material-ui-next-pickers
Advanced tools
Comparing version 0.0.12 to 0.0.15
@@ -1,2 +0,1 @@ | ||
/// <reference types="react" /> | ||
import * as React from 'react'; | ||
@@ -42,2 +41,3 @@ import { StyledComponentProps } from '@material-ui/core/styles'; | ||
closeCalendar: () => void; | ||
dateDisabled?: (date: Date) => boolean; | ||
min?: Date; | ||
@@ -44,0 +44,0 @@ max?: Date; |
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
var extendStatics = function (d, b) { | ||
extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
} | ||
return function (d, b) { | ||
@@ -260,3 +263,3 @@ extendStatics(d, b); | ||
var firstDay = new Date(calendarFocus.year, calendarFocus.month, 1); | ||
var daysInWeekInMonth = [Array.apply(undefined, { length: firstDay.getDay() })]; | ||
var daysInWeekInMonth = [Array(firstDay.getDay()).fill(undefined)]; | ||
var counter = firstDay.getDay(); | ||
@@ -318,3 +321,3 @@ for (var day = firstDay; day.getMonth() === calendarFocus.month; day = new Date(day.getFullYear(), day.getMonth(), day.getDate() + 1)) { | ||
var _this = this; | ||
var _a = this.props, classes = _a.classes, value = _a.value, closeCalendar = _a.closeCalendar, okToConfirm = _a.okToConfirm; | ||
var _a = this.props, classes = _a.classes, value = _a.value, closeCalendar = _a.closeCalendar, dateDisabled = _a.dateDisabled, okToConfirm = _a.okToConfirm; | ||
var _b = this.state, mode = _b.mode, buttonHeight = _b.buttonHeight, selected = _b.selected, year = _b.year, month = _b.month, yearIndex = _b.yearIndex; | ||
@@ -339,9 +342,9 @@ var active = okToConfirm ? selected : value; | ||
return React.createElement("div", { className: classes.week, key: 'week-' + index }, week.map(function (date, index) { | ||
return date ? React.createElement(IconButton, { classes: { root: classnames((_a = {}, _a[classes.selectedDay] = active && DateUtil.sameDay(date, active), _a), classes.weekDay) }, disabled: _this.dayInvalid(date), onClick: function (event) { return _this.selectDate(date, event); }, key: 'day-' + index, style: { height: buttonHeight - 10 } }, | ||
var _a, _b; | ||
return date ? React.createElement(IconButton, { classes: { root: classnames((_a = {}, _a[classes.selectedDay] = active && DateUtil.sameDay(date, active), _a), classes.weekDay) }, disabled: _this.dayInvalid(date) || (dateDisabled && dateDisabled(date)), onClick: function (event) { return _this.selectDate(date, event); }, key: 'day-' + index, style: { height: buttonHeight - 10 } }, | ||
React.createElement(Typography, { classes: { root: classnames((_b = {}, | ||
_b[classes.selectedDayText] = active && DateUtil.sameDay(date, active), | ||
_b[classes.invalidInput] = _this.dayInvalid(date), | ||
_b[classes.invalidInput] = _this.dayInvalid(date) || (dateDisabled && dateDisabled(date)), | ||
_b)) }, variant: 'body1', style: { height: buttonHeight - 10, lineHeight: buttonHeight - 10 + "px" } }, date.getDate())) : | ||
React.createElement("div", { className: classes.weekDay, style: { height: buttonHeight - 10 }, key: 'day-' + index }); | ||
var _a, _b; | ||
})); | ||
@@ -369,2 +372,3 @@ })) : | ||
return React.createElement("div", { className: classes.years, key: 'years-' + index }, years.map(function (currentYear, index) { | ||
var _a, _b; | ||
return React.createElement(Button, { className: classnames((_a = {}, _a[classes.selectedYear] = year === currentYear, _a)), variant: year === currentYear ? 'raised' : 'flat', disabled: _this.yearInvalid(currentYear), onClick: function () { return _this.selectCalendarYear(currentYear); }, key: 'year-' + index }, | ||
@@ -375,3 +379,2 @@ React.createElement(Typography, { className: classnames((_b = {}, | ||
_b)), variant: 'body1' }, currentYear)); | ||
var _a, _b; | ||
})); | ||
@@ -378,0 +381,0 @@ }))) : |
@@ -1,2 +0,1 @@ | ||
/// <reference types="react" /> | ||
import * as React from 'react'; | ||
@@ -3,0 +2,0 @@ import { StyledComponentProps } from '@material-ui/core/styles'; |
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
var extendStatics = function (d, b) { | ||
extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
} | ||
return function (d, b) { | ||
@@ -175,12 +178,12 @@ extendStatics(d, b); | ||
var date = new Date((okToConfirm ? selected : value) || defaultTime); | ||
if (selecting && label === 'hour') { | ||
if (selecting >= 0 && label === 'hour') { | ||
date.setHours(selecting + ((value && value.getHours() >= 12) ? 12 : 0)); | ||
} | ||
else if (selecting && label === 'minute') { | ||
else if (selecting >= 0 && label === 'minute') { | ||
date.setMinutes(selecting); | ||
} | ||
if (selecting && okToConfirm) { | ||
if (selecting >= 0 && okToConfirm) { | ||
_this.setState({ selecting: true, selected: date }); | ||
} | ||
else if (selecting) { | ||
else if (selecting >= 0) { | ||
_this.setState({ selecting: true }, function () { return onChange(date, event); }); | ||
@@ -293,4 +296,4 @@ } | ||
var _b = this.state, mode = _b.mode, selecting = _b.selecting, clockRadius = _b.clockRadius; | ||
var hours = Array.apply(undefined, { length: 12 }).map(function (number, index) { return index === 0 ? 12 : index; }); | ||
var minutes = Array.apply(undefined, { length: 60 }).map(function (number, index) { return !selectableMinutesInterval ? | ||
var hours = Array(12).fill(undefined).map(function (number, index) { return index === 0 ? 12 : index; }); | ||
var minutes = Array(60).fill(undefined).map(function (number, index) { return !selectableMinutesInterval ? | ||
index : | ||
@@ -325,2 +328,3 @@ index % selectableMinutesInterval === 0 ? | ||
hours.map(function (hour, index) { | ||
var _a, _b; | ||
var angle = index / hours.length * 2 * Math.PI - (Math.PI / 6 * 3); | ||
@@ -331,5 +335,5 @@ return React.createElement(Typography, { key: hour, className: classnames(classes.clockText, (_a = {}, _a[classes.clockTextSelected] = mode === 'hour' && selected.hour === index, _a), (_b = {}, _b[classes.clockTextFaded] = mode !== 'hour', _b)), style: { | ||
} }, hour); | ||
var _a, _b; | ||
}), | ||
minutes.map(function (minute, index) { | ||
var _a, _b, _c, _d; | ||
var angle = index / minutes.length * 2 * Math.PI - (Math.PI / 6 * 3); | ||
@@ -348,3 +352,2 @@ if (minute % 5 === 0) { | ||
} | ||
var _a, _b, _c, _d; | ||
}))), | ||
@@ -351,0 +354,0 @@ okToConfirm && React.createElement("div", { className: classes.okToConfirmRow }, |
@@ -1,2 +0,1 @@ | ||
/// <reference types="react" /> | ||
import * as React from 'react'; | ||
@@ -15,2 +14,4 @@ import { StyledComponentProps } from '@material-ui/core/styles'; | ||
componentDidUpdate(prevProps: any, prevState: any): void; | ||
componentWillUnmount(): void; | ||
onWindowClick: (event: MouseEvent) => void; | ||
onFocus: (focus: boolean) => void; | ||
@@ -37,2 +38,3 @@ toggleShowCalendar: () => void; | ||
error?: string; | ||
dateDisabled?: (date: Date) => boolean; | ||
min?: Date; | ||
@@ -39,0 +41,0 @@ max?: Date; |
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
var extendStatics = function (d, b) { | ||
extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
} | ||
return function (d, b) { | ||
@@ -11,9 +14,12 @@ extendStatics(d, b); | ||
})(); | ||
var __assign = (this && this.__assign) || Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
@@ -65,2 +71,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
_this.action = {}; | ||
_this.onWindowClick = function (event) { | ||
if ([_this.input, _this.calendar].reduce(function (contain, next) { return contain && (!next || next.compareDocumentPosition(event.target) < 16); }, true)) { | ||
_this.closeCalendar(); | ||
} | ||
}; | ||
_this.onFocus = function (focus) { | ||
@@ -104,8 +115,3 @@ _this.setState({ focus: focus }); | ||
DateFormatInput.prototype.componentDidMount = function () { | ||
var _this = this; | ||
window.addEventListener('click', function (event) { | ||
if ([_this.input, _this.calendar].reduce(function (contain, next) { return contain && (!next || next.compareDocumentPosition(event.target) < 16); }, true)) { | ||
_this.closeCalendar(); | ||
} | ||
}); | ||
window.addEventListener('click', this.onWindowClick); | ||
}; | ||
@@ -117,6 +123,10 @@ DateFormatInput.prototype.componentDidUpdate = function (prevProps, prevState) { | ||
}; | ||
DateFormatInput.prototype.componentWillUnmount = function () { | ||
window.removeEventListener('click', this.onWindowClick); | ||
}; | ||
DateFormatInput.prototype.render = function () { | ||
var _this = this; | ||
var _a = this.props, name = _a.name, label = _a.label, value = _a.value, onChange = _a.onChange, anchorOrigin = _a.anchorOrigin, transformOrigin = _a.transformOrigin, disabled = _a.disabled, error = _a.error, fullWidth = _a.fullWidth, min = _a.min, max = _a.max, dialog = _a.dialog, okToConfirm = _a.okToConfirm, endIcon = _a.endIcon, className = _a.className, InputLabelProps = _a.InputLabelProps, InputProps = _a.InputProps, FormHelperTextProps = _a.FormHelperTextProps, CalendarProps = _a.CalendarProps, classes = _a.classes; | ||
var _a = this.props, name = _a.name, label = _a.label, value = _a.value, onChange = _a.onChange, anchorOrigin = _a.anchorOrigin, transformOrigin = _a.transformOrigin, disabled = _a.disabled, error = _a.error, fullWidth = _a.fullWidth, dateDisabled = _a.dateDisabled, min = _a.min, max = _a.max, dialog = _a.dialog, okToConfirm = _a.okToConfirm, endIcon = _a.endIcon, className = _a.className, InputLabelProps = _a.InputLabelProps, InputProps = _a.InputProps, FormHelperTextProps = _a.FormHelperTextProps, CalendarProps = _a.CalendarProps, classes = _a.classes; | ||
var _b = this.state, focus = _b.focus, calendarShow = _b.calendarShow; | ||
var calendarProps = __assign({ ref: function (calendar) { return _this.calendar = ReactDOM.findDOMNode(calendar); }, value: value, onChange: onChange, dateDisabled: dateDisabled, min: min, max: max, closeCalendar: this.closeCalendar, okToConfirm: okToConfirm }, CalendarProps); | ||
return ([ | ||
@@ -134,6 +144,6 @@ React.createElement("div", { key: 'date-input', className: className, ref: function (input) { return _this.input = input; } }, | ||
React.createElement(Dialog, { key: 'date-dialog', open: calendarShow, onClose: this.closeCalendar }, | ||
React.createElement(Calendar, __assign({ ref: function (calendar) { return _this.calendar = ReactDOM.findDOMNode(calendar); }, value: value, onChange: onChange, min: min, max: max, closeCalendar: this.closeCalendar, okToConfirm: okToConfirm }, CalendarProps))) : | ||
React.createElement(Calendar, __assign({}, calendarProps))) : | ||
React.createElement(Popover, { key: 'date-popover', onEntered: function () { if (_this.action.resize) | ||
_this.action.resize(); }, open: calendarShow, anchorOrigin: anchorOrigin, transformOrigin: transformOrigin, anchorEl: this.input }, | ||
React.createElement(Calendar, __assign({ action: function (action) { return _this.action.resize = action.resize; }, ref: function (calendar) { return _this.calendar = ReactDOM.findDOMNode(calendar); }, value: value, onChange: onChange, min: min, max: max, closeCalendar: this.closeCalendar, okToConfirm: okToConfirm }, CalendarProps))) | ||
React.createElement(Calendar, __assign({ action: function (action) { return _this.action.resize = action.resize; } }, calendarProps))) | ||
]); | ||
@@ -140,0 +150,0 @@ }; |
@@ -1,2 +0,1 @@ | ||
/// <reference types="react" /> | ||
import * as React from 'react'; | ||
@@ -14,2 +13,4 @@ import { StyledComponentProps } from '@material-ui/core/styles'; | ||
componentDidMount(): void; | ||
componentWillUnmount(): void; | ||
onWindowClick: (event: MouseEvent) => void; | ||
onFocus: (focus: boolean) => void; | ||
@@ -16,0 +17,0 @@ toggleShowClock: () => void; |
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
var extendStatics = function (d, b) { | ||
extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
} | ||
return function (d, b) { | ||
@@ -11,9 +14,12 @@ extendStatics(d, b); | ||
})(); | ||
var __assign = (this && this.__assign) || Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
@@ -65,2 +71,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
_this.action = {}; | ||
_this.onWindowClick = function (event) { | ||
if ([_this.input, _this.clock].reduce(function (contain, next) { return contain && (!next || next.compareDocumentPosition(event.target) < 16); }, true)) { | ||
_this.closeClock(); | ||
} | ||
}; | ||
_this.onFocus = function (focus) { | ||
@@ -92,9 +103,7 @@ _this.setState({ focus: focus }); | ||
TimeFormatInput.prototype.componentDidMount = function () { | ||
var _this = this; | ||
window.addEventListener('click', function (event) { | ||
if ([_this.input, _this.clock].reduce(function (contain, next) { return contain && (!next || next.compareDocumentPosition(event.target) < 16); }, true)) { | ||
_this.closeClock(); | ||
} | ||
}); | ||
window.addEventListener('click', this.onWindowClick); | ||
}; | ||
TimeFormatInput.prototype.componentWillUnmount = function () { | ||
window.removeEventListener('click', this.onWindowClick); | ||
}; | ||
TimeFormatInput.prototype.render = function () { | ||
@@ -101,0 +110,0 @@ var _this = this; |
{ | ||
"name": "material-ui-next-pickers", | ||
"version": "0.0.12", | ||
"version": "0.0.15", | ||
"description": "Datepicker and timepicker for material-ui next", | ||
"keywords": ["material-ui", "next", "date", "time", "datepicker", "timepicker", "calendar", "clock"], | ||
"keywords": [ | ||
"material-ui", | ||
"next", | ||
"date", | ||
"time", | ||
"datepicker", | ||
"timepicker", | ||
"calendar", | ||
"clock" | ||
], | ||
"repository": { | ||
@@ -14,2 +23,3 @@ "type": "github", | ||
"scripts": { | ||
"prepare": "npm run module", | ||
"module": "tsc --rootDir src --declaration true --outDir dist", | ||
@@ -27,20 +37,20 @@ "start:dev": "NODE_ENV=development webpack-dev-server --content-base app --history-api-fallback", | ||
"dependencies": { | ||
"@material-ui/core": "^1.0.0", | ||
"@material-ui/icons": "^1.0.0", | ||
"classnames": "^2.2.5", | ||
"react": "^16.2.0", | ||
"react-dom": "^16.2.0", | ||
"react-swipeable-views": "^0.12.13", | ||
"react-swipeable-views-utils": "^0.12.13", | ||
"typescript": "^2.7.2" | ||
"@material-ui/core": "^1.5.1", | ||
"@material-ui/icons": "^2.0.3", | ||
"classnames": "^2.2.6", | ||
"react": "^16.4.2", | ||
"react-dom": "^16.4.2", | ||
"react-swipeable-views": "^0.12.16", | ||
"react-swipeable-views-utils": "^0.12.16", | ||
"typescript": "^3.0.1" | ||
}, | ||
"devDependencies": { | ||
"@types/react": "^16.3.14", | ||
"@types/react-dom": "^16.0.4", | ||
"@types/react": "^16.4.11", | ||
"@types/react-dom": "^16.0.7", | ||
"html-webpack-plugin": "^3.2.0", | ||
"ts-loader": "^4.3.0", | ||
"webpack": "^4.8.3", | ||
"webpack-cli": "^2.1.3", | ||
"webpack-dev-server": "^3.1.4" | ||
"ts-loader": "^4.5.0", | ||
"webpack": "^4.17.0", | ||
"webpack-cli": "^3.1.0", | ||
"webpack-dev-server": "^3.1.5" | ||
} | ||
} |
@@ -31,2 +31,3 @@ # Material UI Next Pickers | ||
error?: string | ||
dateDisabled?: (date:Date) => boolean | ||
min?: Date | ||
@@ -51,2 +52,3 @@ max?: Date | ||
closeCalendar: () => void | ||
dateDisabled?: (date:Date) => boolean | ||
min?: Date | ||
@@ -53,0 +55,0 @@ max?: Date |
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
117516
1429
138
+ Added@material-ui/icons@2.0.3(transitive)
+ Addedtypescript@3.9.10(transitive)
- Removed@material-ui/icons@1.1.1(transitive)
- Removedbabel-runtime@6.26.0(transitive)
- Removedcore-js@2.6.12(transitive)
- Removedrecompose@0.27.1(transitive)
- Removedregenerator-runtime@0.11.1(transitive)
- Removedtypescript@2.9.2(transitive)
Updated@material-ui/core@^1.5.1
Updated@material-ui/icons@^2.0.3
Updatedclassnames@^2.2.6
Updatedreact@^16.4.2
Updatedreact-dom@^16.4.2
Updatedtypescript@^3.0.1