blazer 1.7.7 → 2.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +242 -33
- data/CONTRIBUTING.md +42 -0
- data/LICENSE.txt +1 -1
- data/README.md +621 -211
- data/app/assets/fonts/blazer/glyphicons-halflings-regular.eot +0 -0
- data/app/assets/fonts/blazer/glyphicons-halflings-regular.svg +0 -0
- data/app/assets/fonts/blazer/glyphicons-halflings-regular.ttf +0 -0
- data/app/assets/fonts/blazer/glyphicons-halflings-regular.woff +0 -0
- data/app/assets/fonts/blazer/glyphicons-halflings-regular.woff2 +0 -0
- data/app/assets/images/blazer/favicon.png +0 -0
- data/app/assets/javascripts/blazer/Chart.js +15658 -10011
- data/app/assets/javascripts/blazer/Sortable.js +3413 -848
- data/app/assets/javascripts/blazer/ace/ace.js +21294 -4
- data/app/assets/javascripts/blazer/ace/ext-language_tools.js +1991 -3
- data/app/assets/javascripts/blazer/ace/mode-sql.js +110 -1
- data/app/assets/javascripts/blazer/ace/snippets/sql.js +40 -1
- data/app/assets/javascripts/blazer/ace/snippets/text.js +14 -1
- data/app/assets/javascripts/blazer/ace/theme-twilight.js +116 -1
- data/app/assets/javascripts/blazer/application.js +5 -3
- data/app/assets/javascripts/blazer/bootstrap.js +842 -628
- data/app/assets/javascripts/blazer/chartkick.js +2015 -1244
- data/app/assets/javascripts/blazer/daterangepicker.js +372 -299
- data/app/assets/javascripts/blazer/highlight.min.js +3 -0
- data/app/assets/javascripts/blazer/{jquery_ujs.js → jquery-ujs.js} +161 -75
- data/app/assets/javascripts/blazer/jquery.js +10126 -9562
- data/app/assets/javascripts/blazer/jquery.stickytableheaders.js +321 -259
- data/app/assets/javascripts/blazer/moment-timezone-with-data.js +1546 -0
- data/app/assets/javascripts/blazer/moment.js +5085 -2460
- data/app/assets/javascripts/blazer/queries.js +18 -4
- data/app/assets/javascripts/blazer/routes.js +3 -0
- data/app/assets/javascripts/blazer/selectize.js +3828 -3604
- data/app/assets/javascripts/blazer/stupidtable-custom-settings.js +13 -0
- data/app/assets/javascripts/blazer/stupidtable.js +254 -87
- data/app/assets/javascripts/blazer/vue.js +11175 -6676
- data/app/assets/stylesheets/blazer/application.css +51 -6
- data/app/assets/stylesheets/blazer/bootstrap-propshaft.css +10 -0
- data/app/assets/stylesheets/blazer/bootstrap-sprockets.css.erb +10 -0
- data/app/assets/stylesheets/blazer/{bootstrap.css.erb → bootstrap.css} +1337 -711
- data/app/assets/stylesheets/blazer/{daterangepicker-bs3.css → daterangepicker.css} +207 -172
- data/app/assets/stylesheets/blazer/{selectize.default.css → selectize.css} +26 -10
- data/app/controllers/blazer/base_controller.rb +73 -46
- data/app/controllers/blazer/checks_controller.rb +1 -1
- data/app/controllers/blazer/dashboards_controller.rb +7 -13
- data/app/controllers/blazer/queries_controller.rb +171 -51
- data/app/controllers/blazer/uploads_controller.rb +147 -0
- data/app/helpers/blazer/base_helper.rb +6 -16
- data/app/models/blazer/audit.rb +3 -3
- data/app/models/blazer/check.rb +31 -5
- data/app/models/blazer/dashboard.rb +6 -2
- data/app/models/blazer/dashboard_query.rb +1 -1
- data/app/models/blazer/query.rb +30 -4
- data/app/models/blazer/record.rb +5 -0
- data/app/models/blazer/upload.rb +11 -0
- data/app/models/blazer/uploads_connection.rb +7 -0
- data/app/views/blazer/_nav.html.erb +3 -1
- data/app/views/blazer/_variables.html.erb +48 -23
- data/app/views/blazer/check_mailer/failing_checks.html.erb +1 -0
- data/app/views/blazer/check_mailer/state_change.html.erb +1 -0
- data/app/views/blazer/checks/_form.html.erb +17 -9
- data/app/views/blazer/checks/edit.html.erb +2 -0
- data/app/views/blazer/checks/index.html.erb +37 -5
- data/app/views/blazer/checks/new.html.erb +2 -0
- data/app/views/blazer/dashboards/_form.html.erb +5 -5
- data/app/views/blazer/dashboards/edit.html.erb +2 -0
- data/app/views/blazer/dashboards/new.html.erb +2 -0
- data/app/views/blazer/dashboards/show.html.erb +13 -7
- data/app/views/blazer/queries/_caching.html.erb +16 -0
- data/app/views/blazer/queries/_cohorts.html.erb +48 -0
- data/app/views/blazer/queries/_form.html.erb +23 -13
- data/app/views/blazer/queries/docs.html.erb +137 -0
- data/app/views/blazer/queries/home.html.erb +21 -7
- data/app/views/blazer/queries/run.html.erb +64 -29
- data/app/views/blazer/queries/schema.html.erb +44 -7
- data/app/views/blazer/queries/show.html.erb +15 -8
- data/app/views/blazer/uploads/_form.html.erb +27 -0
- data/app/views/blazer/uploads/edit.html.erb +3 -0
- data/app/views/blazer/uploads/index.html.erb +55 -0
- data/app/views/blazer/uploads/new.html.erb +3 -0
- data/app/views/layouts/blazer/application.html.erb +10 -5
- data/config/routes.rb +10 -1
- data/lib/blazer/adapters/athena_adapter.rb +182 -0
- data/lib/blazer/adapters/base_adapter.rb +24 -1
- data/lib/blazer/adapters/bigquery_adapter.rb +79 -0
- data/lib/blazer/adapters/cassandra_adapter.rb +70 -0
- data/lib/blazer/adapters/drill_adapter.rb +38 -0
- data/lib/blazer/adapters/druid_adapter.rb +102 -0
- data/lib/blazer/adapters/elasticsearch_adapter.rb +30 -18
- data/lib/blazer/adapters/hive_adapter.rb +55 -0
- data/lib/blazer/adapters/ignite_adapter.rb +64 -0
- data/lib/blazer/adapters/influxdb_adapter.rb +57 -0
- data/lib/blazer/adapters/mongodb_adapter.rb +5 -1
- data/lib/blazer/adapters/neo4j_adapter.rb +62 -0
- data/lib/blazer/adapters/opensearch_adapter.rb +52 -0
- data/lib/blazer/adapters/presto_adapter.rb +9 -0
- data/lib/blazer/adapters/salesforce_adapter.rb +50 -0
- data/lib/blazer/adapters/snowflake_adapter.rb +82 -0
- data/lib/blazer/adapters/soda_adapter.rb +105 -0
- data/lib/blazer/adapters/spark_adapter.rb +14 -0
- data/lib/blazer/adapters/sql_adapter.rb +187 -20
- data/{app/mailers → lib}/blazer/check_mailer.rb +0 -0
- data/lib/blazer/data_source.rb +107 -30
- data/lib/blazer/engine.rb +21 -23
- data/lib/blazer/result.rb +95 -29
- data/lib/blazer/run_statement.rb +8 -4
- data/lib/blazer/run_statement_job.rb +8 -9
- data/lib/blazer/slack_notifier.rb +94 -0
- data/lib/blazer/statement.rb +75 -0
- data/lib/blazer/version.rb +1 -1
- data/lib/blazer.rb +154 -26
- data/lib/generators/blazer/install_generator.rb +7 -18
- data/lib/generators/blazer/templates/{config.yml → config.yml.tt} +26 -3
- data/lib/generators/blazer/templates/{install.rb → install.rb.tt} +6 -4
- data/lib/generators/blazer/templates/uploads.rb.tt +10 -0
- data/lib/generators/blazer/uploads_generator.rb +18 -0
- data/lib/tasks/blazer.rake +11 -1
- data/licenses/LICENSE-ace.txt +24 -0
- data/licenses/LICENSE-bootstrap.txt +21 -0
- data/licenses/LICENSE-chart.js.txt +9 -0
- data/licenses/LICENSE-chartkick.js.txt +22 -0
- data/licenses/LICENSE-daterangepicker.txt +21 -0
- data/licenses/LICENSE-fuzzysearch.txt +20 -0
- data/licenses/LICENSE-highlight.js.txt +29 -0
- data/licenses/LICENSE-jquery-ujs.txt +20 -0
- data/licenses/LICENSE-jquery.txt +20 -0
- data/licenses/LICENSE-moment-timezone.txt +20 -0
- data/licenses/LICENSE-moment.txt +22 -0
- data/licenses/LICENSE-selectize.txt +202 -0
- data/licenses/LICENSE-sortable.txt +21 -0
- data/licenses/LICENSE-stickytableheaders.txt +20 -0
- data/licenses/LICENSE-stupidtable.txt +19 -0
- data/licenses/LICENSE-vue.txt +21 -0
- metadata +83 -53
- data/.gitignore +0 -14
- data/Gemfile +0 -4
- data/Rakefile +0 -1
- data/app/assets/javascripts/blazer/highlight.pack.js +0 -1
- data/app/assets/javascripts/blazer/moment-timezone.js +0 -1007
- data/blazer.gemspec +0 -26
@@ -1,39 +1,34 @@
|
|
1
1
|
/**
|
2
|
-
* @version:
|
2
|
+
* @version: 3.1
|
3
3
|
* @author: Dan Grossman http://www.dangrossman.info/
|
4
|
-
* @copyright: Copyright (c) 2012-
|
4
|
+
* @copyright: Copyright (c) 2012-2019 Dan Grossman. All rights reserved.
|
5
5
|
* @license: Licensed under the MIT license. See http://www.opensource.org/licenses/mit-license.php
|
6
|
-
* @website:
|
6
|
+
* @website: http://www.daterangepicker.com/
|
7
7
|
*/
|
8
|
-
|
9
|
-
(function(root, factory) {
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
root.daterangepicker = factory(root, {}, root.moment || moment, (root.jQuery || root.Zepto || root.ender || root.$));
|
33
|
-
}
|
34
|
-
|
35
|
-
}(this || {}, function(root, daterangepicker, moment, $) { // 'this' doesn't exist on a server
|
36
|
-
|
8
|
+
// Following the UMD template https://github.com/umdjs/umd/blob/master/templates/returnExportsGlobal.js
|
9
|
+
(function (root, factory) {
|
10
|
+
if (typeof define === 'function' && define.amd) {
|
11
|
+
// AMD. Make globaly available as well
|
12
|
+
define(['moment', 'jquery'], function (moment, jquery) {
|
13
|
+
if (!jquery.fn) jquery.fn = {}; // webpack server rendering
|
14
|
+
if (typeof moment !== 'function' && moment.hasOwnProperty('default')) moment = moment['default']
|
15
|
+
return factory(moment, jquery);
|
16
|
+
});
|
17
|
+
} else if (typeof module === 'object' && module.exports) {
|
18
|
+
// Node / Browserify
|
19
|
+
//isomorphic issue
|
20
|
+
var jQuery = (typeof window != 'undefined') ? window.jQuery : undefined;
|
21
|
+
if (!jQuery) {
|
22
|
+
jQuery = require('jquery');
|
23
|
+
if (!jQuery.fn) jQuery.fn = {};
|
24
|
+
}
|
25
|
+
var moment = (typeof window != 'undefined' && typeof window.moment != 'undefined') ? window.moment : require('moment');
|
26
|
+
module.exports = factory(moment, jQuery);
|
27
|
+
} else {
|
28
|
+
// Browser globals
|
29
|
+
root.daterangepicker = factory(root.moment, root.jQuery);
|
30
|
+
}
|
31
|
+
}(this, function(moment, $) {
|
37
32
|
var DateRangePicker = function(element, options, cb) {
|
38
33
|
|
39
34
|
//default settings for options
|
@@ -43,17 +38,22 @@
|
|
43
38
|
this.endDate = moment().endOf('day');
|
44
39
|
this.minDate = false;
|
45
40
|
this.maxDate = false;
|
46
|
-
this.
|
41
|
+
this.maxSpan = false;
|
47
42
|
this.autoApply = false;
|
48
43
|
this.singleDatePicker = false;
|
49
44
|
this.showDropdowns = false;
|
45
|
+
this.minYear = moment().subtract(100, 'year').format('YYYY');
|
46
|
+
this.maxYear = moment().add(100, 'year').format('YYYY');
|
50
47
|
this.showWeekNumbers = false;
|
48
|
+
this.showISOWeekNumbers = false;
|
49
|
+
this.showCustomRangeLabel = true;
|
51
50
|
this.timePicker = false;
|
52
51
|
this.timePicker24Hour = false;
|
53
52
|
this.timePickerIncrement = 1;
|
54
53
|
this.timePickerSeconds = false;
|
55
54
|
this.linkedCalendars = true;
|
56
55
|
this.autoUpdateInput = true;
|
56
|
+
this.alwaysShowCalendars = false;
|
57
57
|
this.ranges = {};
|
58
58
|
|
59
59
|
this.opens = 'right';
|
@@ -65,11 +65,12 @@
|
|
65
65
|
this.drops = 'up';
|
66
66
|
|
67
67
|
this.buttonClasses = 'btn btn-sm';
|
68
|
-
this.
|
69
|
-
this.
|
68
|
+
this.applyButtonClasses = 'btn-primary';
|
69
|
+
this.cancelButtonClasses = 'btn-default';
|
70
70
|
|
71
71
|
this.locale = {
|
72
|
-
|
72
|
+
direction: 'ltr',
|
73
|
+
format: moment.localeData().longDateFormat('L'),
|
73
74
|
separator: ' - ',
|
74
75
|
applyLabel: 'Apply',
|
75
76
|
cancelLabel: 'Cancel',
|
@@ -96,35 +97,22 @@
|
|
96
97
|
options = $.extend(this.element.data(), options);
|
97
98
|
|
98
99
|
//html template for the picker UI
|
99
|
-
if (typeof options.template !== 'string')
|
100
|
-
options.template =
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
'<i class="fa fa-calendar glyphicon glyphicon-calendar"></i>' +
|
105
|
-
'<div class="calendar-time">' +
|
106
|
-
'<div></div>' +
|
107
|
-
'<i class="fa fa-clock-o glyphicon glyphicon-time"></i>' +
|
108
|
-
'</div>' +
|
109
|
-
'</div>' +
|
100
|
+
if (typeof options.template !== 'string' && !(options.template instanceof $))
|
101
|
+
options.template =
|
102
|
+
'<div class="daterangepicker">' +
|
103
|
+
'<div class="ranges"></div>' +
|
104
|
+
'<div class="drp-calendar left">' +
|
110
105
|
'<div class="calendar-table"></div>' +
|
106
|
+
'<div class="calendar-time"></div>' +
|
111
107
|
'</div>' +
|
112
|
-
'<div class="calendar right">' +
|
113
|
-
'<div class="daterangepicker_input">' +
|
114
|
-
'<input class="input-mini" type="text" name="daterangepicker_end" value="" />' +
|
115
|
-
'<i class="fa fa-calendar glyphicon glyphicon-calendar"></i>' +
|
116
|
-
'<div class="calendar-time">' +
|
117
|
-
'<div></div>' +
|
118
|
-
'<i class="fa fa-clock-o glyphicon glyphicon-time"></i>' +
|
119
|
-
'</div>' +
|
120
|
-
'</div>' +
|
108
|
+
'<div class="drp-calendar right">' +
|
121
109
|
'<div class="calendar-table"></div>' +
|
110
|
+
'<div class="calendar-time"></div>' +
|
122
111
|
'</div>' +
|
123
|
-
'<div class="
|
124
|
-
'<
|
125
|
-
|
126
|
-
|
127
|
-
'</div>' +
|
112
|
+
'<div class="drp-buttons">' +
|
113
|
+
'<span class="drp-selected"></span>' +
|
114
|
+
'<button class="cancelBtn" type="button"></button>' +
|
115
|
+
'<button class="applyBtn" disabled="disabled" type="button"></button> ' +
|
128
116
|
'</div>' +
|
129
117
|
'</div>';
|
130
118
|
|
@@ -137,6 +125,9 @@
|
|
137
125
|
|
138
126
|
if (typeof options.locale === 'object') {
|
139
127
|
|
128
|
+
if (typeof options.locale.direction === 'string')
|
129
|
+
this.locale.direction = options.locale.direction;
|
130
|
+
|
140
131
|
if (typeof options.locale.format === 'string')
|
141
132
|
this.locale.format = options.locale.format;
|
142
133
|
|
@@ -161,10 +152,15 @@
|
|
161
152
|
if (typeof options.locale.weekLabel === 'string')
|
162
153
|
this.locale.weekLabel = options.locale.weekLabel;
|
163
154
|
|
164
|
-
if (typeof options.locale.customRangeLabel === 'string')
|
165
|
-
|
166
|
-
|
155
|
+
if (typeof options.locale.customRangeLabel === 'string'){
|
156
|
+
//Support unicode chars in the custom range name.
|
157
|
+
var elem = document.createElement('textarea');
|
158
|
+
elem.innerHTML = options.locale.customRangeLabel;
|
159
|
+
var rangeHtml = elem.value;
|
160
|
+
this.locale.customRangeLabel = rangeHtml;
|
161
|
+
}
|
167
162
|
}
|
163
|
+
this.container.addClass(this.locale.direction);
|
168
164
|
|
169
165
|
if (typeof options.startDate === 'string')
|
170
166
|
this.startDate = moment(options.startDate, this.locale.format);
|
@@ -198,14 +194,23 @@
|
|
198
194
|
if (this.maxDate && this.endDate.isAfter(this.maxDate))
|
199
195
|
this.endDate = this.maxDate.clone();
|
200
196
|
|
201
|
-
if (typeof options.
|
202
|
-
this.
|
197
|
+
if (typeof options.applyButtonClasses === 'string')
|
198
|
+
this.applyButtonClasses = options.applyButtonClasses;
|
199
|
+
|
200
|
+
if (typeof options.applyClass === 'string') //backwards compat
|
201
|
+
this.applyButtonClasses = options.applyClass;
|
202
|
+
|
203
|
+
if (typeof options.cancelButtonClasses === 'string')
|
204
|
+
this.cancelButtonClasses = options.cancelButtonClasses;
|
205
|
+
|
206
|
+
if (typeof options.cancelClass === 'string') //backwards compat
|
207
|
+
this.cancelButtonClasses = options.cancelClass;
|
203
208
|
|
204
|
-
if (typeof options.
|
205
|
-
this.
|
209
|
+
if (typeof options.maxSpan === 'object')
|
210
|
+
this.maxSpan = options.maxSpan;
|
206
211
|
|
207
|
-
if (typeof options.dateLimit === 'object')
|
208
|
-
this.
|
212
|
+
if (typeof options.dateLimit === 'object') //backwards compat
|
213
|
+
this.maxSpan = options.dateLimit;
|
209
214
|
|
210
215
|
if (typeof options.opens === 'string')
|
211
216
|
this.opens = options.opens;
|
@@ -216,6 +221,9 @@
|
|
216
221
|
if (typeof options.showWeekNumbers === 'boolean')
|
217
222
|
this.showWeekNumbers = options.showWeekNumbers;
|
218
223
|
|
224
|
+
if (typeof options.showISOWeekNumbers === 'boolean')
|
225
|
+
this.showISOWeekNumbers = options.showISOWeekNumbers;
|
226
|
+
|
219
227
|
if (typeof options.buttonClasses === 'string')
|
220
228
|
this.buttonClasses = options.buttonClasses;
|
221
229
|
|
@@ -225,6 +233,15 @@
|
|
225
233
|
if (typeof options.showDropdowns === 'boolean')
|
226
234
|
this.showDropdowns = options.showDropdowns;
|
227
235
|
|
236
|
+
if (typeof options.minYear === 'number')
|
237
|
+
this.minYear = options.minYear;
|
238
|
+
|
239
|
+
if (typeof options.maxYear === 'number')
|
240
|
+
this.maxYear = options.maxYear;
|
241
|
+
|
242
|
+
if (typeof options.showCustomRangeLabel === 'boolean')
|
243
|
+
this.showCustomRangeLabel = options.showCustomRangeLabel;
|
244
|
+
|
228
245
|
if (typeof options.singleDatePicker === 'boolean') {
|
229
246
|
this.singleDatePicker = options.singleDatePicker;
|
230
247
|
if (this.singleDatePicker)
|
@@ -255,6 +272,12 @@
|
|
255
272
|
if (typeof options.isInvalidDate === 'function')
|
256
273
|
this.isInvalidDate = options.isInvalidDate;
|
257
274
|
|
275
|
+
if (typeof options.isCustomDate === 'function')
|
276
|
+
this.isCustomDate = options.isCustomDate;
|
277
|
+
|
278
|
+
if (typeof options.alwaysShowCalendars === 'boolean')
|
279
|
+
this.alwaysShowCalendars = options.alwaysShowCalendars;
|
280
|
+
|
258
281
|
// update day names order to firstDay
|
259
282
|
if (this.locale.firstDay != 0) {
|
260
283
|
var iterator = this.locale.firstDay;
|
@@ -268,7 +291,7 @@
|
|
268
291
|
|
269
292
|
//if no start/end dates set, check if an input element contains initial values
|
270
293
|
if (typeof options.startDate === 'undefined' && typeof options.endDate === 'undefined') {
|
271
|
-
if ($(this.element).is('
|
294
|
+
if ($(this.element).is(':text')) {
|
272
295
|
var val = $(this.element).val(),
|
273
296
|
split = val.split(this.locale.separator);
|
274
297
|
|
@@ -301,20 +324,21 @@
|
|
301
324
|
else
|
302
325
|
end = moment(options.ranges[range][1]);
|
303
326
|
|
304
|
-
// If the start or end date exceed those allowed by the minDate or
|
327
|
+
// If the start or end date exceed those allowed by the minDate or maxSpan
|
305
328
|
// options, shorten the range to the allowable period.
|
306
329
|
if (this.minDate && start.isBefore(this.minDate))
|
307
330
|
start = this.minDate.clone();
|
308
331
|
|
309
332
|
var maxDate = this.maxDate;
|
310
|
-
if (this.
|
311
|
-
maxDate = start.clone().add(this.
|
333
|
+
if (this.maxSpan && maxDate && start.clone().add(this.maxSpan).isAfter(maxDate))
|
334
|
+
maxDate = start.clone().add(this.maxSpan);
|
312
335
|
if (maxDate && end.isAfter(maxDate))
|
313
336
|
end = maxDate.clone();
|
314
337
|
|
315
338
|
// If the end of the range is before the minimum or the start of the range is
|
316
339
|
// after the maximum, don't display this range option at all.
|
317
|
-
if ((this.minDate && end.isBefore(this.minDate
|
340
|
+
if ((this.minDate && end.isBefore(this.minDate, this.timepicker ? 'minute' : 'day'))
|
341
|
+
|| (maxDate && start.isAfter(maxDate, this.timepicker ? 'minute' : 'day')))
|
318
342
|
continue;
|
319
343
|
|
320
344
|
//Support unicode chars in the range names.
|
@@ -327,9 +351,11 @@
|
|
327
351
|
|
328
352
|
var list = '<ul>';
|
329
353
|
for (range in this.ranges) {
|
330
|
-
list += '<li>' + range + '</li>';
|
354
|
+
list += '<li data-range-key="' + range + '">' + range + '</li>';
|
355
|
+
}
|
356
|
+
if (this.showCustomRangeLabel) {
|
357
|
+
list += '<li data-range-key="' + this.locale.customRangeLabel + '">' + this.locale.customRangeLabel + '</li>';
|
331
358
|
}
|
332
|
-
list += '<li>' + this.locale.customRangeLabel + '</li>';
|
333
359
|
list += '</ul>';
|
334
360
|
this.container.find('.ranges').prepend(list);
|
335
361
|
}
|
@@ -348,43 +374,35 @@
|
|
348
374
|
if (this.timePicker && this.autoApply)
|
349
375
|
this.autoApply = false;
|
350
376
|
|
351
|
-
if (this.autoApply
|
352
|
-
this.container.
|
353
|
-
} else if (this.autoApply) {
|
354
|
-
this.container.find('.applyBtn, .cancelBtn').addClass('hide');
|
377
|
+
if (this.autoApply) {
|
378
|
+
this.container.addClass('auto-apply');
|
355
379
|
}
|
356
380
|
|
381
|
+
if (typeof options.ranges === 'object')
|
382
|
+
this.container.addClass('show-ranges');
|
383
|
+
|
357
384
|
if (this.singleDatePicker) {
|
358
385
|
this.container.addClass('single');
|
359
|
-
this.container.find('.calendar.left').addClass('single');
|
360
|
-
this.container.find('.calendar.left').show();
|
361
|
-
this.container.find('.calendar.right').hide();
|
362
|
-
this.
|
363
|
-
|
364
|
-
this.container.find('.ranges').hide();
|
386
|
+
this.container.find('.drp-calendar.left').addClass('single');
|
387
|
+
this.container.find('.drp-calendar.left').show();
|
388
|
+
this.container.find('.drp-calendar.right').hide();
|
389
|
+
if (!this.timePicker && this.autoApply) {
|
390
|
+
this.container.addClass('auto-apply');
|
365
391
|
}
|
366
392
|
}
|
367
393
|
|
368
|
-
if (typeof options.ranges === 'undefined' && !this.singleDatePicker) {
|
394
|
+
if ((typeof options.ranges === 'undefined' && !this.singleDatePicker) || this.alwaysShowCalendars) {
|
369
395
|
this.container.addClass('show-calendar');
|
370
396
|
}
|
371
397
|
|
372
398
|
this.container.addClass('opens' + this.opens);
|
373
399
|
|
374
|
-
//swap the position of the predefined ranges if opens right
|
375
|
-
if (typeof options.ranges !== 'undefined' && this.opens == 'right') {
|
376
|
-
var ranges = this.container.find('.ranges');
|
377
|
-
var html = ranges.clone();
|
378
|
-
ranges.remove();
|
379
|
-
this.container.find('.calendar.left').parent().prepend(html);
|
380
|
-
}
|
381
|
-
|
382
400
|
//apply CSS classes and labels to buttons
|
383
401
|
this.container.find('.applyBtn, .cancelBtn').addClass(this.buttonClasses);
|
384
|
-
if (this.
|
385
|
-
this.container.find('.applyBtn').addClass(this.
|
386
|
-
if (this.
|
387
|
-
this.container.find('.cancelBtn').addClass(this.
|
402
|
+
if (this.applyButtonClasses.length)
|
403
|
+
this.container.find('.applyBtn').addClass(this.applyButtonClasses);
|
404
|
+
if (this.cancelButtonClasses.length)
|
405
|
+
this.container.find('.cancelBtn').addClass(this.cancelButtonClasses);
|
388
406
|
this.container.find('.applyBtn').html(this.locale.applyLabel);
|
389
407
|
this.container.find('.cancelBtn').html(this.locale.cancelLabel);
|
390
408
|
|
@@ -392,48 +410,39 @@
|
|
392
410
|
// event listeners
|
393
411
|
//
|
394
412
|
|
395
|
-
this.container.find('.calendar')
|
413
|
+
this.container.find('.drp-calendar')
|
396
414
|
.on('click.daterangepicker', '.prev', $.proxy(this.clickPrev, this))
|
397
415
|
.on('click.daterangepicker', '.next', $.proxy(this.clickNext, this))
|
398
|
-
.on('
|
416
|
+
.on('mousedown.daterangepicker', 'td.available', $.proxy(this.clickDate, this))
|
399
417
|
.on('mouseenter.daterangepicker', 'td.available', $.proxy(this.hoverDate, this))
|
400
|
-
.on('mouseleave.daterangepicker', 'td.available', $.proxy(this.updateFormInputs, this))
|
401
418
|
.on('change.daterangepicker', 'select.yearselect', $.proxy(this.monthOrYearChanged, this))
|
402
419
|
.on('change.daterangepicker', 'select.monthselect', $.proxy(this.monthOrYearChanged, this))
|
403
|
-
.on('change.daterangepicker', 'select.hourselect,select.minuteselect,select.secondselect,select.ampmselect', $.proxy(this.timeChanged, this))
|
404
|
-
.on('click.daterangepicker', '.daterangepicker_input input', $.proxy(this.showCalendars, this))
|
405
|
-
//.on('keyup.daterangepicker', '.daterangepicker_input input', $.proxy(this.formInputsChanged, this))
|
406
|
-
.on('change.daterangepicker', '.daterangepicker_input input', $.proxy(this.formInputsChanged, this));
|
420
|
+
.on('change.daterangepicker', 'select.hourselect,select.minuteselect,select.secondselect,select.ampmselect', $.proxy(this.timeChanged, this));
|
407
421
|
|
408
422
|
this.container.find('.ranges')
|
423
|
+
.on('click.daterangepicker', 'li', $.proxy(this.clickRange, this));
|
424
|
+
|
425
|
+
this.container.find('.drp-buttons')
|
409
426
|
.on('click.daterangepicker', 'button.applyBtn', $.proxy(this.clickApply, this))
|
410
|
-
.on('click.daterangepicker', 'button.cancelBtn', $.proxy(this.clickCancel, this))
|
411
|
-
.on('click.daterangepicker', 'li', $.proxy(this.clickRange, this))
|
412
|
-
.on('mouseenter.daterangepicker', 'li', $.proxy(this.hoverRange, this))
|
413
|
-
.on('mouseleave.daterangepicker', 'li', $.proxy(this.updateFormInputs, this));
|
427
|
+
.on('click.daterangepicker', 'button.cancelBtn', $.proxy(this.clickCancel, this));
|
414
428
|
|
415
|
-
if (this.element.is('input')) {
|
429
|
+
if (this.element.is('input') || this.element.is('button')) {
|
416
430
|
this.element.on({
|
417
431
|
'click.daterangepicker': $.proxy(this.show, this),
|
418
432
|
'focus.daterangepicker': $.proxy(this.show, this),
|
419
433
|
'keyup.daterangepicker': $.proxy(this.elementChanged, this),
|
420
|
-
'keydown.daterangepicker': $.proxy(this.keydown, this)
|
434
|
+
'keydown.daterangepicker': $.proxy(this.keydown, this) //IE 11 compatibility
|
421
435
|
});
|
422
436
|
} else {
|
423
437
|
this.element.on('click.daterangepicker', $.proxy(this.toggle, this));
|
438
|
+
this.element.on('keydown.daterangepicker', $.proxy(this.toggle, this));
|
424
439
|
}
|
425
440
|
|
426
441
|
//
|
427
442
|
// if attached to a text input, set the initial value
|
428
443
|
//
|
429
444
|
|
430
|
-
|
431
|
-
this.element.val(this.startDate.format(this.locale.format) + this.locale.separator + this.endDate.format(this.locale.format));
|
432
|
-
this.element.trigger('change');
|
433
|
-
} else if (this.element.is('input') && this.autoUpdateInput) {
|
434
|
-
this.element.val(this.startDate.format(this.locale.format));
|
435
|
-
this.element.trigger('change');
|
436
|
-
}
|
445
|
+
this.updateElement();
|
437
446
|
|
438
447
|
};
|
439
448
|
|
@@ -454,11 +463,17 @@
|
|
454
463
|
if (this.timePicker && this.timePickerIncrement)
|
455
464
|
this.startDate.minute(Math.round(this.startDate.minute() / this.timePickerIncrement) * this.timePickerIncrement);
|
456
465
|
|
457
|
-
if (this.minDate && this.startDate.isBefore(this.minDate))
|
458
|
-
this.startDate = this.minDate;
|
466
|
+
if (this.minDate && this.startDate.isBefore(this.minDate)) {
|
467
|
+
this.startDate = this.minDate.clone();
|
468
|
+
if (this.timePicker && this.timePickerIncrement)
|
469
|
+
this.startDate.minute(Math.round(this.startDate.minute() / this.timePickerIncrement) * this.timePickerIncrement);
|
470
|
+
}
|
459
471
|
|
460
|
-
if (this.maxDate && this.startDate.isAfter(this.maxDate))
|
461
|
-
this.startDate = this.maxDate;
|
472
|
+
if (this.maxDate && this.startDate.isAfter(this.maxDate)) {
|
473
|
+
this.startDate = this.maxDate.clone();
|
474
|
+
if (this.timePicker && this.timePickerIncrement)
|
475
|
+
this.startDate.minute(Math.floor(this.startDate.minute() / this.timePickerIncrement) * this.timePickerIncrement);
|
476
|
+
}
|
462
477
|
|
463
478
|
if (!this.isShowing)
|
464
479
|
this.updateElement();
|
@@ -483,10 +498,14 @@
|
|
483
498
|
this.endDate = this.startDate.clone();
|
484
499
|
|
485
500
|
if (this.maxDate && this.endDate.isAfter(this.maxDate))
|
486
|
-
this.endDate = this.maxDate;
|
501
|
+
this.endDate = this.maxDate.clone();
|
502
|
+
|
503
|
+
if (this.maxSpan && this.startDate.clone().add(this.maxSpan).isBefore(this.endDate))
|
504
|
+
this.endDate = this.startDate.clone().add(this.maxSpan);
|
505
|
+
|
506
|
+
this.previousRightTime = this.endDate.clone();
|
487
507
|
|
488
|
-
|
489
|
-
this.endDate = this.startDate.clone().add(this.dateLimit);
|
508
|
+
this.container.find('.drp-selected').html(this.startDate.format(this.locale.format) + this.locale.separator + this.endDate.format(this.locale.format));
|
490
509
|
|
491
510
|
if (!this.isShowing)
|
492
511
|
this.updateElement();
|
@@ -498,23 +517,22 @@
|
|
498
517
|
return false;
|
499
518
|
},
|
500
519
|
|
520
|
+
isCustomDate: function() {
|
521
|
+
return false;
|
522
|
+
},
|
523
|
+
|
501
524
|
updateView: function() {
|
502
525
|
if (this.timePicker) {
|
503
526
|
this.renderTimePicker('left');
|
504
527
|
this.renderTimePicker('right');
|
505
528
|
if (!this.endDate) {
|
506
|
-
this.container.find('.right .calendar-time select').
|
529
|
+
this.container.find('.right .calendar-time select').prop('disabled', true).addClass('disabled');
|
507
530
|
} else {
|
508
|
-
this.container.find('.right .calendar-time select').
|
531
|
+
this.container.find('.right .calendar-time select').prop('disabled', false).removeClass('disabled');
|
509
532
|
}
|
510
533
|
}
|
511
|
-
if (this.endDate)
|
512
|
-
this.container.find('
|
513
|
-
this.container.find('input[name="daterangepicker_start"]').addClass('active');
|
514
|
-
} else {
|
515
|
-
this.container.find('input[name="daterangepicker_end"]').addClass('active');
|
516
|
-
this.container.find('input[name="daterangepicker_start"]').removeClass('active');
|
517
|
-
}
|
534
|
+
if (this.endDate)
|
535
|
+
this.container.find('.drp-selected').html(this.startDate.format(this.locale.format) + this.locale.separator + this.endDate.format(this.locale.format));
|
518
536
|
this.updateMonthsInView();
|
519
537
|
this.updateCalendars();
|
520
538
|
this.updateFormInputs();
|
@@ -545,6 +563,10 @@
|
|
545
563
|
this.rightCalendar.month = this.startDate.clone().date(2).add(1, 'month');
|
546
564
|
}
|
547
565
|
}
|
566
|
+
if (this.maxDate && this.linkedCalendars && !this.singleDatePicker && this.rightCalendar.month > this.maxDate) {
|
567
|
+
this.rightCalendar.month = this.maxDate.clone().date(2);
|
568
|
+
this.leftCalendar.month = this.maxDate.clone().date(2).subtract(1, 'month');
|
569
|
+
}
|
548
570
|
},
|
549
571
|
|
550
572
|
updateCalendars: function() {
|
@@ -554,6 +576,9 @@
|
|
554
576
|
if (this.endDate) {
|
555
577
|
hour = parseInt(this.container.find('.left .hourselect').val(), 10);
|
556
578
|
minute = parseInt(this.container.find('.left .minuteselect').val(), 10);
|
579
|
+
if (isNaN(minute)) {
|
580
|
+
minute = parseInt(this.container.find('.left .minuteselect option:last').val(), 10);
|
581
|
+
}
|
557
582
|
second = this.timePickerSeconds ? parseInt(this.container.find('.left .secondselect').val(), 10) : 0;
|
558
583
|
if (!this.timePicker24Hour) {
|
559
584
|
var ampm = this.container.find('.left .ampmselect').val();
|
@@ -565,6 +590,9 @@
|
|
565
590
|
} else {
|
566
591
|
hour = parseInt(this.container.find('.right .hourselect').val(), 10);
|
567
592
|
minute = parseInt(this.container.find('.right .minuteselect').val(), 10);
|
593
|
+
if (isNaN(minute)) {
|
594
|
+
minute = parseInt(this.container.find('.right .minuteselect option:last').val(), 10);
|
595
|
+
}
|
568
596
|
second = this.timePickerSeconds ? parseInt(this.container.find('.right .secondselect').val(), 10) : 0;
|
569
597
|
if (!this.timePicker24Hour) {
|
570
598
|
var ampm = this.container.find('.right .ampmselect').val();
|
@@ -585,30 +613,7 @@
|
|
585
613
|
this.container.find('.ranges li').removeClass('active');
|
586
614
|
if (this.endDate == null) return;
|
587
615
|
|
588
|
-
|
589
|
-
var i = 0;
|
590
|
-
for (var range in this.ranges) {
|
591
|
-
if (this.timePicker) {
|
592
|
-
if (this.startDate.isSame(this.ranges[range][0]) && this.endDate.isSame(this.ranges[range][1])) {
|
593
|
-
customRange = false;
|
594
|
-
this.chosenLabel = this.container.find('.ranges li:eq(' + i + ')').addClass('active').html();
|
595
|
-
break;
|
596
|
-
}
|
597
|
-
} else {
|
598
|
-
//ignore times when comparing dates if time picker is not enabled
|
599
|
-
if (this.startDate.format('YYYY-MM-DD') == this.ranges[range][0].format('YYYY-MM-DD') && this.endDate.format('YYYY-MM-DD') == this.ranges[range][1].format('YYYY-MM-DD')) {
|
600
|
-
customRange = false;
|
601
|
-
this.chosenLabel = this.container.find('.ranges li:eq(' + i + ')').addClass('active').html();
|
602
|
-
break;
|
603
|
-
}
|
604
|
-
}
|
605
|
-
i++;
|
606
|
-
}
|
607
|
-
if (customRange) {
|
608
|
-
this.chosenLabel = this.container.find('.ranges li:last').addClass('active').html();
|
609
|
-
this.showCalendars();
|
610
|
-
}
|
611
|
-
|
616
|
+
this.calculateChosenLabel();
|
612
617
|
},
|
613
618
|
|
614
619
|
renderCalendar: function(side) {
|
@@ -683,17 +688,18 @@
|
|
683
688
|
var minDate = side == 'left' ? this.minDate : this.startDate;
|
684
689
|
var maxDate = this.maxDate;
|
685
690
|
var selected = side == 'left' ? this.startDate : this.endDate;
|
691
|
+
var arrow = this.locale.direction == 'ltr' ? {left: 'chevron-left', right: 'chevron-right'} : {left: 'chevron-right', right: 'chevron-left'};
|
686
692
|
|
687
693
|
var html = '<table class="table-condensed">';
|
688
694
|
html += '<thead>';
|
689
695
|
html += '<tr>';
|
690
696
|
|
691
697
|
// add empty cell for week number
|
692
|
-
if (this.showWeekNumbers)
|
698
|
+
if (this.showWeekNumbers || this.showISOWeekNumbers)
|
693
699
|
html += '<th></th>';
|
694
700
|
|
695
701
|
if ((!minDate || minDate.isBefore(calendar.firstDay)) && (!this.linkedCalendars || side == 'left')) {
|
696
|
-
html += '<th class="prev available"><
|
702
|
+
html += '<th class="prev available"><span></span></th>';
|
697
703
|
} else {
|
698
704
|
html += '<th></th>';
|
699
705
|
}
|
@@ -703,14 +709,14 @@
|
|
703
709
|
if (this.showDropdowns) {
|
704
710
|
var currentMonth = calendar[1][1].month();
|
705
711
|
var currentYear = calendar[1][1].year();
|
706
|
-
var maxYear = (maxDate && maxDate.year()) || (
|
707
|
-
var minYear = (minDate && minDate.year()) || (
|
712
|
+
var maxYear = (maxDate && maxDate.year()) || (this.maxYear);
|
713
|
+
var minYear = (minDate && minDate.year()) || (this.minYear);
|
708
714
|
var inMinYear = currentYear == minYear;
|
709
715
|
var inMaxYear = currentYear == maxYear;
|
710
716
|
|
711
717
|
var monthHtml = '<select class="monthselect">';
|
712
718
|
for (var m = 0; m < 12; m++) {
|
713
|
-
if ((!inMinYear || m >= minDate.month()) && (!inMaxYear || m <= maxDate.month())) {
|
719
|
+
if ((!inMinYear || (minDate && m >= minDate.month())) && (!inMaxYear || (maxDate && m <= maxDate.month()))) {
|
714
720
|
monthHtml += "<option value='" + m + "'" +
|
715
721
|
(m === currentMonth ? " selected='selected'" : "") +
|
716
722
|
">" + this.locale.monthNames[m] + "</option>";
|
@@ -735,7 +741,7 @@
|
|
735
741
|
|
736
742
|
html += '<th colspan="5" class="month">' + dateHtml + '</th>';
|
737
743
|
if ((!maxDate || maxDate.isAfter(calendar.lastDay)) && (!this.linkedCalendars || side == 'right' || this.singleDatePicker)) {
|
738
|
-
html += '<th class="next available"><
|
744
|
+
html += '<th class="next available"><span></span></th>';
|
739
745
|
} else {
|
740
746
|
html += '<th></th>';
|
741
747
|
}
|
@@ -744,7 +750,7 @@
|
|
744
750
|
html += '<tr>';
|
745
751
|
|
746
752
|
// add week number label
|
747
|
-
if (this.showWeekNumbers)
|
753
|
+
if (this.showWeekNumbers || this.showISOWeekNumbers)
|
748
754
|
html += '<th class="week">' + this.locale.weekLabel + '</th>';
|
749
755
|
|
750
756
|
$.each(this.locale.daysOfWeek, function(index, dayOfWeek) {
|
@@ -755,10 +761,10 @@
|
|
755
761
|
html += '</thead>';
|
756
762
|
html += '<tbody>';
|
757
763
|
|
758
|
-
//adjust maxDate to reflect the
|
759
|
-
//grey out end dates beyond the
|
760
|
-
if (this.endDate == null && this.
|
761
|
-
var maxLimit = this.startDate.clone().add(this.
|
764
|
+
//adjust maxDate to reflect the maxSpan setting in order to
|
765
|
+
//grey out end dates beyond the maxSpan
|
766
|
+
if (this.endDate == null && this.maxSpan) {
|
767
|
+
var maxLimit = this.startDate.clone().add(this.maxSpan).endOf('day');
|
762
768
|
if (!maxDate || maxLimit.isBefore(maxDate)) {
|
763
769
|
maxDate = maxLimit;
|
764
770
|
}
|
@@ -770,6 +776,8 @@
|
|
770
776
|
// add week number
|
771
777
|
if (this.showWeekNumbers)
|
772
778
|
html += '<td class="week">' + calendar[row][0].week() + '</td>';
|
779
|
+
else if (this.showISOWeekNumbers)
|
780
|
+
html += '<td class="week">' + calendar[row][0].isoWeek() + '</td>';
|
773
781
|
|
774
782
|
for (var col = 0; col < 7; col++) {
|
775
783
|
|
@@ -785,7 +793,7 @@
|
|
785
793
|
|
786
794
|
//grey out the dates in other months displayed at beginning and end of this calendar
|
787
795
|
if (calendar[row][col].month() != calendar[1][1].month())
|
788
|
-
classes.push('off');
|
796
|
+
classes.push('off', 'ends');
|
789
797
|
|
790
798
|
//don't allow selection of dates before the minimum date
|
791
799
|
if (this.minDate && calendar[row][col].isBefore(this.minDate, 'day'))
|
@@ -811,6 +819,15 @@
|
|
811
819
|
if (this.endDate != null && calendar[row][col] > this.startDate && calendar[row][col] < this.endDate)
|
812
820
|
classes.push('in-range');
|
813
821
|
|
822
|
+
//apply custom classes for this date
|
823
|
+
var isCustom = this.isCustomDate(calendar[row][col]);
|
824
|
+
if (isCustom !== false) {
|
825
|
+
if (typeof isCustom === 'string')
|
826
|
+
classes.push(isCustom);
|
827
|
+
else
|
828
|
+
Array.prototype.push.apply(classes, isCustom);
|
829
|
+
}
|
830
|
+
|
814
831
|
var cname = '', disabled = false;
|
815
832
|
for (var i = 0; i < classes.length; i++) {
|
816
833
|
cname += classes[i] + ' ';
|
@@ -829,33 +846,52 @@
|
|
829
846
|
html += '</tbody>';
|
830
847
|
html += '</table>';
|
831
848
|
|
832
|
-
this.container.find('.calendar.' + side + ' .calendar-table').html(html);
|
849
|
+
this.container.find('.drp-calendar.' + side + ' .calendar-table').html(html);
|
833
850
|
|
834
851
|
},
|
835
852
|
|
836
853
|
renderTimePicker: function(side) {
|
837
854
|
|
855
|
+
// Don't bother updating the time picker if it's currently disabled
|
856
|
+
// because an end date hasn't been clicked yet
|
857
|
+
if (side == 'right' && !this.endDate) return;
|
858
|
+
|
838
859
|
var html, selected, minDate, maxDate = this.maxDate;
|
839
860
|
|
840
|
-
if (this.
|
841
|
-
maxDate = this.startDate.clone().add(this.
|
861
|
+
if (this.maxSpan && (!this.maxDate || this.startDate.clone().add(this.maxSpan).isBefore(this.maxDate)))
|
862
|
+
maxDate = this.startDate.clone().add(this.maxSpan);
|
842
863
|
|
843
864
|
if (side == 'left') {
|
844
865
|
selected = this.startDate.clone();
|
845
866
|
minDate = this.minDate;
|
846
867
|
} else if (side == 'right') {
|
847
|
-
selected = this.endDate
|
868
|
+
selected = this.endDate.clone();
|
848
869
|
minDate = this.startDate;
|
849
870
|
|
850
871
|
//Preserve the time already selected
|
851
|
-
var timeSelector = this.container.find('.calendar.right .calendar-time
|
872
|
+
var timeSelector = this.container.find('.drp-calendar.right .calendar-time');
|
852
873
|
if (timeSelector.html() != '') {
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
874
|
+
|
875
|
+
selected.hour(!isNaN(selected.hour()) ? selected.hour() : timeSelector.find('.hourselect option:selected').val());
|
876
|
+
selected.minute(!isNaN(selected.minute()) ? selected.minute() : timeSelector.find('.minuteselect option:selected').val());
|
877
|
+
selected.second(!isNaN(selected.second()) ? selected.second() : timeSelector.find('.secondselect option:selected').val());
|
878
|
+
|
879
|
+
if (!this.timePicker24Hour) {
|
880
|
+
var ampm = timeSelector.find('.ampmselect option:selected').val();
|
881
|
+
if (ampm === 'PM' && selected.hour() < 12)
|
882
|
+
selected.hour(selected.hour() + 12);
|
883
|
+
if (ampm === 'AM' && selected.hour() === 12)
|
884
|
+
selected.hour(0);
|
885
|
+
}
|
886
|
+
|
858
887
|
}
|
888
|
+
|
889
|
+
if (selected.isBefore(this.startDate))
|
890
|
+
selected = this.startDate.clone();
|
891
|
+
|
892
|
+
if (maxDate && selected.isAfter(maxDate))
|
893
|
+
selected = maxDate.clone();
|
894
|
+
|
859
895
|
}
|
860
896
|
|
861
897
|
//
|
@@ -971,31 +1007,25 @@
|
|
971
1007
|
html += '</select>';
|
972
1008
|
}
|
973
1009
|
|
974
|
-
this.container.find('.calendar.' + side + ' .calendar-time
|
1010
|
+
this.container.find('.drp-calendar.' + side + ' .calendar-time').html(html);
|
975
1011
|
|
976
1012
|
},
|
977
1013
|
|
978
1014
|
updateFormInputs: function() {
|
979
1015
|
|
980
|
-
//ignore mouse movements while an above-calendar text input has focus
|
981
|
-
if (this.container.find('input[name=daterangepicker_start]').is(":focus") || this.container.find('input[name=daterangepicker_end]').is(":focus"))
|
982
|
-
return;
|
983
|
-
|
984
|
-
this.container.find('input[name=daterangepicker_start]').val(this.startDate.format(this.locale.format));
|
985
|
-
if (this.endDate)
|
986
|
-
this.container.find('input[name=daterangepicker_end]').val(this.endDate.format(this.locale.format));
|
987
|
-
|
988
1016
|
if (this.singleDatePicker || (this.endDate && (this.startDate.isBefore(this.endDate) || this.startDate.isSame(this.endDate)))) {
|
989
|
-
this.container.find('button.applyBtn').
|
1017
|
+
this.container.find('button.applyBtn').prop('disabled', false);
|
990
1018
|
} else {
|
991
|
-
this.container.find('button.applyBtn').
|
1019
|
+
this.container.find('button.applyBtn').prop('disabled', true);
|
992
1020
|
}
|
993
1021
|
|
994
1022
|
},
|
995
1023
|
|
996
1024
|
move: function() {
|
997
1025
|
var parentOffset = { top: 0, left: 0 },
|
998
|
-
containerTop
|
1026
|
+
containerTop,
|
1027
|
+
drops = this.drops;
|
1028
|
+
|
999
1029
|
var parentRightEdge = $(window).width();
|
1000
1030
|
if (!this.parentEl.is('body')) {
|
1001
1031
|
parentOffset = {
|
@@ -1005,48 +1035,83 @@
|
|
1005
1035
|
parentRightEdge = this.parentEl[0].clientWidth + this.parentEl.offset().left;
|
1006
1036
|
}
|
1007
1037
|
|
1008
|
-
|
1038
|
+
switch (drops) {
|
1039
|
+
case 'auto':
|
1040
|
+
containerTop = this.element.offset().top + this.element.outerHeight() - parentOffset.top;
|
1041
|
+
if (containerTop + this.container.outerHeight() >= this.parentEl[0].scrollHeight) {
|
1042
|
+
containerTop = this.element.offset().top - this.container.outerHeight() - parentOffset.top;
|
1043
|
+
drops = 'up';
|
1044
|
+
}
|
1045
|
+
break;
|
1046
|
+
case 'up':
|
1009
1047
|
containerTop = this.element.offset().top - this.container.outerHeight() - parentOffset.top;
|
1010
|
-
|
1048
|
+
break;
|
1049
|
+
default:
|
1011
1050
|
containerTop = this.element.offset().top + this.element.outerHeight() - parentOffset.top;
|
1012
|
-
|
1051
|
+
break;
|
1052
|
+
}
|
1053
|
+
|
1054
|
+
// Force the container to it's actual width
|
1055
|
+
this.container.css({
|
1056
|
+
top: 0,
|
1057
|
+
left: 0,
|
1058
|
+
right: 'auto'
|
1059
|
+
});
|
1060
|
+
var containerWidth = this.container.outerWidth();
|
1061
|
+
|
1062
|
+
this.container.toggleClass('drop-up', drops == 'up');
|
1013
1063
|
|
1014
1064
|
if (this.opens == 'left') {
|
1015
|
-
this.
|
1016
|
-
|
1017
|
-
right: parentRightEdge - this.element.offset().left - this.element.outerWidth(),
|
1018
|
-
left: 'auto'
|
1019
|
-
});
|
1020
|
-
if (this.container.offset().left < 0) {
|
1065
|
+
var containerRight = parentRightEdge - this.element.offset().left - this.element.outerWidth();
|
1066
|
+
if (containerWidth + containerRight > $(window).width()) {
|
1021
1067
|
this.container.css({
|
1068
|
+
top: containerTop,
|
1022
1069
|
right: 'auto',
|
1023
1070
|
left: 9
|
1024
1071
|
});
|
1072
|
+
} else {
|
1073
|
+
this.container.css({
|
1074
|
+
top: containerTop,
|
1075
|
+
right: containerRight,
|
1076
|
+
left: 'auto'
|
1077
|
+
});
|
1025
1078
|
}
|
1026
1079
|
} else if (this.opens == 'center') {
|
1027
|
-
this.
|
1028
|
-
|
1029
|
-
|
1030
|
-
- this.container.outerWidth() / 2,
|
1031
|
-
right: 'auto'
|
1032
|
-
});
|
1033
|
-
if (this.container.offset().left < 0) {
|
1080
|
+
var containerLeft = this.element.offset().left - parentOffset.left + this.element.outerWidth() / 2
|
1081
|
+
- containerWidth / 2;
|
1082
|
+
if (containerLeft < 0) {
|
1034
1083
|
this.container.css({
|
1084
|
+
top: containerTop,
|
1035
1085
|
right: 'auto',
|
1036
1086
|
left: 9
|
1037
1087
|
});
|
1088
|
+
} else if (containerLeft + containerWidth > $(window).width()) {
|
1089
|
+
this.container.css({
|
1090
|
+
top: containerTop,
|
1091
|
+
left: 'auto',
|
1092
|
+
right: 0
|
1093
|
+
});
|
1094
|
+
} else {
|
1095
|
+
this.container.css({
|
1096
|
+
top: containerTop,
|
1097
|
+
left: containerLeft,
|
1098
|
+
right: 'auto'
|
1099
|
+
});
|
1038
1100
|
}
|
1039
1101
|
} else {
|
1040
|
-
this.
|
1041
|
-
|
1042
|
-
left: this.element.offset().left - parentOffset.left,
|
1043
|
-
right: 'auto'
|
1044
|
-
});
|
1045
|
-
if (this.container.offset().left + this.container.outerWidth() > $(window).width()) {
|
1102
|
+
var containerLeft = this.element.offset().left - parentOffset.left;
|
1103
|
+
if (containerLeft + containerWidth > $(window).width()) {
|
1046
1104
|
this.container.css({
|
1105
|
+
top: containerTop,
|
1047
1106
|
left: 'auto',
|
1048
1107
|
right: 0
|
1049
1108
|
});
|
1109
|
+
} else {
|
1110
|
+
this.container.css({
|
1111
|
+
top: containerTop,
|
1112
|
+
left: containerLeft,
|
1113
|
+
right: 'auto'
|
1114
|
+
});
|
1050
1115
|
}
|
1051
1116
|
}
|
1052
1117
|
},
|
@@ -1072,6 +1137,7 @@
|
|
1072
1137
|
|
1073
1138
|
this.oldStartDate = this.startDate.clone();
|
1074
1139
|
this.oldEndDate = this.endDate.clone();
|
1140
|
+
this.previousRightTime = this.endDate.clone();
|
1075
1141
|
|
1076
1142
|
this.updateView();
|
1077
1143
|
this.container.show();
|
@@ -1091,7 +1157,7 @@
|
|
1091
1157
|
|
1092
1158
|
//if a new date range was selected, invoke the user callback function
|
1093
1159
|
if (!this.startDate.isSame(this.oldStartDate) || !this.endDate.isSame(this.oldEndDate))
|
1094
|
-
this.callback(this.startDate, this.endDate, this.chosenLabel);
|
1160
|
+
this.callback(this.startDate.clone(), this.endDate.clone(), this.chosenLabel);
|
1095
1161
|
|
1096
1162
|
//if picker is attached to a text input, update it
|
1097
1163
|
this.updateElement();
|
@@ -1123,6 +1189,7 @@
|
|
1123
1189
|
target.closest('.calendar-table').length
|
1124
1190
|
) return;
|
1125
1191
|
this.hide();
|
1192
|
+
this.element.trigger('outsideClick.daterangepicker', this);
|
1126
1193
|
},
|
1127
1194
|
|
1128
1195
|
showCalendars: function() {
|
@@ -1136,25 +1203,8 @@
|
|
1136
1203
|
this.element.trigger('hideCalendar.daterangepicker', this);
|
1137
1204
|
},
|
1138
1205
|
|
1139
|
-
hoverRange: function(e) {
|
1140
|
-
|
1141
|
-
//ignore mouse movements while an above-calendar text input has focus
|
1142
|
-
if (this.container.find('input[name=daterangepicker_start]').is(":focus") || this.container.find('input[name=daterangepicker_end]').is(":focus"))
|
1143
|
-
return;
|
1144
|
-
|
1145
|
-
var label = e.target.innerHTML;
|
1146
|
-
if (label == this.locale.customRangeLabel) {
|
1147
|
-
this.updateView();
|
1148
|
-
} else {
|
1149
|
-
var dates = this.ranges[label];
|
1150
|
-
this.container.find('input[name=daterangepicker_start]').val(dates[0].format(this.locale.format));
|
1151
|
-
this.container.find('input[name=daterangepicker_end]').val(dates[1].format(this.locale.format));
|
1152
|
-
}
|
1153
|
-
|
1154
|
-
},
|
1155
|
-
|
1156
1206
|
clickRange: function(e) {
|
1157
|
-
var label = e.target.
|
1207
|
+
var label = e.target.getAttribute('data-range-key');
|
1158
1208
|
this.chosenLabel = label;
|
1159
1209
|
if (label == this.locale.customRangeLabel) {
|
1160
1210
|
this.showCalendars();
|
@@ -1168,13 +1218,14 @@
|
|
1168
1218
|
this.endDate.endOf('day');
|
1169
1219
|
}
|
1170
1220
|
|
1171
|
-
this.
|
1221
|
+
if (!this.alwaysShowCalendars)
|
1222
|
+
this.hideCalendars();
|
1172
1223
|
this.clickApply();
|
1173
1224
|
}
|
1174
1225
|
},
|
1175
1226
|
|
1176
1227
|
clickPrev: function(e) {
|
1177
|
-
var cal = $(e.target).parents('.calendar');
|
1228
|
+
var cal = $(e.target).parents('.drp-calendar');
|
1178
1229
|
if (cal.hasClass('left')) {
|
1179
1230
|
this.leftCalendar.month.subtract(1, 'month');
|
1180
1231
|
if (this.linkedCalendars)
|
@@ -1186,7 +1237,7 @@
|
|
1186
1237
|
},
|
1187
1238
|
|
1188
1239
|
clickNext: function(e) {
|
1189
|
-
var cal = $(e.target).parents('.calendar');
|
1240
|
+
var cal = $(e.target).parents('.drp-calendar');
|
1190
1241
|
if (cal.hasClass('left')) {
|
1191
1242
|
this.leftCalendar.month.add(1, 'month');
|
1192
1243
|
} else {
|
@@ -1199,32 +1250,21 @@
|
|
1199
1250
|
|
1200
1251
|
hoverDate: function(e) {
|
1201
1252
|
|
1202
|
-
//ignore mouse movements while an above-calendar text input has focus
|
1203
|
-
if (this.container.find('input[name=daterangepicker_start]').is(":focus") || this.container.find('input[name=daterangepicker_end]').is(":focus"))
|
1204
|
-
return;
|
1205
|
-
|
1206
1253
|
//ignore dates that can't be selected
|
1207
1254
|
if (!$(e.target).hasClass('available')) return;
|
1208
1255
|
|
1209
|
-
//have the text inputs above calendars reflect the date being hovered over
|
1210
1256
|
var title = $(e.target).attr('data-title');
|
1211
1257
|
var row = title.substr(1, 1);
|
1212
1258
|
var col = title.substr(3, 1);
|
1213
|
-
var cal = $(e.target).parents('.calendar');
|
1259
|
+
var cal = $(e.target).parents('.drp-calendar');
|
1214
1260
|
var date = cal.hasClass('left') ? this.leftCalendar.calendar[row][col] : this.rightCalendar.calendar[row][col];
|
1215
1261
|
|
1216
|
-
if (this.endDate) {
|
1217
|
-
this.container.find('input[name=daterangepicker_start]').val(date.format(this.locale.format));
|
1218
|
-
} else {
|
1219
|
-
this.container.find('input[name=daterangepicker_end]').val(date.format(this.locale.format));
|
1220
|
-
}
|
1221
|
-
|
1222
1262
|
//highlight the dates between the start date and the date being hovered as a potential end date
|
1223
1263
|
var leftCalendar = this.leftCalendar;
|
1224
1264
|
var rightCalendar = this.rightCalendar;
|
1225
1265
|
var startDate = this.startDate;
|
1226
1266
|
if (!this.endDate) {
|
1227
|
-
this.container.find('.calendar td').each(function(index, el) {
|
1267
|
+
this.container.find('.drp-calendar tbody td').each(function(index, el) {
|
1228
1268
|
|
1229
1269
|
//skip week numbers, only look at dates
|
1230
1270
|
if ($(el).hasClass('week')) return;
|
@@ -1232,10 +1272,10 @@
|
|
1232
1272
|
var title = $(el).attr('data-title');
|
1233
1273
|
var row = title.substr(1, 1);
|
1234
1274
|
var col = title.substr(3, 1);
|
1235
|
-
var cal = $(el).parents('.calendar');
|
1275
|
+
var cal = $(el).parents('.drp-calendar');
|
1236
1276
|
var dt = cal.hasClass('left') ? leftCalendar.calendar[row][col] : rightCalendar.calendar[row][col];
|
1237
1277
|
|
1238
|
-
if (dt.isAfter(startDate) && dt.isBefore(date)) {
|
1278
|
+
if ((dt.isAfter(startDate) && dt.isBefore(date)) || dt.isSame(date, 'day')) {
|
1239
1279
|
$(el).addClass('in-range');
|
1240
1280
|
} else {
|
1241
1281
|
$(el).removeClass('in-range');
|
@@ -1253,7 +1293,7 @@
|
|
1253
1293
|
var title = $(e.target).attr('data-title');
|
1254
1294
|
var row = title.substr(1, 1);
|
1255
1295
|
var col = title.substr(3, 1);
|
1256
|
-
var cal = $(e.target).parents('.calendar');
|
1296
|
+
var cal = $(e.target).parents('.drp-calendar');
|
1257
1297
|
var date = cal.hasClass('left') ? this.leftCalendar.calendar[row][col] : this.rightCalendar.calendar[row][col];
|
1258
1298
|
|
1259
1299
|
//
|
@@ -1262,25 +1302,33 @@
|
|
1262
1302
|
// * if the time picker is enabled, apply the hour/minute/second from the select boxes to the clicked date
|
1263
1303
|
// * if autoapply is enabled, and an end date was chosen, apply the selection
|
1264
1304
|
// * if single date picker mode, and time picker isn't enabled, apply the selection immediately
|
1305
|
+
// * if one of the inputs above the calendars was focused, cancel that manual input
|
1265
1306
|
//
|
1266
1307
|
|
1267
|
-
if (this.endDate || date.isBefore(this.startDate)) {
|
1308
|
+
if (this.endDate || date.isBefore(this.startDate, 'day')) { //picking start
|
1268
1309
|
if (this.timePicker) {
|
1269
1310
|
var hour = parseInt(this.container.find('.left .hourselect').val(), 10);
|
1270
1311
|
if (!this.timePicker24Hour) {
|
1271
|
-
var ampm =
|
1312
|
+
var ampm = this.container.find('.left .ampmselect').val();
|
1272
1313
|
if (ampm === 'PM' && hour < 12)
|
1273
1314
|
hour += 12;
|
1274
1315
|
if (ampm === 'AM' && hour === 12)
|
1275
1316
|
hour = 0;
|
1276
1317
|
}
|
1277
1318
|
var minute = parseInt(this.container.find('.left .minuteselect').val(), 10);
|
1319
|
+
if (isNaN(minute)) {
|
1320
|
+
minute = parseInt(this.container.find('.left .minuteselect option:last').val(), 10);
|
1321
|
+
}
|
1278
1322
|
var second = this.timePickerSeconds ? parseInt(this.container.find('.left .secondselect').val(), 10) : 0;
|
1279
1323
|
date = date.clone().hour(hour).minute(minute).second(second);
|
1280
1324
|
}
|
1281
1325
|
this.endDate = null;
|
1282
1326
|
this.setStartDate(date.clone());
|
1283
|
-
} else {
|
1327
|
+
} else if (!this.endDate && date.isBefore(this.startDate)) {
|
1328
|
+
//special case: clicking the same date for start/end,
|
1329
|
+
//but the time of the end date is before the start date
|
1330
|
+
this.setEndDate(this.startDate.clone());
|
1331
|
+
} else { // picking end
|
1284
1332
|
if (this.timePicker) {
|
1285
1333
|
var hour = parseInt(this.container.find('.right .hourselect').val(), 10);
|
1286
1334
|
if (!this.timePicker24Hour) {
|
@@ -1291,22 +1339,62 @@
|
|
1291
1339
|
hour = 0;
|
1292
1340
|
}
|
1293
1341
|
var minute = parseInt(this.container.find('.right .minuteselect').val(), 10);
|
1342
|
+
if (isNaN(minute)) {
|
1343
|
+
minute = parseInt(this.container.find('.right .minuteselect option:last').val(), 10);
|
1344
|
+
}
|
1294
1345
|
var second = this.timePickerSeconds ? parseInt(this.container.find('.right .secondselect').val(), 10) : 0;
|
1295
1346
|
date = date.clone().hour(hour).minute(minute).second(second);
|
1296
1347
|
}
|
1297
1348
|
this.setEndDate(date.clone());
|
1298
|
-
if (this.autoApply)
|
1299
|
-
|
1349
|
+
if (this.autoApply) {
|
1350
|
+
this.calculateChosenLabel();
|
1351
|
+
this.clickApply();
|
1352
|
+
}
|
1300
1353
|
}
|
1301
1354
|
|
1302
1355
|
if (this.singleDatePicker) {
|
1303
1356
|
this.setEndDate(this.startDate);
|
1304
|
-
if (!this.timePicker)
|
1357
|
+
if (!this.timePicker && this.autoApply)
|
1305
1358
|
this.clickApply();
|
1306
1359
|
}
|
1307
1360
|
|
1308
1361
|
this.updateView();
|
1309
1362
|
|
1363
|
+
//This is to cancel the blur event handler if the mouse was in one of the inputs
|
1364
|
+
e.stopPropagation();
|
1365
|
+
|
1366
|
+
},
|
1367
|
+
|
1368
|
+
calculateChosenLabel: function () {
|
1369
|
+
var customRange = true;
|
1370
|
+
var i = 0;
|
1371
|
+
for (var range in this.ranges) {
|
1372
|
+
if (this.timePicker) {
|
1373
|
+
var format = this.timePickerSeconds ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD HH:mm";
|
1374
|
+
//ignore times when comparing dates if time picker seconds is not enabled
|
1375
|
+
if (this.startDate.format(format) == this.ranges[range][0].format(format) && this.endDate.format(format) == this.ranges[range][1].format(format)) {
|
1376
|
+
customRange = false;
|
1377
|
+
this.chosenLabel = this.container.find('.ranges li:eq(' + i + ')').addClass('active').attr('data-range-key');
|
1378
|
+
break;
|
1379
|
+
}
|
1380
|
+
} else {
|
1381
|
+
//ignore times when comparing dates if time picker is not enabled
|
1382
|
+
if (this.startDate.format('YYYY-MM-DD') == this.ranges[range][0].format('YYYY-MM-DD') && this.endDate.format('YYYY-MM-DD') == this.ranges[range][1].format('YYYY-MM-DD')) {
|
1383
|
+
customRange = false;
|
1384
|
+
this.chosenLabel = this.container.find('.ranges li:eq(' + i + ')').addClass('active').attr('data-range-key');
|
1385
|
+
break;
|
1386
|
+
}
|
1387
|
+
}
|
1388
|
+
i++;
|
1389
|
+
}
|
1390
|
+
if (customRange) {
|
1391
|
+
if (this.showCustomRangeLabel) {
|
1392
|
+
this.chosenLabel = this.container.find('.ranges li:last').addClass('active').attr('data-range-key');
|
1393
|
+
} else {
|
1394
|
+
this.chosenLabel = null;
|
1395
|
+
}
|
1396
|
+
this.showCalendars();
|
1397
|
+
}
|
1310
1398
|
},
|
1311
1399
|
|
1312
1400
|
clickApply: function(e) {
|
@@ -1322,9 +1410,9 @@
|
|
1322
1410
|
},
|
1323
1411
|
|
1324
1412
|
monthOrYearChanged: function(e) {
|
1325
|
-
var isLeft = $(e.target).closest('.calendar').hasClass('left'),
|
1413
|
+
var isLeft = $(e.target).closest('.drp-calendar').hasClass('left'),
|
1326
1414
|
leftOrRight = isLeft ? 'left' : 'right',
|
1327
|
-
cal = this.container.find('.calendar.'+leftOrRight);
|
1415
|
+
cal = this.container.find('.drp-calendar.'+leftOrRight);
|
1328
1416
|
|
1329
1417
|
// Month must be Number for new moment versions
|
1330
1418
|
var month = parseInt(cal.find('.monthselect').val(), 10);
|
@@ -1365,11 +1453,14 @@
|
|
1365
1453
|
|
1366
1454
|
timeChanged: function(e) {
|
1367
1455
|
|
1368
|
-
var cal = $(e.target).closest('.calendar'),
|
1456
|
+
var cal = $(e.target).closest('.drp-calendar'),
|
1369
1457
|
isLeft = cal.hasClass('left');
|
1370
1458
|
|
1371
1459
|
var hour = parseInt(cal.find('.hourselect').val(), 10);
|
1372
1460
|
var minute = parseInt(cal.find('.minuteselect').val(), 10);
|
1461
|
+
if (isNaN(minute)) {
|
1462
|
+
minute = parseInt(cal.find('.minuteselect option:last').val(), 10);
|
1463
|
+
}
|
1373
1464
|
var second = this.timePickerSeconds ? parseInt(cal.find('.secondselect').val(), 10) : 0;
|
1374
1465
|
|
1375
1466
|
if (!this.timePicker24Hour) {
|
@@ -1411,38 +1502,9 @@
|
|
1411
1502
|
|
1412
1503
|
},
|
1413
1504
|
|
1414
|
-
formInputsChanged: function(e) {
|
1415
|
-
var isRight = $(e.target).closest('.calendar').hasClass('right');
|
1416
|
-
var start = moment(this.container.find('input[name="daterangepicker_start"]').val(), this.locale.format);
|
1417
|
-
var end = moment(this.container.find('input[name="daterangepicker_end"]').val(), this.locale.format);
|
1418
|
-
|
1419
|
-
if (start.isValid() && end.isValid()) {
|
1420
|
-
|
1421
|
-
if (isRight && end.isBefore(start))
|
1422
|
-
start = end.clone();
|
1423
|
-
|
1424
|
-
this.setStartDate(start);
|
1425
|
-
this.setEndDate(end);
|
1426
|
-
|
1427
|
-
if (isRight) {
|
1428
|
-
this.container.find('input[name="daterangepicker_start"]').val(this.startDate.format(this.locale.format));
|
1429
|
-
} else {
|
1430
|
-
this.container.find('input[name="daterangepicker_end"]').val(this.endDate.format(this.locale.format));
|
1431
|
-
}
|
1432
|
-
|
1433
|
-
}
|
1434
|
-
|
1435
|
-
this.updateCalendars();
|
1436
|
-
if (this.timePicker) {
|
1437
|
-
this.renderTimePicker('left');
|
1438
|
-
this.renderTimePicker('right');
|
1439
|
-
}
|
1440
|
-
},
|
1441
|
-
|
1442
1505
|
elementChanged: function() {
|
1443
1506
|
if (!this.element.is('input')) return;
|
1444
1507
|
if (!this.element.val().length) return;
|
1445
|
-
if (this.element.val().length < this.locale.format.length) return;
|
1446
1508
|
|
1447
1509
|
var dateString = this.element.val().split(this.locale.separator),
|
1448
1510
|
start = null,
|
@@ -1470,15 +1532,25 @@
|
|
1470
1532
|
if ((e.keyCode === 9) || (e.keyCode === 13)) {
|
1471
1533
|
this.hide();
|
1472
1534
|
}
|
1535
|
+
|
1536
|
+
//hide on esc and prevent propagation
|
1537
|
+
if (e.keyCode === 27) {
|
1538
|
+
e.preventDefault();
|
1539
|
+
e.stopPropagation();
|
1540
|
+
|
1541
|
+
this.hide();
|
1542
|
+
}
|
1473
1543
|
},
|
1474
1544
|
|
1475
1545
|
updateElement: function() {
|
1476
|
-
if (this.element.is('input') &&
|
1477
|
-
|
1478
|
-
this.
|
1479
|
-
|
1480
|
-
|
1481
|
-
this.element.
|
1546
|
+
if (this.element.is('input') && this.autoUpdateInput) {
|
1547
|
+
var newValue = this.startDate.format(this.locale.format);
|
1548
|
+
if (!this.singleDatePicker) {
|
1549
|
+
newValue += this.locale.separator + this.endDate.format(this.locale.format);
|
1550
|
+
}
|
1551
|
+
if (newValue !== this.element.val()) {
|
1552
|
+
this.element.val(newValue).trigger('change');
|
1553
|
+
}
|
1482
1554
|
}
|
1483
1555
|
},
|
1484
1556
|
|
@@ -1491,11 +1563,12 @@
|
|
1491
1563
|
};
|
1492
1564
|
|
1493
1565
|
$.fn.daterangepicker = function(options, callback) {
|
1566
|
+
var implementOptions = $.extend(true, {}, $.fn.daterangepicker.defaultOptions, options);
|
1494
1567
|
this.each(function() {
|
1495
1568
|
var el = $(this);
|
1496
1569
|
if (el.data('daterangepicker'))
|
1497
1570
|
el.data('daterangepicker').remove();
|
1498
|
-
el.data('daterangepicker', new DateRangePicker(el,
|
1571
|
+
el.data('daterangepicker', new DateRangePicker(el, implementOptions, callback));
|
1499
1572
|
});
|
1500
1573
|
return this;
|
1501
1574
|
};
|