@ray-js/components 0.3.29 → 0.4.0

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 (173) hide show
  1. package/lib/Button/Button.js +6 -50
  2. package/lib/Button/Button.web.js +6 -50
  3. package/lib/Button/index.md +10 -10
  4. package/lib/Checkbox/Checkbox.d.ts +0 -1
  5. package/lib/Checkbox/Checkbox.js +3 -29
  6. package/lib/Checkbox/Checkbox.web.js +3 -29
  7. package/lib/Checkbox/index.md +7 -6
  8. package/lib/CheckboxGroup/CheckboxGroup.js +45 -2
  9. package/lib/CheckboxGroup/CheckboxGroup.web.js +45 -2
  10. package/lib/CheckboxGroup/index.md +4 -4
  11. package/lib/CheckboxGroup/props.d.ts +3 -2
  12. package/lib/DatePicker/DatePicker.js +55 -4
  13. package/lib/DatePicker/DatePicker.web.js +55 -4
  14. package/lib/DatePicker/index.md +8 -8
  15. package/lib/DatePicker/props.d.ts +2 -0
  16. package/lib/Form/Form.android.js +1 -0
  17. package/lib/Form/Form.d.ts +4 -0
  18. package/lib/Form/Form.ios.js +1 -0
  19. package/lib/Form/Form.js +37 -0
  20. package/lib/Form/Form.native.d.ts +4 -0
  21. package/lib/Form/Form.tuya.d.ts +4 -0
  22. package/lib/Form/Form.tuya.js +8 -0
  23. package/lib/Form/Form.web.js +37 -0
  24. package/lib/Form/Form.wechat.d.ts +4 -0
  25. package/lib/Form/Form.wechat.js +33 -0
  26. package/lib/Form/index.android.js +1 -0
  27. package/lib/Form/index.d.ts +3 -0
  28. package/lib/Form/index.ios.js +1 -0
  29. package/lib/Form/index.js +3 -0
  30. package/lib/Form/index.md +30 -0
  31. package/lib/Form/index.tuya.js +3 -0
  32. package/lib/Form/index.web.js +3 -0
  33. package/lib/Form/index.wechat.js +3 -0
  34. package/lib/Form/props.android.js +1 -0
  35. package/lib/Form/props.d.ts +13 -0
  36. package/lib/Form/props.ios.js +1 -0
  37. package/lib/Form/props.js +1 -0
  38. package/lib/Form/props.tuya.js +1 -0
  39. package/lib/Form/props.web.js +1 -0
  40. package/lib/Form/props.wechat.js +1 -0
  41. package/lib/Icon/index.md +4 -4
  42. package/lib/Image/Image.js +33 -86
  43. package/lib/Image/Image.web.js +33 -86
  44. package/lib/Image/index.md +20 -20
  45. package/lib/Image/props.d.ts +1 -0
  46. package/lib/Input/Input.js +54 -78
  47. package/lib/Input/Input.web.js +54 -78
  48. package/lib/Input/index.md +14 -14
  49. package/lib/Label/Label.android.js +1 -1
  50. package/lib/Label/Label.ios.js +1 -1
  51. package/lib/Label/Label.js +8 -15
  52. package/lib/Label/Label.web.js +8 -15
  53. package/lib/Label/index.md +31 -0
  54. package/lib/Label/props.d.ts +7 -0
  55. package/lib/Motion/Fade/index.js +1 -1
  56. package/lib/Motion/Fade/index.web.js +1 -1
  57. package/lib/Motion/PullUp/index.js +1 -1
  58. package/lib/Motion/PullUp/index.web.js +1 -1
  59. package/lib/Motion/PushDown/index.js +1 -1
  60. package/lib/Motion/PushDown/index.web.js +1 -1
  61. package/lib/Motion/ScaleFadeIn/index.js +1 -1
  62. package/lib/Motion/ScaleFadeIn/index.web.js +1 -1
  63. package/lib/Motion/ScalePullDown/index.js +1 -1
  64. package/lib/Motion/ScalePullDown/index.web.js +1 -1
  65. package/lib/PageContainer/PageContainer.android.js +1 -1
  66. package/lib/PageContainer/PageContainer.d.ts +2 -4
  67. package/lib/PageContainer/PageContainer.ios.js +1 -1
  68. package/lib/PageContainer/PageContainer.js +1 -1
  69. package/lib/PageContainer/PageContainer.web.js +85 -5
  70. package/lib/PageContainer/index.md +19 -19
  71. package/lib/PageContainer/props.d.ts +12 -7
  72. package/lib/Picker/Picker.js +67 -4
  73. package/lib/Picker/Picker.web.js +67 -4
  74. package/lib/Picker/index.md +9 -9
  75. package/lib/Picker/props.d.ts +2 -0
  76. package/lib/PickerView/PickerView.js +69 -4
  77. package/lib/PickerView/PickerView.web.js +69 -4
  78. package/lib/PickerView/index.md +8 -7
  79. package/lib/PickerView/props.d.ts +3 -0
  80. package/lib/PickerViewColumn/PickerViewColumn.android.js +1 -0
  81. package/lib/PickerViewColumn/PickerViewColumn.d.ts +4 -0
  82. package/lib/PickerViewColumn/PickerViewColumn.ios.js +1 -0
  83. package/lib/PickerViewColumn/PickerViewColumn.js +14 -0
  84. package/lib/PickerViewColumn/PickerViewColumn.native.d.ts +31 -0
  85. package/lib/PickerViewColumn/PickerViewColumn.tuya.d.ts +4 -0
  86. package/lib/PickerViewColumn/PickerViewColumn.tuya.js +71 -0
  87. package/lib/PickerViewColumn/PickerViewColumn.web.js +14 -0
  88. package/lib/PickerViewColumn/PickerViewColumn.wechat.d.ts +4 -0
  89. package/lib/PickerViewColumn/PickerViewColumn.wechat.js +72 -0
  90. package/lib/PickerViewColumn/index.android.js +1 -0
  91. package/lib/PickerViewColumn/index.d.ts +3 -0
  92. package/lib/PickerViewColumn/index.ios.js +1 -0
  93. package/lib/PickerViewColumn/index.js +3 -0
  94. package/lib/PickerViewColumn/index.md +21 -0
  95. package/lib/PickerViewColumn/index.module.less +8 -0
  96. package/lib/PickerViewColumn/index.tuya.js +3 -0
  97. package/lib/PickerViewColumn/index.web.js +3 -0
  98. package/lib/PickerViewColumn/index.wechat.js +3 -0
  99. package/lib/PickerViewColumn/props.android.js +1 -0
  100. package/lib/PickerViewColumn/props.d.ts +16 -0
  101. package/lib/PickerViewColumn/props.ios.js +1 -0
  102. package/lib/PickerViewColumn/props.js +1 -0
  103. package/lib/PickerViewColumn/props.tuya.js +1 -0
  104. package/lib/PickerViewColumn/props.web.js +1 -0
  105. package/lib/PickerViewColumn/props.wechat.js +1 -0
  106. package/lib/Radio/Radio.js +3 -6
  107. package/lib/Radio/Radio.web.js +3 -6
  108. package/lib/Radio/index.md +5 -5
  109. package/lib/RadioGroup/RadioGroup.js +50 -2
  110. package/lib/RadioGroup/RadioGroup.web.js +50 -2
  111. package/lib/RadioGroup/index.md +7 -5
  112. package/lib/RadioGroup/props.d.ts +3 -1
  113. package/lib/RichText/RichText.android.js +1 -0
  114. package/lib/RichText/RichText.d.ts +3 -0
  115. package/lib/RichText/RichText.ios.js +1 -0
  116. package/lib/RichText/RichText.js +9 -0
  117. package/lib/RichText/RichText.tuya.js +9 -0
  118. package/lib/RichText/RichText.web.d.ts +4 -0
  119. package/lib/RichText/RichText.web.js +7 -0
  120. package/lib/RichText/RichText.wechat.js +9 -0
  121. package/lib/RichText/index.android.js +1 -0
  122. package/lib/RichText/index.d.ts +3 -0
  123. package/lib/RichText/index.ios.js +1 -0
  124. package/lib/RichText/index.js +3 -0
  125. package/lib/RichText/index.md +117 -0
  126. package/lib/RichText/index.tuya.js +3 -0
  127. package/lib/RichText/index.web.js +3 -0
  128. package/lib/RichText/index.wechat.js +3 -0
  129. package/lib/RichText/props.android.js +0 -0
  130. package/lib/RichText/props.d.ts +29 -0
  131. package/lib/RichText/props.ios.js +0 -0
  132. package/lib/RichText/props.js +1 -0
  133. package/lib/RichText/props.tuya.js +1 -0
  134. package/lib/RichText/props.web.js +1 -0
  135. package/lib/RichText/props.wechat.js +1 -0
  136. package/lib/ScrollView/ScrollView.d.ts +1 -1
  137. package/lib/ScrollView/ScrollView.js +40 -155
  138. package/lib/ScrollView/ScrollView.web.js +40 -155
  139. package/lib/ScrollView/index.md +11 -11
  140. package/lib/Slider/Slider.js +31 -12
  141. package/lib/Slider/Slider.web.js +31 -12
  142. package/lib/Slider/index.md +17 -17
  143. package/lib/Swiper/Swiper.js +61 -2
  144. package/lib/Swiper/Swiper.web.js +61 -2
  145. package/lib/Swiper/index.md +14 -14
  146. package/lib/Switch/Switch.js +20 -6
  147. package/lib/Switch/Switch.web.js +20 -6
  148. package/lib/Switch/index.md +6 -6
  149. package/lib/Text/Text.js +6 -34
  150. package/lib/Text/Text.web.js +6 -34
  151. package/lib/Text/index.md +6 -6
  152. package/lib/TimePicker/TimePicker.js +35 -4
  153. package/lib/TimePicker/TimePicker.web.js +35 -4
  154. package/lib/TimePicker/index.md +9 -9
  155. package/lib/TimePicker/props.d.ts +2 -0
  156. package/lib/View/View.js +6 -5
  157. package/lib/View/View.web.js +6 -5
  158. package/lib/View/index.md +10 -10
  159. package/lib/index.android.js +1 -1
  160. package/lib/index.d.ts +3 -0
  161. package/lib/index.ios.js +1 -1
  162. package/lib/index.js +3 -0
  163. package/lib/index.tuya.js +3 -0
  164. package/lib/index.web.js +3 -0
  165. package/lib/index.wechat.js +3 -0
  166. package/lib/utils/handleProps.android.js +1 -0
  167. package/lib/utils/handleProps.d.ts +5 -0
  168. package/lib/utils/handleProps.ios.js +1 -0
  169. package/lib/utils/handleProps.js +50 -0
  170. package/lib/utils/handleProps.tuya.js +50 -0
  171. package/lib/utils/handleProps.web.js +50 -0
  172. package/lib/utils/handleProps.wechat.js +50 -0
  173. package/package.json +7 -5
@@ -1,57 +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", "formType", "type", "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
- formType = props.formType,
20
- type = props.type,
21
- onClick = props.onClick,
22
- onTouchCancel = props.onTouchCancel,
23
- onTouchEnd = props.onTouchEnd,
24
- onTouchMove = props.onTouchMove,
25
- onTouchStart = props.onTouchStart,
26
- size = props.size,
27
- loading = props.loading,
28
- disabled = props.disabled,
29
- restProps = _objectWithoutProperties(props, _excluded);
30
-
31
- var _useTouch = useTouch({
32
- hoverDelay: hoverStartTime,
33
- hoverDuration: hoverStayTime,
34
- onTouchStart: onTouchStart,
35
- onTouchMove: onTouchMove,
36
- onTouchEnd: onTouchEnd,
37
- onTouchCancel: onTouchCancel
38
- }),
39
- _useTouch2 = _slicedToArray(_useTouch, 2),
40
- touching = _useTouch2[0],
41
- handlers = _useTouch2[1];
42
-
43
- return /*#__PURE__*/React.createElement("button", _extends({
44
- disabled: disabled,
45
- style: inlineStyle(style),
46
- className: clsx('ray-button', styles.button, styles["button-".concat(size)], _defineProperty({}, styles['button-loading'], loading), touching && hoverClassName, className),
47
- onClick: function (e) {
48
- if (disabled) return;
49
- if (loading) return;
50
- onClick === null || onClick === void 0 ? void 0 : onClick(e);
51
- } // TODO 原生表单类型type 和 按钮主题类型type重合了
52
- ,
53
- type: formType || type
54
- }, handlers, restProps));
6
+ return (
7
+ /*#__PURE__*/
8
+ // @ts-ignore
9
+ React.createElement("ty-button", handleProps(props), props.children)
10
+ );
55
11
  };
56
12
 
57
13
  Button.defaultProps = defaultButtonProps;
@@ -1,57 +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", "formType", "type", "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
- formType = props.formType,
20
- type = props.type,
21
- onClick = props.onClick,
22
- onTouchCancel = props.onTouchCancel,
23
- onTouchEnd = props.onTouchEnd,
24
- onTouchMove = props.onTouchMove,
25
- onTouchStart = props.onTouchStart,
26
- size = props.size,
27
- loading = props.loading,
28
- disabled = props.disabled,
29
- restProps = _objectWithoutProperties(props, _excluded);
30
-
31
- var _useTouch = useTouch({
32
- hoverDelay: hoverStartTime,
33
- hoverDuration: hoverStayTime,
34
- onTouchStart: onTouchStart,
35
- onTouchMove: onTouchMove,
36
- onTouchEnd: onTouchEnd,
37
- onTouchCancel: onTouchCancel
38
- }),
39
- _useTouch2 = _slicedToArray(_useTouch, 2),
40
- touching = _useTouch2[0],
41
- handlers = _useTouch2[1];
42
-
43
- return /*#__PURE__*/React.createElement("button", _extends({
44
- disabled: disabled,
45
- style: inlineStyle(style),
46
- className: clsx('ray-button', styles.button, styles["button-".concat(size)], _defineProperty({}, styles['button-loading'], loading), touching && hoverClassName, className),
47
- onClick: function (e) {
48
- if (disabled) return;
49
- if (loading) return;
50
- onClick === null || onClick === void 0 ? void 0 : onClick(e);
51
- } // TODO 原生表单类型type 和 按钮主题类型type重合了
52
- ,
53
- type: formType || type
54
- }, handlers, restProps));
6
+ return (
7
+ /*#__PURE__*/
8
+ // @ts-ignore
9
+ React.createElement("ty-button", handleProps(props), props.children)
10
+ );
55
11
  };
56
12
 
57
13
  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 |
@@ -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 |
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { BaseProps } from '../types';
2
3
  import { TouchEventHandler } from '@ray-js/framework-shared';
3
4
  declare type changeValue = (e: {
@@ -19,6 +20,7 @@ export interface DatePickerProps extends BaseProps, TouchEventHandler {
19
20
  onCancel?: CancelEvent;
20
21
  confirmText?: string;
21
22
  cancelText?: string;
23
+ children?: React.ReactNode | string;
22
24
  }
23
25
  export declare const defaultProps: DatePickerProps;
24
26
  export interface IState {
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var React=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _this=this,_jsxFileName="/drone/src/packages/components/src/Form/Form.native.tsx";function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap();var cacheNodeInterop=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj;}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}var Form=function(){return React.createElement(_reactNative.Text,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:6,columnNumber:10}},"\u6682\u672A\u5B9E\u73B0");};var _default=Form;exports.default=_default;
@@ -0,0 +1,4 @@
1
+ import * as React from 'react';
2
+ import { FormProps } from './props';
3
+ declare const Form: React.FC<FormProps>;
4
+ export default Form;
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var React=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _this=this,_jsxFileName="/drone/src/packages/components/src/Form/Form.native.tsx";function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap();var cacheNodeInterop=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj;}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}var Form=function(){return React.createElement(_reactNative.Text,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:6,columnNumber:10}},"\u6682\u672A\u5B9E\u73B0");};var _default=Form;exports.default=_default;
@@ -0,0 +1,37 @@
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 = ["onSubmit", "onReset"];
5
+ import * as React from 'react';
6
+ import handleProps from '../utils/handleProps';
7
+ import { useEventListener } from 'ahooks';
8
+
9
+ var Form = function (props) {
10
+ var onSubmit = props.onSubmit,
11
+ onReset = props.onReset,
12
+ restProps = _objectWithoutProperties(props, _excluded);
13
+
14
+ var currentNode = React.useRef(null);
15
+ useEventListener('submit', function (e) {
16
+ onSubmit(_objectSpread(_objectSpread({}, e.detail || {}), {}, {
17
+ origin: e,
18
+ type: 'submit'
19
+ }));
20
+ }, {
21
+ target: currentNode
22
+ });
23
+ useEventListener('reset', function (e) {
24
+ onReset(_objectSpread(_objectSpread({}, e.detail || {}), {}, {
25
+ origin: e,
26
+ type: 'reset'
27
+ }));
28
+ }, {
29
+ target: currentNode
30
+ }); // @ts-ignore
31
+
32
+ return /*#__PURE__*/React.createElement("ty-form", _extends({
33
+ ref: currentNode
34
+ }, handleProps(restProps)));
35
+ };
36
+
37
+ export default Form;