Skip to content

Commit afa3918

Browse files
author
Asaf Shen
authored
Merge pull request demisto#9 from demisto/datetime-clear-and-loading
Datetime clear and loading
2 parents 59bfd93 + d839664 commit afa3918

File tree

5 files changed

+80
-61
lines changed

5 files changed

+80
-61
lines changed

DateTime.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ var Datetime = createClass({
4141
strictParsing: TYPES.bool,
4242
footer: TYPES.any,
4343
header: TYPES.any,
44-
timeOnly: TYPES.bool
44+
timeOnly: TYPES.bool,
45+
isClearable: TYPES.bool,
46+
onClear: TYPES.func,
47+
isLoading: TYPES.bool,
48+
loadingClasses: TYPES.string
4549
},
4650

4751
getDefaultProps: function() {
@@ -59,7 +63,11 @@ var Datetime = createClass({
5963
timeFormat: true,
6064
dateFormat: true,
6165
strictParsing: true,
62-
timeOnly: false
66+
timeOnly: false,
67+
isClearable: false,
68+
onClear: nof,
69+
isLoading: false,
70+
loadingClasses: ''
6371
};
6472
},
6573

@@ -363,7 +371,10 @@ var Datetime = createClass({
363371
{key: 'footer', className: 'rdtPicker-footer'}, [this.props.footer ? this.props.footer : '',
364372
React.createElement('span', {key: 'tpb', className: 'timePickerButtons'},[
365373
React.createElement('div', {key: 'cancel', className: 'cancelBtn', onClick: this.props.onCancel.bind(this, this.state.initialDate)}, 'Cancel'),
366-
React.createElement('div', {key: 'save', className: 'saveBtn ui mini button green', onClick: this.props.onSave.bind(this)}, 'Save')])]
374+
React.createElement('div', {key: 'save', className: 'saveBtn ui mini button green', onClick: this.props.onSave.bind(this)},
375+
this.props.isLoading && this.props.loadingClasses ? React.createElement('i', { className: this.props.loadingClasses}) : 'Save'),
376+
this.props.isClearable && this.props.onClear ?
377+
React.createElement('div', {key: 'clear', className: 'clear-value', onClick: this.props.onClear.bind(this)}, 'Clear date & time') : ''])]
367378
)
368379
)
369380
));

css/react-datetime.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,3 +248,15 @@ td.rdtYear:hover {
248248
font-size: 1.2em;
249249
margin-top: 37px;
250250
}
251+
252+
.rdtPicker-footer .timePickerButtons {
253+
position: relative;
254+
}
255+
256+
.rdtPicker-footer .clear-value {
257+
position: absolute;
258+
top: 4px;
259+
font-size: 12px;
260+
font-weight: 700;
261+
padding-left: 10px;
262+
}

dist/react-datetime.js

Lines changed: 39 additions & 45 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/react-datetime.min.js

Lines changed: 14 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-datetime-demisto",
3-
"version": "3.0.13",
3+
"version": "3.0.14",
44
"description": "A lightweight but complete datetime picker React.js component.",
55
"homepage": "https://github.com/demisto/react-datetime",
66
"repository": {

0 commit comments

Comments
 (0)