ezuikit-js 8.1.16 → 8.2.0-beta.2
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/CHANGELOG.md +58 -21
- package/ezuikit.js +73 -84
- package/ezuikit_static/PlayCtrlWasm/playCtrl1/HasSIMD/Decoder.js +1 -1
- package/ezuikit_static/PlayCtrlWasm/playCtrl1/NoSIMD/Decoder.js +1 -1
- package/ezuikit_static/PlayCtrlWasm/playCtrl3/hasWorker/HasSIMD/Decoder.wasm +0 -0
- package/ezuikit_static/PlayCtrlWasm/playCtrl3/hasWorker/NoSIMD/Decoder.wasm +0 -0
- package/ezuikit_static/PlayCtrlWasm/playCtrl3/noWorker/Decoder.wasm +0 -0
- package/ezuikit_static/rec/datepicker.en-US.js +4 -6
- package/ezuikit_static/rec/datepicker.js +484 -425
- package/ezuikit_static/rec/datepicker.min.css +11 -5
- package/ezuikit_static/rec/datepicker.zh-CN.js +4 -6
- package/index.js +43 -67
- package/index.mjs +43 -67
- package/package.json +6 -8
|
@@ -9,17 +9,19 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
(function (global, factory) {
|
|
12
|
-
typeof exports === 'object' && typeof module !== 'undefined'
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
typeof exports === 'object' && typeof module !== 'undefined'
|
|
13
|
+
? factory(require('jquery'))
|
|
14
|
+
: typeof define === 'function' && define.amd
|
|
15
|
+
? define(['jquery'], factory)
|
|
16
|
+
: ((global = typeof globalThis !== 'undefined' ? globalThis : global || self), factory(global.jQuery));
|
|
17
|
+
})(this, function ($) {
|
|
16
18
|
'use strict';
|
|
17
19
|
|
|
18
20
|
$ = $ && $.hasOwnProperty('default') ? $['default'] : $;
|
|
19
21
|
|
|
20
22
|
function _classCallCheck(instance, Constructor) {
|
|
21
23
|
if (!(instance instanceof Constructor)) {
|
|
22
|
-
throw new TypeError(
|
|
24
|
+
throw new TypeError('Cannot call a class as a function');
|
|
23
25
|
}
|
|
24
26
|
}
|
|
25
27
|
|
|
@@ -28,7 +30,7 @@
|
|
|
28
30
|
var descriptor = props[i];
|
|
29
31
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
30
32
|
descriptor.configurable = true;
|
|
31
|
-
if (
|
|
33
|
+
if ('value' in descriptor) descriptor.writable = true;
|
|
32
34
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
33
35
|
}
|
|
34
36
|
}
|
|
@@ -94,7 +96,34 @@
|
|
|
94
96
|
// A class (CSS) for highlight date item
|
|
95
97
|
highlightedClass: 'highlighted',
|
|
96
98
|
// The template of the datepicker
|
|
97
|
-
template:
|
|
99
|
+
template:
|
|
100
|
+
'<div class="datepicker-container">' +
|
|
101
|
+
'<div class="datepicker-panel" data-view="years picker">' +
|
|
102
|
+
'<ul>' +
|
|
103
|
+
'<li data-view="years prev">‹</li>' +
|
|
104
|
+
'<li data-view="years current"></li>' +
|
|
105
|
+
'<li data-view="years next">›</li>' +
|
|
106
|
+
'</ul>' +
|
|
107
|
+
'<ul data-view="years"></ul>' +
|
|
108
|
+
'</div>' +
|
|
109
|
+
'<div class="datepicker-panel" data-view="months picker">' +
|
|
110
|
+
'<ul>' +
|
|
111
|
+
'<li data-view="year prev">‹</li>' +
|
|
112
|
+
'<li data-view="year current"></li>' +
|
|
113
|
+
'<li data-view="year next">›</li>' +
|
|
114
|
+
'</ul>' +
|
|
115
|
+
'<ul data-view="months"></ul>' +
|
|
116
|
+
'</div>' +
|
|
117
|
+
'<div class="datepicker-panel" data-view="days picker">' +
|
|
118
|
+
'<ul>' +
|
|
119
|
+
'<li data-view="month prev">‹</li>' +
|
|
120
|
+
'<li data-view="month current"></li>' +
|
|
121
|
+
'<li data-view="month next">›</li>' +
|
|
122
|
+
'</ul>' +
|
|
123
|
+
'<ul data-view="week"></ul>' +
|
|
124
|
+
'<ul data-view="days"></ul>' +
|
|
125
|
+
'</div>' +
|
|
126
|
+
'</div>',
|
|
98
127
|
// The offset top or bottom of the datepicker from the element
|
|
99
128
|
offset: 10,
|
|
100
129
|
// The `z-index` of the datepicker
|
|
@@ -104,28 +133,28 @@
|
|
|
104
133
|
// Event shortcuts
|
|
105
134
|
show: null,
|
|
106
135
|
hide: null,
|
|
107
|
-
pick: null
|
|
136
|
+
pick: null,
|
|
108
137
|
};
|
|
109
138
|
|
|
110
139
|
var IS_BROWSER = typeof window !== 'undefined';
|
|
111
140
|
var WINDOW = IS_BROWSER ? window : {};
|
|
112
141
|
var IS_TOUCH_DEVICE = IS_BROWSER ? 'ontouchstart' in WINDOW.document.documentElement : false;
|
|
113
142
|
var NAMESPACE = 'datepicker';
|
|
114
|
-
var EVENT_CLICK =
|
|
115
|
-
var EVENT_FOCUS =
|
|
116
|
-
var EVENT_HIDE =
|
|
117
|
-
var EVENT_KEYUP =
|
|
118
|
-
var EVENT_PICK =
|
|
119
|
-
var EVENT_RESIZE =
|
|
120
|
-
var EVENT_SCROLL =
|
|
121
|
-
var EVENT_SHOW =
|
|
122
|
-
var EVENT_TOUCH_START =
|
|
123
|
-
var CLASS_HIDE =
|
|
143
|
+
var EVENT_CLICK = 'click.'.concat(NAMESPACE);
|
|
144
|
+
var EVENT_FOCUS = 'focus.'.concat(NAMESPACE);
|
|
145
|
+
var EVENT_HIDE = 'hide.'.concat(NAMESPACE);
|
|
146
|
+
var EVENT_KEYUP = 'keyup.'.concat(NAMESPACE);
|
|
147
|
+
var EVENT_PICK = 'pick.'.concat(NAMESPACE);
|
|
148
|
+
var EVENT_RESIZE = 'resize.'.concat(NAMESPACE);
|
|
149
|
+
var EVENT_SCROLL = 'scroll.'.concat(NAMESPACE);
|
|
150
|
+
var EVENT_SHOW = 'show.'.concat(NAMESPACE);
|
|
151
|
+
var EVENT_TOUCH_START = 'touchstart.'.concat(NAMESPACE);
|
|
152
|
+
var CLASS_HIDE = ''.concat(NAMESPACE, '-hide');
|
|
124
153
|
var LANGUAGES = {};
|
|
125
154
|
var VIEWS = {
|
|
126
155
|
DAYS: 0,
|
|
127
156
|
MONTHS: 1,
|
|
128
|
-
YEARS: 2
|
|
157
|
+
YEARS: 2,
|
|
129
158
|
};
|
|
130
159
|
|
|
131
160
|
var toString = Object.prototype.toString;
|
|
@@ -159,10 +188,10 @@
|
|
|
159
188
|
};
|
|
160
189
|
}
|
|
161
190
|
function selectorOf(view) {
|
|
162
|
-
return
|
|
191
|
+
return '[data-view="'.concat(view, '"]');
|
|
163
192
|
}
|
|
164
193
|
function isLeapYear(year) {
|
|
165
|
-
return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
|
|
194
|
+
return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
|
|
166
195
|
}
|
|
167
196
|
function getDaysInMonth(year, month) {
|
|
168
197
|
return [31, isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
|
|
@@ -181,7 +210,7 @@
|
|
|
181
210
|
|
|
182
211
|
format = {
|
|
183
212
|
source: source,
|
|
184
|
-
parts: parts
|
|
213
|
+
parts: parts,
|
|
185
214
|
};
|
|
186
215
|
$.each(parts, function (i, part) {
|
|
187
216
|
switch (part) {
|
|
@@ -209,15 +238,18 @@
|
|
|
209
238
|
var position = $element.css('position');
|
|
210
239
|
var excludeStaticParent = position === 'absolute';
|
|
211
240
|
var overflowRegex = includeHidden ? /auto|scroll|hidden/ : /auto|scroll/;
|
|
212
|
-
var scrollParent = $element
|
|
213
|
-
|
|
241
|
+
var scrollParent = $element
|
|
242
|
+
.parents()
|
|
243
|
+
.filter(function (index, parent) {
|
|
244
|
+
var $parent = $(parent);
|
|
214
245
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
246
|
+
if (excludeStaticParent && $parent.css('position') === 'static') {
|
|
247
|
+
return false;
|
|
248
|
+
}
|
|
218
249
|
|
|
219
|
-
|
|
220
|
-
|
|
250
|
+
return overflowRegex.test($parent.css('overflow') + $parent.css('overflow-y') + $parent.css('overflow-x'));
|
|
251
|
+
})
|
|
252
|
+
.eq(0);
|
|
221
253
|
return position === 'fixed' || !scrollParent.length ? $(element.ownerDocument || document) : scrollParent;
|
|
222
254
|
}
|
|
223
255
|
/**
|
|
@@ -267,12 +299,12 @@
|
|
|
267
299
|
|
|
268
300
|
if (!this.inline) {
|
|
269
301
|
this.$scrollParent.on(EVENT_SCROLL, $.proxy(this.place, this));
|
|
270
|
-
$(window).on(EVENT_RESIZE, this.onResize = proxy(this.place, this));
|
|
271
|
-
$(document).on(EVENT_CLICK, this.onGlobalClick = proxy(this.globalClick, this));
|
|
272
|
-
$(document).on(EVENT_KEYUP, this.onGlobalKeyup = proxy(this.globalKeyup, this));
|
|
302
|
+
$(window).on(EVENT_RESIZE, (this.onResize = proxy(this.place, this)));
|
|
303
|
+
$(document).on(EVENT_CLICK, (this.onGlobalClick = proxy(this.globalClick, this)));
|
|
304
|
+
$(document).on(EVENT_KEYUP, (this.onGlobalKeyup = proxy(this.globalKeyup, this)));
|
|
273
305
|
|
|
274
306
|
if (IS_TOUCH_DEVICE) {
|
|
275
|
-
$(document).on(EVENT_TOUCH_START, this.onTouchStart = proxy(this.touchstart, this));
|
|
307
|
+
$(document).on(EVENT_TOUCH_START, (this.onTouchStart = proxy(this.touchstart, this)));
|
|
276
308
|
}
|
|
277
309
|
|
|
278
310
|
this.place();
|
|
@@ -330,10 +362,12 @@
|
|
|
330
362
|
var $this = this.$element;
|
|
331
363
|
var date = this.date;
|
|
332
364
|
|
|
333
|
-
if (
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
365
|
+
if (
|
|
366
|
+
this.trigger(EVENT_PICK, {
|
|
367
|
+
view: _view || '',
|
|
368
|
+
date: date,
|
|
369
|
+
}).isDefaultPrevented()
|
|
370
|
+
) {
|
|
337
371
|
return;
|
|
338
372
|
}
|
|
339
373
|
|
|
@@ -432,7 +466,6 @@
|
|
|
432
466
|
*/
|
|
433
467
|
setDate: function setDate(date, _updated) {
|
|
434
468
|
var filter = this.options.filter;
|
|
435
|
-
|
|
436
469
|
if (isDate(date) || isString(date)) {
|
|
437
470
|
date = this.parseDate(date);
|
|
438
471
|
|
|
@@ -543,7 +576,6 @@
|
|
|
543
576
|
}
|
|
544
577
|
} // Ignore hours, minutes, seconds and milliseconds to avoid side effect (#192)
|
|
545
578
|
|
|
546
|
-
|
|
547
579
|
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
|
548
580
|
},
|
|
549
581
|
|
|
@@ -567,7 +599,7 @@
|
|
|
567
599
|
m: month + 1,
|
|
568
600
|
mm: addLeadingZero(month + 1, 2),
|
|
569
601
|
yy: String(year).substring(2),
|
|
570
|
-
yyyy: addLeadingZero(year, 4)
|
|
602
|
+
yyyy: addLeadingZero(year, 4),
|
|
571
603
|
};
|
|
572
604
|
formatted = format.source;
|
|
573
605
|
$.each(format.parts, function (i, part) {
|
|
@@ -582,7 +614,7 @@
|
|
|
582
614
|
this.unbind();
|
|
583
615
|
this.unbuild();
|
|
584
616
|
this.$element.removeData(NAMESPACE);
|
|
585
|
-
}
|
|
617
|
+
},
|
|
586
618
|
};
|
|
587
619
|
|
|
588
620
|
var handlers = {
|
|
@@ -606,14 +638,13 @@
|
|
|
606
638
|
|
|
607
639
|
switch (view) {
|
|
608
640
|
case 'years prev':
|
|
609
|
-
case 'years next':
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
}
|
|
641
|
+
case 'years next': {
|
|
642
|
+
viewYear = view === 'years prev' ? viewYear - 10 : viewYear + 10;
|
|
643
|
+
viewDate.setFullYear(viewYear);
|
|
644
|
+
viewDate.setDate(getMinDay(viewYear, viewMonth, viewDay));
|
|
645
|
+
this.renderYears();
|
|
646
|
+
break;
|
|
647
|
+
}
|
|
617
648
|
|
|
618
649
|
case 'year prev':
|
|
619
650
|
case 'year next':
|
|
@@ -634,7 +665,7 @@
|
|
|
634
665
|
if (format.hasMonth) {
|
|
635
666
|
this.showView(VIEWS.MONTHS);
|
|
636
667
|
} else {
|
|
637
|
-
$target.siblings(
|
|
668
|
+
$target.siblings('.'.concat(options.pickedClass)).removeClass(options.pickedClass).data('view', 'year');
|
|
638
669
|
this.hideView();
|
|
639
670
|
}
|
|
640
671
|
|
|
@@ -652,7 +683,7 @@
|
|
|
652
683
|
if (format.hasMonth) {
|
|
653
684
|
this.showView(VIEWS.MONTHS);
|
|
654
685
|
} else {
|
|
655
|
-
$target.addClass(options.pickedClass).data('view', 'year picked').siblings(
|
|
686
|
+
$target.addClass(options.pickedClass).data('view', 'year picked').siblings('.'.concat(options.pickedClass)).removeClass(options.pickedClass).data('view', 'year');
|
|
656
687
|
this.hideView();
|
|
657
688
|
}
|
|
658
689
|
|
|
@@ -688,7 +719,7 @@
|
|
|
688
719
|
if (format.hasDay) {
|
|
689
720
|
this.showView(VIEWS.DAYS);
|
|
690
721
|
} else {
|
|
691
|
-
$target.siblings(
|
|
722
|
+
$target.siblings('.'.concat(options.pickedClass)).removeClass(options.pickedClass).data('view', 'month');
|
|
692
723
|
this.hideView();
|
|
693
724
|
}
|
|
694
725
|
|
|
@@ -708,7 +739,7 @@
|
|
|
708
739
|
if (format.hasDay) {
|
|
709
740
|
this.showView(VIEWS.DAYS);
|
|
710
741
|
} else {
|
|
711
|
-
$target.addClass(options.pickedClass).data('view', 'month picked').siblings(
|
|
742
|
+
$target.addClass(options.pickedClass).data('view', 'month picked').siblings('.'.concat(options.pickedClass)).removeClass(options.pickedClass).data('view', 'month');
|
|
712
743
|
this.hideView();
|
|
713
744
|
}
|
|
714
745
|
|
|
@@ -789,7 +820,7 @@
|
|
|
789
820
|
this.hide();
|
|
790
821
|
this.element.blur();
|
|
791
822
|
}
|
|
792
|
-
}
|
|
823
|
+
},
|
|
793
824
|
};
|
|
794
825
|
|
|
795
826
|
var render = {
|
|
@@ -808,9 +839,11 @@
|
|
|
808
839
|
weekStart = parseInt(weekStart, 10) % 7;
|
|
809
840
|
daysMin = daysMin.slice(weekStart).concat(daysMin.slice(0, weekStart));
|
|
810
841
|
$.each(daysMin, function (i, day) {
|
|
811
|
-
items.push(
|
|
812
|
-
|
|
813
|
-
|
|
842
|
+
items.push(
|
|
843
|
+
_this.createItem({
|
|
844
|
+
text: day,
|
|
845
|
+
}),
|
|
846
|
+
);
|
|
814
847
|
});
|
|
815
848
|
this.$week.html(items.join(''));
|
|
816
849
|
},
|
|
@@ -858,18 +891,25 @@
|
|
|
858
891
|
|
|
859
892
|
var picked = viewYear + i === year;
|
|
860
893
|
var view = picked ? 'year picked' : 'year';
|
|
861
|
-
items.push(
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
894
|
+
items.push(
|
|
895
|
+
this.createItem({
|
|
896
|
+
picked: picked,
|
|
897
|
+
disabled: disabled,
|
|
898
|
+
text: viewYear + i,
|
|
899
|
+
view: disabled ? 'year disabled' : view,
|
|
900
|
+
highlighted: date.getFullYear() === thisYear,
|
|
901
|
+
}),
|
|
902
|
+
);
|
|
868
903
|
}
|
|
869
904
|
|
|
870
905
|
this.$yearsPrev.toggleClass(disabledClass, prevDisabled);
|
|
871
906
|
this.$yearsNext.toggleClass(disabledClass, nextDisabled);
|
|
872
|
-
this.$yearsCurrent.toggleClass(disabledClass, true).html(
|
|
907
|
+
this.$yearsCurrent.toggleClass(disabledClass, true).html(
|
|
908
|
+
''
|
|
909
|
+
.concat(viewYear + start + yearSuffix, ' - ')
|
|
910
|
+
.concat(viewYear + end)
|
|
911
|
+
.concat(yearSuffix),
|
|
912
|
+
);
|
|
873
913
|
this.$years.html(items.join(''));
|
|
874
914
|
},
|
|
875
915
|
renderMonths: function renderMonths() {
|
|
@@ -911,14 +951,16 @@
|
|
|
911
951
|
|
|
912
952
|
var picked = viewYear === year && i === month;
|
|
913
953
|
var view = picked ? 'month picked' : 'month';
|
|
914
|
-
items.push(
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
954
|
+
items.push(
|
|
955
|
+
this.createItem({
|
|
956
|
+
disabled: disabled,
|
|
957
|
+
picked: picked,
|
|
958
|
+
highlighted: viewYear === thisYear && date.getMonth() === thisMonth,
|
|
959
|
+
index: i,
|
|
960
|
+
text: months[i],
|
|
961
|
+
view: disabled ? 'month disabled' : view,
|
|
962
|
+
}),
|
|
963
|
+
);
|
|
922
964
|
}
|
|
923
965
|
|
|
924
966
|
this.$yearPrev.toggleClass(disabledClass, prevDisabled);
|
|
@@ -964,13 +1006,12 @@
|
|
|
964
1006
|
prevViewMonth -= 1;
|
|
965
1007
|
} // The length of the days of prev month
|
|
966
1008
|
|
|
967
|
-
|
|
968
1009
|
length = getDaysInMonth(prevViewYear, prevViewMonth); // The first day of current month
|
|
969
1010
|
|
|
970
1011
|
var firstDay = new Date(viewYear, viewMonth, 1); // The visible length of the days of prev month
|
|
971
1012
|
// [0,1,2,3,4,5,6] - [0,1,2,3,4,5,6] => [-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6]
|
|
972
1013
|
|
|
973
|
-
n = firstDay.getDay() - parseInt(weekStart, 10) % 7; // [-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6] => [1,2,3,4,5,6,7]
|
|
1014
|
+
n = firstDay.getDay() - (parseInt(weekStart, 10) % 7); // [-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6] => [1,2,3,4,5,6,7]
|
|
974
1015
|
|
|
975
1016
|
if (n <= 0) {
|
|
976
1017
|
n += 7;
|
|
@@ -992,18 +1033,19 @@
|
|
|
992
1033
|
disabled = filter.call($element, prevViewDate, 'day') === false;
|
|
993
1034
|
}
|
|
994
1035
|
|
|
995
|
-
prevItems.push(
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1036
|
+
prevItems.push(
|
|
1037
|
+
this.createItem({
|
|
1038
|
+
disabled: disabled,
|
|
1039
|
+
highlighted: prevViewYear === thisYear && prevViewMonth === thisMonth && prevViewDate.getDate() === thisDay,
|
|
1040
|
+
muted: true,
|
|
1041
|
+
picked: prevViewYear === year && prevViewMonth === month && i === day,
|
|
1042
|
+
text: i,
|
|
1043
|
+
view: 'day prev',
|
|
1044
|
+
}),
|
|
1045
|
+
);
|
|
1003
1046
|
} // Days of next month
|
|
1004
1047
|
// -----------------------------------------------------------------------
|
|
1005
1048
|
|
|
1006
|
-
|
|
1007
1049
|
var nextItems = [];
|
|
1008
1050
|
var nextViewYear = viewYear;
|
|
1009
1051
|
var nextViewMonth = viewMonth;
|
|
@@ -1016,7 +1058,6 @@
|
|
|
1016
1058
|
nextViewMonth += 1;
|
|
1017
1059
|
} // The length of the days of current month
|
|
1018
1060
|
|
|
1019
|
-
|
|
1020
1061
|
length = getDaysInMonth(viewYear, viewMonth); // The visible length of next month (42 means 6 rows and 7 columns)
|
|
1021
1062
|
|
|
1022
1063
|
n = 42 - (prevItems.length + length); // The last day of current month
|
|
@@ -1040,18 +1081,19 @@
|
|
|
1040
1081
|
_disabled = filter.call($element, date, 'day') === false;
|
|
1041
1082
|
}
|
|
1042
1083
|
|
|
1043
|
-
nextItems.push(
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1084
|
+
nextItems.push(
|
|
1085
|
+
this.createItem({
|
|
1086
|
+
disabled: _disabled,
|
|
1087
|
+
picked: picked,
|
|
1088
|
+
highlighted: nextViewYear === thisYear && nextViewMonth === thisMonth && date.getDate() === thisDay,
|
|
1089
|
+
muted: true,
|
|
1090
|
+
text: i,
|
|
1091
|
+
view: 'day next',
|
|
1092
|
+
}),
|
|
1093
|
+
);
|
|
1051
1094
|
} // Days of current month
|
|
1052
1095
|
// -----------------------------------------------------------------------
|
|
1053
1096
|
|
|
1054
|
-
|
|
1055
1097
|
var items = [];
|
|
1056
1098
|
|
|
1057
1099
|
for (i = 1; i <= length; i += 1) {
|
|
@@ -1074,31 +1116,32 @@
|
|
|
1074
1116
|
var _picked = viewYear === year && viewMonth === month && i === day;
|
|
1075
1117
|
|
|
1076
1118
|
var view = _picked ? 'day picked' : 'day';
|
|
1077
|
-
items.push(
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1119
|
+
items.push(
|
|
1120
|
+
this.createItem({
|
|
1121
|
+
disabled: _disabled2,
|
|
1122
|
+
picked: _picked,
|
|
1123
|
+
highlighted: viewYear === thisYear && viewMonth === thisMonth && _date.getDate() === thisDay,
|
|
1124
|
+
text: i,
|
|
1125
|
+
view: _disabled2 ? 'day disabled' : view,
|
|
1126
|
+
}),
|
|
1127
|
+
);
|
|
1084
1128
|
} // Render days picker
|
|
1085
1129
|
// -----------------------------------------------------------------------
|
|
1086
1130
|
|
|
1087
|
-
|
|
1088
1131
|
this.$monthPrev.toggleClass(disabledClass, prevDisabled);
|
|
1089
1132
|
this.$monthNext.toggleClass(disabledClass, nextDisabled);
|
|
1090
|
-
this.$monthCurrent.toggleClass(disabledClass, prevDisabled && nextDisabled).html(options.yearFirst ?
|
|
1133
|
+
this.$monthCurrent.toggleClass(disabledClass, prevDisabled && nextDisabled).html(options.yearFirst ? ''.concat(viewYear + yearSuffix, ' ').concat(months[viewMonth]) : ''.concat(months[viewMonth], ' ').concat(viewYear).concat(yearSuffix));
|
|
1091
1134
|
this.$days.html(prevItems.join('') + items.join('') + nextItems.join(''));
|
|
1092
|
-
}
|
|
1135
|
+
},
|
|
1093
1136
|
};
|
|
1094
1137
|
|
|
1095
|
-
var CLASS_TOP_LEFT =
|
|
1096
|
-
var CLASS_TOP_RIGHT =
|
|
1097
|
-
var CLASS_BOTTOM_LEFT =
|
|
1098
|
-
var CLASS_BOTTOM_RIGHT =
|
|
1138
|
+
var CLASS_TOP_LEFT = ''.concat(NAMESPACE, '-top-left');
|
|
1139
|
+
var CLASS_TOP_RIGHT = ''.concat(NAMESPACE, '-top-right');
|
|
1140
|
+
var CLASS_BOTTOM_LEFT = ''.concat(NAMESPACE, '-bottom-left');
|
|
1141
|
+
var CLASS_BOTTOM_RIGHT = ''.concat(NAMESPACE, '-bottom-right');
|
|
1099
1142
|
var CLASS_PLACEMENTS = [CLASS_TOP_LEFT, CLASS_TOP_RIGHT, CLASS_BOTTOM_LEFT, CLASS_BOTTOM_RIGHT].join(' ');
|
|
1100
1143
|
|
|
1101
|
-
var Datepicker = /*#__PURE__*/function () {
|
|
1144
|
+
var Datepicker = /*#__PURE__*/ (function () {
|
|
1102
1145
|
function Datepicker(element) {
|
|
1103
1146
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1104
1147
|
|
|
@@ -1119,353 +1162,370 @@
|
|
|
1119
1162
|
this.init();
|
|
1120
1163
|
}
|
|
1121
1164
|
|
|
1122
|
-
_createClass(
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
if (endDate) {
|
|
1150
|
-
endDate = this.parseDate(endDate);
|
|
1151
|
-
|
|
1152
|
-
if (startDate && endDate.getTime() < startDate.getTime()) {
|
|
1153
|
-
endDate = new Date(startDate);
|
|
1154
|
-
}
|
|
1155
|
-
|
|
1156
|
-
if (date.getTime() > endDate.getTime()) {
|
|
1157
|
-
date = new Date(endDate);
|
|
1158
|
-
}
|
|
1165
|
+
_createClass(
|
|
1166
|
+
Datepicker,
|
|
1167
|
+
[
|
|
1168
|
+
{
|
|
1169
|
+
key: 'init',
|
|
1170
|
+
value: function init() {
|
|
1171
|
+
var $this = this.$element,
|
|
1172
|
+
options = this.options;
|
|
1173
|
+
var startDate = options.startDate,
|
|
1174
|
+
endDate = options.endDate,
|
|
1175
|
+
date = options.date;
|
|
1176
|
+
this.$trigger = $(options.trigger);
|
|
1177
|
+
this.isInput = $this.is('input') || $this.is('textarea');
|
|
1178
|
+
this.inline = options.inline && (options.container || !this.isInput);
|
|
1179
|
+
this.format = parseFormat(options.format);
|
|
1180
|
+
var initialValue = this.getValue();
|
|
1181
|
+
this.initialValue = initialValue;
|
|
1182
|
+
this.oldValue = initialValue;
|
|
1183
|
+
date = this.parseDate(date || initialValue);
|
|
1184
|
+
|
|
1185
|
+
if (startDate) {
|
|
1186
|
+
startDate = this.parseDate(startDate);
|
|
1187
|
+
|
|
1188
|
+
if (date.getTime() < startDate.getTime()) {
|
|
1189
|
+
date = new Date(startDate);
|
|
1190
|
+
}
|
|
1159
1191
|
|
|
1160
|
-
|
|
1161
|
-
|
|
1192
|
+
this.startDate = startDate;
|
|
1193
|
+
}
|
|
1162
1194
|
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
this.initialDate = new Date(this.date);
|
|
1166
|
-
this.bind();
|
|
1195
|
+
if (endDate) {
|
|
1196
|
+
endDate = this.parseDate(endDate);
|
|
1167
1197
|
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1198
|
+
if (startDate && endDate.getTime() < startDate.getTime()) {
|
|
1199
|
+
endDate = new Date(startDate);
|
|
1200
|
+
}
|
|
1171
1201
|
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
}
|
|
1176
|
-
}, {
|
|
1177
|
-
key: "build",
|
|
1178
|
-
value: function build() {
|
|
1179
|
-
if (this.built) {
|
|
1180
|
-
return;
|
|
1181
|
-
}
|
|
1202
|
+
if (date.getTime() > endDate.getTime()) {
|
|
1203
|
+
date = new Date(endDate);
|
|
1204
|
+
}
|
|
1182
1205
|
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
options = this.options;
|
|
1186
|
-
var $picker = $(options.template);
|
|
1187
|
-
this.$picker = $picker;
|
|
1188
|
-
this.$week = $picker.find(selectorOf('week')); // Years view
|
|
1189
|
-
|
|
1190
|
-
this.$yearsPicker = $picker.find(selectorOf('years picker'));
|
|
1191
|
-
this.$yearsPrev = $picker.find(selectorOf('years prev'));
|
|
1192
|
-
this.$yearsNext = $picker.find(selectorOf('years next'));
|
|
1193
|
-
this.$yearsCurrent = $picker.find(selectorOf('years current'));
|
|
1194
|
-
this.$years = $picker.find(selectorOf('years')); // Months view
|
|
1195
|
-
|
|
1196
|
-
this.$monthsPicker = $picker.find(selectorOf('months picker'));
|
|
1197
|
-
this.$yearPrev = $picker.find(selectorOf('year prev'));
|
|
1198
|
-
this.$yearNext = $picker.find(selectorOf('year next'));
|
|
1199
|
-
this.$yearCurrent = $picker.find(selectorOf('year current'));
|
|
1200
|
-
this.$months = $picker.find(selectorOf('months')); // Days view
|
|
1201
|
-
|
|
1202
|
-
this.$daysPicker = $picker.find(selectorOf('days picker'));
|
|
1203
|
-
this.$monthPrev = $picker.find(selectorOf('month prev'));
|
|
1204
|
-
this.$monthNext = $picker.find(selectorOf('month next'));
|
|
1205
|
-
this.$monthCurrent = $picker.find(selectorOf('month current'));
|
|
1206
|
-
this.$days = $picker.find(selectorOf('days'));
|
|
1207
|
-
|
|
1208
|
-
if (this.inline) {
|
|
1209
|
-
$(options.container || $this).append($picker.addClass("".concat(NAMESPACE, "-inline")));
|
|
1210
|
-
} else {
|
|
1211
|
-
$(document.body).append($picker.addClass("".concat(NAMESPACE, "-dropdown")));
|
|
1212
|
-
$picker.addClass(CLASS_HIDE).css({
|
|
1213
|
-
zIndex: parseInt(options.zIndex, 10)
|
|
1214
|
-
});
|
|
1215
|
-
}
|
|
1206
|
+
this.endDate = endDate;
|
|
1207
|
+
}
|
|
1216
1208
|
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
value: function unbuild() {
|
|
1222
|
-
if (!this.built) {
|
|
1223
|
-
return;
|
|
1224
|
-
}
|
|
1209
|
+
this.date = date;
|
|
1210
|
+
this.viewDate = new Date(date);
|
|
1211
|
+
this.initialDate = new Date(this.date);
|
|
1212
|
+
this.bind();
|
|
1225
1213
|
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
}, {
|
|
1230
|
-
key: "bind",
|
|
1231
|
-
value: function bind() {
|
|
1232
|
-
var options = this.options,
|
|
1233
|
-
$this = this.$element;
|
|
1234
|
-
|
|
1235
|
-
if ($.isFunction(options.show)) {
|
|
1236
|
-
$this.on(EVENT_SHOW, options.show);
|
|
1237
|
-
}
|
|
1214
|
+
if (options.autoShow || this.inline) {
|
|
1215
|
+
this.show();
|
|
1216
|
+
}
|
|
1238
1217
|
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1218
|
+
if (options.autoPick) {
|
|
1219
|
+
this.pick();
|
|
1220
|
+
}
|
|
1221
|
+
},
|
|
1222
|
+
},
|
|
1223
|
+
{
|
|
1224
|
+
key: 'build',
|
|
1225
|
+
value: function build() {
|
|
1226
|
+
if (this.built) {
|
|
1227
|
+
return;
|
|
1228
|
+
}
|
|
1242
1229
|
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1230
|
+
this.built = true;
|
|
1231
|
+
var $this = this.$element,
|
|
1232
|
+
options = this.options;
|
|
1233
|
+
var $picker = $(options.template);
|
|
1234
|
+
this.$picker = $picker;
|
|
1235
|
+
this.$week = $picker.find(selectorOf('week')); // Years view
|
|
1236
|
+
|
|
1237
|
+
this.$yearsPicker = $picker.find(selectorOf('years picker'));
|
|
1238
|
+
this.$yearsPrev = $picker.find(selectorOf('years prev'));
|
|
1239
|
+
this.$yearsNext = $picker.find(selectorOf('years next'));
|
|
1240
|
+
this.$yearsCurrent = $picker.find(selectorOf('years current'));
|
|
1241
|
+
this.$years = $picker.find(selectorOf('years')); // Months view
|
|
1242
|
+
|
|
1243
|
+
this.$monthsPicker = $picker.find(selectorOf('months picker'));
|
|
1244
|
+
this.$yearPrev = $picker.find(selectorOf('year prev'));
|
|
1245
|
+
this.$yearNext = $picker.find(selectorOf('year next'));
|
|
1246
|
+
this.$yearCurrent = $picker.find(selectorOf('year current'));
|
|
1247
|
+
this.$months = $picker.find(selectorOf('months')); // Days view
|
|
1248
|
+
|
|
1249
|
+
this.$daysPicker = $picker.find(selectorOf('days picker'));
|
|
1250
|
+
this.$monthPrev = $picker.find(selectorOf('month prev'));
|
|
1251
|
+
this.$monthNext = $picker.find(selectorOf('month next'));
|
|
1252
|
+
this.$monthCurrent = $picker.find(selectorOf('month current'));
|
|
1253
|
+
this.$days = $picker.find(selectorOf('days'));
|
|
1254
|
+
|
|
1255
|
+
if (this.inline) {
|
|
1256
|
+
$(options.container || $this).append($picker.addClass(''.concat(NAMESPACE, '-inline')));
|
|
1257
|
+
} else {
|
|
1258
|
+
$(document.body).append($picker.addClass(''.concat(NAMESPACE, '-dropdown')));
|
|
1259
|
+
$picker.addClass(CLASS_HIDE).css({
|
|
1260
|
+
zIndex: parseInt(options.zIndex, 10),
|
|
1261
|
+
});
|
|
1262
|
+
}
|
|
1246
1263
|
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
}
|
|
1264
|
+
this.renderWeek();
|
|
1265
|
+
},
|
|
1266
|
+
},
|
|
1267
|
+
{
|
|
1268
|
+
key: 'unbuild',
|
|
1269
|
+
value: function unbuild() {
|
|
1270
|
+
if (!this.built) {
|
|
1271
|
+
return;
|
|
1272
|
+
}
|
|
1250
1273
|
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
var $this = this.$element,
|
|
1265
|
-
options = this.options;
|
|
1266
|
-
|
|
1267
|
-
if ($.isFunction(options.show)) {
|
|
1268
|
-
$this.off(EVENT_SHOW, options.show);
|
|
1269
|
-
}
|
|
1274
|
+
this.built = false;
|
|
1275
|
+
this.$picker.remove();
|
|
1276
|
+
},
|
|
1277
|
+
},
|
|
1278
|
+
{
|
|
1279
|
+
key: 'bind',
|
|
1280
|
+
value: function bind() {
|
|
1281
|
+
var options = this.options,
|
|
1282
|
+
$this = this.$element;
|
|
1283
|
+
|
|
1284
|
+
if ($.isFunction(options.show)) {
|
|
1285
|
+
$this.on(EVENT_SHOW, options.show);
|
|
1286
|
+
}
|
|
1270
1287
|
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1288
|
+
if ($.isFunction(options.hide)) {
|
|
1289
|
+
$this.on(EVENT_HIDE, options.hide);
|
|
1290
|
+
}
|
|
1274
1291
|
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1292
|
+
if ($.isFunction(options.pick)) {
|
|
1293
|
+
$this.on(EVENT_PICK, options.pick);
|
|
1294
|
+
}
|
|
1278
1295
|
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1296
|
+
if (this.isInput) {
|
|
1297
|
+
$this.on(EVENT_KEYUP, $.proxy(this.keyup, this));
|
|
1298
|
+
}
|
|
1282
1299
|
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
} else {
|
|
1289
|
-
$this.off(EVENT_CLICK, this.show);
|
|
1290
|
-
}
|
|
1291
|
-
}
|
|
1292
|
-
}
|
|
1293
|
-
}, {
|
|
1294
|
-
key: "showView",
|
|
1295
|
-
value: function showView(view) {
|
|
1296
|
-
var $yearsPicker = this.$yearsPicker,
|
|
1297
|
-
$monthsPicker = this.$monthsPicker,
|
|
1298
|
-
$daysPicker = this.$daysPicker,
|
|
1299
|
-
format = this.format;
|
|
1300
|
-
|
|
1301
|
-
if (format.hasYear || format.hasMonth || format.hasDay) {
|
|
1302
|
-
switch (Number(view)) {
|
|
1303
|
-
case VIEWS.YEARS:
|
|
1304
|
-
$monthsPicker.addClass(CLASS_HIDE);
|
|
1305
|
-
$daysPicker.addClass(CLASS_HIDE);
|
|
1306
|
-
|
|
1307
|
-
if (format.hasYear) {
|
|
1308
|
-
this.renderYears();
|
|
1309
|
-
$yearsPicker.removeClass(CLASS_HIDE);
|
|
1310
|
-
this.place();
|
|
1300
|
+
if (!this.inline) {
|
|
1301
|
+
if (options.trigger) {
|
|
1302
|
+
this.$trigger.on(EVENT_CLICK, $.proxy(this.toggle, this));
|
|
1303
|
+
} else if (this.isInput) {
|
|
1304
|
+
$this.on(EVENT_FOCUS, $.proxy(this.show, this));
|
|
1311
1305
|
} else {
|
|
1312
|
-
this.
|
|
1306
|
+
$this.on(EVENT_CLICK, $.proxy(this.show, this));
|
|
1313
1307
|
}
|
|
1308
|
+
}
|
|
1309
|
+
},
|
|
1310
|
+
},
|
|
1311
|
+
{
|
|
1312
|
+
key: 'unbind',
|
|
1313
|
+
value: function unbind() {
|
|
1314
|
+
var $this = this.$element,
|
|
1315
|
+
options = this.options;
|
|
1316
|
+
|
|
1317
|
+
if ($.isFunction(options.show)) {
|
|
1318
|
+
$this.off(EVENT_SHOW, options.show);
|
|
1319
|
+
}
|
|
1314
1320
|
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
$yearsPicker.addClass(CLASS_HIDE);
|
|
1319
|
-
$daysPicker.addClass(CLASS_HIDE);
|
|
1320
|
-
|
|
1321
|
-
if (format.hasMonth) {
|
|
1322
|
-
this.renderMonths();
|
|
1323
|
-
$monthsPicker.removeClass(CLASS_HIDE);
|
|
1324
|
-
this.place();
|
|
1325
|
-
} else {
|
|
1326
|
-
this.showView(VIEWS.YEARS);
|
|
1327
|
-
}
|
|
1321
|
+
if ($.isFunction(options.hide)) {
|
|
1322
|
+
$this.off(EVENT_HIDE, options.hide);
|
|
1323
|
+
}
|
|
1328
1324
|
|
|
1329
|
-
|
|
1330
|
-
|
|
1325
|
+
if ($.isFunction(options.pick)) {
|
|
1326
|
+
$this.off(EVENT_PICK, options.pick);
|
|
1327
|
+
}
|
|
1331
1328
|
|
|
1332
|
-
|
|
1333
|
-
$
|
|
1334
|
-
|
|
1329
|
+
if (this.isInput) {
|
|
1330
|
+
$this.off(EVENT_KEYUP, this.keyup);
|
|
1331
|
+
}
|
|
1335
1332
|
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1333
|
+
if (!this.inline) {
|
|
1334
|
+
if (options.trigger) {
|
|
1335
|
+
this.$trigger.off(EVENT_CLICK, this.toggle);
|
|
1336
|
+
} else if (this.isInput) {
|
|
1337
|
+
$this.off(EVENT_FOCUS, this.show);
|
|
1340
1338
|
} else {
|
|
1341
|
-
this.
|
|
1339
|
+
$this.off(EVENT_CLICK, this.show);
|
|
1342
1340
|
}
|
|
1341
|
+
}
|
|
1342
|
+
},
|
|
1343
|
+
},
|
|
1344
|
+
{
|
|
1345
|
+
key: 'showView',
|
|
1346
|
+
value: function showView(view) {
|
|
1347
|
+
var $yearsPicker = this.$yearsPicker,
|
|
1348
|
+
$monthsPicker = this.$monthsPicker,
|
|
1349
|
+
$daysPicker = this.$daysPicker,
|
|
1350
|
+
format = this.format;
|
|
1351
|
+
|
|
1352
|
+
if (format.hasYear || format.hasMonth || format.hasDay) {
|
|
1353
|
+
switch (Number(view)) {
|
|
1354
|
+
case VIEWS.YEARS:
|
|
1355
|
+
$monthsPicker.addClass(CLASS_HIDE);
|
|
1356
|
+
$daysPicker.addClass(CLASS_HIDE);
|
|
1357
|
+
|
|
1358
|
+
if (format.hasYear) {
|
|
1359
|
+
this.renderYears();
|
|
1360
|
+
$yearsPicker.removeClass(CLASS_HIDE);
|
|
1361
|
+
this.place();
|
|
1362
|
+
} else {
|
|
1363
|
+
this.showView(VIEWS.DAYS);
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1366
|
+
break;
|
|
1367
|
+
|
|
1368
|
+
case VIEWS.MONTHS:
|
|
1369
|
+
$yearsPicker.addClass(CLASS_HIDE);
|
|
1370
|
+
$daysPicker.addClass(CLASS_HIDE);
|
|
1371
|
+
|
|
1372
|
+
if (format.hasMonth) {
|
|
1373
|
+
this.renderMonths();
|
|
1374
|
+
$monthsPicker.removeClass(CLASS_HIDE);
|
|
1375
|
+
this.place();
|
|
1376
|
+
} else {
|
|
1377
|
+
this.showView(VIEWS.YEARS);
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1380
|
+
break;
|
|
1381
|
+
// case VIEWS.DAYS:
|
|
1382
|
+
|
|
1383
|
+
default:
|
|
1384
|
+
$yearsPicker.addClass(CLASS_HIDE);
|
|
1385
|
+
$monthsPicker.addClass(CLASS_HIDE);
|
|
1386
|
+
|
|
1387
|
+
if (format.hasDay) {
|
|
1388
|
+
this.renderDays();
|
|
1389
|
+
$daysPicker.removeClass(CLASS_HIDE);
|
|
1390
|
+
this.place();
|
|
1391
|
+
} else {
|
|
1392
|
+
this.showView(VIEWS.MONTHS);
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
},
|
|
1397
|
+
},
|
|
1398
|
+
{
|
|
1399
|
+
key: 'hideView',
|
|
1400
|
+
value: function hideView() {
|
|
1401
|
+
if (!this.inline && this.options.autoHide) {
|
|
1402
|
+
this.hide();
|
|
1403
|
+
}
|
|
1404
|
+
},
|
|
1405
|
+
},
|
|
1406
|
+
{
|
|
1407
|
+
key: 'place',
|
|
1408
|
+
value: function place() {
|
|
1409
|
+
if (this.inline) {
|
|
1410
|
+
return;
|
|
1411
|
+
}
|
|
1343
1412
|
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
var containerWidth = $(document).outerWidth();
|
|
1365
|
-
var containerHeight = $(document).outerHeight();
|
|
1366
|
-
var elementWidth = $this.outerWidth();
|
|
1367
|
-
var elementHeight = $this.outerHeight();
|
|
1368
|
-
var width = $picker.width();
|
|
1369
|
-
var height = $picker.height();
|
|
1370
|
-
|
|
1371
|
-
var _$this$offset = $this.offset(),
|
|
1372
|
-
left = _$this$offset.left,
|
|
1373
|
-
top = _$this$offset.top;
|
|
1374
|
-
|
|
1375
|
-
var offset = parseFloat(options.offset);
|
|
1376
|
-
var placement = CLASS_TOP_LEFT;
|
|
1377
|
-
|
|
1378
|
-
if (isNaN(offset)) {
|
|
1379
|
-
offset = 10;
|
|
1380
|
-
}
|
|
1381
|
-
|
|
1382
|
-
if (top > height && top + elementHeight + height > containerHeight) {
|
|
1383
|
-
top -= height + offset;
|
|
1384
|
-
placement = CLASS_BOTTOM_LEFT;
|
|
1385
|
-
} else {
|
|
1386
|
-
top += elementHeight + offset;
|
|
1387
|
-
}
|
|
1413
|
+
var $this = this.$element,
|
|
1414
|
+
options = this.options,
|
|
1415
|
+
$picker = this.$picker;
|
|
1416
|
+
var containerWidth = $(document).outerWidth();
|
|
1417
|
+
var containerHeight = $(document).outerHeight();
|
|
1418
|
+
var elementWidth = $this.outerWidth();
|
|
1419
|
+
var elementHeight = $this.outerHeight();
|
|
1420
|
+
var width = $picker.width();
|
|
1421
|
+
var height = $picker.height();
|
|
1422
|
+
|
|
1423
|
+
var _$this$offset = $this.offset(),
|
|
1424
|
+
left = _$this$offset.left,
|
|
1425
|
+
top = _$this$offset.top;
|
|
1426
|
+
|
|
1427
|
+
var offset = parseFloat(options.offset);
|
|
1428
|
+
var placement = CLASS_TOP_LEFT;
|
|
1429
|
+
|
|
1430
|
+
if (isNaN(offset)) {
|
|
1431
|
+
offset = 10;
|
|
1432
|
+
}
|
|
1388
1433
|
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1434
|
+
if (top > height && top + elementHeight + height > containerHeight) {
|
|
1435
|
+
top -= height + offset;
|
|
1436
|
+
placement = CLASS_BOTTOM_LEFT;
|
|
1437
|
+
} else {
|
|
1438
|
+
top += elementHeight + offset;
|
|
1439
|
+
}
|
|
1393
1440
|
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
} // A shortcut for triggering custom events
|
|
1399
|
-
|
|
1400
|
-
}, {
|
|
1401
|
-
key: "trigger",
|
|
1402
|
-
value: function trigger(type, data) {
|
|
1403
|
-
var e = $.Event(type, data);
|
|
1404
|
-
this.$element.trigger(e);
|
|
1405
|
-
return e;
|
|
1406
|
-
}
|
|
1407
|
-
}, {
|
|
1408
|
-
key: "createItem",
|
|
1409
|
-
value: function createItem(data) {
|
|
1410
|
-
var options = this.options;
|
|
1411
|
-
var itemTag = options.itemTag;
|
|
1412
|
-
var item = {
|
|
1413
|
-
text: '',
|
|
1414
|
-
view: '',
|
|
1415
|
-
muted: false,
|
|
1416
|
-
picked: false,
|
|
1417
|
-
disabled: false,
|
|
1418
|
-
highlighted: false
|
|
1419
|
-
};
|
|
1420
|
-
var classes = [];
|
|
1421
|
-
$.extend(item, data);
|
|
1441
|
+
if (left + width > containerWidth) {
|
|
1442
|
+
left += elementWidth - width;
|
|
1443
|
+
placement = placement.replace('left', 'right');
|
|
1444
|
+
}
|
|
1422
1445
|
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1446
|
+
$picker.removeClass(CLASS_PLACEMENTS).addClass(placement).css({
|
|
1447
|
+
top: top,
|
|
1448
|
+
left: left,
|
|
1449
|
+
});
|
|
1450
|
+
}, // A shortcut for triggering custom events
|
|
1451
|
+
},
|
|
1452
|
+
{
|
|
1453
|
+
key: 'trigger',
|
|
1454
|
+
value: function trigger(type, data) {
|
|
1455
|
+
var e = $.Event(type, data);
|
|
1456
|
+
this.$element.trigger(e);
|
|
1457
|
+
return e;
|
|
1458
|
+
},
|
|
1459
|
+
},
|
|
1460
|
+
{
|
|
1461
|
+
key: 'createItem',
|
|
1462
|
+
value: function createItem(data) {
|
|
1463
|
+
var options = this.options;
|
|
1464
|
+
var itemTag = options.itemTag;
|
|
1465
|
+
var item = {
|
|
1466
|
+
text: '',
|
|
1467
|
+
view: '',
|
|
1468
|
+
muted: false,
|
|
1469
|
+
picked: false,
|
|
1470
|
+
disabled: false,
|
|
1471
|
+
highlighted: false,
|
|
1472
|
+
};
|
|
1473
|
+
var classes = [];
|
|
1474
|
+
$.extend(item, data);
|
|
1475
|
+
|
|
1476
|
+
if (item.muted) {
|
|
1477
|
+
classes.push(options.mutedClass);
|
|
1478
|
+
}
|
|
1426
1479
|
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1480
|
+
if (item.highlighted) {
|
|
1481
|
+
classes.push(options.highlightedClass);
|
|
1482
|
+
}
|
|
1430
1483
|
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1484
|
+
if (item.picked) {
|
|
1485
|
+
classes.push(options.pickedClass);
|
|
1486
|
+
}
|
|
1434
1487
|
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1488
|
+
if (item.disabled) {
|
|
1489
|
+
classes.push(options.disabledClass);
|
|
1490
|
+
}
|
|
1438
1491
|
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1492
|
+
return '<'.concat(itemTag, ' class="').concat(classes.join(' '), '" data-view="').concat(item.view, '">').concat(item.text, '</').concat(itemTag, '>');
|
|
1493
|
+
},
|
|
1494
|
+
},
|
|
1495
|
+
{
|
|
1496
|
+
key: 'getValue',
|
|
1497
|
+
value: function getValue() {
|
|
1498
|
+
var $this = this.$element;
|
|
1499
|
+
return this.isInput ? $this.val() : $this.text();
|
|
1500
|
+
},
|
|
1501
|
+
},
|
|
1502
|
+
{
|
|
1503
|
+
key: 'setValue',
|
|
1504
|
+
value: function setValue() {
|
|
1505
|
+
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
1506
|
+
var $this = this.$element;
|
|
1507
|
+
|
|
1508
|
+
if (this.isInput) {
|
|
1509
|
+
$this.val(value);
|
|
1510
|
+
} else if (!this.inline || this.options.container) {
|
|
1511
|
+
$this.text(value);
|
|
1512
|
+
}
|
|
1513
|
+
},
|
|
1514
|
+
},
|
|
1515
|
+
],
|
|
1516
|
+
[
|
|
1517
|
+
{
|
|
1518
|
+
key: 'setDefaults',
|
|
1519
|
+
value: function setDefaults() {
|
|
1520
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1521
|
+
$.extend(DEFAULTS, LANGUAGES[options.language], $.isPlainObject(options) && options);
|
|
1522
|
+
},
|
|
1523
|
+
},
|
|
1524
|
+
],
|
|
1525
|
+
);
|
|
1466
1526
|
|
|
1467
1527
|
return Datepicker;
|
|
1468
|
-
}();
|
|
1528
|
+
})();
|
|
1469
1529
|
|
|
1470
1530
|
if ($.extend) {
|
|
1471
1531
|
$.extend(Datepicker.prototype, render, handlers, methods);
|
|
@@ -1519,5 +1579,4 @@
|
|
|
1519
1579
|
return this;
|
|
1520
1580
|
};
|
|
1521
1581
|
}
|
|
1522
|
-
|
|
1523
|
-
})));
|
|
1582
|
+
});
|