@uiw/react-heat-map
Advanced tools
Comparing version 2.0.4 to 2.0.5
@@ -144,3 +144,2 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
} | ||
return obj; | ||
@@ -150,6 +149,4 @@ } | ||
function ownKeys(object, enumerableOnly) { | ||
var keys = Object.keys(object); | ||
if (Object.getOwnPropertySymbols) { | ||
@@ -161,6 +158,4 @@ var symbols = Object.getOwnPropertySymbols(object); | ||
} | ||
return keys; | ||
} | ||
function _objectSpread2(target) { | ||
@@ -175,3 +170,2 @@ for (var i = 1; i < arguments.length; i++) { | ||
} | ||
return target; | ||
@@ -185,3 +179,2 @@ } | ||
var key, i; | ||
for (i = 0; i < sourceKeys.length; i++) { | ||
@@ -192,3 +185,2 @@ key = sourceKeys[i]; | ||
} | ||
return target; | ||
@@ -202,6 +194,4 @@ } | ||
var key, i; | ||
if (Object.getOwnPropertySymbols) { | ||
var sourceSymbolKeys = Object.getOwnPropertySymbols(source); | ||
for (i = 0; i < sourceSymbolKeys.length; i++) { | ||
@@ -214,3 +204,2 @@ key = sourceSymbolKeys[i]; | ||
} | ||
return target; | ||
@@ -224,7 +213,5 @@ } | ||
if (len == null || len > arr.length) len = arr.length; | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) { | ||
arr2[i] = arr[i]; | ||
} | ||
return arr2; | ||
@@ -270,3 +257,2 @@ } | ||
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; | ||
if (_i == null) return; | ||
@@ -276,9 +262,6 @@ var _arr = []; | ||
var _d = false; | ||
var _s, _e; | ||
try { | ||
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { | ||
_arr.push(_s.value); | ||
if (i && _arr.length === i) break; | ||
@@ -296,3 +279,2 @@ } | ||
} | ||
return _arr; | ||
@@ -299,0 +281,0 @@ } |
@@ -11,7 +11,6 @@ import _extends from "@babel/runtime/helpers/extends"; | ||
var { | ||
prefixCls = 'w-heatmap', | ||
className | ||
} = props, | ||
others = _objectWithoutPropertiesLoose(props, _excluded); | ||
prefixCls = 'w-heatmap', | ||
className | ||
} = props, | ||
others = _objectWithoutPropertiesLoose(props, _excluded); | ||
var cls = [className, prefixCls].filter(Boolean).join(' '); | ||
@@ -18,0 +17,0 @@ return /*#__PURE__*/_jsx(SVG, _extends({ |
@@ -28,3 +28,2 @@ import React, { Fragment, useMemo } from 'react'; | ||
} | ||
return null; | ||
@@ -31,0 +30,0 @@ }).filter(Boolean).filter((item, idx, list) => list[idx - 1] && list[idx - 1].month !== item.month); |
@@ -20,3 +20,2 @@ import React, { Fragment, useMemo } from 'react'; | ||
} | ||
return null; | ||
@@ -23,0 +22,0 @@ }) |
@@ -9,12 +9,11 @@ import _extends from "@babel/runtime/helpers/extends"; | ||
var { | ||
panelColors, | ||
leftPad = 0, | ||
topPad = 0, | ||
space = 0, | ||
rectSize = 0, | ||
legendCellSize = 0, | ||
legendRender | ||
} = _ref, | ||
props = _objectWithoutPropertiesLoose(_ref, _excluded); | ||
panelColors, | ||
leftPad = 0, | ||
topPad = 0, | ||
space = 0, | ||
rectSize = 0, | ||
legendCellSize = 0, | ||
legendRender | ||
} = _ref, | ||
props = _objectWithoutPropertiesLoose(_ref, _excluded); | ||
var size = legendCellSize || rectSize; | ||
@@ -31,3 +30,2 @@ return useMemo(() => /*#__PURE__*/_jsx(Fragment, { | ||
}); | ||
if (legendRender) return legendRender(rectProps); | ||
@@ -34,0 +32,0 @@ return /*#__PURE__*/_jsx(Rect, _extends({}, rectProps)); |
@@ -14,24 +14,23 @@ import _extends from "@babel/runtime/helpers/extends"; | ||
var _ref = props || {}, | ||
{ | ||
rectSize = 11, | ||
legendCellSize = 11, | ||
space = 2, | ||
startDate = new Date(), | ||
endDate, | ||
rectProps, | ||
rectRender, | ||
legendRender, | ||
value = [], | ||
weekLabels = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], | ||
monthLabels = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], | ||
panelColors = { | ||
0: '#EBEDF0', | ||
8: '#7BC96F', | ||
4: '#C6E48B', | ||
12: '#239A3B', | ||
32: '#196127' | ||
} | ||
} = _ref, | ||
other = _objectWithoutPropertiesLoose(_ref, _excluded); | ||
{ | ||
rectSize = 11, | ||
legendCellSize = 11, | ||
space = 2, | ||
startDate = new Date(), | ||
endDate, | ||
rectProps, | ||
rectRender, | ||
legendRender, | ||
value = [], | ||
weekLabels = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], | ||
monthLabels = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], | ||
panelColors = { | ||
0: '#EBEDF0', | ||
8: '#7BC96F', | ||
4: '#C6E48B', | ||
12: '#239A3B', | ||
32: '#196127' | ||
} | ||
} = _ref, | ||
other = _objectWithoutPropertiesLoose(_ref, _excluded); | ||
var [gridNum, setGridNum] = useState(0); | ||
@@ -98,6 +97,4 @@ var [leftPad, setLeftPad] = useState(!!weekLabels ? 28 : 5); | ||
}); | ||
var currentDate = new Date(initStartDate.getTime() + oneDayTime * (idx * 7 + cidx)); | ||
var date = getDateToString(currentDate); | ||
var dataProps = _extends({}, data[date], { | ||
@@ -109,7 +106,5 @@ date: date, | ||
}); | ||
if (endDate instanceof Date && currentDate.getTime() > endDate.getTime()) { | ||
return null; | ||
} | ||
if (date && data[date] && panelColors && Object.keys(panelColors).length > 0) { | ||
@@ -120,3 +115,2 @@ dayProps.fill = existColor(data[date].count || 0, nums, panelColors); | ||
} | ||
if (rectRender && typeof rectRender === 'function') { | ||
@@ -126,3 +120,2 @@ var elm = rectRender(_extends({}, dayProps, { | ||
}), dataProps); | ||
if (elm && /*#__PURE__*/React.isValidElement(elm)) { | ||
@@ -132,3 +125,2 @@ return elm; | ||
} | ||
return /*#__PURE__*/_jsx(Rect, _extends({}, dayProps, { | ||
@@ -135,0 +127,0 @@ "data-date": date, |
@@ -12,3 +12,2 @@ export var oneDayTime = 24 * 60 * 60 * 1000; | ||
} | ||
var result = {}; | ||
@@ -23,4 +22,4 @@ data.forEach(item => { | ||
} | ||
/** 排序 比较函数 */ | ||
export function numberSort(keys) { | ||
@@ -30,3 +29,2 @@ if (keys === void 0) { | ||
} | ||
return keys.sort((x, y) => { | ||
@@ -41,9 +39,6 @@ if (x < y) return -1;else if (x > y) return 1; | ||
} | ||
if (panelColors === void 0) { | ||
panelColors = {}; | ||
} | ||
var color = ''; | ||
for (var a = 0; a < nums.length; a += 1) { | ||
@@ -54,8 +49,6 @@ if (nums[a] > num) { | ||
} | ||
color = panelColors[nums[a]]; | ||
} | ||
return color; | ||
} | ||
//# sourceMappingURL=utils.js.map |
{ | ||
"name": "@uiw/react-heat-map", | ||
"version": "2.0.4", | ||
"version": "2.0.5", | ||
"description": "React component create calendar heatmap to visualize time series data, a la github contribution graph.", | ||
@@ -8,2 +8,3 @@ "homepage": "https://uiwjs.github.io/react-heat-map/", | ||
"module": "./esm/index.js", | ||
"types": "./lib/index.d.ts", | ||
"author": "kenny wang <wowohoo@qq.com>", | ||
@@ -32,3 +33,3 @@ "license": "MIT", | ||
"src", | ||
"cjs", | ||
"lib", | ||
"esm" | ||
@@ -35,0 +36,0 @@ ], |
@@ -15,2 +15,8 @@ HeatMap 日历热图 | ||
<!--rehype:ignore:start--> | ||
[![](https://user-images.githubusercontent.com/1680273/186116433-d58c2b6d-8468-4322-943c-9b63c2e447e4.png)](https://uiwjs.github.io/react-heat-map) | ||
<!--rehype:ignore:end--> | ||
## Install | ||
@@ -17,0 +23,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
138751
61
1581
325