New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-calendar-timeline

Package Overview
Dependencies
Maintainers
1
Versions
134
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-calendar-timeline - npm Package Compare versions

Comparing version 0.20.0 to 0.21.0

12

CHANGELOG.md

@@ -10,2 +10,14 @@ # Change Log

### 0.21.0
#### fixes
* fix item dimensions not being rendered on zoom in/out @ilaiwi + @acemac
* correct `right_sidebar` to `rightTitle` in readme @maxlibin
#### breaking changes
* add `rct` to `.top-header` and `.bottom-header` to become `.rct-top-header` and `.rct-bottom-header` @Simek
* upgrade dev dependance `react@16.3` @acemac
### 0.20.0

@@ -12,0 +24,0 @@

4

lib/lib/layout/TimelineElementsHeader.js

@@ -212,3 +212,3 @@ 'use strict';

{
className: 'top-header',
className: 'rct-top-header',
style: { height: twoHeaders ? headerLabelGroupHeight : 0, width: canvasWidth }

@@ -221,3 +221,3 @@ },

{
className: 'bottom-header',
className: 'rct-bottom-header',
style: { height: headerLabelHeight, width: canvasWidth }

@@ -224,0 +224,0 @@ },

@@ -363,10 +363,10 @@ 'use strict';

* within the canvas area
* @param {item[]} items
* @param {group[]} groups
* @param {number} canvasTimeStart
* @param {number} visibleTimeStart
* @param {number} visibleTimeEnd
* @param {number} width
* @param {*} props
* @param {*} state
* @param {item[]} items
* @param {group[]} groups
* @param {number} canvasTimeStart
* @param {number} visibleTimeStart
* @param {number} visibleTimeEnd
* @param {number} width
* @param {*} props
* @param {*} state
*/

@@ -457,9 +457,9 @@ function stackItems(items, groups, canvasTimeStart, visibleTimeStart, visibleTimeEnd, width, props, state) {

* does not fit within the existing
* @param {number} visibleTimeStart
* @param {number} visibleTimeEnd
* @param {boolean} forceUpdateDimensions
* @param {*} items
* @param {*} groups
* @param {*} props
* @param {*} state
* @param {number} visibleTimeStart
* @param {number} visibleTimeEnd
* @param {boolean} forceUpdateDimensions
* @param {*} items
* @param {*} groups
* @param {*} props
* @param {*} state
*/

@@ -469,7 +469,7 @@ function calculateScrollCanvas(visibleTimeStart, visibleTimeEnd, forceUpdateDimensions, items, groups, props, state) {

var oldZoom = state.visibleTimeEnd - state.visibleTimeStart;
var newZoom = visibleTimeEnd - visibleTimeStart;
var newState = { visibleTimeStart: visibleTimeStart, visibleTimeEnd: visibleTimeEnd
// Check if the current canvas covers the new times
};var canKeepCanvas = visibleTimeStart >= oldCanvasTimeStart + oldZoom * 0.5 && visibleTimeStart <= oldCanvasTimeStart + oldZoom * 1.5 && visibleTimeEnd >= oldCanvasTimeStart + oldZoom * 1.5 && visibleTimeEnd <= oldCanvasTimeStart + oldZoom * 2.5;
};var canKeepCanvas = newZoom === oldZoom && visibleTimeStart >= oldCanvasTimeStart + oldZoom * 0.5 && visibleTimeStart <= oldCanvasTimeStart + oldZoom * 1.5 && visibleTimeEnd >= oldCanvasTimeStart + oldZoom * 1.5 && visibleTimeEnd <= oldCanvasTimeStart + oldZoom * 2.5;

@@ -476,0 +476,0 @@ if (!canKeepCanvas || forceUpdateDimensions) {

{
"name": "react-calendar-timeline",
"version": "0.20.0",
"version": "0.21.0",
"description": "react calendar timeline",

@@ -14,3 +14,4 @@ "main": "lib/index.js",

"start": "webpack-dev-server --hot --host 0.0.0.0 --display-modules",
"test": "jest"
"test": "jest",
"test:watch": "jest --watch"
},

@@ -52,3 +53,3 @@ "files": [

{
"name": "Alex Maclean",
"name":"Alex Maclean",
"url": "https://github.com/acemac"

@@ -102,4 +103,4 @@ },

"prop-types": "^15.6.2",
"react": ">=16",
"react-dom": ">=16"
"react": ">=16.3",
"react-dom": ">=16.3"
},

@@ -106,0 +107,0 @@ "devDependencies": {

@@ -794,3 +794,3 @@ # React Calendar Timeline

And add `right_sidebar` prop to the groups objects:
And add `rightTitle` prop to the groups objects:

@@ -801,3 +801,3 @@ ```js

title: 'group 1',
right_sidebar: 'additional info about group 1'
rightTitle: 'additional info about group 1'
}

@@ -804,0 +804,0 @@ ```

@@ -235,3 +235,3 @@ import PropTypes from 'prop-types'

<div
className="top-header"
className="rct-top-header"
style={{ height: twoHeaders ? headerLabelGroupHeight : 0, width: canvasWidth }}

@@ -242,3 +242,3 @@ >

<div
className="bottom-header"
className="rct-bottom-header"
style={{ height: headerLabelHeight, width: canvasWidth }}

@@ -245,0 +245,0 @@ >

@@ -67,3 +67,3 @@ import moment from 'moment'

let value = time.get(unit)
time.set(unit, value - value % timeSteps[unit])
time.set(unit, value - (value % timeSteps[unit]))
}

@@ -262,3 +262,3 @@

groupedItems.forEach(function(group) {
var groupVal = groups[k++];
var groupVal = groups[k++]

@@ -322,3 +322,5 @@ // calculate new, non-overlapping positions

export function nostack(items, groupOrders, lineHeight, groups) {
var i, j=0, iMax
var i,
j = 0,
iMax

@@ -333,3 +335,3 @@ var totalHeight = 0

groupedItems.forEach(function(group) {
var groupVal = groups[j++];
var groupVal = groups[j++]

@@ -351,4 +353,4 @@ // calculate new, non-overlapping positions

if (groupVal.height) {
groupHeights.push(groupVal.height);
totalHeight += groupVal.height;
groupHeights.push(groupVal.height)
totalHeight += groupVal.height
} else {

@@ -369,20 +371,20 @@ groupHeights.push(Math.max(groupHeight, lineHeight))

* within the canvas area
* @param {item[]} items
* @param {group[]} groups
* @param {number} canvasTimeStart
* @param {number} visibleTimeStart
* @param {number} visibleTimeEnd
* @param {number} width
* @param {*} props
* @param {*} state
* @param {item[]} items
* @param {group[]} groups
* @param {number} canvasTimeStart
* @param {number} visibleTimeStart
* @param {number} visibleTimeEnd
* @param {number} width
* @param {*} props
* @param {*} state
*/
export function stackItems(
items,
groups,
canvasTimeStart,
visibleTimeStart,
visibleTimeEnd,
width,
props,
state
items,
groups,
canvasTimeStart,
visibleTimeStart,
visibleTimeEnd,
width,
props,
state
) {

@@ -425,3 +427,2 @@ // if there are no groups return an empty array of dimensions

let dimensionItems = visibleItems.reduce((memo, item) => {

@@ -432,3 +433,2 @@ const itemId = _get(item, keys.itemIdKey)

let dimension = calculateDimensions({

@@ -482,21 +482,22 @@ itemTimeStart: _get(item, keys.itemTimeStartKey),

* does not fit within the existing
* @param {number} visibleTimeStart
* @param {number} visibleTimeEnd
* @param {boolean} forceUpdateDimensions
* @param {*} items
* @param {*} groups
* @param {*} props
* @param {*} state
* @param {number} visibleTimeStart
* @param {number} visibleTimeEnd
* @param {boolean} forceUpdateDimensions
* @param {*} items
* @param {*} groups
* @param {*} props
* @param {*} state
*/
export function calculateScrollCanvas(
visibleTimeStart,
visibleTimeEnd,
forceUpdateDimensions,
items,
groups,
props,
state) {
visibleTimeStart,
visibleTimeEnd,
forceUpdateDimensions,
items,
groups,
props,
state
) {
const oldCanvasTimeStart = state.canvasTimeStart
const oldZoom = state.visibleTimeEnd - state.visibleTimeStart
const newZoom = visibleTimeEnd - visibleTimeStart
const newState = { visibleTimeStart, visibleTimeEnd }

@@ -506,2 +507,3 @@

const canKeepCanvas =
newZoom === oldZoom &&
visibleTimeStart >= oldCanvasTimeStart + oldZoom * 0.5 &&

@@ -511,18 +513,22 @@ visibleTimeStart <= oldCanvasTimeStart + oldZoom * 1.5 &&

visibleTimeEnd <= oldCanvasTimeStart + oldZoom * 2.5
if (!canKeepCanvas || forceUpdateDimensions) {
newState.canvasTimeStart = visibleTimeStart - (visibleTimeEnd - visibleTimeStart)
newState.canvasTimeStart =
visibleTimeStart - (visibleTimeEnd - visibleTimeStart)
// The canvas cannot be kept, so calculate the new items position
Object.assign(newState, stackItems(
items,
groups,
newState.canvasTimeStart,
visibleTimeStart,
visibleTimeEnd,
state.width,
props,
state
))
Object.assign(
newState,
stackItems(
items,
groups,
newState.canvasTimeStart,
visibleTimeStart,
visibleTimeEnd,
state.width,
props,
state
)
)
}
return newState
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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