@ray-js/components 0.3.27 → 0.3.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/lib/Button/Button.js +6 -48
  2. package/lib/Button/Button.tuya.js +4 -5
  3. package/lib/Button/Button.web.js +6 -48
  4. package/lib/Button/Button.wechat.js +4 -5
  5. package/lib/Button/index.md +10 -10
  6. package/lib/Button/props.d.ts +1 -0
  7. package/lib/Checkbox/Checkbox.d.ts +0 -1
  8. package/lib/Checkbox/Checkbox.js +3 -29
  9. package/lib/Checkbox/Checkbox.web.js +3 -29
  10. package/lib/Checkbox/index.md +7 -6
  11. package/lib/CheckboxGroup/CheckboxGroup.js +45 -2
  12. package/lib/CheckboxGroup/CheckboxGroup.web.js +45 -2
  13. package/lib/CheckboxGroup/index.md +4 -4
  14. package/lib/CheckboxGroup/props.d.ts +3 -2
  15. package/lib/DatePicker/DatePicker.js +55 -4
  16. package/lib/DatePicker/DatePicker.web.js +55 -4
  17. package/lib/DatePicker/index.md +8 -8
  18. package/lib/DatePicker/props.d.ts +2 -0
  19. package/lib/Form/Form.android.js +1 -0
  20. package/lib/Form/Form.d.ts +4 -0
  21. package/lib/Form/Form.ios.js +1 -0
  22. package/lib/Form/Form.js +37 -0
  23. package/lib/Form/Form.native.d.ts +4 -0
  24. package/lib/Form/Form.tuya.d.ts +4 -0
  25. package/lib/Form/Form.tuya.js +8 -0
  26. package/lib/Form/Form.web.js +37 -0
  27. package/lib/Form/Form.wechat.d.ts +4 -0
  28. package/lib/Form/Form.wechat.js +33 -0
  29. package/lib/Form/index.android.js +1 -0
  30. package/lib/Form/index.d.ts +3 -0
  31. package/lib/Form/index.ios.js +1 -0
  32. package/lib/Form/index.js +3 -0
  33. package/lib/Form/index.md +30 -0
  34. package/lib/Form/index.tuya.js +3 -0
  35. package/lib/Form/index.web.js +3 -0
  36. package/lib/Form/index.wechat.js +3 -0
  37. package/lib/Form/props.android.js +1 -0
  38. package/lib/Form/props.d.ts +13 -0
  39. package/lib/Form/props.ios.js +1 -0
  40. package/lib/Form/props.js +1 -0
  41. package/lib/Form/props.tuya.js +1 -0
  42. package/lib/Form/props.web.js +1 -0
  43. package/lib/Form/props.wechat.js +1 -0
  44. package/lib/Icon/index.md +4 -4
  45. package/lib/Image/Image.js +33 -86
  46. package/lib/Image/Image.web.js +33 -86
  47. package/lib/Image/index.md +20 -20
  48. package/lib/Image/props.d.ts +1 -0
  49. package/lib/Input/Input.js +54 -78
  50. package/lib/Input/Input.web.js +54 -78
  51. package/lib/Input/index.md +14 -14
  52. package/lib/Label/Label.android.js +1 -1
  53. package/lib/Label/Label.ios.js +1 -1
  54. package/lib/Label/Label.js +8 -15
  55. package/lib/Label/Label.web.js +8 -15
  56. package/lib/Label/index.md +31 -0
  57. package/lib/Label/props.d.ts +7 -0
  58. package/lib/Motion/Fade/index.js +1 -1
  59. package/lib/Motion/Fade/index.web.js +1 -1
  60. package/lib/Motion/PullUp/index.js +1 -1
  61. package/lib/Motion/PullUp/index.web.js +1 -1
  62. package/lib/Motion/PushDown/index.js +1 -1
  63. package/lib/Motion/PushDown/index.web.js +1 -1
  64. package/lib/Motion/ScaleFadeIn/index.js +1 -1
  65. package/lib/Motion/ScaleFadeIn/index.web.js +1 -1
  66. package/lib/Motion/ScalePullDown/index.js +1 -1
  67. package/lib/Motion/ScalePullDown/index.web.js +1 -1
  68. package/lib/PageContainer/PageContainer.android.js +1 -1
  69. package/lib/PageContainer/PageContainer.d.ts +2 -4
  70. package/lib/PageContainer/PageContainer.ios.js +1 -1
  71. package/lib/PageContainer/PageContainer.js +1 -1
  72. package/lib/PageContainer/PageContainer.web.js +85 -5
  73. package/lib/PageContainer/index.md +19 -19
  74. package/lib/PageContainer/props.d.ts +12 -7
  75. package/lib/Picker/Picker.js +67 -4
  76. package/lib/Picker/Picker.web.js +67 -4
  77. package/lib/Picker/index.md +9 -9
  78. package/lib/Picker/props.d.ts +2 -0
  79. package/lib/PickerView/PickerView.js +69 -4
  80. package/lib/PickerView/PickerView.web.js +69 -4
  81. package/lib/PickerView/index.md +8 -7
  82. package/lib/PickerView/props.d.ts +3 -0
  83. package/lib/PickerViewColumn/PickerViewColumn.android.js +1 -0
  84. package/lib/PickerViewColumn/PickerViewColumn.d.ts +4 -0
  85. package/lib/PickerViewColumn/PickerViewColumn.ios.js +1 -0
  86. package/lib/PickerViewColumn/PickerViewColumn.js +14 -0
  87. package/lib/PickerViewColumn/PickerViewColumn.native.d.ts +31 -0
  88. package/lib/PickerViewColumn/PickerViewColumn.tuya.d.ts +4 -0
  89. package/lib/PickerViewColumn/PickerViewColumn.tuya.js +71 -0
  90. package/lib/PickerViewColumn/PickerViewColumn.web.js +14 -0
  91. package/lib/PickerViewColumn/PickerViewColumn.wechat.d.ts +4 -0
  92. package/lib/PickerViewColumn/PickerViewColumn.wechat.js +72 -0
  93. package/lib/PickerViewColumn/index.android.js +1 -0
  94. package/lib/PickerViewColumn/index.d.ts +3 -0
  95. package/lib/PickerViewColumn/index.ios.js +1 -0
  96. package/lib/PickerViewColumn/index.js +3 -0
  97. package/lib/PickerViewColumn/index.md +21 -0
  98. package/lib/PickerViewColumn/index.module.less +8 -0
  99. package/lib/PickerViewColumn/index.tuya.js +3 -0
  100. package/lib/PickerViewColumn/index.web.js +3 -0
  101. package/lib/PickerViewColumn/index.wechat.js +3 -0
  102. package/lib/PickerViewColumn/props.android.js +1 -0
  103. package/lib/PickerViewColumn/props.d.ts +16 -0
  104. package/lib/PickerViewColumn/props.ios.js +1 -0
  105. package/lib/PickerViewColumn/props.js +1 -0
  106. package/lib/PickerViewColumn/props.tuya.js +1 -0
  107. package/lib/PickerViewColumn/props.web.js +1 -0
  108. package/lib/PickerViewColumn/props.wechat.js +1 -0
  109. package/lib/Radio/Radio.js +3 -6
  110. package/lib/Radio/Radio.web.js +3 -6
  111. package/lib/Radio/index.md +5 -5
  112. package/lib/RadioGroup/RadioGroup.js +50 -2
  113. package/lib/RadioGroup/RadioGroup.web.js +50 -2
  114. package/lib/RadioGroup/index.md +7 -5
  115. package/lib/RadioGroup/props.d.ts +3 -1
  116. package/lib/RichText/RichText.android.js +1 -0
  117. package/lib/RichText/RichText.d.ts +3 -0
  118. package/lib/RichText/RichText.ios.js +1 -0
  119. package/lib/RichText/RichText.js +9 -0
  120. package/lib/RichText/RichText.tuya.js +9 -0
  121. package/lib/RichText/RichText.web.d.ts +4 -0
  122. package/lib/RichText/RichText.web.js +7 -0
  123. package/lib/RichText/RichText.wechat.js +9 -0
  124. package/lib/RichText/index.android.js +1 -0
  125. package/lib/RichText/index.d.ts +3 -0
  126. package/lib/RichText/index.ios.js +1 -0
  127. package/lib/RichText/index.js +3 -0
  128. package/lib/RichText/index.md +117 -0
  129. package/lib/RichText/index.tuya.js +3 -0
  130. package/lib/RichText/index.web.js +3 -0
  131. package/lib/RichText/index.wechat.js +3 -0
  132. package/lib/RichText/props.android.js +0 -0
  133. package/lib/RichText/props.d.ts +29 -0
  134. package/lib/RichText/props.ios.js +0 -0
  135. package/lib/RichText/props.js +1 -0
  136. package/lib/RichText/props.tuya.js +1 -0
  137. package/lib/RichText/props.web.js +1 -0
  138. package/lib/RichText/props.wechat.js +1 -0
  139. package/lib/ScrollView/ScrollView.d.ts +1 -1
  140. package/lib/ScrollView/ScrollView.js +40 -155
  141. package/lib/ScrollView/ScrollView.web.js +40 -155
  142. package/lib/ScrollView/index.md +11 -11
  143. package/lib/Slider/Slider.js +31 -12
  144. package/lib/Slider/Slider.web.js +31 -12
  145. package/lib/Slider/index.md +17 -17
  146. package/lib/Swiper/Swiper.js +61 -2
  147. package/lib/Swiper/Swiper.tuya.js +1 -0
  148. package/lib/Swiper/Swiper.web.js +61 -2
  149. package/lib/Swiper/Swiper.wechat.js +1 -0
  150. package/lib/Swiper/index.md +14 -14
  151. package/lib/Switch/Switch.js +20 -6
  152. package/lib/Switch/Switch.web.js +20 -6
  153. package/lib/Switch/index.md +6 -6
  154. package/lib/Text/Text.js +6 -34
  155. package/lib/Text/Text.web.js +6 -34
  156. package/lib/Text/index.md +6 -6
  157. package/lib/TimePicker/TimePicker.js +35 -4
  158. package/lib/TimePicker/TimePicker.web.js +35 -4
  159. package/lib/TimePicker/index.md +9 -9
  160. package/lib/TimePicker/props.d.ts +2 -0
  161. package/lib/View/View.js +6 -5
  162. package/lib/View/View.web.js +6 -5
  163. package/lib/View/index.md +10 -10
  164. package/lib/index.android.js +1 -1
  165. package/lib/index.d.ts +3 -0
  166. package/lib/index.ios.js +1 -1
  167. package/lib/index.js +3 -0
  168. package/lib/index.tuya.js +3 -0
  169. package/lib/index.web.js +3 -0
  170. package/lib/index.wechat.js +3 -0
  171. package/lib/utils/handleProps.android.js +1 -0
  172. package/lib/utils/handleProps.d.ts +5 -0
  173. package/lib/utils/handleProps.ios.js +1 -0
  174. package/lib/utils/handleProps.js +50 -0
  175. package/lib/utils/handleProps.tuya.js +50 -0
  176. package/lib/utils/handleProps.web.js +50 -0
  177. package/lib/utils/handleProps.wechat.js +50 -0
  178. package/package.json +7 -5
@@ -1,55 +1,13 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
- var _excluded = ["style", "className", "hoverClassName", "hoverStartTime", "hoverStayTime", "htmlType", "onClick", "onTouchCancel", "onTouchEnd", "onTouchMove", "onTouchStart", "size", "loading", "disabled"];
6
1
  import * as React from 'react';
7
- import clsx from 'clsx';
8
- import { inlineStyle, useTouch } from '@ray-js/framework-shared';
9
2
  import { defaultButtonProps } from './props';
10
- import styles from './index.module.less';
3
+ import handleProps from '../utils/handleProps';
11
4
 
12
5
  var Button = function (props) {
13
- var style = props.style,
14
- className = props.className,
15
- _props$hoverClassName = props.hoverClassName,
16
- hoverClassName = _props$hoverClassName === void 0 ? styles["button-hover"] : _props$hoverClassName,
17
- hoverStartTime = props.hoverStartTime,
18
- hoverStayTime = props.hoverStayTime,
19
- htmlType = props.htmlType,
20
- onClick = props.onClick,
21
- onTouchCancel = props.onTouchCancel,
22
- onTouchEnd = props.onTouchEnd,
23
- onTouchMove = props.onTouchMove,
24
- onTouchStart = props.onTouchStart,
25
- size = props.size,
26
- loading = props.loading,
27
- disabled = props.disabled,
28
- restProps = _objectWithoutProperties(props, _excluded);
29
-
30
- var _useTouch = useTouch({
31
- hoverDelay: hoverStartTime,
32
- hoverDuration: hoverStayTime,
33
- onTouchStart: onTouchStart,
34
- onTouchMove: onTouchMove,
35
- onTouchEnd: onTouchEnd,
36
- onTouchCancel: onTouchCancel
37
- }),
38
- _useTouch2 = _slicedToArray(_useTouch, 2),
39
- touching = _useTouch2[0],
40
- handlers = _useTouch2[1];
41
-
42
- return /*#__PURE__*/React.createElement("button", _extends({
43
- disabled: disabled,
44
- style: inlineStyle(style),
45
- className: clsx('ray-button', styles.button, styles["button-".concat(size)], _defineProperty({}, styles['button-loading'], loading), touching && hoverClassName, className),
46
- onClick: function (e) {
47
- if (disabled) return;
48
- if (loading) return;
49
- onClick === null || onClick === void 0 ? void 0 : onClick(e);
50
- },
51
- type: htmlType
52
- }, handlers, restProps));
6
+ return (
7
+ /*#__PURE__*/
8
+ // @ts-ignore
9
+ React.createElement("ty-button", handleProps(props), props.children)
10
+ );
53
11
  };
54
12
 
55
13
  Button.defaultProps = defaultButtonProps;
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["style", "id", "className", "disabled", "loading", "onClick", "hoverClassName", "size", "children", "htmlType"];
3
+ var _excluded = ["style", "id", "className", "disabled", "loading", "onClick", "hoverClassName", "size", "formType"];
4
4
  import * as React from 'react';
5
5
  import clsx from 'clsx';
6
6
  import { inlineStyle } from '@ray-js/framework-shared';
@@ -17,8 +17,7 @@ var Button = function (props) {
17
17
  hoverClassName = props.hoverClassName,
18
18
  _props$size = props.size,
19
19
  size = _props$size === void 0 ? 'default' : _props$size,
20
- children = props.children,
21
- htmlType = props.htmlType,
20
+ formType = props.formType,
22
21
  restProps = _objectWithoutProperties(props, _excluded);
23
22
 
24
23
  return /*#__PURE__*/React.createElement(RemaxButton, _extends({
@@ -34,8 +33,8 @@ var Button = function (props) {
34
33
  disabled: disabled,
35
34
  size: size,
36
35
  loading: loading,
37
- formType: htmlType
38
- }, restProps), children);
36
+ formType: formType
37
+ }, restProps));
39
38
  };
40
39
 
41
40
  Button.defaultProps = defaultButtonProps;
@@ -1,55 +1,13 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
- var _excluded = ["style", "className", "hoverClassName", "hoverStartTime", "hoverStayTime", "htmlType", "onClick", "onTouchCancel", "onTouchEnd", "onTouchMove", "onTouchStart", "size", "loading", "disabled"];
6
1
  import * as React from 'react';
7
- import clsx from 'clsx';
8
- import { inlineStyle, useTouch } from '@ray-js/framework-shared';
9
2
  import { defaultButtonProps } from './props';
10
- import styles from './index.module.less';
3
+ import handleProps from '../utils/handleProps';
11
4
 
12
5
  var Button = function (props) {
13
- var style = props.style,
14
- className = props.className,
15
- _props$hoverClassName = props.hoverClassName,
16
- hoverClassName = _props$hoverClassName === void 0 ? styles["button-hover"] : _props$hoverClassName,
17
- hoverStartTime = props.hoverStartTime,
18
- hoverStayTime = props.hoverStayTime,
19
- htmlType = props.htmlType,
20
- onClick = props.onClick,
21
- onTouchCancel = props.onTouchCancel,
22
- onTouchEnd = props.onTouchEnd,
23
- onTouchMove = props.onTouchMove,
24
- onTouchStart = props.onTouchStart,
25
- size = props.size,
26
- loading = props.loading,
27
- disabled = props.disabled,
28
- restProps = _objectWithoutProperties(props, _excluded);
29
-
30
- var _useTouch = useTouch({
31
- hoverDelay: hoverStartTime,
32
- hoverDuration: hoverStayTime,
33
- onTouchStart: onTouchStart,
34
- onTouchMove: onTouchMove,
35
- onTouchEnd: onTouchEnd,
36
- onTouchCancel: onTouchCancel
37
- }),
38
- _useTouch2 = _slicedToArray(_useTouch, 2),
39
- touching = _useTouch2[0],
40
- handlers = _useTouch2[1];
41
-
42
- return /*#__PURE__*/React.createElement("button", _extends({
43
- disabled: disabled,
44
- style: inlineStyle(style),
45
- className: clsx('ray-button', styles.button, styles["button-".concat(size)], _defineProperty({}, styles['button-loading'], loading), touching && hoverClassName, className),
46
- onClick: function (e) {
47
- if (disabled) return;
48
- if (loading) return;
49
- onClick === null || onClick === void 0 ? void 0 : onClick(e);
50
- },
51
- type: htmlType
52
- }, handlers, restProps));
6
+ return (
7
+ /*#__PURE__*/
8
+ // @ts-ignore
9
+ React.createElement("ty-button", handleProps(props), props.children)
10
+ );
53
11
  };
54
12
 
55
13
  Button.defaultProps = defaultButtonProps;
@@ -1,7 +1,7 @@
1
1
  import { Button as _Button } from "@remax/wechat/esm/hostComponents/Button/index";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
- var _excluded = ["style", "id", "className", "disabled", "loading", "onClick", "hoverClassName", "size", "children", "htmlType"];
4
+ var _excluded = ["style", "id", "className", "disabled", "loading", "onClick", "hoverClassName", "size", "formType"];
5
5
  import * as React from 'react';
6
6
  import clsx from 'clsx';
7
7
  import { inlineStyle } from '@ray-js/framework-shared';
@@ -18,8 +18,7 @@ var Button = function (props) {
18
18
  hoverClassName = props.hoverClassName,
19
19
  _props$size = props.size,
20
20
  size = _props$size === void 0 ? 'default' : _props$size,
21
- children = props.children,
22
- htmlType = props.htmlType,
21
+ formType = props.formType,
23
22
  restProps = _objectWithoutProperties(props, _excluded);
24
23
 
25
24
  return /*#__PURE__*/React.createElement(_Button, _extends({
@@ -33,10 +32,10 @@ var Button = function (props) {
33
32
  onClick === null || onClick === void 0 ? void 0 : onClick(event);
34
33
  },
35
34
  disabled: disabled,
36
- formType: htmlType,
35
+ formType: formType,
37
36
  loading: loading,
38
37
  size: size
39
- }, restProps), children);
38
+ }, restProps));
40
39
  };
41
40
 
42
41
  Button.defaultProps = defaultButtonProps;
@@ -13,7 +13,7 @@ group:
13
13
  ## 导入
14
14
 
15
15
  ```js
16
- import { Button } from '@ray-js/components';
16
+ import { Button } from '@ray-js/components'
17
17
  ```
18
18
 
19
19
  ## 示例代码
@@ -27,15 +27,15 @@ import { Button } from '@ray-js/components';
27
27
 
28
28
  | 属性 | 类型 | 默认值 | 必填 | 说明 | 支持平台 |
29
29
  | --- | --- | --- | --- | --- | --- |
30
- | size | keyof Size | default | 否 | 按钮的大小 | RN、涂鸦、微信 |
31
- | type | keyof Type | default | 否 | 按钮的样式类型 | RN、涂鸦、微信 |
32
- | plain | boolean | false | 否 | 按钮是否镂空,背景色透明 | RN、涂鸦、微信 |
33
- | disabled | boolean | false | 否 | 是否禁用 | RN、涂鸦、微信 |
34
- | loading | boolean | false | 否 | 名称前是否带 loading 图标 | RN、涂鸦、微信 |
35
- | formType | keyof FormType | | 否 | 用于 form 组件,点击分别会触发 form 组件的 submit/reset 事件 | 涂鸦、微信 |
30
+ | size | keyof Size | default | 否 | 按钮的大小 | RN、涂鸦、微信、Web |
31
+ | type | keyof Type | default | 否 | 按钮的样式类型 | RN、涂鸦、微信、Web |
32
+ | plain | boolean | false | 否 | 按钮是否镂空,背景色透明 | RN、涂鸦、微信、Web |
33
+ | disabled | boolean | false | 否 | 是否禁用 | RN、涂鸦、微信、Web |
34
+ | loading | boolean | false | 否 | 名称前是否带 loading 图标 | RN、涂鸦、微信、Web |
35
+ | formType | keyof FormType | | 否 | 用于 form 组件,点击分别会触发 form 组件的 submit/reset 事件 | 涂鸦、微信、Web |
36
36
  | openType | OpenType | | 否 | 微信开放能力 | 微信 |
37
- | hoverClassName | string | button-hover | 否 | 指定按下去的样式类。当 hover-class="none" 时,没有点击态效果 | 涂鸦、微信、RN |
37
+ | hoverClassName | string | button-hover | 否 | 指定按下去的样式类。当 hover-class="none" 时,没有点击态效果 | 涂鸦、微信、RN、Web |
38
38
  | hoverStyle | StyleProp ViewStyle | none | 否 | 由于 RN 不支持 Class,故 RN 端的 Button 组件实现了 hoverStyle 属性,写法和 style 类似,只不过 hoverStyle 的样式是指定按下去的样式。 | RN |
39
39
  | hoverStopPropagation | boolean | false | 否 | 指定是否阻止本节点的祖先节点出现点击态 | 微信 |
40
- | hoverStartTime | number | 20 | 否 | 按住后多久出现点击态,单位毫秒 | RN、涂鸦、微信 |
41
- | hoverStayTime | number | 70 | 否 | 手指松开后点击态保留时间,单位毫秒 | RN、涂鸦、微信 |
40
+ | hoverStartTime | number | 20 | 否 | 按住后多久出现点击态,单位毫秒 | RN、涂鸦、微信、Web |
41
+ | hoverStayTime | number | 70 | 否 | 手指松开后点击态保留时间,单位毫秒 | RN、涂鸦、微信、Web |
@@ -14,5 +14,6 @@ export interface ButtonProps extends BaseProps {
14
14
  type: 'click';
15
15
  }) => void;
16
16
  children?: React.ReactNode;
17
+ formType?: 'submit' | 'reset';
17
18
  }
18
19
  export declare const defaultButtonProps: ButtonProps;
@@ -1,5 +1,4 @@
1
1
  import * as React from 'react';
2
- import 'antd-mobile/es/components/checkbox/checkbox.css';
3
2
  import { CheckboxProps } from './props';
4
3
  declare const Checkbox: React.FC<CheckboxProps>;
5
4
  export default Checkbox;
@@ -1,35 +1,9 @@
1
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
1
  import * as React from 'react';
3
- import clsx from 'clsx';
4
- import AntdCheckbox from 'antd-mobile/es/components/checkbox';
5
- import CheckOutline from 'antd-mobile-icons/es/CheckOutline';
6
- import 'antd-mobile/es/components/checkbox/checkbox.css';
7
- import { inlineStyle } from '@ray-js/framework-shared';
8
- import styles from './index.module.less';
2
+ import handleProps from '../utils/handleProps';
9
3
 
10
4
  var Checkbox = function (props) {
11
- var checked = props.checked,
12
- disabled = props.disabled,
13
- color = props.color,
14
- className = props.className,
15
- style = props.style;
16
- return /*#__PURE__*/React.createElement(AntdCheckbox, {
17
- style: inlineStyle(_objectSpread({
18
- backgroundColor: disabled ? '#dadada' : '#ffffff'
19
- }, style)),
20
- disabled: disabled,
21
- defaultChecked: checked,
22
- className: clsx(styles.checkboxWrapper, className),
23
- icon: function icon(checked) {
24
- return /*#__PURE__*/React.createElement(CheckOutline, {
25
- className: styles.icon,
26
- color: color || (disabled ? '#9d9d9d' : '#76c6b8'),
27
- style: {
28
- visibility: checked ? 'visible' : 'hidden'
29
- }
30
- });
31
- }
32
- });
5
+ // @ts-ignore
6
+ return /*#__PURE__*/React.createElement("ty-checkbox", handleProps(props));
33
7
  };
34
8
 
35
9
  Checkbox.displayName = 'Checkbox';
@@ -1,35 +1,9 @@
1
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
1
  import * as React from 'react';
3
- import clsx from 'clsx';
4
- import AntdCheckbox from 'antd-mobile/es/components/checkbox';
5
- import CheckOutline from 'antd-mobile-icons/es/CheckOutline';
6
- import 'antd-mobile/es/components/checkbox/checkbox.css';
7
- import { inlineStyle } from '@ray-js/framework-shared';
8
- import styles from './index.module.less';
2
+ import handleProps from '../utils/handleProps';
9
3
 
10
4
  var Checkbox = function (props) {
11
- var checked = props.checked,
12
- disabled = props.disabled,
13
- color = props.color,
14
- className = props.className,
15
- style = props.style;
16
- return /*#__PURE__*/React.createElement(AntdCheckbox, {
17
- style: inlineStyle(_objectSpread({
18
- backgroundColor: disabled ? '#dadada' : '#ffffff'
19
- }, style)),
20
- disabled: disabled,
21
- defaultChecked: checked,
22
- className: clsx(styles.checkboxWrapper, className),
23
- icon: function icon(checked) {
24
- return /*#__PURE__*/React.createElement(CheckOutline, {
25
- className: styles.icon,
26
- color: color || (disabled ? '#9d9d9d' : '#76c6b8'),
27
- style: {
28
- visibility: checked ? 'visible' : 'hidden'
29
- }
30
- });
31
- }
32
- });
5
+ // @ts-ignore
6
+ return /*#__PURE__*/React.createElement("ty-checkbox", handleProps(props));
33
7
  };
34
8
 
35
9
  Checkbox.displayName = 'Checkbox';
@@ -13,13 +13,14 @@ group:
13
13
  ## 导入
14
14
 
15
15
  ```js
16
- import { Checkbox } from '@ray-js/components';
16
+ import { Checkbox } from '@ray-js/components'
17
17
  ```
18
18
 
19
19
  ## 示例代码
20
20
 
21
21
  <code src="./demos/basic.tsx" title="基本使用" background="#f2f4f6"/>
22
- <code src="./demos/checkboxGroup.tsx" title="checkboxGroup" background="#f2f4f6"/>
22
+ <code src="./demos/checkboxGroup.tsx" title="多项选择器组 - 选项" background="#f2f4f6"/>
23
+ <code src="./demos/checkboxGroupChildren.tsx" title="多项选择器组 - 子节点 (仅 Web 端)" background="#f2f4f6"/>
23
24
  <code src="./demos/checked.tsx" title="默认选中" background="#f2f4f6"/>
24
25
  <code src="./demos/disabled.tsx" title="disabled" background="#f2f4f6"/>
25
26
 
@@ -27,7 +28,7 @@ import { Checkbox } from '@ray-js/components';
27
28
 
28
29
  | 属性 | 类型 | 默认值 | 说明 | 支持平台 |
29
30
  | --- | --- | --- | --- | --- |
30
- | value | string | | checkbox 标识,选中时触发 checkbox-group 的 change 事件,并携带 checkbox 的 value | RN、微信、涂鸦 |
31
- | disabled | boolean | false | 是否禁用 | RN、微信、涂鸦 |
32
- | checked | boolean | false | 当前是否选中,可用来设置默认选中 | RN、微信、涂鸦 |
33
- | color | string | '#007AFF' | checkbox 的颜色,同 css 的 color | RN、微信、涂鸦 |
31
+ | value | string | | checkbox 标识,选中时触发 checkbox-group 的 change 事件,并携带 checkbox 的 value | RN、微信、涂鸦、Web |
32
+ | disabled | boolean | false | 是否禁用 | RN、微信、涂鸦、Web |
33
+ | checked | boolean | false | 当前是否选中,可用来设置默认选中 | RN、微信、涂鸦、Web |
34
+ | color | string | '#007AFF' | checkbox 的颜色,同 css 的 color | RN、微信、涂鸦、Web |
@@ -1,8 +1,51 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import "core-js/modules/es.function.name.js";
3
+ import "core-js/modules/es.array.map.js";
1
4
  import * as React from 'react';
5
+ import handleProps from '../utils/handleProps';
6
+ import Label from '../Label';
7
+ import CheckBox from '../Checkbox';
8
+ import { useEventListener } from 'ahooks';
2
9
 
3
10
  var CheckboxGroup = function (props) {
4
- props.onChange;
5
- return /*#__PURE__*/React.createElement("div", null, "\u6682\u672A\u5B9E\u73B0");
11
+ var options = props.options,
12
+ name = props.name,
13
+ disabled = props.disabled,
14
+ _props$onChange = props.onChange,
15
+ onChange = _props$onChange === void 0 ? function () {} : _props$onChange,
16
+ children = props.children;
17
+ var currentNode = React.useRef(null);
18
+ useEventListener('clickoverlay', function (e) {
19
+ var _props$onChange2;
20
+
21
+ (_props$onChange2 = props.onChange) === null || _props$onChange2 === void 0 ? void 0 : _props$onChange2.call(props, {
22
+ type: e.type,
23
+ value: e.detail.value,
24
+ origin: e
25
+ });
26
+ }, {
27
+ target: currentNode
28
+ });
29
+ return (
30
+ /*#__PURE__*/
31
+ // @ts-ignore
32
+ React.createElement("ty-checkbox-group", _extends({
33
+ ref: currentNode
34
+ }, handleProps(props)), children || function renderOptions() {
35
+ return options.map(function (item, index) {
36
+ var _item$checked;
37
+
38
+ return /*#__PURE__*/React.createElement(Label, {
39
+ key: index + '_' + item.value
40
+ }, /*#__PURE__*/React.createElement(CheckBox, {
41
+ value: item.value,
42
+ checked: (_item$checked = item.checked) !== null && _item$checked !== void 0 ? _item$checked : false,
43
+ disabled: disabled || item.disabled || false,
44
+ color: item.color
45
+ }), item.label);
46
+ });
47
+ }())
48
+ );
6
49
  };
7
50
 
8
51
  CheckboxGroup.displayName = 'CheckboxGroup';
@@ -1,8 +1,51 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import "core-js/modules/es.function.name.js";
3
+ import "core-js/modules/es.array.map.js";
1
4
  import * as React from 'react';
5
+ import handleProps from '../utils/handleProps';
6
+ import Label from '../Label';
7
+ import CheckBox from '../Checkbox';
8
+ import { useEventListener } from 'ahooks';
2
9
 
3
10
  var CheckboxGroup = function (props) {
4
- props.onChange;
5
- return /*#__PURE__*/React.createElement("div", null, "\u6682\u672A\u5B9E\u73B0");
11
+ var options = props.options,
12
+ name = props.name,
13
+ disabled = props.disabled,
14
+ _props$onChange = props.onChange,
15
+ onChange = _props$onChange === void 0 ? function () {} : _props$onChange,
16
+ children = props.children;
17
+ var currentNode = React.useRef(null);
18
+ useEventListener('clickoverlay', function (e) {
19
+ var _props$onChange2;
20
+
21
+ (_props$onChange2 = props.onChange) === null || _props$onChange2 === void 0 ? void 0 : _props$onChange2.call(props, {
22
+ type: e.type,
23
+ value: e.detail.value,
24
+ origin: e
25
+ });
26
+ }, {
27
+ target: currentNode
28
+ });
29
+ return (
30
+ /*#__PURE__*/
31
+ // @ts-ignore
32
+ React.createElement("ty-checkbox-group", _extends({
33
+ ref: currentNode
34
+ }, handleProps(props)), children || function renderOptions() {
35
+ return options.map(function (item, index) {
36
+ var _item$checked;
37
+
38
+ return /*#__PURE__*/React.createElement(Label, {
39
+ key: index + '_' + item.value
40
+ }, /*#__PURE__*/React.createElement(CheckBox, {
41
+ value: item.value,
42
+ checked: (_item$checked = item.checked) !== null && _item$checked !== void 0 ? _item$checked : false,
43
+ disabled: disabled || item.disabled || false,
44
+ color: item.color
45
+ }), item.label);
46
+ });
47
+ }())
48
+ );
6
49
  };
7
50
 
8
51
  CheckboxGroup.displayName = 'CheckboxGroup';
@@ -13,16 +13,16 @@ group:
13
13
  ## 导入
14
14
 
15
15
  ```js
16
- import { CheckboxGroup } from '@ray-js/components';
16
+ import { CheckboxGroup } from '@ray-js/components'
17
17
  ```
18
18
 
19
19
  ## Props
20
20
 
21
21
  | 属性 | 类型 | 是否必填 | 默认值 | 说明 | 支持平台 |
22
22
  | --- | --- | --- | --- | --- | --- |
23
- | options | CheckboxOption[] | 是 | | 群组项 | 涂鸦、微信、RN |
24
- | disabled | boolean | 否 | false | 是否禁用 | 涂鸦、微信、RN |
25
- | onChange | (event: { type: 'change'; value: string[] }) => void | 否 | | 选中项发生改变时触发 change 事件 | 涂鸦、微信、RN |
23
+ | options | CheckboxOption[] | 是 | | 群组项 (Web 端非必填) | 涂鸦、微信、RN、Web |
24
+ | disabled | boolean | 否 | false | 是否禁用 | 涂鸦、微信、RN、Web |
25
+ | onChange | (event: { type: 'change'; value: string[] }) => void | 否 | | 选中项发生改变时触发 change 事件 | 涂鸦、微信、RN、Web |
26
26
 
27
27
  ### CheckboxOption
28
28
 
@@ -4,10 +4,11 @@ export declare type CheckboxGroupOption = CheckboxProps & {
4
4
  label: string;
5
5
  };
6
6
  export interface CheckboxGroupProps extends BaseProps, TouchEventHandler {
7
- options: CheckboxGroupOption[];
7
+ options?: CheckboxGroupOption[];
8
8
  disabled?: boolean;
9
9
  onChange?: (event: {
10
- type: 'change';
10
+ type: string;
11
11
  value: string[];
12
+ origin: any;
12
13
  }) => void;
13
14
  }
@@ -1,9 +1,60 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
1
3
  import * as React from 'react';
4
+ import { useTouch } from '@ray-js/framework-shared';
5
+ import { useEventListener } from 'ahooks';
6
+ import handleProps from '../utils/handleProps';
2
7
 
3
- // import styles from './index.module.less';
4
- var DatePicker = function () {
5
- // const { disabled, className, style } = props;
6
- return /*#__PURE__*/React.createElement("div", null, "\u6682\u672A\u5B9E\u73B011");
8
+ var DatePicker = function (props) {
9
+ var children = props.children,
10
+ onLongClick = props.onLongClick,
11
+ onTouchStart = props.onTouchStart,
12
+ onTouchMove = props.onTouchMove,
13
+ onTouchEnd = props.onTouchEnd,
14
+ onTouchCancel = props.onTouchCancel,
15
+ onClick = props.onClick;
16
+ var currentNode = React.useRef(null);
17
+ useEventListener('change', function (e) {
18
+ var _props$onChange;
19
+
20
+ (_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, {
21
+ type: e.type,
22
+ value: e.detail.value,
23
+ origin: e
24
+ });
25
+ }, {
26
+ target: currentNode
27
+ });
28
+ useEventListener('cancel', function (e) {
29
+ var _props$onCancel;
30
+
31
+ (_props$onCancel = props.onCancel) === null || _props$onCancel === void 0 ? void 0 : _props$onCancel.call(props, {
32
+ type: e.type,
33
+ origin: e
34
+ });
35
+ }, {
36
+ target: currentNode
37
+ });
38
+
39
+ var _useTouch = useTouch({
40
+ onLongClick: onLongClick,
41
+ onTouchStart: onTouchStart,
42
+ onTouchMove: onTouchMove,
43
+ onTouchEnd: onTouchEnd,
44
+ onTouchCancel: onTouchCancel,
45
+ onClick: onClick
46
+ }),
47
+ _useTouch2 = _slicedToArray(_useTouch, 2),
48
+ handlers = _useTouch2[1];
49
+
50
+ return (
51
+ /*#__PURE__*/
52
+ // @ts-ignore
53
+ React.createElement("ty-picker", _extends({}, handleProps(props), handlers, {
54
+ ref: currentNode,
55
+ mode: "date"
56
+ }), children)
57
+ );
7
58
  };
8
59
 
9
60
  DatePicker.displayName = 'DatePicker';
@@ -1,9 +1,60 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
1
3
  import * as React from 'react';
4
+ import { useTouch } from '@ray-js/framework-shared';
5
+ import { useEventListener } from 'ahooks';
6
+ import handleProps from '../utils/handleProps';
2
7
 
3
- // import styles from './index.module.less';
4
- var DatePicker = function () {
5
- // const { disabled, className, style } = props;
6
- return /*#__PURE__*/React.createElement("div", null, "\u6682\u672A\u5B9E\u73B011");
8
+ var DatePicker = function (props) {
9
+ var children = props.children,
10
+ onLongClick = props.onLongClick,
11
+ onTouchStart = props.onTouchStart,
12
+ onTouchMove = props.onTouchMove,
13
+ onTouchEnd = props.onTouchEnd,
14
+ onTouchCancel = props.onTouchCancel,
15
+ onClick = props.onClick;
16
+ var currentNode = React.useRef(null);
17
+ useEventListener('change', function (e) {
18
+ var _props$onChange;
19
+
20
+ (_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, {
21
+ type: e.type,
22
+ value: e.detail.value,
23
+ origin: e
24
+ });
25
+ }, {
26
+ target: currentNode
27
+ });
28
+ useEventListener('cancel', function (e) {
29
+ var _props$onCancel;
30
+
31
+ (_props$onCancel = props.onCancel) === null || _props$onCancel === void 0 ? void 0 : _props$onCancel.call(props, {
32
+ type: e.type,
33
+ origin: e
34
+ });
35
+ }, {
36
+ target: currentNode
37
+ });
38
+
39
+ var _useTouch = useTouch({
40
+ onLongClick: onLongClick,
41
+ onTouchStart: onTouchStart,
42
+ onTouchMove: onTouchMove,
43
+ onTouchEnd: onTouchEnd,
44
+ onTouchCancel: onTouchCancel,
45
+ onClick: onClick
46
+ }),
47
+ _useTouch2 = _slicedToArray(_useTouch, 2),
48
+ handlers = _useTouch2[1];
49
+
50
+ return (
51
+ /*#__PURE__*/
52
+ // @ts-ignore
53
+ React.createElement("ty-picker", _extends({}, handleProps(props), handlers, {
54
+ ref: currentNode,
55
+ mode: "date"
56
+ }), children)
57
+ );
7
58
  };
8
59
 
9
60
  DatePicker.displayName = 'DatePicker';
@@ -13,7 +13,7 @@ group:
13
13
  ## 导入
14
14
 
15
15
  ```js
16
- import { DatePicker } from '@ray-js/components';
16
+ import { DatePicker } from '@ray-js/components'
17
17
  ```
18
18
 
19
19
  ## 示例代码
@@ -27,10 +27,10 @@ import { DatePicker } from '@ray-js/components';
27
27
 
28
28
  | 属性 | 类型 | 默认值 | 必填 | 说明 | 支持平台 |
29
29
  | --- | --- | --- | --- | --- | --- |
30
- | disabled | boolean | false | 否 | 是否禁用 | RN、涂鸦、微信 |
31
- | value | string | | 否 | 当前选择的日期 | RN、涂鸦、微信 |
32
- | onChange | func(event) | | 否 | 选择时触发 | RN、涂鸦、微信 |
33
- | onCancel | func(event) | | 否 | 取消选择时触发 | RN、涂鸦、微信 |
34
- | start | string | | 否 | 表示有效日期范围的开始,字符串格式为"YYYY-MM-DD" | RN、涂鸦、微信 |
35
- | end | string | | 否 | 表示有效日期范围的结束,字符串格式为"YYYY-MM-DD" | RN、涂鸦、微信 |
36
- | fields | string | day | 否 | 有效值 year,month,day,表示选择器的粒度 | RN、涂鸦、微信 |
30
+ | disabled | boolean | false | 否 | 是否禁用 | RN、涂鸦、微信、Web |
31
+ | value | string | | 否 | 当前选择的日期 | RN、涂鸦、微信、Web |
32
+ | onChange | func(event) | | 否 | 选择时触发 | RN、涂鸦、微信、Web |
33
+ | onCancel | func(event) | | 否 | 取消选择时触发 | RN、涂鸦、微信、Web |
34
+ | start | string | | 否 | 表示有效日期范围的开始,字符串格式为"YYYY-MM-DD" | RN、涂鸦、微信、Web |
35
+ | end | string | | 否 | 表示有效日期范围的结束,字符串格式为"YYYY-MM-DD" | RN、涂鸦、微信、Web |
36
+ | fields | string | day | 否 | 有效值 year,month,day,表示选择器的粒度 | RN、涂鸦、微信、Web |