datatables.net-datetime 1.5.6 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/dataTables.dateTime.scss +140 -121
- package/dist/dataTables.dateTime.css +123 -131
- package/dist/dataTables.dateTime.js +45 -16
- package/dist/dataTables.dateTime.min.css +1 -1
- package/dist/dataTables.dateTime.min.js +2 -2
- package/dist/dataTables.dateTime.min.mjs +2 -2
- package/dist/dataTables.dateTime.mjs +45 -16
- package/docs/option/alwaysVisible.xml +31 -0
- package/docs/option/buttons.clear.xml +1 -0
- package/docs/option/buttons.selected.xml +30 -0
- package/docs/option/buttons.today.xml +1 -0
- package/docs/option/buttons.xml +5 -2
- package/docs/option/i18n.selected.xml +26 -0
- package/examples/initialisation/alwaysVisible.xml +38 -0
- package/examples/initialisation/buttons.xml +8 -5
- package/js/dataTables.dateTime.js +45 -16
- package/nuget.nuspec +1 -1
- package/package.json +1 -1
- package/test/options/dateTime.onChange.js +6 -6
- package/datatables.net-datetime.1.5.5.nupkg +0 -0
- package/mono_crash.8daede3e0.0.json +0 -511
- package/mono_crash.8daede3e0.1.json +0 -511
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! DateTime picker for DataTables.net v1.
|
|
1
|
+
/*! DateTime picker for DataTables.net v1.6.0
|
|
2
2
|
*
|
|
3
3
|
* © SpryMedia Ltd, all rights reserved.
|
|
4
4
|
* License: MIT datatables.net/license/mit
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @summary DateTime picker for DataTables.net
|
|
9
|
-
* @version 1.
|
|
9
|
+
* @version 1.6.0
|
|
10
10
|
* @file dataTables.dateTime.js
|
|
11
11
|
* @author SpryMedia Ltd
|
|
12
12
|
* @contact www.datatables.net/contact
|
|
@@ -96,6 +96,7 @@ var DateTime = function (input, opts) {
|
|
|
96
96
|
'<div class="' + classPrefix + '-buttons">' +
|
|
97
97
|
'<a class="' + classPrefix + '-clear"></a>' +
|
|
98
98
|
'<a class="' + classPrefix + '-today"></a>' +
|
|
99
|
+
'<a class="' + classPrefix + '-selected"></a>' +
|
|
99
100
|
'</div>' +
|
|
100
101
|
'<div class="' + classPrefix + '-calendar"></div>' +
|
|
101
102
|
'</div>' +
|
|
@@ -118,6 +119,7 @@ var DateTime = function (input, opts) {
|
|
|
118
119
|
buttons: structure.find('.' + classPrefix + '-buttons'),
|
|
119
120
|
clear: structure.find('.' + classPrefix + '-clear'),
|
|
120
121
|
today: structure.find('.' + classPrefix + '-today'),
|
|
122
|
+
selected: structure.find('.' + classPrefix + '-selected'),
|
|
121
123
|
previous: structure.find('.' + classPrefix + '-iconLeft'),
|
|
122
124
|
next: structure.find('.' + classPrefix + '-iconRight'),
|
|
123
125
|
input: $(input)
|
|
@@ -137,7 +139,7 @@ var DateTime = function (input, opts) {
|
|
|
137
139
|
secondsRange: null,
|
|
138
140
|
|
|
139
141
|
/** @type {String} Unique namespace string for this instance */
|
|
140
|
-
namespace: '
|
|
142
|
+
namespace: 'datetime-' + (DateTime._instance++),
|
|
141
143
|
|
|
142
144
|
/** @type {Object} Parts of the picker that should be shown */
|
|
143
145
|
parts: {
|
|
@@ -382,6 +384,10 @@ $.extend(DateTime.prototype, {
|
|
|
382
384
|
this.dom.today.css('display', 'none');
|
|
383
385
|
}
|
|
384
386
|
|
|
387
|
+
if (!this.c.buttons.selected) {
|
|
388
|
+
this.dom.selected.css('display', 'none');
|
|
389
|
+
}
|
|
390
|
+
|
|
385
391
|
// Render the options
|
|
386
392
|
this._optionsTitle();
|
|
387
393
|
|
|
@@ -394,7 +400,7 @@ $.extend(DateTime.prototype, {
|
|
|
394
400
|
|
|
395
401
|
// When attached to a hidden input, we always show the input picker, and
|
|
396
402
|
// do so inline
|
|
397
|
-
if (this.dom.input.attr('type') === 'hidden') {
|
|
403
|
+
if (this.dom.input.attr('type') === 'hidden' || this.c.alwaysVisible) {
|
|
398
404
|
this.dom.container.addClass('inline');
|
|
399
405
|
this.c.attachTo = 'input';
|
|
400
406
|
|
|
@@ -418,15 +424,14 @@ $.extend(DateTime.prototype, {
|
|
|
418
424
|
}
|
|
419
425
|
|
|
420
426
|
// In case the value has changed by text
|
|
421
|
-
that.
|
|
427
|
+
last = that.dom.input.val();
|
|
428
|
+
that.val(last, false);
|
|
422
429
|
|
|
423
430
|
that._show();
|
|
424
431
|
})
|
|
425
432
|
.on('keyup.datetime', function () {
|
|
426
433
|
// Update the calendar's displayed value as the user types
|
|
427
|
-
|
|
428
|
-
that.val(that.dom.input.val(), false);
|
|
429
|
-
}
|
|
434
|
+
that.val(that.dom.input.val(), false);
|
|
430
435
|
});
|
|
431
436
|
|
|
432
437
|
// Want to prevent the focus bubbling up the document to account for
|
|
@@ -531,6 +536,13 @@ $.extend(DateTime.prototype, {
|
|
|
531
536
|
// containing today
|
|
532
537
|
that.s.display = new Date();
|
|
533
538
|
|
|
539
|
+
that._setTitle();
|
|
540
|
+
that._setCalander();
|
|
541
|
+
}
|
|
542
|
+
else if ($(target).hasClass(classPrefix + '-selected')) {
|
|
543
|
+
// Don't change the value, but jump to where the selected value is
|
|
544
|
+
that.s.display = new Date(that.s.d.getTime());
|
|
545
|
+
|
|
534
546
|
that._setTitle();
|
|
535
547
|
that._setCalander();
|
|
536
548
|
}
|
|
@@ -824,7 +836,7 @@ $.extend(DateTime.prototype, {
|
|
|
824
836
|
* @private
|
|
825
837
|
*/
|
|
826
838
|
_hide: function (destroy) {
|
|
827
|
-
if (!destroy && this.dom.input.attr('type') === 'hidden') {
|
|
839
|
+
if (!destroy && (this.dom.input.attr('type') === 'hidden' || this.c.alwaysVisible)) {
|
|
828
840
|
return;
|
|
829
841
|
}
|
|
830
842
|
|
|
@@ -833,10 +845,12 @@ $.extend(DateTime.prototype, {
|
|
|
833
845
|
this.dom.container.detach();
|
|
834
846
|
|
|
835
847
|
$(window).off('.' + namespace);
|
|
836
|
-
$(document)
|
|
848
|
+
$(document)
|
|
849
|
+
.off('keydown.' + namespace)
|
|
850
|
+
.off('keyup.' + namespace)
|
|
851
|
+
.off('click.' + namespace);
|
|
837
852
|
$('div.dataTables_scrollBody').off('scroll.' + namespace);
|
|
838
853
|
$('div.DTE_Body_Content').off('scroll.' + namespace);
|
|
839
|
-
$(document).off('click.' + namespace);
|
|
840
854
|
$(this.dom.input[0].offsetParent).off('.' + namespace);
|
|
841
855
|
},
|
|
842
856
|
|
|
@@ -1301,6 +1315,7 @@ $.extend(DateTime.prototype, {
|
|
|
1301
1315
|
|
|
1302
1316
|
// Set the language strings in case any have changed
|
|
1303
1317
|
this.dom.today.text(i18n.today).text(i18n.today);
|
|
1318
|
+
this.dom.selected.text(i18n.selected).text(i18n.selected);
|
|
1304
1319
|
this.dom.clear.text(i18n.clear).text(i18n.clear);
|
|
1305
1320
|
this.dom.previous
|
|
1306
1321
|
.attr('title', i18n.previous)
|
|
@@ -1524,14 +1539,24 @@ $.extend(DateTime.prototype, {
|
|
|
1524
1539
|
// in the date picker - this might need to be changed).
|
|
1525
1540
|
$(document).on('keydown.' + namespace, function (e) {
|
|
1526
1541
|
if (
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1542
|
+
that.dom.container.is(':visible') && (
|
|
1543
|
+
e.keyCode === 9 || // tab
|
|
1544
|
+
e.keyCode === 13 // return
|
|
1545
|
+
)
|
|
1530
1546
|
) {
|
|
1531
1547
|
that._hide();
|
|
1532
1548
|
}
|
|
1533
1549
|
});
|
|
1534
1550
|
|
|
1551
|
+
// Esc is on keyup to allow Editor to know that the container was hidden and thus
|
|
1552
|
+
// not act on the esc itself.
|
|
1553
|
+
$(document).on('keyup.' + namespace, function (e) {
|
|
1554
|
+
if (that.dom.container.is(':visible') && e.keyCode === 27 ) { // esc
|
|
1555
|
+
e.preventDefault();
|
|
1556
|
+
that._hide();
|
|
1557
|
+
}
|
|
1558
|
+
});
|
|
1559
|
+
|
|
1535
1560
|
clearTimeout(this.s.showTo);
|
|
1536
1561
|
|
|
1537
1562
|
// We can't use blur to hide, as we want to keep the picker open while
|
|
@@ -1629,10 +1654,13 @@ DateTime.type = 'DateTime';
|
|
|
1629
1654
|
* @type {Object}
|
|
1630
1655
|
*/
|
|
1631
1656
|
DateTime.defaults = {
|
|
1657
|
+
alwaysVisible: false,
|
|
1658
|
+
|
|
1632
1659
|
attachTo: 'body',
|
|
1633
1660
|
|
|
1634
1661
|
buttons: {
|
|
1635
1662
|
clear: false,
|
|
1663
|
+
selected: false,
|
|
1636
1664
|
today: false
|
|
1637
1665
|
},
|
|
1638
1666
|
|
|
@@ -1660,7 +1688,8 @@ DateTime.defaults = {
|
|
|
1660
1688
|
minutes: 'Minute',
|
|
1661
1689
|
seconds: 'Second',
|
|
1662
1690
|
unknown: '-',
|
|
1663
|
-
today: 'Today'
|
|
1691
|
+
today: 'Today',
|
|
1692
|
+
selected: 'Selected'
|
|
1664
1693
|
},
|
|
1665
1694
|
|
|
1666
1695
|
maxDate: null,
|
|
@@ -1688,7 +1717,7 @@ DateTime.defaults = {
|
|
|
1688
1717
|
yearRange: 25
|
|
1689
1718
|
};
|
|
1690
1719
|
|
|
1691
|
-
DateTime.version = '1.
|
|
1720
|
+
DateTime.version = '1.6.0';
|
|
1692
1721
|
|
|
1693
1722
|
/**
|
|
1694
1723
|
* CommonJS factory function pass through. Matches DataTables.
|
package/nuget.nuspec
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
|
3
3
|
<metadata>
|
|
4
4
|
<id>datatables.net-datetime</id>
|
|
5
|
-
<version>1.
|
|
5
|
+
<version>1.6.0</version>
|
|
6
6
|
<description>DataTables date / time picker</description>
|
|
7
7
|
<authors>SpryMedia Ltd</authors>
|
|
8
8
|
<projectUrl>http://datatables.net</projectUrl>
|
package/package.json
CHANGED
|
@@ -63,30 +63,30 @@ describe('dateTime - options - onChange', function () {
|
|
|
63
63
|
$('#test').click();
|
|
64
64
|
expect(count).toBe(0);
|
|
65
65
|
});
|
|
66
|
-
it('...
|
|
66
|
+
it('... does not trigger on selected date', function () {
|
|
67
67
|
$('#test').click();
|
|
68
68
|
$('.dt-datetime-calendar .selected button span').click();
|
|
69
|
-
expect(count).toBe(
|
|
69
|
+
expect(count).toBe(0);
|
|
70
70
|
});
|
|
71
71
|
it('... does not trigger again if no change', function () {
|
|
72
72
|
$('#test').click();
|
|
73
73
|
$('.dt-datetime-calendar .selected button span').click();
|
|
74
|
-
expect(count).toBe(
|
|
74
|
+
expect(count).toBe(0);
|
|
75
75
|
});
|
|
76
76
|
it('... triggers on hours', function () {
|
|
77
77
|
$('#test').click();
|
|
78
78
|
$('.dt-datetime-hours tbody tr:eq(0) td:eq(0) button span').click();
|
|
79
|
-
expect(count).toBe(
|
|
79
|
+
expect(count).toBe(1);
|
|
80
80
|
});
|
|
81
81
|
it('... triggers on minutes', function () {
|
|
82
82
|
$('#test').click();
|
|
83
83
|
$('.dt-datetime-minutes tbody tr:eq(0) td:eq(0) button span').click();
|
|
84
|
-
expect(count).toBe(
|
|
84
|
+
expect(count).toBe(2);
|
|
85
85
|
});
|
|
86
86
|
it('... triggers on seconds', function () {
|
|
87
87
|
$('#test').click();
|
|
88
88
|
$('.dt-datetime-seconds tbody tr:eq(0) td:eq(0) button span').click();
|
|
89
|
-
expect(count).toBe(
|
|
89
|
+
expect(count).toBe(3);
|
|
90
90
|
});
|
|
91
91
|
|
|
92
92
|
dt.html('input');
|
|
File without changes
|