text: //>>built
  define("dgrid1/Selection","dojo/_base/declare dojo/aspect dojo/dom-class dojo/mouse dojo/on dojo/sniff dojo/has!touch?./util/touch dojo/query dojo/dom".split(" "),function(x,l,q,y,h,g,r){function t(a,b){b=a.unselectable=b?"on":"";a=a.getElementsByTagName("*");for(var c=a.length;--c;)"INPUT"!==a[c].tagName&&"TEXTAREA"!==a[c].tagName&&(a[c].unselectable=b)}function u(a,b){var c=a.bodyNode,d=b?"text":21>g("ff")?"-moz-none":"none";m&&"msUserSelect"!==m?c.style[m]=d:g("dom-selectstart")?b||a._selectstartHandle?
  b&&a._selectstartHandle&&(a._selectstartHandle.remove(),delete a._selectstartHandle):a._selectstartHandle=h(c,"selectstart",function(e){var f=e.target&&e.target.tagName;"INPUT"!==f&&"TEXTAREA"!==f&&e.preventDefault()}):(t(c,!b),b||a._unselectableHandle)?b&&a._unselectableHandle&&(a._unselectableHandle.remove(),delete a._unselectableHandle):a._unselectableHandle=l.after(a,"renderRow",function(e){t(e,!0);return e})}g.add("dom-comparedocumentposition",function(a,b,c){return!!c.compareDocumentPosition});
  g.add("dom-selectstart","undefined"!==typeof document.onselectstart);var n=g("mac")?"metaKey":"ctrlKey",m=g("css-user-select"),k=g("pointer"),v=k&&"MS"===k.slice(0,2),w=k?k+(v?"Down":"down"):"mousedown",p=k?k+(v?"Up":"up"):"mouseup";"WebkitUserSelect"===m&&"undefined"!==typeof document.documentElement.style.msUserSelect&&(m=!1);return x(null,{selectionDelegate:".dgrid-row",selectionEvents:w+","+p+",dgrid-cellfocusin",selectionTouchEvents:g("touch")?r.tap:null,deselectOnRefresh:!0,allowSelectAll:!1,
  selection:{},selectionMode:"extended",allowTextSelection:void 0,_selectionTargetType:"rows",create:function(){this.selection={};return this.inherited(arguments)},postCreate:function(){this.inherited(arguments);this._initSelectionEvents();var a=this.selectionMode;this.selectionMode="";this._setSelectionMode(a)},destroy:function(){this.inherited(arguments);this._selectstartHandle&&this._selectstartHandle.remove();this._unselectableHandle&&this._unselectableHandle.remove();this._removeDeselectSignals&&
  this._removeDeselectSignals()},_setSelectionMode:function(a){a!==this.selectionMode&&(this.clearSelection(),this.selectionMode=a,this._selectionHandlerName="_"+a+"SelectionHandler",this._setAllowTextSelection(this.allowTextSelection))},_setAllowTextSelection:function(a){"undefined"!==typeof a?u(this,a):u(this,"none"===this.selectionMode);this.allowTextSelection=a},_handleSelect:function(a,b){if(!y.isRight(a)&&this[this._selectionHandlerName]&&this.allowSelect(this.row(b))&&("dgrid-cellfocusin"!==
  a.type||"mousedown"!==a.parentType)&&(a.type!==p||b===this._waitForMouseUp)){this._waitForMouseUp=null;this._selectionTriggerEvent=a;if(!a.keyCode||!a.ctrlKey||32===a.keyCode)if(!a.shiftKey&&a.type===w&&this.isSelected(b))this._waitForMouseUp=b;else this[this._selectionHandlerName](a,b);this._selectionTriggerEvent=null}},_singleSelectionHandler:function(a,b){a=a.keyCode?a.ctrlKey:a[n];this._lastSelected===b?this.select(b,null,!a||!this.isSelected(b)):(this.clearSelection(),this.select(b),this._lastSelected=
  b)},_multipleSelectionHandler:function(a,b){var c=this._lastSelected,d=a.keyCode?a.ctrlKey:a[n];if(!a.shiftKey){var e=d?null:!0;c=null}this.select(b,c,e);c||(this._lastSelected=b)},_extendedSelectionHandler:function(a,b){if(a[n]||!this.isSelected(b)||1!==this.getSelectedCount())(2===a.button?this.isSelected(b):a.keyCode?a.ctrlKey:a[n])||this.clearSelection(null,!0),this._multipleSelectionHandler(a,b)},_toggleSelectionHandler:function(a,b){this.select(b,null,null)},_initSelectionEvents:function(){var a=
  this,b=this.contentNode,c=this.selectionDelegate;this._selectionEventQueues={deselect:[],select:[]};g("touch")&&!g("pointer")&&this.selectionTouchEvents?(h(b,r.selector(c,this.selectionTouchEvents),function(d){a._handleSelect(d,this);a._ignoreMouseSelect=this}),h(b,h.selector(c,this.selectionEvents),function(d){a._ignoreMouseSelect!==this?a._handleSelect(d,this):d.type===p&&(a._ignoreMouseSelect=null)})):h(b,h.selector(c,this.selectionEvents),function(d){a._handleSelect(d,this)});this.addKeyHandler&&
  this.addKeyHandler(32,function(d){a._handleSelect(d,d.target)});if(this.allowSelectAll)this.on("keydown",function(d){d[n]&&65===d.keyCode&&!/\bdgrid-input\b/.test(d.target.className)&&(d.preventDefault(),a[a.allSelected?"clearSelection":"selectAll"]())});this._setCollection&&this._listeners.push(l.before(this,"_setCollection",function(d){a._updateDeselectionAspect(d)}));this._updateDeselectionAspect()},_updateDeselectionAspect:function(a){function b(e,f){if((e=c.row(e))&&c.selection[e.id])c[f](e)}
  var c=this;this._removeDeselectSignals&&this._removeDeselectSignals();var d=a&&a.track&&this._observeCollection?[l.before(this,"_observeCollection",function(e){d.push(e.on("delete",function(f){"undefined"===typeof f.index&&b(f.id,"deselect")}))}),l.after(this,"_observeCollection",function(e){d.push(e.on("update",function(f){"undefined"!==typeof f.index&&b(e.getIdentity(f.target),"select")}))},!0)]:[l.before(this,"removeRow",function(e,f){f||(e=this.row(e))&&e.id in this.selection&&this.deselect(e)})];
  this._removeDeselectSignals=function(){for(var e=d.length;e--;)d[e].remove();d=[]}},allowSelect:function(){return!0},_fireSelectionEvent:function(a){var b=this._selectionEventQueues[a],c=this._selectionTriggerEvent;var d={bubbles:!0,grid:this};c&&(d.parentType=c.type);d[this._selectionTargetType]=b;this._selectionEventQueues[a]=[];h.emit(this.contentNode,"dgrid-"+a,d)},_fireSelectionEvents:function(){var a=this._selectionEventQueues,b;for(b in a)a[b].length&&this._fireSelectionEvent(b)},_select:function(a,
  b,c){"undefined"===typeof c&&(c=!0);a.element||(a=this.row(a));if(!1===c||this.allowSelect(a)){var d=this.selection;var e=!!d[a.id];null===c&&(c=!e);var f=a.element;c||this.allSelected?d[a.id]=c:delete this.selection[a.id];f&&(c?q.add(f,"dgrid-selected"+(this.addUiClasses?" ui-state-active":"")):q.remove(f,"dgrid-selected ui-state-active"));c!==e&&f&&this._selectionEventQueues[(c?"":"de")+"select"].push(a);if(b)if(b.element||(b=this.row(b)),b){if(b=b.element)for(d=this._determineSelectionDirection(f,
  b),d||(b=document.getElementById(b.id),d=this._determineSelectionDirection(f,b));a.element!==b&&(a=this[d](a));)this._select(a,null,c)}else this._lastSelected=f,console.warn("The selection range has been reset because the beginning of the selection is no longer in the DOM. If you are using OnDemandList, you may wish to increase farOffRemoval to avoid this, but note that keeping more nodes in the DOM may impact performance.")}},_determineSelectionDirection:g("dom-comparedocumentposition")?function(a,
  b){a=b.compareDocumentPosition(a);return a&1?!1:2===a?"down":"up"}:function(a,b){return 1>b.sourceIndex?!1:b.sourceIndex>a.sourceIndex?"down":"up"},select:function(a,b,c){this._select(a,b,c);this._fireSelectionEvents()},deselect:function(a,b){this.select(a,b,!1)},clearSelection:function(a,b){this.allSelected=!1;for(var c in this.selection)a!==c&&this._select(c,null,!1);b||(this._lastSelected=null);this._fireSelectionEvents()},selectAll:function(){this.allSelected=!0;this.selection={};for(var a in this._rowIdToObject){var b=
  this.row(this._rowIdToObject[a]);this._select(b.id,null,!0)}this._fireSelectionEvents()},getSelectedCount:function(){var a=0,b;for(b in this.selection)b&&(a+=1);return a},isSelected:function(a){if("undefined"===typeof a||null===a)return!1;a.element||(a=this.row(a));return a.id in this.selection?!!this.selection[a.id]:this.allSelected&&(!a.data||this.allowSelect(a))},refresh:function(){this.deselectOnRefresh&&this.clearSelection();this._lastSelected=null;return this.inherited(arguments)},renderArray:function(){var a=
  this.inherited(arguments),b=this.selection,c,d;for(c=0;c<a.length;c++){var e=this.row(a[c]);(d=e.id in b?b[e.id]:this.allSelected)&&this.select(e,null,d)}this._fireSelectionEvents();return a}})});