react-datepicker-inlinefix
Advanced tools
@@ -51,2 +51,6 @@ :global .react-datepicker__tether-element-attached-top .react-datepicker__triangle, :global .react-datepicker__tether-element-attached-bottom .react-datepicker__triangle, :global .react-datepicker__year-read-view--down-arrow, :global .react-datepicker__month-read-view--down-arrow { | ||
| :global .react-datepicker__tether-element-attached-right .react-datepicker__triangle { | ||
| left: auto; | ||
| right: 42px; } | ||
| :global .react-datepicker__tether-element-attached-bottom.react-datepicker__tether-element { | ||
@@ -151,2 +155,6 @@ margin-top: -20px; } | ||
| background-color: #32be3f; } | ||
| :global .react-datepicker__day--highlighted-custom-1 { | ||
| color: magenta; } | ||
| :global .react-datepicker__day--highlighted-custom-2 { | ||
| color: green; } | ||
| :global .react-datepicker__day--selected, :global .react-datepicker__day--in-selecting-range, :global .react-datepicker__day--in-range { | ||
@@ -153,0 +161,0 @@ border-radius: 0.3rem; |
@@ -51,2 +51,6 @@ :global .react-datepicker__tether-element-attached-top .react-datepicker__triangle, :global .react-datepicker__tether-element-attached-bottom .react-datepicker__triangle, :global .react-datepicker__year-read-view--down-arrow, :global .react-datepicker__month-read-view--down-arrow { | ||
| :global .react-datepicker__tether-element-attached-right .react-datepicker__triangle { | ||
| left: auto; | ||
| right: 42px; } | ||
| :global .react-datepicker__tether-element-attached-bottom.react-datepicker__tether-element { | ||
@@ -151,2 +155,6 @@ margin-top: -20px; } | ||
| background-color: #32be3f; } | ||
| :global .react-datepicker__day--highlighted-custom-1 { | ||
| color: magenta; } | ||
| :global .react-datepicker__day--highlighted-custom-2 { | ||
| color: green; } | ||
| :global .react-datepicker__day--selected, :global .react-datepicker__day--in-selecting-range, :global .react-datepicker__day--in-range { | ||
@@ -153,0 +161,0 @@ border-radius: 0.3rem; |
@@ -59,2 +59,6 @@ .react-datepicker__tether-element-attached-top .react-datepicker__triangle, .react-datepicker__tether-element-attached-bottom .react-datepicker__triangle, .react-datepicker__year-read-view--down-arrow, | ||
| .react-datepicker__tether-element-attached-right .react-datepicker__triangle { | ||
| left: auto; | ||
| right: 42px; } | ||
| .react-datepicker__tether-element-attached-bottom.react-datepicker__tether-element { | ||
@@ -159,2 +163,6 @@ margin-top: -20px; } | ||
| background-color: #32be3f; } | ||
| .react-datepicker__day--highlighted-custom-1 { | ||
| color: magenta; } | ||
| .react-datepicker__day--highlighted-custom-2 { | ||
| color: green; } | ||
| .react-datepicker__day--selected, .react-datepicker__day--in-selecting-range, .react-datepicker__day--in-range { | ||
@@ -161,0 +169,0 @@ border-radius: 0.3rem; |
@@ -59,2 +59,6 @@ .react-datepicker__tether-element-attached-top .react-datepicker__triangle, .react-datepicker__tether-element-attached-bottom .react-datepicker__triangle, .react-datepicker__year-read-view--down-arrow, | ||
| .react-datepicker__tether-element-attached-right .react-datepicker__triangle { | ||
| left: auto; | ||
| right: 42px; } | ||
| .react-datepicker__tether-element-attached-bottom.react-datepicker__tether-element { | ||
@@ -159,2 +163,6 @@ margin-top: -20px; } | ||
| background-color: #32be3f; } | ||
| .react-datepicker__day--highlighted-custom-1 { | ||
| color: magenta; } | ||
| .react-datepicker__day--highlighted-custom-2 { | ||
| color: green; } | ||
| .react-datepicker__day--selected, .react-datepicker__day--in-selecting-range, .react-datepicker__day--in-range { | ||
@@ -161,0 +169,0 @@ border-radius: 0.3rem; |
+7
-14
@@ -98,20 +98,13 @@ 'use strict'; | ||
| var current = _moment2.default.utc().utcOffset(utcOffset); | ||
| var initialDate = preSelection || selected; | ||
| var initialDate = openToDate || selected || preSelection; | ||
| if (initialDate) { | ||
| return initialDate; | ||
| } else if (minDate && maxDate && openToDate && openToDate.isBetween(minDate, maxDate)) { | ||
| return openToDate; | ||
| } else if (minDate && openToDate && openToDate.isAfter(minDate)) { | ||
| return openToDate; | ||
| } else if (minDate && minDate.isAfter(current)) { | ||
| return minDate; | ||
| } else if (maxDate && openToDate && openToDate.isBefore(maxDate)) { | ||
| return openToDate; | ||
| } else if (maxDate && maxDate.isBefore(current)) { | ||
| return maxDate; | ||
| } else if (openToDate) { | ||
| return openToDate; | ||
| } else { | ||
| return current; | ||
| if (minDate && current.isBefore(minDate)) { | ||
| return minDate; | ||
| } else if (maxDate && current.isAfter(maxDate)) { | ||
| return maxDate; | ||
| } | ||
| } | ||
| return current; | ||
| }; | ||
@@ -118,0 +111,0 @@ |
+7
-15
@@ -63,2 +63,3 @@ 'use strict'; | ||
| return { | ||
| allowSameDay: false, | ||
| dateFormat: 'L', | ||
@@ -80,6 +81,3 @@ dateFormatCalendar: 'MMMM YYYY', | ||
| popoverTargetOffset: '10px 0', | ||
| tetherConstraints: [{ | ||
| to: 'window', | ||
| attachment: 'together' | ||
| }], | ||
| tetherConstraints: [{ to: 'window', attachment: 'together' }], | ||
| utcOffset: (0, _moment2.default)().utcOffset(), | ||
@@ -97,3 +95,3 @@ monthsShown: 1, | ||
| _this.getInitialState = function () { | ||
| _this.calcInitialState = function () { | ||
| var defaultPreSelection = _this.props.openToDate ? (0, _moment2.default)(_this.props.openToDate) : _this.props.selectsEnd && _this.props.startDate ? (0, _moment2.default)(_this.props.startDate) : _this.props.selectsStart && _this.props.endDate ? (0, _moment2.default)(_this.props.endDate) : (0, _moment2.default)(); | ||
@@ -124,3 +122,3 @@ var minDate = (0, _date_utils.getEffectiveMinDate)(_this.props); | ||
| open: open, | ||
| preSelection: open && _this.state.open ? _this.state.preSelection : _this.getInitialState().preSelection | ||
| preSelection: open && _this.state.open ? _this.state.preSelection : _this.calcInitialState().preSelection | ||
| }); | ||
@@ -205,3 +203,3 @@ }; | ||
| if (!(0, _date_utils.isSameDay)(_this.props.selected, changedDate)) { | ||
| if (!(0, _date_utils.isSameDay)(_this.props.selected, changedDate) || _this.props.allowSameDay) { | ||
| if (changedDate !== null) { | ||
@@ -386,3 +384,3 @@ if (_this.props.selected) { | ||
| _this.state = _this.getInitialState(); | ||
| _this.state = _this.calcInitialState(); | ||
| return _this; | ||
@@ -392,9 +390,2 @@ } | ||
| _createClass(DatePicker, [{ | ||
| key: 'componentWillUpdate', | ||
| value: function componentWillUpdate(nextProps, nextState) { | ||
| if (nextProps.selected !== this.props.selected) { | ||
| this.setPreSelection(nextProps.selected); | ||
| } | ||
| } | ||
| }, { | ||
| key: 'componentWillUnmount', | ||
@@ -455,2 +446,3 @@ value: function componentWillUnmount() { | ||
| DatePicker.propTypes = { | ||
| allowSameDay: _propTypes2.default.bool, | ||
| autoComplete: _propTypes2.default.string, | ||
@@ -457,0 +449,0 @@ autoFocus: _propTypes2.default.bool, |
+25
-7
@@ -7,2 +7,4 @@ 'use strict'; | ||
| var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
| var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
@@ -30,2 +32,4 @@ | ||
| function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -65,3 +69,3 @@ | ||
| return (0, _date_utils.isDayDisabled)(_this.props.day, _this.props); | ||
| }, _this.isHighlighted = function () { | ||
| }, _this.getHighLightedClass = function (defaultClassName) { | ||
| var _this$props = _this.props, | ||
@@ -72,7 +76,22 @@ day = _this$props.day, | ||
| if (!highlightDates) { | ||
| return false; | ||
| return _defineProperty({}, defaultClassName, false); | ||
| } | ||
| return highlightDates.some(function (testDay) { | ||
| return (0, _date_utils.isSameDay)(day, testDay); | ||
| }); | ||
| for (var i = 0, len = highlightDates.length; i < len; i++) { | ||
| var obj = highlightDates[i]; | ||
| if (obj instanceof _moment2.default) { | ||
| if ((0, _date_utils.isSameDay)(day, obj)) { | ||
| return _defineProperty({}, defaultClassName, true); | ||
| } | ||
| } else if ((typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object') { | ||
| var keys = Object.keys(obj); | ||
| var arr = obj[keys[0]]; | ||
| if (typeof keys[0] === 'string' && arr.constructor === Array) { | ||
| for (var k = 0, _len2 = arr.length; k < _len2; k++) { | ||
| if ((0, _date_utils.isSameDay)(day, arr[k])) { | ||
| return _defineProperty({}, keys[0], true); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| }, _this.isInRange = function () { | ||
@@ -175,3 +194,2 @@ var _this$props2 = _this.props, | ||
| 'react-datepicker__day--keyboard-selected': _this.isKeyboardSelected(), | ||
| 'react-datepicker__day--highlighted': _this.isHighlighted(), | ||
| 'react-datepicker__day--range-start': _this.isRangeStart(), | ||
@@ -186,3 +204,3 @@ 'react-datepicker__day--range-end': _this.isRangeEnd(), | ||
| 'react-datepicker__day--outside-month': _this.isOutsideMonth() | ||
| }); | ||
| }, _this.getHighLightedClass('react-datepicker__day--highlighted')); | ||
| }, _temp), _possibleConstructorReturn(_this, _ret); | ||
@@ -189,0 +207,0 @@ } |
+6
-4
@@ -5,3 +5,3 @@ { | ||
| "description": "A simple and reusable datepicker component for React", | ||
| "version": "0.46.0", | ||
| "version": "0.48.0", | ||
| "license": "MIT", | ||
@@ -35,2 +35,3 @@ "homepage": "https://github.com/vaivanov/react-datepicker", | ||
| "babel-loader": "^6.2.10", | ||
| "babel-plugin-add-react-displayname": "^0.0.4", | ||
| "babel-plugin-react-transform": "^2.0.2", | ||
@@ -47,3 +48,3 @@ "babel-plugin-transform-class-properties": "^6.24.1", | ||
| "css-loader": "^0.26.1", | ||
| "enzyme": "^2.7.1", | ||
| "enzyme": "^2.8.2", | ||
| "eslint": "^3.15.0", | ||
@@ -82,5 +83,6 @@ "eslint-config-standard": "^6.2.0", | ||
| "react-dom": "^15.5.4", | ||
| "react-test-renderer": "^15.5.4", | ||
| "react-transform-hmr": "^1.0.4", | ||
| "sass-loader": "^4.1.1", | ||
| "sinon": "^1.17.7", | ||
| "sinon": "^2.3.2", | ||
| "style-loader": "^0.13.1", | ||
@@ -100,3 +102,3 @@ "webpack": "^1.13.0", | ||
| "prop-types": "^15.5.8", | ||
| "react-onclickoutside": "^5.11.1", | ||
| "react-onclickoutside": "^6.1.1", | ||
| "tether": "^1.4.0" | ||
@@ -103,0 +105,0 @@ }, |
@@ -28,2 +28,7 @@ @import "variables"; | ||
| .react-datepicker__tether-element-attached-right .react-datepicker__triangle { | ||
| left: auto; | ||
| right: 42px; | ||
| } | ||
| .react-datepicker__tether-element-attached-bottom.react-datepicker__tether-element { | ||
@@ -162,2 +167,10 @@ margin-top: -20px; | ||
| } | ||
| &-custom-1 { | ||
| color: magenta; | ||
| } | ||
| &-custom-2 { | ||
| color: green; | ||
| } | ||
| } | ||
@@ -164,0 +177,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
395218
0.82%7119
0.45%58
3.57%+ Added
- Removed
Updated