template.js.base.jquery.fmatter.min.js Maven / Gradle / Ivy
'use strict';(function(d){"function"===typeof define&&define.amd?define(["jquery","./grid.base"],function(n){return d(n)}):"object"===typeof module&&module.exports?module.exports=function(n,r){n||(n=window);void 0===r&&(r="undefined"!==typeof window?require("jquery"):require("jquery")(n));require("./grid.base");d(r);return r}:d(jQuery)})(function(d){d.jgrid=d.jgrid||{};var n=d.jgrid,r=n.getMethod("getGridRes"),w=d.fn.jqGrid;d.fmatter=d.fmatter||{};var q=d.fmatter,x=function(a,b){var c=a.formatoptions||
{};return c.hasOwnProperty(b)?c[b]:(a.editoptions||{})[b]},u=function(a){return String(a).replace(/\'/g,"\x26#39;")},z=function(a){var b=a.colModel||a.cm,c,d;d=!1!==b.title?" title\x3d'"+u(a.colName||b.name)+"'":"";a=x(b,"checkedClass");var e=x(b,"uncheckedClass"),g=x(b,"value"),h="string"===typeof g?g.split(":")[0]||"Yes":"Yes",g="string"===typeof g?g.split(":")[1]||"No":"No";c=x(b,"disabled");void 0===c&&(c=n.formatter.checkbox.disabled);var b=w.getIconRes.call(this,"checkbox.checked"),m=w.getIconRes.call(this,
"checkbox.checkedClasses"),l=w.getIconRes.call(this,"checkbox.unchecked");!0===c&&(a||e||b||l)?(c="\x3ci class\x3d'"+u(a||b)+"'"+d+"\x3e\x3c/i\x3e",d="\x3ci class\x3d'"+u(e||l)+"'"+d+"\x3e\x3c/i\x3e",a=m?m:a||b):(a="",d+=!0===c?" disabled\x3d'disabled'":"",c="\x3cinput type\x3d'checkbox' checked\x3d'checked'"+d+" /\x3e",d="\x3cinput type\x3d'checkbox'"+d+" /\x3e");return{checkedClasses:a,checked:c,unchecked:d,yes:h,no:g}},D={1:1,x:1,"true":1,yes:1,y:1,on:1},F={0:1,"false":1,no:1,n:1,off:1};d.extend(!0,
n,{formatter:{date:{parseRe:/[#%\\\/:_;.,\t\s\-]/,masks:{ISO8601Long:"Y-m-d H:i:s",ISO8601Short:"Y-m-d",SortableDateTime:"Y-m-d\\TH:i:s",UniversalSortableDateTime:"Y-m-d H:i:sO"},reformatAfterEdit:!0,userLocalTime:!1},baseLinkUrl:"",showAction:"",target:"",checkbox:{disabled:!0,defaultValue:!1},idName:"id"},cmTemplate:{integerStr:{formatter:"integer",align:"right",sorttype:"integer",searchoptions:{sopt:"eq ne lt le gt ge".split(" ")}},integer:{formatter:"integer",align:"right",sorttype:"integer",
convertOnSave:function(a){a=a.newValue;return isNaN(a)?a:parseInt(a,10)},searchoptions:{sopt:"eq ne lt le gt ge".split(" ")}},numberStr:{formatter:"number",align:"right",sorttype:"number",searchoptions:{sopt:"eq ne lt le gt ge".split(" ")}},number:{formatter:"number",align:"right",sorttype:"number",convertOnSave:function(a){a=a.newValue;return isNaN(a)?a:parseFloat(a)},searchoptions:{sopt:"eq ne lt le gt ge".split(" ")}},booleanCheckbox:{align:"center",formatter:"checkbox",sorttype:"boolean",edittype:"checkbox",
editoptions:{value:"true:false",defaultValue:"false"},convertOnSave:function(a){var b=a.newValue;a=z.call(this,a);var c=String(b).toLowerCase();if(D[c]||c===a.yes.toLowerCase())b=!0;else if(F[c]||c===a.no.toLowerCase())b=!1;return b},stype:"checkbox",searchoptions:{sopt:["eq"],value:"true:false"}},actions:function(){return{formatter:"actions",width:(null!=this.p&&(w.isInCommonIconClass.call(this,"fa")||w.isInCommonIconClass.call(this,"glyphicon"))?d(this).jqGrid("isBootstrapGuiStyle")?45:39:40)+(n.cellWidth()?
5:0),align:"center",label:"",autoResizable:!1,title:!1,frozen:!0,fixed:!0,hidedlg:!0,resizable:!1,sortable:!1,search:!1,editable:!1,viewable:!1}}}});n.cmTemplate.booleanCheckboxFa=n.cmTemplate.booleanCheckbox;d.extend(q,{isObject:function(a){return a&&("object"===typeof a||d.isFunction(a))||!1},isNumber:function(a){return"number"===typeof a&&isFinite(a)},isValue:function(a){return this.isObject(a)||"string"===typeof a||this.isNumber(a)||"boolean"===typeof a},isEmpty:function(a){if("string"!==typeof a&&
this.isValue(a))return!1;if(!this.isValue(a))return!0;a=d.trim(a).replace(/ /ig,"").replace(/ /ig,"");return""===a},NumberFormat:function(a,b){var c=q.isNumber;c(a)||(a*=1);if(c(a)){var d=0>a,e=String(a),g=b.decimalSeparator||".";if(c(b.decimalPlaces)&&(c=b.decimalPlaces,e=String(Number(Math.round(a+"e"+c)+"e-"+c)),a=e.lastIndexOf("."),0a?(e+=g,a=e.length-1):"."!==g&&(e=e.replace(".",g));e.length-1-ad.inArray(e,m.selarrrow)?h.jqGrid("setSelection",e,!0,a):n.fullBoolFeedback.call(g,"onSelectRow","jqGridSelectRow",e,!0,a);switch(b){case "edit":h.jqGrid("editRow",e,f);break;case "save":h.jqGrid("saveRow",e,f);break;case "cancel":h.jqGrid("restoreRow",e,c.afterRestore);break;case "del":c.delOptions=c.delOptions||{};void 0===c.delOptions.top&&(c.delOptions.top=l);h.jqGrid("delGridRow",e,c.delOptions);break;case "formedit":c.editOptions=
c.editOptions||{};void 0===c.editOptions.top&&(c.editOptions.top=l,c.editOptions.recreateForm=!0);h.jqGrid("editGridRow",e,c.editOptions);break;default:if(null!=c.custom&&0
© 2015 - 2025 Weber Informatics LLC | Privacy Policy