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
320
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.55 to 0.0.1-alpha.56

1

es/PanelContext.d.ts

@@ -18,4 +18,5 @@ import * as React from 'react';

hideRanges?: boolean;
open?: boolean;
}
declare const PanelContext: React.Context<PanelContextProps>;
export default PanelContext;

22

es/panels/TimePanel/TimeUnitColumn.js

@@ -31,2 +31,4 @@ "use strict";

var PanelContext_1 = __importDefault(require("../../PanelContext"));
function TimeUnitColumn(props) {

@@ -40,3 +42,6 @@ var prefixCls = props.prefixCls,

var cellPrefixCls = "".concat(prefixCls, "-cell");
var initRef = React.useRef(true);
var _React$useContext = React.useContext(PanelContext_1.default),
open = _React$useContext.open;
var ulRef = React.useRef(null);

@@ -48,8 +53,15 @@ var liRefs = React.useRef(new Map()); // `useLayoutEffect` here to avoid blink by duration is 0

if (li) {
uiUtil_1.scrollTo(ulRef.current, li.offsetTop, initRef.current ? 0 : 120);
if (li && open !== false) {
uiUtil_1.scrollTo(ulRef.current, li.offsetTop, 120);
}
}, [value]);
React.useLayoutEffect(function () {
if (open) {
var li = liRefs.current.get(value);
initRef.current = false;
}, [value]);
if (li) {
uiUtil_1.scrollTo(ulRef.current, li.offsetTop, 0);
}
}
}, [open]);
return React.createElement("ul", {

@@ -56,0 +68,0 @@ className: classnames_1.default("".concat(prefixCls, "-column"), _defineProperty({}, "".concat(prefixCls, "-column-active"), active)),

@@ -357,3 +357,4 @@ "use strict";

panelRef: panelDivRef,
onSelect: onContextSelect
onSelect: onContextSelect,
open: mergedOpen
}

@@ -360,0 +361,0 @@ }, React.createElement(PickerTrigger_1.default, {

@@ -345,3 +345,2 @@ "use strict";

var canTrigger = values === null || canStartValueTrigger && canEndValueTrigger;
console.log('>>>', canTrigger);

@@ -780,3 +779,4 @@ if (canTrigger) {

hideRanges: true,
onSelect: onContextSelect
onSelect: onContextSelect,
open: mergedOpen
}

@@ -783,0 +783,0 @@ }, React.createElement(PickerTrigger_1.default, {

@@ -22,11 +22,16 @@ "use strict";

var KeyCode_1 = __importDefault(require("rc-util/lib/KeyCode"));
var scrollIds = new Map();
/* eslint-disable no-param-reassign */
function scrollTo(element, to, duration) {
if (scrollIds.get(element)) {
cancelAnimationFrame(scrollIds.get(element));
} // jump to target if duration zero
function scrollTo(element, to, duration) {
// jump to target if duration zero
if (duration <= 0) {
requestAnimationFrame(function () {
scrollIds.set(element, requestAnimationFrame(function () {
element.scrollTop = to;
});
}));
return;

@@ -37,3 +42,3 @@ }

var perTick = difference / duration * 10;
requestAnimationFrame(function () {
scrollIds.set(element, requestAnimationFrame(function () {
element.scrollTop += perTick;

@@ -44,3 +49,3 @@

}
});
}));
}

@@ -47,0 +52,0 @@

@@ -18,4 +18,5 @@ import * as React from 'react';

hideRanges?: boolean;
open?: boolean;
}
declare const PanelContext: React.Context<PanelContextProps>;
export default PanelContext;

@@ -31,2 +31,4 @@ "use strict";

var PanelContext_1 = __importDefault(require("../../PanelContext"));
function TimeUnitColumn(props) {

@@ -40,3 +42,6 @@ var prefixCls = props.prefixCls,

var cellPrefixCls = "".concat(prefixCls, "-cell");
var initRef = React.useRef(true);
var _React$useContext = React.useContext(PanelContext_1.default),
open = _React$useContext.open;
var ulRef = React.useRef(null);

@@ -48,8 +53,15 @@ var liRefs = React.useRef(new Map()); // `useLayoutEffect` here to avoid blink by duration is 0

if (li) {
uiUtil_1.scrollTo(ulRef.current, li.offsetTop, initRef.current ? 0 : 120);
if (li && open !== false) {
uiUtil_1.scrollTo(ulRef.current, li.offsetTop, 120);
}
}, [value]);
React.useLayoutEffect(function () {
if (open) {
var li = liRefs.current.get(value);
initRef.current = false;
}, [value]);
if (li) {
uiUtil_1.scrollTo(ulRef.current, li.offsetTop, 0);
}
}
}, [open]);
return React.createElement("ul", {

@@ -56,0 +68,0 @@ className: classnames_1.default("".concat(prefixCls, "-column"), _defineProperty({}, "".concat(prefixCls, "-column-active"), active)),

@@ -357,3 +357,4 @@ "use strict";

panelRef: panelDivRef,
onSelect: onContextSelect
onSelect: onContextSelect,
open: mergedOpen
}

@@ -360,0 +361,0 @@ }, React.createElement(PickerTrigger_1.default, {

@@ -345,3 +345,2 @@ "use strict";

var canTrigger = values === null || canStartValueTrigger && canEndValueTrigger;
console.log('>>>', canTrigger);

@@ -780,3 +779,4 @@ if (canTrigger) {

hideRanges: true,
onSelect: onContextSelect
onSelect: onContextSelect,
open: mergedOpen
}

@@ -783,0 +783,0 @@ }, React.createElement(PickerTrigger_1.default, {

@@ -22,11 +22,16 @@ "use strict";

var KeyCode_1 = __importDefault(require("rc-util/lib/KeyCode"));
var scrollIds = new Map();
/* eslint-disable no-param-reassign */
function scrollTo(element, to, duration) {
if (scrollIds.get(element)) {
cancelAnimationFrame(scrollIds.get(element));
} // jump to target if duration zero
function scrollTo(element, to, duration) {
// jump to target if duration zero
if (duration <= 0) {
requestAnimationFrame(function () {
scrollIds.set(element, requestAnimationFrame(function () {
element.scrollTop = to;
});
}));
return;

@@ -37,3 +42,3 @@ }

var perTick = difference / duration * 10;
requestAnimationFrame(function () {
scrollIds.set(element, requestAnimationFrame(function () {
element.scrollTop += perTick;

@@ -44,3 +49,3 @@

}
});
}));
}

@@ -47,0 +52,0 @@

{
"name": "rc-picker",
"version": "0.0.1-alpha.55",
"version": "0.0.1-alpha.56",
"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