// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://@sbaseurl@/jsapi/jsapi/esri/copyright.txt and http://www.arcgis.com/apps/webappbuilder/copyright.txt for details.

//>>built
require({cache:{"url:jimu/dijit/_filter/EditTable.html":'\x3cdiv\x3e\r\n    \x3cdiv class\x3d"jimu-multiple-set-container"\x3e\r\n      \x3cdiv data-dojo-attach-point\x3d"" class\x3d"items-list-content items-list-header"  \x3e\r\n        \x3cdiv class\x3d"item"\x3e\r\n          \x3cdiv class\x3d"label jimu-ellipsis" title\x3d"${Nls.value}"\x3e${Nls.value}\x3c/div\x3e\r\n          \x3cdiv class\x3d"label jimu-ellipsis" title\x3d"${CommonNls.label}"\x3e${CommonNls.label}\x3c/div\x3e\r\n          \x3cdiv class\x3d"label checkboxHeader jimu-ellipsis" title\x3d"${CommonNls.defaults}"\x3e${CommonNls.defaults}\x3c/div\x3e\r\n          \x3cdiv class\x3d"label lableR jimu-ellipsis" title\x3d"${CommonNls.actions}"\x3e${CommonNls.actions}\x3c/div\x3e\r\n        \x3c/div\x3e\r\n      \x3c/div\x3e\r\n      \x3cdiv data-dojo-attach-point\x3d"listContent" class\x3d"items-list-content" data-dojo-attach-event\x3d"click:_onListContentClicked, dblclick:_onListContentDblClicked"\x3e\r\n      \x3c/div\x3e\r\n    \x3c/div\x3e\r\n  \x3c/div\x3e'}});
define("dojo/_base/lang dojo/_base/html dojo/Evented dojo/on dojo/keys dojo/dom-attr dojo/_base/declare dijit/_WidgetBase dojo/query dijit/form/ValidationTextBox dijit/form/NumberTextBox dijit/_TemplatedMixin dijit/_WidgetsInTemplateMixin dojo/text!./EditTable.html jimu/utils".split(" "),function(p,c,t,r,u,q,v,w,m,x,y,z,A,B,n){return v([w,z,A,t],{templateString:B,currentItem:null,dataList:[],codedValues:null,isNumberField:!0,tableType:"unique",postMixInProperties:function(){this.inherited(arguments);
this.CommonNls=window.jimuNls.common;this.Nls=window.jimuNls.filterBuilder},postCreate:function(){this.inherited(arguments);c.addClass(this.domNode,"jimu-filter-mutcheck-list-value-provider");"unique"===this.tableType?(this.inputType="radio",c.addClass(this.listContent,"radio-items-list-content")):this.inputType="checkbox"},_onListContentDblClicked:function(a){this.isSearch=!1;var b=a.target||a.srcElement,d=n.getAncestorDom(b,function(e){return c.hasClass(e,"item")},3);if(d&&(c.hasClass(b,"name")||
c.hasClass(b,"alias"))&&(!c.hasClass(d,"empty")||!c.hasClass(b,"name"))){this._dijit?(this.editState="active",this.updateInputDivPre=this.updateInputDiv,this._dijitPre=this._dijit):this.editState="negative";a=this._getNodeText(b);var f=decodeURIComponent(c.getAttr(b,"data"));d=c.hasClass(d,"custom");this.placeHolder=c.hasClass(b,"name")&&!this.codedValues?f:a;d?c.hasClass(b,"alias")&&this.placeHolder!==this.customLabel?this.currentLabel=a:this.currentLabel=NaN:this.currentLabel=this.isNumberField&&
c.hasClass(b,"name")&&!this.codedValues?parseFloat(this.placeHolder):this.placeHolder;q.set(b,"innerHTML","");a="";c.hasClass(b,"name")&&(a='\x3cdiv class\x3d"searchBtn"\x3e\x3cdiv class\x3d"jimu-icon jimu-icon-down-arrow-8"\x3e\x3c/div\x3e\x3c/div\x3e');this.updateInputDiv=c.create("div",{"class":"updateInputDiv",innerHTML:'\x3cdiv class\x3d"inputDiv"\x3e\x3c/div\x3e'+a},b);a=m(".inputDiv",this.updateInputDiv)[0];this.searchBtn=m(".searchBtn",this.updateInputDiv)[0];this.own(r(this.updateInputDiv,
"dblclick",p.hitch(this,function(e){e.stopPropagation();e.preventDefault()})));f={required:!1,intermediateChanges:!1,value:this.currentLabel};this.codedValues&&c.hasClass(b,"name")&&(f.disabled=!0);this.isNumberField&&c.hasClass(b,"name")?(f.constraints={pattern:"#####0.##########"},this._dijit=new y(f)):(f.trim=!0,this._dijit=new x(f));this._dijit.startup();this._dijit.on("keydown",function(e){(e.keyCode||e.which)===u.ENTER&&this._dijit.emit("blur")}.bind(this));this._dijit.on("blur",p.hitch(this,
function(){if(this._dijit){var e="Error"!==this._dijit.state?this._dijit.displayedValue:this.currentLabel;this.isNumberField&&c.hasClass(b,"name")&&"Error"===this._dijit.state&&this._dijit.setValue(parseFloat(e));e=n.sanitizeHTML(e);var l=this._dijit.get("value");""!==l&&l?c.hasClass(b,"name")&&(this.placeHolder===this.customValue||"NaN"===this.placeHolder&&""!==this._dijit.displayedValue)&&(l=n.getAncestorDom(this._dijit.domNode,function(g){return c.hasClass(g,"item")},4),c.removeClass(l,"custom"),
this.emit("editTable_itemChanged")):e=this.placeHolder;this.newLabel=e;setTimeout(p.hitch(this,function(){if(this.isSearch||"active"===this.editState)"active"===this.editState&&(g=this.updateInputDivPre.parentNode,k=decodeURIComponent(c.getAttr(g,"data")),c.hasClass(g,"name")?this.currentValLabel=""===this._dijitPre.displayedValue?k===this.customValue?this.customValue:this.isNumberField?this._getLocalNumber(k):k:this.isNumberField?this._getLocalNumber(this._dijitPre.value):this._dijitPre.value:this.currentValLabel=
""===this._dijitPre.displayedValue?k===this.customLabel?this.customLabel:k:this._dijitPre.displayedValue,!c.hasClass(g,"name")||"NaN"===this.newLabel||this.newLabel===this.customValue||this._getNodeText(g.nextSibling)!==this.customLabel&&this._dijit.value!==this.customLabel||(c.isDescendant(this.updateInputDiv,g.nextSibling)?this._dijit.set("value",this.currentValLabel):(h=this.isNumberField?this.currentValLabel:this.newLabel,c.setAttr(g.nextSibling,"data",encodeURIComponent(h)),this._setNodeText(g.nextSibling,
h),c.setAttr(g.nextSibling,"title",h))),h=c.hasClass(g,"name")?""===this._dijitPre.displayedValue?k===this.customValue?this.customValue:k:this._dijitPre.value:this.newLabel,c.setAttr(g,"data",encodeURIComponent(h)),h=c.hasClass(g,"name")?this.currentValLabel:this.newLabel,this._setNodeText(g,h),c.setAttr(g,"title",h),this._dijitPre=this.updateInputDivPre=null,this.editState="negative");else{var g=this.updateInputDiv.parentNode;var k=decodeURIComponent(c.getAttr(g,"data"));c.hasClass(g,"name")?this.currentValLabel=
""===this._dijit.displayedValue?k===this.customValue?this.customValue:this.isNumberField?this._getLocalNumber(k):k:this.isNumberField?this._getLocalNumber(this._dijit.value):this._dijit.value:this.currentValLabel=""===this._dijit.displayedValue?k===this.customLabel?this.customLabel:k:this._dijit.displayedValue;if(c.hasClass(g,"name")&&"NaN"!==this.newLabel&&this.newLabel!==this.customValue&&this._getNodeText(g.nextSibling)===this.customLabel){var h=this.isNumberField?this.currentValLabel:this.newLabel;
c.setAttr(g.nextSibling,"data",encodeURIComponent(h));this._setNodeText(g.nextSibling,h);c.setAttr(g.nextSibling,"title",h)}h=c.hasClass(g,"name")?""===this._dijit.displayedValue?k===this.customValue?this.customValue:k:this._dijit.value:this.newLabel;c.setAttr(g,"data",encodeURIComponent(h));h=c.hasClass(g,"name")?this.currentValLabel:this.newLabel;this._setNodeText(g,h);c.setAttr(g,"title",h);this._dijit=null;this.isSearch=!1}}),300);this.placeHolder=""}}));c.setStyle(this._dijit.domNode,"width",
"100%");this._dijit.placeAt(a);m("input",this._dijit.domNode)[1].focus();this.searchBtn&&(this.own(r(this.searchBtn,"click",p.hitch(this,function(e){this.isSearch||(this.isSearch=!0,this.searchTarget=e.target||e.srcElement,this.emit("editTable_openListSelectByName",this.newLabel),e.stopPropagation(),e.preventDefault())}))),this.codedValues&&this.searchBtn.click())}},_getLocalNumber:function(a){"string"===typeof a&&(a=parseFloat(a));this.emit("editTable_getValLabelsArrayForNumber",!0,[a]);return this.currentValLabel},
_setNewLabel:function(a,b){if(void 0===a&&void 0===b)if(""!==this._dijit.displayedValue)this.codedValues?(b=this._dijit.displayedValue,a=this._getCodeFromCodevalueLabel(b)):(b=a=this._dijit.value,this.isNumberField&&this.newLabel!==this.customValue&&(b=this._getLocalNumber(a)));else if(a=b=this.customValue,this.updateInputDiv&&this.updateInputDiv.parentNode){var d=this.updateInputDiv.parentNode;d=decodeURIComponent(c.getAttr(d,"data"));d!==this.customValue&&(a=this.isNumberField?parseFloat(d):d,b=
this.codedValues?this._getLabelFromCodevalue(a):this.isNumberField?this._getLocalNumber(a):a)}this.updateInputDiv&&this.updateInputDiv.parentNode&&(d=this.updateInputDiv.parentNode,b!==this.customValue&&this._getNodeText(d.nextSibling)===this.customLabel&&(c.setAttr(d.nextSibling,"data",encodeURIComponent(b)),this._setNodeText(d.nextSibling,b),c.setAttr(d.nextSibling,"title",b)),this.codedValues||(a=a?a:decodeURIComponent(c.getAttr(d,"data"))),c.setAttr(d,"data",encodeURIComponent(a)),a=d.parentNode,
b!==this.customValue&&c.removeClass(a,"custom"),this._setNodeText(d,b),c.setAttr(d,"title",b));this._dijit=this.updateInputDiv=null},_onListContentClicked:function(a){a=a.target||a.srcElement;var b=n.getAncestorDom(a,function(d){return c.hasClass(d,"item")},3);b&&(c.hasClass(a,"checkboxEmpty")?c.hasClass(a,"checked")?c.removeClass(a,"checked"):c.addClass(a,"checked"):c.hasClass(a,this.inputType)?("radio"===this.inputType&&!0===this.currentItem&&(this.currentItem=this.getCurrentItem()),c.hasClass(a,
"checked")?"radio"!==this.inputType?c.removeClass(a,"checked"):c.hasClass(this.currentItem,"checked")||c.removeClass(a,"checked"):("radio"===this.inputType&&this.currentItem&&c.removeClass(this.currentItem,"checked"),c.addClass(a,"checked"),this.currentItem=a)):c.hasClass(a,"action")&&(c.hasClass(a,"up")?b.previousElementSibling&&c.place(b,b.previousElementSibling,"before"):c.hasClass(a,"down")?b.nextElementSibling&&c.place(b,b.nextElementSibling,"after"):c.hasClass(a,"delete")&&(c.destroy(b),this.emit("editTable_itemChanged"))))},
_getLabelFromCodevalue:function(a){for(var b=a,d=0;d<this.codedValues.length;d++){var f=this.codedValues[d];if(f.value===a){b=f.label;break}}return b},_getCodeFromCodevalueLabel:function(a){for(var b=a,d=0;d<this.codedValues.length;d++){var f=this.codedValues[d];if(f.label===a){b=f.value;break}}return b},_createEmptyTarget:function(a){for(var b=this.emptyStr,d=this.emptyLabel?this.emptyLabel:b,f=" checked",e=0;e<a.length;e++)if(a[e].isChecked){f="";break}" checked"===f&&(this.currentItem=!0);e='data\x3d"'+
encodeURIComponent(b)+'"';var l="",g=this.Nls.emptyValueTips;if(0===a.length||this.enableEmpty)l=" checked";return c.create("div",{"class":"item empty",innerHTML:'\x3cdiv class\x3d"label name jimu-ellipsis" style\x3d"cursor: default;"'+e+"\x3e"+b+'\x3c/div\x3e\x3cdiv class\x3d"label alias jimu-ellipsis-Blanks" data\x3d"'+d+'"\x3e'+d+'\x3c/div\x3e\x3cdiv class\x3d"label '+this.inputType+f+' jimu-ellipsis"\x3e\x3c/div\x3e\x3cdiv class\x3d"label checkbox checkboxEmpty'+l+' jimu-ellipsis jimu-flipx" title\x3d"'+
g+'"\x3e\x3c/div\x3e'},this.listContent)},_createTarget:function(a,b,d,f,e){var l="item";e&&(a=b=this.customValue,d=this.customLabel,l="item custom");a=a||0===a?a:"";b=b||"";d=d?d:a;f=f?f:"";var g=a;(this.codedValues||this.isNumberField)&&a!==this.Nls.addValuePlaceHolder&&(g=this.codedValues?this._getLabelFromCodevalue(a):b);b=this.isNumberField?a:encodeURIComponent(a);f=c.create("div",{"class":l,innerHTML:'\x3cdiv class\x3d"label name jimu-ellipsis-Blanks" data\x3d"'+(b+'"\x3e')+g+'\x3c/div\x3e\x3cdiv class\x3d"label alias jimu-ellipsis-Blanks" data\x3d"'+
d+'"\x3e'+d+'\x3c/div\x3e\x3cdiv class\x3d"label '+this.inputType+f+' jimu-ellipsis"\x3e\x3c/div\x3e\x3cdiv class\x3d"actions jimu-float-trailing"\x3e\x3cdiv class\x3d"delete action jimu-float-trailing"\x3e\x3c/div\x3e\x3cdiv class\x3d"down action jimu-float-trailing"\x3e\x3c/div\x3e\x3cdiv class\x3d"up action jimu-float-trailing"\x3e\x3c/div\x3e\x3c/div\x3e'},this.listContent);e&&(e=m(".name",f)[0],c.setAttr(e,"title",a),c.setAttr(e.nextSibling,"title",d));return f},_destroyTarget:function(a){for(var b=
m(".item .name",this.listContent),d=0;d<b.length;d++){var f=b[d];if(q.get(this._dijit.domNode.parentNode,"innerHTML")===a){c.destroy(f.parentNode);break}}},getCurrentItem:function(){for(var a=m(".item .radio",this.listContent),b=0;b<a.length;b++){var d=a[b];if(c.hasClass(d,"checked"))return d}return null},_getEmptyLabel:function(){var a=m(".label.alias",this.listContent.firstChild)[0],b=this._getNodeText(a);a.children.length&&(b="Error"===this._dijit.state?decodeURIComponent(c.getAttr(a,"data")):
this._dijit.value);return b=n.sanitizeHTML(b)},_getEmptyStatus:function(){var a=m(".checkboxEmpty",this.listContent.firstChild)[0];return c.hasClass(a,"checked")?!0:!1},_getNodeText:function(a){return a.textContent||a.innerText||""},_setNodeText:function(a,b){a.innerHTML="\x26nbsp;";a.textContent?a.textContent=b:a.innerText=b},getListValues:function(){this.listItemsArray=[];this.listValuesArray=[];for(var a=m(".item .name",this.listContent),b="radio"===this.inputType?1:0;b<a.length;b++){var d=a[b],
f=n.getAncestorDom(d,function(l){return c.hasClass(l,"item")},3);if(!c.hasClass(f,"custom")){f=this._getNodeText(d);var e=decodeURIComponent(c.getAttr(d,"data"));if(this.isNumberField||this.codedValues)f=e;d.children.length&&(f="Error"===this._dijit.state?e:this._dijit.value,this.codedValues&&(f=this._getCodeFromCodevalueLabel(f),f=void 0!==f?f:e));f=this.isNumberField?parseFloat(f):n.sanitizeHTML(f);e=this._getNodeText(d.nextSibling);e===this.customLabel&&(e=f.toString(),this.isNumberField&&(e=this._getLocalNumber(e)));
d.nextSibling.children.length&&(e="Error"===this._dijit.state?decodeURIComponent(c.getAttr(d.nextSibling,"data")):this._dijit.value);e=n.sanitizeHTML(e);e={value:f,alias:e,isChecked:!1};this.listItemsArray.push(e);this.listValuesArray.push(f);c.hasClass(d.nextSibling.nextSibling,"checked")&&(e.isChecked=!0)}}a={list:this.listItemsArray,valueList:this.listValuesArray};"radio"===this.inputType&&(a.emptyLabel=this._getEmptyLabel(),a.enableEmpty=this._getEmptyStatus());return a},setListValues:function(a,
b){q.set(this.listContent,"innerHTML","");"radio"===this.inputType&&this._createEmptyTarget(a);for(var d=0;d<a.length;d++){var f=a[d],e="";f.isChecked&&(e=" checked",this.currentItem=!0);this._createTarget(f.value,b?b[d].label:f.value,f.alias,e)}a=m(".name",this.listContent);for(b=0;b<a.length;b++)d=a[b],c.setAttr(d,"title",this._getNodeText(d)),d=d.nextSibling,c.setAttr(d,"title",this._getNodeText(d))},_initTable:function(){},getDijits:function(){return[this.mutiValuesSelect]},destroy:function(){this.inherited(arguments)}})});