|
|
|
|
/* perfect-scrollbar v0.6.13 */
|
|
|
|
|
!function t(e,n,r){function o(i,s){if(!n[i]){if(!e[i]){var a="function"==typeof require&&require;if(!s&&a)return a(i,!0);if(l)return l(i,!0);var c=new Error("Cannot find module '"+i+"'");throw c.code="MODULE_NOT_FOUND",c}var u=n[i]={exports:{}};e[i][0].call(u.exports,function(t){var n=e[i][1][t];return o(n?n:t)},u,u.exports,t,e,n,r)}return n[i].exports}for(var l="function"==typeof require&&require,i=0;i<r.length;i++)o(r[i]);return o}({1:[function(t,e,n){"use strict";function r(t){t.fn.perfectScrollbar=function(t){return this.each(function(){if("object"==typeof t||"undefined"==typeof t){var e=t;l.get(this)||o.initialize(this,e)}else{var n=t;"update"===n?o.update(this):"destroy"===n&&o.destroy(this)}})}}var o=t("../main"),l=t("../plugin/instances");if("function"==typeof define&&define.amd)define(["jquery"],r);else{var i=window.jQuery?window.jQuery:window.$;"undefined"!=typeof i&&r(i)}e.exports=r},{"../main":7,"../plugin/instances":18}],2:[function(t,e,n){"use strict";function r(t,e){var n=t.className.split(" ");n.indexOf(e)<0&&n.push(e),t.className=n.join(" ")}function o(t,e){var n=t.className.split(" "),r=n.indexOf(e);r>=0&&n.splice(r,1),t.className=n.join(" ")}n.add=function(t,e){t.classList?t.classList.add(e):r(t,e)},n.remove=function(t,e){t.classList?t.classList.remove(e):o(t,e)},n.list=function(t){return t.classList?Array.prototype.slice.apply(t.classList):t.className.split(" ")}},{}],3:[function(t,e,n){"use strict";function r(t,e){return window.getComputedStyle(t)[e]}function o(t,e,n){return"number"==typeof n&&(n=n.toString()+"px"),t.style[e]=n,t}function l(t,e){for(var n in e){var r=e[n];"number"==typeof r&&(r=r.toString()+"px"),t.style[n]=r}return t}var i={};i.e=function(t,e){var n=document.createElement(t);return n.className=e,n},i.appendTo=function(t,e){return e.appendChild(t),t},i.css=function(t,e,n){return"object"==typeof e?l(t,e):"undefined"==typeof n?r(t,e):o(t,e,n)},i.matches=function(t,e){return"undefined"!=typeof t.matches?t.matches(e):"undefined"!=typeof t.matchesSelector?t.matchesSelector(e):"undefined"!=typeof t.webkitMatchesSelector?t.webkitMatchesSelector(e):"undefined"!=typeof t.mozMatchesSelector?t.mozMatchesSelector(e):"undefined"!=typeof t.msMatchesSelector?t.msMatchesSelector(e):void 0},i.remove=function(t){"undefined"!=typeof t.remove?t.remove():t.parentNode&&t.parentNode.removeChild(t)},i.queryChildren=function(t,e){return Array.prototype.filter.call(t.childNodes,function(t){return i.matches(t,e)})},e.exports=i},{}],4:[function(t,e,n){"use strict";var r=function(t){this.element=t,this.events={}};r.prototype.bind=function(t,e){"undefined"==typeof this.events[t]&&(this.events[t]=[]),this.events[t].push(e),this.element.addEventListener(t,e,!1)},r.prototype.unbind=function(t,e){var n="undefined"!=typeof e;this.events[t]=this.events[t].filter(function(r){return!(!n||r===e)||(this.element.removeEventListener(t,r,!1),!1)},this)},r.prototype.unbindAll=function(){for(var t in this.events)this.unbind(t)};var o=function(){this.eventElements=[]};o.prototype.eventElement=function(t){var e=this.eventElements.filter(function(e){return e.element===t})[0];return"undefined"==typeof e&&(e=new r(t),this.eventElements.push(e)),e},o.prototype.bind=function(t,e,n){this.eventElement(t).bind(e,n)},o.prototype.unbind=function(t,e,n){this.eventElement(t).unbind(e,n)},o.prototype.unbindAll=function(){for(var t=0;t<this.eventElements.length;t++)this.eventElements[t].unbindAll()},o.prototype.once=function(t,e,n){var r=this.eventElement(t),o=function(t){r.unbind(e,o),n(t)};r.bind(e,o)},e.exports=o},{}],5:[function(t,e,n){"use strict";e.exports=function(){function t(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return function(){return t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()}}()},{}],6:[function(t,e,n){"use strict";var r=t("./class"),o=t("./dom"),l=n.toInt=function(t){return parseInt(t,10)||0},i=n.clone=function(t){if(t){if(t.constructor===Array)return t.map(i);if("object"==typeof t){var e={};for(var n in t)e[n]=i(t[n]);return e}return t}return null};n.extend=function(t,e){var n=i(t);for(var
|
|
|
|
|
|
|
|
|
|
//! moment.js
|
|
|
|
|
//! version : 2.29.4
|
|
|
|
|
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
|
|
|
|
|
//! license : MIT
|
|
|
|
|
//! momentjs.com
|
|
|
|
|
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.moment=t()}(this,function(){"use strict";var H;function f(){return H.apply(null,arguments)}function a(e){return e instanceof Array||"[object Array]"===Object.prototype.toString.call(e)}function F(e){return null!=e&&"[object Object]"===Object.prototype.toString.call(e)}function c(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function L(e){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(e).length;for(var t in e)if(c(e,t))return;return 1}function o(e){return void 0===e}function u(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function V(e){return e instanceof Date||"[object Date]"===Object.prototype.toString.call(e)}function G(e,t){for(var n=[],s=e.length,i=0;i<s;++i)n.push(t(e[i],i));return n}function E(e,t){for(var n in t)c(t,n)&&(e[n]=t[n]);return c(t,"toString")&&(e.toString=t.toString),c(t,"valueOf")&&(e.valueOf=t.valueOf),e}function l(e,t,n,s){return Pt(e,t,n,s,!0).utc()}function m(e){return null==e._pf&&(e._pf={empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidEra:null,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],era:null,meridiem:null,rfc2822:!1,weekdayMismatch:!1}),e._pf}function A(e){if(null==e._isValid){var t=m(e),n=j.call(t.parsedDateParts,function(e){return null!=e}),n=!isNaN(e._d.getTime())&&t.overflow<0&&!t.empty&&!t.invalidEra&&!t.invalidMonth&&!t.invalidWeekday&&!t.weekdayMismatch&&!t.nullInput&&!t.invalidFormat&&!t.userInvalidated&&(!t.meridiem||t.meridiem&&n);if(e._strict&&(n=n&&0===t.charsLeftOver&&0===t.unusedTokens.length&&void 0===t.bigHour),null!=Object.isFrozen&&Object.isFrozen(e))return n;e._isValid=n}return e._isValid}function I(e){var t=l(NaN);return null!=e?E(m(t),e):m(t).userInvalidated=!0,t}var j=Array.prototype.some||function(e){for(var t=Object(this),n=t.length>>>0,s=0;s<n;s++)if(s in t&&e.call(this,t[s],s,t))return!0;return!1},Z=f.momentProperties=[],z=!1;function $(e,t){var n,s,i,r=Z.length;if(o(t._isAMomentObject)||(e._isAMomentObject=t._isAMomentObject),o(t._i)||(e._i=t._i),o(t._f)||(e._f=t._f),o(t._l)||(e._l=t._l),o(t._strict)||(e._strict=t._strict),o(t._tzm)||(e._tzm=t._tzm),o(t._isUTC)||(e._isUTC=t._isUTC),o(t._offset)||(e._offset=t._offset),o(t._pf)||(e._pf=m(t)),o(t._locale)||(e._locale=t._locale),0<r)for(n=0;n<r;n++)o(i=t[s=Z[n]])||(e[s]=i);return e}function q(e){$(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),!1===z&&(z=!0,f.updateOffset(this),z=!1)}function h(e){return e instanceof q||null!=e&&null!=e._isAMomentObject}function B(e){!1===f.suppressDeprecationWarnings&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+e)}function e(r,a){var o=!0;return E(function(){if(null!=f.deprecationHandler&&f.deprecationHandler(null,r),o){for(var e,t,n=[],s=arguments.length,i=0;i<s;i++){if(e="","object"==typeof arguments[i]){for(t in e+="\n["+i+"] ",arguments[0])c(arguments[0],t)&&(e+=t+": "+arguments[0][t]+", ");e=e.slice(0,-2)}else e=arguments[i];n.push(e)}B(r+"\nArguments: "+Array.prototype.slice.call(n).join("")+"\n"+(new Error).stack),o=!1}return a.apply(this,arguments)},a)}var J={};function Q(e,t){null!=f.deprecationHandler&&f.deprecationHandler(e,t),J[e]||(B(t),J[e]=!0)}function d(e){return"undefined"!=typeof Function&&e instanceof Function||"[object Function]"===Object.prototype.toString.call(e)}function X(e,t){var n,s=E({},e);for(n in t)c(t,n)&&(F(e[n])&&F(t[n])?(s[n]={},E(s[n],e[n]),E(s[n],t[n])):null!=t[n]?s[n]=t[n]:delete s[n]);for(n in e)c(e,n)&&!c(t,n)&&F(e[n])&&(s[n]=E({},s[n]));return s}function K(e){null!=e&&this.set(e)}f.suppressDeprecationWarnings=!1,f.deprecationHandler=null;var ee=Object.keys||function(e){var t,n=[];for(t in e)c(e,t)&&n.push(t);return n};function r(e,t,n){var s=""+Math.abs(e);return(0<=e?n?"+":"":"-")+Math.pow(10,Math.max(0,t-s.length)).toString().substr(1)+s}var te=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* sweetalert2 v5.3.5
|
|
|
|
|
* Released under the MIT License.
|
|
|
|
|
*/
|
|
|
|
|
(function(global, factory) {
|
|
|
|
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
|
|
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
|
|
|
(global.Sweetalert2 = factory());
|
|
|
|
|
}(this, function() {
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
var swalPrefix = 'swal2-'
|
|
|
|
|
|
|
|
|
|
var prefix = function(items) {
|
|
|
|
|
var result = {}
|
|
|
|
|
for (var i in items) {
|
|
|
|
|
result[items[i]] = swalPrefix + items[i]
|
|
|
|
|
}
|
|
|
|
|
return result
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var swalClasses = prefix([
|
|
|
|
|
'container',
|
|
|
|
|
'in',
|
|
|
|
|
'iosfix',
|
|
|
|
|
'modal',
|
|
|
|
|
'overlay',
|
|
|
|
|
'fade',
|
|
|
|
|
'show',
|
|
|
|
|
'hide',
|
|
|
|
|
'noanimation',
|
|
|
|
|
'close',
|
|
|
|
|
'content',
|
|
|
|
|
'spacer',
|
|
|
|
|
'confirm',
|
|
|
|
|
'cancel',
|
|
|
|
|
'icon',
|
|
|
|
|
'image',
|
|
|
|
|
'input',
|
|
|
|
|
'file',
|
|
|
|
|
'range',
|
|
|
|
|
'select',
|
|
|
|
|
'radio',
|
|
|
|
|
'checkbox',
|
|
|
|
|
'textarea',
|
|
|
|
|
'inputerror',
|
|
|
|
|
'validationerror',
|
|
|
|
|
'progresssteps',
|
|
|
|
|
'activeprogressstep',
|
|
|
|
|
'progresscircle',
|
|
|
|
|
'progressline',
|
|
|
|
|
'loading',
|
|
|
|
|
'styled'
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
var iconTypes = prefix([
|
|
|
|
|
'success',
|
|
|
|
|
'warning',
|
|
|
|
|
'info',
|
|
|
|
|
'question',
|
|
|
|
|
'error'
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
var defaultParams = {
|
|
|
|
|
title: '',
|
|
|
|
|
text: '',
|
|
|
|
|
html: '',
|
|
|
|
|
type: null,
|
|
|
|
|
customClass: '',
|
|
|
|
|
animation: true,
|
|
|
|
|
allowOutsideClick: true,
|
|
|
|
|
allowEscapeKey: true,
|
|
|
|
|
showConfirmButton: true,
|
|
|
|
|
showCancelButton: false,
|
|
|
|
|
preConfirm: null,
|
|
|
|
|
confirmButtonText: 'OK',
|
|
|
|
|
confirmButtonColor: '#3085d6',
|
|
|
|
|
confirmButtonClass: null,
|
|
|
|
|
cancelButtonText: 'Cancel',
|
|
|
|
|
cancelButtonColor: '#aaa',
|
|
|
|
|
cancelButtonClass: null,
|
|
|
|
|
buttonsStyling: true,
|
|
|
|
|
reverseButtons: false,
|
|
|
|
|
focusCancel: false,
|
|
|
|
|
showCloseButton: false,
|
|
|
|
|
showLoaderOnConfirm: false,
|
|
|
|
|
imageUrl: null,
|
|
|
|
|
imageWidth: null,
|
|
|
|
|
imageHeight: null,
|
|
|
|
|
imageClass: null,
|
|
|
|
|
timer: null,
|
|
|
|
|
width: 500,
|
|
|
|
|
padding: 20,
|
|
|
|
|
background: '#fff',
|
|
|
|
|
input: null,
|
|
|
|
|
inputPlaceholder: '',
|
|
|
|
|
inputValue: '',
|
|
|
|
|
inputOptions: {},
|
|
|
|
|
inputAutoTrim: true,
|
|
|
|
|
inputClass: null,
|
|
|
|
|
inputAttributes: {},
|
|
|
|
|
inputValidator: null,
|
|
|
|
|
progressSteps: [],
|
|
|
|
|
currentProgressStep: null,
|
|
|
|
|
progressStepsDistance: '40px',
|
|
|
|
|
onOpen: null,
|
|
|
|
|
onClose: null
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var sweetHTML = '<div class="' + swalClasses.modal + '" style="display: none" tabIndex="-1">' +
|
|
|
|
|
'<ul class="' + swalClasses.progresssteps + '"></ul>' +
|
|
|
|
|
'<div class="' + swalClasses.icon + ' ' + iconTypes.error + '">' +
|
|
|
|
|
'<span class="x-mark"><span class="line left"></span><span class="line right"></span></span>' +
|
|
|
|
|
'</div>' +
|
|
|
|
|
'<div class="' + swalClasses.icon + ' ' + iconTypes.question + '">?</div>' +
|
|
|
|
|
'<div class="' + swalClasses.icon + ' ' + iconTypes.warning + '">!</div>' +
|
|
|
|
|
'<div class="' + swalClasses.icon + ' ' + iconTypes.info + '">i</div>' +
|
|
|
|
|
'<div class="' + swalClasses.icon + ' ' + iconTypes.success + '">' +
|
|
|
|
|
'<span class="line tip"></span> <span class="line long"></span>' +
|
|
|
|
|
'<div class="placeholder"></div> <div class="fix"></div>' +
|
|
|
|
|
'</div>' +
|
|
|
|
|
'<img class="' + swalClasses.image + '">' +
|
|
|
|
|
'<h2></h2>' +
|
|
|
|
|
'<div class="' + swalClasses.content + '"></div>' +
|
|
|
|
|
'<input class="' + swalClasses.input + '">' +
|
|
|
|
|
'<input type="file" class="' + swalClasses.file + '">' +
|
|
|
|
|
'<div class="' + swalClasses.range + '">' +
|
|
|
|
|
'<output></output>' +
|
|
|
|
|
'<input type="range">' +
|
|
|
|
|
'</div>' +
|
|
|
|
|
'<select class="' + swalClasses.select + '"></select>' +
|
|
|
|
|
'<div class="' + swalClasses.radio + '"></div>' +
|
|
|
|
|
'<label for="' + swalClasses.checkbox + '" class="' + swalClasses.checkbox + '">' +
|
|
|
|
|
'<input type="checkbox">' +
|
|
|
|
|
'</label>' +
|
|
|
|
|
'<textarea class="' + swalClasses.textarea + '"></textarea>' +
|
|
|
|
|
'<div class="' + swalClasses.validationerror + '"></div>' +
|
|
|
|
|
'<hr class="' + swalClasses.spacer + '">' +
|
|
|
|
|
'<button type="button" class="' + swalClasses.confirm + '">OK</button>' +
|
|
|
|
|
'<button type="button" class="' + swalClasses.cancel + '">Cancel</button>' +
|
|
|
|
|
'<span class="' + swalClasses.close + '">×</span>' +
|
|
|
|
|
'</div>'
|
|
|
|
|
|
|
|
|
|
var sweetContainer
|
|
|
|
|
|
|
|
|
|
var existingSweetContainers = document.getElementsByClassName(swalClasses.container)
|
|
|
|
|
|
|
|
|
|
if (existingSweetContainers.length) {
|
|
|
|
|
sweetContainer = existingSweetContainers[0]
|
|
|
|
|
} else {
|
|
|
|
|
sweetContainer = document.createElement('div')
|
|
|
|
|
sweetContainer.className = swalClasses.container
|
|
|
|
|
sweetContainer.innerHTML = sweetHTML
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var extend = function(a, b) {
|
|
|
|
|
for (var key in b) {
|
|
|
|
|
if (b.hasOwnProperty(key)) {
|
|
|
|
|
a[key] = b[key]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return a
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Set hover, active and focus-states for buttons (source: http://www.sitepoint.com/javascript-generate-lighter-darker-color)
|
|
|
|
|
*/
|
|
|
|
|
var colorLuminance = function(hex, lum) {
|
|
|
|
|
// Validate hex string
|
|
|
|
|
hex = String(hex).replace(/[^0-9a-f]/gi, '')
|
|
|
|
|
if (hex.length < 6) {
|
|
|
|
|
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2]
|
|
|
|
|
}
|
|
|
|
|
lum = lum || 0
|
|
|
|
|
|
|
|
|
|
// Convert to decimal and change luminosity
|
|
|
|
|
var rgb = '#'
|
|
|
|
|
for (var i = 0; i < 3; i++) {
|
|
|
|
|
var c = parseInt(hex.substr(i * 2, 2), 16)
|
|
|
|
|
c = Math.round(Math.min(Math.max(0, c + (c * lum)), 255)).toString(16)
|
|
|
|
|
rgb += ('00' + c).substr(c.length)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return rgb
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Remember state in cases where opening and handling a modal will fiddle with it.
|
|
|
|
|
var states = {
|
|
|
|
|
previousWindowKeyDown: null,
|
|
|
|
|
previousActiveElement: null,
|
|
|
|
|
previousBodyPadding: null
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Add modal + overlay to DOM
|
|
|
|
|
*/
|
|
|
|
|
var init = function() {
|
|
|
|
|
if (typeof document === 'undefined') {
|
|
|
|
|
console.error('SweetAlert2 requires document to initialize')
|
|
|
|
|
return
|
|
|
|
|
} else if (document.getElementsByClassName(swalClasses.container).length) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
document.body.appendChild(sweetContainer)
|
|
|
|
|
|
|
|
|
|
var modal = getModal()
|
|
|
|
|
var input = getChildByClass(modal, swalClasses.input)
|
|
|
|
|
var file = getChildByClass(modal, swalClasses.file)
|
|
|
|
|
var range = modal.querySelector('.' + swalClasses.range + ' input')
|
|
|
|
|
var select = getChildByClass(modal, swalClasses.select)
|
|
|
|
|
var checkbox = modal.querySelector('.' + swalClasses.checkbox + ' input')
|
|
|
|
|
var textarea = getChildByClass(modal, swalClasses.textarea)
|
|
|
|
|
|
|
|
|
|
input.oninput = function() {
|
|
|
|
|
sweetAlert.resetValidationError()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
input.onkeyup = function(event) {
|
|
|
|
|
event.stopPropagation()
|
|
|
|
|
if (event.keyCode === 13) {
|
|
|
|
|
sweetAlert.clickConfirm()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
file.onchange = function() {
|
|
|
|
|
sweetAlert.resetValidationError()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
range.oninput = function() {
|
|
|
|
|
sweetAlert.resetValidationError()
|
|
|
|
|
range.previousSibling.value = range.value
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
range.onchange = function() {
|
|
|
|
|
sweetAlert.resetValidationError()
|
|
|
|
|
range.previousSibling.value = range.value
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
select.onchange = function() {
|
|
|
|
|
sweetAlert.resetValidationError()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
checkbox.onchange = function() {
|
|
|
|
|
sweetAlert.resetValidationError()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
textarea.oninput = function() {
|
|
|
|
|
sweetAlert.resetValidationError()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return modal
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Manipulate DOM
|
|
|
|
|
*/
|
|
|
|
|
var elementByClass = function(className) {
|
|
|
|
|
return sweetContainer.querySelector('.' + className)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var getModal = function() {
|
|
|
|
|
return document.body.querySelector('.' + swalClasses.modal) || init()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var getIcons = function() {
|
|
|
|
|
var modal = getModal()
|
|
|
|
|
return modal.querySelectorAll('.' + swalClasses.icon)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var getSpacer = function() {
|
|
|
|
|
return elementByClass(swalClasses.spacer)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var getProgressSteps = function() {
|
|
|
|
|
return elementByClass(swalClasses.progresssteps)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var getValidationError = function() {
|
|
|
|
|
return elementByClass(swalClasses.validationerror)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var getConfirmButton = function() {
|
|
|
|
|
return elementByClass(swalClasses.confirm)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var getCancelButton = function() {
|
|
|
|
|
return elementByClass(swalClasses.cancel)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var getCloseButton = function() {
|
|
|
|
|
return elementByClass(swalClasses.close)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var getFocusableElements = function(focusCancel) {
|
|
|
|
|
var buttons = [getConfirmButton(), getCancelButton()]
|
|
|
|
|
if (focusCancel) {
|
|
|
|
|
buttons.reverse()
|
|
|
|
|
}
|
|
|
|
|
return buttons.concat(Array.prototype.slice.call(
|
|
|
|
|
getModal().querySelectorAll('button:not([class^=' + swalPrefix + ']), input:not([type=hidden]), textarea, select')
|
|
|
|
|
))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var hasClass = function(elem, className) {
|
|
|
|
|
return elem.classList.contains(className)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var focusInput = function(input) {
|
|
|
|
|
input.focus()
|
|
|
|
|
|
|
|
|
|
// place cursor at end of text in text input
|
|
|
|
|
if (input.type !== 'file') {
|
|
|
|
|
// http://stackoverflow.com/a/2345915/1331425
|
|
|
|
|
var val = input.value
|
|
|
|
|
input.value = ''
|
|
|
|
|
input.value = val
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var addClass = function(elem, className) {
|
|
|
|
|
if (!elem || !className) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
var classes = className.split(/\s+/)
|
|
|
|
|
classes.forEach(function(className) {
|
|
|
|
|
elem.classList.add(className)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var removeClass = function(elem, className) {
|
|
|
|
|
if (!elem || !className) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
var classes = className.split(/\s+/)
|
|
|
|
|
classes.forEach(function(className) {
|
|
|
|
|
elem.classList.remove(className)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var getChildByClass = function(elem, className) {
|
|
|
|
|
for (var i = 0; i < elem.childNodes.length; i++) {
|
|
|
|
|
if (hasClass(elem.childNodes[i], className)) {
|
|
|
|
|
return elem.childNodes[i]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var show = function(elem, display) {
|
|
|
|
|
if (!display) {
|
|
|
|
|
display = 'block'
|
|
|
|
|
}
|
|
|
|
|
elem.style.opacity = ''
|
|
|
|
|
elem.style.display = display
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var hide = function(elem) {
|
|
|
|
|
elem.style.opacity = ''
|
|
|
|
|
elem.style.display = 'none'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var empty = function(elem) {
|
|
|
|
|
while (elem.firstChild) {
|
|
|
|
|
elem.removeChild(elem.firstChild)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// borrowed from jqeury $(elem).is(':visible') implementation
|
|
|
|
|
var isVisible = function(elem) {
|
|
|
|
|
return elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var removeStyleProperty = function(elem, property) {
|
|
|
|
|
if (elem.style.removeProperty) {
|
|
|
|
|
elem.style.removeProperty(property)
|
|
|
|
|
} else {
|
|
|
|
|
elem.style.removeAttribute(property)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var fireClick = function(node) {
|
|
|
|
|
// Taken from http://www.nonobtrusive.com/2011/11/29/programatically-fire-crossbrowser-click-event-with-javascript/
|
|
|
|
|
// Then fixed for today's Chrome browser.
|
|
|
|
|
if (typeof MouseEvent === 'function') {
|
|
|
|
|
// Up-to-date approach
|
|
|
|
|
var mevt = new MouseEvent('click', {
|
|
|
|
|
view: window,
|
|
|
|
|
bubbles: false,
|
|
|
|
|
cancelable: true
|
|
|
|
|
})
|
|
|
|
|
node.dispatchEvent(mevt)
|
|
|
|
|
} else if (document.createEvent) {
|
|
|
|
|
// Fallback
|
|
|
|
|
var evt = document.createEvent('MouseEvents')
|
|
|
|
|
evt.initEvent('click', false, false)
|
|
|
|
|
node.dispatchEvent(evt)
|
|
|
|
|
} else if (document.createEventObject) {
|
|
|
|
|
node.fireEvent('onclick')
|
|
|
|
|
} else if (typeof node.onclick === 'function') {
|
|
|
|
|
node.onclick()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var stopEventPropagation = function(e) {
|
|
|
|
|
// In particular, make sure the space bar doesn't scroll the main window.
|
|
|
|
|
if (typeof e.stopPropagation === 'function') {
|
|
|
|
|
e.stopPropagation()
|
|
|
|
|
e.preventDefault()
|
|
|
|
|
} else if (window.event && window.event.hasOwnProperty('cancelBubble')) {
|
|
|
|
|
window.event.cancelBubble = true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var animationEndEvent = (function() {
|
|
|
|
|
var testEl = document.createElement('div')
|
|
|
|
|
var transEndEventNames = {
|
|
|
|
|
'WebkitAnimation': 'webkitAnimationEnd',
|
|
|
|
|
'OAnimation': 'oAnimationEnd oanimationend',
|
|
|
|
|
'msAnimation': 'MSAnimationEnd',
|
|
|
|
|
'animation': 'animationend'
|
|
|
|
|
}
|
|
|
|
|
for (var i in transEndEventNames) {
|
|
|
|
|
if (transEndEventNames.hasOwnProperty(i) &&
|
|
|
|
|
testEl.style[i] !== undefined) {
|
|
|
|
|
return transEndEventNames[i]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false
|
|
|
|
|
})()
|
|
|
|
|
|
|
|
|
|
// Reset the page to its previous state
|
|
|
|
|
var resetPrevState = function() {
|
|
|
|
|
var modal = getModal()
|
|
|
|
|
window.onkeydown = states.previousWindowKeyDown
|
|
|
|
|
if (states.previousActiveElement && states.previousActiveElement.focus) {
|
|
|
|
|
states.previousActiveElement.focus()
|
|
|
|
|
}
|
|
|
|
|
clearTimeout(modal.timeout)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Measure width of scrollbar
|
|
|
|
|
// https://github.com/twbs/bootstrap/blob/master/js/modal.js#L279-L286
|
|
|
|
|
var measureScrollbar = function() {
|
|
|
|
|
var scrollDiv = document.createElement('div')
|
|
|
|
|
scrollDiv.style.width = '50px'
|
|
|
|
|
scrollDiv.style.height = '50px'
|
|
|
|
|
scrollDiv.style.overflow = 'scroll'
|
|
|
|
|
document.body.appendChild(scrollDiv)
|
|
|
|
|
var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth
|
|
|
|
|
document.body.removeChild(scrollDiv)
|
|
|
|
|
return scrollbarWidth
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// JavaScript Debounce Function
|
|
|
|
|
// https://davidwalsh.name/javascript-debounce-function
|
|
|
|
|
var debounce = function(func, wait, immediate) {
|
|
|
|
|
var timeout
|
|
|
|
|
return function() {
|
|
|
|
|
var context = this
|
|
|
|
|
var args = arguments
|
|
|
|
|
var later = function() {
|
|
|
|
|
timeout = null
|
|
|
|
|
if (!immediate) func.apply(context, args)
|
|
|
|
|
}
|
|
|
|
|
var callNow = immediate && !timeout
|
|
|
|
|
clearTimeout(timeout)
|
|
|
|
|
timeout = setTimeout(later, wait)
|
|
|
|
|
if (callNow) func.apply(context, args)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var modalParams = extend({}, defaultParams)
|
|
|
|
|
var queue = []
|
|
|
|
|
var swal2Observer
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Set type, text and actions on modal
|
|
|
|
|
*/
|
|
|
|
|
var setParameters = function(params) {
|
|
|
|
|
var modal = getModal()
|
|
|
|
|
|
|
|
|
|
for (var param in params) {
|
|
|
|
|
if (!defaultParams.hasOwnProperty(param) && param !== 'extraParams') {
|
|
|
|
|
console.warn('SweetAlert2: Unknown parameter "' + param + '"')
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// set modal width and margin-left
|
|
|
|
|
modal.style.width = (typeof params.width === 'number') ? params.width + 'px' : params.width
|
|
|
|
|
|
|
|
|
|
modal.style.padding = params.padding + 'px'
|
|
|
|
|
modal.style.background = params.background
|
|
|
|
|
|
|
|
|
|
var $title = modal.querySelector('h2')
|
|
|
|
|
var $content = modal.querySelector('.' + swalClasses.content)
|
|
|
|
|
var $confirmBtn = getConfirmButton()
|
|
|
|
|
var $cancelBtn = getCancelButton()
|
|
|
|
|
var $closeButton = modal.querySelector('.' + swalClasses.close)
|
|
|
|
|
|
|
|
|
|
// Title
|
|
|
|
|
$title.innerHTML = params.title.split('\n').join('<br>')
|
|
|
|
|
|
|
|
|
|
// Content
|
|
|
|
|
var i
|
|
|
|
|
if (params.text || params.html) {
|
|
|
|
|
if (typeof params.html === 'object') {
|
|
|
|
|
$content.innerHTML = ''
|
|
|
|
|
if (0 in params.html) {
|
|
|
|
|
for (i = 0; i in params.html; i++) {
|
|
|
|
|
$content.appendChild(params.html[i].cloneNode(true))
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$content.appendChild(params.html.cloneNode(true))
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$content.innerHTML = params.html || (params.text.split('\n').join('<br>'))
|
|
|
|
|
}
|
|
|
|
|
show($content)
|
|
|
|
|
} else {
|
|
|
|
|
hide($content)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Close button
|
|
|
|
|
if (params.showCloseButton) {
|
|
|
|
|
show($closeButton)
|
|
|
|
|
} else {
|
|
|
|
|
hide($closeButton)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Custom Class
|
|
|
|
|
modal.className = swalClasses.modal
|
|
|
|
|
if (params.customClass) {
|
|
|
|
|
addClass(modal, params.customClass)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Progress steps
|
|
|
|
|
var progressStepsContainer = getProgressSteps()
|
|
|
|
|
var currentProgressStep = parseInt(params.currentProgressStep === null ? sweetAlert.getQueueStep() : params.currentProgressStep, 10)
|
|
|
|
|
if (params.progressSteps.length) {
|
|
|
|
|
show(progressStepsContainer)
|
|
|
|
|
empty(progressStepsContainer)
|
|
|
|
|
if (currentProgressStep >= params.progressSteps.length) {
|
|
|
|
|
console.warn(
|
|
|
|
|
'SweetAlert2: Invalid currentProgressStep parameter, it should be less than progressSteps.length ' +
|
|
|
|
|
'(currentProgressStep like JS arrays starts from 0)'
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
params.progressSteps.forEach(function(step, index) {
|
|
|
|
|
var circle = document.createElement('li')
|
|
|
|
|
addClass(circle, swalClasses.progresscircle)
|
|
|
|
|
circle.innerHTML = step
|
|
|
|
|
if (index === currentProgressStep) {
|
|
|
|
|
addClass(circle, swalClasses.activeprogressstep)
|
|
|
|
|
}
|
|
|
|
|
progressStepsContainer.appendChild(circle)
|
|
|
|
|
if (index !== params.progressSteps.length - 1) {
|
|
|
|
|
var line = document.createElement('li')
|
|
|
|
|
addClass(line, swalClasses.progressline)
|
|
|
|
|
line.style.width = params.progressStepsDistance
|
|
|
|
|
progressStepsContainer.appendChild(line)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
hide(progressStepsContainer)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Icon
|
|
|
|
|
var icons = getIcons()
|
|
|
|
|
for (i = 0; i < icons.length; i++) {
|
|
|
|
|
hide(icons[i])
|
|
|
|
|
}
|
|
|
|
|
if (params.type) {
|
|
|
|
|
var validType = false
|
|
|
|
|
for (var iconType in iconTypes) {
|
|
|
|
|
if (params.type === iconType) {
|
|
|
|
|
validType = true
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!validType) {
|
|
|
|
|
console.error('SweetAlert2: Unknown alert type: ' + params.type)
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
var $icon = modal.querySelector('.' + swalClasses.icon + '.' + iconTypes[params.type])
|
|
|
|
|
show($icon)
|
|
|
|
|
|
|
|
|
|
// Animate icon
|
|
|
|
|
switch (params.type) {
|
|
|
|
|
case 'success':
|
|
|
|
|
addClass($icon, 'animate')
|
|
|
|
|
addClass($icon.querySelector('.tip'), 'animate-success-tip')
|
|
|
|
|
addClass($icon.querySelector('.long'), 'animate-success-long')
|
|
|
|
|
break
|
|
|
|
|
case 'error':
|
|
|
|
|
addClass($icon, 'animate-error-icon')
|
|
|
|
|
addClass($icon.querySelector('.x-mark'), 'animate-x-mark')
|
|
|
|
|
break
|
|
|
|
|
case 'warning':
|
|
|
|
|
addClass($icon, 'pulse-warning')
|
|
|
|
|
break
|
|
|
|
|
default:
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Custom image
|
|
|
|
|
var $customImage = modal.querySelector('.' + swalClasses.image)
|
|
|
|
|
if (params.imageUrl) {
|
|
|
|
|
$customImage.setAttribute('src', params.imageUrl)
|
|
|
|
|
show($customImage)
|
|
|
|
|
|
|
|
|
|
if (params.imageWidth) {
|
|
|
|
|
$customImage.setAttribute('width', params.imageWidth)
|
|
|
|
|
} else {
|
|
|
|
|
$customImage.removeAttribute('width')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (params.imageHeight) {
|
|
|
|
|
$customImage.setAttribute('height', params.imageHeight)
|
|
|
|
|
} else {
|
|
|
|
|
$customImage.removeAttribute('height')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$customImage.className = swalClasses.image
|
|
|
|
|
if (params.imageClass) {
|
|
|
|
|
addClass($customImage, params.imageClass)
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
hide($customImage)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Cancel button
|
|
|
|
|
if (params.showCancelButton) {
|
|
|
|
|
$cancelBtn.style.display = 'inline-block'
|
|
|
|
|
} else {
|
|
|
|
|
hide($cancelBtn)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Confirm button
|
|
|
|
|
if (params.showConfirmButton) {
|
|
|
|
|
removeStyleProperty($confirmBtn, 'display')
|
|
|
|
|
} else {
|
|
|
|
|
hide($confirmBtn)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Buttons spacer
|
|
|
|
|
var spacer = getSpacer()
|
|
|
|
|
if (!params.showConfirmButton && !params.showCancelButton) {
|
|
|
|
|
hide(spacer)
|
|
|
|
|
} else {
|
|
|
|
|
show(spacer)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Edit text on cancel and confirm buttons
|
|
|
|
|
$confirmBtn.innerHTML = params.confirmButtonText
|
|
|
|
|
$cancelBtn.innerHTML = params.cancelButtonText
|
|
|
|
|
|
|
|
|
|
// Set buttons to selected background colors
|
|
|
|
|
if (params.buttonsStyling) {
|
|
|
|
|
$confirmBtn.style.backgroundColor = params.confirmButtonColor
|
|
|
|
|
$cancelBtn.style.backgroundColor = params.cancelButtonColor
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Add buttons custom classes
|
|
|
|
|
$confirmBtn.className = swalClasses.confirm
|
|
|
|
|
addClass($confirmBtn, params.confirmButtonClass)
|
|
|
|
|
$cancelBtn.className = swalClasses.cancel
|
|
|
|
|
addClass($cancelBtn, params.cancelButtonClass)
|
|
|
|
|
|
|
|
|
|
// Buttons styling
|
|
|
|
|
if (params.buttonsStyling) {
|
|
|
|
|
addClass($confirmBtn, swalClasses.styled)
|
|
|
|
|
addClass($cancelBtn, swalClasses.styled)
|
|
|
|
|
} else {
|
|
|
|
|
removeClass($confirmBtn, swalClasses.styled)
|
|
|
|
|
removeClass($cancelBtn, swalClasses.styled)
|
|
|
|
|
|
|
|
|
|
$confirmBtn.style.backgroundColor = $confirmBtn.style.borderLeftColor = $confirmBtn.style.borderRightColor = ''
|
|
|
|
|
$cancelBtn.style.backgroundColor = $cancelBtn.style.borderLeftColor = $cancelBtn.style.borderRightColor = ''
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// CSS animation
|
|
|
|
|
if (params.animation === true) {
|
|
|
|
|
removeClass(modal, swalClasses.noanimation)
|
|
|
|
|
} else {
|
|
|
|
|
addClass(modal, swalClasses.noanimation)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Animations
|
|
|
|
|
*/
|
|
|
|
|
var openModal = function(animation, onComplete) {
|
|
|
|
|
var modal = getModal()
|
|
|
|
|
if (animation) {
|
|
|
|
|
addClass(modal, swalClasses.show)
|
|
|
|
|
addClass(sweetContainer, swalClasses.fade)
|
|
|
|
|
removeClass(modal, swalClasses.hide)
|
|
|
|
|
} else {
|
|
|
|
|
removeClass(modal, swalClasses.fade)
|
|
|
|
|
}
|
|
|
|
|
show(modal)
|
|
|
|
|
|
|
|
|
|
// scrolling is 'hidden' until animation is done, after that 'auto'
|
|
|
|
|
sweetContainer.style.overflowY = 'hidden'
|
|
|
|
|
if (animationEndEvent && !hasClass(modal, swalClasses.noanimation)) {
|
|
|
|
|
modal.addEventListener(animationEndEvent, function swalCloseEventFinished() {
|
|
|
|
|
modal.removeEventListener(animationEndEvent, swalCloseEventFinished)
|
|
|
|
|
sweetContainer.style.overflowY = 'auto'
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
sweetContainer.style.overflowY = 'auto'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
addClass(sweetContainer, swalClasses.in)
|
|
|
|
|
addClass(document.body, swalClasses.in)
|
|
|
|
|
fixScrollbar()
|
|
|
|
|
iOSfix()
|
|
|
|
|
states.previousActiveElement = document.activeElement
|
|
|
|
|
if (onComplete !== null && typeof onComplete === 'function') {
|
|
|
|
|
onComplete.call(this, modal)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function fixScrollbar() {
|
|
|
|
|
// for queues, do not do this more than once
|
|
|
|
|
if (states.previousBodyPadding !== null) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
// if the body has overflow
|
|
|
|
|
if (document.body.scrollHeight > window.innerHeight) {
|
|
|
|
|
// add padding so the content doesn't shift after removal of scrollbar
|
|
|
|
|
states.previousBodyPadding = document.body.style.paddingRight
|
|
|
|
|
document.body.style.paddingRight = measureScrollbar() + 'px'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function undoScrollbar() {
|
|
|
|
|
if (states.previousBodyPadding !== null) {
|
|
|
|
|
document.body.style.paddingRight = states.previousBodyPadding
|
|
|
|
|
states.previousBodyPadding = null
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Fix iOS scrolling http://stackoverflow.com/q/39626302/1331425
|
|
|
|
|
function iOSfix() {
|
|
|
|
|
var iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream
|
|
|
|
|
if (iOS && !hasClass(document.body, swalClasses.iosfix)) {
|
|
|
|
|
var offset = document.body.scrollTop
|
|
|
|
|
document.body.style.top = (offset * -1) + 'px'
|
|
|
|
|
addClass(document.body, swalClasses.iosfix)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function undoIOSfix() {
|
|
|
|
|
if (hasClass(document.body, swalClasses.iosfix)) {
|
|
|
|
|
var offset = parseInt(document.body.style.top, 10)
|
|
|
|
|
removeClass(document.body, swalClasses.iosfix)
|
|
|
|
|
document.body.scrollTop = (offset * -1)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function modalDependant() {
|
|
|
|
|
if (arguments[0] === undefined) {
|
|
|
|
|
console.error('SweetAlert2 expects at least 1 attribute!')
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var params = extend({}, modalParams)
|
|
|
|
|
|
|
|
|
|
switch (typeof arguments[0]) {
|
|
|
|
|
|
|
|
|
|
case 'string':
|
|
|
|
|
params.title = arguments[0]
|
|
|
|
|
params.text = arguments[1] || ''
|
|
|
|
|
params.type = arguments[2] || ''
|
|
|
|
|
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
case 'object':
|
|
|
|
|
extend(params, arguments[0])
|
|
|
|
|
params.extraParams = arguments[0].extraParams
|
|
|
|
|
|
|
|
|
|
if (params.input === 'email' && params.inputValidator === null) {
|
|
|
|
|
params.inputValidator = function(email) {
|
|
|
|
|
return new Promise(function(resolve, reject) {
|
|
|
|
|
var emailRegex = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/
|
|
|
|
|
if (emailRegex.test(email)) {
|
|
|
|
|
resolve()
|
|
|
|
|
} else {
|
|
|
|
|
reject('Invalid email address')
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
console.error('SweetAlert2: Unexpected type of argument! Expected "string" or "object", got ' + typeof arguments[0])
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setParameters(params)
|
|
|
|
|
|
|
|
|
|
// Modal interactions
|
|
|
|
|
var modal = getModal()
|
|
|
|
|
|
|
|
|
|
return new Promise(function(resolve, reject) {
|
|
|
|
|
// Close on timer
|
|
|
|
|
if (params.timer) {
|
|
|
|
|
modal.timeout = setTimeout(function() {
|
|
|
|
|
sweetAlert.closeModal(params.onClose)
|
|
|
|
|
reject('timer')
|
|
|
|
|
}, params.timer)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Get input element by specified type or, if type isn't specified, by params.input
|
|
|
|
|
var getInput = function(inputType) {
|
|
|
|
|
inputType = inputType || params.input
|
|
|
|
|
switch (inputType) {
|
|
|
|
|
case 'select':
|
|
|
|
|
case 'textarea':
|
|
|
|
|
case 'file':
|
|
|
|
|
return getChildByClass(modal, swalClasses[inputType])
|
|
|
|
|
case 'checkbox':
|
|
|
|
|
return modal.querySelector('.' + swalClasses.checkbox + ' input')
|
|
|
|
|
case 'radio':
|
|
|
|
|
return modal.querySelector('.' + swalClasses.radio + ' input:checked') ||
|
|
|
|
|
modal.querySelector('.' + swalClasses.radio + ' input:first-child')
|
|
|
|
|
case 'range':
|
|
|
|
|
return modal.querySelector('.' + swalClasses.range + ' input')
|
|
|
|
|
default:
|
|
|
|
|
return getChildByClass(modal, swalClasses.input)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Get the value of the modal input
|
|
|
|
|
var getInputValue = function() {
|
|
|
|
|
var input = getInput()
|
|
|
|
|
if (!input) {
|
|
|
|
|
return null
|
|
|
|
|
}
|
|
|
|
|
switch (params.input) {
|
|
|
|
|
case 'checkbox':
|
|
|
|
|
return input.checked ? 1 : 0
|
|
|
|
|
case 'radio':
|
|
|
|
|
return input.checked ? input.value : null
|
|
|
|
|
case 'file':
|
|
|
|
|
return input.files.length ? input.files[0] : null
|
|
|
|
|
default:
|
|
|
|
|
return params.inputAutoTrim ? input.value.trim() : input.value
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// input autofocus
|
|
|
|
|
if (params.input) {
|
|
|
|
|
setTimeout(function() {
|
|
|
|
|
var input = getInput()
|
|
|
|
|
if (input) {
|
|
|
|
|
focusInput(input)
|
|
|
|
|
}
|
|
|
|
|
}, 0)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var confirm = function(value) {
|
|
|
|
|
if (params.showLoaderOnConfirm) {
|
|
|
|
|
sweetAlert.showLoading()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (params.preConfirm) {
|
|
|
|
|
params.preConfirm(value, params.extraParams).then(
|
|
|
|
|
function(preConfirmValue) {
|
|
|
|
|
sweetAlert.closeModal(params.onClose)
|
|
|
|
|
resolve(preConfirmValue || value)
|
|
|
|
|
},
|
|
|
|
|
function(error) {
|
|
|
|
|
sweetAlert.hideLoading()
|
|
|
|
|
if (error) {
|
|
|
|
|
sweetAlert.showValidationError(error)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
} else {
|
|
|
|
|
sweetAlert.closeModal(params.onClose)
|
|
|
|
|
resolve(value)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Mouse interactions
|
|
|
|
|
var onButtonEvent = function(event) {
|
|
|
|
|
var e = event || window.event
|
|
|
|
|
var target = e.target || e.srcElement
|
|
|
|
|
var confirmBtn = getConfirmButton()
|
|
|
|
|
var cancelBtn = getCancelButton()
|
|
|
|
|
var targetedConfirm = confirmBtn === target || confirmBtn.contains(target)
|
|
|
|
|
var targetedCancel = cancelBtn === target || cancelBtn.contains(target)
|
|
|
|
|
|
|
|
|
|
switch (e.type) {
|
|
|
|
|
case 'mouseover':
|
|
|
|
|
case 'mouseup':
|
|
|
|
|
if (params.buttonsStyling) {
|
|
|
|
|
if (targetedConfirm) {
|
|
|
|
|
confirmBtn.style.backgroundColor = colorLuminance(params.confirmButtonColor, -0.1)
|
|
|
|
|
} else if (targetedCancel) {
|
|
|
|
|
cancelBtn.style.backgroundColor = colorLuminance(params.cancelButtonColor, -0.1)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break
|
|
|
|
|
case 'mouseout':
|
|
|
|
|
if (params.buttonsStyling) {
|
|
|
|
|
if (targetedConfirm) {
|
|
|
|
|
confirmBtn.style.backgroundColor = params.confirmButtonColor
|
|
|
|
|
} else if (targetedCancel) {
|
|
|
|
|
cancelBtn.style.backgroundColor = params.cancelButtonColor
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break
|
|
|
|
|
case 'mousedown':
|
|
|
|
|
if (params.buttonsStyling) {
|
|
|
|
|
if (targetedConfirm) {
|
|
|
|
|
confirmBtn.style.backgroundColor = colorLuminance(params.confirmButtonColor, -0.2)
|
|
|
|
|
} else if (targetedCancel) {
|
|
|
|
|
cancelBtn.style.backgroundColor = colorLuminance(params.cancelButtonColor, -0.2)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break
|
|
|
|
|
case 'click':
|
|
|
|
|
// Clicked 'confirm'
|
|
|
|
|
if (targetedConfirm && sweetAlert.isVisible()) {
|
|
|
|
|
if (params.input) {
|
|
|
|
|
var inputValue = getInputValue()
|
|
|
|
|
|
|
|
|
|
if (params.inputValidator) {
|
|
|
|
|
sweetAlert.disableInput()
|
|
|
|
|
params.inputValidator(inputValue, params.extraParams).then(
|
|
|
|
|
function() {
|
|
|
|
|
sweetAlert.enableInput()
|
|
|
|
|
confirm(inputValue)
|
|
|
|
|
},
|
|
|
|
|
function(error) {
|
|
|
|
|
sweetAlert.enableInput()
|
|
|
|
|
if (error) {
|
|
|
|
|
sweetAlert.showValidationError(error)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
} else {
|
|
|
|
|
confirm(inputValue)
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
confirm(true)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Clicked 'cancel'
|
|
|
|
|
} else if (targetedCancel && sweetAlert.isVisible()) {
|
|
|
|
|
sweetAlert.closeModal(params.onClose)
|
|
|
|
|
reject('cancel')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break
|
|
|
|
|
default:
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var $buttons = modal.querySelectorAll('button')
|
|
|
|
|
var i
|
|
|
|
|
for (i = 0; i < $buttons.length; i++) {
|
|
|
|
|
$buttons[i].onclick = onButtonEvent
|
|
|
|
|
$buttons[i].onmouseover = onButtonEvent
|
|
|
|
|
$buttons[i].onmouseout = onButtonEvent
|
|
|
|
|
$buttons[i].onmousedown = onButtonEvent
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Closing modal by close button
|
|
|
|
|
getCloseButton().onclick = function() {
|
|
|
|
|
sweetAlert.closeModal(params.onClose)
|
|
|
|
|
reject('close')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Closing modal by overlay click
|
|
|
|
|
sweetContainer.onclick = function(e) {
|
|
|
|
|
if (e.target !== sweetContainer) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (params.allowOutsideClick) {
|
|
|
|
|
sweetAlert.closeModal(params.onClose)
|
|
|
|
|
reject('overlay')
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var $confirmButton = getConfirmButton()
|
|
|
|
|
var $cancelButton = getCancelButton()
|
|
|
|
|
|
|
|
|
|
// Reverse buttons if neede d
|
|
|
|
|
if (params.reverseButtons) {
|
|
|
|
|
$confirmButton.parentNode.insertBefore($cancelButton, $confirmButton)
|
|
|
|
|
} else {
|
|
|
|
|
$confirmButton.parentNode.insertBefore($confirmButton, $cancelButton)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Focus handling
|
|
|
|
|
function setFocus(index, increment) {
|
|
|
|
|
var focusableElements = getFocusableElements(params.focusCancel)
|
|
|
|
|
// search for visible elements and select the next possible match
|
|
|
|
|
for (var i = 0; i < focusableElements.length; i++) {
|
|
|
|
|
index = index + increment
|
|
|
|
|
|
|
|
|
|
// rollover to first item
|
|
|
|
|
if (index === focusableElements.length) {
|
|
|
|
|
index = 0
|
|
|
|
|
|
|
|
|
|
// go to last item
|
|
|
|
|
} else if (index === -1) {
|
|
|
|
|
index = focusableElements.length - 1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// determine if element is visible
|
|
|
|
|
var el = focusableElements[index]
|
|
|
|
|
if (isVisible(el)) {
|
|
|
|
|
return el.focus()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function handleKeyDown(event) {
|
|
|
|
|
var e = event || window.event
|
|
|
|
|
var keyCode = e.keyCode || e.which
|
|
|
|
|
|
|
|
|
|
if ([9, 13, 32, 27].indexOf(keyCode) === -1) {
|
|
|
|
|
// Don't do work on keys we don't care about.
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var $targetElement = e.target || e.srcElement
|
|
|
|
|
|
|
|
|
|
var focusableElements = getFocusableElements(params.focusCancel)
|
|
|
|
|
var btnIndex = -1 // Find the button - note, this is a nodelist, not an array.
|
|
|
|
|
for (var i = 0; i < focusableElements.length; i++) {
|
|
|
|
|
if ($targetElement === focusableElements[i]) {
|
|
|
|
|
btnIndex = i
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TAB
|
|
|
|
|
if (keyCode === 9) {
|
|
|
|
|
if (!e.shiftKey) {
|
|
|
|
|
// Cycle to the next button
|
|
|
|
|
setFocus(btnIndex, 1)
|
|
|
|
|
} else {
|
|
|
|
|
// Cycle to the prev button
|
|
|
|
|
setFocus(btnIndex, -1)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
stopEventPropagation(e)
|
|
|
|
|
} else {
|
|
|
|
|
if (keyCode === 13 || keyCode === 32) {
|
|
|
|
|
if (btnIndex === -1) {
|
|
|
|
|
// ENTER/SPACE clicked outside of a button.
|
|
|
|
|
if (params.focusCancel) {
|
|
|
|
|
fireClick($cancelButton, e)
|
|
|
|
|
} else {
|
|
|
|
|
fireClick($confirmButton, e)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (keyCode === 27 && params.allowEscapeKey === true) {
|
|
|
|
|
sweetAlert.closeModal(params.onClose)
|
|
|
|
|
reject('esc')
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
states.previousWindowKeyDown = window.onkeydown
|
|
|
|
|
window.onkeydown = handleKeyDown
|
|
|
|
|
|
|
|
|
|
// Loading state
|
|
|
|
|
if (params.buttonsStyling) {
|
|
|
|
|
$confirmButton.style.borderLeftColor = params.confirmButtonColor
|
|
|
|
|
$confirmButton.style.borderRightColor = params.confirmButtonColor
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Show spinner instead of Confirm button and disable Cancel button
|
|
|
|
|
*/
|
|
|
|
|
sweetAlert.showLoading = sweetAlert.enableLoading = function() {
|
|
|
|
|
show(getSpacer())
|
|
|
|
|
show($confirmButton, 'inline-block')
|
|
|
|
|
addClass($confirmButton, swalClasses.loading)
|
|
|
|
|
addClass(modal, swalClasses.loading)
|
|
|
|
|
$confirmButton.disabled = true
|
|
|
|
|
$cancelButton.disabled = true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Show spinner instead of Confirm button and disable Cancel button
|
|
|
|
|
*/
|
|
|
|
|
sweetAlert.hideLoading = sweetAlert.disableLoading = function() {
|
|
|
|
|
if (!params.showConfirmButton) {
|
|
|
|
|
hide($confirmButton)
|
|
|
|
|
if (!params.showCancelButton) {
|
|
|
|
|
hide(getSpacer())
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
removeClass($confirmButton, swalClasses.loading)
|
|
|
|
|
removeClass(modal, swalClasses.loading)
|
|
|
|
|
$confirmButton.disabled = false
|
|
|
|
|
$cancelButton.disabled = false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sweetAlert.enableButtons = function() {
|
|
|
|
|
$confirmButton.disabled = false
|
|
|
|
|
$cancelButton.disabled = false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sweetAlert.disableButtons = function() {
|
|
|
|
|
$confirmButton.disabled = true
|
|
|
|
|
$cancelButton.disabled = true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sweetAlert.enableConfirmButton = function() {
|
|
|
|
|
$confirmButton.disabled = false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sweetAlert.disableConfirmButton = function() {
|
|
|
|
|
$confirmButton.disabled = true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sweetAlert.enableInput = function() {
|
|
|
|
|
var input = getInput()
|
|
|
|
|
if (!input) {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
if (input.type === 'radio') {
|
|
|
|
|
var radiosContainer = input.parentNode.parentNode
|
|
|
|
|
var radios = radiosContainer.querySelectorAll('input')
|
|
|
|
|
for (var i = 0; i < radios.length; i++) {
|
|
|
|
|
radios[i].disabled = false
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
input.disabled = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sweetAlert.disableInput = function() {
|
|
|
|
|
var input = getInput()
|
|
|
|
|
if (!input) {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
if (input && input.type === 'radio') {
|
|
|
|
|
var radiosContainer = input.parentNode.parentNode
|
|
|
|
|
var radios = radiosContainer.querySelectorAll('input')
|
|
|
|
|
for (var i = 0; i < radios.length; i++) {
|
|
|
|
|
radios[i].disabled = true
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
input.disabled = true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Set modal min-height to disable scrolling inside the modal
|
|
|
|
|
sweetAlert.recalculateHeight = debounce(function() {
|
|
|
|
|
var modal = getModal()
|
|
|
|
|
var prevState = modal.style.display
|
|
|
|
|
modal.style.minHeight = ''
|
|
|
|
|
show(modal)
|
|
|
|
|
modal.style.minHeight = (modal.scrollHeight + 1) + 'px'
|
|
|
|
|
modal.style.display = prevState
|
|
|
|
|
}, 50)
|
|
|
|
|
|
|
|
|
|
// Show block with validation error
|
|
|
|
|
sweetAlert.showValidationError = function(error) {
|
|
|
|
|
var validationError = getValidationError()
|
|
|
|
|
validationError.innerHTML = error
|
|
|
|
|
show(validationError)
|
|
|
|
|
|
|
|
|
|
var input = getInput()
|
|
|
|
|
focusInput(input)
|
|
|
|
|
addClass(input, swalClasses.inputerror)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Hide block with validation error
|
|
|
|
|
sweetAlert.resetValidationError = function() {
|
|
|
|
|
var validationError = getValidationError()
|
|
|
|
|
hide(validationError)
|
|
|
|
|
sweetAlert.recalculateHeight()
|
|
|
|
|
|
|
|
|
|
var input = getInput()
|
|
|
|
|
if (input) {
|
|
|
|
|
removeClass(input, swalClasses.inputerror)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sweetAlert.getProgressSteps = function() {
|
|
|
|
|
return params.progressSteps
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sweetAlert.setProgressSteps = function(progressSteps) {
|
|
|
|
|
params.progressSteps = progressSteps
|
|
|
|
|
setParameters(params)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sweetAlert.showProgressSteps = function() {
|
|
|
|
|
show(getProgressSteps())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sweetAlert.hideProgressSteps = function() {
|
|
|
|
|
hide(getProgressSteps())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sweetAlert.enableButtons()
|
|
|
|
|
sweetAlert.hideLoading()
|
|
|
|
|
sweetAlert.resetValidationError()
|
|
|
|
|
|
|
|
|
|
// inputs
|
|
|
|
|
var inputTypes = ['input', 'file', 'range', 'select', 'radio', 'checkbox', 'textarea']
|
|
|
|
|
var input
|
|
|
|
|
for (i = 0; i < inputTypes.length; i++) {
|
|
|
|
|
var inputClass = swalClasses[inputTypes[i]]
|
|
|
|
|
var inputContainer = getChildByClass(modal, inputClass)
|
|
|
|
|
input = getInput(inputTypes[i])
|
|
|
|
|
|
|
|
|
|
// set attributes
|
|
|
|
|
if (input) {
|
|
|
|
|
for (var j in input.attributes) {
|
|
|
|
|
if (input.attributes.hasOwnProperty(j)) {
|
|
|
|
|
var attrName = input.attributes[j].name
|
|
|
|
|
if (attrName !== 'type' && attrName !== 'value') {
|
|
|
|
|
input.removeAttribute(attrName)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for (var attr in params.inputAttributes) {
|
|
|
|
|
input.setAttribute(attr, params.inputAttributes[attr])
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// set class
|
|
|
|
|
inputContainer.className = inputClass
|
|
|
|
|
if (params.inputClass) {
|
|
|
|
|
addClass(inputContainer, params.inputClass)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
hide(inputContainer)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var populateInputOptions
|
|
|
|
|
switch (params.input) {
|
|
|
|
|
case 'text':
|
|
|
|
|
case 'email':
|
|
|
|
|
case 'password':
|
|
|
|
|
case 'number':
|
|
|
|
|
case 'tel':
|
|
|
|
|
input = getChildByClass(modal, swalClasses.input)
|
|
|
|
|
input.value = params.inputValue
|
|
|
|
|
input.placeholder = params.inputPlaceholder
|
|
|
|
|
input.type = params.input
|
|
|
|
|
show(input)
|
|
|
|
|
break
|
|
|
|
|
case 'file':
|
|
|
|
|
input = getChildByClass(modal, swalClasses.file)
|
|
|
|
|
input.placeholder = params.inputPlaceholder
|
|
|
|
|
input.type = params.input
|
|
|
|
|
show(input)
|
|
|
|
|
break
|
|
|
|
|
case 'range':
|
|
|
|
|
var range = getChildByClass(modal, swalClasses.range)
|
|
|
|
|
var rangeInput = range.querySelector('input')
|
|
|
|
|
var rangeOutput = range.querySelector('output')
|
|
|
|
|
rangeInput.value = params.inputValue
|
|
|
|
|
rangeInput.type = params.input
|
|
|
|
|
rangeOutput.value = params.inputValue
|
|
|
|
|
show(range)
|
|
|
|
|
break
|
|
|
|
|
case 'select':
|
|
|
|
|
var select = getChildByClass(modal, swalClasses.select)
|
|
|
|
|
select.innerHTML = ''
|
|
|
|
|
if (params.inputPlaceholder) {
|
|
|
|
|
var placeholder = document.createElement('option')
|
|
|
|
|
placeholder.innerHTML = params.inputPlaceholder
|
|
|
|
|
placeholder.value = ''
|
|
|
|
|
placeholder.disabled = true
|
|
|
|
|
placeholder.selected = true
|
|
|
|
|
select.appendChild(placeholder)
|
|
|
|
|
}
|
|
|
|
|
populateInputOptions = function(inputOptions) {
|
|
|
|
|
for (var optionValue in inputOptions) {
|
|
|
|
|
var option = document.createElement('option')
|
|
|
|
|
option.value = optionValue
|
|
|
|
|
option.innerHTML = inputOptions[optionValue]
|
|
|
|
|
if (params.inputValue === optionValue) {
|
|
|
|
|
option.selected = true
|
|
|
|
|
}
|
|
|
|
|
select.appendChild(option)
|
|
|
|
|
}
|
|
|
|
|
show(select)
|
|
|
|
|
select.focus()
|
|
|
|
|
}
|
|
|
|
|
break
|
|
|
|
|
case 'radio':
|
|
|
|
|
var radio = getChildByClass(modal, swalClasses.radio)
|
|
|
|
|
radio.innerHTML = ''
|
|
|
|
|
populateInputOptions = function(inputOptions) {
|
|
|
|
|
for (var radioValue in inputOptions) {
|
|
|
|
|
var id = 1
|
|
|
|
|
var radioInput = document.createElement('input')
|
|
|
|
|
var radioLabel = document.createElement('label')
|
|
|
|
|
var radioLabelSpan = document.createElement('span')
|
|
|
|
|
radioInput.type = 'radio'
|
|
|
|
|
radioInput.name = swalClasses.radio
|
|
|
|
|
radioInput.value = radioValue
|
|
|
|
|
radioInput.id = swalClasses.radio + '-' + (id++)
|
|
|
|
|
if (params.inputValue === radioValue) {
|
|
|
|
|
radioInput.checked = true
|
|
|
|
|
}
|
|
|
|
|
radioLabelSpan.innerHTML = inputOptions[radioValue]
|
|
|
|
|
radioLabel.appendChild(radioInput)
|
|
|
|
|
radioLabel.appendChild(radioLabelSpan)
|
|
|
|
|
radioLabel.for = radioInput.id
|
|
|
|
|
radio.appendChild(radioLabel)
|
|
|
|
|
}
|
|
|
|
|
show(radio)
|
|
|
|
|
var radios = radio.querySelectorAll('input')
|
|
|
|
|
if (radios.length) {
|
|
|
|
|
radios[0].focus()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break
|
|
|
|
|
case 'checkbox':
|
|
|
|
|
var checkbox = getChildByClass(modal, swalClasses.checkbox)
|
|
|
|
|
var checkboxInput = getInput('checkbox')
|
|
|
|
|
checkboxInput.type = 'checkbox'
|
|
|
|
|
checkboxInput.value = 1
|
|
|
|
|
checkboxInput.id = swalClasses.checkbox
|
|
|
|
|
checkboxInput.checked = Boolean(params.inputValue)
|
|
|
|
|
var label = checkbox.getElementsByTagName('span')
|
|
|
|
|
if (label.length) {
|
|
|
|
|
checkbox.removeChild(label[0])
|
|
|
|
|
}
|
|
|
|
|
label = document.createElement('span')
|
|
|
|
|
label.innerHTML = params.inputPlaceholder
|
|
|
|
|
checkbox.appendChild(label)
|
|
|
|
|
show(checkbox)
|
|
|
|
|
break
|
|
|
|
|
case 'textarea':
|
|
|
|
|
var textarea = getChildByClass(modal, swalClasses.textarea)
|
|
|
|
|
textarea.value = params.inputValue
|
|
|
|
|
textarea.placeholder = params.inputPlaceholder
|
|
|
|
|
show(textarea)
|
|
|
|
|
break
|
|
|
|
|
case null:
|
|
|
|
|
break
|
|
|
|
|
default:
|
|
|
|
|
console.error('SweetAlert2: Unexpected type of input! Expected "text" or "email" or "password", "select", "checkbox", "textarea" or "file", got "' + params.input + '"')
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (params.input === 'select' || params.input === 'radio') {
|
|
|
|
|
if (params.inputOptions instanceof Promise) {
|
|
|
|
|
sweetAlert.showLoading()
|
|
|
|
|
params.inputOptions.then(function(inputOptions) {
|
|
|
|
|
sweetAlert.hideLoading()
|
|
|
|
|
populateInputOptions(inputOptions)
|
|
|
|
|
})
|
|
|
|
|
} else if (typeof params.inputOptions === 'object') {
|
|
|
|
|
populateInputOptions(params.inputOptions)
|
|
|
|
|
} else {
|
|
|
|
|
console.error('SweetAlert2: Unexpected type of inputOptions! Expected object or Promise, got ' + typeof params.inputOptions)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
openModal(params.animation, params.onOpen)
|
|
|
|
|
|
|
|
|
|
// Focus the first element (input or button)
|
|
|
|
|
setFocus(-1, 1)
|
|
|
|
|
|
|
|
|
|
// fix scroll
|
|
|
|
|
sweetContainer.scrollTop = 0
|
|
|
|
|
|
|
|
|
|
// Observe changes inside the modal and adjust height
|
|
|
|
|
if (typeof MutationObserver !== 'undefined' && !swal2Observer) {
|
|
|
|
|
swal2Observer = new MutationObserver(sweetAlert.recalculateHeight)
|
|
|
|
|
swal2Observer.observe(modal, {
|
|
|
|
|
childList: true,
|
|
|
|
|
characterData: true,
|
|
|
|
|
subtree: true
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// SweetAlert function
|
|
|
|
|
function sweetAlert() {
|
|
|
|
|
// Copy arguments to the local args variable
|
|
|
|
|
var args = arguments
|
|
|
|
|
|
|
|
|
|
if (sweetAlert.isVisible()) {
|
|
|
|
|
sweetAlert.close()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return modalDependant.apply(this, args)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Global function to determine if swal2 modal is visible
|
|
|
|
|
*/
|
|
|
|
|
sweetAlert.isVisible = function() {
|
|
|
|
|
var modal = getModal()
|
|
|
|
|
return isVisible(modal)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Global function for chaining sweetAlert modals
|
|
|
|
|
*/
|
|
|
|
|
sweetAlert.queue = function(steps) {
|
|
|
|
|
queue = steps
|
|
|
|
|
var modal = getModal()
|
|
|
|
|
var resetQueue = function() {
|
|
|
|
|
queue = []
|
|
|
|
|
modal.removeAttribute('data-queue-step')
|
|
|
|
|
}
|
|
|
|
|
return new Promise(function(resolve, reject) {
|
|
|
|
|
(function step(i, callback) {
|
|
|
|
|
if (i < queue.length) {
|
|
|
|
|
modal.setAttribute('data-queue-step', i)
|
|
|
|
|
|
|
|
|
|
sweetAlert(queue[i]).then(function() {
|
|
|
|
|
step(i + 1, callback)
|
|
|
|
|
}, function(dismiss) {
|
|
|
|
|
resetQueue()
|
|
|
|
|
reject(dismiss)
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
resetQueue()
|
|
|
|
|
resolve()
|
|
|
|
|
}
|
|
|
|
|
})(0)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Global function for getting the index of current modal in queue
|
|
|
|
|
*/
|
|
|
|
|
sweetAlert.getQueueStep = function() {
|
|
|
|
|
return getModal().getAttribute('data-queue-step')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Global function for inserting a modal to the queue
|
|
|
|
|
*/
|
|
|
|
|
sweetAlert.insertQueueStep = function(step, index) {
|
|
|
|
|
if (index && index < queue.length) {
|
|
|
|
|
return queue.splice(index, 0, step)
|
|
|
|
|
}
|
|
|
|
|
return queue.push(step)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Global function for deleting a modal from the queue
|
|
|
|
|
*/
|
|
|
|
|
sweetAlert.deleteQueueStep = function(index) {
|
|
|
|
|
if (typeof queue[index] !== 'undefined') {
|
|
|
|
|
queue.splice(index, 1)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Global function to close sweetAlert
|
|
|
|
|
*/
|
|
|
|
|
sweetAlert.close = sweetAlert.closeModal = function(onComplete) {
|
|
|
|
|
var modal = getModal()
|
|
|
|
|
removeClass(modal, swalClasses.show)
|
|
|
|
|
addClass(modal, swalClasses.hide)
|
|
|
|
|
|
|
|
|
|
// Reset icon animations
|
|
|
|
|
var $successIcon = modal.querySelector('.' + swalClasses.icon + '.' + iconTypes.success)
|
|
|
|
|
removeClass($successIcon, 'animate')
|
|
|
|
|
removeClass($successIcon.querySelector('.tip'), 'animate-success-tip')
|
|
|
|
|
removeClass($successIcon.querySelector('.long'), 'animate-success-long')
|
|
|
|
|
|
|
|
|
|
var $errorIcon = modal.querySelector('.' + swalClasses.icon + '.' + iconTypes.error)
|
|
|
|
|
removeClass($errorIcon, 'animate-error-icon')
|
|
|
|
|
removeClass($errorIcon.querySelector('.x-mark'), 'animate-x-mark')
|
|
|
|
|
|
|
|
|
|
var $warningIcon = modal.querySelector('.' + swalClasses.icon + '.' + iconTypes.warning)
|
|
|
|
|
removeClass($warningIcon, 'pulse-warning')
|
|
|
|
|
|
|
|
|
|
resetPrevState()
|
|
|
|
|
|
|
|
|
|
var hideModalAndResetState = function() {
|
|
|
|
|
hide(modal)
|
|
|
|
|
modal.style.minHeight = ''
|
|
|
|
|
removeClass(sweetContainer, swalClasses.in)
|
|
|
|
|
removeClass(document.body, swalClasses.in)
|
|
|
|
|
undoScrollbar()
|
|
|
|
|
undoIOSfix()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If animation is supported, animate
|
|
|
|
|
if (animationEndEvent && !hasClass(modal, swalClasses.noanimation)) {
|
|
|
|
|
modal.addEventListener(animationEndEvent, function swalCloseEventFinished() {
|
|
|
|
|
modal.removeEventListener(animationEndEvent, swalCloseEventFinished)
|
|
|
|
|
if (hasClass(modal, swalClasses.hide)) {
|
|
|
|
|
hideModalAndResetState()
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
// Otherwise, hide immediately
|
|
|
|
|
hideModalAndResetState()
|
|
|
|
|
}
|
|
|
|
|
if (onComplete !== null && typeof onComplete === 'function') {
|
|
|
|
|
onComplete.call(this, modal)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Global function to click 'Confirm' button
|
|
|
|
|
*/
|
|
|
|
|
sweetAlert.clickConfirm = function() {
|
|
|
|
|
getConfirmButton().click()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Global function to click 'Cancel' button
|
|
|
|
|
*/
|
|
|
|
|
sweetAlert.clickCancel = function() {
|
|
|
|
|
getCancelButton().click()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set default params for each popup
|
|
|
|
|
* @param {Object} userParams
|
|
|
|
|
*/
|
|
|
|
|
sweetAlert.setDefaults = function(userParams) {
|
|
|
|
|
if (!userParams) {
|
|
|
|
|
throw new Error('userParams is required')
|
|
|
|
|
}
|
|
|
|
|
if (typeof userParams !== 'object') {
|
|
|
|
|
throw new Error('userParams has to be a object')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
extend(modalParams, userParams)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Reset default params for each popup
|
|
|
|
|
*/
|
|
|
|
|
sweetAlert.resetDefaults = function() {
|
|
|
|
|
modalParams = extend({}, defaultParams)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sweetAlert.noop = function() {}
|
|
|
|
|
|
|
|
|
|
sweetAlert.version = '5.3.5'
|
|
|
|
|
|
|
|
|
|
if (typeof Promise === 'function') {
|
|
|
|
|
Promise.prototype.done = Promise.prototype.done || function() { // eslint-disable-line
|
|
|
|
|
return this.catch(function() {
|
|
|
|
|
// Catch promise rejections silently.
|
|
|
|
|
// https://github.com/limonte/sweetalert2/issues/177
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
console.warn('SweetAlert2: Please inlude Promise polyfill BEFORE including sweetalert2.js if IE10+ support needed.')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return sweetAlert;
|
|
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
if (window.Sweetalert2) window.sweetAlert = window.swal = window.Sweetalert2;
|
|
|
|
|
|
|
|
|
|
/*! jQuery Validation Plugin - v1.14.0 - 6/30/2015
|
|
|
|
|
* http://jqueryvalidation.org/
|
|
|
|
|
* Copyright (c) 2015 Jörn Zaefferer; Licensed MIT */
|
|
|
|
|
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a(jQuery)}(function(a){a.extend(a.fn,{validate:function(b){if(!this.length)return void(b&&b.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing."));var c=a.data(this[0],"validator");return c?c:(this.attr("novalidate","novalidate"),c=new a.validator(b,this[0]),a.data(this[0],"validator",c),c.settings.onsubmit&&(this.on("click.validate",":submit",function(b){c.settings.submitHandler&&(c.submitButton=b.target),a(this).hasClass("cancel")&&(c.cancelSubmit=!0),void 0!==a(this).attr("formnovalidate")&&(c.cancelSubmit=!0)}),this.on("submit.validate",function(b){function d(){var d,e;return c.settings.submitHandler?(c.submitButton&&(d=a("<input type='hidden'/>").attr("name",c.submitButton.name).val(a(c.submitButton).val()).appendTo(c.currentForm)),e=c.settings.submitHandler.call(c,c.currentForm,b),c.submitButton&&d.remove(),void 0!==e?e:!1):!0}return c.settings.debug&&b.preventDefault(),c.cancelSubmit?(c.cancelSubmit=!1,d()):c.form()?c.pendingRequest?(c.formSubmitted=!0,!1):d():(c.focusInvalid(),!1)})),c)},valid:function(){var b,c,d;return a(this[0]).is("form")?b=this.validate().form():(d=[],b=!0,c=a(this[0].form).validate(),this.each(function(){b=c.element(this)&&b,d=d.concat(c.errorList)}),c.errorList=d),b},rules:function(b,c){var d,e,f,g,h,i,j=this[0];if(b)switch(d=a.data(j.form,"validator").settings,e=d.rules,f=a.validator.staticRules(j),b){case"add":a.extend(f,a.validator.normalizeRule(c)),delete f.messages,e[j.name]=f,c.messages&&(d.messages[j.name]=a.extend(d.messages[j.name],c.messages));break;case"remove":return c?(i={},a.each(c.split(/\s/),function(b,c){i[c]=f[c],delete f[c],"required"===c&&a(j).removeAttr("aria-required")}),i):(delete e[j.name],f)}return g=a.validator.normalizeRules(a.extend({},a.validator.classRules(j),a.validator.attributeRules(j),a.validator.dataRules(j),a.validator.staticRules(j)),j),g.required&&(h=g.required,delete g.required,g=a.extend({required:h},g),a(j).attr("aria-required","true")),g.remote&&(h=g.remote,delete g.remote,g=a.extend(g,{remote:h})),g}}),a.extend(a.expr[":"],{blank:function(b){return!a.trim(""+a(b).val())},filled:function(b){return!!a.trim(""+a(b).val())},unchecked:function(b){return!a(b).prop("checked")}}),a.validator=function(b,c){this.settings=a.extend(!0,{},a.validator.defaults,b),this.currentForm=c,this.init()},a.validator.format=function(b,c){return 1===arguments.length?function(){var c=a.makeArray(arguments);return c.unshift(b),a.validator.format.apply(this,c)}:(arguments.length>2&&c.constructor!==Array&&(c=a.makeArray(arguments).slice(1)),c.constructor!==Array&&(c=[c]),a.each(c,function(a,c){b=b.replace(new RegExp("\\{"+a+"\\}","g"),function(){return c})}),b)},a.extend(a.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusCleanup:!1,focusInvalid:!0,errorContainer:a([]),errorLabelContainer:a([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(a){this.lastActive=a,this.settings.focusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,a,this.settings.errorClass,this.settings.validClass),this.hideThese(this.errorsFor(a)))},onfocusout:function(a){this.checkable(a)||!(a.name in this.submitted)&&this.optional(a)||this.element(a)},onkeyup:function(b,c){var d=[16,17,18,20,35,36,37,38,39,40,45,144,225];9===c.which&&""===this.elementValue(b)||-1!==a.inArray(c.keyCode,d)||(b.name in this.submitted||b===this.lastElement)&&this.element(b)},onclick:function(a){a.name in this.submitted?this.element(a):a.parentNode.name in this.submitted&&this.element(a.parentNode)},highlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).addClass(c).removeClass(d):a(b).addClass(c).removeClass(d)},unhighlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).removeClass(c).addClass(d):a(b).removeClass(c).addClass(d)}},setDefaults:function(b){a.extend(a.validator.defaults,b)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* Bootstrap-select v1.13.1 (https://developer.snapappointments.com/bootstrap-select)
|
|
|
|
|
*
|
|
|
|
|
* Copyright 2012-2018 SnapAppointments, LLC
|
|
|
|
|
* Licensed under MIT (https://github.com/snapappointments/bootstrap-select/blob/master/LICENSE)
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
(function(root, factory) {
|
|
|
|
|
if (typeof define === 'function' && define.amd) {
|
|
|
|
|
// AMD. Register as an anonymous module unless amdModuleId is set
|
|
|
|
|
define(["jquery"], function(a0) {
|
|
|
|
|
return (factory(a0));
|
|
|
|
|
});
|
|
|
|
|
} else if (typeof module === 'object' && module.exports) {
|
|
|
|
|
// Node. Does not work with strict CommonJS, but
|
|
|
|
|
// only CommonJS-like environments that support module.exports,
|
|
|
|
|
// like Node.
|
|
|
|
|
module.exports = factory(require("jquery"));
|
|
|
|
|
} else {
|
|
|
|
|
factory(root["jQuery"]);
|
|
|
|
|
}
|
|
|
|
|
}(this, function(jQuery) {
|
|
|
|
|
|
|
|
|
|
(function($) {
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
|
var testElement = document.createElement('_');
|
|
|
|
|
|
|
|
|
|
testElement.classList.toggle('c3', false);
|
|
|
|
|
|
|
|
|
|
// Polyfill for IE 10 and Firefox <24, where classList.toggle does not
|
|
|
|
|
// support the second argument.
|
|
|
|
|
if (testElement.classList.contains('c3')) {
|
|
|
|
|
var _toggle = DOMTokenList.prototype.toggle;
|
|
|
|
|
|
|
|
|
|
DOMTokenList.prototype.toggle = function(token, force) {
|
|
|
|
|
if (1 in arguments && !this.contains(token) === !force) {
|
|
|
|
|
return force;
|
|
|
|
|
} else {
|
|
|
|
|
return _toggle.call(this, token);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// shallow array comparison
|
|
|
|
|
function isEqual(array1, array2) {
|
|
|
|
|
return array1.length === array2.length && array1.every(function(element, index) {
|
|
|
|
|
return element === array2[index];
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//<editor-fold desc="Shims">
|
|
|
|
|
if (!String.prototype.startsWith) {
|
|
|
|
|
(function() {
|
|
|
|
|
'use strict'; // needed to support `apply`/`call` with `undefined`/`null`
|
|
|
|
|
var defineProperty = (function() {
|
|
|
|
|
// IE 8 only supports `Object.defineProperty` on DOM elements
|
|
|
|
|
try {
|
|
|
|
|
var object = {};
|
|
|
|
|
var $defineProperty = Object.defineProperty;
|
|
|
|
|
var result = $defineProperty(object, object, object) && $defineProperty;
|
|
|
|
|
} catch (error) {}
|
|
|
|
|
return result;
|
|
|
|
|
}());
|
|
|
|
|
var toString = {}.toString;
|
|
|
|
|
var startsWith = function(search) {
|
|
|
|
|
if (this == null) {
|
|
|
|
|
throw new TypeError();
|
|
|
|
|
}
|
|
|
|
|
var string = String(this);
|
|
|
|
|
if (search && toString.call(search) == '[object RegExp]') {
|
|
|
|
|
throw new TypeError();
|
|
|
|
|
}
|
|
|
|
|
var stringLength = string.length;
|
|
|
|
|
var searchString = String(search);
|
|
|
|
|
var searchLength = searchString.length;
|
|
|
|
|
var position = arguments.length > 1 ? arguments[1] : undefined;
|
|
|
|
|
// `ToInteger`
|
|
|
|
|
var pos = position ? Number(position) : 0;
|
|
|
|
|
if (pos != pos) { // better `isNaN`
|
|
|
|
|
pos = 0;
|
|
|
|
|
}
|
|
|
|
|
var start = Math.min(Math.max(pos, 0), stringLength);
|
|
|
|
|
// Avoid the `indexOf` call if no match is possible
|
|
|
|
|
if (searchLength + start > stringLength) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
var index = -1;
|
|
|
|
|
while (++index < searchLength) {
|
|
|
|
|
if (string.charCodeAt(start + index) != searchString.charCodeAt(index)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
};
|
|
|
|
|
if (defineProperty) {
|
|
|
|
|
defineProperty(String.prototype, 'startsWith', {
|
|
|
|
|
'value': startsWith,
|
|
|
|
|
'configurable': true,
|
|
|
|
|
'writable': true
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
String.prototype.startsWith = startsWith;
|
|
|
|
|
}
|
|
|
|
|
}());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!Object.keys) {
|
|
|
|
|
Object.keys = function(
|
|
|
|
|
o, // object
|
|
|
|
|
k, // key
|
|
|
|
|
r // result array
|
|
|
|
|
) {
|
|
|
|
|
// initialize object and result
|
|
|
|
|
r = [];
|
|
|
|
|
// iterate over object keys
|
|
|
|
|
for (k in o)
|
|
|
|
|
// fill result array with non-prototypical keys
|
|
|
|
|
r.hasOwnProperty.call(o, k) && r.push(k);
|
|
|
|
|
// return result
|
|
|
|
|
return r;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// much faster than $.val()
|
|
|
|
|
function getSelectValues(select) {
|
|
|
|
|
var result = [];
|
|
|
|
|
var options = select && select.options;
|
|
|
|
|
var opt;
|
|
|
|
|
|
|
|
|
|
if (select.multiple) {
|
|
|
|
|
for (var i = 0, len = options.length; i < len; i++) {
|
|
|
|
|
opt = options[i];
|
|
|
|
|
|
|
|
|
|
if (opt.selected) {
|
|
|
|
|
result.push(opt.value || opt.text);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
result = select.value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// set data-selected on select element if the value has been programmatically selected
|
|
|
|
|
// prior to initialization of bootstrap-select
|
|
|
|
|
// * consider removing or replacing an alternative method *
|
|
|
|
|
var valHooks = {
|
|
|
|
|
useDefault: false,
|
|
|
|
|
_set: $.valHooks.select.set
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$.valHooks.select.set = function(elem, value) {
|
|
|
|
|
if (value && !valHooks.useDefault) $(elem).data('selected', true);
|
|
|
|
|
|
|
|
|
|
return valHooks._set.apply(this, arguments);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var changed_arguments = null;
|
|
|
|
|
|
|
|
|
|
var EventIsSupported = (function() {
|
|
|
|
|
try {
|
|
|
|
|
new Event('change');
|
|
|
|
|
return true;
|
|
|
|
|
} catch (e) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
})();
|
|
|
|
|
|
|
|
|
|
$.fn.triggerNative = function(eventName) {
|
|
|
|
|
var el = this[0],
|
|
|
|
|
event;
|
|
|
|
|
|
|
|
|
|
if (el.dispatchEvent) { // for modern browsers & IE9+
|
|
|
|
|
if (EventIsSupported) {
|
|
|
|
|
// For modern browsers
|
|
|
|
|
event = new Event(eventName, {
|
|
|
|
|
bubbles: true
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
// For IE since it doesn't support Event constructor
|
|
|
|
|
event = document.createEvent('Event');
|
|
|
|
|
event.initEvent(eventName, true, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
el.dispatchEvent(event);
|
|
|
|
|
} else if (el.fireEvent) { // for IE8
|
|
|
|
|
event = document.createEventObject();
|
|
|
|
|
event.eventType = eventName;
|
|
|
|
|
el.fireEvent('on' + eventName, event);
|
|
|
|
|
} else {
|
|
|
|
|
// fall back to jQuery.trigger
|
|
|
|
|
this.trigger(eventName);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
//</editor-fold>
|
|
|
|
|
|
|
|
|
|
function stringSearch(li, searchString, method, normalize) {
|
|
|
|
|
var stringTypes = [
|
|
|
|
|
'content',
|
|
|
|
|
'subtext',
|
|
|
|
|
'tokens'
|
|
|
|
|
],
|
|
|
|
|
searchSuccess = false;
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < stringTypes.length; i++) {
|
|
|
|
|
var stringType = stringTypes[i],
|
|
|
|
|
string = li[stringType];
|
|
|
|
|
|
|
|
|
|
if (string) {
|
|
|
|
|
string = string.toString();
|
|
|
|
|
|
|
|
|
|
// Strip HTML tags. This isn't perfect, but it's much faster than any other method
|
|
|
|
|
if (stringType === 'content') {
|
|
|
|
|
string = string.replace(/<[^>]+>/g, '');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (normalize) string = normalizeToBase(string);
|
|
|
|
|
string = string.toUpperCase();
|
|
|
|
|
|
|
|
|
|
if (method === 'contains') {
|
|
|
|
|
searchSuccess = string.indexOf(searchString) >= 0;
|
|
|
|
|
} else {
|
|
|
|
|
searchSuccess = string.startsWith(searchString);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (searchSuccess) break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return searchSuccess;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function toInteger(value) {
|
|
|
|
|
return parseInt(value, 10) || 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Remove all diatrics from the given text.
|
|
|
|
|
* @access private
|
|
|
|
|
* @param {String} text
|
|
|
|
|
* @returns {String}
|
|
|
|
|
*/
|
|
|
|
|
function normalizeToBase(text) {
|
|
|
|
|
var rExps = [{
|
|
|
|
|
re: /[\xC0-\xC6]/g,
|
|
|
|
|
ch: "A"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
re: /[\xE0-\xE6]/g,
|
|
|
|
|
ch: "a"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
re: /[\xC8-\xCB]/g,
|
|
|
|
|
ch: "E"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
re: /[\xE8-\xEB]/g,
|
|
|
|
|
ch: "e"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
re: /[\xCC-\xCF]/g,
|
|
|
|
|
ch: "I"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
re: /[\xEC-\xEF]/g,
|
|
|
|
|
ch: "i"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
re: /[\xD2-\xD6]/g,
|
|
|
|
|
ch: "O"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
re: /[\xF2-\xF6]/g,
|
|
|
|
|
ch: "o"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
re: /[\xD9-\xDC]/g,
|
|
|
|
|
ch: "U"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
re: /[\xF9-\xFC]/g,
|
|
|
|
|
ch: "u"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
re: /[\xC7-\xE7]/g,
|
|
|
|
|
ch: "c"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
re: /[\xD1]/g,
|
|
|
|
|
ch: "N"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
re: /[\xF1]/g,
|
|
|
|
|
ch: "n"
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
$.each(rExps, function() {
|
|
|
|
|
text = text ? text.replace(this.re, this.ch) : '';
|
|
|
|
|
});
|
|
|
|
|
return text;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// List of HTML entities for escaping.
|
|
|
|
|
var escapeMap = {
|
|
|
|
|
'&': '&',
|
|
|
|
|
'<': '<',
|
|
|
|
|
'>': '>',
|
|
|
|
|
'"': '"',
|
|
|
|
|
"'": ''',
|
|
|
|
|
'`': '`'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var unescapeMap = {
|
|
|
|
|
'&': '&',
|
|
|
|
|
'<': '<',
|
|
|
|
|
'>': '>',
|
|
|
|
|
'"': '"',
|
|
|
|
|
''': "'",
|
|
|
|
|
'`': '`'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Functions for escaping and unescaping strings to/from HTML interpolation.
|
|
|
|
|
var createEscaper = function(map) {
|
|
|
|
|
var escaper = function(match) {
|
|
|
|
|
return map[match];
|
|
|
|
|
};
|
|
|
|
|
// Regexes for identifying a key that needs to be escaped.
|
|
|
|
|
var source = '(?:' + Object.keys(map).join('|') + ')';
|
|
|
|
|
var testRegexp = RegExp(source);
|
|
|
|
|
var replaceRegexp = RegExp(source, 'g');
|
|
|
|
|
return function(string) {
|
|
|
|
|
string = string == null ? '' : '' + string;
|
|
|
|
|
return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var htmlEscape = createEscaper(escapeMap);
|
|
|
|
|
var htmlUnescape = createEscaper(unescapeMap);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* ------------------------------------------------------------------------
|
|
|
|
|
* Constants
|
|
|
|
|
* ------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
var keyCodeMap = {
|
|
|
|
|
32: ' ',
|
|
|
|
|
48: '0',
|
|
|
|
|
49: '1',
|
|
|
|
|
50: '2',
|
|
|
|
|
51: '3',
|
|
|
|
|
52: '4',
|
|
|
|
|
53: '5',
|
|
|
|
|
54: '6',
|
|
|
|
|
55: '7',
|
|
|
|
|
56: '8',
|
|
|
|
|
57: '9',
|
|
|
|
|
59: ';',
|
|
|
|
|
65: 'A',
|
|
|
|
|
66: 'B',
|
|
|
|
|
67: 'C',
|
|
|
|
|
68: 'D',
|
|
|
|
|
69: 'E',
|
|
|
|
|
70: 'F',
|
|
|
|
|
71: 'G',
|
|
|
|
|
72: 'H',
|
|
|
|
|
73: 'I',
|
|
|
|
|
74: 'J',
|
|
|
|
|
75: 'K',
|
|
|
|
|
76: 'L',
|
|
|
|
|
77: 'M',
|
|
|
|
|
78: 'N',
|
|
|
|
|
79: 'O',
|
|
|
|
|
80: 'P',
|
|
|
|
|
81: 'Q',
|
|
|
|
|
82: 'R',
|
|
|
|
|
83: 'S',
|
|
|
|
|
84: 'T',
|
|
|
|
|
85: 'U',
|
|
|
|
|
86: 'V',
|
|
|
|
|
87: 'W',
|
|
|
|
|
88: 'X',
|
|
|
|
|
89: 'Y',
|
|
|
|
|
90: 'Z',
|
|
|
|
|
96: '0',
|
|
|
|
|
97: '1',
|
|
|
|
|
98: '2',
|
|
|
|
|
99: '3',
|
|
|
|
|
100: '4',
|
|
|
|
|
101: '5',
|
|
|
|
|
102: '6',
|
|
|
|
|
103: '7',
|
|
|
|
|
104: '8',
|
|
|
|
|
105: '9'
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var keyCodes = {
|
|
|
|
|
ESCAPE: 27, // KeyboardEvent.which value for Escape (Esc) key
|
|
|
|
|
ENTER: 13, // KeyboardEvent.which value for Enter key
|
|
|
|
|
SPACE: 32, // KeyboardEvent.which value for space key
|
|
|
|
|
TAB: 9, // KeyboardEvent.which value for tab key
|
|
|
|
|
ARROW_UP: 38, // KeyboardEvent.which value for up arrow key
|
|
|
|
|
ARROW_DOWN: 40 // KeyboardEvent.which value for down arrow key
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var version = {};
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
version.full = ($.fn.dropdown.Constructor.VERSION || '').split(' ')[0].split('.');
|
|
|
|
|
version.major = version.full[0];
|
|
|
|
|
} catch (err) {
|
|
|
|
|
console.error('There was an issue retrieving Bootstrap\'s version. Ensure Bootstrap is being loaded before bootstrap-select and there is no namespace collision.', err);
|
|
|
|
|
version.major = '3';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var classNames = {
|
|
|
|
|
DISABLED: 'disabled',
|
|
|
|
|
DIVIDER: version.major === '4' ? 'dropdown-divider' : 'divider',
|
|
|
|
|
SHOW: version.major === '4' ? 'show' : 'open',
|
|
|
|
|
DROPUP: 'dropup',
|
|
|
|
|
MENURIGHT: 'dropdown-menu-right',
|
|
|
|
|
MENULEFT: 'dropdown-menu-left',
|
|
|
|
|
// to-do: replace with more advanced template/customization options
|
|
|
|
|
BUTTONCLASS: version.major === '4' ? 'btn-light' : 'btn-default',
|
|
|
|
|
POPOVERHEADER: version.major === '4' ? 'popover-header' : 'popover-title'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var REGEXP_ARROW = new RegExp(keyCodes.ARROW_UP + '|' + keyCodes.ARROW_DOWN);
|
|
|
|
|
var REGEXP_TAB_OR_ESCAPE = new RegExp('^' + keyCodes.TAB + '$|' + keyCodes.ESCAPE);
|
|
|
|
|
var REGEXP_ENTER_OR_SPACE = new RegExp(keyCodes.ENTER + '|' + keyCodes.SPACE);
|
|
|
|
|
|
|
|
|
|
var Selectpicker = function(element, options) {
|
|
|
|
|
var that = this;
|
|
|
|
|
|
|
|
|
|
// bootstrap-select has been initialized - revert valHooks.select.set back to its original function
|
|
|
|
|
if (!valHooks.useDefault) {
|
|
|
|
|
$.valHooks.select.set = valHooks._set;
|
|
|
|
|
valHooks.useDefault = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.$element = $(element);
|
|
|
|
|
this.$newElement = null;
|
|
|
|
|
this.$button = null;
|
|
|
|
|
this.$menu = null;
|
|
|
|
|
this.options = options;
|
|
|
|
|
this.selectpicker = {
|
|
|
|
|
main: {
|
|
|
|
|
// store originalIndex (key) and newIndex (value) in this.selectpicker.main.map.newIndex for fast accessibility
|
|
|
|
|
// allows us to do this.main.elements[this.selectpicker.main.map.newIndex[index]] to select an element based on the originalIndex
|
|
|
|
|
map: {
|
|
|
|
|
newIndex: {},
|
|
|
|
|
originalIndex: {}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
current: {
|
|
|
|
|
map: {}
|
|
|
|
|
}, // current changes if a search is in progress
|
|
|
|
|
search: {
|
|
|
|
|
map: {}
|
|
|
|
|
},
|
|
|
|
|
view: {},
|
|
|
|
|
keydown: {
|
|
|
|
|
keyHistory: '',
|
|
|
|
|
resetKeyHistory: {
|
|
|
|
|
start: function() {
|
|
|
|
|
return setTimeout(function() {
|
|
|
|
|
that.selectpicker.keydown.keyHistory = '';
|
|
|
|
|
}, 800);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
// If we have no title yet, try to pull it from the html title attribute (jQuery doesnt' pick it up as it's not a
|
|
|
|
|
// data-attribute)
|
|
|
|
|
if (this.options.title === null) {
|
|
|
|
|
this.options.title = this.$element.attr('title');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Format window padding
|
|
|
|
|
var winPad = this.options.windowPadding;
|
|
|
|
|
if (typeof winPad === 'number') {
|
|
|
|
|
this.options.windowPadding = [winPad, winPad, winPad, winPad];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Expose public methods
|
|
|
|
|
this.val = Selectpicker.prototype.val;
|
|
|
|
|
this.render = Selectpicker.prototype.render;
|
|
|
|
|
this.refresh = Selectpicker.prototype.refresh;
|
|
|
|
|
this.setStyle = Selectpicker.prototype.setStyle;
|
|
|
|
|
this.selectAll = Selectpicker.prototype.selectAll;
|
|
|
|
|
this.deselectAll = Selectpicker.prototype.deselectAll;
|
|
|
|
|
this.destroy = Selectpicker.prototype.destroy;
|
|
|
|
|
this.remove = Selectpicker.prototype.remove;
|
|
|
|
|
this.show = Selectpicker.prototype.show;
|
|
|
|
|
this.hide = Selectpicker.prototype.hide;
|
|
|
|
|
|
|
|
|
|
this.init();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Selectpicker.VERSION = '1.13.1';
|
|
|
|
|
|
|
|
|
|
// part of this is duplicated in i18n/defaults-en_US.js. Make sure to update both.
|
|
|
|
|
Selectpicker.DEFAULTS = {
|
|
|
|
|
noneSelectedText: 'Nothing selected',
|
|
|
|
|
noneResultsText: 'No results matched {0}',
|
|
|
|
|
countSelectedText: function(numSelected, numTotal) {
|
|
|
|
|
return (numSelected == 1) ? "{0} item selected" : "{0} items selected";
|
|
|
|
|
},
|
|
|
|
|
maxOptionsText: function(numAll, numGroup) {
|
|
|
|
|
return [
|
|
|
|
|
(numAll == 1) ? 'Limit reached ({n} item max)' : 'Limit reached ({n} items max)',
|
|
|
|
|
(numGroup == 1) ? 'Group limit reached ({n} item max)' : 'Group limit reached ({n} items max)'
|
|
|
|
|
];
|
|
|
|
|
},
|
|
|
|
|
selectAllText: 'Select All',
|
|
|
|
|
deselectAllText: 'Deselect All',
|
|
|
|
|
doneButton: false,
|
|
|
|
|
doneButtonText: 'Close',
|
|
|
|
|
multipleSeparator: ', ',
|
|
|
|
|
styleBase: 'btn',
|
|
|
|
|
style: 'btn-default',
|
|
|
|
|
size: 'auto',
|
|
|
|
|
title: null,
|
|
|
|
|
selectedTextFormat: 'values',
|
|
|
|
|
width: false,
|
|
|
|
|
container: false,
|
|
|
|
|
hideDisabled: false,
|
|
|
|
|
showSubtext: false,
|
|
|
|
|
showIcon: true,
|
|
|
|
|
showContent: true,
|
|
|
|
|
dropupAuto: true,
|
|
|
|
|
header: false,
|
|
|
|
|
liveSearch: false,
|
|
|
|
|
liveSearchPlaceholder: null,
|
|
|
|
|
liveSearchNormalize: false,
|
|
|
|
|
liveSearchStyle: 'contains',
|
|
|
|
|
actionsBox: false,
|
|
|
|
|
iconBase: 'glyphicon',
|
|
|
|
|
tickIcon: 'glyphicon-ok',
|
|
|
|
|
showTick: false,
|
|
|
|
|
template: {
|
|
|
|
|
caret: '<span class="caret"></span>'
|
|
|
|
|
},
|
|
|
|
|
maxOptions: false,
|
|
|
|
|
mobile: false,
|
|
|
|
|
selectOnTab: false,
|
|
|
|
|
dropdownAlignRight: false,
|
|
|
|
|
windowPadding: 0,
|
|
|
|
|
virtualScroll: 600
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (version.major === '4') {
|
|
|
|
|
Selectpicker.DEFAULTS.style = 'btn-light';
|
|
|
|
|
Selectpicker.DEFAULTS.iconBase = '';
|
|
|
|
|
Selectpicker.DEFAULTS.tickIcon = 'bs-ok-default';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Selectpicker.prototype = {
|
|
|
|
|
|
|
|
|
|
constructor: Selectpicker,
|
|
|
|
|
|
|
|
|
|
init: function() {
|
|
|
|
|
var that = this,
|
|
|
|
|
id = this.$element.attr('id');
|
|
|
|
|
|
|
|
|
|
this.$element.addClass('bs-select-hidden');
|
|
|
|
|
|
|
|
|
|
this.multiple = this.$element.prop('multiple');
|
|
|
|
|
this.autofocus = this.$element.prop('autofocus');
|
|
|
|
|
this.$newElement = this.createDropdown();
|
|
|
|
|
this.createLi();
|
|
|
|
|
this.$element
|
|
|
|
|
.after(this.$newElement)
|
|
|
|
|
.prependTo(this.$newElement);
|
|
|
|
|
this.$button = this.$newElement.children('button');
|
|
|
|
|
this.$menu = this.$newElement.children('.dropdown-menu');
|
|
|
|
|
this.$menuInner = this.$menu.children('.inner');
|
|
|
|
|
this.$searchbox = this.$menu.find('input');
|
|
|
|
|
|
|
|
|
|
this.$element.removeClass('bs-select-hidden');
|
|
|
|
|
|
|
|
|
|
if (this.options.dropdownAlignRight === true) this.$menu.addClass(classNames.MENURIGHT);
|
|
|
|
|
|
|
|
|
|
if (typeof id !== 'undefined') {
|
|
|
|
|
this.$button.attr('data-id', id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.checkDisabled();
|
|
|
|
|
this.clickListener();
|
|
|
|
|
if (this.options.liveSearch) this.liveSearchListener();
|
|
|
|
|
this.render();
|
|
|
|
|
this.setStyle();
|
|
|
|
|
this.setWidth();
|
|
|
|
|
if (this.options.container) {
|
|
|
|
|
this.selectPosition();
|
|
|
|
|
} else {
|
|
|
|
|
this.$element.on('hide.bs.select', function() {
|
|
|
|
|
if (that.isVirtual()) {
|
|
|
|
|
// empty menu on close
|
|
|
|
|
var menuInner = that.$menuInner[0],
|
|
|
|
|
emptyMenu = menuInner.firstChild.cloneNode(false);
|
|
|
|
|
|
|
|
|
|
// replace the existing UL with an empty one - this is faster than $.empty() or innerHTML = ''
|
|
|
|
|
menuInner.replaceChild(emptyMenu, menuInner.firstChild);
|
|
|
|
|
menuInner.scrollTop = 0;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
this.$menu.data('this', this);
|
|
|
|
|
this.$newElement.data('this', this);
|
|
|
|
|
if (this.options.mobile) this.mobile();
|
|
|
|
|
|
|
|
|
|
this.$newElement.on({
|
|
|
|
|
'hide.bs.dropdown': function(e) {
|
|
|
|
|
that.$menuInner.attr('aria-expanded', false);
|
|
|
|
|
that.$element.trigger('hide.bs.select', e);
|
|
|
|
|
},
|
|
|
|
|
'hidden.bs.dropdown': function(e) {
|
|
|
|
|
that.$element.trigger('hidden.bs.select', e);
|
|
|
|
|
},
|
|
|
|
|
'show.bs.dropdown': function(e) {
|
|
|
|
|
that.$menuInner.attr('aria-expanded', true);
|
|
|
|
|
that.$element.trigger('show.bs.select', e);
|
|
|
|
|
},
|
|
|
|
|
'shown.bs.dropdown': function(e) {
|
|
|
|
|
that.$element.trigger('shown.bs.select', e);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (that.$element[0].hasAttribute('required')) {
|
|
|
|
|
this.$element.on('invalid', function() {
|
|
|
|
|
that.$button.addClass('bs-invalid');
|
|
|
|
|
|
|
|
|
|
that.$element.on({
|
|
|
|
|
'shown.bs.select': function() {
|
|
|
|
|
that.$element
|
|
|
|
|
.val(that.$element.val()) // set the value to hide the validation message in Chrome when menu is opened
|
|
|
|
|
.off('shown.bs.select');
|
|
|
|
|
},
|
|
|
|
|
'rendered.bs.select': function() {
|
|
|
|
|
// if select is no longer invalid, remove the bs-invalid class
|
|
|
|
|
if (this.validity.valid) that.$button.removeClass('bs-invalid');
|
|
|
|
|
that.$element.off('rendered.bs.select');
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
that.$button.on('blur.bs.select', function() {
|
|
|
|
|
that.$element.focus().blur();
|
|
|
|
|
that.$button.off('blur.bs.select');
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setTimeout(function() {
|
|
|
|
|
that.$element.trigger('loaded.bs.select');
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
createDropdown: function() {
|
|
|
|
|
// Options
|
|
|
|
|
// If we are multiple or showTick option is set, then add the show-tick class
|
|
|
|
|
var showTick = (this.multiple || this.options.showTick) ? ' show-tick' : '',
|
|
|
|
|
autofocus = this.autofocus ? ' autofocus' : '';
|
|
|
|
|
// Elements
|
|
|
|
|
var header = this.options.header ? '<div class="' + classNames.POPOVERHEADER + '"><button type="button" class="close" aria-hidden="true">×</button>' + this.options.header + '</div>' : '';
|
|
|
|
|
var searchbox = this.options.liveSearch ?
|
|
|
|
|
'<div class="bs-searchbox">' +
|
|
|
|
|
'<input type="text" class="form-control" autocomplete="off"' +
|
|
|
|
|
(null === this.options.liveSearchPlaceholder ? '' : ' placeholder="' + htmlEscape(this.options.liveSearchPlaceholder) + '"') + ' role="textbox" aria-label="Search">' +
|
|
|
|
|
'</div>' :
|
|
|
|
|
'';
|
|
|
|
|
var actionsbox = this.multiple && this.options.actionsBox ?
|
|
|
|
|
'<div class="bs-actionsbox">' +
|
|
|
|
|
'<div class="btn-group btn-group-sm btn-block">' +
|
|
|
|
|
'<button type="button" class="actions-btn bs-select-all btn ' + classNames.BUTTONCLASS + '">' +
|
|
|
|
|
this.options.selectAllText +
|
|
|
|
|
'</button>' +
|
|
|
|
|
'<button type="button" class="actions-btn bs-deselect-all btn ' + classNames.BUTTONCLASS + '">' +
|
|
|
|
|
this.options.deselectAllText +
|
|
|
|
|
'</button>' +
|
|
|
|
|
'</div>' +
|
|
|
|
|
'</div>' :
|
|
|
|
|
'';
|
|
|
|
|
var donebutton = this.multiple && this.options.doneButton ?
|
|
|
|
|
'<div class="bs-donebutton">' +
|
|
|
|
|
'<div class="btn-group btn-block">' +
|
|
|
|
|
'<button type="button" class="btn btn-sm ' + classNames.BUTTONCLASS + '">' +
|
|
|
|
|
this.options.doneButtonText +
|
|
|
|
|
'</button>' +
|
|
|
|
|
'</div>' +
|
|
|
|
|
'</div>' :
|
|
|
|
|
'';
|
|
|
|
|
var drop =
|
|
|
|
|
'<div class="dropdown bootstrap-select' + showTick + '">' +
|
|
|
|
|
'<button type="button" class="' + this.options.styleBase + ' dropdown-toggle" data-toggle="dropdown"' + autofocus + ' role="button">' +
|
|
|
|
|
'<div class="filter-option">' +
|
|
|
|
|
'<div class="filter-option-inner">' +
|
|
|
|
|
'<div class="filter-option-inner-inner"></div>' +
|
|
|
|
|
'</div> ' +
|
|
|
|
|
'</div>' +
|
|
|
|
|
(version.major === '4' ?
|
|
|
|
|
'' :
|
|
|
|
|
'<span class="bs-caret">' +
|
|
|
|
|
this.options.template.caret +
|
|
|
|
|
'</span>'
|
|
|
|
|
) +
|
|
|
|
|
'</button>' +
|
|
|
|
|
'<div class="dropdown-menu ' + (version.major === '4' ? '' : classNames.SHOW) + '" role="combobox">' +
|
|
|
|
|
header +
|
|
|
|
|
searchbox +
|
|
|
|
|
actionsbox +
|
|
|
|
|
'<div class="inner ' + classNames.SHOW + '" role="listbox" aria-expanded="false" tabindex="-1">' +
|
|
|
|
|
'<ul class="dropdown-menu inner ' + (version.major === '4' ? classNames.SHOW : '') + '">' +
|
|
|
|
|
'</ul>' +
|
|
|
|
|
'</div>' +
|
|
|
|
|
donebutton +
|
|
|
|
|
'</div>' +
|
|
|
|
|
'</div>';
|
|
|
|
|
|
|
|
|
|
return $(drop);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
setPositionData: function() {
|
|
|
|
|
this.selectpicker.view.canHighlight = [];
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < this.selectpicker.current.data.length; i++) {
|
|
|
|
|
var li = this.selectpicker.current.data[i],
|
|
|
|
|
canHighlight = true;
|
|
|
|
|
|
|
|
|
|
if (li.type === 'divider') {
|
|
|
|
|
canHighlight = false;
|
|
|
|
|
li.height = this.sizeInfo.dividerHeight;
|
|
|
|
|
} else if (li.type === 'optgroup-label') {
|
|
|
|
|
canHighlight = false;
|
|
|
|
|
li.height = this.sizeInfo.dropdownHeaderHeight;
|
|
|
|
|
} else {
|
|
|
|
|
li.height = this.sizeInfo.liHeight;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (li.disabled) canHighlight = false;
|
|
|
|
|
|
|
|
|
|
this.selectpicker.view.canHighlight.push(canHighlight);
|
|
|
|
|
|
|
|
|
|
li.position = (i === 0 ? 0 : this.selectpicker.current.data[i - 1].position) + li.height;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
isVirtual: function() {
|
|
|
|
|
return (this.options.virtualScroll !== false) && this.selectpicker.main.elements.length >= this.options.virtualScroll || this.options.virtualScroll === true;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
createView: function(isSearching, scrollTop) {
|
|
|
|
|
scrollTop = scrollTop || 0;
|
|
|
|
|
|
|
|
|
|
var that = this;
|
|
|
|
|
|
|
|
|
|
this.selectpicker.current = isSearching ? this.selectpicker.search : this.selectpicker.main;
|
|
|
|
|
|
|
|
|
|
var $lis;
|
|
|
|
|
var active = [];
|
|
|
|
|
var selected;
|
|
|
|
|
var prevActive;
|
|
|
|
|
var activeIndex;
|
|
|
|
|
var prevActiveIndex;
|
|
|
|
|
|
|
|
|
|
this.setPositionData();
|
|
|
|
|
|
|
|
|
|
scroll(scrollTop, true);
|
|
|
|
|
|
|
|
|
|
this.$menuInner.off('scroll.createView').on('scroll.createView', function(e, updateValue) {
|
|
|
|
|
if (!that.noScroll) scroll(this.scrollTop, updateValue);
|
|
|
|
|
that.noScroll = false;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function scroll(scrollTop, init) {
|
|
|
|
|
var size = that.selectpicker.current.elements.length,
|
|
|
|
|
chunks = [],
|
|
|
|
|
chunkSize,
|
|
|
|
|
chunkCount,
|
|
|
|
|
firstChunk,
|
|
|
|
|
lastChunk,
|
|
|
|
|
currentChunk = undefined,
|
|
|
|
|
prevPositions,
|
|
|
|
|
positionIsDifferent,
|
|
|
|
|
previousElements,
|
|
|
|
|
menuIsDifferent = true,
|
|
|
|
|
isVirtual = that.isVirtual();
|
|
|
|
|
|
|
|
|
|
that.selectpicker.view.scrollTop = scrollTop;
|
|
|
|
|
|
|
|
|
|
if (isVirtual === true) {
|
|
|
|
|
// if an option that is encountered that is wider than the current menu width, update the menu width accordingly
|
|
|
|
|
if (that.sizeInfo.hasScrollBar && that.$menu[0].offsetWidth > that.sizeInfo.totalMenuWidth) {
|
|
|
|
|
that.sizeInfo.menuWidth = that.$menu[0].offsetWidth;
|
|
|
|
|
that.sizeInfo.totalMenuWidth = that.sizeInfo.menuWidth + that.sizeInfo.scrollBarWidth;
|
|
|
|
|
that.$menu.css('min-width', that.sizeInfo.menuWidth);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
chunkSize = Math.ceil(that.sizeInfo.menuInnerHeight / that.sizeInfo.liHeight * 1.5); // number of options in a chunk
|
|
|
|
|
chunkCount = Math.round(size / chunkSize) || 1; // number of chunks
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < chunkCount; i++) {
|
|
|
|
|
var end_of_chunk = (i + 1) * chunkSize;
|
|
|
|
|
|
|
|
|
|
if (i === chunkCount - 1) {
|
|
|
|
|
end_of_chunk = size;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
chunks[i] = [
|
|
|
|
|
(i) * chunkSize + (!i ? 0 : 1),
|
|
|
|
|
end_of_chunk
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
if (!size) break;
|
|
|
|
|
|
|
|
|
|
if (currentChunk === undefined && scrollTop <= that.selectpicker.current.data[end_of_chunk - 1].position - that.sizeInfo.menuInnerHeight) {
|
|
|
|
|
currentChunk = i;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (currentChunk === undefined) currentChunk = 0;
|
|
|
|
|
|
|
|
|
|
prevPositions = [that.selectpicker.view.position0, that.selectpicker.view.position1];
|
|
|
|
|
|
|
|
|
|
// always display previous, current, and next chunks
|
|
|
|
|
firstChunk = Math.max(0, currentChunk - 1);
|
|
|
|
|
lastChunk = Math.min(chunkCount - 1, currentChunk + 1);
|
|
|
|
|
|
|
|
|
|
that.selectpicker.view.position0 = Math.max(0, chunks[firstChunk][0]) || 0;
|
|
|
|
|
that.selectpicker.view.position1 = Math.min(size, chunks[lastChunk][1]) || 0;
|
|
|
|
|
|
|
|
|
|
positionIsDifferent = prevPositions[0] !== that.selectpicker.view.position0 || prevPositions[1] !== that.selectpicker.view.position1;
|
|
|
|
|
|
|
|
|
|
if (that.activeIndex !== undefined) {
|
|
|
|
|
prevActive = that.selectpicker.current.elements[that.selectpicker.current.map.newIndex[that.prevActiveIndex]];
|
|
|
|
|
active = that.selectpicker.current.elements[that.selectpicker.current.map.newIndex[that.activeIndex]];
|
|
|
|
|
selected = that.selectpicker.current.elements[that.selectpicker.current.map.newIndex[that.selectedIndex]];
|
|
|
|
|
|
|
|
|
|
if (init) {
|
|
|
|
|
if (that.activeIndex !== that.selectedIndex) {
|
|
|
|
|
active.classList.remove('active');
|
|
|
|
|
if (active.firstChild) active.firstChild.classList.remove('active');
|
|
|
|
|
}
|
|
|
|
|
that.activeIndex = undefined;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (that.activeIndex && that.activeIndex !== that.selectedIndex && selected && selected.length) {
|
|
|
|
|
selected.classList.remove('active');
|
|
|
|
|
if (selected.firstChild) selected.firstChild.classList.remove('active');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (that.prevActiveIndex !== undefined && that.prevActiveIndex !== that.activeIndex && that.prevActiveIndex !== that.selectedIndex && prevActive && prevActive.length) {
|
|
|
|
|
prevActive.classList.remove('active');
|
|
|
|
|
if (prevActive.firstChild) prevActive.firstChild.classList.remove('active');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (init || positionIsDifferent) {
|
|
|
|
|
previousElements = that.selectpicker.view.visibleElements ? that.selectpicker.view.visibleElements.slice() : [];
|
|
|
|
|
|
|
|
|
|
that.selectpicker.view.visibleElements = that.selectpicker.current.elements.slice(that.selectpicker.view.position0, that.selectpicker.view.position1);
|
|
|
|
|
|
|
|
|
|
that.setOptionStatus();
|
|
|
|
|
|
|
|
|
|
// if searching, check to make sure the list has actually been updated before updating DOM
|
|
|
|
|
// this prevents unnecessary repaints
|
|
|
|
|
if (isSearching || (isVirtual === false && init)) menuIsDifferent = !isEqual(previousElements, that.selectpicker.view.visibleElements);
|
|
|
|
|
|
|
|
|
|
// if virtual scroll is disabled and not searching,
|
|
|
|
|
// menu should never need to be updated more than once
|
|
|
|
|
if ((init || isVirtual === true) && menuIsDifferent) {
|
|
|
|
|
var menuInner = that.$menuInner[0],
|
|
|
|
|
menuFragment = document.createDocumentFragment(),
|
|
|
|
|
emptyMenu = menuInner.firstChild.cloneNode(false),
|
|
|
|
|
marginTop,
|
|
|
|
|
marginBottom,
|
|
|
|
|
elements = isVirtual === true ? that.selectpicker.view.visibleElements : that.selectpicker.current.elements;
|
|
|
|
|
|
|
|
|
|
// replace the existing UL with an empty one - this is faster than $.empty()
|
|
|
|
|
menuInner.replaceChild(emptyMenu, menuInner.firstChild);
|
|
|
|
|
|
|
|
|
|
for (var i = 0, visibleElementsLen = elements.length; i < visibleElementsLen; i++) {
|
|
|
|
|
menuFragment.appendChild(elements[i]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isVirtual === true) {
|
|
|
|
|
marginTop = (that.selectpicker.view.position0 === 0 ? 0 : that.selectpicker.current.data[that.selectpicker.view.position0 - 1].position),
|
|
|
|
|
marginBottom = (that.selectpicker.view.position1 > size - 1 ? 0 : that.selectpicker.current.data[size - 1].position - that.selectpicker.current.data[that.selectpicker.view.position1 - 1].position);
|
|
|
|
|
|
|
|
|
|
menuInner.firstChild.style.marginTop = marginTop + 'px';
|
|
|
|
|
menuInner.firstChild.style.marginBottom = marginBottom + 'px';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
menuInner.firstChild.appendChild(menuFragment);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
that.prevActiveIndex = that.activeIndex;
|
|
|
|
|
|
|
|
|
|
if (!that.options.liveSearch) {
|
|
|
|
|
that.$menuInner.focus();
|
|
|
|
|
} else if (isSearching && init) {
|
|
|
|
|
var index = 0,
|
|
|
|
|
newActive;
|
|
|
|
|
|
|
|
|
|
if (!that.selectpicker.view.canHighlight[index]) {
|
|
|
|
|
index = 1 + that.selectpicker.view.canHighlight.slice(1).indexOf(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
newActive = that.selectpicker.view.visibleElements[index];
|
|
|
|
|
|
|
|
|
|
if (that.selectpicker.view.currentActive) {
|
|
|
|
|
that.selectpicker.view.currentActive.classList.remove('active');
|
|
|
|
|
if (that.selectpicker.view.currentActive.firstChild) that.selectpicker.view.currentActive.firstChild.classList.remove('active');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (newActive) {
|
|
|
|
|
newActive.classList.add('active');
|
|
|
|
|
if (newActive.firstChild) newActive.firstChild.classList.add('active');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
that.activeIndex = that.selectpicker.current.map.originalIndex[index];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$(window).off('resize.createView').on('resize.createView', function() {
|
|
|
|
|
scroll(that.$menuInner[0].scrollTop);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
createLi: function() {
|
|
|
|
|
var that = this,
|
|
|
|
|
mainElements = [],
|
|
|
|
|
widestOption,
|
|
|
|
|
availableOptionsCount = 0,
|
|
|
|
|
widestOptionLength = 0,
|
|
|
|
|
mainData = [],
|
|
|
|
|
optID = 0,
|
|
|
|
|
headerIndex = 0,
|
|
|
|
|
liIndex = -1; // increment liIndex whenever a new <li> element is created to ensure newIndex is correct
|
|
|
|
|
|
|
|
|
|
if (!this.selectpicker.view.titleOption) this.selectpicker.view.titleOption = document.createElement('option');
|
|
|
|
|
|
|
|
|
|
var elementTemplates = {
|
|
|
|
|
span: document.createElement('span'),
|
|
|
|
|
subtext: document.createElement('small'),
|
|
|
|
|
a: document.createElement('a'),
|
|
|
|
|
li: document.createElement('li'),
|
|
|
|
|
whitespace: document.createTextNode("\u00A0")
|
|
|
|
|
},
|
|
|
|
|
checkMark = elementTemplates.span.cloneNode(false),
|
|
|
|
|
fragment = document.createDocumentFragment();
|
|
|
|
|
|
|
|
|
|
checkMark.className = that.options.iconBase + ' ' + that.options.tickIcon + ' check-mark';
|
|
|
|
|
elementTemplates.a.appendChild(checkMark);
|
|
|
|
|
elementTemplates.a.setAttribute('role', 'option');
|
|
|
|
|
|
|
|
|
|
elementTemplates.subtext.className = 'text-muted';
|
|
|
|
|
|
|
|
|
|
elementTemplates.text = elementTemplates.span.cloneNode(false);
|
|
|
|
|
elementTemplates.text.className = 'text';
|
|
|
|
|
|
|
|
|
|
// Helper functions
|
|
|
|
|
/**
|
|
|
|
|
* @param content
|
|
|
|
|
* @param [index]
|
|
|
|
|
* @param [classes]
|
|
|
|
|
* @param [optgroup]
|
|
|
|
|
* @returns {HTMLElement}
|
|
|
|
|
*/
|
|
|
|
|
var generateLI = function(content, index, classes, optgroup) {
|
|
|
|
|
var li = elementTemplates.li.cloneNode(false);
|
|
|
|
|
|
|
|
|
|
if (content) {
|
|
|
|
|
if (content.nodeType === 1 || content.nodeType === 11) {
|
|
|
|
|
li.appendChild(content);
|
|
|
|
|
} else {
|
|
|
|
|
li.innerHTML = content;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (typeof classes !== 'undefined' && '' !== classes) li.className = classes;
|
|
|
|
|
if (typeof optgroup !== 'undefined' && null !== optgroup) li.classList.add('optgroup-' + optgroup);
|
|
|
|
|
|
|
|
|
|
return li;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param text
|
|
|
|
|
* @param [classes]
|
|
|
|
|
* @param [inline]
|
|
|
|
|
* @returns {string}
|
|
|
|
|
*/
|
|
|
|
|
var generateA = function(text, classes, inline) {
|
|
|
|
|
var a = elementTemplates.a.cloneNode(true);
|
|
|
|
|
|
|
|
|
|
if (text) {
|
|
|
|
|
if (text.nodeType === 11) {
|
|
|
|
|
a.appendChild(text);
|
|
|
|
|
} else {
|
|
|
|
|
a.insertAdjacentHTML('beforeend', text);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (typeof classes !== 'undefined' & '' !== classes) a.className = classes;
|
|
|
|
|
if (version.major === '4') a.classList.add('dropdown-item');
|
|
|
|
|
if (inline) a.setAttribute('style', inline);
|
|
|
|
|
|
|
|
|
|
return a;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var generateText = function(options) {
|
|
|
|
|
var textElement = elementTemplates.text.cloneNode(false),
|
|
|
|
|
optionSubtextElement,
|
|
|
|
|
optionIconElement;
|
|
|
|
|
|
|
|
|
|
if (options.optionContent) {
|
|
|
|
|
textElement.innerHTML = options.optionContent;
|
|
|
|
|
} else {
|
|
|
|
|
textElement.textContent = options.text;
|
|
|
|
|
|
|
|
|
|
if (options.optionIcon) {
|
|
|
|
|
var whitespace = elementTemplates.whitespace.cloneNode(false);
|
|
|
|
|
|
|
|
|
|
optionIconElement = elementTemplates.span.cloneNode(false);
|
|
|
|
|
optionIconElement.className = that.options.iconBase + ' ' + options.optionIcon;
|
|
|
|
|
|
|
|
|
|
fragment.appendChild(optionIconElement);
|
|
|
|
|
fragment.appendChild(whitespace);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (options.optionSubtext) {
|
|
|
|
|
optionSubtextElement = elementTemplates.subtext.cloneNode(false);
|
|
|
|
|
optionSubtextElement.innerHTML = options.optionSubtext;
|
|
|
|
|
textElement.appendChild(optionSubtextElement);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fragment.appendChild(textElement);
|
|
|
|
|
|
|
|
|
|
return fragment;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var generateLabel = function(options) {
|
|
|
|
|
var labelTextElement = elementTemplates.text.cloneNode(false),
|
|
|
|
|
labelSubtextElement,
|
|
|
|
|
labelIconElement;
|
|
|
|
|
|
|
|
|
|
labelTextElement.textContent = options.labelEscaped;
|
|
|
|
|
|
|
|
|
|
if (options.labelIcon) {
|
|
|
|
|
var whitespace = elementTemplates.whitespace.cloneNode(false);
|
|
|
|
|
|
|
|
|
|
labelIconElement = elementTemplates.span.cloneNode(false);
|
|
|
|
|
labelIconElement.className = that.options.iconBase + ' ' + options.labelIcon;
|
|
|
|
|
|
|
|
|
|
fragment.appendChild(labelIconElement);
|
|
|
|
|
fragment.appendChild(whitespace);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (options.labelSubtext) {
|
|
|
|
|
labelSubtextElement = elementTemplates.subtext.cloneNode(false);
|
|
|
|
|
labelSubtextElement.textContent = options.labelSubtext;
|
|
|
|
|
labelTextElement.appendChild(labelSubtextElement);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fragment.appendChild(labelTextElement);
|
|
|
|
|
|
|
|
|
|
return fragment;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.options.title && !this.multiple) {
|
|
|
|
|
// this option doesn't create a new <li> element, but does add a new option, so liIndex is decreased
|
|
|
|
|
// since newIndex is recalculated on every refresh, liIndex needs to be decreased even if the titleOption is already appended
|
|
|
|
|
liIndex--;
|
|
|
|
|
|
|
|
|
|
var element = this.$element[0],
|
|
|
|
|
isSelected = false,
|
|
|
|
|
titleNotAppended = !this.selectpicker.view.titleOption.parentNode;
|
|
|
|
|
|
|
|
|
|
if (titleNotAppended) {
|
|
|
|
|
// Use native JS to prepend option (faster)
|
|
|
|
|
this.selectpicker.view.titleOption.className = 'bs-title-option';
|
|
|
|
|
this.selectpicker.view.titleOption.value = '';
|
|
|
|
|
|
|
|
|
|
// Check if selected or data-selected attribute is already set on an option. If not, select the titleOption option.
|
|
|
|
|
// the selected item may have been changed by user or programmatically before the bootstrap select plugin runs,
|
|
|
|
|
// if so, the select will have the data-selected attribute
|
|
|
|
|
var $opt = $(element.options[element.selectedIndex]);
|
|
|
|
|
isSelected = $opt.attr('selected') === undefined && this.$element.data('selected') === undefined;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (titleNotAppended || this.selectpicker.view.titleOption.index !== 0) {
|
|
|
|
|
element.insertBefore(this.selectpicker.view.titleOption, element.firstChild);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Set selected *after* appending to select,
|
|
|
|
|
// otherwise the option doesn't get selected in IE
|
|
|
|
|
// set using selectedIndex, as setting the selected attr to true here doesn't work in IE11
|
|
|
|
|
if (isSelected) element.selectedIndex = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var $selectOptions = this.$element.find('option');
|
|
|
|
|
|
|
|
|
|
$selectOptions.each(function(index) {
|
|
|
|
|
var $this = $(this);
|
|
|
|
|
|
|
|
|
|
liIndex++;
|
|
|
|
|
|
|
|
|
|
if ($this.hasClass('bs-title-option')) return;
|
|
|
|
|
|
|
|
|
|
var thisData = $this.data();
|
|
|
|
|
|
|
|
|
|
// Get the class and text for the option
|
|
|
|
|
var optionClass = this.className || '',
|
|
|
|
|
inline = htmlEscape(this.style.cssText),
|
|
|
|
|
optionContent = thisData.content,
|
|
|
|
|
text = this.textContent,
|
|
|
|
|
tokens = thisData.tokens,
|
|
|
|
|
subtext = thisData.subtext,
|
|
|
|
|
icon = thisData.icon,
|
|
|
|
|
$parent = $this.parent(),
|
|
|
|
|
parent = $parent[0],
|
|
|
|
|
isOptgroup = parent.tagName === 'OPTGROUP',
|
|
|
|
|
isOptgroupDisabled = isOptgroup && parent.disabled,
|
|
|
|
|
isDisabled = this.disabled || isOptgroupDisabled,
|
|
|
|
|
prevHiddenIndex,
|
|
|
|
|
showDivider = this.previousElementSibling && this.previousElementSibling.tagName === 'OPTGROUP',
|
|
|
|
|
textElement;
|
|
|
|
|
|
|
|
|
|
var parentData = $parent.data();
|
|
|
|
|
|
|
|
|
|
if (thisData.hidden === true || that.options.hideDisabled && (isDisabled && !isOptgroup || isOptgroupDisabled)) {
|
|
|
|
|
// set prevHiddenIndex - the index of the first hidden option in a group of hidden options
|
|
|
|
|
// used to determine whether or not a divider should be placed after an optgroup if there are
|
|
|
|
|
// hidden options between the optgroup and the first visible option
|
|
|
|
|
prevHiddenIndex = thisData.prevHiddenIndex;
|
|
|
|
|
$this.next().data('prevHiddenIndex', (prevHiddenIndex !== undefined ? prevHiddenIndex : index));
|
|
|
|
|
|
|
|
|
|
liIndex--;
|
|
|
|
|
|
|
|
|
|
// if previous element is not an optgroup
|
|
|
|
|
if (!showDivider) {
|
|
|
|
|
if (prevHiddenIndex !== undefined) {
|
|
|
|
|
// select the element **before** the first hidden element in the group
|
|
|
|
|
var prevHidden = $selectOptions[prevHiddenIndex].previousElementSibling;
|
|
|
|
|
|
|
|
|
|
if (prevHidden && prevHidden.tagName === 'OPTGROUP' && !prevHidden.disabled) {
|
|
|
|
|
showDivider = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (showDivider && mainData[mainData.length - 1].type !== 'divider') {
|
|
|
|
|
liIndex++;
|
|
|
|
|
mainElements.push(
|
|
|
|
|
generateLI(
|
|
|
|
|
false,
|
|
|
|
|
null,
|
|
|
|
|
classNames.DIVIDER,
|
|
|
|
|
optID + 'div'
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
mainData.push({
|
|
|
|
|
type: 'divider',
|
|
|
|
|
optID: optID,
|
|
|
|
|
originalIndex: index
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isOptgroup && thisData.divider !== true) {
|
|
|
|
|
if (that.options.hideDisabled && isDisabled) {
|
|
|
|
|
if (parentData.allOptionsDisabled === undefined) {
|
|
|
|
|
var $options = $parent.children();
|
|
|
|
|
$parent.data('allOptionsDisabled', $options.filter(':disabled').length === $options.length);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($parent.data('allOptionsDisabled')) {
|
|
|
|
|
liIndex--;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var optGroupClass = ' ' + parent.className || '';
|
|
|
|
|
|
|
|
|
|
if (!this.previousElementSibling) { // Is it the first option of the optgroup?
|
|
|
|
|
optID += 1;
|
|
|
|
|
|
|
|
|
|
// Get the opt group label
|
|
|
|
|
var label = parent.label,
|
|
|
|
|
labelEscaped = htmlEscape(label),
|
|
|
|
|
labelSubtext = parentData.subtext,
|
|
|
|
|
labelIcon = parentData.icon;
|
|
|
|
|
|
|
|
|
|
if (index !== 0 && mainElements.length > 0) { // Is it NOT the first option of the select && are there elements in the dropdown?
|
|
|
|
|
liIndex++;
|
|
|
|
|
mainElements.push(
|
|
|
|
|
generateLI(
|
|
|
|
|
false,
|
|
|
|
|
null,
|
|
|
|
|
classNames.DIVIDER,
|
|
|
|
|
optID + 'div'
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
mainData.push({
|
|
|
|
|
type: 'divider',
|
|
|
|
|
optID: optID,
|
|
|
|
|
originalIndex: index
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
liIndex++;
|
|
|
|
|
|
|
|
|
|
var labelElement = generateLabel({
|
|
|
|
|
labelEscaped: labelEscaped,
|
|
|
|
|
labelSubtext: labelSubtext,
|
|
|
|
|
labelIcon: labelIcon
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
mainElements.push(generateLI(labelElement, null, 'dropdown-header' + optGroupClass, optID));
|
|
|
|
|
mainData.push({
|
|
|
|
|
content: labelEscaped,
|
|
|
|
|
subtext: labelSubtext,
|
|
|
|
|
type: 'optgroup-label',
|
|
|
|
|
optID: optID,
|
|
|
|
|
originalIndex: index
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
headerIndex = liIndex - 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (that.options.hideDisabled && isDisabled || thisData.hidden === true) {
|
|
|
|
|
liIndex--;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
textElement = generateText({
|
|
|
|
|
text: text,
|
|
|
|
|
optionContent: optionContent,
|
|
|
|
|
optionSubtext: subtext,
|
|
|
|
|
optionIcon: icon
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
mainElements.push(generateLI(generateA(textElement, 'opt ' + optionClass + optGroupClass, inline), index, '', optID));
|
|
|
|
|
mainData.push({
|
|
|
|
|
content: optionContent || text,
|
|
|
|
|
subtext: subtext,
|
|
|
|
|
tokens: tokens,
|
|
|
|
|
type: 'option',
|
|
|
|
|
optID: optID,
|
|
|
|
|
headerIndex: headerIndex,
|
|
|
|
|
lastIndex: headerIndex + parent.childElementCount,
|
|
|
|
|
originalIndex: index,
|
|
|
|
|
data: thisData
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
availableOptionsCount++;
|
|
|
|
|
} else if (thisData.divider === true) {
|
|
|
|
|
mainElements.push(generateLI(false, index, 'divider'));
|
|
|
|
|
mainData.push({
|
|
|
|
|
type: 'divider',
|
|
|
|
|
originalIndex: index
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
// if previous element is not an optgroup and hideDisabled is true
|
|
|
|
|
if (!showDivider && that.options.hideDisabled) {
|
|
|
|
|
prevHiddenIndex = thisData.prevHiddenIndex;
|
|
|
|
|
|
|
|
|
|
if (prevHiddenIndex !== undefined) {
|
|
|
|
|
// select the element **before** the first hidden element in the group
|
|
|
|
|
var prevHidden = $selectOptions[prevHiddenIndex].previousElementSibling;
|
|
|
|
|
|
|
|
|
|
if (prevHidden && prevHidden.tagName === 'OPTGROUP' && !prevHidden.disabled) {
|
|
|
|
|
showDivider = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (showDivider && mainData[mainData.length - 1].type !== 'divider') {
|
|
|
|
|
liIndex++;
|
|
|
|
|
mainElements.push(
|
|
|
|
|
generateLI(
|
|
|
|
|
false,
|
|
|
|
|
null,
|
|
|
|
|
classNames.DIVIDER,
|
|
|
|
|
optID + 'div'
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
mainData.push({
|
|
|
|
|
type: 'divider',
|
|
|
|
|
optID: optID,
|
|
|
|
|
originalIndex: index
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
textElement = generateText({
|
|
|
|
|
text: text,
|
|
|
|
|
optionContent: optionContent,
|
|
|
|
|
optionSubtext: subtext,
|
|
|
|
|
optionIcon: icon
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
mainElements.push(generateLI(generateA(textElement, optionClass, inline), index));
|
|
|
|
|
mainData.push({
|
|
|
|
|
content: optionContent || text,
|
|
|
|
|
subtext: subtext,
|
|
|
|
|
tokens: tokens,
|
|
|
|
|
type: 'option',
|
|
|
|
|
originalIndex: index,
|
|
|
|
|
data: thisData
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
availableOptionsCount++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
that.selectpicker.main.map.newIndex[index] = liIndex;
|
|
|
|
|
that.selectpicker.main.map.originalIndex[liIndex] = index;
|
|
|
|
|
|
|
|
|
|
// get the most recent option info added to mainData
|
|
|
|
|
var _mainDataLast = mainData[mainData.length - 1];
|
|
|
|
|
|
|
|
|
|
_mainDataLast.disabled = isDisabled;
|
|
|
|
|
|
|
|
|
|
var combinedLength = 0;
|
|
|
|
|
|
|
|
|
|
// count the number of characters in the option - not perfect, but should work in most cases
|
|
|
|
|
if (_mainDataLast.content) combinedLength += _mainDataLast.content.length;
|
|
|
|
|
if (_mainDataLast.subtext) combinedLength += _mainDataLast.subtext.length;
|
|
|
|
|
// if there is an icon, ensure this option's width is checked
|
|
|
|
|
if (icon) combinedLength += 1;
|
|
|
|
|
|
|
|
|
|
if (combinedLength > widestOptionLength) {
|
|
|
|
|
widestOptionLength = combinedLength;
|
|
|
|
|
|
|
|
|
|
// guess which option is the widest
|
|
|
|
|
// use this when calculating menu width
|
|
|
|
|
// not perfect, but it's fast, and the width will be updating accordingly when scrolling
|
|
|
|
|
widestOption = mainElements[mainElements.length - 1];
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.selectpicker.main.elements = mainElements;
|
|
|
|
|
this.selectpicker.main.data = mainData;
|
|
|
|
|
|
|
|
|
|
this.selectpicker.current = this.selectpicker.main;
|
|
|
|
|
|
|
|
|
|
this.selectpicker.view.widestOption = widestOption;
|
|
|
|
|
this.selectpicker.view.availableOptionsCount = availableOptionsCount; // faster way to get # of available options without filter
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
findLis: function() {
|
|
|
|
|
return this.$menuInner.find('.inner > li');
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
render: function() {
|
|
|
|
|
var that = this,
|
|
|
|
|
$selectOptions = this.$element.find('option'),
|
|
|
|
|
selectedItems = [],
|
|
|
|
|
selectedItemsInTitle = [];
|
|
|
|
|
|
|
|
|
|
this.togglePlaceholder();
|
|
|
|
|
|
|
|
|
|
this.tabIndex();
|
|
|
|
|
|
|
|
|
|
for (var i = 0, len = this.selectpicker.main.elements.length; i < len; i++) {
|
|
|
|
|
var index = this.selectpicker.main.map.originalIndex[i],
|
|
|
|
|
option = $selectOptions[index];
|
|
|
|
|
|
|
|
|
|
if (option && option.selected) {
|
|
|
|
|
selectedItems.push(option);
|
|
|
|
|
|
|
|
|
|
if (selectedItemsInTitle.length < 100 && that.options.selectedTextFormat !== 'count' || selectedItems.length === 1) {
|
|
|
|
|
if (that.options.hideDisabled && (option.disabled || option.parentNode.tagName === 'OPTGROUP' && option.parentNode.disabled)) return;
|
|
|
|
|
|
|
|
|
|
var thisData = this.selectpicker.main.data[i].data,
|
|
|
|
|
icon = thisData.icon && that.options.showIcon ? '<i class="' + that.options.iconBase + ' ' + thisData.icon + '"></i> ' : '',
|
|
|
|
|
subtext,
|
|
|
|
|
titleItem;
|
|
|
|
|
|
|
|
|
|
if (that.options.showSubtext && thisData.subtext && !that.multiple) {
|
|
|
|
|
subtext = ' <small class="text-muted">' + thisData.subtext + '</small>';
|
|
|
|
|
} else {
|
|
|
|
|
subtext = '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (option.title) {
|
|
|
|
|
titleItem = option.title;
|
|
|
|
|
} else if (thisData.content && that.options.showContent) {
|
|
|
|
|
titleItem = thisData.content.toString();
|
|
|
|
|
} else {
|
|
|
|
|
titleItem = icon + option.innerHTML.trim() + subtext;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
selectedItemsInTitle.push(titleItem);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Fixes issue in IE10 occurring when no default option is selected and at least one option is disabled
|
|
|
|
|
//Convert all the values into a comma delimited string
|
|
|
|
|
var title = !this.multiple ? selectedItemsInTitle[0] : selectedItemsInTitle.join(this.options.multipleSeparator);
|
|
|
|
|
|
|
|
|
|
// add ellipsis
|
|
|
|
|
if (selectedItems.length > 50) title += '...';
|
|
|
|
|
|
|
|
|
|
// If this is a multiselect, and selectedTextFormat is count, then show 1 of 2 selected etc..
|
|
|
|
|
if (this.multiple && this.options.selectedTextFormat.indexOf('count') !== -1) {
|
|
|
|
|
var max = this.options.selectedTextFormat.split('>');
|
|
|
|
|
|
|
|
|
|
if ((max.length > 1 && selectedItems.length > max[1]) || (max.length === 1 && selectedItems.length >= 2)) {
|
|
|
|
|
var totalCount = this.selectpicker.view.availableOptionsCount,
|
|
|
|
|
tr8nText = (typeof this.options.countSelectedText === 'function') ? this.options.countSelectedText(selectedItems.length, totalCount) : this.options.countSelectedText;
|
|
|
|
|
|
|
|
|
|
title = tr8nText.replace('{0}', selectedItems.length.toString()).replace('{1}', totalCount.toString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.options.title == undefined) {
|
|
|
|
|
// use .attr to ensure undefined is returned if title attribute is not set
|
|
|
|
|
this.options.title = this.$element.attr('title');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.options.selectedTextFormat == 'static') {
|
|
|
|
|
title = this.options.title;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//If we dont have a title, then use the default, or if nothing is set at all, use the not selected text
|
|
|
|
|
if (!title) {
|
|
|
|
|
title = typeof this.options.title !== 'undefined' ? this.options.title : this.options.noneSelectedText;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//strip all HTML tags and trim the result, then unescape any escaped tags
|
|
|
|
|
this.$button[0].title = htmlUnescape(title.replace(/<[^>]*>?/g, '').trim());
|
|
|
|
|
this.$button.find('.filter-option-inner-inner')[0].innerHTML = title;
|
|
|
|
|
|
|
|
|
|
this.$element.trigger('rendered.bs.select');
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param [style]
|
|
|
|
|
* @param [status]
|
|
|
|
|
*/
|
|
|
|
|
setStyle: function(style, status) {
|
|
|
|
|
if (this.$element.attr('class')) {
|
|
|
|
|
this.$newElement.addClass(this.$element.attr('class').replace(/selectpicker|mobile-device|bs-select-hidden|validate\[.*\]/gi, ''));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var buttonClass = style ? style : this.options.style;
|
|
|
|
|
|
|
|
|
|
if (status == 'add') {
|
|
|
|
|
this.$button.addClass(buttonClass);
|
|
|
|
|
} else if (status == 'remove') {
|
|
|
|
|
this.$button.removeClass(buttonClass);
|
|
|
|
|
} else {
|
|
|
|
|
this.$button.removeClass(this.options.style);
|
|
|
|
|
this.$button.addClass(buttonClass);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
liHeight: function(refresh) {
|
|
|
|
|
if (!refresh && (this.options.size === false || this.sizeInfo)) return;
|
|
|
|
|
|
|
|
|
|
if (!this.sizeInfo) this.sizeInfo = {};
|
|
|
|
|
|
|
|
|
|
var newElement = document.createElement('div'),
|
|
|
|
|
menu = document.createElement('div'),
|
|
|
|
|
menuInner = document.createElement('div'),
|
|
|
|
|
menuInnerInner = document.createElement('ul'),
|
|
|
|
|
divider = document.createElement('li'),
|
|
|
|
|
dropdownHeader = document.createElement('li'),
|
|
|
|
|
li = document.createElement('li'),
|
|
|
|
|
a = document.createElement('a'),
|
|
|
|
|
text = document.createElement('span'),
|
|
|
|
|
header = this.options.header && this.$menu.find('.' + classNames.POPOVERHEADER).length > 0 ? this.$menu.find('.' + classNames.POPOVERHEADER)[0].cloneNode(true) : null,
|
|
|
|
|
search = this.options.liveSearch ? document.createElement('div') : null,
|
|
|
|
|
actions = this.options.actionsBox && this.multiple && this.$menu.find('.bs-actionsbox').length > 0 ? this.$menu.find('.bs-actionsbox')[0].cloneNode(true) : null,
|
|
|
|
|
doneButton = this.options.doneButton && this.multiple && this.$menu.find('.bs-donebutton').length > 0 ? this.$menu.find('.bs-donebutton')[0].cloneNode(true) : null;
|
|
|
|
|
|
|
|
|
|
this.sizeInfo.selectWidth = this.$newElement[0].offsetWidth;
|
|
|
|
|
|
|
|
|
|
text.className = 'text';
|
|
|
|
|
a.className = 'dropdown-item';
|
|
|
|
|
newElement.className = this.$menu[0].parentNode.className + ' ' + classNames.SHOW;
|
|
|
|
|
newElement.style.width = this.sizeInfo.selectWidth + 'px';
|
|
|
|
|
menu.className = 'dropdown-menu ' + classNames.SHOW;
|
|
|
|
|
menuInner.className = 'inner ' + classNames.SHOW;
|
|
|
|
|
menuInnerInner.className = 'dropdown-menu inner ' + (version.major === '4' ? classNames.SHOW : '');
|
|
|
|
|
divider.className = classNames.DIVIDER;
|
|
|
|
|
dropdownHeader.className = 'dropdown-header';
|
|
|
|
|
|
|
|
|
|
text.appendChild(document.createTextNode('Inner text'));
|
|
|
|
|
a.appendChild(text);
|
|
|
|
|
li.appendChild(a);
|
|
|
|
|
dropdownHeader.appendChild(text.cloneNode(true));
|
|
|
|
|
|
|
|
|
|
if (this.selectpicker.view.widestOption) {
|
|
|
|
|
menuInnerInner.appendChild(this.selectpicker.view.widestOption.cloneNode(true));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
menuInnerInner.appendChild(li);
|
|
|
|
|
menuInnerInner.appendChild(divider);
|
|
|
|
|
menuInnerInner.appendChild(dropdownHeader);
|
|
|
|
|
if (header) menu.appendChild(header);
|
|
|
|
|
if (search) {
|
|
|
|
|
var input = document.createElement('input');
|
|
|
|
|
search.className = 'bs-searchbox';
|
|
|
|
|
input.className = 'form-control';
|
|
|
|
|
search.appendChild(input);
|
|
|
|
|
menu.appendChild(search);
|
|
|
|
|
}
|
|
|
|
|
if (actions) menu.appendChild(actions);
|
|
|
|
|
menuInner.appendChild(menuInnerInner);
|
|
|
|
|
menu.appendChild(menuInner);
|
|
|
|
|
if (doneButton) menu.appendChild(doneButton);
|
|
|
|
|
newElement.appendChild(menu);
|
|
|
|
|
|
|
|
|
|
document.body.appendChild(newElement);
|
|
|
|
|
|
|
|
|
|
var liHeight = a.offsetHeight,
|
|
|
|
|
dropdownHeaderHeight = dropdownHeader ? dropdownHeader.offsetHeight : 0,
|
|
|
|
|
headerHeight = header ? header.offsetHeight : 0,
|
|
|
|
|
searchHeight = search ? search.offsetHeight : 0,
|
|
|
|
|
actionsHeight = actions ? actions.offsetHeight : 0,
|
|
|
|
|
doneButtonHeight = doneButton ? doneButton.offsetHeight : 0,
|
|
|
|
|
dividerHeight = $(divider).outerHeight(true),
|
|
|
|
|
// fall back to jQuery if getComputedStyle is not supported
|
|
|
|
|
menuStyle = window.getComputedStyle ? window.getComputedStyle(menu) : false,
|
|
|
|
|
menuWidth = menu.offsetWidth,
|
|
|
|
|
$menu = menuStyle ? null : $(menu),
|
|
|
|
|
menuPadding = {
|
|
|
|
|
vert: toInteger(menuStyle ? menuStyle.paddingTop : $menu.css('paddingTop')) +
|
|
|
|
|
toInteger(menuStyle ? menuStyle.paddingBottom : $menu.css('paddingBottom')) +
|
|
|
|
|
toInteger(menuStyle ? menuStyle.borderTopWidth : $menu.css('borderTopWidth')) +
|
|
|
|
|
toInteger(menuStyle ? menuStyle.borderBottomWidth : $menu.css('borderBottomWidth')),
|
|
|
|
|
horiz: toInteger(menuStyle ? menuStyle.paddingLeft : $menu.css('paddingLeft')) +
|
|
|
|
|
toInteger(menuStyle ? menuStyle.paddingRight : $menu.css('paddingRight')) +
|
|
|
|
|
toInteger(menuStyle ? menuStyle.borderLeftWidth : $menu.css('borderLeftWidth')) +
|
|
|
|
|
toInteger(menuStyle ? menuStyle.borderRightWidth : $menu.css('borderRightWidth'))
|
|
|
|
|
},
|
|
|
|
|
menuExtras = {
|
|
|
|
|
vert: menuPadding.vert +
|
|
|
|
|
toInteger(menuStyle ? menuStyle.marginTop : $menu.css('marginTop')) +
|
|
|
|
|
toInteger(menuStyle ? menuStyle.marginBottom : $menu.css('marginBottom')) + 2,
|
|
|
|
|
horiz: menuPadding.horiz +
|
|
|
|
|
toInteger(menuStyle ? menuStyle.marginLeft : $menu.css('marginLeft')) +
|
|
|
|
|
toInteger(menuStyle ? menuStyle.marginRight : $menu.css('marginRight')) + 2
|
|
|
|
|
},
|
|
|
|
|
scrollBarWidth;
|
|
|
|
|
|
|
|
|
|
menuInner.style.overflowY = 'scroll';
|
|
|
|
|
|
|
|
|
|
scrollBarWidth = menu.offsetWidth - menuWidth;
|
|
|
|
|
|
|
|
|
|
document.body.removeChild(newElement);
|
|
|
|
|
|
|
|
|
|
this.sizeInfo.liHeight = liHeight;
|
|
|
|
|
this.sizeInfo.dropdownHeaderHeight = dropdownHeaderHeight;
|
|
|
|
|
this.sizeInfo.headerHeight = headerHeight;
|
|
|
|
|
this.sizeInfo.searchHeight = searchHeight;
|
|
|
|
|
this.sizeInfo.actionsHeight = actionsHeight;
|
|
|
|
|
this.sizeInfo.doneButtonHeight = doneButtonHeight;
|
|
|
|
|
this.sizeInfo.dividerHeight = dividerHeight;
|
|
|
|
|
this.sizeInfo.menuPadding = menuPadding;
|
|
|
|
|
this.sizeInfo.menuExtras = menuExtras;
|
|
|
|
|
this.sizeInfo.menuWidth = menuWidth;
|
|
|
|
|
this.sizeInfo.totalMenuWidth = this.sizeInfo.menuWidth;
|
|
|
|
|
this.sizeInfo.scrollBarWidth = scrollBarWidth;
|
|
|
|
|
this.sizeInfo.selectHeight = this.$newElement[0].offsetHeight;
|
|
|
|
|
|
|
|
|
|
this.setPositionData();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
getSelectPosition: function() {
|
|
|
|
|
var that = this,
|
|
|
|
|
$window = $(window),
|
|
|
|
|
pos = that.$newElement.offset(),
|
|
|
|
|
$container = $(that.options.container),
|
|
|
|
|
containerPos;
|
|
|
|
|
|
|
|
|
|
if (that.options.container && !$container.is('body')) {
|
|
|
|
|
containerPos = $container.offset();
|
|
|
|
|
containerPos.top += parseInt($container.css('borderTopWidth'));
|
|
|
|
|
containerPos.left += parseInt($container.css('borderLeftWidth'));
|
|
|
|
|
} else {
|
|
|
|
|
containerPos = {
|
|
|
|
|
top: 0,
|
|
|
|
|
left: 0
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var winPad = that.options.windowPadding;
|
|
|
|
|
|
|
|
|
|
this.sizeInfo.selectOffsetTop = pos.top - containerPos.top - $window.scrollTop();
|
|
|
|
|
this.sizeInfo.selectOffsetBot = $window.height() - this.sizeInfo.selectOffsetTop - this.sizeInfo['selectHeight'] - containerPos.top - winPad[2];
|
|
|
|
|
this.sizeInfo.selectOffsetLeft = pos.left - containerPos.left - $window.scrollLeft();
|
|
|
|
|
this.sizeInfo.selectOffsetRight = $window.width() - this.sizeInfo.selectOffsetLeft - this.sizeInfo['selectWidth'] - containerPos.left - winPad[1];
|
|
|
|
|
this.sizeInfo.selectOffsetTop -= winPad[0];
|
|
|
|
|
this.sizeInfo.selectOffsetLeft -= winPad[3];
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
setMenuSize: function(isAuto) {
|
|
|
|
|
this.getSelectPosition();
|
|
|
|
|
|
|
|
|
|
var selectWidth = this.sizeInfo['selectWidth'],
|
|
|
|
|
liHeight = this.sizeInfo['liHeight'],
|
|
|
|
|
headerHeight = this.sizeInfo['headerHeight'],
|
|
|
|
|
searchHeight = this.sizeInfo['searchHeight'],
|
|
|
|
|
actionsHeight = this.sizeInfo['actionsHeight'],
|
|
|
|
|
doneButtonHeight = this.sizeInfo['doneButtonHeight'],
|
|
|
|
|
divHeight = this.sizeInfo['dividerHeight'],
|
|
|
|
|
menuPadding = this.sizeInfo['menuPadding'],
|
|
|
|
|
menuInnerHeight,
|
|
|
|
|
menuHeight,
|
|
|
|
|
divLength = 0,
|
|
|
|
|
minHeight,
|
|
|
|
|
_minHeight,
|
|
|
|
|
maxHeight,
|
|
|
|
|
menuInnerMinHeight,
|
|
|
|
|
estimate;
|
|
|
|
|
|
|
|
|
|
if (this.options.dropupAuto) {
|
|
|
|
|
// Get the estimated height of the menu without scrollbars.
|
|
|
|
|
// This is useful for smaller menus, where there might be plenty of room
|
|
|
|
|
// below the button without setting dropup, but we can't know
|
|
|
|
|
// the exact height of the menu until createView is called later
|
|
|
|
|
estimate = liHeight * this.selectpicker.current.elements.length + menuPadding.vert;
|
|
|
|
|
this.$newElement.toggleClass(classNames.DROPUP, this.sizeInfo.selectOffsetTop - this.sizeInfo.selectOffsetBot > this.sizeInfo.menuExtras.vert && estimate + this.sizeInfo.menuExtras.vert + 50 > this.sizeInfo.selectOffsetBot);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.options.size === 'auto') {
|
|
|
|
|
_minHeight = this.selectpicker.current.elements.length > 3 ? this.sizeInfo.liHeight * 3 + this.sizeInfo.menuExtras.vert - 2 : 0;
|
|
|
|
|
menuHeight = this.sizeInfo.selectOffsetBot - this.sizeInfo.menuExtras.vert;
|
|
|
|
|
minHeight = _minHeight + headerHeight + searchHeight + actionsHeight + doneButtonHeight;
|
|
|
|
|
menuInnerMinHeight = Math.max(_minHeight - menuPadding.vert, 0);
|
|
|
|
|
|
|
|
|
|
if (this.$newElement.hasClass(classNames.DROPUP)) {
|
|
|
|
|
menuHeight = this.sizeInfo.selectOffsetTop - this.sizeInfo.menuExtras.vert;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
maxHeight = menuHeight;
|
|
|
|
|
menuInnerHeight = menuHeight - headerHeight - searchHeight - actionsHeight - doneButtonHeight - menuPadding.vert;
|
|
|
|
|
} else if (this.options.size && this.options.size != 'auto' && this.selectpicker.current.elements.length > this.options.size) {
|
|
|
|
|
for (var i = 0; i < this.options.size; i++) {
|
|
|
|
|
if (this.selectpicker.current.data[i].type === 'divider') divLength++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
menuHeight = liHeight * this.options.size + divLength * divHeight + menuPadding.vert;
|
|
|
|
|
menuInnerHeight = menuHeight - menuPadding.vert;
|
|
|
|
|
maxHeight = menuHeight + headerHeight + searchHeight + actionsHeight + doneButtonHeight;
|
|
|
|
|
minHeight = menuInnerMinHeight = '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.options.dropdownAlignRight === 'auto') {
|
|
|
|
|
this.$menu.toggleClass(classNames.MENURIGHT, this.sizeInfo.selectOffsetLeft > this.sizeInfo.selectOffsetRight && this.sizeInfo.selectOffsetRight < (this.$menu[0].offsetWidth - selectWidth));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.$menu.css({
|
|
|
|
|
'max-height': maxHeight + 'px',
|
|
|
|
|
'overflow': 'hidden',
|
|
|
|
|
'min-height': minHeight + 'px'
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.$menuInner.css({
|
|
|
|
|
'max-height': menuInnerHeight + 'px',
|
|
|
|
|
'overflow-y': 'auto',
|
|
|
|
|
'min-height': menuInnerMinHeight + 'px'
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.sizeInfo['menuInnerHeight'] = menuInnerHeight;
|
|
|
|
|
|
|
|
|
|
if (this.selectpicker.current.data.length && this.selectpicker.current.data[this.selectpicker.current.data.length - 1].position > this.sizeInfo.menuInnerHeight) {
|
|
|
|
|
this.sizeInfo.hasScrollBar = true;
|
|
|
|
|
this.sizeInfo.totalMenuWidth = this.sizeInfo.menuWidth + this.sizeInfo.scrollBarWidth;
|
|
|
|
|
|
|
|
|
|
this.$menu.css('min-width', this.sizeInfo.totalMenuWidth);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.dropdown && this.dropdown._popper) this.dropdown._popper.update();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
setSize: function(refresh) {
|
|
|
|
|
this.liHeight(refresh);
|
|
|
|
|
|
|
|
|
|
if (this.options.header) this.$menu.css('padding-top', 0);
|
|
|
|
|
if (this.options.size === false) return;
|
|
|
|
|
|
|
|
|
|
var that = this,
|
|
|
|
|
$window = $(window),
|
|
|
|
|
selectedIndex,
|
|
|
|
|
offset = 0;
|
|
|
|
|
|
|
|
|
|
this.setMenuSize();
|
|
|
|
|
|
|
|
|
|
if (this.options.size === 'auto') {
|
|
|
|
|
this.$searchbox.off('input.setMenuSize propertychange.setMenuSize').on('input.setMenuSize propertychange.setMenuSize', function() {
|
|
|
|
|
return that.setMenuSize();
|
|
|
|
|
});
|
|
|
|
|
$window.off('resize.setMenuSize scroll.setMenuSize').on('resize.setMenuSize scroll.setMenuSize', function() {
|
|
|
|
|
return that.setMenuSize();
|
|
|
|
|
});
|
|
|
|
|
} else if (this.options.size && this.options.size != 'auto' && this.selectpicker.current.elements.length > this.options.size) {
|
|
|
|
|
this.$searchbox.off('input.setMenuSize propertychange.setMenuSize');
|
|
|
|
|
$window.off('resize.setMenuSize scroll.setMenuSize');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (refresh) {
|
|
|
|
|
offset = this.$menuInner[0].scrollTop;
|
|
|
|
|
} else if (!that.multiple) {
|
|
|
|
|
selectedIndex = that.selectpicker.main.map.newIndex[that.$element[0].selectedIndex];
|
|
|
|
|
|
|
|
|
|
if (typeof selectedIndex === 'number' && that.options.size !== false) {
|
|
|
|
|
offset = that.sizeInfo.liHeight * selectedIndex;
|
|
|
|
|
offset = offset - (that.sizeInfo.menuInnerHeight / 2) + (that.sizeInfo.liHeight / 2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
that.createView(false, offset);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
setWidth: function() {
|
|
|
|
|
var that = this;
|
|
|
|
|
|
|
|
|
|
if (this.options.width === 'auto') {
|
|
|
|
|
requestAnimationFrame(function() {
|
|
|
|
|
that.$menu.css('min-width', '0');
|
|
|
|
|
that.liHeight();
|
|
|
|
|
that.setMenuSize();
|
|
|
|
|
|
|
|
|
|
// Get correct width if element is hidden
|
|
|
|
|
var $selectClone = that.$newElement.clone().appendTo('body'),
|
|
|
|
|
btnWidth = $selectClone.css('width', 'auto').children('button').outerWidth();
|
|
|
|
|
|
|
|
|
|
$selectClone.remove();
|
|
|
|
|
|
|
|
|
|
// Set width to whatever's larger, button title or longest option
|
|
|
|
|
that.sizeInfo.selectWidth = Math.max(that.sizeInfo.totalMenuWidth, btnWidth);
|
|
|
|
|
that.$newElement.css('width', that.sizeInfo.selectWidth + 'px');
|
|
|
|
|
});
|
|
|
|
|
} else if (this.options.width === 'fit') {
|
|
|
|
|
// Remove inline min-width so width can be changed from 'auto'
|
|
|
|
|
this.$menu.css('min-width', '');
|
|
|
|
|
this.$newElement.css('width', '').addClass('fit-width');
|
|
|
|
|
} else if (this.options.width) {
|
|
|
|
|
// Remove inline min-width so width can be changed from 'auto'
|
|
|
|
|
this.$menu.css('min-width', '');
|
|
|
|
|
this.$newElement.css('width', this.options.width);
|
|
|
|
|
} else {
|
|
|
|
|
// Remove inline min-width/width so width can be changed
|
|
|
|
|
this.$menu.css('min-width', '');
|
|
|
|
|
this.$newElement.css('width', '');
|
|
|
|
|
}
|
|
|
|
|
// Remove fit-width class if width is changed programmatically
|
|
|
|
|
if (this.$newElement.hasClass('fit-width') && this.options.width !== 'fit') {
|
|
|
|
|
this.$newElement.removeClass('fit-width');
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
selectPosition: function() {
|
|
|
|
|
this.$bsContainer = $('<div class="bs-container" />');
|
|
|
|
|
|
|
|
|
|
var that = this,
|
|
|
|
|
$container = $(this.options.container),
|
|
|
|
|
pos,
|
|
|
|
|
containerPos,
|
|
|
|
|
actualHeight,
|
|
|
|
|
getPlacement = function($element) {
|
|
|
|
|
var containerPosition = {};
|
|
|
|
|
|
|
|
|
|
that.$bsContainer.addClass($element.attr('class').replace(/form-control|fit-width/gi, '')).toggleClass(classNames.DROPUP, $element.hasClass(classNames.DROPUP));
|
|
|
|
|
pos = $element.offset();
|
|
|
|
|
|
|
|
|
|
if (!$container.is('body')) {
|
|
|
|
|
containerPos = $container.offset();
|
|
|
|
|
containerPos.top += parseInt($container.css('borderTopWidth')) - $container.scrollTop();
|
|
|
|
|
containerPos.left += parseInt($container.css('borderLeftWidth')) - $container.scrollLeft();
|
|
|
|
|
} else {
|
|
|
|
|
containerPos = {
|
|
|
|
|
top: 0,
|
|
|
|
|
left: 0
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
actualHeight = $element.hasClass(classNames.DROPUP) ? 0 : $element[0].offsetHeight;
|
|
|
|
|
|
|
|
|
|
// Bootstrap 4+ uses Popper for menu positioning
|
|
|
|
|
if (version.major < 4) {
|
|
|
|
|
containerPosition['top'] = pos.top - containerPos.top + actualHeight;
|
|
|
|
|
containerPosition['left'] = pos.left - containerPos.left;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
containerPosition['width'] = $element[0].offsetWidth;
|
|
|
|
|
|
|
|
|
|
that.$bsContainer.css(containerPosition);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
this.$button.on('click.bs.dropdown.data-api', function() {
|
|
|
|
|
if (that.isDisabled()) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getPlacement(that.$newElement);
|
|
|
|
|
|
|
|
|
|
that.$bsContainer
|
|
|
|
|
.appendTo(that.options.container)
|
|
|
|
|
.toggleClass(classNames.SHOW, !that.$button.hasClass(classNames.SHOW))
|
|
|
|
|
.append(that.$menu);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$(window).on('resize scroll', function() {
|
|
|
|
|
getPlacement(that.$newElement);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.$element.on('hide.bs.select', function() {
|
|
|
|
|
that.$menu.data('height', that.$menu.height());
|
|
|
|
|
that.$bsContainer.detach();
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
setOptionStatus: function() {
|
|
|
|
|
var that = this,
|
|
|
|
|
$selectOptions = this.$element.find('option');
|
|
|
|
|
|
|
|
|
|
that.noScroll = false;
|
|
|
|
|
|
|
|
|
|
if (that.selectpicker.view.visibleElements && that.selectpicker.view.visibleElements.length) {
|
|
|
|
|
for (var i = 0; i < that.selectpicker.view.visibleElements.length; i++) {
|
|
|
|
|
var index = that.selectpicker.current.map.originalIndex[i + that.selectpicker.view.position0], // faster than $(li).data('originalIndex')
|
|
|
|
|
option = $selectOptions[index];
|
|
|
|
|
|
|
|
|
|
if (option) {
|
|
|
|
|
var liIndex = this.selectpicker.main.map.newIndex[index],
|
|
|
|
|
li = this.selectpicker.main.elements[liIndex];
|
|
|
|
|
|
|
|
|
|
that.setDisabled(
|
|
|
|
|
index,
|
|
|
|
|
option.disabled || option.parentNode.tagName === 'OPTGROUP' && option.parentNode.disabled,
|
|
|
|
|
liIndex,
|
|
|
|
|
li
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
that.setSelected(
|
|
|
|
|
index,
|
|
|
|
|
option.selected,
|
|
|
|
|
liIndex,
|
|
|
|
|
li
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param {number} index - the index of the option that is being changed
|
|
|
|
|
* @param {boolean} selected - true if the option is being selected, false if being deselected
|
|
|
|
|
*/
|
|
|
|
|
setSelected: function(index, selected, liIndex, li) {
|
|
|
|
|
var activeIndexIsSet = this.activeIndex !== undefined,
|
|
|
|
|
thisIsActive = this.activeIndex === index,
|
|
|
|
|
prevActiveIndex,
|
|
|
|
|
prevActive,
|
|
|
|
|
a,
|
|
|
|
|
// if current option is already active
|
|
|
|
|
// OR
|
|
|
|
|
// if the current option is being selected, it's NOT multiple, and
|
|
|
|
|
// activeIndex is undefined:
|
|
|
|
|
// - when the menu is first being opened, OR
|
|
|
|
|
// - after a search has been performed, OR
|
|
|
|
|
// - when retainActive is false when selecting a new option (i.e. index of the newly selected option is not the same as the current activeIndex)
|
|
|
|
|
keepActive = thisIsActive || selected && !this.multiple && !activeIndexIsSet;
|
|
|
|
|
|
|
|
|
|
if (!liIndex) liIndex = this.selectpicker.main.map.newIndex[index];
|
|
|
|
|
if (!li) li = this.selectpicker.main.elements[liIndex];
|
|
|
|
|
|
|
|
|
|
a = li.firstChild;
|
|
|
|
|
|
|
|
|
|
if (selected) {
|
|
|
|
|
this.selectedIndex = index;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
li.classList.toggle('selected', selected);
|
|
|
|
|
li.classList.toggle('active', keepActive);
|
|
|
|
|
|
|
|
|
|
if (keepActive) {
|
|
|
|
|
this.selectpicker.view.currentActive = li;
|
|
|
|
|
this.activeIndex = index;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (a) {
|
|
|
|
|
a.classList.toggle('selected', selected);
|
|
|
|
|
a.classList.toggle('active', keepActive);
|
|
|
|
|
a.setAttribute('aria-selected', selected);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!keepActive) {
|
|
|
|
|
if (!activeIndexIsSet && selected && this.prevActiveIndex !== undefined) {
|
|
|
|
|
prevActiveIndex = this.selectpicker.main.map.newIndex[this.prevActiveIndex];
|
|
|
|
|
prevActive = this.selectpicker.main.elements[prevActiveIndex];
|
|
|
|
|
|
|
|
|
|
prevActive.classList.remove('selected');
|
|
|
|
|
prevActive.classList.remove('active');
|
|
|
|
|
if (prevActive.firstChild) {
|
|
|
|
|
prevActive.firstChild.classList.remove('selected');
|
|
|
|
|
prevActive.firstChild.classList.remove('active');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param {number} index - the index of the option that is being disabled
|
|
|
|
|
* @param {boolean} disabled - true if the option is being disabled, false if being enabled
|
|
|
|
|
*/
|
|
|
|
|
setDisabled: function(index, disabled, liIndex, li) {
|
|
|
|
|
var a;
|
|
|
|
|
|
|
|
|
|
if (!liIndex) liIndex = this.selectpicker.main.map.newIndex[index];
|
|
|
|
|
if (!li) li = this.selectpicker.main.elements[liIndex];
|
|
|
|
|
|
|
|
|
|
a = li.firstChild;
|
|
|
|
|
|
|
|
|
|
li.classList.toggle(classNames.DISABLED, disabled);
|
|
|
|
|
|
|
|
|
|
if (a) {
|
|
|
|
|
if (version.major === '4') a.classList.toggle(classNames.DISABLED, disabled);
|
|
|
|
|
|
|
|
|
|
a.setAttribute('aria-disabled', disabled);
|
|
|
|
|
|
|
|
|
|
if (disabled) {
|
|
|
|
|
a.setAttribute('tabindex', -1);
|
|
|
|
|
} else {
|
|
|
|
|
a.setAttribute('tabindex', 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
isDisabled: function() {
|
|
|
|
|
return this.$element[0].disabled;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
checkDisabled: function() {
|
|
|
|
|
var that = this;
|
|
|
|
|
|
|
|
|
|
if (this.isDisabled()) {
|
|
|
|
|
this.$newElement.addClass(classNames.DISABLED);
|
|
|
|
|
this.$button.addClass(classNames.DISABLED).attr('tabindex', -1).attr('aria-disabled', true);
|
|
|
|
|
} else {
|
|
|
|
|
if (this.$button.hasClass(classNames.DISABLED)) {
|
|
|
|
|
this.$newElement.removeClass(classNames.DISABLED);
|
|
|
|
|
this.$button.removeClass(classNames.DISABLED).attr('aria-disabled', false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.$button.attr('tabindex') == -1 && !this.$element.data('tabindex')) {
|
|
|
|
|
this.$button.removeAttr('tabindex');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.$button.click(function() {
|
|
|
|
|
return !that.isDisabled();
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
togglePlaceholder: function() {
|
|
|
|
|
// much faster than calling $.val()
|
|
|
|
|
var element = this.$element[0],
|
|
|
|
|
selectedIndex = element.selectedIndex,
|
|
|
|
|
nothingSelected = selectedIndex === -1;
|
|
|
|
|
|
|
|
|
|
if (!nothingSelected && !element.options[selectedIndex].value) nothingSelected = true;
|
|
|
|
|
|
|
|
|
|
this.$button.toggleClass('bs-placeholder', nothingSelected);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
tabIndex: function() {
|
|
|
|
|
if (this.$element.data('tabindex') !== this.$element.attr('tabindex') &&
|
|
|
|
|
(this.$element.attr('tabindex') !== -98 && this.$element.attr('tabindex') !== '-98')) {
|
|
|
|
|
this.$element.data('tabindex', this.$element.attr('tabindex'));
|
|
|
|
|
this.$button.attr('tabindex', this.$element.data('tabindex'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.$element.attr('tabindex', -98);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
clickListener: function() {
|
|
|
|
|
var that = this,
|
|
|
|
|
$document = $(document);
|
|
|
|
|
|
|
|
|
|
$document.data('spaceSelect', false);
|
|
|
|
|
|
|
|
|
|
this.$button.on('keyup', function(e) {
|
|
|
|
|
if (/(32)/.test(e.keyCode.toString(10)) && $document.data('spaceSelect')) {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
$document.data('spaceSelect', false);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.$newElement.on('show.bs.dropdown', function() {
|
|
|
|
|
if (version.major > 3 && !that.dropdown) {
|
|
|
|
|
that.dropdown = that.$button.data('bs.dropdown');
|
|
|
|
|
that.dropdown._menu = that.$menu[0];
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.$button.on('click.bs.dropdown.data-api', function() {
|
|
|
|
|
if (!that.$newElement.hasClass(classNames.SHOW)) {
|
|
|
|
|
that.setSize();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.$element.on('shown.bs.select', function() {
|
|
|
|
|
if (that.$menuInner[0].scrollTop !== that.selectpicker.view.scrollTop) {
|
|
|
|
|
that.$menuInner[0].scrollTop = that.selectpicker.view.scrollTop;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (that.options.liveSearch) {
|
|
|
|
|
that.$searchbox.focus();
|
|
|
|
|
} else {
|
|
|
|
|
that.$menuInner.focus();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.$menuInner.on('click', 'li a', function(e, retainActive) {
|
|
|
|
|
var $this = $(this),
|
|
|
|
|
position0 = that.isVirtual() ? that.selectpicker.view.position0 : 0,
|
|
|
|
|
clickedIndex = that.selectpicker.current.map.originalIndex[$this.parent().index() + position0],
|
|
|
|
|
prevValue = getSelectValues(that.$element[0]),
|
|
|
|
|
prevIndex = that.$element.prop('selectedIndex'),
|
|
|
|
|
triggerChange = true;
|
|
|
|
|
|
|
|
|
|
// Don't close on multi choice menu
|
|
|
|
|
if (that.multiple && that.options.maxOptions !== 1) {
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
|
|
//Don't run if we have been disabled
|
|
|
|
|
if (!that.isDisabled() && !$this.parent().hasClass(classNames.DISABLED)) {
|
|
|
|
|
var $options = that.$element.find('option'),
|
|
|
|
|
$option = $options.eq(clickedIndex),
|
|
|
|
|
state = $option.prop('selected'),
|
|
|
|
|
$optgroup = $option.parent('optgroup'),
|
|
|
|
|
maxOptions = that.options.maxOptions,
|
|
|
|
|
maxOptionsGrp = $optgroup.data('maxOptions') || false;
|
|
|
|
|
|
|
|
|
|
if (clickedIndex === that.activeIndex) retainActive = true;
|
|
|
|
|
|
|
|
|
|
if (!retainActive) {
|
|
|
|
|
that.prevActiveIndex = that.activeIndex;
|
|
|
|
|
that.activeIndex = undefined;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!that.multiple) { // Deselect all others if not multi select box
|
|
|
|
|
$options.prop('selected', false);
|
|
|
|
|
$option.prop('selected', true);
|
|
|
|
|
that.setSelected(clickedIndex, true);
|
|
|
|
|
} else { // Toggle the one we have chosen if we are multi select.
|
|
|
|
|
$option.prop('selected', !state);
|
|
|
|
|
|
|
|
|
|
that.setSelected(clickedIndex, !state);
|
|
|
|
|
$this.blur();
|
|
|
|
|
|
|
|
|
|
if (maxOptions !== false || maxOptionsGrp !== false) {
|
|
|
|
|
var maxReached = maxOptions < $options.filter(':selected').length,
|
|
|
|
|
maxReachedGrp = maxOptionsGrp < $optgroup.find('option:selected').length;
|
|
|
|
|
|
|
|
|
|
if ((maxOptions && maxReached) || (maxOptionsGrp && maxReachedGrp)) {
|
|
|
|
|
if (maxOptions && maxOptions == 1) {
|
|
|
|
|
$options.prop('selected', false);
|
|
|
|
|
$option.prop('selected', true);
|
|
|
|
|
that.$menuInner.find('.selected').removeClass('selected');
|
|
|
|
|
that.setSelected(clickedIndex, true);
|
|
|
|
|
} else if (maxOptionsGrp && maxOptionsGrp == 1) {
|
|
|
|
|
$optgroup.find('option:selected').prop('selected', false);
|
|
|
|
|
$option.prop('selected', true);
|
|
|
|
|
var optgroupID = that.selectpicker.current.data[$this.parent().index() + that.selectpicker.view.position0].optID;
|
|
|
|
|
that.$menuInner.find('.optgroup-' + optgroupID).removeClass('selected');
|
|
|
|
|
that.setSelected(clickedIndex, true);
|
|
|
|
|
} else {
|
|
|
|
|
var maxOptionsText = typeof that.options.maxOptionsText === 'string' ? [that.options.maxOptionsText, that.options.maxOptionsText] : that.options.maxOptionsText,
|
|
|
|
|
maxOptionsArr = typeof maxOptionsText === 'function' ? maxOptionsText(maxOptions, maxOptionsGrp) : maxOptionsText,
|
|
|
|
|
maxTxt = maxOptionsArr[0].replace('{n}', maxOptions),
|
|
|
|
|
maxTxtGrp = maxOptionsArr[1].replace('{n}', maxOptionsGrp),
|
|
|
|
|
$notify = $('<div class="notify"></div>');
|
|
|
|
|
// If {var} is set in array, replace it
|
|
|
|
|
/** @deprecated */
|
|
|
|
|
if (maxOptionsArr[2]) {
|
|
|
|
|
maxTxt = maxTxt.replace('{var}', maxOptionsArr[2][maxOptions > 1 ? 0 : 1]);
|
|
|
|
|
maxTxtGrp = maxTxtGrp.replace('{var}', maxOptionsArr[2][maxOptionsGrp > 1 ? 0 : 1]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$option.prop('selected', false);
|
|
|
|
|
|
|
|
|
|
that.$menu.append($notify);
|
|
|
|
|
|
|
|
|
|
if (maxOptions && maxReached) {
|
|
|
|
|
$notify.append($('<div>' + maxTxt + '</div>'));
|
|
|
|
|
triggerChange = false;
|
|
|
|
|
that.$element.trigger('maxReached.bs.select');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (maxOptionsGrp && maxReachedGrp) {
|
|
|
|
|
$notify.append($('<div>' + maxTxtGrp + '</div>'));
|
|
|
|
|
triggerChange = false;
|
|
|
|
|
that.$element.trigger('maxReachedGrp.bs.select');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setTimeout(function() {
|
|
|
|
|
that.setSelected(clickedIndex, false);
|
|
|
|
|
}, 10);
|
|
|
|
|
|
|
|
|
|
$notify.delay(750).fadeOut(300, function() {
|
|
|
|
|
$(this).remove();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!that.multiple || (that.multiple && that.options.maxOptions === 1)) {
|
|
|
|
|
that.$button.focus();
|
|
|
|
|
} else if (that.options.liveSearch) {
|
|
|
|
|
that.$searchbox.focus();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Trigger select 'change'
|
|
|
|
|
if (triggerChange) {
|
|
|
|
|
if ((prevValue != getSelectValues(that.$element[0]) && that.multiple) || (prevIndex != that.$element.prop('selectedIndex') && !that.multiple)) {
|
|
|
|
|
// $option.prop('selected') is current option state (selected/unselected). prevValue is the value of the select prior to being changed.
|
|
|
|
|
changed_arguments = [clickedIndex, $option.prop('selected'), prevValue];
|
|
|
|
|
that.$element
|
|
|
|
|
.triggerNative('change');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.$menu.on('click', 'li.' + classNames.DISABLED + ' a, .' + classNames.POPOVERHEADER + ', .' + classNames.POPOVERHEADER + ' :not(.close)', function(e) {
|
|
|
|
|
if (e.currentTarget == this) {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
if (that.options.liveSearch && !$(e.target).hasClass('close')) {
|
|
|
|
|
that.$searchbox.focus();
|
|
|
|
|
} else {
|
|
|
|
|
that.$button.focus();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.$menuInner.on('click', '.divider, .dropdown-header', function(e) {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
if (that.options.liveSearch) {
|
|
|
|
|
that.$searchbox.focus();
|
|
|
|
|
} else {
|
|
|
|
|
that.$button.focus();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.$menu.on('click', '.' + classNames.POPOVERHEADER + ' .close', function() {
|
|
|
|
|
that.$button.click();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.$searchbox.on('click', function(e) {
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.$menu.on('click', '.actions-btn', function(e) {
|
|
|
|
|
if (that.options.liveSearch) {
|
|
|
|
|
that.$searchbox.focus();
|
|
|
|
|
} else {
|
|
|
|
|
that.$button.focus();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
|
|
|
|
|
if ($(this).hasClass('bs-select-all')) {
|
|
|
|
|
that.selectAll();
|
|
|
|
|
} else {
|
|
|
|
|
that.deselectAll();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.$element.on({
|
|
|
|
|
'change': function() {
|
|
|
|
|
that.render();
|
|
|
|
|
that.$element.trigger('changed.bs.select', changed_arguments);
|
|
|
|
|
changed_arguments = null;
|
|
|
|
|
},
|
|
|
|
|
'focus': function() {
|
|
|
|
|
that.$button.focus();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
liveSearchListener: function() {
|
|
|
|
|
var that = this,
|
|
|
|
|
no_results = document.createElement('li');
|
|
|
|
|
|
|
|
|
|
this.$button.on('click.bs.dropdown.data-api', function() {
|
|
|
|
|
if (!!that.$searchbox.val()) {
|
|
|
|
|
that.$searchbox.val('');
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.$searchbox.on('click.bs.dropdown.data-api focus.bs.dropdown.data-api touchend.bs.dropdown.data-api', function(e) {
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.$searchbox.on('input propertychange', function() {
|
|
|
|
|
var searchValue = that.$searchbox.val();
|
|
|
|
|
|
|
|
|
|
that.selectpicker.search.map.newIndex = {};
|
|
|
|
|
that.selectpicker.search.map.originalIndex = {};
|
|
|
|
|
that.selectpicker.search.elements = [];
|
|
|
|
|
that.selectpicker.search.data = [];
|
|
|
|
|
|
|
|
|
|
if (searchValue) {
|
|
|
|
|
var i,
|
|
|
|
|
searchMatch = [],
|
|
|
|
|
q = searchValue.toUpperCase(),
|
|
|
|
|
cache = {},
|
|
|
|
|
cacheArr = [],
|
|
|
|
|
searchStyle = that._searchStyle(),
|
|
|
|
|
normalizeSearch = that.options.liveSearchNormalize;
|
|
|
|
|
|
|
|
|
|
that._$lisSelected = that.$menuInner.find('.selected');
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < that.selectpicker.main.data.length; i++) {
|
|
|
|
|
var li = that.selectpicker.main.data[i];
|
|
|
|
|
|
|
|
|
|
if (!cache[i]) {
|
|
|
|
|
cache[i] = stringSearch(li, q, searchStyle, normalizeSearch);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (cache[i] && li.headerIndex !== undefined && cacheArr.indexOf(li.headerIndex) === -1) {
|
|
|
|
|
if (li.headerIndex > 0) {
|
|
|
|
|
cache[li.headerIndex - 1] = true;
|
|
|
|
|
cacheArr.push(li.headerIndex - 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cache[li.headerIndex] = true;
|
|
|
|
|
cacheArr.push(li.headerIndex);
|
|
|
|
|
|
|
|
|
|
cache[li.lastIndex + 1] = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (cache[i] && li.type !== 'optgroup-label') cacheArr.push(i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (var i = 0, cacheLen = cacheArr.length; i < cacheLen; i++) {
|
|
|
|
|
var index = cacheArr[i],
|
|
|
|
|
prevIndex = cacheArr[i - 1],
|
|
|
|
|
li = that.selectpicker.main.data[index],
|
|
|
|
|
liPrev = that.selectpicker.main.data[prevIndex];
|
|
|
|
|
|
|
|
|
|
if (li.type !== 'divider' || (li.type === 'divider' && liPrev && liPrev.type !== 'divider' && cacheLen - 1 !== i)) {
|
|
|
|
|
that.selectpicker.search.data.push(li);
|
|
|
|
|
searchMatch.push(that.selectpicker.main.elements[index]);
|
|
|
|
|
that.selectpicker.search.map.newIndex[li.originalIndex] = searchMatch.length - 1;
|
|
|
|
|
that.selectpicker.search.map.originalIndex[searchMatch.length - 1] = li.originalIndex;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
that.activeIndex = undefined;
|
|
|
|
|
that.noScroll = true;
|
|
|
|
|
that.$menuInner.scrollTop(0);
|
|
|
|
|
that.selectpicker.search.elements = searchMatch;
|
|
|
|
|
that.createView(true);
|
|
|
|
|
|
|
|
|
|
if (!searchMatch.length) {
|
|
|
|
|
no_results.className = 'no-results';
|
|
|
|
|
no_results.innerHTML = that.options.noneResultsText.replace('{0}', '"' + htmlEscape(searchValue) + '"');
|
|
|
|
|
that.$menuInner[0].firstChild.appendChild(no_results);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
that.$menuInner.scrollTop(0);
|
|
|
|
|
that.createView(false);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
_searchStyle: function() {
|
|
|
|
|
return this.options.liveSearchStyle || 'contains';
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
val: function(value) {
|
|
|
|
|
if (typeof value !== 'undefined') {
|
|
|
|
|
this.$element
|
|
|
|
|
.val(value)
|
|
|
|
|
.triggerNative('change');
|
|
|
|
|
|
|
|
|
|
return this.$element;
|
|
|
|
|
} else {
|
|
|
|
|
return this.$element.val();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
changeAll: function(status) {
|
|
|
|
|
if (!this.multiple) return;
|
|
|
|
|
if (typeof status === 'undefined') status = true;
|
|
|
|
|
|
|
|
|
|
var $selectOptions = this.$element.find('option'),
|
|
|
|
|
previousSelected = 0,
|
|
|
|
|
currentSelected = 0,
|
|
|
|
|
prevValue = getSelectValues(this.$element[0]);
|
|
|
|
|
|
|
|
|
|
this.$element.addClass('bs-select-hidden');
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < this.selectpicker.current.elements.length; i++) {
|
|
|
|
|
var index = this.selectpicker.current.map.originalIndex[i], // faster than $(li).data('originalIndex')
|
|
|
|
|
option = $selectOptions[index];
|
|
|
|
|
|
|
|
|
|
if (option) {
|
|
|
|
|
if (option.selected) previousSelected++;
|
|
|
|
|
option.selected = status;
|
|
|
|
|
if (option.selected) currentSelected++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.$element.removeClass('bs-select-hidden');
|
|
|
|
|
|
|
|
|
|
if (previousSelected === currentSelected) return;
|
|
|
|
|
|
|
|
|
|
this.setOptionStatus();
|
|
|
|
|
|
|
|
|
|
this.togglePlaceholder();
|
|
|
|
|
|
|
|
|
|
changed_arguments = [null, null, prevValue];
|
|
|
|
|
|
|
|
|
|
this.$element
|
|
|
|
|
.triggerNative('change');
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
selectAll: function() {
|
|
|
|
|
return this.changeAll(true);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
deselectAll: function() {
|
|
|
|
|
return this.changeAll(false);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
toggle: function(e) {
|
|
|
|
|
e = e || window.event;
|
|
|
|
|
|
|
|
|
|
if (e) e.stopPropagation();
|
|
|
|
|
|
|
|
|
|
this.$button.trigger('click.bs.dropdown.data-api');
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
keydown: function(e) {
|
|
|
|
|
var $this = $(this),
|
|
|
|
|
$parent = $this.is('input') ? $this.parent().parent() : $this.parent(),
|
|
|
|
|
that = $parent.data('this'),
|
|
|
|
|
$items = that.findLis(),
|
|
|
|
|
index,
|
|
|
|
|
isActive,
|
|
|
|
|
liActive,
|
|
|
|
|
activeLi,
|
|
|
|
|
offset,
|
|
|
|
|
updateScroll = false,
|
|
|
|
|
downOnTab = e.which === keyCodes.TAB && !$this.hasClass('dropdown-toggle') && !that.options.selectOnTab,
|
|
|
|
|
isArrowKey = REGEXP_ARROW.test(e.which) || downOnTab,
|
|
|
|
|
scrollTop = that.$menuInner[0].scrollTop,
|
|
|
|
|
isVirtual = that.isVirtual(),
|
|
|
|
|
position0 = isVirtual === true ? that.selectpicker.view.position0 : 0;
|
|
|
|
|
|
|
|
|
|
isActive = that.$newElement.hasClass(classNames.SHOW);
|
|
|
|
|
|
|
|
|
|
if (!isActive &&
|
|
|
|
|
(
|
|
|
|
|
isArrowKey ||
|
|
|
|
|
e.which >= 48 && e.which <= 57 ||
|
|
|
|
|
e.which >= 96 && e.which <= 105 ||
|
|
|
|
|
e.which >= 65 && e.which <= 90
|
|
|
|
|
)
|
|
|
|
|
) {
|
|
|
|
|
that.$button.trigger('click.bs.dropdown.data-api');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (e.which === keyCodes.ESCAPE && isActive) {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
that.$button.trigger('click.bs.dropdown.data-api').focus();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isArrowKey) { // if up or down
|
|
|
|
|
if (!$items.length) return;
|
|
|
|
|
|
|
|
|
|
// $items.index/.filter is too slow with a large list and no virtual scroll
|
|
|
|
|
index = isVirtual === true ? $items.index($items.filter('.active')) : that.selectpicker.current.map.newIndex[that.activeIndex];
|
|
|
|
|
|
|
|
|
|
if (index === undefined) index = -1;
|
|
|
|
|
|
|
|
|
|
if (index !== -1) {
|
|
|
|
|
liActive = that.selectpicker.current.elements[index + position0];
|
|
|
|
|
liActive.classList.remove('active');
|
|
|
|
|
if (liActive.firstChild) liActive.firstChild.classList.remove('active');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (e.which === keyCodes.ARROW_UP) { // up
|
|
|
|
|
if (index !== -1) index--;
|
|
|
|
|
if (index + position0 < 0) index += $items.length;
|
|
|
|
|
|
|
|
|
|
if (!that.selectpicker.view.canHighlight[index + position0]) {
|
|
|
|
|
index = that.selectpicker.view.canHighlight.slice(0, index + position0).lastIndexOf(true) - position0;
|
|
|
|
|
if (index === -1) index = $items.length - 1;
|
|
|
|
|
}
|
|
|
|
|
} else if (e.which === keyCodes.ARROW_DOWN || downOnTab) { // down
|
|
|
|
|
index++;
|
|
|
|
|
if (index + position0 >= that.selectpicker.view.canHighlight.length) index = 0;
|
|
|
|
|
|
|
|
|
|
if (!that.selectpicker.view.canHighlight[index + position0]) {
|
|
|
|
|
index = index + 1 + that.selectpicker.view.canHighlight.slice(index + position0 + 1).indexOf(true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
|
|
var liActiveIndex = position0 + index;
|
|
|
|
|
|
|
|
|
|
if (e.which === keyCodes.ARROW_UP) { // up
|
|
|
|
|
// scroll to bottom and highlight last option
|
|
|
|
|
if (position0 === 0 && index === $items.length - 1) {
|
|
|
|
|
that.$menuInner[0].scrollTop = that.$menuInner[0].scrollHeight;
|
|
|
|
|
|
|
|
|
|
liActiveIndex = that.selectpicker.current.elements.length - 1;
|
|
|
|
|
} else {
|
|
|
|
|
activeLi = that.selectpicker.current.data[liActiveIndex];
|
|
|
|
|
offset = activeLi.position - activeLi.height;
|
|
|
|
|
|
|
|
|
|
updateScroll = offset < scrollTop;
|
|
|
|
|
}
|
|
|
|
|
} else if (e.which === keyCodes.ARROW_DOWN || downOnTab) { // down
|
|
|
|
|
// scroll to top and highlight first option
|
|
|
|
|
if (position0 !== 0 && index === 0) {
|
|
|
|
|
that.$menuInner[0].scrollTop = 0;
|
|
|
|
|
|
|
|
|
|
liActiveIndex = 0;
|
|
|
|
|
} else {
|
|
|
|
|
activeLi = that.selectpicker.current.data[liActiveIndex];
|
|
|
|
|
offset = activeLi.position - that.sizeInfo.menuInnerHeight;
|
|
|
|
|
|
|
|
|
|
updateScroll = offset > scrollTop;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
liActive = that.selectpicker.current.elements[liActiveIndex];
|
|
|
|
|
liActive.classList.add('active');
|
|
|
|
|
if (liActive.firstChild) liActive.firstChild.classList.add('active');
|
|
|
|
|
that.activeIndex = that.selectpicker.current.map.originalIndex[liActiveIndex];
|
|
|
|
|
|
|
|
|
|
that.selectpicker.view.currentActive = liActive;
|
|
|
|
|
|
|
|
|
|
if (updateScroll) that.$menuInner[0].scrollTop = offset;
|
|
|
|
|
|
|
|
|
|
if (that.options.liveSearch) {
|
|
|
|
|
that.$searchbox.focus();
|
|
|
|
|
} else {
|
|
|
|
|
$this.focus();
|
|
|
|
|
}
|
|
|
|
|
} else if (!$this.is('input') &&
|
|
|
|
|
!REGEXP_TAB_OR_ESCAPE.test(e.which) ||
|
|
|
|
|
(e.which === keyCodes.SPACE && that.selectpicker.keydown.keyHistory)
|
|
|
|
|
) {
|
|
|
|
|
var searchMatch,
|
|
|
|
|
matches = [],
|
|
|
|
|
keyHistory;
|
|
|
|
|
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
|
|
that.selectpicker.keydown.keyHistory += keyCodeMap[e.which];
|
|
|
|
|
|
|
|
|
|
if (that.selectpicker.keydown.resetKeyHistory.cancel) clearTimeout(that.selectpicker.keydown.resetKeyHistory.cancel);
|
|
|
|
|
that.selectpicker.keydown.resetKeyHistory.cancel = that.selectpicker.keydown.resetKeyHistory.start();
|
|
|
|
|
|
|
|
|
|
keyHistory = that.selectpicker.keydown.keyHistory;
|
|
|
|
|
|
|
|
|
|
// if all letters are the same, set keyHistory to just the first character when searching
|
|
|
|
|
if (/^(.)\1+$/.test(keyHistory)) {
|
|
|
|
|
keyHistory = keyHistory.charAt(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// find matches
|
|
|
|
|
for (var i = 0; i < that.selectpicker.current.data.length; i++) {
|
|
|
|
|
var li = that.selectpicker.current.data[i],
|
|
|
|
|
hasMatch;
|
|
|
|
|
|
|
|
|
|
hasMatch = stringSearch(li, keyHistory, 'startsWith', true);
|
|
|
|
|
|
|
|
|
|
if (hasMatch && that.selectpicker.view.canHighlight[i]) {
|
|
|
|
|
li.index = i;
|
|
|
|
|
matches.push(li.originalIndex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (matches.length) {
|
|
|
|
|
var matchIndex = 0;
|
|
|
|
|
|
|
|
|
|
$items.removeClass('active').find('a').removeClass('active');
|
|
|
|
|
|
|
|
|
|
// either only one key has been pressed or they are all the same key
|
|
|
|
|
if (keyHistory.length === 1) {
|
|
|
|
|
matchIndex = matches.indexOf(that.activeIndex);
|
|
|
|
|
|
|
|
|
|
if (matchIndex === -1 || matchIndex === matches.length - 1) {
|
|
|
|
|
matchIndex = 0;
|
|
|
|
|
} else {
|
|
|
|
|
matchIndex++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
searchMatch = that.selectpicker.current.map.newIndex[matches[matchIndex]];
|
|
|
|
|
|
|
|
|
|
activeLi = that.selectpicker.current.data[searchMatch];
|
|
|
|
|
|
|
|
|
|
if (scrollTop - activeLi.position > 0) {
|
|
|
|
|
offset = activeLi.position - activeLi.height;
|
|
|
|
|
updateScroll = true;
|
|
|
|
|
} else {
|
|
|
|
|
offset = activeLi.position - that.sizeInfo.menuInnerHeight;
|
|
|
|
|
// if the option is already visible at the current scroll position, just keep it the same
|
|
|
|
|
updateScroll = activeLi.position > scrollTop + that.sizeInfo.menuInnerHeight;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
liActive = that.selectpicker.current.elements[searchMatch];
|
|
|
|
|
liActive.classList.add('active');
|
|
|
|
|
if (liActive.firstChild) liActive.firstChild.classList.add('active');
|
|
|
|
|
that.activeIndex = matches[matchIndex];
|
|
|
|
|
|
|
|
|
|
liActive.firstChild.focus();
|
|
|
|
|
|
|
|
|
|
if (updateScroll) that.$menuInner[0].scrollTop = offset;
|
|
|
|
|
|
|
|
|
|
$this.focus();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Select focused option if "Enter", "Spacebar" or "Tab" (when selectOnTab is true) are pressed inside the menu.
|
|
|
|
|
if (
|
|
|
|
|
isActive &&
|
|
|
|
|
(
|
|
|
|
|
(e.which === keyCodes.SPACE && !that.selectpicker.keydown.keyHistory) ||
|
|
|
|
|
e.which === keyCodes.ENTER ||
|
|
|
|
|
(e.which === keyCodes.TAB && that.options.selectOnTab)
|
|
|
|
|
)
|
|
|
|
|
) {
|
|
|
|
|
if (e.which !== keyCodes.SPACE) e.preventDefault();
|
|
|
|
|
|
|
|
|
|
if (!that.options.liveSearch || e.which !== keyCodes.SPACE) {
|
|
|
|
|
that.$menuInner.find('.active a').trigger('click', true); // retain active class
|
|
|
|
|
$this.focus();
|
|
|
|
|
|
|
|
|
|
if (!that.options.liveSearch) {
|
|
|
|
|
// Prevent screen from scrolling if the user hits the spacebar
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
// Fixes spacebar selection of dropdown items in FF & IE
|
|
|
|
|
$(document).data('spaceSelect', true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
mobile: function() {
|
|
|
|
|
this.$element.addClass('mobile-device');
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
refresh: function() {
|
|
|
|
|
// update options if data attributes have been changed
|
|
|
|
|
var config = $.extend({}, this.options, this.$element.data());
|
|
|
|
|
this.options = config;
|
|
|
|
|
|
|
|
|
|
this.selectpicker.main.map.newIndex = {};
|
|
|
|
|
this.selectpicker.main.map.originalIndex = {};
|
|
|
|
|
this.createLi();
|
|
|
|
|
this.checkDisabled();
|
|
|
|
|
this.render();
|
|
|
|
|
this.setStyle();
|
|
|
|
|
this.setWidth();
|
|
|
|
|
|
|
|
|
|
this.setSize(true);
|
|
|
|
|
|
|
|
|
|
this.$element.trigger('refreshed.bs.select');
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
hide: function() {
|
|
|
|
|
this.$newElement.hide();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
show: function() {
|
|
|
|
|
this.$newElement.show();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
remove: function() {
|
|
|
|
|
this.$newElement.remove();
|
|
|
|
|
this.$element.remove();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
destroy: function() {
|
|
|
|
|
this.$newElement.before(this.$element).remove();
|
|
|
|
|
|
|
|
|
|
if (this.$bsContainer) {
|
|
|
|
|
this.$bsContainer.remove();
|
|
|
|
|
} else {
|
|
|
|
|
this.$menu.remove();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.$element
|
|
|
|
|
.off('.bs.select')
|
|
|
|
|
.removeData('selectpicker')
|
|
|
|
|
.removeClass('bs-select-hidden selectpicker');
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// SELECTPICKER PLUGIN DEFINITION
|
|
|
|
|
// ==============================
|
|
|
|
|
function Plugin(option) {
|
|
|
|
|
// get the args of the outer function..
|
|
|
|
|
var args = arguments;
|
|
|
|
|
// The arguments of the function are explicitly re-defined from the argument list, because the shift causes them
|
|
|
|
|
// to get lost/corrupted in android 2.3 and IE9 #715 #775
|
|
|
|
|
var _option = option;
|
|
|
|
|
|
|
|
|
|
[].shift.apply(args);
|
|
|
|
|
|
|
|
|
|
var value;
|
|
|
|
|
var chain = this.each(function() {
|
|
|
|
|
var $this = $(this);
|
|
|
|
|
if ($this.is('select')) {
|
|
|
|
|
var data = $this.data('selectpicker'),
|
|
|
|
|
options = typeof _option == 'object' && _option;
|
|
|
|
|
|
|
|
|
|
if (!data) {
|
|
|
|
|
var config = $.extend({}, Selectpicker.DEFAULTS, $.fn.selectpicker.defaults || {}, $this.data(), options);
|
|
|
|
|
config.template = $.extend({}, Selectpicker.DEFAULTS.template, ($.fn.selectpicker.defaults ? $.fn.selectpicker.defaults.template : {}), $this.data().template, options.template);
|
|
|
|
|
$this.data('selectpicker', (data = new Selectpicker(this, config)));
|
|
|
|
|
} else if (options) {
|
|
|
|
|
for (var i in options) {
|
|
|
|
|
if (options.hasOwnProperty(i)) {
|
|
|
|
|
data.options[i] = options[i];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (typeof _option == 'string') {
|
|
|
|
|
if (data[_option] instanceof Function) {
|
|
|
|
|
value = data[_option].apply(data, args);
|
|
|
|
|
} else {
|
|
|
|
|
value = data.options[_option];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (typeof value !== 'undefined') {
|
|
|
|
|
//noinspection JSUnusedAssignment
|
|
|
|
|
return value;
|
|
|
|
|
} else {
|
|
|
|
|
return chain;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var old = $.fn.selectpicker;
|
|
|
|
|
$.fn.selectpicker = Plugin;
|
|
|
|
|
$.fn.selectpicker.Constructor = Selectpicker;
|
|
|
|
|
|
|
|
|
|
// SELECTPICKER NO CONFLICT
|
|
|
|
|
// ========================
|
|
|
|
|
$.fn.selectpicker.noConflict = function() {
|
|
|
|
|
$.fn.selectpicker = old;
|
|
|
|
|
return this;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$(document)
|
|
|
|
|
.off('keydown.bs.dropdown.data-api')
|
|
|
|
|
.on('keydown.bs.select', '.bootstrap-select [data-toggle="dropdown"], .bootstrap-select [role="listbox"], .bs-searchbox input', Selectpicker.prototype.keydown)
|
|
|
|
|
.on('focusin.modal', '.bootstrap-select [data-toggle="dropdown"], .bootstrap-select [role="listbox"], .bs-searchbox input', function(e) {
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// SELECTPICKER DATA-API
|
|
|
|
|
// =====================
|
|
|
|
|
$(window).on('load.bs.select.data-api', function() {
|
|
|
|
|
$('.selectpicker').each(function() {
|
|
|
|
|
var $selectpicker = $(this);
|
|
|
|
|
Plugin.call($selectpicker, $selectpicker.data());
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
})(jQuery);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
/*! version : 4.17.47
|
|
|
|
|
=========================================================
|
|
|
|
|
bootstrap-datetimejs
|
|
|
|
|
https://github.com/Eonasdan/bootstrap-datetimepicker
|
|
|
|
|
Copyright (c) 2015 Jonathan Peterson
|
|
|
|
|
=========================================================
|
|
|
|
|
*/
|
|
|
|
|
/*
|
|
|
|
|
The MIT License (MIT)
|
|
|
|
|
|
|
|
|
|
Copyright (c) 2015 Jonathan Peterson
|
|
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
|
THE SOFTWARE.
|
|
|
|
|
*/
|
|
|
|
|
/*global define:false */
|
|
|
|
|
/*global exports:false */
|
|
|
|
|
/*global require:false */
|
|
|
|
|
/*global jQuery:false */
|
|
|
|
|
/*global moment:false */
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Creative Tim Modifications
|
|
|
|
|
|
|
|
|
|
We added class btn-primary for custom styling button.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
!function(e){"use strict";if("function"==typeof define&&define.amd)define(["jquery","moment"],e);else if("object"==typeof exports)module.exports=e(require("jquery"),require("moment"));else{if("undefined"==typeof jQuery)throw"bootstrap-datetimepicker requires jQuery to be loaded first";if("undefined"==typeof moment)throw"bootstrap-datetimepicker requires Moment.js to be loaded first";e(jQuery,moment)}}(function(e,t){"use strict";if(!t)throw new Error("bootstrap-datetimepicker requires Moment.js to be loaded first");var n=function(n,a){var r,i,o,s,d,l,p,c={},u=!0,f=!1,h=!1,m=0,y=[{clsName:"days",navFnc:"M",navStep:1},{clsName:"months",navFnc:"y",navStep:1},{clsName:"years",navFnc:"y",navStep:10},{clsName:"decades",navFnc:"y",navStep:100}],b=["days","months","years","decades"],g=["top","bottom","auto"],w=["left","right","auto"],v=["default","top","bottom"],k={up:38,38:"up",down:40,40:"down",left:37,37:"left",right:39,39:"right",tab:9,9:"tab",escape:27,27:"escape",enter:13,13:"enter",pageUp:33,33:"pageUp",pageDown:34,34:"pageDown",shift:16,16:"shift",control:17,17:"control",space:32,32:"space",t:84,84:"t",delete:46,46:"delete"},D={},C=function(){return void 0!==t.tz&&void 0!==a.timeZone&&null!==a.timeZone&&""!==a.timeZone},x=function(e){var n;return n=void 0===e||null===e?t():t.isDate(e)||t.isMoment(e)?t(e):C()?t.tz(e,l,a.useStrict,a.timeZone):t(e,l,a.useStrict),C()&&n.tz(a.timeZone),n},T=function(e){if("string"!=typeof e||e.length>1)throw new TypeError("isEnabled expects a single character string parameter");switch(e){case"y":return-1!==d.indexOf("Y");case"M":return-1!==d.indexOf("M");case"d":return-1!==d.toLowerCase().indexOf("d");case"h":case"H":return-1!==d.toLowerCase().indexOf("h");case"m":return-1!==d.indexOf("m");case"s":return-1!==d.indexOf("s");default:return!1}},M=function(){return T("h")||T("m")||T("s")},S=function(){return T("y")||T("M")||T("d")},O=function(){var t=e("<thead>").append(e("<tr>").append(e("<th>").addClass("prev").attr("data-action","previous").append(e("<span>").addClass(a.icons.previous))).append(e("<th>").addClass("picker-switch").attr("data-action","pickerSwitch").attr("colspan",a.calendarWeeks?"6":"5")).append(e("<th>").addClass("next").attr("data-action","next").append(e("<span>").addClass(a.icons.next)))),n=e("<tbody>").append(e("<tr>").append(e("<td>").attr("colspan",a.calendarWeeks?"8":"7")));return[e("<div>").addClass("datepicker-days").append(e("<table>").addClass("table-condensed").append(t).append(e("<tbody>"))),e("<div>").addClass("datepicker-months").append(e("<table>").addClass("table-condensed").append(t.clone()).append(n.clone())),e("<div>").addClass("datepicker-years").append(e("<table>").addClass("table-condensed").append(t.clone()).append(n.clone())),e("<div>").addClass("datepicker-decades").append(e("<table>").addClass("table-condensed").append(t.clone()).append(n.clone()))]},P=function(){var t=e("<tr>"),n=e("<tr>"),r=e("<tr>");return T("h")&&(t.append(e("<td>").append(e("<a>").attr({href:"#",tabindex:"-1",title:a.tooltips.incrementHour}).addClass("btn").attr("data-action","incrementHours").append(e("<span>").addClass(a.icons.up)))),n.append(e("<td>").append(e("<span>").addClass("timepicker-hour").attr({"data-time-component":"hours",title:a.tooltips.pickHour}).attr("data-action","showHours"))),r.append(e("<td>").append(e("<a>").attr({href:"#",tabindex:"-1",title:a.tooltips.decrementHour}).addClass("btn").attr("data-action","decrementHours").append(e("<span>").addClass(a.icons.down))))),T("m")&&(T("h")&&(t.append(e("<td>").addClass("separator")),n.append(e("<td>").addClass("separator").html(":")),r.append(e("<td>").addClass("separator"))),t.append(e("<td>").append(e("<a>").attr({href:"#",tabindex:"-1",title:a.tooltips.incrementMinute}).addClass("btn").attr("data-action","incrementMinutes").append(e("<span>").addClass(a.icons.up)))),n.append(e("<td>").append(e("<span>").addClass("timepicker-minute").attr({"data-time-component":"minutes",title:a.tooltips.pickMinute}).attr("data-action","showMinutes"))),r.append(e("<td>").append(e("<a>").attr({href:"#",tabindex:"-1",title:a.toolt
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* This combined file was created by the DataTables downloader builder:
|
|
|
|
|
* https://datatables.net/download
|
|
|
|
|
*
|
|
|
|
|
* To rebuild or modify this file with the latest versions of the included
|
|
|
|
|
* software please visit:
|
|
|
|
|
* https://datatables.net/download/#bs4/dt-1.10.20/r-2.2.3
|
|
|
|
|
*
|
|
|
|
|
* Included libraries:
|
|
|
|
|
* DataTables 1.10.20, Responsive 2.2.3
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
Copyright 2008-2019 SpryMedia Ltd.
|
|
|
|
|
|
|
|
|
|
This source file is free software, available under the following license:
|
|
|
|
|
MIT license - http://datatables.net/license
|
|
|
|
|
|
|
|
|
|
This source file is distributed in the hope that it will be useful, but
|
|
|
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
|
or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
|
|
|
|
|
|
|
|
|
|
For details please refer to: http://www.datatables.net
|
|
|
|
|
DataTables 1.10.20
|
|
|
|
|
©2008-2019 SpryMedia Ltd - datatables.net/license
|
|
|
|
|
*/
|
|
|
|
|
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(f,z,y){f instanceof String&&(f=String(f));for(var p=f.length,H=0;H<p;H++){var L=f[H];if(z.call(y,L,H,f))return{i:H,v:L}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;
|
|
|
|
|
$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(f,z,y){f!=Array.prototype&&f!=Object.prototype&&(f[z]=y.value)};$jscomp.getGlobal=function(f){return"undefined"!=typeof window&&window===f?f:"undefined"!=typeof global&&null!=global?global:f};$jscomp.global=$jscomp.getGlobal(this);
|
|
|
|
|
$jscomp.polyfill=function(f,z,y,p){if(z){y=$jscomp.global;f=f.split(".");for(p=0;p<f.length-1;p++){var H=f[p];H in y||(y[H]={});y=y[H]}f=f[f.length-1];p=y[f];z=z(p);z!=p&&null!=z&&$jscomp.defineProperty(y,f,{configurable:!0,writable:!0,value:z})}};$jscomp.polyfill("Array.prototype.find",function(f){return f?f:function(f,y){return $jscomp.findInternal(this,f,y).v}},"es6","es3");
|
|
|
|
|
(function(f){"function"===typeof define&&define.amd?define(["jquery"],function(z){return f(z,window,document)}):"object"===typeof exports?module.exports=function(z,y){z||(z=window);y||(y="undefined"!==typeof window?require("jquery"):require("jquery")(z));return f(y,z,z.document)}:f(jQuery,window,document)})(function(f,z,y,p){function H(a){var b,c,d={};f.each(a,function(e,h){(b=e.match(/^([^A-Z]+?)([A-Z])/))&&-1!=="a aa ai ao as b fn i m o s ".indexOf(b[1]+" ")&&(c=e.replace(b[0],b[2].toLowerCase()),
|
|
|
|
|
d[c]=e,"o"===b[1]&&H(a[e]))});a._hungarianMap=d}function L(a,b,c){a._hungarianMap||H(a);var d;f.each(b,function(e,h){d=a._hungarianMap[e];d===p||!c&&b[d]!==p||("o"===d.charAt(0)?(b[d]||(b[d]={}),f.extend(!0,b[d],b[e]),L(a[d],b[d],c)):b[d]=b[e])})}function Ga(a){var b=q.defaults.oLanguage,c=b.sDecimal;c&&Ha(c);if(a){var d=a.sZeroRecords;!a.sEmptyTable&&d&&"No data available in table"===b.sEmptyTable&&M(a,a,"sZeroRecords","sEmptyTable");!a.sLoadingRecords&&d&&"Loading..."===b.sLoadingRecords&&M(a,a,
|
|
|
|
|
"sZeroRecords","sLoadingRecords");a.sInfoThousands&&(a.sThousands=a.sInfoThousands);(a=a.sDecimal)&&c!==a&&Ha(a)}}function jb(a){F(a,"ordering","bSort");F(a,"orderMulti","bSortMulti");F(a,"orderClasses","bSortClasses");F(a,"orderCellsTop","bSortCellsTop");F(a,"order","aaSorting");F(a,"orderFixed","aaSortingFixed");F(a,"paging","bPaginate");F(a,"pagingType","sPaginationType");F(a,"pageLength","iDisplayLength");F(a,"searching","bFilter");"boolean"===typeof a.sScrollX&&(a.sScrollX=a.sScrollX?"100%":
|
|
|
|
|
"");"boolean"===typeof a.scrollX&&(a.scrollX=a.scrollX?"100%":"");if(a=a.aoSearchCols)for(var b=0,c=a.length;b<c;b++)a[b]&&L(q.models.oSearch,a[b])}function kb(a){F(a,"orderable","bSortable");F(a,"orderData","aDataSort");F(a,"orderSequence","asSorting");F(a,"orderDataType","sortDataType");var b=a.aDataSort;"number"!==typeof b||f.isArray(b)||(a.aDataSort=[b])}function lb(a){if(!q.__browser){var b={};q.__browser=b;var c=f("<div/>").css({position:"fixed",top:0,left:-1*f(z).scrollLeft(),height:1,width:1,
|
|
|
|
|
overflow:"hidden"}).append(f("<div/>").css({position:"absolute",top:1,left:1,width:100,overflow:"scroll"}).append(f("<div/>").css({width:"100%",height:10}))).appendTo("body"),d=c.children(),e=d.children();b.barWidth=d[0].offsetWidth-d[0].clientWidth;b.bScrollOversize=100===e[0].offsetWidth&&100!==d[0].clientWidth;b.bScrollbarLeft=1!==Math.round(e.offset().left);b.bBounding=c[0].getBoundingClientRect().width?!0:!1;c.remove()}f.extend(a.oBrowser,q.__browser);a.oScroll.iBarWidth=q.__browser.barWidth}
|
|
|
|
|
function mb(a,b,c,d,e,h){var g=!1;if(c!==p){var k=c;g=!0}for(;d!==e;)a.hasOwnProperty(d)&&(k=g?b(k,a[d],d,a):a[d],g=!0,d+=h);return k}function Ia(a,b){var c=q.defaults.column,d=a.aoColumns.length;c=f.extend({},q.models.oColumn,c,{nTh:b?b:y.createElement("th"),sTitle:c.sTitle?c.sTitle:b?b.innerHTML:"",aDataSort:c.aDataSort?c.aDataSort:[d],mData:c.mData?c.mData:d,idx:d});a.aoColumns.push(c);c=a.aoPreSearchCols;c[d]=f.extend({},q.models.oSearch,c[d]);ma(a,d,f(b).data())}function ma(a,b,c){b=a.aoColumns[b];
|
|
|
|
|
var d=a.oClasses,e=f(b.nTh);if(!b.sWidthOrig){b.sWidthOrig=e.attr("width")||null;var h=(e.attr("style")||"").match(/width:\s*(\d+[pxem%]+)/);h&&(b.sWidthOrig=h[1])}c!==p&&null!==c&&(kb(c),L(q.defaults.column,c,!0),c.mDataProp===p||c.mData||(c.mData=c.mDataProp),c.sType&&(b._sManualType=c.sType),c.className&&!c.sClass&&(c.sClass=c.className),c.sClass&&e.addClass(c.sClass),f.extend(b,c),M(b,c,"sWidth","sWidthOrig"),c.iDataSort!==p&&(b.aDataSort=[c.iDataSort]),M(b,c,"aDataSort"));var g=b.mData,k=U(g),
|
|
|
|
|
l=b.mRender?U(b.mRender):null;c=function(a){return"string"===typeof a&&-1!==a.indexOf("@")};b._bAttrSrc=f.isPlainObject(g)&&(c(g.sort)||c(g.type)||c(g.filter));b._setter=null;b.fnGetData=function(a,b,c){var d=k(a,b,p,c);return l&&b?l(d,b,a,c):d};b.fnSetData=function(a,b,c){return Q(g)(a,b,c)};"number"!==typeof g&&(a._rowReadObject=!0);a.oFeatures.bSort||(b.bSortable=!1,e.addClass(d.sSortableNone));a=-1!==f.inArray("asc",b.asSorting);c=-1!==f.inArray("desc",b.asSorting);b.bSortable&&(a||c)?a&&!c?(b.sSortingClass=
|
|
|
|
|
d.sSortableAsc,b.sSortingClassJUI=d.sSortJUIAscAllowed):!a&&c?(b.sSortingClass=d.sSortableDesc,b.sSortingClassJUI=d.sSortJUIDescAllowed):(b.sSortingClass=d.sSortable,b.sSortingClassJUI=d.sSortJUI):(b.sSortingClass=d.sSortableNone,b.sSortingClassJUI="")}function aa(a){if(!1!==a.oFeatures.bAutoWidth){var b=a.aoColumns;Ja(a);for(var c=0,d=b.length;c<d;c++)b[c].nTh.style.width=b[c].sWidth}b=a.oScroll;""===b.sY&&""===b.sX||na(a);A(a,null,"column-sizing",[a])}function ba(a,b){a=oa(a,"bVisible");return"number"===
|
|
|
|
|
typeof a[b]?a[b]:null}function ca(a,b){a=oa(a,"bVisible");b=f.inArray(b,a);return-1!==b?b:null}function W(a){var b=0;f.each(a.aoColumns,function(a,d){d.bVisible&&"none"!==f(d.nTh).css("display")&&b++});return b}function oa(a,b){var c=[];f.map(a.aoColumns,function(a,e){a[b]&&c.push(e)});return c}function Ka(a){var b=a.aoColumns,c=a.aoData,d=q.ext.type.detect,e,h,g;var k=0;for(e=b.length;k<e;k++){var f=b[k];var n=[];if(!f.sType&&f._sManualType)f.sType=f._sManualType;else if(!f.sType){var m=0;for(h=
|
|
|
|
|
d.length;m<h;m++){var w=0;for(g=c.length;w<g;w++){n[w]===p&&(n[w]=I(a,w,k,"type"));var u=d[m](n[w],a);if(!u&&m!==d.length-1)break;if("html"===u)break}if(u){f.sType=u;break}}f.sType||(f.sType="string")}}}function nb(a,b,c,d){var e,h,g,k=a.aoColumns;if(b)for(e=b.length-1;0<=e;e--){var l=b[e];var n=l.targets!==p?l.targets:l.aTargets;f.isArray(n)||(n=[n]);var m=0;for(h=n.length;m<h;m++)if("number"===typeof n[m]&&0<=n[m]){for(;k.length<=n[m];)Ia(a);d(n[m],l)}else if("number"===typeof n[m]&&0>n[m])d(k.length+
|
|
|
|
|
n[m],l);else if("string"===typeof n[m]){var w=0;for(g=k.length;w<g;w++)("_all"==n[m]||f(k[w].nTh).hasClass(n[m]))&&d(w,l)}}if(c)for(e=0,a=c.length;e<a;e++)d(e,c[e])}function R(a,b,c,d){var e=a.aoData.length,h=f.extend(!0,{},q.models.oRow,{src:c?"dom":"data",idx:e});h._aData=b;a.aoData.push(h);for(var g=a.aoColumns,k=0,l=g.length;k<l;k++)g[k].sType=null;a.aiDisplayMaster.push(e);b=a.rowIdFn(b);b!==p&&(a.aIds[b]=h);!c&&a.oFeatures.bDeferRender||La(a,e,c,d);return e}function pa(a,b){var c;b instanceof
|
|
|
|
|
f||(b=f(b));return b.map(function(b,e){c=Ma(a,e);return R(a,c.data,e,c.cells)})}function I(a,b,c,d){var e=a.iDraw,h=a.aoColumns[c],g=a.aoData[b]._aData,k=h.sDefaultContent,f=h.fnGetData(g,d,{settings:a,row:b,col:c});if(f===p)return a.iDrawError!=e&&null===k&&(O(a,0,"Requested unknown parameter "+("function"==typeof h.mData?"{function}":"'"+h.mData+"'")+" for row "+b+", column "+c,4),a.iDrawError=e),k;if((f===g||null===f)&&null!==k&&d!==p)f=k;else if("function"===typeof f)return f.call(g);return null===
|
|
|
|
|
f&&"display"==d?"":f}function ob(a,b,c,d){a.aoColumns[c].fnSetData(a.aoData[b]._aData,d,{settings:a,row:b,col:c})}function Na(a){return f.map(a.match(/(\\.|[^\.])+/g)||[""],function(a){return a.replace(/\\\./g,".")})}function U(a){if(f.isPlainObject(a)){var b={};f.each(a,function(a,c){c&&(b[a]=U(c))});return function(a,c,h,g){var d=b[c]||b._;return d!==p?d(a,c,h,g):a}}if(null===a)return function(a){return a};if("function"===typeof a)return function(b,c,h,g){return a(b,c,h,g)};if("string"!==typeof a||
|
|
|
|
|
-1===a.indexOf(".")&&-1===a.indexOf("[")&&-1===a.indexOf("("))return function(b,c){return b[a]};var c=function(a,b,h){if(""!==h){var d=Na(h);for(var e=0,l=d.length;e<l;e++){h=d[e].match(da);var n=d[e].match(X);if(h){d[e]=d[e].replace(da,"");""!==d[e]&&(a=a[d[e]]);n=[];d.splice(0,e+1);d=d.join(".");if(f.isArray(a))for(e=0,l=a.length;e<l;e++)n.push(c(a[e],b,d));a=h[0].substring(1,h[0].length-1);a=""===a?n:n.join(a);break}else if(n){d[e]=d[e].replace(X,"");a=a[d[e]]();continue}if(null===a||a[d[e]]===
|
|
|
|
|
p)return p;a=a[d[e]]}}return a};return function(b,e){return c(b,e,a)}}function Q(a){if(f.isPlainObject(a))return Q(a._);if(null===a)return function(){};if("function"===typeof a)return function(b,d,e){a(b,"set",d,e)};if("string"!==typeof a||-1===a.indexOf(".")&&-1===a.indexOf("[")&&-1===a.indexOf("("))return function(b,d){b[a]=d};var b=function(a,d,e){e=Na(e);var c=e[e.length-1];for(var g,k,l=0,n=e.length-1;l<n;l++){g=e[l].match(da);k=e[l].match(X);if(g){e[l]=e[l].replace(da,"");a[e[l]]=[];c=e.slice();
|
|
|
|
|
c.splice(0,l+1);g=c.join(".");if(f.isArray(d))for(k=0,n=d.length;k<n;k++)c={},b(c,d[k],g),a[e[l]].push(c);else a[e[l]]=d;return}k&&(e[l]=e[l].replace(X,""),a=a[e[l]](d));if(null===a[e[l]]||a[e[l]]===p)a[e[l]]={};a=a[e[l]]}if(c.match(X))a[c.replace(X,"")](d);else a[c.replace(da,"")]=d};return function(c,d){return b(c,d,a)}}function Oa(a){return J(a.aoData,"_aData")}function qa(a){a.aoData.length=0;a.aiDisplayMaster.length=0;a.aiDisplay.length=0;a.aIds={}}function ra(a,b,c){for(var d=-1,e=0,h=a.length;e<
|
|
|
|
|
h;e++)a[e]==b?d=e:a[e]>b&&a[e]--; -1!=d&&c===p&&a.splice(d,1)}function ea(a,b,c,d){var e=a.aoData[b],h,g=function(c,d){for(;c.childNodes.length;)c.removeChild(c.firstChild);c.innerHTML=I(a,b,d,"display")};if("dom"!==c&&(c&&"auto"!==c||"dom"!==e.src)){var k=e.anCells;if(k)if(d!==p)g(k[d],d);else for(c=0,h=k.length;c<h;c++)g(k[c],c)}else e._aData=Ma(a,e,d,d===p?p:e._aData).data;e._aSortData=null;e._aFilterData=null;g=a.aoColumns;if(d!==p)g[d].sType=null;else{c=0;for(h=g.length;c<h;c++)g[c].sType=null;
|
|
|
|
|
Pa(a,e)}}function Ma(a,b,c,d){var e=[],h=b.firstChild,g,k=0,l,n=a.aoColumns,m=a._rowReadObject;d=d!==p?d:m?{}:[];var w=function(a,b){if("string"===typeof a){var c=a.indexOf("@");-1!==c&&(c=a.substring(c+1),Q(a)(d,b.getAttribute(c)))}},u=function(a){if(c===p||c===k)g=n[k],l=f.trim(a.innerHTML),g&&g._bAttrSrc?(Q(g.mData._)(d,l),w(g.mData.sort,a),w(g.mData.type,a),w(g.mData.filter,a)):m?(g._setter||(g._setter=Q(g.mData)),g._setter(d,l)):d[k]=l;k++};if(h)for(;h;){var q=h.nodeName.toUpperCase();if("TD"==
|
|
|
|
|
q||"TH"==q)u(h),e.push(h);h=h.nextSibling}else for(e=b.anCells,h=0,q=e.length;h<q;h++)u(e[h]);(b=b.firstChild?b:b.nTr)&&(b=b.getAttribute("id"))&&Q(a.rowId)(d,b);return{data:d,cells:e}}function La(a,b,c,d){var e=a.aoData[b],h=e._aData,g=[],k,l;if(null===e.nTr){var n=c||y.createElement("tr");e.nTr=n;e.anCells=g;n._DT_RowIndex=b;Pa(a,e);var m=0;for(k=a.aoColumns.length;m<k;m++){var w=a.aoColumns[m];var p=(l=c?!1:!0)?y.createElement(w.sCellType):d[m];p._DT_CellIndex={row:b,column:m};g.push(p);if(l||
|
|
|
|
|
!(c&&!w.mRender&&w.mData===m||f.isPlainObject(w.mData)&&w.mData._===m+".display"))p.innerHTML=I(a,b,m,"display");w.sClass&&(p.className+=" "+w.sClass);w.bVisible&&!c?n.appendChild(p):!w.bVisible&&c&&p.parentNode.removeChild(p);w.fnCreatedCell&&w.fnCreatedCell.call(a.oInstance,p,I(a,b,m),h,b,m)}A(a,"aoRowCreatedCallback",null,[n,h,b,g])}e.nTr.setAttribute("role","row")}function Pa(a,b){var c=b.nTr,d=b._aData;if(c){if(a=a.rowIdFn(d))c.id=a;d.DT_RowClass&&(a=d.DT_RowClass.split(" "),b.__rowc=b.__rowc?
|
|
|
|
|
ta(b.__rowc.concat(a)):a,f(c).removeClass(b.__rowc.join(" ")).addClass(d.DT_RowClass));d.DT_RowAttr&&f(c).attr(d.DT_RowAttr);d.DT_RowData&&f(c).data(d.DT_RowData)}}function pb(a){var b,c,d=a.nTHead,e=a.nTFoot,h=0===f("th, td",d).length,g=a.oClasses,k=a.aoColumns;h&&(c=f("<tr/>").appendTo(d));var l=0;for(b=k.length;l<b;l++){var n=k[l];var m=f(n.nTh).addClass(n.sClass);h&&m.appendTo(c);a.oFeatures.bSort&&(m.addClass(n.sSortingClass),!1!==n.bSortable&&(m.attr("tabindex",a.iTabIndex).attr("aria-controls",
|
|
|
|
|
a.sTableId),Qa(a,n.nTh,l)));n.sTitle!=m[0].innerHTML&&m.html(n.sTitle);Ra(a,"header")(a,m,n,g)}h&&fa(a.aoHeader,d);f(d).find(">tr").attr("role","row");f(d).find(">tr>th, >tr>td").addClass(g.sHeaderTH);f(e).find(">tr>th, >tr>td").addClass(g.sFooterTH);if(null!==e)for(a=a.aoFooter[0],l=0,b=a.length;l<b;l++)n=k[l],n.nTf=a[l].cell,n.sClass&&f(n.nTf).addClass(n.sClass)}function ha(a,b,c){var d,e,h=[],g=[],k=a.aoColumns.length;if(b){c===p&&(c=!1);var l=0;for(d=b.length;l<d;l++){h[l]=b[l].slice();h[l].nTr=
|
|
|
|
|
b[l].nTr;for(e=k-1;0<=e;e--)a.aoColumns[e].bVisible||c||h[l].splice(e,1);g.push([])}l=0;for(d=h.length;l<d;l++){if(a=h[l].nTr)for(;e=a.firstChild;)a.removeChild(e);e=0;for(b=h[l].length;e<b;e++){var n=k=1;if(g[l][e]===p){a.appendChild(h[l][e].cell);for(g[l][e]=1;h[l+k]!==p&&h[l][e].cell==h[l+k][e].cell;)g[l+k][e]=1,k++;for(;h[l][e+n]!==p&&h[l][e].cell==h[l][e+n].cell;){for(c=0;c<k;c++)g[l+c][e+n]=1;n++}f(h[l][e].cell).attr("rowspan",k).attr("colspan",n)}}}}}function S(a){var b=A(a,"aoPreDrawCallback",
|
|
|
|
|
"preDraw",[a]);if(-1!==f.inArray(!1,b))K(a,!1);else{b=[];var c=0,d=a.asStripeClasses,e=d.length,h=a.oLanguage,g=a.iInitDisplayStart,k="ssp"==D(a),l=a.aiDisplay;a.bDrawing=!0;g!==p&&-1!==g&&(a._iDisplayStart=k?g:g>=a.fnRecordsDisplay()?0:g,a.iInitDisplayStart=-1);g=a._iDisplayStart;var n=a.fnDisplayEnd();if(a.bDeferLoading)a.bDeferLoading=!1,a.iDraw++,K(a,!1);else if(!k)a.iDraw++;else if(!a.bDestroying&&!qb(a))return;if(0!==l.length)for(h=k?a.aoData.length:n,k=k?0:g;k<h;k++){var m=l[k],w=a.aoData[m];
|
|
|
|
|
null===w.nTr&&La(a,m);var u=w.nTr;if(0!==e){var q=d[c%e];w._sRowStripe!=q&&(f(u).removeClass(w._sRowStripe).addClass(q),w._sRowStripe=q)}A(a,"aoRowCallback",null,[u,w._aData,c,k,m]);b.push(u);c++}else c=h.sZeroRecords,1==a.iDraw&&"ajax"==D(a)?c=h.sLoadingRecords:h.sEmptyTable&&0===a.fnRecordsTotal()&&(c=h.sEmptyTable),b[0]=f("<tr/>",{"class":e?d[0]:""}).append(f("<td />",{valign:"top",colSpan:W(a),"class":a.oClasses.sRowEmpty}).html(c))[0];A(a,"aoHeaderCallback","header",[f(a.nTHead).children("tr")[0],
|
|
|
|
|
Oa(a),g,n,l]);A(a,"aoFooterCallback","footer",[f(a.nTFoot).children("tr")[0],Oa(a),g,n,l]);d=f(a.nTBody);d.children().detach();d.append(f(b));A(a,"aoDrawCallback","draw",[a]);a.bSorted=!1;a.bFiltered=!1;a.bDrawing=!1}}function V(a,b){var c=a.oFeatures,d=c.bFilter;c.bSort&&rb(a);d?ia(a,a.oPreviousSearch):a.aiDisplay=a.aiDisplayMaster.slice();!0!==b&&(a._iDisplayStart=0);a._drawHold=b;S(a);a._drawHold=!1}function sb(a){var b=a.oClasses,c=f(a.nTable);c=f("<div/>").insertBefore(c);var d=a.oFeatures,e=
|
|
|
|
|
f("<div/>",{id:a.sTableId+"_wrapper","class":b.sWrapper+(a.nTFoot?"":" "+b.sNoFooter)});a.nHolding=c[0];a.nTableWrapper=e[0];a.nTableReinsertBefore=a.nTable.nextSibling;for(var h=a.sDom.split(""),g,k,l,n,m,p,u=0;u<h.length;u++){g=null;k=h[u];if("<"==k){l=f("<div/>")[0];n=h[u+1];if("'"==n||'"'==n){m="";for(p=2;h[u+p]!=n;)m+=h[u+p],p++;"H"==m?m=b.sJUIHeader:"F"==m&&(m=b.sJUIFooter);-1!=m.indexOf(".")?(n=m.split("."),l.id=n[0].substr(1,n[0].length-1),l.className=n[1]):"#"==m.charAt(0)?l.id=m.substr(1,
|
|
|
|
|
m.length-1):l.className=m;u+=p}e.append(l);e=f(l)}else if(">"==k)e=e.parent();else if("l"==k&&d.bPaginate&&d.bLengthChange)g=tb(a);else if("f"==k&&d.bFilter)g=ub(a);else if("r"==k&&d.bProcessing)g=vb(a);else if("t"==k)g=wb(a);else if("i"==k&&d.bInfo)g=xb(a);else if("p"==k&&d.bPaginate)g=yb(a);else if(0!==q.ext.feature.length)for(l=q.ext.feature,p=0,n=l.length;p<n;p++)if(k==l[p].cFeature){g=l[p].fnInit(a);break}g&&(l=a.aanFeatures,l[k]||(l[k]=[]),l[k].push(g),e.append(g))}c.replaceWith(e);a.nHolding=
|
|
|
|
|
null}function fa(a,b){b=f(b).children("tr");var c,d,e;a.splice(0,a.length);var h=0;for(e=b.length;h<e;h++)a.push([]);h=0;for(e=b.length;h<e;h++){var g=b[h];for(c=g.firstChild;c;){if("TD"==c.nodeName.toUpperCase()||"TH"==c.nodeName.toUpperCase()){var k=1*c.getAttribute("colspan");var l=1*c.getAttribute("rowspan");k=k&&0!==k&&1!==k?k:1;l=l&&0!==l&&1!==l?l:1;var n=0;for(d=a[h];d[n];)n++;var m=n;var p=1===k?!0:!1;for(d=0;d<k;d++)for(n=0;n<l;n++)a[h+n][m+d]={cell:c,unique:p},a[h+n].nTr=g}c=c.nextSibling}}}
|
|
|
|
|
function ua(a,b,c){var d=[];c||(c=a.aoHeader,b&&(c=[],fa(c,b)));b=0;for(var e=c.length;b<e;b++)for(var h=0,g=c[b].length;h<g;h++)!c[b][h].unique||d[h]&&a.bSortCellsTop||(d[h]=c[b][h].cell);return d}function va(a,b,c){A(a,"aoServerParams","serverParams",[b]);if(b&&f.isArray(b)){var d={},e=/(.*?)\[\]$/;f.each(b,function(a,b){(a=b.name.match(e))?(a=a[0],d[a]||(d[a]=[]),d[a].push(b.value)):d[b.name]=b.value});b=d}var h=a.ajax,g=a.oInstance,k=function(b){A(a,null,"xhr",[a,b,a.jqXHR]);c(b)};if(f.isPlainObject(h)&&
|
|
|
|
|
h.data){var l=h.data;var n="function"===typeof l?l(b,a):l;b="function"===typeof l&&n?n:f.extend(!0,b,n);delete h.data}n={data:b,success:function(b){var c=b.error||b.sError;c&&O(a,0,c);a.json=b;k(b)},dataType:"json",cache:!1,type:a.sServerMethod,error:function(b,c,d){d=A(a,null,"xhr",[a,null,a.jqXHR]);-1===f.inArray(!0,d)&&("parsererror"==c?O(a,0,"Invalid JSON response",1):4===b.readyState&&O(a,0,"Ajax error",7));K(a,!1)}};a.oAjaxData=b;A(a,null,"preXhr",[a,b]);a.fnServerData?a.fnServerData.call(g,
|
|
|
|
|
a.sAjaxSource,f.map(b,function(a,b){return{name:b,value:a}}),k,a):a.sAjaxSource||"string"===typeof h?a.jqXHR=f.ajax(f.extend(n,{url:h||a.sAjaxSource})):"function"===typeof h?a.jqXHR=h.call(g,b,k,a):(a.jqXHR=f.ajax(f.extend(n,h)),h.data=l)}function qb(a){return a.bAjaxDataGet?(a.iDraw++,K(a,!0),va(a,zb(a),function(b){Ab(a,b)}),!1):!0}function zb(a){var b=a.aoColumns,c=b.length,d=a.oFeatures,e=a.oPreviousSearch,h=a.aoPreSearchCols,g=[],k=Y(a);var l=a._iDisplayStart;var n=!1!==d.bPaginate?a._iDisplayLength:
|
|
|
|
|
-1;var m=function(a,b){g.push({name:a,value:b})};m("sEcho",a.iDraw);m("iColumns",c);m("sColumns",J(b,"sName").join(","));m("iDisplayStart",l);m("iDisplayLength",n);var p={draw:a.iDraw,columns:[],order:[],start:l,length:n,search:{value:e.sSearch,regex:e.bRegex}};for(l=0;l<c;l++){var u=b[l];var sa=h[l];n="function"==typeof u.mData?"function":u.mData;p.columns.push({data:n,name:u.sName,searchable:u.bSearchable,orderable:u.bSortable,search:{value:sa.sSearch,regex:sa.bRegex}});m("mDataProp_"+l,n);d.bFilter&&
|
|
|
|
|
(m("sSearch_"+l,sa.sSearch),m("bRegex_"+l,sa.bRegex),m("bSearchable_"+l,u.bSearchable));d.bSort&&m("bSortable_"+l,u.bSortable)}d.bFilter&&(m("sSearch",e.sSearch),m("bRegex",e.bRegex));d.bSort&&(f.each(k,function(a,b){p.order.push({column:b.col,dir:b.dir});m("iSortCol_"+a,b.col);m("sSortDir_"+a,b.dir)}),m("iSortingCols",k.length));b=q.ext.legacy.ajax;return null===b?a.sAjaxSource?g:p:b?g:p}function Ab(a,b){var c=function(a,c){return b[a]!==p?b[a]:b[c]},d=wa(a,b),e=c("sEcho","draw"),h=c("iTotalRecords",
|
|
|
|
|
"recordsTotal");c=c("iTotalDisplayRecords","recordsFiltered");if(e){if(1*e<a.iDraw)return;a.iDraw=1*e}qa(a);a._iRecordsTotal=parseInt(h,10);a._iRecordsDisplay=parseInt(c,10);e=0;for(h=d.length;e<h;e++)R(a,d[e]);a.aiDisplay=a.aiDisplayMaster.slice();a.bAjaxDataGet=!1;S(a);a._bInitComplete||xa(a,b);a.bAjaxDataGet=!0;K(a,!1)}function wa(a,b){a=f.isPlainObject(a.ajax)&&a.ajax.dataSrc!==p?a.ajax.dataSrc:a.sAjaxDataProp;return"data"===a?b.aaData||b[a]:""!==a?U(a)(b):b}function ub(a){var b=a.oClasses,c=
|
|
|
|
|
a.sTableId,d=a.oLanguage,e=a.oPreviousSearch,h=a.aanFeatures,g='<input type="search" class="'+b.sFilterInput+'"/>',k=d.sSearch;k=k.match(/_INPUT_/)?k.replace("_INPUT_",g):k+g;b=f("<div/>",{id:h.f?null:c+"_filter","class":b.sFilter}).append(f("<label/>").append(k));h=function(){var b=this.value?this.value:"";b!=e.sSearch&&(ia(a,{sSearch:b,bRegex:e.bRegex,bSmart:e.bSmart,bCaseInsensitive:e.bCaseInsensitive}),a._iDisplayStart=0,S(a))};g=null!==a.searchDelay?a.searchDelay:"ssp"===D(a)?400:0;var l=f("input",
|
|
|
|
|
b).val(e.sSearch).attr("placeholder",d.sSearchPlaceholder).on("keyup.DT search.DT input.DT paste.DT cut.DT",g?Sa(h,g):h).on("keypress.DT",function(a){if(13==a.keyCode)return!1}).attr("aria-controls",c);f(a.nTable).on("search.dt.DT",function(b,c){if(a===c)try{l[0]!==y.activeElement&&l.val(e.sSearch)}catch(w){}});return b[0]}function ia(a,b,c){var d=a.oPreviousSearch,e=a.aoPreSearchCols,h=function(a){d.sSearch=a.sSearch;d.bRegex=a.bRegex;d.bSmart=a.bSmart;d.bCaseInsensitive=a.bCaseInsensitive},g=function(a){return a.bEscapeRegex!==
|
|
|
|
|
p?!a.bEscapeRegex:a.bRegex};Ka(a);if("ssp"!=D(a)){Bb(a,b.sSearch,c,g(b),b.bSmart,b.bCaseInsensitive);h(b);for(b=0;b<e.length;b++)Cb(a,e[b].sSearch,b,g(e[b]),e[b].bSmart,e[b].bCaseInsensitive);Db(a)}else h(b);a.bFiltered=!0;A(a,null,"search",[a])}function Db(a){for(var b=q.ext.search,c=a.aiDisplay,d,e,h=0,g=b.length;h<g;h++){for(var k=[],l=0,n=c.length;l<n;l++)e=c[l],d=a.aoData[e],b[h](a,d._aFilterData,e,d._aData,l)&&k.push(e);c.length=0;f.merge(c,k)}}function Cb(a,b,c,d,e,h){if(""!==b){var g=[],k=
|
|
|
|
|
a.aiDisplay;d=Ta(b,d,e,h);for(e=0;e<k.length;e++)b=a.aoData[k[e]]._aFilterData[c],d.test(b)&&g.push(k[e]);a.aiDisplay=g}}function Bb(a,b,c,d,e,h){e=Ta(b,d,e,h);var g=a.oPreviousSearch.sSearch,k=a.aiDisplayMaster;h=[];0!==q.ext.search.length&&(c=!0);var f=Eb(a);if(0>=b.length)a.aiDisplay=k.slice();else{if(f||c||d||g.length>b.length||0!==b.indexOf(g)||a.bSorted)a.aiDisplay=k.slice();b=a.aiDisplay;for(c=0;c<b.length;c++)e.test(a.aoData[b[c]]._sFilterRow)&&h.push(b[c]);a.aiDisplay=h}}function Ta(a,b,
|
|
|
|
|
c,d){a=b?a:Ua(a);c&&(a="^(?=.*?"+f.map(a.match(/"[^"]+"|[^ ]+/g)||[""],function(a){if('"'===a.charAt(0)){var b=a.match(/^"(.*)"$/);a=b?b[1]:a}return a.replace('"',"")}).join(")(?=.*?")+").*$");return new RegExp(a,d?"i":"")}function Eb(a){var b=a.aoColumns,c,d,e=q.ext.type.search;var h=!1;var g=0;for(c=a.aoData.length;g<c;g++){var k=a.aoData[g];if(!k._aFilterData){var f=[];var n=0;for(d=b.length;n<d;n++){h=b[n];if(h.bSearchable){var m=I(a,g,n,"filter");e[h.sType]&&(m=e[h.sType](m));null===m&&(m="");
|
|
|
|
|
"string"!==typeof m&&m.toString&&(m=m.toString())}else m="";m.indexOf&&-1!==m.indexOf("&")&&(ya.innerHTML=m,m=$b?ya.textContent:ya.innerText);m.replace&&(m=m.replace(/[\r\n\u2028]/g,""));f.push(m)}k._aFilterData=f;k._sFilterRow=f.join(" ");h=!0}}return h}function Fb(a){return{search:a.sSearch,smart:a.bSmart,regex:a.bRegex,caseInsensitive:a.bCaseInsensitive}}function Gb(a){return{sSearch:a.search,bSmart:a.smart,bRegex:a.regex,bCaseInsensitive:a.caseInsensitive}}function xb(a){var b=a.sTableId,c=a.aanFeatures.i,
|
|
|
|
|
d=f("<div/>",{"class":a.oClasses.sInfo,id:c?null:b+"_info"});c||(a.aoDrawCallback.push({fn:Hb,sName:"information"}),d.attr("role","status").attr("aria-live","polite"),f(a.nTable).attr("aria-describedby",b+"_info"));return d[0]}function Hb(a){var b=a.aanFeatures.i;if(0!==b.length){var c=a.oLanguage,d=a._iDisplayStart+1,e=a.fnDisplayEnd(),h=a.fnRecordsTotal(),g=a.fnRecordsDisplay(),k=g?c.sInfo:c.sInfoEmpty;g!==h&&(k+=" "+c.sInfoFiltered);k+=c.sInfoPostFix;k=Ib(a,k);c=c.fnInfoCallback;null!==c&&(k=c.call(a.oInstance,
|
|
|
|
|
a,d,e,h,g,k));f(b).html(k)}}function Ib(a,b){var c=a.fnFormatNumber,d=a._iDisplayStart+1,e=a._iDisplayLength,h=a.fnRecordsDisplay(),g=-1===e;return b.replace(/_START_/g,c.call(a,d)).replace(/_END_/g,c.call(a,a.fnDisplayEnd())).replace(/_MAX_/g,c.call(a,a.fnRecordsTotal())).replace(/_TOTAL_/g,c.call(a,h)).replace(/_PAGE_/g,c.call(a,g?1:Math.ceil(d/e))).replace(/_PAGES_/g,c.call(a,g?1:Math.ceil(h/e)))}function ja(a){var b=a.iInitDisplayStart,c=a.aoColumns;var d=a.oFeatures;var e=a.bDeferLoading;if(a.bInitialised){sb(a);
|
|
|
|
|
pb(a);ha(a,a.aoHeader);ha(a,a.aoFooter);K(a,!0);d.bAutoWidth&&Ja(a);var h=0;for(d=c.length;h<d;h++){var g=c[h];g.sWidth&&(g.nTh.style.width=B(g.sWidth))}A(a,null,"preInit",[a]);V(a);c=D(a);if("ssp"!=c||e)"ajax"==c?va(a,[],function(c){var d=wa(a,c);for(h=0;h<d.length;h++)R(a,d[h]);a.iInitDisplayStart=b;V(a);K(a,!1);xa(a,c)},a):(K(a,!1),xa(a))}else setTimeout(function(){ja(a)},200)}function xa(a,b){a._bInitComplete=!0;(b||a.oInit.aaData)&&aa(a);A(a,null,"plugin-init",[a,b]);A(a,"aoInitComplete","init",
|
|
|
|
|
[a,b])}function Va(a,b){b=parseInt(b,10);a._iDisplayLength=b;Wa(a);A(a,null,"length",[a,b])}function tb(a){var b=a.oClasses,c=a.sTableId,d=a.aLengthMenu,e=f.isArray(d[0]),h=e?d[0]:d;d=e?d[1]:d;e=f("<select/>",{name:c+"_length","aria-controls":c,"class":b.sLengthSelect});for(var g=0,k=h.length;g<k;g++)e[0][g]=new Option("number"===typeof d[g]?a.fnFormatNumber(d[g]):d[g],h[g]);var l=f("<div><label/></div>").addClass(b.sLength);a.aanFeatures.l||(l[0].id=c+"_length");l.children().append(a.oLanguage.sLengthMenu.replace("_MENU_",
|
|
|
|
|
e[0].outerHTML));f("select",l).val(a._iDisplayLength).on("change.DT",function(b){Va(a,f(this).val());S(a)});f(a.nTable).on("length.dt.DT",function(b,c,d){a===c&&f("select",l).val(d)});return l[0]}function yb(a){var b=a.sPaginationType,c=q.ext.pager[b],d="function"===typeof c,e=function(a){S(a)};b=f("<div/>").addClass(a.oClasses.sPaging+b)[0];var h=a.aanFeatures;d||c.fnInit(a,b,e);h.p||(b.id=a.sTableId+"_paginate",a.aoDrawCallback.push({fn:function(a){if(d){var b=a._iDisplayStart,g=a._iDisplayLength,
|
|
|
|
|
f=a.fnRecordsDisplay(),m=-1===g;b=m?0:Math.ceil(b/g);g=m?1:Math.ceil(f/g);f=c(b,g);var p;m=0;for(p=h.p.length;m<p;m++)Ra(a,"pageButton")(a,h.p[m],m,f,b,g)}else c.fnUpdate(a,e)},sName:"pagination"}));return b}function Xa(a,b,c){var d=a._iDisplayStart,e=a._iDisplayLength,h=a.fnRecordsDisplay();0===h||-1===e?d=0:"number"===typeof b?(d=b*e,d>h&&(d=0)):"first"==b?d=0:"previous"==b?(d=0<=e?d-e:0,0>d&&(d=0)):"next"==b?d+e<h&&(d+=e):"last"==b?d=Math.floor((h-1)/e)*e:O(a,0,"Unknown paging action: "+b,5);b=
|
|
|
|
|
a._iDisplayStart!==d;a._iDisplayStart=d;b&&(A(a,null,"page",[a]),c&&S(a));return b}function vb(a){return f("<div/>",{id:a.aanFeatures.r?null:a.sTableId+"_processing","class":a.oClasses.sProcessing}).html(a.oLanguage.sProcessing).insertBefore(a.nTable)[0]}function K(a,b){a.oFeatures.bProcessing&&f(a.aanFeatures.r).css("display",b?"block":"none");A(a,null,"processing",[a,b])}function wb(a){var b=f(a.nTable);b.attr("role","grid");var c=a.oScroll;if(""===c.sX&&""===c.sY)return a.nTable;var d=c.sX,e=c.sY,
|
|
|
|
|
h=a.oClasses,g=b.children("caption"),k=g.length?g[0]._captionSide:null,l=f(b[0].cloneNode(!1)),n=f(b[0].cloneNode(!1)),m=b.children("tfoot");m.length||(m=null);l=f("<div/>",{"class":h.sScrollWrapper}).append(f("<div/>",{"class":h.sScrollHead}).css({overflow:"hidden",position:"relative",border:0,width:d?d?B(d):null:"100%"}).append(f("<div/>",{"class":h.sScrollHeadInner}).css({"box-sizing":"content-box",width:c.sXInner||"100%"}).append(l.removeAttr("id").css("margin-left",0).append("top"===k?g:null).append(b.children("thead"))))).append(f("<div/>",
|
|
|
|
|
{"class":h.sScrollBody}).css({position:"relative",overflow:"auto",width:d?B(d):null}).append(b));m&&l.append(f("<div/>",{"class":h.sScrollFoot}).css({overflow:"hidden",border:0,width:d?d?B(d):null:"100%"}).append(f("<div/>",{"class":h.sScrollFootInner}).append(n.removeAttr("id").css("margin-left",0).append("bottom"===k?g:null).append(b.children("tfoot")))));b=l.children();var p=b[0];h=b[1];var u=m?b[2]:null;if(d)f(h).on("scroll.DT",function(a){a=this.scrollLeft;p.scrollLeft=a;m&&(u.scrollLeft=a)});
|
|
|
|
|
f(h).css(e&&c.bCollapse?"max-height":"height",e);a.nScrollHead=p;a.nScrollBody=h;a.nScrollFoot=u;a.aoDrawCallback.push({fn:na,sName:"scrolling"});return l[0]}function na(a){var b=a.oScroll,c=b.sX,d=b.sXInner,e=b.sY;b=b.iBarWidth;var h=f(a.nScrollHead),g=h[0].style,k=h.children("div"),l=k[0].style,n=k.children("table");k=a.nScrollBody;var m=f(k),w=k.style,u=f(a.nScrollFoot).children("div"),q=u.children("table"),t=f(a.nTHead),r=f(a.nTable),v=r[0],za=v.style,T=a.nTFoot?f(a.nTFoot):null,A=a.oBrowser,
|
|
|
|
|
x=A.bScrollOversize,ac=J(a.aoColumns,"nTh"),Ya=[],y=[],z=[],C=[],G,H=function(a){a=a.style;a.paddingTop="0";a.paddingBottom="0";a.borderTopWidth="0";a.borderBottomWidth="0";a.height=0};var D=k.scrollHeight>k.clientHeight;if(a.scrollBarVis!==D&&a.scrollBarVis!==p)a.scrollBarVis=D,aa(a);else{a.scrollBarVis=D;r.children("thead, tfoot").remove();if(T){var E=T.clone().prependTo(r);var F=T.find("tr");E=E.find("tr")}var I=t.clone().prependTo(r);t=t.find("tr");D=I.find("tr");I.find("th, td").removeAttr("tabindex");
|
|
|
|
|
c||(w.width="100%",h[0].style.width="100%");f.each(ua(a,I),function(b,c){G=ba(a,b);c.style.width=a.aoColumns[G].sWidth});T&&N(function(a){a.style.width=""},E);h=r.outerWidth();""===c?(za.width="100%",x&&(r.find("tbody").height()>k.offsetHeight||"scroll"==m.css("overflow-y"))&&(za.width=B(r.outerWidth()-b)),h=r.outerWidth()):""!==d&&(za.width=B(d),h=r.outerWidth());N(H,D);N(function(a){z.push(a.innerHTML);Ya.push(B(f(a).css("width")))},D);N(function(a,b){-1!==f.inArray(a,ac)&&(a.style.width=Ya[b])},
|
|
|
|
|
t);f(D).height(0);T&&(N(H,E),N(function(a){C.push(a.innerHTML);y.push(B(f(a).css("width")))},E),N(function(a,b){a.style.width=y[b]},F),f(E).height(0));N(function(a,b){a.innerHTML='<div class="dataTables_sizing">'+z[b]+"</div>";a.childNodes[0].style.height="0";a.childNodes[0].style.overflow="hidden";a.style.width=Ya[b]},D);T&&N(function(a,b){a.innerHTML='<div class="dataTables_sizing">'+C[b]+"</div>";a.childNodes[0].style.height="0";a.childNodes[0].style.overflow="hidden";a.style.width=y[b]},E);r.outerWidth()<
|
|
|
|
|
h?(F=k.scrollHeight>k.offsetHeight||"scroll"==m.css("overflow-y")?h+b:h,x&&(k.scrollHeight>k.offsetHeight||"scroll"==m.css("overflow-y"))&&(za.width=B(F-b)),""!==c&&""===d||O(a,1,"Possible column misalignment",6)):F="100%";w.width=B(F);g.width=B(F);T&&(a.nScrollFoot.style.width=B(F));!e&&x&&(w.height=B(v.offsetHeight+b));c=r.outerWidth();n[0].style.width=B(c);l.width=B(c);d=r.height()>k.clientHeight||"scroll"==m.css("overflow-y");e="padding"+(A.bScrollbarLeft?"Left":"Right");l[e]=d?b+"px":"0px";T&&
|
|
|
|
|
(q[0].style.width=B(c),u[0].style.width=B(c),u[0].style[e]=d?b+"px":"0px");r.children("colgroup").insertBefore(r.children("thead"));m.trigger("scroll");!a.bSorted&&!a.bFiltered||a._drawHold||(k.scrollTop=0)}}function N(a,b,c){for(var d=0,e=0,h=b.length,g,k;e<h;){g=b[e].firstChild;for(k=c?c[e].firstChild:null;g;)1===g.nodeType&&(c?a(g,k,d):a(g,d),d++),g=g.nextSibling,k=c?k.nextSibling:null;e++}}function Ja(a){var b=a.nTable,c=a.aoColumns,d=a.oScroll,e=d.sY,h=d.sX,g=d.sXInner,k=c.length,l=oa(a,"bVisible"),
|
|
|
|
|
n=f("th",a.nTHead),m=b.getAttribute("width"),p=b.parentNode,u=!1,q,t=a.oBrowser;d=t.bScrollOversize;(q=b.style.width)&&-1!==q.indexOf("%")&&(m=q);for(q=0;q<l.length;q++){var r=c[l[q]];null!==r.sWidth&&(r.sWidth=Jb(r.sWidthOrig,p),u=!0)}if(d||!u&&!h&&!e&&k==W(a)&&k==n.length)for(q=0;q<k;q++)l=ba(a,q),null!==l&&(c[l].sWidth=B(n.eq(q).width()));else{k=f(b).clone().css("visibility","hidden").removeAttr("id");k.find("tbody tr").remove();var v=f("<tr/>").appendTo(k.find("tbody"));k.find("thead, tfoot").remove();
|
|
|
|
|
k.append(f(a.nTHead).clone()).append(f(a.nTFoot).clone());k.find("tfoot th, tfoot td").css("width","");n=ua(a,k.find("thead")[0]);for(q=0;q<l.length;q++)r=c[l[q]],n[q].style.width=null!==r.sWidthOrig&&""!==r.sWidthOrig?B(r.sWidthOrig):"",r.sWidthOrig&&h&&f(n[q]).append(f("<div/>").css({width:r.sWidthOrig,margin:0,padding:0,border:0,height:1}));if(a.aoData.length)for(q=0;q<l.length;q++)u=l[q],r=c[u],f(Kb(a,u)).clone(!1).append(r.sContentPadding).appendTo(v);f("[name]",k).removeAttr("name");r=f("<div/>").css(h||
|
|
|
|
|
e?{position:"absolute",top:0,left:0,height:1,right:0,overflow:"hidden"}:{}).append(k).appendTo(p);h&&g?k.width(g):h?(k.css("width","auto"),k.removeAttr("width"),k.width()<p.clientWidth&&m&&k.width(p.clientWidth)):e?k.width(p.clientWidth):m&&k.width(m);for(q=e=0;q<l.length;q++)p=f(n[q]),g=p.outerWidth()-p.width(),p=t.bBounding?Math.ceil(n[q].getBoundingClientRect().width):p.outerWidth(),e+=p,c[l[q]].sWidth=B(p-g);b.style.width=B(e);r.remove()}m&&(b.style.width=B(m));!m&&!h||a._reszEvt||(b=function(){f(z).on("resize.DT-"+
|
|
|
|
|
a.sInstance,Sa(function(){aa(a)}))},d?setTimeout(b,1E3):b(),a._reszEvt=!0)}function Jb(a,b){if(!a)return 0;a=f("<div/>").css("width",B(a)).appendTo(b||y.body);b=a[0].offsetWidth;a.remove();return b}function Kb(a,b){var c=Lb(a,b);if(0>c)return null;var d=a.aoData[c];return d.nTr?d.anCells[b]:f("<td/>").html(I(a,c,b,"display"))[0]}function Lb(a,b){for(var c,d=-1,e=-1,h=0,g=a.aoData.length;h<g;h++)c=I(a,h,b,"display")+"",c=c.replace(bc,""),c=c.replace(/ /g," "),c.length>d&&(d=c.length,e=h);return e}
|
|
|
|
|
function B(a){return null===a?"0px":"number"==typeof a?0>a?"0px":a+"px":a.match(/\d$/)?a+"px":a}function Y(a){var b=[],c=a.aoColumns;var d=a.aaSortingFixed;var e=f.isPlainObject(d);var h=[];var g=function(a){a.length&&!f.isArray(a[0])?h.push(a):f.merge(h,a)};f.isArray(d)&&g(d);e&&d.pre&&g(d.pre);g(a.aaSorting);e&&d.post&&g(d.post);for(a=0;a<h.length;a++){var k=h[a][0];g=c[k].aDataSort;d=0;for(e=g.length;d<e;d++){var l=g[d];var n=c[l].sType||"string";h[a]._idx===p&&(h[a]._idx=f.inArray(h[a][1],c[l].asSorting));
|
|
|
|
|
b.push({src:k,col:l,dir:h[a][1],index:h[a]._idx,type:n,formatter:q.ext.type.order[n+"-pre"]})}}return b}function rb(a){var b,c=[],d=q.ext.type.order,e=a.aoData,h=0,g=a.aiDisplayMaster;Ka(a);var k=Y(a);var f=0;for(b=k.length;f<b;f++){var n=k[f];n.formatter&&h++;Mb(a,n.col)}if("ssp"!=D(a)&&0!==k.length){f=0;for(b=g.length;f<b;f++)c[g[f]]=f;h===k.length?g.sort(function(a,b){var d,h=k.length,g=e[a]._aSortData,f=e[b]._aSortData;for(d=0;d<h;d++){var l=k[d];var m=g[l.col];var n=f[l.col];m=m<n?-1:m>n?1:0;
|
|
|
|
|
if(0!==m)return"asc"===l.dir?m:-m}m=c[a];n=c[b];return m<n?-1:m>n?1:0}):g.sort(function(a,b){var h,g=k.length,f=e[a]._aSortData,l=e[b]._aSortData;for(h=0;h<g;h++){var m=k[h];var n=f[m.col];var p=l[m.col];m=d[m.type+"-"+m.dir]||d["string-"+m.dir];n=m(n,p);if(0!==n)return n}n=c[a];p=c[b];return n<p?-1:n>p?1:0})}a.bSorted=!0}function Nb(a){var b=a.aoColumns,c=Y(a);a=a.oLanguage.oAria;for(var d=0,e=b.length;d<e;d++){var h=b[d];var g=h.asSorting;var k=h.sTitle.replace(/<.*?>/g,"");var f=h.nTh;f.removeAttribute("aria-sort");
|
|
|
|
|
h.bSortable&&(0<c.length&&c[0].col==d?(f.setAttribute("aria-sort","asc"==c[0].dir?"ascending":"descending"),h=g[c[0].index+1]||g[0]):h=g[0],k+="asc"===h?a.sSortAscending:a.sSortDescending);f.setAttribute("aria-label",k)}}function Za(a,b,c,d){var e=a.aaSorting,h=a.aoColumns[b].asSorting,g=function(a,b){var c=a._idx;c===p&&(c=f.inArray(a[1],h));return c+1<h.length?c+1:b?null:0};"number"===typeof e[0]&&(e=a.aaSorting=[e]);c&&a.oFeatures.bSortMulti?(c=f.inArray(b,J(e,"0")),-1!==c?(b=g(e[c],!0),null===
|
|
|
|
|
b&&1===e.length&&(b=0),null===b?e.splice(c,1):(e[c][1]=h[b],e[c]._idx=b)):(e.push([b,h[0],0]),e[e.length-1]._idx=0)):e.length&&e[0][0]==b?(b=g(e[0]),e.length=1,e[0][1]=h[b],e[0]._idx=b):(e.length=0,e.push([b,h[0]]),e[0]._idx=0);V(a);"function"==typeof d&&d(a)}function Qa(a,b,c,d){var e=a.aoColumns[c];$a(b,{},function(b){!1!==e.bSortable&&(a.oFeatures.bProcessing?(K(a,!0),setTimeout(function(){Za(a,c,b.shiftKey,d);"ssp"!==D(a)&&K(a,!1)},0)):Za(a,c,b.shiftKey,d))})}function Aa(a){var b=a.aLastSort,
|
|
|
|
|
c=a.oClasses.sSortColumn,d=Y(a),e=a.oFeatures,h;if(e.bSort&&e.bSortClasses){e=0;for(h=b.length;e<h;e++){var g=b[e].src;f(J(a.aoData,"anCells",g)).removeClass(c+(2>e?e+1:3))}e=0;for(h=d.length;e<h;e++)g=d[e].src,f(J(a.aoData,"anCells",g)).addClass(c+(2>e?e+1:3))}a.aLastSort=d}function Mb(a,b){var c=a.aoColumns[b],d=q.ext.order[c.sSortDataType],e;d&&(e=d.call(a.oInstance,a,b,ca(a,b)));for(var h,g=q.ext.type.order[c.sType+"-pre"],k=0,f=a.aoData.length;k<f;k++)if(c=a.aoData[k],c._aSortData||(c._aSortData=
|
|
|
|
|
[]),!c._aSortData[b]||d)h=d?e[k]:I(a,k,b,"sort"),c._aSortData[b]=g?g(h):h}function Ba(a){if(a.oFeatures.bStateSave&&!a.bDestroying){var b={time:+new Date,start:a._iDisplayStart,length:a._iDisplayLength,order:f.extend(!0,[],a.aaSorting),search:Fb(a.oPreviousSearch),columns:f.map(a.aoColumns,function(b,d){return{visible:b.bVisible,search:Fb(a.aoPreSearchCols[d])}})};A(a,"aoStateSaveParams","stateSaveParams",[a,b]);a.oSavedState=b;a.fnStateSaveCallback.call(a.oInstance,a,b)}}function Ob(a,b,c){var d,
|
|
|
|
|
e,h=a.aoColumns;b=function(b){if(b&&b.time){var g=A(a,"aoStateLoadParams","stateLoadParams",[a,b]);if(-1===f.inArray(!1,g)&&(g=a.iStateDuration,!(0<g&&b.time<+new Date-1E3*g||b.columns&&h.length!==b.columns.length))){a.oLoadedState=f.extend(!0,{},b);b.start!==p&&(a._iDisplayStart=b.start,a.iInitDisplayStart=b.start);b.length!==p&&(a._iDisplayLength=b.length);b.order!==p&&(a.aaSorting=[],f.each(b.order,function(b,c){a.aaSorting.push(c[0]>=h.length?[0,c[1]]:c)}));b.search!==p&&f.extend(a.oPreviousSearch,
|
|
|
|
|
Gb(b.search));if(b.columns)for(d=0,e=b.columns.length;d<e;d++)g=b.columns[d],g.visible!==p&&(h[d].bVisible=g.visible),g.search!==p&&f.extend(a.aoPreSearchCols[d],Gb(g.search));A(a,"aoStateLoaded","stateLoaded",[a,b])}}c()};if(a.oFeatures.bStateSave){var g=a.fnStateLoadCallback.call(a.oInstance,a,b);g!==p&&b(g)}else c()}function Ca(a){var b=q.settings;a=f.inArray(a,J(b,"nTable"));return-1!==a?b[a]:null}function O(a,b,c,d){c="DataTables warning: "+(a?"table id="+a.sTableId+" - ":"")+c;d&&(c+=". For more information about this error, please see http://datatables.net/tn/"+
|
|
|
|
|
d);if(b)z.console&&console.log&&console.log(c);else if(b=q.ext,b=b.sErrMode||b.errMode,a&&A(a,null,"error",[a,d,c]),"alert"==b)alert(c);else{if("throw"==b)throw Error(c);"function"==typeof b&&b(a,d,c)}}function M(a,b,c,d){f.isArray(c)?f.each(c,function(c,d){f.isArray(d)?M(a,b,d[0],d[1]):M(a,b,d)}):(d===p&&(d=c),b[c]!==p&&(a[d]=b[c]))}function ab(a,b,c){var d;for(d in b)if(b.hasOwnProperty(d)){var e=b[d];f.isPlainObject(e)?(f.isPlainObject(a[d])||(a[d]={}),f.extend(!0,a[d],e)):c&&"data"!==d&&"aaData"!==
|
|
|
|
|
d&&f.isArray(e)?a[d]=e.slice():a[d]=e}return a}function $a(a,b,c){f(a).on("click.DT",b,function(b){f(a).blur();c(b)}).on("keypress.DT",b,function(a){13===a.which&&(a.preventDefault(),c(a))}).on("selectstart.DT",function(){return!1})}function E(a,b,c,d){c&&a[b].push({fn:c,sName:d})}function A(a,b,c,d){var e=[];b&&(e=f.map(a[b].slice().reverse(),function(b,c){return b.fn.apply(a.oInstance,d)}));null!==c&&(b=f.Event(c+".dt"),f(a.nTable).trigger(b,d),e.push(b.result));return e}function Wa(a){var b=a._iDisplayStart,
|
|
|
|
|
c=a.fnDisplayEnd(),d=a._iDisplayLength;b>=c&&(b=c-d);b-=b%d;if(-1===d||0>b)b=0;a._iDisplayStart=b}function Ra(a,b){a=a.renderer;var c=q.ext.renderer[b];return f.isPlainObject(a)&&a[b]?c[a[b]]||c._:"string"===typeof a?c[a]||c._:c._}function D(a){return a.oFeatures.bServerSide?"ssp":a.ajax||a.sAjaxSource?"ajax":"dom"}function ka(a,b){var c=Pb.numbers_length,d=Math.floor(c/2);b<=c?a=Z(0,b):a<=d?(a=Z(0,c-2),a.push("ellipsis"),a.push(b-1)):(a>=b-1-d?a=Z(b-(c-2),b):(a=Z(a-d+2,a+d-1),a.push("ellipsis"),
|
|
|
|
|
a.push(b-1)),a.splice(0,0,"ellipsis"),a.splice(0,0,0));a.DT_el="span";return a}function Ha(a){f.each({num:function(b){return Da(b,a)},"num-fmt":function(b){return Da(b,a,bb)},"html-num":function(b){return Da(b,a,Ea)},"html-num-fmt":function(b){return Da(b,a,Ea,bb)}},function(b,c){C.type.order[b+a+"-pre"]=c;b.match(/^html\-/)&&(C.type.search[b+a]=C.type.search.html)})}function Qb(a){return function(){var b=[Ca(this[q.ext.iApiIndex])].concat(Array.prototype.slice.call(arguments));return q.ext.internal[a].apply(this,
|
|
|
|
|
b)}}var q=function(a){this.$=function(a,b){return this.api(!0).$(a,b)};this._=function(a,b){return this.api(!0).rows(a,b).data()};this.api=function(a){return a?new v(Ca(this[C.iApiIndex])):new v(this)};this.fnAddData=function(a,b){var c=this.api(!0);a=f.isArray(a)&&(f.isArray(a[0])||f.isPlainObject(a[0]))?c.rows.add(a):c.row.add(a);(b===p||b)&&c.draw();return a.flatten().toArray()};this.fnAdjustColumnSizing=function(a){var b=this.api(!0).columns.adjust(),c=b.settings()[0],d=c.oScroll;a===p||a?b.draw(!1):
|
|
|
|
|
(""!==d.sX||""!==d.sY)&&na(c)};this.fnClearTable=function(a){var b=this.api(!0).clear();(a===p||a)&&b.draw()};this.fnClose=function(a){this.api(!0).row(a).child.hide()};this.fnDeleteRow=function(a,b,c){var d=this.api(!0);a=d.rows(a);var e=a.settings()[0],h=e.aoData[a[0][0]];a.remove();b&&b.call(this,e,h);(c===p||c)&&d.draw();return h};this.fnDestroy=function(a){this.api(!0).destroy(a)};this.fnDraw=function(a){this.api(!0).draw(a)};this.fnFilter=function(a,b,c,d,e,f){e=this.api(!0);null===b||b===p?
|
|
|
|
|
e.search(a,c,d,f):e.column(b).search(a,c,d,f);e.draw()};this.fnGetData=function(a,b){var c=this.api(!0);if(a!==p){var d=a.nodeName?a.nodeName.toLowerCase():"";return b!==p||"td"==d||"th"==d?c.cell(a,b).data():c.row(a).data()||null}return c.data().toArray()};this.fnGetNodes=function(a){var b=this.api(!0);return a!==p?b.row(a).node():b.rows().nodes().flatten().toArray()};this.fnGetPosition=function(a){var b=this.api(!0),c=a.nodeName.toUpperCase();return"TR"==c?b.row(a).index():"TD"==c||"TH"==c?(a=b.cell(a).index(),
|
|
|
|
|
[a.row,a.columnVisible,a.column]):null};this.fnIsOpen=function(a){return this.api(!0).row(a).child.isShown()};this.fnOpen=function(a,b,c){return this.api(!0).row(a).child(b,c).show().child()[0]};this.fnPageChange=function(a,b){a=this.api(!0).page(a);(b===p||b)&&a.draw(!1)};this.fnSetColumnVis=function(a,b,c){a=this.api(!0).column(a).visible(b);(c===p||c)&&a.columns.adjust().draw()};this.fnSettings=function(){return Ca(this[C.iApiIndex])};this.fnSort=function(a){this.api(!0).order(a).draw()};this.fnSortListener=
|
|
|
|
|
function(a,b,c){this.api(!0).order.listener(a,b,c)};this.fnUpdate=function(a,b,c,d,e){var h=this.api(!0);c===p||null===c?h.row(b).data(a):h.cell(b,c).data(a);(e===p||e)&&h.columns.adjust();(d===p||d)&&h.draw();return 0};this.fnVersionCheck=C.fnVersionCheck;var b=this,c=a===p,d=this.length;c&&(a={});this.oApi=this.internal=C.internal;for(var e in q.ext.internal)e&&(this[e]=Qb(e));this.each(function(){var e={},g=1<d?ab(e,a,!0):a,k=0,l;e=this.getAttribute("id");var n=!1,m=q.defaults,w=f(this);if("table"!=
|
|
|
|
|
this.nodeName.toLowerCase())O(null,0,"Non-table node initialisation ("+this.nodeName+")",2);else{jb(m);kb(m.column);L(m,m,!0);L(m.column,m.column,!0);L(m,f.extend(g,w.data()),!0);var u=q.settings;k=0;for(l=u.length;k<l;k++){var t=u[k];if(t.nTable==this||t.nTHead&&t.nTHead.parentNode==this||t.nTFoot&&t.nTFoot.parentNode==this){var v=g.bRetrieve!==p?g.bRetrieve:m.bRetrieve;if(c||v)return t.oInstance;if(g.bDestroy!==p?g.bDestroy:m.bDestroy){t.oInstance.fnDestroy();break}else{O(t,0,"Cannot reinitialise DataTable",
|
|
|
|
|
3);return}}if(t.sTableId==this.id){u.splice(k,1);break}}if(null===e||""===e)this.id=e="DataTables_Table_"+q.ext._unique++;var r=f.extend(!0,{},q.models.oSettings,{sDestroyWidth:w[0].style.width,sInstance:e,sTableId:e});r.nTable=this;r.oApi=b.internal;r.oInit=g;u.push(r);r.oInstance=1===b.length?b:w.dataTable();jb(g);Ga(g.oLanguage);g.aLengthMenu&&!g.iDisplayLength&&(g.iDisplayLength=f.isArray(g.aLengthMenu[0])?g.aLengthMenu[0][0]:g.aLengthMenu[0]);g=ab(f.extend(!0,{},m),g);M(r.oFeatures,g,"bPaginate bLengthChange bFilter bSort bSortMulti bInfo bProcessing bAutoWidth bSortClasses bServerSide bDeferRender".split(" "));
|
|
|
|
|
M(r,g,["asStripeClasses","ajax","fnServerData","fnFormatNumber","sServerMethod","aaSorting","aaSortingFixed","aLengthMenu","sPaginationType","sAjaxSource","sAjaxDataProp","iStateDuration","sDom","bSortCellsTop","iTabIndex","fnStateLoadCallback","fnStateSaveCallback","renderer","searchDelay","rowId",["iCookieDuration","iStateDuration"],["oSearch","oPreviousSearch"],["aoSearchCols","aoPreSearchCols"],["iDisplayLength","_iDisplayLength"]]);M(r.oScroll,g,[["sScrollX","sX"],["sScrollXInner","sXInner"],
|
|
|
|
|
["sScrollY","sY"],["bScrollCollapse","bCollapse"]]);M(r.oLanguage,g,"fnInfoCallback");E(r,"aoDrawCallback",g.fnDrawCallback,"user");E(r,"aoServerParams",g.fnServerParams,"user");E(r,"aoStateSaveParams",g.fnStateSaveParams,"user");E(r,"aoStateLoadParams",g.fnStateLoadParams,"user");E(r,"aoStateLoaded",g.fnStateLoaded,"user");E(r,"aoRowCallback",g.fnRowCallback,"user");E(r,"aoRowCreatedCallback",g.fnCreatedRow,"user");E(r,"aoHeaderCallback",g.fnHeaderCallback,"user");E(r,"aoFooterCallback",g.fnFooterCallback,
|
|
|
|
|
"user");E(r,"aoInitComplete",g.fnInitComplete,"user");E(r,"aoPreDrawCallback",g.fnPreDrawCallback,"user");r.rowIdFn=U(g.rowId);lb(r);var x=r.oClasses;f.extend(x,q.ext.classes,g.oClasses);w.addClass(x.sTable);r.iInitDisplayStart===p&&(r.iInitDisplayStart=g.iDisplayStart,r._iDisplayStart=g.iDisplayStart);null!==g.iDeferLoading&&(r.bDeferLoading=!0,e=f.isArray(g.iDeferLoading),r._iRecordsDisplay=e?g.iDeferLoading[0]:g.iDeferLoading,r._iRecordsTotal=e?g.iDeferLoading[1]:g.iDeferLoading);var y=r.oLanguage;
|
|
|
|
|
f.extend(!0,y,g.oLanguage);y.sUrl&&(f.ajax({dataType:"json",url:y.sUrl,success:function(a){Ga(a);L(m.oLanguage,a);f.extend(!0,y,a);ja(r)},error:function(){ja(r)}}),n=!0);null===g.asStripeClasses&&(r.asStripeClasses=[x.sStripeOdd,x.sStripeEven]);e=r.asStripeClasses;var z=w.children("tbody").find("tr").eq(0);-1!==f.inArray(!0,f.map(e,function(a,b){return z.hasClass(a)}))&&(f("tbody tr",this).removeClass(e.join(" ")),r.asDestroyStripes=e.slice());e=[];u=this.getElementsByTagName("thead");0!==u.length&&
|
|
|
|
|
(fa(r.aoHeader,u[0]),e=ua(r));if(null===g.aoColumns)for(u=[],k=0,l=e.length;k<l;k++)u.push(null);else u=g.aoColumns;k=0;for(l=u.length;k<l;k++)Ia(r,e?e[k]:null);nb(r,g.aoColumnDefs,u,function(a,b){ma(r,a,b)});if(z.length){var B=function(a,b){return null!==a.getAttribute("data-"+b)?b:null};f(z[0]).children("th, td").each(function(a,b){var c=r.aoColumns[a];if(c.mData===a){var d=B(b,"sort")||B(b,"order");b=B(b,"filter")||B(b,"search");if(null!==d||null!==b)c.mData={_:a+".display",sort:null!==d?a+".@data-"+
|
|
|
|
|
d:p,type:null!==d?a+".@data-"+d:p,filter:null!==b?a+".@data-"+b:p},ma(r,a)}})}var C=r.oFeatures;e=function(){if(g.aaSorting===p){var a=r.aaSorting;k=0;for(l=a.length;k<l;k++)a[k][1]=r.aoColumns[k].asSorting[0]}Aa(r);C.bSort&&E(r,"aoDrawCallback",function(){if(r.bSorted){var a=Y(r),b={};f.each(a,function(a,c){b[c.src]=c.dir});A(r,null,"order",[r,a,b]);Nb(r)}});E(r,"aoDrawCallback",function(){(r.bSorted||"ssp"===D(r)||C.bDeferRender)&&Aa(r)},"sc");a=w.children("caption").each(function(){this._captionSide=
|
|
|
|
|
f(this).css("caption-side")});var b=w.children("thead");0===b.length&&(b=f("<thead/>").appendTo(w));r.nTHead=b[0];b=w.children("tbody");0===b.length&&(b=f("<tbody/>").appendTo(w));r.nTBody=b[0];b=w.children("tfoot");0===b.length&&0<a.length&&(""!==r.oScroll.sX||""!==r.oScroll.sY)&&(b=f("<tfoot/>").appendTo(w));0===b.length||0===b.children().length?w.addClass(x.sNoFooter):0<b.length&&(r.nTFoot=b[0],fa(r.aoFooter,r.nTFoot));if(g.aaData)for(k=0;k<g.aaData.length;k++)R(r,g.aaData[k]);else(r.bDeferLoading||
|
|
|
|
|
"dom"==D(r))&&pa(r,f(r.nTBody).children("tr"));r.aiDisplay=r.aiDisplayMaster.slice();r.bInitialised=!0;!1===n&&ja(r)};g.bStateSave?(C.bStateSave=!0,E(r,"aoDrawCallback",Ba,"state_save"),Ob(r,g,e)):e()}});b=null;return this},C,t,x,cb={},Rb=/[\r\n\u2028]/g,Ea=/<.*?>/g,cc=/^\d{2,4}[\.\/\-]\d{1,2}[\.\/\-]\d{1,2}([T ]{1}\d{1,2}[:\.]\d{2}([\.:]\d{2})?)?$/,dc=/(\/|\.|\*|\+|\?|\||\(|\)|\[|\]|\{|\}|\\|\$|\^|\-)/g,bb=/[',$£€¥%\u2009\u202F\u20BD\u20a9\u20BArfkɃΞ]/gi,P=function(a){return a&&!0!==a&&"-"!==a?!1:
|
|
|
|
|
!0},Sb=function(a){var b=parseInt(a,10);return!isNaN(b)&&isFinite(a)?b:null},Tb=function(a,b){cb[b]||(cb[b]=new RegExp(Ua(b),"g"));return"string"===typeof a&&"."!==b?a.replace(/\./g,"").replace(cb[b],"."):a},db=function(a,b,c){var d="string"===typeof a;if(P(a))return!0;b&&d&&(a=Tb(a,b));c&&d&&(a=a.replace(bb,""));return!isNaN(parseFloat(a))&&isFinite(a)},Ub=function(a,b,c){return P(a)?!0:P(a)||"string"===typeof a?db(a.replace(Ea,""),b,c)?!0:null:null},J=function(a,b,c){var d=[],e=0,h=a.length;if(c!==
|
|
|
|
|
p)for(;e<h;e++)a[e]&&a[e][b]&&d.push(a[e][b][c]);else for(;e<h;e++)a[e]&&d.push(a[e][b]);return d},la=function(a,b,c,d){var e=[],h=0,g=b.length;if(d!==p)for(;h<g;h++)a[b[h]][c]&&e.push(a[b[h]][c][d]);else for(;h<g;h++)e.push(a[b[h]][c]);return e},Z=function(a,b){var c=[];if(b===p){b=0;var d=a}else d=b,b=a;for(a=b;a<d;a++)c.push(a);return c},Vb=function(a){for(var b=[],c=0,d=a.length;c<d;c++)a[c]&&b.push(a[c]);return b},ta=function(a){a:{if(!(2>a.length)){var b=a.slice().sort();for(var c=b[0],d=1,
|
|
|
|
|
e=b.length;d<e;d++){if(b[d]===c){b=!1;break a}c=b[d]}}b=!0}if(b)return a.slice();b=[];e=a.length;var h,g=0;d=0;a:for(;d<e;d++){c=a[d];for(h=0;h<g;h++)if(b[h]===c)continue a;b.push(c);g++}return b};q.util={throttle:function(a,b){var c=b!==p?b:200,d,e;return function(){var b=this,g=+new Date,f=arguments;d&&g<d+c?(clearTimeout(e),e=setTimeout(function(){d=p;a.apply(b,f)},c)):(d=g,a.apply(b,f))}},escapeRegex:function(a){return a.replace(dc,"\\$1")}};var F=function(a,b,c){a[b]!==p&&(a[c]=a[b])},da=/\[.*?\]$/,
|
|
|
|
|
X=/\(\)$/,Ua=q.util.escapeRegex,ya=f("<div>")[0],$b=ya.textContent!==p,bc=/<.*?>/g,Sa=q.util.throttle,Wb=[],G=Array.prototype,ec=function(a){var b,c=q.settings,d=f.map(c,function(a,b){return a.nTable});if(a){if(a.nTable&&a.oApi)return[a];if(a.nodeName&&"table"===a.nodeName.toLowerCase()){var e=f.inArray(a,d);return-1!==e?[c[e]]:null}if(a&&"function"===typeof a.settings)return a.settings().toArray();"string"===typeof a?b=f(a):a instanceof f&&(b=a)}else return[];if(b)return b.map(function(a){e=f.inArray(this,
|
|
|
|
|
d);return-1!==e?c[e]:null}).toArray()};var v=function(a,b){if(!(this instanceof v))return new v(a,b);var c=[],d=function(a){(a=ec(a))&&c.push.apply(c,a)};if(f.isArray(a))for(var e=0,h=a.length;e<h;e++)d(a[e]);else d(a);this.context=ta(c);b&&f.merge(this,b);this.selector={rows:null,cols:null,opts:null};v.extend(this,this,Wb)};q.Api=v;f.extend(v.prototype,{any:function(){return 0!==this.count()},concat:G.concat,context:[],count:function(){return this.flatten().length},each:function(a){for(var b=0,c=
|
|
|
|
|
this.length;b<c;b++)a.call(this,this[b],b,this);return this},eq:function(a){var b=this.context;return b.length>a?new v(b[a],this[a]):null},filter:function(a){var b=[];if(G.filter)b=G.filter.call(this,a,this);else for(var c=0,d=this.length;c<d;c++)a.call(this,this[c],c,this)&&b.push(this[c]);return new v(this.context,b)},flatten:function(){var a=[];return new v(this.context,a.concat.apply(a,this.toArray()))},join:G.join,indexOf:G.indexOf||function(a,b){b=b||0;for(var c=this.length;b<c;b++)if(this[b]===
|
|
|
|
|
a)return b;return-1},iterator:function(a,b,c,d){var e=[],h,g,f=this.context,l,n=this.selector;"string"===typeof a&&(d=c,c=b,b=a,a=!1);var m=0;for(h=f.length;m<h;m++){var q=new v(f[m]);if("table"===b){var u=c.call(q,f[m],m);u!==p&&e.push(u)}else if("columns"===b||"rows"===b)u=c.call(q,f[m],this[m],m),u!==p&&e.push(u);else if("column"===b||"column-rows"===b||"row"===b||"cell"===b){var t=this[m];"column-rows"===b&&(l=Fa(f[m],n.opts));var x=0;for(g=t.length;x<g;x++)u=t[x],u="cell"===b?c.call(q,f[m],u.row,
|
|
|
|
|
u.column,m,x):c.call(q,f[m],u,m,x,l),u!==p&&e.push(u)}}return e.length||d?(a=new v(f,a?e.concat.apply([],e):e),b=a.selector,b.rows=n.rows,b.cols=n.cols,b.opts=n.opts,a):this},lastIndexOf:G.lastIndexOf||function(a,b){return this.indexOf.apply(this.toArray.reverse(),arguments)},length:0,map:function(a){var b=[];if(G.map)b=G.map.call(this,a,this);else for(var c=0,d=this.length;c<d;c++)b.push(a.call(this,this[c],c));return new v(this.context,b)},pluck:function(a){return this.map(function(b){return b[a]})},
|
|
|
|
|
pop:G.pop,push:G.push,reduce:G.reduce||function(a,b){return mb(this,a,b,0,this.length,1)},reduceRight:G.reduceRight||function(a,b){return mb(this,a,b,this.length-1,-1,-1)},reverse:G.reverse,selector:null,shift:G.shift,slice:function(){return new v(this.context,this)},sort:G.sort,splice:G.splice,toArray:function(){return G.slice.call(this)},to$:function(){return f(this)},toJQuery:function(){return f(this)},unique:function(){return new v(this.context,ta(this))},unshift:G.unshift});v.extend=function(a,
|
|
|
|
|
b,c){if(c.length&&b&&(b instanceof v||b.__dt_wrapper)){var d,e=function(a,b,c){return function(){var d=b.apply(a,arguments);v.extend(d,d,c.methodExt);return d}};var h=0;for(d=c.length;h<d;h++){var g=c[h];b[g.name]="function"===g.type?e(a,g.val,g):"object"===g.type?{}:g.val;b[g.name].__dt_wrapper=!0;v.extend(a,b[g.name],g.propExt)}}};v.register=t=function(a,b){if(f.isArray(a))for(var c=0,d=a.length;c<d;c++)v.register(a[c],b);else{d=a.split(".");var e=Wb,h;a=0;for(c=d.length;a<c;a++){var g=(h=-1!==
|
|
|
|
|
d[a].indexOf("()"))?d[a].replace("()",""):d[a];a:{var k=0;for(var l=e.length;k<l;k++)if(e[k].name===g){k=e[k];break a}k=null}k||(k={name:g,val:{},methodExt:[],propExt:[],type:"object"},e.push(k));a===c-1?(k.val=b,k.type="function"===typeof b?"function":f.isPlainObject(b)?"object":"other"):e=h?k.methodExt:k.propExt}}};v.registerPlural=x=function(a,b,c){v.register(a,c);v.register(b,function(){var a=c.apply(this,arguments);return a===this?this:a instanceof v?a.length?f.isArray(a[0])?new v(a.context,
|
|
|
|
|
a[0]):a[0]:p:a})};var fc=function(a,b){if("number"===typeof a)return[b[a]];var c=f.map(b,function(a,b){return a.nTable});return f(c).filter(a).map(function(a){a=f.inArray(this,c);return b[a]}).toArray()};t("tables()",function(a){return a?new v(fc(a,this.context)):this});t("table()",function(a){a=this.tables(a);var b=a.context;return b.length?new v(b[0]):a});x("tables().nodes()","table().node()",function(){return this.iterator("table",function(a){return a.nTable},1)});x("tables().body()","table().body()",
|
|
|
|
|
function(){return this.iterator("table",function(a){return a.nTBody},1)});x("tables().header()","table().header()",function(){return this.iterator("table",function(a){return a.nTHead},1)});x("tables().footer()","table().footer()",function(){return this.iterator("table",function(a){return a.nTFoot},1)});x("tables().containers()","table().container()",function(){return this.iterator("table",function(a){return a.nTableWrapper},1)});t("draw()",function(a){return this.iterator("table",function(b){"page"===
|
|
|
|
|
a?S(b):("string"===typeof a&&(a="full-hold"===a?!1:!0),V(b,!1===a))})});t("page()",function(a){return a===p?this.page.info().page:this.iterator("table",function(b){Xa(b,a)})});t("page.info()",function(a){if(0===this.context.length)return p;a=this.context[0];var b=a._iDisplayStart,c=a.oFeatures.bPaginate?a._iDisplayLength:-1,d=a.fnRecordsDisplay(),e=-1===c;return{page:e?0:Math.floor(b/c),pages:e?1:Math.ceil(d/c),start:b,end:a.fnDisplayEnd(),length:c,recordsTotal:a.fnRecordsTotal(),recordsDisplay:d,
|
|
|
|
|
serverSide:"ssp"===D(a)}});t("page.len()",function(a){return a===p?0!==this.context.length?this.context[0]._iDisplayLength:p:this.iterator("table",function(b){Va(b,a)})});var Xb=function(a,b,c){if(c){var d=new v(a);d.one("draw",function(){c(d.ajax.json())})}if("ssp"==D(a))V(a,b);else{K(a,!0);var e=a.jqXHR;e&&4!==e.readyState&&e.abort();va(a,[],function(c){qa(a);c=wa(a,c);for(var d=0,e=c.length;d<e;d++)R(a,c[d]);V(a,b);K(a,!1)})}};t("ajax.json()",function(){var a=this.context;if(0<a.length)return a[0].json});
|
|
|
|
|
t("ajax.params()",function(){var a=this.context;if(0<a.length)return a[0].oAjaxData});t("ajax.reload()",function(a,b){return this.iterator("table",function(c){Xb(c,!1===b,a)})});t("ajax.url()",function(a){var b=this.context;if(a===p){if(0===b.length)return p;b=b[0];return b.ajax?f.isPlainObject(b.ajax)?b.ajax.url:b.ajax:b.sAjaxSource}return this.iterator("table",function(b){f.isPlainObject(b.ajax)?b.ajax.url=a:b.ajax=a})});t("ajax.url().load()",function(a,b){return this.iterator("table",function(c){Xb(c,
|
|
|
|
|
!1===b,a)})});var eb=function(a,b,c,d,e){var h=[],g,k,l;var n=typeof b;b&&"string"!==n&&"function"!==n&&b.length!==p||(b=[b]);n=0;for(k=b.length;n<k;n++){var m=b[n]&&b[n].split&&!b[n].match(/[\[\(:]/)?b[n].split(","):[b[n]];var q=0;for(l=m.length;q<l;q++)(g=c("string"===typeof m[q]?f.trim(m[q]):m[q]))&&g.length&&(h=h.concat(g))}a=C.selector[a];if(a.length)for(n=0,k=a.length;n<k;n++)h=a[n](d,e,h);return ta(h)},fb=function(a){a||(a={});a.filter&&a.search===p&&(a.search=a.filter);return f.extend({search:"none",
|
|
|
|
|
order:"current",page:"all"},a)},gb=function(a){for(var b=0,c=a.length;b<c;b++)if(0<a[b].length)return a[0]=a[b],a[0].length=1,a.length=1,a.context=[a.context[b]],a;a.length=0;return a},Fa=function(a,b){var c=[],d=a.aiDisplay;var e=a.aiDisplayMaster;var h=b.search;var g=b.order;b=b.page;if("ssp"==D(a))return"removed"===h?[]:Z(0,e.length);if("current"==b)for(g=a._iDisplayStart,a=a.fnDisplayEnd();g<a;g++)c.push(d[g]);else if("current"==g||"applied"==g)if("none"==h)c=e.slice();else if("applied"==h)c=
|
|
|
|
|
d.slice();else{if("removed"==h){var k={};g=0;for(a=d.length;g<a;g++)k[d[g]]=null;c=f.map(e,function(a){return k.hasOwnProperty(a)?null:a})}}else if("index"==g||"original"==g)for(g=0,a=a.aoData.length;g<a;g++)"none"==h?c.push(g):(e=f.inArray(g,d),(-1===e&&"removed"==h||0<=e&&"applied"==h)&&c.push(g));return c},gc=function(a,b,c){var d;return eb("row",b,function(b){var e=Sb(b),g=a.aoData;if(null!==e&&!c)return[e];d||(d=Fa(a,c));if(null!==e&&-1!==f.inArray(e,d))return[e];if(null===b||b===p||""===b)return d;
|
|
|
|
|
if("function"===typeof b)return f.map(d,function(a){var c=g[a];return b(a,c._aData,c.nTr)?a:null});if(b.nodeName){e=b._DT_RowIndex;var k=b._DT_CellIndex;if(e!==p)return g[e]&&g[e].nTr===b?[e]:[];if(k)return g[k.row]&&g[k.row].nTr===b.parentNode?[k.row]:[];e=f(b).closest("*[data-dt-row]");return e.length?[e.data("dt-row")]:[]}if("string"===typeof b&&"#"===b.charAt(0)&&(e=a.aIds[b.replace(/^#/,"")],e!==p))return[e.idx];e=Vb(la(a.aoData,d,"nTr"));return f(e).filter(b).map(function(){return this._DT_RowIndex}).toArray()},
|
|
|
|
|
a,c)};t("rows()",function(a,b){a===p?a="":f.isPlainObject(a)&&(b=a,a="");b=fb(b);var c=this.iterator("table",function(c){return gc(c,a,b)},1);c.selector.rows=a;c.selector.opts=b;return c});t("rows().nodes()",function(){return this.iterator("row",function(a,b){return a.aoData[b].nTr||p},1)});t("rows().data()",function(){return this.iterator(!0,"rows",function(a,b){return la(a.aoData,b,"_aData")},1)});x("rows().cache()","row().cache()",function(a){return this.iterator("row",function(b,c){b=b.aoData[c];
|
|
|
|
|
return"search"===a?b._aFilterData:b._aSortData},1)});x("rows().invalidate()","row().invalidate()",function(a){return this.iterator("row",function(b,c){ea(b,c,a)})});x("rows().indexes()","row().index()",function(){return this.iterator("row",function(a,b){return b},1)});x("rows().ids()","row().id()",function(a){for(var b=[],c=this.context,d=0,e=c.length;d<e;d++)for(var h=0,g=this[d].length;h<g;h++){var f=c[d].rowIdFn(c[d].aoData[this[d][h]]._aData);b.push((!0===a?"#":"")+f)}return new v(c,b)});x("rows().remove()",
|
|
|
|
|
"row().remove()",function(){var a=this;this.iterator("row",function(b,c,d){var e=b.aoData,h=e[c],g,f;e.splice(c,1);var l=0;for(g=e.length;l<g;l++){var n=e[l];var m=n.anCells;null!==n.nTr&&(n.nTr._DT_RowIndex=l);if(null!==m)for(n=0,f=m.length;n<f;n++)m[n]._DT_CellIndex.row=l}ra(b.aiDisplayMaster,c);ra(b.aiDisplay,c);ra(a[d],c,!1);0<b._iRecordsDisplay&&b._iRecordsDisplay--;Wa(b);c=b.rowIdFn(h._aData);c!==p&&delete b.aIds[c]});this.iterator("table",function(a){for(var b=0,d=a.aoData.length;b<d;b++)a.aoData[b].idx=
|
|
|
|
|
b});return this});t("rows.add()",function(a){var b=this.iterator("table",function(b){var c,d=[];var g=0;for(c=a.length;g<c;g++){var f=a[g];f.nodeName&&"TR"===f.nodeName.toUpperCase()?d.push(pa(b,f)[0]):d.push(R(b,f))}return d},1),c=this.rows(-1);c.pop();f.merge(c,b);return c});t("row()",function(a,b){return gb(this.rows(a,b))});t("row().data()",function(a){var b=this.context;if(a===p)return b.length&&this.length?b[0].aoData[this[0]]._aData:p;var c=b[0].aoData[this[0]];c._aData=a;f.isArray(a)&&c.nTr.id&&
|
|
|
|
|
Q(b[0].rowId)(a,c.nTr.id);ea(b[0],this[0],"data");return this});t("row().node()",function(){var a=this.context;return a.length&&this.length?a[0].aoData[this[0]].nTr||null:null});t("row.add()",function(a){a instanceof f&&a.length&&(a=a[0]);var b=this.iterator("table",function(b){return a.nodeName&&"TR"===a.nodeName.toUpperCase()?pa(b,a)[0]:R(b,a)});return this.row(b[0])});var hc=function(a,b,c,d){var e=[],h=function(b,c){if(f.isArray(b)||b instanceof f)for(var d=0,g=b.length;d<g;d++)h(b[d],c);else b.nodeName&&
|
|
|
|
|
"tr"===b.nodeName.toLowerCase()?e.push(b):(d=f("<tr><td/></tr>").addClass(c),f("td",d).addClass(c).html(b)[0].colSpan=W(a),e.push(d[0]))};h(c,d);b._details&&b._details.detach();b._details=f(e);b._detailsShow&&b._details.insertAfter(b.nTr)},hb=function(a,b){var c=a.context;c.length&&(a=c[0].aoData[b!==p?b:a[0]])&&a._details&&(a._details.remove(),a._detailsShow=p,a._details=p)},Yb=function(a,b){var c=a.context;c.length&&a.length&&(a=c[0].aoData[a[0]],a._details&&((a._detailsShow=b)?a._details.insertAfter(a.nTr):
|
|
|
|
|
a._details.detach(),ic(c[0])))},ic=function(a){var b=new v(a),c=a.aoData;b.off("draw.dt.DT_details column-visibility.dt.DT_details destroy.dt.DT_details");0<J(c,"_details").length&&(b.on("draw.dt.DT_details",function(d,e){a===e&&b.rows({page:"current"}).eq(0).each(function(a){a=c[a];a._detailsShow&&a._details.insertAfter(a.nTr)})}),b.on("column-visibility.dt.DT_details",function(b,e,f,g){if(a===e)for(e=W(e),f=0,g=c.length;f<g;f++)b=c[f],b._details&&b._details.children("td[colspan]").attr("colspan",
|
|
|
|
|
e)}),b.on("destroy.dt.DT_details",function(d,e){if(a===e)for(d=0,e=c.length;d<e;d++)c[d]._details&&hb(b,d)}))};t("row().child()",function(a,b){var c=this.context;if(a===p)return c.length&&this.length?c[0].aoData[this[0]]._details:p;!0===a?this.child.show():!1===a?hb(this):c.length&&this.length&&hc(c[0],c[0].aoData[this[0]],a,b);return this});t(["row().child.show()","row().child().show()"],function(a){Yb(this,!0);return this});t(["row().child.hide()","row().child().hide()"],function(){Yb(this,!1);
|
|
|
|
|
return this});t(["row().child.remove()","row().child().remove()"],function(){hb(this);return this});t("row().child.isShown()",function(){var a=this.context;return a.length&&this.length?a[0].aoData[this[0]]._detailsShow||!1:!1});var jc=/^([^:]+):(name|visIdx|visible)$/,Zb=function(a,b,c,d,e){c=[];d=0;for(var f=e.length;d<f;d++)c.push(I(a,e[d],b));return c},kc=function(a,b,c){var d=a.aoColumns,e=J(d,"sName"),h=J(d,"nTh");return eb("column",b,function(b){var g=Sb(b);if(""===b)return Z(d.length);if(null!==
|
|
|
|
|
g)return[0<=g?g:d.length+g];if("function"===typeof b){var l=Fa(a,c);return f.map(d,function(c,d){return b(d,Zb(a,d,0,0,l),h[d])?d:null})}var n="string"===typeof b?b.match(jc):"";if(n)switch(n[2]){case "visIdx":case "visible":g=parseInt(n[1],10);if(0>g){var m=f.map(d,function(a,b){return a.bVisible?b:null});return[m[m.length+g]]}return[ba(a,g)];case "name":return f.map(e,function(a,b){return a===n[1]?b:null});default:return[]}if(b.nodeName&&b._DT_CellIndex)return[b._DT_CellIndex.column];g=f(h).filter(b).map(function(){return f.inArray(this,
|
|
|
|
|
h)}).toArray();if(g.length||!b.nodeName)return g;g=f(b).closest("*[data-dt-column]");return g.length?[g.data("dt-column")]:[]},a,c)};t("columns()",function(a,b){a===p?a="":f.isPlainObject(a)&&(b=a,a="");b=fb(b);var c=this.iterator("table",function(c){return kc(c,a,b)},1);c.selector.cols=a;c.selector.opts=b;return c});x("columns().header()","column().header()",function(a,b){return this.iterator("column",function(a,b){return a.aoColumns[b].nTh},1)});x("columns().footer()","column().footer()",function(a,
|
|
|
|
|
b){return this.iterator("column",function(a,b){return a.aoColumns[b].nTf},1)});x("columns().data()","column().data()",function(){return this.iterator("column-rows",Zb,1)});x("columns().dataSrc()","column().dataSrc()",function(){return this.iterator("column",function(a,b){return a.aoColumns[b].mData},1)});x("columns().cache()","column().cache()",function(a){return this.iterator("column-rows",function(b,c,d,e,f){return la(b.aoData,f,"search"===a?"_aFilterData":"_aSortData",c)},1)});x("columns().nodes()",
|
|
|
|
|
"column().nodes()",function(){return this.iterator("column-rows",function(a,b,c,d,e){return la(a.aoData,e,"anCells",b)},1)});x("columns().visible()","column().visible()",function(a,b){var c=this,d=this.iterator("column",function(b,c){if(a===p)return b.aoColumns[c].bVisible;var d=b.aoColumns,e=d[c],h=b.aoData,n;if(a!==p&&e.bVisible!==a){if(a){var m=f.inArray(!0,J(d,"bVisible"),c+1);d=0;for(n=h.length;d<n;d++){var q=h[d].nTr;b=h[d].anCells;q&&q.insertBefore(b[c],b[m]||null)}}else f(J(b.aoData,"anCells",
|
|
|
|
|
c)).detach();e.bVisible=a}});a!==p&&this.iterator("table",function(d){ha(d,d.aoHeader);ha(d,d.aoFooter);d.aiDisplay.length||f(d.nTBody).find("td[colspan]").attr("colspan",W(d));Ba(d);c.iterator("column",function(c,d){A(c,null,"column-visibility",[c,d,a,b])});(b===p||b)&&c.columns.adjust()});return d});x("columns().indexes()","column().index()",function(a){return this.iterator("column",function(b,c){return"visible"===a?ca(b,c):c},1)});t("columns.adjust()",function(){return this.iterator("table",function(a){aa(a)},
|
|
|
|
|
1)});t("column.index()",function(a,b){if(0!==this.context.length){var c=this.context[0];if("fromVisible"===a||"toData"===a)return ba(c,b);if("fromData"===a||"toVisible"===a)return ca(c,b)}});t("column()",function(a,b){return gb(this.columns(a,b))});var lc=function(a,b,c){var d=a.aoData,e=Fa(a,c),h=Vb(la(d,e,"anCells")),g=f([].concat.apply([],h)),k,l=a.aoColumns.length,n,m,q,u,t,v;return eb("cell",b,function(b){var c="function"===typeof b;if(null===b||b===p||c){n=[];m=0;for(q=e.length;m<q;m++)for(k=
|
|
|
|
|
e[m],u=0;u<l;u++)t={row:k,column:u},c?(v=d[k],b(t,I(a,k,u),v.anCells?v.anCells[u]:null)&&n.push(t)):n.push(t);return n}if(f.isPlainObject(b))return b.column!==p&&b.row!==p&&-1!==f.inArray(b.row,e)?[b]:[];c=g.filter(b).map(function(a,b){return{row:b._DT_CellIndex.row,column:b._DT_CellIndex.column}}).toArray();if(c.length||!b.nodeName)return c;v=f(b).closest("*[data-dt-row]");return v.length?[{row:v.data("dt-row"),column:v.data("dt-column")}]:[]},a,c)};t("cells()",function(a,b,c){f.isPlainObject(a)&&
|
|
|
|
|
(a.row===p?(c=a,a=null):(c=b,b=null));f.isPlainObject(b)&&(c=b,b=null);if(null===b||b===p)return this.iterator("table",function(b){return lc(b,a,fb(c))});var d=c?{page:c.page,order:c.order,search:c.search}:{},e=this.columns(b,d),h=this.rows(a,d),g,k,l,n;d=this.iterator("table",function(a,b){a=[];g=0;for(k=h[b].length;g<k;g++)for(l=0,n=e[b].length;l<n;l++)a.push({row:h[b][g],column:e[b][l]});return a},1);d=c&&c.selected?this.cells(d,c):d;f.extend(d.selector,{cols:b,rows:a,opts:c});return d});x("cells().nodes()",
|
|
|
|
|
"cell().node()",function(){return this.iterator("cell",function(a,b,c){return(a=a.aoData[b])&&a.anCells?a.anCells[c]:p},1)});t("cells().data()",function(){return this.iterator("cell",function(a,b,c){return I(a,b,c)},1)});x("cells().cache()","cell().cache()",function(a){a="search"===a?"_aFilterData":"_aSortData";return this.iterator("cell",function(b,c,d){return b.aoData[c][a][d]},1)});x("cells().render()","cell().render()",function(a){return this.iterator("cell",function(b,c,d){return I(b,c,d,a)},
|
|
|
|
|
1)});x("cells().indexes()","cell().index()",function(){return this.iterator("cell",function(a,b,c){return{row:b,column:c,columnVisible:ca(a,c)}},1)});x("cells().invalidate()","cell().invalidate()",function(a){return this.iterator("cell",function(b,c,d){ea(b,c,a,d)})});t("cell()",function(a,b,c){return gb(this.cells(a,b,c))});t("cell().data()",function(a){var b=this.context,c=this[0];if(a===p)return b.length&&c.length?I(b[0],c[0].row,c[0].column):p;ob(b[0],c[0].row,c[0].column,a);ea(b[0],c[0].row,
|
|
|
|
|
"data",c[0].column);return this});t("order()",function(a,b){var c=this.context;if(a===p)return 0!==c.length?c[0].aaSorting:p;"number"===typeof a?a=[[a,b]]:a.length&&!f.isArray(a[0])&&(a=Array.prototype.slice.call(arguments));return this.iterator("table",function(b){b.aaSorting=a.slice()})});t("order.listener()",function(a,b,c){return this.iterator("table",function(d){Qa(d,a,b,c)})});t("order.fixed()",function(a){if(!a){var b=this.context;b=b.length?b[0].aaSortingFixed:p;return f.isArray(b)?{pre:b}:
|
|
|
|
|
b}return this.iterator("table",function(b){b.aaSortingFixed=f.extend(!0,{},a)})});t(["columns().order()","column().order()"],function(a){var b=this;return this.iterator("table",function(c,d){var e=[];f.each(b[d],function(b,c){e.push([c,a])});c.aaSorting=e})});t("search()",function(a,b,c,d){var e=this.context;return a===p?0!==e.length?e[0].oPreviousSearch.sSearch:p:this.iterator("table",function(e){e.oFeatures.bFilter&&ia(e,f.extend({},e.oPreviousSearch,{sSearch:a+"",bRegex:null===b?!1:b,bSmart:null===
|
|
|
|
|
c?!0:c,bCaseInsensitive:null===d?!0:d}),1)})});x("columns().search()","column().search()",function(a,b,c,d){return this.iterator("column",function(e,h){var g=e.aoPreSearchCols;if(a===p)return g[h].sSearch;e.oFeatures.bFilter&&(f.extend(g[h],{sSearch:a+"",bRegex:null===b?!1:b,bSmart:null===c?!0:c,bCaseInsensitive:null===d?!0:d}),ia(e,e.oPreviousSearch,1))})});t("state()",function(){return this.context.length?this.context[0].oSavedState:null});t("state.clear()",function(){return this.iterator("table",
|
|
|
|
|
function(a){a.fnStateSaveCallback.call(a.oInstance,a,{})})});t("state.loaded()",function(){return this.context.length?this.context[0].oLoadedState:null});t("state.save()",function(){return this.iterator("table",function(a){Ba(a)})});q.versionCheck=q.fnVersionCheck=function(a){var b=q.version.split(".");a=a.split(".");for(var c,d,e=0,f=a.length;e<f;e++)if(c=parseInt(b[e],10)||0,d=parseInt(a[e],10)||0,c!==d)return c>d;return!0};q.isDataTable=q.fnIsDataTable=function(a){var b=f(a).get(0),c=!1;if(a instanceof
|
|
|
|
|
q.Api)return!0;f.each(q.settings,function(a,e){a=e.nScrollHead?f("table",e.nScrollHead)[0]:null;var d=e.nScrollFoot?f("table",e.nScrollFoot)[0]:null;if(e.nTable===b||a===b||d===b)c=!0});return c};q.tables=q.fnTables=function(a){var b=!1;f.isPlainObject(a)&&(b=a.api,a=a.visible);var c=f.map(q.settings,function(b){if(!a||a&&f(b.nTable).is(":visible"))return b.nTable});return b?new v(c):c};q.camelToHungarian=L;t("$()",function(a,b){b=this.rows(b).nodes();b=f(b);return f([].concat(b.filter(a).toArray(),
|
|
|
|
|
b.find(a).toArray()))});f.each(["on","one","off"],function(a,b){t(b+"()",function(){var a=Array.prototype.slice.call(arguments);a[0]=f.map(a[0].split(/\s/),function(a){return a.match(/\.dt\b/)?a:a+".dt"}).join(" ");var d=f(this.tables().nodes());d[b].apply(d,a);return this})});t("clear()",function(){return this.iterator("table",function(a){qa(a)})});t("settings()",function(){return new v(this.context,this.context)});t("init()",function(){var a=this.context;return a.length?a[0].oInit:null});t("data()",
|
|
|
|
|
function(){return this.iterator("table",function(a){return J(a.aoData,"_aData")}).flatten()});t("destroy()",function(a){a=a||!1;return this.iterator("table",function(b){var c=b.nTableWrapper.parentNode,d=b.oClasses,e=b.nTable,h=b.nTBody,g=b.nTHead,k=b.nTFoot,l=f(e);h=f(h);var n=f(b.nTableWrapper),m=f.map(b.aoData,function(a){return a.nTr}),p;b.bDestroying=!0;A(b,"aoDestroyCallback","destroy",[b]);a||(new v(b)).columns().visible(!0);n.off(".DT").find(":not(tbody *)").off(".DT");f(z).off(".DT-"+b.sInstance);
|
|
|
|
|
e!=g.parentNode&&(l.children("thead").detach(),l.append(g));k&&e!=k.parentNode&&(l.children("tfoot").detach(),l.append(k));b.aaSorting=[];b.aaSortingFixed=[];Aa(b);f(m).removeClass(b.asStripeClasses.join(" "));f("th, td",g).removeClass(d.sSortable+" "+d.sSortableAsc+" "+d.sSortableDesc+" "+d.sSortableNone);h.children().detach();h.append(m);g=a?"remove":"detach";l[g]();n[g]();!a&&c&&(c.insertBefore(e,b.nTableReinsertBefore),l.css("width",b.sDestroyWidth).removeClass(d.sTable),(p=b.asDestroyStripes.length)&&
|
|
|
|
|
h.children().each(function(a){f(this).addClass(b.asDestroyStripes[a%p])}));c=f.inArray(b,q.settings);-1!==c&&q.settings.splice(c,1)})});f.each(["column","row","cell"],function(a,b){t(b+"s().every()",function(a){var c=this.selector.opts,e=this;return this.iterator(b,function(d,f,k,l,n){a.call(e[b](f,"cell"===b?k:c,"cell"===b?c:p),f,k,l,n)})})});t("i18n()",function(a,b,c){var d=this.context[0];a=U(a)(d.oLanguage);a===p&&(a=b);c!==p&&f.isPlainObject(a)&&(a=a[c]!==p?a[c]:a._);return a.replace("%d",c)});
|
|
|
|
|
q.version="1.10.20";q.settings=[];q.models={};q.models.oSearch={bCaseInsensitive:!0,sSearch:"",bRegex:!1,bSmart:!0};q.models.oRow={nTr:null,anCells:null,_aData:[],_aSortData:null,_aFilterData:null,_sFilterRow:null,_sRowStripe:"",src:null,idx:-1};q.models.oColumn={idx:null,aDataSort:null,asSorting:null,bSearchable:null,bSortable:null,bVisible:null,_sManualType:null,_bAttrSrc:!1,fnCreatedCell:null,fnGetData:null,fnSetData:null,mData:null,mRender:null,nTh:null,nTf:null,sClass:null,sContentPadding:null,
|
|
|
|
|
sDefaultContent:null,sName:null,sSortDataType:"std",sSortingClass:null,sSortingClassJUI:null,sTitle:null,sType:null,sWidth:null,sWidthOrig:null};q.defaults={aaData:null,aaSorting:[[0,"asc"]],aaSortingFixed:[],ajax:null,aLengthMenu:[10,25,50,100],aoColumns:null,aoColumnDefs:null,aoSearchCols:[],asStripeClasses:null,bAutoWidth:!0,bDeferRender:!1,bDestroy:!1,bFilter:!0,bInfo:!0,bLengthChange:!0,bPaginate:!0,bProcessing:!1,bRetrieve:!1,bScrollCollapse:!1,bServerSide:!1,bSort:!0,bSortMulti:!0,bSortCellsTop:!1,
|
|
|
|
|
bSortClasses:!0,bStateSave:!1,fnCreatedRow:null,fnDrawCallback:null,fnFooterCallback:null,fnFormatNumber:function(a){return a.toString().replace(/\B(?=(\d{3})+(?!\d))/g,this.oLanguage.sThousands)},fnHeaderCallback:null,fnInfoCallback:null,fnInitComplete:null,fnPreDrawCallback:null,fnRowCallback:null,fnServerData:null,fnServerParams:null,fnStateLoadCallback:function(a){try{return JSON.parse((-1===a.iStateDuration?sessionStorage:localStorage).getItem("DataTables_"+a.sInstance+"_"+location.pathname))}catch(b){}},
|
|
|
|
|
fnStateLoadParams:null,fnStateLoaded:null,fnStateSaveCallback:function(a,b){try{(-1===a.iStateDuration?sessionStorage:localStorage).setItem("DataTables_"+a.sInstance+"_"+location.pathname,JSON.stringify(b))}catch(c){}},fnStateSaveParams:null,iStateDuration:7200,iDeferLoading:null,iDisplayLength:10,iDisplayStart:0,iTabIndex:0,oClasses:{},oLanguage:{oAria:{sSortAscending:": activate to sort column ascending",sSortDescending:": activate to sort column descending"},oPaginate:{sFirst:"First",sLast:"Last",
|
|
|
|
|
sNext:"Next",sPrevious:"Previous"},sEmptyTable:"No data available in table",sInfo:"Showing _START_ to _END_ of _TOTAL_ entries",sInfoEmpty:"Showing 0 to 0 of 0 entries",sInfoFiltered:"(filtered from _MAX_ total entries)",sInfoPostFix:"",sDecimal:"",sThousands:",",sLengthMenu:"Show _MENU_ entries",sLoadingRecords:"Loading...",sProcessing:"Processing...",sSearch:"Search:",sSearchPlaceholder:"",sUrl:"",sZeroRecords:"No matching records found"},oSearch:f.extend({},q.models.oSearch),sAjaxDataProp:"data",
|
|
|
|
|
sAjaxSource:null,sDom:"lfrtip",searchDelay:null,sPaginationType:"simple_numbers",sScrollX:"",sScrollXInner:"",sScrollY:"",sServerMethod:"GET",renderer:null,rowId:"DT_RowId"};H(q.defaults);q.defaults.column={aDataSort:null,iDataSort:-1,asSorting:["asc","desc"],bSearchable:!0,bSortable:!0,bVisible:!0,fnCreatedCell:null,mData:null,mRender:null,sCellType:"td",sClass:"",sContentPadding:"",sDefaultContent:null,sName:"",sSortDataType:"std",sTitle:null,sType:null,sWidth:null};H(q.defaults.column);q.models.oSettings=
|
|
|
|
|
{oFeatures:{bAutoWidth:null,bDeferRender:null,bFilter:null,bInfo:null,bLengthChange:null,bPaginate:null,bProcessing:null,bServerSide:null,bSort:null,bSortMulti:null,bSortClasses:null,bStateSave:null},oScroll:{bCollapse:null,iBarWidth:0,sX:null,sXInner:null,sY:null},oLanguage:{fnInfoCallback:null},oBrowser:{bScrollOversize:!1,bScrollbarLeft:!1,bBounding:!1,barWidth:0},ajax:null,aanFeatures:[],aoData:[],aiDisplay:[],aiDisplayMaster:[],aIds:{},aoColumns:[],aoHeader:[],aoFooter:[],oPreviousSearch:{},
|
|
|
|
|
aoPreSearchCols:[],aaSorting:null,aaSortingFixed:[],asStripeClasses:null,asDestroyStripes:[],sDestroyWidth:0,aoRowCallback:[],aoHeaderCallback:[],aoFooterCallback:[],aoDrawCallback:[],aoRowCreatedCallback:[],aoPreDrawCallback:[],aoInitComplete:[],aoStateSaveParams:[],aoStateLoadParams:[],aoStateLoaded:[],sTableId:"",nTable:null,nTHead:null,nTFoot:null,nTBody:null,nTableWrapper:null,bDeferLoading:!1,bInitialised:!1,aoOpenRows:[],sDom:null,searchDelay:null,sPaginationType:"two_button",iStateDuration:0,
|
|
|
|
|
aoStateSave:[],aoStateLoad:[],oSavedState:null,oLoadedState:null,sAjaxSource:null,sAjaxDataProp:null,bAjaxDataGet:!0,jqXHR:null,json:p,oAjaxData:p,fnServerData:null,aoServerParams:[],sServerMethod:null,fnFormatNumber:null,aLengthMenu:null,iDraw:0,bDrawing:!1,iDrawError:-1,_iDisplayLength:10,_iDisplayStart:0,_iRecordsTotal:0,_iRecordsDisplay:0,oClasses:{},bFiltered:!1,bSorted:!1,bSortCellsTop:null,oInit:null,aoDestroyCallback:[],fnRecordsTotal:function(){return"ssp"==D(this)?1*this._iRecordsTotal:
|
|
|
|
|
this.aiDisplayMaster.length},fnRecordsDisplay:function(){return"ssp"==D(this)?1*this._iRecordsDisplay:this.aiDisplay.length},fnDisplayEnd:function(){var a=this._iDisplayLength,b=this._iDisplayStart,c=b+a,d=this.aiDisplay.length,e=this.oFeatures,f=e.bPaginate;return e.bServerSide?!1===f||-1===a?b+d:Math.min(b+a,this._iRecordsDisplay):!f||c>d||-1===a?d:c},oInstance:null,sInstance:null,iTabIndex:0,nScrollHead:null,nScrollFoot:null,aLastSort:[],oPlugins:{},rowIdFn:null,rowId:null};q.ext=C={buttons:{},
|
|
|
|
|
classes:{},build:"bs4/dt-1.10.20/r-2.2.3",errMode:"alert",feature:[],search:[],selector:{cell:[],column:[],row:[]},internal:{},legacy:{ajax:null},pager:{},renderer:{pageButton:{},header:{}},order:{},type:{detect:[],search:{},order:{}},_unique:0,fnVersionCheck:q.fnVersionCheck,iApiIndex:0,oJUIClasses:{},sVersion:q.version};f.extend(C,{afnFiltering:C.search,aTypes:C.type.detect,ofnSearch:C.type.search,oSort:C.type.order,afnSortData:C.order,aoFeatures:C.feature,oApi:C.internal,oStdClasses:C.classes,oPagination:C.pager});
|
|
|
|
|
f.extend(q.ext.classes,{sTable:"dataTable",sNoFooter:"no-footer",sPageButton:"paginate_button",sPageButtonActive:"current",sPageButtonDisabled:"disabled",sStripeOdd:"odd",sStripeEven:"even",sRowEmpty:"dataTables_empty",sWrapper:"dataTables_wrapper",sFilter:"dataTables_filter",sInfo:"dataTables_info",sPaging:"dataTables_paginate paging_",sLength:"dataTables_length",sProcessing:"dataTables_processing",sSortAsc:"sorting_asc",sSortDesc:"sorting_desc",sSortable:"sorting",sSortableAsc:"sorting_asc_disabled",
|
|
|
|
|
sSortableDesc:"sorting_desc_disabled",sSortableNone:"sorting_disabled",sSortColumn:"sorting_",sFilterInput:"",sLengthSelect:"",sScrollWrapper:"dataTables_scroll",sScrollHead:"dataTables_scrollHead",sScrollHeadInner:"dataTables_scrollHeadInner",sScrollBody:"dataTables_scrollBody",sScrollFoot:"dataTables_scrollFoot",sScrollFootInner:"dataTables_scrollFootInner",sHeaderTH:"",sFooterTH:"",sSortJUIAsc:"",sSortJUIDesc:"",sSortJUI:"",sSortJUIAscAllowed:"",sSortJUIDescAllowed:"",sSortJUIWrapper:"",sSortIcon:"",
|
|
|
|
|
sJUIHeader:"",sJUIFooter:""});var Pb=q.ext.pager;f.extend(Pb,{simple:function(a,b){return["previous","next"]},full:function(a,b){return["first","previous","next","last"]},numbers:function(a,b){return[ka(a,b)]},simple_numbers:function(a,b){return["previous",ka(a,b),"next"]},full_numbers:function(a,b){return["first","previous",ka(a,b),"next","last"]},first_last_numbers:function(a,b){return["first",ka(a,b),"last"]},_numbers:ka,numbers_length:7});f.extend(!0,q.ext.renderer,{pageButton:{_:function(a,b,
|
|
|
|
|
c,d,e,h){var g=a.oClasses,k=a.oLanguage.oPaginate,l=a.oLanguage.oAria.paginate||{},n,m,q=0,t=function(b,d){var p,r=g.sPageButtonDisabled,u=function(b){Xa(a,b.data.action,!0)};var w=0;for(p=d.length;w<p;w++){var v=d[w];if(f.isArray(v)){var x=f("<"+(v.DT_el||"div")+"/>").appendTo(b);t(x,v)}else{n=null;m=v;x=a.iTabIndex;switch(v){case "ellipsis":b.append('<span class="ellipsis">…</span>');break;case "first":n=k.sFirst;0===e&&(x=-1,m+=" "+r);break;case "previous":n=k.sPrevious;0===e&&(x=-1,m+=
|
|
|
|
|
" "+r);break;case "next":n=k.sNext;e===h-1&&(x=-1,m+=" "+r);break;case "last":n=k.sLast;e===h-1&&(x=-1,m+=" "+r);break;default:n=v+1,m=e===v?g.sPageButtonActive:""}null!==n&&(x=f("<a>",{"class":g.sPageButton+" "+m,"aria-controls":a.sTableId,"aria-label":l[v],"data-dt-idx":q,tabindex:x,id:0===c&&"string"===typeof v?a.sTableId+"_"+v:null}).html(n).appendTo(b),$a(x,{action:v},u),q++)}}};try{var v=f(b).find(y.activeElement).data("dt-idx")}catch(mc){}t(f(b).empty(),d);v!==p&&f(b).find("[data-dt-idx="+
|
|
|
|
|
v+"]").focus()}}});f.extend(q.ext.type.detect,[function(a,b){b=b.oLanguage.sDecimal;return db(a,b)?"num"+b:null},function(a,b){if(a&&!(a instanceof Date)&&!cc.test(a))return null;b=Date.parse(a);return null!==b&&!isNaN(b)||P(a)?"date":null},function(a,b){b=b.oLanguage.sDecimal;return db(a,b,!0)?"num-fmt"+b:null},function(a,b){b=b.oLanguage.sDecimal;return Ub(a,b)?"html-num"+b:null},function(a,b){b=b.oLanguage.sDecimal;return Ub(a,b,!0)?"html-num-fmt"+b:null},function(a,b){return P(a)||"string"===
|
|
|
|
|
typeof a&&-1!==a.indexOf("<")?"html":null}]);f.extend(q.ext.type.search,{html:function(a){return P(a)?a:"string"===typeof a?a.replace(Rb," ").replace(Ea,""):""},string:function(a){return P(a)?a:"string"===typeof a?a.replace(Rb," "):a}});var Da=function(a,b,c,d){if(0!==a&&(!a||"-"===a))return-Infinity;b&&(a=Tb(a,b));a.replace&&(c&&(a=a.replace(c,"")),d&&(a=a.replace(d,"")));return 1*a};f.extend(C.type.order,{"date-pre":function(a){a=Date.parse(a);return isNaN(a)?-Infinity:a},"html-pre":function(a){return P(a)?
|
|
|
|
|
"":a.replace?a.replace(/<.*?>/g,"").toLowerCase():a+""},"string-pre":function(a){return P(a)?"":"string"===typeof a?a.toLowerCase():a.toString?a.toString():""},"string-asc":function(a,b){return a<b?-1:a>b?1:0},"string-desc":function(a,b){return a<b?1:a>b?-1:0}});Ha("");f.extend(!0,q.ext.renderer,{header:{_:function(a,b,c,d){f(a.nTable).on("order.dt.DT",function(e,f,g,k){a===f&&(e=c.idx,b.removeClass(c.sSortingClass+" "+d.sSortAsc+" "+d.sSortDesc).addClass("asc"==k[e]?d.sSortAsc:"desc"==k[e]?d.sSortDesc:
|
|
|
|
|
c.sSortingClass))})},jqueryui:function(a,b,c,d){f("<div/>").addClass(d.sSortJUIWrapper).append(b.contents()).append(f("<span/>").addClass(d.sSortIcon+" "+c.sSortingClassJUI)).appendTo(b);f(a.nTable).on("order.dt.DT",function(e,f,g,k){a===f&&(e=c.idx,b.removeClass(d.sSortAsc+" "+d.sSortDesc).addClass("asc"==k[e]?d.sSortAsc:"desc"==k[e]?d.sSortDesc:c.sSortingClass),b.find("span."+d.sSortIcon).removeClass(d.sSortJUIAsc+" "+d.sSortJUIDesc+" "+d.sSortJUI+" "+d.sSortJUIAscAllowed+" "+d.sSortJUIDescAllowed).addClass("asc"==
|
|
|
|
|
k[e]?d.sSortJUIAsc:"desc"==k[e]?d.sSortJUIDesc:c.sSortingClassJUI))})}}});var ib=function(a){return"string"===typeof a?a.replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""):a};q.render={number:function(a,b,c,d,e){return{display:function(f){if("number"!==typeof f&&"string"!==typeof f)return f;var g=0>f?"-":"",h=parseFloat(f);if(isNaN(h))return ib(f);h=h.toFixed(c);f=Math.abs(h);h=parseInt(f,10);f=c?b+(f-h).toFixed(c).substring(2):"";return g+(d||"")+h.toString().replace(/\B(?=(\d{3})+(?!\d))/g,
|
|
|
|
|
a)+f+(e||"")}}},text:function(){return{display:ib,filter:ib}}};f.extend(q.ext.internal,{_fnExternApiFunc:Qb,_fnBuildAjax:va,_fnAjaxUpdate:qb,_fnAjaxParameters:zb,_fnAjaxUpdateDraw:Ab,_fnAjaxDataSrc:wa,_fnAddColumn:Ia,_fnColumnOptions:ma,_fnAdjustColumnSizing:aa,_fnVisibleToColumnIndex:ba,_fnColumnIndexToVisible:ca,_fnVisbleColumns:W,_fnGetColumns:oa,_fnColumnTypes:Ka,_fnApplyColumnDefs:nb,_fnHungarianMap:H,_fnCamelToHungarian:L,_fnLanguageCompat:Ga,_fnBrowserDetect:lb,_fnAddData:R,_fnAddTr:pa,_fnNodeToDataIndex:function(a,
|
|
|
|
|
b){return b._DT_RowIndex!==p?b._DT_RowIndex:null},_fnNodeToColumnIndex:function(a,b,c){return f.inArray(c,a.aoData[b].anCells)},_fnGetCellData:I,_fnSetCellData:ob,_fnSplitObjNotation:Na,_fnGetObjectDataFn:U,_fnSetObjectDataFn:Q,_fnGetDataMaster:Oa,_fnClearTable:qa,_fnDeleteIndex:ra,_fnInvalidate:ea,_fnGetRowElements:Ma,_fnCreateTr:La,_fnBuildHead:pb,_fnDrawHead:ha,_fnDraw:S,_fnReDraw:V,_fnAddOptionsHtml:sb,_fnDetectHeader:fa,_fnGetUniqueThs:ua,_fnFeatureHtmlFilter:ub,_fnFilterComplete:ia,_fnFilterCustom:Db,
|
|
|
|
|
_fnFilterColumn:Cb,_fnFilter:Bb,_fnFilterCreateSearch:Ta,_fnEscapeRegex:Ua,_fnFilterData:Eb,_fnFeatureHtmlInfo:xb,_fnUpdateInfo:Hb,_fnInfoMacros:Ib,_fnInitialise:ja,_fnInitComplete:xa,_fnLengthChange:Va,_fnFeatureHtmlLength:tb,_fnFeatureHtmlPaginate:yb,_fnPageChange:Xa,_fnFeatureHtmlProcessing:vb,_fnProcessingDisplay:K,_fnFeatureHtmlTable:wb,_fnScrollDraw:na,_fnApplyToChildren:N,_fnCalculateColumnWidths:Ja,_fnThrottle:Sa,_fnConvertToWidth:Jb,_fnGetWidestNode:Kb,_fnGetMaxLenString:Lb,_fnStringToCss:B,
|
|
|
|
|
_fnSortFlatten:Y,_fnSort:rb,_fnSortAria:Nb,_fnSortListener:Za,_fnSortAttachListener:Qa,_fnSortingClasses:Aa,_fnSortData:Mb,_fnSaveState:Ba,_fnLoadState:Ob,_fnSettingsFromNode:Ca,_fnLog:O,_fnMap:M,_fnBindAction:$a,_fnCallbackReg:E,_fnCallbackFire:A,_fnLengthOverflow:Wa,_fnRenderer:Ra,_fnDataSource:D,_fnRowAttributes:Pa,_fnExtend:ab,_fnCalculateEnd:function(){}});f.fn.dataTable=q;q.$=f;f.fn.dataTableSettings=q.settings;f.fn.dataTableExt=q.ext;f.fn.DataTable=function(a){return f(this).dataTable(a).api()};
|
|
|
|
|
f.each(q,function(a,b){f.fn.DataTable[a]=b});return f.fn.dataTable});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
DataTables Bootstrap 4 integration
|
|
|
|
|
©2011-2017 SpryMedia Ltd - datatables.net/license
|
|
|
|
|
*/
|
|
|
|
|
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(a,b,c){a instanceof String&&(a=String(a));for(var e=a.length,d=0;d<e;d++){var k=a[d];if(b.call(c,k,d,a))return{i:d,v:k}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;
|
|
|
|
|
$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)};$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);
|
|
|
|
|
$jscomp.polyfill=function(a,b,c,e){if(b){c=$jscomp.global;a=a.split(".");for(e=0;e<a.length-1;e++){var d=a[e];d in c||(c[d]={});c=c[d]}a=a[a.length-1];e=c[a];b=b(e);b!=e&&null!=b&&$jscomp.defineProperty(c,a,{configurable:!0,writable:!0,value:b})}};$jscomp.polyfill("Array.prototype.find",function(a){return a?a:function(a,c){return $jscomp.findInternal(this,a,c).v}},"es6","es3");
|
|
|
|
|
(function(a){"function"===typeof define&&define.amd?define(["jquery","datatables.net"],function(b){return a(b,window,document)}):"object"===typeof exports?module.exports=function(b,c){b||(b=window);c&&c.fn.dataTable||(c=require("datatables.net")(b,c).$);return a(c,b,b.document)}:a(jQuery,window,document)})(function(a,b,c,e){var d=a.fn.dataTable;a.extend(!0,d.defaults,{dom:"<'row'<'col-sm-12 col-md-6'l><'col-sm-12 col-md-6'f>><'row'<'col-sm-12'tr>><'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>",
|
|
|
|
|
renderer:"bootstrap"});a.extend(d.ext.classes,{sWrapper:"dataTables_wrapper dt-bootstrap4",sFilterInput:"form-control form-control-sm",sLengthSelect:"custom-select custom-select-sm form-control form-control-sm",sProcessing:"dataTables_processing card",sPageButton:"paginate_button page-item"});d.ext.renderer.pageButton.bootstrap=function(b,l,v,w,m,r){var k=new d.Api(b),x=b.oClasses,n=b.oLanguage.oPaginate,y=b.oLanguage.oAria.paginate||{},g,h,t=0,u=function(c,d){var e,l=function(b){b.preventDefault();
|
|
|
|
|
a(b.currentTarget).hasClass("disabled")||k.page()==b.data.action||k.page(b.data.action).draw("page")};var q=0;for(e=d.length;q<e;q++){var f=d[q];if(a.isArray(f))u(c,f);else{h=g="";switch(f){case "ellipsis":g="…";h="disabled";break;case "first":g=n.sFirst;h=f+(0<m?"":" disabled");break;case "previous":g=n.sPrevious;h=f+(0<m?"":" disabled");break;case "next":g=n.sNext;h=f+(m<r-1?"":" disabled");break;case "last":g=n.sLast;h=f+(m<r-1?"":" disabled");break;default:g=f+1,h=m===f?"active":""}if(g){var p=
|
|
|
|
|
a("<li>",{"class":x.sPageButton+" "+h,id:0===v&&"string"===typeof f?b.sTableId+"_"+f:null}).append(a("<a>",{href:"#","aria-controls":b.sTableId,"aria-label":y[f],"data-dt-idx":t,tabindex:b.iTabIndex,"class":"page-link"}).html(g)).appendTo(c);b.oApi._fnBindAction(p,{action:f},l);t++}}}};try{var p=a(l).find(c.activeElement).data("dt-idx")}catch(z){}u(a(l).empty().html('<ul class="pagination"/>').children("ul"),w);p!==e&&a(l).find("[data-dt-idx="+p+"]").focus()};return d});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
Responsive 2.2.3
|
|
|
|
|
2014-2018 SpryMedia Ltd - datatables.net/license
|
|
|
|
|
*/
|
|
|
|
|
(function(d){"function"===typeof define&&define.amd?define(["jquery","datatables.net"],function(l){return d(l,window,document)}):"object"===typeof exports?module.exports=function(l,j){l||(l=window);if(!j||!j.fn.dataTable)j=require("datatables.net")(l,j).$;return d(j,l,l.document)}:d(jQuery,window,document)})(function(d,l,j,q){function t(a,b,c){var e=b+"-"+c;if(n[e])return n[e];for(var d=[],a=a.cell(b,c).node().childNodes,b=0,c=a.length;b<c;b++)d.push(a[b]);return n[e]=d}function r(a,b,d){var e=b+
|
|
|
|
|
"-"+d;if(n[e]){for(var a=a.cell(b,d).node(),d=n[e][0].parentNode.childNodes,b=[],f=0,g=d.length;f<g;f++)b.push(d[f]);d=0;for(f=b.length;d<f;d++)a.appendChild(b[d]);n[e]=q}}var o=d.fn.dataTable,i=function(a,b){if(!o.versionCheck||!o.versionCheck("1.10.10"))throw"DataTables Responsive requires DataTables 1.10.10 or newer";this.s={dt:new o.Api(a),columns:[],current:[]};this.s.dt.settings()[0].responsive||(b&&"string"===typeof b.details?b.details={type:b.details}:b&&!1===b.details?b.details={type:!1}:
|
|
|
|
|
b&&!0===b.details&&(b.details={type:"inline"}),this.c=d.extend(!0,{},i.defaults,o.defaults.responsive,b),a.responsive=this,this._constructor())};d.extend(i.prototype,{_constructor:function(){var a=this,b=this.s.dt,c=b.settings()[0],e=d(l).width();b.settings()[0]._responsive=this;d(l).on("resize.dtr orientationchange.dtr",o.util.throttle(function(){var b=d(l).width();b!==e&&(a._resize(),e=b)}));c.oApi._fnCallbackReg(c,"aoRowCreatedCallback",function(e){-1!==d.inArray(!1,a.s.current)&&d(">td, >th",
|
|
|
|
|
e).each(function(e){e=b.column.index("toData",e);!1===a.s.current[e]&&d(this).css("display","none")})});b.on("destroy.dtr",function(){b.off(".dtr");d(b.table().body()).off(".dtr");d(l).off("resize.dtr orientationchange.dtr");d.each(a.s.current,function(b,e){!1===e&&a._setColumnVis(b,!0)})});this.c.breakpoints.sort(function(a,b){return a.width<b.width?1:a.width>b.width?-1:0});this._classLogic();this._resizeAuto();c=this.c.details;!1!==c.type&&(a._detailsInit(),b.on("column-visibility.dtr",function(){a._timer&&
|
|
|
|
|
clearTimeout(a._timer);a._timer=setTimeout(function(){a._timer=null;a._classLogic();a._resizeAuto();a._resize();a._redrawChildren()},100)}),b.on("draw.dtr",function(){a._redrawChildren()}),d(b.table().node()).addClass("dtr-"+c.type));b.on("column-reorder.dtr",function(){a._classLogic();a._resizeAuto();a._resize()});b.on("column-sizing.dtr",function(){a._resizeAuto();a._resize()});b.on("preXhr.dtr",function(){var e=[];b.rows().every(function(){this.child.isShown()&&e.push(this.id(true))});b.one("draw.dtr",
|
|
|
|
|
function(){a._resizeAuto();a._resize();b.rows(e).every(function(){a._detailsDisplay(this,false)})})});b.on("init.dtr",function(){a._resizeAuto();a._resize();d.inArray(false,a.s.current)&&b.columns.adjust()});this._resize()},_columnsVisiblity:function(a){var b=this.s.dt,c=this.s.columns,e,f,g=c.map(function(a,b){return{columnIdx:b,priority:a.priority}}).sort(function(a,b){return a.priority!==b.priority?a.priority-b.priority:a.columnIdx-b.columnIdx}),h=d.map(c,function(e,c){return!1===b.column(c).visible()?
|
|
|
|
|
"not-visible":e.auto&&null===e.minWidth?!1:!0===e.auto?"-":-1!==d.inArray(a,e.includeIn)}),m=0;e=0;for(f=h.length;e<f;e++)!0===h[e]&&(m+=c[e].minWidth);e=b.settings()[0].oScroll;e=e.sY||e.sX?e.iBarWidth:0;m=b.table().container().offsetWidth-e-m;e=0;for(f=h.length;e<f;e++)c[e].control&&(m-=c[e].minWidth);var s=!1;e=0;for(f=g.length;e<f;e++){var k=g[e].columnIdx;"-"===h[k]&&(!c[k].control&&c[k].minWidth)&&(s||0>m-c[k].minWidth?(s=!0,h[k]=!1):h[k]=!0,m-=c[k].minWidth)}g=!1;e=0;for(f=c.length;e<f;e++)if(!c[e].control&&
|
|
|
|
|
!c[e].never&&!1===h[e]){g=!0;break}e=0;for(f=c.length;e<f;e++)c[e].control&&(h[e]=g),"not-visible"===h[e]&&(h[e]=!1);-1===d.inArray(!0,h)&&(h[0]=!0);return h},_classLogic:function(){var a=this,b=this.c.breakpoints,c=this.s.dt,e=c.columns().eq(0).map(function(a){var b=this.column(a),e=b.header().className,a=c.settings()[0].aoColumns[a].responsivePriority;a===q&&(b=d(b.header()).data("priority"),a=b!==q?1*b:1E4);return{className:e,includeIn:[],auto:!1,control:!1,never:e.match(/\bnever\b/)?!0:!1,priority:a}}),
|
|
|
|
|
f=function(a,b){var c=e[a].includeIn;-1===d.inArray(b,c)&&c.push(b)},g=function(d,c,g,k){if(g)if("max-"===g){k=a._find(c).width;c=0;for(g=b.length;c<g;c++)b[c].width<=k&&f(d,b[c].name)}else if("min-"===g){k=a._find(c).width;c=0;for(g=b.length;c<g;c++)b[c].width>=k&&f(d,b[c].name)}else{if("not-"===g){c=0;for(g=b.length;c<g;c++)-1===b[c].name.indexOf(k)&&f(d,b[c].name)}}else e[d].includeIn.push(c)};e.each(function(a,e){for(var c=a.className.split(" "),f=!1,i=0,l=c.length;i<l;i++){var j=d.trim(c[i]);
|
|
|
|
|
if("all"===j){f=!0;a.includeIn=d.map(b,function(a){return a.name});return}if("none"===j||a.never){f=!0;return}if("control"===j){f=!0;a.control=!0;return}d.each(b,function(a,b){var d=b.name.split("-"),c=j.match(RegExp("(min\\-|max\\-|not\\-)?("+d[0]+")(\\-[_a-zA-Z0-9])?"));c&&(f=!0,c[2]===d[0]&&c[3]==="-"+d[1]?g(e,b.name,c[1],c[2]+c[3]):c[2]===d[0]&&!c[3]&&g(e,b.name,c[1],c[2]))})}f||(a.auto=!0)});this.s.columns=e},_detailsDisplay:function(a,b){var c=this,e=this.s.dt,f=this.c.details;if(f&&!1!==f.type){var g=
|
|
|
|
|
f.display(a,b,function(){return f.renderer(e,a[0],c._detailsObj(a[0]))});(!0===g||!1===g)&&d(e.table().node()).triggerHandler("responsive-display.dt",[e,a,g,b])}},_detailsInit:function(){var a=this,b=this.s.dt,c=this.c.details;"inline"===c.type&&(c.target="td:first-child, th:first-child");b.on("draw.dtr",function(){a._tabIndexes()});a._tabIndexes();d(b.table().body()).on("keyup.dtr","td, th",function(a){a.keyCode===13&&d(this).data("dtr-keyboard")&&d(this).click()});var e=c.target;d(b.table().body()).on("click.dtr mousedown.dtr mouseup.dtr",
|
|
|
|
|
"string"===typeof e?e:"td, th",function(c){if(d(b.table().node()).hasClass("collapsed")&&d.inArray(d(this).closest("tr").get(0),b.rows().nodes().toArray())!==-1){if(typeof e==="number"){var g=e<0?b.columns().eq(0).length+e:e;if(b.cell(this).index().column!==g)return}g=b.row(d(this).closest("tr"));c.type==="click"?a._detailsDisplay(g,false):c.type==="mousedown"?d(this).css("outline","none"):c.type==="mouseup"&&d(this).blur().css("outline","")}})},_detailsObj:function(a){var b=this,c=this.s.dt;return d.map(this.s.columns,
|
|
|
|
|
function(e,d){if(!e.never&&!e.control)return{title:c.settings()[0].aoColumns[d].sTitle,data:c.cell(a,d).render(b.c.orthogonal),hidden:c.column(d).visible()&&!b.s.current[d],columnIndex:d,rowIndex:a}})},_find:function(a){for(var b=this.c.breakpoints,c=0,e=b.length;c<e;c++)if(b[c].name===a)return b[c]},_redrawChildren:function(){var a=this,b=this.s.dt;b.rows({page:"current"}).iterator("row",function(c,e){b.row(e);a._detailsDisplay(b.row(e),!0)})},_resize:function(){var a=this,b=this.s.dt,c=d(l).width(),
|
|
|
|
|
e=this.c.breakpoints,f=e[0].name,g=this.s.columns,h,m=this.s.current.slice();for(h=e.length-1;0<=h;h--)if(c<=e[h].width){f=e[h].name;break}var i=this._columnsVisiblity(f);this.s.current=i;e=!1;h=0;for(c=g.length;h<c;h++)if(!1===i[h]&&!g[h].never&&!g[h].control&&!1===!b.column(h).visible()){e=!0;break}d(b.table().node()).toggleClass("collapsed",e);var k=!1,j=0;b.columns().eq(0).each(function(b,c){!0===i[c]&&j++;i[c]!==m[c]&&(k=!0,a._setColumnVis(b,i[c]))});k&&(this._redrawChildren(),d(b.table().node()).trigger("responsive-resize.dt",
|
|
|
|
|
[b,this.s.current]),0===b.page.info().recordsDisplay&&d("td",b.table().body()).eq(0).attr("colspan",j))},_resizeAuto:function(){var a=this.s.dt,b=this.s.columns;if(this.c.auto&&-1!==d.inArray(!0,d.map(b,function(a){return a.auto}))){d.isEmptyObject(n)||d.each(n,function(b){b=b.split("-");r(a,1*b[0],1*b[1])});a.table().node();var c=a.table().node().cloneNode(!1),e=d(a.table().header().cloneNode(!1)).appendTo(c),f=d(a.table().body()).clone(!1,!1).empty().appendTo(c),g=a.columns().header().filter(function(b){return a.column(b).visible()}).to$().clone(!1).css("display",
|
|
|
|
|
"table-cell").css("min-width",0);d(f).append(d(a.rows({page:"current"}).nodes()).clone(!1)).find("th, td").css("display","");if(f=a.table().footer()){var f=d(f.cloneNode(!1)).appendTo(c),h=a.columns().footer().filter(function(b){return a.column(b).visible()}).to$().clone(!1).css("display","table-cell");d("<tr/>").append(h).appendTo(f)}d("<tr/>").append(g).appendTo(e);"inline"===this.c.details.type&&d(c).addClass("dtr-inline collapsed");d(c).find("[name]").removeAttr("name");d(c).css("position","relative");
|
|
|
|
|
c=d("<div/>").css({width:1,height:1,overflow:"hidden",clear:"both"}).append(c);c.insertBefore(a.table().node());g.each(function(c){c=a.column.index("fromVisible",c);b[c].minWidth=this.offsetWidth||0});c.remove()}},_setColumnVis:function(a,b){var c=this.s.dt,e=b?"":"none";d(c.column(a).header()).css("display",e);d(c.column(a).footer()).css("display",e);c.column(a).nodes().to$().css("display",e);d.isEmptyObject(n)||c.cells(null,a).indexes().each(function(a){r(c,a.row,a.column)})},_tabIndexes:function(){var a=
|
|
|
|
|
this.s.dt,b=a.cells({page:"current"}).nodes().to$(),c=a.settings()[0],e=this.c.details.target;b.filter("[data-dtr-keyboard]").removeData("[data-dtr-keyboard]");"number"===typeof e?a.cells(null,e,{page:"current"}).nodes().to$().attr("tabIndex",c.iTabIndex).data("dtr-keyboard",1):("td:first-child, th:first-child"===e&&(e=">td:first-child, >th:first-child"),d(e,a.rows({page:"current"}).nodes()).attr("tabIndex",c.iTabIndex).data("dtr-keyboard",1))}});i.breakpoints=[{name:"desktop",width:Infinity},{name:"tablet-l",
|
|
|
|
|
width:1024},{name:"tablet-p",width:768},{name:"mobile-l",width:480},{name:"mobile-p",width:320}];i.display={childRow:function(a,b,c){if(b){if(d(a.node()).hasClass("parent"))return a.child(c(),"child").show(),!0}else{if(a.child.isShown())return a.child(!1),d(a.node()).removeClass("parent"),!1;a.child(c(),"child").show();d(a.node()).addClass("parent");return!0}},childRowImmediate:function(a,b,c){if(!b&&a.child.isShown()||!a.responsive.hasHidden())return a.child(!1),d(a.node()).removeClass("parent"),
|
|
|
|
|
!1;a.child(c(),"child").show();d(a.node()).addClass("parent");return!0},modal:function(a){return function(b,c,e){if(c)d("div.dtr-modal-content").empty().append(e());else{var f=function(){g.remove();d(j).off("keypress.dtr")},g=d('<div class="dtr-modal"/>').append(d('<div class="dtr-modal-display"/>').append(d('<div class="dtr-modal-content"/>').append(e())).append(d('<div class="dtr-modal-close">×</div>').click(function(){f()}))).append(d('<div class="dtr-modal-background"/>').click(function(){f()})).appendTo("body");
|
|
|
|
|
d(j).on("keyup.dtr",function(a){27===a.keyCode&&(a.stopPropagation(),f())})}a&&a.header&&d("div.dtr-modal-content").prepend("<h2>"+a.header(b)+"</h2>")}}};var n={};i.renderer={listHiddenNodes:function(){return function(a,b,c){var e=d('<ul data-dtr-index="'+b+'" class="dtr-details"/>'),f=!1;d.each(c,function(b,c){c.hidden&&(d('<li data-dtr-index="'+c.columnIndex+'" data-dt-row="'+c.rowIndex+'" data-dt-column="'+c.columnIndex+'"><span class="dtr-title">'+c.title+"</span> </li>").append(d('<span class="dtr-data"/>').append(t(a,
|
|
|
|
|
c.rowIndex,c.columnIndex))).appendTo(e),f=!0)});return f?e:!1}},listHidden:function(){return function(a,b,c){return(a=d.map(c,function(a){return a.hidden?'<li data-dtr-index="'+a.columnIndex+'" data-dt-row="'+a.rowIndex+'" data-dt-column="'+a.columnIndex+'"><span class="dtr-title">'+a.title+'</span> <span class="dtr-data">'+a.data+"</span></li>":""}).join(""))?d('<ul data-dtr-index="'+b+'" class="dtr-details"/>').append(a):!1}},tableAll:function(a){a=d.extend({tableClass:""},a);return function(b,
|
|
|
|
|
c,e){b=d.map(e,function(a){return'<tr data-dt-row="'+a.rowIndex+'" data-dt-column="'+a.columnIndex+'"><td>'+a.title+":</td> <td>"+a.data+"</td></tr>"}).join("");return d('<table class="'+a.tableClass+' dtr-details" width="100%"/>').append(b)}}};i.defaults={breakpoints:i.breakpoints,auto:!0,details:{display:i.display.childRow,renderer:i.renderer.listHidden(),target:0,type:"inline"},orthogonal:"display"};var p=d.fn.dataTable.Api;p.register("responsive()",function(){return this});p.register("responsive.index()",
|
|
|
|
|
function(a){a=d(a);return{column:a.data("dtr-index"),row:a.parent().data("dtr-index")}});p.register("responsive.rebuild()",function(){return this.iterator("table",function(a){a._responsive&&a._responsive._classLogic()})});p.register("responsive.recalc()",function(){return this.iterator("table",function(a){a._responsive&&(a._responsive._resizeAuto(),a._responsive._resize())})});p.register("responsive.hasHidden()",function(){var a=this.context[0];return a._responsive?-1!==d.inArray(!1,a._responsive.s.current):
|
|
|
|
|
!1});p.registerPlural("columns().responsiveHidden()","column().responsiveHidden()",function(){return this.iterator("column",function(a,b){return a._responsive?a._responsive.s.current[b]:!1},1)});i.version="2.2.3";d.fn.dataTable.Responsive=i;d.fn.DataTable.Responsive=i;d(j).on("preInit.dt.dtr",function(a,b){if("dt"===a.namespace&&(d(b.nTable).hasClass("responsive")||d(b.nTable).hasClass("dt-responsive")||b.oInit.responsive||o.defaults.responsive)){var c=b.oInit.responsive;!1!==c&&new i(b,d.isPlainObject(c)?
|
|
|
|
|
c:{})}});return i});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
Bootstrap 4 integration for DataTables' Responsive
|
|
|
|
|
©2016 SpryMedia Ltd - datatables.net/license
|
|
|
|
|
*/
|
|
|
|
|
(function(c){"function"===typeof define&&define.amd?define(["jquery","datatables.net-bs4","datatables.net-responsive"],function(a){return c(a,window,document)}):"object"===typeof exports?module.exports=function(a,b){a||(a=window);if(!b||!b.fn.dataTable)b=require("datatables.net-bs4")(a,b).$;b.fn.dataTable.Responsive||require("datatables.net-responsive")(a,b);return c(b,a,a.document)}:c(jQuery,window,document)})(function(c){var a=c.fn.dataTable,b=a.Responsive.display,g=b.modal,e=c('<div class="modal fade dtr-bs-modal" role="dialog"><div class="modal-dialog" role="document"><div class="modal-content"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button></div><div class="modal-body"/></div></div></div>');
|
|
|
|
|
b.modal=function(a){return function(b,d,f){if(c.fn.modal){if(!d){if(a&&a.header){var d=e.find("div.modal-header"),h=d.find("button").detach();d.empty().append('<h4 class="modal-title">'+a.header(b)+"</h4>").append(h)}e.find("div.modal-body").empty().append(f());e.appendTo("body").modal()}}else g(b,d,f)}};return a.Responsive});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* FullCalendar v3.9.0
|
|
|
|
|
* Docs & License: https://fullcalendar.io/
|
|
|
|
|
* (c) 2018 Adam Shaw
|
|
|
|
|
*/
|
|
|
|
|
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("moment"),require("jquery")):"function"==typeof define&&define.amd?define(["moment","jquery"],e):"object"==typeof exports?exports.FullCalendar=e(require("moment"),require("jquery")):t.FullCalendar=e(t.moment,t.jQuery)}("undefined"!=typeof self?self:this,function(t,e){return function(t){function e(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=236)}([function(e,n){e.exports=t},,function(t,e){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};e.__extends=function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}},function(t,n){t.exports=e},function(t,e,n){function i(t,e){e.left&&t.css({"border-left-width":1,"margin-left":e.left-1}),e.right&&t.css({"border-right-width":1,"margin-right":e.right-1})}function r(t){t.css({"margin-left":"","margin-right":"","border-left-width":"","border-right-width":""})}function o(){ht("body").addClass("fc-not-allowed")}function s(){ht("body").removeClass("fc-not-allowed")}function a(t,e,n){var i=Math.floor(e/t.length),r=Math.floor(e-i*(t.length-1)),o=[],s=[],a=[],u=0;l(t),t.each(function(e,n){var l=e===t.length-1?r:i,d=ht(n).outerHeight(!0);d<l?(o.push(n),s.push(d),a.push(ht(n).height())):u+=d}),n&&(e-=u,i=Math.floor(e/o.length),r=Math.floor(e-i*(o.length-1))),ht(o).each(function(t,e){var n=t===o.length-1?r:i,l=s[t],u=a[t],d=n-(l-u);l<n&&ht(e).height(d)})}function l(t){t.height("")}function u(t){var e=0;return t.find("> *").each(function(t,n){var i=ht(n).outerWidth();i>e&&(e=i)}),e++,t.width(e),e}function d(t,e){var n,i=t.add(e);return i.css({position:"relative",left:-1}),n=t.outerHeight()-e.outerHeight(),i.css({position:"",left:""}),n}function c(t){var e=t.css("position"),n=t.parents().filter(function(){var t=ht(this);return/(auto|scroll)/.test(t.css("overflow")+t.css("overflow-y")+t.css("overflow-x"))}).eq(0);return"fixed"!==e&&n.length?n:ht(t[0].ownerDocument||document)}function p(t,e){var n=t.offset(),i=n.left-(e?e.left:0),r=n.top-(e?e.top:0);return{left:i,right:i+t.outerWidth(),top:r,bottom:r+t.outerHeight()}}function h(t,e){var n=t.offset(),i=g(t),r=n.left+b(t,"border-left-width")+i.left-(e?e.left:0),o=n.top+b(t,"border-top-width")+i.top-(e?e.top:0);return{left:r,right:r+t[0].clientWidth,top:o,bottom:o+t[0].clientHeight}}function f(t,e){var n=t.offset(),i=n.left+b(t,"border-left-width")+b(t,"padding-left")-(e?e.left:0),r=n.top+b(t,"border-top-width")+b(t,"padding-top")-(e?e.top:0);return{left:i,right:i+t.width(),top:r,bottom:r+t.height()}}function g(t){var e,n=t[0].offsetWidth-t[0].clientWidth,i=t[0].offsetHeight-t[0].clientHeight;return n=v(n),i=v(i),e={left:0,right:0,top:0,bottom:i},y()&&"rtl"===t.css("direction")?e.left=n:e.right=n,e}function v(t){return t=Math.max(0,t),t=Math.round(t)}function y(){return null===ft&&(ft=m()),ft}function m(){var t=ht("<div><div/></div>").css({position:"absolute",top:-1e3,left:0,border:0,padding:0,overflow:"scroll",direction:"rtl"}).appendTo("body"),e=t.children(),n=e.offset().left>t.offset().left;return t.remove(),n}function b(t,e){return parseFloat(t.css(e))||0}function w(t){return 1===t.which&&!t.ctrlKey}function D(t){var e=t.originalEvent.touches;return e&&e.length?e[0].pageX:t.pageX}function E(t){var e=t.originalEvent.touches;return e&&e.length?e[0].pageY:t.pageY}function S(t){return/^touch/.test(t.type)}function C(t){t.addClass("fc-unselectable").on("selectstart",T)}function R(t){t.removeClass("fc-unselectable").off("selectstart",T)}function T(t){t.preventDefault()}function M(t,e){var n={left:Math.max(t.left
|
|
|
|
|
mediumTimeFormat:function(t){return t.longDateFormat("LT").replace(/\s*a$/i,"a")},smallTimeFormat:function(t){return t.longDateFormat("LT").replace(":mm","(:mm)").replace(/(\Wmm)$/,"($1)").replace(/\s*a$/i,"a")},extraSmallTimeFormat:function(t){return t.longDateFormat("LT").replace(":mm","(:mm)").replace(/(\Wmm)$/,"($1)").replace(/\s*a$/i,"t")},hourFormat:function(t){return t.longDateFormat("LT").replace(":mm","").replace(/(\Wmm)$/,"").replace(/\s*a$/i,"a")},noMeridiemTimeFormat:function(t){return t.longDateFormat("LT").replace(/\s*a$/i,"")}},f={smallDayDateFormat:function(t){return t.isRTL?"D dd":"dd D"},weekFormat:function(t){return t.isRTL?"w[ "+t.weekNumberTitle+"]":"["+t.weekNumberTitle+" ]w"},smallWeekFormat:function(t){return t.isRTL?"w["+t.weekNumberTitle+"]":"["+t.weekNumberTitle+"]w"}};e.populateInstanceComputableOptions=i,e.datepickerLocale=r,e.locale=o,e.getMomentLocaleData=s,o("en",d.englishDefaults)},function(t,e,n){function i(t){return r.mergeProps(t,o)}Object.defineProperty(e,"__esModule",{value:!0});var r=n(4);e.globalDefaults={titleRangeSeparator:" – ",monthYearFormat:"MMMM YYYY",defaultTimedEventDuration:"02:00:00",defaultAllDayEventDuration:{days:1},forceEventDuration:!1,nextDayThreshold:"09:00:00",columnHeader:!0,defaultView:"month",aspectRatio:1.35,header:{left:"title",center:"",right:"today prev,next"},weekends:!0,weekNumbers:!1,weekNumberTitle:"W",weekNumberCalculation:"local",scrollTime:"06:00:00",minTime:"00:00:00",maxTime:"24:00:00",showNonCurrentDates:!0,lazyFetching:!0,startParam:"start",endParam:"end",timezoneParam:"timezone",timezone:!1,locale:null,isRTL:!1,buttonText:{prev:"prev",next:"next",prevYear:"prev year",nextYear:"next year",year:"year",today:"today",month:"month",week:"week",day:"day"},allDayText:"all-day",agendaEventMinHeight:0,theme:!1,dragOpacity:.75,dragRevertDuration:500,dragScroll:!0,unselectAuto:!0,dropAccept:"*",eventOrder:"title",eventLimit:!1,eventLimitText:"more",eventLimitClick:"popover",dayPopoverFormat:"LL",handleWindowResize:!0,windowResizeDelay:100,longPressDelay:1e3},e.englishDefaults={dayPopoverFormat:"dddd, MMMM D"},e.rtlDefaults={header:{left:"next,prev today",center:"",right:"title"},buttonIcons:{prev:"right-single-arrow",next:"left-single-arrow",prevYear:"right-double-arrow",nextYear:"left-double-arrow"},themeButtonIcons:{prev:"circle-triangle-e",next:"circle-triangle-w",nextYear:"seek-prev",prevYear:"seek-next"}};var o=["header","footer","buttonText","buttonIcons","themeButtonIcons"];e.mergeOptions=i},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),r=n(4),o=function(){function t(){}return t.extend=function(t){var e=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i.__extends(e,t),e}(this);return r.copyOwnProps(t,e.prototype),e},t.mixin=function(t){r.copyOwnProps(t,this.prototype)},t}();e.default=o},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});var i=n(3),r=n(208),o=function(){function t(t){this.source=t,this.className=[],this.miscProps={}}return t.parse=function(t,e){var n=new this(e);return!!n.applyProps(t)&&n},t.normalizeId=function(t){return String(t)},t.generateId=function(){return"_fc"+t.uuid++},t.prototype.clone=function(){var e=new this.constructor(this.source);return e.id=this.id,e.rawId=this.rawId,e.uid=this.uid,t.copyVerbatimStandardProps(this,e),e.className=this.className.slice(),e.miscProps=i.extend({},this.miscProps),e},t.prototype.hasInverseRendering=function(){return"inverse-background"===this.getRendering()},t.prototype.hasBgRendering=function(){var t=this.getRendering();return"inverse-background"===t||"background"===t},t.prototype.getRendering=function(){return null!=this.rendering?this.rendering:this.source.rendering},t.prototype.getConstraint=function(){return null!=this.constraint?this.constraint:null!=this.source.constraint?this.source.constraint:this.source.calendar.opt("eventConstraint")},t.prototype.getOverlap=function(){return null!=this.overlap?this.overlap:null!=this.source.overlap?this.source.overlap:this.source.calendar.opt("eventOverlap")},t.prototyp
|
|
|
|
|
;return a.startMs-l.startMs||l.endMs-l.startMs-(a.endMs-a.startMs)||s.isAllDay-o.isAllDay||r.compareByFieldSpecs(n.eventDef,i.eventDef,this.view.eventOrderSpecs,n.eventDef.miscProps,i.eventDef.miscProps)},t}();e.default=o},,,,,function(t,e,n){function i(t){return"en"!==t.locale()?t.clone().locale("en"):t}function r(t,e){return h(a(e).fakeFormatString,t)}function o(t,e,n,i,r){var o;return t=y.default.parseZone(t),e=y.default.parseZone(e),o=t.localeData(),n=o.longDateFormat(n)||n,s(a(n),t,e,i||" - ",r)}function s(t,e,n,i,r){var o,s,a,l=t.sameUnits,u=e.clone().stripZone(),d=n.clone().stripZone(),c=f(t.fakeFormatString,e),p=f(t.fakeFormatString,n),h="",v="",y="",m="",b="";for(o=0;o<l.length&&(!l[o]||u.isSame(d,l[o]));o++)h+=c[o];for(s=l.length-1;s>o&&(!l[s]||u.isSame(d,l[s]))&&(s-1!==o||"."!==c[s]);s--)v=c[s]+v;for(a=o;a<=s;a++)y+=c[a],m+=p[a];return(y||m)&&(b=r?m+i+y:y+i+m),g(h+b+v)}function a(t){return C[t]||(C[t]=l(t))}function l(t){var e=u(t);return{fakeFormatString:c(e),sameUnits:p(e)}}function u(t){for(var e,n=[],i=/\[([^\]]*)\]|\(([^\)]*)\)|(LTS|LT|(\w)\4*o?)|([^\w\[\(]+)/g;e=i.exec(t);)e[1]?n.push.apply(n,d(e[1])):e[2]?n.push({maybe:u(e[2])}):e[3]?n.push({token:e[3]}):e[5]&&n.push.apply(n,d(e[5]));return n}function d(t){return". "===t?["."," "]:[t]}function c(t){var e,n,i=[];for(e=0;e<t.length;e++)n=t[e],"string"==typeof n?i.push("["+n+"]"):n.token?n.token in E?i.push(b+"["+n.token+"]"):i.push(n.token):n.maybe&&i.push(w+c(n.maybe)+w);return i.join(m)}function p(t){var e,n,i,r=[];for(e=0;e<t.length;e++)n=t[e],n.token?(i=S[n.token.charAt(0)],r.push(i?i.unit:"second")):n.maybe?r.push.apply(r,p(n.maybe)):r.push(null);return r}function h(t,e){return g(f(t,e).join(""))}function f(t,e){var n,i,r=[],o=y.oldMomentFormat(e,t),s=o.split(m);for(n=0;n<s.length;n++)i=s[n],i.charAt(0)===b?r.push(E[i.substring(1)](e)):r.push(i);return r}function g(t){return t.replace(D,function(t,e){return e.match(/[1-9]/)?e:""})}function v(t){var e,n,i,r,o=u(t);for(e=0;e<o.length;e++)n=o[e],n.token&&(i=S[n.token.charAt(0)])&&(!r||i.value>r.value)&&(r=i);return r?r.unit:null}Object.defineProperty(e,"__esModule",{value:!0});var y=n(10);y.newMomentProto.format=function(){return this._fullCalendar&&arguments[0]?r(this,arguments[0]):this._ambigTime?y.oldMomentFormat(i(this),"YYYY-MM-DD"):this._ambigZone?y.oldMomentFormat(i(this),"YYYY-MM-DD[T]HH:mm:ss"):this._fullCalendar?y.oldMomentFormat(i(this)):y.oldMomentProto.format.apply(this,arguments)},y.newMomentProto.toISOString=function(){return this._ambigTime?y.oldMomentFormat(i(this),"YYYY-MM-DD"):this._ambigZone?y.oldMomentFormat(i(this),"YYYY-MM-DD[T]HH:mm:ss"):this._fullCalendar?y.oldMomentProto.toISOString.apply(i(this),arguments):y.oldMomentProto.toISOString.apply(this,arguments)};var m="\v",b="",w="",D=new RegExp(w+"([^"+w+"]*)"+w,"g"),E={t:function(t){return y.oldMomentFormat(t,"a").charAt(0)},T:function(t){return y.oldMomentFormat(t,"A").charAt(0)}},S={Y:{value:1,unit:"year"},M:{value:2,unit:"month"},W:{value:3,unit:"week"},w:{value:3,unit:"week"},D:{value:4,unit:"day"},d:{value:4,unit:"day"}};e.formatDate=r,e.formatRange=o;var C={};e.queryMostGranularFormatUnit=v},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),r=n(33),o=n(11),s=n(7),a=function(t){function e(){var e=t.call(this)||this;return e._watchers={},e._props={},e.applyGlobalWatchers(),e.constructed(),e}return i.__extends(e,t),e.watch=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];this.prototype.hasOwnProperty("_globalWatchArgs")||(this.prototype._globalWatchArgs=Object.create(this.prototype._globalWatchArgs)),this.prototype._globalWatchArgs[t]=e},e.prototype.constructed=function(){},e.prototype.applyGlobalWatchers=function(){var t,e=this._globalWatchArgs;for(t in e)this.watch.apply(this,[t].concat(e[t]))},e.prototype.has=function(t){return t in this._props},e.prototype.get=function(t){return void 0===t?this._props:this._props[t]},e.prototype.set=function(t,e){var n;"string"==typeof t?(n={},n[t]=void 0===e?null:e):n=t,this.setProps(n)},e.prototype.reset=function(t){var e,n=this._props,
|
|
|
|
|
return t.prototype.getOwnEventSegs.call(this).concat(this.popoverSegs||[])},e.prototype.renderDrag=function(t,e,n){var i;for(i=0;i<t.length;i++)this.renderHighlight(t[i].componentFootprint);if(t.length&&e&&e.component!==this)return this.helperRenderer.renderEventDraggingFootprints(t,e,n),!0},e.prototype.unrenderDrag=function(){this.unrenderHighlight(),this.helperRenderer.unrender()},e.prototype.renderEventResize=function(t,e,n){var i;for(i=0;i<t.length;i++)this.renderHighlight(t[i].componentFootprint);this.helperRenderer.renderEventResizingFootprints(t,e,n)},e.prototype.unrenderEventResize=function(){this.unrenderHighlight(),this.helperRenderer.unrender()},e.prototype.removeSegPopover=function(){this.segPopover&&this.segPopover.hide()},e.prototype.limitRows=function(t){var e,n,i=this.eventRenderer.rowStructs||[];for(e=0;e<i.length;e++)this.unlimitRow(e),!1!==(n=!!t&&("number"==typeof t?t:this.computeRowLevelLimit(e)))&&this.limitRow(e,n)},e.prototype.computeRowLevelLimit=function(t){function e(t,e){o=Math.max(o,r(e).outerHeight())}var n,i,o,s=this.rowEls.eq(t),a=s.height(),l=this.eventRenderer.rowStructs[t].tbodyEl.children();for(n=0;n<l.length;n++)if(i=l.eq(n).removeClass("fc-limited"),o=0,i.find("> td > :first-child").each(e),i.position().top+o>a)return n;return!1},e.prototype.limitRow=function(t,e){var n,i,o,s,a,l,u,d,c,p,h,f,g,v,y,m=this,b=this.eventRenderer.rowStructs[t],w=[],D=0,E=function(n){for(;D<n;)l=m.getCellSegs(t,D,e),l.length&&(c=i[e-1][D],y=m.renderMoreLink(t,D,l),v=r("<div/>").append(y),c.append(v),w.push(v[0])),D++};if(e&&e<b.segLevels.length){for(n=b.segLevels[e-1],i=b.cellMatrix,o=b.tbodyEl.children().slice(e).addClass("fc-limited").get(),s=0;s<n.length;s++){for(a=n[s],E(a.leftCol),d=[],u=0;D<=a.rightCol;)l=this.getCellSegs(t,D,e),d.push(l),u+=l.length,D++;if(u){for(c=i[e-1][a.leftCol],p=c.attr("rowspan")||1,h=[],f=0;f<d.length;f++)g=r('<td class="fc-more-cell"/>').attr("rowspan",p),l=d[f],y=this.renderMoreLink(t,a.leftCol+f,[a].concat(l)),v=r("<div/>").append(y),g.append(v),h.push(g[0]),w.push(g[0]);c.addClass("fc-limited").after(r(h)),o.push(c[0])}}E(this.colCnt),b.moreEls=r(w),b.limitedEls=r(o)}},e.prototype.unlimitRow=function(t){var e=this.eventRenderer.rowStructs[t];e.moreEls&&(e.moreEls.remove(),e.moreEls=null),e.limitedEls&&(e.limitedEls.removeClass("fc-limited"),e.limitedEls=null)},e.prototype.renderMoreLink=function(t,e,n){var i=this,o=this.view;return r('<a class="fc-more"/>').text(this.getMoreLinkText(n.length)).on("click",function(s){var a=i.opt("eventLimitClick"),l=i.getCellDate(t,e),u=r(s.currentTarget),d=i.getCellEl(t,e),c=i.getCellSegs(t,e),p=i.resliceDaySegs(c,l),h=i.resliceDaySegs(n,l);"function"==typeof a&&(a=i.publiclyTrigger("eventLimitClick",{context:o,args:[{date:l.clone(),dayEl:d,moreEl:u,segs:p,hiddenSegs:h},s,o]})),"popover"===a?i.showSegPopover(t,e,u,p):"string"==typeof a&&o.calendar.zoomTo(l,a)})},e.prototype.showSegPopover=function(t,e,n,i){var r,o,s=this,l=this.view,u=n.parent();r=1===this.rowCnt?l.el:this.rowEls.eq(t),o={className:"fc-more-popover "+l.calendar.theme.getClass("popover"),content:this.renderSegPopoverContent(t,e,i),parentEl:l.el,top:r.offset().top,autoHide:!0,viewportConstrain:this.opt("popoverViewportConstrain"),hide:function(){s.popoverSegs&&s.triggerBeforeEventSegsDestroyed(s.popoverSegs),s.segPopover.removeElement(),s.segPopover=null,s.popoverSegs=null}},this.isRTL?o.right=u.offset().left+u.outerWidth()+1:o.left=u.offset().left-1,this.segPopover=new a.default(o),this.segPopover.show(),this.bindAllSegHandlersToEl(this.segPopover.el),this.triggerAfterEventSegsRendered(i)},e.prototype.renderSegPopoverContent=function(t,e,n){var i,s=this.view,a=s.calendar.theme,l=this.getCellDate(t,e).format(this.opt("dayPopoverFormat")),u=r('<div class="fc-header '+a.getClass("popoverHeader")+'"><span class="fc-close '+a.getIconClass("close")+'"></span><span class="fc-title">'+o.htmlEscape(l)+'</span><div class="fc-clear"/></div><div class="fc-body '+a.getClass("popoverContent")+'"><div class="fc-event-container"></div></div>'),d=u.find(".fc-event-container");for(n=this.e
|
|
|
|
|
;return this.dateProfile.activeUnzonedRange.containsDate(t)?(r.push("fc-"+a.dayIDs[t.day()]),i.isDateInOtherMonth(t,this.dateProfile)&&r.push("fc-other-month"),n=i.calendar.getNow(),t.isSame(n,"day")?(r.push("fc-today"),!0!==e&&r.push(i.calendar.theme.getClass("today"))):t<n?r.push("fc-past"):r.push("fc-future")):r.push("fc-disabled-day"),r},e.prototype.formatRange=function(t,e,n,i){var r=t.end;return e&&(r=r.clone().subtract(1)),u.formatRange(t.start,r,n,i,this.isRTL)},e.prototype.currentRangeAs=function(t){return this._getDateProfile().currentUnzonedRange.as(t)},e.prototype.computeDayRange=function(t){var e=this._getCalendar(),n=e.msToUtcMoment(t.startMs,!0),i=e.msToUtcMoment(t.endMs),r=+i.time(),o=i.clone().stripTime();return r&&r>=this.nextDayThreshold&&o.add(1,"days"),o<=n&&(o=n.clone().add(1,"days")),{start:n,end:o}},e.prototype.isMultiDayRange=function(t){var e=this.computeDayRange(t);return e.end.diff(e.start,"days")>1},e.guid=0,e}(d.default);e.default=p},function(t,e,n){function i(t,e){return null==e?t:r.isFunction(e)?t.filter(e):(e+="",t.filter(function(t){return t.id==e||t._id===e}))}Object.defineProperty(e,"__esModule",{value:!0});var r=n(3),o=n(0),s=n(4),a=n(32),l=n(238),u=n(21),d=n(11),c=n(7),p=n(239),h=n(240),f=n(241),g=n(207),v=n(31),y=n(10),m=n(5),b=n(12),w=n(17),D=n(242),E=n(212),S=n(38),C=n(49),R=n(13),T=n(37),M=n(6),I=n(51),H=function(){function t(t,e){this.loadingLevel=0,this.ignoreUpdateViewSize=0,this.freezeContentHeightDepth=0,u.default.needed(),this.el=t,this.viewsByType={},this.optionsManager=new h.default(this,e),this.viewSpecManager=new f.default(this.optionsManager,this),this.initMomentInternals(),this.initCurrentDate(),this.initEventManager(),this.constraints=new g.default(this.eventManager,this),this.constructed()}return t.prototype.constructed=function(){},t.prototype.getView=function(){return this.view},t.prototype.publiclyTrigger=function(t,e){var n,i,o=this.opt(t);if(r.isPlainObject(e)?(n=e.context,i=e.args):r.isArray(e)&&(i=e),null==n&&(n=this.el[0]),i||(i=[]),this.triggerWith(t,n,i),o)return o.apply(n,i)},t.prototype.hasPublicHandlers=function(t){return this.hasHandlers(t)||this.opt(t)},t.prototype.option=function(t,e){var n;if("string"==typeof t){if(void 0===e)return this.optionsManager.get(t);n={},n[t]=e,this.optionsManager.add(n)}else"object"==typeof t&&this.optionsManager.add(t)},t.prototype.opt=function(t){return this.optionsManager.get(t)},t.prototype.instantiateView=function(t){var e=this.viewSpecManager.getViewSpec(t);if(!e)throw new Error('View type "'+t+'" is not valid');return new e.class(this,e)},t.prototype.isValidViewType=function(t){return Boolean(this.viewSpecManager.getViewSpec(t))},t.prototype.changeView=function(t,e){e&&(e.start&&e.end?this.optionsManager.recordOverrides({visibleRange:e}):this.currentDate=this.moment(e).stripZone()),this.renderView(t)},t.prototype.zoomTo=function(t,e){var n;e=e||"day",n=this.viewSpecManager.getViewSpec(e)||this.viewSpecManager.getUnitViewSpec(e),this.currentDate=t.clone(),this.renderView(n?n.type:null)},t.prototype.initCurrentDate=function(){var t=this.opt("defaultDate");this.currentDate=null!=t?this.moment(t).stripZone():this.getNow()},t.prototype.prev=function(){var t=this.view,e=t.dateProfileGenerator.buildPrev(t.get("dateProfile"));e.isValid&&(this.currentDate=e.date,this.renderView())},t.prototype.next=function(){var t=this.view,e=t.dateProfileGenerator.buildNext(t.get("dateProfile"));e.isValid&&(this.currentDate=e.date,this.renderView())},t.prototype.prevYear=function(){this.currentDate.add(-1,"years"),this.renderView()},t.prototype.nextYear=function(){this.currentDate.add(1,"years"),this.renderView()},t.prototype.today=function(){this.currentDate=this.getNow(),this.renderView()},t.prototype.gotoDate=function(t){this.currentDate=this.moment(t).stripZone(),this.renderView()},t.prototype.incrementDate=function(t){this.currentDate.add(o.duration(t)),this.renderView()},t.prototype.getDate=function(){return this.applyTimezone(this.currentDate)},t.prototype.pushLoading=function(){this.loadingLevel++||this.publiclyTrigger("loading",
|
|
|
|
|
return s.__extends(e,t),e.prototype.instantiateTimeGrid=function(){var t=new this.timeGridClass(this);return u.copyOwnProps(r,t),t},e.prototype.instantiateDayGrid=function(){var t=new this.dayGridClass(this);return u.copyOwnProps(o,t),t},e.prototype.renderSkeleton=function(){var t,e;this.el.addClass("fc-agenda-view").html(this.renderSkeletonHtml()),this.scroller.render(),t=this.scroller.el.addClass("fc-time-grid-container"),e=l('<div class="fc-time-grid" />').appendTo(t),this.el.find(".fc-body > tr > td").append(t),this.timeGrid.headContainerEl=this.el.find(".fc-head-container"),this.timeGrid.setElement(e),this.dayGrid&&(this.dayGrid.setElement(this.el.find(".fc-day-grid")),this.dayGrid.bottomCoordPadding=this.dayGrid.el.next("hr").outerHeight())},e.prototype.unrenderSkeleton=function(){this.timeGrid.removeElement(),this.dayGrid&&this.dayGrid.removeElement(),this.scroller.destroy()},e.prototype.renderSkeletonHtml=function(){var t=this.calendar.theme;return'<table class="'+t.getClass("tableGrid")+'">'+(this.opt("columnHeader")?'<thead class="fc-head"><tr><td class="fc-head-container '+t.getClass("widgetHeader")+'"> </td></tr></thead>':"")+'<tbody class="fc-body"><tr><td class="'+t.getClass("widgetContent")+'">'+(this.dayGrid?'<div class="fc-day-grid"/><hr class="fc-divider '+t.getClass("widgetHeader")+'"/>':"")+"</td></tr></tbody></table>"},e.prototype.axisStyleAttr=function(){return null!=this.axisWidth?'style="width:'+this.axisWidth+'px"':""},e.prototype.getNowIndicatorUnit=function(){return this.timeGrid.getNowIndicatorUnit()},e.prototype.updateSize=function(e,n,i){var r,o,s;if(t.prototype.updateSize.call(this,e,n,i),this.axisWidth=u.matchCellWidths(this.el.find(".fc-axis")),!this.timeGrid.colEls)return void(n||(o=this.computeScrollerHeight(e),this.scroller.setHeight(o)));var a=this.el.find(".fc-row:not(.fc-scroller *)");this.timeGrid.bottomRuleEl.hide(),this.scroller.clear(),u.uncompensateScroll(a),this.dayGrid&&(this.dayGrid.removeSegPopover(),r=this.opt("eventLimit"),r&&"number"!=typeof r&&(r=5),r&&this.dayGrid.limitRows(r)),n||(o=this.computeScrollerHeight(e),this.scroller.setHeight(o),s=this.scroller.getScrollbarWidths(),(s.left||s.right)&&(u.compensateScroll(a,s),o=this.computeScrollerHeight(e),this.scroller.setHeight(o)),this.scroller.lockOverflow(s),this.timeGrid.getTotalSlatHeight()<o&&this.timeGrid.bottomRuleEl.show())},e.prototype.computeScrollerHeight=function(t){return t-u.subtractInnerElHeight(this.el,this.scroller.el)},e.prototype.computeInitialDateScroll=function(){var t=a.duration(this.opt("scrollTime")),e=this.timeGrid.computeTimeTop(t);return e=Math.ceil(e),e&&e++,{top:e}},e.prototype.queryDateScroll=function(){return{top:this.scroller.getScrollTop()}},e.prototype.applyDateScroll=function(t){void 0!==t.top&&this.scroller.setScrollTop(t.top)},e.prototype.getHitFootprint=function(t){return t.component.getHitFootprint(t)},e.prototype.getHitEl=function(t){return t.component.getHitEl(t)},e.prototype.executeEventRender=function(t){var e,n,i={},r={};for(e in t)n=t[e],n.getEventDef().isAllDay()?i[e]=n:r[e]=n;this.timeGrid.executeEventRender(r),this.dayGrid&&this.dayGrid.executeEventRender(i)},e.prototype.renderDrag=function(t,e,n){var r=i(t),o=!1;return o=this.timeGrid.renderDrag(r.timed,e,n),this.dayGrid&&(o=this.dayGrid.renderDrag(r.allDay,e,n)||o),o},e.prototype.renderEventResize=function(t,e,n){var r=i(t);this.timeGrid.renderEventResize(r.timed,e,n),this.dayGrid&&this.dayGrid.renderEventResize(r.allDay,e,n)},e.prototype.renderSelectionFootprint=function(t){t.isAllDay?this.dayGrid&&this.dayGrid.renderSelectionFootprint(t):this.timeGrid.renderSelectionFootprint(t)},e}(c.default);e.default=f,f.prototype.timeGridClass=p.default,f.prototype.dayGridClass=h.default,r={renderHeadIntroHtml:function(){var t,e=this.view,n=e.calendar,i=n.msToUtcMoment(this.dateProfile.renderUnzonedRange.startMs,!0);return this.opt("weekNumbers")?(t=i.format(this.opt("smallWeekFormat")),'<th class="fc-axis fc-week-number '+n.theme.getClass("widgetHeader")+'" '+e.axisStyleAttr()+">"+e.buildGotoAnchorHtml({date:i,type:"week",forc
|
|
|
|
|
;delete this.eventDefsByUid[t.uid],n&&(r.removeExact(n,t),n.length||delete e[t.id],this.removeEventInstancesForDef(t))},t.prototype.getEventInstances=function(){var t,e=this.eventInstanceGroupsById,n=[];for(t in e)n.push.apply(n,e[t].eventInstances);return n},t.prototype.getEventInstancesWithId=function(t){var e=this.eventInstanceGroupsById[t];return e?e.eventInstances.slice():[]},t.prototype.getEventInstancesWithoutId=function(t){var e,n=this.eventInstanceGroupsById,i=[];for(e in n)e!==t&&i.push.apply(i,n[e].eventInstances);return i},t.prototype.addEventInstance=function(t,e){var n=this.eventInstanceGroupsById;(n[e]||(n[e]=new l.default)).eventInstances.push(t),this.tryRelease()},t.prototype.removeEventInstancesForDef=function(t){var e,n=this.eventInstanceGroupsById,i=n[t.id];i&&(e=r.removeMatching(i.eventInstances,function(e){return e.def===t}),i.eventInstances.length||delete n[t.id],e&&this.tryRelease())},t.prototype.tryRelease=function(){this.pendingCnt||(this.freezeDepth?this.stuntedReleaseCnt++:this.release())},t.prototype.release=function(){this.releaseCnt++,this.trigger("release",this.eventInstanceGroupsById)},t.prototype.whenReleased=function(){var t=this;return this.releaseCnt?o.default.resolve(this.eventInstanceGroupsById):o.default.construct(function(e){t.one("release",e)})},t.prototype.freeze=function(){this.freezeDepth++||(this.stuntedReleaseCnt=0)},t.prototype.thaw=function(){--this.freezeDepth||!this.stuntedReleaseCnt||this.pendingCnt||this.release()},t}();e.default=u,s.default.mixInto(u)},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});var i=n(3),r=n(4),o=n(7),s=function(){function t(t,e){this.isFollowing=!1,this.isHidden=!1,this.isAnimating=!1,this.options=e=e||{},this.sourceEl=t,this.parentEl=e.parentEl?i(e.parentEl):t.parent()}return t.prototype.start=function(t){this.isFollowing||(this.isFollowing=!0,this.y0=r.getEvY(t),this.x0=r.getEvX(t),this.topDelta=0,this.leftDelta=0,this.isHidden||this.updatePosition(),r.getEvIsTouch(t)?this.listenTo(i(document),"touchmove",this.handleMove):this.listenTo(i(document),"mousemove",this.handleMove))},t.prototype.stop=function(t,e){var n=this,r=this.options.revertDuration,o=function(){n.isAnimating=!1,n.removeElement(),n.top0=n.left0=null,e&&e()};this.isFollowing&&!this.isAnimating&&(this.isFollowing=!1,this.stopListeningTo(i(document)),t&&r&&!this.isHidden?(this.isAnimating=!0,this.el.animate({top:this.top0,left:this.left0},{duration:r,complete:o})):o())},t.prototype.getEl=function(){var t=this.el;return t||(t=this.el=this.sourceEl.clone().addClass(this.options.additionalClass||"").css({position:"absolute",visibility:"",display:this.isHidden?"none":"",margin:0,right:"auto",bottom:"auto",width:this.sourceEl.width(),height:this.sourceEl.height(),opacity:this.options.opacity||"",zIndex:this.options.zIndex}),t.addClass("fc-unselectable"),t.appendTo(this.parentEl)),t},t.prototype.removeElement=function(){this.el&&(this.el.remove(),this.el=null)},t.prototype.updatePosition=function(){var t,e;this.getEl(),null==this.top0&&(t=this.sourceEl.offset(),e=this.el.offsetParent().offset(),this.top0=t.top-e.top,this.left0=t.left-e.left),this.el.css({top:this.top0+this.topDelta,left:this.left0+this.leftDelta})},t.prototype.handleMove=function(t){this.topDelta=r.getEvY(t)-this.y0,this.leftDelta=r.getEvX(t)-this.x0,this.isHidden||this.updatePosition()},t.prototype.hide=function(){this.isHidden||(this.isHidden=!0,this.el&&this.el.hide())},t.prototype.show=function(){this.isHidden&&(this.isHidden=!1,this.updatePosition(),this.getEl().show())},t}();e.default=s,o.default.mixInto(s)},function(t,e,n){Object.defineProperty(e,"__esModule",{value:!0});var i=n(2),r=n(23),o=n(15),s=function(t){function e(e){var n=t.call(this,e)||this;return n.dragListener=n.buildDragListener(),n}return i.__extends(e,t),e.prototype.end=function(){this.dragListener.endInteraction()},e.prototype.bindToEl=function(t){var e=this.component,n=this.dragListener;e.bindDateHandlerToEl(t,"mousedown",function(t){e.shouldIgnoreMouse()||n.startInteraction(t)}),e.bindDateHandlerToEl(t,"touchstart",function(t
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* arrive.js
|
|
|
|
|
* v2.4.1
|
|
|
|
|
* https://github.com/uzairfarooq/arrive
|
|
|
|
|
* MIT licensed
|
|
|
|
|
*
|
|
|
|
|
* Copyright (c) 2014-2017 Uzair Farooq
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
var Arrive=function(e,t,n){"use strict";function r(e,t,n){l.addMethod(t,n,e.unbindEvent),l.addMethod(t,n,e.unbindEventWithSelectorOrCallback),l.addMethod(t,n,e.unbindEventWithSelectorAndCallback)}function i(e){e.arrive=f.bindEvent,r(f,e,"unbindArrive"),e.leave=d.bindEvent,r(d,e,"unbindLeave")}if(e.MutationObserver&&"undefined"!=typeof HTMLElement){var o=0,l=function(){var t=HTMLElement.prototype.matches||HTMLElement.prototype.webkitMatchesSelector||HTMLElement.prototype.mozMatchesSelector||HTMLElement.prototype.msMatchesSelector;return{matchesSelector:function(e,n){return e instanceof HTMLElement&&t.call(e,n)},addMethod:function(e,t,r){var i=e[t];e[t]=function(){return r.length==arguments.length?r.apply(this,arguments):"function"==typeof i?i.apply(this,arguments):n}},callCallbacks:function(e,t){t&&t.options.onceOnly&&1==t.firedElems.length&&(e=[e[0]]);for(var n,r=0;n=e[r];r++)n&&n.callback&&n.callback.call(n.elem,n.elem);t&&t.options.onceOnly&&1==t.firedElems.length&&t.me.unbindEventWithSelectorAndCallback.call(t.target,t.selector,t.callback)},checkChildNodesRecursively:function(e,t,n,r){for(var i,o=0;i=e[o];o++)n(i,t,r)&&r.push({callback:t.callback,elem:i}),i.childNodes.length>0&&l.checkChildNodesRecursively(i.childNodes,t,n,r)},mergeArrays:function(e,t){var n,r={};for(n in e)e.hasOwnProperty(n)&&(r[n]=e[n]);for(n in t)t.hasOwnProperty(n)&&(r[n]=t[n]);return r},toElementsArray:function(t){return n===t||"number"==typeof t.length&&t!==e||(t=[t]),t}}}(),c=function(){var e=function(){this._eventsBucket=[],this._beforeAdding=null,this._beforeRemoving=null};return e.prototype.addEvent=function(e,t,n,r){var i={target:e,selector:t,options:n,callback:r,firedElems:[]};return this._beforeAdding&&this._beforeAdding(i),this._eventsBucket.push(i),i},e.prototype.removeEvent=function(e){for(var t,n=this._eventsBucket.length-1;t=this._eventsBucket[n];n--)if(e(t)){this._beforeRemoving&&this._beforeRemoving(t);var r=this._eventsBucket.splice(n,1);r&&r.length&&(r[0].callback=null)}},e.prototype.beforeAdding=function(e){this._beforeAdding=e},e.prototype.beforeRemoving=function(e){this._beforeRemoving=e},e}(),a=function(t,r){var i=new c,o=this,a={fireOnAttributesModification:!1};return i.beforeAdding(function(n){var i,l=n.target;(l===e.document||l===e)&&(l=document.getElementsByTagName("html")[0]),i=new MutationObserver(function(e){r.call(this,e,n)});var c=t(n.options);i.observe(l,c),n.observer=i,n.me=o}),i.beforeRemoving(function(e){e.observer.disconnect()}),this.bindEvent=function(e,t,n){t=l.mergeArrays(a,t);for(var r=l.toElementsArray(this),o=0;o<r.length;o++)i.addEvent(r[o],e,t,n)},this.unbindEvent=function(){var e=l.toElementsArray(this);i.removeEvent(function(t){for(var r=0;r<e.length;r++)if(this===n||t.target===e[r])return!0;return!1})},this.unbindEventWithSelectorOrCallback=function(e){var t,r=l.toElementsArray(this),o=e;t="function"==typeof e?function(e){for(var t=0;t<r.length;t++)if((this===n||e.target===r[t])&&e.callback===o)return!0;return!1}:function(t){for(var i=0;i<r.length;i++)if((this===n||t.target===r[i])&&t.selector===e)return!0;return!1},i.removeEvent(t)},this.unbindEventWithSelectorAndCallback=function(e,t){var r=l.toElementsArray(this);i.removeEvent(function(i){for(var o=0;o<r.length;o++)if((this===n||i.target===r[o])&&i.selector===e&&i.callback===t)return!0;return!1})},this},s=function(){function e(e){var t={attributes:!1,childList:!0,subtree:!0};return e.fireOnAttributesModification&&(t.attributes=!0),t}function t(e,t){e.forEach(function(e){var n=e.addedNodes,i=e.target,o=[];null!==n&&n.length>0?l.checkChildNodesRecursively(n,t,r,o):"attributes"===e.type&&r(i,t,o)&&o.push({callback:t.callback,elem:i}),l.callCallbacks(o,t)})}function r(e,t){return l.matchesSelector(e,t.selector)&&(e._id===n&&(e._id=o++),-1==t.firedElems.indexOf(e._id))?(t.firedElems.push(e._id),!0):!1}var i={fireOnAttributesModification:!1,onceOnly:!1,existing:!1};f=new a(e,t);var c=f.bindEvent;return f.bindEvent=function(e,t,r){n===r?(r=t,t=i):t=l.mergeArrays(i,t);var o=l.toElementsArray(this);if(t.existing){for(var a=[],s=0;s<o.length;s++)for(var u=
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Creative Tim Modifications
|
|
|
|
|
|
|
|
|
|
Lines: 236 was changed from top: 5px to top: 50% and we added margin-top: -9px. In this way the close button will be aligned vertically
|
|
|
|
|
Line:219 - modified when the icon is set, we add the class "alert-with-icon", so there will be enough space for the icon.
|
|
|
|
|
Lines: 179/222 - class() was changed to html() so we can add the Material Design Icons
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Project: Bootstrap Notify = v3.1.5
|
|
|
|
|
* Description: Turns standard Bootstrap alerts into "Growl-like" notifications.
|
|
|
|
|
* Author: Mouse0270 aka Robert McIntosh
|
|
|
|
|
* License: MIT License
|
|
|
|
|
* Website: https://github.com/mouse0270/bootstrap-growl
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/* global define:false, require: false, jQuery:false */
|
|
|
|
|
|
|
|
|
|
(function(factory){if(typeof define==='function'&&define.amd){define(['jquery'],factory)}else if(typeof exports==='object'){factory(require('jquery'))}else{factory(jQuery)}}(function($){var defaults={element:'body',position:null,type:"info",allow_dismiss:true,allow_duplicates:true,newest_on_top:false,showProgressbar:false,placement:{from:"top",align:"right"},offset:20,spacing:10,z_index:1031,delay:5000,timer:1000,url_target:'_blank',mouse_over:null,animate:{enter:'animated fadeInDown',exit:'animated fadeOutUp'},onShow:null,onShown:null,onClose:null,onClosed:null,icon_type:'class',template:'<div data-notify="container" class="col-xs-11 col-sm-4 alert alert-{0}" role="alert"><button type="button" aria-hidden="true" class="close" data-notify="dismiss"><i class="material-icons">close</i></button><i data-notify="icon" class="material-icons"></i><span data-notify="title">{1}</span> <span data-notify="message">{2}</span><div class="progress" data-notify="progressbar"><div class="progress-bar progress-bar-{0}" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div></div><a href="{3}" target="{4}" data-notify="url"></a></div>'};String.format=function(){var str=arguments[0];for(var i=1;i<arguments.length;i++){str=str.replace(RegExp("\\{"+(i-1)+"\\}","gm"),arguments[i])}return str};function isDuplicateNotification(notification){var isDupe=false;$('[data-notify="container"]').each(function(i,el){var $el=$(el);var title=$el.find('[data-notify="title"]').text().trim();var message=$el.find('[data-notify="message"]').html().trim();var isSameTitle=title===$("<div>"+notification.settings.content.title+"</div>").html().trim();var isSameMsg=message===$("<div>"+notification.settings.content.message+"</div>").html().trim();var isSameType=$el.hasClass('alert-'+notification.settings.type);if(isSameTitle&&isSameMsg&&isSameType){isDupe=true}return!isDupe});return isDupe}function Notify(element,content,options){var contentObj={content:{message:typeof content==='object'?content.message:content,title:content.title?content.title:'',icon:content.icon?content.icon:'',url:content.url?content.url:'#',target:content.target?content.target:'-'}};options=$.extend(true,{},contentObj,options);this.settings=$.extend(true,{},defaults,options);this._defaults=defaults;if(this.settings.content.target==="-"){this.settings.content.target=this.settings.url_target}this.animations={start:'webkitAnimationStart oanimationstart MSAnimationStart animationstart',end:'webkitAnimationEnd oanimationend MSAnimationEnd animationend'};if(typeof this.settings.offset==='number'){this.settings.offset={x:this.settings.offset,y:this.settings.offset}}if(this.settings.allow_duplicates||(!this.settings.allow_duplicates&&!isDuplicateNotification(this))){this.init()}}$.extend(Notify.prototype,{init:function(){var self=this;this.buildNotify();if(this.settings.content.icon){this.setIcon()}if(this.settings.content.url!="#"){this.styleURL()}this.styleDismiss();this.placement();this.bind();this.notify={$ele:this.$ele,update:function(command,update){var commands={};if(typeof command==="string"){commands[command]=update}else{commands=command}for(var cmd in commands){switch(cmd){case"type":this.$ele.removeClass('alert-'+self.settings.type);this.$ele.find('[data-notify="progressbar"] > .progress-bar').removeClass('progress-bar-'+self.settings.type);self.settings.type=commands[cmd];this.$ele.addClass('alert-'+commands[cmd]).find('[data-notify="progressbar"] > .progress-bar').addClass('progress-bar-'+commands[cmd]);break;case"icon":var $icon=this.$ele.find('[data-notify="icon"]');if(self.settings.icon_type.toLowerCase()==='class'){$icon.html(commands[cmd])}else{if(!$icon.is('img')){$icon.find('img')}$icon.attr('src',commands[cmd])}break;case"progress":var newDelay=self.settings.delay-(self.settings.delay*(commands[cmd]/100));this.$ele.data('notify-delay',newDelay);this.$ele.find('[data-notify="progressbar"] > div').attr('aria-valuenow',commands[cmd]).css('width',commands[cmd]+'%');break;case"url":this.$ele.find('[data-notify="url"]').attr('href',commands[c
|