Skip to content

Commit

Permalink
Display title for Months row
Browse files Browse the repository at this point in the history
By using monthTitleEnable= {true}, place title for Months row
  • Loading branch information
A-Kasaaian authored Apr 25, 2018
1 parent 9f1da07 commit cefe9e7
Show file tree
Hide file tree
Showing 12 changed files with 45 additions and 24 deletions.
5 changes: 3 additions & 2 deletions dist/DateRangePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@
customClassEnd = _props.customClassEnd,
customClassStart = _props.customClassStart,
containerClass = _props.containerClass,
inputTextAlign = _props.inputTextAlign;
inputTextAlign = _props.inputTextAlign,
monthTitleEnable = _props.monthTitleEnable;
var disableFromUnix = this.state.disableFromUnix;

if (!placeholderStart) placeholderStart = "";
Expand All @@ -128,7 +129,7 @@
return _react2.default.createElement(
"div",
{ className: "jdtrp", style: { textAlign: "initial" } },
_react2.default.createElement(_index2.default, { containerClass: containerClass, inputTextAlign: inputTextAlign, customClass: customClassStart, placeholder: placeholderStart, format: format, onChange: this.change, id: idStart }),
_react2.default.createElement(_index2.default, { monthTitleEnable: monthTitleEnable, containerClass: containerClass, inputTextAlign: inputTextAlign, customClass: customClassStart, placeholder: placeholderStart, format: format, onChange: this.change, id: idStart }),
_react2.default.createElement(
"div",
null,
Expand Down
5 changes: 3 additions & 2 deletions dist/DateTimePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,8 @@
disableFromUnix = _props3.disableFromUnix,
customClass = _props3.customClass,
containerClass = _props3.containerClass,
inputTextAlign = _props3.inputTextAlign;
inputTextAlign = _props3.inputTextAlign,
monthTitleEnable = _props3.monthTitleEnable;

var inputAlign = !!inputTextAlign && typeof inputTextAlign != "undefined" ? inputTextAlign : "right";
return _react2.default.createElement(
Expand Down Expand Up @@ -264,7 +265,7 @@
}, selectedTime: selectedTime })
)
),
_react2.default.createElement(_Months2.default, { clickEvent: function clickEvent(returnedMonth) {
_react2.default.createElement(_Months2.default, { monthTitleEnable: monthTitleEnable, clickEvent: function clickEvent(returnedMonth) {
return _this2.monthsClicked(returnedMonth);
}, month: currentMonth }),
_react2.default.createElement(
Expand Down
7 changes: 4 additions & 3 deletions dist/DateTimeRangePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@
customClassStart = _props.customClassStart,
customClassEnd = _props.customClassEnd,
containerClass = _props.containerClass,
inputTextAlign = _props.inputTextAlign;
inputTextAlign = _props.inputTextAlign,
monthTitleEnable = _props.monthTitleEnable;
var disableFromUnix = this.state.disableFromUnix;

if (!placeholderStart) placeholderStart = "";
Expand All @@ -128,7 +129,7 @@
return _react2.default.createElement(
"div",
{ className: "jdtrp", style: { textAlign: "initial" } },
_react2.default.createElement(_DateTimePicker2.default, { containerClass: containerClass, inputTextAlign: inputTextAlign, customClass: customClassStart, placeholder: placeholderStart, format: format, onChange: this.change, id: idStart }),
_react2.default.createElement(_DateTimePicker2.default, { monthTitleEnable: monthTitleEnable, containerClass: containerClass, inputTextAlign: inputTextAlign, customClass: customClassStart, placeholder: placeholderStart, format: format, onChange: this.change, id: idStart }),
_react2.default.createElement(
"div",
null,
Expand All @@ -139,7 +140,7 @@
null,
placeholderEnd
),
!!disableFromUnix && _react2.default.createElement(_DateTimePicker2.default, { containerClass: containerClass, inputTextAlign: inputTextAlign, customClass: customClassEnd, placeholder: placeholderEnd, disableFromUnix: disableFromUnix, format: format, onChange: this.secondchange, id: "datePicker" })
!!disableFromUnix && _react2.default.createElement(_DateTimePicker2.default, { monthTitleEnable: monthTitleEnable, containerClass: containerClass, inputTextAlign: inputTextAlign, customClass: customClassEnd, placeholder: placeholderEnd, disableFromUnix: disableFromUnix, format: format, onChange: this.secondchange, id: "datePicker" })
);
}
}]);
Expand Down
9 changes: 8 additions & 1 deletion dist/Partials/Months.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,21 @@
value: function render() {
var _this3 = this;

var month = this.props.month;
var _props = this.props,
month = _props.month,
monthTitleEnable = _props.monthTitleEnable;
var _state2 = this.state,
months = _state2.months,
monthPickerView = _state2.monthPickerView;

return _react2.default.createElement(
"div",
{ className: "JC-months" },
monthTitleEnable && _react2.default.createElement(
"span",
null,
"\u0645\u0627\u0647: "
),
_react2.default.createElement(
"div",
{ className: "holder" },
Expand Down
4 changes: 2 additions & 2 deletions dist/Partials/Styles.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,18 +207,19 @@
selectedMonthFirstDay = _state.selectedMonthFirstDay,
inputValue = _state.inputValue;
var _props2 = this.props,
idStart = _props2.idStart,
id = _props2.id,
placeholder = _props2.placeholder,
disableFromUnix = _props2.disableFromUnix,
customClass = _props2.customClass,
containerClass = _props2.containerClass,
inputTextAlign = _props2.inputTextAlign;
inputTextAlign = _props2.inputTextAlign,
monthTitleEnable = _props2.monthTitleEnable;

var inputAlign = !!inputTextAlign && typeof inputTextAlign != "undefined" ? inputTextAlign : "right";
return _react2.default.createElement(
"div",
{ style: { textAlign: "initial" }, className: containerClass },
_react2.default.createElement("input", { type: "text", id: idStart, placeholder: placeholder, dir: "ltr", style: { textAlign: inputAlign }, readOnly: true, value: inputValue, onClick: function onClick() {
_react2.default.createElement("input", { type: "text", id: id, placeholder: placeholder, dir: "ltr", style: { textAlign: inputAlign }, readOnly: true, value: inputValue, onClick: function onClick() {
_this2.setState({ openPicker: !openPicker });
} }),
openPicker && _react2.default.createElement(
Expand All @@ -236,7 +237,7 @@
),
_react2.default.createElement("div", { className: "left" })
),
_react2.default.createElement(_Months2.default, { clickEvent: function clickEvent(returnedMonth) {
_react2.default.createElement(_Months2.default, { monthTitleEnable: monthTitleEnable, clickEvent: function clickEvent(returnedMonth) {
return _this2.monthsClicked(returnedMonth);
}, month: currentMonth }),
_react2.default.createElement(
Expand Down
4 changes: 2 additions & 2 deletions src/DateRangePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ class DateRangePicker extends React.Component {
if(!!onChangeEnd) onChangeEnd(unix, formatted)
}
render() {
let {placeholderEnd, placeholderStart, idStart, idEnd, format, customClassEnd, customClassStart, containerClass, inputTextAlign} = this.props;
let {placeholderEnd, placeholderStart, idStart, idEnd, format, customClassEnd, customClassStart, containerClass, inputTextAlign, monthTitleEnable} = this.props;
let { disableFromUnix } = this.state;
if(!placeholderStart) placeholderStart= "";
if(!placeholderEnd) placeholderEnd= "";
if(!idStart) idStart="";
if(!idEnd) idEnd="";
return (
<div className="jdtrp" style={{textAlign: "initial"}}>
<DatePicker containerClass={containerClass} inputTextAlign={inputTextAlign} customClass={customClassStart} placeholder={placeholderStart} format={format} onChange={this.change} id={idStart} />
<DatePicker monthTitleEnable={monthTitleEnable} containerClass={containerClass} inputTextAlign={inputTextAlign} customClass={customClassStart} placeholder={placeholderStart} format={format} onChange={this.change} id={idStart} />
<div>{"->"}</div>
{!disableFromUnix && <div>{placeholderEnd}</div>}
{!!disableFromUnix && <DatePicker containerClass={containerClass} inputTextAlign={inputTextAlign} customClass={customClassEnd} placeholder={placeholderEnd} disableFromUnix={disableFromUnix} format={format} onChange={this.secondchange} id="datePicker" />}
Expand Down
4 changes: 2 additions & 2 deletions src/DateTimePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class DateTimePicker extends React.Component {
}
render() {
let {openPicker, daysCount, selectedDay, currentMonth, selectedYear, selectedMonthFirstDay, inputValue, selectedTime} = this.state;
let {id, placeholder, disableFromUnix, customClass, containerClass, inputTextAlign} = this.props;
let {id, placeholder, disableFromUnix, customClass, containerClass, inputTextAlign, monthTitleEnable} = this.props;
let inputAlign = !!inputTextAlign && typeof inputTextAlign != "undefined" ? inputTextAlign :"right";
return (
<div style={{textAlign: "initial"}} className={containerClass}>
Expand All @@ -118,7 +118,7 @@ class DateTimePicker extends React.Component {
<TimePicker disableFromUnix={disableFromUnix} selectedYear={selectedYear} selectedDay={selectedDay} currentMonth={currentMonth} changeEvent={(returnedTime)=>this.timeSelected(returnedTime)} selectedTime={selectedTime} />
</div>
</div>
<Months clickEvent={(returnedMonth)=>this.monthsClicked(returnedMonth)} month={currentMonth} />
<Months monthTitleEnable={monthTitleEnable} clickEvent={(returnedMonth)=>this.monthsClicked(returnedMonth)} month={currentMonth} />
<div className="days-titles">
<div>ش</div>
<div>ی</div>
Expand Down
Loading

0 comments on commit cefe9e7

Please sign in to comment.