@atto-byte/react-month-picker
Advanced tools
Comparing version 1.4.0 to 1.4.1
@@ -6,6 +6,7 @@ import * as React from 'react'; | ||
}; | ||
declare type Years = Array<number> | number | Month | { | ||
declare type MinMaxMonth = { | ||
min: Month; | ||
max: Month; | ||
}; | ||
declare type Years = Array<number> | number | MinMaxMonth; | ||
declare type Range = { | ||
@@ -12,0 +13,0 @@ from: Month; |
@@ -17,3 +17,2 @@ "use strict"; | ||
var React = require("react"); | ||
var Tappable = require("react-tappable"); | ||
var isBrowser = (typeof window !== "undefined" && typeof document !== "undefined"); | ||
@@ -59,4 +58,8 @@ var __MIN_VALID_YEAR = 1; | ||
}); | ||
if ((typeof years === 'object')) { | ||
var n = 0, min = 0, ymin = getYearMon(years.min), ymax = getYearMon(years.max); | ||
else if (typeof years === 'number' && years > 0) | ||
return getYearsByNum(years); | ||
else if (typeof years !== 'number' && 'min' in years) { | ||
var n = 0, min = 0; | ||
var ymin = getYearMon(years.min); | ||
var ymax = getYearMon(years.max); | ||
if ((typeof ymin.year === 'number') && ymin.year > __MIN_VALID_YEAR) | ||
@@ -73,4 +76,2 @@ min = ymin.year; | ||
} | ||
else if (typeof years === 'number' && years > 0) | ||
return getYearsByNum(years); | ||
else | ||
@@ -174,3 +175,12 @@ return getYearsByNum(5); | ||
var _this = this; | ||
var values = this.state.values, value = values[padIndex], labelYears = this.state.labelYears, labelYear = labelYears[padIndex] = labelYears[padIndex] || value.year, ymArr = this.state.years, lang = this.props.lang || [], months = Array.isArray(lang) ? lang : (Array.isArray(lang.months) ? lang.months : []), prevCss = '', nextCss = '', yearMaxIdx = ymArr.length - 1, yearIdx = this.state.yearIndexes[padIndex]; | ||
var values = this.state.values; | ||
var value = values[padIndex]; | ||
var labelYears = this.state.labelYears; | ||
var labelYear = labelYears[padIndex] = labelYears[padIndex] || value.year; | ||
var ymArr = this.state.years; | ||
var lang = this.props.lang || []; | ||
var months = Array.isArray(lang) ? lang : (Array.isArray(lang.months) ? lang.months : []); | ||
var prevCss = '', nextCss = ''; | ||
var yearMaxIdx = ymArr.length - 1; | ||
var yearIdx = this.state.yearIndexes[padIndex]; | ||
if (yearIdx === 0) | ||
@@ -180,3 +190,6 @@ prevCss = 'disable'; | ||
nextCss = 'disable'; | ||
var yearActive = (labelYear === value.year), atMinYear = (labelYear === ymArr[0].year), atMaxYear = (labelYear === ymArr[yearMaxIdx].year), otherValue = false; | ||
var yearActive = (labelYear === value.year); | ||
var atMinYear = (labelYear === ymArr[0].year); | ||
var atMaxYear = (labelYear === ymArr[yearMaxIdx].year); | ||
var otherValue = false; | ||
if (values.length > 1) { | ||
@@ -239,3 +252,3 @@ otherValue = values[1 - padIndex]; | ||
React.createElement("div", { className: ["rmp-container", "rmp-table", this.props.className, (this.state.showed ? "show" : '')].join(' ') }, | ||
React.createElement(Tappable, { className: "rmp-overlay", onTap: this._handleOverlayTouchTap }), | ||
React.createElement("div", { className: "rmp-overlay", onTouchEnd: this._handleOverlayTouchTap }), | ||
React.createElement("div", { className: "rmp-cell" }, | ||
@@ -242,0 +255,0 @@ React.createElement("div", { className: ["rmp-popup", popupClass, this.props.theme, (this.state.showed ? "show" : '')].join(' ') }, pads))))); |
@@ -15,3 +15,3 @@ { | ||
"author": "William Luke <william@atto-byte.com>", | ||
"version": "1.4.0", | ||
"version": "1.4.1", | ||
"license": "MIT", | ||
@@ -18,0 +18,0 @@ "private": false, |
@@ -8,11 +8,11 @@ { | ||
"module": "commonjs", | ||
"strictNullChecks": true, | ||
"strictNullChecks": false, | ||
"removeComments": true, | ||
"declaration": true, | ||
"sourceMap": true, | ||
"noUnusedLocals": true, | ||
"noUnusedLocals": false, | ||
"strict": true, | ||
"noImplicitAny": false, | ||
"alwaysStrict": true, | ||
"noUnusedParameters": true, | ||
"noUnusedParameters": false, | ||
"jsx": "react", | ||
@@ -19,0 +19,0 @@ "typeRoots": [ |
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
462299
689