@ray-js/components 0.4.6-beta-2 → 0.4.7
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.
- package/lib/Button/Button.js +1 -1
- package/lib/Button/Button.web.js +1 -1
- package/lib/Checkbox/Checkbox.js +1 -1
- package/lib/Checkbox/Checkbox.web.js +1 -1
- package/lib/CheckboxGroup/CheckboxGroup.js +1 -1
- package/lib/CheckboxGroup/CheckboxGroup.web.js +1 -1
- package/lib/DatePicker/DatePicker.js +1 -1
- package/lib/DatePicker/DatePicker.web.js +1 -1
- package/lib/Form/Form.js +1 -1
- package/lib/Form/Form.web.js +1 -1
- package/lib/Image/Image.js +1 -1
- package/lib/Image/Image.web.js +1 -1
- package/lib/Input/Input.js +1 -1
- package/lib/Input/Input.web.js +1 -1
- package/lib/Label/Label.js +1 -1
- package/lib/Label/Label.web.js +1 -1
- package/lib/MovableArea/MovableArea.android.js +1 -0
- package/lib/MovableArea/MovableArea.d.ts +4 -0
- package/lib/MovableArea/MovableArea.ios.js +1 -0
- package/lib/MovableArea/MovableArea.js +11 -0
- package/lib/MovableArea/MovableArea.tuya.js +11 -0
- package/lib/MovableArea/MovableArea.web.d.ts +4 -0
- package/lib/MovableArea/MovableArea.web.js +11 -0
- package/lib/MovableArea/MovableArea.wechat.js +11 -0
- package/lib/MovableArea/index.android.js +1 -0
- package/lib/MovableArea/index.d.ts +3 -0
- package/lib/MovableArea/index.ios.js +1 -0
- package/lib/MovableArea/index.js +3 -0
- package/lib/MovableArea/index.md +23 -0
- package/lib/MovableArea/index.tuya.js +3 -0
- package/lib/MovableArea/index.web.js +3 -0
- package/lib/MovableArea/index.wechat.js +3 -0
- package/lib/MovableArea/props.android.js +1 -0
- package/lib/MovableArea/props.d.ts +19 -0
- package/lib/MovableArea/props.ios.js +1 -0
- package/lib/MovableArea/props.js +3 -0
- package/lib/MovableArea/props.tuya.js +3 -0
- package/lib/MovableArea/props.web.js +3 -0
- package/lib/MovableArea/props.wechat.js +3 -0
- package/lib/MovableView/MovableView.android.js +1 -0
- package/lib/MovableView/MovableView.d.ts +4 -0
- package/lib/MovableView/MovableView.ios.js +1 -0
- package/lib/MovableView/MovableView.js +11 -0
- package/lib/MovableView/MovableView.tuya.js +11 -0
- package/lib/MovableView/MovableView.web.d.ts +4 -0
- package/lib/MovableView/MovableView.web.js +40 -0
- package/lib/MovableView/MovableView.wechat.js +11 -0
- package/lib/MovableView/index.android.js +1 -0
- package/lib/MovableView/index.d.ts +3 -0
- package/lib/MovableView/index.ios.js +1 -0
- package/lib/MovableView/index.js +3 -0
- package/lib/MovableView/index.md +61 -0
- package/lib/MovableView/index.tuya.js +3 -0
- package/lib/MovableView/index.web.js +3 -0
- package/lib/MovableView/index.wechat.js +3 -0
- package/lib/MovableView/props.android.js +1 -0
- package/lib/MovableView/props.d.ts +109 -0
- package/lib/MovableView/props.ios.js +1 -0
- package/lib/MovableView/props.js +15 -0
- package/lib/MovableView/props.tuya.js +15 -0
- package/lib/MovableView/props.web.js +15 -0
- package/lib/MovableView/props.wechat.js +15 -0
- package/lib/PageContainer/PageContainer.android.js +1 -1
- package/lib/PageContainer/PageContainer.ios.js +1 -1
- package/lib/PageContainer/PageContainer.js +1 -1
- package/lib/PageContainer/PageContainer.web.js +1 -1
- package/lib/Picker/Picker.js +1 -1
- package/lib/Picker/Picker.web.js +1 -1
- package/lib/PickerView/PickerView.js +1 -1
- package/lib/PickerView/PickerView.web.js +1 -1
- package/lib/PickerViewColumn/PickerViewColumn.js +1 -1
- package/lib/PickerViewColumn/PickerViewColumn.web.js +1 -1
- package/lib/Radio/Radio.js +1 -1
- package/lib/Radio/Radio.web.js +1 -1
- package/lib/RadioGroup/RadioGroup.js +2 -2
- package/lib/RadioGroup/RadioGroup.web.js +2 -2
- package/lib/RichText/RichText.web.js +1 -1
- package/lib/ScrollView/ScrollView.js +1 -1
- package/lib/ScrollView/ScrollView.web.js +1 -1
- package/lib/Slider/Slider.js +1 -1
- package/lib/Slider/Slider.web.js +1 -1
- package/lib/Swiper/Swiper.js +2 -2
- package/lib/Swiper/Swiper.web.js +2 -2
- package/lib/SwiperItem/SwiperItem.android.js +1 -1
- package/lib/SwiperItem/SwiperItem.ios.js +1 -1
- package/lib/SwiperItem/SwiperItem.js +1 -1
- package/lib/SwiperItem/SwiperItem.web.js +1 -1
- package/lib/Switch/Switch.js +1 -1
- package/lib/Switch/Switch.web.js +1 -1
- package/lib/Text/Text.js +1 -1
- package/lib/Text/Text.web.js +1 -1
- package/lib/Textarea/Textarea.js +49 -103
- package/lib/Textarea/Textarea.web.js +49 -103
- package/lib/TimePicker/TimePicker.js +1 -1
- package/lib/TimePicker/TimePicker.web.js +1 -1
- package/lib/View/View.js +1 -1
- package/lib/View/View.web.js +1 -1
- package/lib/utils/handleProps.android.js +1 -1
- package/lib/utils/handleProps.ios.js +1 -1
- package/lib/utils/handleProps.js +29 -10
- package/lib/utils/handleProps.tuya.js +29 -10
- package/lib/utils/handleProps.web.js +29 -10
- package/lib/utils/handleProps.wechat.js +29 -10
- package/package.json +5 -5
package/lib/Textarea/Textarea.js
CHANGED
@@ -1,120 +1,66 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
2
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
3
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
4
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
5
|
-
var _excluded = ["
|
6
|
-
import "core-js/modules/es.function.name.js";
|
3
|
+
var _excluded = ["className", "onInput", "onConfirm", "onFocus", "onBlur"];
|
7
4
|
import * as React from 'react';
|
8
|
-
import TextareaAutoSize from 'react-autosize-textarea';
|
9
5
|
import clsx from 'clsx';
|
10
|
-
import {
|
6
|
+
import { useEventListener } from 'ahooks';
|
11
7
|
import styles from './index.module.less';
|
8
|
+
import handleProps from '../utils/handleProps';
|
12
9
|
|
13
10
|
var Textarea = function (props) {
|
14
|
-
var
|
15
|
-
className = props.className,
|
16
|
-
style = props.style,
|
17
|
-
value = props.value,
|
18
|
-
placeholderStyle = props.placeholderStyle,
|
19
|
-
placeholder = props.placeholder,
|
11
|
+
var className = props.className,
|
20
12
|
onInput = props.onInput,
|
21
|
-
onFocus = props.onFocus,
|
22
13
|
onConfirm = props.onConfirm,
|
14
|
+
onFocus = props.onFocus,
|
23
15
|
onBlur = props.onBlur,
|
24
|
-
maxLength = props.maxLength,
|
25
|
-
focus = props.focus,
|
26
|
-
disabled = props.disabled,
|
27
|
-
name = props.name,
|
28
|
-
autoHeight = props.autoHeight,
|
29
16
|
restProps = _objectWithoutProperties(props, _excluded);
|
30
17
|
|
31
|
-
var
|
32
|
-
|
33
|
-
var _React$useState = React.useState(value),
|
34
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
35
|
-
internalValue = _React$useState2[0],
|
36
|
-
setValue = _React$useState2[1];
|
37
|
-
|
38
|
-
React.useEffect(function () {
|
39
|
-
if (textareaRef.current) {
|
40
|
-
if (focus) {
|
41
|
-
textareaRef.current.focus(); // 设置光标位置
|
42
|
-
|
43
|
-
textareaRef.current.setSelectionRange(-1, -1);
|
44
|
-
} else {
|
45
|
-
textareaRef.current.blur();
|
46
|
-
}
|
47
|
-
}
|
48
|
-
}, [focus]);
|
49
|
-
React.useEffect(function () {
|
50
|
-
setValue(value);
|
51
|
-
}, [value]);
|
52
|
-
|
53
|
-
var _useStylesheet = useStylesheet(_objectSpread({
|
54
|
-
lineHeight: 1.5
|
55
|
-
}, inlineStyle(placeholderStyle))),
|
56
|
-
_useStylesheet2 = _slicedToArray(_useStylesheet, 1),
|
57
|
-
placeholderStyleClassName = _useStylesheet2[0];
|
58
|
-
|
59
|
-
function handleKeyPress(e) {
|
60
|
-
if (e.key === 'Enter' && typeof onConfirm === 'function') {
|
61
|
-
onConfirm({
|
62
|
-
value: value
|
63
|
-
});
|
64
|
-
}
|
65
|
-
}
|
66
|
-
|
67
|
-
function handleInput(event) {
|
68
|
-
var target = event.currentTarget;
|
69
|
-
var value = target.value;
|
70
|
-
setValue(value);
|
18
|
+
var currentNode = React.useRef(null);
|
19
|
+
useEventListener('input', function (e) {
|
71
20
|
onInput === null || onInput === void 0 ? void 0 : onInput({
|
72
|
-
|
21
|
+
type: 'input',
|
22
|
+
value: e.detail.value,
|
23
|
+
origin: e
|
73
24
|
});
|
74
|
-
}
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
maxLength: maxLength,
|
113
|
-
onChange: handleInput,
|
114
|
-
onFocus: onFocus,
|
115
|
-
onBlur: onBlur,
|
116
|
-
onKeyPress: handleKeyPress
|
117
|
-
}, restProps));
|
25
|
+
}, {
|
26
|
+
target: currentNode
|
27
|
+
});
|
28
|
+
useEventListener('confirm', function (e) {
|
29
|
+
onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm({
|
30
|
+
type: 'confirm',
|
31
|
+
value: e.detail.value,
|
32
|
+
origin: e
|
33
|
+
});
|
34
|
+
}, {
|
35
|
+
target: currentNode
|
36
|
+
});
|
37
|
+
useEventListener('focus', function (e) {
|
38
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus({
|
39
|
+
type: 'focus',
|
40
|
+
value: e.detail.value,
|
41
|
+
origin: e
|
42
|
+
});
|
43
|
+
}, {
|
44
|
+
target: currentNode
|
45
|
+
});
|
46
|
+
useEventListener('blur', function (e) {
|
47
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
48
|
+
type: 'blur',
|
49
|
+
value: e.detail.value,
|
50
|
+
origin: e
|
51
|
+
});
|
52
|
+
}, {
|
53
|
+
target: currentNode
|
54
|
+
});
|
55
|
+
return (
|
56
|
+
/*#__PURE__*/
|
57
|
+
// @ts-ignore
|
58
|
+
React.createElement("v-textarea", _extends({}, handleProps(restProps), {
|
59
|
+
ref: currentNode,
|
60
|
+
class: clsx('ray-textarea', styles.textarea, className)
|
61
|
+
}))
|
62
|
+
);
|
118
63
|
};
|
119
64
|
|
65
|
+
Textarea.displayName = 'Textarea';
|
120
66
|
export default Textarea;
|
@@ -1,120 +1,66 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
2
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
3
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
4
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
5
|
-
var _excluded = ["
|
6
|
-
import "core-js/modules/es.function.name.js";
|
3
|
+
var _excluded = ["className", "onInput", "onConfirm", "onFocus", "onBlur"];
|
7
4
|
import * as React from 'react';
|
8
|
-
import TextareaAutoSize from 'react-autosize-textarea';
|
9
5
|
import clsx from 'clsx';
|
10
|
-
import {
|
6
|
+
import { useEventListener } from 'ahooks';
|
11
7
|
import styles from './index.module.less';
|
8
|
+
import handleProps from '../utils/handleProps';
|
12
9
|
|
13
10
|
var Textarea = function (props) {
|
14
|
-
var
|
15
|
-
className = props.className,
|
16
|
-
style = props.style,
|
17
|
-
value = props.value,
|
18
|
-
placeholderStyle = props.placeholderStyle,
|
19
|
-
placeholder = props.placeholder,
|
11
|
+
var className = props.className,
|
20
12
|
onInput = props.onInput,
|
21
|
-
onFocus = props.onFocus,
|
22
13
|
onConfirm = props.onConfirm,
|
14
|
+
onFocus = props.onFocus,
|
23
15
|
onBlur = props.onBlur,
|
24
|
-
maxLength = props.maxLength,
|
25
|
-
focus = props.focus,
|
26
|
-
disabled = props.disabled,
|
27
|
-
name = props.name,
|
28
|
-
autoHeight = props.autoHeight,
|
29
16
|
restProps = _objectWithoutProperties(props, _excluded);
|
30
17
|
|
31
|
-
var
|
32
|
-
|
33
|
-
var _React$useState = React.useState(value),
|
34
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
35
|
-
internalValue = _React$useState2[0],
|
36
|
-
setValue = _React$useState2[1];
|
37
|
-
|
38
|
-
React.useEffect(function () {
|
39
|
-
if (textareaRef.current) {
|
40
|
-
if (focus) {
|
41
|
-
textareaRef.current.focus(); // 设置光标位置
|
42
|
-
|
43
|
-
textareaRef.current.setSelectionRange(-1, -1);
|
44
|
-
} else {
|
45
|
-
textareaRef.current.blur();
|
46
|
-
}
|
47
|
-
}
|
48
|
-
}, [focus]);
|
49
|
-
React.useEffect(function () {
|
50
|
-
setValue(value);
|
51
|
-
}, [value]);
|
52
|
-
|
53
|
-
var _useStylesheet = useStylesheet(_objectSpread({
|
54
|
-
lineHeight: 1.5
|
55
|
-
}, inlineStyle(placeholderStyle))),
|
56
|
-
_useStylesheet2 = _slicedToArray(_useStylesheet, 1),
|
57
|
-
placeholderStyleClassName = _useStylesheet2[0];
|
58
|
-
|
59
|
-
function handleKeyPress(e) {
|
60
|
-
if (e.key === 'Enter' && typeof onConfirm === 'function') {
|
61
|
-
onConfirm({
|
62
|
-
value: value
|
63
|
-
});
|
64
|
-
}
|
65
|
-
}
|
66
|
-
|
67
|
-
function handleInput(event) {
|
68
|
-
var target = event.currentTarget;
|
69
|
-
var value = target.value;
|
70
|
-
setValue(value);
|
18
|
+
var currentNode = React.useRef(null);
|
19
|
+
useEventListener('input', function (e) {
|
71
20
|
onInput === null || onInput === void 0 ? void 0 : onInput({
|
72
|
-
|
21
|
+
type: 'input',
|
22
|
+
value: e.detail.value,
|
23
|
+
origin: e
|
73
24
|
});
|
74
|
-
}
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
maxLength: maxLength,
|
113
|
-
onChange: handleInput,
|
114
|
-
onFocus: onFocus,
|
115
|
-
onBlur: onBlur,
|
116
|
-
onKeyPress: handleKeyPress
|
117
|
-
}, restProps));
|
25
|
+
}, {
|
26
|
+
target: currentNode
|
27
|
+
});
|
28
|
+
useEventListener('confirm', function (e) {
|
29
|
+
onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm({
|
30
|
+
type: 'confirm',
|
31
|
+
value: e.detail.value,
|
32
|
+
origin: e
|
33
|
+
});
|
34
|
+
}, {
|
35
|
+
target: currentNode
|
36
|
+
});
|
37
|
+
useEventListener('focus', function (e) {
|
38
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus({
|
39
|
+
type: 'focus',
|
40
|
+
value: e.detail.value,
|
41
|
+
origin: e
|
42
|
+
});
|
43
|
+
}, {
|
44
|
+
target: currentNode
|
45
|
+
});
|
46
|
+
useEventListener('blur', function (e) {
|
47
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur({
|
48
|
+
type: 'blur',
|
49
|
+
value: e.detail.value,
|
50
|
+
origin: e
|
51
|
+
});
|
52
|
+
}, {
|
53
|
+
target: currentNode
|
54
|
+
});
|
55
|
+
return (
|
56
|
+
/*#__PURE__*/
|
57
|
+
// @ts-ignore
|
58
|
+
React.createElement("v-textarea", _extends({}, handleProps(restProps), {
|
59
|
+
ref: currentNode,
|
60
|
+
class: clsx('ray-textarea', styles.textarea, className)
|
61
|
+
}))
|
62
|
+
);
|
118
63
|
};
|
119
64
|
|
65
|
+
Textarea.displayName = 'Textarea';
|
120
66
|
export default Textarea;
|
@@ -30,7 +30,7 @@ var TimePicker = function (props) {
|
|
30
30
|
return (
|
31
31
|
/*#__PURE__*/
|
32
32
|
// @ts-ignore
|
33
|
-
React.createElement("
|
33
|
+
React.createElement("v-picker", _extends({}, handleProps(props), {
|
34
34
|
ref: currentNode,
|
35
35
|
mode: "time"
|
36
36
|
}), children)
|
@@ -30,7 +30,7 @@ var TimePicker = function (props) {
|
|
30
30
|
return (
|
31
31
|
/*#__PURE__*/
|
32
32
|
// @ts-ignore
|
33
|
-
React.createElement("
|
33
|
+
React.createElement("v-picker", _extends({}, handleProps(props), {
|
34
34
|
ref: currentNode,
|
35
35
|
mode: "time"
|
36
36
|
}), children)
|
package/lib/View/View.js
CHANGED
@@ -41,7 +41,7 @@ var View = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
41
41
|
touching = _useTouch2[0],
|
42
42
|
handlers = _useTouch2[1];
|
43
43
|
|
44
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("
|
44
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("v-view", _extends({}, handleProps(props), {
|
45
45
|
ref: ref,
|
46
46
|
id: id,
|
47
47
|
class: clsx('ray-view', className, hoverable && touching && styles.hover, touching && hoverClassName),
|
package/lib/View/View.web.js
CHANGED
@@ -41,7 +41,7 @@ var View = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
41
41
|
touching = _useTouch2[0],
|
42
42
|
handlers = _useTouch2[1];
|
43
43
|
|
44
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("
|
44
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("v-view", _extends({}, handleProps(props), {
|
45
45
|
ref: ref,
|
46
46
|
id: id,
|
47
47
|
class: clsx('ray-view', className, hoverable && touching && styles.hover, touching && hoverClassName),
|
@@ -1 +1 @@
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _frameworkShared=require("@ray-js/framework-shared");var _paramCase=require("param-case");var _excluded=["className","hoverClassName","hoverStyle","refresherDefaultStyle","overlayStyle","customStyle","indicatorStyle","maskStyle","placeholderStyle","borderStyle","style","children"];function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;})),keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?ownKeys(Object(source),!0).forEach(function(key){(0,_defineProperty2.default)(target,key,source[key]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}return target;}var transformStyle=function(originStyle){return Object.entries(originStyle).map(function(_ref){var _ref2=(0,_slicedToArray2.default)(_ref,2),k=_ref2[0],v=_ref2[1];return k+":"+v;}).join(';');};var handleProps=function(props){var className=props.className,hoverClassName=props.hoverClassName,hoverStyle=props.hoverStyle,refresherDefaultStyle=props.refresherDefaultStyle,overlayStyle=props.overlayStyle,customStyle=props.customStyle,indicatorStyle=props.indicatorStyle,maskStyle=props.maskStyle,placeholderStyle=props.placeholderStyle,borderStyle=props.borderStyle,style=props.style,children=props.children,tempProps=(0,_objectWithoutProperties2.default)(props,_excluded);for(var key in tempProps){if(tempProps[key]===false){delete tempProps[key];}else if(typeof tempProps[key]==='object'){tempProps[key]=JSON.stringify(tempProps[key]);}tempProps[(0,_paramCase.paramCase)(key)]=tempProps[key];}return _objectSpread({class:className,style:style&&(0,_frameworkShared.inlineStyle)(style),'hover-class':hoverClassName,'hover-style':hoverStyle&&transformStyle(hoverStyle),'refresher-default-style':refresherDefaultStyle&&transformStyle(hoverStyle),'overlay-style':overlayStyle&&transformStyle(overlayStyle),'custom-style':customStyle&&transformStyle(customStyle),'indicator-style':indicatorStyle&&transformStyle(indicatorStyle),'mask-style':maskStyle&&transformStyle(maskStyle),'placeholder-style':placeholderStyle&&transformStyle(placeholderStyle),'border-style':borderStyle&&transformStyle(borderStyle),children:children},tempProps);};var _default=handleProps;exports.default=_default;
|
@@ -1 +1 @@
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _frameworkShared=require("@ray-js/framework-shared");var _paramCase=require("param-case");var _excluded=["className","hoverClassName","hoverStyle","refresherDefaultStyle","overlayStyle","customStyle","indicatorStyle","maskStyle","placeholderStyle","borderStyle","style","children"];function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;})),keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?ownKeys(Object(source),!0).forEach(function(key){(0,_defineProperty2.default)(target,key,source[key]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}return target;}var transformStyle=function(originStyle){return Object.entries(originStyle).map(function(_ref){var _ref2=(0,_slicedToArray2.default)(_ref,2),k=_ref2[0],v=_ref2[1];return k+":"+v;}).join(';');};var handleProps=function(props){var className=props.className,hoverClassName=props.hoverClassName,hoverStyle=props.hoverStyle,refresherDefaultStyle=props.refresherDefaultStyle,overlayStyle=props.overlayStyle,customStyle=props.customStyle,indicatorStyle=props.indicatorStyle,maskStyle=props.maskStyle,placeholderStyle=props.placeholderStyle,borderStyle=props.borderStyle,style=props.style,children=props.children,tempProps=(0,_objectWithoutProperties2.default)(props,_excluded);for(var key in tempProps){if(tempProps[key]===false){delete tempProps[key];}else if(typeof tempProps[key]==='object'){tempProps[key]=JSON.stringify(tempProps[key]);}tempProps[(0,_paramCase.paramCase)(key)]=tempProps[key];}return _objectSpread({class:className,style:style&&(0,_frameworkShared.inlineStyle)(style),'hover-class':hoverClassName,'hover-style':hoverStyle&&transformStyle(hoverStyle),'refresher-default-style':refresherDefaultStyle&&transformStyle(hoverStyle),'overlay-style':overlayStyle&&transformStyle(overlayStyle),'custom-style':customStyle&&transformStyle(customStyle),'indicator-style':indicatorStyle&&transformStyle(indicatorStyle),'mask-style':maskStyle&&transformStyle(maskStyle),'placeholder-style':placeholderStyle&&transformStyle(placeholderStyle),'border-style':borderStyle&&transformStyle(borderStyle),children:children},tempProps);};var _default=handleProps;exports.default=_default;
|
package/lib/utils/handleProps.js
CHANGED
@@ -1,23 +1,41 @@
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
2
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
3
2
|
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
4
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
5
|
-
|
6
|
-
|
4
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
5
|
+
var _excluded = ["className", "hoverClassName", "hoverStyle", "refresherDefaultStyle", "overlayStyle", "customStyle", "indicatorStyle", "maskStyle", "placeholderStyle", "borderStyle", "style", "children"];
|
7
6
|
import "core-js/modules/es.array.join.js";
|
8
7
|
import "core-js/modules/es.array.map.js";
|
9
8
|
import "core-js/modules/es.object.entries.js";
|
10
9
|
import "core-js/modules/es.array.concat.js";
|
10
|
+
import "core-js/modules/es.json.stringify.js";
|
11
11
|
import { inlineStyle } from '@ray-js/framework-shared';
|
12
12
|
import { paramCase } from 'param-case';
|
13
|
+
|
14
|
+
var transformStyle = function (originStyle) {
|
15
|
+
return Object.entries(originStyle).map(function (_ref) {
|
16
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
17
|
+
k = _ref2[0],
|
18
|
+
v = _ref2[1];
|
19
|
+
|
20
|
+
return "".concat(k, ":").concat(v);
|
21
|
+
}).join(';');
|
22
|
+
};
|
13
23
|
/**
|
14
24
|
* 处理 web 端 props
|
15
25
|
*/
|
16
26
|
|
27
|
+
|
17
28
|
var handleProps = function (props) {
|
18
29
|
var className = props.className,
|
19
30
|
hoverClassName = props.hoverClassName,
|
20
31
|
hoverStyle = props.hoverStyle,
|
32
|
+
refresherDefaultStyle = props.refresherDefaultStyle,
|
33
|
+
overlayStyle = props.overlayStyle,
|
34
|
+
customStyle = props.customStyle,
|
35
|
+
indicatorStyle = props.indicatorStyle,
|
36
|
+
maskStyle = props.maskStyle,
|
37
|
+
placeholderStyle = props.placeholderStyle,
|
38
|
+
borderStyle = props.borderStyle,
|
21
39
|
style = props.style,
|
22
40
|
children = props.children,
|
23
41
|
tempProps = _objectWithoutProperties(props, _excluded);
|
@@ -36,13 +54,14 @@ var handleProps = function (props) {
|
|
36
54
|
class: className,
|
37
55
|
style: style && inlineStyle(style),
|
38
56
|
'hover-class': hoverClassName,
|
39
|
-
'hover-style': hoverStyle &&
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
57
|
+
'hover-style': hoverStyle && transformStyle(hoverStyle),
|
58
|
+
'refresher-default-style': refresherDefaultStyle && transformStyle(hoverStyle),
|
59
|
+
'overlay-style': overlayStyle && transformStyle(overlayStyle),
|
60
|
+
'custom-style': customStyle && transformStyle(customStyle),
|
61
|
+
'indicator-style': indicatorStyle && transformStyle(indicatorStyle),
|
62
|
+
'mask-style': maskStyle && transformStyle(maskStyle),
|
63
|
+
'placeholder-style': placeholderStyle && transformStyle(placeholderStyle),
|
64
|
+
'border-style': borderStyle && transformStyle(borderStyle),
|
46
65
|
children: children
|
47
66
|
}, tempProps);
|
48
67
|
};
|
@@ -1,23 +1,41 @@
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
2
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
3
2
|
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
4
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
5
|
-
|
6
|
-
|
4
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
5
|
+
var _excluded = ["className", "hoverClassName", "hoverStyle", "refresherDefaultStyle", "overlayStyle", "customStyle", "indicatorStyle", "maskStyle", "placeholderStyle", "borderStyle", "style", "children"];
|
7
6
|
import "core-js/modules/es.array.join.js";
|
8
7
|
import "core-js/modules/es.array.map.js";
|
9
8
|
import "core-js/modules/es.object.entries.js";
|
10
9
|
import "core-js/modules/es.array.concat.js";
|
10
|
+
import "core-js/modules/es.json.stringify.js";
|
11
11
|
import { inlineStyle } from '@ray-js/framework-shared';
|
12
12
|
import { paramCase } from 'param-case';
|
13
|
+
|
14
|
+
var transformStyle = function (originStyle) {
|
15
|
+
return Object.entries(originStyle).map(function (_ref) {
|
16
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
17
|
+
k = _ref2[0],
|
18
|
+
v = _ref2[1];
|
19
|
+
|
20
|
+
return "".concat(k, ":").concat(v);
|
21
|
+
}).join(';');
|
22
|
+
};
|
13
23
|
/**
|
14
24
|
* 处理 web 端 props
|
15
25
|
*/
|
16
26
|
|
27
|
+
|
17
28
|
var handleProps = function (props) {
|
18
29
|
var className = props.className,
|
19
30
|
hoverClassName = props.hoverClassName,
|
20
31
|
hoverStyle = props.hoverStyle,
|
32
|
+
refresherDefaultStyle = props.refresherDefaultStyle,
|
33
|
+
overlayStyle = props.overlayStyle,
|
34
|
+
customStyle = props.customStyle,
|
35
|
+
indicatorStyle = props.indicatorStyle,
|
36
|
+
maskStyle = props.maskStyle,
|
37
|
+
placeholderStyle = props.placeholderStyle,
|
38
|
+
borderStyle = props.borderStyle,
|
21
39
|
style = props.style,
|
22
40
|
children = props.children,
|
23
41
|
tempProps = _objectWithoutProperties(props, _excluded);
|
@@ -36,13 +54,14 @@ var handleProps = function (props) {
|
|
36
54
|
class: className,
|
37
55
|
style: style && inlineStyle(style),
|
38
56
|
'hover-class': hoverClassName,
|
39
|
-
'hover-style': hoverStyle &&
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
57
|
+
'hover-style': hoverStyle && transformStyle(hoverStyle),
|
58
|
+
'refresher-default-style': refresherDefaultStyle && transformStyle(hoverStyle),
|
59
|
+
'overlay-style': overlayStyle && transformStyle(overlayStyle),
|
60
|
+
'custom-style': customStyle && transformStyle(customStyle),
|
61
|
+
'indicator-style': indicatorStyle && transformStyle(indicatorStyle),
|
62
|
+
'mask-style': maskStyle && transformStyle(maskStyle),
|
63
|
+
'placeholder-style': placeholderStyle && transformStyle(placeholderStyle),
|
64
|
+
'border-style': borderStyle && transformStyle(borderStyle),
|
46
65
|
children: children
|
47
66
|
}, tempProps);
|
48
67
|
};
|
@@ -1,23 +1,41 @@
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
2
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
3
2
|
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
4
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
5
|
-
|
6
|
-
|
4
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
5
|
+
var _excluded = ["className", "hoverClassName", "hoverStyle", "refresherDefaultStyle", "overlayStyle", "customStyle", "indicatorStyle", "maskStyle", "placeholderStyle", "borderStyle", "style", "children"];
|
7
6
|
import "core-js/modules/es.array.join.js";
|
8
7
|
import "core-js/modules/es.array.map.js";
|
9
8
|
import "core-js/modules/es.object.entries.js";
|
10
9
|
import "core-js/modules/es.array.concat.js";
|
10
|
+
import "core-js/modules/es.json.stringify.js";
|
11
11
|
import { inlineStyle } from '@ray-js/framework-shared';
|
12
12
|
import { paramCase } from 'param-case';
|
13
|
+
|
14
|
+
var transformStyle = function (originStyle) {
|
15
|
+
return Object.entries(originStyle).map(function (_ref) {
|
16
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
17
|
+
k = _ref2[0],
|
18
|
+
v = _ref2[1];
|
19
|
+
|
20
|
+
return "".concat(k, ":").concat(v);
|
21
|
+
}).join(';');
|
22
|
+
};
|
13
23
|
/**
|
14
24
|
* 处理 web 端 props
|
15
25
|
*/
|
16
26
|
|
27
|
+
|
17
28
|
var handleProps = function (props) {
|
18
29
|
var className = props.className,
|
19
30
|
hoverClassName = props.hoverClassName,
|
20
31
|
hoverStyle = props.hoverStyle,
|
32
|
+
refresherDefaultStyle = props.refresherDefaultStyle,
|
33
|
+
overlayStyle = props.overlayStyle,
|
34
|
+
customStyle = props.customStyle,
|
35
|
+
indicatorStyle = props.indicatorStyle,
|
36
|
+
maskStyle = props.maskStyle,
|
37
|
+
placeholderStyle = props.placeholderStyle,
|
38
|
+
borderStyle = props.borderStyle,
|
21
39
|
style = props.style,
|
22
40
|
children = props.children,
|
23
41
|
tempProps = _objectWithoutProperties(props, _excluded);
|
@@ -36,13 +54,14 @@ var handleProps = function (props) {
|
|
36
54
|
class: className,
|
37
55
|
style: style && inlineStyle(style),
|
38
56
|
'hover-class': hoverClassName,
|
39
|
-
'hover-style': hoverStyle &&
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
57
|
+
'hover-style': hoverStyle && transformStyle(hoverStyle),
|
58
|
+
'refresher-default-style': refresherDefaultStyle && transformStyle(hoverStyle),
|
59
|
+
'overlay-style': overlayStyle && transformStyle(overlayStyle),
|
60
|
+
'custom-style': customStyle && transformStyle(customStyle),
|
61
|
+
'indicator-style': indicatorStyle && transformStyle(indicatorStyle),
|
62
|
+
'mask-style': maskStyle && transformStyle(maskStyle),
|
63
|
+
'placeholder-style': placeholderStyle && transformStyle(placeholderStyle),
|
64
|
+
'border-style': borderStyle && transformStyle(borderStyle),
|
46
65
|
children: children
|
47
66
|
}, tempProps);
|
48
67
|
};
|