@ray-js/components 1.3.21 → 1.3.23

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 (141) hide show
  1. package/LICENSE.md +9 -0
  2. package/lib/Button/Button.js +1 -3
  3. package/lib/Button/Button.thing.js +15 -17
  4. package/lib/Button/Button.wechat.js +15 -17
  5. package/lib/Button/props.js +1 -1
  6. package/lib/Camera/Camera.d.ts +2 -1
  7. package/lib/Camera/Camera.js +3 -3
  8. package/lib/Camera/Camera.thing.js +1 -3
  9. package/lib/Camera/Camera.wechat.d.ts +2 -1
  10. package/lib/Camera/Camera.wechat.js +2 -2
  11. package/lib/Checkbox/Checkbox.js +1 -3
  12. package/lib/Checkbox/Checkbox.thing.js +8 -9
  13. package/lib/Checkbox/Checkbox.wechat.js +9 -10
  14. package/lib/CheckboxGroup/CheckboxGroup.js +15 -19
  15. package/lib/CheckboxGroup/CheckboxGroup.thing.js +12 -17
  16. package/lib/CheckboxGroup/CheckboxGroup.wechat.js +12 -17
  17. package/lib/CheckboxGroup/props.d.ts +1 -1
  18. package/lib/CoverView/CoverView.js +1 -3
  19. package/lib/CoverView/CoverView.thing.js +1 -3
  20. package/lib/CoverView/CoverView.wechat.d.ts +2 -1
  21. package/lib/CoverView/CoverView.wechat.js +0 -2
  22. package/lib/CoverView/props.d.ts +1 -1
  23. package/lib/CoverView/props.js +1 -1
  24. package/lib/Form/Form.js +12 -12
  25. package/lib/Form/Form.thing.js +1 -3
  26. package/lib/Form/Form.wechat.js +19 -25
  27. package/lib/Form/props.d.ts +1 -1
  28. package/lib/Icon/Icon.js +10 -10
  29. package/lib/Icon/Icon.thing.js +10 -10
  30. package/lib/Icon/Icon.wechat.js +10 -10
  31. package/lib/Icon/iconfont/iconfont.js +13 -20
  32. package/lib/Icon/props.d.ts +1 -1
  33. package/lib/Icon/props.js +1 -1
  34. package/lib/Iframe/Iframe.d.ts +2 -1
  35. package/lib/Iframe/Iframe.js +3 -3
  36. package/lib/Iframe/Iframe.thing.js +1 -3
  37. package/lib/Iframe/Iframe.wechat.d.ts +2 -1
  38. package/lib/Iframe/Iframe.wechat.js +3 -3
  39. package/lib/Image/Image.js +6 -8
  40. package/lib/Image/Image.thing.js +8 -10
  41. package/lib/Image/Image.wechat.js +25 -32
  42. package/lib/Input/Input.js +28 -26
  43. package/lib/Input/Input.thing.js +35 -36
  44. package/lib/Input/Input.wechat.js +46 -47
  45. package/lib/Input/props.d.ts +1 -1
  46. package/lib/Input/props.js +1 -1
  47. package/lib/IpcPlayer/IpcPlayer.d.ts +2 -1
  48. package/lib/IpcPlayer/IpcPlayer.js +3 -3
  49. package/lib/IpcPlayer/IpcPlayer.thing.js +1 -3
  50. package/lib/IpcPlayer/IpcPlayer.wechat.d.ts +2 -1
  51. package/lib/IpcPlayer/IpcPlayer.wechat.js +2 -2
  52. package/lib/Label/Label.js +7 -8
  53. package/lib/Label/Label.thing.js +8 -8
  54. package/lib/Label/Label.wechat.js +8 -8
  55. package/lib/Map/Map.js +1 -3
  56. package/lib/Map/Map.thing.js +1 -3
  57. package/lib/Map/Map.wechat.js +1 -3
  58. package/lib/Modal/index.js +4 -2
  59. package/lib/Modal/index.web.js +6 -4
  60. package/lib/MovableArea/MovableArea.js +5 -4
  61. package/lib/MovableArea/MovableArea.thing.js +1 -3
  62. package/lib/MovableArea/MovableArea.wechat.js +1 -3
  63. package/lib/MovableView/MovableView.js +12 -11
  64. package/lib/MovableView/MovableView.thing.js +1 -3
  65. package/lib/MovableView/MovableView.wechat.js +1 -3
  66. package/lib/NativeVideo/NativeVideo.d.ts +2 -1
  67. package/lib/NativeVideo/NativeVideo.js +3 -3
  68. package/lib/NativeVideo/NativeVideo.thing.js +1 -3
  69. package/lib/NativeVideo/NativeVideo.wechat.d.ts +2 -1
  70. package/lib/NativeVideo/NativeVideo.wechat.js +2 -2
  71. package/lib/PageContainer/PageContainer.js +12 -19
  72. package/lib/PageContainer/PageContainer.thing.d.ts +2 -1
  73. package/lib/PageContainer/PageContainer.thing.js +0 -2
  74. package/lib/PageContainer/PageContainer.wechat.d.ts +2 -1
  75. package/lib/PageContainer/PageContainer.wechat.js +0 -2
  76. package/lib/PageContainer/props.d.ts +2 -2
  77. package/lib/PageContainer/props.js +3 -3
  78. package/lib/Picker/Picker.js +22 -31
  79. package/lib/Picker/Picker.thing.js +25 -31
  80. package/lib/Picker/Picker.wechat.js +25 -31
  81. package/lib/PickerView/PickerView.js +23 -34
  82. package/lib/PickerView/PickerView.thing.js +16 -19
  83. package/lib/PickerView/PickerView.wechat.js +16 -19
  84. package/lib/PickerViewColumn/PickerViewColumn.js +4 -4
  85. package/lib/PickerViewColumn/PickerViewColumn.thing.js +6 -7
  86. package/lib/PickerViewColumn/PickerViewColumn.wechat.js +6 -7
  87. package/lib/Progress/Progress.js +1 -3
  88. package/lib/Progress/Progress.thing.js +6 -7
  89. package/lib/Progress/Progress.wechat.js +6 -7
  90. package/lib/Radio/Radio.js +1 -3
  91. package/lib/Radio/Radio.thing.js +8 -9
  92. package/lib/Radio/Radio.wechat.js +9 -10
  93. package/lib/RadioGroup/RadioGroup.js +12 -18
  94. package/lib/RadioGroup/RadioGroup.thing.js +15 -21
  95. package/lib/RadioGroup/RadioGroup.wechat.js +12 -17
  96. package/lib/RadioGroup/props.d.ts +1 -1
  97. package/lib/RichText/RichText.js +1 -1
  98. package/lib/RichText/RichText.thing.js +1 -3
  99. package/lib/RichText/RichText.wechat.js +1 -3
  100. package/lib/ScrollView/ScrollView.js +12 -13
  101. package/lib/ScrollView/ScrollView.thing.js +6 -7
  102. package/lib/ScrollView/ScrollView.wechat.js +6 -7
  103. package/lib/Slider/Slider.js +4 -8
  104. package/lib/Slider/Slider.thing.js +13 -14
  105. package/lib/Slider/Slider.wechat.js +14 -15
  106. package/lib/Slider/props.js +1 -1
  107. package/lib/Swiper/Swiper.d.ts +1 -1
  108. package/lib/Swiper/Swiper.js +23 -33
  109. package/lib/Swiper/Swiper.thing.d.ts +1 -1
  110. package/lib/Swiper/Swiper.thing.js +17 -24
  111. package/lib/Swiper/Swiper.wechat.d.ts +1 -1
  112. package/lib/Swiper/Swiper.wechat.js +17 -24
  113. package/lib/Swiper/props.d.ts +1 -1
  114. package/lib/Swiper/props.js +2 -2
  115. package/lib/SwiperItem/SwiperItem.js +4 -4
  116. package/lib/SwiperItem/SwiperItem.thing.js +8 -9
  117. package/lib/SwiperItem/SwiperItem.wechat.js +8 -9
  118. package/lib/Switch/Switch.js +5 -8
  119. package/lib/Switch/Switch.thing.js +12 -14
  120. package/lib/Switch/Switch.wechat.js +12 -14
  121. package/lib/Switch/props.js +1 -1
  122. package/lib/Text/Text.js +1 -3
  123. package/lib/Text/Text.thing.js +1 -3
  124. package/lib/Text/Text.wechat.js +19 -25
  125. package/lib/Textarea/Textarea.js +13 -14
  126. package/lib/Textarea/Textarea.thing.js +25 -22
  127. package/lib/Textarea/Textarea.wechat.js +25 -22
  128. package/lib/Textarea/props.d.ts +1 -1
  129. package/lib/View/View.js +28 -32
  130. package/lib/View/View.thing.js +33 -35
  131. package/lib/View/View.wechat.js +33 -35
  132. package/lib/View/props.js +1 -1
  133. package/lib/WebView/WebView.js +1 -3
  134. package/lib/WebView/WebView.thing.js +1 -3
  135. package/lib/WebView/WebView.wechat.js +1 -3
  136. package/lib/assets/icons.js +1 -1
  137. package/lib/core/index.js +5 -12
  138. package/lib/types/event.d.ts +1 -1
  139. package/lib/types/index.js +1 -0
  140. package/lib/utils/handleProps.js +26 -41
  141. package/package.json +7 -7
@@ -1,8 +1,6 @@
1
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
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
- var _excluded = ["id", "className", "style", "hoverClassName", "hoverStartTime", "hoverStayTime", "children", "onLongClick", "onTouchStart", "onTouchMove", "onTouchEnd", "onTouchCancel", "onClick", "hoverable", "onTransitionEnd"];
3
+ const _excluded = ["id", "className", "style", "hoverClassName", "hoverStartTime", "hoverStayTime", "children", "onLongClick", "onTouchStart", "onTouchMove", "onTouchEnd", "onTouchCancel", "onClick", "hoverable", "onTransitionEnd"];
6
4
  import * as React from 'react';
7
5
  import clsx from 'clsx';
8
6
  import { inlineStyle, useTouch } from '@ray-js/framework-shared';
@@ -10,45 +8,45 @@ import { View as RemaxView } from '@ray-core/wechat';
10
8
  import PropTypes from 'prop-types';
11
9
  import { defaultViewProps } from './props';
12
10
  import styles from './index.module.less';
13
- var View = /*#__PURE__*/React.forwardRef(function (props, ref) {
14
- var id = props.id,
15
- className = props.className,
16
- style = props.style,
17
- hoverClassName = props.hoverClassName,
18
- hoverStartTime = props.hoverStartTime,
19
- hoverStayTime = props.hoverStayTime,
20
- children = props.children,
21
- onLongClick = props.onLongClick,
22
- onTouchStart = props.onTouchStart,
23
- onTouchMove = props.onTouchMove,
24
- onTouchEnd = props.onTouchEnd,
25
- onTouchCancel = props.onTouchCancel,
26
- onClick = props.onClick,
27
- hoverable = props.hoverable,
28
- onTransitionEnd = props.onTransitionEnd,
29
- restProps = _objectWithoutProperties(props, _excluded);
30
-
31
- var _useTouch = useTouch({
11
+ const View = /*#__PURE__*/React.forwardRef((props, ref) => {
12
+ const {
13
+ id,
14
+ className,
15
+ style,
16
+ hoverClassName,
17
+ hoverStartTime,
18
+ hoverStayTime,
19
+ children,
20
+ onLongClick,
21
+ onTouchStart,
22
+ onTouchMove,
23
+ onTouchEnd,
24
+ onTouchCancel,
25
+ onClick,
26
+ hoverable,
27
+ onTransitionEnd
28
+ } = props,
29
+ restProps = _objectWithoutProperties(props, _excluded);
30
+ const [touching, handlers] = useTouch({
32
31
  hoverDelay: hoverStartTime,
33
32
  hoverDuration: hoverStayTime,
34
- onLongClick: onLongClick,
35
- onTouchStart: onTouchStart,
36
- onTouchMove: onTouchMove,
37
- onTouchEnd: onTouchEnd,
38
- onTouchCancel: onTouchCancel,
39
- onClick: onClick
40
- }),
41
- _useTouch2 = _slicedToArray(_useTouch, 2),
42
- touching = _useTouch2[0],
43
- handlers = _useTouch2[1];
44
-
45
- return /*#__PURE__*/React.createElement(RemaxView // @ts-ignore
33
+ onLongClick,
34
+ onTouchStart,
35
+ onTouchMove,
36
+ onTouchEnd,
37
+ onTouchCancel,
38
+ onClick
39
+ });
40
+ return /*#__PURE__*/React.createElement(RemaxView
41
+ // @ts-ignore
46
42
  , _extends({
47
43
  ref: ref,
48
44
  id: id,
49
45
  className: className,
50
46
  style: inlineStyle(style),
51
- hoverClassName: clsx(_defineProperty({}, styles.hover, hoverable), hoverClassName),
47
+ hoverClassName: clsx({
48
+ [styles.hover]: hoverable
49
+ }, hoverClassName),
52
50
  hoverStartTime: hoverStartTime,
53
51
  hoverStayTime: hoverStayTime,
54
52
  onTransitionEnd: onTransitionEnd
package/lib/View/props.js CHANGED
@@ -1,4 +1,4 @@
1
- export var defaultViewProps = {
1
+ export const defaultViewProps = {
2
2
  hoverStartTime: 20,
3
3
  hoverStayTime: 70
4
4
  };
@@ -1,7 +1,5 @@
1
1
  import React from 'react';
2
-
3
- var WebView = function () {
2
+ const WebView = () => {
4
3
  return /*#__PURE__*/React.createElement("div", null, "web\u7AEF\u6682\u672A\u5B9E\u73B0");
5
4
  };
6
-
7
5
  export default WebView;
@@ -1,8 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { WebView as RemaxWebView } from '@ray-js/adapter';
3
-
4
- var WebView = function (props) {
3
+ const WebView = props => {
5
4
  return /*#__PURE__*/React.createElement(RemaxWebView, props);
6
5
  };
7
-
8
6
  export default WebView;
@@ -1,8 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { WebView as RemaxWebView } from '@ray-js/adapter';
3
-
4
- var WebView = function (props) {
3
+ const WebView = props => {
5
4
  return /*#__PURE__*/React.createElement(RemaxWebView, props);
6
5
  };
7
-
8
6
  export default WebView;
@@ -1,4 +1,4 @@
1
- export var iconList = {
1
+ export const iconList = {
2
2
  success_no_circle: require('./success_no_circle.png'),
3
3
  loading: require('./loading.png'),
4
4
  loading_warn: require('./loading-warn.png'),
package/lib/core/index.js CHANGED
@@ -1,23 +1,16 @@
1
- import "core-js/modules/es.object.to-string.js";
2
- import "core-js/modules/es.regexp.to-string.js";
3
- import "core-js/modules/es.promise.js";
4
- import "core-js/modules/web.dom-collections.for-each.js";
5
- import "core-js/modules/es.object.keys.js";
6
1
  export function generateId() {
7
- return "V".concat(Math.random().toString(32).substr(2, 6).toUpperCase());
2
+ return `V${Math.random().toString(32).substr(2, 6).toUpperCase()}`;
8
3
  }
9
4
  export function nextFrame(duration) {
10
- return new Promise(function (resolve) {
11
- return setTimeout(resolve, duration !== null && duration !== void 0 ? duration : 1000 / 30);
12
- });
5
+ return new Promise(resolve => setTimeout(resolve, duration !== null && duration !== void 0 ? duration : 1000 / 30));
13
6
  }
7
+
14
8
  /**
15
9
  * props 的 alias 替换
16
10
  */
17
-
18
11
  export function propsAlias(props, alias) {
19
- Object.keys(alias).forEach(function (key) {
20
- var targetName = alias[key];
12
+ Object.keys(alias).forEach(key => {
13
+ const targetName = alias[key];
21
14
  props[targetName] = props[key];
22
15
  delete props[key];
23
16
  });
@@ -1,3 +1,3 @@
1
- export declare type FormEvent<V> = V & {
1
+ export type FormEvent<V> = V & {
2
2
  target?: any;
3
3
  };
@@ -5,5 +5,6 @@
5
5
  /**
6
6
  * 通用回调事件
7
7
  */
8
+
8
9
  export * from './event';
9
10
  export {};
@@ -1,63 +1,49 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
- import _typeof from "@babel/runtime/helpers/esm/typeof";
3
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
5
- var _excluded = ["className", "hoverClassName", "hoverStyle", "refresherDefaultStyle", "overlayStyle", "customStyle", "indicatorStyle", "maskStyle", "placeholderStyle", "borderStyle", "style", "children"];
6
- import "core-js/modules/es.array.map.js";
7
- import "core-js/modules/es.object.entries.js";
8
- import "core-js/modules/es.array.concat.js";
9
- import "core-js/modules/es.json.stringify.js";
3
+ const _excluded = ["className", "hoverClassName", "hoverStyle", "refresherDefaultStyle", "overlayStyle", "customStyle", "indicatorStyle", "maskStyle", "placeholderStyle", "borderStyle", "style", "children"];
10
4
  import { inlineStyle } from '@ray-js/framework-shared';
11
5
  import { paramCase } from 'param-case';
12
6
  import s2o from 'style-to-object';
13
-
14
- var transformStyle = function (originStyle) {
15
- var tempStyle;
16
-
7
+ const transformStyle = originStyle => {
8
+ let tempStyle;
17
9
  if (typeof originStyle === 'string') {
18
10
  tempStyle = s2o(originStyle);
19
11
  } else {
20
12
  tempStyle = originStyle;
21
13
  }
22
-
23
- return Object.entries(inlineStyle(tempStyle)).map(function (_ref) {
24
- var _ref2 = _slicedToArray(_ref, 2),
25
- k = _ref2[0],
26
- v = _ref2[1];
27
-
28
- return "".concat(k, ":").concat(v);
14
+ return Object.entries(inlineStyle(tempStyle)).map(_ref => {
15
+ let [k, v] = _ref;
16
+ return `${k}:${v}`;
29
17
  }).join(';');
30
18
  };
19
+
31
20
  /**
32
21
  * 处理 web 端 props
33
22
  */
34
-
35
-
36
- var handleProps = function (props) {
37
- var className = props.className,
38
- hoverClassName = props.hoverClassName,
39
- hoverStyle = props.hoverStyle,
40
- refresherDefaultStyle = props.refresherDefaultStyle,
41
- overlayStyle = props.overlayStyle,
42
- customStyle = props.customStyle,
43
- indicatorStyle = props.indicatorStyle,
44
- maskStyle = props.maskStyle,
45
- placeholderStyle = props.placeholderStyle,
46
- borderStyle = props.borderStyle,
47
- style = props.style,
48
- children = props.children,
49
- tempProps = _objectWithoutProperties(props, _excluded);
50
-
51
- for (var key in tempProps) {
23
+ const handleProps = props => {
24
+ const {
25
+ className,
26
+ hoverClassName,
27
+ hoverStyle,
28
+ refresherDefaultStyle,
29
+ overlayStyle,
30
+ customStyle,
31
+ indicatorStyle,
32
+ maskStyle,
33
+ placeholderStyle,
34
+ borderStyle,
35
+ style,
36
+ children
37
+ } = props,
38
+ tempProps = _objectWithoutProperties(props, _excluded);
39
+ for (const key in tempProps) {
52
40
  if (tempProps[key] === false) {
53
41
  delete tempProps[key];
54
- } else if (_typeof(tempProps[key]) === 'object') {
42
+ } else if (typeof tempProps[key] === 'object') {
55
43
  tempProps[key] = JSON.stringify(tempProps[key]);
56
44
  }
57
-
58
45
  tempProps[paramCase(key)] = tempProps[key];
59
46
  }
60
-
61
47
  return _objectSpread({
62
48
  class: className,
63
49
  style: style && inlineStyle(style),
@@ -70,8 +56,7 @@ var handleProps = function (props) {
70
56
  'mask-style': maskStyle && transformStyle(maskStyle),
71
57
  'placeholder-style': placeholderStyle && transformStyle(placeholderStyle),
72
58
  'border-style': borderStyle && transformStyle(borderStyle),
73
- children: children
59
+ children
74
60
  }, tempProps);
75
61
  };
76
-
77
62
  export default handleProps;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/components",
3
- "version": "1.3.21",
3
+ "version": "1.3.23",
4
4
  "description": "Ray basic components",
5
5
  "keywords": [
6
6
  "ray"
@@ -24,10 +24,10 @@
24
24
  "watch": "ray start --type=component"
25
25
  },
26
26
  "dependencies": {
27
- "@ray-core/macro": "^0.3.5",
28
- "@ray-core/wechat": "^0.3.5",
29
- "@ray-js/adapter": "1.3.21",
30
- "@ray-js/framework-shared": "1.3.21",
27
+ "@ray-core/macro": "^0.3.9",
28
+ "@ray-core/wechat": "^0.3.9",
29
+ "@ray-js/adapter": "1.3.23",
30
+ "@ray-js/framework-shared": "1.3.23",
31
31
  "ahooks": "^3.7.1",
32
32
  "clsx": "^1.1.1",
33
33
  "core-js": "^3.19.1",
@@ -37,7 +37,7 @@
37
37
  "style-to-object": "^0.3.0"
38
38
  },
39
39
  "devDependencies": {
40
- "@ray-js/cli": "1.3.21"
40
+ "@ray-js/cli": "1.3.23"
41
41
  },
42
42
  "maintainers": [
43
43
  {
@@ -45,6 +45,6 @@
45
45
  "email": "tuyafe@tuya.com"
46
46
  }
47
47
  ],
48
- "gitHead": "14cb935df10f020e714b44bb41d4899646db751c",
48
+ "gitHead": "04708bb394d817a7a522fcde178f19f170d5d364",
49
49
  "repository": {}
50
50
  }