@ray-js/components 0.3.29 → 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.
- package/lib/Button/Button.js +6 -50
- package/lib/Button/Button.web.js +6 -50
- package/lib/Button/index.md +10 -10
- package/lib/Checkbox/Checkbox.d.ts +0 -1
- package/lib/Checkbox/Checkbox.js +3 -29
- package/lib/Checkbox/Checkbox.web.js +3 -29
- package/lib/Checkbox/index.md +7 -6
- package/lib/CheckboxGroup/CheckboxGroup.js +45 -2
- package/lib/CheckboxGroup/CheckboxGroup.web.js +45 -2
- package/lib/CheckboxGroup/index.md +4 -4
- package/lib/CheckboxGroup/props.d.ts +3 -2
- package/lib/DatePicker/DatePicker.js +55 -4
- package/lib/DatePicker/DatePicker.web.js +55 -4
- package/lib/DatePicker/index.md +8 -8
- package/lib/DatePicker/props.d.ts +2 -0
- package/lib/Form/Form.android.js +1 -0
- package/lib/Form/Form.d.ts +4 -0
- package/lib/Form/Form.ios.js +1 -0
- package/lib/Form/Form.js +37 -0
- package/lib/Form/Form.native.d.ts +4 -0
- package/lib/Form/Form.tuya.d.ts +4 -0
- package/lib/Form/Form.tuya.js +8 -0
- package/lib/Form/Form.web.js +37 -0
- package/lib/Form/Form.wechat.d.ts +4 -0
- package/lib/Form/Form.wechat.js +33 -0
- package/lib/Form/index.android.js +1 -0
- package/lib/Form/index.d.ts +3 -0
- package/lib/Form/index.ios.js +1 -0
- package/lib/Form/index.js +3 -0
- package/lib/Form/index.md +30 -0
- package/lib/Form/index.tuya.js +3 -0
- package/lib/Form/index.web.js +3 -0
- package/lib/Form/index.wechat.js +3 -0
- package/lib/Form/props.android.js +1 -0
- package/lib/Form/props.d.ts +13 -0
- package/lib/Form/props.ios.js +1 -0
- package/lib/Form/props.js +1 -0
- package/lib/Form/props.tuya.js +1 -0
- package/lib/Form/props.web.js +1 -0
- package/lib/Form/props.wechat.js +1 -0
- package/lib/Icon/index.md +4 -4
- package/lib/Image/Image.js +33 -86
- package/lib/Image/Image.web.js +33 -86
- package/lib/Image/index.md +20 -20
- package/lib/Image/props.d.ts +1 -0
- package/lib/Input/Input.js +54 -78
- package/lib/Input/Input.web.js +54 -78
- package/lib/Input/index.md +14 -14
- package/lib/Label/Label.android.js +1 -1
- package/lib/Label/Label.ios.js +1 -1
- package/lib/Label/Label.js +8 -15
- package/lib/Label/Label.web.js +8 -15
- package/lib/Label/index.md +31 -0
- package/lib/Label/props.d.ts +7 -0
- package/lib/Motion/Fade/index.js +1 -1
- package/lib/Motion/Fade/index.web.js +1 -1
- package/lib/Motion/PullUp/index.js +1 -1
- package/lib/Motion/PullUp/index.web.js +1 -1
- package/lib/Motion/PushDown/index.js +1 -1
- package/lib/Motion/PushDown/index.web.js +1 -1
- package/lib/Motion/ScaleFadeIn/index.js +1 -1
- package/lib/Motion/ScaleFadeIn/index.web.js +1 -1
- package/lib/Motion/ScalePullDown/index.js +1 -1
- package/lib/Motion/ScalePullDown/index.web.js +1 -1
- package/lib/PageContainer/PageContainer.android.js +1 -1
- package/lib/PageContainer/PageContainer.d.ts +2 -4
- package/lib/PageContainer/PageContainer.ios.js +1 -1
- package/lib/PageContainer/PageContainer.js +1 -1
- package/lib/PageContainer/PageContainer.web.js +85 -5
- package/lib/PageContainer/index.md +19 -19
- package/lib/PageContainer/props.d.ts +12 -7
- package/lib/Picker/Picker.js +67 -4
- package/lib/Picker/Picker.web.js +67 -4
- package/lib/Picker/index.md +9 -9
- package/lib/Picker/props.d.ts +2 -0
- package/lib/PickerView/PickerView.js +69 -4
- package/lib/PickerView/PickerView.web.js +69 -4
- package/lib/PickerView/index.md +8 -7
- package/lib/PickerView/props.d.ts +3 -0
- package/lib/PickerViewColumn/PickerViewColumn.android.js +1 -0
- package/lib/PickerViewColumn/PickerViewColumn.d.ts +4 -0
- package/lib/PickerViewColumn/PickerViewColumn.ios.js +1 -0
- package/lib/PickerViewColumn/PickerViewColumn.js +14 -0
- package/lib/PickerViewColumn/PickerViewColumn.native.d.ts +31 -0
- package/lib/PickerViewColumn/PickerViewColumn.tuya.d.ts +4 -0
- package/lib/PickerViewColumn/PickerViewColumn.tuya.js +71 -0
- package/lib/PickerViewColumn/PickerViewColumn.web.js +14 -0
- package/lib/PickerViewColumn/PickerViewColumn.wechat.d.ts +4 -0
- package/lib/PickerViewColumn/PickerViewColumn.wechat.js +72 -0
- package/lib/PickerViewColumn/index.android.js +1 -0
- package/lib/PickerViewColumn/index.d.ts +3 -0
- package/lib/PickerViewColumn/index.ios.js +1 -0
- package/lib/PickerViewColumn/index.js +3 -0
- package/lib/PickerViewColumn/index.md +21 -0
- package/lib/PickerViewColumn/index.module.less +8 -0
- package/lib/PickerViewColumn/index.tuya.js +3 -0
- package/lib/PickerViewColumn/index.web.js +3 -0
- package/lib/PickerViewColumn/index.wechat.js +3 -0
- package/lib/PickerViewColumn/props.android.js +1 -0
- package/lib/PickerViewColumn/props.d.ts +16 -0
- package/lib/PickerViewColumn/props.ios.js +1 -0
- package/lib/PickerViewColumn/props.js +1 -0
- package/lib/PickerViewColumn/props.tuya.js +1 -0
- package/lib/PickerViewColumn/props.web.js +1 -0
- package/lib/PickerViewColumn/props.wechat.js +1 -0
- package/lib/Radio/Radio.js +3 -6
- package/lib/Radio/Radio.web.js +3 -6
- package/lib/Radio/index.md +5 -5
- package/lib/RadioGroup/RadioGroup.js +50 -2
- package/lib/RadioGroup/RadioGroup.web.js +50 -2
- package/lib/RadioGroup/index.md +7 -5
- package/lib/RadioGroup/props.d.ts +3 -1
- package/lib/RichText/RichText.android.js +1 -0
- package/lib/RichText/RichText.d.ts +3 -0
- package/lib/RichText/RichText.ios.js +1 -0
- package/lib/RichText/RichText.js +9 -0
- package/lib/RichText/RichText.tuya.js +9 -0
- package/lib/RichText/RichText.web.d.ts +4 -0
- package/lib/RichText/RichText.web.js +7 -0
- package/lib/RichText/RichText.wechat.js +9 -0
- package/lib/RichText/index.android.js +1 -0
- package/lib/RichText/index.d.ts +3 -0
- package/lib/RichText/index.ios.js +1 -0
- package/lib/RichText/index.js +3 -0
- package/lib/RichText/index.md +117 -0
- package/lib/RichText/index.tuya.js +3 -0
- package/lib/RichText/index.web.js +3 -0
- package/lib/RichText/index.wechat.js +3 -0
- package/lib/RichText/props.android.js +0 -0
- package/lib/RichText/props.d.ts +29 -0
- package/lib/RichText/props.ios.js +0 -0
- package/lib/RichText/props.js +1 -0
- package/lib/RichText/props.tuya.js +1 -0
- package/lib/RichText/props.web.js +1 -0
- package/lib/RichText/props.wechat.js +1 -0
- package/lib/ScrollView/ScrollView.d.ts +1 -1
- package/lib/ScrollView/ScrollView.js +40 -155
- package/lib/ScrollView/ScrollView.web.js +40 -155
- package/lib/ScrollView/index.md +11 -11
- package/lib/Slider/Slider.js +31 -12
- package/lib/Slider/Slider.web.js +31 -12
- package/lib/Slider/index.md +17 -17
- package/lib/Swiper/Swiper.js +61 -2
- package/lib/Swiper/Swiper.web.js +61 -2
- package/lib/Swiper/index.md +14 -14
- package/lib/Switch/Switch.js +20 -6
- package/lib/Switch/Switch.web.js +20 -6
- package/lib/Switch/index.md +6 -6
- package/lib/Text/Text.js +6 -34
- package/lib/Text/Text.web.js +6 -34
- package/lib/Text/index.md +6 -6
- package/lib/TimePicker/TimePicker.js +35 -4
- package/lib/TimePicker/TimePicker.web.js +35 -4
- package/lib/TimePicker/index.md +9 -9
- package/lib/TimePicker/props.d.ts +2 -0
- package/lib/View/View.js +6 -5
- package/lib/View/View.web.js +6 -5
- package/lib/View/index.md +10 -10
- package/lib/index.android.js +1 -1
- package/lib/index.d.ts +3 -0
- package/lib/index.ios.js +1 -1
- package/lib/index.js +3 -0
- package/lib/index.tuya.js +3 -0
- package/lib/index.web.js +3 -0
- package/lib/index.wechat.js +3 -0
- package/lib/utils/handleProps.android.js +1 -0
- package/lib/utils/handleProps.d.ts +5 -0
- package/lib/utils/handleProps.ios.js +1 -0
- package/lib/utils/handleProps.js +50 -0
- package/lib/utils/handleProps.tuya.js +50 -0
- package/lib/utils/handleProps.web.js +50 -0
- package/lib/utils/handleProps.wechat.js +50 -0
- package/package.json +7 -5
@@ -0,0 +1,31 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
3
|
+
import { PickerViewProps } from './props';
|
4
|
+
interface IProps extends Omit<PickerViewProps, 'style'> {
|
5
|
+
style?: StyleProp<ViewStyle>;
|
6
|
+
}
|
7
|
+
interface IState {
|
8
|
+
selectIdx: number | number[];
|
9
|
+
}
|
10
|
+
export default class _Picker extends React.Component<IProps, IState> {
|
11
|
+
static displayName: string;
|
12
|
+
static defaultProps: {
|
13
|
+
value: number;
|
14
|
+
};
|
15
|
+
constructor(props: IProps);
|
16
|
+
componentDidUpdate(prevProps: Readonly<IProps>): void;
|
17
|
+
getItem: () => {
|
18
|
+
label: string;
|
19
|
+
value: string;
|
20
|
+
}[] | {
|
21
|
+
label: string;
|
22
|
+
value: string;
|
23
|
+
}[][];
|
24
|
+
onItemSelected: (event: any, isOnly: boolean, index: number) => void;
|
25
|
+
renderPickerItem: (item: {
|
26
|
+
label: string;
|
27
|
+
value: string;
|
28
|
+
}, selectIdx: number | number[], isOnly: boolean, index: number) => JSX.Element;
|
29
|
+
render(): React.ReactNode;
|
30
|
+
}
|
31
|
+
export {};
|
@@ -0,0 +1,71 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
3
|
+
var _excluded = ["className", "style", "id", "onChange", "range"];
|
4
|
+
import "core-js/modules/es.array.map.js";
|
5
|
+
import clsx from 'clsx';
|
6
|
+
import * as React from 'react';
|
7
|
+
import { inlineStyle } from '@ray-js/framework-shared';
|
8
|
+
import { PickerView as RemaxPickerView, PickerViewColumn as RemaxPickerViewColumn } from '@ray-js/remax-tuya';
|
9
|
+
import { View } from '@ray-js/components';
|
10
|
+
import styles from './index.module.less';
|
11
|
+
|
12
|
+
var Picker = function (props) {
|
13
|
+
var className = props.className,
|
14
|
+
style = props.style,
|
15
|
+
id = props.id,
|
16
|
+
onChange = props.onChange,
|
17
|
+
range = props.range,
|
18
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
19
|
+
|
20
|
+
var countArray = function (array) {
|
21
|
+
var countArr = 1;
|
22
|
+
|
23
|
+
var multiarr = function (arr) {
|
24
|
+
for (var i = 0; i < arr.length; i++) {
|
25
|
+
if (arr[i] instanceof Array) {
|
26
|
+
countArr++;
|
27
|
+
arr = arr[i];
|
28
|
+
multiarr(arr);
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
return countArr;
|
33
|
+
};
|
34
|
+
|
35
|
+
return multiarr(array);
|
36
|
+
};
|
37
|
+
|
38
|
+
return /*#__PURE__*/React.createElement(RemaxPickerView, _extends({
|
39
|
+
onChange: function handleChange(e) {
|
40
|
+
onChange === null || onChange === void 0 ? void 0 : onChange({
|
41
|
+
type: 'change',
|
42
|
+
value: e.detail.value,
|
43
|
+
origin: e
|
44
|
+
});
|
45
|
+
},
|
46
|
+
style: inlineStyle(style),
|
47
|
+
className: clsx(styles.pickerViewWrp, className)
|
48
|
+
}, restProps), function renderPickerColumn() {
|
49
|
+
if (countArray(props.range) > 1) {
|
50
|
+
return props.range.map(function (item, index) {
|
51
|
+
return /*#__PURE__*/React.createElement(RemaxPickerViewColumn, {
|
52
|
+
key: index
|
53
|
+
}, item.map(function (i, id) {
|
54
|
+
return /*#__PURE__*/React.createElement(View, {
|
55
|
+
key: id,
|
56
|
+
className: styles.pcWrp
|
57
|
+
}, i);
|
58
|
+
}));
|
59
|
+
});
|
60
|
+
} else {
|
61
|
+
return /*#__PURE__*/React.createElement(RemaxPickerViewColumn, null, range.map(function (item, index) {
|
62
|
+
return /*#__PURE__*/React.createElement(View, {
|
63
|
+
key: index,
|
64
|
+
className: styles.pcWrp
|
65
|
+
}, item);
|
66
|
+
}));
|
67
|
+
}
|
68
|
+
}());
|
69
|
+
};
|
70
|
+
|
71
|
+
export default Picker;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import handleProps from '../utils/handleProps';
|
3
|
+
|
4
|
+
var PickerViewColumn = function (props) {
|
5
|
+
var children = props.children;
|
6
|
+
return (
|
7
|
+
/*#__PURE__*/
|
8
|
+
// @ts-ignore
|
9
|
+
React.createElement("ty-picker-view-column", handleProps(props), children)
|
10
|
+
);
|
11
|
+
};
|
12
|
+
|
13
|
+
PickerViewColumn.displayName = 'PickerViewColumn';
|
14
|
+
export default PickerViewColumn;
|
@@ -0,0 +1,72 @@
|
|
1
|
+
import { PickerView as _PickerView } from "@remax/wechat/esm/hostComponents/PickerView/index";
|
2
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
3
|
+
import { PickerViewColumn as _PickerViewColumn } from "@remax/wechat/esm/hostComponents/PickerViewColumn/index";
|
4
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
5
|
+
var _excluded = ["className", "style", "id", "onChange", "range"];
|
6
|
+
import "core-js/modules/es.array.map.js";
|
7
|
+
import clsx from 'clsx';
|
8
|
+
import * as React from 'react';
|
9
|
+
import { inlineStyle } from '@ray-js/framework-shared';
|
10
|
+
import { View } from '@ray-js/components';
|
11
|
+
import styles from './index.module.less';
|
12
|
+
|
13
|
+
var Picker = function (props) {
|
14
|
+
var className = props.className,
|
15
|
+
style = props.style,
|
16
|
+
id = props.id,
|
17
|
+
onChange = props.onChange,
|
18
|
+
range = props.range,
|
19
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
20
|
+
|
21
|
+
var countArray = function (array) {
|
22
|
+
var countArr = 1;
|
23
|
+
|
24
|
+
var multiarr = function (arr) {
|
25
|
+
for (var i = 0; i < arr.length; i++) {
|
26
|
+
if (arr[i] instanceof Array) {
|
27
|
+
countArr++;
|
28
|
+
arr = arr[i];
|
29
|
+
multiarr(arr);
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
return countArr;
|
34
|
+
};
|
35
|
+
|
36
|
+
return multiarr(array);
|
37
|
+
};
|
38
|
+
|
39
|
+
return /*#__PURE__*/React.createElement(_PickerView, _extends({
|
40
|
+
onChange: function handleChange(e) {
|
41
|
+
onChange === null || onChange === void 0 ? void 0 : onChange({
|
42
|
+
type: 'change',
|
43
|
+
value: e.detail.value,
|
44
|
+
origin: e
|
45
|
+
});
|
46
|
+
},
|
47
|
+
style: inlineStyle(style),
|
48
|
+
className: clsx(styles.pickerViewWrp, className)
|
49
|
+
}, restProps), function renderPickerColumn() {
|
50
|
+
if (countArray(props.range) > 1) {
|
51
|
+
return props.range.map(function (item, index) {
|
52
|
+
return /*#__PURE__*/React.createElement(_PickerViewColumn, {
|
53
|
+
key: index
|
54
|
+
}, item.map(function (i, id) {
|
55
|
+
return /*#__PURE__*/React.createElement(View, {
|
56
|
+
key: id,
|
57
|
+
className: styles.pcWrp
|
58
|
+
}, i);
|
59
|
+
}));
|
60
|
+
});
|
61
|
+
} else {
|
62
|
+
return /*#__PURE__*/React.createElement(_PickerViewColumn, null, range.map(function (item, index) {
|
63
|
+
return /*#__PURE__*/React.createElement(View, {
|
64
|
+
key: index,
|
65
|
+
className: styles.pcWrp
|
66
|
+
}, item);
|
67
|
+
}));
|
68
|
+
}
|
69
|
+
}());
|
70
|
+
};
|
71
|
+
|
72
|
+
export default Picker;
|
@@ -0,0 +1 @@
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});var _exportNames={};exports.default=void 0;var _PickerViewColumn=_interopRequireDefault(require("./PickerViewColumn"));var _props=require("./props");Object.keys(_props).forEach(function(key){if(key==="default"||key==="__esModule")return;if(Object.prototype.hasOwnProperty.call(_exportNames,key))return;if(key in exports&&exports[key]===_props[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function get(){return _props[key];}});});var _default=_PickerViewColumn.default;exports.default=_default;
|
@@ -0,0 +1 @@
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});var _exportNames={};exports.default=void 0;var _PickerViewColumn=_interopRequireDefault(require("./PickerViewColumn"));var _props=require("./props");Object.keys(_props).forEach(function(key){if(key==="default"||key==="__esModule")return;if(Object.prototype.hasOwnProperty.call(_exportNames,key))return;if(key in exports&&exports[key]===_props[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function get(){return _props[key];}});});var _default=_PickerViewColumn.default;exports.default=_default;
|
@@ -0,0 +1,21 @@
|
|
1
|
+
---
|
2
|
+
nav:
|
3
|
+
title: 组件
|
4
|
+
path: /components
|
5
|
+
group:
|
6
|
+
title: 选择器组件
|
7
|
+
---
|
8
|
+
|
9
|
+
# PickerViewColumn
|
10
|
+
|
11
|
+
滚动选择器子项。需要配合 `<PickerView />` 使用, 仅可放置于 PickerView 中,其高度会自动设置成与 PickerView 的选中框的高度一致(仅支持 web)
|
12
|
+
|
13
|
+
## 示例代码
|
14
|
+
|
15
|
+
请参考 PickerView 组件
|
16
|
+
|
17
|
+
## 导入
|
18
|
+
|
19
|
+
```js
|
20
|
+
import { PickerViewColumn } from '@ray-js/components'
|
21
|
+
```
|
@@ -0,0 +1 @@
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:true});
|
@@ -0,0 +1,16 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
import { BaseProps } from '../types';
|
3
|
+
import { TouchEventHandler } from '@ray-js/framework-shared';
|
4
|
+
export interface PickerViewColumnProps extends BaseProps, TouchEventHandler {
|
5
|
+
children?: React.ReactNode | string;
|
6
|
+
}
|
7
|
+
export interface PickerViewProps extends BaseProps {
|
8
|
+
value?: number | number[];
|
9
|
+
fontSize?: number;
|
10
|
+
range?: string[] | string[][];
|
11
|
+
onChange?: (e: {
|
12
|
+
type: 'change';
|
13
|
+
value: number | number[];
|
14
|
+
origin?: any;
|
15
|
+
}) => void;
|
16
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:true});
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
package/lib/Radio/Radio.js
CHANGED
@@ -1,12 +1,9 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
+
import handleProps from '../utils/handleProps';
|
2
3
|
|
3
4
|
var Radio = function (props) {
|
4
|
-
|
5
|
-
|
6
|
-
color = props.color,
|
7
|
-
className = props.className,
|
8
|
-
style = props.style;
|
9
|
-
return /*#__PURE__*/React.createElement("div", null, "\u6682\u672A\u5B9E\u73B0");
|
5
|
+
// @ts-ignore
|
6
|
+
return /*#__PURE__*/React.createElement("ty-radio", handleProps(props));
|
10
7
|
};
|
11
8
|
|
12
9
|
Radio.displayName = 'Radio';
|
package/lib/Radio/Radio.web.js
CHANGED
@@ -1,12 +1,9 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
+
import handleProps from '../utils/handleProps';
|
2
3
|
|
3
4
|
var Radio = function (props) {
|
4
|
-
|
5
|
-
|
6
|
-
color = props.color,
|
7
|
-
className = props.className,
|
8
|
-
style = props.style;
|
9
|
-
return /*#__PURE__*/React.createElement("div", null, "\u6682\u672A\u5B9E\u73B0");
|
5
|
+
// @ts-ignore
|
6
|
+
return /*#__PURE__*/React.createElement("ty-radio", handleProps(props));
|
10
7
|
};
|
11
8
|
|
12
9
|
Radio.displayName = 'Radio';
|
package/lib/Radio/index.md
CHANGED
@@ -13,7 +13,7 @@ group:
|
|
13
13
|
## 导入
|
14
14
|
|
15
15
|
```js
|
16
|
-
import { Radio } from '@ray-js/components'
|
16
|
+
import { Radio } from '@ray-js/components'
|
17
17
|
```
|
18
18
|
|
19
19
|
## 示例代码
|
@@ -24,7 +24,7 @@ import { Radio } from '@ray-js/components';
|
|
24
24
|
|
25
25
|
| 属性 | 类型 | 默认值 | 说明 | 属性 |
|
26
26
|
| --- | --- | --- | --- | --- |
|
27
|
-
| value | string | | radio 标识。当该 radio 选中时,Radio.Group 的 change 事件会携带 radio 的 value | RN
|
28
|
-
| checked | boolean | false | 当前是否选中 | RN
|
29
|
-
| disabled | boolean | false | 是否禁用 | RN
|
30
|
-
| color | string | '#007AFF' | Radio 的颜色,同 css 的 color | RN
|
27
|
+
| value | string | | radio 标识。当该 radio 选中时,Radio.Group 的 change 事件会携带 radio 的 value | RN、涂鸦、微信、Web |
|
28
|
+
| checked | boolean | false | 当前是否选中 | RN、涂鸦、微信、Web |
|
29
|
+
| disabled | boolean | false | 是否禁用 | RN、涂鸦、微信、Web |
|
30
|
+
| color | string | '#007AFF' | Radio 的颜色,同 css 的 color | RN、涂鸦、微信、Web |
|
@@ -1,8 +1,56 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
2
|
+
import "core-js/modules/es.array.map.js";
|
1
3
|
import * as React from 'react';
|
4
|
+
import { useEventListener } from 'ahooks';
|
5
|
+
import handleProps from '../utils/handleProps';
|
2
6
|
|
3
7
|
var RadioGroup = function (props) {
|
4
|
-
props.
|
5
|
-
|
8
|
+
var options = props.options,
|
9
|
+
disabled = props.disabled,
|
10
|
+
children = props.children;
|
11
|
+
var currentNode = React.useRef(null);
|
12
|
+
useEventListener('change', function (e) {
|
13
|
+
var _props$onChange;
|
14
|
+
|
15
|
+
!disabled && ((_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, {
|
16
|
+
type: 'change',
|
17
|
+
value: e.detail.value
|
18
|
+
}));
|
19
|
+
}, {
|
20
|
+
target: currentNode
|
21
|
+
});
|
22
|
+
return (
|
23
|
+
/*#__PURE__*/
|
24
|
+
// @ts-ignore
|
25
|
+
React.createElement("ty-radio-group", _extends({}, handleProps(props), {
|
26
|
+
ref: currentNode
|
27
|
+
}), children || function renderOptions() {
|
28
|
+
return options.map(function (item, index) {
|
29
|
+
var _item$checked;
|
30
|
+
|
31
|
+
var radioProps = {
|
32
|
+
value: item.value,
|
33
|
+
color: item.color
|
34
|
+
};
|
35
|
+
|
36
|
+
if ((_item$checked = item.checked) !== null && _item$checked !== void 0 ? _item$checked : false) {
|
37
|
+
radioProps.checked = true;
|
38
|
+
}
|
39
|
+
|
40
|
+
if (disabled || item.disabled || false) {
|
41
|
+
radioProps.disabled = true;
|
42
|
+
}
|
43
|
+
|
44
|
+
return (
|
45
|
+
/*#__PURE__*/
|
46
|
+
// @ts-ignore
|
47
|
+
React.createElement("label", {
|
48
|
+
key: index + '_' + item.value
|
49
|
+
}, /*#__PURE__*/React.createElement("ty-radio", radioProps), item.label)
|
50
|
+
);
|
51
|
+
});
|
52
|
+
}())
|
53
|
+
);
|
6
54
|
};
|
7
55
|
|
8
56
|
RadioGroup.displayName = 'RadioGroup';
|
@@ -1,8 +1,56 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
2
|
+
import "core-js/modules/es.array.map.js";
|
1
3
|
import * as React from 'react';
|
4
|
+
import { useEventListener } from 'ahooks';
|
5
|
+
import handleProps from '../utils/handleProps';
|
2
6
|
|
3
7
|
var RadioGroup = function (props) {
|
4
|
-
props.
|
5
|
-
|
8
|
+
var options = props.options,
|
9
|
+
disabled = props.disabled,
|
10
|
+
children = props.children;
|
11
|
+
var currentNode = React.useRef(null);
|
12
|
+
useEventListener('change', function (e) {
|
13
|
+
var _props$onChange;
|
14
|
+
|
15
|
+
!disabled && ((_props$onChange = props.onChange) === null || _props$onChange === void 0 ? void 0 : _props$onChange.call(props, {
|
16
|
+
type: 'change',
|
17
|
+
value: e.detail.value
|
18
|
+
}));
|
19
|
+
}, {
|
20
|
+
target: currentNode
|
21
|
+
});
|
22
|
+
return (
|
23
|
+
/*#__PURE__*/
|
24
|
+
// @ts-ignore
|
25
|
+
React.createElement("ty-radio-group", _extends({}, handleProps(props), {
|
26
|
+
ref: currentNode
|
27
|
+
}), children || function renderOptions() {
|
28
|
+
return options.map(function (item, index) {
|
29
|
+
var _item$checked;
|
30
|
+
|
31
|
+
var radioProps = {
|
32
|
+
value: item.value,
|
33
|
+
color: item.color
|
34
|
+
};
|
35
|
+
|
36
|
+
if ((_item$checked = item.checked) !== null && _item$checked !== void 0 ? _item$checked : false) {
|
37
|
+
radioProps.checked = true;
|
38
|
+
}
|
39
|
+
|
40
|
+
if (disabled || item.disabled || false) {
|
41
|
+
radioProps.disabled = true;
|
42
|
+
}
|
43
|
+
|
44
|
+
return (
|
45
|
+
/*#__PURE__*/
|
46
|
+
// @ts-ignore
|
47
|
+
React.createElement("label", {
|
48
|
+
key: index + '_' + item.value
|
49
|
+
}, /*#__PURE__*/React.createElement("ty-radio", radioProps), item.label)
|
50
|
+
);
|
51
|
+
});
|
52
|
+
}())
|
53
|
+
);
|
6
54
|
};
|
7
55
|
|
8
56
|
RadioGroup.displayName = 'RadioGroup';
|
package/lib/RadioGroup/index.md
CHANGED
@@ -13,20 +13,22 @@ group:
|
|
13
13
|
## 导入
|
14
14
|
|
15
15
|
```js
|
16
|
-
import { RadioGroup } from '@ray-js/components'
|
16
|
+
import { RadioGroup } from '@ray-js/components'
|
17
17
|
```
|
18
18
|
|
19
19
|
## 示例代码
|
20
20
|
|
21
|
-
<code src="./demos/group.tsx" title="
|
21
|
+
<code src="./demos/group.tsx" title="一组数据 - 选项" background="#f2f4f6" height="500px" />
|
22
|
+
<code src="./demos/groupChildren.tsx" title="一组数据 - 子节点(仅支持web端)" background="#f2f4f6" height="500px" />
|
23
|
+
<code src="./demos/groupDisabled.tsx" title="全部禁止" background="#f2f4f6" height="500px" />
|
22
24
|
|
23
25
|
## Props
|
24
26
|
|
25
27
|
| 属性 | 类型 | 是否必填 | 默认值 | 说明 | 支持平台 |
|
26
28
|
| --- | --- | --- | --- | --- | --- |
|
27
|
-
| options | RadioOption[] | 是 | | 组项 | RN
|
28
|
-
| disabled | boolean | 否 | false | 是否禁用 | RN
|
29
|
-
| onChange | (event: { type: 'change'; value: string[] }) => void | 否 | | 选中项发生改变时触发 change 事件 | RN
|
29
|
+
| options | RadioOption[] | 是 | | 组项(Web 端非必填) | RN、涂鸦、微信、Web |
|
30
|
+
| disabled | boolean | 否 | false | 是否禁用 | RN、涂鸦、微信、Web |
|
31
|
+
| onChange | (event: { type: 'change'; value: string[] }) => void | 否 | | 选中项发生改变时触发 change 事件 | RN、涂鸦、微信、Web |
|
30
32
|
|
31
33
|
### RadioOption
|
32
34
|
|
@@ -1,14 +1,16 @@
|
|
1
|
+
/// <reference types="react" />
|
1
2
|
import { BaseProps, TouchEventHandler } from '../types';
|
2
3
|
import { RadioProps } from '../Radio/props';
|
3
4
|
export declare type RadioGroupOption = RadioProps & {
|
4
5
|
label: string;
|
5
6
|
};
|
6
7
|
export interface RadioGroupProps extends BaseProps, TouchEventHandler {
|
7
|
-
options
|
8
|
+
options?: RadioGroupOption[];
|
8
9
|
name?: string;
|
9
10
|
disabled?: boolean;
|
10
11
|
onChange?: (event: {
|
11
12
|
type: 'change';
|
12
13
|
value: string[];
|
13
14
|
}) => void;
|
15
|
+
children?: React.ReactNode;
|
14
16
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var React=_interopRequireWildcard(require("react"));var _components=require("@ray-js/components");var _this=this,_jsxFileName="/drone/src/packages/components/src/RichText/RichText.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 RichText=function(){return React.createElement(_components.Text,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:5,columnNumber:10}},"\u6682\u672A\u5B9E\u73B0");};RichText.displayName='RichText';var _default=RichText;exports.default=_default;
|
@@ -0,0 +1 @@
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var React=_interopRequireWildcard(require("react"));var _components=require("@ray-js/components");var _this=this,_jsxFileName="/drone/src/packages/components/src/RichText/RichText.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 RichText=function(){return React.createElement(_components.Text,{__self:_this,__source:{fileName:_jsxFileName,lineNumber:5,columnNumber:10}},"\u6682\u672A\u5B9E\u73B0");};RichText.displayName='RichText';var _default=RichText;exports.default=_default;
|
@@ -0,0 +1 @@
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});var _exportNames={};exports.default=void 0;var _RichText=_interopRequireDefault(require("./RichText"));var _props=require("./props");Object.keys(_props).forEach(function(key){if(key==="default"||key==="__esModule")return;if(Object.prototype.hasOwnProperty.call(_exportNames,key))return;if(key in exports&&exports[key]===_props[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function get(){return _props[key];}});});var _default=_RichText.default;exports.default=_default;
|
@@ -0,0 +1 @@
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});var _exportNames={};exports.default=void 0;var _RichText=_interopRequireDefault(require("./RichText"));var _props=require("./props");Object.keys(_props).forEach(function(key){if(key==="default"||key==="__esModule")return;if(Object.prototype.hasOwnProperty.call(_exportNames,key))return;if(key in exports&&exports[key]===_props[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function get(){return _props[key];}});});var _default=_RichText.default;exports.default=_default;
|