@ntlab/ntjs-assets 2.0.44 → 2.0.46
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/assets/js/DataTables/Extensions/DateTime/js/dataTables.dateTime.js +6 -6
- package/assets/js/DataTables/Extensions/DateTime/js/dataTables.dateTime.min.js +2 -2
- package/assets/js/DataTables/Extensions/Select/js/dataTables.select.js +208 -71
- package/assets/js/DataTables/Extensions/Select/js/dataTables.select.min.js +2 -2
- package/assets/js/cdn.json +2 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! DateTime picker for DataTables.net v1.5.
|
|
1
|
+
/*! DateTime picker for DataTables.net v1.5.4
|
|
2
2
|
*
|
|
3
3
|
* © SpryMedia Ltd, all rights reserved.
|
|
4
4
|
* License: MIT datatables.net/license/mit
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
50
|
* @summary DateTime picker for DataTables.net
|
|
51
|
-
* @version 1.5.
|
|
51
|
+
* @version 1.5.4
|
|
52
52
|
* @file dataTables.dateTime.js
|
|
53
53
|
* @author SpryMedia Ltd
|
|
54
54
|
* @contact www.datatables.net/contact
|
|
@@ -863,7 +863,7 @@ $.extend(DateTime.prototype, {
|
|
|
863
863
|
$(document).off('keydown.' + namespace);
|
|
864
864
|
$('div.dataTables_scrollBody').off('scroll.' + namespace);
|
|
865
865
|
$('div.DTE_Body_Content').off('scroll.' + namespace);
|
|
866
|
-
$(
|
|
866
|
+
$(document).off('click.' + namespace);
|
|
867
867
|
$(this.dom.input[0].offsetParent).off('.' + namespace);
|
|
868
868
|
},
|
|
869
869
|
|
|
@@ -1401,7 +1401,7 @@ $.extend(DateTime.prototype, {
|
|
|
1401
1401
|
|
|
1402
1402
|
// Correct to the right
|
|
1403
1403
|
if (calWidth + offset.left > $(window).width()) {
|
|
1404
|
-
var newLeft = $(window).width() - calWidth;
|
|
1404
|
+
var newLeft = $(window).width() - calWidth - 5;
|
|
1405
1405
|
|
|
1406
1406
|
// Account for elements which are inside a position absolute element
|
|
1407
1407
|
if (this.c.attachTo === 'input') {
|
|
@@ -1563,7 +1563,7 @@ $.extend(DateTime.prototype, {
|
|
|
1563
1563
|
// event from the one that was used to trigger the show (bubble and
|
|
1564
1564
|
// inline)
|
|
1565
1565
|
setTimeout(function () {
|
|
1566
|
-
$(
|
|
1566
|
+
$(document).on('click.' + namespace, function (e) {
|
|
1567
1567
|
var parents = $(e.target).parents();
|
|
1568
1568
|
|
|
1569
1569
|
if (!parents.filter(that.dom.container).length && e.target !== that.dom.input[0]) {
|
|
@@ -1690,7 +1690,7 @@ DateTime.defaults = {
|
|
|
1690
1690
|
yearRange: 25
|
|
1691
1691
|
};
|
|
1692
1692
|
|
|
1693
|
-
DateTime.version = '1.5.
|
|
1693
|
+
DateTime.version = '1.5.4';
|
|
1694
1694
|
|
|
1695
1695
|
/**
|
|
1696
1696
|
* CommonJS factory function pass through. Matches DataTables.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*! DateTime picker for DataTables.net v1.5.
|
|
1
|
+
/*! DateTime picker for DataTables.net v1.5.4
|
|
2
2
|
*
|
|
3
3
|
* © SpryMedia Ltd, all rights reserved.
|
|
4
4
|
* License: MIT datatables.net/license/mit
|
|
5
5
|
*/
|
|
6
|
-
!function(s){var i;"function"==typeof define&&define.amd?define(["jquery"],function(t){return s(t,window,document)}):"object"==typeof exports?(i=require("jquery"),"undefined"==typeof window?module.exports=function(t,e){return t=t||window,e=e||i(t),s(e,t,t.document)}:module.exports=s(i,window,window.document)):s(jQuery,window,document)}(function(g,o,i){"use strict";function n(t,e){if(n.factory(t,e))return n;if(void 0===a&&(a=o.moment||o.dayjs||o.luxon||null),this.c=g.extend(!0,{},n.defaults,e),e=this.c.classPrefix,!a&&"YYYY-MM-DD"!==this.c.format)throw"DateTime: Without momentjs, dayjs or luxon only the format 'YYYY-MM-DD' can be used";"string"==typeof this.c.minDate&&(this.c.minDate=new Date(this.c.minDate)),"string"==typeof this.c.maxDate&&(this.c.maxDate=new Date(this.c.maxDate));var s=g('<div class="'+e+'"><div class="'+e+'-date"><div class="'+e+'-title"><div class="'+e+'-iconLeft"><button type="button"></button></div><div class="'+e+'-iconRight"><button type="button"></button></div><div class="'+e+'-label"><span></span><select class="'+e+'-month"></select></div><div class="'+e+'-label"><span></span><select class="'+e+'-year"></select></div></div><div class="'+e+'-buttons"><a class="'+e+'-clear"></a><a class="'+e+'-today"></a></div><div class="'+e+'-calendar"></div></div><div class="'+e+'-time"><div class="'+e+'-hours"></div><div class="'+e+'-minutes"></div><div class="'+e+'-seconds"></div></div><div class="'+e+'-error"></div></div>');this.dom={container:s,date:s.find("."+e+"-date"),title:s.find("."+e+"-title"),calendar:s.find("."+e+"-calendar"),time:s.find("."+e+"-time"),error:s.find("."+e+"-error"),buttons:s.find("."+e+"-buttons"),clear:s.find("."+e+"-clear"),today:s.find("."+e+"-today"),previous:s.find("."+e+"-iconLeft"),next:s.find("."+e+"-iconRight"),input:g(t)},this.s={d:null,display:null,minutesRange:null,secondsRange:null,namespace:"dateime-"+n._instance++,parts:{date:null!==this.c.format.match(/[YMD]|L(?!T)|l/),time:null!==this.c.format.match(/[Hhm]|LT|LTS/),seconds:-1!==this.c.format.indexOf("s"),hours12:null!==this.c.format.match(/[haA]/)}},this.dom.container.append(this.dom.date).append(this.dom.time).append(this.dom.error),this.dom.date.append(this.dom.title).append(this.dom.buttons).append(this.dom.calendar),this.dom.input.addClass("dt-datetime"),this._constructor()}var a;return g.extend(n.prototype,{destroy:function(){this._hide(!0),this.dom.container.off().empty(),this.dom.input.removeClass("dt-datetime").removeAttr("autocomplete").off(".datetime")},display:function(t,e){return void 0!==t&&this.s.display.setUTCFullYear(t),void 0!==e&&this.s.display.setUTCMonth(e-1),void 0!==t||void 0!==e?(this._setTitle(),this._setCalander(),this):{month:this.s.display.getUTCMonth()+1,year:this.s.display.getUTCFullYear()}},errorMsg:function(t){var e=this.dom.error;return t?e.html(t):e.empty(),this},hide:function(){return this._hide(),this},max:function(t){return this.c.maxDate="string"==typeof t?new Date(t):t,this._optionsTitle(),this._setCalander(),this},min:function(t){return this.c.minDate="string"==typeof t?new Date(t):t,this._optionsTitle(),this._setCalander(),this},owns:function(t){return 0<g(t).parents().filter(this.dom.container).length},val:function(t,e){return void 0===t?this.s.d:(t instanceof Date?this.s.d=this._dateToUtc(t):null===t||""===t?this.s.d=null:"--now"===t?this.s.d=this._dateToUtc(new Date):"string"==typeof t&&(this.s.d=this._dateToUtc(this._convert(t,this.c.format,null))),!e&&void 0!==e||(this.s.d?this._writeOutput():this.dom.input.val(t)),this.s.display=this.s.d?new Date(this.s.d.toString()):new Date,this.s.display.setUTCDate(1),this._setTitle(),this._setCalander(),this._setTime(),this)},valFormat:function(t,e){return e?(this.val(this._convert(e,t,null)),this):this._convert(this.val(),null,t)},_constructor:function(){function a(){var t=o.dom.input.val();t!==e&&(o.c.onChange.call(o,t,o.s.d,o.dom.input),e=t)}var o=this,r=this.c.classPrefix,e=this.dom.input.val();this.s.parts.date||this.dom.date.css("display","none"),this.s.parts.time||this.dom.time.css("display","none"),this.s.parts.seconds||(this.dom.time.children("div."+r+"-seconds").remove(),this.dom.time.children("span").eq(1).remove()),this.c.buttons.clear||this.dom.clear.css("display","none"),this.c.buttons.today||this.dom.today.css("display","none"),this._optionsTitle(),g(i).on("i18n.dt",function(t,e){e.oLanguage.datetime&&(g.extend(!0,o.c.i18n,e.oLanguage.datetime),o._optionsTitle())}),"hidden"===this.dom.input.attr("type")&&(this.dom.container.addClass("inline"),this.c.attachTo="input",this.val(this.dom.input.val(),!1),this._show()),e&&this.val(e,!1),this.dom.input.attr("autocomplete","off").on("focus.datetime click.datetime",function(){o.dom.container.is(":visible")||o.dom.input.is(":disabled")||(o.val(o.dom.input.val(),!1),o._show())}).on("keyup.datetime",function(){o.dom.container.is(":visible")&&o.val(o.dom.input.val(),!1)}),this.dom.container[0].addEventListener("focusin",function(t){t.stopPropagation()}),this.dom.container.on("change","select",function(){var t,e,s=g(this),i=s.val();s.hasClass(r+"-month")?(o._correctMonth(o.s.display,i),o._setTitle(),o._setCalander()):s.hasClass(r+"-year")?(o.s.display.setUTCFullYear(i),o._setTitle(),o._setCalander()):s.hasClass(r+"-hours")||s.hasClass(r+"-ampm")?(o.s.parts.hours12?(t=+g(o.dom.container).find("."+r+"-hours").val(),e="pm"===g(o.dom.container).find("."+r+"-ampm").val(),o.s.d.setUTCHours(12!=t||e?e&&12!=t?12+t:t:0)):o.s.d.setUTCHours(i),o._setTime(),o._writeOutput(!0),a()):s.hasClass(r+"-minutes")?(o.s.d.setUTCMinutes(i),o._setTime(),o._writeOutput(!0),a()):s.hasClass(r+"-seconds")&&(o.s.d.setSeconds(i),o._setTime(),o._writeOutput(!0),a()),o.dom.input.focus(),o._position()}).on("click",function(t){var e=o.s.d,s="span"===t.target.nodeName.toLowerCase()?t.target.parentNode:t.target,i=s.nodeName.toLowerCase();if("select"!==i)if(t.stopPropagation(),"a"===i&&(t.preventDefault(),g(s).hasClass(r+"-clear")?(o.s.d=null,o.dom.input.val(""),o._writeOutput(),o._setCalander(),o._setTime(),a()):g(s).hasClass(r+"-today")&&(o.s.display=new Date,o._setTitle(),o._setCalander())),"button"===i){t=g(s),i=t.parent();if(i.hasClass("disabled")&&!i.hasClass("range"))t.blur();else if(i.hasClass(r+"-iconLeft"))o.s.display.setUTCMonth(o.s.display.getUTCMonth()-1),o._setTitle(),o._setCalander(),o.dom.input.focus();else if(i.hasClass(r+"-iconRight"))o._correctMonth(o.s.display,o.s.display.getUTCMonth()+1),o._setTitle(),o._setCalander(),o.dom.input.focus();else{if(t.parents("."+r+"-time").length){var s=t.data("value"),n=t.data("unit"),e=o._needValue();if("minutes"===n){if(i.hasClass("disabled")&&i.hasClass("range"))return o.s.minutesRange=s,void o._setTime();o.s.minutesRange=null}if("seconds"===n){if(i.hasClass("disabled")&&i.hasClass("range"))return o.s.secondsRange=s,void o._setTime();o.s.secondsRange=null}if("am"===s){if(!(12<=e.getUTCHours()))return;s=e.getUTCHours()-12}else if("pm"===s){if(!(e.getUTCHours()<12))return;s=e.getUTCHours()+12}e["hours"===n?"setUTCHours":"minutes"===n?"setUTCMinutes":"setSeconds"](s),o._setCalander(),o._setTime(),o._writeOutput(!0)}else(e=o._needValue()).setUTCDate(1),e.setUTCFullYear(t.data("year")),e.setUTCMonth(t.data("month")),e.setUTCDate(t.data("day")),o._writeOutput(!0),o.s.parts.time?(o._setCalander(),o._setTime()):setTimeout(function(){o._hide()},10);a()}}else o.dom.input.focus()})},_compareDates:function(t,e){return this._isLuxon()?a.DateTime.fromJSDate(t).toUTC().toISODate()===a.DateTime.fromJSDate(e).toUTC().toISODate():this._dateToUtcString(t)===this._dateToUtcString(e)},_convert:function(t,e,s){var i;return t&&(a?this._isLuxon()?(i=t instanceof Date?a.DateTime.fromJSDate(t).toUTC():a.DateTime.fromFormat(t,e)).isValid?s?i.toFormat(s):i.toJSDate():null:(i=t instanceof Date?a.utc(t,void 0,this.c.locale,this.c.strict):a(t,e,this.c.locale,this.c.strict)).isValid()?s?i.format(s):i.toDate():null:!e&&!s||e&&s?t:e?(i=t.match(/(\d{4})\-(\d{2})\-(\d{2})/))?new Date(i[1],i[2]-1,i[3]):null:t.getUTCFullYear()+"-"+this._pad(t.getUTCMonth()+1)+"-"+this._pad(t.getUTCDate()))},_correctMonth:function(t,e){var s=this._daysInMonth(t.getUTCFullYear(),e),i=t.getUTCDate()>s;t.setUTCMonth(e),i&&(t.setUTCDate(s),t.setUTCMonth(e))},_daysInMonth:function(t,e){return[31,t%4==0&&(t%100!=0||t%400==0)?29:28,31,30,31,30,31,31,30,31,30,31][e]},_dateToUtc:function(t){return t&&new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds()))},_dateToUtcString:function(t){return this._isLuxon()?a.DateTime.fromJSDate(t).toUTC().toISODate():t.getUTCFullYear()+"-"+this._pad(t.getUTCMonth()+1)+"-"+this._pad(t.getUTCDate())},_hide:function(t){!t&&"hidden"===this.dom.input.attr("type")||(t=this.s.namespace,this.dom.container.detach(),g(o).off("."+t),g(i).off("keydown."+t),g("div.dataTables_scrollBody").off("scroll."+t),g("div.DTE_Body_Content").off("scroll."+t),g("body").off("click."+t),g(this.dom.input[0].offsetParent).off("."+t))},_hours24To12:function(t){return 0===t?12:12<t?t-12:t},_htmlDay:function(t){var e,s;return t.empty?'<td class="empty"></td>':(e=["selectable"],s=this.c.classPrefix,t.disabled&&e.push("disabled"),t.today&&e.push("now"),t.selected&&e.push("selected"),'<td data-day="'+t.day+'" class="'+e.join(" ")+'"><button class="'+s+"-button "+s+'-day" type="button" data-year="'+t.year+'" data-month="'+t.month+'" data-day="'+t.day+'"><span>'+t.day+"</span></button></td>")},_htmlMonth:function(t,e){for(var s=this._dateToUtc(new Date),i=this._daysInMonth(t,e),n=new Date(Date.UTC(t,e,1)).getUTCDay(),a=[],o=[],r=(0<this.c.firstDay&&(n-=this.c.firstDay)<0&&(n+=7),i+n),d=r;7<d;)d-=7;r+=7-d;var l=this.c.minDate,h=this.c.maxDate;l&&(l.setUTCHours(0),l.setUTCMinutes(0),l.setSeconds(0)),h&&(h.setUTCHours(23),h.setUTCMinutes(59),h.setSeconds(59));for(var u=0,c=0;u<r;u++){var m=new Date(Date.UTC(t,e,u-n+1)),f=!!this.s.d&&this._compareDates(m,this.s.d),p=this._compareDates(m,s),y=u<n||i+n<=u,T=l&&m<l||h&&h<m,v=this.c.disableDays,f={day:u-n+1,month:e,year:t,selected:f,today:p,disabled:T=Array.isArray(v)&&-1!==g.inArray(m.getUTCDay(),v)||"function"==typeof v&&!0===v(m)?!0:T,empty:y};o.push(this._htmlDay(f)),7==++c&&(this.c.showWeekNumber&&o.unshift(this._htmlWeekOfYear(u-n,e,t)),a.push("<tr>"+o.join("")+"</tr>"),o=[],c=0)}var _,D=this.c.classPrefix,C=D+"-table";return this.c.showWeekNumber&&(C+=" weekNumber"),l&&(_=l>=new Date(Date.UTC(t,e,1,0,0,0)),this.dom.title.find("div."+D+"-iconLeft").css("display",_?"none":"block")),h&&(_=h<new Date(Date.UTC(t,e+1,1,0,0,0)),this.dom.title.find("div."+D+"-iconRight").css("display",_?"none":"block")),'<table class="'+C+'"><thead>'+this._htmlMonthHead()+"</thead><tbody>"+a.join("")+"</tbody></table>"},_htmlMonthHead:function(){var t=[],e=this.c.firstDay,s=this.c.i18n;this.c.showWeekNumber&&t.push("<th></th>");for(var i=0;i<7;i++)t.push("<th>"+function(t){for(t+=e;7<=t;)t-=7;return s.weekdays[t]}(i)+"</th>");return t.join("")},_htmlWeekOfYear:function(t,e,s){e=new Date(s,e,t,0,0,0,0),e.setDate(e.getDate()+4-(e.getDay()||7)),t=new Date(s,0,1),s=Math.ceil(((e-t)/864e5+1)/7);return'<td class="'+this.c.classPrefix+'-week">'+s+"</td>"},_isLuxon:function(){return!!(a&&a.DateTime&&a.Duration&&a.Settings)},_needValue:function(){return this.s.d||(this.s.d=this._dateToUtc(new Date),this.s.parts.time)||(this.s.d.setUTCHours(0),this.s.d.setUTCMinutes(0),this.s.d.setSeconds(0),this.s.d.setMilliseconds(0)),this.s.d},_options:function(t,e,s){s=s||e;var i=this.dom.container.find("select."+this.c.classPrefix+"-"+t);i.empty();for(var n=0,a=e.length;n<a;n++)i.append('<option value="'+e[n]+'">'+s[n]+"</option>")},_optionSet:function(t,e){var t=this.dom.container.find("select."+this.c.classPrefix+"-"+t),s=t.parent().children("span"),e=(t.val(e),t.find("option:selected"));s.html(0!==e.length?e.text():this.c.i18n.unknown)},_optionsTime:function(n,a,o,r,t){var e,d=this.c.classPrefix,s=this.dom.container.find("div."+d+"-"+n),i=12===a?function(t){return t}:this._pad,l=d+"-table",h=this.c.i18n;if(s.length){var u="",c=10,m=function(t,e,s){12===a&&"number"==typeof t&&(12<=o&&(t+=12),12==t?t=0:24==t&&(t=12));var i=o===t||"am"===t&&o<12||"pm"===t&&12<=o?"selected":"";return"number"==typeof t&&r&&-1===g.inArray(t,r)&&(i+=" disabled"),s&&(i+=" "+s),'<td class="selectable '+i+'"><button class="'+d+"-button "+d+'-day" type="button" data-unit="'+n+'" data-value="'+t+'"><span>'+e+"</span></button></td>"};if(12===a){for(u+="<tr>",e=1;e<=6;e++)u+=m(e,i(e));for(u=(u+=m("am",h.amPm[0]))+"</tr>"+"<tr>",e=7;e<=12;e++)u+=m(e,i(e));u=u+m("pm",h.amPm[1])+"</tr>",c=7}else{if(24===a)for(var f=0,p=0;p<4;p++){for(u+="<tr>",e=0;e<6;e++)u+=m(f,i(f)),f++;u+="</tr>"}else{for(u+="<tr>",p=0;p<60;p+=10)u+=m(p,i(p),"range");var u=u+"</tr>"+('</tbody></thead><table class="'+l+" "+l+'-nospace"><tbody>'),y=null!==t?t:-1===o?0:10*Math.floor(o/10);for(u+="<tr>",p=y+1;p<y+10;p++)u+=m(p,i(p));u+="</tr>"}c=6}s.empty().append('<table class="'+l+'"><thead><tr><th colspan="'+c+'">'+h[n]+"</th></tr></thead><tbody>"+u+"</tbody></table>")}},_optionsTitle:function(){var t=this.c.i18n,e=this.c.minDate,s=this.c.maxDate,e=e?e.getFullYear():null,s=s?s.getFullYear():null,e=null!==e?e:(new Date).getFullYear()-this.c.yearRange,s=null!==s?s:(new Date).getFullYear()+this.c.yearRange;this._options("month",this._range(0,11),t.months),this._options("year",this._range(e,s)),this.dom.today.text(t.today).text(t.today),this.dom.clear.text(t.clear).text(t.clear),this.dom.previous.attr("title",t.previous).children("button").text(t.previous),this.dom.next.attr("title",t.next).children("button").text(t.next)},_pad:function(t){return t<10?"0"+t:t},_position:function(){var t,e,s,i="input"===this.c.attachTo?this.dom.input.position():this.dom.input.offset(),n=this.dom.container,a=this.dom.input.outerHeight();n.hasClass("inline")?n.insertAfter(this.dom.input):(this.s.parts.date&&this.s.parts.time&&550<g(o).width()?n.addClass("horizontal"):n.removeClass("horizontal"),"input"===this.c.attachTo?n.css({top:i.top+a,left:i.left}).insertAfter(this.dom.input):n.css({top:i.top+a,left:i.left}).appendTo("body"),t=n.outerHeight(),e=n.outerWidth(),s=g(o).scrollTop(),i.top+a+t-s>g(o).height()&&(a=i.top-t,n.css("top",a<0?0:a)),e+i.left>g(o).width()&&(s=g(o).width()-e,"input"===this.c.attachTo&&(s-=g(n).offsetParent().offset().left),n.css("left",s<0?0:s)))},_range:function(t,e,s){var i=[];s=s||1;for(var n=t;n<=e;n+=s)i.push(n);return i},_setCalander:function(){this.s.display&&this.dom.calendar.empty().append(this._htmlMonth(this.s.display.getUTCFullYear(),this.s.display.getUTCMonth()))},_setTitle:function(){this._optionSet("month",this.s.display.getUTCMonth()),this._optionSet("year",this.s.display.getUTCFullYear())},_setTime:function(){function t(t){return e.c[t+"Available"]||e._range(0,59,e.c[t+"Increment"])}var e=this,s=this.s.d,i=null,n=null!=(i=this._isLuxon()?a.DateTime.fromJSDate(s).toUTC():i)?i.hour:s?s.getUTCHours():-1;this._optionsTime("hours",this.s.parts.hours12?12:24,n,this.c.hoursAvailable),this._optionsTime("minutes",60,null!=i?i.minute:s?s.getUTCMinutes():-1,t("minutes"),this.s.minutesRange),this._optionsTime("seconds",60,null!=i?i.second:s?s.getSeconds():-1,t("seconds"),this.s.secondsRange)},_show:function(){var e=this,t=this.s.namespace,s=(this._position(),g(o).on("scroll."+t+" resize."+t,function(){e._position()}),g("div.DTE_Body_Content").on("scroll."+t,function(){e._position()}),g("div.dataTables_scrollBody").on("scroll."+t,function(){e._position()}),this.dom.input[0].offsetParent);s!==i.body&&g(s).on("scroll."+t,function(){e._position()}),g(i).on("keydown."+t,function(t){9!==t.keyCode&&27!==t.keyCode&&13!==t.keyCode||e._hide()}),setTimeout(function(){g("body").on("click."+t,function(t){g(t.target).parents().filter(e.dom.container).length||t.target===e.dom.input[0]||e._hide()})},10)},_writeOutput:function(t){var e=this.s.d,s="",i=this.dom.input,e=(e&&(s=this._convert(e,null,this.c.format)),i.val(s),new Event("change",{bubbles:!0}));i[0].dispatchEvent(e),"hidden"===i.attr("type")&&this.val(s,!1),t&&i.focus()}}),n.use=function(t){a=t},n._instance=0,n.type="DateTime",n.defaults={attachTo:"body",buttons:{clear:!1,today:!1},classPrefix:"dt-datetime",disableDays:null,firstDay:1,format:"YYYY-MM-DD",hoursAvailable:null,i18n:{clear:"Clear",previous:"Previous",next:"Next",months:["January","February","March","April","May","June","July","August","September","October","November","December"],weekdays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],amPm:["am","pm"],hours:"Hour",minutes:"Minute",seconds:"Second",unknown:"-",today:"Today"},maxDate:null,minDate:null,minutesAvailable:null,minutesIncrement:1,strict:!0,locale:"en",onChange:function(){},secondsAvailable:null,secondsIncrement:1,showWeekNumber:!1,yearRange:25},n.version="1.5.3",n.factory=function(t,e){var s=!1;return t&&t.document&&(i=(o=t).document),e&&e.fn&&e.fn.jquery&&(g=e,s=!0),s},o.DateTime||(o.DateTime=n),o.DataTable&&(o.DataTable.DateTime=n),g.fn.dtDateTime=function(t){return this.each(function(){new n(this,t)})},g.fn.dataTable&&(g.fn.dataTable.DateTime=n,g.fn.DataTable.DateTime=n,g.fn.dataTable.Editor)&&(g.fn.dataTable.Editor.DateTime=n),n});
|
|
6
|
+
!function(s){var i;"function"==typeof define&&define.amd?define(["jquery"],function(t){return s(t,window,document)}):"object"==typeof exports?(i=require("jquery"),"undefined"==typeof window?module.exports=function(t,e){return t=t||window,e=e||i(t),s(e,t,t.document)}:module.exports=s(i,window,window.document)):s(jQuery,window,document)}(function(g,o,i){"use strict";function n(t,e){if(n.factory(t,e))return n;if(void 0===a&&(a=o.moment||o.dayjs||o.luxon||null),this.c=g.extend(!0,{},n.defaults,e),e=this.c.classPrefix,!a&&"YYYY-MM-DD"!==this.c.format)throw"DateTime: Without momentjs, dayjs or luxon only the format 'YYYY-MM-DD' can be used";"string"==typeof this.c.minDate&&(this.c.minDate=new Date(this.c.minDate)),"string"==typeof this.c.maxDate&&(this.c.maxDate=new Date(this.c.maxDate));var s=g('<div class="'+e+'"><div class="'+e+'-date"><div class="'+e+'-title"><div class="'+e+'-iconLeft"><button type="button"></button></div><div class="'+e+'-iconRight"><button type="button"></button></div><div class="'+e+'-label"><span></span><select class="'+e+'-month"></select></div><div class="'+e+'-label"><span></span><select class="'+e+'-year"></select></div></div><div class="'+e+'-buttons"><a class="'+e+'-clear"></a><a class="'+e+'-today"></a></div><div class="'+e+'-calendar"></div></div><div class="'+e+'-time"><div class="'+e+'-hours"></div><div class="'+e+'-minutes"></div><div class="'+e+'-seconds"></div></div><div class="'+e+'-error"></div></div>');this.dom={container:s,date:s.find("."+e+"-date"),title:s.find("."+e+"-title"),calendar:s.find("."+e+"-calendar"),time:s.find("."+e+"-time"),error:s.find("."+e+"-error"),buttons:s.find("."+e+"-buttons"),clear:s.find("."+e+"-clear"),today:s.find("."+e+"-today"),previous:s.find("."+e+"-iconLeft"),next:s.find("."+e+"-iconRight"),input:g(t)},this.s={d:null,display:null,minutesRange:null,secondsRange:null,namespace:"dateime-"+n._instance++,parts:{date:null!==this.c.format.match(/[YMD]|L(?!T)|l/),time:null!==this.c.format.match(/[Hhm]|LT|LTS/),seconds:-1!==this.c.format.indexOf("s"),hours12:null!==this.c.format.match(/[haA]/)}},this.dom.container.append(this.dom.date).append(this.dom.time).append(this.dom.error),this.dom.date.append(this.dom.title).append(this.dom.buttons).append(this.dom.calendar),this.dom.input.addClass("dt-datetime"),this._constructor()}var a;return g.extend(n.prototype,{destroy:function(){this._hide(!0),this.dom.container.off().empty(),this.dom.input.removeClass("dt-datetime").removeAttr("autocomplete").off(".datetime")},display:function(t,e){return void 0!==t&&this.s.display.setUTCFullYear(t),void 0!==e&&this.s.display.setUTCMonth(e-1),void 0!==t||void 0!==e?(this._setTitle(),this._setCalander(),this):{month:this.s.display.getUTCMonth()+1,year:this.s.display.getUTCFullYear()}},errorMsg:function(t){var e=this.dom.error;return t?e.html(t):e.empty(),this},hide:function(){return this._hide(),this},max:function(t){return this.c.maxDate="string"==typeof t?new Date(t):t,this._optionsTitle(),this._setCalander(),this},min:function(t){return this.c.minDate="string"==typeof t?new Date(t):t,this._optionsTitle(),this._setCalander(),this},owns:function(t){return 0<g(t).parents().filter(this.dom.container).length},val:function(t,e){return void 0===t?this.s.d:(t instanceof Date?this.s.d=this._dateToUtc(t):null===t||""===t?this.s.d=null:"--now"===t?this.s.d=this._dateToUtc(new Date):"string"==typeof t&&(this.s.d=this._dateToUtc(this._convert(t,this.c.format,null))),!e&&void 0!==e||(this.s.d?this._writeOutput():this.dom.input.val(t)),this.s.display=this.s.d?new Date(this.s.d.toString()):new Date,this.s.display.setUTCDate(1),this._setTitle(),this._setCalander(),this._setTime(),this)},valFormat:function(t,e){return e?(this.val(this._convert(e,t,null)),this):this._convert(this.val(),null,t)},_constructor:function(){function a(){var t=o.dom.input.val();t!==e&&(o.c.onChange.call(o,t,o.s.d,o.dom.input),e=t)}var o=this,r=this.c.classPrefix,e=this.dom.input.val();this.s.parts.date||this.dom.date.css("display","none"),this.s.parts.time||this.dom.time.css("display","none"),this.s.parts.seconds||(this.dom.time.children("div."+r+"-seconds").remove(),this.dom.time.children("span").eq(1).remove()),this.c.buttons.clear||this.dom.clear.css("display","none"),this.c.buttons.today||this.dom.today.css("display","none"),this._optionsTitle(),g(i).on("i18n.dt",function(t,e){e.oLanguage.datetime&&(g.extend(!0,o.c.i18n,e.oLanguage.datetime),o._optionsTitle())}),"hidden"===this.dom.input.attr("type")&&(this.dom.container.addClass("inline"),this.c.attachTo="input",this.val(this.dom.input.val(),!1),this._show()),e&&this.val(e,!1),this.dom.input.attr("autocomplete","off").on("focus.datetime click.datetime",function(){o.dom.container.is(":visible")||o.dom.input.is(":disabled")||(o.val(o.dom.input.val(),!1),o._show())}).on("keyup.datetime",function(){o.dom.container.is(":visible")&&o.val(o.dom.input.val(),!1)}),this.dom.container[0].addEventListener("focusin",function(t){t.stopPropagation()}),this.dom.container.on("change","select",function(){var t,e,s=g(this),i=s.val();s.hasClass(r+"-month")?(o._correctMonth(o.s.display,i),o._setTitle(),o._setCalander()):s.hasClass(r+"-year")?(o.s.display.setUTCFullYear(i),o._setTitle(),o._setCalander()):s.hasClass(r+"-hours")||s.hasClass(r+"-ampm")?(o.s.parts.hours12?(t=+g(o.dom.container).find("."+r+"-hours").val(),e="pm"===g(o.dom.container).find("."+r+"-ampm").val(),o.s.d.setUTCHours(12!=t||e?e&&12!=t?12+t:t:0)):o.s.d.setUTCHours(i),o._setTime(),o._writeOutput(!0),a()):s.hasClass(r+"-minutes")?(o.s.d.setUTCMinutes(i),o._setTime(),o._writeOutput(!0),a()):s.hasClass(r+"-seconds")&&(o.s.d.setSeconds(i),o._setTime(),o._writeOutput(!0),a()),o.dom.input.focus(),o._position()}).on("click",function(t){var e=o.s.d,s="span"===t.target.nodeName.toLowerCase()?t.target.parentNode:t.target,i=s.nodeName.toLowerCase();if("select"!==i)if(t.stopPropagation(),"a"===i&&(t.preventDefault(),g(s).hasClass(r+"-clear")?(o.s.d=null,o.dom.input.val(""),o._writeOutput(),o._setCalander(),o._setTime(),a()):g(s).hasClass(r+"-today")&&(o.s.display=new Date,o._setTitle(),o._setCalander())),"button"===i){t=g(s),i=t.parent();if(i.hasClass("disabled")&&!i.hasClass("range"))t.blur();else if(i.hasClass(r+"-iconLeft"))o.s.display.setUTCMonth(o.s.display.getUTCMonth()-1),o._setTitle(),o._setCalander(),o.dom.input.focus();else if(i.hasClass(r+"-iconRight"))o._correctMonth(o.s.display,o.s.display.getUTCMonth()+1),o._setTitle(),o._setCalander(),o.dom.input.focus();else{if(t.parents("."+r+"-time").length){var s=t.data("value"),n=t.data("unit"),e=o._needValue();if("minutes"===n){if(i.hasClass("disabled")&&i.hasClass("range"))return o.s.minutesRange=s,void o._setTime();o.s.minutesRange=null}if("seconds"===n){if(i.hasClass("disabled")&&i.hasClass("range"))return o.s.secondsRange=s,void o._setTime();o.s.secondsRange=null}if("am"===s){if(!(12<=e.getUTCHours()))return;s=e.getUTCHours()-12}else if("pm"===s){if(!(e.getUTCHours()<12))return;s=e.getUTCHours()+12}e["hours"===n?"setUTCHours":"minutes"===n?"setUTCMinutes":"setSeconds"](s),o._setCalander(),o._setTime(),o._writeOutput(!0)}else(e=o._needValue()).setUTCDate(1),e.setUTCFullYear(t.data("year")),e.setUTCMonth(t.data("month")),e.setUTCDate(t.data("day")),o._writeOutput(!0),o.s.parts.time?(o._setCalander(),o._setTime()):setTimeout(function(){o._hide()},10);a()}}else o.dom.input.focus()})},_compareDates:function(t,e){return this._isLuxon()?a.DateTime.fromJSDate(t).toUTC().toISODate()===a.DateTime.fromJSDate(e).toUTC().toISODate():this._dateToUtcString(t)===this._dateToUtcString(e)},_convert:function(t,e,s){var i;return t&&(a?this._isLuxon()?(i=t instanceof Date?a.DateTime.fromJSDate(t).toUTC():a.DateTime.fromFormat(t,e)).isValid?s?i.toFormat(s):i.toJSDate():null:(i=t instanceof Date?a.utc(t,void 0,this.c.locale,this.c.strict):a(t,e,this.c.locale,this.c.strict)).isValid()?s?i.format(s):i.toDate():null:!e&&!s||e&&s?t:e?(i=t.match(/(\d{4})\-(\d{2})\-(\d{2})/))?new Date(i[1],i[2]-1,i[3]):null:t.getUTCFullYear()+"-"+this._pad(t.getUTCMonth()+1)+"-"+this._pad(t.getUTCDate()))},_correctMonth:function(t,e){var s=this._daysInMonth(t.getUTCFullYear(),e),i=t.getUTCDate()>s;t.setUTCMonth(e),i&&(t.setUTCDate(s),t.setUTCMonth(e))},_daysInMonth:function(t,e){return[31,t%4==0&&(t%100!=0||t%400==0)?29:28,31,30,31,30,31,31,30,31,30,31][e]},_dateToUtc:function(t){return t&&new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds()))},_dateToUtcString:function(t){return this._isLuxon()?a.DateTime.fromJSDate(t).toUTC().toISODate():t.getUTCFullYear()+"-"+this._pad(t.getUTCMonth()+1)+"-"+this._pad(t.getUTCDate())},_hide:function(t){!t&&"hidden"===this.dom.input.attr("type")||(t=this.s.namespace,this.dom.container.detach(),g(o).off("."+t),g(i).off("keydown."+t),g("div.dataTables_scrollBody").off("scroll."+t),g("div.DTE_Body_Content").off("scroll."+t),g(i).off("click."+t),g(this.dom.input[0].offsetParent).off("."+t))},_hours24To12:function(t){return 0===t?12:12<t?t-12:t},_htmlDay:function(t){var e,s;return t.empty?'<td class="empty"></td>':(e=["selectable"],s=this.c.classPrefix,t.disabled&&e.push("disabled"),t.today&&e.push("now"),t.selected&&e.push("selected"),'<td data-day="'+t.day+'" class="'+e.join(" ")+'"><button class="'+s+"-button "+s+'-day" type="button" data-year="'+t.year+'" data-month="'+t.month+'" data-day="'+t.day+'"><span>'+t.day+"</span></button></td>")},_htmlMonth:function(t,e){for(var s=this._dateToUtc(new Date),i=this._daysInMonth(t,e),n=new Date(Date.UTC(t,e,1)).getUTCDay(),a=[],o=[],r=(0<this.c.firstDay&&(n-=this.c.firstDay)<0&&(n+=7),i+n),d=r;7<d;)d-=7;r+=7-d;var l=this.c.minDate,h=this.c.maxDate;l&&(l.setUTCHours(0),l.setUTCMinutes(0),l.setSeconds(0)),h&&(h.setUTCHours(23),h.setUTCMinutes(59),h.setSeconds(59));for(var u=0,c=0;u<r;u++){var m=new Date(Date.UTC(t,e,u-n+1)),f=!!this.s.d&&this._compareDates(m,this.s.d),p=this._compareDates(m,s),y=u<n||i+n<=u,T=l&&m<l||h&&h<m,v=this.c.disableDays,f={day:u-n+1,month:e,year:t,selected:f,today:p,disabled:T=Array.isArray(v)&&-1!==g.inArray(m.getUTCDay(),v)||"function"==typeof v&&!0===v(m)?!0:T,empty:y};o.push(this._htmlDay(f)),7==++c&&(this.c.showWeekNumber&&o.unshift(this._htmlWeekOfYear(u-n,e,t)),a.push("<tr>"+o.join("")+"</tr>"),o=[],c=0)}var _,D=this.c.classPrefix,C=D+"-table";return this.c.showWeekNumber&&(C+=" weekNumber"),l&&(_=l>=new Date(Date.UTC(t,e,1,0,0,0)),this.dom.title.find("div."+D+"-iconLeft").css("display",_?"none":"block")),h&&(_=h<new Date(Date.UTC(t,e+1,1,0,0,0)),this.dom.title.find("div."+D+"-iconRight").css("display",_?"none":"block")),'<table class="'+C+'"><thead>'+this._htmlMonthHead()+"</thead><tbody>"+a.join("")+"</tbody></table>"},_htmlMonthHead:function(){var t=[],e=this.c.firstDay,s=this.c.i18n;this.c.showWeekNumber&&t.push("<th></th>");for(var i=0;i<7;i++)t.push("<th>"+function(t){for(t+=e;7<=t;)t-=7;return s.weekdays[t]}(i)+"</th>");return t.join("")},_htmlWeekOfYear:function(t,e,s){e=new Date(s,e,t,0,0,0,0),e.setDate(e.getDate()+4-(e.getDay()||7)),t=new Date(s,0,1),s=Math.ceil(((e-t)/864e5+1)/7);return'<td class="'+this.c.classPrefix+'-week">'+s+"</td>"},_isLuxon:function(){return!!(a&&a.DateTime&&a.Duration&&a.Settings)},_needValue:function(){return this.s.d||(this.s.d=this._dateToUtc(new Date),this.s.parts.time)||(this.s.d.setUTCHours(0),this.s.d.setUTCMinutes(0),this.s.d.setSeconds(0),this.s.d.setMilliseconds(0)),this.s.d},_options:function(t,e,s){s=s||e;var i=this.dom.container.find("select."+this.c.classPrefix+"-"+t);i.empty();for(var n=0,a=e.length;n<a;n++)i.append('<option value="'+e[n]+'">'+s[n]+"</option>")},_optionSet:function(t,e){var t=this.dom.container.find("select."+this.c.classPrefix+"-"+t),s=t.parent().children("span"),e=(t.val(e),t.find("option:selected"));s.html(0!==e.length?e.text():this.c.i18n.unknown)},_optionsTime:function(n,a,o,r,t){var e,d=this.c.classPrefix,s=this.dom.container.find("div."+d+"-"+n),i=12===a?function(t){return t}:this._pad,l=d+"-table",h=this.c.i18n;if(s.length){var u="",c=10,m=function(t,e,s){12===a&&"number"==typeof t&&(12<=o&&(t+=12),12==t?t=0:24==t&&(t=12));var i=o===t||"am"===t&&o<12||"pm"===t&&12<=o?"selected":"";return"number"==typeof t&&r&&-1===g.inArray(t,r)&&(i+=" disabled"),s&&(i+=" "+s),'<td class="selectable '+i+'"><button class="'+d+"-button "+d+'-day" type="button" data-unit="'+n+'" data-value="'+t+'"><span>'+e+"</span></button></td>"};if(12===a){for(u+="<tr>",e=1;e<=6;e++)u+=m(e,i(e));for(u=(u+=m("am",h.amPm[0]))+"</tr>"+"<tr>",e=7;e<=12;e++)u+=m(e,i(e));u=u+m("pm",h.amPm[1])+"</tr>",c=7}else{if(24===a)for(var f=0,p=0;p<4;p++){for(u+="<tr>",e=0;e<6;e++)u+=m(f,i(f)),f++;u+="</tr>"}else{for(u+="<tr>",p=0;p<60;p+=10)u+=m(p,i(p),"range");var u=u+"</tr>"+('</tbody></thead><table class="'+l+" "+l+'-nospace"><tbody>'),y=null!==t?t:-1===o?0:10*Math.floor(o/10);for(u+="<tr>",p=y+1;p<y+10;p++)u+=m(p,i(p));u+="</tr>"}c=6}s.empty().append('<table class="'+l+'"><thead><tr><th colspan="'+c+'">'+h[n]+"</th></tr></thead><tbody>"+u+"</tbody></table>")}},_optionsTitle:function(){var t=this.c.i18n,e=this.c.minDate,s=this.c.maxDate,e=e?e.getFullYear():null,s=s?s.getFullYear():null,e=null!==e?e:(new Date).getFullYear()-this.c.yearRange,s=null!==s?s:(new Date).getFullYear()+this.c.yearRange;this._options("month",this._range(0,11),t.months),this._options("year",this._range(e,s)),this.dom.today.text(t.today).text(t.today),this.dom.clear.text(t.clear).text(t.clear),this.dom.previous.attr("title",t.previous).children("button").text(t.previous),this.dom.next.attr("title",t.next).children("button").text(t.next)},_pad:function(t){return t<10?"0"+t:t},_position:function(){var t,e,s,i="input"===this.c.attachTo?this.dom.input.position():this.dom.input.offset(),n=this.dom.container,a=this.dom.input.outerHeight();n.hasClass("inline")?n.insertAfter(this.dom.input):(this.s.parts.date&&this.s.parts.time&&550<g(o).width()?n.addClass("horizontal"):n.removeClass("horizontal"),"input"===this.c.attachTo?n.css({top:i.top+a,left:i.left}).insertAfter(this.dom.input):n.css({top:i.top+a,left:i.left}).appendTo("body"),t=n.outerHeight(),e=n.outerWidth(),s=g(o).scrollTop(),i.top+a+t-s>g(o).height()&&(a=i.top-t,n.css("top",a<0?0:a)),e+i.left>g(o).width()&&(s=g(o).width()-e-5,"input"===this.c.attachTo&&(s-=g(n).offsetParent().offset().left),n.css("left",s<0?0:s)))},_range:function(t,e,s){var i=[];s=s||1;for(var n=t;n<=e;n+=s)i.push(n);return i},_setCalander:function(){this.s.display&&this.dom.calendar.empty().append(this._htmlMonth(this.s.display.getUTCFullYear(),this.s.display.getUTCMonth()))},_setTitle:function(){this._optionSet("month",this.s.display.getUTCMonth()),this._optionSet("year",this.s.display.getUTCFullYear())},_setTime:function(){function t(t){return e.c[t+"Available"]||e._range(0,59,e.c[t+"Increment"])}var e=this,s=this.s.d,i=null,n=null!=(i=this._isLuxon()?a.DateTime.fromJSDate(s).toUTC():i)?i.hour:s?s.getUTCHours():-1;this._optionsTime("hours",this.s.parts.hours12?12:24,n,this.c.hoursAvailable),this._optionsTime("minutes",60,null!=i?i.minute:s?s.getUTCMinutes():-1,t("minutes"),this.s.minutesRange),this._optionsTime("seconds",60,null!=i?i.second:s?s.getSeconds():-1,t("seconds"),this.s.secondsRange)},_show:function(){var e=this,t=this.s.namespace,s=(this._position(),g(o).on("scroll."+t+" resize."+t,function(){e._position()}),g("div.DTE_Body_Content").on("scroll."+t,function(){e._position()}),g("div.dataTables_scrollBody").on("scroll."+t,function(){e._position()}),this.dom.input[0].offsetParent);s!==i.body&&g(s).on("scroll."+t,function(){e._position()}),g(i).on("keydown."+t,function(t){9!==t.keyCode&&27!==t.keyCode&&13!==t.keyCode||e._hide()}),setTimeout(function(){g(i).on("click."+t,function(t){g(t.target).parents().filter(e.dom.container).length||t.target===e.dom.input[0]||e._hide()})},10)},_writeOutput:function(t){var e=this.s.d,s="",i=this.dom.input,e=(e&&(s=this._convert(e,null,this.c.format)),i.val(s),new Event("change",{bubbles:!0}));i[0].dispatchEvent(e),"hidden"===i.attr("type")&&this.val(s,!1),t&&i.focus()}}),n.use=function(t){a=t},n._instance=0,n.type="DateTime",n.defaults={attachTo:"body",buttons:{clear:!1,today:!1},classPrefix:"dt-datetime",disableDays:null,firstDay:1,format:"YYYY-MM-DD",hoursAvailable:null,i18n:{clear:"Clear",previous:"Previous",next:"Next",months:["January","February","March","April","May","June","July","August","September","October","November","December"],weekdays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],amPm:["am","pm"],hours:"Hour",minutes:"Minute",seconds:"Second",unknown:"-",today:"Today"},maxDate:null,minDate:null,minutesAvailable:null,minutesIncrement:1,strict:!0,locale:"en",onChange:function(){},secondsAvailable:null,secondsIncrement:1,showWeekNumber:!1,yearRange:25},n.version="1.5.4",n.factory=function(t,e){var s=!1;return t&&t.document&&(i=(o=t).document),e&&e.fn&&e.fn.jquery&&(g=e,s=!0),s},o.DateTime||(o.DateTime=n),o.DataTable&&(o.DataTable.DateTime=n),g.fn.dtDateTime=function(t){return this.each(function(){new n(this,t)})},g.fn.dataTable&&(g.fn.dataTable.DateTime=n,g.fn.DataTable.DateTime=n,g.fn.dataTable.Editor)&&(g.fn.dataTable.Editor.DateTime=n),n});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Select for DataTables 2.0
|
|
1
|
+
/*! Select for DataTables 2.1.0
|
|
2
2
|
* © SpryMedia Ltd - datatables.net/license/mit
|
|
3
3
|
*/
|
|
4
4
|
|
|
@@ -56,7 +56,7 @@ DataTable.select.classes = {
|
|
|
56
56
|
checkbox: 'dt-select-checkbox'
|
|
57
57
|
};
|
|
58
58
|
|
|
59
|
-
DataTable.select.version = '2.0
|
|
59
|
+
DataTable.select.version = '2.1.0';
|
|
60
60
|
|
|
61
61
|
DataTable.select.init = function (dt) {
|
|
62
62
|
var ctx = dt.settings()[0];
|
|
@@ -126,6 +126,7 @@ DataTable.select.init = function (dt) {
|
|
|
126
126
|
var style = 'api';
|
|
127
127
|
var blurable = false;
|
|
128
128
|
var toggleable = true;
|
|
129
|
+
var selectable = null;
|
|
129
130
|
var info = true;
|
|
130
131
|
var selector = 'td, th';
|
|
131
132
|
var className = 'selected';
|
|
@@ -182,6 +183,10 @@ DataTable.select.init = function (dt) {
|
|
|
182
183
|
if (opts.headerCheckbox !== undefined) {
|
|
183
184
|
headerCheckbox = opts.headerCheckbox;
|
|
184
185
|
}
|
|
186
|
+
|
|
187
|
+
if (opts.selectable !== undefined) {
|
|
188
|
+
selectable = opts.selectable;
|
|
189
|
+
}
|
|
185
190
|
}
|
|
186
191
|
|
|
187
192
|
dt.select.selector(selector);
|
|
@@ -190,6 +195,7 @@ DataTable.select.init = function (dt) {
|
|
|
190
195
|
dt.select.blurable(blurable);
|
|
191
196
|
dt.select.toggleable(toggleable);
|
|
192
197
|
dt.select.info(info);
|
|
198
|
+
dt.select.selectable(selectable);
|
|
193
199
|
ctx._select.className = className;
|
|
194
200
|
|
|
195
201
|
// If the init options haven't enabled select, but there is a selectable
|
|
@@ -199,11 +205,9 @@ DataTable.select.init = function (dt) {
|
|
|
199
205
|
}
|
|
200
206
|
|
|
201
207
|
// Insert a checkbox into the header if needed - might need to wait
|
|
202
|
-
// for init complete
|
|
208
|
+
// for init complete
|
|
203
209
|
if (headerCheckbox || headerCheckbox === 'select-page' || headerCheckbox === 'select-all') {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
dt.on('init', function () {
|
|
210
|
+
dt.ready(function () {
|
|
207
211
|
initCheckboxHeader(dt, headerCheckbox);
|
|
208
212
|
});
|
|
209
213
|
}
|
|
@@ -570,9 +574,13 @@ function info(api, node) {
|
|
|
570
574
|
return;
|
|
571
575
|
}
|
|
572
576
|
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
577
|
+
// If _select_set has any length, then ids are available and should be used
|
|
578
|
+
// as the counter. Otherwise use the API to workout how many rows are
|
|
579
|
+
// selected.
|
|
580
|
+
var rowSetLength = api.settings()[0]._select_set.length;
|
|
581
|
+
var rows = rowSetLength ? rowSetLength : api.rows({ selected: true }).count();
|
|
582
|
+
var columns = api.columns({ selected: true }).count();
|
|
583
|
+
var cells = api.cells({ selected: true }).count();
|
|
576
584
|
|
|
577
585
|
var add = function (el, name, num) {
|
|
578
586
|
el.append(
|
|
@@ -612,7 +620,8 @@ function info(api, node) {
|
|
|
612
620
|
* @param {*} headerCheckbox the header checkbox option
|
|
613
621
|
*/
|
|
614
622
|
function initCheckboxHeader( dt, headerCheckbox ) {
|
|
615
|
-
var
|
|
623
|
+
var dtSettings = dt.settings()[0];
|
|
624
|
+
var dtInternalColumns = dtSettings.aoColumns;
|
|
616
625
|
|
|
617
626
|
// Find any checkbox column(s)
|
|
618
627
|
dt.columns().iterator('column', function (s, idx) {
|
|
@@ -636,33 +645,36 @@ function initCheckboxHeader( dt, headerCheckbox ) {
|
|
|
636
645
|
.on('change', function () {
|
|
637
646
|
if (this.checked) {
|
|
638
647
|
if (headerCheckbox == 'select-page') {
|
|
639
|
-
dt.rows({page: 'current'}).select()
|
|
648
|
+
dt.rows({page: 'current'}).select();
|
|
640
649
|
} else {
|
|
641
650
|
dt.rows({search: 'applied'}).select();
|
|
642
651
|
}
|
|
643
652
|
}
|
|
644
653
|
else {
|
|
645
|
-
|
|
654
|
+
if (headerCheckbox == 'select-page') {
|
|
655
|
+
dt.rows({page: 'current', selected: true}).deselect();
|
|
656
|
+
}
|
|
657
|
+
else {
|
|
658
|
+
dt.rows({selected: true}).deselect();
|
|
659
|
+
}
|
|
646
660
|
}
|
|
647
661
|
})
|
|
648
662
|
.on('click', function (e) {
|
|
649
663
|
e.stopPropagation();
|
|
650
664
|
});
|
|
651
|
-
|
|
665
|
+
|
|
652
666
|
// Update the header checkbox's state when the selection in the
|
|
653
667
|
// table changes
|
|
654
668
|
dt.on('draw select deselect', function (e, pass, type) {
|
|
655
669
|
if (type === 'row' || ! type) {
|
|
656
|
-
var
|
|
657
|
-
var search = dt.rows({search: 'applied', selected: true}).count();
|
|
658
|
-
var available = headerCheckbox == 'select-page' ? dt.rows({page: 'current'}).count() : dt.rows({search: 'applied'}).count();
|
|
670
|
+
var nums = headerCheckboxState(dt, headerCheckbox);
|
|
659
671
|
|
|
660
|
-
if (search && search <= count && search === available) {
|
|
672
|
+
if (nums.search && nums.search <= nums.count && nums.search === nums.available) {
|
|
661
673
|
input
|
|
662
674
|
.prop('checked', true)
|
|
663
675
|
.prop('indeterminate', false);
|
|
664
676
|
}
|
|
665
|
-
else if (search === 0 && count === 0) {
|
|
677
|
+
else if (nums.search === 0 && nums.count === 0) {
|
|
666
678
|
input
|
|
667
679
|
.prop('checked', false)
|
|
668
680
|
.prop('indeterminate', false);
|
|
@@ -678,6 +690,54 @@ function initCheckboxHeader( dt, headerCheckbox ) {
|
|
|
678
690
|
});
|
|
679
691
|
}
|
|
680
692
|
|
|
693
|
+
/**
|
|
694
|
+
* Determine the counts used to define the header checkbox's state
|
|
695
|
+
*
|
|
696
|
+
* @param {*} dt DT API
|
|
697
|
+
* @param {*} headerCheckbox Configuration for what the header checkbox does
|
|
698
|
+
* @returns Counts object
|
|
699
|
+
*/
|
|
700
|
+
function headerCheckboxState(dt, headerCheckbox) {
|
|
701
|
+
var ctx = dt.settings()[0];
|
|
702
|
+
var selectable = ctx._select.selectable;
|
|
703
|
+
var available = 0;
|
|
704
|
+
var count = headerCheckbox == 'select-page'
|
|
705
|
+
? dt.rows({page: 'current', selected: true}).count()
|
|
706
|
+
: dt.rows({selected: true}).count();
|
|
707
|
+
var search = headerCheckbox == 'select-page'
|
|
708
|
+
? dt.rows({page: 'current', selected: true}).count()
|
|
709
|
+
: dt.rows({search: 'applied', selected: true}).count();
|
|
710
|
+
|
|
711
|
+
if (! selectable) {
|
|
712
|
+
available = headerCheckbox == 'select-page'
|
|
713
|
+
? dt.rows({page: 'current'}).count()
|
|
714
|
+
: dt.rows({search: 'applied'}).count();
|
|
715
|
+
}
|
|
716
|
+
else {
|
|
717
|
+
// Need to count how many rows are actually selectable to know if all selectable
|
|
718
|
+
// rows are selected or not
|
|
719
|
+
var indexes = headerCheckbox == 'select-page'
|
|
720
|
+
? dt.rows({page: 'current'}).indexes()
|
|
721
|
+
: dt.rows({search: 'applied'}).indexes();
|
|
722
|
+
|
|
723
|
+
for (var i=0 ; i<indexes.length ; i++) {
|
|
724
|
+
// For speed I use the internal DataTables object.
|
|
725
|
+
var rowInternal = ctx.aoData[indexes[i]];
|
|
726
|
+
var result = selectable(rowInternal._aData, rowInternal.nTr, indexes[i]);
|
|
727
|
+
|
|
728
|
+
if (result) {
|
|
729
|
+
available++;
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
return {
|
|
735
|
+
available: available,
|
|
736
|
+
count: count,
|
|
737
|
+
search: search
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
|
|
681
741
|
/**
|
|
682
742
|
* Initialisation of a new table. Attach event handlers and callbacks to allow
|
|
683
743
|
* Select to operate correctly.
|
|
@@ -692,6 +752,9 @@ function init(ctx) {
|
|
|
692
752
|
var api = new DataTable.Api(ctx);
|
|
693
753
|
ctx._select_init = true;
|
|
694
754
|
|
|
755
|
+
// _select_set contains a list of the ids of all rows that are selected
|
|
756
|
+
ctx._select_set = [];
|
|
757
|
+
|
|
695
758
|
// Row callback so that classes can be added to rows and cells if the item
|
|
696
759
|
// was selected before the element was created. This will happen with the
|
|
697
760
|
// `deferRender` option enabled.
|
|
@@ -702,9 +765,15 @@ function init(ctx) {
|
|
|
702
765
|
ctx.aoRowCreatedCallback.push(function (row, data, index) {
|
|
703
766
|
var i, ien;
|
|
704
767
|
var d = ctx.aoData[index];
|
|
768
|
+
var id = api.row(index).id();
|
|
705
769
|
|
|
706
770
|
// Row
|
|
707
|
-
if (
|
|
771
|
+
if (
|
|
772
|
+
d._select_selected ||
|
|
773
|
+
(id !== 'undefined' && ctx._select_set.includes(id))
|
|
774
|
+
) {
|
|
775
|
+
d._select_selected = true;
|
|
776
|
+
|
|
708
777
|
$(row)
|
|
709
778
|
.addClass(ctx._select.className)
|
|
710
779
|
.find('input.' + checkboxClass(true)).prop('checked', true);
|
|
@@ -723,46 +792,7 @@ function init(ctx) {
|
|
|
723
792
|
}
|
|
724
793
|
);
|
|
725
794
|
|
|
726
|
-
|
|
727
|
-
// if there is an rowId (i.e. a unique value to identify each row with)
|
|
728
|
-
api.on('preXhr.dt.dtSelect', function (e, settings) {
|
|
729
|
-
if (settings !== api.settings()[0]) {
|
|
730
|
-
// Not triggered by our DataTable!
|
|
731
|
-
return;
|
|
732
|
-
}
|
|
733
|
-
|
|
734
|
-
// note that column selection doesn't need to be cached and then
|
|
735
|
-
// reselected, as they are already selected
|
|
736
|
-
var rows = api
|
|
737
|
-
.rows({ selected: true })
|
|
738
|
-
.ids(true)
|
|
739
|
-
.filter(function (d) {
|
|
740
|
-
return d !== undefined;
|
|
741
|
-
});
|
|
742
|
-
|
|
743
|
-
var cells = api
|
|
744
|
-
.cells({ selected: true })
|
|
745
|
-
.eq(0)
|
|
746
|
-
.map(function (cellIdx) {
|
|
747
|
-
var id = api.row(cellIdx.row).id(true);
|
|
748
|
-
return id ? { row: id, column: cellIdx.column } : undefined;
|
|
749
|
-
})
|
|
750
|
-
.filter(function (d) {
|
|
751
|
-
return d !== undefined;
|
|
752
|
-
});
|
|
753
|
-
|
|
754
|
-
// On the next draw, reselect the currently selected items
|
|
755
|
-
api.one('draw.dt.dtSelect', function () {
|
|
756
|
-
api.rows(rows).select();
|
|
757
|
-
|
|
758
|
-
// `cells` is not a cell index selector, so it needs a loop
|
|
759
|
-
if (cells.any()) {
|
|
760
|
-
cells.each(function (id) {
|
|
761
|
-
api.cells(id.row, id.column).select();
|
|
762
|
-
});
|
|
763
|
-
}
|
|
764
|
-
});
|
|
765
|
-
});
|
|
795
|
+
_cumulativeEvents(api);
|
|
766
796
|
|
|
767
797
|
// Update the table information element with selected item summary
|
|
768
798
|
api.on('info.dt', function (e, ctx, node) {
|
|
@@ -935,6 +965,57 @@ function _safeId(node) {
|
|
|
935
965
|
return node.id.replace(/[^a-zA-Z0-9\-\_]/g, '-');
|
|
936
966
|
}
|
|
937
967
|
|
|
968
|
+
/**
|
|
969
|
+
* Set up event handlers for cumulative selection
|
|
970
|
+
*
|
|
971
|
+
* @param {*} api DT API instance
|
|
972
|
+
*/
|
|
973
|
+
function _cumulativeEvents(api) {
|
|
974
|
+
// Add event listeners to add / remove from the _select_set
|
|
975
|
+
api.on('select', function (e, dt, type, indexes) {
|
|
976
|
+
// Only support for rows at the moment
|
|
977
|
+
if (type !== 'row') {
|
|
978
|
+
return;
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
var ctx = api.settings()[0];
|
|
982
|
+
|
|
983
|
+
_add(api, ctx._select_set, indexes);
|
|
984
|
+
});
|
|
985
|
+
|
|
986
|
+
api.on('deselect', function (e, dt, type, indexes) {
|
|
987
|
+
// Only support for rows at the moment
|
|
988
|
+
if (type !== 'row') {
|
|
989
|
+
return;
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
var ctx = api.settings()[0];
|
|
993
|
+
|
|
994
|
+
_remove(api, ctx._select_set, indexes);
|
|
995
|
+
});
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
function _add(api, arr, indexes) {
|
|
999
|
+
for (var i=0 ; i<indexes.length ; i++) {
|
|
1000
|
+
var id = api.row(indexes[i]).id();
|
|
1001
|
+
|
|
1002
|
+
if (id && id !== 'undefined' && ! arr.includes(id)) {
|
|
1003
|
+
arr.push(id);
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
function _remove(api, arr, indexes) {
|
|
1009
|
+
for (var i=0 ; i<indexes.length ; i++) {
|
|
1010
|
+
var id = api.row(indexes[i]).id();
|
|
1011
|
+
var idx = arr.indexOf(id);
|
|
1012
|
+
|
|
1013
|
+
if (idx !== -1) {
|
|
1014
|
+
arr.splice(idx, 1);
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
|
|
938
1019
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
939
1020
|
* DataTables selectors
|
|
940
1021
|
*/
|
|
@@ -1083,10 +1164,15 @@ apiRegister('select.style()', function (style) {
|
|
|
1083
1164
|
// Add / remove mouse event handlers. They aren't required when only
|
|
1084
1165
|
// API selection is available
|
|
1085
1166
|
var dt = new DataTable.Api(ctx);
|
|
1086
|
-
disableMouseSelection(dt);
|
|
1087
1167
|
|
|
1088
1168
|
if (style !== 'api') {
|
|
1089
|
-
|
|
1169
|
+
dt.ready(function () {
|
|
1170
|
+
disableMouseSelection(dt);
|
|
1171
|
+
enableMouseSelection(dt);
|
|
1172
|
+
});
|
|
1173
|
+
}
|
|
1174
|
+
else {
|
|
1175
|
+
disableMouseSelection(dt);
|
|
1090
1176
|
}
|
|
1091
1177
|
|
|
1092
1178
|
eventTrigger(new DataTable.Api(ctx), 'selectStyle', [style]);
|
|
@@ -1099,16 +1185,36 @@ apiRegister('select.selector()', function (selector) {
|
|
|
1099
1185
|
}
|
|
1100
1186
|
|
|
1101
1187
|
return this.iterator('table', function (ctx) {
|
|
1102
|
-
|
|
1188
|
+
var dt = new DataTable.Api(ctx);
|
|
1189
|
+
var style = ctx._select.style;
|
|
1190
|
+
|
|
1191
|
+
disableMouseSelection(dt);
|
|
1103
1192
|
|
|
1104
1193
|
ctx._select.selector = selector;
|
|
1105
1194
|
|
|
1106
|
-
if (
|
|
1107
|
-
|
|
1195
|
+
if (style && style !== 'api') {
|
|
1196
|
+
dt.ready(function () {
|
|
1197
|
+
disableMouseSelection(dt);
|
|
1198
|
+
enableMouseSelection(dt);
|
|
1199
|
+
});
|
|
1200
|
+
}
|
|
1201
|
+
else {
|
|
1202
|
+
disableMouseSelection(dt);
|
|
1108
1203
|
}
|
|
1109
1204
|
});
|
|
1110
1205
|
});
|
|
1111
1206
|
|
|
1207
|
+
apiRegister('select.selectable()', function (set) {
|
|
1208
|
+
let ctx = this.context[0];
|
|
1209
|
+
|
|
1210
|
+
if (set) {
|
|
1211
|
+
ctx._select.selectable = set;
|
|
1212
|
+
return this;
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
return ctx._select.selectable;
|
|
1216
|
+
});
|
|
1217
|
+
|
|
1112
1218
|
apiRegister('select.last()', function (set) {
|
|
1113
1219
|
let ctx = this.context[0];
|
|
1114
1220
|
|
|
@@ -1120,8 +1226,17 @@ apiRegister('select.last()', function (set) {
|
|
|
1120
1226
|
return ctx._select_lastCell;
|
|
1121
1227
|
});
|
|
1122
1228
|
|
|
1229
|
+
apiRegister('select.cumulative()', function () {
|
|
1230
|
+
let ctx = this.context[0];
|
|
1231
|
+
|
|
1232
|
+
return ctx && ctx._select_set
|
|
1233
|
+
? ctx._select_set
|
|
1234
|
+
: [];
|
|
1235
|
+
});
|
|
1236
|
+
|
|
1123
1237
|
apiRegisterPlural('rows().select()', 'row().select()', function (select) {
|
|
1124
1238
|
var api = this;
|
|
1239
|
+
var selectedIndexes = [];
|
|
1125
1240
|
|
|
1126
1241
|
if (select === false) {
|
|
1127
1242
|
return this.deselect();
|
|
@@ -1136,9 +1251,20 @@ apiRegisterPlural('rows().select()', 'row().select()', function (select) {
|
|
|
1136
1251
|
var dtData = ctx.aoData[idx];
|
|
1137
1252
|
var dtColumns = ctx.aoColumns;
|
|
1138
1253
|
|
|
1254
|
+
if (ctx._select.selectable) {
|
|
1255
|
+
var result = ctx._select.selectable(dtData._aData, dtData.nTr, idx);
|
|
1256
|
+
|
|
1257
|
+
if (result === false) {
|
|
1258
|
+
// Not selectable - do nothing
|
|
1259
|
+
return;
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1139
1263
|
$(dtData.nTr).addClass(ctx._select.className);
|
|
1140
1264
|
dtData._select_selected = true;
|
|
1141
1265
|
|
|
1266
|
+
selectedIndexes.push(idx);
|
|
1267
|
+
|
|
1142
1268
|
for (var i=0 ; i<dtColumns.length ; i++) {
|
|
1143
1269
|
var col = dtColumns[i];
|
|
1144
1270
|
|
|
@@ -1163,8 +1289,8 @@ apiRegisterPlural('rows().select()', 'row().select()', function (select) {
|
|
|
1163
1289
|
}
|
|
1164
1290
|
});
|
|
1165
1291
|
|
|
1166
|
-
this.iterator('table', function (
|
|
1167
|
-
eventTrigger(api, 'select', ['row',
|
|
1292
|
+
this.iterator('table', function (ct) {
|
|
1293
|
+
eventTrigger(api, 'select', ['row', selectedIndexes], true);
|
|
1168
1294
|
});
|
|
1169
1295
|
|
|
1170
1296
|
return this;
|
|
@@ -1526,6 +1652,8 @@ $.each(['Row', 'Column', 'Cell'], function (i, item) {
|
|
|
1526
1652
|
init: function (dt) {
|
|
1527
1653
|
var that = this;
|
|
1528
1654
|
|
|
1655
|
+
this.active(dt.select.items() === lc);
|
|
1656
|
+
|
|
1529
1657
|
dt.on('selectItems.dt.DT', function (e, ctx, items) {
|
|
1530
1658
|
that.active(items === lc);
|
|
1531
1659
|
});
|
|
@@ -1576,8 +1704,18 @@ DataTable.render.select = function (valueProp, nameProp) {
|
|
|
1576
1704
|
var dtRow = meta.settings.aoData[meta.row];
|
|
1577
1705
|
var selected = dtRow._select_selected;
|
|
1578
1706
|
var ariaLabel = meta.settings.oLanguage.select.aria.rowCheckbox;
|
|
1707
|
+
var selectable = meta.settings._select.selectable;
|
|
1579
1708
|
|
|
1580
1709
|
if (type === 'display') {
|
|
1710
|
+
// Check if the row is selectable before showing the checkbox
|
|
1711
|
+
if (selectable) {
|
|
1712
|
+
var result = selectable(row, dtRow.nTr, meta.row);
|
|
1713
|
+
|
|
1714
|
+
if (result === false) {
|
|
1715
|
+
return '';
|
|
1716
|
+
}
|
|
1717
|
+
}
|
|
1718
|
+
|
|
1581
1719
|
return $('<input>')
|
|
1582
1720
|
.attr({
|
|
1583
1721
|
'aria-label': ariaLabel,
|
|
@@ -1636,11 +1774,10 @@ $.fn.DataTable.select = DataTable.select;
|
|
|
1636
1774
|
* Initialisation
|
|
1637
1775
|
*/
|
|
1638
1776
|
|
|
1639
|
-
// DataTables creation -
|
|
1640
|
-
//
|
|
1641
|
-
//
|
|
1642
|
-
|
|
1643
|
-
$(document).on('preInit.dt.dtSelect', function (e, ctx) {
|
|
1777
|
+
// DataTables creation - we need this to run _before_ data is read in, but
|
|
1778
|
+
// for backwards compat. we also run again on preInit. If it happens twice
|
|
1779
|
+
// it will simply do nothing the second time around.
|
|
1780
|
+
$(document).on('i18n.dt.dtSelect preInit.dt.dtSelect', function (e, ctx) {
|
|
1644
1781
|
if (e.namespace !== 'dt') {
|
|
1645
1782
|
return;
|
|
1646
1783
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Select for DataTables 2.0
|
|
1
|
+
/*! Select for DataTables 2.1.0
|
|
2
2
|
* © SpryMedia Ltd - datatables.net/license/mit
|
|
3
3
|
*/
|
|
4
|
-
!function(l){var s,c;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(e){return l(e,window,document)}):"object"==typeof exports?(s=require("jquery"),c=function(e,t){t.fn.dataTable||require("datatables.net")(e,t)},"undefined"==typeof window?module.exports=function(e,t){return e=e||window,t=t||s(e),c(e,t),l(t,e,e.document)}:(c(window,s),module.exports=l(s,window,window.document))):l(jQuery,window,document)}(function(m,i,e){"use strict";var _=m.fn.dataTable;function r(n,e,t){function l(t,l){l<t&&(e=l,l=t,t=e);var e,s=!1;return n.columns(":visible").indexes().filter(function(e){return e===t&&(s=!0),e===l?!(s=!1):s})}function s(t,l){var e,s=n.rows({search:"applied"}).indexes(),c=(s.indexOf(t)>s.indexOf(l)&&(e=l,l=t,t=e),!1);return s.filter(function(e){return e===t&&(c=!0),e===l?!(c=!1):c})}var c,t=n.cells({selected:!0}).any()||t?(c=l(t.column,e.column),s(t.row,e.row)):(c=l(0,e.column),s(0,e.row)),t=n.cells(t,c).flatten();n.cells(e,{selected:!0}).any()?n.cells(t).deselect():n.cells(t).select()}function u(e){var t=_.select.classes.checkbox;return e?t.replace(/ /g,"."):t}function s(e){var t=e.settings()[0]._select.selector;m(e.table().container()).off("mousedown.dtSelect",t).off("mouseup.dtSelect",t).off("click.dtSelect",t),m("body").off("click.dtSelect"+b(e.table().node()))}function n(o){var a,t=m(o.table().container()),l=o.settings()[0],s=l._select.selector;t.on("mousedown.dtSelect",s,function(e){(e.shiftKey||e.metaKey||e.ctrlKey)&&t.css("-moz-user-select","none").one("selectstart.dtSelect",s,function(){return!1}),i.getSelection&&(a=i.getSelection())}).on("mouseup.dtSelect",s,function(){t.css("-moz-user-select","")}).on("click.dtSelect",s,function(e){var t,l=o.select.items();if(a){var s=i.getSelection();if((!s.anchorNode||m(s.anchorNode).closest("table")[0]===o.table().node())&&s!==a)return}var c,s=o.settings()[0],n=o.table().container();m(e.target).closest("div.dt-container")[0]==n&&(n=o.cell(m(e.target).closest("td, th"))).any()&&(c=m.Event("user-select.dt"),d(o,c,[l,n,e]),c.isDefaultPrevented()||(c=n.index(),"row"===l?(t=c.row,w(e,o,s,"row",t)):"column"===l?(t=n.index().column,w(e,o,s,"column",t)):"cell"===l&&(t=n.index(),w(e,o,s,"cell",t)),s._select_lastCell=c))}),m("body").on("click.dtSelect"+b(o.table().node()),function(e){var t;!l._select.blurable||m(e.target).parents().filter(o.table().container()).length||0===m(e.target).parents("html").length||m(e.target).parents("div.DTE").length||(t=m.Event("select-blur.dt"),d(o,t,[e.target,e]),t.isDefaultPrevented())||v(l,!0)})}function d(e,t,l,s){s&&!e.flatten().length||("string"==typeof t&&(t+=".dt"),l.unshift(e),m(e.table().node()).trigger(t,l))}function f(e){return e.mRender&&"selectCheckbox"===e.mRender._name}function a(s,e){var t,l,c,n,o;"api"!==s.select.style()&&!1!==s.select.info()&&(o=s.rows({selected:!0}).flatten().length,t=s.columns({selected:!0}).flatten().length,l=s.cells({selected:!0}).flatten().length,c=function(e,t,l){e.append(m('<span class="select-item"/>').append(s.i18n("select."+t+"s",{_:"%d "+t+"s selected",0:"",1:"1 "+t+" selected"},l)))},e=m(e),c(n=m('<span class="select-info"/>'),"row",o),c(n,"column",t),c(n,"cell",l),(o=e.children("span.select-info")).length&&o.remove(),""!==n.text())&&e.append(n)}function p(o,a){var l=o.settings()[0].aoColumns;o.columns().iterator("column",function(e,t){var n;f(l[t])&&(t=o.column(t).header(),m("input",t).length||(n=m("<input>").attr({class:u(!0),type:"checkbox","aria-label":o.i18n("select.aria.headerCheckbox")||"Select all rows"}).appendTo(t).on("change",function(){this.checked?("select-page"==a?o.rows({page:"current"}):o.rows({search:"applied"})).select():o.rows({selected:!0}).deselect()}).on("click",function(e){e.stopPropagation()}),o.on("draw select deselect",function(e,t,l){var s,c;"row"!==l&&l||(l=o.rows({selected:!0}).count(),s=o.rows({search:"applied",selected:!0}).count(),c=("select-page"==a?o.rows({page:"current"}):o.rows({search:"applied"})).count(),s&&s<=l&&s===c?n.prop("checked",!0).prop("indeterminate",!1):0===s&&0===l?n.prop("checked",!1).prop("indeterminate",!1):n.prop("checked",!1).prop("indeterminate",!0))})))})}function h(e,t,l,s){var c,n=e[t+"s"]({search:"applied"}).indexes(),s=n.indexOf(s),o=n.indexOf(l);e[t+"s"]({selected:!0}).any()||-1!==s?(o<s&&(c=o,o=s,s=c),n.splice(o+1,n.length),n.splice(0,s)):n.splice(n.indexOf(l)+1,n.length),e[t](l,{selected:!0}).any()?(n.splice(n.indexOf(l),1),e[t+"s"](n).deselect()):e[t+"s"](n).select()}function v(e,t){!t&&"single"!==e._select.style||((t=new _.Api(e)).rows({selected:!0}).deselect(),t.columns({selected:!0}).deselect(),t.cells({selected:!0}).deselect())}function w(e,t,l,s,c){var n=t.select.style(),o=t.select.toggleable(),a=t[s](c,{selected:!0}).any();a&&!o||("os"===n?e.ctrlKey||e.metaKey?t[s](c).select(!a):e.shiftKey?"cell"===s?r(t,c,l._select_lastCell||null):h(t,s,c,l._select_lastCell?l._select_lastCell[s]:null):(o=t[s+"s"]({selected:!0}),a&&1===o.flatten().length?t[s](c).deselect():(o.deselect(),t[s](c).select())):"multi+shift"==n&&e.shiftKey?"cell"===s?r(t,c,l._select_lastCell||null):h(t,s,c,l._select_lastCell?l._select_lastCell[s]:null):t[s](c).select(!a))}function b(e){return e.id.replace(/[^a-zA-Z0-9\-\_]/g,"-")}_.select={},_.select.classes={checkbox:"dt-select-checkbox"},_.select.version="2.0.5",_.select.init=function(c){var e,t,l,s,n,o,a,i,r,u,d,f,h=c.settings()[0];if(!_.versionCheck("2"))throw"Warning: Select requires DataTables 2 or newer";!h._select&&(e=c.state.loaded(),t=function(e,t,l){if(null!==l&&void 0!==l.select){if(c.rows({selected:!0}).any()&&c.rows().deselect(),void 0!==l.select.rows&&c.rows(l.select.rows).select(),c.columns({selected:!0}).any()&&c.columns().deselect(),void 0!==l.select.columns&&c.columns(l.select.columns).select(),c.cells({selected:!0}).any()&&c.cells().deselect(),void 0!==l.select.cells)for(var s=0;s<l.select.cells.length;s++)c.cell(l.select.cells[s].row,l.select.cells[s].column).select();c.state.save()}},c.on("stateSaveParams",function(e,t,l){l.select={},l.select.rows=c.rows({selected:!0}).ids(!0).toArray(),l.select.columns=c.columns({selected:!0})[0],l.select.cells=c.cells({selected:!0})[0].map(function(e){return{row:c.row(e.row).id(!0),column:e.column}})}).on("stateLoadParams",t).one("init",function(){t(0,0,e)}),s=h.oInit.select,l=_.defaults.select,l=void 0===s?l:s,s="row",r="td, th",u="selected",f=!(d=i=a=!(o=!(n="api"))),h._select={infoEls:[]},!0===l?(n="os",f=!0):"string"==typeof l?(n=l,f=!0):m.isPlainObject(l)&&(void 0!==l.blurable&&(o=l.blurable),void 0!==l.toggleable&&(a=l.toggleable),void 0!==l.info&&(i=l.info),void 0!==l.items&&(s=l.items),f=(n=void 0!==l.style?l.style:"os",!0),void 0!==l.selector&&(r=l.selector),void 0!==l.className&&(u=l.className),void 0!==l.headerCheckbox)&&(d=l.headerCheckbox),c.select.selector(r),c.select.items(s),c.select.style(n),c.select.blurable(o),c.select.toggleable(a),c.select.info(i),h._select.className=u,!f&&m(c.table().node()).hasClass("selectable")&&c.select.style("os"),d||"select-page"===d||"select-all"===d)&&(p(c,d),c.on("init",function(){p(c,d)}))},m.each([{type:"row",prop:"aoData"},{type:"column",prop:"aoColumns"}],function(e,i){_.ext.selector[i.type].push(function(e,t,l){var s,c=t.selected,n=[];if(!0!==c&&!1!==c)return l;for(var o=0,a=l.length;o<a;o++)(s=e[i.prop][l[o]])&&(!0===c&&!0===s._select_selected||!1===c&&!s._select_selected)&&n.push(l[o]);return n})}),_.ext.selector.cell.push(function(e,t,l){var s,c=t.selected,n=[];if(void 0===c)return l;for(var o=0,a=l.length;o<a;o++)(s=e.aoData[l[o].row])&&(!0===c&&s._selected_cells&&!0===s._selected_cells[l[o].column]||!1===c&&(!s._selected_cells||!s._selected_cells[l[o].column]))&&n.push(l[o]);return n});var t=_.Api.register,l=_.Api.registerPlural;function o(t,l){return function(e){return e.i18n("buttons."+t,l)}}function g(e){e=e._eventNamespace;return"draw.dt.DT"+e+" select.dt.DT"+e+" deselect.dt.DT"+e}t("select()",function(){return this.iterator("table",function(e){_.select.init(new _.Api(e))})}),t("select.blurable()",function(t){return void 0===t?this.context[0]._select.blurable:this.iterator("table",function(e){e._select.blurable=t})}),t("select.toggleable()",function(t){return void 0===t?this.context[0]._select.toggleable:this.iterator("table",function(e){e._select.toggleable=t})}),t("select.info()",function(t){return void 0===t?this.context[0]._select.info:this.iterator("table",function(e){e._select.info=t})}),t("select.items()",function(t){return void 0===t?this.context[0]._select.items:this.iterator("table",function(e){e._select.items=t,d(new _.Api(e),"selectItems",[t])})}),t("select.style()",function(l){return void 0===l?this.context[0]._select.style:this.iterator("table",function(e){e._select||_.select.init(new _.Api(e)),e._select_init||(o=e,c=new _.Api(o),o._select_init=!0,o.aoRowCreatedCallback.push(function(e,t,l){var s,c,n=o.aoData[l];for(n._select_selected&&m(e).addClass(o._select.className).find("input."+u(!0)).prop("checked",!0),s=0,c=o.aoColumns.length;s<c;s++)(o.aoColumns[s]._select_selected||n._selected_cells&&n._selected_cells[s])&&m(n.anCells[s]).addClass(o._select.className)}),c.on("preXhr.dt.dtSelect",function(e,t){var l,s;t===c.settings()[0]&&(l=c.rows({selected:!0}).ids(!0).filter(function(e){return void 0!==e}),s=c.cells({selected:!0}).eq(0).map(function(e){var t=c.row(e.row).id(!0);return t?{row:t,column:e.column}:void 0}).filter(function(e){return void 0!==e}),c.one("draw.dt.dtSelect",function(){c.rows(l).select(),s.any()&&s.each(function(e){c.cells(e.row,e.column).select()})}))}),c.on("info.dt",function(e,t,l){t._select.infoEls.includes(l)||t._select.infoEls.push(l),a(c,l)}),c.on("select.dtSelect.dt deselect.dtSelect.dt",function(){o._select.infoEls.forEach(function(e){a(c,e)}),c.state.save()}),c.on("destroy.dtSelect",function(){m(c.rows({selected:!0}).nodes()).removeClass(c.settings()[0]._select.className),m("input."+u(!0),c.table().header()).remove(),s(c),c.off(".dtSelect"),m("body").off(".dtSelect"+b(c.table().node()))})),e._select.style=l;var o,c,t=new _.Api(e);s(t),"api"!==l&&n(t),d(new _.Api(e),"selectStyle",[l])})}),t("select.selector()",function(t){return void 0===t?this.context[0]._select.selector:this.iterator("table",function(e){s(new _.Api(e)),e._select.selector=t,"api"!==e._select.style&&n(new _.Api(e))})}),t("select.last()",function(e){var t=this.context[0];return e?(t._select_lastCell=e,this):t._select_lastCell}),l("rows().select()","row().select()",function(e){var o=this;return!1===e?this.deselect():(this.iterator("row",function(e,t){v(e);var l=e.aoData[t],s=e.aoColumns;m(l.nTr).addClass(e._select.className),l._select_selected=!0;for(var c=0;c<s.length;c++){var n=s[c];null===n.sType&&o.columns().types(),f(n)&&((n=l.anCells)&&n[c]&&m("input."+u(!0),n[c]).prop("checked",!0),null!==l._aSortData)&&(l._aSortData[c]=null)}}),this.iterator("table",function(e,t){d(o,"select",["row",o[t]],!0)}),this)}),t("row().selected()",function(){var e=this.context[0];return!!(e&&this.length&&e.aoData[this[0]]&&e.aoData[this[0]]._select_selected)}),l("columns().select()","column().select()",function(e){var l=this;return!1===e?this.deselect():(this.iterator("column",function(e,t){v(e),e.aoColumns[t]._select_selected=!0;t=new _.Api(e).column(t);m(t.header()).addClass(e._select.className),m(t.footer()).addClass(e._select.className),t.nodes().to$().addClass(e._select.className)}),this.iterator("table",function(e,t){d(l,"select",["column",l[t]],!0)}),this)}),t("column().selected()",function(){var e=this.context[0];return!!(e&&this.length&&e.aoColumns[this[0]]&&e.aoColumns[this[0]]._select_selected)}),l("cells().select()","cell().select()",function(e){var l=this;return!1===e?this.deselect():(this.iterator("cell",function(e,t,l){v(e);t=e.aoData[t];void 0===t._selected_cells&&(t._selected_cells=[]),t._selected_cells[l]=!0,t.anCells&&m(t.anCells[l]).addClass(e._select.className)}),this.iterator("table",function(e,t){d(l,"select",["cell",l.cells(l[t]).indexes().toArray()],!0)}),this)}),t("cell().selected()",function(){var e=this.context[0];if(e&&this.length){e=e.aoData[this[0][0].row];if(e&&e._selected_cells&&e._selected_cells[this[0][0].column])return!0}return!1}),l("rows().deselect()","row().deselect()",function(){var o=this;return this.iterator("row",function(e,t){var l=e.aoData[t],s=e.aoColumns;m(l.nTr).removeClass(e._select.className),l._select_selected=!1,e._select_lastCell=null;for(var c=0;c<s.length;c++){var n=s[c];null===n.sType&&o.columns().types(),f(n)&&((n=l.anCells)&&n[c]&&m("input."+u(!0),l.anCells[c]).prop("checked",!1),null!==l._aSortData)&&(l._aSortData[c]=null)}}),this.iterator("table",function(e,t){d(o,"deselect",["row",o[t]],!0)}),this}),l("columns().deselect()","column().deselect()",function(){var l=this;return this.iterator("column",function(s,e){s.aoColumns[e]._select_selected=!1;var t=new _.Api(s),l=t.column(e);m(l.header()).removeClass(s._select.className),m(l.footer()).removeClass(s._select.className),t.cells(null,e).indexes().each(function(e){var t=s.aoData[e.row],l=t._selected_cells;!t.anCells||l&&l[e.column]||m(t.anCells[e.column]).removeClass(s._select.className)})}),this.iterator("table",function(e,t){d(l,"deselect",["column",l[t]],!0)}),this}),l("cells().deselect()","cell().deselect()",function(){var l=this;return this.iterator("cell",function(e,t,l){t=e.aoData[t];void 0!==t._selected_cells&&(t._selected_cells[l]=!1),t.anCells&&!e.aoColumns[l]._select_selected&&m(t.anCells[l]).removeClass(e._select.className)}),this.iterator("table",function(e,t){d(l,"deselect",["cell",l[t]],!0)}),this});var x=0;return m.extend(_.ext.buttons,{selected:{text:o("selected","Selected"),className:"buttons-selected",limitTo:["rows","columns","cells"],init:function(l,e,s){var c=this;s._eventNamespace=".select"+x++,l.on(g(s),function(){var e,t;c.enable((e=l,!(-1===(t=s).limitTo.indexOf("rows")||!e.rows({selected:!0}).any())||!(-1===t.limitTo.indexOf("columns")||!e.columns({selected:!0}).any())||!(-1===t.limitTo.indexOf("cells")||!e.cells({selected:!0}).any())))}),this.disable()},destroy:function(e,t,l){e.off(l._eventNamespace)}},selectedSingle:{text:o("selectedSingle","Selected single"),className:"buttons-selected-single",init:function(t,e,l){var s=this;l._eventNamespace=".select"+x++,t.on(g(l),function(){var e=t.rows({selected:!0}).flatten().length+t.columns({selected:!0}).flatten().length+t.cells({selected:!0}).flatten().length;s.enable(1===e)}),this.disable()},destroy:function(e,t,l){e.off(l._eventNamespace)}},selectAll:{text:o("selectAll","Select all"),className:"buttons-select-all",action:function(e,t,l,s){var c=this.select.items(),n=s.selectorModifier;(n?("function"==typeof n&&(n=n.call(t,e,t,l,s)),this[c+"s"](n)):this[c+"s"]()).select()}},selectNone:{text:o("selectNone","Deselect all"),className:"buttons-select-none",action:function(){v(this.settings()[0],!0)},init:function(t,e,l){var s=this;l._eventNamespace=".select"+x++,t.on(g(l),function(){var e=t.rows({selected:!0}).flatten().length+t.columns({selected:!0}).flatten().length+t.cells({selected:!0}).flatten().length;s.enable(0<e)}),this.disable()},destroy:function(e,t,l){e.off(l._eventNamespace)}},showSelected:{text:o("showSelected","Show only selected"),className:"buttons-show-selected",action:function(e,t){var s;t.search.fixed("dt-select")?(t.search.fixed("dt-select",null),this.active(!1)):(s=t.settings()[0].aoData,t.search.fixed("dt-select",function(e,t,l){return s[l]._select_selected}),this.active(!0)),t.draw()}}}),m.each(["Row","Column","Cell"],function(e,t){var c=t.toLowerCase();_.ext.buttons["select"+t+"s"]={text:o("select"+t+"s","Select "+c+"s"),className:"buttons-select-"+c+"s",action:function(){this.select.items(c)},init:function(e){var s=this;e.on("selectItems.dt.DT",function(e,t,l){s.active(l===c)})}}}),_.type("select-checkbox",{className:"dt-select",detect:_.versionCheck("2.1")?{oneOf:function(){return!1},allOf:function(){return!1},init:function(e,t,l){return f(t)}}:function(e){return"select-checkbox"===e&&e},order:{pre:function(e){return"X"===e?-1:0}}}),m.extend(!0,_.defaults.oLanguage,{select:{aria:{rowCheckbox:"Select row"}}}),_.render.select=function(e,t){function l(e,t,l,s){var c=s.settings.aoData[s.row]._select_selected,s=s.settings.oLanguage.select.aria.rowCheckbox;return"display"===t?m("<input>").attr({"aria-label":s,class:u(),name:o?o(l):null,type:"checkbox",value:n?n(l):null,checked:c}).on("input",function(e){e.preventDefault(),this.checked=m(this).closest("tr").hasClass("selected")})[0]:"type"===t?"select-checkbox":"filter"!==t&&c?"X":""}var n=e?_.util.get(e):null,o=t?_.util.get(t):null;return l._name="selectCheckbox",l},_.ext.order["select-checkbox"]=function(t,e){return this.api().column(e,{order:"index"}).nodes().map(function(e){return"row"===t._select.items?m(e).parent().hasClass(t._select.className).toString():"cell"===t._select.items&&m(e).hasClass(t._select.className).toString()})},m.fn.DataTable.select=_.select,m(e).on("preInit.dt.dtSelect",function(e,t){"dt"===e.namespace&&_.select.init(new _.Api(t))}),_});
|
|
4
|
+
!function(l){var s,c;"function"==typeof define&&define.amd?define(["jquery","datatables.net"],function(e){return l(e,window,document)}):"object"==typeof exports?(s=require("jquery"),c=function(e,t){t.fn.dataTable||require("datatables.net")(e,t)},"undefined"==typeof window?module.exports=function(e,t){return e=e||window,t=t||s(e),c(e,t),l(t,e,e.document)}:(c(window,s),module.exports=l(s,window,window.document))):l(jQuery,window,document)}(function(m,i,e){"use strict";var p=m.fn.dataTable;function r(n,e,t){function l(t,l){l<t&&(e=l,l=t,t=e);var e,s=!1;return n.columns(":visible").indexes().filter(function(e){return e===t&&(s=!0),e===l?!(s=!1):s})}function s(t,l){var e,s=n.rows({search:"applied"}).indexes(),c=(s.indexOf(t)>s.indexOf(l)&&(e=l,l=t,t=e),!1);return s.filter(function(e){return e===t&&(c=!0),e===l?!(c=!1):c})}var c,t=n.cells({selected:!0}).any()||t?(c=l(t.column,e.column),s(t.row,e.row)):(c=l(0,e.column),s(0,e.row)),t=n.cells(t,c).flatten();n.cells(e,{selected:!0}).any()?n.cells(t).deselect():n.cells(t).select()}function v(e){var t=p.select.classes.checkbox;return e?t.replace(/ /g,"."):t}function c(e){var t=e.settings()[0]._select.selector;m(e.table().container()).off("mousedown.dtSelect",t).off("mouseup.dtSelect",t).off("click.dtSelect",t),m("body").off("click.dtSelect"+_(e.table().node()))}function n(o){var a,t=m(o.table().container()),l=o.settings()[0],s=l._select.selector;t.on("mousedown.dtSelect",s,function(e){(e.shiftKey||e.metaKey||e.ctrlKey)&&t.css("-moz-user-select","none").one("selectstart.dtSelect",s,function(){return!1}),i.getSelection&&(a=i.getSelection())}).on("mouseup.dtSelect",s,function(){t.css("-moz-user-select","")}).on("click.dtSelect",s,function(e){var t,l=o.select.items();if(a){var s=i.getSelection();if((!s.anchorNode||m(s.anchorNode).closest("table")[0]===o.table().node())&&s!==a)return}var c,s=o.settings()[0],n=o.table().container();m(e.target).closest("div.dt-container")[0]==n&&(n=o.cell(m(e.target).closest("td, th"))).any()&&(c=m.Event("user-select.dt"),u(o,c,[l,n,e]),c.isDefaultPrevented()||(c=n.index(),"row"===l?(t=c.row,h(e,o,s,"row",t)):"column"===l?(t=n.index().column,h(e,o,s,"column",t)):"cell"===l&&(t=n.index(),h(e,o,s,"cell",t)),s._select_lastCell=c))}),m("body").on("click.dtSelect"+_(o.table().node()),function(e){var t;!l._select.blurable||m(e.target).parents().filter(o.table().container()).length||0===m(e.target).parents("html").length||m(e.target).parents("div.DTE").length||(t=m.Event("select-blur.dt"),u(o,t,[e.target,e]),t.isDefaultPrevented())||f(l,!0)})}function u(e,t,l,s){s&&!e.flatten().length||("string"==typeof t&&(t+=".dt"),l.unshift(e),m(e.table().node()).trigger(t,l))}function b(e){return e.mRender&&"selectCheckbox"===e.mRender._name}function s(s,e){var t,l,c,n,o;"api"!==s.select.style()&&!1!==s.select.info()&&(o=s.settings()[0]._select_set.length||s.rows({selected:!0}).count(),t=s.columns({selected:!0}).count(),l=s.cells({selected:!0}).count(),c=function(e,t,l){e.append(m('<span class="select-item"/>').append(s.i18n("select."+t+"s",{_:"%d "+t+"s selected",0:"",1:"1 "+t+" selected"},l)))},e=m(e),c(n=m('<span class="select-info"/>'),"row",o),c(n,"column",t),c(n,"cell",l),(o=e.children("span.select-info")).length&&o.remove(),""!==n.text())&&e.append(n)}function o(o){var r,a=new p.Api(o);o._select_init=!0,o._select_set=[],o.aoRowCreatedCallback.push(function(e,t,l){var s,c,n=o.aoData[l],l=a.row(l).id();for((n._select_selected||"undefined"!==l&&o._select_set.includes(l))&&(n._select_selected=!0,m(e).addClass(o._select.className).find("input."+v(!0)).prop("checked",!0)),s=0,c=o.aoColumns.length;s<c;s++)(o.aoColumns[s]._select_selected||n._selected_cells&&n._selected_cells[s])&&m(n.anCells[s]).addClass(o._select.className)}),(r=a).on("select",function(e,t,l,s){if("row"===l)for(var l=r.settings()[0],c=r,n=l._select_set,o=s,a=0;a<o.length;a++){var i=c.row(o[a]).id();i&&"undefined"!==i&&!n.includes(i)&&n.push(i)}}),r.on("deselect",function(e,t,l,s){if("row"===l)for(var l=r.settings()[0],c=r,n=l._select_set,o=s,a=0;a<o.length;a++){var i=c.row(o[a]).id(),i=n.indexOf(i);-1!==i&&n.splice(i,1)}}),a.on("info.dt",function(e,t,l){t._select.infoEls.includes(l)||t._select.infoEls.push(l),s(a,l)}),a.on("select.dtSelect.dt deselect.dtSelect.dt",function(){o._select.infoEls.forEach(function(e){s(a,e)}),a.state.save()}),a.on("destroy.dtSelect",function(){m(a.rows({selected:!0}).nodes()).removeClass(a.settings()[0]._select.className),m("input."+v(!0),a.table().header()).remove(),c(a),a.off(".dtSelect"),m("body").off(".dtSelect"+_(a.table().node()))})}function d(e,t,l,s){var c,n=e[t+"s"]({search:"applied"}).indexes(),s=n.indexOf(s),o=n.indexOf(l);e[t+"s"]({selected:!0}).any()||-1!==s?(o<s&&(c=o,o=s,s=c),n.splice(o+1,n.length),n.splice(0,s)):n.splice(n.indexOf(l)+1,n.length),e[t](l,{selected:!0}).any()?(n.splice(n.indexOf(l),1),e[t+"s"](n).deselect()):e[t+"s"](n).select()}function f(e,t){!t&&"single"!==e._select.style||((t=new p.Api(e)).rows({selected:!0}).deselect(),t.columns({selected:!0}).deselect(),t.cells({selected:!0}).deselect())}function h(e,t,l,s,c){var n=t.select.style(),o=t.select.toggleable(),a=t[s](c,{selected:!0}).any();a&&!o||("os"===n?e.ctrlKey||e.metaKey?t[s](c).select(!a):e.shiftKey?"cell"===s?r(t,c,l._select_lastCell||null):d(t,s,c,l._select_lastCell?l._select_lastCell[s]:null):(o=t[s+"s"]({selected:!0}),a&&1===o.flatten().length?t[s](c).deselect():(o.deselect(),t[s](c).select())):"multi+shift"==n&&e.shiftKey?"cell"===s?r(t,c,l._select_lastCell||null):d(t,s,c,l._select_lastCell?l._select_lastCell[s]:null):t[s](c).select(!a))}function _(e){return e.id.replace(/[^a-zA-Z0-9\-\_]/g,"-")}p.select={},p.select.classes={checkbox:"dt-select-checkbox"},p.select.version="2.1.0",p.select.init=function(o){var e,t,l,s,c,n,a,i,r,u,d,f,h,_=o.settings()[0];if(!p.versionCheck("2"))throw"Warning: Select requires DataTables 2 or newer";!_._select&&(e=o.state.loaded(),t=function(e,t,l){if(null!==l&&void 0!==l.select){if(o.rows({selected:!0}).any()&&o.rows().deselect(),void 0!==l.select.rows&&o.rows(l.select.rows).select(),o.columns({selected:!0}).any()&&o.columns().deselect(),void 0!==l.select.columns&&o.columns(l.select.columns).select(),o.cells({selected:!0}).any()&&o.cells().deselect(),void 0!==l.select.cells)for(var s=0;s<l.select.cells.length;s++)o.cell(l.select.cells[s].row,l.select.cells[s].column).select();o.state.save()}},o.on("stateSaveParams",function(e,t,l){l.select={},l.select.rows=o.rows({selected:!0}).ids(!0).toArray(),l.select.columns=o.columns({selected:!0})[0],l.select.cells=o.cells({selected:!0})[0].map(function(e){return{row:o.row(e.row).id(!0),column:e.column}})}).on("stateLoadParams",t).one("init",function(){t(0,0,e)}),s=_.oInit.select,l=p.defaults.select,l=void 0===s?l:s,s="row",a=!(n=!(c="api")),u="td, th",d="selected",h=!(f=r=!(i=null)),_._select={infoEls:[]},!0===l?(c="os",h=!0):"string"==typeof l?(c=l,h=!0):m.isPlainObject(l)&&(void 0!==l.blurable&&(n=l.blurable),void 0!==l.toggleable&&(a=l.toggleable),void 0!==l.info&&(r=l.info),void 0!==l.items&&(s=l.items),h=(c=void 0!==l.style?l.style:"os",!0),void 0!==l.selector&&(u=l.selector),void 0!==l.className&&(d=l.className),void 0!==l.headerCheckbox&&(f=l.headerCheckbox),void 0!==l.selectable)&&(i=l.selectable),o.select.selector(u),o.select.items(s),o.select.style(c),o.select.blurable(n),o.select.toggleable(a),o.select.info(r),o.select.selectable(i),_._select.className=d,!h&&m(o.table().node()).hasClass("selectable")&&o.select.style("os"),f||"select-page"===f||"select-all"===f)&&o.ready(function(){var c,n,l;n=f,l=(c=o).settings()[0].aoColumns,c.columns().iterator("column",function(e,t){var s;b(l[t])&&(t=c.column(t).header(),m("input",t).length||(s=m("<input>").attr({class:v(!0),type:"checkbox","aria-label":c.i18n("select.aria.headerCheckbox")||"Select all rows"}).appendTo(t).on("change",function(){this.checked?("select-page"==n?c.rows({page:"current"}):c.rows({search:"applied"})).select():("select-page"==n?c.rows({page:"current",selected:!0}):c.rows({selected:!0})).deselect()}).on("click",function(e){e.stopPropagation()}),c.on("draw select deselect",function(e,t,l){"row"!==l&&l||((l=function(e,t){var l=e.settings()[0],s=l._select.selectable,c=0,n=("select-page"==t?e.rows({page:"current",selected:!0}):e.rows({selected:!0})).count(),o=("select-page"==t?e.rows({page:"current",selected:!0}):e.rows({search:"applied",selected:!0})).count();if(s)for(var a=("select-page"==t?e.rows({page:"current"}):e.rows({search:"applied"})).indexes(),i=0;i<a.length;i++){var r=l.aoData[a[i]];s(r._aData,r.nTr,a[i])&&c++}else c=("select-page"==t?e.rows({page:"current"}):e.rows({search:"applied"})).count();return{available:c,count:n,search:o}}(c,n)).search&&l.search<=l.count&&l.search===l.available?s.prop("checked",!0).prop("indeterminate",!1):0===l.search&&0===l.count?s.prop("checked",!1).prop("indeterminate",!1):s.prop("checked",!1).prop("indeterminate",!0))})))})})},m.each([{type:"row",prop:"aoData"},{type:"column",prop:"aoColumns"}],function(e,i){p.ext.selector[i.type].push(function(e,t,l){var s,c=t.selected,n=[];if(!0!==c&&!1!==c)return l;for(var o=0,a=l.length;o<a;o++)(s=e[i.prop][l[o]])&&(!0===c&&!0===s._select_selected||!1===c&&!s._select_selected)&&n.push(l[o]);return n})}),p.ext.selector.cell.push(function(e,t,l){var s,c=t.selected,n=[];if(void 0===c)return l;for(var o=0,a=l.length;o<a;o++)(s=e.aoData[l[o].row])&&(!0===c&&s._selected_cells&&!0===s._selected_cells[l[o].column]||!1===c&&(!s._selected_cells||!s._selected_cells[l[o].column]))&&n.push(l[o]);return n});var t=p.Api.register,l=p.Api.registerPlural;function a(t,l){return function(e){return e.i18n("buttons."+t,l)}}function w(e){e=e._eventNamespace;return"draw.dt.DT"+e+" select.dt.DT"+e+" deselect.dt.DT"+e}t("select()",function(){return this.iterator("table",function(e){p.select.init(new p.Api(e))})}),t("select.blurable()",function(t){return void 0===t?this.context[0]._select.blurable:this.iterator("table",function(e){e._select.blurable=t})}),t("select.toggleable()",function(t){return void 0===t?this.context[0]._select.toggleable:this.iterator("table",function(e){e._select.toggleable=t})}),t("select.info()",function(t){return void 0===t?this.context[0]._select.info:this.iterator("table",function(e){e._select.info=t})}),t("select.items()",function(t){return void 0===t?this.context[0]._select.items:this.iterator("table",function(e){e._select.items=t,u(new p.Api(e),"selectItems",[t])})}),t("select.style()",function(l){return void 0===l?this.context[0]._select.style:this.iterator("table",function(e){e._select||p.select.init(new p.Api(e)),e._select_init||o(e),e._select.style=l;var t=new p.Api(e);"api"!==l?t.ready(function(){c(t),n(t)}):c(t),u(new p.Api(e),"selectStyle",[l])})}),t("select.selector()",function(s){return void 0===s?this.context[0]._select.selector:this.iterator("table",function(e){var t=new p.Api(e),l=e._select.style;c(t),e._select.selector=s,l&&"api"!==l?t.ready(function(){c(t),n(t)}):c(t)})}),t("select.selectable()",function(e){var t=this.context[0];return e?(t._select.selectable=e,this):t._select.selectable}),t("select.last()",function(e){var t=this.context[0];return e?(t._select_lastCell=e,this):t._select_lastCell}),t("select.cumulative()",function(){var e=this.context[0];return e&&e._select_set?e._select_set:[]}),l("rows().select()","row().select()",function(e){var o=this,a=[];return!1===e?this.deselect():(this.iterator("row",function(e,t){f(e);var l=e.aoData[t],s=e.aoColumns;if(e._select.selectable&&!1===e._select.selectable(l._aData,l.nTr,t))return;m(l.nTr).addClass(e._select.className),l._select_selected=!0,a.push(t);for(var c=0;c<s.length;c++){var n=s[c];null===n.sType&&o.columns().types(),b(n)&&((n=l.anCells)&&n[c]&&m("input."+v(!0),n[c]).prop("checked",!0),null!==l._aSortData)&&(l._aSortData[c]=null)}}),this.iterator("table",function(e){u(o,"select",["row",a],!0)}),this)}),t("row().selected()",function(){var e=this.context[0];return!!(e&&this.length&&e.aoData[this[0]]&&e.aoData[this[0]]._select_selected)}),l("columns().select()","column().select()",function(e){var l=this;return!1===e?this.deselect():(this.iterator("column",function(e,t){f(e),e.aoColumns[t]._select_selected=!0;t=new p.Api(e).column(t);m(t.header()).addClass(e._select.className),m(t.footer()).addClass(e._select.className),t.nodes().to$().addClass(e._select.className)}),this.iterator("table",function(e,t){u(l,"select",["column",l[t]],!0)}),this)}),t("column().selected()",function(){var e=this.context[0];return!!(e&&this.length&&e.aoColumns[this[0]]&&e.aoColumns[this[0]]._select_selected)}),l("cells().select()","cell().select()",function(e){var l=this;return!1===e?this.deselect():(this.iterator("cell",function(e,t,l){f(e);t=e.aoData[t];void 0===t._selected_cells&&(t._selected_cells=[]),t._selected_cells[l]=!0,t.anCells&&m(t.anCells[l]).addClass(e._select.className)}),this.iterator("table",function(e,t){u(l,"select",["cell",l.cells(l[t]).indexes().toArray()],!0)}),this)}),t("cell().selected()",function(){var e=this.context[0];if(e&&this.length){e=e.aoData[this[0][0].row];if(e&&e._selected_cells&&e._selected_cells[this[0][0].column])return!0}return!1}),l("rows().deselect()","row().deselect()",function(){var o=this;return this.iterator("row",function(e,t){var l=e.aoData[t],s=e.aoColumns;m(l.nTr).removeClass(e._select.className),l._select_selected=!1,e._select_lastCell=null;for(var c=0;c<s.length;c++){var n=s[c];null===n.sType&&o.columns().types(),b(n)&&((n=l.anCells)&&n[c]&&m("input."+v(!0),l.anCells[c]).prop("checked",!1),null!==l._aSortData)&&(l._aSortData[c]=null)}}),this.iterator("table",function(e,t){u(o,"deselect",["row",o[t]],!0)}),this}),l("columns().deselect()","column().deselect()",function(){var l=this;return this.iterator("column",function(s,e){s.aoColumns[e]._select_selected=!1;var t=new p.Api(s),l=t.column(e);m(l.header()).removeClass(s._select.className),m(l.footer()).removeClass(s._select.className),t.cells(null,e).indexes().each(function(e){var t=s.aoData[e.row],l=t._selected_cells;!t.anCells||l&&l[e.column]||m(t.anCells[e.column]).removeClass(s._select.className)})}),this.iterator("table",function(e,t){u(l,"deselect",["column",l[t]],!0)}),this}),l("cells().deselect()","cell().deselect()",function(){var l=this;return this.iterator("cell",function(e,t,l){t=e.aoData[t];void 0!==t._selected_cells&&(t._selected_cells[l]=!1),t.anCells&&!e.aoColumns[l]._select_selected&&m(t.anCells[l]).removeClass(e._select.className)}),this.iterator("table",function(e,t){u(l,"deselect",["cell",l[t]],!0)}),this});var g=0;return m.extend(p.ext.buttons,{selected:{text:a("selected","Selected"),className:"buttons-selected",limitTo:["rows","columns","cells"],init:function(l,e,s){var c=this;s._eventNamespace=".select"+g++,l.on(w(s),function(){var e,t;c.enable((e=l,!(-1===(t=s).limitTo.indexOf("rows")||!e.rows({selected:!0}).any())||!(-1===t.limitTo.indexOf("columns")||!e.columns({selected:!0}).any())||!(-1===t.limitTo.indexOf("cells")||!e.cells({selected:!0}).any())))}),this.disable()},destroy:function(e,t,l){e.off(l._eventNamespace)}},selectedSingle:{text:a("selectedSingle","Selected single"),className:"buttons-selected-single",init:function(t,e,l){var s=this;l._eventNamespace=".select"+g++,t.on(w(l),function(){var e=t.rows({selected:!0}).flatten().length+t.columns({selected:!0}).flatten().length+t.cells({selected:!0}).flatten().length;s.enable(1===e)}),this.disable()},destroy:function(e,t,l){e.off(l._eventNamespace)}},selectAll:{text:a("selectAll","Select all"),className:"buttons-select-all",action:function(e,t,l,s){var c=this.select.items(),n=s.selectorModifier;(n?("function"==typeof n&&(n=n.call(t,e,t,l,s)),this[c+"s"](n)):this[c+"s"]()).select()}},selectNone:{text:a("selectNone","Deselect all"),className:"buttons-select-none",action:function(){f(this.settings()[0],!0)},init:function(t,e,l){var s=this;l._eventNamespace=".select"+g++,t.on(w(l),function(){var e=t.rows({selected:!0}).flatten().length+t.columns({selected:!0}).flatten().length+t.cells({selected:!0}).flatten().length;s.enable(0<e)}),this.disable()},destroy:function(e,t,l){e.off(l._eventNamespace)}},showSelected:{text:a("showSelected","Show only selected"),className:"buttons-show-selected",action:function(e,t){var s;t.search.fixed("dt-select")?(t.search.fixed("dt-select",null),this.active(!1)):(s=t.settings()[0].aoData,t.search.fixed("dt-select",function(e,t,l){return s[l]._select_selected}),this.active(!0)),t.draw()}}}),m.each(["Row","Column","Cell"],function(e,t){var c=t.toLowerCase();p.ext.buttons["select"+t+"s"]={text:a("select"+t+"s","Select "+c+"s"),className:"buttons-select-"+c+"s",action:function(){this.select.items(c)},init:function(e){var s=this;this.active(e.select.items()===c),e.on("selectItems.dt.DT",function(e,t,l){s.active(l===c)})}}}),p.type("select-checkbox",{className:"dt-select",detect:p.versionCheck("2.1")?{oneOf:function(){return!1},allOf:function(){return!1},init:function(e,t,l){return b(t)}}:function(e){return"select-checkbox"===e&&e},order:{pre:function(e){return"X"===e?-1:0}}}),m.extend(!0,p.defaults.oLanguage,{select:{aria:{rowCheckbox:"Select row"}}}),p.render.select=function(e,t){function l(e,t,l,s){var c=s.settings.aoData[s.row],n=c._select_selected,o=s.settings.oLanguage.select.aria.rowCheckbox,a=s.settings._select.selectable;return"display"!==t?"type"===t?"select-checkbox":"filter"!==t&&n?"X":"":a&&!1===a(l,c.nTr,s.row)?"":m("<input>").attr({"aria-label":o,class:v(),name:r?r(l):null,type:"checkbox",value:i?i(l):null,checked:n}).on("input",function(e){e.preventDefault(),this.checked=m(this).closest("tr").hasClass("selected")})[0]}var i=e?p.util.get(e):null,r=t?p.util.get(t):null;return l._name="selectCheckbox",l},p.ext.order["select-checkbox"]=function(t,e){return this.api().column(e,{order:"index"}).nodes().map(function(e){return"row"===t._select.items?m(e).parent().hasClass(t._select.className).toString():"cell"===t._select.items&&m(e).hasClass(t._select.className).toString()})},m.fn.DataTable.select=p.select,m(e).on("i18n.dt.dtSelect preInit.dt.dtSelect",function(e,t){"dt"===e.namespace&&p.select.init(new p.Api(t))}),p});
|
package/assets/js/cdn.json
CHANGED
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"datatables-extension": "colreorder"
|
|
71
71
|
},
|
|
72
72
|
"DataTables-DateTime": {
|
|
73
|
-
"version": "1.5.
|
|
73
|
+
"version": "1.5.4",
|
|
74
74
|
"datatables-extension": "datetime"
|
|
75
75
|
},
|
|
76
76
|
"DataTables-FixedColumns": {
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
"datatables-extension": "searchpanes"
|
|
115
115
|
},
|
|
116
116
|
"DataTables-Select": {
|
|
117
|
-
"version": "2.0
|
|
117
|
+
"version": "2.1.0",
|
|
118
118
|
"datatables-extension": "select"
|
|
119
119
|
},
|
|
120
120
|
"DataTables-StateRestore": {
|