react-calendar
Advanced tools
Comparing version 2.17.1 to 2.17.2
@@ -29,4 +29,2 @@ 'use strict'; | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -50,7 +48,3 @@ | ||
value: function render() { | ||
var _props = this.props, | ||
activeStartDate = _props.activeStartDate, | ||
otherProps = _objectWithoutProperties(_props, ['activeStartDate']); | ||
return _react2.default.createElement(_TileGroup2.default, _extends({}, otherProps, { | ||
return _react2.default.createElement(_TileGroup2.default, _extends({}, this.props, { | ||
className: 'react-calendar__century-view__decades', | ||
@@ -57,0 +51,0 @@ dateTransform: _dates.getBeginOfDecade, |
@@ -29,4 +29,2 @@ 'use strict'; | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -50,7 +48,3 @@ | ||
value: function render() { | ||
var _props = this.props, | ||
activeStartDate = _props.activeStartDate, | ||
otherProps = _objectWithoutProperties(_props, ['activeStartDate']); | ||
return _react2.default.createElement(_TileGroup2.default, _extends({}, otherProps, { | ||
return _react2.default.createElement(_TileGroup2.default, _extends({}, this.props, { | ||
className: 'react-calendar__decade-view__years', | ||
@@ -57,0 +51,0 @@ dateTransform: function dateTransform(year) { |
@@ -0,0 +0,0 @@ declare module "react-calendar/dist/entry.nostyle" { |
@@ -58,5 +58,4 @@ 'use strict'; | ||
var _props = this.props, | ||
activeStartDate = _props.activeStartDate, | ||
showNeighboringMonth = _props.showNeighboringMonth, | ||
otherProps = _objectWithoutProperties(_props, ['activeStartDate', 'showNeighboringMonth']); | ||
otherProps = _objectWithoutProperties(_props, ['showNeighboringMonth']); | ||
@@ -63,0 +62,0 @@ return _react2.default.createElement(_TileGroup2.default, _extends({}, otherProps, { |
@@ -111,2 +111,3 @@ 'use strict'; | ||
var tileProps = exports.tileProps = { | ||
activeStartDate: _propTypes2.default.instanceOf(Date).isRequired, | ||
classes: _propTypes2.default.arrayOf(_propTypes2.default.string).isRequired, | ||
@@ -113,0 +114,0 @@ date: _propTypes2.default.instanceOf(Date).isRequired, |
@@ -26,3 +26,4 @@ 'use strict'; | ||
var Tile = function Tile(_ref) { | ||
var children = _ref.children, | ||
var activeStartDate = _ref.activeStartDate, | ||
children = _ref.children, | ||
classes = _ref.classes, | ||
@@ -46,3 +47,3 @@ date = _ref.date, | ||
className: (0, _mergeClassNames2.default)(classes, tileClassName instanceof Function ? tileClassName({ date: date, view: view }) : tileClassName), | ||
disabled: minDate && minDateTransform(minDate) > date || maxDate && maxDateTransform(maxDate) < date || tileDisabled && tileDisabled({ date: date, view: view }), | ||
disabled: minDate && minDateTransform(minDate) > date || maxDate && maxDateTransform(maxDate) < date || tileDisabled && tileDisabled({ activeStartDate: activeStartDate, date: date, view: view }), | ||
onClick: onClick && function () { | ||
@@ -49,0 +50,0 @@ return onClick(date); |
@@ -33,4 +33,2 @@ 'use strict'; | ||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -64,7 +62,3 @@ | ||
var _props = this.props, | ||
activeStartDate = _props.activeStartDate, | ||
otherProps = _objectWithoutProperties(_props, ['activeStartDate']); | ||
return _react2.default.createElement(_TileGroup2.default, _extends({}, otherProps, { | ||
return _react2.default.createElement(_TileGroup2.default, _extends({}, this.props, { | ||
className: 'react-calendar__year-view__months', | ||
@@ -71,0 +65,0 @@ dateTransform: function dateTransform(monthIndex) { |
@@ -23,2 +23,3 @@ declare module "react-calendar" { | ||
minDetail?: Detail; | ||
navigationLabel?: ({date: Date, view: Detail, label: string}) => string | JSX.Element | null; | ||
next2Label?: string | JSX.Element | null; | ||
@@ -46,3 +47,3 @@ nextLabel?: string | JSX.Element; | ||
tileContent?: JSX.Element | ((props: CalendarTileProperties) => JSX.Element | null); | ||
tileDisabled?: (props: CalendarTileProperties) => boolean; | ||
tileDisabled?: (props: CalendarTileProperties & {activeStartDate: Date}) => boolean; | ||
value?: Date | Date[]; | ||
@@ -49,0 +50,0 @@ view?: Detail; |
{ | ||
"name": "react-calendar", | ||
"version": "2.17.1", | ||
"version": "2.17.2", | ||
"description": "Ultimate calendar for your React app.", | ||
@@ -12,5 +12,6 @@ "main": "dist/entry.js", | ||
"build-styles": "lessc ./dist/Calendar.less ./dist/Calendar.css", | ||
"clean": "rimraf dist", | ||
"copy-styles": "node ./copy-styles.js", | ||
"copy-types": "node ./copy-types.js", | ||
"prepublishOnly": "yarn run build", | ||
"prepublishOnly": "yarn run clean && yarn run build", | ||
"test": "yarn run test-eslint && yarn run test-jest", | ||
@@ -77,7 +78,5 @@ "test-eslint": "eslint src/ test/ --ext .jsx,.js", | ||
"babel-plugin-transform-class-properties": "^6.24.1", | ||
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2", | ||
"babel-plugin-transform-object-assign": "^6.22.0", | ||
"babel-plugin-transform-object-rest-spread": "^6.26.0", | ||
"babel-preset-env": "^1.7.0", | ||
"babel-preset-react": "^6.24.1", | ||
"babel-preset-stage-2": "^6.24.1", | ||
"enzyme": "^3.3.0", | ||
@@ -95,3 +94,4 @@ "enzyme-adapter-react-16": "^1.1.1", | ||
"react-dom": "^16.4.1", | ||
"react-test-renderer": "^16.4.1" | ||
"react-test-renderer": "^16.4.1", | ||
"rimraf": "^2.6.2" | ||
}, | ||
@@ -98,0 +98,0 @@ "peerDependencies": { |
@@ -120,3 +120,3 @@ ![downloads](https://img.shields.io/npm/dt/react-calendar.svg) ![build](https://img.shields.io/travis/wojtekmaj/react-calendar/master.svg) ![dependencies](https://img.shields.io/david/wojtekmaj/react-calendar.svg | ||
|tileContent|Allows to render custom content within a given calendar item (day on month view, month on year view and so on).|<ul><li>String: `"Sample"`</li><li>React element: `<TileContent />`</li><li>Function: `({ date, view }) => view === 'month' && date.getDay() === 0 ? <p>It's Sunday!</p> : null`</li></ul>| | ||
|tileDisabled|Pass a function to determine if a certain day should be displayed as disabled.|<ul><li>Function: `({date, view }) => date.getDay() === 0`</li></ul>| | ||
|tileDisabled|Pass a function to determine if a certain day should be displayed as disabled.|<ul><li>Function: `({activeStartDate, date, view }) => date.getDay() === 0`</li></ul>| | ||
|value|Defines the value of the calendar.|<ul><li>Date: `new Date()`</li><li>An array of dates: `[new Date(2017, 0, 1), new Date(2017, 7, 1)]`| | ||
@@ -123,0 +123,0 @@ |view|Determines which calendar view shall be opened initially. Does not disable navigation. Can be "month", "year", "decade" or "century". Defaults to the most detailed view allowed.|`"year"`| |
@@ -0,0 +0,0 @@ import React from 'react'; |
@@ -0,0 +0,0 @@ import React from 'react'; |
@@ -0,0 +0,0 @@ import React from 'react'; |
@@ -0,0 +0,0 @@ import React from 'react'; |
@@ -0,0 +0,0 @@ import React from 'react'; |
@@ -0,0 +0,0 @@ import React, { Component } from 'react'; |
@@ -0,0 +0,0 @@ import React from 'react'; |
@@ -0,0 +0,0 @@ import React from 'react'; |
@@ -23,10 +23,5 @@ import React, { PureComponent } from 'react'; | ||
render() { | ||
const { | ||
activeStartDate, | ||
...otherProps | ||
} = this.props; | ||
return ( | ||
<TileGroup | ||
{...otherProps} | ||
{...this.props} | ||
className="react-calendar__century-view__decades" | ||
@@ -33,0 +28,0 @@ dateTransform={getBeginOfDecade} |
@@ -0,0 +0,0 @@ import React from 'react'; |
@@ -0,0 +0,0 @@ import React from 'react'; |
@@ -20,10 +20,5 @@ import React, { PureComponent } from 'react'; | ||
render() { | ||
const { | ||
activeStartDate, | ||
...otherProps | ||
} = this.props; | ||
return ( | ||
<TileGroup | ||
{...otherProps} | ||
{...this.props} | ||
className="react-calendar__decade-view__years" | ||
@@ -30,0 +25,0 @@ dateTransform={year => new Date(year, 0, 1)} |
@@ -0,0 +0,0 @@ import Calendar from './Calendar'; |
@@ -0,0 +0,0 @@ import Calendar from './Calendar'; |
@@ -0,0 +0,0 @@ import React from 'react'; |
@@ -0,0 +0,0 @@ import React from 'react'; |
@@ -82,3 +82,2 @@ import React, { PureComponent } from 'react'; | ||
const { | ||
activeStartDate, | ||
showNeighboringMonth, | ||
@@ -85,0 +84,0 @@ ...otherProps |
@@ -0,0 +0,0 @@ import React, { Component } from 'react'; |
@@ -0,0 +0,0 @@ import React from 'react'; |
@@ -0,0 +0,0 @@ import React, { PureComponent } from 'react'; |
@@ -0,0 +0,0 @@ import { |
@@ -102,2 +102,3 @@ import PropTypes from 'prop-types'; | ||
export const tileProps = { | ||
activeStartDate: PropTypes.instanceOf(Date).isRequired, | ||
classes: PropTypes.arrayOf(PropTypes.string).isRequired, | ||
@@ -104,0 +105,0 @@ date: PropTypes.instanceOf(Date).isRequired, |
@@ -8,2 +8,3 @@ import React from 'react'; | ||
const Tile = ({ | ||
activeStartDate, | ||
children, | ||
@@ -33,3 +34,3 @@ classes, | ||
|| (maxDate && maxDateTransform(maxDate) < date) | ||
|| (tileDisabled && tileDisabled({ date, view })) | ||
|| (tileDisabled && tileDisabled({ activeStartDate, date, view })) | ||
} | ||
@@ -36,0 +37,0 @@ onClick={onClick && (() => onClick(date))} |
@@ -0,0 +0,0 @@ import React from 'react'; |
@@ -0,0 +0,0 @@ import React, { PureComponent } from 'react'; |
@@ -21,10 +21,5 @@ import React, { PureComponent } from 'react'; | ||
render() { | ||
const { | ||
activeStartDate, | ||
...otherProps | ||
} = this.props; | ||
return ( | ||
<TileGroup | ||
{...otherProps} | ||
{...this.props} | ||
className="react-calendar__year-view__months" | ||
@@ -31,0 +26,0 @@ dateTransform={monthIndex => new Date(this.year, monthIndex, 1)} |
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
22
338967
75
8546