bee-datepicker
Advanced tools
Comparing version
@@ -109,3 +109,3 @@ "use strict"; | ||
this.setState({ | ||
panelValue: value ? null : nextProps.panelValue | ||
panelValue: value ? null : (0, _moment2["default"])(nextProps.panelValue) | ||
}); | ||
@@ -496,3 +496,4 @@ } | ||
inputValue: '', | ||
value: '' | ||
value: '', | ||
panelValue: null | ||
}); | ||
@@ -499,0 +500,0 @@ _this3.fireChange('', ''); |
@@ -114,2 +114,3 @@ "use strict"; | ||
var initialValue = props.value || props.defaultValue; | ||
_this.state = { | ||
@@ -119,3 +120,3 @@ hoverValue: [], | ||
open: props.open || false, | ||
panelValues: props.value || props.defaultValue ? null : _this.modifyPanelValues(props.panelValues) | ||
panelValues: initialValue && initialValue.length ? null : _this.modifyPanelValues(props.panelValues) | ||
}; | ||
@@ -134,4 +135,7 @@ return _this; | ||
if ("panelValues" in nextProps) { | ||
var isValueEmpty = !value.some(function (item) { | ||
return item; | ||
}); | ||
this.setState({ | ||
panelValues: value ? null : this.modifyPanelValues(nextProps.panelValues) | ||
panelValues: !isValueEmpty ? null : this.modifyPanelValues(nextProps.panelValues) | ||
}); | ||
@@ -138,0 +142,0 @@ } |
@@ -153,3 +153,2 @@ 'use strict'; | ||
var selected = false; | ||
if (isSameDay(current, today)) { | ||
@@ -159,3 +158,11 @@ cls += ' ' + todayClass; | ||
} | ||
var _props = this.props, | ||
panelValue = _props.panelValue, | ||
noCurrentDate = _props.noCurrentDate; | ||
if (panelValue && !noCurrentDate && isSameDay(current, panelValue)) { | ||
cls += ' ' + todayClass; | ||
isCurrentWeek = true; | ||
} | ||
var isBeforeCurrentMonthYear = beforeCurrentMonthYear(current, value); | ||
@@ -162,0 +169,0 @@ var isAfterCurrentMonthYear = afterCurrentMonthYear(current, value); |
@@ -87,3 +87,4 @@ 'use strict'; | ||
onInputBlur = props.onInputBlur, | ||
validatorFunc = props.validatorFunc; | ||
validatorFunc = props.validatorFunc, | ||
noCurrentDate = props.noCurrentDate; | ||
@@ -169,3 +170,5 @@ var shouldShowTimePicker = showTimePicker && timePicker; | ||
showWeekNumber: props.showWeekNumber, | ||
value: this.state.panelValue || value | ||
value: this.state.panelValue || value, | ||
panelValue: this.state.panelValue, | ||
noCurrentDate: noCurrentDate | ||
})) | ||
@@ -172,0 +175,0 @@ ) |
@@ -317,3 +317,5 @@ 'use strict'; | ||
onInputBlur: onEndInputBlur | ||
}, rightPanelValue)) | ||
}, rightPanelValue, { | ||
noCurrentDate: true | ||
})) | ||
), | ||
@@ -320,0 +322,0 @@ _react2["default"].createElement( |
@@ -0,1 +1,15 @@ | ||
## [2.4.3](https://github.com/tinper-bee/bee-datepicker/compare/v2.4.2...v2.4.3) (2021-02-04) | ||
### Bug Fixes | ||
* 修改value和panelValue的变化 ([03c7e48](https://github.com/tinper-bee/bee-datepicker/commit/03c7e48643779083a0d22114e1a0eb847369f99c)) | ||
### Features | ||
* 支持显示默认传入的日期高亮 ([ecf33c7](https://github.com/tinper-bee/bee-datepicker/commit/ecf33c7dd866b29abc0b1a259dad70928ac1bc23)) | ||
## [2.4.2](https://github.com/tinper-bee/bee-datepicker/compare/v2.4.1...v2.4.2) (2021-02-03) | ||
@@ -2,0 +16,0 @@ |
{ | ||
"name": "bee-datepicker", | ||
"version": "2.4.2", | ||
"version": "2.4.3", | ||
"description": "DatePicker ui component for react", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -66,3 +66,3 @@ /** | ||
this.setState({ | ||
panelValue: value ? null : nextProps.panelValue | ||
panelValue: value ? null : moment(nextProps.panelValue) | ||
}); | ||
@@ -277,3 +277,4 @@ } | ||
inputValue:'', | ||
value:'' | ||
value:'', | ||
panelValue: null | ||
}) | ||
@@ -280,0 +281,0 @@ this.fireChange('',''); |
@@ -54,2 +54,3 @@ /** | ||
super(props, context); | ||
const initialValue = props.value || props.defaultValue | ||
this.state = { | ||
@@ -59,3 +60,3 @@ hoverValue: [], | ||
open: props.open||false, | ||
panelValues: (props.value || props.defaultValue) ? null : this.modifyPanelValues(props.panelValues) | ||
panelValues: (initialValue && initialValue.length) ? null : this.modifyPanelValues(props.panelValues) | ||
}; | ||
@@ -113,4 +114,5 @@ } | ||
if ("panelValues" in nextProps) { | ||
const isValueEmpty = !value.some(item => item) | ||
this.setState({ | ||
panelValues: value ? null : this.modifyPanelValues(nextProps.panelValues) | ||
panelValues: !isValueEmpty ? null : this.modifyPanelValues(nextProps.panelValues) | ||
}); | ||
@@ -117,0 +119,0 @@ } |
@@ -126,3 +126,2 @@ import React from 'react'; | ||
let selected = false; | ||
if (isSameDay(current, today)) { | ||
@@ -132,2 +131,7 @@ cls += ` ${todayClass}`; | ||
} | ||
const { panelValue, noCurrentDate } = this.props | ||
if (panelValue && !noCurrentDate && (isSameDay(current, panelValue))) { | ||
cls += ` ${todayClass}`; | ||
isCurrentWeek = true; | ||
} | ||
@@ -134,0 +138,0 @@ const isBeforeCurrentMonthYear = beforeCurrentMonthYear(current, value); |
@@ -59,3 +59,3 @@ import React from 'react'; | ||
clearIcon,renderError,inputTabIndex, | ||
onInputBlur,validatorFunc | ||
onInputBlur,validatorFunc,noCurrentDate | ||
} = props; | ||
@@ -140,2 +140,4 @@ const shouldShowTimePicker = showTimePicker && timePicker; | ||
value={this.state.panelValue || value} | ||
panelValue={this.state.panelValue} | ||
noCurrentDate={noCurrentDate} | ||
/> | ||
@@ -142,0 +144,0 @@ </div> |
@@ -757,2 +757,3 @@ import React from 'react'; | ||
{...rightPanelValue} | ||
noCurrentDate | ||
/> | ||
@@ -759,0 +760,0 @@ </div> |
671627
0.24%16574
0.17%