@rax-ui/select
Advanced tools
+1
-1
@@ -48,3 +48,3 @@ import { HTMLAttributes, RaxNode } from 'rax'; | ||
| prepend?: RaxNode; | ||
| renderSelection?: (value: any, valueLabel: any) => RaxNode; | ||
| renderSelection?: (value: any, valueLabel: any, item: any) => RaxNode; | ||
| renderPicker?: (props: SelectPickerProps) => RaxNode; | ||
@@ -51,0 +51,0 @@ onClick?: any; |
+9
-3
@@ -41,3 +41,4 @@ "use strict"; | ||
| var SelectBase = function SelectBase(props, ref) { | ||
| var data = props.data, | ||
| var _props$data = props.data, | ||
| data = _props$data === void 0 ? [] : _props$data, | ||
| label = props.label, | ||
@@ -47,2 +48,3 @@ labelWidth = props.labelWidth, | ||
| icon = props.icon, | ||
| type = props.type, | ||
| _props$actionIcon = props.actionIcon, | ||
@@ -82,3 +84,3 @@ actionIcon = _props$actionIcon === void 0 ? 'dropdown-down' : _props$actionIcon, | ||
| styles = _props$styles === void 0 ? {} : _props$styles, | ||
| others = _objectWithoutPropertiesLoose(props, ["data", "label", "labelWidth", "labelType", "icon", "actionIcon", "value", "defaultValue", "disabled", "readOnly", "solo", "outline", "placeholder", "helpText", "errorText", "align", "clear", "append", "prepend", "renderSelection", "renderPicker", "onClick", "onFocus", "onBlur", "onShow", "onHide", "onChange", "styles"]); | ||
| others = _objectWithoutPropertiesLoose(props, ["data", "label", "labelWidth", "labelType", "icon", "type", "actionIcon", "value", "defaultValue", "disabled", "readOnly", "solo", "outline", "placeholder", "helpText", "errorText", "align", "clear", "append", "prepend", "renderSelection", "renderPicker", "onClick", "onFocus", "onBlur", "onShow", "onHide", "onChange", "styles"]); | ||
@@ -101,2 +103,6 @@ var _useState = (0, _rax.useState)(false), | ||
| var item = (data || []).find(function (i) { | ||
| return i.value === selectValue; | ||
| }) || null; | ||
| if ('value' in props) { | ||
@@ -189,3 +195,3 @@ setSelectValue(value); | ||
| }) | ||
| }, selectValue && renderSelection ? renderSelection(selectValue, valueLabel) : (0, _rax.createElement)(_raxView.default, { | ||
| }, selectValue && type !== 'multiple' && renderSelection ? renderSelection(selectValue, valueLabel, item) : (0, _rax.createElement)(_raxView.default, { | ||
| style: { | ||
@@ -192,0 +198,0 @@ position: 'absolute', |
+1
-1
@@ -19,3 +19,3 @@ /// <reference types="rax" /> | ||
| } | ||
| declare const _default: import("@rax-types/rax").ForwardRefExoticComponent<Pick<CheckListPickerProps, "data" | "value" | "onHide" | "onChange" | "style" | "title" | "styles" | "visible" | "view" | "locale" | "multiple"> & import("@rax-types/rax").RefAttributes<any>>; | ||
| declare const _default: import("@rax-types/rax").ForwardRefExoticComponent<Pick<CheckListPickerProps, "data" | "value" | "onHide" | "onChange" | "style" | "title" | "styles" | "visible" | "view" | "multiple" | "locale"> & import("@rax-types/rax").RefAttributes<any>>; | ||
| export default _default; |
+3
-0
@@ -32,2 +32,4 @@ "use strict"; | ||
| var getLabel = function getLabel(value, data, type, delimiter) { | ||
| data = data || []; | ||
| if (!value || value.length === 0) { | ||
@@ -84,2 +86,3 @@ return ''; | ||
| styles: styles, | ||
| type: type, | ||
| renderPicker: function renderPicker(_ref) { | ||
@@ -86,0 +89,0 @@ var data = _ref.data, |
+9
-9
| { | ||
| "name": "@rax-ui/select", | ||
| "version": "1.0.0-beta.55", | ||
| "version": "1.0.0-beta.56", | ||
| "description": "Rax UI Select", | ||
@@ -23,10 +23,10 @@ "author": "jinli.lyy<jinli.lyy@alibaba-inc.com>", | ||
| "dependencies": { | ||
| "@rax-ui/button": "^1.0.0-beta.55", | ||
| "@rax-ui/check-list": "^1.0.0-beta.55", | ||
| "@rax-ui/drawer": "^1.0.0-beta.55", | ||
| "@rax-ui/list": "^1.0.0-beta.55", | ||
| "@rax-ui/locale": "^1.0.0-beta.55", | ||
| "@rax-ui/picker": "^1.0.0-beta.55", | ||
| "@rax-ui/styles": "^1.0.0-beta.55", | ||
| "@rax-ui/text-field": "^1.0.0-beta.55", | ||
| "@rax-ui/button": "^1.0.0-beta.56", | ||
| "@rax-ui/check-list": "^1.0.0-beta.56", | ||
| "@rax-ui/drawer": "^1.0.0-beta.56", | ||
| "@rax-ui/list": "^1.0.0-beta.56", | ||
| "@rax-ui/locale": "^1.0.0-beta.56", | ||
| "@rax-ui/picker": "^1.0.0-beta.56", | ||
| "@rax-ui/styles": "^1.0.0-beta.56", | ||
| "@rax-ui/text-field": "^1.0.0-beta.56", | ||
| "rax-scrollview": "^1.0.4", | ||
@@ -33,0 +33,0 @@ "rax-text": "^1.2.0", |
+6
-4
@@ -64,3 +64,3 @@ import { | ||
| prepend?: RaxNode; | ||
| renderSelection?: (value: any, valueLabel: any) => RaxNode; | ||
| renderSelection?: (value: any, valueLabel: any, item: any) => RaxNode; | ||
| renderPicker?: (props: SelectPickerProps) => RaxNode; | ||
@@ -77,3 +77,3 @@ onClick?: any; | ||
| const { | ||
| data, | ||
| data = [], | ||
| label, | ||
@@ -83,2 +83,3 @@ labelWidth, | ||
| icon, | ||
| type, | ||
| actionIcon = 'dropdown-down', | ||
@@ -114,2 +115,3 @@ value, | ||
| const [valueLabel, setValueLabel] = useState(''); | ||
| const item = (data || []).find((i) => i.value === selectValue) || null; | ||
@@ -192,4 +194,4 @@ if ('value' in props) { | ||
| > | ||
| {selectValue && renderSelection ? ( | ||
| renderSelection(selectValue, valueLabel) | ||
| {selectValue && type !== 'multiple' && renderSelection ? ( | ||
| renderSelection(selectValue, valueLabel, item) | ||
| ) : ( | ||
@@ -196,0 +198,0 @@ <View |
+2
-0
@@ -34,2 +34,3 @@ import { createElement, RefForwardingComponent, forwardRef } from 'rax'; | ||
| const getLabel = (value, data, type: SelectType, delimiter) => { | ||
| data = data || []; | ||
| if (!value || value.length === 0) { | ||
@@ -67,2 +68,3 @@ return ''; | ||
| styles={styles} | ||
| type={type} | ||
| renderPicker={({ data, value, visible, onHide, onChange, valueLabel, setValueLabel }) => { | ||
@@ -69,0 +71,0 @@ const pickerValue = value ? (Array.isArray(value) ? value : [value]) : []; |
54788
0.81%1539
0.72%