ui-widget-toolkit
Version:
UI widgets built on top of D3, Pixi.js and ag-grid-community
1 lines • 27.3 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("es6-promise"),require("ag-grid-community")):"function"==typeof define&&define.amd?define("UWT",["es6-promise","ag-grid-community"],t):"object"==typeof exports?exports.UWT=t(require("es6-promise"),require("ag-grid-community")):e.UWT=t(e["es6-promise"],e.agGrid)}(window,(function(e,t){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=58)}({0:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e[e.Left=1]="Left",e[e.Right=2]="Right",e[e.Top=4]="Top",e[e.Bottom=8]="Bottom",e[e.None=0]="None"}(t.Alignment||(t.Alignment={})),function(e){e[e.CursorStart=0]="CursorStart",e[e.CursorMove=1]="CursorMove",e[e.CursorEnd=2]="CursorEnd",e[e.BrushStart=3]="BrushStart",e[e.BrushMove=4]="BrushMove",e[e.BrushEnd=5]="BrushEnd",e[e.HoverStart=6]="HoverStart",e[e.HoverEnd=7]="HoverEnd",e[e.HoverClear=8]="HoverClear",e[e.FocusStart=6]="FocusStart",e[e.FocusEnd=7]="FocusEnd",e[e.FocusClear=8]="FocusClear",e[e.SelectAdd=9]="SelectAdd",e[e.SelectRemove=10]="SelectRemove",e[e.SelectStart=9]="SelectStart",e[e.SelectEnd=10]="SelectEnd",e[e.SelectClear=11]="SelectClear",e[e.Zoom=12]="Zoom",e[e.Click=13]="Click",e[e.DoubleClick=14]="DoubleClick",e[e.RangeUpdate=15]="RangeUpdate"}(t.EventType||(t.EventType={})),function(e){e[e.Unrendered=0]="Unrendered",e[e.Cartesian=1]="Cartesian",e[e.Pie=2]="Pie",e[e.Grid=3]="Grid",e[e.FlowDiagram=4]="FlowDiagram",e[e.ForceDirectedGraph=5]="ForceDirectedGraph",e[e.Sunburst=6]="Sunburst",e[e.HierarchyGraph=7]="HierarchyGraph",e[e.PortDiagram=8]="PortDiagram",e[e.SimpleGraph=9]="SimpleGraph",e[e.TreeMap=10]="TreeMap",e[e.Axis=11]="Axis",e[e.Radar=12]="Radar"}(t.UIType||(t.UIType={})),function(e){e[e.Discrete=0]="Discrete",e[e.Gradient=1]="Gradient"}(t.LegendType||(t.LegendType={})),function(e){e[e.Vertical=0]="Vertical",e[e.Horizontal=1]="Horizontal"}(t.LegendOrientation||(t.LegendOrientation={})),function(e){e[e.Rectangle=0]="Rectangle",e[e.Line=1]="Line",e[e.Circle=2]="Circle"}(t.LegendItemShape||(t.LegendItemShape={}));t.Rect=class{constructor(e,t,n,o){this.x=0,this.y=0,this.width=0,this.height=0,this.x=e,this.y=t,this.width=n,this.height=o}contains(e,t){return e>=this.x&&e<=this.x+this.width&&t>=this.y&&t<=this.y+this.height}};t.Css=class{constructor(e,t){e?this.addClasses(e):this.classes={},this.style=t||{}}addClasses(e){let t=e.split(" ");for(let e=0;e<t.length;++e)this.classes[t[e]]=!0;return this}addStyles(e){for(let t in e)this.style[t]=e[t];return this}setColor(e){return this.addStyles({color:e}),this}setOpacity(e){return this.addStyles({opacity:e}),this}removeClass(e){return delete this.classes[e],this}removeStyle(e){return delete this.style[e],this}getClasses(){return Object.keys(this.classes)}getClassString(){let e="";for(let t in this.classes)e+=t+" ";return e}getStyles(){return this.style}getStyleString(){return JSON.stringify(this.style)}};t.Range=class{constructor(e,t){this.min=e,this.max=t}setMin(e){return this.min=e,this}getMin(){return this.min}setMax(e){return this.max=e,this}getMax(){return this.max}}},1:function(e,t,n){"use strict";function o(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function r(e){return function(t,n){return o(e(t),n)}}function l(e){return e||(e=o),1===e.length&&(e=r(e)),{left:function(t,n,o,r){for(null==o&&(o=0),null==r&&(r=t.length);o<r;){var l=o+r>>>1;e(t[l],n)<0?o=l+1:r=l}return o},right:function(t,n,o,r){for(null==o&&(o=0),null==r&&(r=t.length);o<r;){var l=o+r>>>1;e(t[l],n)>0?r=l:o=l+1}return o}}}Object.defineProperty(t,"__esModule",{value:!0}),t.getSelectionName=function(e){return"number"==typeof e?"n"+e:e?(e.length>0&&!isNaN(Number(e[0]))&&(e="z"+e),e=e.replace(/[\*\%\#\[\]\/\>\<\s\+\(\)\;\@\:\?\"=.,]/g,"-")):""},t.removeFromList=function(e,t){if(e){let n=t.indexOf(e);-1!==n&&t.splice(n,1)}},t.bisect=l,t.bucketData=function(e,t,n){let o=l().right,r=[];for(let e=0;e<t.length-1;++e)r[e]=[];let i=t[0],s=t[t.length-1],a=t.slice(1);for(let t=0;t<e.length;++t){let l=n(e[t]);l<i||l>s||r[o(a,l)].push(e[t])}let c={};for(let e=0;e<t.length-1;++e){c[t[e]+"-"+t[e+1]]=r[e]}return c},t.copy=function(e){let t={};for(let n in e)t[n]=e[n];return t},t.merge=function(e,t){for(let n in t)e[n]=t[n]},t.convertTraceToTrees=function(e){let t=[],n=[],o=[];for(let r=0;r<e.length;r++){let l=e[r],i=n[n.length-1];for(;n.length&&l.x>i.x+i.dx;)--n.length,--o.length,i=n[n.length-1];let s=o[o.length-1],a={key:l.key,value:l.dx,children:[],parent:s};l.name&&(a.name=l.name),s?s.children.push(a):t.push(a),n.push(l),o.push(a)}return t};t.SimpleBuffer=class{constructor(e){this._data=e||[]}push(e){this._data.push(e)}get(e){return this._data[e]}length(){return this._data.length}getData(){return this._data}};t.RingBuffer=class{constructor(e){this._data=new Array(e),this._startIdx=0,this._count=0,this._isRotating=!1}push(e){this._isRotating?(this._data[this._startIdx]=e,++this._startIdx,this._startIdx===this._count&&(this._startIdx=0),this._isRotating=!0):this._count===this._data.length-1?(this._data[this._count]=e,++this._count,this._isRotating=!0):(this._data[this._count]=e,++this._count)}get(e){return this._isRotating&&(e+=this._startIdx)>=this._count&&(e-=this._count),this._data[e]}length(){return this._count}getData(){if(this._isRotating){let e=[];for(let t=this._startIdx;t<this._data.length;++t)e.push(this._data[t]);for(let t=0;t<this._startIdx;++t)e.push(this._data[t]);return e}return this._data}},t.bisectBuffer=function(e){return e||(e=o),1===e.length&&(e=r(e)),{left:function(t,n,o,r){for(null==o&&(o=0),null==r&&(r=t.length());o<r;){var l=o+r>>>1;e(t.get(l),n)<0?o=l+1:r=l}return o},right:function(t,n,o,r){for(null==o&&(o=0),null==r&&(r=t.length());o<r;){var l=o+r>>>1;e(t.get(l),n)>0?r=l:o=l+1}return o}}},t.transposeKeys=function(e){let t={};function n(e,o,r,l){let i=[];for(let e=0;e<o.length;++e)i[e]=o[e];if(i.push(r.key),Array.isArray(r.data))for(let t=0;t<r.data.length;++t)n(e,i,r.data[t],l+1);else{let n=e;for(let e=i.length-1;e>=0;--e){let o,l=i[e];t.hasOwnProperty(l)?o=t[l]:(o=n.length,t[l]=o),n[o]||(n[o]={key:l,data:[]}),0===e?n[o].data=r.data:n=n[o].data}}}let o=[];for(let t=0;t<e.length;++t)n(o,[],e[t],0);return o},t.runFunctionOnLeaf=function e(t,n){if(t&&t.children&&t.children.length>0)for(let o=0;o<t.children.length;++o)e(t.children[o],n);else n(t)},t.isOverlapping=function(e,t){return e.x<=t.right&&e.right>=t.x&&e.y<=t.bottom&&e.bottom>=t.y}},13:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(1),r=n(0);var l;!function(e){e[e.Tooltip=0]="Tooltip",e[e.Highlight=1]="Highlight",e[e.Render=2]="Render",e[e.Focus=3]="Focus",e[e.Select=4]="Select",e[e.None=5]="None"}(l||(l={}));class i{constructor(){this._nameMap={},this._objectMap=new Map}}function s(e){e.getTooltip||(e.getTooltip=function(t){return e.renderer&&e.renderer.getTooltipData?e.renderer.getTooltipData(e,t):[{source:e,group:"",metrics:{}}]})}function a(e){e.api||(e.api={}),e.api.select||(e.api.select=function(t){if(e.renderer&&e.renderer.select)return e.renderer.select(e,t)})}function c(e){e.api||(e.api={}),e.api.cursorChange||(e.api.cursorChange=function(t){if(e.renderer&&e.renderer.cursorChange)return e.renderer.cursorChange(e,t)}),e.api.focus||(e.api.focus=function(t){return e.renderer&&!e.renderer.focus&&e.renderer.hover?e.renderer.hover(e,t):e.renderer&&e.renderer.focus?e.renderer.focus(e,t):void 0},e.api.hover=e.api.focus),e.api.brush||(e.api.brush=function(t){if(e.renderer&&e.renderer.brush)return e.renderer.brush(e,t)}),e.api.zoom||(e.api.zoom=function(t){if(e.renderer&&e.renderer.zoom)return e.renderer.zoom(e,t)})}function u(e){e.api||(e.api={}),e.api.brush||(e.api.brush=function(t){if(e.renderer&&e.renderer.brush)return e.renderer.brush(e,t)}),e.api.render||(e.api.render=function(t,n){return t?e.renderer=t:t=e.renderer,new Promise((function(o,r){t&&(e.renderer.render(e,n),o("Ok")),r("No renderer available")}))})}function d(e){s(e),c(e),a(e),u(e)}t.GroupInfo=i,t.addCallbacks=d;t.ElementManager=class{constructor(){this._elems=[];let e=this;this._groupInfo=[];for(let e=0;e<5;++e)this._groupInfo.push(new i);this._onHoverCallback=function(t){t.caller||console.warn("Warning no caller specified for this event, cannot propoate changes",t);let n=e._groupInfo[3]._objectMap.get(t.caller);if(n)if(e._hoverCallback)e._hoverCallback(n,t);else for(let e=0;e<n.length;++e){let o=n[e];t.caller!==o&&o.api&&!o.api.focus&&o.api.hover&&o.api.hover(t),t.caller!==o&&o.api&&o.api.focus&&o.api.focus(t)}};let t=function(t,n,o){return function(r){r.caller||console.warn("Warning no caller specified for this event, cannot propagate changes",r);let l=e._groupInfo[t]._objectMap.get(r.caller);if(l)if(n)n(l,r);else for(let e=0;e<l.length;++e){let t=l[e];r.caller!==t&&t.api&&t.api[o]&&t.api[o](r)}}};this._onZoomCallback=t(1,this._zoomCallback,"zoom"),this._onCursorChangeCallback=t(1,this._cursorChangeCallback,"cursorChange"),this._onBrushCallback=t(1,this._brushCallback,"brush"),this._onClickCallback=t(4,this._clickCallback,"select"),this._onTooltipCallback=function(t){t.caller||console.warn("Warning no caller specified for this event, cannot propoate changes",t);let n=[],o=e._groupInfo[0]._objectMap.get(t.caller);if(o){if(e._tooltipCallback)n=n.concat(e._tooltipCallback(o,t));else for(let e=0;e<o.length;++e){let r=o[e].getTooltip(t);n=n.concat(r)}return t.data&&t.data.tooltip&&t.data.tooltip.setData(t.data.tooltip.getTitle(),n),n}},this._onUpdateCallback=function(t,n){t||console.warn("Warning no caller specified for this event, cannot propoate changes");let o=e._groupInfo[2]._objectMap.get(t);if(o)for(let e=0;e<o.length;++e){let t=o[e];t.renderer&&t.renderer.render(t,n)}}}removeFromGroup(e,t){let n=this._groupInfo[t]._objectMap.get(e);n&&o.removeFromList(e,n)}addToGroup(e,t,n){this._groupInfo[n]._nameMap.hasOwnProperty(t)||(this._groupInfo[n]._nameMap[t]=[]),this._groupInfo[n]._nameMap[t].push(e),this._groupInfo[n]._objectMap.set(e,this._groupInfo[n]._nameMap[t])}addElement(e,t,n,o){if(!e)return this;if(-1!==this._elems.indexOf(e))throw"Element already exists in this manager";{let r;d(e),this._elems.push(e),e.getElements||(e.getElements=function(){return[e]}),r=e.getElements();for(let e=0;e<r.length;++e){let l=r[e];t&&this.addToTooltipGroup(l,t),n&&this.addToHighlightGroup(l,n),o&&this.addToRenderGroup(l,o)}}return e.manager=this,this}removeElement(e){if(!e)return this;let t;t=e.getElements?e.getElements():[e];for(let e=0;e<t.length;++e){let n=t[e];this.removeFromTooltipGroup(n),this.removeFromHighlightGroup(n),this.removeFromRenderGroup(n)}return o.removeFromList(e,this._elems),delete e.manager,this}getElements(){return this._elems}setZoomCallback(e){return this._zoomCallback=e,this}setHoverCallback(e){return this._hoverCallback=e,this}setClickCallback(e){return this._clickCallback=e,this}setTooltipCallback(e){return this._tooltipCallback=e,this}setBrushCallback(e){return this._brushCallback=e,this}addToTooltipGroup(e,t){s(e),this.removeFromTooltipGroup(e),this.addToGroup(e,t,0);let n=this;if(e.onTooltip){let t=e.onTooltip;e.onTooltip=function(e){n._onTooltipCallback(e),t(e)}}else e.onTooltip=this._onTooltipCallback;return this}removeFromTooltipGroup(e){return this.removeFromGroup(e,0),this}addToFocusGroup(e,t){c(e),this.removeFromFocusGroup(e);let n=this;if(e.onHover){let t=e.onHover;e.onHover=function(e){n._onHoverCallback(e),t(e)}}else e.onHover=n._onHoverCallback;return this.addToGroup(e,t,3),this}removeFromFocusGroup(e){return this.removeFromGroup(e,3),this}addToSelectGroup(e,t){a(e),this.removeFromSelectGroup(e);let n=this;if(e.onClick){let t=e.onClick;e.onClick=function(e){n._onClickCallback(e),t(e)}}else e.onClick=n._onClickCallback;return this.addToGroup(e,t,4),this}removeFromSelectGroup(e){return this.removeFromGroup(e,4),this}addToHighlightGroup(e,t){c(e),this.removeFromHighlightGroup(e),this.addToFocusGroup(e,t),this.addToSelectGroup(e,t);let n=this;if(e.onBrush){let t=e.onBrush;e.onBrush=function(e){n._onBrushCallback(e),t(e)}}else e.onBrush=n._onBrushCallback;if(e.onCursorChanged){let t=e.onCursorChanged;e.onCursorChanged=function(e){n._onCursorChangeCallback(e),t(e)}}else e.onCursorChanged=this._onCursorChangeCallback;if(e.onZoom){let t=e.onZoom;e.onZoom=function(e){n._onZoomCallback(e),t(e)}}else e.onZoom=this._onZoomCallback;let l=this._groupInfo[1]._nameMap[t];if(l&&l.length){let t=l[0];if(t.api.getOptions&&e.api&&e.api.zoom){let n=t.api.getOptions(),l=o.copy(n);l.event=r.EventType.Zoom,setTimeout(()=>{e.api.zoom(l)})}}return this.addToGroup(e,t,1),this}removeFromHighlightGroup(e){return this.removeFromFocusGroup(e),this.removeFromSelectGroup(e),this.removeFromGroup(e,1),this}addToRenderGroup(e,t){u(e),this.removeFromRenderGroup(e),this.addToGroup(e,t,2);let n=this;if(e.handleUpdate){let t=e.handleUpdate;e.handleUpdate=function(e,o){n._onUpdateCallback(e,o),t(e,o)}}else e.handleUpdate=this._onUpdateCallback;return this}removeFromRenderGroup(e){return this.removeFromGroup(e,2),this}clear(){this._elems.length=0,this._groupInfo.length=0;for(let e=0;e<5;++e)this._groupInfo.push(new i)}}},17:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(18);function r(){let e=window.navigator.userAgent,t=e.indexOf("MSIE ");if(t>0)return o.polyfill(),String.prototype.startsWith||(String.prototype.startsWith=function(e,t){return t=t||0,this.substr(t,e.length)===e}),parseInt(e.substring(t+5,e.indexOf(".",t)),10);if(e.indexOf("Trident/")>0){o.polyfill(),String.prototype.startsWith||(String.prototype.startsWith=function(e,t){return t=t||0,this.substr(t,e.length)===e});let t=e.indexOf("rv:");return parseInt(e.substring(t+3,e.indexOf(".",t)),10)}let n=e.indexOf("Edge/");return n>0&&parseInt(e.substring(n+5,e.indexOf(".",n)),10)}t.detectIE=r,document.addEventListener("DOMContentLoaded",(function(){r()}),!1),t.useIEPolyfill=function(e){try{new CustomEvent("test")}catch(t){let n=function(t,n){n=n||{bubbles:!1,cancelable:!1};var o=document.createEvent("MouseEvent");return o.initMouseEvent(t,n.bubbles,n.cancelable,e,0,0,0,0,0,!1,!1,!1,!1,0,null),o};n.prototype=Event.prototype,e.MouseEvent=n}}},18:function(t,n){t.exports=e},58:function(e,t,n){"use strict";function o(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),o(n(0)),o(n(59)),o(n(13)),o(n(8)),o(n(1)),o(n(17)),o(n(60))},59:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.Column=class{constructor(e,t){this.headerName=e,this.field=t||e}}},60:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(0),r=n(1),l=n(8),i=n(7),s=n(61);function a(e,t){let n={},o={};for(let r=0;r<t.length;++r){let l=t[r];n[l.field]||(n[l.field]=0),o[l.field]||(o[l.field]=0);for(let t=0;t<e.length;++t)e[t][l.field]&&(e[t][l.field].value&&(e[t][l.field]=e[t][l.field].value),n[l.field]=Math.max(n[l.field],e[t][l.field]),o[l.field]+=e[t][l.field])}for(let r=0;r<t.length;++r){let l=t[r];for(let t=0;t<e.length;++t)e[t][l.field]={value:e[t][l.field],columnMax:n[l.field],total:o[l.field]}}}function c(e){let t=e.value;t.value=t.value?t.value:0;let n=document.createElement("div"),o=t.columnMax?t.value/t.columnMax*100:0,r=t.total?t.value/t.total*100:0;return n.className="div-percent-bar",n.style.height="25px",n.style.backgroundColor="#B3E5FC",n.style.width=o+"%",e.colDef.showAsPercentage?(n.innerHTML=r.toFixed(2)+"%",n.title=r.toFixed(2)+"% (Value: "+t.value+")"):(n.innerHTML=t.value.toFixed(2),n.title="Value: "+t.value+" ("+r.toFixed(2)+"%)"),n}function u(e,t,n,o,r){return e.value-t.value}t.percentCellRenderer=function(e){var t=e.value;null==t&&(t=0);var n=document.createElement("div");return n.className="div-percent-bar",n.style.width=t+"%",n.style.height="25px",n.style.backgroundColor="#B3E5FC",n.innerHTML=t.toFixed(2)+"%",n},t.computeMaxAndPercentage=a,t.valueCellRenderer=c,t.valueComparator=u,t.menuItemShowAsPercentage={title:"Display Percentage",action:function(e,n,o){let r=n.colDef.contextMenuItems.indexOf(t.menuItemShowAsPercentage);n.colDef.contextMenuItems[r]=t.menuItemShowAsTotal,n.colDef.showAsPercentage=!0,n.api.refreshCells({columns:[n.colDef],force:!0})}},t.menuItemShowAsTotal={title:"Display Raw Values",action:function(e,n,o){n.colDef.contextMenuItems.indexOf(t.menuItemShowAsTotal);n.colDef.contextMenuItems=[t.menuItemShowAsPercentage],n.colDef.showAsPercentage=!1,n.api.refreshCells({columns:[n.colDef],force:!0})}};class d{constructor(e,t,n,l={}){this._element=e,this._renderer=t,this._options=l,this._disableCallbacks=!1,n&&(this._div=document.querySelector(n));let i=this,s=function(e,t,n){if(i._disableCallbacks)return;let o=i._element,r=o.gridOptions;if(n){let l=r.columnApi.getAllColumns();if(l&&l.length>0){let r=l[0].colDef.field;n({caller:o,selection:e.node.data[r],event:t,data:{row:e}})}}};this.onRowFocusDefaultCallback=function(e){s(e,o.EventType.HoverStart,i._element.onHover)},this.onRowUnfocusDefaultCallback=function(e){s(e,o.EventType.HoverEnd,i._element.onHover)},this.onRowSelectedDefaultCallback=function(e){let t=e.node.isSelected()?o.EventType.SelectAdd:o.EventType.SelectRemove;s(e,t,i._element.onClick)},this.api={select:i.select,hover:i.select},this.keyboardSelectionFocus=function(e){var t=e.previousCellDef,n=e.nextCellDef;let l=i._element.gridOptions.columnApi.getAllColumns();if(l&&l.length>0){let s=i._element.gridOptions.selectionKey?i._element.gridOptions.selectionKey:l[0].colDef.field,a=function(l){return t=e.previousCellDef,i._element.gridOptions.api.forEachNode(t=>{l===t.rowIndex?t.setSelected(!0):e.event.shiftKey||i._renderer.focus(i._element,{event:o.EventType.HoverEnd,selection:r.getSelectionName(t.data[s])})}),n};switch(e.key){case 40:return a(t.rowIndex+1);case 38:return a(t.rowIndex-1);case 37:case 39:return n;default:throw"this will never happen, navigation is always on of the 4 keys above"}}}}setDiv(e){this._div=e}select(e){let t=this,n=e.selection,l=this._element.gridOptions,i=l.columnApi.getAllColumns();if(t._disableCallbacks=!0,i&&i.length>0){let s=l.selectionKey?l.selectionKey:i[0].colDef.field,a=e.selectionKey?e.selectionKey:s;e.event===o.EventType.SelectAdd||e.event===o.EventType.HoverStart?(this._prevSelection=e.selection,l.api.forEachNode((function(e){r.getSelectionName(e.data[a])===r.getSelectionName(n)&&(e.setSelected(!0),t._element.gridOptions.autoScrollToSelection&&l.api.ensureNodeVisible(e,"middle"))}))):e.event===o.EventType.SelectClear||e.event===o.EventType.HoverClear?l.api.deselectAll():(e.selection||(n=t._prevSelection),l.api.forEachNode((function(o){r.getSelectionName(o.data[a])===r.getSelectionName(n)&&(o.setSelected(!1),e.selection===t._prevSelection&&(t._prevSelection=void 0))})))}t._disableCallbacks=!1}setContextMenuItems(e,t){if(e){t||(t=[]);for(let n=0;n<e.length;++n){let o=e[n];o.onCellContextMenu=function(e){i.showContextMenu(e.event,e,e.colDef.contextMenuItems?t.concat(e.colDef.contextMenuItems):t)},o.children&&this.setContextMenuItems(o.children,t)}}}invalidate(e={}){let n=this,r=this._element.gridOptions;r.suppressAsyncEvents=!0,r.animateRows=void 0===r.animateRows||r.animateRows,r.rowSelection=void 0!==r.rowSelection?r.rowSelection:"multiple",r.rowDeselection=void 0===r.rowDeselection||r.rowDeselection,r.suppressScrollOnNewData=void 0===r.suppressScrollOnNewData||r.suppressScrollOnNewData,r.suppressPropertyNamesCheck=void 0===r.suppressPropertyNamesCheck||r.suppressPropertyNamesCheck,r.defaultColDef=void 0!==r.defaultColDef?r.defaultColDef:{},r.defaultColDef.sortable=void 0===r.defaultColDef.sortable||r.defaultColDef.sortable,r.defaultColDef.resizable=void 0===r.defaultColDef.resizable||r.defaultColDef.resizable,r.defaultColDef.filter=void 0===r.defaultColDef.filter||r.defaultColDef.filter,r.autoScrollToSelection=void 0===r.autoScrollToSelection||r.autoScrollToSelection;let l=function(e,t,o){return e?function(t){n._disableCallbacks||e({caller:n._element,event:o,data:{row:t.node.data,node:t.node}})}:t};r.onCellMouseOver=l(r.onCellMouseOver,this.onRowFocusDefaultCallback,o.EventType.HoverStart),r.cellMouseOut=l(r.onCellMouseOver,this.onRowUnfocusDefaultCallback,o.EventType.HoverEnd),r.onRowGroupOpened=l(r.onRowGroupOpened,void 0,void 0),r.onRowClicked=l(r.onRowClicked,void 0,void 0),r.onRowDoubleClicked=l(r.onRowDoubleClicked,void 0,void 0),r.onClick&&(r.onRowClicked=l(r.onClick,void 0,void 0)),r.onDoubleClick&&(r.onRowDoubleClicked=l(r.onDoubleClick,void 0,void 0)),r.onRowSelected?(r.userOnRowSelected||(r.userOnRowSelected=r.onRowSelected),r.onRowSelected=function(e){n._disableCallbacks||r.userOnRowSelected({caller:n._element,data:{row:e.node.data,node:e.node,isSelected:e.node.selected},event:e.node.selected?o.EventType.SelectAdd:o.EventType.SelectRemove})}):r.onRowSelected=this.onRowSelectedDefaultCallback;let i=!1;if(r.rowData&&!r.getNodeChildDetails)for(let e=0;e<r.rowData.length;++e){let t=r.rowData[e];if(t.children&&t.children.length>0){i=!0;break}}if(r.columnDefs){let e=[];for(let o=0;o<r.columnDefs.length;++o){let l=r.columnDefs[o];if(l.canShowPercentage||l.showAsPercentage||l.showAsBar){e.push(l),l.cellRenderer=c,l.comparator=u,l.contextMenuItems||(l.contextMenuItems=[]);let n=0;l.showAsPercentage?(n=l.contextMenuItems.indexOf(t.menuItemShowAsPercentage),-1!==n?l.contextMenuItems[o]=t.menuItemShowAsTotal:(n=l.contextMenuItems.indexOf(t.menuItemShowAsTotal),-1===n&&l.contextMenuItems.push(t.menuItemShowAsTotal))):l.canShowPercentage&&(n=l.contextMenuItems.indexOf(t.menuItemShowAsTotal),-1!==n?l.contextMenuItems[o]=t.menuItemShowAsPercentage:(n=l.contextMenuItems.indexOf(t.menuItemShowAsPercentage),-1===n&&l.contextMenuItems.push(t.menuItemShowAsPercentage)))}if(l.onCellClicked){let e=l.onCellClicked;l.onCellClicked=function(t){e({caller:n._element,data:{cell:t}})}}if(l.onCellDoubleClicked){let e=l.onCellDoubleClicked;l.onCellDoubleClicked=function(t){e({caller:n._element,data:{cell:t}})}}}if(i&&r.columnDefs.length>0){let e=r.columnDefs[0];e.cellRenderer="agGroupCellRenderer",e.cellRendererParams={innerRenderer:t=>t.data[e.field],suppressCount:!0},r.getNodeChildDetails=t=>t.children?{group:!0,expanded:t.expanded,children:t.children,key:t[e.field]}:null}e.length>0&&a(r.rowData,e)}r.enableSingleKeyboardSelection&&(r.navigateToNextCell=this.keyboardSelectionFocus);let d=null==r.contextMenuItems;if(r.columnDefs)for(let e=0;d&&e<r.columnDefs.length;++e){r.columnDefs[e].contextMenuItems&&(d=!1)}for(d||this.setContextMenuItems(r.columnDefs,r.contextMenuItems);this._div.firstChild;)this._div.removeChild(this._div.firstChild);this._element.api||(this._element.api={select:void 0,hover:void 0}),this._element.api.select=function(e){n.select(e)},this._element.api.hover=this._element.api.select,new s.Grid(this._div,this._element.gridOptions)}}t.AgGridRenderer=class{constructor(e,t={},n=new l.ColorManager){this.invalidate=this.render,this._parent=e,this._rendererMap=new WeakMap,this._options=t,this._colorMgr=n}getColorManager(){return this._colorMgr}setOnRenderCallback(e){this.onRender=e}setOptions(e){for(let t in e)this._options[t]=e[t]}hover(e,t){this.focus(e,t)}focus(e,t){console.debug("currently no focus events can be created for the grid")}select(e,t){if(this._rendererMap.has(e))return this._rendererMap.get(e).api.select(t)}setDiv(e,t){this._rendererMap.has(e)||e.type===o.UIType.Grid&&this._rendererMap.set(e,new d(e,this)),this._rendererMap.has(e)&&this._rendererMap.get(e).setDiv(t)}render(e,t={}){e.renderer=this,this._rendererMap.has(e)||e.type===o.UIType.Grid&&this._rendererMap.set(e,new d(e,this,this._parent)),this._rendererMap.has(e)&&(this._rendererMap.get(e).invalidate(t),this.onRender&&this.onRender(e,t))}destroy(e){this._rendererMap.delete(e)}getOptions(){return this._options}}},61:function(e,n){e.exports=t},7:function(e,t,n){"use strict";function o(e,t,n,i,s){let a;if(a=document.createElement("div"),a.setAttribute("class","context-menu"),a.oncontextmenu=function(e){l(),e.preventDefault()},document.body.appendChild(a),n.length>0){let c=document.createElement("ul");a.appendChild(c);for(let i=0;i<n.length;++i){let a=n[i],u=document.createElement("li");a.divider?(u.className+=" is-divider",u.innerHTML="<hr>"):(a.title||console.error("No title attribute set. Check the spelling of your options."),a.disabled&&(u.className+=" is-disabled"),a.action||a.submenu||(u.className+=" is-header"),a.submenu?u.innerHTML=`<span><text>${a.title}</text>`+'<text style="width: 5px; float: right; color: #000000A0">►</text></span>':u.innerHTML=a.title,u.onclick=function(e){a.disabled||a.action&&(a.action(u,t,i),l())},u.onmouseenter=function(){if(r(n),a.submenu){let n=u.getBoundingClientRect(),r={top:n.top+window.scrollY,bottom:n.bottom+window.scrollY,left:n.left+window.scrollX,right:n.right+window.scrollX,height:n.height,width:n.width};a.submenuDiv=o(e,t,a.submenu,r,s)}}),c.appendChild(u)}a.style.display="block",function(e,t){let n=document.body.clientWidth,o=document.body.clientHeight,r=t.left,l=t.top;r=t.right+e.clientWidth<n?t.right:t.left-e.clientWidth,t.top+e.clientHeight>o&&(l=t.top-e.clientHeight),e.style.left=r-2+"px",e.style.top=l-2+"px"}(a,i),s||e.stopPropagation()}return a}function r(e){e.forEach((function(e,t,n){!function(e){e.submenuDiv&&(document.body.removeChild(e.submenuDiv),delete e.submenuDiv),e.submenu&&r(e.submenu)}(e)}))}function l(){r(i);let e=document.getElementsByClassName("context-menu");for(;e.length;)document.body.removeChild(e[0])}Object.defineProperty(t,"__esModule",{value:!0});let i=[];t.showContextMenu=function(e,t,n,r=!1){e&&(window.onkeyup=function(e){27===e.keyCode&&l()},l(),i=n,o(e,t,n,{left:e.pageX,top:e.pageY,right:e.pageX,bottom:e.pageY,height:0,width:0},r),e.preventDefault())}},8:function(e,t,n){"use strict";function o(e){var t=Number(e).toString(16);return 1==t.length?"0"+t:t}function r(e){let t=e.substring(e.indexOf("(")+1,e.indexOf(")")).split(",");return o(t[0])+o(t[1])+o(t[2])}Object.defineProperty(t,"__esModule",{value:!0});class l{constructor(e){this._colorMap={},this.getRandomColor=e||function(){for(var e="#",t=0;t<6;t++)e+="0123456789ABCDEF"[Math.floor(16*Math.random())];return e}}hasColor(e){return this._colorMap.hasOwnProperty(e)}setColor(e,t){0===t.indexOf("rgb")&&(t=l.RgbToHex(t)),this._colorMap[e]=t}getColor(e){return this.hasColor(e)||(this._colorMap[e]=this.getRandomColor()),this._colorMap[e]}static IntToHex(e){return"#"+e.toString(16).padStart(6,"0")}static RgbToHex(e){return"#"+r(e)}static RgbToInt(e){return parseInt(r(e),16)}}t.ColorManager=l}})}));