rc-picker
Advanced tools
Comparing version 0.0.1-alpha.50 to 0.0.1-alpha.51
@@ -17,4 +17,5 @@ import * as React from 'react'; | ||
onSelect?: OnSelect<any>; | ||
hideRanges?: boolean; | ||
} | ||
declare const PanelContext: React.Context<PanelContextProps>; | ||
export default PanelContext; |
@@ -93,6 +93,2 @@ "use strict"; | ||
var getExtraFooter_1 = __importDefault(require("./utils/getExtraFooter")); | ||
var getRanges_1 = __importDefault(require("./utils/getRanges")); | ||
function InnerPicker(props) { | ||
@@ -122,3 +118,2 @@ var _classnames_1$default2; | ||
open = props.open, | ||
mode = props.mode, | ||
defaultOpen = props.defaultOpen, | ||
@@ -132,3 +127,2 @@ suffixIcon = props.suffixIcon, | ||
pickerRef = props.pickerRef, | ||
renderExtraFooter = props.renderExtraFooter, | ||
onChange = props.onChange, | ||
@@ -138,3 +132,2 @@ onOpenChange = props.onOpenChange, | ||
onBlur = props.onBlur, | ||
onPanelChange = props.onPanelChange, | ||
onMouseDown = props.onMouseDown, | ||
@@ -145,6 +138,3 @@ onMouseUp = props.onMouseUp, | ||
onContextMenu = props.onContextMenu, | ||
onClick = props.onClick, | ||
onSelect = props.onSelect, | ||
_onOk = props.onOk, | ||
components = props.components; | ||
onClick = props.onClick; | ||
var inputRef = React.useRef(null); | ||
@@ -217,22 +207,5 @@ var needConfirmButton = picker === 'date' && !!showTime || picker === 'time'; // ============================= State ============================= | ||
triggerTextChange = _useTextValueMapping_2[1], | ||
resetText = _useTextValueMapping_2[2]; // ============================= Modes ============================= | ||
resetText = _useTextValueMapping_2[2]; // ============================ Trigger ============================ | ||
var _useMergeState_1$defa5 = useMergeState_1.default({ | ||
value: mode, | ||
defaultStateValue: picker | ||
}), | ||
_useMergeState_1$defa6 = _slicedToArray(_useMergeState_1$defa5, 2), | ||
mergedMode = _useMergeState_1$defa6[0], | ||
setInnerMode = _useMergeState_1$defa6[1]; | ||
var triggerModeChange = function triggerModeChange(newValue, newMode) { | ||
setInnerMode(newMode); | ||
if (onPanelChange) { | ||
onPanelChange(newValue, newMode); | ||
} | ||
}; // ============================ Trigger ============================ | ||
var triggerChange = function triggerChange(newValue) { | ||
@@ -340,30 +313,2 @@ setSelectedValue(newValue); | ||
var extraNode = getExtraFooter_1.default(prefixCls, mergedMode, renderExtraFooter); | ||
var rangesNode = getRanges_1.default({ | ||
prefixCls: prefixCls, | ||
components: components, | ||
needConfirmButton: needConfirmButton, | ||
okDisabled: !selectedValue, | ||
locale: locale, | ||
onNow: function onNow() { | ||
var now = generateConfig.getNow(); | ||
if (onSelect) { | ||
onSelect(now); | ||
} | ||
triggerChange(now); | ||
triggerOpen(false, true); | ||
}, | ||
onOk: function onOk() { | ||
if (selectedValue) { | ||
triggerChange(selectedValue); | ||
triggerOpen(false, true); | ||
if (_onOk) { | ||
_onOk(selectedValue); | ||
} | ||
} | ||
} | ||
}); | ||
var panel = React.createElement("div", { | ||
@@ -380,8 +325,4 @@ className: "".concat(prefixCls, "-panel-container"), | ||
tabIndex: -1, | ||
mode: mergedMode, | ||
onChange: setSelectedValue, | ||
onPanelChange: triggerModeChange | ||
})), React.createElement("div", { | ||
className: "".concat(prefixCls, "-footer") | ||
}, extraNode, rangesNode)); | ||
onChange: setSelectedValue | ||
}))); | ||
var suffixNode; | ||
@@ -388,0 +329,0 @@ |
@@ -122,3 +122,4 @@ "use strict"; | ||
panelDivRef = panelContext.panelRef, | ||
onContextSelect = panelContext.onSelect; | ||
onContextSelect = panelContext.onSelect, | ||
hideRanges = panelContext.hideRanges; | ||
@@ -350,3 +351,3 @@ var _React$useContext = React.useContext(RangeContext_1.default), | ||
if (!onContextSelect) { | ||
if (!hideRanges) { | ||
extraFooter = getExtraFooter_1.default(prefixCls, mergedMode, renderExtraFooter); | ||
@@ -359,2 +360,5 @@ rangesNode = getRanges_1.default({ | ||
locale: locale, | ||
onNow: needConfirmButton && function () { | ||
triggerSelect(generateConfig.getNow(), 'submit'); | ||
}, | ||
onOk: function onOk() { | ||
@@ -361,0 +365,0 @@ if (mergedValue) { |
@@ -771,2 +771,3 @@ "use strict"; | ||
onDateMouseLeave: onDateMouseLeave, | ||
hideRanges: true, | ||
onSelect: onContextSelect | ||
@@ -773,0 +774,0 @@ } |
@@ -8,4 +8,4 @@ /// <reference types="react" /> | ||
needConfirmButton: boolean; | ||
onNow?: null | (() => void); | ||
onOk?: null | (() => void); | ||
onNow?: null | (() => void) | false; | ||
onOk?: null | (() => void) | false; | ||
okDisabled?: boolean; | ||
@@ -12,0 +12,0 @@ locale: Locale; |
@@ -17,4 +17,5 @@ import * as React from 'react'; | ||
onSelect?: OnSelect<any>; | ||
hideRanges?: boolean; | ||
} | ||
declare const PanelContext: React.Context<PanelContextProps>; | ||
export default PanelContext; |
@@ -93,6 +93,2 @@ "use strict"; | ||
var getExtraFooter_1 = __importDefault(require("./utils/getExtraFooter")); | ||
var getRanges_1 = __importDefault(require("./utils/getRanges")); | ||
function InnerPicker(props) { | ||
@@ -122,3 +118,2 @@ var _classnames_1$default2; | ||
open = props.open, | ||
mode = props.mode, | ||
defaultOpen = props.defaultOpen, | ||
@@ -132,3 +127,2 @@ suffixIcon = props.suffixIcon, | ||
pickerRef = props.pickerRef, | ||
renderExtraFooter = props.renderExtraFooter, | ||
onChange = props.onChange, | ||
@@ -138,3 +132,2 @@ onOpenChange = props.onOpenChange, | ||
onBlur = props.onBlur, | ||
onPanelChange = props.onPanelChange, | ||
onMouseDown = props.onMouseDown, | ||
@@ -145,6 +138,3 @@ onMouseUp = props.onMouseUp, | ||
onContextMenu = props.onContextMenu, | ||
onClick = props.onClick, | ||
onSelect = props.onSelect, | ||
_onOk = props.onOk, | ||
components = props.components; | ||
onClick = props.onClick; | ||
var inputRef = React.useRef(null); | ||
@@ -217,22 +207,5 @@ var needConfirmButton = picker === 'date' && !!showTime || picker === 'time'; // ============================= State ============================= | ||
triggerTextChange = _useTextValueMapping_2[1], | ||
resetText = _useTextValueMapping_2[2]; // ============================= Modes ============================= | ||
resetText = _useTextValueMapping_2[2]; // ============================ Trigger ============================ | ||
var _useMergeState_1$defa5 = useMergeState_1.default({ | ||
value: mode, | ||
defaultStateValue: picker | ||
}), | ||
_useMergeState_1$defa6 = _slicedToArray(_useMergeState_1$defa5, 2), | ||
mergedMode = _useMergeState_1$defa6[0], | ||
setInnerMode = _useMergeState_1$defa6[1]; | ||
var triggerModeChange = function triggerModeChange(newValue, newMode) { | ||
setInnerMode(newMode); | ||
if (onPanelChange) { | ||
onPanelChange(newValue, newMode); | ||
} | ||
}; // ============================ Trigger ============================ | ||
var triggerChange = function triggerChange(newValue) { | ||
@@ -340,30 +313,2 @@ setSelectedValue(newValue); | ||
var extraNode = getExtraFooter_1.default(prefixCls, mergedMode, renderExtraFooter); | ||
var rangesNode = getRanges_1.default({ | ||
prefixCls: prefixCls, | ||
components: components, | ||
needConfirmButton: needConfirmButton, | ||
okDisabled: !selectedValue, | ||
locale: locale, | ||
onNow: function onNow() { | ||
var now = generateConfig.getNow(); | ||
if (onSelect) { | ||
onSelect(now); | ||
} | ||
triggerChange(now); | ||
triggerOpen(false, true); | ||
}, | ||
onOk: function onOk() { | ||
if (selectedValue) { | ||
triggerChange(selectedValue); | ||
triggerOpen(false, true); | ||
if (_onOk) { | ||
_onOk(selectedValue); | ||
} | ||
} | ||
} | ||
}); | ||
var panel = React.createElement("div", { | ||
@@ -380,8 +325,4 @@ className: "".concat(prefixCls, "-panel-container"), | ||
tabIndex: -1, | ||
mode: mergedMode, | ||
onChange: setSelectedValue, | ||
onPanelChange: triggerModeChange | ||
})), React.createElement("div", { | ||
className: "".concat(prefixCls, "-footer") | ||
}, extraNode, rangesNode)); | ||
onChange: setSelectedValue | ||
}))); | ||
var suffixNode; | ||
@@ -388,0 +329,0 @@ |
@@ -122,3 +122,4 @@ "use strict"; | ||
panelDivRef = panelContext.panelRef, | ||
onContextSelect = panelContext.onSelect; | ||
onContextSelect = panelContext.onSelect, | ||
hideRanges = panelContext.hideRanges; | ||
@@ -350,3 +351,3 @@ var _React$useContext = React.useContext(RangeContext_1.default), | ||
if (!onContextSelect) { | ||
if (!hideRanges) { | ||
extraFooter = getExtraFooter_1.default(prefixCls, mergedMode, renderExtraFooter); | ||
@@ -359,2 +360,5 @@ rangesNode = getRanges_1.default({ | ||
locale: locale, | ||
onNow: needConfirmButton && function () { | ||
triggerSelect(generateConfig.getNow(), 'submit'); | ||
}, | ||
onOk: function onOk() { | ||
@@ -361,0 +365,0 @@ if (mergedValue) { |
@@ -771,2 +771,3 @@ "use strict"; | ||
onDateMouseLeave: onDateMouseLeave, | ||
hideRanges: true, | ||
onSelect: onContextSelect | ||
@@ -773,0 +774,0 @@ } |
@@ -8,4 +8,4 @@ /// <reference types="react" /> | ||
needConfirmButton: boolean; | ||
onNow?: null | (() => void); | ||
onOk?: null | (() => void); | ||
onNow?: null | (() => void) | false; | ||
onOk?: null | (() => void) | false; | ||
okDisabled?: boolean; | ||
@@ -12,0 +12,0 @@ locale: Locale; |
{ | ||
"name": "rc-picker", | ||
"version": "0.0.1-alpha.50", | ||
"version": "0.0.1-alpha.51", | ||
"description": "React date & time picker", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
576563
13722