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.
2 lines
1.7 KiB
JavaScript
2 lines
1.7 KiB
JavaScript
/*! © SpryMedia Ltd, Jim Palmer, Michael Buehler, Mike Grier, Clint Priest, Kyle Adams, guillermo - datatables.net/license */
|
|
import DataTable from"datatables.net";function naturalSort(a,t,r){var e=/(^-?[0-9]+(\.?[0-9]*)[df]?e?[0-9]?%?$|^0x[0-9a-f]+$|[0-9]+)/gi,n=/(^[ ]*|[ ]*$)/g,l=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,o=/^0x[0-9a-f]+$/i,u=/^0/,c=/(<([^>]+)>)/gi,a=a.toString().replace(n,"")||"",t=t.toString().replace(n,"")||"",i=(r||(a=a.replace(c,""),t=t.replace(c,"")),a.replace(e,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0")),p=t.replace(e,"\0$1\0").replace(/\0$/,"").replace(/^\0/,"").split("\0"),n=parseInt(a.match(o),10)||1!==i.length&&a.match(l)&&Date.parse(a),r=parseInt(t.match(o),10)||n&&t.match(l)&&Date.parse(t)||null;if(r){if(n<r)return-1;if(r<n)return 1}for(var s=0,f=Math.max(i.length,p.length);s<f;s++){var d=!(i[s]||"").match(u)&&parseFloat(i[s])||i[s]||0,S=!(p[s]||"").match(u)&&parseFloat(p[s])||p[s]||0;if(isNaN(d)!==isNaN(S))return isNaN(d)?1:-1;if(typeof d!=typeof S&&(d+="",S+=""),d<S)return-1;if(S<d)return 1}return 0}DataTable.ext.order["natural-asc"]=function(a,t){return naturalSort(a,t,!0)},DataTable.ext.order["natural-desc"]=function(a,t){return-1*naturalSort(a,t,!0)},DataTable.ext.order["natural-nohtml-asc"]=function(a,t){return naturalSort(a,t,!1)},DataTable.ext.order["natural-nohtml-asc"]=function(a,t){return-1*naturalSort(a,t,!1)},DataTable.ext.order["natural-ci-asc"]=function(a,t){return naturalSort(a=a.toString().toLowerCase(),t=t.toString().toLowerCase(),!0)},DataTable.ext.order["natural-ci-asc"]=function(a,t){return-1*naturalSort(a=a.toString().toLowerCase(),t=t.toString().toLowerCase(),!0)};export default DataTable; |