Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rc-picker

Package Overview
Dependencies
Maintainers
1
Versions
318
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-picker - npm Package Compare versions

Comparing version 0.0.1-alpha.41 to 0.0.1-alpha.42

26

es/hooks/usePickerInput.js

@@ -127,3 +127,8 @@ "use strict";

triggerOpen(false);
if (blurToCancel) {
onCancel();
} else {
triggerOpen(false);
}
setFocused(false);

@@ -141,15 +146,12 @@

if (open && isClickOutside(target)) {
preventBlurRef.current = true;
if (open) {
if (!isClickOutside(target)) {
preventBlurRef.current = true; // Always set back in case `onBlur` prevented by user
if (blurToCancel) {
onCancel();
} else {
window.setTimeout(function () {
preventBlurRef.current = false;
}, 0);
} else if (!focused) {
triggerOpen(false);
} // Always set back in case `onBlur` prevented by user
window.setTimeout(function () {
preventBlurRef.current = false;
}, 0);
}
}

@@ -156,0 +158,0 @@ });

@@ -243,3 +243,3 @@ "use strict";

isClickOutside: function isClickOutside(target) {
return !!(panelDivRef.current && !panelDivRef.current.contains(target) && inputDivRef.current && !inputDivRef.current.contains(target) && onOpenChange);
return !!(panelDivRef.current && !panelDivRef.current.contains(target) && inputDivRef.current && !inputDivRef.current.contains(target));
},

@@ -246,0 +246,0 @@ onSubmit: function onSubmit() {

@@ -338,3 +338,6 @@ "use strict";

var triggerChange = function triggerChange(newValue) {
var forceInput = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var _config$forceInput = config.forceInput,
forceInput = _config$forceInput === void 0 ? true : _config$forceInput,
source = config.source;
var values = newValue;

@@ -366,3 +369,5 @@ var startValue = miscUtil_1.getValue(values, 0);

_triggerOpen(false, activePickerIndex, true);
if (source !== 'open') {
_triggerOpen(false, activePickerIndex, true);
}

@@ -380,3 +385,5 @@ if (onChange && (!dateUtil_1.isEqual(generateConfig, miscUtil_1.getValue(mergedValue, 0), startValue) || !dateUtil_1.isEqual(generateConfig, miscUtil_1.getValue(mergedValue, 1), endValue))) {

_triggerOpen(true, missingValueIndex); // Delay to focus to avoid input blur trigger expired selectedValues
if (source !== 'open') {
_triggerOpen(true, missingValueIndex);
} // Delay to focus to avoid input blur trigger expired selectedValues

@@ -404,3 +411,5 @@

if (!preventChangeEvent) {
triggerChange(selectedValue);
triggerChange(selectedValue, {
source: 'open'
});
}

@@ -468,3 +477,3 @@ }

var getSharedInputHookProps = function getSharedInputHookProps(index, inputDivRef, resetText) {
var getSharedInputHookProps = function getSharedInputHookProps(index, resetText) {
return {

@@ -475,3 +484,3 @@ blurToCancel: !!(picker === 'date' && showTime),

isClickOutside: function isClickOutside(target) {
return !!(panelDivRef.current && !panelDivRef.current.contains(target) && inputDivRef.current && !inputDivRef.current.contains(target));
return !!(panelDivRef.current && !panelDivRef.current.contains(target) && startInputDivRef.current && !startInputDivRef.current.contains(target) && endInputDivRef.current && !endInputDivRef.current.contains(target));
},

@@ -501,3 +510,3 @@ onFocus: function onFocus(e) {

var _usePickerInput_1$def = usePickerInput_1.default(_objectSpread({}, getSharedInputHookProps(0, startInputDivRef, resetStartText), {
var _usePickerInput_1$def = usePickerInput_1.default(_objectSpread({}, getSharedInputHookProps(0, resetStartText), {
open: startOpen

@@ -511,3 +520,3 @@ })),

var _usePickerInput_1$def4 = usePickerInput_1.default(_objectSpread({}, getSharedInputHookProps(1, endInputDivRef, resetEndText), {
var _usePickerInput_1$def4 = usePickerInput_1.default(_objectSpread({}, getSharedInputHookProps(1, resetEndText), {
open: endOpen

@@ -761,3 +770,5 @@ })),

triggerChange(values, false);
triggerChange(values, {
forceInput: false
});
},

@@ -764,0 +775,0 @@ className: "".concat(prefixCls, "-clear")

@@ -127,3 +127,8 @@ "use strict";

triggerOpen(false);
if (blurToCancel) {
onCancel();
} else {
triggerOpen(false);
}
setFocused(false);

@@ -141,15 +146,12 @@

if (open && isClickOutside(target)) {
preventBlurRef.current = true;
if (open) {
if (!isClickOutside(target)) {
preventBlurRef.current = true; // Always set back in case `onBlur` prevented by user
if (blurToCancel) {
onCancel();
} else {
window.setTimeout(function () {
preventBlurRef.current = false;
}, 0);
} else if (!focused) {
triggerOpen(false);
} // Always set back in case `onBlur` prevented by user
window.setTimeout(function () {
preventBlurRef.current = false;
}, 0);
}
}

@@ -156,0 +158,0 @@ });

@@ -243,3 +243,3 @@ "use strict";

isClickOutside: function isClickOutside(target) {
return !!(panelDivRef.current && !panelDivRef.current.contains(target) && inputDivRef.current && !inputDivRef.current.contains(target) && onOpenChange);
return !!(panelDivRef.current && !panelDivRef.current.contains(target) && inputDivRef.current && !inputDivRef.current.contains(target));
},

@@ -246,0 +246,0 @@ onSubmit: function onSubmit() {

@@ -338,3 +338,6 @@ "use strict";

var triggerChange = function triggerChange(newValue) {
var forceInput = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var _config$forceInput = config.forceInput,
forceInput = _config$forceInput === void 0 ? true : _config$forceInput,
source = config.source;
var values = newValue;

@@ -366,3 +369,5 @@ var startValue = miscUtil_1.getValue(values, 0);

_triggerOpen(false, activePickerIndex, true);
if (source !== 'open') {
_triggerOpen(false, activePickerIndex, true);
}

@@ -380,3 +385,5 @@ if (onChange && (!dateUtil_1.isEqual(generateConfig, miscUtil_1.getValue(mergedValue, 0), startValue) || !dateUtil_1.isEqual(generateConfig, miscUtil_1.getValue(mergedValue, 1), endValue))) {

_triggerOpen(true, missingValueIndex); // Delay to focus to avoid input blur trigger expired selectedValues
if (source !== 'open') {
_triggerOpen(true, missingValueIndex);
} // Delay to focus to avoid input blur trigger expired selectedValues

@@ -404,3 +411,5 @@

if (!preventChangeEvent) {
triggerChange(selectedValue);
triggerChange(selectedValue, {
source: 'open'
});
}

@@ -468,3 +477,3 @@ }

var getSharedInputHookProps = function getSharedInputHookProps(index, inputDivRef, resetText) {
var getSharedInputHookProps = function getSharedInputHookProps(index, resetText) {
return {

@@ -475,3 +484,3 @@ blurToCancel: !!(picker === 'date' && showTime),

isClickOutside: function isClickOutside(target) {
return !!(panelDivRef.current && !panelDivRef.current.contains(target) && inputDivRef.current && !inputDivRef.current.contains(target));
return !!(panelDivRef.current && !panelDivRef.current.contains(target) && startInputDivRef.current && !startInputDivRef.current.contains(target) && endInputDivRef.current && !endInputDivRef.current.contains(target));
},

@@ -501,3 +510,3 @@ onFocus: function onFocus(e) {

var _usePickerInput_1$def = usePickerInput_1.default(_objectSpread({}, getSharedInputHookProps(0, startInputDivRef, resetStartText), {
var _usePickerInput_1$def = usePickerInput_1.default(_objectSpread({}, getSharedInputHookProps(0, resetStartText), {
open: startOpen

@@ -511,3 +520,3 @@ })),

var _usePickerInput_1$def4 = usePickerInput_1.default(_objectSpread({}, getSharedInputHookProps(1, endInputDivRef, resetEndText), {
var _usePickerInput_1$def4 = usePickerInput_1.default(_objectSpread({}, getSharedInputHookProps(1, resetEndText), {
open: endOpen

@@ -761,3 +770,5 @@ })),

triggerChange(values, false);
triggerChange(values, {
forceInput: false
});
},

@@ -764,0 +775,0 @@ className: "".concat(prefixCls, "-clear")

{
"name": "rc-picker",
"version": "0.0.1-alpha.41",
"version": "0.0.1-alpha.42",
"description": "React date & time picker",

@@ -5,0 +5,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc