You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Plugins/sorting/absolute.min.mjs

2 lines
1.4 KiB
JavaScript

/*! © SpryMedia Ltd - datatables.net/license */
import $ from"jquery";import DataTable from"datatables.net";var _unique=0,_setup=function(a){Array.isArray(a)||(a=[a]);for(var o={name:"absoluteOrder"+_unique++,alwaysTop:{},alwaysBottom:{},asc:function(a,t,e){},desc:function(a,t,e){}},t=0,e=a.length;t<e;t++){var r=a[t];"string"==typeof r?o.alwaysTop[r]=!0:void 0===r.position||"top"===r.position?o.alwaysTop[r.value]=!0:o.alwaysBottom[r.value]=!0}return o.asc=function(a,t,e){return o.alwaysTop[a]&&o.alwaysTop[t]||o.alwaysBottom[a]&&o.alwaysBottom[t]?0:o.alwaysTop[a]||o.alwaysBottom[t]?-1:o.alwaysBottom[a]||o.alwaysTop[t]?1:(e&&("string"==typeof a&&(a=+a.replace(/[^\d\-\.]/g,"")),"string"==typeof t)&&(t=+t.replace(/[^\d\-\.]/g,"")),a<t?-1:t<a?1:0)},o.desc=function(a,t,e){return o.alwaysTop[a]&&o.alwaysTop[t]||o.alwaysBottom[a]&&o.alwaysBottom[t]?0:o.alwaysTop[a]||o.alwaysBottom[t]?-1:o.alwaysBottom[a]||o.alwaysTop[t]||(e&&("string"==typeof a&&(a=+a.replace(/[^\d\-\.]/g,"")),"string"==typeof t)&&(t=+t.replace(/[^\d\-\.]/g,"")),a<t)?1:t<a?-1:0},o};DataTable.absoluteOrder=function(a){a=_setup(a);return DataTable.ext.type.order[a.name+"-asc"]=a.asc,DataTable.ext.type.order[a.name+"-desc"]=a.desc,a.name},DataTable.absoluteOrderNumber=function(a){var e=_setup(a);return DataTable.ext.type.order[e.name+"-asc"]=function(a,t){return e.asc(a,t,!0)},DataTable.ext.type.order[e.name+"-desc"]=function(a,t){return e.desc(a,t,!0)},e.name};export default DataTable;