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.
 
 
 
 
 
 

8 lines
2.2 KiB

/*
YUI 3.17.2 (build 9c3c78e)
Copyright 2014 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/
YUI.add("datatable-formatters",function(e,t){var n=e.Lang,r=n.isValue,i=e.Escape.html,s=e.ClassNameManager.getClassName,o=function(e){return s("datatable",e)},u=function(e,t){return r(e)?i(e.toString()):t||""},a={button:function(e){var t=o("button"),n="<button>"+(e.buttonLabel||"Click")+"</button>";return e.allowHTML=!0,function(e){return e.className=t,n}},"boolean":function(e){var t=e.booleanLabels||this.get("booleanLabels")||{"true":"true","false":"false"};return function(e){var n=e.value;return!n&&n!==!1?n:(n=n?"true":"false",e.className=o(n),t[n])}},currency:function(t){var n=o("currency"),r=t.currencyFormat||this.get("currencyFormat"),i=e.Number.format;return function(e){e.className=n;var t=parseFloat(e.value);return!t&&t!==0?e.value:i(t,r)}},_date:function(t){var n=o("date"),r=e.Date.format;return t={format:t},function(e){return e.className=n,r(e.value,t)}},date:function(e){return a._date(e.dateFormat||this.get("dateFormat"))},localDate:function(){return a._date("%x")},localTime:function(){return a._date("%X")},localDateTime:function(){return a._date("%c")},email:function(e){var t=o("email"),n=e.linkFrom,r=e.emptyCellValue,i=(this.getColumn(n)||{}).emptyCellValue;return e.allowHTML=!0,function(e){var s=u(e.value,r),o=n?u(e.data[n],i):s;return e.className=t,o?'<a href="mailto:'+o+'">'+s+"</a>":s}},link:function(e){var t=o("link"),n=e.linkFrom,r=e.emptyCellValue,i=(this.getColumn(n)||{}).emptyCellValue;return e.allowHTML=!0,function(e){var s=u(e.value,r),o=n?u(e.data[n],i):s;return e.className=t,o?'<a href="'+o+'">'+s+"</a>":s}},number:function(t){var n=o("number"),r=t.numberFormat||this.get("numberFormat"),i=e.Number.format;return function(e){e.className=n;var t=parseFloat(e.value);return!t&&t!==0?e.value:i(t,r)}},lookup:function(e){var t=o("lookup"),r=e.lookupTable||{},i,s,u;if(n.isArray(r)){i=r,r={};for(s=0,u=i.length;s<u;++s)r[i[s].value]=i[s].text}return function(e){return e.className=t,r[e.value]}}};e.mix(e.DataTable.BodyView.Formatters,a)},"3.17.2",{requires:["datatable-body","datatype-number-format","datatype-date-format","escape"]});