Skip to content

Commit

Permalink
fix: 修复 range-input disabled失效问题 (#921)
Browse files Browse the repository at this point in the history
* fix: 修复 range-input disabled失效问题

* fix: 修复 range-input disabled失效问题
  • Loading branch information
honkinglin authored Jun 23, 2022
1 parent adf52b0 commit 9c06792
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/range-input/RangeInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ const RangeInput = React.forwardRef((props: RangeInputProps, ref: React.RefObjec
ref={wrapperRef}
style={style}
className={classNames(name, className, {
[`${classPrefix}-is-disabled`]: disabled,
[`${classPrefix}-is-focused`]: isFocused,
[`${classPrefix}-is-${status}`]: status,
[`${classPrefix}-size-l`]: size === 'large',
Expand Down
6 changes: 4 additions & 2 deletions src/range-input/RangeInputPopup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ const RangeInputPopup = React.forwardRef((props: RangeInputPopupProps, ref: Reac
const { classPrefix } = useConfig();
const name = `${classPrefix}-range-input-popup`;

const { className, style, inputValue, panel, popupProps, rangeInputProps, popupVisible, onInputChange } = props;
const { className, style, inputValue, panel, popupProps, rangeInputProps, popupVisible, onInputChange, disabled } =
props;

const { tOverlayStyle, innerPopupVisible, onInnerPopupVisibleChange } = useOverlayStyle(props);

Expand All @@ -33,11 +34,12 @@ const RangeInputPopup = React.forwardRef((props: RangeInputPopupProps, ref: Reac
placement="bottom-left"
visible={popupVisible ?? innerPopupVisible}
onVisibleChange={onInnerPopupVisibleChange}
disabled={disabled}
{...popupProps}
overlayStyle={tOverlayStyle}
className={popupClasses}
>
<RangeInput value={inputValue} onChange={onInputChange} {...rangeInputProps} />
<RangeInput disabled={disabled} value={inputValue} onChange={onInputChange} {...rangeInputProps} />
</Popup>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion src/range-input/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export interface TdRangeInputPopupProps {
* 是否禁用范围输入框,值为数组表示可分别控制某一个输入框是否禁用
* @default false
*/
disabled?: boolean | Array<boolean>;
disabled?: boolean;
/**
* 输入框的值
*/
Expand Down
2 changes: 1 addition & 1 deletion src/time-picker/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export interface TdTimeRangePickerProps {
* 是否禁用组件,值为数组表示可分别控制开始日期和结束日期是否禁用
* @default false
*/
disabled?: boolean | Array<boolean>;
disabled?: boolean;
/**
* 禁用时间项
*/
Expand Down

0 comments on commit 9c06792

Please sign in to comment.