From 00f5d0ed6752183aa14c53a2ae75cebb450f4b43 Mon Sep 17 00:00:00 2001 From: Tony Germaneri Date: Wed, 23 Aug 2017 00:54:56 -0700 Subject: [PATCH] updated tests --- README.md | 2 +- build.txt | 2 +- dist/canvas-datagrid.debug.js | 4 +- dist/canvas-datagrid.debug.map | 2 +- dist/canvas-datagrid.js | 2 +- dist/canvas-datagrid.map | 2 +- test/tests.js | 193 +++++++++++++++++++++++++++++++-- 7 files changed, 194 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 8b2ee063..944ed7dc 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Canvas Data Grid ![canvas-datagrid](https://tonygermaneri.github.io/canvas-datagrid/images/datagrid1.png) -[![Coverage Status](https://coveralls.io/repos/github/TonyGermaneri/canvas-datagrid/badge.svg?branch=master&build=1540)](https://coveralls.io/github/TonyGermaneri/canvas-datagrid?branch=master) +[![Coverage Status](https://coveralls.io/repos/github/TonyGermaneri/canvas-datagrid/badge.svg?branch=master&build=1552)](https://coveralls.io/github/TonyGermaneri/canvas-datagrid?branch=master) * Support for millions of contiguous rows and columns without paging or loading. * Support for touch devices (phones and tablets). diff --git a/build.txt b/build.txt index bf9b5071..c8db0f66 100644 --- a/build.txt +++ b/build.txt @@ -1 +1 @@ -1540 +1552 diff --git a/dist/canvas-datagrid.debug.js b/dist/canvas-datagrid.debug.js index 54d57a74..a24c4778 100644 --- a/dist/canvas-datagrid.debug.js +++ b/dist/canvas-datagrid.debug.js @@ -1977,7 +1977,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*jslint browser if (row) { var r = []; Object.keys(row).forEach(function (key) { - r.push(row[key]); + r.push('"' + row[key].replace(/"/g, '""') + '"'); }); r.join(','); rows.push(r); @@ -2456,6 +2456,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*jslint browser self.intf.assertPxColor = self.assertPxColor; self.intf.clearPxColorAssertions = self.clearPxColorAssertions; self.intf.integerToAlpha = self.integerToAlpha; + self.intf.copy = self.copy; self.intf.style = {}; Object.keys(self.style).forEach(function (key) { // unless this line is here, Object.keys() will not work on .style @@ -3897,6 +3898,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*jslint browser if (ny > self.data.length - 1) { ny = 0; } + self.scrollIntoView(nx, ny); self.beginEditAt(nx, ny); } }); diff --git a/dist/canvas-datagrid.debug.map b/dist/canvas-datagrid.debug.map index 7ba28d97..f9af8922 100644 --- a/dist/canvas-datagrid.debug.map +++ b/dist/canvas-datagrid.debug.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 11fa4988d364ad1a4771","webpack:///./lib/main.js","webpack:///./lib/draw.js","webpack:///./lib/events.js","webpack:///./lib/intf.js","webpack:///./lib/contextMenu.js","webpack:///./lib/defaults.js","webpack:///./lib/dom.js","webpack:///./lib/publicMethods.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;AC7DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAAA;;;;;;;;;;;;AC7BD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C;AACA;AACA,gFAAgF,UAAU;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD,IAAI,QAAQ;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD,OAAO;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,WAAW;AAC7C;AACA;AACA;AACA,sCAAsC;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,OAAO;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C,OAAO;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD,OAAO;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,QAAQ;AAClD;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,6BAA6B,QAAQ;AACrC;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA,uDAAuD,qBAAqB,EAAE;AAC9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD,IAAI,QAAQ;AAC9D;AACA;AACA;AACA,CAAC;AAAA;;;;;;;;;;;;AC54BD;AACA;AACA;AACA;AACA;AACA,0BAA0B,wCAAwC;AAClE,8BAA8B,4BAA4B;AAC1D,0BAA0B,4BAA4B;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD,wCAAwC,IAAI,QAAQ;AACtG,iCAAiC,QAAQ;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yEAAyE,eAAe;AACxF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2DAA2D,sDAAsD;AACjH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,eAAe,IAAI,QAAQ;AAC3E;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,iCAAiC,QAAQ;AACzC;AACA;AACA,aAAa;AACb;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,4EAA4E,eAAe;AAC3F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD,uCAAuC,IAAI,QAAQ;AACpG;AACA;AACA,iCAAiC,QAAQ;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD,uCAAuC,IAAI,QAAQ;AACtG,iCAAiC,QAAQ;AACzC;AACA;AACA,4EAA4E,eAAe;AAC3F;AACA;AACA;AACA;AACA,6CAA6C,qBAAqB;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,QAAQ;AAC3C;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,oCAAoC,oBAAoB;AACxD;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,+DAA+D;AACzG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,oCAAoC;AAC1D;AACA;AACA,gCAAgC,WAAW;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD,qBAAqB;AACtE;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,QAAQ;AAChD;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C,uCAAuC,IAAI,QAAQ;AAChG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoD,4CAA4C,IAAI,cAAc;AAClH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,iBAAiB;AACjB;AACA;AACA,iDAAiD,OAAO;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD,uCAAuC,IAAI,QAAQ;AACpG;AACA;AACA;AACA,+CAA+C,QAAQ;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C,uCAAuC,IAAI,QAAQ;AAClG;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD,QAAQ;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C,uCAAuC,IAAI,QAAQ;AAClG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD,kCAAkC;AACxF;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA,6CAA6C,uCAAuC,IAAI,QAAQ;AAChG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,uCAAuC,IAAI,QAAQ;AACnG;AACA;AACA,gDAAgD,uCAAuC,IAAI,QAAQ;AACnG;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,6CAA6C,eAAe;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,eAAe,IAAI,QAAQ;AACvE,qDAAqD,QAAQ;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAAA;;;;;;;;;;;;ACh7BD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA,kCAAkC,QAAQ;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,iBAAiB;AACjB;AACA,yCAAyC,QAAQ;AACjD;AACA,qBAAqB;AACrB;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,WAAW;AACpC;AACA;AACA;AACA;AACA;AACA,qDAAqD,UAAU;AAC/D;AACA;AACA;AACA,kDAAkD,UAAU;AAC5D;AACA;AACA;AACA,kDAAkD,QAAQ;AAC1D;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2DAA2D,oBAAoB,EAAE;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,gBAAgB;AACjD,iCAAiC,gBAAgB;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,uCAAuC,0BAA0B,EAAE;AACnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,kEAAkE;AAClE,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,QAAQ;AAC/C;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA,4DAA4D,wBAAwB;AACpF;AACA,iBAAiB;AACjB,aAAa;AACb;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA,wDAAwD,4BAA4B;AACpF;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,gEAAgE,6BAA6B;AAC7F;AACA,iBAAiB;AACjB,aAAa;AACb;AACA,iCAAiC,aAAa;AAC9C;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,aAAa;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD,mBAAmB,EAAE;AACxE,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,UAAU;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,+BAA+B,SAAS;AACxC;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,qDAAqD,oBAAoB;AACzE;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,SAAS;AACjD;AACA;AACA;AACA;AACA;AACA,yDAAyD,wBAAwB;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0DAA0D,iBAAiB;AAC3E;AACA;AACA,mDAAmD,gBAAgB;AACnE;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,iBAAiB;AACjB;AACA,aAAa;AACb;AACA;AACA;AACA,iBAAiB;AACjB;AACA,aAAa;AACb;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,CAAC;AAAA;;;;;;;;;;;;ACj+BD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA,wCAAwC,wDAAwD;AAChG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,QAAQ;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qEAAqE,QAAQ;AAC7E,4FAA4F,QAAQ;AACpG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,WAAW;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,wCAAwC,+BAA+B;AACvE,iBAAiB;AACjB;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD,QAAQ;AAC3D;AACA,gFAAgF,QAAQ,gBAAgB;AACxG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,iBAAiB;AACjB;AACA;AACA,2EAA2E,QAAQ;AACnF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,sBAAsB,oBAAoB;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D,oCAAoC;AAChG,yDAAyD,kCAAkC;AAC3F;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAAA;;;;;;;;;;;;ACxdD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uDAAuD;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD;AACtD,oDAAoD;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAAA;;;;;;;;;;;;ACrOD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,QAAQ;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,IAAI,cAAc;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,IAAI,cAAc;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B;AACA;AACA,4CAA4C,QAAQ;AACpD;AACA;AACA;AACA,uDAAuD,WAAW,IAAI,cAAc;AACpF;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wEAAwE,WAAW;AACnF,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA,iDAAiD,oBAAoB;AACrE;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,6CAA6C,8BAA8B;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,iBAAiB;AACjB;AACA,+CAA+C,mBAAmB;AAClE,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAAA;;;;;;;;;;;;AC5XD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,mBAAmB,QAAQ;AAC3B,mBAAmB,QAAQ;AAC3B,mBAAmB,QAAQ;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,uCAAuC,QAAQ;AAC/C;AACA;AACA,2BAA2B,OAAO;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,+BAA+B,QAAQ;AACvC;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,mBAAmB,QAAQ;AAC3B,mBAAmB,QAAQ;AAC3B,mBAAmB,QAAQ;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C,QAAQ;AACnD;AACA;AACA,gCAAgC,SAAS;AACzC;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,+BAA+B,QAAQ;AACvC;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,4CAA4C;AAC7E;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,6CAA6C,8BAA8B;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,OAAO;AAC5B,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA,uBAAuB,cAAc;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,QAAQ;AAC7B,mBAAmB,KAAK,oEAAoE,6BAA6B;AACzH;AACA;AACA;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,KAAK;AAC1B,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B,mBAAmB,SAAS;AAC5B,mBAAmB,KAAK;AACxB;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C,uCAAuC;AACtF;AACA,qCAAqC,QAAQ;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,KAAK;AAC1B,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,KAAK;AAC1B,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA,kEAAkE,QAAQ;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,KAAK;AAC1B;AACA;AACA;AACA;AACA;AACA,uBAAuB,yBAAyB;AAChD,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,OAAO;AAC5B;AACA;AACA,gDAAgD,QAAQ;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,KAAK;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,kCAAkC;AAChF;AACA,mDAAmD,iCAAiC;AACpF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,OAAO;AAC5B,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,QAAQ;AAChD;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uDAAuD,UAAU;AACjE;AACA;AACA,mDAAmD,UAAU;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAAA","file":"canvas-datagrid.debug.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"canvasDatagrid\"] = factory();\n\telse\n\t\troot[\"canvasDatagrid\"] = factory();\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 11fa4988d364ad1a4771","/*jslint browser: true, unparam: true, todo: true*/\n/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/\ndefine([\n './draw',\n './events',\n './intf',\n './contextMenu',\n './defaults',\n './dom',\n './publicMethods'\n], function context() {\n 'use strict';\n var modules = Array.prototype.slice.call(arguments);\n function grid(args) {\n args = args || {};\n var self = {};\n self.args = args;\n self.createGrid = grid;\n modules.forEach(function (module) {\n module(self);\n });\n self.init();\n return self.intf;\n }\n if (window && !window.canvasDatagrid && !window.require) {\n window.canvasDatagrid = grid;\n }\n module.exports = grid;\n return grid;\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/main.js\n// module id = 0\n// module chunks = 0","/*jslint browser: true, unparam: true, todo: true*/\n/*globals XMLSerializer: false, define: true, Blob: false, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/\ndefine([], function () {\n 'use strict';\n return function (self) {\n var perfCounters = [],\n drawCount = 0,\n perfWindowSize = 20;\n self.htmlImageCache = {};\n function drawOnAllImagesLoaded() {\n var loaded = true;\n Object.keys(self.htmlImageCache).forEach(function (html) {\n if (!self.htmlImageCache[html].complete) {\n loaded = false;\n }\n });\n if (loaded) {\n self.draw();\n }\n }\n function drawHtml(cell) {\n var img,\n v = cell.innerHTML || cell.formattedValue,\n x = cell.x + self.canvasOffsetLeft,\n y = cell.y + self.canvasOffsetTop;\n if (self.htmlImageCache[v]) {\n img = self.htmlImageCache[v];\n if (img.height !== cell.height || img.width !== cell.width) {\n // height and width of the cell has changed, invalidate cache\n self.htmlImageCache[v] = undefined;\n } else {\n if (!img.complete) {\n return;\n }\n return self.ctx.drawImage(img, x, y);\n }\n }\n img = new Image(cell.width, cell.height);\n self.htmlImageCache[v] = img;\n img.onload = function () {\n self.ctx.drawImage(img, x, y);\n drawOnAllImagesLoaded();\n };\n img.src = 'data:image/svg+xml;base64,' + btoa(\n '\\n' +\n '\\n' +\n '\\n' +\n v + '\\n' +\n '' +\n '\\n' +\n '\\n'\n );\n }\n function drawOrderByArrow(x, y) {\n x += self.canvasOffsetLeft;\n y += self.canvasOffsetTop;\n self.ctx.fillStyle = self.style.columnHeaderOrderByArrowColor;\n self.ctx.strokeStyle = self.style.columnHeaderOrderByArrowBorderColor;\n self.ctx.beginPath();\n x = x + self.style.columnHeaderOrderByArrowMarginLeft;\n y = y + self.style.columnHeaderOrderByArrowMarginTop;\n if (self.orderDirection === 'asc') {\n self.ctx.moveTo(x, y);\n self.ctx.lineTo(x + self.style.columnHeaderOrderByArrowWidth, y);\n self.ctx.lineTo(x + (self.style.columnHeaderOrderByArrowWidth * 0.5), y + self.style.columnHeaderOrderByArrowHeight);\n self.ctx.moveTo(x, y);\n } else {\n self.ctx.lineTo(x, y + self.style.columnHeaderOrderByArrowHeight);\n self.ctx.lineTo(x + self.style.columnHeaderOrderByArrowWidth, y + self.style.columnHeaderOrderByArrowHeight);\n self.ctx.lineTo(x + (self.style.columnHeaderOrderByArrowWidth * 0.5), y);\n self.ctx.lineTo(x, y + self.style.columnHeaderOrderByArrowHeight);\n }\n self.ctx.stroke();\n self.ctx.fill();\n return self.style.columnHeaderOrderByArrowMarginLeft\n + self.style.columnHeaderOrderByArrowWidth\n + self.style.columnHeaderOrderByArrowMarginRight;\n }\n function drawTreeArrow(cell, x, y) {\n x += self.canvasOffsetLeft;\n y += self.canvasOffsetTop;\n self.ctx.fillStyle = self.style.treeArrowColor;\n self.ctx.strokeStyle = self.style.treeArrowBorderColor;\n self.ctx.beginPath();\n x = x + self.style.treeArrowMarginLeft;\n y = y + self.style.treeArrowMarginTop;\n if (self.openChildren[cell.data[self.uniqueId]]) {\n self.ctx.moveTo(x, y);\n self.ctx.lineTo(x + self.style.treeArrowWidth, y);\n self.ctx.lineTo(x + (self.style.treeArrowWidth * 0.5), y + self.style.treeArrowHeight);\n self.ctx.moveTo(x, y);\n } else {\n self.ctx.lineTo(x, y);\n self.ctx.lineTo(x + self.style.treeArrowHeight, y + (self.style.treeArrowWidth * 0.5));\n self.ctx.lineTo(x, y + self.style.treeArrowWidth);\n self.ctx.lineTo(x, y);\n }\n self.ctx.stroke();\n self.ctx.fill();\n return self.style.treeArrowMarginLeft\n + self.style.treeArrowWidth\n + self.style.treeArrowMarginRight;\n }\n function radiusRect(x, y, w, h, radius) {\n x += self.canvasOffsetLeft;\n y += self.canvasOffsetTop;\n var r = x + w, b = y + h;\n self.ctx.beginPath();\n self.ctx.moveTo(x + radius, y);\n self.ctx.lineTo(r - radius, y);\n self.ctx.quadraticCurveTo(r, y, r, y + radius);\n self.ctx.lineTo(r, y + h - radius);\n self.ctx.quadraticCurveTo(r, b, r - radius, b);\n self.ctx.lineTo(x + radius, b);\n self.ctx.quadraticCurveTo(x, b, x, b - radius);\n self.ctx.lineTo(x, y + radius);\n self.ctx.quadraticCurveTo(x, y, x + radius, y);\n }\n function fillRect(x, y, w, h) {\n x += self.canvasOffsetLeft;\n y += self.canvasOffsetTop;\n self.ctx.fillRect(x, y, w, h);\n }\n function strokeRect(x, y, w, h) {\n x += self.canvasOffsetLeft;\n y += self.canvasOffsetTop;\n self.ctx.strokeRect(x, y, w, h);\n }\n function fillText(text, x, y) {\n x += self.canvasOffsetLeft;\n y += self.canvasOffsetTop;\n self.ctx.fillText(text, x, y);\n }\n function addBorderLine(c, pos) {\n self.ctx.beginPath();\n var p = {\n t: function () {\n self.ctx.moveTo(c.x + self.canvasOffsetLeft, c.y + self.canvasOffsetTop);\n self.ctx.lineTo(c.x + self.canvasOffsetLeft + c.width, c.y + self.canvasOffsetTop);\n },\n r: function () {\n self.ctx.moveTo(c.x + self.canvasOffsetLeft + c.width, c.y + self.canvasOffsetTop);\n self.ctx.lineTo(c.x + self.canvasOffsetLeft + c.width, c.y + self.canvasOffsetTop + c.height);\n },\n b: function () {\n self.ctx.moveTo(c.x + self.canvasOffsetLeft, c.y + self.canvasOffsetTop + c.height);\n self.ctx.lineTo(c.x + self.canvasOffsetLeft + c.width, c.y + self.canvasOffsetTop + c.height);\n },\n l: function () {\n self.ctx.moveTo(c.x + self.canvasOffsetLeft, c.y + self.canvasOffsetTop);\n self.ctx.lineTo(c.x + self.canvasOffsetLeft, c.y + self.canvasOffsetTop + c.height);\n },\n };\n p[pos]();\n self.ctx.stroke();\n }\n function addEllipsis(text, width) {\n var c, w = 0;\n if (self.ellipsisCache[text] && self.ellipsisCache[text][width]) {\n return self.ellipsisCache[text][width];\n }\n //TODO Add ellipsis back when there is a fast way to do it\n w = self.ctx.measureText(text).width;\n self.ellipsisCache[text] = self.ellipsisCache[text] || {};\n c = {value: text, width: w};\n self.ellipsisCache[text][width] = c;\n return c;\n }\n function drawText(cell) {\n var paddingLeft = self.style[cell.style + 'PaddingLeft'],\n paddingTop = self.style[cell.style + 'PaddingTop'],\n paddingRight = self.style[cell.style + 'PaddingRight'],\n paddingBottom = self.style[cell.style + 'PaddingBottom'],\n vPos = paddingTop + cell.height - (cell.height * 0.5),\n hPos = paddingLeft + cell.treeArrowWidth + cell.orderByArrowWidth;\n cell.text = addEllipsis(cell.formattedValue, cell.width - paddingRight - paddingLeft);\n cell.text.height = cell.fontHeight;\n if (cell.horizontalAlignment === 'right') {\n hPos = cell.width - cell.text.width - paddingRight;\n } else if (cell.horizontalAlignment === 'center') {\n hPos = (cell.width / 2) - (cell.text.width / 2);\n }\n if (cell.verticalAlignment === 'top') {\n vPos = paddingTop + cell.text.height;\n } else if (cell.verticalAlignment === 'bottom') {\n vPos = cell.height - paddingBottom - cell.text.height;\n }\n cell.text.x = cell.x + hPos;\n cell.text.y = cell.y + vPos;\n fillText(cell.text.value, cell.text.x, cell.text.y);\n }\n /**\n * Redraws the grid. No matter what the change, this is the only method required to refresh everything.\n * @memberof canvasDataGrid\n * @name draw\n * @method\n */\n self.draw = function (internal) {\n if (self.dispatchEvent('beforedraw', {})) { return; }\n if (!self.isChildGrid && (!self.height || !self.width)) {\n return;\n }\n if (self.isChildGrid && internal) {\n requestAnimationFrame(self.parentGrid.draw);\n return;\n }\n if (self.intf.visible === false) {\n return;\n }\n // initial values\n var checkScrollHeight, rowHeaderCell, p, cx, cy, treeGrid, rowOpen,\n rowHeight, cornerCell, y, x, c, h, w, s, r, rd, aCell,\n selectionBorders = [],\n rowHeaders = [],\n l = self.data.length,\n u = self.currentCell || {},\n rowHeaderCellHeight = self.getRowHeaderCellHeight(),\n columnHeaderCellWidth = self.getColumnHeaderCellWidth(),\n cellHeight = self.style.cellHeight;\n drawCount += 1;\n p = performance.now();\n // if data length has changed, there is no way to know\n if (self.data.length > self.orders.rows.length) {\n self.createRowOrders();\n }\n function drawScrollBars() {\n var v = {\n x: 0,\n y: 0,\n height: 0,\n width: 0,\n style: 'vertical-scroll-bar'\n },\n n = {\n x: 0,\n y: 0,\n height: 0,\n width: 0,\n style: 'horizontal-scroll-bar'\n },\n vb = {\n x: 0,\n y: 0,\n height: 0,\n width: 0,\n style: 'vertical-scroll-box'\n },\n nb = {\n x: 0,\n y: 0,\n height: 0,\n width: 0,\n style: 'horizontal-scroll-box'\n },\n co = {\n x: 0,\n y: 0,\n height: 0,\n width: 0,\n isCorner: true,\n isScrollBoxCorner: true,\n style: 'scroll-box-corner'\n },\n m = (self.style.scrollBarBoxMargin * 2),\n d = self.style.scrollBarBoxMargin * 0.5;\n self.ctx.strokeStyle = self.style.scrollBarBorderColor;\n self.ctx.lineWidth = self.style.scrollBarBorderWidth;\n // vertical\n v.x += w - self.style.scrollBarWidth - self.style.scrollBarBorderWidth - d;\n v.y += rowHeaderCellHeight;\n v.width = self.style.scrollBarWidth + self.style.scrollBarBorderWidth + d;\n v.height = h - rowHeaderCellHeight - self.style.scrollBarWidth - d - m;\n self.ctx.fillStyle = self.style.scrollBarBackgroundColor;\n fillRect(v.x, v.y, v.width, v.height + m);\n strokeRect(v.x, v.y, v.width, v.height + m);\n // vertical box\n vb.x = v.x + self.style.scrollBarBoxMargin;\n vb.y = rowHeaderCellHeight + self.style.scrollBarBoxMargin\n + ((v.height - self.scrollBox.scrollBoxHeight)\n * (self.scrollBox.scrollTop / self.scrollBox.scrollHeight));\n vb.width = self.style.scrollBarBoxWidth;\n vb.height = self.scrollBox.scrollBoxHeight;\n self.ctx.fillStyle = self.style.scrollBarBoxColor;\n if (/vertical/.test(u.context)) {\n self.ctx.fillStyle = self.style.scrollBarActiveColor;\n }\n if (vb.height < v.height) {\n radiusRect(vb.x, vb.y, vb.width, vb.height, self.style.scrollBarBoxBorderRadius);\n self.ctx.stroke();\n self.ctx.fill();\n }\n // horizontal\n n.x += columnHeaderCellWidth;\n n.y += h - self.style.scrollBarWidth - d;\n n.width = w - self.style.scrollBarWidth - columnHeaderCellWidth - d - m;\n n.height = self.style.scrollBarWidth + self.style.scrollBarBorderWidth + d;\n self.ctx.fillStyle = self.style.scrollBarBackgroundColor;\n fillRect(n.x, n.y, n.width + m, n.height);\n strokeRect(n.x, n.y, n.width + m, n.height);\n // horizontal box\n nb.y = n.y + self.style.scrollBarBoxMargin;\n nb.x = columnHeaderCellWidth + self.style.scrollBarBoxMargin\n + ((n.width - self.scrollBox.scrollBoxWidth)\n * (self.scrollBox.scrollLeft / self.scrollBox.scrollWidth));\n nb.width = self.scrollBox.scrollBoxWidth;\n nb.height = self.style.scrollBarBoxWidth;\n self.ctx.fillStyle = self.style.scrollBarBoxColor;\n if (/horizontal/.test(u.context)) {\n self.ctx.fillStyle = self.style.scrollBarActiveColor;\n }\n if (nb.width < n.width) {\n radiusRect(nb.x, nb.y, nb.width, nb.height, self.style.scrollBarBoxBorderRadius);\n self.ctx.stroke();\n self.ctx.fill();\n }\n //corner\n self.ctx.strokeStyle = self.style.scrollBarCornerBorderColor;\n self.ctx.fillStyle = self.style.scrollBarCornerBackgroundColor;\n co.x = n.x + n.width + m;\n co.y = v.y + v.height + m;\n co.width = self.style.scrollBarWidth + self.style.scrollBarBorderWidth;\n co.height = self.style.scrollBarWidth + self.style.scrollBarBorderWidth;\n radiusRect(co.x, co.y, co.width, co.height, 0);\n self.ctx.stroke();\n self.ctx.fill();\n self.visibleCells.unshift(v);\n self.visibleCells.unshift(vb);\n self.visibleCells.unshift(n);\n self.visibleCells.unshift(nb);\n self.visibleCells.unshift(co);\n self.scrollBox.bar = {\n v: v,\n h: n\n };\n self.scrollBox.box = {\n v: vb,\n h: nb\n };\n }\n function drawCell(d, rowIndex, rowOrderIndex) {\n return function drawEach(header, headerIndex, columnOrderIndex) {\n var cellStyle = header.style || 'cell',\n childGridAttributes,\n cell,\n isHeader = /HeaderCell/.test(cellStyle),\n isCorner = /cornerCell/.test(cellStyle),\n isRowHeader = 'rowHeaderCell' === cellStyle,\n isColumnHeader = 'columnHeaderCell' === cellStyle,\n selected = self.selections[rowOrderIndex] && self.selections[rowOrderIndex].indexOf(columnOrderIndex) !== -1,\n hovered = self.hovers[d[self.uniqueId]] && self.hovers[d[self.uniqueId]].indexOf(columnOrderIndex) !== -1,\n active = self.activeCell.rowIndex === rowOrderIndex && self.activeCell.columnIndex === columnOrderIndex,\n isGrid = typeof d[header.name] === 'object' && d[header.name] !== null && d[header.name] !== undefined,\n activeHeader = (self.orders.rows[self.activeCell.rowIndex] === rowOrderIndex\n || self.orders.columns[self.activeCell.columnIndex] === columnOrderIndex)\n && (columnOrderIndex === -1 || rowOrderIndex === -1)\n ? (isRowHeader ? 'activeRowHeaderCell' : 'activeColumnHeaderCell') : false,\n val,\n f = self.formatters[header.type || 'string'],\n orderByArrowSize = 0,\n treeArrowSize = 0,\n cellWidth = self.sizes.columns[isRowHeader ? 'cornerCell' : header[self.uniqueId]] || header.width,\n ev = {\n value: d[header.name],\n row: d,\n header: header\n };\n if (cellStyle === 'headerCellCap') {\n cellWidth = w - x;\n }\n // if no data or schema are defined, a width is provided to the stub column\n if (cellWidth === undefined) {\n cellWidth = self.style.columnWidth;\n }\n if (x + cellWidth + self.style.cellBorderWidth < 0) {\n x += cellWidth + self.style.cellBorderWidth;\n }\n if (active) {\n cellStyle = 'activeCell';\n }\n if (self.visibleRows.indexOf(rowIndex) === -1 && !isHeader) {\n self.visibleRows.push(rowIndex);\n }\n val = self.dispatchEvent('formatcellvalue', ev);\n if (!self.dispatchEvent('beforerendercell', ev)) {\n cx = x;\n cy = y;\n if (cellStyle === 'cornerCell') {\n cx = 0;\n cy = 0;\n } else if (isRowHeader) {\n cx = 0;\n } else if (isHeader) {\n cy = 0;\n }\n cell = {\n type: isGrid ? 'canvas-datagrid-cell' : header.type,\n style: cellStyle,\n nodeType: 'canvas-datagrid-cell',\n x: cx,\n y: cy,\n horizontalAlignment: self.style[cellStyle + 'HorizontalAlignment'],\n verticalAlignment: self.style[cellStyle + 'VerticalAlignment'],\n offsetTop: self.canvasOffsetTop + cy,\n offsetLeft: self.canvasOffsetLeft + cx,\n scrollTop: self.scrollBox.scrollTop,\n scrollLeft: self.scrollBox.scrollLeft,\n active: active || activeHeader,\n hovered: hovered,\n selected: selected,\n width: cellWidth,\n height: cellHeight,\n offsetWidth: cellWidth,\n offsetHeight: cellHeight,\n parentNode: self.intf.parentNode,\n offsetParent: self.intf.parentNode,\n data: d,\n isCorner: isCorner,\n isHeader: isHeader,\n isColumnHeader: isColumnHeader,\n isHeaderCellCap: !!header.isHeaderCellCap,\n isRowHeader: isRowHeader,\n rowOpen: rowOpen,\n header: header,\n columnIndex: columnOrderIndex,\n rowIndex: rowOrderIndex,\n sortColumnIndex: headerIndex,\n sortRowIndex: rowIndex,\n isGrid: isGrid,\n gridId: (self.attributes.name || '') + d[self.uniqueId] + ':' + header[self.uniqueId],\n parentGrid: self.intf,\n innerHTML: '',\n activeHeader: activeHeader,\n value: isHeader && !isRowHeader ? (header.title || header.name) : d[header.name]\n };\n ev.cell = cell;\n cell.userHeight = cell.isHeader ? self.sizes.rows[-1] : rowHeight;\n cell.userWidth = cell.isHeader ? self.sizes.columns.cornerCell : self.sizes.columns[header[self.uniqueId]];\n cell[self.uniqueId] = d[self.uniqueId];\n self.visibleCells.unshift(cell);\n self.ctx.fillStyle = self.style[cellStyle + 'BackgroundColor'];\n self.ctx.strokeStyle = self.style[cellStyle + 'BorderColor'];\n self.ctx.lineWidth = self.style[cellStyle + 'BorderWidth'];\n if (hovered) {\n self.ctx.fillStyle = self.style[cellStyle + 'HoverBackgroundColor'];\n self.ctx.strokeStyle = self.style[cellStyle + 'HoverBorderColor'];\n }\n if (selected) {\n self.ctx.fillStyle = self.style[cellStyle + 'SelectedBackgroundColor'];\n self.ctx.strokeStyle = self.style[cellStyle + 'SelectedBorderColor'];\n }\n if (activeHeader) {\n self.ctx.fillStyle = self.style[activeHeader + 'BackgroundColor'];\n }\n self.dispatchEvent('rendercell', ev);\n if (cell.isGrid) {\n if (cell.height !== rowHeight) {\n cell.height = rowHeight || self.style.cellHeightWithChildGrid;\n checkScrollHeight = true;\n }\n cell.width = self.sizes.columns[header[self.uniqueId]] || self.style.cellWidthWithChildGrid;\n }\n if (rowOpen && !cell.isRowHeader) {\n cell.height = self.sizes.rows[rd[self.uniqueId]] || self.style.cellHeight;\n }\n if (!cell.isGrid) {\n fillRect(cx, cy, cell.width, cell.height);\n strokeRect(cx, cy, cell.width, cell.height);\n }\n self.ctx.save();\n radiusRect(cell.x, cell.y, cell.width, cell.height, 0);\n self.ctx.clip();\n self.dispatchEvent('afterrendercell', ev);\n if (cell.height !== cellHeight && !(rowOpen && !cell.isRowHeader)) {\n self.sizes.rows[isHeader ? -1 : d[self.uniqueId]] = cell.height;\n checkScrollHeight = true;\n }\n if (cell.width !== cellWidth) {\n self.sizes.columns[header[self.uniqueId]] = cell.width;\n checkScrollHeight = true;\n }\n if (isRowHeader && self.attributes.tree) {\n if (!self.dispatchEvent('rendertreearrow', ev)) {\n treeArrowSize = drawTreeArrow(cell, self.style[cellStyle + 'PaddingLeft'], cy, 0);\n }\n }\n if ((self.attributes.showRowNumbers && isRowHeader)\n || !isRowHeader) {\n if (cell.isGrid) {\n if (!self.childGrids[cell.gridId]) {\n childGridAttributes = self.args.childGridAttributes || self.args;\n childGridAttributes.name = self.attributes.saveAppearance ? cell.gridId : undefined;\n childGridAttributes.parentNode = cell;\n childGridAttributes.data = d[header.name];\n self.childGrids[cell.gridId] = self.createGrid(childGridAttributes);\n self.sizes.rows[rd[self.uniqueId]]\n = self.sizes.rows[rd[self.uniqueId]] || self.style.cellGridHeight;\n checkScrollHeight = true;\n }\n cell.grid = self.childGrids[cell.gridId];\n cell.grid.parentNode = cell;\n cell.grid.visible = true;\n cell.grid.draw();\n self.dispatchEvent('rendercellgrid', ev);\n } else {\n if (self.childGrids[cell.gridId]) {\n self.childGrids[cell.gridId].parentNode.offsetHeight = 0;\n }\n if (isHeader && self.orderBy === header.name) {\n if (!self.dispatchEvent('renderorderbyarrow', ev)) {\n orderByArrowSize = drawOrderByArrow(cx + self.style[cellStyle + 'PaddingLeft'], 0);\n }\n }\n self.ctx.fillStyle = self.style[cellStyle + 'Color'];\n if (hovered) {\n self.ctx.fillStyle = self.style[cellStyle + 'HoverColor'];\n }\n if (selected) {\n self.ctx.fillStyle = self.style[cellStyle + 'SelectedColor'];\n }\n if (activeHeader) {\n self.ctx.fillStyle = self.style[activeHeader + 'Color'];\n }\n self.ctx.font = self.style[cellStyle + 'Font'];\n cell.fontHeight = self.style[cellStyle + 'FontHeight'];\n cell.treeArrowWidth = treeArrowSize;\n cell.orderByArrowWidth = orderByArrowSize;\n val = val !== undefined ? val : f\n ? f(ev) : '';\n if (val === undefined && !f) {\n val = '';\n console.warn('canvas-datagrid: Unknown format '\n + header.type + ' add a cellFormater');\n }\n cell.formattedValue = ((val !== undefined && val !== null) ? val : '').toString();\n if (self.columnFilters && self.columnFilters[val] !== undefined && isHeader) {\n cell.formattedValue = self.attributes.filterTextPrefix + val;\n }\n if (!self.dispatchEvent('rendertext', ev)) {\n if (cell.innerHTML || header.type === 'html') {\n drawHtml(cell);\n } else {\n drawText(cell);\n }\n }\n }\n }\n if (active) {\n aCell = cell;\n }\n if (selected && !isRowHeader) {\n if ((!self.selections[cell.rowIndex - 1]\n || self.selections[cell.rowIndex - 1].indexOf(cell.columnIndex) === -1\n || cell.rowIndex === 0)\n && !cell.isHeader) {\n selectionBorders.push([cell, 't']);\n }\n if (!self.selections[cell.rowIndex + 1]\n || self.selections[cell.rowIndex + 1].indexOf(cell.columnIndex) === -1) {\n selectionBorders.push([cell, 'b']);\n }\n if (!self.selections[cell.rowIndex] || cell.columnIndex === 0\n || self.selections[cell.rowIndex].indexOf(cell.columnIndex - 1) === -1) {\n selectionBorders.push([cell, 'l']);\n }\n if (!self.selections[cell.rowIndex] || cell.columnIndex === s.length\n || self.selections[cell.rowIndex].indexOf(cell.columnIndex + 1) === -1) {\n selectionBorders.push([cell, 'r']);\n }\n }\n self.ctx.restore();\n x += cell.width + self.style.cellBorderWidth;\n return cell.width;\n }\n };\n }\n function drawRowHeader(rowData, index, rowOrderIndex) {\n var a;\n if (self.attributes.showRowHeaders) {\n x = 0;\n rowHeaderCell = {'rowHeaderCell': index + 1 };\n rowHeaderCell[self.uniqueId] = rowData[self.uniqueId];\n a = {\n name: 'rowHeaderCell',\n width: self.style.rowHeaderCellWidth,\n style: 'rowHeaderCell',\n type: 'string',\n data: rowData[self.uniqueId],\n index: -1\n };\n a[self.uniqueId] = rowData[self.uniqueId];\n rowOpen = self.openChildren[rowData[self.uniqueId]];\n drawCell(rowHeaderCell, index, rowOrderIndex)(a, -1, -1);\n }\n }\n function drawHeaders() {\n var d, g = s.length, i, o, columnHeaderCell, header;\n rowHeaders.forEach(function (rArgs) {\n y = rArgs[3];\n cellHeight = rArgs[4];\n drawRowHeader(rArgs[0], rArgs[1], rArgs[2]);\n });\n if (self.attributes.showColumnHeaders) {\n x = (self.scrollBox.scrollLeft * -1) + self.scrollPixelLeft;\n if (self.attributes.showRowHeaders) {\n x += columnHeaderCellWidth;\n }\n y = 0;\n // cell height might have changed during drawing\n cellHeight = self.getRowHeaderCellHeight();\n for (o = self.scrollIndexLeft; o < g; o += 1) {\n i = self.orders.columns[o];\n header = s[i];\n d = {\n title: header.title,\n name: header.name,\n width: header.width,\n style: 'columnHeaderCell',\n type: 'string',\n index: o,\n order: i\n };\n columnHeaderCell = {'columnHeaderCell': header.title || header.name};\n columnHeaderCell[self.uniqueId] = 'h' + header[self.uniqueId];\n d[self.uniqueId] = header[self.uniqueId];\n x += drawCell(columnHeaderCell, -1, -1)(d, o, i);\n if (x > self.width + self.scrollBox.scrollLeft) {\n break;\n }\n }\n // fill in the space right of the headers\n if (x < w) {\n c = {\n name: '',\n width: self.style.scrollBarWidth,\n style: 'headerCellCap',\n isHeaderCell: true,\n isHeaderCellCap: true,\n type: 'string',\n index: s.length\n };\n c[self.uniqueId] = 'columnHeaderCell';\n drawCell({endCap: ''}, -1, -1)(c, -1, -1);\n }\n // fill in the space right of the headers\n if (self.attributes.showRowHeaders) {\n cornerCell = {'cornerCell': '' };\n cornerCell[self.uniqueId] = 'cornerCell';\n x = 0;\n c = {\n name: 'cornerCell',\n width: self.style.rowHeaderCellWidth,\n style: 'cornerCell',\n type: 'string',\n index: -1\n };\n c[self.uniqueId] = 'cornerCell';\n drawCell(cornerCell, -1, -1)(c, -1, -1);\n }\n }\n }\n function drawRow(r, d) {\n var i, treeHeight, rowSansTreeHeight, o, g = s.length;\n if (y - (cellHeight * 2) > h) {\n return false;\n }\n rd = self.data[r];\n rowOpen = self.openChildren[rd[self.uniqueId]];\n rowSansTreeHeight = self.sizes.rows[rd[self.uniqueId]] || self.style.cellHeight;\n treeHeight = (rowOpen ? self.sizes.trees[rd[self.uniqueId]] : 0);\n rowHeight = rowSansTreeHeight + treeHeight;\n if (y < rowHeight * -1) {\n return false;\n }\n if (self.attributes.showRowHeaders) {\n x += columnHeaderCellWidth;\n }\n cellHeight = rowHeight;\n for (o = self.scrollIndexLeft; o < g; o += 1) {\n i = self.orders.columns[o];\n x += drawCell(rd, r, d)(s[i], i, o);\n if (x > self.width) {\n break;\n }\n }\n // cell height might have changed during drawing\n cellHeight = rowHeight;\n x = (self.scrollBox.scrollLeft * -1) + self.scrollPixelLeft + self.style.cellBorderWidth;\n // don't draw a tree for the new row\n treeGrid = self.childGrids[rd[self.uniqueId]];\n if (r !== self.data.length && rowOpen) {\n treeGrid.visible = true;\n treeGrid.parentNode = {\n offsetTop: y + rowSansTreeHeight + self.canvasOffsetTop,\n offsetLeft: columnHeaderCellWidth - 1 + self.canvasOffsetLeft,\n offsetHeight: treeHeight,\n offsetWidth: self.width - columnHeaderCellWidth - self.style.scrollBarWidth - 1,\n offsetParent: self.intf.parentNode,\n parentNode: self.intf.parentNode,\n style: self.style,\n nodeType: 'canvas-datagrid-tree',\n scrollTop: self.scrollBox.scrollTop,\n scrollLeft: self.scrollBox.scrollLeft,\n rowIndex: r\n };\n self.visibleCells.unshift({\n rowIndex: x,\n columnIndex: 0,\n y: treeGrid.parentNode.offsetTop,\n x: treeGrid.parentNode.offsetLeft,\n height: treeGrid.parentNode.offsetHeight,\n width: treeGrid.parentNode.offsetWidth,\n style: 'tree-grid',\n type: treeGrid.parentNode.nodeType\n });\n treeGrid.draw();\n } else if (treeGrid) {\n treeGrid.parentNode.offsetHeight = 0;\n delete self.sizes.trees[rd[self.uniqueId]];\n }\n rowHeaders.push([rd, r, d, y, rowHeight]);\n y += cellHeight + self.style.cellBorderWidth;\n return true;\n }\n function initDraw() {\n self.visibleRows = [];\n s = self.getVisibleSchema();\n self.visibleCells = [];\n self.canvasOffsetTop = self.isChildGrid ? self.parentNode.offsetTop : 0;\n self.canvasOffsetLeft = self.isChildGrid ? self.parentNode.offsetLeft : 0;\n h = self.height;\n w = self.width;\n if (!self.isChildGrid) {\n self.ctx.scale(window.devicePixelRatio, window.devicePixelRatio);\n }\n }\n function drawBackground() {\n radiusRect(0, 0, w, h, 0);\n self.ctx.clip();\n self.ctx.fillStyle = self.style.backgroundColor;\n fillRect(0, 0, w, h);\n }\n function drawRows() {\n var o, n, i, g = s.length;\n x = (self.scrollBox.scrollLeft * -1) + self.scrollPixelLeft + self.style.cellBorderWidth;\n y = (self.scrollBox.scrollTop * -1) + rowHeaderCellHeight + self.scrollPixelTop + self.style.cellBorderWidth;\n for (r = self.scrollIndexTop; r < l; r += 1) {\n n = self.orders.rows[r];\n if (!drawRow(n, r)) {\n break;\n }\n }\n if (self.attributes.showNewRow) {\n if (self.attributes.showRowHeaders) {\n x += columnHeaderCellWidth;\n }\n rowHeight = cellHeight = self.style.cellHeight;\n rowOpen = false;\n for (o = self.scrollIndexLeft; o < g; o += 1) {\n i = self.orders.columns[o];\n x += drawCell(self.newRow, self.data.length, self.data.length)(s[i], i, o);\n if (x > self.width + self.scrollBox.scrollLeft) {\n break;\n }\n }\n rowHeaders.push([self.newRow, self.data.length, self.data.length, y, rowHeight]);\n }\n }\n function drawReorderMarkers() {\n if (!self.reorderObject) { return; }\n var b = {\n height: self.reorderObject.height,\n width: self.reorderObject.width,\n x: self.reorderObject.x + self.reorderObject.dragOffset.x,\n y: self.reorderObject.y + self.reorderObject.dragOffset.y\n },\n m = {\n width: w,\n heigth: h,\n x: 0,\n y: 0\n };\n self.ctx.fillStyle = self.style.reorderMarkerBackgroundColor;\n self.ctx.lineWidth = self.style.reorderMarkerBorderWidth;\n self.ctx.strokeStyle = self.style.reorderMarkerBorderColor;\n if (self.dragMode === 'row-reorder') {\n b.width = w;\n b.x = 0;\n m.width = w;\n m.y = self.currentCell.y;\n fillRect(b.x, b.y, b.width, b.height);\n strokeRect(b.x, b.y, b.width, b.height);\n self.ctx.lineWidth = self.style.reorderMarkerIndexBorderWidth;\n self.ctx.strokeStyle = self.style.reorderMarkerIndexBorderColor;\n if (self.currentCell.rowIndex !== self.reorderObject.rowIndex\n && self.currentCell.rowIndex - 1 !== self.reorderObject.rowIndex) {\n addBorderLine(m, 't');\n }\n } else if (self.dragMode === 'column-reorder' && self.reorderObject) {\n b.height = h;\n b.y = 0;\n m.height = h;\n m.x = self.currentCell.x;\n fillRect(b.x, b.y, b.width, b.height);\n strokeRect(b.x, b.y, b.width, b.height);\n self.ctx.lineWidth = self.style.reorderMarkerIndexBorderWidth;\n self.ctx.strokeStyle = self.style.reorderMarkerIndexBorderColor;\n if (self.currentCell.columnIndex !== self.reorderObject.columnIndex\n && self.currentCell.columnIndex - 1 !== self.reorderObject.columnIndex) {\n addBorderLine(m, 'l');\n }\n }\n }\n function drawBorder() {\n self.ctx.lineWidth = self.style.gridBorderWidth;\n self.ctx.strokeStyle = self.style.gridBorderColor;\n strokeRect(0, 0, self.width, self.height);\n }\n function drawSelectionBorders() {\n self.ctx.lineWidth = self.style.selectionOverlayBorderWidth;\n self.ctx.strokeStyle = self.style.selectionOverlayBorderColor;\n selectionBorders.forEach(function (c) {\n addBorderLine(c[0], c[1]);\n });\n }\n function drawActiveCell() {\n if (!aCell) { return; }\n if (self.attributes.rowSelectionMode) {\n if (self.activeCell && self.activeCell.rowIndex === aCell.rowIndex) {\n self.ctx.lineWidth = self.style.activeCellOverlayBorderWidth;\n self.ctx.strokeStyle = self.style.activeCellOverlayBorderColor;\n strokeRect(0, aCell.y, self.getHeaderWidth() + columnHeaderCellWidth, rowHeight);\n }\n } else {\n self.ctx.lineWidth = self.style.activeCellOverlayBorderWidth;\n self.ctx.strokeStyle = self.style.activeCellOverlayBorderColor;\n strokeRect(aCell.x, aCell.y, aCell.width, aCell.height);\n }\n\n }\n function drawDebug() {\n perfCounters[drawCount % perfWindowSize] = performance.now() - p;\n var d;\n if (self.attributes.debug) {\n self.ctx.font = '11px sans-serif';\n d = {};\n d.perf = (perfCounters.reduce(function (a, b) {\n return a + b;\n }, 0) / perfCounters.length).toFixed(1)\n + 'ms (' +\n perfCounters.map(function (a) { return a.toFixed(1); }).join(', ') + ')';\n d.htmlImages = Object.keys(self.htmlImageCache).length;\n d.scrollLeft = self.scrollBox.scrollLeft;\n d.scrollTop = self.scrollBox.scrollTop;\n d.scrollIndexTop = self.scrollIndexTop;\n d.scrollPixelTop = self.scrollPixelTop;\n d.scrollIndexLeft = self.scrollIndexLeft;\n d.scrollPixelLeft = self.scrollPixelLeft;\n d.canvasOffsetLeft = self.canvasOffsetLeft;\n d.canvasOffsetTop = self.canvasOffsetTop;\n d.width = self.width;\n d.height = self.height;\n d.mousex = self.mouse.x;\n d.mousey = self.mouse.y;\n d.touchx = !self.touchStart ? 0 : self.touchStart.x;\n d.touchy = !self.touchStart ? 0 : self.touchStart.y;\n d.entities = self.visibleCells.length;\n d.hasFocus = self.hasFocus;\n d.dragMode = self.dragMode;\n if (self.currentCell) {\n d.columnIndex = self.currentCell.columnIndex;\n d.rowIndex = self.currentCell.rowIndex;\n d.sortColumnIndex = self.currentCell.sortColumnIndex;\n d.sortRowIndex = self.currentCell.sortRowIndex;\n d.context = self.currentCell.context;\n d.dragContext = self.currentCell.dragContext;\n d.style = self.currentCell.style;\n d.type = self.currentCell.type;\n }\n self.ctx.save();\n Object.keys(d).forEach(function (key, index) {\n var m = key + ': ' + d[key],\n lh = 14;\n self.ctx.fillStyle = 'rgba(255, 255, 255, 0.8)';\n fillRect(columnHeaderCellWidth, lh + (index * lh), 100, lh);\n self.ctx.fillStyle = 'rgba(0, 0, 0, 1)';\n fillText(m, columnHeaderCellWidth + 1, rowHeaderCellHeight + (index * lh));\n });\n self.ctx.restore();\n }\n }\n self.ctx.save();\n initDraw();\n drawBackground();\n drawRows();\n drawSelectionBorders();\n drawActiveCell();\n drawHeaders();\n drawReorderMarkers();\n drawScrollBars();\n if (checkScrollHeight) {\n self.resize(true);\n }\n drawBorder();\n drawDebug();\n if (self.dispatchEvent('afterdraw', {})) { return; }\n self.ctx.restore();\n };\n };\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/draw.js\n// module id = 1\n// module chunks = 0","/*jslint browser: true, unparam: true, todo: true*/\n/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/\ndefine([], function () {\n 'use strict';\n return function (self) {\n var touchDelta = {x: 0, y: 0, scrollTop: 0, scrollLeft: 0},\n touchAnimateTo = {scrollLeft: 0, scrollTop: 0},\n touchSigma = {scrollLeft: 0, scrollTop: 0},\n xPPS = 0,\n yPPS = 0,\n touchingCell = false,\n startingCell = false,\n animationFrames = 0;\n self.getTouchPos = function (e) {\n var rect = self.canvas.getBoundingClientRect(),\n pos = {\n x: e.touches[0].clientX - rect.left,\n y: e.touches[0].clientY - rect.top\n };\n if (self.isChildGrid) {\n pos.x -= self.canvasOffsetLeft;\n pos.y -= self.canvasOffsetTop;\n }\n return {\n x: pos.x,\n y: pos.y,\n rect: rect\n };\n };\n self.calculatePPS = function () {\n xPPS = ((touchDelta.scrollLeft - touchSigma.scrollLeft) / (touchDelta.t - touchSigma.t));\n yPPS = ((touchDelta.scrollTop - touchSigma.scrollTop) / (touchDelta.t - touchSigma.t));\n touchSigma = {\n scrollLeft: touchDelta.scrollLeft,\n scrollTop: touchDelta.scrollTop,\n t: performance.now() / 1000\n };\n };\n self.touchCell = function (e) {\n return function () {\n clearInterval(self.touchCalcTimeout);\n var pos = self.getTouchPos(e);\n if (Math.abs(touchDelta.x) + Math.abs(touchDelta.y) < self.attributes.touchDeadZone) {\n touchingCell = self.getCellAt(pos.x, pos.y);\n self.mousemove(e, pos);\n self.mousedown(e, pos);\n self.mousemove(e, pos);\n self.draw();\n }\n };\n };\n self.touchstart = function (e) {\n touchingCell = false;\n self.touchStart = self.getTouchPos(e);\n startingCell = self.getCellAt(self.touchStart.x, self.touchStart.y, true);\n if (self.dispatchEvent('touchstart', {NativeEvent: e, cell: self.startingCell})) { return; }\n if (!self.hasFocus) { return; }\n self.stopPropagation(e);\n e.preventDefault();\n if (e.touches.length === 2) {\n return self.contextmenu(e, self.touchStart);\n }\n self.touchScrollStart = {\n scrollLeft: self.scrollBox.scrollLeft,\n scrollTop: self.scrollBox.scrollTop,\n t: performance.now() / 1000\n };\n touchDelta = {\n x: self.touchStart.x,\n y: self.touchStart.y,\n scrollLeft: self.scrollBox.scrollLeft,\n scrollTop: self.scrollBox.scrollTop,\n t: 0\n };\n self.touchmove(e);\n clearTimeout(self.touchTimeout);\n clearInterval(self.touchCalcTimeout);\n self.touchTimeout = setTimeout(self.touchCell(e), self.attributes.touchSelectTimeMs);\n self.touchCalcTimeout = setInterval(self.calculatePPS, 20);\n self.touchHaltAnimation = true;\n document.body.addEventListener('touchmove', self.touchmove, {passive: false});\n document.body.addEventListener('touchend', self.touchend, false);\n document.body.addEventListener('touchcancel', self.touchcancel, false);\n };\n self.easing = function (t, b, c, d) {\n return c * (t / d) * (2 - t) + b;\n };\n self.touchEndAnimation = function () {\n if (!self.canvas || !self.scrollBox.scrollTo) { return requestAnimationFrame(self.touchEndAnimation); }\n var x,\n y,\n n = performance.now() / 1000,\n d = (self.attributes.touchReleaseAnimationDurationMs / 1000),\n t;\n touchDelta.t = touchDelta.t || n + d;\n t = n - touchDelta.t + 1;\n if (t > 1 || self.touchHaltAnimation || (animationFrames > 1000)) {\n animationFrames = 0;\n self.touchHaltAnimation = false;\n touchAnimateTo = {scrollLeft: -1, scrollTop: -1};\n return;\n }\n animationFrames += 1;\n x = self.easing(t, touchDelta.scrollLeft, -touchAnimateTo.scrollLeft, d);\n y = self.easing(t, touchDelta.scrollTop, -touchAnimateTo.scrollTop, d);\n self.scrollBox.scrollTo(x, y);\n requestAnimationFrame(self.touchEndAnimation);\n };\n self.touchend = function (e) {\n if (self.dispatchEvent('touchend', {NativeEvent: e})) { return; }\n var dz = Math.abs(touchDelta.x) + Math.abs(touchDelta.y) < self.attributes.touchDeadZone,\n pos = {\n x: self.touchStart.x + touchDelta.x,\n y: self.touchStart.y + touchDelta.y\n },\n cell = self.getCellAt(pos.x, pos.y);\n if (!self.hasFocus) { return; }\n if (touchingCell) {\n self.mouseup(e, self.touchStart);\n } else if (dz) {\n if (cell.active) {\n self.beginEditAt(cell.columnIndex, cell.rowIndex);\n } else {\n self.mousedown(e, self.touchStart);\n self.mouseup(e, self.touchStart);\n self.click(e, self.touchStart);\n }\n }\n touchingCell = false;\n document.body.removeEventListener('touchmove', self.touchmove, {passive: false});\n document.body.removeEventListener('touchend', self.touchend, false);\n document.body.removeEventListener('touchcancel', self.touchcancel, false);\n clearTimeout(self.touchTimeout);\n clearInterval(self.touchCalcTimeout);\n self.calculatePPS();\n touchAnimateTo.scrollLeft = xPPS * self.attributes.touchReleaseAcceleration;\n touchAnimateTo.scrollTop = yPPS * self.attributes.touchReleaseAcceleration;\n self.touchHaltAnimation = false;\n if (animationFrames === 0 && !/-scroll-/.test(startingCell.style) && !dz) {\n self.touchEndAnimation();\n }\n };\n self.touchmove = function (e) {\n var d = self.getTouchPos(e);\n if (self.dispatchEvent('touchmove', {NativeEvent: e, cell: self.currentCell})) { return; }\n self.stopPropagation(e);\n e.preventDefault();\n if (!self.hasFocus) { return; }\n touchDelta = {\n x: d.x - self.touchStart.x,\n y: d.y - self.touchStart.y,\n scrollLeft: self.scrollBox.scrollLeft,\n scrollTop: self.scrollBox.scrollTop,\n t: 0\n };\n if (/vertical-scroll-/.test(startingCell.style)) {\n self.scrollBox.scrollTop = self.scrollBox.scrollHeight * (d.y / self.height);\n } else if (/horizontal-scroll-/.test(startingCell.style)) {\n self.scrollBox.scrollLeft = self.scrollBox.scrollWidth * (d.x / self.width);\n } else if (touchingCell) {\n self.mousemove(e, d);\n self.draw();\n } else {\n if (animationFrames === 0) {\n self.scrollBox.scrollTo(self.touchScrollStart.scrollLeft - touchDelta.x,\n self.touchScrollStart.scrollTop - touchDelta.y);\n }\n }\n };\n self.touchcancel = function (e) {\n if (self.dispatchEvent('touchcancel', {NativeEvent: e, cell: self.currentCell})) { return; }\n if (!self.hasFocus) { return; }\n self.touchend(e);\n touchingCell = false;\n document.body.removeEventListener('touchmove', self.touchmove, {passive: false});\n document.body.removeEventListener('touchend', self.touchend, false);\n document.body.removeEventListener('touchcancel', self.touchcancel, false);\n return;\n };\n self.stopPropagation = function (e) { e.stopPropagation(); };\n self.addEventListener = function (ev, fn) {\n self.events[ev] = self.events[ev] || [];\n self.events[ev].unshift(fn);\n };\n self.removeEventListener = function (ev, fn) {\n (self.events[ev] || []).forEach(function removeEachListener(sfn, idx) {\n if (fn === sfn) {\n self.events[ev].splice(idx, 1);\n }\n });\n };\n self.dispatchEvent = function (ev, e) {\n var defaultPrevented;\n function preventDefault() {\n defaultPrevented = true;\n }\n if (!self.events[ev]) { return; }\n self.events[ev].forEach(function dispatchEachEvent(fn) {\n e.ctx = self.ctx;\n e.preventDefault = preventDefault;\n fn.apply(self.intf, [e]);\n });\n return defaultPrevented;\n };\n self.resize = function (drawAfterResize) {\n var cellBorder = self.style.cellBorderWidth * 2,\n columnHeaderCellBorder = self.style.columnHeaderCellBorderWidth * 2,\n scrollHeight,\n scrollWidth,\n rowHeaderCellHeight = self.getRowHeaderCellHeight(),\n columnHeaderCellWidth = self.getColumnHeaderCellWidth(),\n // TODO: What the hell are these numbers!? They are probably some value in the style.\n scrollDragPositionOffsetY = 30,\n scrollDragPositionOffsetX = 15;\n if (self.isChildGrid) {\n self.height = self.parentNode.offsetHeight;\n self.width = self.parentNode.offsetWidth;\n } else {\n self.parentNode = self.parentDOMNode;\n if (!self.parentIsCanvas) {\n self.height = self.parentDOMNode.offsetHeight;\n self.width = self.parentDOMNode.offsetWidth;\n self.canvas.height = self.height * window.devicePixelRatio;\n self.canvas.width = self.width * window.devicePixelRatio;\n self.canvas.style.height = self.height + 'px';\n self.canvas.style.width = self.width + 'px';\n }\n self.canvasOffsetTop = self.args.canvasOffsetTop || 0;\n self.canvasOffsetLeft = self.args.canvasOffsetLeft || 0;\n }\n scrollHeight = self.data.reduce(function reduceData(accumulator, row) {\n return accumulator\n + (self.sizes.rows[row[self.uniqueId]] || self.style.cellHeight)\n + (self.sizes.trees[row[self.uniqueId]] || 0)\n + cellBorder;\n }, 0) || 0;\n scrollWidth = self.getVisibleSchema().reduce(function reduceSchema(accumulator, column) {\n if (column.hidden) { return accumulator; }\n return accumulator + (self.sizes.columns[column[self.uniqueId]] || column.width || self.style.columnWidth) + cellBorder;\n }, 0) || 0;\n if (self.attributes.showNewRow) {\n scrollHeight += self.style.cellHeight + cellBorder;\n }\n self.scrollBox.width = self.width - columnHeaderCellWidth;\n self.scrollBox.height = self.height - rowHeaderCellHeight - columnHeaderCellBorder;\n self.scrollBox.top = rowHeaderCellHeight + columnHeaderCellBorder;\n self.scrollBox.left = columnHeaderCellWidth;\n self.scrollBox.scrollHeight = scrollHeight + self.style.scrollBarWidth - self.scrollBox.height;\n self.scrollBox.scrollWidth = scrollWidth + self.style.scrollBarWidth - self.scrollBox.width;\n self.scrollBox.widthBoxRatio = ((self.scrollBox.width - scrollDragPositionOffsetX)\n / (self.scrollBox.scrollWidth + self.scrollBox.width - scrollDragPositionOffsetX));\n self.scrollBox.scrollBoxWidth = self.scrollBox.width\n * self.scrollBox.widthBoxRatio\n - self.style.scrollBarWidth;\n self.scrollBox.heightBoxRatio = ((self.scrollBox.height - scrollDragPositionOffsetY)\n / (self.scrollBox.scrollHeight + (self.scrollBox.height - scrollDragPositionOffsetY)));\n self.scrollBox.scrollBoxHeight = self.scrollBox.height\n * self.scrollBox.heightBoxRatio\n - self.style.scrollBarWidth;\n self.scrollBox.scrollBoxWidth = Math.max(self.scrollBox.scrollBoxWidth, self.style.scrollBarBoxMinSize);\n self.scrollBox.scrollBoxHeight = Math.max(self.scrollBox.scrollBoxHeight, self.style.scrollBarBoxMinSize);\n self.page = self.visibleRows.length - 3 - self.attributes.pageUpDownOverlap;\n self.resizeEditInput();\n self.scroll(true);\n if (drawAfterResize) {\n self.draw(true);\n }\n self.dispatchEvent('resize', {});\n return true;\n };\n self.resizeEditInput = function () {\n if (self.input) {\n var pos = self.canvas.getBoundingClientRect(),\n s = self.scrollOffset(self.canvas),\n bx2 = (self.style.cellBorderWidth * 2),\n cell = self.getVisibleCellByIndex(self.input.editCell.columnIndex, self.input.editCell.rowIndex)\n || {x: -100, y: -100, height: 0, width: 0};\n self.input.style.left = pos.left + cell.x - self.style.cellBorderWidth + self.canvasOffsetLeft - s.left + 'px';\n self.input.style.top = pos.top + cell.y - bx2 + self.canvasOffsetTop - s.top + 'px';\n self.input.style.height = cell.height - bx2 - 1 + 'px';\n self.input.style.width = cell.width - bx2 - self.style.cellPaddingLeft + 'px';\n self.clipElement(self.input);\n }\n };\n self.scroll = function (e, dontDraw) {\n var s = self.getVisibleSchema(),\n cellBorder = self.style.cellBorderWidth * 2;\n self.scrollIndexTop = 0;\n self.scrollPixelTop = 0;\n self.scrollIndexLeft = 0;\n self.scrollPixelLeft = 0;\n while (self.scrollPixelTop < self.scrollBox.scrollTop && self.scrollIndexTop < self.data.length) {\n self.scrollPixelTop +=\n (self.sizes.rows[self.data[self.scrollIndexTop][self.uniqueId]] || self.style.cellHeight)\n + (self.sizes.trees[self.data[self.scrollIndexTop][self.uniqueId]] || 0)\n + cellBorder;\n self.scrollIndexTop += 1;\n }\n while (self.scrollPixelLeft < self.scrollBox.scrollLeft && self.scrollIndexLeft < s.length) {\n self.scrollPixelLeft +=\n (self.sizes.columns[s[self.scrollIndexLeft][self.uniqueId]] || s[self.scrollIndexLeft].width);\n self.scrollIndexLeft += 1;\n }\n if (self.data.length > 0) {\n self.scrollIndexLeft = Math.max(self.scrollIndexLeft - 1, 0);\n self.scrollPixelLeft = Math.max(self.scrollPixelLeft\n - (self.sizes.columns[s[self.scrollIndexLeft][self.uniqueId]] || s[self.scrollIndexLeft].width), 0);\n self.scrollIndexTop = Math.max(self.scrollIndexTop - 1, 0);\n self.scrollPixelTop = Math.max(self.scrollPixelTop\n - (self.sizes.rows[self.data[self.scrollIndexTop][self.uniqueId]] || self.style.cellHeight)\n - (self.sizes.trees[self.data[self.scrollIndexTop][self.uniqueId]] || 0), 0);\n }\n self.ellipsisCache = {};\n if (!dontDraw) {\n self.draw(true);\n }\n //TODO: figure out why this has to be delayed for child grids\n //BUG: scrolling event on 3rd level hierarchy fails to move input box\n requestAnimationFrame(self.resizeEditInput);\n self.dispatchEvent('scroll', {top: self.scrollBox.scrollTop, left: self.scrollBox.scrollLeft});\n };\n self.mousemove = function (e, overridePos) {\n if (self.contextMenu || self.input) {\n return;\n }\n self.mouse = overridePos || self.getLayerPos(e);\n var ctrl = (e.controlKey || e.metaKey || self.attributes.persistantSelectionMode),\n i,\n s = self.getSchema(),\n dragBounds,\n sBounds,\n x = self.mouse.x,\n y = self.mouse.y,\n o = self.getCellAt(x, y),\n delta,\n ev = {NativeEvent: e, cell: o, x: x, y: y},\n previousCell = self.currentCell;\n clearTimeout(self.scrollTimer);\n if (!self.isInGrid({x: x, y: y})) {\n self.hasFocus = false;\n }\n if (self.dispatchEvent('mousemove', ev)) {\n return;\n }\n if (o && self.currentCell && (self.currentCell.rowIndex !== o.rowIndex\n || self.currentCell.columnIndex !== o.columnIndex)) {\n self.cellBoundaryCrossed = true;\n ev.cell = previousCell;\n self.dispatchEvent('cellmouseout', ev);\n ev.cell = o;\n self.dispatchEvent('cellmouseover', ev);\n }\n self.currentCell = o;\n if (!self.hasFocus) {\n return;\n }\n self.hovers = {};\n if (!self.draggingItem\n && o\n && self.scrollModes.indexOf(o.context) === -1) {\n self.dragItem = o;\n self.dragMode = o.dragContext;\n self.canvas.style.cursor = o.context;\n if (o.context === 'cell' && o.data) {\n self.canvas.style.cursor = 'pointer';\n self.hovers[o.data[self.uniqueId]] = [o.columnIndex];\n }\n if ((self.selecting || self.reorderObject)\n && o.context === 'cell'\n && o.data) {\n sBounds = self.getSelectionBounds();\n delta = {\n x: Math.abs(self.dragStart.x - x),\n y: Math.abs(self.dragStart.y - y),\n };\n if (self.dragStartObject.columnIndex !== -1 && e.shiftKey) {\n self.dragStartObject = {\n rowIndex: self.activeCell.rowIndex,\n columnIndex: self.activeCell.columnIndex\n };\n }\n dragBounds = {\n top: Math.min(self.dragStartObject.rowIndex, o.rowIndex),\n left: Math.min(self.dragStartObject.columnIndex, o.columnIndex),\n bottom: Math.max(self.dragStartObject.rowIndex, o.rowIndex),\n right: Math.max(self.dragStartObject.columnIndex, o.columnIndex)\n };\n if (self.dragStartObject.columnIndex === -1) {\n dragBounds.left = -1;\n dragBounds.right = s.length - 1;\n dragBounds.top = Math.min(sBounds.top, o.rowIndex);\n dragBounds.bottom = Math.max(sBounds.bottom, o.rowIndex);\n }\n if (self.dragStartObject.rowIndex !== o.rowIndex\n || self.dragStartObject.columnIndex !== o.columnIndex) {\n self.ignoreNextClick = true;\n }\n if (self.cellBoundaryCrossed || (delta.x === 0 && delta.y === 0) || self.attributes.rowSelectionMode) {\n if (self.attributes.rowSelectionMode || self.dragStartObject.columnIndex === -1) {\n self.selectRow(o.rowIndex, ctrl, null, true);\n } else {\n if (!self.dragAddToSelection && o.rowIndex !== undefined) {\n if (self.selections[o.rowIndex] && self.selections[o.rowIndex].indexOf(o.columnIndex) !== -1) {\n self.selections[o.rowIndex].splice(self.selections[o.rowIndex].indexOf(o.columnIndex), 1);\n }\n } else {\n self.selections[o.rowIndex] = self.selections[o.rowIndex] || [];\n if (self.selections[o.rowIndex].indexOf(o.columnIndex) === -1) {\n self.selections[o.rowIndex].push(o.columnIndex);\n }\n }\n }\n }\n if ((!self.selectionBounds || (dragBounds.top !== self.selectionBounds.top\n || dragBounds.left !== self.selectionBounds.left\n || dragBounds.bottom !== self.selectionBounds.bottom\n || dragBounds.right !== self.selectionBounds.right)) && !ctrl) {\n self.selections = [];\n sBounds = dragBounds;\n if (self.attributes.rowSelectionMode) {\n for (i = sBounds.top; i <= sBounds.bottom; i += 1) {\n self.selectRow(i, true, null, true);\n }\n } else {\n self.selectArea(sBounds, true);\n }\n }\n self.autoScrollZone(e, x, y, ctrl);\n }\n }\n self.cellBoundaryCrossed = false;\n self.draw(true);\n };\n self.click = function (e, overridePos) {\n var i,\n selectionChanged,\n ctrl = (e.controlKey || e.metaKey || self.attributes.persistantSelectionMode),\n pos = overridePos || self.getLayerPos(e);\n self.currentCell = self.getCellAt(pos.x, pos.y);\n if (self.currentCell.grid !== undefined) {\n return;\n }\n function checkSelectionChange() {\n if (!selectionChanged) { return; }\n self.dispatchEvent('selectionchanged', {\n selectedData: self.getSelectedData(),\n selections: self.selections,\n selectionBounds: self.selectionBounds\n });\n }\n if (self.input) {\n self.endEdit();\n }\n if (self.ignoreNextClick) {\n self.ignoreNextClick = false;\n return;\n }\n i = self.currentCell;\n if (self.dispatchEvent('click', {NativeEvent: e, cell: self.currentCell})) { return; }\n if (!self.hasFocus) {\n return;\n }\n if (self.currentCell.context === 'cell') {\n if (self.currentCell.style === 'cornerCell') {\n self.order(self.uniqueId, 'asc', self.sorters.number);\n self.setFilter();\n checkSelectionChange();\n return;\n }\n if (self.currentCell.style === 'columnHeaderCell') {\n if (self.attributes.columnHeaderClickBehavior === 'sort') {\n if (self.orderBy === i.header.name) {\n self.orderDirection = self.orderDirection === 'asc' ? 'desc' : 'asc';\n } else {\n self.orderDirection = 'asc';\n }\n self.order(i.header.name, self.orderDirection);\n checkSelectionChange();\n return;\n }\n if (self.attributes.columnHeaderClickBehavior === 'select') {\n self.selectColumn(i.header.index, ctrl, e.shiftKey, true);\n checkSelectionChange();\n self.draw();\n return;\n }\n }\n if (['rowHeaderCell', 'columnHeaderCell'].indexOf(self.currentCell.style) === -1 && !ctrl) {\n self.setActiveCell(i.columnIndex, i.rowIndex);\n }\n self.selections[i.rowIndex] = self.selections[i.rowIndex] || [];\n if ((self.attributes.rowSelectionMode || self.currentCell.style === 'rowHeaderCell')) {\n if (self.currentCell.style === 'rowHeaderCell'\n && self.attributes.tree && pos.x > 0\n && pos.x - self.currentCell.x < self.style.treeArrowWidth\n + self.style.treeArrowMarginLeft\n + self.style.treeArrowMarginRight + self.style.treeArrowClickRadius\n && pos.y - self.currentCell.y < self.style.treeArrowHeight\n + self.style.treeArrowMarginTop + self.style.treeArrowClickRadius\n && pos.y > 0) {\n self.toggleTree(i.rowIndex);\n return;\n }\n selectionChanged = true;\n self.selectRow(i.rowIndex, ctrl, null, true);\n }\n if (e.shiftKey && !ctrl) {\n self.selectionBounds = self.getSelectionBounds();\n self.selectArea(undefined, false);\n }\n }\n checkSelectionChange();\n self.draw(true);\n };\n self.dragResizeColumn = function (e) {\n var pos, x, y;\n pos = self.getLayerPos(e);\n x = self.resizingStartingWidth + pos.x - self.dragStart.x;\n y = self.resizingStartingHeight + pos.y - self.dragStart.y;\n if (x < self.style.minColumnWidth) {\n x = self.style.minColumnWidth;\n }\n if (y < self.style.minRowHeight) {\n y = self.style.minRowHeight;\n }\n if (self.dispatchEvent('resizecolumn', {x: x, y: y, draggingItem: self.draggingItem})) { return false; }\n if (self.scrollBox.scrollLeft > self.scrollBox.scrollWidth - self.attributes.resizeScrollZone\n && self.dragMode === 'ew-resize') {\n self.resize(true);\n self.scrollBox.scrollLeft += x;\n }\n if (self.dragMode === 'ew-resize') {\n self.sizes.columns[self.draggingItem.header.style === 'rowHeaderCell'\n ? 'cornerCell' : self.draggingItem.header[self.uniqueId]] = x;\n if (['rowHeaderCell', 'cornerCell'].indexOf(self.draggingItem.header.style) !== -1) {\n self.resize(true);\n }\n self.resizeChildGrids();\n return;\n }\n if (self.dragMode === 'ns-resize') {\n if (self.draggingItem.rowOpen) {\n self.sizes.trees[self.draggingItem.data[self.uniqueId]] = y;\n } else if (self.attributes.globalRowResize) {\n self.style.cellHeight = y;\n } else {\n self.sizes.rows[self.draggingItem.data[self.uniqueId]] = y;\n }\n self.dispatchEvent('resizerow', {row: y});\n self.resizeChildGrids();\n return;\n }\n self.ellipsisCache = {};\n };\n self.stopDragResize = function () {\n self.resize();\n document.body.removeEventListener('mousemove', self.dragResizeColumn, false);\n document.body.removeEventListener('mouseup', self.stopDragResize, false);\n self.setStorageData();\n self.draw(true);\n self.ignoreNextClick = true;\n };\n self.scrollGrid = function (e) {\n var pos = self.getLayerPos(e);\n if (self.attributes.scrollPointerLock && self.pointerLockPosition\n && ['horizontal-scroll-box', 'vertical-scroll-box'].indexOf(self.scrollStartMode) !== -1) {\n self.pointerLockPosition.x += e.movementX;\n self.pointerLockPosition.y += e.movementY;\n pos = self.pointerLockPosition;\n }\n self.scrollMode = self.getCellAt(pos.x, pos.y).context;\n if (self.scrollMode === 'horizontal-scroll-box' && self.scrollStartMode !== 'horizontal-scroll-box') {\n self.scrollStartMode = 'horizontal-scroll-box';\n self.dragStart = pos;\n self.scrollStart.left = self.scrollBox.scrollLeft;\n clearTimeout(self.scrollTimer);\n return;\n }\n if (self.scrollMode === 'vertical-scroll-box' && self.scrollStartMode !== 'vertical-scroll-box') {\n self.scrollStartMode = 'vertical-scroll-box';\n self.dragStart = pos;\n self.scrollStart.top = self.scrollBox.scrollTop;\n clearTimeout(self.scrollTimer);\n return;\n }\n if (self.scrollStartMode === 'vertical-scroll-box'\n && self.scrollMode !== 'vertical-scroll-box') {\n self.scrollMode = 'vertical-scroll-box';\n }\n if (self.scrollStartMode === 'horizontal-scroll-box'\n && self.scrollMode !== 'horizontal-scroll-box') {\n self.scrollMode = 'horizontal-scroll-box';\n }\n clearTimeout(self.scrollTimer);\n if (self.scrollModes.indexOf(self.scrollMode) === -1) {\n return;\n }\n if (self.scrollMode === 'vertical-scroll-box') {\n self.scrollBox.scrollTop = self.scrollStart.top + ((pos.y - self.dragStart.y)\n / self.scrollBox.heightBoxRatio);\n } else if (self.scrollMode === 'vertical-scroll-top') {\n self.scrollBox.scrollTop -= (self.page * self.style.cellHeight);\n self.scrollTimer = setTimeout(self.scrollGrid, self.attributes.scrollRepeatRate, e);\n } else if (self.scrollMode === 'vertical-scroll-bottom') {\n self.scrollBox.scrollTop += (self.page * self.style.cellHeight);\n self.scrollTimer = setTimeout(self.scrollGrid, self.attributes.scrollRepeatRate, e);\n }\n if (self.scrollMode === 'horizontal-scroll-box') {\n self.scrollBox.scrollLeft = self.scrollStart.left + ((pos.x - self.dragStart.x)\n / self.scrollBox.widthBoxRatio);\n } else if (self.scrollMode === 'horizontal-scroll-right') {\n self.scrollBox.scrollLeft += self.attributes.selectionScrollIncrement;\n self.scrollTimer = setTimeout(self.scrollGrid, self.attributes.scrollRepeatRate, e);\n } else if (self.scrollMode === 'horizontal-scroll-left') {\n self.scrollBox.scrollLeft -= self.attributes.selectionScrollIncrement;\n self.scrollTimer = setTimeout(self.scrollGrid, self.attributes.scrollRepeatRate, e);\n }\n };\n self.stopScrollGrid = function () {\n clearTimeout(self.scrollTimer);\n if (document.exitPointerLock) {\n document.exitPointerLock();\n }\n document.body.removeEventListener('mousemove', self.scrollGrid, false);\n };\n self.dragReorder = function (e) {\n var pos, x, y;\n pos = self.getLayerPos(e);\n x = pos.x - self.dragStart.x;\n y = pos.y - self.dragStart.y;\n if (!self.attributes.allowColumnReordering && self.dragMode === 'column-reorder') {\n return;\n }\n if (!self.attributes.allowRowReordering && self.dragMode === 'row-reorder') {\n return;\n }\n if (self.dispatchEvent('reordering', {\n NativeEvent: e,\n source: self.dragStartObject,\n target: self.currentCell,\n dragMode: self.dragMode\n })) {\n return;\n }\n if (Math.abs(x) > self.attributes.reorderDeadZone || Math.abs(y) > self.attributes.reorderDeadZone) {\n self.reorderObject = self.dragStartObject;\n self.reorderTarget = self.currentCell;\n self.reorderObject.dragOffset = {\n x: x,\n y: y\n };\n self.autoScrollZone(e, pos.x, pos.x, false);\n }\n };\n self.stopDragReorder = function (e) {\n var cr = {\n 'row-reorder': self.orders.rows,\n 'column-reorder': self.orders.columns\n },\n i = {\n 'row-reorder': 'rowIndex',\n 'column-reorder': 'columnIndex'\n }[self.dragMode];\n document.body.removeEventListener('mousemove', self.dragReorder, false);\n document.body.removeEventListener('mouseup', self.stopDragReorder, false);\n if (self.reorderObject\n && self.reorderTarget) {\n self.ignoreNextClick = true;\n if (self.reorderObject[i] !== self.reorderTarget[i]\n && !self.dispatchEvent('reorder', {\n NativeEvent: e,\n source: self.reorderObject,\n target: self.reorderTarget,\n dragMode: self.dragMode\n })) {\n cr[self.dragMode].splice(cr[self.dragMode].indexOf(self.reorderObject[i]), 1);\n cr[self.dragMode].splice(cr[self.dragMode].indexOf(self.reorderTarget[i]), 0, self.reorderObject[i]);\n self.setStorageData();\n }\n }\n self.reorderObject = undefined;\n self.reorderTarget = undefined;\n self.draw(true);\n };\n self.mousedown = function (e, overridePos) {\n self.lastMouseDownTarget = e.target;\n if (self.dispatchEvent('mousedown', {NativeEvent: e, cell: self.currentCell})) { return; }\n if (!self.hasFocus) {\n return;\n }\n if (e.button === 2 || self.input) { return; }\n var ctrl = (e.controlKey || e.metaKey);\n self.dragStart = overridePos || self.getLayerPos(e);\n self.scrollStart = {\n left: self.scrollBox.scrollLeft,\n top: self.scrollBox.scrollTop\n };\n self.dragStartObject = self.getCellAt(self.dragStart.x, self.dragStart.y);\n self.dragAddToSelection = !self.dragStartObject.selected;\n if (!ctrl && !e.shiftKey && !/(vertical|horizontal)-scroll-(bar|box)/\n .test(self.dragStartObject.context) && !self.currentCell.isColumnHeader) {\n self.selections = [];\n }\n if (self.dragStartObject.isGrid) {\n return;\n }\n if (self.scrollModes.indexOf(self.dragStartObject.context) !== -1) {\n self.scrollMode = self.dragStartObject.context;\n self.scrollStartMode = self.dragStartObject.context;\n self.scrollGrid(e);\n if (self.attributes.scrollPointerLock\n && ['horizontal-scroll-box', 'vertical-scroll-box'].indexOf(self.scrollStartMode) !== -1) {\n self.pointerLockPosition = {\n x: self.dragStart.x,\n y: self.dragStart.y\n };\n self.canvas.requestPointerLock();\n }\n document.body.addEventListener('mousemove', self.scrollGrid, false);\n document.body.addEventListener('mouseup', self.stopScrollGrid, false);\n self.ignoreNextClick = true;\n return;\n }\n if (self.dragMode === 'cell') {\n self.selecting = true;\n if (self.attributes.rowSelectionMode) {\n self.selectRow(self.dragStartObject.rowIndex, ctrl, null, true);\n }\n return self.mousemove(e);\n }\n if (['ns-resize', 'ew-resize'].indexOf(self.dragMode) !== -1) {\n self.draggingItem = self.dragItem;\n if (self.draggingItem.rowOpen) {\n self.resizingStartingHeight = self.sizes.trees[self.draggingItem.data[self.uniqueId]];\n } else {\n self.resizingStartingHeight = self.sizes.rows[self.draggingItem.data[self.uniqueId]] || self.style.cellHeight;\n }\n self.resizingStartingWidth = self.sizes.columns[self.draggingItem.header.style === 'rowHeaderCell'\n ? 'cornerCell' : self.draggingItem.header[self.uniqueId]] || self.draggingItem.header.width;\n document.body.addEventListener('mousemove', self.dragResizeColumn, false);\n document.body.addEventListener('mouseup', self.stopDragResize, false);\n }\n if (['row-reorder', 'column-reorder'].indexOf(self.dragMode) !== -1) {\n self.draggingItem = self.dragItem;\n document.body.addEventListener('mousemove', self.dragReorder, false);\n document.body.addEventListener('mouseup', self.stopDragReorder, false);\n }\n };\n self.mouseup = function (e) {\n clearTimeout(self.scrollTimer);\n self.cellBoundaryCrossed = true;\n self.selecting = undefined;\n self.draggingItem = undefined;\n self.dragStartObject = undefined;\n if (self.dispatchEvent('mouseup', {NativeEvent: e, cell: self.currentCell})) { return; }\n if (!self.hasFocus && e.target !== self.canvas) {\n return;\n }\n if (self.currentCell && self.currentCell.grid !== undefined) {\n return;\n }\n if (self.contextMenu || self.input) { return; }\n if (self.dragStart && self.isInGrid(self.dragStart)) {\n self.controlInput.focus();\n }\n e.preventDefault();\n };\n self.keydown = function (e) {\n var i,\n x = self.activeCell.columnIndex,\n y = self.activeCell.rowIndex,\n ctrl = (e.controlKey || e.metaKey),\n last = self.data.length - 1,\n cols = self.getVisibleSchema().length - 1;\n if (self.dispatchEvent('keydown', {NativeEvent: e, cell: self.currentCell})) { return; }\n if (!self.hasFocus) {\n return;\n }\n self.page = self.visibleRows.length - 3 - self.attributes.pageUpDownOverlap;\n if (self.attributes.showNewRow) {\n last += 1;\n }\n if (e.keyCode === 9) {\n e.preventDefault();\n }\n // ctrl + a\n if (ctrl && e.keyCode === 65) {\n self.selectAll();\n //ArrowDown\n } else if (e.keyCode === 40) {\n y += 1;\n //ArrowUp\n } else if (e.keyCode === 38) {\n y -= 1;\n //ArrowLeft Tab\n } else if (e.keyCode === 37 || (e.shiftKey && e.keyCode === 9)) {\n x -= 1;\n //ArrowRight Tab\n } else if (e.keyCode === 39 || (!e.shiftKey && e.keyCode === 9)) {\n x += 1;\n //PageUp\n } else if (e.keyCode === 33) {\n y -= self.page;\n e.preventDefault();\n //PageDown\n } else if (e.keyCode === 34) {\n y += self.page;\n e.preventDefault();\n //Home ArrowUp\n } else if (e.keyCode === 36 || (ctrl && e.keyCode === 38)) {\n y = 0;\n //End ArrowDown\n } else if (e.keyCode === 35 || (ctrl && e.keyCode === 40)) {\n y = self.data.length - 1;\n //ArrowRight\n } else if (ctrl && e.keyCode === 39) {\n x = cols;\n //ArrowLeft\n } else if (ctrl && e.keyCode === 37) {\n x = 0;\n }\n //Enter\n if (e.keyCode === 13) {\n return self.beginEditAt(x, y);\n }\n //Space\n if (e.keyCode === 32) {\n self.selections = [];\n self.selections[Math.max(y, 0)] = [];\n self.selections[Math.max(y, 0)].push(x);\n self.selectionBounds = self.getSelectionBounds();\n if (self.attributes.rowSelectionMode) {\n for (i = self.selectionBounds.top; i <= self.selectionBounds.bottom; i += 1) {\n self.selectRow(i, ctrl, null, true);\n }\n } else {\n self.selectArea(undefined, ctrl);\n }\n e.preventDefault();\n self.draw(true);\n return;\n }\n if (x < 0) {\n x = 0;\n }\n if (y > last) {\n y = last;\n }\n if (y < 0) {\n y = 0;\n }\n if (x > cols) {\n x = cols;\n }\n // Arrows\n if (e.shiftKey && [37, 38, 39, 40].indexOf(e.keyCode) !== -1) {\n self.selections[Math.max(y, 0)] = self.selections[Math.max(y, 0)] || [];\n self.selections[Math.max(y, 0)].push(x);\n self.selectionBounds = self.getSelectionBounds();\n self.selectArea(undefined, ctrl);\n self.draw(true);\n }\n if (x !== self.activeCell.columnIndex || y !== self.activeCell.rowIndex) {\n self.scrollIntoView(x !== self.activeCell.columnIndex ? x : undefined, y !== self.activeCell.rowIndex ? y : undefined);\n self.setActiveCell(x, y);\n if (!e.shiftKey && self.attributes.selectionFollowsActiveCell) {\n if (!ctrl) {\n self.selections = [];\n }\n self.selections[y] = self.selections[y] || [];\n self.selections[y].push(x);\n self.dispatchEvent('selectionchanged', {\n selectedData: self.getSelectedData(),\n selections: self.selections,\n selectionBounds: self.selectionBounds\n });\n }\n self.draw(true);\n }\n };\n self.keyup = function (e) {\n if (self.dispatchEvent('keyup', {NativeEvent: e, cell: self.currentCell})) { return; }\n if (!self.hasFocus) {\n return;\n }\n self.controlInput.value = '';\n };\n self.keypress = function (e) {\n if (!self.hasFocus) {\n return;\n }\n if (self.dispatchEvent('keypress', {NativeEvent: e, cell: self.currentCell})) { return; }\n };\n self.dblclick = function (e) {\n if (self.dispatchEvent('dblclick', {NativeEvent: e, cell: self.currentCell})) { return; }\n if (!self.hasFocus) {\n return;\n }\n if (self.currentCell.context === 'ew-resize'\n && self.currentCell.style === 'columnHeaderCell') {\n self.fitColumnToValues(self.currentCell.header.name);\n } else if (self.currentCell.context === 'ew-resize'\n && self.currentCell.style === 'cornerCell') {\n self.autosize();\n } else if (['cell', 'activeCell'].indexOf(self.currentCell.style) !== -1) {\n self.beginEditAt(self.currentCell.columnIndex, self.currentCell.rowIndex);\n }\n };\n self.scrollWheel = function (e) {\n if (self.dispatchEvent('wheel', {NativeEvent: e})) {\n return;\n }\n self.touchHaltAnimation = true;\n var l = self.scrollBox.scrollLeft,\n t = self.scrollBox.scrollTop;\n if (self.hasFocus) {\n self.scrollBox.scrollTop += e.deltaY;\n self.scrollBox.scrollLeft += e.deltaX;\n }\n if (t !== self.scrollBox.scrollTop || l !== self.scrollBox.scrollLeft) {\n e.preventDefault();\n }\n };\n self.copy = function (e) {\n if (self.dispatchEvent('copy', {NativeEvent: e})) { return; }\n if (!self.hasFocus || !e.clipboardData) { return; }\n var rows = [], sData = self.getSelectedData();\n if (sData.length > 0) {\n sData.forEach(function (row) {\n if (row) {\n var r = [];\n Object.keys(row).forEach(function (key) {\n r.push(row[key]);\n });\n r.join(',');\n rows.push(r);\n }\n });\n e.clipboardData.setData('text/plain', rows.join('\\n'));\n e.preventDefault();\n }\n };\n return;\n };\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/events.js\n// module id = 2\n// module chunks = 0","/*jslint browser: true, unparam: true, todo: true*/\n/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/\ndefine([], function () {\n 'use strict';\n return function (self) {\n self.orders = {\n rows: [],\n columns: []\n };\n self.hasFocus = false;\n self.activeCell = {\n columnIndex: 0,\n rowIndex: 0\n };\n self.storageName = 'canvasDataGrid';\n self.invalidSearchExpClass = 'canvas-datagrid-invalid-search-regExp';\n self.localStyleLibraryStorageKey = 'canvas-datagrid-user-style-library';\n self.uniqueId = '_canvasDataGridUniqueId';\n self.orderBy = self.uniqueId;\n self.orderDirection = 'asc';\n self.columnFilters = {};\n self.filters = {};\n self.ellipsisCache = {};\n self.scrollBox = {};\n self.visibleRows = [];\n self.sizes = {\n rows: {},\n columns: {},\n trees: {}\n };\n self.currentFilter = function () {\n return true;\n };\n self.selections = [];\n self.hovers = {};\n self.attributes = {};\n self.style = {};\n self.intf = {};\n self.formatters = {};\n self.sorters = {};\n self.schemaHashes = {};\n self.events = {};\n self.uId = 0;\n self.changes = [];\n self.scrollIndexTop = 0;\n self.scrollPixelTop = 0;\n self.scrollIndexLeft = 0;\n self.scrollPixelLeft = 0;\n self.childGrids = {};\n self.openChildren = {};\n self.scrollModes = [\n 'vertical-scroll-box',\n 'vertical-scroll-top',\n 'vertical-scroll-bottom',\n 'horizontal-scroll-box',\n 'horizontal-scroll-right',\n 'horizontal-scroll-left'\n ];\n self.mouse = { x: 0, y: 0};\n self.getSelectedData = function (expandToRow) {\n var d = [], s = self.getSchema(), l = self.data.length;\n self.selections.forEach(function (row, index) {\n if (index === l) { return; }\n if (row.length === 0) {\n d[index] = null;\n return;\n }\n d[index] = {};\n if (expandToRow) {\n s.forEach(function (column) {\n d[index][column.name] = self.data[index][column.name];\n });\n } else {\n row.forEach(function (col) {\n if (col === -1) { return; }\n d[index][s[col].name] = self.data[index][s[col].name];\n });\n }\n });\n return d;\n };\n self.scrollOffset = function (e) {\n var x = 0, y = 0;\n while (e.parentNode) {\n if (e.nodeType !== 'canvas-datagrid-tree'\n && e.nodeType !== 'canvas-datagrid-cell') {\n x -= e.scrollLeft;\n y -= e.scrollTop;\n }\n e = e.parentNode;\n }\n return {left: x, top: y};\n };\n self.position = function (e, ignoreScrollOffset) {\n var x = 0, y = 0, s = e, h, w;\n while (e.offsetParent) {\n x += e.offsetLeft;\n y += e.offsetTop;\n h = e.offsetHeight;\n w = e.offsetWidth;\n e = e.offsetParent;\n }\n if (ignoreScrollOffset) {\n return {left: x, top: y, height: h, width: w};\n }\n e = s;\n s = self.scrollOffset(e);\n return { left: x + s.left, top: y + s.top, height: h, width: w };\n };\n self.getLayerPos = function (e) {\n var rect = self.canvas.getBoundingClientRect(),\n pos = {\n x: e.clientX - rect.left,\n y: e.clientY - rect.top\n };\n if (self.isChildGrid) {\n pos.x -= self.canvasOffsetLeft;\n pos.y -= self.canvasOffsetTop;\n }\n return {\n x: pos.x,\n y: pos.y,\n rect: rect\n };\n };\n self.fillArray = function (low, high, step) {\n step = step || 1;\n var i = [], x;\n for (x = low; x <= high; x += step) {\n i[x] = x;\n }\n return i;\n };\n self.getRowHeaderCellHeight = function () {\n if (!self.attributes.showColumnHeaders) { return 0; }\n return self.sizes.rows[-1] || self.style.columnHeaderCellHeight;\n };\n self.getColumnHeaderCellWidth = function () {\n if (!self.attributes.showRowHeaders) { return 0; }\n return self.sizes.columns.cornerCell || self.style.rowHeaderCellWidth;\n };\n self.setStorageData = function () {\n if (!self.attributes.saveAppearance) { return; }\n localStorage.setItem(self.storageName + '-' + self.attributes.name, JSON.stringify({\n sizes: {\n rows: self.sizes.rows,\n columns: self.sizes.columns\n },\n orders: {\n rows: self.orders.rows,\n columns: self.orders.columns\n },\n orderBy: self.orderBy,\n orderDirection: self.orderDirection\n }));\n };\n self.getSchema = function () {\n return self.schema || self.tempSchema;\n };\n self.createColumnOrders = function () {\n var s = self.getSchema();\n self.orders.columns = self.fillArray(0, s.length - 1);\n };\n self.createRowOrders = function () {\n self.orders.rows = self.fillArray(0, self.data.length - 1);\n };\n self.getVisibleSchema = function () {\n return self.getSchema().filter(function (col) { return !col.hidden; });\n };\n self.applyDefaultValue = function (row, header) {\n var d = header.defaultValue || '';\n if (typeof d === 'function') {\n d = d.apply(self.intf, [header]);\n }\n row[header.name] = d;\n };\n self.createNewRowData = function () {\n self.newRow = {};\n self.newRow[self.uniqueId] = self.uId;\n self.uId += 1;\n self.getSchema().forEach(function forEachHeader(header) {\n self.applyDefaultValue(self.newRow, header);\n });\n };\n self.getSchemaNameHash = function (key) {\n var n = 0;\n while (self.schemaHashes[key]) {\n n += 1;\n key = key + n;\n }\n return key;\n };\n self.filter = function (type) {\n var f = self.filters[type];\n if (!f && type !== undefined) {\n console.warn('Cannot find filter for type %s, falling back to substring match.', type);\n f = self.filters.string;\n }\n return f;\n };\n self.getBestGuessDataType = function (columnName) {\n var t, x, l = self.data.length;\n for (x = 0; x < l; x += 1) {\n if ([null, undefined].indexOf(self.data[x][columnName]) !== -1) {\n t = typeof self.data[x];\n return t === 'object' ? 'string' : t;\n }\n }\n return 'string';\n };\n self.drawChildGrids = function () {\n Object.keys(self.childGrids).forEach(function (gridKey) {\n self.childGrids[gridKey].draw();\n });\n };\n self.resizeChildGrids = function () {\n Object.keys(self.childGrids).forEach(function (gridKey) {\n self.childGrids[gridKey].resize();\n });\n };\n self.getClippingRect = function (ele) {\n var boundingRect = self.position(self.parentNode),\n eleRect = self.position(ele),\n s = self.scrollOffset(self.canvas),\n clipRect = {\n x: 0,\n y: 0,\n h: 0,\n w: 0\n },\n parentRect = {\n x: -Infinity,\n y: -Infinity,\n h: Infinity,\n w: Infinity\n },\n rowHeaderCellHeight = self.getRowHeaderCellHeight(),\n columnHeaderCellWidth = self.getColumnHeaderCellWidth();\n boundingRect.top -= s.top;\n boundingRect.left -= s.left;\n eleRect.top -= s.top;\n eleRect.left -= s.left;\n clipRect.h = boundingRect.top + boundingRect.height - ele.offsetTop - self.style.scrollBarWidth;\n clipRect.w = boundingRect.left + boundingRect.width - ele.offsetLeft - self.style.scrollBarWidth;\n clipRect.x = boundingRect.left + (eleRect.left * -1) + columnHeaderCellWidth;\n clipRect.y = boundingRect.top + (eleRect.top * -1) + rowHeaderCellHeight;\n return {\n x: clipRect.x > parentRect.x ? clipRect.x : parentRect.x,\n y: clipRect.y > parentRect.y ? clipRect.y : parentRect.y,\n h: clipRect.h < parentRect.h ? clipRect.h : parentRect.h,\n w: clipRect.w < parentRect.w ? clipRect.w : parentRect.w\n };\n };\n self.clipElement = function (ele) {\n var clipRect = self.getClippingRect(ele);\n if (clipRect.w < 0) { clipRect.w = 0; }\n if (clipRect.h < 0) { clipRect.h = 0; }\n ele.style.clip = 'rect('\n + clipRect.y + 'px,'\n + clipRect.w + 'px,'\n + clipRect.h + 'px,'\n + clipRect.x + 'px'\n + ')';\n // INFO https://developer.mozilla.org/en-US/docs/Web/CSS/clip\n // clip has been \"deprecated\" for clipPath. Of course nothing but chrome\n // supports clip path, so we'll keep using clip until someday clipPath becomes\n // more widely support. The code below works correctly, but setting clipPath and clip\n // at the same time has undesirable results.\n // ele.style.clipPath = 'polygon('\n // + clipRect.x + 'px ' + clipRect.y + 'px,'\n // + clipRect.x + 'px ' + clipRect.h + 'px,'\n // + clipRect.w + 'px ' + clipRect.h + 'px,'\n // + clipRect.w + 'px ' + clipRect.y + 'px'\n // + ')';\n };\n self.autoScrollZone = function (e, x, y, ctrl) {\n var setTimer,\n columnHeaderCellWidth = self.getColumnHeaderCellWidth(),\n rowHeaderCellHeight = self.getRowHeaderCellHeight();\n if (x > self.width - self.attributes.selectionScrollZone && x < self.width) {\n self.scrollBox.scrollLeft += self.attributes.selectionScrollIncrement;\n setTimer = true;\n }\n if (y > self.height - self.attributes.selectionScrollZone && y < self.height) {\n self.scrollBox.scrollTop += self.attributes.selectionScrollIncrement;\n setTimer = true;\n }\n if (x - self.attributes.selectionScrollZone - columnHeaderCellWidth < 0) {\n self.scrollBox.scrollLeft -= self.attributes.selectionScrollIncrement;\n setTimer = true;\n }\n if (y - self.attributes.selectionScrollZone - rowHeaderCellHeight < 0) {\n self.scrollBox.scrollTop -= self.attributes.selectionScrollIncrement;\n setTimer = true;\n }\n if (setTimer && !ctrl && self.currentCell && self.currentCell.columnIndex !== -1) {\n self.scrollTimer = setTimeout(self.mousemove, self.attributes.scrollRepeatRate, e);\n }\n };\n self.refreshFromOrigialData = function () {\n self.data = self.originalData.filter(function (row) {\n return true;\n });\n };\n self.validateColumn = function (c, s) {\n if (!c.name) {\n throw new Error('A column must contain at least a name.');\n }\n if (s.filter(function (i) { return i.name === c.name; }).length > 0) {\n throw new Error('A column with the name '\n + c.name + ' already exists and cannot be added again.');\n }\n return true;\n };\n self.setDefaults = function (obj1, obj2, key, def) {\n obj1[key] = obj2[key] === undefined ? def : obj2[key];\n };\n self.setAttributes = function () {\n self.defaults.attributes.forEach(function eachAttribute(i) {\n self.setDefaults(self.attributes, self.args, i[0], i[1]);\n });\n };\n self.setStyle = function () {\n self.defaults.styles.forEach(function eachStyle(i) {\n self.setDefaults(self.style, self.args.style || {}, i[0], i[1]);\n });\n };\n self.autosize = function (colName) {\n self.getVisibleSchema().forEach(function (col) {\n if (col.name === colName || colName === undefined) {\n self.fitColumnToValues(col.name);\n }\n });\n self.fitColumnToValues('cornerCell');\n };\n self.dispose = function () {\n if (!self.isChildGrid && self.canvas && self.canvas.parentNode) {\n self.canvas.parentNode.removeChild(self.canvas);\n }\n self.eventParent.removeEventListener('mouseup', self.mouseup, false);\n self.eventParent.removeEventListener('mousedown', self.mousedown, false);\n self.eventParent.removeEventListener('dblclick', self.dblclick, false);\n self.eventParent.removeEventListener('click', self.click, false);\n self.eventParent.removeEventListener('mousemove', self.mousemove);\n self.eventParent.removeEventListener('wheel', self.scrollWheel, false);\n self.canvas.removeEventListener('contextmenu', self.contextmenu, false);\n self.canvas.removeEventListener('copy', self.copy);\n self.controlInput.removeEventListener('keypress', self.keypress, false);\n self.controlInput.removeEventListener('keyup', self.keyup, false);\n self.controlInput.removeEventListener('keydown', self.keydown, false);\n window.removeEventListener('resize', self.resize);\n if (self.observer && self.observer.disconnect) {\n self.observer.disconnect();\n }\n };\n self.tryLoadStoredOrders = function () {\n var s;\n if (self.storedSettings && typeof self.storedSettings.orders === 'object') {\n if (self.storedSettings.orders.rows.length >= self.data.length) {\n self.orders.rows = self.storedSettings.orders.rows;\n }\n s = self.getSchema();\n self.orders.columns = self.storedSettings.orders.columns;\n s.forEach(function (h, i) {\n if (self.orders.columns.indexOf(i) === -1) {\n self.orders.columns.push(i);\n }\n });\n self.orderBy = self.storedSettings.orderBy === undefined\n ? self.uniqueId : self.storedSettings.orderBy;\n self.orderDirection = self.storedSettings.orderDirection === undefined\n ? self.uniqueId : self.storedSettings.orderDirection;\n if (self.getHeaderByName(self.orderBy) && self.orderDirection) {\n self.order(self.orderBy, self.orderDirection);\n }\n }\n };\n self.getFontHeight = function (fontStyle) {\n return parseFloat(fontStyle, 10);\n };\n self.parseFont = function (key) {\n if (/Font/.test(key)) {\n self.style[key + 'Height'] = self.getFontHeight(self.style[key]);\n }\n };\n self.initProp = function (propName) {\n if (!self.args[propName]) { return; }\n Object.keys(self.args[propName]).forEach(function (key) {\n self[propName][key] = self.args[propName][key];\n });\n };\n self.init = function () {\n var publicStyleKeyIntf = {};\n self.setAttributes();\n self.setStyle();\n self.initScrollBox();\n self.setDom();\n self.type = 'canvas-datagrid';\n Object.keys(self.style).forEach(self.parseFont);\n self.intf.type = self.type;\n self.intf.addEventListener = self.addEventListener;\n self.intf.removeEventListener = self.removeEventListener;\n self.intf.dispatchEvent = self.dispatchEvent;\n self.intf.dispose = self.dispose;\n self.intf.appendTo = self.appendTo;\n self.intf.filters = self.filters;\n self.intf.sorters = self.sorters;\n self.intf.autosize = self.autosize;\n self.intf.beginEditAt = self.beginEditAt;\n self.intf.endEdit = self.endEdit;\n self.intf.setActiveCell = self.setActiveCell;\n self.intf.scrollIntoView = self.scrollIntoView;\n self.intf.clearChangeLog = self.clearChangeLog;\n self.intf.gotoCell = self.gotoCell;\n self.intf.gotoRow = self.gotoRow;\n self.intf.findColumnScrollLeft = self.findColumnScrollLeft;\n self.intf.findRowScrollTop = self.findRowScrollTop;\n self.intf.fitColumnToValues = self.fitColumnToValues;\n self.intf.findColumnMaxTextLength = self.findColumnMaxTextLength;\n self.intf.disposeContextMenu = self.disposeContextMenu;\n self.intf.getCellAt = self.getCellAt;\n self.intf.isCellVisible = self.isCellVisible;\n self.intf.order = self.order;\n self.intf.draw = self.draw;\n self.intf.selectArea = self.selectArea;\n self.intf.clipElement = self.clipElement;\n self.intf.getSchemaFromData = self.getSchemaFromData;\n self.intf.setFilter = self.setFilter;\n self.intf.selectRow = self.selectRow;\n self.intf.parentGrid = self.parentGrid;\n self.intf.toggleTree = self.toggleTree;\n self.intf.expandTree = self.expandTree;\n self.intf.collapseTree = self.collapseTree;\n self.intf.canvas = self.canvas;\n self.intf.context = self.ctx;\n self.intf.insertRow = self.insertRow;\n self.intf.deleteRow = self.deleteRow;\n self.intf.addRow = self.addRow;\n self.intf.insertColumn = self.insertColumn;\n self.intf.deleteColumn = self.deleteColumn;\n self.intf.addColumn = self.addColumn;\n self.intf.getClippingRect = self.getClippingRect;\n self.intf.setRowHeight = self.setRowHeight;\n self.intf.setColumnWidth = self.setColumnWidth;\n self.intf.resetColumnWidths = self.resetColumnWidths;\n self.intf.resetRowHeights = self.resetRowHeights;\n self.intf.resize = self.resize;\n self.intf.selectColumn = self.selectColumn;\n self.intf.selectRow = self.selectRow;\n self.intf.selectAll = self.selectAll;\n self.intf.drawChildGrids = self.drawChildGrids;\n self.intf.assertPxColor = self.assertPxColor;\n self.intf.clearPxColorAssertions = self.clearPxColorAssertions;\n self.intf.integerToAlpha = self.integerToAlpha;\n self.intf.style = {};\n Object.keys(self.style).forEach(function (key) {\n // unless this line is here, Object.keys() will not work on .style\n publicStyleKeyIntf[key] = undefined;\n Object.defineProperty(publicStyleKeyIntf, key, {\n get: function () {\n return self.style[key];\n },\n set: function (value) {\n self.parseFont(value);\n self.style[key] = value;\n self.draw(true);\n self.dispatchEvent('stylechanged', {name: key, value: value});\n }\n });\n });\n Object.defineProperty(self.intf, 'activeCell', {\n get: function () {\n return self.activeCell;\n }\n });\n /**\n * When true, the grid is has focus.\n * @memberof canvasDataGrid\n * @property hasFocus\n * @readonly\n */\n Object.defineProperty(self.intf, 'hasFocus', {\n get: function () {\n return self.hasFocus;\n }\n });\n Object.defineProperty(self.intf, 'style', {\n get: function () {\n return publicStyleKeyIntf;\n },\n set: function (value) {\n Object.keys(value).forEach(function (key) {\n self.parseFont(value);\n self.style[key] = value[key];\n });\n self.draw(true);\n self.dispatchEvent('stylechanged', {name: 'style', value: value});\n }\n });\n Object.keys(self.attributes).forEach(function (key) {\n Object.defineProperty(self.intf.attributes, key, {\n get: function () {\n return self.attributes[key];\n },\n set: function (value) {\n self.attributes[key] = value;\n self.draw(true);\n self.dispatchEvent('attributechanged', {name: key, value: value[key]});\n }\n });\n });\n self.filters.string = function (value, filterFor) {\n if (!filterFor) { return true; }\n var filterRegExp;\n self.invalidFilterRegEx = undefined;\n try {\n filterRegExp = new RegExp(filterFor, 'ig');\n } catch (e) {\n self.invalidFilterRegEx = e;\n return;\n }\n return filterRegExp.test(value);\n };\n self.filters.number = function (value, filterFor) {\n if (!filterFor) { return true; }\n return value === filterFor;\n };\n if (self.attributes.name && self.attributes.saveAppearance) {\n self.storedSettings = localStorage.getItem(self.storageName + '-' + self.attributes.name);\n if (self.storedSettings) {\n try {\n self.storedSettings = JSON.parse(self.storedSettings);\n } catch (e) {\n console.warn('could not read settings from localStore', e);\n self.storedSettings = undefined;\n }\n }\n if (self.storedSettings) {\n if (typeof self.storedSettings.sizes === 'object') {\n self.sizes.rows = self.storedSettings.sizes.rows;\n self.sizes.columns = self.storedSettings.sizes.columns;\n ['trees', 'columns', 'rows'].forEach(function (i) {\n if (!self.sizes[i]) {\n self.sizes[i] = {};\n }\n });\n }\n }\n }\n ['formatters', 'filters', 'sorters'].forEach(self.initProp);\n if (self.args.data) {\n self.intf.data = self.args.data;\n }\n if (!self.data) {\n self.intf.data = [];\n }\n if (self.args.schema) {\n self.intf.schema = self.args.schema;\n }\n if (self.isChildGrid) {\n requestAnimationFrame(function () { self.resize(true); });\n } else {\n self.resize(true);\n }\n };\n /**\n * Removes focus from the grid.\n * @memberof canvasDataGrid\n * @name blur\n * @method\n */\n self.intf.blur = function (e) {\n self.hasFocus = false;\n };\n /**\n * Focuses on the grid.\n * @memberof canvasDataGrid\n * @name focus\n * @method\n */\n self.intf.focus = function () {\n self.hasFocus = true;\n self.controlInput.focus();\n };\n Object.defineProperty(self.intf, 'height', {\n get: function () {\n return self.parentNode.height;\n },\n set: function (value) {\n self.parentNode.height = value;\n self.resize(true);\n }\n });\n Object.defineProperty(self.intf, 'width', {\n get: function () {\n return self.parentNode.width;\n },\n set: function (value) {\n self.parentNode.width = value;\n self.resize(true);\n }\n });\n Object.defineProperty(self.intf, 'openChildren', {\n get: function () {\n return self.openChildren;\n }\n });\n Object.defineProperty(self.intf, 'childGrids', {\n get: function () {\n return Object.keys(self.childGrids).map(function (gridId) {\n return self.childGrids[gridId];\n });\n }\n });\n Object.defineProperty(self.intf, 'isChildGrid', {\n get: function () {\n return self.isChildGrid;\n }\n });\n Object.defineProperty(self.intf, 'parentNode', {\n get: function () {\n return self.parentNode;\n },\n set: function (value) {\n self.parentNode = value;\n }\n });\n Object.defineProperty(self.intf, 'offsetParent', {\n get: function () {\n return self.parentNode;\n },\n set: function (value) {\n self.parentNode = value;\n }\n });\n Object.defineProperty(self.intf, 'offsetLeft', {\n get: function () {\n return self.parentNode.offsetLeft;\n }\n });\n Object.defineProperty(self.intf, 'offsetTop', {\n get: function () {\n return self.parentNode.offsetTop;\n }\n });\n Object.defineProperty(self.intf, 'scrollHeight', {\n get: function () {\n return self.scrollBox.scrollHeight;\n }\n });\n Object.defineProperty(self.intf, 'scrollWidth', {\n get: function () {\n return self.scrollBox.scrollWidth;\n }\n });\n Object.defineProperty(self.intf, 'scrollTop', {\n get: function () {\n return self.scrollBox.scrollTop;\n },\n set: function (value) {\n self.scrollBox.scrollTop = value;\n }\n });\n Object.defineProperty(self.intf, 'scrollLeft', {\n get: function () {\n return self.scrollBox.scrollLeft;\n },\n set: function (value) {\n self.scrollBox.scrollLeft = value;\n }\n });\n Object.defineProperty(self.intf, 'sizes', {\n get: function () {\n return self.sizes;\n }\n });\n Object.defineProperty(self.intf, 'input', {\n get: function () {\n return self.input;\n }\n });\n Object.defineProperty(self.intf, 'controlInput', {\n get: function () {\n return self.controlInput;\n }\n });\n Object.defineProperty(self.intf, 'currentCell', {\n get: function () {\n return self.currentCell;\n }\n });\n Object.defineProperty(self.intf, 'visibleCells', {\n get: function () {\n return self.visibleCells;\n }\n });\n Object.defineProperty(self.intf, 'visibleRows', {\n get: function () {\n return self.visibleRows;\n }\n });\n Object.defineProperty(self.intf, 'selections', {\n get: function () {\n return self.selections;\n }\n });\n Object.defineProperty(self.intf, 'dragMode', {\n get: function () {\n return self.dragMode;\n }\n });\n Object.defineProperty(self.intf, 'changes', {\n get: function () {\n return self.changes;\n }\n });\n self.intf.attributes = {};\n self.intf.formatters = self.formatters;\n self.normalizeDataset = function (data) {\n var i, d, max, syncFnInvoked;\n if (data === null || data === '' || data === undefined) {\n return [];\n }\n if (typeof data === 'string'\n || typeof data === 'number'\n || typeof data === 'boolean') {\n data = [{'0': data}];\n }\n if (!Array.isArray(data) && typeof data === 'object') {\n data = [data];\n }\n if ((!Array.isArray(data[0]) && typeof data[0] === 'object')\n || (Array.isArray(data) && data.length === 0)) {\n return data;\n }\n if (typeof data === 'function') {\n i = data.apply(self.intf, [function (d) {\n if (syncFnInvoked) {\n console.warn('Detected a callback to the data setter function after the same function already returned a value synchronously.');\n }\n self.normalizeDataset(d);\n }]);\n if (i) {\n syncFnInvoked = true;\n self.normalizeDataset(i);\n }\n }\n if (!Array.isArray(data) && typeof data === 'object') {\n data = [data];\n }\n if (Array.isArray(data)) {\n if (!Array.isArray(data[0])) {\n //array of something? throw it all into 1 row!\n data = [data];\n }\n // find the longest length\n max = 0;\n d = [];\n data.forEach(function (row) {\n max = Math.max(max, row.length);\n });\n // map against length indexes\n data.forEach(function (row, index) {\n var x;\n d[index] = {};\n for (x = 0; x < max; x += 1) {\n d[index][x] = row[x] || null;\n }\n });\n return d;\n }\n throw new Error('Unsupported data type. Must be an array of arrays or an array of objects, function or string.');\n };\n Object.defineProperty(self.intf, 'selectionBounds', {\n get: function () {\n return self.getSelectionBounds();\n }\n });\n Object.defineProperty(self.intf, 'selectedRows', {\n get: function () {\n return self.getSelectedData(true);\n }\n });\n Object.defineProperty(self.intf, 'selectedCells', {\n get: function () {\n return self.getSelectedData();\n }\n });\n Object.defineProperty(self.intf, 'visibleSchema', {\n get: function () {\n return self.getVisibleSchema().map(function eachDataRow(col) {\n return col;\n });\n }\n });\n Object.defineProperty(self.intf, 'ctx', {\n get: function () {\n return self.ctx;\n }\n });\n Object.defineProperty(self.intf, 'schema', {\n get: function schemaGetter() {\n return self.getSchema();\n },\n set: function schemaSetter(value) {\n if (!Array.isArray(value) || typeof value[0] !== 'object') {\n throw new Error('Schema must be an array of objects.');\n }\n if (value[0].name === undefined) {\n throw new Error('Expected schema to contain an object with at least a name property.');\n }\n self.schema = value.map(function eachSchemaColumn(column, index) {\n column.width = column.width || self.style.columnWidth;\n column[self.uniqueId] = self.getSchemaNameHash(column.name);\n column.filter = column.filter || self.filter(column.type);\n column.type = column.type || 'string';\n column.index = index;\n column.columnIndex = index;\n column.rowIndex = -1;\n return column;\n });\n self.tempSchema = undefined;\n self.createNewRowData();\n self.createColumnOrders();\n self.tryLoadStoredOrders();\n self.resize(true);\n self.dispatchEvent('schemachanged', {schema: self.schema});\n }\n });\n Object.defineProperty(self.intf, 'data', {\n get: function dataGetter() {\n return self.data.map(function (row) {\n delete row[self.uniqueId];\n return row;\n });\n },\n set: function dataSetter(value) {\n self.originalData = self.normalizeDataset(value).map(function eachDataRow(row) {\n row[self.uniqueId] = self.uId;\n self.uId += 1;\n return row;\n });\n self.changes = [];\n //TODO apply filter to incoming dataset\n self.data = self.originalData;\n if (!self.schema && self.data.length > 0) {\n self.tempSchema = self.getSchemaFromData();\n }\n if (!self.schema && self.data.length === 0) {\n self.tempSchema = [{name: ''}];\n self.tempSchema[0][self.uniqueId] = self.getSchemaNameHash('');\n }\n if (self.tempSchema && !self.schema) {\n self.createColumnOrders();\n self.tryLoadStoredOrders();\n self.dispatchEvent('schemachanged', {schema: self.tempSchema});\n }\n self.createNewRowData();\n if (self.attributes.autoResizeColumns && self.data.length > 0\n && self.storedSettings === undefined) {\n self.autosize();\n }\n self.fitColumnToValues('cornerCell', true);\n if (!self.resize() || !self.isChildGrid) { self.draw(true); }\n self.createRowOrders();\n self.tryLoadStoredOrders();\n self.dispatchEvent('datachanged', {data: self.data});\n }\n });\n self.initScrollBox = function () {\n var sHeight = 0,\n sWidth = 0,\n scrollTop = 0,\n scrollLeft = 0,\n scrollHeight = 0,\n scrollWidth = 0,\n scrollBoxHeight = 20,\n scrollBoxWidth = 20;\n function setScrollTop(value, preventScrollEvent) {\n if (isNaN(value)) {\n throw new Error('ScrollTop value must be a number');\n }\n if (value < 0) {\n value = 0;\n }\n if (value > scrollHeight) {\n value = scrollHeight;\n }\n if (scrollHeight < 0) {\n value = 0;\n }\n scrollTop = value;\n if (!preventScrollEvent) {\n self.scroll();\n }\n }\n function setScrollLeft(value, preventScrollEvent) {\n if (isNaN(value)) {\n throw new Error('ScrollLeft value must be a number');\n }\n if (value < 0) {\n value = 0;\n }\n if (value > scrollWidth) {\n value = scrollWidth;\n }\n if (scrollWidth < 0) {\n value = 0;\n }\n scrollLeft = value;\n if (!preventScrollEvent) {\n self.scroll();\n }\n }\n self.scrollBox.scrollTo = function (x, y) {\n setScrollLeft(x, true);\n setScrollTop(y);\n };\n Object.defineProperty(self.scrollBox, 'scrollBoxHeight', {\n get: function () {\n return scrollBoxHeight;\n },\n set: function (value) {\n scrollBoxHeight = value;\n }\n });\n Object.defineProperty(self.scrollBox, 'scrollBoxWidth', {\n get: function () {\n return scrollBoxWidth;\n },\n set: function (value) {\n scrollBoxWidth = value;\n }\n });\n Object.defineProperty(self.scrollBox, 'height', {\n get: function () {\n return sHeight;\n },\n set: function (value) {\n if (scrollHeight < value) {\n scrollTop = 0;\n }\n sHeight = value;\n }\n });\n Object.defineProperty(self.scrollBox, 'width', {\n get: function () {\n return sWidth;\n },\n set: function (value) {\n sWidth = value;\n }\n });\n Object.defineProperty(self.scrollBox, 'scrollTop', {\n get: function () {\n return scrollTop;\n },\n set: setScrollTop\n });\n Object.defineProperty(self.scrollBox, 'scrollLeft', {\n get: function () {\n return scrollLeft;\n },\n set: setScrollLeft\n });\n Object.defineProperty(self.scrollBox, 'scrollHeight', {\n get: function () {\n return scrollHeight;\n },\n set: function (value) {\n if (scrollTop > value) {\n scrollTop = Math.max(value, 0);\n }\n if (scrollHeight < sHeight) {\n scrollTop = 0;\n }\n scrollHeight = value;\n }\n });\n Object.defineProperty(self.scrollBox, 'scrollWidth', {\n get: function () {\n return scrollWidth;\n },\n set: function (value) {\n if (scrollLeft > value) {\n scrollLeft = Math.max(value, 0);\n }\n scrollWidth = value;\n }\n });\n };\n return;\n };\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/intf.js\n// module id = 3\n// module chunks = 0","/*jslint browser: true, unparam: true, todo: true*/\n/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false, Event: false*/\ndefine([], function () {\n 'use strict';\n return function (self) {\n var zIndexTop = 2, hoverScrollTimeout, autoCompleteContext;\n function createContextMenu(ev, pos, items, parentContextMenu) {\n var container = document.createElement('div'),\n upArrow = document.createElement('div'),\n downArrow = document.createElement('div'),\n children = [],\n selectedIndex = -1,\n intf = {},\n rect;\n if (!Array.isArray(items)) { throw new Error('createContextMenu expects an array.'); }\n function createItems() {\n items.forEach(function (item) {\n var contextItemContainer = document.createElement('div'),\n childMenuArrow;\n function removeChildContext(e) {\n if (e.relatedTarget === container\n || item.contextMenu.container === e.relatedTarget\n || childMenuArrow === e.relatedTarget\n || (contextItemContainer === e.relatedTarget)\n ) { return; }\n item.contextMenu.dispose();\n children.splice(children.indexOf(item.contextMenu), 1);\n item.contextMenu = undefined;\n contextItemContainer.removeEventListener('mouseout', removeChildContext);\n container.removeEventListener('mouseout', removeChildContext);\n contextItemContainer.setAttribute('contextOpen', '0');\n contextItemContainer.setAttribute('opening', '0');\n }\n function contextAddCallback(items) {\n // check yet again if the user hasn't moved off\n if (contextItemContainer.getAttribute('opening') !== '1' ||\n contextItemContainer.getAttribute('contextOpen') === '1') {\n return;\n }\n var cPos = contextItemContainer.getBoundingClientRect();\n cPos = {\n left: cPos.left + self.style.childContextMenuMarginLeft + container.offsetWidth,\n top: cPos.top + self.style.childContextMenuMarginTop,\n bottom: cPos.bottom,\n right: cPos.right,\n };\n item.contextMenu = createContextMenu(ev, cPos, items, intf);\n contextItemContainer.setAttribute('contextOpen', '1');\n contextItemContainer.addEventListener('mouseout', removeChildContext);\n container.addEventListener('mouseout', removeChildContext);\n children.push(item.contextMenu);\n }\n function createChildContext() {\n var i;\n if (contextItemContainer.getAttribute('contextOpen') === '1') {\n return;\n }\n contextItemContainer.setAttribute('opening', '1');\n if (typeof item.items === 'function') {\n i = item.items.apply(intf, [function (items) {\n contextAddCallback(items);\n }]);\n if (i !== undefined && Array.isArray(i)) {\n contextAddCallback(i);\n }\n return;\n }\n contextAddCallback(item.items);\n }\n function addItem(item) {\n function addContent(content) {\n if (typeof content === 'function') {\n return addContent(content(ev));\n }\n if (typeof content === 'object') {\n contextItemContainer.appendChild(content);\n return;\n }\n self.createInlineStyle(contextItemContainer, 'canvas-datagrid-context-menu-item');\n contextItemContainer.addEventListener('mouseover', function () {\n self.createInlineStyle(contextItemContainer, 'canvas-datagrid-context-menu-item:hover');\n });\n contextItemContainer.addEventListener('mouseout', function () {\n self.createInlineStyle(contextItemContainer, 'canvas-datagrid-context-menu-item');\n });\n contextItemContainer.innerHTML = content;\n return;\n }\n addContent(item.title);\n item.contextItemContainer = contextItemContainer;\n if (item.items && item.items.length > 0) {\n childMenuArrow = document.createElement('div');\n self.createInlineStyle(childMenuArrow, 'canvas-datagrid-context-child-arrow');\n childMenuArrow.innerHTML = self.style.childContextMenuArrowHTML;\n contextItemContainer.appendChild(childMenuArrow);\n contextItemContainer.addEventListener('mouseover', createChildContext);\n contextItemContainer.addEventListener('mouseout', function () {\n contextItemContainer.setAttribute('opening', '0');\n });\n }\n if (item.click) {\n contextItemContainer.addEventListener('click', function (ev) {\n item.click.apply(self, [ev]);\n });\n }\n }\n addItem(item);\n container.appendChild(contextItemContainer);\n });\n }\n function clickIndex(idx) {\n items[idx].contextItemContainer.dispatchEvent(new Event('click'));\n }\n function checkArrowVisibility() {\n if (container.scrollTop > 0) {\n document.body.appendChild(upArrow);\n } else if (upArrow.parentNode) {\n upArrow.parentNode.removeChild(upArrow);\n }\n if (container.scrollTop >= container.scrollHeight - container.offsetHeight && downArrow.parentNode) {\n downArrow.parentNode.removeChild(downArrow);\n } else if (container.scrollHeight - container.offsetHeight > 0\n && !(container.scrollTop >= container.scrollHeight - container.offsetHeight)) {\n document.body.appendChild(downArrow);\n }\n }\n function startHoverScroll(type) {\n return function t() {\n var a = self.attributes.contextHoverScrollAmount;\n if (type === 'up' && container.scrollTop === 0) { return; }\n if (type === 'down' && container.scrollTop === container.scrollHeight) { return; }\n container.scrollTop += (type === 'up' ? -a : a);\n hoverScrollTimeout = setTimeout(t, self.attributes.contextHoverScrollRateMs, type);\n };\n }\n function endHoverScroll(type) {\n return function () {\n clearTimeout(hoverScrollTimeout);\n };\n }\n function init() {\n var loc = {},\n s = self.scrollOffset(self.canvas);\n createItems();\n self.createInlineStyle(container, 'canvas-datagrid-context-menu');\n loc.x = pos.left - s.left;\n loc.y = pos.top - s.top;\n loc.height = 0;\n zIndexTop += 1;\n container.style.position = 'absolute';\n upArrow.style.color = self.style.contextMenuArrowColor;\n downArrow.style.color = self.style.contextMenuArrowColor;\n [upArrow, downArrow].forEach(function (el) {\n el.style.textAlign = 'center';\n el.style.position = 'absolute';\n el.style.zIndex = zIndexTop + 1;\n });\n container.style.zIndex = zIndexTop;\n if (parentContextMenu && parentContextMenu.inputDropdown) {\n container.style.maxHeight = window.innerHeight - loc.y - self.style.autocompleteBottomMargin + 'px';\n container.style.minWidth = pos.width + 'px';\n loc.y += pos.height;\n }\n container.style.left = loc.x + 'px';\n container.style.top = loc.y + 'px';\n container.addEventListener('scroll', checkArrowVisibility);\n container.addEventListener('wheel', function (e) {\n if (self.hasFocus) {\n container.scrollTop += e.deltaY;\n container.scrollLeft += e.deltaX;\n }\n checkArrowVisibility();\n });\n upArrow.innerHTML = self.style.contextMenuArrowUpHTML;\n downArrow.innerHTML = self.style.contextMenuArrowDownHTML;\n container.appendChild(upArrow);\n document.body.appendChild(downArrow);\n document.body.appendChild(container);\n rect = container.getBoundingClientRect();\n if (rect.bottom > window.innerHeight && !(parentContextMenu && parentContextMenu.inputDropdown)) {\n loc.y = window.innerHeight - container.offsetHeight;\n if (loc.y < 0) { loc.y = 0; }\n if (container.offsetHeight > window.innerHeight) {\n container.style.height = window.innerHeight - self.style.contextMenuWindowMargin + 'px';\n }\n }\n if (rect.right > window.innerWidth) {\n if (parentContextMenu) {\n loc.x = parentContextMenu.container.offsetLeft - container.offsetWidth;\n } else {\n loc.x = window.innerWidth - container.offsetWidth;\n }\n }\n container.style.left = loc.x + 'px';\n container.style.top = loc.y + 'px';\n rect = container.getBoundingClientRect();\n upArrow.style.top = rect.top + 'px';\n downArrow.style.top = rect.top + rect.height - downArrow.offsetHeight + 'px';\n upArrow.style.left = rect.left + 'px';\n downArrow.style.left = rect.left + 'px';\n downArrow.style.width = container.offsetWidth + 'px';\n upArrow.style.width = container.offsetWidth + 'px';\n downArrow.addEventListener('mouseover', startHoverScroll('down'));\n downArrow.addEventListener('mouseout', endHoverScroll('down'));\n upArrow.addEventListener('mouseover', startHoverScroll('up'));\n upArrow.addEventListener('mouseout', endHoverScroll('up'));\n checkArrowVisibility();\n }\n intf.parentGrid = self.intf;\n intf.parentContextMenu = parentContextMenu;\n intf.container = container;\n init();\n intf.clickIndex = clickIndex;\n intf.rect = rect;\n intf.items = items;\n intf.upArrow = upArrow;\n intf.downArrow = downArrow;\n intf.dispose = function () {\n clearTimeout(hoverScrollTimeout);\n children.forEach(function (c) {\n c.dispose();\n });\n [downArrow, upArrow, container].forEach(function (el) {\n if (el.parentNode) { el.parentNode.removeChild(el); }\n });\n };\n Object.defineProperty(intf, 'selectedIndex', {\n get: function () {\n return selectedIndex;\n },\n set: function (value) {\n if (typeof value !== 'number' || isNaN(value || !isFinite(value))) {\n throw new Error('Context menu selected index must be a sane number.');\n }\n selectedIndex = value;\n if (selectedIndex > items.length - 1) {\n selectedIndex = items.length - 1;\n }\n if (selectedIndex < 0) {\n selectedIndex = 0;\n }\n items.forEach(function (item, index) {\n if (index === selectedIndex) {\n return self.createInlineStyle(item.contextItemContainer, 'canvas-datagrid-context-menu-item:hover');\n }\n self.createInlineStyle(item.contextItemContainer, 'canvas-datagrid-context-menu-item');\n });\n }\n });\n return intf;\n }\n function createFilterContextMenuItems(e) {\n var filterContainer = document.createElement('div'),\n filterLabel = document.createElement('div'),\n filterAutoCompleteButton = document.createElement('button'),\n filterInput = document.createElement('input'),\n n = e.cell && e.cell.header ? e.cell.header.title || e.cell.header.name : '',\n autoCompleteItems,\n iRect;\n function fillAutoComplete() {\n autoCompleteItems = {};\n self.data.forEach(function (row) {\n var value = row[e.cell.header.name];\n if (autoCompleteItems[value]) { return; }\n autoCompleteItems[value] = {\n title: self.formatters[e.cell.header.type || 'string']({ cell: { value: value }}),\n click: function (e) {\n filterInput.value = value;\n e.stopPropagation();\n filterInput.dispatchEvent(new Event('keyup'));\n self.disposeAutocomplete();\n return;\n }\n };\n });\n autoCompleteItems = Object.keys(autoCompleteItems).map(function (key) {\n return autoCompleteItems[key];\n });\n }\n function createAutoCompleteContext(ev) {\n if (ev && [40, 38, 13, 9, 27].indexOf(ev.keyCode) !== -1) { return; }\n fillAutoComplete();\n iRect = filterInput.getBoundingClientRect();\n if (autoCompleteContext) {\n autoCompleteContext.dispose();\n autoCompleteContext = undefined;\n }\n autoCompleteContext = createContextMenu(e, {\n left: iRect.left,\n top: iRect.top,\n right: iRect.right,\n bottom: iRect.bottom,\n height: iRect.height,\n width: iRect.width\n }, autoCompleteItems, {inputDropdown: true});\n autoCompleteContext.selectedIndex = 0;\n }\n self.createInlineStyle(filterLabel, 'canvas-datagrid-context-menu-label');\n self.createInlineStyle(filterAutoCompleteButton, 'canvas-datagrid-context-menu-filter-button');\n self.createInlineStyle(filterInput, 'canvas-datagrid-context-menu-filter-input');\n filterInput.onclick = self.disposeAutocomplete;\n filterInput.addEventListener('keydown', function (e) {\n //down\n if (e.keyCode === 40) {\n autoCompleteContext.selectedIndex += 1;\n }\n //up\n if (e.keyCode === 38) {\n autoCompleteContext.selectedIndex -= 1;\n }\n //enter\n if (e.keyCode === 13) {\n autoCompleteContext.clickIndex(autoCompleteContext.selectedIndex);\n self.disposeContextMenu();\n }\n //tab\n if (e.keyCode === 9) {\n autoCompleteContext.clickIndex(autoCompleteContext.selectedIndex);\n e.preventDefault();\n }\n //esc\n if (e.keyCode === 27) {\n self.disposeContextMenu();\n }\n });\n filterInput.addEventListener('keyup', function () {\n self.setFilter(e.cell.header.name, filterInput.value);\n });\n filterInput.addEventListener('keyup', createAutoCompleteContext);\n filterInput.value = e.cell.header ? self.columnFilters[e.cell.header.name] || '' : '';\n filterLabel.innerHTML = self.attributes.filterOptionText.replace(/%s/g, n);\n filterAutoCompleteButton.onclick = function () {\n if (autoCompleteContext) {\n return self.disposeAutocomplete();\n }\n createAutoCompleteContext();\n };\n filterAutoCompleteButton.innerHTML = self.style.contextFilterButtonHTML;\n filterContainer.addEventListener('click', function (e) {\n return e.stopPropagation();\n });\n filterContainer.appendChild(filterLabel);\n filterContainer.appendChild(filterInput);\n filterContainer.appendChild(filterAutoCompleteButton);\n e.items.push({\n title: filterContainer\n });\n if (Object.keys(self.columnFilters).length) {\n Object.keys(self.columnFilters).forEach(function (cf) {\n var h = self.getHeaderByName(cf);\n e.items.push({\n title: self.attributes.removeFilterOptionText.replace(/%s/g, h.title || h.name),\n click: function removeFilterClick(e) {\n e.preventDefault();\n self.setFilter(cf, '');\n self.controlInput.focus();\n }\n });\n });\n }\n }\n function addDefaultContextMenuItem(e) {\n var isNormalCell = !(e.cell.isBackground || e.cell.isHeaderCellCap\n || e.cell.isScrollBar || e.cell.isCorner || e.cell.isRowHeader)\n && e.cell.header;\n if (self.attributes.showFilter && isNormalCell) {\n createFilterContextMenuItems(e);\n }\n if (self.attributes.showCopy\n && self.selections.reduce(function (p, r) {\n return p + r.length;\n }, 0) > 0) {\n e.items.push({\n title: self.attributes.copyText,\n click: function () {\n document.execCommand('copy');\n self.disposeContextMenu();\n self.controlInput.focus();\n }\n });\n }\n if (self.attributes.saveAppearance && self.attributes.showClearSettingsOption\n && (Object.keys(self.sizes.rows).length > 0\n || Object.keys(self.sizes.columns).length > 0)) {\n e.items.push({\n title: self.attributes.clearSettingsOptionText,\n click: function (e) {\n e.preventDefault();\n self.sizes.rows = {};\n self.sizes.columns = {};\n self.createRowOrders();\n self.createColumnOrders();\n self.storedSettings = undefined;\n self.dispatchEvent('resizecolumn', {columnWidth: self.style.columnWidth});\n self.dispatchEvent('resizerow', {cellHeight: self.style.cellHeight});\n self.setStorageData();\n self.resize(true);\n self.disposeContextMenu();\n self.controlInput.focus();\n }\n });\n }\n if (self.attributes.allowSorting && self.attributes.showOrderByOption && isNormalCell) {\n e.items.push({\n title: self.attributes.showOrderByOptionTextAsc.replace('%s', e.cell.header.title || e.cell.header.name),\n click: function (ev) {\n ev.preventDefault();\n self.order(e.cell.header.name, 'asc');\n self.controlInput.focus();\n }\n });\n e.items.push({\n title: self.attributes.showOrderByOptionTextDesc.replace('%s', e.cell.header.title || e.cell.header.name),\n click: function (ev) {\n ev.preventDefault();\n self.order(e.cell.header.name, 'desc');\n self.disposeContextMenu();\n self.controlInput.focus();\n }\n });\n }\n }\n self.disposeAutocomplete = function () {\n if (autoCompleteContext) {\n autoCompleteContext.dispose();\n autoCompleteContext = undefined;\n }\n };\n self.disposeContextMenu = function () {\n document.removeEventListener('click', self.disposeContextMenu);\n zIndexTop = 2;\n self.disposeAutocomplete();\n if (self.contextMenu) {\n self.contextMenu.dispose();\n }\n self.contextMenu = undefined;\n };\n self.contextmenuEvent = function (e, overridePos) {\n if (!self.hasFocus && e.target !== self.canvas) {\n return;\n }\n var items = [],\n pos = overridePos || self.getLayerPos(e, true),\n ev = {\n NativeEvent: e,\n cell: self.getCellAt(pos.x, pos.y),\n items: items\n };\n if (!ev.cell.isGrid) {\n addDefaultContextMenuItem(ev);\n }\n if (self.dispatchEvent('contextmenu', ev)) {\n return;\n }\n if (!ev.cell.isGrid) {\n if (self.contextMenu) {\n self.disposeContextMenu();\n }\n self.contextMenu = createContextMenu(ev, {\n left: pos.x + pos.rect.left + self.style.contextMenuMarginLeft + self.canvasOffsetLeft,\n top: pos.y + pos.rect.top + self.style.contextMenuMarginTop + self.canvasOffsetTop,\n right: ev.cell.width + ev.cell.x + pos.rect.left,\n bottom: ev.cell.height + ev.cell.y + pos.rect.top,\n height: ev.cell.height,\n width: ev.cell.width\n }, items);\n document.addEventListener('click', self.disposeContextMenu);\n e.preventDefault();\n }\n };\n return;\n };\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/contextMenu.js\n// module id = 4\n// module chunks = 0","/*jslint browser: true, unparam: true, todo: true*/\n/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/\ndefine([], function () {\n 'use strict';\n return function (self) {\n self.defaults = {\n attributes: [\n ['name', ''],\n ['tree', false],\n ['showNewRow', false],\n ['treeHorizontalScroll', false],\n ['saveAppearance', true],\n ['selectionFollowsActiveCell', false],\n ['multiLine', false],\n ['editable', true],\n ['allowColumnReordering', true],\n ['allowRowReordering', false],\n ['allowSorting', true],\n ['showFilter', true],\n ['globalRowResize', false],\n ['pageUpDownOverlap', 1],\n ['persistantSelectionMode', false],\n ['rowSelectionMode', false],\n ['autoResizeColumns', false],\n ['allowRowHeaderResize', true],\n ['allowColumnResize', true],\n ['allowRowResize', true],\n ['allowRowResizeFromCell', false],\n ['allowColumnResizeFromCell', false],\n ['debug', false],\n ['borderResizeZone', 10],\n ['showColumnHeaders', true],\n ['showRowNumbers', true],\n ['showRowHeaders', true],\n ['scrollRepeatRate', 75],\n ['selectionScrollZone', 20],\n ['resizeScrollZone', 20],\n ['contextHoverScrollRateMs', 5],\n ['contextHoverScrollAmount', 2],\n ['selectionScrollIncrement', 20],\n ['reorderDeadZone', 3],\n ['showClearSettingsOption', true],\n ['showOrderByOption', true],\n ['clearSettingsOptionText', 'Clear saved settings'],\n ['showOrderByOptionTextAsc', 'Order by %s ascending'],\n ['showOrderByOptionTextDesc', 'Order by %s descending'],\n ['removeFilterOptionText', 'Remove filter on %s'],\n ['filterOptionText', 'Filter %s'],\n ['filterTextPrefix', '(filtered) '],\n ['touchReleaseAnimationDurationMs', 1000],\n ['touchReleaseAcceleration', 30],\n ['touchDeadZone', 3],\n ['touchSelectTimeMs', 800],\n ['touchScrollZone', 40],\n ['copyText', 'Copy'],\n ['showCopy', true],\n ['columnHeaderClickBehavior', 'sort'],\n ['scrollPointerLock', true]\n ],\n styles: [\n ['activeCellBackgroundColor', 'rgba(255, 255, 255, 1)'],\n ['activeCellBorderColor', 'rgba(110, 168, 255, 1)'],\n ['activeCellBorderWidth', 0.25],\n ['activeCellColor', 'rgba(0, 0, 0, 1)'],\n ['activeCellFont', '16px sans-serif'],\n ['activeCellHoverBackgroundColor', 'rgba(255, 255, 255, 1)'],\n ['activeCellHoverColor', 'rgba(0, 0, 0, 1)'],\n ['activeCellOverlayBorderColor', 'rgba(66, 133, 244, 1)'],\n ['activeCellOverlayBorderWidth', 0.5],\n ['activeCellPaddingBottom', 5],\n ['activeCellPaddingLeft', 5],\n ['activeCellPaddingRight', 7],\n ['activeCellPaddingTop', 5],\n ['activeCellSelectedBackgroundColor', 'rgba(236, 243, 255, 1)'],\n ['activeCellSelectedColor', 'rgba(0, 0, 0, 1)'],\n ['activeColumnHeaderCellBackgroundColor', 'rgba(225, 225, 225, 1)'],\n ['activeColumnHeaderCellColor', 'rgba(0, 0, 0, 1)'],\n ['activeRowHeaderCellBackgroundColor', 'rgba(225, 225, 225, 1)'],\n ['activeRowHeaderCellColor', 'rgba(0, 0, 0, 1)'],\n ['autocompleteBottomMargin', 60],\n ['autosizeHeaderCellPadding', 8],\n ['autosizePadding', 5],\n ['backgroundColor', 'rgba(240, 240, 240, 1)'],\n ['cellAutoResizePadding', 13],\n ['cellBackgroundColor', 'rgba(255, 255, 255, 1)'],\n ['cellBorderColor', 'rgba(195, 199, 202, 1)'],\n ['cellBorderWidth', 0.5],\n ['cellColor', 'rgba(0, 0, 0, 1)'],\n ['cellFont', '16px sans-serif'],\n ['cellGridHeight', 250],\n ['cellHeight', 24],\n ['cellHeightWithChildGrid', 150],\n ['cellHorizontalAlignment', 'left'],\n ['cellHoverBackgroundColor', 'rgba(255, 255, 255, 1)'],\n ['cellHoverColor', 'rgba(0, 0, 0, 1)'],\n ['cellPaddingBottom', 5],\n ['cellPaddingLeft', 5],\n ['cellPaddingRight', 7],\n ['cellPaddingTop', 5],\n ['cellSelectedBackgroundColor', 'rgba(236, 243, 255, 1)'],\n ['cellSelectedColor', 'rgba(0, 0, 0, 1)'],\n ['cellVerticalAlignment', 'center'],\n ['cellWidthWithChildGrid', 250],\n ['childContextMenuArrowColor', 'rgba(43, 48, 43, 1)'],\n ['childContextMenuArrowHTML', '►'],\n ['childContextMenuMarginLeft', -15],\n ['childContextMenuMarginTop', 0],\n ['columnHeaderCellBackgroundColor', 'rgba(240, 240, 240, 1)'],\n ['columnHeaderCellBorderColor', 'rgba(152, 152, 152, 1)'],\n ['columnHeaderCellBorderWidth', 0.25],\n ['columnHeaderCellColor', 'rgba(50, 50, 50, 1)'],\n ['columnHeaderCellFont', '16px sans-serif'],\n ['columnHeaderCellHeight', 25],\n ['columnHeaderCellHorizontalAlignment', 'left'],\n ['columnHeaderCellHoverBackgroundColor', 'rgba(235, 235, 235, 1)'],\n ['columnHeaderCellHoverColor', 'rgba(0, 0, 0, 1)'],\n ['columnHeaderCellPaddingBottom', 5],\n ['columnHeaderCellPaddingLeft', 5],\n ['columnHeaderCellPaddingRight', 7],\n ['columnHeaderCellPaddingTop', 5],\n ['columnHeaderCellVerticalAlignment', 'center'],\n ['columnWidth', 250],\n ['contextFilterButtonBorder', 'solid 1px rgba(158, 163, 169, 1)'],\n ['contextFilterButtonBorderRadius', '3px'],\n ['contextFilterButtonHTML', '▼'],\n ['contextFilterInputBackground', 'rgba(255,255,255,1)'],\n ['contextFilterInputBorder', 'solid 1px rgba(158, 163, 169, 1)'],\n ['contextFilterInputBorderRadius', '0'],\n ['contextFilterInputColor', 'rgba(0,0,0,1)'],\n ['contextFilterInputFontFamily', 'sans-serif'],\n ['contextFilterInputFontSize', '14px'],\n ['contextMenuArrowColor', 'rgba(43, 48, 43, 1)'],\n ['contextMenuArrowDownHTML', '▼'],\n ['contextMenuArrowUpHTML', '▲'],\n ['contextMenuBackground', 'rgba(240, 240, 240, 1)'],\n ['contextMenuBorder', 'solid 1px rgba(158, 163, 169, 1)'],\n ['contextMenuBorderRadius', '3px'],\n ['contextMenuChildArrowFontSize', '12px'],\n ['contextMenuColor', 'rgba(43, 48, 43, 1)'],\n ['contextMenuFilterButtonFontFamily', 'sans-serif'],\n ['contextMenuFilterButtonFontSize', '10px'],\n ['contextMenuFilterInvalidExpresion', 'rgba(237, 155, 156, 1)'],\n ['contextMenuFontFamily', 'sans-serif'],\n ['contextMenuFontSize', '16px'],\n ['contextMenuHoverBackground', 'rgba(182, 205, 250, 1)'],\n ['contextMenuHoverColor', 'rgba(43, 48, 153, 1)'],\n ['contextMenuItemBorderRadius', '3px'],\n ['contextMenuItemMargin', '2px'],\n ['contextMenuLabelDisplay', 'inline-block'],\n ['contextMenuLabelMargin', '0 3px 0 0'],\n ['contextMenuLabelMaxWidth', '700px'],\n ['contextMenuLabelMinWidth', '75px'],\n ['contextMenuMarginLeft', 3],\n ['contextMenuMarginTop', -3],\n ['contextMenuOpacity', '0.98'],\n ['contextMenuPadding', '2px'],\n ['contextMenuWindowMargin', 6],\n ['cornerCellBackgroundColor', 'rgba(240, 240, 240, 1)'],\n ['cornerCellBorderColor', 'rgba(202, 202, 202, 1)'],\n ['editCellBackgroundColor', 'white'],\n ['editCellBorder', 'solid 1px rgba(110, 168, 255, 1)'],\n ['editCellBoxShadow', '0 2px 5px rgba(0,0,0,0.4)'],\n ['editCellColor', 'black'],\n ['editCellFontFamily', 'sans-serif'],\n ['editCellFontSize', '16px'],\n ['editCellPaddingLeft', 4],\n ['gridBorderColor', 'rgba(202, 202, 202, 1)'],\n ['gridBorderWidth', 1],\n ['columnHeaderOrderByArrowBorderColor', 'rgba(195, 199, 202, 1)'],\n ['columnHeaderOrderByArrowBorderWidth', 1],\n ['columnHeaderOrderByArrowColor', 'rgba(155, 155, 155, 1)'],\n ['columnHeaderOrderByArrowHeight', 8],\n ['columnHeaderOrderByArrowMarginLeft', 0],\n ['columnHeaderOrderByArrowMarginRight', 5],\n ['columnHeaderOrderByArrowMarginTop', 6],\n ['columnHeaderOrderByArrowWidth', 13],\n ['minColumnWidth', 45],\n ['minHeight', 24],\n ['minRowHeight', 24],\n ['name', 'default'],\n ['reorderMarkerBackgroundColor', 'rgba(0, 0, 0, 0.1)'],\n ['reorderMarkerBorderColor', 'rgba(0, 0, 0, 0.2)'],\n ['reorderMarkerBorderWidth', 1.25],\n ['reorderMarkerIndexBorderColor', 'rgba(66, 133, 244, 1)'],\n ['reorderMarkerIndexBorderWidth', 2.75],\n ['rowHeaderCellBackgroundColor', 'rgba(240, 240, 240, 1)'],\n ['rowHeaderCellBorderColor', 'rgba(200, 200, 200, 1)'],\n ['rowHeaderCellBorderWidth', 1],\n ['rowHeaderCellColor', 'rgba(50, 50, 50, 1)'],\n ['rowHeaderCellFont', '16px sans-serif'],\n ['rowHeaderCellHeight', 25],\n ['rowHeaderCellHorizontalAlignment', 'left'],\n ['rowHeaderCellHoverBackgroundColor', 'rgba(235, 235, 235, 1)'],\n ['rowHeaderCellHoverColor', 'rgba(0, 0, 0, 1)'],\n ['rowHeaderCellPaddingBottom', 5],\n ['rowHeaderCellPaddingLeft', 5],\n ['rowHeaderCellPaddingRight', 5],\n ['rowHeaderCellPaddingTop', 5],\n ['rowHeaderCellSelectedBackgroundColor', 'rgba(217, 217, 217, 1)'],\n ['rowHeaderCellSelectedColor', 'rgba(50, 50, 50, 1)'],\n ['rowHeaderCellVerticalAlignment', 'center'],\n ['rowHeaderCellWidth', 57],\n ['scrollBarActiveColor', 'rgba(125, 125, 125, 1)'],\n ['scrollBarBackgroundColor', 'rgba(240, 240, 240, 1)'],\n ['scrollBarBorderColor', 'rgba(202, 202, 202, 1)'],\n ['scrollBarBorderWidth', 0.5],\n ['scrollBarBoxBorderRadius', 4.125],\n ['scrollBarBoxColor', 'rgba(192, 192, 192, 1)'],\n ['scrollBarBoxMargin', 2],\n ['scrollBarBoxMinSize', 15],\n ['scrollBarBoxWidth', 8],\n ['scrollBarCornerBackgroundColor', 'rgba(240, 240, 240, 1)'],\n ['scrollBarCornerBorderColor', 'rgba(202, 202, 202, 1)'],\n ['scrollBarWidth', 11],\n ['selectionOverlayBorderColor', 'rgba(66, 133, 244, 1)'],\n ['selectionOverlayBorderWidth', 0.75],\n ['treeArrowBorderColor', 'rgba(195, 199, 202, 1)'],\n ['treeArrowBorderWidth', 1],\n ['treeArrowClickRadius', 5],\n ['treeArrowColor', 'rgba(155, 155, 155, 1)'],\n ['treeArrowHeight', 8],\n ['treeArrowMarginLeft', 0],\n ['treeArrowMarginRight', 5],\n ['treeArrowMarginTop', 6],\n ['treeArrowWidth', 13],\n ['treeGridHeight', 250]\n ]\n };\n };\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/defaults.js\n// module id = 5\n// module chunks = 0","/*jslint browser: true, unparam: true, todo: true*/\n/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/\ndefine([], function () {\n 'use strict';\n return function (self) {\n /**\n * Ends editing, optionally aborting the edit.\n * @memberof canvasDataGrid\n * @name endEdit\n * @method\n * @param {boolean} abort When true, abort the edit.\n */\n self.endEdit = function (abort) {\n var cell = self.input.editCell,\n y = cell.rowIndex;\n function abortEdit() {\n abort = true;\n }\n if (self.dispatchEvent('beforeendedit', {\n cell: cell,\n newValue: self.input.value,\n oldValue: cell.value,\n abort: abortEdit,\n input: self.input\n })) { return false; }\n if (self.input.value !== cell.value && !abort) {\n self.changes[y] = self.changes[y] || {};\n self.changes[y][cell.header.name] = self.input.value;\n cell.data[cell.header.name] = self.input.value;\n if (y === self.data.length) {\n if (self.dispatchEvent('newrow', {\n value: self.input.value,\n defaultValue: cell.value,\n aborted: abort,\n cell: cell,\n input: self.input\n })) { return false; }\n self.uId += 1;\n self.addRow(cell.data);\n self.createNewRowData();\n }\n self.draw(true);\n }\n document.body.removeChild(self.input);\n self.controlInput.focus();\n self.dispatchEvent('endedit', {\n cell: cell,\n value: self.input.value,\n aborted: abort,\n input: self.input\n });\n self.input = undefined;\n return true;\n };\n /**\n * Begins editing at cell x, row y.\n * @memberof canvasDataGrid\n * @name beginEditAt\n * @method\n * @param {number} x The column index of the cell to edit.\n * @param {number} y The row index of the cell to edit.\n */\n self.beginEditAt = function (x, y) {\n if (!self.attributes.editable) { return; }\n var cell = self.getVisibleCellByIndex(x, y),\n s = self.getVisibleSchema(),\n enumItems;\n if (self.dispatchEvent('beforebeginedit', {cell: cell})) { return false; }\n self.scrollIntoView(x, y);\n self.setActiveCell(x, y);\n if (cell.header.enum) {\n self.input = document.createElement('select');\n } else {\n self.input = document.createElement(self.attributes.multiLine\n ? 'textarea' : 'input');\n }\n function postDraw() {\n var option, valueInEnum;\n cell = self.getVisibleCellByIndex(x, y);\n if (cell.header.enum) {\n // add enums\n if (typeof cell.header.enum === 'function') {\n enumItems = cell.header.enum.apply(self.intf, [{cell: cell}]);\n } else if (Array.isArray(cell.header.enum)) {\n enumItems = cell.header.enum;\n }\n enumItems.forEach(function (e) {\n var i = document.createElement('option'),\n val,\n title;\n if (Array.isArray(e)) {\n val = e[0];\n title = e[1];\n } else {\n val = e;\n title = e;\n }\n if (val === cell.value) { valueInEnum = true; }\n i.value = val;\n i.innerHTML = title;\n self.input.appendChild(i);\n });\n if (!valueInEnum) {\n option = document.createElement('option');\n option.value = cell.value;\n option.innerHTML = cell.value;\n self.input.appendChild(option);\n }\n self.input.addEventListener('change', function () {\n self.endEdit();\n self.draw(true);\n });\n }\n document.body.appendChild(self.input);\n self.createInlineStyle(self.input, 'canvas-datagrid-edit-input');\n self.input.style.position = 'absolute';\n self.input.editCell = cell;\n self.resizeEditInput();\n self.input.style.zIndex = '2';\n self.input.value = cell.value;\n self.input.focus();\n self.input.addEventListener('click', self.stopPropagation);\n self.input.addEventListener('dblclick', self.stopPropagation);\n self.input.addEventListener('mouseup', self.stopPropagation);\n self.input.addEventListener('mousedown', self.stopPropagation);\n self.input.addEventListener('keydown', function (e) {\n var nx = cell.columnIndex,\n ny = cell.rowIndex;\n // esc\n if (e.keyCode === 27) {\n self.endEdit(true);\n self.draw(true);\n // enter\n } else if (e.keyCode === 13\n && (!self.attributes.multiLine\n || (self.attributes.multiLine && e.shiftKey))) {\n self.endEdit();\n self.draw(true);\n } else if (e.keyCode === 9) {\n e.preventDefault();\n if (!self.endEdit()) {\n return;\n }\n if (e.shiftKey) {\n nx -= 1;\n } else {\n nx += 1;\n }\n if (nx < 0) {\n nx = s.length - 1;\n ny -= 1;\n }\n if (nx > s.length - 1) {\n nx = 0;\n ny += 1;\n }\n if (ny < 0) {\n ny = self.data.length - 1;\n }\n if (ny > self.data.length - 1) {\n ny = 0;\n }\n self.beginEditAt(nx, ny);\n }\n });\n }\n postDraw();\n self.dispatchEvent('beginedit', {cell: cell, input: self.input});\n };\n self.createInlineStyle = function (el, className) {\n var css = {\n 'canvas-datagrid-context-menu-filter-input': {\n height: '19px',\n verticalAlign: 'bottom',\n marginLeft: '2px',\n padding: '0',\n background: self.style.contextFilterInputBackground,\n color: self.style.contextFilterInputColor,\n border: self.style.contextFilterInputBorder,\n borderRadius: self.style.contextFilterInputBorderRadius,\n lineHeight: 'normal',\n fontWeight: 'normal',\n fontFamily: self.style.contextFilterInputFontFamily,\n fontSize: self.style.contextFilterInputFontSize\n },\n 'canvas-datagrid-context-menu-filter-button': {\n height: '19px',\n verticalAlign: 'bottom',\n marginLeft: '2px',\n padding: '0',\n background: self.style.contextMenuBackground,\n color: self.style.contextMenuColor,\n border: self.style.contextFilterButtonBorder,\n borderRadius: self.style.contextFilterButtonBorderRadius,\n lineHeight: 'normal',\n fontWeight: 'normal',\n fontFamily: self.style.contextMenuFilterButtonFontFamily,\n fontSize: self.style.contextMenuFilterButtonFontSize\n },\n 'canvas-datagrid-context-child-arrow': {\n cssFloat: 'right',\n color: self.style.childContextMenuArrowColor,\n fontSize: self.style.contextMenuChildArrowFontSize,\n fontFamily: self.style.contextMenuFontFamily,\n verticalAlign: 'middle'\n },\n 'canvas-datagrid-autocomplete': {\n fontFamily: self.style.contextMenuFontFamily,\n fontSize: self.style.contextMenuFontSize,\n background: self.style.contextMenuBackground,\n color: self.style.contextMenuColor,\n border: self.style.contextMenuBorder,\n padding: self.style.contextMenuPadding,\n borderRadius: self.style.contextMenuBorderRadius,\n opacity: self.style.contextMenuOpacity,\n position: 'absolute',\n zIndex: 3,\n overflow: 'hidden'\n },\n 'canvas-datagrid-autocomplete-item': {\n background: self.style.contextMenuBackground,\n color: self.style.contextMenuColor\n },\n 'canvas-datagrid-autocomplete-item:hover': {\n background: self.style.contextMenuHoverBackground,\n color: self.style.contextMenuHoverColor\n },\n 'canvas-datagrid-canvas': {\n position: 'absolute',\n zIndex: '-1'\n },\n 'canvas-datagrid': {\n position: 'absolute',\n background: self.style.backgroundColor,\n zIndex: '1',\n boxSizing: 'content-box',\n padding: '0'\n },\n 'canvas-datagrid-control-input': {\n position: 'fixed',\n top: '-5px',\n left: '-5px',\n border: 'none',\n opacity: '0',\n cursor: 'pointer',\n width: '1px',\n height: '1px',\n lineHeight: 'normal',\n fontWeight: 'normal',\n fontFamily: self.style.contextMenuFontFamily,\n fontSize: self.style.contextMenuFontSize\n },\n 'canvas-datagrid-edit-input': {\n boxSizing: 'content-box',\n outline: 'none',\n margin: '0',\n padding: '0 0 0 ' + self.style.editCellPaddingLeft + 'px',\n lineHeight: 'normal',\n fontWeight: 'normal',\n fontFamily: self.style.editCellFontFamily,\n fontSize: self.style.editCellFontSize,\n boxShadow: self.style.editCellBoxShadow,\n border: self.style.editCellBorder,\n color: self.style.editCellColor,\n background: self.style.editCellBackgroundColor,\n appearance: 'none',\n webkitAppearance: 'none',\n mozAppearance: 'none',\n borderRadius: '0'\n },\n 'canvas-datagrid-context-menu-item': {\n lineHeight: 'normal',\n fontWeight: 'normal',\n fontFamily: self.style.contextMenuFontFamily,\n fontSize: self.style.contextMenuFontSize,\n color: 'inherit',\n background: 'inherit',\n margin: self.style.contextMenuItemMargin,\n borderRadius: self.style.contextMenuItemBorderRadius,\n verticalAlign: 'middle'\n },\n 'canvas-datagrid-context-menu-item:hover': {\n background: self.style.contextMenuHoverBackground,\n color: self.style.contextMenuHoverColor\n },\n 'canvas-datagrid-context-menu-label': {\n margin: self.style.contextMenuLabelMargin,\n display: self.style.contextMenuLabelDisplay,\n minWidth: self.style.contextMenuLabelMinWidth,\n maxWidth: self.style.contextMenuLabelMaxWidth\n },\n 'canvas-datagrid-context-menu': {\n lineHeight: 'normal',\n fontWeight: 'normal',\n fontFamily: self.style.contextMenuFontFamily,\n fontSize: self.style.contextMenuFontSize,\n background: self.style.contextMenuBackground,\n color: self.style.contextMenuColor,\n border: self.style.contextMenuBorder,\n padding: self.style.contextMenuPadding,\n borderRadius: self.style.contextMenuBorderRadius,\n opacity: self.style.contextMenuOpacity,\n overflow: 'hidden'\n },\n 'canvas-datagrid-invalid-search-regExp': {\n background: self.style.contextMenuFilterInvalidExpresion\n }\n };\n if (css[className]) {\n Object.keys(css[className]).map(function (prop) {\n el.style[prop] = css[className][prop];\n });\n }\n return;\n };\n self.appendTo = function (n) {\n self.parentNode = n;\n self.height = self.parentNode.offsetHeight;\n self.width = self.parentNode.offsetWidth;\n if (self.parentNode && /canvas-datagrid-(cell|tree)/.test(self.parentNode.nodeType)) {\n self.isChildGrid = true;\n self.parentGrid = self.parentNode.parentGrid;\n self.ctx = self.parentGrid.context;\n self.canvas = self.parentGrid.canvas;\n self.controlInput = self.parentGrid.controlInput;\n self.eventParent = self.canvas;\n self.intf.offsetParent = self.parentNode;\n } else {\n self.controlInput = document.createElement('input');\n self.controlInput.onblur = self.intf.blur;\n self.createInlineStyle(self.controlInput, 'canvas-datagrid-control-input');\n self.isChildGrid = false;\n self.parentDOMNode = self.parentNode;\n self.parentNode = self.parentDOMNode;\n self.parentIsCanvas = /canvas/i.test(self.parentDOMNode.tagName);\n if (self.parentIsCanvas) {\n self.canvas = self.parentDOMNode;\n } else {\n self.canvas = document.createElement('canvas');\n self.parentDOMNode.appendChild(self.canvas);\n }\n self.ctx = self.canvas.getContext('2d');\n self.ctx.textBaseline = 'alphabetic';\n document.body.appendChild(self.controlInput);\n self.eventParent = self.canvas;\n }\n self.controlInput.addEventListener('blur', function (e) {\n if (e.target !== self.canvas) {\n self.hasFocus = false;\n }\n });\n window.addEventListener('resize', self.resize);\n if (MutationObserver) {\n self.observer = new MutationObserver(function (mutations) {\n mutations.forEach(function (mutation) {\n self.resize(true);\n });\n });\n [self.canvas.parentNode].forEach(function (el) {\n self.observer.observe(el, { attributes: true });\n });\n }\n self.eventParent.addEventListener('scroll', self.resize, false);\n self.eventParent.addEventListener('touchstart', self.touchstart, false);\n self.eventParent.addEventListener('mouseup', self.mouseup, false);\n self.eventParent.addEventListener('mousedown', self.mousedown, false);\n self.eventParent.addEventListener('dblclick', self.dblclick, false);\n self.eventParent.addEventListener('click', self.click, false);\n self.eventParent.addEventListener('mousemove', self.mousemove);\n self.eventParent.addEventListener('wheel', self.scrollWheel, false);\n self.canvas.addEventListener('contextmenu', self.contextmenuEvent, false);\n (self.isChildGrid ? self.parentGrid : document).addEventListener('copy', self.copy);\n self.controlInput.addEventListener('keypress', self.keypress, false);\n self.controlInput.addEventListener('keyup', self.keyup, false);\n self.controlInput.addEventListener('keydown', self.keydown, false);\n };\n self.setDom = function () {\n self.appendTo(self.args.parentNode);\n };\n };\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/dom.js\n// module id = 6\n// module chunks = 0","/*jslint browser: true, unparam: true, todo: true*/\n/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/\ndefine([], function () {\n 'use strict';\n return function (self) {\n // all methods here are exposed by intf\n // to users\n /**\n * Converts a integer into a letter A - ZZZZZ...\n * @memberof canvasDataGrid\n * @name integerToAlpha\n * @method\n * @param {column} n The number to convert.\n */\n self.integerToAlpha = function (n) {\n var ordA = 'a'.charCodeAt(0),\n ordZ = 'z'.charCodeAt(0),\n len = ordZ - ordA + 1,\n s = '';\n while (n >= 0) {\n s = String.fromCharCode(n % len + ordA) + s;\n n = Math.floor(n / len) - 1;\n }\n return s;\n };\n /**\n * Inserts a new column before the specified index into the schema.\n * @see canvasDataGrid#schema\n * @tutorial schema\n * @memberof canvasDataGrid\n * @name insertColumn\n * @method\n * @param {column} c The column to insert into the schema.\n * @param {number} index The index of the column to insert before.\n */\n self.insertColumn = function (c, index) {\n var s = self.getSchema();\n if (s.length < index) {\n throw new Error('Index is beyond the length of the schema.');\n }\n self.validateColumn(c, s);\n s.splice(index, 0, c);\n self.data.forEach(function (row) {\n self.applyDefaultValue(row, c);\n });\n self.intf.schema = s;\n };\n /**\n * Deletes a column from the schema at the specified index.\n * @memberof canvasDataGrid\n * @name deleteColumn\n * @tutorial schema\n * @method\n * @param {number} index The index of the column to delete.\n */\n self.deleteColumn = function (index) {\n var s = self.getSchema();\n // remove data matching this column name from data\n self.data.forEach(function (row) {\n delete row[s[index].name];\n });\n s.splice(index, 1);\n self.intf.schema = s;\n };\n /**\n * Adds a new column into the schema.\n * @see canvasDataGrid#schema\n * @tutorial schema\n * @memberof canvasDataGrid\n * @name addColumn\n * @method\n * @param {column} c The column to add to the schema.\n */\n self.addColumn = function (c) {\n var s = self.getSchema();\n self.validateColumn(c, s);\n s.push(c);\n self.data.forEach(function (row) {\n self.applyDefaultValue(row, c);\n });\n self.intf.schema = s;\n };\n /**\n * Deletes a row from the dataset at the specified index.\n * @memberof canvasDataGrid\n * @name deleteRow\n * @method\n * @param {number} index The index of the row to delete.\n */\n self.deleteRow = function (index) {\n self.originalData.splice(index, 1);\n self.setFilter();\n self.resize(true);\n };\n /**\n * Inserts a new row into the dataset before the specified index.\n * @memberof canvasDataGrid\n * @name insertRow\n * @method\n * @param {object} d data.\n * @param {number} index The index of the row to insert before.\n */\n self.insertRow = function (d, index) {\n if (self.originalData.length < index) {\n throw new Error('Index is beyond the length of the dataset.');\n }\n self.originalData.splice(index, 0, d);\n self.getSchema().forEach(function (c) {\n if (d[c.name] === undefined) {\n self.applyDefaultValue(self.originalData[index], c);\n }\n });\n self.setFilter();\n self.resize(true);\n };\n /**\n * Adds a new row into the dataset.\n * @memberof canvasDataGrid\n * @name addRow\n * @method\n * @param {object} d data.\n */\n self.addRow = function (d) {\n self.originalData.push(d);\n self.getSchema().forEach(function (c) {\n if (d[c.name] === undefined) {\n self.applyDefaultValue(self.originalData[self.originalData.length - 1], c);\n }\n });\n self.setFilter();\n self.resize(true);\n };\n /**\n * Sets the height of a given row by index number.\n * @memberof canvasDataGrid\n * @name setRowHeight\n * @method\n * @param {number} rowIndex The index of the row to set.\n * @param {number} height Height to set the row to.\n */\n self.setRowHeight = function (rowIndex, height) {\n self.sizes.rows[self.data[rowIndex][self.uniqueId]] = height;\n self.draw(true);\n };\n /**\n * Sets the width of a given column by index number.\n * @memberof canvasDataGrid\n * @name setColumnWidth\n * @method\n * @param {number} colIndex The index of the column to set.\n * @param {number} width Width to set the column to.\n */\n self.setColumnWidth = function (colIndex, width) {\n var s = self.getSchema();\n self.sizes.columns[s[colIndex][self.uniqueId]] = width;\n self.draw(true);\n };\n /**\n * Removes any changes to the width of the columns due to user or api interaction, setting them back to the schema or style default.\n * @memberof canvasDataGrid\n * @name resetColumnWidths\n * @tutorial schema\n * @method\n */\n self.resetColumnWidths = function () {\n self.sizes.columns = {};\n self.draw(true);\n };\n /**\n * Removes any changes to the height of the rows due to user or api interaction, setting them back to the schema or style default.\n * @memberof canvasDataGrid\n * @name resetRowHeights\n * @tutorial schema\n * @method\n */\n self.resetRowHeights = function () {\n self.sizes.rows = {};\n self.draw(true);\n };\n /**\n * Sets the value of the filter.\n * @memberof canvasDataGrid\n * @name setFilter\n * @method\n * @param {string} column Name of the column to filter.\n * @param {string} value The value to filter for.\n */\n self.setFilter = function (column, value) {\n function applyFilter() {\n self.refreshFromOrigialData();\n Object.keys(self.columnFilters).forEach(function (filter) {\n var header = self.getHeaderByName(column);\n if (!header) {\n return;\n }\n self.currentFilter = header.filter || self.filter(column.type || 'string');\n self.data = self.data.filter(function (row) {\n return self.currentFilter(row[filter], self.columnFilters[filter]);\n });\n });\n self.resize();\n self.draw(true);\n }\n if (column === undefined && value === undefined) {\n self.columnFilters = {};\n return applyFilter();\n }\n if (column && (value === '' || value === undefined)) {\n delete self.columnFilters[column];\n } else {\n self.columnFilters[column] = value;\n }\n applyFilter();\n };\n /**\n * Returns the number of pixels to scroll down to line up with row rowIndex.\n * @memberof canvasDataGrid\n * @name findRowScrollTop\n * @method\n * @param {number} rowIndex The row index of the row to scroll find.\n */\n self.findRowScrollTop = function (rowIndex) {\n var top = 0, x = 0, l = self.data.length,\n cellBorder = self.style.cellBorderWidth * 2;\n if (!self.attributes.showNewRow) {\n l -= 1;\n }\n if (rowIndex > l) {\n throw new Error('Impossible row index');\n }\n while (x < rowIndex) {\n top += (self.sizes.rows[self.data[x][self.uniqueId]] || self.style.cellHeight) + cellBorder;\n x += 1;\n }\n //TODO: This is not super accurate, causes pageUp/Dn to not move around right\n return top - (self.sizes.rows[self.data[rowIndex][self.uniqueId]] || self.style.cellHeight);\n };\n /**\n * Returns the number of pixels to scroll to the left to line up with column columnIndex.\n * @memberof canvasDataGrid\n * @name findColumnScrollLeft\n * @method\n * @param {number} columnIndex The column index of the column to find.\n */\n self.findColumnScrollLeft = function (columnIndex) {\n var left = 0, y = 0, s = self.getSchema(), l = s.length - 1;\n if (columnIndex > l) {\n throw new Error('Impossible column index');\n }\n while (y < columnIndex) {\n left += self.sizes.columns[s[y][self.uniqueId]] || s[y].width;\n y += 1;\n }\n return left;\n };\n /**\n * Scrolls the cell at cell x, row y.\n * @memberof canvasDataGrid\n * @name gotoCell\n * @method\n * @param {number} x The column index of the cell to scroll to.\n * @param {number} y The row index of the cell to scroll to.\n */\n self.gotoCell = function (x, y) {\n if (x !== undefined) {\n self.scrollBox.scrollLeft = self.findColumnScrollLeft(x);\n }\n if (y !== undefined) {\n self.scrollBox.scrollTop = self.findRowScrollTop(y);\n }\n };\n /**\n * Scrolls the row y.\n * @memberof canvasDataGrid\n * @name gotoRow\n * @method\n * @param {number} y The row index of the cell to scroll to.\n */\n self.gotoRow = function (y) {\n self.gotoCell(0, y);\n };\n /**\n * Scrolls the cell at cell x, row y into view if it is not already.\n * @memberof canvasDataGrid\n * @name scrollIntoView\n * @method\n * @param {number} x The column index of the cell to scroll into view.\n * @param {number} y The row index of the cell to scroll into view.\n */\n self.scrollIntoView = function (x, y) {\n if (self.visibleCells.filter(function (cell) {\n return (cell.rowIndex === y || y === undefined)\n && (cell.columnIndex === x || x === undefined)\n && cell.x > 0\n && cell.y > 0\n && cell.x + cell.width < self.width\n && cell.y + cell.height < self.height;\n }).length === 0) {\n self.gotoCell(x, y);\n }\n };\n /**\n * Sets the active cell. Requires redrawing.\n * @memberof canvasDataGrid\n * @name setActiveCell\n * @method\n * @param {number} x The column index of the cell to set active.\n * @param {number} y The row index of the cell to set active.\n */\n self.setActiveCell = function (x, y) {\n self.activeCell = {\n rowIndex: y,\n columnIndex: x\n };\n };\n /**\n * Selects every visible cell.\n * @memberof canvasDataGrid\n * @name selectAll\n * @method\n */\n self.selectAll = function () {\n self.selectArea({\n top: 0,\n left: 0,\n right: self.getVisibleSchema().length - 1,\n bottom: self.data.length - 1\n });\n };\n /**\n * Returns true if the selected columnIndex is selected on every row.\n * @memberof canvasDataGrid\n * @name isColumnSelected\n * @method\n * @param {number} columnIndex The column index to check.\n */\n self.isColumnSelected = function (columnIndex) {\n var colIsSelected = true;\n self.data.forEach(function (row, rowIndex) {\n if (!self.selections[rowIndex] || self.selections[rowIndex].indexOf(self.orders.columns[columnIndex]) === -1) {\n colIsSelected = false;\n }\n });\n return colIsSelected;\n };\n /**\n * Selects a column.\n * @memberof canvasDataGrid\n * @name selectColumn\n * @method\n * @param {number} columnIndex The column index to select.\n * @param {boolean} toggleSelectMode When true, behaves as if you were holding control/command when you clicked the column.\n * @param {boolean} shift When true, behaves as if you were holding shift when you clicked the column.\n * @param {boolean} supressSelectionchangedEvent When true, prevents the selectionchanged event from firing.\n */\n self.selectColumn = function (columnIndex, ctrl, shift, supressEvent) {\n var s, e, x;\n function addCol(i) {\n self.data.forEach(function (row, rowIndex) {\n self.selections[rowIndex] = self.selections[rowIndex] || [];\n if (self.selections[rowIndex].indexOf(i) === -1) {\n self.selections[rowIndex].push(i);\n }\n });\n }\n function removeCol(i) {\n self.data.forEach(function (row, rowIndex) {\n self.selections[rowIndex] = self.selections[rowIndex] || [];\n if (self.selections[rowIndex].indexOf(i) !== -1) {\n self.selections[rowIndex].splice(self.selections[rowIndex].indexOf(i), 1);\n }\n });\n }\n if (shift) {\n if (!self.activeCell) { return; }\n s = Math.min(self.activeCell.columnIndex, columnIndex);\n e = Math.max(self.activeCell.columnIndex, columnIndex);\n for (x = s; e > x; x += 1) {\n addCol(x);\n }\n }\n if (!ctrl && !shift) {\n self.selections = [];\n self.activeCell.columnIndex = columnIndex;\n self.activeCell.rowIndex = self.scrollIndexTop;\n }\n if (ctrl && self.isColumnSelected(columnIndex)) {\n removeCol(columnIndex);\n } else {\n addCol(columnIndex);\n }\n if (supressEvent) { return; }\n self.dispatchEvent('selectionchanged', {\n selectedData: self.getSelectedData(),\n selections: self.selections,\n selectionBounds: self.selectionBounds\n });\n };\n /**\n * Selects a row.\n * @memberof canvasDataGrid\n * @name selectRow\n * @method\n * @param {number} rowIndex The row index to select.\n * @param {boolean} ctrl When true, behaves as if you were holding control/command when you clicked the row.\n * @param {boolean} shift When true, behaves as if you were holding shift when you clicked the row.\n * @param {boolean} supressSelectionchangedEvent When true, prevents the selectionchanged event from firing.\n */\n self.selectRow = function (rowIndex, ctrl, shift, supressEvent) {\n var x, st, en, s = self.getSchema();\n function addRow(ri) {\n self.selections[ri] = [];\n self.selections[ri].push(-1);\n s.forEach(function (col) {\n self.selections[ri].push(col.index);\n });\n }\n if (self.dragAddToSelection === false || self.dragObject === undefined) {\n if (self.selections[rowIndex] && self.selections[rowIndex].length - 1 === s.length) {\n if (ctrl) {\n self.selections[rowIndex] = [];\n return;\n }\n }\n }\n if (self.dragAddToSelection === true || self.dragObject === undefined) {\n if (shift && self.dragObject === undefined) {\n if (!self.activeCell) { return; }\n st = Math.min(self.activeCell.rowIndex, rowIndex);\n en = Math.max(self.activeCell.rowIndex, rowIndex);\n for (x = st; en >= x; x += 1) {\n addRow(x);\n }\n } else {\n addRow(rowIndex);\n }\n }\n if (supressEvent) { return; }\n self.dispatchEvent('selectionchanged', {\n selectedData: self.getSelectedData(),\n selections: self.selections,\n selectionBounds: self.selectionBounds\n });\n };\n /**\n * Collapse a tree grid by row index.\n * @memberof canvasDataGrid\n * @name collapseTree\n * @method\n * @param {number} index The index of the row to collapse.\n */\n self.collapseTree = function (rowIndex) {\n var rowId = self.data[rowIndex][self.uniqueId];\n self.dispatchEvent('collapsetree', {\n childGrid: self.childGrids[rowId],\n data: self.data[rowIndex],\n rowIndex: rowIndex\n });\n self.openChildren[rowId].blur();\n self.openChildren[rowId].dispose();\n delete self.openChildren[rowId];\n delete self.sizes.trees[rowId];\n delete self.childGrids[rowId];\n self.dispatchEvent('resizerow', {\n cellHeight: self.style.cellHeight\n });\n self.resize(true);\n self.draw(true);\n };\n /**\n * Expands a tree grid by row index.\n * @memberof canvasDataGrid\n * @name expandTree\n * @method\n * @param {number} index The index of the row to expand.\n */\n self.expandTree = function (rowIndex) {\n var rowHeaderCellHeight = self.getRowHeaderCellHeight(),\n columnHeaderCellWidth = self.sizes.columns.cornerCell || self.style.rowHeaderCellWidth,\n rowId = self.data[rowIndex][self.uniqueId],\n h = self.sizes.trees[rowId] || self.style.treeGridHeight,\n treeGrid;\n if (!self.childGrids[rowId]) {\n treeGrid = self.createGrid({\n debug: self.attributes.debug,\n name: self.attributes.saveAppearance\n ? self.attributes.name + 'tree' + rowId : undefined,\n parentNode: {\n parentGrid: self.intf,\n nodeType: 'canvas-datagrid-tree',\n offsetHeight: h,\n offsetWidth: self.width - columnHeaderCellWidth,\n header: { width: self.width - columnHeaderCellWidth },\n offsetLeft: columnHeaderCellWidth,\n offsetTop: rowHeaderCellHeight,\n offsetParent: self.intf.parentNode,\n parentNode: self.intf.parentNode,\n style: 'tree',\n data: self.data[rowIndex]\n }\n });\n self.childGrids[rowId] = treeGrid;\n }\n treeGrid = self.childGrids[rowId];\n treeGrid.visible = true;\n self.dispatchEvent('expandtree', {\n treeGrid: treeGrid,\n data: self.data[rowIndex],\n rowIndex: rowIndex\n });\n self.openChildren[rowId] = treeGrid;\n self.sizes.trees[rowId] = h;\n self.dispatchEvent('resizerow', {height: self.style.cellHeight});\n self.resize(true);\n };\n /**\n * Toggles tree grid open and close by row index.\n * @memberof canvasDataGrid\n * @name toggleTree\n * @method\n * @param {number} index The index of the row to toggle.\n */\n self.toggleTree = function (rowIndex) {\n var i = self.openChildren[self.data[rowIndex][self.uniqueId]];\n if (i) {\n return self.collapseTree(rowIndex);\n }\n self.expandTree(rowIndex);\n };\n /**\n * Returns a header from the schema by name.\n * @memberof canvasDataGrid\n * @name getHeaderByName\n * @tutorial schema\n * @method\n * @returns {header} header with the selected name, or undefined.\n * @param {string} name The name of the column to resize.\n */\n self.getHeaderByName = function (name) {\n var x, i = self.getSchema();\n for (x = 0; x < i.length; x += 1) {\n if (i[x].name === name) {\n return i[x];\n }\n }\n };\n /**\n * Resizes a column to fit the longest value in the column. Call without a value to resize all columns.\n * Warning, can be slow on very large record sets (1m records ~3-5 seconds on an i7).\n * @memberof canvasDataGrid\n * @name fitColumnToValues\n * @method\n * @param {string} name The name of the column to resize.\n */\n self.fitColumnToValues = function (name, internal) {\n self.sizes.columns[name === 'cornerCell' ? name : self.getHeaderByName(name)[self.uniqueId]]\n = self.findColumnMaxTextLength(name);\n if (!internal) {\n self.resize();\n self.draw(true);\n }\n };\n /**\n * Checks if a cell is currently visible.\n * @memberof canvasDataGrid\n * @name isCellVisible\n * @method\n * @returns {boolean} when true, the cell is visible, when false the cell is not currently drawn.\n * @param {cell} cell The cell to check for. Alternatively you can pass an object { x: , y: }.\n */\n self.isCellVisible = function (cell) {\n var x, l = self.visibleCells.length;\n for (x = 0; x < l; x += 1) {\n if (cell.x === self.visibleCells[x].x && cell.y === self.visibleCells[x].y) {\n return true;\n }\n }\n return false;\n };\n /**\n * Sets the order of the data.\n * @memberof canvasDataGrid\n * @name order\n * @method\n * @returns {cell} cell at the selected location.\n * @param {number} columnName Number of pixels from the left.\n * @param {string} direction `asc` for ascending or `desc` for descending.\n * @param {function} [sortFunction] When defined, override the default sorting method defined in the column's schema and use this one.\n * @param {bool} [dontSetStorageData] Don't store this setting for future use.\n */\n self.order = function (columnName, direction, sortFunction, dontSetStorageData) {\n var f,\n c = self.getSchema().filter(function (col) {\n return col.name === columnName;\n });\n self.orderBy = columnName;\n if (c.length === 0) {\n throw new Error('Cannot sort. No such column name');\n }\n f = sortFunction || self.sorters[c[0].type];\n if (!f && c[0].type !== undefined) {\n console.warn('Cannot sort type \"%s\" falling back to string sort.', c[0].type);\n }\n self.data = self.data.sort(typeof f === 'function' ? f(columnName, direction) : self.sorters.string);\n self.dispatchEvent('ordercolumn', {name: columnName, direction: direction});\n self.draw(true);\n if (dontSetStorageData) { return; }\n self.setStorageData();\n };\n self.isInGrid = function (e) {\n if (e.x < 0\n || e.x > self.width\n || e.y < 0\n || e.y > self.height) {\n return false;\n }\n return true;\n };\n /**\n * Gets the cell at columnIndex and rowIndex.\n * @memberof canvasDataGrid\n * @name getVisibleCellByIndex\n * @method\n * @returns {cell} cell at the selected location.\n * @param {number} x Column index.\n * @param {number} y Row index.\n */\n self.getVisibleCellByIndex = function (x, y) {\n return self.visibleCells.filter(function (c) {\n return c.columnIndex === x && c.rowIndex === y;\n })[0];\n };\n /**\n * Gets the cell at grid pixel coordinate x and y.\n * @memberof canvasDataGrid\n * @name getCellAt\n * @method\n * @returns {cell} cell at the selected location.\n * @param {number} x Number of pixels from the left.\n * @param {number} y Number of pixels from the top.\n */\n self.getCellAt = function (x, y, useTouchScrollZones) {\n var tsz = useTouchScrollZones ? self.attributes.touchScrollZone : 0, i, l = self.visibleCells.length, cell;\n if (!self.visibleCells || !self.visibleCells.length) { return; }\n self.hasFocus = true;\n if (!(y < self.height\n && y > 0\n && x < self.width\n && x > 0)) {\n self.hasFocus = false;\n return {\n dragContext: 'inherit',\n context: 'inherit'\n };\n }\n for (i = 0; i < l; i += 1) {\n cell = self.visibleCells[i];\n if (useTouchScrollZones && /(vertical|horizontal)-scroll-/.test(cell.style)) {\n cell.x -= tsz;\n cell.y -= tsz;\n cell.height += tsz;\n cell.width += tsz;\n }\n if (cell.x - self.style.cellBorderWidth < x\n && cell.x + cell.width + self.style.cellBorderWidth > x\n && cell.y - self.style.cellBorderWidth < y\n && cell.y + cell.height + self.style.cellBorderWidth > y) {\n if (/vertical-scroll-(bar|box)/.test(cell.style)) {\n cell.dragContext = 'vertical-scroll-box';\n cell.context = 'vertical-scroll-box';\n cell.isScrollBar = true;\n cell.isVerticalScrollBar = true;\n if (y > self.scrollBox.box.v.y + self.scrollBox.scrollBoxHeight) {\n cell.dragContext = 'vertical-scroll-bottom';\n cell.context = 'vertical-scroll-bottom';\n } else if (y < self.scrollBox.box.v.y) {\n cell.dragContext = 'vertical-scroll-top';\n cell.context = 'vertical-scroll-top';\n }\n self.canvas.style.cursor = 'default';\n return cell;\n }\n if (/horizontal-scroll-(bar|box)/.test(cell.style)) {\n cell.dragContext = 'horizontal-scroll-box';\n cell.context = 'horizontal-scroll-box';\n cell.isScrollBar = true;\n cell.isHorizontalScrollBar = true;\n if (x > self.scrollBox.box.h.x + self.scrollBox.scrollBoxWidth) {\n cell.dragContext = 'horizontal-scroll-right';\n cell.context = 'horizontal-scroll-right';\n } else if (x < self.scrollBox.box.h.x) {\n cell.dragContext = 'horizontal-scroll-left';\n cell.context = 'horizontal-scroll-left';\n }\n self.canvas.style.cursor = 'default';\n return cell;\n }\n if (cell.x + cell.width - (self.attributes.borderResizeZone * 0.4) < x\n && cell.x + cell.width + (self.attributes.borderResizeZone * 0.6) > x\n && self.attributes.allowColumnResize\n && ((self.attributes.allowColumnResizeFromCell && cell.style === 'cell')\n || cell.style !== 'cell')\n && ((self.attributes.allowRowHeaderResize\n && ['rowHeaderCell', 'cornerCell'].indexOf(cell.style) !== -1)\n || ['rowHeaderCell', 'cornerCell'].indexOf(cell.style) === -1)) {\n cell.context = 'ew-resize';\n cell.dragContext = 'ew-resize';\n return cell;\n }\n if (cell.y + cell.height - (self.attributes.borderResizeZone * 0.4) < y\n && cell.y + cell.height + (self.attributes.borderResizeZone * 0.6) > y\n && self.attributes.allowRowResize\n && ((self.attributes.allowRowResizeFromCell && cell.style === 'cell')\n || cell.style !== 'cell')\n && cell.style !== 'columnHeaderCell') {\n cell.context = 'ns-resize';\n cell.dragContext = 'ns-resize';\n return cell;\n }\n if (cell.style === 'columnHeaderCell') {\n cell.context = 'cell';\n cell.dragContext = 'column-reorder';\n return cell;\n }\n if (cell.style === 'rowHeaderCell') {\n cell.context = 'cell';\n cell.dragContext = 'row-reorder';\n return cell;\n }\n if (cell.isGrid) {\n self.hasFocus = false;\n cell.dragContext = 'cell-grid';\n cell.context = 'cell-grid';\n return cell;\n }\n if (cell.style === 'tree-grid') {\n self.hasFocus = false;\n cell.dragContext = 'tree';\n cell.context = 'tree';\n return cell;\n }\n cell.dragContext = 'cell';\n cell.context = 'cell';\n return cell;\n }\n }\n self.hasFocus = true;\n self.canvas.style.cursor = 'default';\n return {\n dragContext: 'background',\n context: 'background',\n style: 'background',\n isBackground: true\n };\n };\n /**\n * Gets the bounds of current selection. \n * @returns {rect} selection.\n * @memberof canvasDataGrid\n * @name getSelectionBounds\n * @method\n */\n self.getSelectionBounds = function () {\n var low = {x: Infinity, y: Infinity},\n high = {x: -Infinity, y: -Infinity};\n self.data.forEach(function (row, rowIndex) {\n var maxCol, minCol;\n if (self.selections[rowIndex] && self.selections[rowIndex].length) {\n low.y = rowIndex < low.y ? rowIndex : low.y;\n high.y = rowIndex > high.y ? rowIndex : high.y;\n maxCol = Math.max.apply(null, self.selections[rowIndex]);\n minCol = Math.min.apply(null, self.selections[rowIndex]);\n low.x = minCol < low.x ? minCol : low.x;\n high.x = maxCol > high.x ? maxCol : high.x;\n }\n });\n return {\n top: low.y,\n left: low.x,\n bottom: high.y,\n right: high.x\n };\n };\n /**\n * Returns an auto generated schema based on data structure.\n * @memberof canvasDataGrid\n * @name getSchemaFromData\n * @method\n * @tutorial schema\n * @returns {schema} schema A schema based on the first item in the data array.\n */\n self.getSchemaFromData = function () {\n return Object.keys(self.data[0] || {' ': ''}).map(function mapEachSchemaColumn(key, index) {\n var type = self.getBestGuessDataType(key),\n i = {\n name: key,\n title: isNaN(parseInt(key, 10)) ? key : self.integerToAlpha(key).toUpperCase(),\n width: self.style.columnWidth,\n index: index,\n type: type,\n filter: self.filter(type)\n };\n if (key === self.uniqueId) {\n i.hidden = true;\n }\n i[self.uniqueId] = self.getSchemaNameHash(key);\n return i;\n });\n };\n /**\n * Clears the change log grid.changes that keeps track of changes to the data set.\n * This does not undo changes or alter data it is simply a convince array to keep\n * track of changes made to the data since last this method was called.\n * @memberof canvasDataGrid\n * @name clearChangeLog\n * @method\n */\n self.clearChangeLog = function () {\n self.changes = [];\n };\n /**\n * Selects an area of the grid.\n * @memberof canvasDataGrid\n * @name selectArea\n * @method\n * @param {rect} bounds A rect object representing the selected values.\n */\n self.selectArea = function (bounds, ctrl) {\n self.selectionBounds = bounds || self.selectionBounds;\n var x, y, s = self.getSchema();\n if (!ctrl) {\n self.selections = [];\n }\n if (self.selectionBounds.top < -1\n || self.selectionBounds.bottom > self.data.length\n || self.selectionBounds.left < -1\n || self.selectionBounds.right > s.length) {\n throw new Error('Impossible selection area');\n }\n for (x = self.selectionBounds.top; x <= self.selectionBounds.bottom; x += 1) {\n self.selections[x] = [];\n for (y = self.selectionBounds.left; y <= self.selectionBounds.right; y += 1) {\n if (self.selections[x].indexOf(y) === -1) {\n self.selections[x].push(y);\n }\n }\n }\n self.dispatchEvent('selectionchanged', {\n selectedData: self.getSelectedData(),\n selections: self.selections,\n selectionBounds: self.selectionBounds\n });\n };\n /**\n * Returns the maximum text width for a given column by column name.\n * @memberof canvasDataGrid\n * @name findColumnMaxTextLength\n * @method\n * @returns {number} The number of pixels wide the maximum width value in the selected column.\n * @param {string} name The name of the column to calculate the value's width of.\n */\n self.findColumnMaxTextLength = function (name) {\n var m = -Infinity;\n if (name === 'cornerCell') {\n self.ctx.font = self.style.rowHeaderCellFont;\n return self.ctx.measureText((self.data.length + (self.attributes.showNewRow ? 1 : 0)).toString()).width\n + self.style.autosizePadding + self.style.autosizeHeaderCellPadding\n + self.style.rowHeaderCellPaddingRight\n + self.style.rowHeaderCellPaddingLeft\n + (self.attributes.tree ? self.style.treeArrowWidth\n + self.style.treeArrowMarginLeft + self.style.treeArrowMarginRight : 0);\n }\n self.getSchema().forEach(function (col) {\n if (col.name !== name) { return; }\n self.ctx.font = self.style.columnHeaderCellFont;\n var t = self.ctx.measureText(col.title || col.name).width\n + self.style.headerCellPaddingRight\n + self.style.headerCellPaddingLeft;\n m = t > m ? t : m;\n });\n self.data.forEach(function (row) {\n self.ctx.font = self.style.cellFont;\n var t = self.ctx.measureText(row[name]).width\n + self.style.cellPaddingRight\n + self.style.cellPaddingLeft + self.style.cellAutoResizePadding;\n m = t > m ? t : m;\n });\n return m;\n };\n /**\n * Gets the total width of all header columns.\n * @memberof canvasDataGrid\n * @name getHeaderWidth\n * @method\n */\n self.getHeaderWidth = function () {\n return self.getVisibleSchema().reduce(function (total, header) {\n return total + header.width;\n }, 0);\n };\n self.formatters.string = function cellFormatterString(e) {\n return e.cell.value !== undefined ? e.cell.value : '';\n };\n self.formatters.rowHeaderCell = self.formatters.string;\n self.formatters.headerCell = self.formatters.string;\n self.formatters.number = self.formatters.string;\n self.formatters.int = self.formatters.string;\n self.formatters.html = self.formatters.string;\n self.sorters.string = function (columnName, direction) {\n var asc = direction === 'asc';\n return function (a, b) {\n if (a[columnName] === undefined || a[columnName] === null) {\n return 1;\n }\n if (b[columnName] === undefined || b[columnName] === null) {\n return 0;\n }\n if (asc) {\n if (!a[columnName].localeCompare) { return 1; }\n return a[columnName].localeCompare(b[columnName]);\n }\n if (!b[columnName].localeCompare) { return 1; }\n return b[columnName].localeCompare(a[columnName]);\n };\n };\n self.sorters.number = function (columnName, direction) {\n var asc = direction === 'asc';\n return function (a, b) {\n if (asc) {\n return a[columnName] - b[columnName];\n }\n return b[columnName] - a[columnName];\n };\n };\n self.sorters.date = function (columnName, direction) {\n var asc = direction === 'asc';\n return function (a, b) {\n if (asc) {\n return new Date(a[columnName]).getTime()\n - new Date(b[columnName]).getTime();\n }\n return new Date(b[columnName]).getTime()\n - new Date(a[columnName]).getTime();\n };\n };\n };\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/publicMethods.js\n// module id = 7\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 15098d93c6126eedfbf8","webpack:///./lib/main.js","webpack:///./lib/draw.js","webpack:///./lib/events.js","webpack:///./lib/intf.js","webpack:///./lib/contextMenu.js","webpack:///./lib/defaults.js","webpack:///./lib/dom.js","webpack:///./lib/publicMethods.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;;;;;;AC7DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAAA;;;;;;;;;;;;AC7BD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C;AACA;AACA,gFAAgF,UAAU;AAC1F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD,IAAI,QAAQ;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD,OAAO;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,WAAW;AAC7C;AACA;AACA;AACA,sCAAsC;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,OAAO;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C,OAAO;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD,OAAO;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,QAAQ;AAClD;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,6BAA6B,QAAQ;AACrC;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA,uDAAuD,qBAAqB,EAAE;AAC9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD,IAAI,QAAQ;AAC9D;AACA;AACA;AACA,CAAC;AAAA;;;;;;;;;;;;AC54BD;AACA;AACA;AACA;AACA;AACA,0BAA0B,wCAAwC;AAClE,8BAA8B,4BAA4B;AAC1D,0BAA0B,4BAA4B;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD,wCAAwC,IAAI,QAAQ;AACtG,iCAAiC,QAAQ;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yEAAyE,eAAe;AACxF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2DAA2D,sDAAsD;AACjH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,eAAe,IAAI,QAAQ;AAC3E;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,iCAAiC,QAAQ;AACzC;AACA;AACA,aAAa;AACb;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,4EAA4E,eAAe;AAC3F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD,uCAAuC,IAAI,QAAQ;AACpG;AACA;AACA,iCAAiC,QAAQ;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD,uCAAuC,IAAI,QAAQ;AACtG,iCAAiC,QAAQ;AACzC;AACA;AACA,4EAA4E,eAAe;AAC3F;AACA;AACA;AACA;AACA,6CAA6C,qBAAqB;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,QAAQ;AAC3C;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,oCAAoC,oBAAoB;AACxD;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,+DAA+D;AACzG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,oCAAoC;AAC1D;AACA;AACA,gCAAgC,WAAW;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD,qBAAqB;AACtE;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,QAAQ;AAChD;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C,uCAAuC,IAAI,QAAQ;AAChG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoD,4CAA4C,IAAI,cAAc;AAClH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,iBAAiB;AACjB;AACA;AACA,iDAAiD,OAAO;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD,uCAAuC,IAAI,QAAQ;AACpG;AACA;AACA;AACA,+CAA+C,QAAQ;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C,uCAAuC,IAAI,QAAQ;AAClG;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD,QAAQ;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C,uCAAuC,IAAI,QAAQ;AAClG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD,kCAAkC;AACxF;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA,6CAA6C,uCAAuC,IAAI,QAAQ;AAChG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,uCAAuC,IAAI,QAAQ;AACnG;AACA;AACA,gDAAgD,uCAAuC,IAAI,QAAQ;AACnG;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,6CAA6C,eAAe;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,eAAe,IAAI,QAAQ;AACvE,qDAAqD,QAAQ;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAAA;;;;;;;;;;;;ACh7BD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB,uBAAuB;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB;AACtB;AACA;AACA;AACA,kCAAkC,QAAQ;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,iBAAiB;AACjB;AACA,yCAAyC,QAAQ;AACjD;AACA,qBAAqB;AACrB;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,WAAW;AACpC;AACA;AACA;AACA;AACA;AACA,qDAAqD,UAAU;AAC/D;AACA;AACA;AACA,kDAAkD,UAAU;AAC5D;AACA;AACA;AACA,kDAAkD,QAAQ;AAC1D;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2DAA2D,oBAAoB,EAAE;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,gBAAgB;AACjD,iCAAiC,gBAAgB;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,uCAAuC,0BAA0B,EAAE;AACnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,kEAAkE;AAClE,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,QAAQ;AAC/C;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA,4DAA4D,wBAAwB;AACpF;AACA,iBAAiB;AACjB,aAAa;AACb;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA,wDAAwD,4BAA4B;AACpF;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA,gEAAgE,6BAA6B;AAC7F;AACA,iBAAiB;AACjB,aAAa;AACb;AACA,iCAAiC,aAAa;AAC9C;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,aAAa;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD,mBAAmB,EAAE;AACxE,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,UAAU;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,+BAA+B,SAAS;AACxC;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,qDAAqD,oBAAoB;AACzE;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,SAAS;AACjD;AACA;AACA;AACA;AACA;AACA,yDAAyD,wBAAwB;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0DAA0D,iBAAiB;AAC3E;AACA;AACA,mDAAmD,gBAAgB;AACnE;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,iBAAiB;AACjB;AACA,aAAa;AACb;AACA;AACA;AACA,iBAAiB;AACjB;AACA,aAAa;AACb;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,CAAC;AAAA;;;;;;;;;;;;ACl+BD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA,wCAAwC,wDAAwD;AAChG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,QAAQ;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qEAAqE,QAAQ;AAC7E,4FAA4F,QAAQ;AACpG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,WAAW;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,wCAAwC,+BAA+B;AACvE,iBAAiB;AACjB;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD,QAAQ;AAC3D;AACA,gFAAgF,QAAQ,gBAAgB;AACxG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,iBAAiB;AACjB;AACA;AACA,2EAA2E,QAAQ;AACnF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,sBAAsB,oBAAoB;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4DAA4D,oCAAoC;AAChG,yDAAyD,kCAAkC;AAC3F;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAAA;;;;;;;;;;;;ACxdD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uDAAuD;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sDAAsD;AACtD,oDAAoD;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAAA;;;;;;;;;;;;ACrOD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,QAAQ;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB,IAAI,cAAc;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,IAAI,cAAc;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B;AACA;AACA,4CAA4C,QAAQ;AACpD;AACA;AACA;AACA,uDAAuD,WAAW,IAAI,cAAc;AACpF;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wEAAwE,WAAW;AACnF,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA,iDAAiD,oBAAoB;AACrE;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,6CAA6C,8BAA8B;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,iBAAiB;AACjB;AACA,+CAA+C,mBAAmB;AAClE,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAAA;;;;;;;;;;;;AC7XD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,mBAAmB,QAAQ;AAC3B,mBAAmB,QAAQ;AAC3B,mBAAmB,QAAQ;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA,uCAAuC,QAAQ;AAC/C;AACA;AACA,2BAA2B,OAAO;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,+BAA+B,QAAQ;AACvC;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,mBAAmB,QAAQ;AAC3B,mBAAmB,QAAQ;AAC3B,mBAAmB,QAAQ;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2CAA2C,QAAQ;AACnD;AACA;AACA,gCAAgC,SAAS;AACzC;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA,+BAA+B,QAAQ;AACvC;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC,4CAA4C;AAC7E;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,6CAA6C,8BAA8B;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,OAAO;AAC5B,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA,uBAAuB,cAAc;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,QAAQ;AAC7B,mBAAmB,KAAK,oEAAoE,6BAA6B;AACzH;AACA;AACA;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,KAAK;AAC1B,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B,mBAAmB,SAAS;AAC5B,mBAAmB,KAAK;AACxB;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C,uCAAuC;AACtF;AACA,qCAAqC,QAAQ;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,KAAK;AAC1B,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,KAAK;AAC1B,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA,kEAAkE,QAAQ;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,OAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,KAAK;AAC1B;AACA;AACA;AACA;AACA;AACA,uBAAuB,yBAAyB;AAChD,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,OAAO;AAC5B;AACA;AACA,gDAAgD,QAAQ;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,KAAK;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,kCAAkC;AAChF;AACA,mDAAmD,iCAAiC;AACpF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,OAAO;AAC5B,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,QAAQ;AAChD;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uDAAuD,UAAU;AACjE;AACA;AACA,mDAAmD,UAAU;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAAA","file":"canvas-datagrid.debug.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"canvasDatagrid\"] = factory();\n\telse\n\t\troot[\"canvasDatagrid\"] = factory();\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 15098d93c6126eedfbf8","/*jslint browser: true, unparam: true, todo: true*/\n/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/\ndefine([\n './draw',\n './events',\n './intf',\n './contextMenu',\n './defaults',\n './dom',\n './publicMethods'\n], function context() {\n 'use strict';\n var modules = Array.prototype.slice.call(arguments);\n function grid(args) {\n args = args || {};\n var self = {};\n self.args = args;\n self.createGrid = grid;\n modules.forEach(function (module) {\n module(self);\n });\n self.init();\n return self.intf;\n }\n if (window && !window.canvasDatagrid && !window.require) {\n window.canvasDatagrid = grid;\n }\n module.exports = grid;\n return grid;\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/main.js\n// module id = 0\n// module chunks = 0","/*jslint browser: true, unparam: true, todo: true*/\n/*globals XMLSerializer: false, define: true, Blob: false, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/\ndefine([], function () {\n 'use strict';\n return function (self) {\n var perfCounters = [],\n drawCount = 0,\n perfWindowSize = 20;\n self.htmlImageCache = {};\n function drawOnAllImagesLoaded() {\n var loaded = true;\n Object.keys(self.htmlImageCache).forEach(function (html) {\n if (!self.htmlImageCache[html].complete) {\n loaded = false;\n }\n });\n if (loaded) {\n self.draw();\n }\n }\n function drawHtml(cell) {\n var img,\n v = cell.innerHTML || cell.formattedValue,\n x = cell.x + self.canvasOffsetLeft,\n y = cell.y + self.canvasOffsetTop;\n if (self.htmlImageCache[v]) {\n img = self.htmlImageCache[v];\n if (img.height !== cell.height || img.width !== cell.width) {\n // height and width of the cell has changed, invalidate cache\n self.htmlImageCache[v] = undefined;\n } else {\n if (!img.complete) {\n return;\n }\n return self.ctx.drawImage(img, x, y);\n }\n }\n img = new Image(cell.width, cell.height);\n self.htmlImageCache[v] = img;\n img.onload = function () {\n self.ctx.drawImage(img, x, y);\n drawOnAllImagesLoaded();\n };\n img.src = 'data:image/svg+xml;base64,' + btoa(\n '\\n' +\n '\\n' +\n '\\n' +\n v + '\\n' +\n '' +\n '\\n' +\n '\\n'\n );\n }\n function drawOrderByArrow(x, y) {\n x += self.canvasOffsetLeft;\n y += self.canvasOffsetTop;\n self.ctx.fillStyle = self.style.columnHeaderOrderByArrowColor;\n self.ctx.strokeStyle = self.style.columnHeaderOrderByArrowBorderColor;\n self.ctx.beginPath();\n x = x + self.style.columnHeaderOrderByArrowMarginLeft;\n y = y + self.style.columnHeaderOrderByArrowMarginTop;\n if (self.orderDirection === 'asc') {\n self.ctx.moveTo(x, y);\n self.ctx.lineTo(x + self.style.columnHeaderOrderByArrowWidth, y);\n self.ctx.lineTo(x + (self.style.columnHeaderOrderByArrowWidth * 0.5), y + self.style.columnHeaderOrderByArrowHeight);\n self.ctx.moveTo(x, y);\n } else {\n self.ctx.lineTo(x, y + self.style.columnHeaderOrderByArrowHeight);\n self.ctx.lineTo(x + self.style.columnHeaderOrderByArrowWidth, y + self.style.columnHeaderOrderByArrowHeight);\n self.ctx.lineTo(x + (self.style.columnHeaderOrderByArrowWidth * 0.5), y);\n self.ctx.lineTo(x, y + self.style.columnHeaderOrderByArrowHeight);\n }\n self.ctx.stroke();\n self.ctx.fill();\n return self.style.columnHeaderOrderByArrowMarginLeft\n + self.style.columnHeaderOrderByArrowWidth\n + self.style.columnHeaderOrderByArrowMarginRight;\n }\n function drawTreeArrow(cell, x, y) {\n x += self.canvasOffsetLeft;\n y += self.canvasOffsetTop;\n self.ctx.fillStyle = self.style.treeArrowColor;\n self.ctx.strokeStyle = self.style.treeArrowBorderColor;\n self.ctx.beginPath();\n x = x + self.style.treeArrowMarginLeft;\n y = y + self.style.treeArrowMarginTop;\n if (self.openChildren[cell.data[self.uniqueId]]) {\n self.ctx.moveTo(x, y);\n self.ctx.lineTo(x + self.style.treeArrowWidth, y);\n self.ctx.lineTo(x + (self.style.treeArrowWidth * 0.5), y + self.style.treeArrowHeight);\n self.ctx.moveTo(x, y);\n } else {\n self.ctx.lineTo(x, y);\n self.ctx.lineTo(x + self.style.treeArrowHeight, y + (self.style.treeArrowWidth * 0.5));\n self.ctx.lineTo(x, y + self.style.treeArrowWidth);\n self.ctx.lineTo(x, y);\n }\n self.ctx.stroke();\n self.ctx.fill();\n return self.style.treeArrowMarginLeft\n + self.style.treeArrowWidth\n + self.style.treeArrowMarginRight;\n }\n function radiusRect(x, y, w, h, radius) {\n x += self.canvasOffsetLeft;\n y += self.canvasOffsetTop;\n var r = x + w, b = y + h;\n self.ctx.beginPath();\n self.ctx.moveTo(x + radius, y);\n self.ctx.lineTo(r - radius, y);\n self.ctx.quadraticCurveTo(r, y, r, y + radius);\n self.ctx.lineTo(r, y + h - radius);\n self.ctx.quadraticCurveTo(r, b, r - radius, b);\n self.ctx.lineTo(x + radius, b);\n self.ctx.quadraticCurveTo(x, b, x, b - radius);\n self.ctx.lineTo(x, y + radius);\n self.ctx.quadraticCurveTo(x, y, x + radius, y);\n }\n function fillRect(x, y, w, h) {\n x += self.canvasOffsetLeft;\n y += self.canvasOffsetTop;\n self.ctx.fillRect(x, y, w, h);\n }\n function strokeRect(x, y, w, h) {\n x += self.canvasOffsetLeft;\n y += self.canvasOffsetTop;\n self.ctx.strokeRect(x, y, w, h);\n }\n function fillText(text, x, y) {\n x += self.canvasOffsetLeft;\n y += self.canvasOffsetTop;\n self.ctx.fillText(text, x, y);\n }\n function addBorderLine(c, pos) {\n self.ctx.beginPath();\n var p = {\n t: function () {\n self.ctx.moveTo(c.x + self.canvasOffsetLeft, c.y + self.canvasOffsetTop);\n self.ctx.lineTo(c.x + self.canvasOffsetLeft + c.width, c.y + self.canvasOffsetTop);\n },\n r: function () {\n self.ctx.moveTo(c.x + self.canvasOffsetLeft + c.width, c.y + self.canvasOffsetTop);\n self.ctx.lineTo(c.x + self.canvasOffsetLeft + c.width, c.y + self.canvasOffsetTop + c.height);\n },\n b: function () {\n self.ctx.moveTo(c.x + self.canvasOffsetLeft, c.y + self.canvasOffsetTop + c.height);\n self.ctx.lineTo(c.x + self.canvasOffsetLeft + c.width, c.y + self.canvasOffsetTop + c.height);\n },\n l: function () {\n self.ctx.moveTo(c.x + self.canvasOffsetLeft, c.y + self.canvasOffsetTop);\n self.ctx.lineTo(c.x + self.canvasOffsetLeft, c.y + self.canvasOffsetTop + c.height);\n },\n };\n p[pos]();\n self.ctx.stroke();\n }\n function addEllipsis(text, width) {\n var c, w = 0;\n if (self.ellipsisCache[text] && self.ellipsisCache[text][width]) {\n return self.ellipsisCache[text][width];\n }\n //TODO Add ellipsis back when there is a fast way to do it\n w = self.ctx.measureText(text).width;\n self.ellipsisCache[text] = self.ellipsisCache[text] || {};\n c = {value: text, width: w};\n self.ellipsisCache[text][width] = c;\n return c;\n }\n function drawText(cell) {\n var paddingLeft = self.style[cell.style + 'PaddingLeft'],\n paddingTop = self.style[cell.style + 'PaddingTop'],\n paddingRight = self.style[cell.style + 'PaddingRight'],\n paddingBottom = self.style[cell.style + 'PaddingBottom'],\n vPos = paddingTop + cell.height - (cell.height * 0.5),\n hPos = paddingLeft + cell.treeArrowWidth + cell.orderByArrowWidth;\n cell.text = addEllipsis(cell.formattedValue, cell.width - paddingRight - paddingLeft);\n cell.text.height = cell.fontHeight;\n if (cell.horizontalAlignment === 'right') {\n hPos = cell.width - cell.text.width - paddingRight;\n } else if (cell.horizontalAlignment === 'center') {\n hPos = (cell.width / 2) - (cell.text.width / 2);\n }\n if (cell.verticalAlignment === 'top') {\n vPos = paddingTop + cell.text.height;\n } else if (cell.verticalAlignment === 'bottom') {\n vPos = cell.height - paddingBottom - cell.text.height;\n }\n cell.text.x = cell.x + hPos;\n cell.text.y = cell.y + vPos;\n fillText(cell.text.value, cell.text.x, cell.text.y);\n }\n /**\n * Redraws the grid. No matter what the change, this is the only method required to refresh everything.\n * @memberof canvasDataGrid\n * @name draw\n * @method\n */\n self.draw = function (internal) {\n if (self.dispatchEvent('beforedraw', {})) { return; }\n if (!self.isChildGrid && (!self.height || !self.width)) {\n return;\n }\n if (self.isChildGrid && internal) {\n requestAnimationFrame(self.parentGrid.draw);\n return;\n }\n if (self.intf.visible === false) {\n return;\n }\n // initial values\n var checkScrollHeight, rowHeaderCell, p, cx, cy, treeGrid, rowOpen,\n rowHeight, cornerCell, y, x, c, h, w, s, r, rd, aCell,\n selectionBorders = [],\n rowHeaders = [],\n l = self.data.length,\n u = self.currentCell || {},\n rowHeaderCellHeight = self.getRowHeaderCellHeight(),\n columnHeaderCellWidth = self.getColumnHeaderCellWidth(),\n cellHeight = self.style.cellHeight;\n drawCount += 1;\n p = performance.now();\n // if data length has changed, there is no way to know\n if (self.data.length > self.orders.rows.length) {\n self.createRowOrders();\n }\n function drawScrollBars() {\n var v = {\n x: 0,\n y: 0,\n height: 0,\n width: 0,\n style: 'vertical-scroll-bar'\n },\n n = {\n x: 0,\n y: 0,\n height: 0,\n width: 0,\n style: 'horizontal-scroll-bar'\n },\n vb = {\n x: 0,\n y: 0,\n height: 0,\n width: 0,\n style: 'vertical-scroll-box'\n },\n nb = {\n x: 0,\n y: 0,\n height: 0,\n width: 0,\n style: 'horizontal-scroll-box'\n },\n co = {\n x: 0,\n y: 0,\n height: 0,\n width: 0,\n isCorner: true,\n isScrollBoxCorner: true,\n style: 'scroll-box-corner'\n },\n m = (self.style.scrollBarBoxMargin * 2),\n d = self.style.scrollBarBoxMargin * 0.5;\n self.ctx.strokeStyle = self.style.scrollBarBorderColor;\n self.ctx.lineWidth = self.style.scrollBarBorderWidth;\n // vertical\n v.x += w - self.style.scrollBarWidth - self.style.scrollBarBorderWidth - d;\n v.y += rowHeaderCellHeight;\n v.width = self.style.scrollBarWidth + self.style.scrollBarBorderWidth + d;\n v.height = h - rowHeaderCellHeight - self.style.scrollBarWidth - d - m;\n self.ctx.fillStyle = self.style.scrollBarBackgroundColor;\n fillRect(v.x, v.y, v.width, v.height + m);\n strokeRect(v.x, v.y, v.width, v.height + m);\n // vertical box\n vb.x = v.x + self.style.scrollBarBoxMargin;\n vb.y = rowHeaderCellHeight + self.style.scrollBarBoxMargin\n + ((v.height - self.scrollBox.scrollBoxHeight)\n * (self.scrollBox.scrollTop / self.scrollBox.scrollHeight));\n vb.width = self.style.scrollBarBoxWidth;\n vb.height = self.scrollBox.scrollBoxHeight;\n self.ctx.fillStyle = self.style.scrollBarBoxColor;\n if (/vertical/.test(u.context)) {\n self.ctx.fillStyle = self.style.scrollBarActiveColor;\n }\n if (vb.height < v.height) {\n radiusRect(vb.x, vb.y, vb.width, vb.height, self.style.scrollBarBoxBorderRadius);\n self.ctx.stroke();\n self.ctx.fill();\n }\n // horizontal\n n.x += columnHeaderCellWidth;\n n.y += h - self.style.scrollBarWidth - d;\n n.width = w - self.style.scrollBarWidth - columnHeaderCellWidth - d - m;\n n.height = self.style.scrollBarWidth + self.style.scrollBarBorderWidth + d;\n self.ctx.fillStyle = self.style.scrollBarBackgroundColor;\n fillRect(n.x, n.y, n.width + m, n.height);\n strokeRect(n.x, n.y, n.width + m, n.height);\n // horizontal box\n nb.y = n.y + self.style.scrollBarBoxMargin;\n nb.x = columnHeaderCellWidth + self.style.scrollBarBoxMargin\n + ((n.width - self.scrollBox.scrollBoxWidth)\n * (self.scrollBox.scrollLeft / self.scrollBox.scrollWidth));\n nb.width = self.scrollBox.scrollBoxWidth;\n nb.height = self.style.scrollBarBoxWidth;\n self.ctx.fillStyle = self.style.scrollBarBoxColor;\n if (/horizontal/.test(u.context)) {\n self.ctx.fillStyle = self.style.scrollBarActiveColor;\n }\n if (nb.width < n.width) {\n radiusRect(nb.x, nb.y, nb.width, nb.height, self.style.scrollBarBoxBorderRadius);\n self.ctx.stroke();\n self.ctx.fill();\n }\n //corner\n self.ctx.strokeStyle = self.style.scrollBarCornerBorderColor;\n self.ctx.fillStyle = self.style.scrollBarCornerBackgroundColor;\n co.x = n.x + n.width + m;\n co.y = v.y + v.height + m;\n co.width = self.style.scrollBarWidth + self.style.scrollBarBorderWidth;\n co.height = self.style.scrollBarWidth + self.style.scrollBarBorderWidth;\n radiusRect(co.x, co.y, co.width, co.height, 0);\n self.ctx.stroke();\n self.ctx.fill();\n self.visibleCells.unshift(v);\n self.visibleCells.unshift(vb);\n self.visibleCells.unshift(n);\n self.visibleCells.unshift(nb);\n self.visibleCells.unshift(co);\n self.scrollBox.bar = {\n v: v,\n h: n\n };\n self.scrollBox.box = {\n v: vb,\n h: nb\n };\n }\n function drawCell(d, rowIndex, rowOrderIndex) {\n return function drawEach(header, headerIndex, columnOrderIndex) {\n var cellStyle = header.style || 'cell',\n childGridAttributes,\n cell,\n isHeader = /HeaderCell/.test(cellStyle),\n isCorner = /cornerCell/.test(cellStyle),\n isRowHeader = 'rowHeaderCell' === cellStyle,\n isColumnHeader = 'columnHeaderCell' === cellStyle,\n selected = self.selections[rowOrderIndex] && self.selections[rowOrderIndex].indexOf(columnOrderIndex) !== -1,\n hovered = self.hovers[d[self.uniqueId]] && self.hovers[d[self.uniqueId]].indexOf(columnOrderIndex) !== -1,\n active = self.activeCell.rowIndex === rowOrderIndex && self.activeCell.columnIndex === columnOrderIndex,\n isGrid = typeof d[header.name] === 'object' && d[header.name] !== null && d[header.name] !== undefined,\n activeHeader = (self.orders.rows[self.activeCell.rowIndex] === rowOrderIndex\n || self.orders.columns[self.activeCell.columnIndex] === columnOrderIndex)\n && (columnOrderIndex === -1 || rowOrderIndex === -1)\n ? (isRowHeader ? 'activeRowHeaderCell' : 'activeColumnHeaderCell') : false,\n val,\n f = self.formatters[header.type || 'string'],\n orderByArrowSize = 0,\n treeArrowSize = 0,\n cellWidth = self.sizes.columns[isRowHeader ? 'cornerCell' : header[self.uniqueId]] || header.width,\n ev = {\n value: d[header.name],\n row: d,\n header: header\n };\n if (cellStyle === 'headerCellCap') {\n cellWidth = w - x;\n }\n // if no data or schema are defined, a width is provided to the stub column\n if (cellWidth === undefined) {\n cellWidth = self.style.columnWidth;\n }\n if (x + cellWidth + self.style.cellBorderWidth < 0) {\n x += cellWidth + self.style.cellBorderWidth;\n }\n if (active) {\n cellStyle = 'activeCell';\n }\n if (self.visibleRows.indexOf(rowIndex) === -1 && !isHeader) {\n self.visibleRows.push(rowIndex);\n }\n val = self.dispatchEvent('formatcellvalue', ev);\n if (!self.dispatchEvent('beforerendercell', ev)) {\n cx = x;\n cy = y;\n if (cellStyle === 'cornerCell') {\n cx = 0;\n cy = 0;\n } else if (isRowHeader) {\n cx = 0;\n } else if (isHeader) {\n cy = 0;\n }\n cell = {\n type: isGrid ? 'canvas-datagrid-cell' : header.type,\n style: cellStyle,\n nodeType: 'canvas-datagrid-cell',\n x: cx,\n y: cy,\n horizontalAlignment: self.style[cellStyle + 'HorizontalAlignment'],\n verticalAlignment: self.style[cellStyle + 'VerticalAlignment'],\n offsetTop: self.canvasOffsetTop + cy,\n offsetLeft: self.canvasOffsetLeft + cx,\n scrollTop: self.scrollBox.scrollTop,\n scrollLeft: self.scrollBox.scrollLeft,\n active: active || activeHeader,\n hovered: hovered,\n selected: selected,\n width: cellWidth,\n height: cellHeight,\n offsetWidth: cellWidth,\n offsetHeight: cellHeight,\n parentNode: self.intf.parentNode,\n offsetParent: self.intf.parentNode,\n data: d,\n isCorner: isCorner,\n isHeader: isHeader,\n isColumnHeader: isColumnHeader,\n isHeaderCellCap: !!header.isHeaderCellCap,\n isRowHeader: isRowHeader,\n rowOpen: rowOpen,\n header: header,\n columnIndex: columnOrderIndex,\n rowIndex: rowOrderIndex,\n sortColumnIndex: headerIndex,\n sortRowIndex: rowIndex,\n isGrid: isGrid,\n gridId: (self.attributes.name || '') + d[self.uniqueId] + ':' + header[self.uniqueId],\n parentGrid: self.intf,\n innerHTML: '',\n activeHeader: activeHeader,\n value: isHeader && !isRowHeader ? (header.title || header.name) : d[header.name]\n };\n ev.cell = cell;\n cell.userHeight = cell.isHeader ? self.sizes.rows[-1] : rowHeight;\n cell.userWidth = cell.isHeader ? self.sizes.columns.cornerCell : self.sizes.columns[header[self.uniqueId]];\n cell[self.uniqueId] = d[self.uniqueId];\n self.visibleCells.unshift(cell);\n self.ctx.fillStyle = self.style[cellStyle + 'BackgroundColor'];\n self.ctx.strokeStyle = self.style[cellStyle + 'BorderColor'];\n self.ctx.lineWidth = self.style[cellStyle + 'BorderWidth'];\n if (hovered) {\n self.ctx.fillStyle = self.style[cellStyle + 'HoverBackgroundColor'];\n self.ctx.strokeStyle = self.style[cellStyle + 'HoverBorderColor'];\n }\n if (selected) {\n self.ctx.fillStyle = self.style[cellStyle + 'SelectedBackgroundColor'];\n self.ctx.strokeStyle = self.style[cellStyle + 'SelectedBorderColor'];\n }\n if (activeHeader) {\n self.ctx.fillStyle = self.style[activeHeader + 'BackgroundColor'];\n }\n self.dispatchEvent('rendercell', ev);\n if (cell.isGrid) {\n if (cell.height !== rowHeight) {\n cell.height = rowHeight || self.style.cellHeightWithChildGrid;\n checkScrollHeight = true;\n }\n cell.width = self.sizes.columns[header[self.uniqueId]] || self.style.cellWidthWithChildGrid;\n }\n if (rowOpen && !cell.isRowHeader) {\n cell.height = self.sizes.rows[rd[self.uniqueId]] || self.style.cellHeight;\n }\n if (!cell.isGrid) {\n fillRect(cx, cy, cell.width, cell.height);\n strokeRect(cx, cy, cell.width, cell.height);\n }\n self.ctx.save();\n radiusRect(cell.x, cell.y, cell.width, cell.height, 0);\n self.ctx.clip();\n self.dispatchEvent('afterrendercell', ev);\n if (cell.height !== cellHeight && !(rowOpen && !cell.isRowHeader)) {\n self.sizes.rows[isHeader ? -1 : d[self.uniqueId]] = cell.height;\n checkScrollHeight = true;\n }\n if (cell.width !== cellWidth) {\n self.sizes.columns[header[self.uniqueId]] = cell.width;\n checkScrollHeight = true;\n }\n if (isRowHeader && self.attributes.tree) {\n if (!self.dispatchEvent('rendertreearrow', ev)) {\n treeArrowSize = drawTreeArrow(cell, self.style[cellStyle + 'PaddingLeft'], cy, 0);\n }\n }\n if ((self.attributes.showRowNumbers && isRowHeader)\n || !isRowHeader) {\n if (cell.isGrid) {\n if (!self.childGrids[cell.gridId]) {\n childGridAttributes = self.args.childGridAttributes || self.args;\n childGridAttributes.name = self.attributes.saveAppearance ? cell.gridId : undefined;\n childGridAttributes.parentNode = cell;\n childGridAttributes.data = d[header.name];\n self.childGrids[cell.gridId] = self.createGrid(childGridAttributes);\n self.sizes.rows[rd[self.uniqueId]]\n = self.sizes.rows[rd[self.uniqueId]] || self.style.cellGridHeight;\n checkScrollHeight = true;\n }\n cell.grid = self.childGrids[cell.gridId];\n cell.grid.parentNode = cell;\n cell.grid.visible = true;\n cell.grid.draw();\n self.dispatchEvent('rendercellgrid', ev);\n } else {\n if (self.childGrids[cell.gridId]) {\n self.childGrids[cell.gridId].parentNode.offsetHeight = 0;\n }\n if (isHeader && self.orderBy === header.name) {\n if (!self.dispatchEvent('renderorderbyarrow', ev)) {\n orderByArrowSize = drawOrderByArrow(cx + self.style[cellStyle + 'PaddingLeft'], 0);\n }\n }\n self.ctx.fillStyle = self.style[cellStyle + 'Color'];\n if (hovered) {\n self.ctx.fillStyle = self.style[cellStyle + 'HoverColor'];\n }\n if (selected) {\n self.ctx.fillStyle = self.style[cellStyle + 'SelectedColor'];\n }\n if (activeHeader) {\n self.ctx.fillStyle = self.style[activeHeader + 'Color'];\n }\n self.ctx.font = self.style[cellStyle + 'Font'];\n cell.fontHeight = self.style[cellStyle + 'FontHeight'];\n cell.treeArrowWidth = treeArrowSize;\n cell.orderByArrowWidth = orderByArrowSize;\n val = val !== undefined ? val : f\n ? f(ev) : '';\n if (val === undefined && !f) {\n val = '';\n console.warn('canvas-datagrid: Unknown format '\n + header.type + ' add a cellFormater');\n }\n cell.formattedValue = ((val !== undefined && val !== null) ? val : '').toString();\n if (self.columnFilters && self.columnFilters[val] !== undefined && isHeader) {\n cell.formattedValue = self.attributes.filterTextPrefix + val;\n }\n if (!self.dispatchEvent('rendertext', ev)) {\n if (cell.innerHTML || header.type === 'html') {\n drawHtml(cell);\n } else {\n drawText(cell);\n }\n }\n }\n }\n if (active) {\n aCell = cell;\n }\n if (selected && !isRowHeader) {\n if ((!self.selections[cell.rowIndex - 1]\n || self.selections[cell.rowIndex - 1].indexOf(cell.columnIndex) === -1\n || cell.rowIndex === 0)\n && !cell.isHeader) {\n selectionBorders.push([cell, 't']);\n }\n if (!self.selections[cell.rowIndex + 1]\n || self.selections[cell.rowIndex + 1].indexOf(cell.columnIndex) === -1) {\n selectionBorders.push([cell, 'b']);\n }\n if (!self.selections[cell.rowIndex] || cell.columnIndex === 0\n || self.selections[cell.rowIndex].indexOf(cell.columnIndex - 1) === -1) {\n selectionBorders.push([cell, 'l']);\n }\n if (!self.selections[cell.rowIndex] || cell.columnIndex === s.length\n || self.selections[cell.rowIndex].indexOf(cell.columnIndex + 1) === -1) {\n selectionBorders.push([cell, 'r']);\n }\n }\n self.ctx.restore();\n x += cell.width + self.style.cellBorderWidth;\n return cell.width;\n }\n };\n }\n function drawRowHeader(rowData, index, rowOrderIndex) {\n var a;\n if (self.attributes.showRowHeaders) {\n x = 0;\n rowHeaderCell = {'rowHeaderCell': index + 1 };\n rowHeaderCell[self.uniqueId] = rowData[self.uniqueId];\n a = {\n name: 'rowHeaderCell',\n width: self.style.rowHeaderCellWidth,\n style: 'rowHeaderCell',\n type: 'string',\n data: rowData[self.uniqueId],\n index: -1\n };\n a[self.uniqueId] = rowData[self.uniqueId];\n rowOpen = self.openChildren[rowData[self.uniqueId]];\n drawCell(rowHeaderCell, index, rowOrderIndex)(a, -1, -1);\n }\n }\n function drawHeaders() {\n var d, g = s.length, i, o, columnHeaderCell, header;\n rowHeaders.forEach(function (rArgs) {\n y = rArgs[3];\n cellHeight = rArgs[4];\n drawRowHeader(rArgs[0], rArgs[1], rArgs[2]);\n });\n if (self.attributes.showColumnHeaders) {\n x = (self.scrollBox.scrollLeft * -1) + self.scrollPixelLeft;\n if (self.attributes.showRowHeaders) {\n x += columnHeaderCellWidth;\n }\n y = 0;\n // cell height might have changed during drawing\n cellHeight = self.getRowHeaderCellHeight();\n for (o = self.scrollIndexLeft; o < g; o += 1) {\n i = self.orders.columns[o];\n header = s[i];\n d = {\n title: header.title,\n name: header.name,\n width: header.width,\n style: 'columnHeaderCell',\n type: 'string',\n index: o,\n order: i\n };\n columnHeaderCell = {'columnHeaderCell': header.title || header.name};\n columnHeaderCell[self.uniqueId] = 'h' + header[self.uniqueId];\n d[self.uniqueId] = header[self.uniqueId];\n x += drawCell(columnHeaderCell, -1, -1)(d, o, i);\n if (x > self.width + self.scrollBox.scrollLeft) {\n break;\n }\n }\n // fill in the space right of the headers\n if (x < w) {\n c = {\n name: '',\n width: self.style.scrollBarWidth,\n style: 'headerCellCap',\n isHeaderCell: true,\n isHeaderCellCap: true,\n type: 'string',\n index: s.length\n };\n c[self.uniqueId] = 'columnHeaderCell';\n drawCell({endCap: ''}, -1, -1)(c, -1, -1);\n }\n // fill in the space right of the headers\n if (self.attributes.showRowHeaders) {\n cornerCell = {'cornerCell': '' };\n cornerCell[self.uniqueId] = 'cornerCell';\n x = 0;\n c = {\n name: 'cornerCell',\n width: self.style.rowHeaderCellWidth,\n style: 'cornerCell',\n type: 'string',\n index: -1\n };\n c[self.uniqueId] = 'cornerCell';\n drawCell(cornerCell, -1, -1)(c, -1, -1);\n }\n }\n }\n function drawRow(r, d) {\n var i, treeHeight, rowSansTreeHeight, o, g = s.length;\n if (y - (cellHeight * 2) > h) {\n return false;\n }\n rd = self.data[r];\n rowOpen = self.openChildren[rd[self.uniqueId]];\n rowSansTreeHeight = self.sizes.rows[rd[self.uniqueId]] || self.style.cellHeight;\n treeHeight = (rowOpen ? self.sizes.trees[rd[self.uniqueId]] : 0);\n rowHeight = rowSansTreeHeight + treeHeight;\n if (y < rowHeight * -1) {\n return false;\n }\n if (self.attributes.showRowHeaders) {\n x += columnHeaderCellWidth;\n }\n cellHeight = rowHeight;\n for (o = self.scrollIndexLeft; o < g; o += 1) {\n i = self.orders.columns[o];\n x += drawCell(rd, r, d)(s[i], i, o);\n if (x > self.width) {\n break;\n }\n }\n // cell height might have changed during drawing\n cellHeight = rowHeight;\n x = (self.scrollBox.scrollLeft * -1) + self.scrollPixelLeft + self.style.cellBorderWidth;\n // don't draw a tree for the new row\n treeGrid = self.childGrids[rd[self.uniqueId]];\n if (r !== self.data.length && rowOpen) {\n treeGrid.visible = true;\n treeGrid.parentNode = {\n offsetTop: y + rowSansTreeHeight + self.canvasOffsetTop,\n offsetLeft: columnHeaderCellWidth - 1 + self.canvasOffsetLeft,\n offsetHeight: treeHeight,\n offsetWidth: self.width - columnHeaderCellWidth - self.style.scrollBarWidth - 1,\n offsetParent: self.intf.parentNode,\n parentNode: self.intf.parentNode,\n style: self.style,\n nodeType: 'canvas-datagrid-tree',\n scrollTop: self.scrollBox.scrollTop,\n scrollLeft: self.scrollBox.scrollLeft,\n rowIndex: r\n };\n self.visibleCells.unshift({\n rowIndex: x,\n columnIndex: 0,\n y: treeGrid.parentNode.offsetTop,\n x: treeGrid.parentNode.offsetLeft,\n height: treeGrid.parentNode.offsetHeight,\n width: treeGrid.parentNode.offsetWidth,\n style: 'tree-grid',\n type: treeGrid.parentNode.nodeType\n });\n treeGrid.draw();\n } else if (treeGrid) {\n treeGrid.parentNode.offsetHeight = 0;\n delete self.sizes.trees[rd[self.uniqueId]];\n }\n rowHeaders.push([rd, r, d, y, rowHeight]);\n y += cellHeight + self.style.cellBorderWidth;\n return true;\n }\n function initDraw() {\n self.visibleRows = [];\n s = self.getVisibleSchema();\n self.visibleCells = [];\n self.canvasOffsetTop = self.isChildGrid ? self.parentNode.offsetTop : 0;\n self.canvasOffsetLeft = self.isChildGrid ? self.parentNode.offsetLeft : 0;\n h = self.height;\n w = self.width;\n if (!self.isChildGrid) {\n self.ctx.scale(window.devicePixelRatio, window.devicePixelRatio);\n }\n }\n function drawBackground() {\n radiusRect(0, 0, w, h, 0);\n self.ctx.clip();\n self.ctx.fillStyle = self.style.backgroundColor;\n fillRect(0, 0, w, h);\n }\n function drawRows() {\n var o, n, i, g = s.length;\n x = (self.scrollBox.scrollLeft * -1) + self.scrollPixelLeft + self.style.cellBorderWidth;\n y = (self.scrollBox.scrollTop * -1) + rowHeaderCellHeight + self.scrollPixelTop + self.style.cellBorderWidth;\n for (r = self.scrollIndexTop; r < l; r += 1) {\n n = self.orders.rows[r];\n if (!drawRow(n, r)) {\n break;\n }\n }\n if (self.attributes.showNewRow) {\n if (self.attributes.showRowHeaders) {\n x += columnHeaderCellWidth;\n }\n rowHeight = cellHeight = self.style.cellHeight;\n rowOpen = false;\n for (o = self.scrollIndexLeft; o < g; o += 1) {\n i = self.orders.columns[o];\n x += drawCell(self.newRow, self.data.length, self.data.length)(s[i], i, o);\n if (x > self.width + self.scrollBox.scrollLeft) {\n break;\n }\n }\n rowHeaders.push([self.newRow, self.data.length, self.data.length, y, rowHeight]);\n }\n }\n function drawReorderMarkers() {\n if (!self.reorderObject) { return; }\n var b = {\n height: self.reorderObject.height,\n width: self.reorderObject.width,\n x: self.reorderObject.x + self.reorderObject.dragOffset.x,\n y: self.reorderObject.y + self.reorderObject.dragOffset.y\n },\n m = {\n width: w,\n heigth: h,\n x: 0,\n y: 0\n };\n self.ctx.fillStyle = self.style.reorderMarkerBackgroundColor;\n self.ctx.lineWidth = self.style.reorderMarkerBorderWidth;\n self.ctx.strokeStyle = self.style.reorderMarkerBorderColor;\n if (self.dragMode === 'row-reorder') {\n b.width = w;\n b.x = 0;\n m.width = w;\n m.y = self.currentCell.y;\n fillRect(b.x, b.y, b.width, b.height);\n strokeRect(b.x, b.y, b.width, b.height);\n self.ctx.lineWidth = self.style.reorderMarkerIndexBorderWidth;\n self.ctx.strokeStyle = self.style.reorderMarkerIndexBorderColor;\n if (self.currentCell.rowIndex !== self.reorderObject.rowIndex\n && self.currentCell.rowIndex - 1 !== self.reorderObject.rowIndex) {\n addBorderLine(m, 't');\n }\n } else if (self.dragMode === 'column-reorder' && self.reorderObject) {\n b.height = h;\n b.y = 0;\n m.height = h;\n m.x = self.currentCell.x;\n fillRect(b.x, b.y, b.width, b.height);\n strokeRect(b.x, b.y, b.width, b.height);\n self.ctx.lineWidth = self.style.reorderMarkerIndexBorderWidth;\n self.ctx.strokeStyle = self.style.reorderMarkerIndexBorderColor;\n if (self.currentCell.columnIndex !== self.reorderObject.columnIndex\n && self.currentCell.columnIndex - 1 !== self.reorderObject.columnIndex) {\n addBorderLine(m, 'l');\n }\n }\n }\n function drawBorder() {\n self.ctx.lineWidth = self.style.gridBorderWidth;\n self.ctx.strokeStyle = self.style.gridBorderColor;\n strokeRect(0, 0, self.width, self.height);\n }\n function drawSelectionBorders() {\n self.ctx.lineWidth = self.style.selectionOverlayBorderWidth;\n self.ctx.strokeStyle = self.style.selectionOverlayBorderColor;\n selectionBorders.forEach(function (c) {\n addBorderLine(c[0], c[1]);\n });\n }\n function drawActiveCell() {\n if (!aCell) { return; }\n if (self.attributes.rowSelectionMode) {\n if (self.activeCell && self.activeCell.rowIndex === aCell.rowIndex) {\n self.ctx.lineWidth = self.style.activeCellOverlayBorderWidth;\n self.ctx.strokeStyle = self.style.activeCellOverlayBorderColor;\n strokeRect(0, aCell.y, self.getHeaderWidth() + columnHeaderCellWidth, rowHeight);\n }\n } else {\n self.ctx.lineWidth = self.style.activeCellOverlayBorderWidth;\n self.ctx.strokeStyle = self.style.activeCellOverlayBorderColor;\n strokeRect(aCell.x, aCell.y, aCell.width, aCell.height);\n }\n\n }\n function drawDebug() {\n perfCounters[drawCount % perfWindowSize] = performance.now() - p;\n var d;\n if (self.attributes.debug) {\n self.ctx.font = '11px sans-serif';\n d = {};\n d.perf = (perfCounters.reduce(function (a, b) {\n return a + b;\n }, 0) / perfCounters.length).toFixed(1)\n + 'ms (' +\n perfCounters.map(function (a) { return a.toFixed(1); }).join(', ') + ')';\n d.htmlImages = Object.keys(self.htmlImageCache).length;\n d.scrollLeft = self.scrollBox.scrollLeft;\n d.scrollTop = self.scrollBox.scrollTop;\n d.scrollIndexTop = self.scrollIndexTop;\n d.scrollPixelTop = self.scrollPixelTop;\n d.scrollIndexLeft = self.scrollIndexLeft;\n d.scrollPixelLeft = self.scrollPixelLeft;\n d.canvasOffsetLeft = self.canvasOffsetLeft;\n d.canvasOffsetTop = self.canvasOffsetTop;\n d.width = self.width;\n d.height = self.height;\n d.mousex = self.mouse.x;\n d.mousey = self.mouse.y;\n d.touchx = !self.touchStart ? 0 : self.touchStart.x;\n d.touchy = !self.touchStart ? 0 : self.touchStart.y;\n d.entities = self.visibleCells.length;\n d.hasFocus = self.hasFocus;\n d.dragMode = self.dragMode;\n if (self.currentCell) {\n d.columnIndex = self.currentCell.columnIndex;\n d.rowIndex = self.currentCell.rowIndex;\n d.sortColumnIndex = self.currentCell.sortColumnIndex;\n d.sortRowIndex = self.currentCell.sortRowIndex;\n d.context = self.currentCell.context;\n d.dragContext = self.currentCell.dragContext;\n d.style = self.currentCell.style;\n d.type = self.currentCell.type;\n }\n self.ctx.save();\n Object.keys(d).forEach(function (key, index) {\n var m = key + ': ' + d[key],\n lh = 14;\n self.ctx.fillStyle = 'rgba(255, 255, 255, 0.8)';\n fillRect(columnHeaderCellWidth, lh + (index * lh), 100, lh);\n self.ctx.fillStyle = 'rgba(0, 0, 0, 1)';\n fillText(m, columnHeaderCellWidth + 1, rowHeaderCellHeight + (index * lh));\n });\n self.ctx.restore();\n }\n }\n self.ctx.save();\n initDraw();\n drawBackground();\n drawRows();\n drawSelectionBorders();\n drawActiveCell();\n drawHeaders();\n drawReorderMarkers();\n drawScrollBars();\n if (checkScrollHeight) {\n self.resize(true);\n }\n drawBorder();\n drawDebug();\n if (self.dispatchEvent('afterdraw', {})) { return; }\n self.ctx.restore();\n };\n };\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/draw.js\n// module id = 1\n// module chunks = 0","/*jslint browser: true, unparam: true, todo: true*/\n/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/\ndefine([], function () {\n 'use strict';\n return function (self) {\n var touchDelta = {x: 0, y: 0, scrollTop: 0, scrollLeft: 0},\n touchAnimateTo = {scrollLeft: 0, scrollTop: 0},\n touchSigma = {scrollLeft: 0, scrollTop: 0},\n xPPS = 0,\n yPPS = 0,\n touchingCell = false,\n startingCell = false,\n animationFrames = 0;\n self.getTouchPos = function (e) {\n var rect = self.canvas.getBoundingClientRect(),\n pos = {\n x: e.touches[0].clientX - rect.left,\n y: e.touches[0].clientY - rect.top\n };\n if (self.isChildGrid) {\n pos.x -= self.canvasOffsetLeft;\n pos.y -= self.canvasOffsetTop;\n }\n return {\n x: pos.x,\n y: pos.y,\n rect: rect\n };\n };\n self.calculatePPS = function () {\n xPPS = ((touchDelta.scrollLeft - touchSigma.scrollLeft) / (touchDelta.t - touchSigma.t));\n yPPS = ((touchDelta.scrollTop - touchSigma.scrollTop) / (touchDelta.t - touchSigma.t));\n touchSigma = {\n scrollLeft: touchDelta.scrollLeft,\n scrollTop: touchDelta.scrollTop,\n t: performance.now() / 1000\n };\n };\n self.touchCell = function (e) {\n return function () {\n clearInterval(self.touchCalcTimeout);\n var pos = self.getTouchPos(e);\n if (Math.abs(touchDelta.x) + Math.abs(touchDelta.y) < self.attributes.touchDeadZone) {\n touchingCell = self.getCellAt(pos.x, pos.y);\n self.mousemove(e, pos);\n self.mousedown(e, pos);\n self.mousemove(e, pos);\n self.draw();\n }\n };\n };\n self.touchstart = function (e) {\n touchingCell = false;\n self.touchStart = self.getTouchPos(e);\n startingCell = self.getCellAt(self.touchStart.x, self.touchStart.y, true);\n if (self.dispatchEvent('touchstart', {NativeEvent: e, cell: self.startingCell})) { return; }\n if (!self.hasFocus) { return; }\n self.stopPropagation(e);\n e.preventDefault();\n if (e.touches.length === 2) {\n return self.contextmenu(e, self.touchStart);\n }\n self.touchScrollStart = {\n scrollLeft: self.scrollBox.scrollLeft,\n scrollTop: self.scrollBox.scrollTop,\n t: performance.now() / 1000\n };\n touchDelta = {\n x: self.touchStart.x,\n y: self.touchStart.y,\n scrollLeft: self.scrollBox.scrollLeft,\n scrollTop: self.scrollBox.scrollTop,\n t: 0\n };\n self.touchmove(e);\n clearTimeout(self.touchTimeout);\n clearInterval(self.touchCalcTimeout);\n self.touchTimeout = setTimeout(self.touchCell(e), self.attributes.touchSelectTimeMs);\n self.touchCalcTimeout = setInterval(self.calculatePPS, 20);\n self.touchHaltAnimation = true;\n document.body.addEventListener('touchmove', self.touchmove, {passive: false});\n document.body.addEventListener('touchend', self.touchend, false);\n document.body.addEventListener('touchcancel', self.touchcancel, false);\n };\n self.easing = function (t, b, c, d) {\n return c * (t / d) * (2 - t) + b;\n };\n self.touchEndAnimation = function () {\n if (!self.canvas || !self.scrollBox.scrollTo) { return requestAnimationFrame(self.touchEndAnimation); }\n var x,\n y,\n n = performance.now() / 1000,\n d = (self.attributes.touchReleaseAnimationDurationMs / 1000),\n t;\n touchDelta.t = touchDelta.t || n + d;\n t = n - touchDelta.t + 1;\n if (t > 1 || self.touchHaltAnimation || (animationFrames > 1000)) {\n animationFrames = 0;\n self.touchHaltAnimation = false;\n touchAnimateTo = {scrollLeft: -1, scrollTop: -1};\n return;\n }\n animationFrames += 1;\n x = self.easing(t, touchDelta.scrollLeft, -touchAnimateTo.scrollLeft, d);\n y = self.easing(t, touchDelta.scrollTop, -touchAnimateTo.scrollTop, d);\n self.scrollBox.scrollTo(x, y);\n requestAnimationFrame(self.touchEndAnimation);\n };\n self.touchend = function (e) {\n if (self.dispatchEvent('touchend', {NativeEvent: e})) { return; }\n var dz = Math.abs(touchDelta.x) + Math.abs(touchDelta.y) < self.attributes.touchDeadZone,\n pos = {\n x: self.touchStart.x + touchDelta.x,\n y: self.touchStart.y + touchDelta.y\n },\n cell = self.getCellAt(pos.x, pos.y);\n if (!self.hasFocus) { return; }\n if (touchingCell) {\n self.mouseup(e, self.touchStart);\n } else if (dz) {\n if (cell.active) {\n self.beginEditAt(cell.columnIndex, cell.rowIndex);\n } else {\n self.mousedown(e, self.touchStart);\n self.mouseup(e, self.touchStart);\n self.click(e, self.touchStart);\n }\n }\n touchingCell = false;\n document.body.removeEventListener('touchmove', self.touchmove, {passive: false});\n document.body.removeEventListener('touchend', self.touchend, false);\n document.body.removeEventListener('touchcancel', self.touchcancel, false);\n clearTimeout(self.touchTimeout);\n clearInterval(self.touchCalcTimeout);\n self.calculatePPS();\n touchAnimateTo.scrollLeft = xPPS * self.attributes.touchReleaseAcceleration;\n touchAnimateTo.scrollTop = yPPS * self.attributes.touchReleaseAcceleration;\n self.touchHaltAnimation = false;\n if (animationFrames === 0 && !/-scroll-/.test(startingCell.style) && !dz) {\n self.touchEndAnimation();\n }\n };\n self.touchmove = function (e) {\n var d = self.getTouchPos(e);\n if (self.dispatchEvent('touchmove', {NativeEvent: e, cell: self.currentCell})) { return; }\n self.stopPropagation(e);\n e.preventDefault();\n if (!self.hasFocus) { return; }\n touchDelta = {\n x: d.x - self.touchStart.x,\n y: d.y - self.touchStart.y,\n scrollLeft: self.scrollBox.scrollLeft,\n scrollTop: self.scrollBox.scrollTop,\n t: 0\n };\n if (/vertical-scroll-/.test(startingCell.style)) {\n self.scrollBox.scrollTop = self.scrollBox.scrollHeight * (d.y / self.height);\n } else if (/horizontal-scroll-/.test(startingCell.style)) {\n self.scrollBox.scrollLeft = self.scrollBox.scrollWidth * (d.x / self.width);\n } else if (touchingCell) {\n self.mousemove(e, d);\n self.draw();\n } else {\n if (animationFrames === 0) {\n self.scrollBox.scrollTo(self.touchScrollStart.scrollLeft - touchDelta.x,\n self.touchScrollStart.scrollTop - touchDelta.y);\n }\n }\n };\n self.touchcancel = function (e) {\n if (self.dispatchEvent('touchcancel', {NativeEvent: e, cell: self.currentCell})) { return; }\n if (!self.hasFocus) { return; }\n self.touchend(e);\n touchingCell = false;\n document.body.removeEventListener('touchmove', self.touchmove, {passive: false});\n document.body.removeEventListener('touchend', self.touchend, false);\n document.body.removeEventListener('touchcancel', self.touchcancel, false);\n return;\n };\n self.stopPropagation = function (e) { e.stopPropagation(); };\n self.addEventListener = function (ev, fn) {\n self.events[ev] = self.events[ev] || [];\n self.events[ev].unshift(fn);\n };\n self.removeEventListener = function (ev, fn) {\n (self.events[ev] || []).forEach(function removeEachListener(sfn, idx) {\n if (fn === sfn) {\n self.events[ev].splice(idx, 1);\n }\n });\n };\n self.dispatchEvent = function (ev, e) {\n var defaultPrevented;\n function preventDefault() {\n defaultPrevented = true;\n }\n if (!self.events[ev]) { return; }\n self.events[ev].forEach(function dispatchEachEvent(fn) {\n e.ctx = self.ctx;\n e.preventDefault = preventDefault;\n fn.apply(self.intf, [e]);\n });\n return defaultPrevented;\n };\n self.resize = function (drawAfterResize) {\n var cellBorder = self.style.cellBorderWidth * 2,\n columnHeaderCellBorder = self.style.columnHeaderCellBorderWidth * 2,\n scrollHeight,\n scrollWidth,\n rowHeaderCellHeight = self.getRowHeaderCellHeight(),\n columnHeaderCellWidth = self.getColumnHeaderCellWidth(),\n // TODO: What the hell are these numbers!? They are probably some value in the style.\n scrollDragPositionOffsetY = 30,\n scrollDragPositionOffsetX = 15;\n if (self.isChildGrid) {\n self.height = self.parentNode.offsetHeight;\n self.width = self.parentNode.offsetWidth;\n } else {\n self.parentNode = self.parentDOMNode;\n if (!self.parentIsCanvas) {\n self.height = self.parentDOMNode.offsetHeight;\n self.width = self.parentDOMNode.offsetWidth;\n self.canvas.height = self.height * window.devicePixelRatio;\n self.canvas.width = self.width * window.devicePixelRatio;\n self.canvas.style.height = self.height + 'px';\n self.canvas.style.width = self.width + 'px';\n }\n self.canvasOffsetTop = self.args.canvasOffsetTop || 0;\n self.canvasOffsetLeft = self.args.canvasOffsetLeft || 0;\n }\n scrollHeight = self.data.reduce(function reduceData(accumulator, row) {\n return accumulator\n + (self.sizes.rows[row[self.uniqueId]] || self.style.cellHeight)\n + (self.sizes.trees[row[self.uniqueId]] || 0)\n + cellBorder;\n }, 0) || 0;\n scrollWidth = self.getVisibleSchema().reduce(function reduceSchema(accumulator, column) {\n if (column.hidden) { return accumulator; }\n return accumulator + (self.sizes.columns[column[self.uniqueId]] || column.width || self.style.columnWidth) + cellBorder;\n }, 0) || 0;\n if (self.attributes.showNewRow) {\n scrollHeight += self.style.cellHeight + cellBorder;\n }\n self.scrollBox.width = self.width - columnHeaderCellWidth;\n self.scrollBox.height = self.height - rowHeaderCellHeight - columnHeaderCellBorder;\n self.scrollBox.top = rowHeaderCellHeight + columnHeaderCellBorder;\n self.scrollBox.left = columnHeaderCellWidth;\n self.scrollBox.scrollHeight = scrollHeight + self.style.scrollBarWidth - self.scrollBox.height;\n self.scrollBox.scrollWidth = scrollWidth + self.style.scrollBarWidth - self.scrollBox.width;\n self.scrollBox.widthBoxRatio = ((self.scrollBox.width - scrollDragPositionOffsetX)\n / (self.scrollBox.scrollWidth + self.scrollBox.width - scrollDragPositionOffsetX));\n self.scrollBox.scrollBoxWidth = self.scrollBox.width\n * self.scrollBox.widthBoxRatio\n - self.style.scrollBarWidth;\n self.scrollBox.heightBoxRatio = ((self.scrollBox.height - scrollDragPositionOffsetY)\n / (self.scrollBox.scrollHeight + (self.scrollBox.height - scrollDragPositionOffsetY)));\n self.scrollBox.scrollBoxHeight = self.scrollBox.height\n * self.scrollBox.heightBoxRatio\n - self.style.scrollBarWidth;\n self.scrollBox.scrollBoxWidth = Math.max(self.scrollBox.scrollBoxWidth, self.style.scrollBarBoxMinSize);\n self.scrollBox.scrollBoxHeight = Math.max(self.scrollBox.scrollBoxHeight, self.style.scrollBarBoxMinSize);\n self.page = self.visibleRows.length - 3 - self.attributes.pageUpDownOverlap;\n self.resizeEditInput();\n self.scroll(true);\n if (drawAfterResize) {\n self.draw(true);\n }\n self.dispatchEvent('resize', {});\n return true;\n };\n self.resizeEditInput = function () {\n if (self.input) {\n var pos = self.canvas.getBoundingClientRect(),\n s = self.scrollOffset(self.canvas),\n bx2 = (self.style.cellBorderWidth * 2),\n cell = self.getVisibleCellByIndex(self.input.editCell.columnIndex, self.input.editCell.rowIndex)\n || {x: -100, y: -100, height: 0, width: 0};\n self.input.style.left = pos.left + cell.x - self.style.cellBorderWidth + self.canvasOffsetLeft - s.left + 'px';\n self.input.style.top = pos.top + cell.y - bx2 + self.canvasOffsetTop - s.top + 'px';\n self.input.style.height = cell.height - bx2 - 1 + 'px';\n self.input.style.width = cell.width - bx2 - self.style.cellPaddingLeft + 'px';\n self.clipElement(self.input);\n }\n };\n self.scroll = function (e, dontDraw) {\n var s = self.getVisibleSchema(),\n cellBorder = self.style.cellBorderWidth * 2;\n self.scrollIndexTop = 0;\n self.scrollPixelTop = 0;\n self.scrollIndexLeft = 0;\n self.scrollPixelLeft = 0;\n while (self.scrollPixelTop < self.scrollBox.scrollTop && self.scrollIndexTop < self.data.length) {\n self.scrollPixelTop +=\n (self.sizes.rows[self.data[self.scrollIndexTop][self.uniqueId]] || self.style.cellHeight)\n + (self.sizes.trees[self.data[self.scrollIndexTop][self.uniqueId]] || 0)\n + cellBorder;\n self.scrollIndexTop += 1;\n }\n while (self.scrollPixelLeft < self.scrollBox.scrollLeft && self.scrollIndexLeft < s.length) {\n self.scrollPixelLeft +=\n (self.sizes.columns[s[self.scrollIndexLeft][self.uniqueId]] || s[self.scrollIndexLeft].width);\n self.scrollIndexLeft += 1;\n }\n if (self.data.length > 0) {\n self.scrollIndexLeft = Math.max(self.scrollIndexLeft - 1, 0);\n self.scrollPixelLeft = Math.max(self.scrollPixelLeft\n - (self.sizes.columns[s[self.scrollIndexLeft][self.uniqueId]] || s[self.scrollIndexLeft].width), 0);\n self.scrollIndexTop = Math.max(self.scrollIndexTop - 1, 0);\n self.scrollPixelTop = Math.max(self.scrollPixelTop\n - (self.sizes.rows[self.data[self.scrollIndexTop][self.uniqueId]] || self.style.cellHeight)\n - (self.sizes.trees[self.data[self.scrollIndexTop][self.uniqueId]] || 0), 0);\n }\n self.ellipsisCache = {};\n if (!dontDraw) {\n self.draw(true);\n }\n //TODO: figure out why this has to be delayed for child grids\n //BUG: scrolling event on 3rd level hierarchy fails to move input box\n requestAnimationFrame(self.resizeEditInput);\n self.dispatchEvent('scroll', {top: self.scrollBox.scrollTop, left: self.scrollBox.scrollLeft});\n };\n self.mousemove = function (e, overridePos) {\n if (self.contextMenu || self.input) {\n return;\n }\n self.mouse = overridePos || self.getLayerPos(e);\n var ctrl = (e.controlKey || e.metaKey || self.attributes.persistantSelectionMode),\n i,\n s = self.getSchema(),\n dragBounds,\n sBounds,\n x = self.mouse.x,\n y = self.mouse.y,\n o = self.getCellAt(x, y),\n delta,\n ev = {NativeEvent: e, cell: o, x: x, y: y},\n previousCell = self.currentCell;\n clearTimeout(self.scrollTimer);\n if (!self.isInGrid({x: x, y: y})) {\n self.hasFocus = false;\n }\n if (self.dispatchEvent('mousemove', ev)) {\n return;\n }\n if (o && self.currentCell && (self.currentCell.rowIndex !== o.rowIndex\n || self.currentCell.columnIndex !== o.columnIndex)) {\n self.cellBoundaryCrossed = true;\n ev.cell = previousCell;\n self.dispatchEvent('cellmouseout', ev);\n ev.cell = o;\n self.dispatchEvent('cellmouseover', ev);\n }\n self.currentCell = o;\n if (!self.hasFocus) {\n return;\n }\n self.hovers = {};\n if (!self.draggingItem\n && o\n && self.scrollModes.indexOf(o.context) === -1) {\n self.dragItem = o;\n self.dragMode = o.dragContext;\n self.canvas.style.cursor = o.context;\n if (o.context === 'cell' && o.data) {\n self.canvas.style.cursor = 'pointer';\n self.hovers[o.data[self.uniqueId]] = [o.columnIndex];\n }\n if ((self.selecting || self.reorderObject)\n && o.context === 'cell'\n && o.data) {\n sBounds = self.getSelectionBounds();\n delta = {\n x: Math.abs(self.dragStart.x - x),\n y: Math.abs(self.dragStart.y - y),\n };\n if (self.dragStartObject.columnIndex !== -1 && e.shiftKey) {\n self.dragStartObject = {\n rowIndex: self.activeCell.rowIndex,\n columnIndex: self.activeCell.columnIndex\n };\n }\n dragBounds = {\n top: Math.min(self.dragStartObject.rowIndex, o.rowIndex),\n left: Math.min(self.dragStartObject.columnIndex, o.columnIndex),\n bottom: Math.max(self.dragStartObject.rowIndex, o.rowIndex),\n right: Math.max(self.dragStartObject.columnIndex, o.columnIndex)\n };\n if (self.dragStartObject.columnIndex === -1) {\n dragBounds.left = -1;\n dragBounds.right = s.length - 1;\n dragBounds.top = Math.min(sBounds.top, o.rowIndex);\n dragBounds.bottom = Math.max(sBounds.bottom, o.rowIndex);\n }\n if (self.dragStartObject.rowIndex !== o.rowIndex\n || self.dragStartObject.columnIndex !== o.columnIndex) {\n self.ignoreNextClick = true;\n }\n if (self.cellBoundaryCrossed || (delta.x === 0 && delta.y === 0) || self.attributes.rowSelectionMode) {\n if (self.attributes.rowSelectionMode || self.dragStartObject.columnIndex === -1) {\n self.selectRow(o.rowIndex, ctrl, null, true);\n } else {\n if (!self.dragAddToSelection && o.rowIndex !== undefined) {\n if (self.selections[o.rowIndex] && self.selections[o.rowIndex].indexOf(o.columnIndex) !== -1) {\n self.selections[o.rowIndex].splice(self.selections[o.rowIndex].indexOf(o.columnIndex), 1);\n }\n } else {\n self.selections[o.rowIndex] = self.selections[o.rowIndex] || [];\n if (self.selections[o.rowIndex].indexOf(o.columnIndex) === -1) {\n self.selections[o.rowIndex].push(o.columnIndex);\n }\n }\n }\n }\n if ((!self.selectionBounds || (dragBounds.top !== self.selectionBounds.top\n || dragBounds.left !== self.selectionBounds.left\n || dragBounds.bottom !== self.selectionBounds.bottom\n || dragBounds.right !== self.selectionBounds.right)) && !ctrl) {\n self.selections = [];\n sBounds = dragBounds;\n if (self.attributes.rowSelectionMode) {\n for (i = sBounds.top; i <= sBounds.bottom; i += 1) {\n self.selectRow(i, true, null, true);\n }\n } else {\n self.selectArea(sBounds, true);\n }\n }\n self.autoScrollZone(e, x, y, ctrl);\n }\n }\n self.cellBoundaryCrossed = false;\n self.draw(true);\n };\n self.click = function (e, overridePos) {\n var i,\n selectionChanged,\n ctrl = (e.controlKey || e.metaKey || self.attributes.persistantSelectionMode),\n pos = overridePos || self.getLayerPos(e);\n self.currentCell = self.getCellAt(pos.x, pos.y);\n if (self.currentCell.grid !== undefined) {\n return;\n }\n function checkSelectionChange() {\n if (!selectionChanged) { return; }\n self.dispatchEvent('selectionchanged', {\n selectedData: self.getSelectedData(),\n selections: self.selections,\n selectionBounds: self.selectionBounds\n });\n }\n if (self.input) {\n self.endEdit();\n }\n if (self.ignoreNextClick) {\n self.ignoreNextClick = false;\n return;\n }\n i = self.currentCell;\n if (self.dispatchEvent('click', {NativeEvent: e, cell: self.currentCell})) { return; }\n if (!self.hasFocus) {\n return;\n }\n if (self.currentCell.context === 'cell') {\n if (self.currentCell.style === 'cornerCell') {\n self.order(self.uniqueId, 'asc', self.sorters.number);\n self.setFilter();\n checkSelectionChange();\n return;\n }\n if (self.currentCell.style === 'columnHeaderCell') {\n if (self.attributes.columnHeaderClickBehavior === 'sort') {\n if (self.orderBy === i.header.name) {\n self.orderDirection = self.orderDirection === 'asc' ? 'desc' : 'asc';\n } else {\n self.orderDirection = 'asc';\n }\n self.order(i.header.name, self.orderDirection);\n checkSelectionChange();\n return;\n }\n if (self.attributes.columnHeaderClickBehavior === 'select') {\n self.selectColumn(i.header.index, ctrl, e.shiftKey, true);\n checkSelectionChange();\n self.draw();\n return;\n }\n }\n if (['rowHeaderCell', 'columnHeaderCell'].indexOf(self.currentCell.style) === -1 && !ctrl) {\n self.setActiveCell(i.columnIndex, i.rowIndex);\n }\n self.selections[i.rowIndex] = self.selections[i.rowIndex] || [];\n if ((self.attributes.rowSelectionMode || self.currentCell.style === 'rowHeaderCell')) {\n if (self.currentCell.style === 'rowHeaderCell'\n && self.attributes.tree && pos.x > 0\n && pos.x - self.currentCell.x < self.style.treeArrowWidth\n + self.style.treeArrowMarginLeft\n + self.style.treeArrowMarginRight + self.style.treeArrowClickRadius\n && pos.y - self.currentCell.y < self.style.treeArrowHeight\n + self.style.treeArrowMarginTop + self.style.treeArrowClickRadius\n && pos.y > 0) {\n self.toggleTree(i.rowIndex);\n return;\n }\n selectionChanged = true;\n self.selectRow(i.rowIndex, ctrl, null, true);\n }\n if (e.shiftKey && !ctrl) {\n self.selectionBounds = self.getSelectionBounds();\n self.selectArea(undefined, false);\n }\n }\n checkSelectionChange();\n self.draw(true);\n };\n self.dragResizeColumn = function (e) {\n var pos, x, y;\n pos = self.getLayerPos(e);\n x = self.resizingStartingWidth + pos.x - self.dragStart.x;\n y = self.resizingStartingHeight + pos.y - self.dragStart.y;\n if (x < self.style.minColumnWidth) {\n x = self.style.minColumnWidth;\n }\n if (y < self.style.minRowHeight) {\n y = self.style.minRowHeight;\n }\n if (self.dispatchEvent('resizecolumn', {x: x, y: y, draggingItem: self.draggingItem})) { return false; }\n if (self.scrollBox.scrollLeft > self.scrollBox.scrollWidth - self.attributes.resizeScrollZone\n && self.dragMode === 'ew-resize') {\n self.resize(true);\n self.scrollBox.scrollLeft += x;\n }\n if (self.dragMode === 'ew-resize') {\n self.sizes.columns[self.draggingItem.header.style === 'rowHeaderCell'\n ? 'cornerCell' : self.draggingItem.header[self.uniqueId]] = x;\n if (['rowHeaderCell', 'cornerCell'].indexOf(self.draggingItem.header.style) !== -1) {\n self.resize(true);\n }\n self.resizeChildGrids();\n return;\n }\n if (self.dragMode === 'ns-resize') {\n if (self.draggingItem.rowOpen) {\n self.sizes.trees[self.draggingItem.data[self.uniqueId]] = y;\n } else if (self.attributes.globalRowResize) {\n self.style.cellHeight = y;\n } else {\n self.sizes.rows[self.draggingItem.data[self.uniqueId]] = y;\n }\n self.dispatchEvent('resizerow', {row: y});\n self.resizeChildGrids();\n return;\n }\n self.ellipsisCache = {};\n };\n self.stopDragResize = function () {\n self.resize();\n document.body.removeEventListener('mousemove', self.dragResizeColumn, false);\n document.body.removeEventListener('mouseup', self.stopDragResize, false);\n self.setStorageData();\n self.draw(true);\n self.ignoreNextClick = true;\n };\n self.scrollGrid = function (e) {\n var pos = self.getLayerPos(e);\n if (self.attributes.scrollPointerLock && self.pointerLockPosition\n && ['horizontal-scroll-box', 'vertical-scroll-box'].indexOf(self.scrollStartMode) !== -1) {\n self.pointerLockPosition.x += e.movementX;\n self.pointerLockPosition.y += e.movementY;\n pos = self.pointerLockPosition;\n }\n self.scrollMode = self.getCellAt(pos.x, pos.y).context;\n if (self.scrollMode === 'horizontal-scroll-box' && self.scrollStartMode !== 'horizontal-scroll-box') {\n self.scrollStartMode = 'horizontal-scroll-box';\n self.dragStart = pos;\n self.scrollStart.left = self.scrollBox.scrollLeft;\n clearTimeout(self.scrollTimer);\n return;\n }\n if (self.scrollMode === 'vertical-scroll-box' && self.scrollStartMode !== 'vertical-scroll-box') {\n self.scrollStartMode = 'vertical-scroll-box';\n self.dragStart = pos;\n self.scrollStart.top = self.scrollBox.scrollTop;\n clearTimeout(self.scrollTimer);\n return;\n }\n if (self.scrollStartMode === 'vertical-scroll-box'\n && self.scrollMode !== 'vertical-scroll-box') {\n self.scrollMode = 'vertical-scroll-box';\n }\n if (self.scrollStartMode === 'horizontal-scroll-box'\n && self.scrollMode !== 'horizontal-scroll-box') {\n self.scrollMode = 'horizontal-scroll-box';\n }\n clearTimeout(self.scrollTimer);\n if (self.scrollModes.indexOf(self.scrollMode) === -1) {\n return;\n }\n if (self.scrollMode === 'vertical-scroll-box') {\n self.scrollBox.scrollTop = self.scrollStart.top + ((pos.y - self.dragStart.y)\n / self.scrollBox.heightBoxRatio);\n } else if (self.scrollMode === 'vertical-scroll-top') {\n self.scrollBox.scrollTop -= (self.page * self.style.cellHeight);\n self.scrollTimer = setTimeout(self.scrollGrid, self.attributes.scrollRepeatRate, e);\n } else if (self.scrollMode === 'vertical-scroll-bottom') {\n self.scrollBox.scrollTop += (self.page * self.style.cellHeight);\n self.scrollTimer = setTimeout(self.scrollGrid, self.attributes.scrollRepeatRate, e);\n }\n if (self.scrollMode === 'horizontal-scroll-box') {\n self.scrollBox.scrollLeft = self.scrollStart.left + ((pos.x - self.dragStart.x)\n / self.scrollBox.widthBoxRatio);\n } else if (self.scrollMode === 'horizontal-scroll-right') {\n self.scrollBox.scrollLeft += self.attributes.selectionScrollIncrement;\n self.scrollTimer = setTimeout(self.scrollGrid, self.attributes.scrollRepeatRate, e);\n } else if (self.scrollMode === 'horizontal-scroll-left') {\n self.scrollBox.scrollLeft -= self.attributes.selectionScrollIncrement;\n self.scrollTimer = setTimeout(self.scrollGrid, self.attributes.scrollRepeatRate, e);\n }\n };\n self.stopScrollGrid = function () {\n clearTimeout(self.scrollTimer);\n if (document.exitPointerLock) {\n document.exitPointerLock();\n }\n document.body.removeEventListener('mousemove', self.scrollGrid, false);\n };\n self.dragReorder = function (e) {\n var pos, x, y;\n pos = self.getLayerPos(e);\n x = pos.x - self.dragStart.x;\n y = pos.y - self.dragStart.y;\n if (!self.attributes.allowColumnReordering && self.dragMode === 'column-reorder') {\n return;\n }\n if (!self.attributes.allowRowReordering && self.dragMode === 'row-reorder') {\n return;\n }\n if (self.dispatchEvent('reordering', {\n NativeEvent: e,\n source: self.dragStartObject,\n target: self.currentCell,\n dragMode: self.dragMode\n })) {\n return;\n }\n if (Math.abs(x) > self.attributes.reorderDeadZone || Math.abs(y) > self.attributes.reorderDeadZone) {\n self.reorderObject = self.dragStartObject;\n self.reorderTarget = self.currentCell;\n self.reorderObject.dragOffset = {\n x: x,\n y: y\n };\n self.autoScrollZone(e, pos.x, pos.x, false);\n }\n };\n self.stopDragReorder = function (e) {\n var cr = {\n 'row-reorder': self.orders.rows,\n 'column-reorder': self.orders.columns\n },\n i = {\n 'row-reorder': 'rowIndex',\n 'column-reorder': 'columnIndex'\n }[self.dragMode];\n document.body.removeEventListener('mousemove', self.dragReorder, false);\n document.body.removeEventListener('mouseup', self.stopDragReorder, false);\n if (self.reorderObject\n && self.reorderTarget) {\n self.ignoreNextClick = true;\n if (self.reorderObject[i] !== self.reorderTarget[i]\n && !self.dispatchEvent('reorder', {\n NativeEvent: e,\n source: self.reorderObject,\n target: self.reorderTarget,\n dragMode: self.dragMode\n })) {\n cr[self.dragMode].splice(cr[self.dragMode].indexOf(self.reorderObject[i]), 1);\n cr[self.dragMode].splice(cr[self.dragMode].indexOf(self.reorderTarget[i]), 0, self.reorderObject[i]);\n self.setStorageData();\n }\n }\n self.reorderObject = undefined;\n self.reorderTarget = undefined;\n self.draw(true);\n };\n self.mousedown = function (e, overridePos) {\n self.lastMouseDownTarget = e.target;\n if (self.dispatchEvent('mousedown', {NativeEvent: e, cell: self.currentCell})) { return; }\n if (!self.hasFocus) {\n return;\n }\n if (e.button === 2 || self.input) { return; }\n var ctrl = (e.controlKey || e.metaKey);\n self.dragStart = overridePos || self.getLayerPos(e);\n self.scrollStart = {\n left: self.scrollBox.scrollLeft,\n top: self.scrollBox.scrollTop\n };\n self.dragStartObject = self.getCellAt(self.dragStart.x, self.dragStart.y);\n self.dragAddToSelection = !self.dragStartObject.selected;\n if (!ctrl && !e.shiftKey && !/(vertical|horizontal)-scroll-(bar|box)/\n .test(self.dragStartObject.context) && !self.currentCell.isColumnHeader) {\n self.selections = [];\n }\n if (self.dragStartObject.isGrid) {\n return;\n }\n if (self.scrollModes.indexOf(self.dragStartObject.context) !== -1) {\n self.scrollMode = self.dragStartObject.context;\n self.scrollStartMode = self.dragStartObject.context;\n self.scrollGrid(e);\n if (self.attributes.scrollPointerLock\n && ['horizontal-scroll-box', 'vertical-scroll-box'].indexOf(self.scrollStartMode) !== -1) {\n self.pointerLockPosition = {\n x: self.dragStart.x,\n y: self.dragStart.y\n };\n self.canvas.requestPointerLock();\n }\n document.body.addEventListener('mousemove', self.scrollGrid, false);\n document.body.addEventListener('mouseup', self.stopScrollGrid, false);\n self.ignoreNextClick = true;\n return;\n }\n if (self.dragMode === 'cell') {\n self.selecting = true;\n if (self.attributes.rowSelectionMode) {\n self.selectRow(self.dragStartObject.rowIndex, ctrl, null, true);\n }\n return self.mousemove(e);\n }\n if (['ns-resize', 'ew-resize'].indexOf(self.dragMode) !== -1) {\n self.draggingItem = self.dragItem;\n if (self.draggingItem.rowOpen) {\n self.resizingStartingHeight = self.sizes.trees[self.draggingItem.data[self.uniqueId]];\n } else {\n self.resizingStartingHeight = self.sizes.rows[self.draggingItem.data[self.uniqueId]] || self.style.cellHeight;\n }\n self.resizingStartingWidth = self.sizes.columns[self.draggingItem.header.style === 'rowHeaderCell'\n ? 'cornerCell' : self.draggingItem.header[self.uniqueId]] || self.draggingItem.header.width;\n document.body.addEventListener('mousemove', self.dragResizeColumn, false);\n document.body.addEventListener('mouseup', self.stopDragResize, false);\n }\n if (['row-reorder', 'column-reorder'].indexOf(self.dragMode) !== -1) {\n self.draggingItem = self.dragItem;\n document.body.addEventListener('mousemove', self.dragReorder, false);\n document.body.addEventListener('mouseup', self.stopDragReorder, false);\n }\n };\n self.mouseup = function (e) {\n clearTimeout(self.scrollTimer);\n self.cellBoundaryCrossed = true;\n self.selecting = undefined;\n self.draggingItem = undefined;\n self.dragStartObject = undefined;\n if (self.dispatchEvent('mouseup', {NativeEvent: e, cell: self.currentCell})) { return; }\n if (!self.hasFocus && e.target !== self.canvas) {\n return;\n }\n if (self.currentCell && self.currentCell.grid !== undefined) {\n return;\n }\n if (self.contextMenu || self.input) { return; }\n if (self.dragStart && self.isInGrid(self.dragStart)) {\n self.controlInput.focus();\n }\n e.preventDefault();\n };\n self.keydown = function (e) {\n var i,\n x = self.activeCell.columnIndex,\n y = self.activeCell.rowIndex,\n ctrl = (e.controlKey || e.metaKey),\n last = self.data.length - 1,\n cols = self.getVisibleSchema().length - 1;\n if (self.dispatchEvent('keydown', {NativeEvent: e, cell: self.currentCell})) { return; }\n if (!self.hasFocus) {\n return;\n }\n self.page = self.visibleRows.length - 3 - self.attributes.pageUpDownOverlap;\n if (self.attributes.showNewRow) {\n last += 1;\n }\n if (e.keyCode === 9) {\n e.preventDefault();\n }\n // ctrl + a\n if (ctrl && e.keyCode === 65) {\n self.selectAll();\n //ArrowDown\n } else if (e.keyCode === 40) {\n y += 1;\n //ArrowUp\n } else if (e.keyCode === 38) {\n y -= 1;\n //ArrowLeft Tab\n } else if (e.keyCode === 37 || (e.shiftKey && e.keyCode === 9)) {\n x -= 1;\n //ArrowRight Tab\n } else if (e.keyCode === 39 || (!e.shiftKey && e.keyCode === 9)) {\n x += 1;\n //PageUp\n } else if (e.keyCode === 33) {\n y -= self.page;\n e.preventDefault();\n //PageDown\n } else if (e.keyCode === 34) {\n y += self.page;\n e.preventDefault();\n //Home ArrowUp\n } else if (e.keyCode === 36 || (ctrl && e.keyCode === 38)) {\n y = 0;\n //End ArrowDown\n } else if (e.keyCode === 35 || (ctrl && e.keyCode === 40)) {\n y = self.data.length - 1;\n //ArrowRight\n } else if (ctrl && e.keyCode === 39) {\n x = cols;\n //ArrowLeft\n } else if (ctrl && e.keyCode === 37) {\n x = 0;\n }\n //Enter\n if (e.keyCode === 13) {\n return self.beginEditAt(x, y);\n }\n //Space\n if (e.keyCode === 32) {\n self.selections = [];\n self.selections[Math.max(y, 0)] = [];\n self.selections[Math.max(y, 0)].push(x);\n self.selectionBounds = self.getSelectionBounds();\n if (self.attributes.rowSelectionMode) {\n for (i = self.selectionBounds.top; i <= self.selectionBounds.bottom; i += 1) {\n self.selectRow(i, ctrl, null, true);\n }\n } else {\n self.selectArea(undefined, ctrl);\n }\n e.preventDefault();\n self.draw(true);\n return;\n }\n if (x < 0) {\n x = 0;\n }\n if (y > last) {\n y = last;\n }\n if (y < 0) {\n y = 0;\n }\n if (x > cols) {\n x = cols;\n }\n // Arrows\n if (e.shiftKey && [37, 38, 39, 40].indexOf(e.keyCode) !== -1) {\n self.selections[Math.max(y, 0)] = self.selections[Math.max(y, 0)] || [];\n self.selections[Math.max(y, 0)].push(x);\n self.selectionBounds = self.getSelectionBounds();\n self.selectArea(undefined, ctrl);\n self.draw(true);\n }\n if (x !== self.activeCell.columnIndex || y !== self.activeCell.rowIndex) {\n self.scrollIntoView(x !== self.activeCell.columnIndex ? x : undefined, y !== self.activeCell.rowIndex ? y : undefined);\n self.setActiveCell(x, y);\n if (!e.shiftKey && self.attributes.selectionFollowsActiveCell) {\n if (!ctrl) {\n self.selections = [];\n }\n self.selections[y] = self.selections[y] || [];\n self.selections[y].push(x);\n self.dispatchEvent('selectionchanged', {\n selectedData: self.getSelectedData(),\n selections: self.selections,\n selectionBounds: self.selectionBounds\n });\n }\n self.draw(true);\n }\n };\n self.keyup = function (e) {\n if (self.dispatchEvent('keyup', {NativeEvent: e, cell: self.currentCell})) { return; }\n if (!self.hasFocus) {\n return;\n }\n self.controlInput.value = '';\n };\n self.keypress = function (e) {\n if (!self.hasFocus) {\n return;\n }\n if (self.dispatchEvent('keypress', {NativeEvent: e, cell: self.currentCell})) { return; }\n };\n self.dblclick = function (e) {\n if (self.dispatchEvent('dblclick', {NativeEvent: e, cell: self.currentCell})) { return; }\n if (!self.hasFocus) {\n return;\n }\n if (self.currentCell.context === 'ew-resize'\n && self.currentCell.style === 'columnHeaderCell') {\n self.fitColumnToValues(self.currentCell.header.name);\n } else if (self.currentCell.context === 'ew-resize'\n && self.currentCell.style === 'cornerCell') {\n self.autosize();\n } else if (['cell', 'activeCell'].indexOf(self.currentCell.style) !== -1) {\n self.beginEditAt(self.currentCell.columnIndex, self.currentCell.rowIndex);\n }\n };\n self.scrollWheel = function (e) {\n if (self.dispatchEvent('wheel', {NativeEvent: e})) {\n return;\n }\n self.touchHaltAnimation = true;\n var l = self.scrollBox.scrollLeft,\n t = self.scrollBox.scrollTop;\n if (self.hasFocus) {\n self.scrollBox.scrollTop += e.deltaY;\n self.scrollBox.scrollLeft += e.deltaX;\n }\n if (t !== self.scrollBox.scrollTop || l !== self.scrollBox.scrollLeft) {\n e.preventDefault();\n }\n };\n self.copy = function (e) {\n if (self.dispatchEvent('copy', {NativeEvent: e})) { return; }\n if (!self.hasFocus || !e.clipboardData) { return; }\n var rows = [], sData = self.getSelectedData();\n if (sData.length > 0) {\n sData.forEach(function (row) {\n if (row) {\n var r = [];\n Object.keys(row).forEach(function (key) {\n r.push('\"' + row[key].replace(/\"/g, '\"\"') + '\"');\n });\n r.join(',');\n rows.push(r);\n }\n });\n e.clipboardData.setData('text/plain', rows.join('\\n'));\n e.preventDefault();\n }\n };\n return;\n };\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/events.js\n// module id = 2\n// module chunks = 0","/*jslint browser: true, unparam: true, todo: true*/\n/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/\ndefine([], function () {\n 'use strict';\n return function (self) {\n self.orders = {\n rows: [],\n columns: []\n };\n self.hasFocus = false;\n self.activeCell = {\n columnIndex: 0,\n rowIndex: 0\n };\n self.storageName = 'canvasDataGrid';\n self.invalidSearchExpClass = 'canvas-datagrid-invalid-search-regExp';\n self.localStyleLibraryStorageKey = 'canvas-datagrid-user-style-library';\n self.uniqueId = '_canvasDataGridUniqueId';\n self.orderBy = self.uniqueId;\n self.orderDirection = 'asc';\n self.columnFilters = {};\n self.filters = {};\n self.ellipsisCache = {};\n self.scrollBox = {};\n self.visibleRows = [];\n self.sizes = {\n rows: {},\n columns: {},\n trees: {}\n };\n self.currentFilter = function () {\n return true;\n };\n self.selections = [];\n self.hovers = {};\n self.attributes = {};\n self.style = {};\n self.intf = {};\n self.formatters = {};\n self.sorters = {};\n self.schemaHashes = {};\n self.events = {};\n self.uId = 0;\n self.changes = [];\n self.scrollIndexTop = 0;\n self.scrollPixelTop = 0;\n self.scrollIndexLeft = 0;\n self.scrollPixelLeft = 0;\n self.childGrids = {};\n self.openChildren = {};\n self.scrollModes = [\n 'vertical-scroll-box',\n 'vertical-scroll-top',\n 'vertical-scroll-bottom',\n 'horizontal-scroll-box',\n 'horizontal-scroll-right',\n 'horizontal-scroll-left'\n ];\n self.mouse = { x: 0, y: 0};\n self.getSelectedData = function (expandToRow) {\n var d = [], s = self.getSchema(), l = self.data.length;\n self.selections.forEach(function (row, index) {\n if (index === l) { return; }\n if (row.length === 0) {\n d[index] = null;\n return;\n }\n d[index] = {};\n if (expandToRow) {\n s.forEach(function (column) {\n d[index][column.name] = self.data[index][column.name];\n });\n } else {\n row.forEach(function (col) {\n if (col === -1) { return; }\n d[index][s[col].name] = self.data[index][s[col].name];\n });\n }\n });\n return d;\n };\n self.scrollOffset = function (e) {\n var x = 0, y = 0;\n while (e.parentNode) {\n if (e.nodeType !== 'canvas-datagrid-tree'\n && e.nodeType !== 'canvas-datagrid-cell') {\n x -= e.scrollLeft;\n y -= e.scrollTop;\n }\n e = e.parentNode;\n }\n return {left: x, top: y};\n };\n self.position = function (e, ignoreScrollOffset) {\n var x = 0, y = 0, s = e, h, w;\n while (e.offsetParent) {\n x += e.offsetLeft;\n y += e.offsetTop;\n h = e.offsetHeight;\n w = e.offsetWidth;\n e = e.offsetParent;\n }\n if (ignoreScrollOffset) {\n return {left: x, top: y, height: h, width: w};\n }\n e = s;\n s = self.scrollOffset(e);\n return { left: x + s.left, top: y + s.top, height: h, width: w };\n };\n self.getLayerPos = function (e) {\n var rect = self.canvas.getBoundingClientRect(),\n pos = {\n x: e.clientX - rect.left,\n y: e.clientY - rect.top\n };\n if (self.isChildGrid) {\n pos.x -= self.canvasOffsetLeft;\n pos.y -= self.canvasOffsetTop;\n }\n return {\n x: pos.x,\n y: pos.y,\n rect: rect\n };\n };\n self.fillArray = function (low, high, step) {\n step = step || 1;\n var i = [], x;\n for (x = low; x <= high; x += step) {\n i[x] = x;\n }\n return i;\n };\n self.getRowHeaderCellHeight = function () {\n if (!self.attributes.showColumnHeaders) { return 0; }\n return self.sizes.rows[-1] || self.style.columnHeaderCellHeight;\n };\n self.getColumnHeaderCellWidth = function () {\n if (!self.attributes.showRowHeaders) { return 0; }\n return self.sizes.columns.cornerCell || self.style.rowHeaderCellWidth;\n };\n self.setStorageData = function () {\n if (!self.attributes.saveAppearance) { return; }\n localStorage.setItem(self.storageName + '-' + self.attributes.name, JSON.stringify({\n sizes: {\n rows: self.sizes.rows,\n columns: self.sizes.columns\n },\n orders: {\n rows: self.orders.rows,\n columns: self.orders.columns\n },\n orderBy: self.orderBy,\n orderDirection: self.orderDirection\n }));\n };\n self.getSchema = function () {\n return self.schema || self.tempSchema;\n };\n self.createColumnOrders = function () {\n var s = self.getSchema();\n self.orders.columns = self.fillArray(0, s.length - 1);\n };\n self.createRowOrders = function () {\n self.orders.rows = self.fillArray(0, self.data.length - 1);\n };\n self.getVisibleSchema = function () {\n return self.getSchema().filter(function (col) { return !col.hidden; });\n };\n self.applyDefaultValue = function (row, header) {\n var d = header.defaultValue || '';\n if (typeof d === 'function') {\n d = d.apply(self.intf, [header]);\n }\n row[header.name] = d;\n };\n self.createNewRowData = function () {\n self.newRow = {};\n self.newRow[self.uniqueId] = self.uId;\n self.uId += 1;\n self.getSchema().forEach(function forEachHeader(header) {\n self.applyDefaultValue(self.newRow, header);\n });\n };\n self.getSchemaNameHash = function (key) {\n var n = 0;\n while (self.schemaHashes[key]) {\n n += 1;\n key = key + n;\n }\n return key;\n };\n self.filter = function (type) {\n var f = self.filters[type];\n if (!f && type !== undefined) {\n console.warn('Cannot find filter for type %s, falling back to substring match.', type);\n f = self.filters.string;\n }\n return f;\n };\n self.getBestGuessDataType = function (columnName) {\n var t, x, l = self.data.length;\n for (x = 0; x < l; x += 1) {\n if ([null, undefined].indexOf(self.data[x][columnName]) !== -1) {\n t = typeof self.data[x];\n return t === 'object' ? 'string' : t;\n }\n }\n return 'string';\n };\n self.drawChildGrids = function () {\n Object.keys(self.childGrids).forEach(function (gridKey) {\n self.childGrids[gridKey].draw();\n });\n };\n self.resizeChildGrids = function () {\n Object.keys(self.childGrids).forEach(function (gridKey) {\n self.childGrids[gridKey].resize();\n });\n };\n self.getClippingRect = function (ele) {\n var boundingRect = self.position(self.parentNode),\n eleRect = self.position(ele),\n s = self.scrollOffset(self.canvas),\n clipRect = {\n x: 0,\n y: 0,\n h: 0,\n w: 0\n },\n parentRect = {\n x: -Infinity,\n y: -Infinity,\n h: Infinity,\n w: Infinity\n },\n rowHeaderCellHeight = self.getRowHeaderCellHeight(),\n columnHeaderCellWidth = self.getColumnHeaderCellWidth();\n boundingRect.top -= s.top;\n boundingRect.left -= s.left;\n eleRect.top -= s.top;\n eleRect.left -= s.left;\n clipRect.h = boundingRect.top + boundingRect.height - ele.offsetTop - self.style.scrollBarWidth;\n clipRect.w = boundingRect.left + boundingRect.width - ele.offsetLeft - self.style.scrollBarWidth;\n clipRect.x = boundingRect.left + (eleRect.left * -1) + columnHeaderCellWidth;\n clipRect.y = boundingRect.top + (eleRect.top * -1) + rowHeaderCellHeight;\n return {\n x: clipRect.x > parentRect.x ? clipRect.x : parentRect.x,\n y: clipRect.y > parentRect.y ? clipRect.y : parentRect.y,\n h: clipRect.h < parentRect.h ? clipRect.h : parentRect.h,\n w: clipRect.w < parentRect.w ? clipRect.w : parentRect.w\n };\n };\n self.clipElement = function (ele) {\n var clipRect = self.getClippingRect(ele);\n if (clipRect.w < 0) { clipRect.w = 0; }\n if (clipRect.h < 0) { clipRect.h = 0; }\n ele.style.clip = 'rect('\n + clipRect.y + 'px,'\n + clipRect.w + 'px,'\n + clipRect.h + 'px,'\n + clipRect.x + 'px'\n + ')';\n // INFO https://developer.mozilla.org/en-US/docs/Web/CSS/clip\n // clip has been \"deprecated\" for clipPath. Of course nothing but chrome\n // supports clip path, so we'll keep using clip until someday clipPath becomes\n // more widely support. The code below works correctly, but setting clipPath and clip\n // at the same time has undesirable results.\n // ele.style.clipPath = 'polygon('\n // + clipRect.x + 'px ' + clipRect.y + 'px,'\n // + clipRect.x + 'px ' + clipRect.h + 'px,'\n // + clipRect.w + 'px ' + clipRect.h + 'px,'\n // + clipRect.w + 'px ' + clipRect.y + 'px'\n // + ')';\n };\n self.autoScrollZone = function (e, x, y, ctrl) {\n var setTimer,\n columnHeaderCellWidth = self.getColumnHeaderCellWidth(),\n rowHeaderCellHeight = self.getRowHeaderCellHeight();\n if (x > self.width - self.attributes.selectionScrollZone && x < self.width) {\n self.scrollBox.scrollLeft += self.attributes.selectionScrollIncrement;\n setTimer = true;\n }\n if (y > self.height - self.attributes.selectionScrollZone && y < self.height) {\n self.scrollBox.scrollTop += self.attributes.selectionScrollIncrement;\n setTimer = true;\n }\n if (x - self.attributes.selectionScrollZone - columnHeaderCellWidth < 0) {\n self.scrollBox.scrollLeft -= self.attributes.selectionScrollIncrement;\n setTimer = true;\n }\n if (y - self.attributes.selectionScrollZone - rowHeaderCellHeight < 0) {\n self.scrollBox.scrollTop -= self.attributes.selectionScrollIncrement;\n setTimer = true;\n }\n if (setTimer && !ctrl && self.currentCell && self.currentCell.columnIndex !== -1) {\n self.scrollTimer = setTimeout(self.mousemove, self.attributes.scrollRepeatRate, e);\n }\n };\n self.refreshFromOrigialData = function () {\n self.data = self.originalData.filter(function (row) {\n return true;\n });\n };\n self.validateColumn = function (c, s) {\n if (!c.name) {\n throw new Error('A column must contain at least a name.');\n }\n if (s.filter(function (i) { return i.name === c.name; }).length > 0) {\n throw new Error('A column with the name '\n + c.name + ' already exists and cannot be added again.');\n }\n return true;\n };\n self.setDefaults = function (obj1, obj2, key, def) {\n obj1[key] = obj2[key] === undefined ? def : obj2[key];\n };\n self.setAttributes = function () {\n self.defaults.attributes.forEach(function eachAttribute(i) {\n self.setDefaults(self.attributes, self.args, i[0], i[1]);\n });\n };\n self.setStyle = function () {\n self.defaults.styles.forEach(function eachStyle(i) {\n self.setDefaults(self.style, self.args.style || {}, i[0], i[1]);\n });\n };\n self.autosize = function (colName) {\n self.getVisibleSchema().forEach(function (col) {\n if (col.name === colName || colName === undefined) {\n self.fitColumnToValues(col.name);\n }\n });\n self.fitColumnToValues('cornerCell');\n };\n self.dispose = function () {\n if (!self.isChildGrid && self.canvas && self.canvas.parentNode) {\n self.canvas.parentNode.removeChild(self.canvas);\n }\n self.eventParent.removeEventListener('mouseup', self.mouseup, false);\n self.eventParent.removeEventListener('mousedown', self.mousedown, false);\n self.eventParent.removeEventListener('dblclick', self.dblclick, false);\n self.eventParent.removeEventListener('click', self.click, false);\n self.eventParent.removeEventListener('mousemove', self.mousemove);\n self.eventParent.removeEventListener('wheel', self.scrollWheel, false);\n self.canvas.removeEventListener('contextmenu', self.contextmenu, false);\n self.canvas.removeEventListener('copy', self.copy);\n self.controlInput.removeEventListener('keypress', self.keypress, false);\n self.controlInput.removeEventListener('keyup', self.keyup, false);\n self.controlInput.removeEventListener('keydown', self.keydown, false);\n window.removeEventListener('resize', self.resize);\n if (self.observer && self.observer.disconnect) {\n self.observer.disconnect();\n }\n };\n self.tryLoadStoredOrders = function () {\n var s;\n if (self.storedSettings && typeof self.storedSettings.orders === 'object') {\n if (self.storedSettings.orders.rows.length >= self.data.length) {\n self.orders.rows = self.storedSettings.orders.rows;\n }\n s = self.getSchema();\n self.orders.columns = self.storedSettings.orders.columns;\n s.forEach(function (h, i) {\n if (self.orders.columns.indexOf(i) === -1) {\n self.orders.columns.push(i);\n }\n });\n self.orderBy = self.storedSettings.orderBy === undefined\n ? self.uniqueId : self.storedSettings.orderBy;\n self.orderDirection = self.storedSettings.orderDirection === undefined\n ? self.uniqueId : self.storedSettings.orderDirection;\n if (self.getHeaderByName(self.orderBy) && self.orderDirection) {\n self.order(self.orderBy, self.orderDirection);\n }\n }\n };\n self.getFontHeight = function (fontStyle) {\n return parseFloat(fontStyle, 10);\n };\n self.parseFont = function (key) {\n if (/Font/.test(key)) {\n self.style[key + 'Height'] = self.getFontHeight(self.style[key]);\n }\n };\n self.initProp = function (propName) {\n if (!self.args[propName]) { return; }\n Object.keys(self.args[propName]).forEach(function (key) {\n self[propName][key] = self.args[propName][key];\n });\n };\n self.init = function () {\n var publicStyleKeyIntf = {};\n self.setAttributes();\n self.setStyle();\n self.initScrollBox();\n self.setDom();\n self.type = 'canvas-datagrid';\n Object.keys(self.style).forEach(self.parseFont);\n self.intf.type = self.type;\n self.intf.addEventListener = self.addEventListener;\n self.intf.removeEventListener = self.removeEventListener;\n self.intf.dispatchEvent = self.dispatchEvent;\n self.intf.dispose = self.dispose;\n self.intf.appendTo = self.appendTo;\n self.intf.filters = self.filters;\n self.intf.sorters = self.sorters;\n self.intf.autosize = self.autosize;\n self.intf.beginEditAt = self.beginEditAt;\n self.intf.endEdit = self.endEdit;\n self.intf.setActiveCell = self.setActiveCell;\n self.intf.scrollIntoView = self.scrollIntoView;\n self.intf.clearChangeLog = self.clearChangeLog;\n self.intf.gotoCell = self.gotoCell;\n self.intf.gotoRow = self.gotoRow;\n self.intf.findColumnScrollLeft = self.findColumnScrollLeft;\n self.intf.findRowScrollTop = self.findRowScrollTop;\n self.intf.fitColumnToValues = self.fitColumnToValues;\n self.intf.findColumnMaxTextLength = self.findColumnMaxTextLength;\n self.intf.disposeContextMenu = self.disposeContextMenu;\n self.intf.getCellAt = self.getCellAt;\n self.intf.isCellVisible = self.isCellVisible;\n self.intf.order = self.order;\n self.intf.draw = self.draw;\n self.intf.selectArea = self.selectArea;\n self.intf.clipElement = self.clipElement;\n self.intf.getSchemaFromData = self.getSchemaFromData;\n self.intf.setFilter = self.setFilter;\n self.intf.selectRow = self.selectRow;\n self.intf.parentGrid = self.parentGrid;\n self.intf.toggleTree = self.toggleTree;\n self.intf.expandTree = self.expandTree;\n self.intf.collapseTree = self.collapseTree;\n self.intf.canvas = self.canvas;\n self.intf.context = self.ctx;\n self.intf.insertRow = self.insertRow;\n self.intf.deleteRow = self.deleteRow;\n self.intf.addRow = self.addRow;\n self.intf.insertColumn = self.insertColumn;\n self.intf.deleteColumn = self.deleteColumn;\n self.intf.addColumn = self.addColumn;\n self.intf.getClippingRect = self.getClippingRect;\n self.intf.setRowHeight = self.setRowHeight;\n self.intf.setColumnWidth = self.setColumnWidth;\n self.intf.resetColumnWidths = self.resetColumnWidths;\n self.intf.resetRowHeights = self.resetRowHeights;\n self.intf.resize = self.resize;\n self.intf.selectColumn = self.selectColumn;\n self.intf.selectRow = self.selectRow;\n self.intf.selectAll = self.selectAll;\n self.intf.drawChildGrids = self.drawChildGrids;\n self.intf.assertPxColor = self.assertPxColor;\n self.intf.clearPxColorAssertions = self.clearPxColorAssertions;\n self.intf.integerToAlpha = self.integerToAlpha;\n self.intf.copy = self.copy;\n self.intf.style = {};\n Object.keys(self.style).forEach(function (key) {\n // unless this line is here, Object.keys() will not work on .style\n publicStyleKeyIntf[key] = undefined;\n Object.defineProperty(publicStyleKeyIntf, key, {\n get: function () {\n return self.style[key];\n },\n set: function (value) {\n self.parseFont(value);\n self.style[key] = value;\n self.draw(true);\n self.dispatchEvent('stylechanged', {name: key, value: value});\n }\n });\n });\n Object.defineProperty(self.intf, 'activeCell', {\n get: function () {\n return self.activeCell;\n }\n });\n /**\n * When true, the grid is has focus.\n * @memberof canvasDataGrid\n * @property hasFocus\n * @readonly\n */\n Object.defineProperty(self.intf, 'hasFocus', {\n get: function () {\n return self.hasFocus;\n }\n });\n Object.defineProperty(self.intf, 'style', {\n get: function () {\n return publicStyleKeyIntf;\n },\n set: function (value) {\n Object.keys(value).forEach(function (key) {\n self.parseFont(value);\n self.style[key] = value[key];\n });\n self.draw(true);\n self.dispatchEvent('stylechanged', {name: 'style', value: value});\n }\n });\n Object.keys(self.attributes).forEach(function (key) {\n Object.defineProperty(self.intf.attributes, key, {\n get: function () {\n return self.attributes[key];\n },\n set: function (value) {\n self.attributes[key] = value;\n self.draw(true);\n self.dispatchEvent('attributechanged', {name: key, value: value[key]});\n }\n });\n });\n self.filters.string = function (value, filterFor) {\n if (!filterFor) { return true; }\n var filterRegExp;\n self.invalidFilterRegEx = undefined;\n try {\n filterRegExp = new RegExp(filterFor, 'ig');\n } catch (e) {\n self.invalidFilterRegEx = e;\n return;\n }\n return filterRegExp.test(value);\n };\n self.filters.number = function (value, filterFor) {\n if (!filterFor) { return true; }\n return value === filterFor;\n };\n if (self.attributes.name && self.attributes.saveAppearance) {\n self.storedSettings = localStorage.getItem(self.storageName + '-' + self.attributes.name);\n if (self.storedSettings) {\n try {\n self.storedSettings = JSON.parse(self.storedSettings);\n } catch (e) {\n console.warn('could not read settings from localStore', e);\n self.storedSettings = undefined;\n }\n }\n if (self.storedSettings) {\n if (typeof self.storedSettings.sizes === 'object') {\n self.sizes.rows = self.storedSettings.sizes.rows;\n self.sizes.columns = self.storedSettings.sizes.columns;\n ['trees', 'columns', 'rows'].forEach(function (i) {\n if (!self.sizes[i]) {\n self.sizes[i] = {};\n }\n });\n }\n }\n }\n ['formatters', 'filters', 'sorters'].forEach(self.initProp);\n if (self.args.data) {\n self.intf.data = self.args.data;\n }\n if (!self.data) {\n self.intf.data = [];\n }\n if (self.args.schema) {\n self.intf.schema = self.args.schema;\n }\n if (self.isChildGrid) {\n requestAnimationFrame(function () { self.resize(true); });\n } else {\n self.resize(true);\n }\n };\n /**\n * Removes focus from the grid.\n * @memberof canvasDataGrid\n * @name blur\n * @method\n */\n self.intf.blur = function (e) {\n self.hasFocus = false;\n };\n /**\n * Focuses on the grid.\n * @memberof canvasDataGrid\n * @name focus\n * @method\n */\n self.intf.focus = function () {\n self.hasFocus = true;\n self.controlInput.focus();\n };\n Object.defineProperty(self.intf, 'height', {\n get: function () {\n return self.parentNode.height;\n },\n set: function (value) {\n self.parentNode.height = value;\n self.resize(true);\n }\n });\n Object.defineProperty(self.intf, 'width', {\n get: function () {\n return self.parentNode.width;\n },\n set: function (value) {\n self.parentNode.width = value;\n self.resize(true);\n }\n });\n Object.defineProperty(self.intf, 'openChildren', {\n get: function () {\n return self.openChildren;\n }\n });\n Object.defineProperty(self.intf, 'childGrids', {\n get: function () {\n return Object.keys(self.childGrids).map(function (gridId) {\n return self.childGrids[gridId];\n });\n }\n });\n Object.defineProperty(self.intf, 'isChildGrid', {\n get: function () {\n return self.isChildGrid;\n }\n });\n Object.defineProperty(self.intf, 'parentNode', {\n get: function () {\n return self.parentNode;\n },\n set: function (value) {\n self.parentNode = value;\n }\n });\n Object.defineProperty(self.intf, 'offsetParent', {\n get: function () {\n return self.parentNode;\n },\n set: function (value) {\n self.parentNode = value;\n }\n });\n Object.defineProperty(self.intf, 'offsetLeft', {\n get: function () {\n return self.parentNode.offsetLeft;\n }\n });\n Object.defineProperty(self.intf, 'offsetTop', {\n get: function () {\n return self.parentNode.offsetTop;\n }\n });\n Object.defineProperty(self.intf, 'scrollHeight', {\n get: function () {\n return self.scrollBox.scrollHeight;\n }\n });\n Object.defineProperty(self.intf, 'scrollWidth', {\n get: function () {\n return self.scrollBox.scrollWidth;\n }\n });\n Object.defineProperty(self.intf, 'scrollTop', {\n get: function () {\n return self.scrollBox.scrollTop;\n },\n set: function (value) {\n self.scrollBox.scrollTop = value;\n }\n });\n Object.defineProperty(self.intf, 'scrollLeft', {\n get: function () {\n return self.scrollBox.scrollLeft;\n },\n set: function (value) {\n self.scrollBox.scrollLeft = value;\n }\n });\n Object.defineProperty(self.intf, 'sizes', {\n get: function () {\n return self.sizes;\n }\n });\n Object.defineProperty(self.intf, 'input', {\n get: function () {\n return self.input;\n }\n });\n Object.defineProperty(self.intf, 'controlInput', {\n get: function () {\n return self.controlInput;\n }\n });\n Object.defineProperty(self.intf, 'currentCell', {\n get: function () {\n return self.currentCell;\n }\n });\n Object.defineProperty(self.intf, 'visibleCells', {\n get: function () {\n return self.visibleCells;\n }\n });\n Object.defineProperty(self.intf, 'visibleRows', {\n get: function () {\n return self.visibleRows;\n }\n });\n Object.defineProperty(self.intf, 'selections', {\n get: function () {\n return self.selections;\n }\n });\n Object.defineProperty(self.intf, 'dragMode', {\n get: function () {\n return self.dragMode;\n }\n });\n Object.defineProperty(self.intf, 'changes', {\n get: function () {\n return self.changes;\n }\n });\n self.intf.attributes = {};\n self.intf.formatters = self.formatters;\n self.normalizeDataset = function (data) {\n var i, d, max, syncFnInvoked;\n if (data === null || data === '' || data === undefined) {\n return [];\n }\n if (typeof data === 'string'\n || typeof data === 'number'\n || typeof data === 'boolean') {\n data = [{'0': data}];\n }\n if (!Array.isArray(data) && typeof data === 'object') {\n data = [data];\n }\n if ((!Array.isArray(data[0]) && typeof data[0] === 'object')\n || (Array.isArray(data) && data.length === 0)) {\n return data;\n }\n if (typeof data === 'function') {\n i = data.apply(self.intf, [function (d) {\n if (syncFnInvoked) {\n console.warn('Detected a callback to the data setter function after the same function already returned a value synchronously.');\n }\n self.normalizeDataset(d);\n }]);\n if (i) {\n syncFnInvoked = true;\n self.normalizeDataset(i);\n }\n }\n if (!Array.isArray(data) && typeof data === 'object') {\n data = [data];\n }\n if (Array.isArray(data)) {\n if (!Array.isArray(data[0])) {\n //array of something? throw it all into 1 row!\n data = [data];\n }\n // find the longest length\n max = 0;\n d = [];\n data.forEach(function (row) {\n max = Math.max(max, row.length);\n });\n // map against length indexes\n data.forEach(function (row, index) {\n var x;\n d[index] = {};\n for (x = 0; x < max; x += 1) {\n d[index][x] = row[x] || null;\n }\n });\n return d;\n }\n throw new Error('Unsupported data type. Must be an array of arrays or an array of objects, function or string.');\n };\n Object.defineProperty(self.intf, 'selectionBounds', {\n get: function () {\n return self.getSelectionBounds();\n }\n });\n Object.defineProperty(self.intf, 'selectedRows', {\n get: function () {\n return self.getSelectedData(true);\n }\n });\n Object.defineProperty(self.intf, 'selectedCells', {\n get: function () {\n return self.getSelectedData();\n }\n });\n Object.defineProperty(self.intf, 'visibleSchema', {\n get: function () {\n return self.getVisibleSchema().map(function eachDataRow(col) {\n return col;\n });\n }\n });\n Object.defineProperty(self.intf, 'ctx', {\n get: function () {\n return self.ctx;\n }\n });\n Object.defineProperty(self.intf, 'schema', {\n get: function schemaGetter() {\n return self.getSchema();\n },\n set: function schemaSetter(value) {\n if (!Array.isArray(value) || typeof value[0] !== 'object') {\n throw new Error('Schema must be an array of objects.');\n }\n if (value[0].name === undefined) {\n throw new Error('Expected schema to contain an object with at least a name property.');\n }\n self.schema = value.map(function eachSchemaColumn(column, index) {\n column.width = column.width || self.style.columnWidth;\n column[self.uniqueId] = self.getSchemaNameHash(column.name);\n column.filter = column.filter || self.filter(column.type);\n column.type = column.type || 'string';\n column.index = index;\n column.columnIndex = index;\n column.rowIndex = -1;\n return column;\n });\n self.tempSchema = undefined;\n self.createNewRowData();\n self.createColumnOrders();\n self.tryLoadStoredOrders();\n self.resize(true);\n self.dispatchEvent('schemachanged', {schema: self.schema});\n }\n });\n Object.defineProperty(self.intf, 'data', {\n get: function dataGetter() {\n return self.data.map(function (row) {\n delete row[self.uniqueId];\n return row;\n });\n },\n set: function dataSetter(value) {\n self.originalData = self.normalizeDataset(value).map(function eachDataRow(row) {\n row[self.uniqueId] = self.uId;\n self.uId += 1;\n return row;\n });\n self.changes = [];\n //TODO apply filter to incoming dataset\n self.data = self.originalData;\n if (!self.schema && self.data.length > 0) {\n self.tempSchema = self.getSchemaFromData();\n }\n if (!self.schema && self.data.length === 0) {\n self.tempSchema = [{name: ''}];\n self.tempSchema[0][self.uniqueId] = self.getSchemaNameHash('');\n }\n if (self.tempSchema && !self.schema) {\n self.createColumnOrders();\n self.tryLoadStoredOrders();\n self.dispatchEvent('schemachanged', {schema: self.tempSchema});\n }\n self.createNewRowData();\n if (self.attributes.autoResizeColumns && self.data.length > 0\n && self.storedSettings === undefined) {\n self.autosize();\n }\n self.fitColumnToValues('cornerCell', true);\n if (!self.resize() || !self.isChildGrid) { self.draw(true); }\n self.createRowOrders();\n self.tryLoadStoredOrders();\n self.dispatchEvent('datachanged', {data: self.data});\n }\n });\n self.initScrollBox = function () {\n var sHeight = 0,\n sWidth = 0,\n scrollTop = 0,\n scrollLeft = 0,\n scrollHeight = 0,\n scrollWidth = 0,\n scrollBoxHeight = 20,\n scrollBoxWidth = 20;\n function setScrollTop(value, preventScrollEvent) {\n if (isNaN(value)) {\n throw new Error('ScrollTop value must be a number');\n }\n if (value < 0) {\n value = 0;\n }\n if (value > scrollHeight) {\n value = scrollHeight;\n }\n if (scrollHeight < 0) {\n value = 0;\n }\n scrollTop = value;\n if (!preventScrollEvent) {\n self.scroll();\n }\n }\n function setScrollLeft(value, preventScrollEvent) {\n if (isNaN(value)) {\n throw new Error('ScrollLeft value must be a number');\n }\n if (value < 0) {\n value = 0;\n }\n if (value > scrollWidth) {\n value = scrollWidth;\n }\n if (scrollWidth < 0) {\n value = 0;\n }\n scrollLeft = value;\n if (!preventScrollEvent) {\n self.scroll();\n }\n }\n self.scrollBox.scrollTo = function (x, y) {\n setScrollLeft(x, true);\n setScrollTop(y);\n };\n Object.defineProperty(self.scrollBox, 'scrollBoxHeight', {\n get: function () {\n return scrollBoxHeight;\n },\n set: function (value) {\n scrollBoxHeight = value;\n }\n });\n Object.defineProperty(self.scrollBox, 'scrollBoxWidth', {\n get: function () {\n return scrollBoxWidth;\n },\n set: function (value) {\n scrollBoxWidth = value;\n }\n });\n Object.defineProperty(self.scrollBox, 'height', {\n get: function () {\n return sHeight;\n },\n set: function (value) {\n if (scrollHeight < value) {\n scrollTop = 0;\n }\n sHeight = value;\n }\n });\n Object.defineProperty(self.scrollBox, 'width', {\n get: function () {\n return sWidth;\n },\n set: function (value) {\n sWidth = value;\n }\n });\n Object.defineProperty(self.scrollBox, 'scrollTop', {\n get: function () {\n return scrollTop;\n },\n set: setScrollTop\n });\n Object.defineProperty(self.scrollBox, 'scrollLeft', {\n get: function () {\n return scrollLeft;\n },\n set: setScrollLeft\n });\n Object.defineProperty(self.scrollBox, 'scrollHeight', {\n get: function () {\n return scrollHeight;\n },\n set: function (value) {\n if (scrollTop > value) {\n scrollTop = Math.max(value, 0);\n }\n if (scrollHeight < sHeight) {\n scrollTop = 0;\n }\n scrollHeight = value;\n }\n });\n Object.defineProperty(self.scrollBox, 'scrollWidth', {\n get: function () {\n return scrollWidth;\n },\n set: function (value) {\n if (scrollLeft > value) {\n scrollLeft = Math.max(value, 0);\n }\n scrollWidth = value;\n }\n });\n };\n return;\n };\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/intf.js\n// module id = 3\n// module chunks = 0","/*jslint browser: true, unparam: true, todo: true*/\n/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false, Event: false*/\ndefine([], function () {\n 'use strict';\n return function (self) {\n var zIndexTop = 2, hoverScrollTimeout, autoCompleteContext;\n function createContextMenu(ev, pos, items, parentContextMenu) {\n var container = document.createElement('div'),\n upArrow = document.createElement('div'),\n downArrow = document.createElement('div'),\n children = [],\n selectedIndex = -1,\n intf = {},\n rect;\n if (!Array.isArray(items)) { throw new Error('createContextMenu expects an array.'); }\n function createItems() {\n items.forEach(function (item) {\n var contextItemContainer = document.createElement('div'),\n childMenuArrow;\n function removeChildContext(e) {\n if (e.relatedTarget === container\n || item.contextMenu.container === e.relatedTarget\n || childMenuArrow === e.relatedTarget\n || (contextItemContainer === e.relatedTarget)\n ) { return; }\n item.contextMenu.dispose();\n children.splice(children.indexOf(item.contextMenu), 1);\n item.contextMenu = undefined;\n contextItemContainer.removeEventListener('mouseout', removeChildContext);\n container.removeEventListener('mouseout', removeChildContext);\n contextItemContainer.setAttribute('contextOpen', '0');\n contextItemContainer.setAttribute('opening', '0');\n }\n function contextAddCallback(items) {\n // check yet again if the user hasn't moved off\n if (contextItemContainer.getAttribute('opening') !== '1' ||\n contextItemContainer.getAttribute('contextOpen') === '1') {\n return;\n }\n var cPos = contextItemContainer.getBoundingClientRect();\n cPos = {\n left: cPos.left + self.style.childContextMenuMarginLeft + container.offsetWidth,\n top: cPos.top + self.style.childContextMenuMarginTop,\n bottom: cPos.bottom,\n right: cPos.right,\n };\n item.contextMenu = createContextMenu(ev, cPos, items, intf);\n contextItemContainer.setAttribute('contextOpen', '1');\n contextItemContainer.addEventListener('mouseout', removeChildContext);\n container.addEventListener('mouseout', removeChildContext);\n children.push(item.contextMenu);\n }\n function createChildContext() {\n var i;\n if (contextItemContainer.getAttribute('contextOpen') === '1') {\n return;\n }\n contextItemContainer.setAttribute('opening', '1');\n if (typeof item.items === 'function') {\n i = item.items.apply(intf, [function (items) {\n contextAddCallback(items);\n }]);\n if (i !== undefined && Array.isArray(i)) {\n contextAddCallback(i);\n }\n return;\n }\n contextAddCallback(item.items);\n }\n function addItem(item) {\n function addContent(content) {\n if (typeof content === 'function') {\n return addContent(content(ev));\n }\n if (typeof content === 'object') {\n contextItemContainer.appendChild(content);\n return;\n }\n self.createInlineStyle(contextItemContainer, 'canvas-datagrid-context-menu-item');\n contextItemContainer.addEventListener('mouseover', function () {\n self.createInlineStyle(contextItemContainer, 'canvas-datagrid-context-menu-item:hover');\n });\n contextItemContainer.addEventListener('mouseout', function () {\n self.createInlineStyle(contextItemContainer, 'canvas-datagrid-context-menu-item');\n });\n contextItemContainer.innerHTML = content;\n return;\n }\n addContent(item.title);\n item.contextItemContainer = contextItemContainer;\n if (item.items && item.items.length > 0) {\n childMenuArrow = document.createElement('div');\n self.createInlineStyle(childMenuArrow, 'canvas-datagrid-context-child-arrow');\n childMenuArrow.innerHTML = self.style.childContextMenuArrowHTML;\n contextItemContainer.appendChild(childMenuArrow);\n contextItemContainer.addEventListener('mouseover', createChildContext);\n contextItemContainer.addEventListener('mouseout', function () {\n contextItemContainer.setAttribute('opening', '0');\n });\n }\n if (item.click) {\n contextItemContainer.addEventListener('click', function (ev) {\n item.click.apply(self, [ev]);\n });\n }\n }\n addItem(item);\n container.appendChild(contextItemContainer);\n });\n }\n function clickIndex(idx) {\n items[idx].contextItemContainer.dispatchEvent(new Event('click'));\n }\n function checkArrowVisibility() {\n if (container.scrollTop > 0) {\n document.body.appendChild(upArrow);\n } else if (upArrow.parentNode) {\n upArrow.parentNode.removeChild(upArrow);\n }\n if (container.scrollTop >= container.scrollHeight - container.offsetHeight && downArrow.parentNode) {\n downArrow.parentNode.removeChild(downArrow);\n } else if (container.scrollHeight - container.offsetHeight > 0\n && !(container.scrollTop >= container.scrollHeight - container.offsetHeight)) {\n document.body.appendChild(downArrow);\n }\n }\n function startHoverScroll(type) {\n return function t() {\n var a = self.attributes.contextHoverScrollAmount;\n if (type === 'up' && container.scrollTop === 0) { return; }\n if (type === 'down' && container.scrollTop === container.scrollHeight) { return; }\n container.scrollTop += (type === 'up' ? -a : a);\n hoverScrollTimeout = setTimeout(t, self.attributes.contextHoverScrollRateMs, type);\n };\n }\n function endHoverScroll(type) {\n return function () {\n clearTimeout(hoverScrollTimeout);\n };\n }\n function init() {\n var loc = {},\n s = self.scrollOffset(self.canvas);\n createItems();\n self.createInlineStyle(container, 'canvas-datagrid-context-menu');\n loc.x = pos.left - s.left;\n loc.y = pos.top - s.top;\n loc.height = 0;\n zIndexTop += 1;\n container.style.position = 'absolute';\n upArrow.style.color = self.style.contextMenuArrowColor;\n downArrow.style.color = self.style.contextMenuArrowColor;\n [upArrow, downArrow].forEach(function (el) {\n el.style.textAlign = 'center';\n el.style.position = 'absolute';\n el.style.zIndex = zIndexTop + 1;\n });\n container.style.zIndex = zIndexTop;\n if (parentContextMenu && parentContextMenu.inputDropdown) {\n container.style.maxHeight = window.innerHeight - loc.y - self.style.autocompleteBottomMargin + 'px';\n container.style.minWidth = pos.width + 'px';\n loc.y += pos.height;\n }\n container.style.left = loc.x + 'px';\n container.style.top = loc.y + 'px';\n container.addEventListener('scroll', checkArrowVisibility);\n container.addEventListener('wheel', function (e) {\n if (self.hasFocus) {\n container.scrollTop += e.deltaY;\n container.scrollLeft += e.deltaX;\n }\n checkArrowVisibility();\n });\n upArrow.innerHTML = self.style.contextMenuArrowUpHTML;\n downArrow.innerHTML = self.style.contextMenuArrowDownHTML;\n container.appendChild(upArrow);\n document.body.appendChild(downArrow);\n document.body.appendChild(container);\n rect = container.getBoundingClientRect();\n if (rect.bottom > window.innerHeight && !(parentContextMenu && parentContextMenu.inputDropdown)) {\n loc.y = window.innerHeight - container.offsetHeight;\n if (loc.y < 0) { loc.y = 0; }\n if (container.offsetHeight > window.innerHeight) {\n container.style.height = window.innerHeight - self.style.contextMenuWindowMargin + 'px';\n }\n }\n if (rect.right > window.innerWidth) {\n if (parentContextMenu) {\n loc.x = parentContextMenu.container.offsetLeft - container.offsetWidth;\n } else {\n loc.x = window.innerWidth - container.offsetWidth;\n }\n }\n container.style.left = loc.x + 'px';\n container.style.top = loc.y + 'px';\n rect = container.getBoundingClientRect();\n upArrow.style.top = rect.top + 'px';\n downArrow.style.top = rect.top + rect.height - downArrow.offsetHeight + 'px';\n upArrow.style.left = rect.left + 'px';\n downArrow.style.left = rect.left + 'px';\n downArrow.style.width = container.offsetWidth + 'px';\n upArrow.style.width = container.offsetWidth + 'px';\n downArrow.addEventListener('mouseover', startHoverScroll('down'));\n downArrow.addEventListener('mouseout', endHoverScroll('down'));\n upArrow.addEventListener('mouseover', startHoverScroll('up'));\n upArrow.addEventListener('mouseout', endHoverScroll('up'));\n checkArrowVisibility();\n }\n intf.parentGrid = self.intf;\n intf.parentContextMenu = parentContextMenu;\n intf.container = container;\n init();\n intf.clickIndex = clickIndex;\n intf.rect = rect;\n intf.items = items;\n intf.upArrow = upArrow;\n intf.downArrow = downArrow;\n intf.dispose = function () {\n clearTimeout(hoverScrollTimeout);\n children.forEach(function (c) {\n c.dispose();\n });\n [downArrow, upArrow, container].forEach(function (el) {\n if (el.parentNode) { el.parentNode.removeChild(el); }\n });\n };\n Object.defineProperty(intf, 'selectedIndex', {\n get: function () {\n return selectedIndex;\n },\n set: function (value) {\n if (typeof value !== 'number' || isNaN(value || !isFinite(value))) {\n throw new Error('Context menu selected index must be a sane number.');\n }\n selectedIndex = value;\n if (selectedIndex > items.length - 1) {\n selectedIndex = items.length - 1;\n }\n if (selectedIndex < 0) {\n selectedIndex = 0;\n }\n items.forEach(function (item, index) {\n if (index === selectedIndex) {\n return self.createInlineStyle(item.contextItemContainer, 'canvas-datagrid-context-menu-item:hover');\n }\n self.createInlineStyle(item.contextItemContainer, 'canvas-datagrid-context-menu-item');\n });\n }\n });\n return intf;\n }\n function createFilterContextMenuItems(e) {\n var filterContainer = document.createElement('div'),\n filterLabel = document.createElement('div'),\n filterAutoCompleteButton = document.createElement('button'),\n filterInput = document.createElement('input'),\n n = e.cell && e.cell.header ? e.cell.header.title || e.cell.header.name : '',\n autoCompleteItems,\n iRect;\n function fillAutoComplete() {\n autoCompleteItems = {};\n self.data.forEach(function (row) {\n var value = row[e.cell.header.name];\n if (autoCompleteItems[value]) { return; }\n autoCompleteItems[value] = {\n title: self.formatters[e.cell.header.type || 'string']({ cell: { value: value }}),\n click: function (e) {\n filterInput.value = value;\n e.stopPropagation();\n filterInput.dispatchEvent(new Event('keyup'));\n self.disposeAutocomplete();\n return;\n }\n };\n });\n autoCompleteItems = Object.keys(autoCompleteItems).map(function (key) {\n return autoCompleteItems[key];\n });\n }\n function createAutoCompleteContext(ev) {\n if (ev && [40, 38, 13, 9, 27].indexOf(ev.keyCode) !== -1) { return; }\n fillAutoComplete();\n iRect = filterInput.getBoundingClientRect();\n if (autoCompleteContext) {\n autoCompleteContext.dispose();\n autoCompleteContext = undefined;\n }\n autoCompleteContext = createContextMenu(e, {\n left: iRect.left,\n top: iRect.top,\n right: iRect.right,\n bottom: iRect.bottom,\n height: iRect.height,\n width: iRect.width\n }, autoCompleteItems, {inputDropdown: true});\n autoCompleteContext.selectedIndex = 0;\n }\n self.createInlineStyle(filterLabel, 'canvas-datagrid-context-menu-label');\n self.createInlineStyle(filterAutoCompleteButton, 'canvas-datagrid-context-menu-filter-button');\n self.createInlineStyle(filterInput, 'canvas-datagrid-context-menu-filter-input');\n filterInput.onclick = self.disposeAutocomplete;\n filterInput.addEventListener('keydown', function (e) {\n //down\n if (e.keyCode === 40) {\n autoCompleteContext.selectedIndex += 1;\n }\n //up\n if (e.keyCode === 38) {\n autoCompleteContext.selectedIndex -= 1;\n }\n //enter\n if (e.keyCode === 13) {\n autoCompleteContext.clickIndex(autoCompleteContext.selectedIndex);\n self.disposeContextMenu();\n }\n //tab\n if (e.keyCode === 9) {\n autoCompleteContext.clickIndex(autoCompleteContext.selectedIndex);\n e.preventDefault();\n }\n //esc\n if (e.keyCode === 27) {\n self.disposeContextMenu();\n }\n });\n filterInput.addEventListener('keyup', function () {\n self.setFilter(e.cell.header.name, filterInput.value);\n });\n filterInput.addEventListener('keyup', createAutoCompleteContext);\n filterInput.value = e.cell.header ? self.columnFilters[e.cell.header.name] || '' : '';\n filterLabel.innerHTML = self.attributes.filterOptionText.replace(/%s/g, n);\n filterAutoCompleteButton.onclick = function () {\n if (autoCompleteContext) {\n return self.disposeAutocomplete();\n }\n createAutoCompleteContext();\n };\n filterAutoCompleteButton.innerHTML = self.style.contextFilterButtonHTML;\n filterContainer.addEventListener('click', function (e) {\n return e.stopPropagation();\n });\n filterContainer.appendChild(filterLabel);\n filterContainer.appendChild(filterInput);\n filterContainer.appendChild(filterAutoCompleteButton);\n e.items.push({\n title: filterContainer\n });\n if (Object.keys(self.columnFilters).length) {\n Object.keys(self.columnFilters).forEach(function (cf) {\n var h = self.getHeaderByName(cf);\n e.items.push({\n title: self.attributes.removeFilterOptionText.replace(/%s/g, h.title || h.name),\n click: function removeFilterClick(e) {\n e.preventDefault();\n self.setFilter(cf, '');\n self.controlInput.focus();\n }\n });\n });\n }\n }\n function addDefaultContextMenuItem(e) {\n var isNormalCell = !(e.cell.isBackground || e.cell.isHeaderCellCap\n || e.cell.isScrollBar || e.cell.isCorner || e.cell.isRowHeader)\n && e.cell.header;\n if (self.attributes.showFilter && isNormalCell) {\n createFilterContextMenuItems(e);\n }\n if (self.attributes.showCopy\n && self.selections.reduce(function (p, r) {\n return p + r.length;\n }, 0) > 0) {\n e.items.push({\n title: self.attributes.copyText,\n click: function () {\n document.execCommand('copy');\n self.disposeContextMenu();\n self.controlInput.focus();\n }\n });\n }\n if (self.attributes.saveAppearance && self.attributes.showClearSettingsOption\n && (Object.keys(self.sizes.rows).length > 0\n || Object.keys(self.sizes.columns).length > 0)) {\n e.items.push({\n title: self.attributes.clearSettingsOptionText,\n click: function (e) {\n e.preventDefault();\n self.sizes.rows = {};\n self.sizes.columns = {};\n self.createRowOrders();\n self.createColumnOrders();\n self.storedSettings = undefined;\n self.dispatchEvent('resizecolumn', {columnWidth: self.style.columnWidth});\n self.dispatchEvent('resizerow', {cellHeight: self.style.cellHeight});\n self.setStorageData();\n self.resize(true);\n self.disposeContextMenu();\n self.controlInput.focus();\n }\n });\n }\n if (self.attributes.allowSorting && self.attributes.showOrderByOption && isNormalCell) {\n e.items.push({\n title: self.attributes.showOrderByOptionTextAsc.replace('%s', e.cell.header.title || e.cell.header.name),\n click: function (ev) {\n ev.preventDefault();\n self.order(e.cell.header.name, 'asc');\n self.controlInput.focus();\n }\n });\n e.items.push({\n title: self.attributes.showOrderByOptionTextDesc.replace('%s', e.cell.header.title || e.cell.header.name),\n click: function (ev) {\n ev.preventDefault();\n self.order(e.cell.header.name, 'desc');\n self.disposeContextMenu();\n self.controlInput.focus();\n }\n });\n }\n }\n self.disposeAutocomplete = function () {\n if (autoCompleteContext) {\n autoCompleteContext.dispose();\n autoCompleteContext = undefined;\n }\n };\n self.disposeContextMenu = function () {\n document.removeEventListener('click', self.disposeContextMenu);\n zIndexTop = 2;\n self.disposeAutocomplete();\n if (self.contextMenu) {\n self.contextMenu.dispose();\n }\n self.contextMenu = undefined;\n };\n self.contextmenuEvent = function (e, overridePos) {\n if (!self.hasFocus && e.target !== self.canvas) {\n return;\n }\n var items = [],\n pos = overridePos || self.getLayerPos(e, true),\n ev = {\n NativeEvent: e,\n cell: self.getCellAt(pos.x, pos.y),\n items: items\n };\n if (!ev.cell.isGrid) {\n addDefaultContextMenuItem(ev);\n }\n if (self.dispatchEvent('contextmenu', ev)) {\n return;\n }\n if (!ev.cell.isGrid) {\n if (self.contextMenu) {\n self.disposeContextMenu();\n }\n self.contextMenu = createContextMenu(ev, {\n left: pos.x + pos.rect.left + self.style.contextMenuMarginLeft + self.canvasOffsetLeft,\n top: pos.y + pos.rect.top + self.style.contextMenuMarginTop + self.canvasOffsetTop,\n right: ev.cell.width + ev.cell.x + pos.rect.left,\n bottom: ev.cell.height + ev.cell.y + pos.rect.top,\n height: ev.cell.height,\n width: ev.cell.width\n }, items);\n document.addEventListener('click', self.disposeContextMenu);\n e.preventDefault();\n }\n };\n return;\n };\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/contextMenu.js\n// module id = 4\n// module chunks = 0","/*jslint browser: true, unparam: true, todo: true*/\n/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/\ndefine([], function () {\n 'use strict';\n return function (self) {\n self.defaults = {\n attributes: [\n ['name', ''],\n ['tree', false],\n ['showNewRow', false],\n ['treeHorizontalScroll', false],\n ['saveAppearance', true],\n ['selectionFollowsActiveCell', false],\n ['multiLine', false],\n ['editable', true],\n ['allowColumnReordering', true],\n ['allowRowReordering', false],\n ['allowSorting', true],\n ['showFilter', true],\n ['globalRowResize', false],\n ['pageUpDownOverlap', 1],\n ['persistantSelectionMode', false],\n ['rowSelectionMode', false],\n ['autoResizeColumns', false],\n ['allowRowHeaderResize', true],\n ['allowColumnResize', true],\n ['allowRowResize', true],\n ['allowRowResizeFromCell', false],\n ['allowColumnResizeFromCell', false],\n ['debug', false],\n ['borderResizeZone', 10],\n ['showColumnHeaders', true],\n ['showRowNumbers', true],\n ['showRowHeaders', true],\n ['scrollRepeatRate', 75],\n ['selectionScrollZone', 20],\n ['resizeScrollZone', 20],\n ['contextHoverScrollRateMs', 5],\n ['contextHoverScrollAmount', 2],\n ['selectionScrollIncrement', 20],\n ['reorderDeadZone', 3],\n ['showClearSettingsOption', true],\n ['showOrderByOption', true],\n ['clearSettingsOptionText', 'Clear saved settings'],\n ['showOrderByOptionTextAsc', 'Order by %s ascending'],\n ['showOrderByOptionTextDesc', 'Order by %s descending'],\n ['removeFilterOptionText', 'Remove filter on %s'],\n ['filterOptionText', 'Filter %s'],\n ['filterTextPrefix', '(filtered) '],\n ['touchReleaseAnimationDurationMs', 1000],\n ['touchReleaseAcceleration', 30],\n ['touchDeadZone', 3],\n ['touchSelectTimeMs', 800],\n ['touchScrollZone', 40],\n ['copyText', 'Copy'],\n ['showCopy', true],\n ['columnHeaderClickBehavior', 'sort'],\n ['scrollPointerLock', true]\n ],\n styles: [\n ['activeCellBackgroundColor', 'rgba(255, 255, 255, 1)'],\n ['activeCellBorderColor', 'rgba(110, 168, 255, 1)'],\n ['activeCellBorderWidth', 0.25],\n ['activeCellColor', 'rgba(0, 0, 0, 1)'],\n ['activeCellFont', '16px sans-serif'],\n ['activeCellHoverBackgroundColor', 'rgba(255, 255, 255, 1)'],\n ['activeCellHoverColor', 'rgba(0, 0, 0, 1)'],\n ['activeCellOverlayBorderColor', 'rgba(66, 133, 244, 1)'],\n ['activeCellOverlayBorderWidth', 0.5],\n ['activeCellPaddingBottom', 5],\n ['activeCellPaddingLeft', 5],\n ['activeCellPaddingRight', 7],\n ['activeCellPaddingTop', 5],\n ['activeCellSelectedBackgroundColor', 'rgba(236, 243, 255, 1)'],\n ['activeCellSelectedColor', 'rgba(0, 0, 0, 1)'],\n ['activeColumnHeaderCellBackgroundColor', 'rgba(225, 225, 225, 1)'],\n ['activeColumnHeaderCellColor', 'rgba(0, 0, 0, 1)'],\n ['activeRowHeaderCellBackgroundColor', 'rgba(225, 225, 225, 1)'],\n ['activeRowHeaderCellColor', 'rgba(0, 0, 0, 1)'],\n ['autocompleteBottomMargin', 60],\n ['autosizeHeaderCellPadding', 8],\n ['autosizePadding', 5],\n ['backgroundColor', 'rgba(240, 240, 240, 1)'],\n ['cellAutoResizePadding', 13],\n ['cellBackgroundColor', 'rgba(255, 255, 255, 1)'],\n ['cellBorderColor', 'rgba(195, 199, 202, 1)'],\n ['cellBorderWidth', 0.5],\n ['cellColor', 'rgba(0, 0, 0, 1)'],\n ['cellFont', '16px sans-serif'],\n ['cellGridHeight', 250],\n ['cellHeight', 24],\n ['cellHeightWithChildGrid', 150],\n ['cellHorizontalAlignment', 'left'],\n ['cellHoverBackgroundColor', 'rgba(255, 255, 255, 1)'],\n ['cellHoverColor', 'rgba(0, 0, 0, 1)'],\n ['cellPaddingBottom', 5],\n ['cellPaddingLeft', 5],\n ['cellPaddingRight', 7],\n ['cellPaddingTop', 5],\n ['cellSelectedBackgroundColor', 'rgba(236, 243, 255, 1)'],\n ['cellSelectedColor', 'rgba(0, 0, 0, 1)'],\n ['cellVerticalAlignment', 'center'],\n ['cellWidthWithChildGrid', 250],\n ['childContextMenuArrowColor', 'rgba(43, 48, 43, 1)'],\n ['childContextMenuArrowHTML', '►'],\n ['childContextMenuMarginLeft', -15],\n ['childContextMenuMarginTop', 0],\n ['columnHeaderCellBackgroundColor', 'rgba(240, 240, 240, 1)'],\n ['columnHeaderCellBorderColor', 'rgba(152, 152, 152, 1)'],\n ['columnHeaderCellBorderWidth', 0.25],\n ['columnHeaderCellColor', 'rgba(50, 50, 50, 1)'],\n ['columnHeaderCellFont', '16px sans-serif'],\n ['columnHeaderCellHeight', 25],\n ['columnHeaderCellHorizontalAlignment', 'left'],\n ['columnHeaderCellHoverBackgroundColor', 'rgba(235, 235, 235, 1)'],\n ['columnHeaderCellHoverColor', 'rgba(0, 0, 0, 1)'],\n ['columnHeaderCellPaddingBottom', 5],\n ['columnHeaderCellPaddingLeft', 5],\n ['columnHeaderCellPaddingRight', 7],\n ['columnHeaderCellPaddingTop', 5],\n ['columnHeaderCellVerticalAlignment', 'center'],\n ['columnWidth', 250],\n ['contextFilterButtonBorder', 'solid 1px rgba(158, 163, 169, 1)'],\n ['contextFilterButtonBorderRadius', '3px'],\n ['contextFilterButtonHTML', '▼'],\n ['contextFilterInputBackground', 'rgba(255,255,255,1)'],\n ['contextFilterInputBorder', 'solid 1px rgba(158, 163, 169, 1)'],\n ['contextFilterInputBorderRadius', '0'],\n ['contextFilterInputColor', 'rgba(0,0,0,1)'],\n ['contextFilterInputFontFamily', 'sans-serif'],\n ['contextFilterInputFontSize', '14px'],\n ['contextMenuArrowColor', 'rgba(43, 48, 43, 1)'],\n ['contextMenuArrowDownHTML', '▼'],\n ['contextMenuArrowUpHTML', '▲'],\n ['contextMenuBackground', 'rgba(240, 240, 240, 1)'],\n ['contextMenuBorder', 'solid 1px rgba(158, 163, 169, 1)'],\n ['contextMenuBorderRadius', '3px'],\n ['contextMenuChildArrowFontSize', '12px'],\n ['contextMenuColor', 'rgba(43, 48, 43, 1)'],\n ['contextMenuFilterButtonFontFamily', 'sans-serif'],\n ['contextMenuFilterButtonFontSize', '10px'],\n ['contextMenuFilterInvalidExpresion', 'rgba(237, 155, 156, 1)'],\n ['contextMenuFontFamily', 'sans-serif'],\n ['contextMenuFontSize', '16px'],\n ['contextMenuHoverBackground', 'rgba(182, 205, 250, 1)'],\n ['contextMenuHoverColor', 'rgba(43, 48, 153, 1)'],\n ['contextMenuItemBorderRadius', '3px'],\n ['contextMenuItemMargin', '2px'],\n ['contextMenuLabelDisplay', 'inline-block'],\n ['contextMenuLabelMargin', '0 3px 0 0'],\n ['contextMenuLabelMaxWidth', '700px'],\n ['contextMenuLabelMinWidth', '75px'],\n ['contextMenuMarginLeft', 3],\n ['contextMenuMarginTop', -3],\n ['contextMenuOpacity', '0.98'],\n ['contextMenuPadding', '2px'],\n ['contextMenuWindowMargin', 6],\n ['cornerCellBackgroundColor', 'rgba(240, 240, 240, 1)'],\n ['cornerCellBorderColor', 'rgba(202, 202, 202, 1)'],\n ['editCellBackgroundColor', 'white'],\n ['editCellBorder', 'solid 1px rgba(110, 168, 255, 1)'],\n ['editCellBoxShadow', '0 2px 5px rgba(0,0,0,0.4)'],\n ['editCellColor', 'black'],\n ['editCellFontFamily', 'sans-serif'],\n ['editCellFontSize', '16px'],\n ['editCellPaddingLeft', 4],\n ['gridBorderColor', 'rgba(202, 202, 202, 1)'],\n ['gridBorderWidth', 1],\n ['columnHeaderOrderByArrowBorderColor', 'rgba(195, 199, 202, 1)'],\n ['columnHeaderOrderByArrowBorderWidth', 1],\n ['columnHeaderOrderByArrowColor', 'rgba(155, 155, 155, 1)'],\n ['columnHeaderOrderByArrowHeight', 8],\n ['columnHeaderOrderByArrowMarginLeft', 0],\n ['columnHeaderOrderByArrowMarginRight', 5],\n ['columnHeaderOrderByArrowMarginTop', 6],\n ['columnHeaderOrderByArrowWidth', 13],\n ['minColumnWidth', 45],\n ['minHeight', 24],\n ['minRowHeight', 24],\n ['name', 'default'],\n ['reorderMarkerBackgroundColor', 'rgba(0, 0, 0, 0.1)'],\n ['reorderMarkerBorderColor', 'rgba(0, 0, 0, 0.2)'],\n ['reorderMarkerBorderWidth', 1.25],\n ['reorderMarkerIndexBorderColor', 'rgba(66, 133, 244, 1)'],\n ['reorderMarkerIndexBorderWidth', 2.75],\n ['rowHeaderCellBackgroundColor', 'rgba(240, 240, 240, 1)'],\n ['rowHeaderCellBorderColor', 'rgba(200, 200, 200, 1)'],\n ['rowHeaderCellBorderWidth', 1],\n ['rowHeaderCellColor', 'rgba(50, 50, 50, 1)'],\n ['rowHeaderCellFont', '16px sans-serif'],\n ['rowHeaderCellHeight', 25],\n ['rowHeaderCellHorizontalAlignment', 'left'],\n ['rowHeaderCellHoverBackgroundColor', 'rgba(235, 235, 235, 1)'],\n ['rowHeaderCellHoverColor', 'rgba(0, 0, 0, 1)'],\n ['rowHeaderCellPaddingBottom', 5],\n ['rowHeaderCellPaddingLeft', 5],\n ['rowHeaderCellPaddingRight', 5],\n ['rowHeaderCellPaddingTop', 5],\n ['rowHeaderCellSelectedBackgroundColor', 'rgba(217, 217, 217, 1)'],\n ['rowHeaderCellSelectedColor', 'rgba(50, 50, 50, 1)'],\n ['rowHeaderCellVerticalAlignment', 'center'],\n ['rowHeaderCellWidth', 57],\n ['scrollBarActiveColor', 'rgba(125, 125, 125, 1)'],\n ['scrollBarBackgroundColor', 'rgba(240, 240, 240, 1)'],\n ['scrollBarBorderColor', 'rgba(202, 202, 202, 1)'],\n ['scrollBarBorderWidth', 0.5],\n ['scrollBarBoxBorderRadius', 4.125],\n ['scrollBarBoxColor', 'rgba(192, 192, 192, 1)'],\n ['scrollBarBoxMargin', 2],\n ['scrollBarBoxMinSize', 15],\n ['scrollBarBoxWidth', 8],\n ['scrollBarCornerBackgroundColor', 'rgba(240, 240, 240, 1)'],\n ['scrollBarCornerBorderColor', 'rgba(202, 202, 202, 1)'],\n ['scrollBarWidth', 11],\n ['selectionOverlayBorderColor', 'rgba(66, 133, 244, 1)'],\n ['selectionOverlayBorderWidth', 0.75],\n ['treeArrowBorderColor', 'rgba(195, 199, 202, 1)'],\n ['treeArrowBorderWidth', 1],\n ['treeArrowClickRadius', 5],\n ['treeArrowColor', 'rgba(155, 155, 155, 1)'],\n ['treeArrowHeight', 8],\n ['treeArrowMarginLeft', 0],\n ['treeArrowMarginRight', 5],\n ['treeArrowMarginTop', 6],\n ['treeArrowWidth', 13],\n ['treeGridHeight', 250]\n ]\n };\n };\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/defaults.js\n// module id = 5\n// module chunks = 0","/*jslint browser: true, unparam: true, todo: true*/\n/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/\ndefine([], function () {\n 'use strict';\n return function (self) {\n /**\n * Ends editing, optionally aborting the edit.\n * @memberof canvasDataGrid\n * @name endEdit\n * @method\n * @param {boolean} abort When true, abort the edit.\n */\n self.endEdit = function (abort) {\n var cell = self.input.editCell,\n y = cell.rowIndex;\n function abortEdit() {\n abort = true;\n }\n if (self.dispatchEvent('beforeendedit', {\n cell: cell,\n newValue: self.input.value,\n oldValue: cell.value,\n abort: abortEdit,\n input: self.input\n })) { return false; }\n if (self.input.value !== cell.value && !abort) {\n self.changes[y] = self.changes[y] || {};\n self.changes[y][cell.header.name] = self.input.value;\n cell.data[cell.header.name] = self.input.value;\n if (y === self.data.length) {\n if (self.dispatchEvent('newrow', {\n value: self.input.value,\n defaultValue: cell.value,\n aborted: abort,\n cell: cell,\n input: self.input\n })) { return false; }\n self.uId += 1;\n self.addRow(cell.data);\n self.createNewRowData();\n }\n self.draw(true);\n }\n document.body.removeChild(self.input);\n self.controlInput.focus();\n self.dispatchEvent('endedit', {\n cell: cell,\n value: self.input.value,\n aborted: abort,\n input: self.input\n });\n self.input = undefined;\n return true;\n };\n /**\n * Begins editing at cell x, row y.\n * @memberof canvasDataGrid\n * @name beginEditAt\n * @method\n * @param {number} x The column index of the cell to edit.\n * @param {number} y The row index of the cell to edit.\n */\n self.beginEditAt = function (x, y) {\n if (!self.attributes.editable) { return; }\n var cell = self.getVisibleCellByIndex(x, y),\n s = self.getVisibleSchema(),\n enumItems;\n if (self.dispatchEvent('beforebeginedit', {cell: cell})) { return false; }\n self.scrollIntoView(x, y);\n self.setActiveCell(x, y);\n if (cell.header.enum) {\n self.input = document.createElement('select');\n } else {\n self.input = document.createElement(self.attributes.multiLine\n ? 'textarea' : 'input');\n }\n function postDraw() {\n var option, valueInEnum;\n cell = self.getVisibleCellByIndex(x, y);\n if (cell.header.enum) {\n // add enums\n if (typeof cell.header.enum === 'function') {\n enumItems = cell.header.enum.apply(self.intf, [{cell: cell}]);\n } else if (Array.isArray(cell.header.enum)) {\n enumItems = cell.header.enum;\n }\n enumItems.forEach(function (e) {\n var i = document.createElement('option'),\n val,\n title;\n if (Array.isArray(e)) {\n val = e[0];\n title = e[1];\n } else {\n val = e;\n title = e;\n }\n if (val === cell.value) { valueInEnum = true; }\n i.value = val;\n i.innerHTML = title;\n self.input.appendChild(i);\n });\n if (!valueInEnum) {\n option = document.createElement('option');\n option.value = cell.value;\n option.innerHTML = cell.value;\n self.input.appendChild(option);\n }\n self.input.addEventListener('change', function () {\n self.endEdit();\n self.draw(true);\n });\n }\n document.body.appendChild(self.input);\n self.createInlineStyle(self.input, 'canvas-datagrid-edit-input');\n self.input.style.position = 'absolute';\n self.input.editCell = cell;\n self.resizeEditInput();\n self.input.style.zIndex = '2';\n self.input.value = cell.value;\n self.input.focus();\n self.input.addEventListener('click', self.stopPropagation);\n self.input.addEventListener('dblclick', self.stopPropagation);\n self.input.addEventListener('mouseup', self.stopPropagation);\n self.input.addEventListener('mousedown', self.stopPropagation);\n self.input.addEventListener('keydown', function (e) {\n var nx = cell.columnIndex,\n ny = cell.rowIndex;\n // esc\n if (e.keyCode === 27) {\n self.endEdit(true);\n self.draw(true);\n // enter\n } else if (e.keyCode === 13\n && (!self.attributes.multiLine\n || (self.attributes.multiLine && e.shiftKey))) {\n self.endEdit();\n self.draw(true);\n } else if (e.keyCode === 9) {\n e.preventDefault();\n if (!self.endEdit()) {\n return;\n }\n if (e.shiftKey) {\n nx -= 1;\n } else {\n nx += 1;\n }\n if (nx < 0) {\n nx = s.length - 1;\n ny -= 1;\n }\n if (nx > s.length - 1) {\n nx = 0;\n ny += 1;\n }\n if (ny < 0) {\n ny = self.data.length - 1;\n }\n if (ny > self.data.length - 1) {\n ny = 0;\n }\n self.scrollIntoView(nx, ny);\n self.beginEditAt(nx, ny);\n }\n });\n }\n postDraw();\n self.dispatchEvent('beginedit', {cell: cell, input: self.input});\n };\n self.createInlineStyle = function (el, className) {\n var css = {\n 'canvas-datagrid-context-menu-filter-input': {\n height: '19px',\n verticalAlign: 'bottom',\n marginLeft: '2px',\n padding: '0',\n background: self.style.contextFilterInputBackground,\n color: self.style.contextFilterInputColor,\n border: self.style.contextFilterInputBorder,\n borderRadius: self.style.contextFilterInputBorderRadius,\n lineHeight: 'normal',\n fontWeight: 'normal',\n fontFamily: self.style.contextFilterInputFontFamily,\n fontSize: self.style.contextFilterInputFontSize\n },\n 'canvas-datagrid-context-menu-filter-button': {\n height: '19px',\n verticalAlign: 'bottom',\n marginLeft: '2px',\n padding: '0',\n background: self.style.contextMenuBackground,\n color: self.style.contextMenuColor,\n border: self.style.contextFilterButtonBorder,\n borderRadius: self.style.contextFilterButtonBorderRadius,\n lineHeight: 'normal',\n fontWeight: 'normal',\n fontFamily: self.style.contextMenuFilterButtonFontFamily,\n fontSize: self.style.contextMenuFilterButtonFontSize\n },\n 'canvas-datagrid-context-child-arrow': {\n cssFloat: 'right',\n color: self.style.childContextMenuArrowColor,\n fontSize: self.style.contextMenuChildArrowFontSize,\n fontFamily: self.style.contextMenuFontFamily,\n verticalAlign: 'middle'\n },\n 'canvas-datagrid-autocomplete': {\n fontFamily: self.style.contextMenuFontFamily,\n fontSize: self.style.contextMenuFontSize,\n background: self.style.contextMenuBackground,\n color: self.style.contextMenuColor,\n border: self.style.contextMenuBorder,\n padding: self.style.contextMenuPadding,\n borderRadius: self.style.contextMenuBorderRadius,\n opacity: self.style.contextMenuOpacity,\n position: 'absolute',\n zIndex: 3,\n overflow: 'hidden'\n },\n 'canvas-datagrid-autocomplete-item': {\n background: self.style.contextMenuBackground,\n color: self.style.contextMenuColor\n },\n 'canvas-datagrid-autocomplete-item:hover': {\n background: self.style.contextMenuHoverBackground,\n color: self.style.contextMenuHoverColor\n },\n 'canvas-datagrid-canvas': {\n position: 'absolute',\n zIndex: '-1'\n },\n 'canvas-datagrid': {\n position: 'absolute',\n background: self.style.backgroundColor,\n zIndex: '1',\n boxSizing: 'content-box',\n padding: '0'\n },\n 'canvas-datagrid-control-input': {\n position: 'fixed',\n top: '-5px',\n left: '-5px',\n border: 'none',\n opacity: '0',\n cursor: 'pointer',\n width: '1px',\n height: '1px',\n lineHeight: 'normal',\n fontWeight: 'normal',\n fontFamily: self.style.contextMenuFontFamily,\n fontSize: self.style.contextMenuFontSize\n },\n 'canvas-datagrid-edit-input': {\n boxSizing: 'content-box',\n outline: 'none',\n margin: '0',\n padding: '0 0 0 ' + self.style.editCellPaddingLeft + 'px',\n lineHeight: 'normal',\n fontWeight: 'normal',\n fontFamily: self.style.editCellFontFamily,\n fontSize: self.style.editCellFontSize,\n boxShadow: self.style.editCellBoxShadow,\n border: self.style.editCellBorder,\n color: self.style.editCellColor,\n background: self.style.editCellBackgroundColor,\n appearance: 'none',\n webkitAppearance: 'none',\n mozAppearance: 'none',\n borderRadius: '0'\n },\n 'canvas-datagrid-context-menu-item': {\n lineHeight: 'normal',\n fontWeight: 'normal',\n fontFamily: self.style.contextMenuFontFamily,\n fontSize: self.style.contextMenuFontSize,\n color: 'inherit',\n background: 'inherit',\n margin: self.style.contextMenuItemMargin,\n borderRadius: self.style.contextMenuItemBorderRadius,\n verticalAlign: 'middle'\n },\n 'canvas-datagrid-context-menu-item:hover': {\n background: self.style.contextMenuHoverBackground,\n color: self.style.contextMenuHoverColor\n },\n 'canvas-datagrid-context-menu-label': {\n margin: self.style.contextMenuLabelMargin,\n display: self.style.contextMenuLabelDisplay,\n minWidth: self.style.contextMenuLabelMinWidth,\n maxWidth: self.style.contextMenuLabelMaxWidth\n },\n 'canvas-datagrid-context-menu': {\n lineHeight: 'normal',\n fontWeight: 'normal',\n fontFamily: self.style.contextMenuFontFamily,\n fontSize: self.style.contextMenuFontSize,\n background: self.style.contextMenuBackground,\n color: self.style.contextMenuColor,\n border: self.style.contextMenuBorder,\n padding: self.style.contextMenuPadding,\n borderRadius: self.style.contextMenuBorderRadius,\n opacity: self.style.contextMenuOpacity,\n overflow: 'hidden'\n },\n 'canvas-datagrid-invalid-search-regExp': {\n background: self.style.contextMenuFilterInvalidExpresion\n }\n };\n if (css[className]) {\n Object.keys(css[className]).map(function (prop) {\n el.style[prop] = css[className][prop];\n });\n }\n return;\n };\n self.appendTo = function (n) {\n self.parentNode = n;\n self.height = self.parentNode.offsetHeight;\n self.width = self.parentNode.offsetWidth;\n if (self.parentNode && /canvas-datagrid-(cell|tree)/.test(self.parentNode.nodeType)) {\n self.isChildGrid = true;\n self.parentGrid = self.parentNode.parentGrid;\n self.ctx = self.parentGrid.context;\n self.canvas = self.parentGrid.canvas;\n self.controlInput = self.parentGrid.controlInput;\n self.eventParent = self.canvas;\n self.intf.offsetParent = self.parentNode;\n } else {\n self.controlInput = document.createElement('input');\n self.controlInput.onblur = self.intf.blur;\n self.createInlineStyle(self.controlInput, 'canvas-datagrid-control-input');\n self.isChildGrid = false;\n self.parentDOMNode = self.parentNode;\n self.parentNode = self.parentDOMNode;\n self.parentIsCanvas = /canvas/i.test(self.parentDOMNode.tagName);\n if (self.parentIsCanvas) {\n self.canvas = self.parentDOMNode;\n } else {\n self.canvas = document.createElement('canvas');\n self.parentDOMNode.appendChild(self.canvas);\n }\n self.ctx = self.canvas.getContext('2d');\n self.ctx.textBaseline = 'alphabetic';\n document.body.appendChild(self.controlInput);\n self.eventParent = self.canvas;\n }\n self.controlInput.addEventListener('blur', function (e) {\n if (e.target !== self.canvas) {\n self.hasFocus = false;\n }\n });\n window.addEventListener('resize', self.resize);\n if (MutationObserver) {\n self.observer = new MutationObserver(function (mutations) {\n mutations.forEach(function (mutation) {\n self.resize(true);\n });\n });\n [self.canvas.parentNode].forEach(function (el) {\n self.observer.observe(el, { attributes: true });\n });\n }\n self.eventParent.addEventListener('scroll', self.resize, false);\n self.eventParent.addEventListener('touchstart', self.touchstart, false);\n self.eventParent.addEventListener('mouseup', self.mouseup, false);\n self.eventParent.addEventListener('mousedown', self.mousedown, false);\n self.eventParent.addEventListener('dblclick', self.dblclick, false);\n self.eventParent.addEventListener('click', self.click, false);\n self.eventParent.addEventListener('mousemove', self.mousemove);\n self.eventParent.addEventListener('wheel', self.scrollWheel, false);\n self.canvas.addEventListener('contextmenu', self.contextmenuEvent, false);\n (self.isChildGrid ? self.parentGrid : document).addEventListener('copy', self.copy);\n self.controlInput.addEventListener('keypress', self.keypress, false);\n self.controlInput.addEventListener('keyup', self.keyup, false);\n self.controlInput.addEventListener('keydown', self.keydown, false);\n };\n self.setDom = function () {\n self.appendTo(self.args.parentNode);\n };\n };\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/dom.js\n// module id = 6\n// module chunks = 0","/*jslint browser: true, unparam: true, todo: true*/\n/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/\ndefine([], function () {\n 'use strict';\n return function (self) {\n // all methods here are exposed by intf\n // to users\n /**\n * Converts a integer into a letter A - ZZZZZ...\n * @memberof canvasDataGrid\n * @name integerToAlpha\n * @method\n * @param {column} n The number to convert.\n */\n self.integerToAlpha = function (n) {\n var ordA = 'a'.charCodeAt(0),\n ordZ = 'z'.charCodeAt(0),\n len = ordZ - ordA + 1,\n s = '';\n while (n >= 0) {\n s = String.fromCharCode(n % len + ordA) + s;\n n = Math.floor(n / len) - 1;\n }\n return s;\n };\n /**\n * Inserts a new column before the specified index into the schema.\n * @see canvasDataGrid#schema\n * @tutorial schema\n * @memberof canvasDataGrid\n * @name insertColumn\n * @method\n * @param {column} c The column to insert into the schema.\n * @param {number} index The index of the column to insert before.\n */\n self.insertColumn = function (c, index) {\n var s = self.getSchema();\n if (s.length < index) {\n throw new Error('Index is beyond the length of the schema.');\n }\n self.validateColumn(c, s);\n s.splice(index, 0, c);\n self.data.forEach(function (row) {\n self.applyDefaultValue(row, c);\n });\n self.intf.schema = s;\n };\n /**\n * Deletes a column from the schema at the specified index.\n * @memberof canvasDataGrid\n * @name deleteColumn\n * @tutorial schema\n * @method\n * @param {number} index The index of the column to delete.\n */\n self.deleteColumn = function (index) {\n var s = self.getSchema();\n // remove data matching this column name from data\n self.data.forEach(function (row) {\n delete row[s[index].name];\n });\n s.splice(index, 1);\n self.intf.schema = s;\n };\n /**\n * Adds a new column into the schema.\n * @see canvasDataGrid#schema\n * @tutorial schema\n * @memberof canvasDataGrid\n * @name addColumn\n * @method\n * @param {column} c The column to add to the schema.\n */\n self.addColumn = function (c) {\n var s = self.getSchema();\n self.validateColumn(c, s);\n s.push(c);\n self.data.forEach(function (row) {\n self.applyDefaultValue(row, c);\n });\n self.intf.schema = s;\n };\n /**\n * Deletes a row from the dataset at the specified index.\n * @memberof canvasDataGrid\n * @name deleteRow\n * @method\n * @param {number} index The index of the row to delete.\n */\n self.deleteRow = function (index) {\n self.originalData.splice(index, 1);\n self.setFilter();\n self.resize(true);\n };\n /**\n * Inserts a new row into the dataset before the specified index.\n * @memberof canvasDataGrid\n * @name insertRow\n * @method\n * @param {object} d data.\n * @param {number} index The index of the row to insert before.\n */\n self.insertRow = function (d, index) {\n if (self.originalData.length < index) {\n throw new Error('Index is beyond the length of the dataset.');\n }\n self.originalData.splice(index, 0, d);\n self.getSchema().forEach(function (c) {\n if (d[c.name] === undefined) {\n self.applyDefaultValue(self.originalData[index], c);\n }\n });\n self.setFilter();\n self.resize(true);\n };\n /**\n * Adds a new row into the dataset.\n * @memberof canvasDataGrid\n * @name addRow\n * @method\n * @param {object} d data.\n */\n self.addRow = function (d) {\n self.originalData.push(d);\n self.getSchema().forEach(function (c) {\n if (d[c.name] === undefined) {\n self.applyDefaultValue(self.originalData[self.originalData.length - 1], c);\n }\n });\n self.setFilter();\n self.resize(true);\n };\n /**\n * Sets the height of a given row by index number.\n * @memberof canvasDataGrid\n * @name setRowHeight\n * @method\n * @param {number} rowIndex The index of the row to set.\n * @param {number} height Height to set the row to.\n */\n self.setRowHeight = function (rowIndex, height) {\n self.sizes.rows[self.data[rowIndex][self.uniqueId]] = height;\n self.draw(true);\n };\n /**\n * Sets the width of a given column by index number.\n * @memberof canvasDataGrid\n * @name setColumnWidth\n * @method\n * @param {number} colIndex The index of the column to set.\n * @param {number} width Width to set the column to.\n */\n self.setColumnWidth = function (colIndex, width) {\n var s = self.getSchema();\n self.sizes.columns[s[colIndex][self.uniqueId]] = width;\n self.draw(true);\n };\n /**\n * Removes any changes to the width of the columns due to user or api interaction, setting them back to the schema or style default.\n * @memberof canvasDataGrid\n * @name resetColumnWidths\n * @tutorial schema\n * @method\n */\n self.resetColumnWidths = function () {\n self.sizes.columns = {};\n self.draw(true);\n };\n /**\n * Removes any changes to the height of the rows due to user or api interaction, setting them back to the schema or style default.\n * @memberof canvasDataGrid\n * @name resetRowHeights\n * @tutorial schema\n * @method\n */\n self.resetRowHeights = function () {\n self.sizes.rows = {};\n self.draw(true);\n };\n /**\n * Sets the value of the filter.\n * @memberof canvasDataGrid\n * @name setFilter\n * @method\n * @param {string} column Name of the column to filter.\n * @param {string} value The value to filter for.\n */\n self.setFilter = function (column, value) {\n function applyFilter() {\n self.refreshFromOrigialData();\n Object.keys(self.columnFilters).forEach(function (filter) {\n var header = self.getHeaderByName(column);\n if (!header) {\n return;\n }\n self.currentFilter = header.filter || self.filter(column.type || 'string');\n self.data = self.data.filter(function (row) {\n return self.currentFilter(row[filter], self.columnFilters[filter]);\n });\n });\n self.resize();\n self.draw(true);\n }\n if (column === undefined && value === undefined) {\n self.columnFilters = {};\n return applyFilter();\n }\n if (column && (value === '' || value === undefined)) {\n delete self.columnFilters[column];\n } else {\n self.columnFilters[column] = value;\n }\n applyFilter();\n };\n /**\n * Returns the number of pixels to scroll down to line up with row rowIndex.\n * @memberof canvasDataGrid\n * @name findRowScrollTop\n * @method\n * @param {number} rowIndex The row index of the row to scroll find.\n */\n self.findRowScrollTop = function (rowIndex) {\n var top = 0, x = 0, l = self.data.length,\n cellBorder = self.style.cellBorderWidth * 2;\n if (!self.attributes.showNewRow) {\n l -= 1;\n }\n if (rowIndex > l) {\n throw new Error('Impossible row index');\n }\n while (x < rowIndex) {\n top += (self.sizes.rows[self.data[x][self.uniqueId]] || self.style.cellHeight) + cellBorder;\n x += 1;\n }\n //TODO: This is not super accurate, causes pageUp/Dn to not move around right\n return top - (self.sizes.rows[self.data[rowIndex][self.uniqueId]] || self.style.cellHeight);\n };\n /**\n * Returns the number of pixels to scroll to the left to line up with column columnIndex.\n * @memberof canvasDataGrid\n * @name findColumnScrollLeft\n * @method\n * @param {number} columnIndex The column index of the column to find.\n */\n self.findColumnScrollLeft = function (columnIndex) {\n var left = 0, y = 0, s = self.getSchema(), l = s.length - 1;\n if (columnIndex > l) {\n throw new Error('Impossible column index');\n }\n while (y < columnIndex) {\n left += self.sizes.columns[s[y][self.uniqueId]] || s[y].width;\n y += 1;\n }\n return left;\n };\n /**\n * Scrolls the cell at cell x, row y.\n * @memberof canvasDataGrid\n * @name gotoCell\n * @method\n * @param {number} x The column index of the cell to scroll to.\n * @param {number} y The row index of the cell to scroll to.\n */\n self.gotoCell = function (x, y) {\n if (x !== undefined) {\n self.scrollBox.scrollLeft = self.findColumnScrollLeft(x);\n }\n if (y !== undefined) {\n self.scrollBox.scrollTop = self.findRowScrollTop(y);\n }\n };\n /**\n * Scrolls the row y.\n * @memberof canvasDataGrid\n * @name gotoRow\n * @method\n * @param {number} y The row index of the cell to scroll to.\n */\n self.gotoRow = function (y) {\n self.gotoCell(0, y);\n };\n /**\n * Scrolls the cell at cell x, row y into view if it is not already.\n * @memberof canvasDataGrid\n * @name scrollIntoView\n * @method\n * @param {number} x The column index of the cell to scroll into view.\n * @param {number} y The row index of the cell to scroll into view.\n */\n self.scrollIntoView = function (x, y) {\n if (self.visibleCells.filter(function (cell) {\n return (cell.rowIndex === y || y === undefined)\n && (cell.columnIndex === x || x === undefined)\n && cell.x > 0\n && cell.y > 0\n && cell.x + cell.width < self.width\n && cell.y + cell.height < self.height;\n }).length === 0) {\n self.gotoCell(x, y);\n }\n };\n /**\n * Sets the active cell. Requires redrawing.\n * @memberof canvasDataGrid\n * @name setActiveCell\n * @method\n * @param {number} x The column index of the cell to set active.\n * @param {number} y The row index of the cell to set active.\n */\n self.setActiveCell = function (x, y) {\n self.activeCell = {\n rowIndex: y,\n columnIndex: x\n };\n };\n /**\n * Selects every visible cell.\n * @memberof canvasDataGrid\n * @name selectAll\n * @method\n */\n self.selectAll = function () {\n self.selectArea({\n top: 0,\n left: 0,\n right: self.getVisibleSchema().length - 1,\n bottom: self.data.length - 1\n });\n };\n /**\n * Returns true if the selected columnIndex is selected on every row.\n * @memberof canvasDataGrid\n * @name isColumnSelected\n * @method\n * @param {number} columnIndex The column index to check.\n */\n self.isColumnSelected = function (columnIndex) {\n var colIsSelected = true;\n self.data.forEach(function (row, rowIndex) {\n if (!self.selections[rowIndex] || self.selections[rowIndex].indexOf(self.orders.columns[columnIndex]) === -1) {\n colIsSelected = false;\n }\n });\n return colIsSelected;\n };\n /**\n * Selects a column.\n * @memberof canvasDataGrid\n * @name selectColumn\n * @method\n * @param {number} columnIndex The column index to select.\n * @param {boolean} toggleSelectMode When true, behaves as if you were holding control/command when you clicked the column.\n * @param {boolean} shift When true, behaves as if you were holding shift when you clicked the column.\n * @param {boolean} supressSelectionchangedEvent When true, prevents the selectionchanged event from firing.\n */\n self.selectColumn = function (columnIndex, ctrl, shift, supressEvent) {\n var s, e, x;\n function addCol(i) {\n self.data.forEach(function (row, rowIndex) {\n self.selections[rowIndex] = self.selections[rowIndex] || [];\n if (self.selections[rowIndex].indexOf(i) === -1) {\n self.selections[rowIndex].push(i);\n }\n });\n }\n function removeCol(i) {\n self.data.forEach(function (row, rowIndex) {\n self.selections[rowIndex] = self.selections[rowIndex] || [];\n if (self.selections[rowIndex].indexOf(i) !== -1) {\n self.selections[rowIndex].splice(self.selections[rowIndex].indexOf(i), 1);\n }\n });\n }\n if (shift) {\n if (!self.activeCell) { return; }\n s = Math.min(self.activeCell.columnIndex, columnIndex);\n e = Math.max(self.activeCell.columnIndex, columnIndex);\n for (x = s; e > x; x += 1) {\n addCol(x);\n }\n }\n if (!ctrl && !shift) {\n self.selections = [];\n self.activeCell.columnIndex = columnIndex;\n self.activeCell.rowIndex = self.scrollIndexTop;\n }\n if (ctrl && self.isColumnSelected(columnIndex)) {\n removeCol(columnIndex);\n } else {\n addCol(columnIndex);\n }\n if (supressEvent) { return; }\n self.dispatchEvent('selectionchanged', {\n selectedData: self.getSelectedData(),\n selections: self.selections,\n selectionBounds: self.selectionBounds\n });\n };\n /**\n * Selects a row.\n * @memberof canvasDataGrid\n * @name selectRow\n * @method\n * @param {number} rowIndex The row index to select.\n * @param {boolean} ctrl When true, behaves as if you were holding control/command when you clicked the row.\n * @param {boolean} shift When true, behaves as if you were holding shift when you clicked the row.\n * @param {boolean} supressSelectionchangedEvent When true, prevents the selectionchanged event from firing.\n */\n self.selectRow = function (rowIndex, ctrl, shift, supressEvent) {\n var x, st, en, s = self.getSchema();\n function addRow(ri) {\n self.selections[ri] = [];\n self.selections[ri].push(-1);\n s.forEach(function (col) {\n self.selections[ri].push(col.index);\n });\n }\n if (self.dragAddToSelection === false || self.dragObject === undefined) {\n if (self.selections[rowIndex] && self.selections[rowIndex].length - 1 === s.length) {\n if (ctrl) {\n self.selections[rowIndex] = [];\n return;\n }\n }\n }\n if (self.dragAddToSelection === true || self.dragObject === undefined) {\n if (shift && self.dragObject === undefined) {\n if (!self.activeCell) { return; }\n st = Math.min(self.activeCell.rowIndex, rowIndex);\n en = Math.max(self.activeCell.rowIndex, rowIndex);\n for (x = st; en >= x; x += 1) {\n addRow(x);\n }\n } else {\n addRow(rowIndex);\n }\n }\n if (supressEvent) { return; }\n self.dispatchEvent('selectionchanged', {\n selectedData: self.getSelectedData(),\n selections: self.selections,\n selectionBounds: self.selectionBounds\n });\n };\n /**\n * Collapse a tree grid by row index.\n * @memberof canvasDataGrid\n * @name collapseTree\n * @method\n * @param {number} index The index of the row to collapse.\n */\n self.collapseTree = function (rowIndex) {\n var rowId = self.data[rowIndex][self.uniqueId];\n self.dispatchEvent('collapsetree', {\n childGrid: self.childGrids[rowId],\n data: self.data[rowIndex],\n rowIndex: rowIndex\n });\n self.openChildren[rowId].blur();\n self.openChildren[rowId].dispose();\n delete self.openChildren[rowId];\n delete self.sizes.trees[rowId];\n delete self.childGrids[rowId];\n self.dispatchEvent('resizerow', {\n cellHeight: self.style.cellHeight\n });\n self.resize(true);\n self.draw(true);\n };\n /**\n * Expands a tree grid by row index.\n * @memberof canvasDataGrid\n * @name expandTree\n * @method\n * @param {number} index The index of the row to expand.\n */\n self.expandTree = function (rowIndex) {\n var rowHeaderCellHeight = self.getRowHeaderCellHeight(),\n columnHeaderCellWidth = self.sizes.columns.cornerCell || self.style.rowHeaderCellWidth,\n rowId = self.data[rowIndex][self.uniqueId],\n h = self.sizes.trees[rowId] || self.style.treeGridHeight,\n treeGrid;\n if (!self.childGrids[rowId]) {\n treeGrid = self.createGrid({\n debug: self.attributes.debug,\n name: self.attributes.saveAppearance\n ? self.attributes.name + 'tree' + rowId : undefined,\n parentNode: {\n parentGrid: self.intf,\n nodeType: 'canvas-datagrid-tree',\n offsetHeight: h,\n offsetWidth: self.width - columnHeaderCellWidth,\n header: { width: self.width - columnHeaderCellWidth },\n offsetLeft: columnHeaderCellWidth,\n offsetTop: rowHeaderCellHeight,\n offsetParent: self.intf.parentNode,\n parentNode: self.intf.parentNode,\n style: 'tree',\n data: self.data[rowIndex]\n }\n });\n self.childGrids[rowId] = treeGrid;\n }\n treeGrid = self.childGrids[rowId];\n treeGrid.visible = true;\n self.dispatchEvent('expandtree', {\n treeGrid: treeGrid,\n data: self.data[rowIndex],\n rowIndex: rowIndex\n });\n self.openChildren[rowId] = treeGrid;\n self.sizes.trees[rowId] = h;\n self.dispatchEvent('resizerow', {height: self.style.cellHeight});\n self.resize(true);\n };\n /**\n * Toggles tree grid open and close by row index.\n * @memberof canvasDataGrid\n * @name toggleTree\n * @method\n * @param {number} index The index of the row to toggle.\n */\n self.toggleTree = function (rowIndex) {\n var i = self.openChildren[self.data[rowIndex][self.uniqueId]];\n if (i) {\n return self.collapseTree(rowIndex);\n }\n self.expandTree(rowIndex);\n };\n /**\n * Returns a header from the schema by name.\n * @memberof canvasDataGrid\n * @name getHeaderByName\n * @tutorial schema\n * @method\n * @returns {header} header with the selected name, or undefined.\n * @param {string} name The name of the column to resize.\n */\n self.getHeaderByName = function (name) {\n var x, i = self.getSchema();\n for (x = 0; x < i.length; x += 1) {\n if (i[x].name === name) {\n return i[x];\n }\n }\n };\n /**\n * Resizes a column to fit the longest value in the column. Call without a value to resize all columns.\n * Warning, can be slow on very large record sets (1m records ~3-5 seconds on an i7).\n * @memberof canvasDataGrid\n * @name fitColumnToValues\n * @method\n * @param {string} name The name of the column to resize.\n */\n self.fitColumnToValues = function (name, internal) {\n self.sizes.columns[name === 'cornerCell' ? name : self.getHeaderByName(name)[self.uniqueId]]\n = self.findColumnMaxTextLength(name);\n if (!internal) {\n self.resize();\n self.draw(true);\n }\n };\n /**\n * Checks if a cell is currently visible.\n * @memberof canvasDataGrid\n * @name isCellVisible\n * @method\n * @returns {boolean} when true, the cell is visible, when false the cell is not currently drawn.\n * @param {cell} cell The cell to check for. Alternatively you can pass an object { x: , y: }.\n */\n self.isCellVisible = function (cell) {\n var x, l = self.visibleCells.length;\n for (x = 0; x < l; x += 1) {\n if (cell.x === self.visibleCells[x].x && cell.y === self.visibleCells[x].y) {\n return true;\n }\n }\n return false;\n };\n /**\n * Sets the order of the data.\n * @memberof canvasDataGrid\n * @name order\n * @method\n * @returns {cell} cell at the selected location.\n * @param {number} columnName Number of pixels from the left.\n * @param {string} direction `asc` for ascending or `desc` for descending.\n * @param {function} [sortFunction] When defined, override the default sorting method defined in the column's schema and use this one.\n * @param {bool} [dontSetStorageData] Don't store this setting for future use.\n */\n self.order = function (columnName, direction, sortFunction, dontSetStorageData) {\n var f,\n c = self.getSchema().filter(function (col) {\n return col.name === columnName;\n });\n self.orderBy = columnName;\n if (c.length === 0) {\n throw new Error('Cannot sort. No such column name');\n }\n f = sortFunction || self.sorters[c[0].type];\n if (!f && c[0].type !== undefined) {\n console.warn('Cannot sort type \"%s\" falling back to string sort.', c[0].type);\n }\n self.data = self.data.sort(typeof f === 'function' ? f(columnName, direction) : self.sorters.string);\n self.dispatchEvent('ordercolumn', {name: columnName, direction: direction});\n self.draw(true);\n if (dontSetStorageData) { return; }\n self.setStorageData();\n };\n self.isInGrid = function (e) {\n if (e.x < 0\n || e.x > self.width\n || e.y < 0\n || e.y > self.height) {\n return false;\n }\n return true;\n };\n /**\n * Gets the cell at columnIndex and rowIndex.\n * @memberof canvasDataGrid\n * @name getVisibleCellByIndex\n * @method\n * @returns {cell} cell at the selected location.\n * @param {number} x Column index.\n * @param {number} y Row index.\n */\n self.getVisibleCellByIndex = function (x, y) {\n return self.visibleCells.filter(function (c) {\n return c.columnIndex === x && c.rowIndex === y;\n })[0];\n };\n /**\n * Gets the cell at grid pixel coordinate x and y.\n * @memberof canvasDataGrid\n * @name getCellAt\n * @method\n * @returns {cell} cell at the selected location.\n * @param {number} x Number of pixels from the left.\n * @param {number} y Number of pixels from the top.\n */\n self.getCellAt = function (x, y, useTouchScrollZones) {\n var tsz = useTouchScrollZones ? self.attributes.touchScrollZone : 0, i, l = self.visibleCells.length, cell;\n if (!self.visibleCells || !self.visibleCells.length) { return; }\n self.hasFocus = true;\n if (!(y < self.height\n && y > 0\n && x < self.width\n && x > 0)) {\n self.hasFocus = false;\n return {\n dragContext: 'inherit',\n context: 'inherit'\n };\n }\n for (i = 0; i < l; i += 1) {\n cell = self.visibleCells[i];\n if (useTouchScrollZones && /(vertical|horizontal)-scroll-/.test(cell.style)) {\n cell.x -= tsz;\n cell.y -= tsz;\n cell.height += tsz;\n cell.width += tsz;\n }\n if (cell.x - self.style.cellBorderWidth < x\n && cell.x + cell.width + self.style.cellBorderWidth > x\n && cell.y - self.style.cellBorderWidth < y\n && cell.y + cell.height + self.style.cellBorderWidth > y) {\n if (/vertical-scroll-(bar|box)/.test(cell.style)) {\n cell.dragContext = 'vertical-scroll-box';\n cell.context = 'vertical-scroll-box';\n cell.isScrollBar = true;\n cell.isVerticalScrollBar = true;\n if (y > self.scrollBox.box.v.y + self.scrollBox.scrollBoxHeight) {\n cell.dragContext = 'vertical-scroll-bottom';\n cell.context = 'vertical-scroll-bottom';\n } else if (y < self.scrollBox.box.v.y) {\n cell.dragContext = 'vertical-scroll-top';\n cell.context = 'vertical-scroll-top';\n }\n self.canvas.style.cursor = 'default';\n return cell;\n }\n if (/horizontal-scroll-(bar|box)/.test(cell.style)) {\n cell.dragContext = 'horizontal-scroll-box';\n cell.context = 'horizontal-scroll-box';\n cell.isScrollBar = true;\n cell.isHorizontalScrollBar = true;\n if (x > self.scrollBox.box.h.x + self.scrollBox.scrollBoxWidth) {\n cell.dragContext = 'horizontal-scroll-right';\n cell.context = 'horizontal-scroll-right';\n } else if (x < self.scrollBox.box.h.x) {\n cell.dragContext = 'horizontal-scroll-left';\n cell.context = 'horizontal-scroll-left';\n }\n self.canvas.style.cursor = 'default';\n return cell;\n }\n if (cell.x + cell.width - (self.attributes.borderResizeZone * 0.4) < x\n && cell.x + cell.width + (self.attributes.borderResizeZone * 0.6) > x\n && self.attributes.allowColumnResize\n && ((self.attributes.allowColumnResizeFromCell && cell.style === 'cell')\n || cell.style !== 'cell')\n && ((self.attributes.allowRowHeaderResize\n && ['rowHeaderCell', 'cornerCell'].indexOf(cell.style) !== -1)\n || ['rowHeaderCell', 'cornerCell'].indexOf(cell.style) === -1)) {\n cell.context = 'ew-resize';\n cell.dragContext = 'ew-resize';\n return cell;\n }\n if (cell.y + cell.height - (self.attributes.borderResizeZone * 0.4) < y\n && cell.y + cell.height + (self.attributes.borderResizeZone * 0.6) > y\n && self.attributes.allowRowResize\n && ((self.attributes.allowRowResizeFromCell && cell.style === 'cell')\n || cell.style !== 'cell')\n && cell.style !== 'columnHeaderCell') {\n cell.context = 'ns-resize';\n cell.dragContext = 'ns-resize';\n return cell;\n }\n if (cell.style === 'columnHeaderCell') {\n cell.context = 'cell';\n cell.dragContext = 'column-reorder';\n return cell;\n }\n if (cell.style === 'rowHeaderCell') {\n cell.context = 'cell';\n cell.dragContext = 'row-reorder';\n return cell;\n }\n if (cell.isGrid) {\n self.hasFocus = false;\n cell.dragContext = 'cell-grid';\n cell.context = 'cell-grid';\n return cell;\n }\n if (cell.style === 'tree-grid') {\n self.hasFocus = false;\n cell.dragContext = 'tree';\n cell.context = 'tree';\n return cell;\n }\n cell.dragContext = 'cell';\n cell.context = 'cell';\n return cell;\n }\n }\n self.hasFocus = true;\n self.canvas.style.cursor = 'default';\n return {\n dragContext: 'background',\n context: 'background',\n style: 'background',\n isBackground: true\n };\n };\n /**\n * Gets the bounds of current selection. \n * @returns {rect} selection.\n * @memberof canvasDataGrid\n * @name getSelectionBounds\n * @method\n */\n self.getSelectionBounds = function () {\n var low = {x: Infinity, y: Infinity},\n high = {x: -Infinity, y: -Infinity};\n self.data.forEach(function (row, rowIndex) {\n var maxCol, minCol;\n if (self.selections[rowIndex] && self.selections[rowIndex].length) {\n low.y = rowIndex < low.y ? rowIndex : low.y;\n high.y = rowIndex > high.y ? rowIndex : high.y;\n maxCol = Math.max.apply(null, self.selections[rowIndex]);\n minCol = Math.min.apply(null, self.selections[rowIndex]);\n low.x = minCol < low.x ? minCol : low.x;\n high.x = maxCol > high.x ? maxCol : high.x;\n }\n });\n return {\n top: low.y,\n left: low.x,\n bottom: high.y,\n right: high.x\n };\n };\n /**\n * Returns an auto generated schema based on data structure.\n * @memberof canvasDataGrid\n * @name getSchemaFromData\n * @method\n * @tutorial schema\n * @returns {schema} schema A schema based on the first item in the data array.\n */\n self.getSchemaFromData = function () {\n return Object.keys(self.data[0] || {' ': ''}).map(function mapEachSchemaColumn(key, index) {\n var type = self.getBestGuessDataType(key),\n i = {\n name: key,\n title: isNaN(parseInt(key, 10)) ? key : self.integerToAlpha(key).toUpperCase(),\n width: self.style.columnWidth,\n index: index,\n type: type,\n filter: self.filter(type)\n };\n if (key === self.uniqueId) {\n i.hidden = true;\n }\n i[self.uniqueId] = self.getSchemaNameHash(key);\n return i;\n });\n };\n /**\n * Clears the change log grid.changes that keeps track of changes to the data set.\n * This does not undo changes or alter data it is simply a convince array to keep\n * track of changes made to the data since last this method was called.\n * @memberof canvasDataGrid\n * @name clearChangeLog\n * @method\n */\n self.clearChangeLog = function () {\n self.changes = [];\n };\n /**\n * Selects an area of the grid.\n * @memberof canvasDataGrid\n * @name selectArea\n * @method\n * @param {rect} bounds A rect object representing the selected values.\n */\n self.selectArea = function (bounds, ctrl) {\n self.selectionBounds = bounds || self.selectionBounds;\n var x, y, s = self.getSchema();\n if (!ctrl) {\n self.selections = [];\n }\n if (self.selectionBounds.top < -1\n || self.selectionBounds.bottom > self.data.length\n || self.selectionBounds.left < -1\n || self.selectionBounds.right > s.length) {\n throw new Error('Impossible selection area');\n }\n for (x = self.selectionBounds.top; x <= self.selectionBounds.bottom; x += 1) {\n self.selections[x] = [];\n for (y = self.selectionBounds.left; y <= self.selectionBounds.right; y += 1) {\n if (self.selections[x].indexOf(y) === -1) {\n self.selections[x].push(y);\n }\n }\n }\n self.dispatchEvent('selectionchanged', {\n selectedData: self.getSelectedData(),\n selections: self.selections,\n selectionBounds: self.selectionBounds\n });\n };\n /**\n * Returns the maximum text width for a given column by column name.\n * @memberof canvasDataGrid\n * @name findColumnMaxTextLength\n * @method\n * @returns {number} The number of pixels wide the maximum width value in the selected column.\n * @param {string} name The name of the column to calculate the value's width of.\n */\n self.findColumnMaxTextLength = function (name) {\n var m = -Infinity;\n if (name === 'cornerCell') {\n self.ctx.font = self.style.rowHeaderCellFont;\n return self.ctx.measureText((self.data.length + (self.attributes.showNewRow ? 1 : 0)).toString()).width\n + self.style.autosizePadding + self.style.autosizeHeaderCellPadding\n + self.style.rowHeaderCellPaddingRight\n + self.style.rowHeaderCellPaddingLeft\n + (self.attributes.tree ? self.style.treeArrowWidth\n + self.style.treeArrowMarginLeft + self.style.treeArrowMarginRight : 0);\n }\n self.getSchema().forEach(function (col) {\n if (col.name !== name) { return; }\n self.ctx.font = self.style.columnHeaderCellFont;\n var t = self.ctx.measureText(col.title || col.name).width\n + self.style.headerCellPaddingRight\n + self.style.headerCellPaddingLeft;\n m = t > m ? t : m;\n });\n self.data.forEach(function (row) {\n self.ctx.font = self.style.cellFont;\n var t = self.ctx.measureText(row[name]).width\n + self.style.cellPaddingRight\n + self.style.cellPaddingLeft + self.style.cellAutoResizePadding;\n m = t > m ? t : m;\n });\n return m;\n };\n /**\n * Gets the total width of all header columns.\n * @memberof canvasDataGrid\n * @name getHeaderWidth\n * @method\n */\n self.getHeaderWidth = function () {\n return self.getVisibleSchema().reduce(function (total, header) {\n return total + header.width;\n }, 0);\n };\n self.formatters.string = function cellFormatterString(e) {\n return e.cell.value !== undefined ? e.cell.value : '';\n };\n self.formatters.rowHeaderCell = self.formatters.string;\n self.formatters.headerCell = self.formatters.string;\n self.formatters.number = self.formatters.string;\n self.formatters.int = self.formatters.string;\n self.formatters.html = self.formatters.string;\n self.sorters.string = function (columnName, direction) {\n var asc = direction === 'asc';\n return function (a, b) {\n if (a[columnName] === undefined || a[columnName] === null) {\n return 1;\n }\n if (b[columnName] === undefined || b[columnName] === null) {\n return 0;\n }\n if (asc) {\n if (!a[columnName].localeCompare) { return 1; }\n return a[columnName].localeCompare(b[columnName]);\n }\n if (!b[columnName].localeCompare) { return 1; }\n return b[columnName].localeCompare(a[columnName]);\n };\n };\n self.sorters.number = function (columnName, direction) {\n var asc = direction === 'asc';\n return function (a, b) {\n if (asc) {\n return a[columnName] - b[columnName];\n }\n return b[columnName] - a[columnName];\n };\n };\n self.sorters.date = function (columnName, direction) {\n var asc = direction === 'asc';\n return function (a, b) {\n if (asc) {\n return new Date(a[columnName]).getTime()\n - new Date(b[columnName]).getTime();\n }\n return new Date(b[columnName]).getTime()\n - new Date(a[columnName]).getTime();\n };\n };\n };\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/publicMethods.js\n// module id = 7\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/canvas-datagrid.js b/dist/canvas-datagrid.js index 8b7bea10..e0c7115c 100644 --- a/dist/canvas-datagrid.js +++ b/dist/canvas-datagrid.js @@ -1,2 +1,2 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.canvasDatagrid=t():e.canvasDatagrid=t()}(this,function(){return function(e){function t(r){if(o[r])return o[r].exports;var n=o[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var o={};return t.m=e,t.c=o,t.d=function(e,o,r){t.o(e,o)||Object.defineProperty(e,o,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var o=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(o,"a",o),o},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,o){var r,n;r=[o(1),o(2),o(3),o(4),o(5),o(6),o(7)],void 0!==(n=function(){"use strict";function t(e){e=e||{};var r={};return r.args=e,r.createGrid=t,o.forEach(function(e){e(r)}),r.init(),r.intf}var o=Array.prototype.slice.call(arguments);return!window||window.canvasDatagrid||window.require||(window.canvasDatagrid=t),e.exports=t,t}.apply(t,r))&&(e.exports=n)},function(e,t,o){var r,n;r=[],void 0!==(n=function(){"use strict";return function(e){function t(){var t=!0;Object.keys(e.htmlImageCache).forEach(function(o){e.htmlImageCache[o].complete||(t=!1)}),t&&e.draw()}function o(o){var r,n=o.innerHTML||o.formattedValue,l=o.x+e.canvasOffsetLeft,i=o.y+e.canvasOffsetTop;if(e.htmlImageCache[n]){if(r=e.htmlImageCache[n],r.height===o.height&&r.width===o.width){if(!r.complete)return;return e.ctx.drawImage(r,l,i)}e.htmlImageCache[n]=void 0}r=new Image(o.width,o.height),e.htmlImageCache[n]=r,r.onload=function(){e.ctx.drawImage(r,l,i),t()},r.src="data:image/svg+xml;base64,"+btoa('\n\n\n'+n+"\n\n\n")}function r(t,o){return t+=e.canvasOffsetLeft,o+=e.canvasOffsetTop,e.ctx.fillStyle=e.style.columnHeaderOrderByArrowColor,e.ctx.strokeStyle=e.style.columnHeaderOrderByArrowBorderColor,e.ctx.beginPath(),t+=e.style.columnHeaderOrderByArrowMarginLeft,o+=e.style.columnHeaderOrderByArrowMarginTop,"asc"===e.orderDirection?(e.ctx.moveTo(t,o),e.ctx.lineTo(t+e.style.columnHeaderOrderByArrowWidth,o),e.ctx.lineTo(t+.5*e.style.columnHeaderOrderByArrowWidth,o+e.style.columnHeaderOrderByArrowHeight),e.ctx.moveTo(t,o)):(e.ctx.lineTo(t,o+e.style.columnHeaderOrderByArrowHeight),e.ctx.lineTo(t+e.style.columnHeaderOrderByArrowWidth,o+e.style.columnHeaderOrderByArrowHeight),e.ctx.lineTo(t+.5*e.style.columnHeaderOrderByArrowWidth,o),e.ctx.lineTo(t,o+e.style.columnHeaderOrderByArrowHeight)),e.ctx.stroke(),e.ctx.fill(),e.style.columnHeaderOrderByArrowMarginLeft+e.style.columnHeaderOrderByArrowWidth+e.style.columnHeaderOrderByArrowMarginRight}function n(t,o,r){return o+=e.canvasOffsetLeft,r+=e.canvasOffsetTop,e.ctx.fillStyle=e.style.treeArrowColor,e.ctx.strokeStyle=e.style.treeArrowBorderColor,e.ctx.beginPath(),o+=e.style.treeArrowMarginLeft,r+=e.style.treeArrowMarginTop,e.openChildren[t.data[e.uniqueId]]?(e.ctx.moveTo(o,r),e.ctx.lineTo(o+e.style.treeArrowWidth,r),e.ctx.lineTo(o+.5*e.style.treeArrowWidth,r+e.style.treeArrowHeight),e.ctx.moveTo(o,r)):(e.ctx.lineTo(o,r),e.ctx.lineTo(o+e.style.treeArrowHeight,r+.5*e.style.treeArrowWidth),e.ctx.lineTo(o,r+e.style.treeArrowWidth),e.ctx.lineTo(o,r)),e.ctx.stroke(),e.ctx.fill(),e.style.treeArrowMarginLeft+e.style.treeArrowWidth+e.style.treeArrowMarginRight}function l(t,o,r,n,l){t+=e.canvasOffsetLeft,o+=e.canvasOffsetTop;var i=t+r,s=o+n;e.ctx.beginPath(),e.ctx.moveTo(t+l,o),e.ctx.lineTo(i-l,o),e.ctx.quadraticCurveTo(i,o,i,o+l),e.ctx.lineTo(i,o+n-l),e.ctx.quadraticCurveTo(i,s,i-l,s),e.ctx.lineTo(t+l,s),e.ctx.quadraticCurveTo(t,s,t,s-l),e.ctx.lineTo(t,o+l),e.ctx.quadraticCurveTo(t,o,t+l,o)}function i(t,o,r,n){t+=e.canvasOffsetLeft,o+=e.canvasOffsetTop,e.ctx.fillRect(t,o,r,n)}function s(t,o,r,n){t+=e.canvasOffsetLeft,o+=e.canvasOffsetTop,e.ctx.strokeRect(t,o,r,n)}function a(t,o,r){o+=e.canvasOffsetLeft,r+=e.canvasOffsetTop,e.ctx.fillText(t,o,r)}function c(t,o){e.ctx.beginPath(),{t:function(){e.ctx.moveTo(t.x+e.canvasOffsetLeft,t.y+e.canvasOffsetTop),e.ctx.lineTo(t.x+e.canvasOffsetLeft+t.width,t.y+e.canvasOffsetTop)},r:function(){e.ctx.moveTo(t.x+e.canvasOffsetLeft+t.width,t.y+e.canvasOffsetTop),e.ctx.lineTo(t.x+e.canvasOffsetLeft+t.width,t.y+e.canvasOffsetTop+t.height)},b:function(){e.ctx.moveTo(t.x+e.canvasOffsetLeft,t.y+e.canvasOffsetTop+t.height),e.ctx.lineTo(t.x+e.canvasOffsetLeft+t.width,t.y+e.canvasOffsetTop+t.height)},l:function(){e.ctx.moveTo(t.x+e.canvasOffsetLeft,t.y+e.canvasOffsetTop),e.ctx.lineTo(t.x+e.canvasOffsetLeft,t.y+e.canvasOffsetTop+t.height)}}[o](),e.ctx.stroke()}function d(t,o){var r,n=0;return e.ellipsisCache[t]&&e.ellipsisCache[t][o]?e.ellipsisCache[t][o]:(n=e.ctx.measureText(t).width,e.ellipsisCache[t]=e.ellipsisCache[t]||{},r={value:t,width:n},e.ellipsisCache[t][o]=r,r)}function u(t){var o=e.style[t.style+"PaddingLeft"],r=e.style[t.style+"PaddingTop"],n=e.style[t.style+"PaddingRight"],l=e.style[t.style+"PaddingBottom"],i=r+t.height-.5*t.height,s=o+t.treeArrowWidth+t.orderByArrowWidth;t.text=d(t.formattedValue,t.width-n-o),t.text.height=t.fontHeight,"right"===t.horizontalAlignment?s=t.width-t.text.width-n:"center"===t.horizontalAlignment&&(s=t.width/2-t.text.width/2),"top"===t.verticalAlignment?i=r+t.text.height:"bottom"===t.verticalAlignment&&(i=t.height-l-t.text.height),t.text.x=t.x+s,t.text.y=t.y+i,a(t.text.value,t.text.x,t.text.y)}var h=[],f=0,g=20;e.htmlImageCache={},e.draw=function(t){function d(t,a,c){return function(d,h,f){var g,x,p,y=d.style||"cell",v=/HeaderCell/.test(y),b=/cornerCell/.test(y),S="rowHeaderCell"===y,T="columnHeaderCell"===y,O=e.selections[c]&&-1!==e.selections[c].indexOf(f),z=e.hovers[t[e.uniqueId]]&&-1!==e.hovers[t[e.uniqueId]].indexOf(f),P=e.activeCell.rowIndex===c&&e.activeCell.columnIndex===f,W="object"==typeof t[d.name]&&null!==t[d.name]&&void 0!==t[d.name],F=!(e.orders.rows[e.activeCell.rowIndex]!==c&&e.orders.columns[e.activeCell.columnIndex]!==f||-1!==f&&-1!==c)&&(S?"activeRowHeaderCell":"activeColumnHeaderCell"),D=e.formatters[d.type||"string"],j=0,G=0,q=e.sizes.columns[S?"cornerCell":d[e.uniqueId]]||d.width,V={value:t[d.name],row:t,header:d};if("headerCellCap"===y&&(q=L-M),void 0===q&&(q=e.style.columnWidth),M+q+e.style.cellBorderWidth<0&&(M+=q+e.style.cellBorderWidth),P&&(y="activeCell"),-1!==e.visibleRows.indexOf(a)||v||e.visibleRows.push(a),p=e.dispatchEvent("formatcellvalue",V),!e.dispatchEvent("beforerendercell",V))return w=M,C=H,"cornerCell"===y?(w=0,C=0):S?w=0:v&&(C=0),x={type:W?"canvas-datagrid-cell":d.type,style:y,nodeType:"canvas-datagrid-cell",x:w,y:C,horizontalAlignment:e.style[y+"HorizontalAlignment"],verticalAlignment:e.style[y+"VerticalAlignment"],offsetTop:e.canvasOffsetTop+C,offsetLeft:e.canvasOffsetLeft+w,scrollTop:e.scrollBox.scrollTop,scrollLeft:e.scrollBox.scrollLeft,active:P||F,hovered:z,selected:O,width:q,height:N,offsetWidth:q,offsetHeight:N,parentNode:e.intf.parentNode,offsetParent:e.intf.parentNode,data:t,isCorner:b,isHeader:v,isColumnHeader:T,isHeaderCellCap:!!d.isHeaderCellCap,isRowHeader:S,rowOpen:B,header:d,columnIndex:f,rowIndex:c,sortColumnIndex:h,sortRowIndex:a,isGrid:W,gridId:(e.attributes.name||"")+t[e.uniqueId]+":"+d[e.uniqueId],parentGrid:e.intf,innerHTML:"",activeHeader:F,value:v&&!S?d.title||d.name:t[d.name]},V.cell=x,x.userHeight=x.isHeader?e.sizes.rows[-1]:I,x.userWidth=x.isHeader?e.sizes.columns.cornerCell:e.sizes.columns[d[e.uniqueId]],x[e.uniqueId]=t[e.uniqueId],e.visibleCells.unshift(x),e.ctx.fillStyle=e.style[y+"BackgroundColor"],e.ctx.strokeStyle=e.style[y+"BorderColor"],e.ctx.lineWidth=e.style[y+"BorderWidth"],z&&(e.ctx.fillStyle=e.style[y+"HoverBackgroundColor"],e.ctx.strokeStyle=e.style[y+"HoverBorderColor"]),O&&(e.ctx.fillStyle=e.style[y+"SelectedBackgroundColor"],e.ctx.strokeStyle=e.style[y+"SelectedBorderColor"]),F&&(e.ctx.fillStyle=e.style[F+"BackgroundColor"]),e.dispatchEvent("rendercell",V),x.isGrid&&(x.height!==I&&(x.height=I||e.style.cellHeightWithChildGrid,m=!0),x.width=e.sizes.columns[d[e.uniqueId]]||e.style.cellWidthWithChildGrid),B&&!x.isRowHeader&&(x.height=e.sizes.rows[A[e.uniqueId]]||e.style.cellHeight),x.isGrid||(i(w,C,x.width,x.height),s(w,C,x.width,x.height)),e.ctx.save(),l(x.x,x.y,x.width,x.height,0),e.ctx.clip(),e.dispatchEvent("afterrendercell",V),x.height===N||B&&!x.isRowHeader||(e.sizes.rows[v?-1:t[e.uniqueId]]=x.height,m=!0),x.width!==q&&(e.sizes.columns[d[e.uniqueId]]=x.width,m=!0),S&&e.attributes.tree&&(e.dispatchEvent("rendertreearrow",V)||(G=n(x,e.style[y+"PaddingLeft"],C,0))),(e.attributes.showRowNumbers&&S||!S)&&(x.isGrid?(e.childGrids[x.gridId]||(g=e.args.childGridAttributes||e.args,g.name=e.attributes.saveAppearance?x.gridId:void 0,g.parentNode=x,g.data=t[d.name],e.childGrids[x.gridId]=e.createGrid(g),e.sizes.rows[A[e.uniqueId]]=e.sizes.rows[A[e.uniqueId]]||e.style.cellGridHeight,m=!0),x.grid=e.childGrids[x.gridId],x.grid.parentNode=x,x.grid.visible=!0,x.grid.draw(),e.dispatchEvent("rendercellgrid",V)):(e.childGrids[x.gridId]&&(e.childGrids[x.gridId].parentNode.offsetHeight=0),v&&e.orderBy===d.name&&(e.dispatchEvent("renderorderbyarrow",V)||(j=r(w+e.style[y+"PaddingLeft"],0))),e.ctx.fillStyle=e.style[y+"Color"],z&&(e.ctx.fillStyle=e.style[y+"HoverColor"]),O&&(e.ctx.fillStyle=e.style[y+"SelectedColor"]),F&&(e.ctx.fillStyle=e.style[F+"Color"]),e.ctx.font=e.style[y+"Font"],x.fontHeight=e.style[y+"FontHeight"],x.treeArrowWidth=G,x.orderByArrowWidth=j,p=void 0!==p?p:D?D(V):"",void 0!==p||D||(p="",console.warn("canvas-datagrid: Unknown format "+d.type+" add a cellFormater")),x.formattedValue=(void 0!==p&&null!==p?p:"").toString(),e.columnFilters&&void 0!==e.columnFilters[p]&&v&&(x.formattedValue=e.attributes.filterTextPrefix+p),e.dispatchEvent("rendertext",V)||(x.innerHTML||"html"===d.type?o(x):u(x)))),P&&(k=x),O&&!S&&(e.selections[x.rowIndex-1]&&-1!==e.selections[x.rowIndex-1].indexOf(x.columnIndex)&&0!==x.rowIndex||x.isHeader||R.push([x,"t"]),e.selections[x.rowIndex+1]&&-1!==e.selections[x.rowIndex+1].indexOf(x.columnIndex)||R.push([x,"b"]),e.selections[x.rowIndex]&&0!==x.columnIndex&&-1!==e.selections[x.rowIndex].indexOf(x.columnIndex-1)||R.push([x,"l"]),e.selections[x.rowIndex]&&x.columnIndex!==E.length&&-1!==e.selections[x.rowIndex].indexOf(x.columnIndex+1)||R.push([x,"r"])),e.ctx.restore(),M+=x.width+e.style.cellBorderWidth,x.width}}function x(t,o,r){var n;e.attributes.showRowHeaders&&(M=0,y={rowHeaderCell:o+1},y[e.uniqueId]=t[e.uniqueId],n={name:"rowHeaderCell",width:e.style.rowHeaderCellWidth,style:"rowHeaderCell",type:"string",data:t[e.uniqueId],index:-1},n[e.uniqueId]=t[e.uniqueId],B=e.openChildren[t[e.uniqueId]],d(y,o,r)(n,-1,-1))}function p(t,o){var r,n,l,i,s=E.length;if(H-2*N>O)return!1;if(A=e.data[t],B=e.openChildren[A[e.uniqueId]],l=e.sizes.rows[A[e.uniqueId]]||e.style.cellHeight,n=B?e.sizes.trees[A[e.uniqueId]]:0,I=l+n,H<-1*I)return!1;for(e.attributes.showRowHeaders&&(M+=j),N=I,i=e.scrollIndexLeft;ie.width));i+=1);return N=I,M=-1*e.scrollBox.scrollLeft+e.scrollPixelLeft+e.style.cellBorderWidth,b=e.childGrids[A[e.uniqueId]],t!==e.data.length&&B?(b.visible=!0,b.parentNode={offsetTop:H+l+e.canvasOffsetTop,offsetLeft:j-1+e.canvasOffsetLeft,offsetHeight:n,offsetWidth:e.width-j-e.style.scrollBarWidth-1,offsetParent:e.intf.parentNode,parentNode:e.intf.parentNode,style:e.style,nodeType:"canvas-datagrid-tree",scrollTop:e.scrollBox.scrollTop,scrollLeft:e.scrollBox.scrollLeft,rowIndex:t},e.visibleCells.unshift({rowIndex:M,columnIndex:0,y:b.parentNode.offsetTop,x:b.parentNode.offsetLeft,height:b.parentNode.offsetHeight,width:b.parentNode.offsetWidth,style:"tree-grid",type:b.parentNode.nodeType}),b.draw()):b&&(b.parentNode.offsetHeight=0,delete e.sizes.trees[A[e.uniqueId]]),P.push([A,t,o,H,I]),H+=N+e.style.cellBorderWidth,!0}if(!e.dispatchEvent("beforedraw",{})&&(e.isChildGrid||e.height&&e.width)){if(e.isChildGrid&&t)return void requestAnimationFrame(e.parentGrid.draw);if(!1!==e.intf.visible){var m,y,v,w,C,b,B,I,S,H,M,T,O,L,E,z,A,k,R=[],P=[],W=e.data.length,F=e.currentCell||{},D=e.getRowHeaderCellHeight(),j=e.getColumnHeaderCellWidth(),N=e.style.cellHeight;f+=1,v=performance.now(),e.data.length>e.orders.rows.length&&e.createRowOrders(),e.ctx.save(),function(){e.visibleRows=[],E=e.getVisibleSchema(),e.visibleCells=[],e.canvasOffsetTop=e.isChildGrid?e.parentNode.offsetTop:0,e.canvasOffsetLeft=e.isChildGrid?e.parentNode.offsetLeft:0,O=e.height,L=e.width,e.isChildGrid||e.ctx.scale(window.devicePixelRatio,window.devicePixelRatio)}(),function(){l(0,0,L,O,0),e.ctx.clip(),e.ctx.fillStyle=e.style.backgroundColor,i(0,0,L,O)}(),function(){var t,o,r,n=E.length;for(M=-1*e.scrollBox.scrollLeft+e.scrollPixelLeft+e.style.cellBorderWidth,H=-1*e.scrollBox.scrollTop+D+e.scrollPixelTop+e.style.cellBorderWidth,z=e.scrollIndexTop;ze.width+e.scrollBox.scrollLeft));t+=1);P.push([e.newRow,e.data.length,e.data.length,H,I])}}(),function(){e.ctx.lineWidth=e.style.selectionOverlayBorderWidth,e.ctx.strokeStyle=e.style.selectionOverlayBorderColor,R.forEach(function(e){c(e[0],e[1])})}(),function(){k&&(e.attributes.rowSelectionMode?e.activeCell&&e.activeCell.rowIndex===k.rowIndex&&(e.ctx.lineWidth=e.style.activeCellOverlayBorderWidth,e.ctx.strokeStyle=e.style.activeCellOverlayBorderColor,s(0,k.y,e.getHeaderWidth()+j,I)):(e.ctx.lineWidth=e.style.activeCellOverlayBorderWidth,e.ctx.strokeStyle=e.style.activeCellOverlayBorderColor,s(k.x,k.y,k.width,k.height)))}(),function(){var t,o,r,n,l,i=E.length;if(P.forEach(function(e){H=e[3],N=e[4],x(e[0],e[1],e[2])}),e.attributes.showColumnHeaders){for(M=-1*e.scrollBox.scrollLeft+e.scrollPixelLeft,e.attributes.showRowHeaders&&(M+=j),H=0,N=e.getRowHeaderCellHeight(),r=e.scrollIndexLeft;re.width+e.scrollBox.scrollLeft));r+=1);M1||e.touchHaltAnimation||a>1e3)return a=0,e.touchHaltAnimation=!1,void(o={scrollLeft:-1,scrollTop:-1});a+=1,r=e.easing(l,t.scrollLeft,-o.scrollLeft,s),n=e.easing(l,t.scrollTop,-o.scrollTop,s),e.scrollBox.scrollTo(r,n),requestAnimationFrame(e.touchEndAnimation)},e.touchend=function(r){if(!e.dispatchEvent("touchend",{NativeEvent:r})){var c=Math.abs(t.x)+Math.abs(t.y)0&&(e.scrollIndexLeft=Math.max(e.scrollIndexLeft-1,0),e.scrollPixelLeft=Math.max(e.scrollPixelLeft-(e.sizes.columns[r[e.scrollIndexLeft][e.uniqueId]]||r[e.scrollIndexLeft].width),0),e.scrollIndexTop=Math.max(e.scrollIndexTop-1,0),e.scrollPixelTop=Math.max(e.scrollPixelTop-(e.sizes.rows[e.data[e.scrollIndexTop][e.uniqueId]]||e.style.cellHeight)-(e.sizes.trees[e.data[e.scrollIndexTop][e.uniqueId]]||0),0)),e.ellipsisCache={},o||e.draw(!0),requestAnimationFrame(e.resizeEditInput),e.dispatchEvent("scroll",{top:e.scrollBox.scrollTop,left:e.scrollBox.scrollLeft})},e.mousemove=function(t,o){if(!e.contextMenu&&!e.input){e.mouse=o||e.getLayerPos(t);var r,n,l,i,s=t.controlKey||t.metaKey||e.attributes.persistantSelectionMode,a=e.getSchema(),c=e.mouse.x,d=e.mouse.y,u=e.getCellAt(c,d),h={NativeEvent:t,cell:u,x:c,y:d},f=e.currentCell;if(clearTimeout(e.scrollTimer),e.isInGrid({x:c,y:d})||(e.hasFocus=!1),!e.dispatchEvent("mousemove",h)&&(u&&e.currentCell&&(e.currentCell.rowIndex!==u.rowIndex||e.currentCell.columnIndex!==u.columnIndex)&&(e.cellBoundaryCrossed=!0,h.cell=f,e.dispatchEvent("cellmouseout",h),h.cell=u,e.dispatchEvent("cellmouseover",h)),e.currentCell=u,e.hasFocus)){if(e.hovers={},!e.draggingItem&&u&&-1===e.scrollModes.indexOf(u.context)&&(e.dragItem=u,e.dragMode=u.dragContext,e.canvas.style.cursor=u.context,"cell"===u.context&&u.data&&(e.canvas.style.cursor="pointer",e.hovers[u.data[e.uniqueId]]=[u.columnIndex]),(e.selecting||e.reorderObject)&&"cell"===u.context&&u.data)){if(l=e.getSelectionBounds(),i={x:Math.abs(e.dragStart.x-c),y:Math.abs(e.dragStart.y-d)},-1!==e.dragStartObject.columnIndex&&t.shiftKey&&(e.dragStartObject={rowIndex:e.activeCell.rowIndex,columnIndex:e.activeCell.columnIndex}),n={top:Math.min(e.dragStartObject.rowIndex,u.rowIndex),left:Math.min(e.dragStartObject.columnIndex,u.columnIndex),bottom:Math.max(e.dragStartObject.rowIndex,u.rowIndex),right:Math.max(e.dragStartObject.columnIndex,u.columnIndex)},-1===e.dragStartObject.columnIndex&&(n.left=-1,n.right=a.length-1,n.top=Math.min(l.top,u.rowIndex),n.bottom=Math.max(l.bottom,u.rowIndex)),e.dragStartObject.rowIndex===u.rowIndex&&e.dragStartObject.columnIndex===u.columnIndex||(e.ignoreNextClick=!0),(e.cellBoundaryCrossed||0===i.x&&0===i.y||e.attributes.rowSelectionMode)&&(e.attributes.rowSelectionMode||-1===e.dragStartObject.columnIndex?e.selectRow(u.rowIndex,s,null,!0):e.dragAddToSelection||void 0===u.rowIndex?(e.selections[u.rowIndex]=e.selections[u.rowIndex]||[],-1===e.selections[u.rowIndex].indexOf(u.columnIndex)&&e.selections[u.rowIndex].push(u.columnIndex)):e.selections[u.rowIndex]&&-1!==e.selections[u.rowIndex].indexOf(u.columnIndex)&&e.selections[u.rowIndex].splice(e.selections[u.rowIndex].indexOf(u.columnIndex),1)),!(e.selectionBounds&&n.top===e.selectionBounds.top&&n.left===e.selectionBounds.left&&n.bottom===e.selectionBounds.bottom&&n.right===e.selectionBounds.right||s))if(e.selections=[],l=n,e.attributes.rowSelectionMode)for(r=l.top;r<=l.bottom;r+=1)e.selectRow(r,!0,null,!0);else e.selectArea(l,!0);e.autoScrollZone(t,c,d,s)}e.cellBoundaryCrossed=!1,e.draw(!0)}}},e.click=function(t,o){function r(){l&&e.dispatchEvent("selectionchanged",{selectedData:e.getSelectedData(),selections:e.selections,selectionBounds:e.selectionBounds})}var n,l,i=t.controlKey||t.metaKey||e.attributes.persistantSelectionMode,s=o||e.getLayerPos(t);if(e.currentCell=e.getCellAt(s.x,s.y),void 0===e.currentCell.grid){if(e.input&&e.endEdit(),e.ignoreNextClick)return void(e.ignoreNextClick=!1);if(n=e.currentCell,!e.dispatchEvent("click",{NativeEvent:t,cell:e.currentCell})&&e.hasFocus){if("cell"===e.currentCell.context){if("cornerCell"===e.currentCell.style)return e.order(e.uniqueId,"asc",e.sorters.number),e.setFilter(),void r();if("columnHeaderCell"===e.currentCell.style){if("sort"===e.attributes.columnHeaderClickBehavior)return e.orderBy===n.header.name?e.orderDirection="asc"===e.orderDirection?"desc":"asc":e.orderDirection="asc",e.order(n.header.name,e.orderDirection),void r();if("select"===e.attributes.columnHeaderClickBehavior)return e.selectColumn(n.header.index,i,t.shiftKey,!0),r(),void e.draw()}if(-1!==["rowHeaderCell","columnHeaderCell"].indexOf(e.currentCell.style)||i||e.setActiveCell(n.columnIndex,n.rowIndex),e.selections[n.rowIndex]=e.selections[n.rowIndex]||[],e.attributes.rowSelectionMode||"rowHeaderCell"===e.currentCell.style){if("rowHeaderCell"===e.currentCell.style&&e.attributes.tree&&s.x>0&&s.x-e.currentCell.x0)return void e.toggleTree(n.rowIndex);l=!0,e.selectRow(n.rowIndex,i,null,!0)}t.shiftKey&&!i&&(e.selectionBounds=e.getSelectionBounds(),e.selectArea(void 0,!1))}r(),e.draw(!0)}}},e.dragResizeColumn=function(t){var o,r,n;return o=e.getLayerPos(t),r=e.resizingStartingWidth+o.x-e.dragStart.x,n=e.resizingStartingHeight+o.y-e.dragStart.y,re.scrollBox.scrollWidth-e.attributes.resizeScrollZone&&"ew-resize"===e.dragMode&&(e.resize(!0),e.scrollBox.scrollLeft+=r),"ew-resize"===e.dragMode?(e.sizes.columns["rowHeaderCell"===e.draggingItem.header.style?"cornerCell":e.draggingItem.header[e.uniqueId]]=r,-1!==["rowHeaderCell","cornerCell"].indexOf(e.draggingItem.header.style)&&e.resize(!0),void e.resizeChildGrids()):"ns-resize"===e.dragMode?(e.draggingItem.rowOpen?e.sizes.trees[e.draggingItem.data[e.uniqueId]]=n:e.attributes.globalRowResize?e.style.cellHeight=n:e.sizes.rows[e.draggingItem.data[e.uniqueId]]=n,e.dispatchEvent("resizerow",{row:n}),void e.resizeChildGrids()):void(e.ellipsisCache={}))},e.stopDragResize=function(){e.resize(),document.body.removeEventListener("mousemove",e.dragResizeColumn,!1),document.body.removeEventListener("mouseup",e.stopDragResize,!1),e.setStorageData(),e.draw(!0),e.ignoreNextClick=!0},e.scrollGrid=function(t){var o=e.getLayerPos(t);return e.attributes.scrollPointerLock&&e.pointerLockPosition&&-1!==["horizontal-scroll-box","vertical-scroll-box"].indexOf(e.scrollStartMode)&&(e.pointerLockPosition.x+=t.movementX,e.pointerLockPosition.y+=t.movementY,o=e.pointerLockPosition),e.scrollMode=e.getCellAt(o.x,o.y).context,"horizontal-scroll-box"===e.scrollMode&&"horizontal-scroll-box"!==e.scrollStartMode?(e.scrollStartMode="horizontal-scroll-box",e.dragStart=o,e.scrollStart.left=e.scrollBox.scrollLeft,void clearTimeout(e.scrollTimer)):"vertical-scroll-box"===e.scrollMode&&"vertical-scroll-box"!==e.scrollStartMode?(e.scrollStartMode="vertical-scroll-box",e.dragStart=o,e.scrollStart.top=e.scrollBox.scrollTop,void clearTimeout(e.scrollTimer)):("vertical-scroll-box"===e.scrollStartMode&&"vertical-scroll-box"!==e.scrollMode&&(e.scrollMode="vertical-scroll-box"),"horizontal-scroll-box"===e.scrollStartMode&&"horizontal-scroll-box"!==e.scrollMode&&(e.scrollMode="horizontal-scroll-box"),clearTimeout(e.scrollTimer),void(-1!==e.scrollModes.indexOf(e.scrollMode)&&("vertical-scroll-box"===e.scrollMode?e.scrollBox.scrollTop=e.scrollStart.top+(o.y-e.dragStart.y)/e.scrollBox.heightBoxRatio:"vertical-scroll-top"===e.scrollMode?(e.scrollBox.scrollTop-=e.page*e.style.cellHeight,e.scrollTimer=setTimeout(e.scrollGrid,e.attributes.scrollRepeatRate,t)):"vertical-scroll-bottom"===e.scrollMode&&(e.scrollBox.scrollTop+=e.page*e.style.cellHeight,e.scrollTimer=setTimeout(e.scrollGrid,e.attributes.scrollRepeatRate,t)),"horizontal-scroll-box"===e.scrollMode?e.scrollBox.scrollLeft=e.scrollStart.left+(o.x-e.dragStart.x)/e.scrollBox.widthBoxRatio:"horizontal-scroll-right"===e.scrollMode?(e.scrollBox.scrollLeft+=e.attributes.selectionScrollIncrement,e.scrollTimer=setTimeout(e.scrollGrid,e.attributes.scrollRepeatRate,t)):"horizontal-scroll-left"===e.scrollMode&&(e.scrollBox.scrollLeft-=e.attributes.selectionScrollIncrement,e.scrollTimer=setTimeout(e.scrollGrid,e.attributes.scrollRepeatRate,t)))))},e.stopScrollGrid=function(){clearTimeout(e.scrollTimer),document.exitPointerLock&&document.exitPointerLock(),document.body.removeEventListener("mousemove",e.scrollGrid,!1)},e.dragReorder=function(t){var o,r,n;o=e.getLayerPos(t),r=o.x-e.dragStart.x,n=o.y-e.dragStart.y,(e.attributes.allowColumnReordering||"column-reorder"!==e.dragMode)&&(e.attributes.allowRowReordering||"row-reorder"!==e.dragMode)&&(e.dispatchEvent("reordering",{NativeEvent:t,source:e.dragStartObject,target:e.currentCell,dragMode:e.dragMode})||(Math.abs(r)>e.attributes.reorderDeadZone||Math.abs(n)>e.attributes.reorderDeadZone)&&(e.reorderObject=e.dragStartObject,e.reorderTarget=e.currentCell,e.reorderObject.dragOffset={x:r,y:n},e.autoScrollZone(t,o.x,o.x,!1)))},e.stopDragReorder=function(t){var o={"row-reorder":e.orders.rows,"column-reorder":e.orders.columns},r={"row-reorder":"rowIndex","column-reorder":"columnIndex"}[e.dragMode];document.body.removeEventListener("mousemove",e.dragReorder,!1),document.body.removeEventListener("mouseup",e.stopDragReorder,!1),e.reorderObject&&e.reorderTarget&&(e.ignoreNextClick=!0,e.reorderObject[r]===e.reorderTarget[r]||e.dispatchEvent("reorder",{NativeEvent:t,source:e.reorderObject,target:e.reorderTarget,dragMode:e.dragMode})||(o[e.dragMode].splice(o[e.dragMode].indexOf(e.reorderObject[r]),1),o[e.dragMode].splice(o[e.dragMode].indexOf(e.reorderTarget[r]),0,e.reorderObject[r]),e.setStorageData())),e.reorderObject=void 0,e.reorderTarget=void 0,e.draw(!0)},e.mousedown=function(t,o){if(e.lastMouseDownTarget=t.target,!e.dispatchEvent("mousedown",{NativeEvent:t,cell:e.currentCell})&&e.hasFocus&&2!==t.button&&!e.input){var r=t.controlKey||t.metaKey;if(e.dragStart=o||e.getLayerPos(t),e.scrollStart={left:e.scrollBox.scrollLeft,top:e.scrollBox.scrollTop},e.dragStartObject=e.getCellAt(e.dragStart.x,e.dragStart.y),e.dragAddToSelection=!e.dragStartObject.selected,r||t.shiftKey||/(vertical|horizontal)-scroll-(bar|box)/.test(e.dragStartObject.context)||e.currentCell.isColumnHeader||(e.selections=[]),!e.dragStartObject.isGrid){if(-1!==e.scrollModes.indexOf(e.dragStartObject.context))return e.scrollMode=e.dragStartObject.context,e.scrollStartMode=e.dragStartObject.context,e.scrollGrid(t),e.attributes.scrollPointerLock&&-1!==["horizontal-scroll-box","vertical-scroll-box"].indexOf(e.scrollStartMode)&&(e.pointerLockPosition={x:e.dragStart.x,y:e.dragStart.y},e.canvas.requestPointerLock()),document.body.addEventListener("mousemove",e.scrollGrid,!1),document.body.addEventListener("mouseup",e.stopScrollGrid,!1),void(e.ignoreNextClick=!0);if("cell"===e.dragMode)return e.selecting=!0,e.attributes.rowSelectionMode&&e.selectRow(e.dragStartObject.rowIndex,r,null,!0),e.mousemove(t);-1!==["ns-resize","ew-resize"].indexOf(e.dragMode)&&(e.draggingItem=e.dragItem,e.draggingItem.rowOpen?e.resizingStartingHeight=e.sizes.trees[e.draggingItem.data[e.uniqueId]]:e.resizingStartingHeight=e.sizes.rows[e.draggingItem.data[e.uniqueId]]||e.style.cellHeight,e.resizingStartingWidth=e.sizes.columns["rowHeaderCell"===e.draggingItem.header.style?"cornerCell":e.draggingItem.header[e.uniqueId]]||e.draggingItem.header.width,document.body.addEventListener("mousemove",e.dragResizeColumn,!1),document.body.addEventListener("mouseup",e.stopDragResize,!1)),-1!==["row-reorder","column-reorder"].indexOf(e.dragMode)&&(e.draggingItem=e.dragItem,document.body.addEventListener("mousemove",e.dragReorder,!1),document.body.addEventListener("mouseup",e.stopDragReorder,!1))}}},e.mouseup=function(t){clearTimeout(e.scrollTimer),e.cellBoundaryCrossed=!0,e.selecting=void 0,e.draggingItem=void 0,e.dragStartObject=void 0,e.dispatchEvent("mouseup",{NativeEvent:t,cell:e.currentCell})||(e.hasFocus||t.target===e.canvas)&&(e.currentCell&&void 0!==e.currentCell.grid||e.contextMenu||e.input||(e.dragStart&&e.isInGrid(e.dragStart)&&e.controlInput.focus(),t.preventDefault()))},e.keydown=function(t){var o,r=e.activeCell.columnIndex,n=e.activeCell.rowIndex,l=t.controlKey||t.metaKey,i=e.data.length-1,s=e.getVisibleSchema().length-1;if(!e.dispatchEvent("keydown",{NativeEvent:t,cell:e.currentCell})&&e.hasFocus){if(e.page=e.visibleRows.length-3-e.attributes.pageUpDownOverlap,e.attributes.showNewRow&&(i+=1),9===t.keyCode&&t.preventDefault(),l&&65===t.keyCode?e.selectAll():40===t.keyCode?n+=1:38===t.keyCode?n-=1:37===t.keyCode||t.shiftKey&&9===t.keyCode?r-=1:39===t.keyCode||!t.shiftKey&&9===t.keyCode?r+=1:33===t.keyCode?(n-=e.page,t.preventDefault()):34===t.keyCode?(n+=e.page,t.preventDefault()):36===t.keyCode||l&&38===t.keyCode?n=0:35===t.keyCode||l&&40===t.keyCode?n=e.data.length-1:l&&39===t.keyCode?r=s:l&&37===t.keyCode&&(r=0),13===t.keyCode)return e.beginEditAt(r,n);if(32===t.keyCode){if(e.selections=[],e.selections[Math.max(n,0)]=[],e.selections[Math.max(n,0)].push(r),e.selectionBounds=e.getSelectionBounds(),e.attributes.rowSelectionMode)for(o=e.selectionBounds.top;o<=e.selectionBounds.bottom;o+=1)e.selectRow(o,l,null,!0);else e.selectArea(void 0,l);return t.preventDefault(),void e.draw(!0)}r<0&&(r=0),n>i&&(n=i),n<0&&(n=0),r>s&&(r=s),t.shiftKey&&-1!==[37,38,39,40].indexOf(t.keyCode)&&(e.selections[Math.max(n,0)]=e.selections[Math.max(n,0)]||[],e.selections[Math.max(n,0)].push(r),e.selectionBounds=e.getSelectionBounds(),e.selectArea(void 0,l),e.draw(!0)),r===e.activeCell.columnIndex&&n===e.activeCell.rowIndex||(e.scrollIntoView(r!==e.activeCell.columnIndex?r:void 0,n!==e.activeCell.rowIndex?n:void 0),e.setActiveCell(r,n),!t.shiftKey&&e.attributes.selectionFollowsActiveCell&&(l||(e.selections=[]),e.selections[n]=e.selections[n]||[],e.selections[n].push(r),e.dispatchEvent("selectionchanged",{selectedData:e.getSelectedData(),selections:e.selections,selectionBounds:e.selectionBounds})),e.draw(!0))}},e.keyup=function(t){e.dispatchEvent("keyup",{NativeEvent:t,cell:e.currentCell})||e.hasFocus&&(e.controlInput.value="")},e.keypress=function(t){e.hasFocus&&e.dispatchEvent("keypress",{NativeEvent:t,cell:e.currentCell})},e.dblclick=function(t){e.dispatchEvent("dblclick",{NativeEvent:t,cell:e.currentCell})||e.hasFocus&&("ew-resize"===e.currentCell.context&&"columnHeaderCell"===e.currentCell.style?e.fitColumnToValues(e.currentCell.header.name):"ew-resize"===e.currentCell.context&&"cornerCell"===e.currentCell.style?e.autosize():-1!==["cell","activeCell"].indexOf(e.currentCell.style)&&e.beginEditAt(e.currentCell.columnIndex,e.currentCell.rowIndex))},e.scrollWheel=function(t){if(!e.dispatchEvent("wheel",{NativeEvent:t})){e.touchHaltAnimation=!0;var o=e.scrollBox.scrollLeft,r=e.scrollBox.scrollTop;e.hasFocus&&(e.scrollBox.scrollTop+=t.deltaY,e.scrollBox.scrollLeft+=t.deltaX),r===e.scrollBox.scrollTop&&o===e.scrollBox.scrollLeft||t.preventDefault()}},e.copy=function(t){if(!e.dispatchEvent("copy",{NativeEvent:t})&&e.hasFocus&&t.clipboardData){var o=[],r=e.getSelectedData();r.length>0&&(r.forEach(function(e){if(e){var t=[];Object.keys(e).forEach(function(o){t.push(e[o])}),t.join(","),o.push(t)}}),t.clipboardData.setData("text/plain",o.join("\n")),t.preventDefault())}}}}.apply(t,r))&&(e.exports=n)},function(e,t,o){var r,n;r=[],void 0!==(n=function(){"use strict";return function(e){e.orders={rows:[],columns:[]},e.hasFocus=!1,e.activeCell={columnIndex:0,rowIndex:0},e.storageName="canvasDataGrid",e.invalidSearchExpClass="canvas-datagrid-invalid-search-regExp",e.localStyleLibraryStorageKey="canvas-datagrid-user-style-library",e.uniqueId="_canvasDataGridUniqueId",e.orderBy=e.uniqueId,e.orderDirection="asc",e.columnFilters={},e.filters={},e.ellipsisCache={},e.scrollBox={},e.visibleRows=[],e.sizes={rows:{},columns:{},trees:{}},e.currentFilter=function(){return!0},e.selections=[],e.hovers={},e.attributes={},e.style={},e.intf={},e.formatters={},e.sorters={},e.schemaHashes={},e.events={},e.uId=0,e.changes=[],e.scrollIndexTop=0,e.scrollPixelTop=0,e.scrollIndexLeft=0,e.scrollPixelLeft=0,e.childGrids={},e.openChildren={},e.scrollModes=["vertical-scroll-box","vertical-scroll-top","vertical-scroll-bottom","horizontal-scroll-box","horizontal-scroll-right","horizontal-scroll-left"],e.mouse={x:0,y:0},e.getSelectedData=function(t){var o=[],r=e.getSchema(),n=e.data.length;return e.selections.forEach(function(l,i){if(i!==n){if(0===l.length)return void(o[i]=null);o[i]={},t?r.forEach(function(t){o[i][t.name]=e.data[i][t.name]}):l.forEach(function(t){-1!==t&&(o[i][r[t].name]=e.data[i][r[t].name])})}}),o},e.scrollOffset=function(e){for(var t=0,o=0;e.parentNode;)"canvas-datagrid-tree"!==e.nodeType&&"canvas-datagrid-cell"!==e.nodeType&&(t-=e.scrollLeft,o-=e.scrollTop),e=e.parentNode;return{left:t,top:o}},e.position=function(t,o){for(var r,n,l=0,i=0,s=t;t.offsetParent;)l+=t.offsetLeft,i+=t.offsetTop,r=t.offsetHeight,n=t.offsetWidth,t=t.offsetParent;return o?{left:l,top:i,height:r,width:n}:(t=s,s=e.scrollOffset(t),{left:l+s.left,top:i+s.top,height:r,width:n})},e.getLayerPos=function(t){var o=e.canvas.getBoundingClientRect(),r={x:t.clientX-o.left,y:t.clientY-o.top};return e.isChildGrid&&(r.x-=e.canvasOffsetLeft,r.y-=e.canvasOffsetTop),{x:r.x,y:r.y,rect:o}},e.fillArray=function(e,t,o){o=o||1;var r,n=[];for(r=e;r<=t;r+=o)n[r]=r;return n},e.getRowHeaderCellHeight=function(){return e.attributes.showColumnHeaders?e.sizes.rows[-1]||e.style.columnHeaderCellHeight:0},e.getColumnHeaderCellWidth=function(){return e.attributes.showRowHeaders?e.sizes.columns.cornerCell||e.style.rowHeaderCellWidth:0},e.setStorageData=function(){e.attributes.saveAppearance&&localStorage.setItem(e.storageName+"-"+e.attributes.name,JSON.stringify({sizes:{rows:e.sizes.rows,columns:e.sizes.columns},orders:{rows:e.orders.rows,columns:e.orders.columns},orderBy:e.orderBy,orderDirection:e.orderDirection}))},e.getSchema=function(){return e.schema||e.tempSchema},e.createColumnOrders=function(){var t=e.getSchema();e.orders.columns=e.fillArray(0,t.length-1)},e.createRowOrders=function(){e.orders.rows=e.fillArray(0,e.data.length-1)},e.getVisibleSchema=function(){return e.getSchema().filter(function(e){return!e.hidden})},e.applyDefaultValue=function(t,o){var r=o.defaultValue||"";"function"==typeof r&&(r=r.apply(e.intf,[o])),t[o.name]=r},e.createNewRowData=function(){e.newRow={},e.newRow[e.uniqueId]=e.uId,e.uId+=1,e.getSchema().forEach(function(t){e.applyDefaultValue(e.newRow,t)})},e.getSchemaNameHash=function(t){for(var o=0;e.schemaHashes[t];)o+=1,t+=o;return t},e.filter=function(t){var o=e.filters[t];return o||void 0===t||(console.warn("Cannot find filter for type %s, falling back to substring match.",t),o=e.filters.string),o},e.getBestGuessDataType=function(t){var o,r,n=e.data.length;for(r=0;ri.x?l.x:i.x,y:l.y>i.y?l.y:i.y,h:l.he.width-e.attributes.selectionScrollZone&&oe.height-e.attributes.selectionScrollZone&&r0)throw new Error("A column with the name "+e.name+" already exists and cannot be added again.");return!0},e.setDefaults=function(e,t,o,r){e[o]=void 0===t[o]?r:t[o]},e.setAttributes=function(){e.defaults.attributes.forEach(function(t){e.setDefaults(e.attributes,e.args,t[0],t[1])})},e.setStyle=function(){e.defaults.styles.forEach(function(t){e.setDefaults(e.style,e.args.style||{},t[0],t[1])})},e.autosize=function(t){e.getVisibleSchema().forEach(function(o){o.name!==t&&void 0!==t||e.fitColumnToValues(o.name)}),e.fitColumnToValues("cornerCell")},e.dispose=function(){!e.isChildGrid&&e.canvas&&e.canvas.parentNode&&e.canvas.parentNode.removeChild(e.canvas),e.eventParent.removeEventListener("mouseup",e.mouseup,!1),e.eventParent.removeEventListener("mousedown",e.mousedown,!1),e.eventParent.removeEventListener("dblclick",e.dblclick,!1),e.eventParent.removeEventListener("click",e.click,!1),e.eventParent.removeEventListener("mousemove",e.mousemove),e.eventParent.removeEventListener("wheel",e.scrollWheel,!1),e.canvas.removeEventListener("contextmenu",e.contextmenu,!1),e.canvas.removeEventListener("copy",e.copy),e.controlInput.removeEventListener("keypress",e.keypress,!1),e.controlInput.removeEventListener("keyup",e.keyup,!1),e.controlInput.removeEventListener("keydown",e.keydown,!1),window.removeEventListener("resize",e.resize),e.observer&&e.observer.disconnect&&e.observer.disconnect()},e.tryLoadStoredOrders=function(){var t;e.storedSettings&&"object"==typeof e.storedSettings.orders&&(e.storedSettings.orders.rows.length>=e.data.length&&(e.orders.rows=e.storedSettings.orders.rows),t=e.getSchema(),e.orders.columns=e.storedSettings.orders.columns,t.forEach(function(t,o){-1===e.orders.columns.indexOf(o)&&e.orders.columns.push(o)}),e.orderBy=void 0===e.storedSettings.orderBy?e.uniqueId:e.storedSettings.orderBy,e.orderDirection=void 0===e.storedSettings.orderDirection?e.uniqueId:e.storedSettings.orderDirection,e.getHeaderByName(e.orderBy)&&e.orderDirection&&e.order(e.orderBy,e.orderDirection))},e.getFontHeight=function(e){return parseFloat(e,10)},e.parseFont=function(t){/Font/.test(t)&&(e.style[t+"Height"]=e.getFontHeight(e.style[t]))},e.initProp=function(t){e.args[t]&&Object.keys(e.args[t]).forEach(function(o){e[t][o]=e.args[t][o]})},e.init=function(){var t={};if(e.setAttributes(),e.setStyle(),e.initScrollBox(),e.setDom(),e.type="canvas-datagrid",Object.keys(e.style).forEach(e.parseFont),e.intf.type=e.type,e.intf.addEventListener=e.addEventListener,e.intf.removeEventListener=e.removeEventListener,e.intf.dispatchEvent=e.dispatchEvent,e.intf.dispose=e.dispose,e.intf.appendTo=e.appendTo,e.intf.filters=e.filters,e.intf.sorters=e.sorters,e.intf.autosize=e.autosize,e.intf.beginEditAt=e.beginEditAt,e.intf.endEdit=e.endEdit,e.intf.setActiveCell=e.setActiveCell,e.intf.scrollIntoView=e.scrollIntoView,e.intf.clearChangeLog=e.clearChangeLog,e.intf.gotoCell=e.gotoCell,e.intf.gotoRow=e.gotoRow,e.intf.findColumnScrollLeft=e.findColumnScrollLeft,e.intf.findRowScrollTop=e.findRowScrollTop,e.intf.fitColumnToValues=e.fitColumnToValues,e.intf.findColumnMaxTextLength=e.findColumnMaxTextLength,e.intf.disposeContextMenu=e.disposeContextMenu,e.intf.getCellAt=e.getCellAt,e.intf.isCellVisible=e.isCellVisible,e.intf.order=e.order,e.intf.draw=e.draw,e.intf.selectArea=e.selectArea,e.intf.clipElement=e.clipElement,e.intf.getSchemaFromData=e.getSchemaFromData,e.intf.setFilter=e.setFilter,e.intf.selectRow=e.selectRow,e.intf.parentGrid=e.parentGrid,e.intf.toggleTree=e.toggleTree,e.intf.expandTree=e.expandTree,e.intf.collapseTree=e.collapseTree,e.intf.canvas=e.canvas,e.intf.context=e.ctx,e.intf.insertRow=e.insertRow,e.intf.deleteRow=e.deleteRow,e.intf.addRow=e.addRow,e.intf.insertColumn=e.insertColumn,e.intf.deleteColumn=e.deleteColumn,e.intf.addColumn=e.addColumn,e.intf.getClippingRect=e.getClippingRect,e.intf.setRowHeight=e.setRowHeight,e.intf.setColumnWidth=e.setColumnWidth,e.intf.resetColumnWidths=e.resetColumnWidths,e.intf.resetRowHeights=e.resetRowHeights,e.intf.resize=e.resize,e.intf.selectColumn=e.selectColumn,e.intf.selectRow=e.selectRow,e.intf.selectAll=e.selectAll,e.intf.drawChildGrids=e.drawChildGrids,e.intf.assertPxColor=e.assertPxColor,e.intf.clearPxColorAssertions=e.clearPxColorAssertions,e.intf.integerToAlpha=e.integerToAlpha,e.intf.style={},Object.keys(e.style).forEach(function(o){t[o]=void 0,Object.defineProperty(t,o,{get:function(){return e.style[o]},set:function(t){e.parseFont(t),e.style[o]=t,e.draw(!0),e.dispatchEvent("stylechanged",{name:o,value:t})}})}),Object.defineProperty(e.intf,"activeCell",{get:function(){return e.activeCell}}),Object.defineProperty(e.intf,"hasFocus",{get:function(){return e.hasFocus}}),Object.defineProperty(e.intf,"style",{get:function(){return t},set:function(t){Object.keys(t).forEach(function(o){e.parseFont(t),e.style[o]=t[o]}),e.draw(!0),e.dispatchEvent("stylechanged",{name:"style",value:t})}}),Object.keys(e.attributes).forEach(function(t){Object.defineProperty(e.intf.attributes,t,{get:function(){return e.attributes[t]},set:function(o){e.attributes[t]=o,e.draw(!0),e.dispatchEvent("attributechanged",{name:t,value:o[t]})}})}),e.filters.string=function(t,o){if(!o)return!0;var r;e.invalidFilterRegEx=void 0;try{r=new RegExp(o,"ig")}catch(t){return void(e.invalidFilterRegEx=t)}return r.test(t)},e.filters.number=function(e,t){return!t||e===t},e.attributes.name&&e.attributes.saveAppearance){if(e.storedSettings=localStorage.getItem(e.storageName+"-"+e.attributes.name),e.storedSettings)try{e.storedSettings=JSON.parse(e.storedSettings)}catch(t){console.warn("could not read settings from localStore",t),e.storedSettings=void 0}e.storedSettings&&"object"==typeof e.storedSettings.sizes&&(e.sizes.rows=e.storedSettings.sizes.rows,e.sizes.columns=e.storedSettings.sizes.columns,["trees","columns","rows"].forEach(function(t){e.sizes[t]||(e.sizes[t]={})}))}["formatters","filters","sorters"].forEach(e.initProp),e.args.data&&(e.intf.data=e.args.data),e.data||(e.intf.data=[]),e.args.schema&&(e.intf.schema=e.args.schema),e.isChildGrid?requestAnimationFrame(function(){e.resize(!0)}):e.resize(!0)},e.intf.blur=function(t){e.hasFocus=!1},e.intf.focus=function(){e.hasFocus=!0,e.controlInput.focus()},Object.defineProperty(e.intf,"height",{get:function(){return e.parentNode.height},set:function(t){e.parentNode.height=t,e.resize(!0)}}),Object.defineProperty(e.intf,"width",{get:function(){return e.parentNode.width},set:function(t){e.parentNode.width=t,e.resize(!0)}}),Object.defineProperty(e.intf,"openChildren",{get:function(){return e.openChildren}}),Object.defineProperty(e.intf,"childGrids",{get:function(){return Object.keys(e.childGrids).map(function(t){return e.childGrids[t]})}}),Object.defineProperty(e.intf,"isChildGrid",{get:function(){return e.isChildGrid}}),Object.defineProperty(e.intf,"parentNode",{get:function(){return e.parentNode},set:function(t){e.parentNode=t}}),Object.defineProperty(e.intf,"offsetParent",{get:function(){return e.parentNode},set:function(t){e.parentNode=t}}),Object.defineProperty(e.intf,"offsetLeft",{get:function(){return e.parentNode.offsetLeft}}),Object.defineProperty(e.intf,"offsetTop",{get:function(){return e.parentNode.offsetTop}}),Object.defineProperty(e.intf,"scrollHeight",{get:function(){return e.scrollBox.scrollHeight}}),Object.defineProperty(e.intf,"scrollWidth",{get:function(){return e.scrollBox.scrollWidth}}),Object.defineProperty(e.intf,"scrollTop",{get:function(){return e.scrollBox.scrollTop},set:function(t){e.scrollBox.scrollTop=t}}),Object.defineProperty(e.intf,"scrollLeft",{get:function(){return e.scrollBox.scrollLeft},set:function(t){e.scrollBox.scrollLeft=t}}),Object.defineProperty(e.intf,"sizes",{get:function(){return e.sizes}}),Object.defineProperty(e.intf,"input",{get:function(){return e.input}}),Object.defineProperty(e.intf,"controlInput",{get:function(){return e.controlInput}}),Object.defineProperty(e.intf,"currentCell",{get:function(){return e.currentCell}}),Object.defineProperty(e.intf,"visibleCells",{get:function(){return e.visibleCells}}),Object.defineProperty(e.intf,"visibleRows",{get:function(){return e.visibleRows}}),Object.defineProperty(e.intf,"selections",{get:function(){return e.selections}}),Object.defineProperty(e.intf,"dragMode",{get:function(){return e.dragMode}}),Object.defineProperty(e.intf,"changes",{get:function(){return e.changes}}),e.intf.attributes={},e.intf.formatters=e.formatters,e.normalizeDataset=function(t){var o,r,n,l;if(null===t||""===t||void 0===t)return[];if("string"!=typeof t&&"number"!=typeof t&&"boolean"!=typeof t||(t=[{0:t}]),Array.isArray(t)||"object"!=typeof t||(t=[t]),!Array.isArray(t[0])&&"object"==typeof t[0]||Array.isArray(t)&&0===t.length)return t;if("function"==typeof t&&(o=t.apply(e.intf,[function(t){l&&console.warn("Detected a callback to the data setter function after the same function already returned a value synchronously."),e.normalizeDataset(t)}]))&&(l=!0,e.normalizeDataset(o)),Array.isArray(t)||"object"!=typeof t||(t=[t]),Array.isArray(t))return Array.isArray(t[0])||(t=[t]),n=0,r=[],t.forEach(function(e){n=Math.max(n,e.length)}),t.forEach(function(e,t){var o;for(r[t]={},o=0;o0&&(e.tempSchema=e.getSchemaFromData()),e.schema||0!==e.data.length||(e.tempSchema=[{name:""}],e.tempSchema[0][e.uniqueId]=e.getSchemaNameHash("")),e.tempSchema&&!e.schema&&(e.createColumnOrders(),e.tryLoadStoredOrders(),e.dispatchEvent("schemachanged",{schema:e.tempSchema})),e.createNewRowData(),e.attributes.autoResizeColumns&&e.data.length>0&&void 0===e.storedSettings&&e.autosize(),e.fitColumnToValues("cornerCell",!0),e.resize()&&e.isChildGrid||e.draw(!0),e.createRowOrders(),e.tryLoadStoredOrders(),e.dispatchEvent("datachanged",{data:e.data})}}),e.initScrollBox=function(){function t(t,o){if(isNaN(t))throw new Error("ScrollTop value must be a number");t<0&&(t=0),t>s&&(t=s),s<0&&(t=0),l=t,o||e.scroll()}function o(t,o){if(isNaN(t))throw new Error("ScrollLeft value must be a number");t<0&&(t=0),t>a&&(t=a),a<0&&(t=0),i=t,o||e.scroll()}var r=0,n=0,l=0,i=0,s=0,a=0,c=20,d=20;e.scrollBox.scrollTo=function(e,r){o(e,!0),t(r)},Object.defineProperty(e.scrollBox,"scrollBoxHeight",{get:function(){return c},set:function(e){c=e}}),Object.defineProperty(e.scrollBox,"scrollBoxWidth",{get:function(){return d},set:function(e){d=e}}),Object.defineProperty(e.scrollBox,"height",{get:function(){return r},set:function(e){se&&(l=Math.max(e,0)),se&&(i=Math.max(e,0)),a=e}})}}}.apply(t,r))&&(e.exports=n)},function(e,t,o){var r,n;r=[],void 0!==(n=function(){"use strict";return function(e){function t(o,r,l,s){function a(){l.forEach(function(r){function n(e){e.relatedTarget!==g&&r.contextMenu.container!==e.relatedTarget&&s!==e.relatedTarget&&a!==e.relatedTarget&&(r.contextMenu.dispose(),m.splice(m.indexOf(r.contextMenu),1),r.contextMenu=void 0,a.removeEventListener("mouseout",n),g.removeEventListener("mouseout",n),a.setAttribute("contextOpen","0"),a.setAttribute("opening","0"))}function l(l){if("1"===a.getAttribute("opening")&&"1"!==a.getAttribute("contextOpen")){var i=a.getBoundingClientRect();i={left:i.left+e.style.childContextMenuMarginLeft+g.offsetWidth,top:i.top+e.style.childContextMenuMarginTop,bottom:i.bottom,right:i.right},r.contextMenu=t(o,i,l,v),a.setAttribute("contextOpen","1"),a.addEventListener("mouseout",n),g.addEventListener("mouseout",n),m.push(r.contextMenu)}}function i(){var e;if("1"!==a.getAttribute("contextOpen")){if(a.setAttribute("opening","1"),"function"==typeof r.items)return void(void 0!==(e=r.items.apply(v,[function(e){l(e)}]))&&Array.isArray(e)&&l(e));l(r.items)}}var s,a=document.createElement("div");!function(t){function r(t){return"function"==typeof t?r(t(o)):"object"==typeof t?void a.appendChild(t):(e.createInlineStyle(a,"canvas-datagrid-context-menu-item"),a.addEventListener("mouseover",function(){e.createInlineStyle(a,"canvas-datagrid-context-menu-item:hover")}),a.addEventListener("mouseout",function(){e.createInlineStyle(a,"canvas-datagrid-context-menu-item")}),void(a.innerHTML=t))}r(t.title),t.contextItemContainer=a,t.items&&t.items.length>0&&(s=document.createElement("div"),e.createInlineStyle(s,"canvas-datagrid-context-child-arrow"),s.innerHTML=e.style.childContextMenuArrowHTML,a.appendChild(s),a.addEventListener("mouseover",i),a.addEventListener("mouseout",function(){a.setAttribute("opening","0")})),t.click&&a.addEventListener("click",function(o){t.click.apply(e,[o])})}(r),g.appendChild(a)})}function c(e){l[e].contextItemContainer.dispatchEvent(new Event("click"))}function d(){g.scrollTop>0?document.body.appendChild(x):x.parentNode&&x.parentNode.removeChild(x),g.scrollTop>=g.scrollHeight-g.offsetHeight&&p.parentNode?p.parentNode.removeChild(p):g.scrollHeight-g.offsetHeight>0&&!(g.scrollTop>=g.scrollHeight-g.offsetHeight)&&document.body.appendChild(p)}function u(t){return function o(){var r=e.attributes.contextHoverScrollAmount;"up"===t&&0===g.scrollTop||"down"===t&&g.scrollTop===g.scrollHeight||(g.scrollTop+="up"===t?-r:r,n=setTimeout(o,e.attributes.contextHoverScrollRateMs,t))}}function h(e){return function(){clearTimeout(n)}}var f,g=document.createElement("div"),x=document.createElement("div"),p=document.createElement("div"),m=[],y=-1,v={};if(!Array.isArray(l))throw new Error("createContextMenu expects an array.");return v.parentGrid=e.intf,v.parentContextMenu=s,v.container=g,function(){var t={},o=e.scrollOffset(e.canvas);a(),e.createInlineStyle(g,"canvas-datagrid-context-menu"),t.x=r.left-o.left,t.y=r.top-o.top,t.height=0,i+=1,g.style.position="absolute",x.style.color=e.style.contextMenuArrowColor,p.style.color=e.style.contextMenuArrowColor,[x,p].forEach(function(e){e.style.textAlign="center",e.style.position="absolute",e.style.zIndex=i+1}),g.style.zIndex=i,s&&s.inputDropdown&&(g.style.maxHeight=window.innerHeight-t.y-e.style.autocompleteBottomMargin+"px",g.style.minWidth=r.width+"px",t.y+=r.height),g.style.left=t.x+"px",g.style.top=t.y+"px",g.addEventListener("scroll",d),g.addEventListener("wheel",function(t){e.hasFocus&&(g.scrollTop+=t.deltaY,g.scrollLeft+=t.deltaX),d()}),x.innerHTML=e.style.contextMenuArrowUpHTML,p.innerHTML=e.style.contextMenuArrowDownHTML,g.appendChild(x),document.body.appendChild(p),document.body.appendChild(g),f=g.getBoundingClientRect(),!(f.bottom>window.innerHeight)||s&&s.inputDropdown||(t.y=window.innerHeight-g.offsetHeight,t.y<0&&(t.y=0),g.offsetHeight>window.innerHeight&&(g.style.height=window.innerHeight-e.style.contextMenuWindowMargin+"px")),f.right>window.innerWidth&&(t.x=s?s.container.offsetLeft-g.offsetWidth:window.innerWidth-g.offsetWidth),g.style.left=t.x+"px",g.style.top=t.y+"px",f=g.getBoundingClientRect(),x.style.top=f.top+"px",p.style.top=f.top+f.height-p.offsetHeight+"px",x.style.left=f.left+"px",p.style.left=f.left+"px",p.style.width=g.offsetWidth+"px",x.style.width=g.offsetWidth+"px",p.addEventListener("mouseover",u("down")),p.addEventListener("mouseout",h("down")),x.addEventListener("mouseover",u("up")),x.addEventListener("mouseout",h("up")),d()}(),v.clickIndex=c,v.rect=f,v.items=l,v.upArrow=x,v.downArrow=p,v.dispose=function(){clearTimeout(n),m.forEach(function(e){e.dispose()}),[p,x,g].forEach(function(e){e.parentNode&&e.parentNode.removeChild(e)})},Object.defineProperty(v,"selectedIndex",{get:function(){return y},set:function(t){if("number"!=typeof t||isNaN(t||!isFinite(t)))throw new Error("Context menu selected index must be a sane number.");y=t,y>l.length-1&&(y=l.length-1),y<0&&(y=0),l.forEach(function(t,o){if(o===y)return e.createInlineStyle(t.contextItemContainer,"canvas-datagrid-context-menu-item:hover");e.createInlineStyle(t.contextItemContainer,"canvas-datagrid-context-menu-item")})}}),v}function o(o){function r(){i={},e.data.forEach(function(t){var r=t[o.cell.header.name];i[r]||(i[r]={title:e.formatters[o.cell.header.type||"string"]({cell:{value:r}}),click:function(t){u.value=r,t.stopPropagation(),u.dispatchEvent(new Event("keyup")),e.disposeAutocomplete()}})}),i=Object.keys(i).map(function(e){return i[e]})}function n(e){e&&-1!==[40,38,13,9,27].indexOf(e.keyCode)||(r(),s=u.getBoundingClientRect(),l&&(l.dispose(),l=void 0),l=t(o,{left:s.left,top:s.top,right:s.right,bottom:s.bottom,height:s.height,width:s.width},i,{inputDropdown:!0}),l.selectedIndex=0)}var i,s,a=document.createElement("div"),c=document.createElement("div"),d=document.createElement("button"),u=document.createElement("input"),h=o.cell&&o.cell.header?o.cell.header.title||o.cell.header.name:"";e.createInlineStyle(c,"canvas-datagrid-context-menu-label"),e.createInlineStyle(d,"canvas-datagrid-context-menu-filter-button"),e.createInlineStyle(u,"canvas-datagrid-context-menu-filter-input"),u.onclick=e.disposeAutocomplete,u.addEventListener("keydown",function(t){40===t.keyCode&&(l.selectedIndex+=1),38===t.keyCode&&(l.selectedIndex-=1),13===t.keyCode&&(l.clickIndex(l.selectedIndex),e.disposeContextMenu()),9===t.keyCode&&(l.clickIndex(l.selectedIndex),t.preventDefault()),27===t.keyCode&&e.disposeContextMenu()}),u.addEventListener("keyup",function(){e.setFilter(o.cell.header.name,u.value)}),u.addEventListener("keyup",n),u.value=o.cell.header?e.columnFilters[o.cell.header.name]||"":"",c.innerHTML=e.attributes.filterOptionText.replace(/%s/g,h),d.onclick=function(){if(l)return e.disposeAutocomplete();n()},d.innerHTML=e.style.contextFilterButtonHTML,a.addEventListener("click",function(e){return e.stopPropagation()}),a.appendChild(c),a.appendChild(u),a.appendChild(d),o.items.push({title:a}),Object.keys(e.columnFilters).length&&Object.keys(e.columnFilters).forEach(function(t){var r=e.getHeaderByName(t);o.items.push({title:e.attributes.removeFilterOptionText.replace(/%s/g,r.title||r.name),click:function(o){o.preventDefault(),e.setFilter(t,""),e.controlInput.focus()}})})}function r(t){var r=!(t.cell.isBackground||t.cell.isHeaderCellCap||t.cell.isScrollBar||t.cell.isCorner||t.cell.isRowHeader)&&t.cell.header;e.attributes.showFilter&&r&&o(t),e.attributes.showCopy&&e.selections.reduce(function(e,t){return e+t.length},0)>0&&t.items.push({title:e.attributes.copyText,click:function(){document.execCommand("copy"),e.disposeContextMenu(),e.controlInput.focus()}}),e.attributes.saveAppearance&&e.attributes.showClearSettingsOption&&(Object.keys(e.sizes.rows).length>0||Object.keys(e.sizes.columns).length>0)&&t.items.push({title:e.attributes.clearSettingsOptionText,click:function(t){t.preventDefault(),e.sizes.rows={},e.sizes.columns={},e.createRowOrders(),e.createColumnOrders(),e.storedSettings=void 0,e.dispatchEvent("resizecolumn",{columnWidth:e.style.columnWidth}),e.dispatchEvent("resizerow",{cellHeight:e.style.cellHeight}),e.setStorageData(),e.resize(!0),e.disposeContextMenu(),e.controlInput.focus()}}),e.attributes.allowSorting&&e.attributes.showOrderByOption&&r&&(t.items.push({title:e.attributes.showOrderByOptionTextAsc.replace("%s",t.cell.header.title||t.cell.header.name),click:function(o){o.preventDefault(),e.order(t.cell.header.name,"asc"),e.controlInput.focus()}}),t.items.push({title:e.attributes.showOrderByOptionTextDesc.replace("%s",t.cell.header.title||t.cell.header.name),click:function(o){o.preventDefault(),e.order(t.cell.header.name,"desc"),e.disposeContextMenu(),e.controlInput.focus()}}))}var n,l,i=2;e.disposeAutocomplete=function(){l&&(l.dispose(),l=void 0)},e.disposeContextMenu=function(){document.removeEventListener("click",e.disposeContextMenu),i=2,e.disposeAutocomplete(),e.contextMenu&&e.contextMenu.dispose(),e.contextMenu=void 0},e.contextmenuEvent=function(o,n){if(e.hasFocus||o.target===e.canvas){var l=[],i=n||e.getLayerPos(o,!0),s={NativeEvent:o,cell:e.getCellAt(i.x,i.y),items:l};s.cell.isGrid||r(s),e.dispatchEvent("contextmenu",s)||s.cell.isGrid||(e.contextMenu&&e.disposeContextMenu(),e.contextMenu=t(s,{left:i.x+i.rect.left+e.style.contextMenuMarginLeft+e.canvasOffsetLeft,top:i.y+i.rect.top+e.style.contextMenuMarginTop+e.canvasOffsetTop,right:s.cell.width+s.cell.x+i.rect.left,bottom:s.cell.height+s.cell.y+i.rect.top,height:s.cell.height,width:s.cell.width},l),document.addEventListener("click",e.disposeContextMenu),o.preventDefault())}}}}.apply(t,r))&&(e.exports=n)},function(e,t,o){var r,n;r=[],void 0!==(n=function(){"use strict";return function(e){e.defaults={attributes:[["name",""],["tree",!1],["showNewRow",!1],["treeHorizontalScroll",!1],["saveAppearance",!0],["selectionFollowsActiveCell",!1],["multiLine",!1],["editable",!0],["allowColumnReordering",!0],["allowRowReordering",!1],["allowSorting",!0],["showFilter",!0],["globalRowResize",!1],["pageUpDownOverlap",1],["persistantSelectionMode",!1],["rowSelectionMode",!1],["autoResizeColumns",!1],["allowRowHeaderResize",!0],["allowColumnResize",!0],["allowRowResize",!0],["allowRowResizeFromCell",!1],["allowColumnResizeFromCell",!1],["debug",!1],["borderResizeZone",10],["showColumnHeaders",!0],["showRowNumbers",!0],["showRowHeaders",!0],["scrollRepeatRate",75],["selectionScrollZone",20],["resizeScrollZone",20],["contextHoverScrollRateMs",5],["contextHoverScrollAmount",2],["selectionScrollIncrement",20],["reorderDeadZone",3],["showClearSettingsOption",!0],["showOrderByOption",!0],["clearSettingsOptionText","Clear saved settings"],["showOrderByOptionTextAsc","Order by %s ascending"],["showOrderByOptionTextDesc","Order by %s descending"],["removeFilterOptionText","Remove filter on %s"],["filterOptionText","Filter %s"],["filterTextPrefix","(filtered) "],["touchReleaseAnimationDurationMs",1e3],["touchReleaseAcceleration",30],["touchDeadZone",3],["touchSelectTimeMs",800],["touchScrollZone",40],["copyText","Copy"],["showCopy",!0],["columnHeaderClickBehavior","sort"],["scrollPointerLock",!0]],styles:[["activeCellBackgroundColor","rgba(255, 255, 255, 1)"],["activeCellBorderColor","rgba(110, 168, 255, 1)"],["activeCellBorderWidth",.25],["activeCellColor","rgba(0, 0, 0, 1)"],["activeCellFont","16px sans-serif"],["activeCellHoverBackgroundColor","rgba(255, 255, 255, 1)"],["activeCellHoverColor","rgba(0, 0, 0, 1)"],["activeCellOverlayBorderColor","rgba(66, 133, 244, 1)"],["activeCellOverlayBorderWidth",.5],["activeCellPaddingBottom",5],["activeCellPaddingLeft",5],["activeCellPaddingRight",7],["activeCellPaddingTop",5],["activeCellSelectedBackgroundColor","rgba(236, 243, 255, 1)"],["activeCellSelectedColor","rgba(0, 0, 0, 1)"],["activeColumnHeaderCellBackgroundColor","rgba(225, 225, 225, 1)"],["activeColumnHeaderCellColor","rgba(0, 0, 0, 1)"],["activeRowHeaderCellBackgroundColor","rgba(225, 225, 225, 1)"],["activeRowHeaderCellColor","rgba(0, 0, 0, 1)"],["autocompleteBottomMargin",60],["autosizeHeaderCellPadding",8],["autosizePadding",5],["backgroundColor","rgba(240, 240, 240, 1)"],["cellAutoResizePadding",13],["cellBackgroundColor","rgba(255, 255, 255, 1)"],["cellBorderColor","rgba(195, 199, 202, 1)"],["cellBorderWidth",.5],["cellColor","rgba(0, 0, 0, 1)"],["cellFont","16px sans-serif"],["cellGridHeight",250],["cellHeight",24],["cellHeightWithChildGrid",150],["cellHorizontalAlignment","left"],["cellHoverBackgroundColor","rgba(255, 255, 255, 1)"],["cellHoverColor","rgba(0, 0, 0, 1)"],["cellPaddingBottom",5],["cellPaddingLeft",5],["cellPaddingRight",7],["cellPaddingTop",5],["cellSelectedBackgroundColor","rgba(236, 243, 255, 1)"],["cellSelectedColor","rgba(0, 0, 0, 1)"],["cellVerticalAlignment","center"],["cellWidthWithChildGrid",250],["childContextMenuArrowColor","rgba(43, 48, 43, 1)"],["childContextMenuArrowHTML","►"],["childContextMenuMarginLeft",-15],["childContextMenuMarginTop",0],["columnHeaderCellBackgroundColor","rgba(240, 240, 240, 1)"],["columnHeaderCellBorderColor","rgba(152, 152, 152, 1)"],["columnHeaderCellBorderWidth",.25],["columnHeaderCellColor","rgba(50, 50, 50, 1)"],["columnHeaderCellFont","16px sans-serif"],["columnHeaderCellHeight",25],["columnHeaderCellHorizontalAlignment","left"],["columnHeaderCellHoverBackgroundColor","rgba(235, 235, 235, 1)"],["columnHeaderCellHoverColor","rgba(0, 0, 0, 1)"],["columnHeaderCellPaddingBottom",5],["columnHeaderCellPaddingLeft",5],["columnHeaderCellPaddingRight",7],["columnHeaderCellPaddingTop",5],["columnHeaderCellVerticalAlignment","center"],["columnWidth",250],["contextFilterButtonBorder","solid 1px rgba(158, 163, 169, 1)"],["contextFilterButtonBorderRadius","3px"],["contextFilterButtonHTML","▼"],["contextFilterInputBackground","rgba(255,255,255,1)"],["contextFilterInputBorder","solid 1px rgba(158, 163, 169, 1)"],["contextFilterInputBorderRadius","0"],["contextFilterInputColor","rgba(0,0,0,1)"],["contextFilterInputFontFamily","sans-serif"],["contextFilterInputFontSize","14px"],["contextMenuArrowColor","rgba(43, 48, 43, 1)"],["contextMenuArrowDownHTML","▼"],["contextMenuArrowUpHTML","▲"],["contextMenuBackground","rgba(240, 240, 240, 1)"],["contextMenuBorder","solid 1px rgba(158, 163, 169, 1)"],["contextMenuBorderRadius","3px"],["contextMenuChildArrowFontSize","12px"],["contextMenuColor","rgba(43, 48, 43, 1)"],["contextMenuFilterButtonFontFamily","sans-serif"],["contextMenuFilterButtonFontSize","10px"],["contextMenuFilterInvalidExpresion","rgba(237, 155, 156, 1)"],["contextMenuFontFamily","sans-serif"],["contextMenuFontSize","16px"],["contextMenuHoverBackground","rgba(182, 205, 250, 1)"],["contextMenuHoverColor","rgba(43, 48, 153, 1)"],["contextMenuItemBorderRadius","3px"],["contextMenuItemMargin","2px"],["contextMenuLabelDisplay","inline-block"],["contextMenuLabelMargin","0 3px 0 0"],["contextMenuLabelMaxWidth","700px"],["contextMenuLabelMinWidth","75px"],["contextMenuMarginLeft",3],["contextMenuMarginTop",-3],["contextMenuOpacity","0.98"],["contextMenuPadding","2px"],["contextMenuWindowMargin",6],["cornerCellBackgroundColor","rgba(240, 240, 240, 1)"],["cornerCellBorderColor","rgba(202, 202, 202, 1)"],["editCellBackgroundColor","white"],["editCellBorder","solid 1px rgba(110, 168, 255, 1)"],["editCellBoxShadow","0 2px 5px rgba(0,0,0,0.4)"],["editCellColor","black"],["editCellFontFamily","sans-serif"],["editCellFontSize","16px"],["editCellPaddingLeft",4],["gridBorderColor","rgba(202, 202, 202, 1)"],["gridBorderWidth",1],["columnHeaderOrderByArrowBorderColor","rgba(195, 199, 202, 1)"],["columnHeaderOrderByArrowBorderWidth",1],["columnHeaderOrderByArrowColor","rgba(155, 155, 155, 1)"],["columnHeaderOrderByArrowHeight",8],["columnHeaderOrderByArrowMarginLeft",0],["columnHeaderOrderByArrowMarginRight",5],["columnHeaderOrderByArrowMarginTop",6],["columnHeaderOrderByArrowWidth",13],["minColumnWidth",45],["minHeight",24],["minRowHeight",24],["name","default"],["reorderMarkerBackgroundColor","rgba(0, 0, 0, 0.1)"],["reorderMarkerBorderColor","rgba(0, 0, 0, 0.2)"],["reorderMarkerBorderWidth",1.25],["reorderMarkerIndexBorderColor","rgba(66, 133, 244, 1)"],["reorderMarkerIndexBorderWidth",2.75],["rowHeaderCellBackgroundColor","rgba(240, 240, 240, 1)"],["rowHeaderCellBorderColor","rgba(200, 200, 200, 1)"],["rowHeaderCellBorderWidth",1],["rowHeaderCellColor","rgba(50, 50, 50, 1)"],["rowHeaderCellFont","16px sans-serif"],["rowHeaderCellHeight",25],["rowHeaderCellHorizontalAlignment","left"],["rowHeaderCellHoverBackgroundColor","rgba(235, 235, 235, 1)"],["rowHeaderCellHoverColor","rgba(0, 0, 0, 1)"],["rowHeaderCellPaddingBottom",5],["rowHeaderCellPaddingLeft",5],["rowHeaderCellPaddingRight",5],["rowHeaderCellPaddingTop",5],["rowHeaderCellSelectedBackgroundColor","rgba(217, 217, 217, 1)"],["rowHeaderCellSelectedColor","rgba(50, 50, 50, 1)"],["rowHeaderCellVerticalAlignment","center"],["rowHeaderCellWidth",57],["scrollBarActiveColor","rgba(125, 125, 125, 1)"],["scrollBarBackgroundColor","rgba(240, 240, 240, 1)"],["scrollBarBorderColor","rgba(202, 202, 202, 1)"],["scrollBarBorderWidth",.5],["scrollBarBoxBorderRadius",4.125],["scrollBarBoxColor","rgba(192, 192, 192, 1)"],["scrollBarBoxMargin",2],["scrollBarBoxMinSize",15],["scrollBarBoxWidth",8],["scrollBarCornerBackgroundColor","rgba(240, 240, 240, 1)"],["scrollBarCornerBorderColor","rgba(202, 202, 202, 1)"],["scrollBarWidth",11],["selectionOverlayBorderColor","rgba(66, 133, 244, 1)"],["selectionOverlayBorderWidth",.75],["treeArrowBorderColor","rgba(195, 199, 202, 1)"],["treeArrowBorderWidth",1],["treeArrowClickRadius",5],["treeArrowColor","rgba(155, 155, 155, 1)"],["treeArrowHeight",8],["treeArrowMarginLeft",0],["treeArrowMarginRight",5],["treeArrowMarginTop",6],["treeArrowWidth",13],["treeGridHeight",250]]}}}.apply(t,r))&&(e.exports=n)},function(e,t,o){var r,n;r=[],void 0!==(n=function(){"use strict";return function(e){e.endEdit=function(t){function o(){t=!0}var r=e.input.editCell,n=r.rowIndex;if(e.dispatchEvent("beforeendedit",{cell:r,newValue:e.input.value,oldValue:r.value,abort:o,input:e.input}))return!1;if(e.input.value!==r.value&&!t){if(e.changes[n]=e.changes[n]||{},e.changes[n][r.header.name]=e.input.value,r.data[r.header.name]=e.input.value,n===e.data.length){if(e.dispatchEvent("newrow",{value:e.input.value,defaultValue:r.value,aborted:t,cell:r,input:e.input}))return!1;e.uId+=1,e.addRow(r.data),e.createNewRowData()}e.draw(!0)}return document.body.removeChild(e.input),e.controlInput.focus(),e.dispatchEvent("endedit",{cell:r,value:e.input.value,aborted:t,input:e.input}),e.input=void 0,!0},e.beginEditAt=function(t,o){if(e.attributes.editable){var r,n=e.getVisibleCellByIndex(t,o),l=e.getVisibleSchema();if(e.dispatchEvent("beforebeginedit",{cell:n}))return!1;e.scrollIntoView(t,o),e.setActiveCell(t,o),n.header.enum?e.input=document.createElement("select"):e.input=document.createElement(e.attributes.multiLine?"textarea":"input"),function(){var i,s;n=e.getVisibleCellByIndex(t,o),n.header.enum&&("function"==typeof n.header.enum?r=n.header.enum.apply(e.intf,[{cell:n}]):Array.isArray(n.header.enum)&&(r=n.header.enum),r.forEach(function(t){var o,r,l=document.createElement("option");Array.isArray(t)?(o=t[0],r=t[1]):(o=t,r=t),o===n.value&&(s=!0),l.value=o,l.innerHTML=r,e.input.appendChild(l)}),s||(i=document.createElement("option"),i.value=n.value,i.innerHTML=n.value,e.input.appendChild(i)),e.input.addEventListener("change",function(){e.endEdit(),e.draw(!0)})),document.body.appendChild(e.input),e.createInlineStyle(e.input,"canvas-datagrid-edit-input"),e.input.style.position="absolute",e.input.editCell=n,e.resizeEditInput(),e.input.style.zIndex="2",e.input.value=n.value,e.input.focus(),e.input.addEventListener("click",e.stopPropagation),e.input.addEventListener("dblclick",e.stopPropagation),e.input.addEventListener("mouseup",e.stopPropagation),e.input.addEventListener("mousedown",e.stopPropagation),e.input.addEventListener("keydown",function(t){var o=n.columnIndex,r=n.rowIndex;if(27===t.keyCode)e.endEdit(!0),e.draw(!0);else if(13===t.keyCode&&(!e.attributes.multiLine||e.attributes.multiLine&&t.shiftKey))e.endEdit(),e.draw(!0);else if(9===t.keyCode){if(t.preventDefault(),!e.endEdit())return;t.shiftKey?o-=1:o+=1,o<0&&(o=l.length-1,r-=1),o>l.length-1&&(o=0,r+=1),r<0&&(r=e.data.length-1),r>e.data.length-1&&(r=0),e.beginEditAt(o,r)}})}(),e.dispatchEvent("beginedit",{cell:n,input:e.input})}},e.createInlineStyle=function(t,o){var r={"canvas-datagrid-context-menu-filter-input":{height:"19px",verticalAlign:"bottom",marginLeft:"2px",padding:"0",background:e.style.contextFilterInputBackground,color:e.style.contextFilterInputColor,border:e.style.contextFilterInputBorder,borderRadius:e.style.contextFilterInputBorderRadius,lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.contextFilterInputFontFamily,fontSize:e.style.contextFilterInputFontSize},"canvas-datagrid-context-menu-filter-button":{height:"19px",verticalAlign:"bottom",marginLeft:"2px",padding:"0",background:e.style.contextMenuBackground,color:e.style.contextMenuColor,border:e.style.contextFilterButtonBorder,borderRadius:e.style.contextFilterButtonBorderRadius,lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.contextMenuFilterButtonFontFamily,fontSize:e.style.contextMenuFilterButtonFontSize},"canvas-datagrid-context-child-arrow":{cssFloat:"right",color:e.style.childContextMenuArrowColor,fontSize:e.style.contextMenuChildArrowFontSize,fontFamily:e.style.contextMenuFontFamily,verticalAlign:"middle"},"canvas-datagrid-autocomplete":{fontFamily:e.style.contextMenuFontFamily,fontSize:e.style.contextMenuFontSize,background:e.style.contextMenuBackground,color:e.style.contextMenuColor,border:e.style.contextMenuBorder,padding:e.style.contextMenuPadding,borderRadius:e.style.contextMenuBorderRadius,opacity:e.style.contextMenuOpacity,position:"absolute",zIndex:3,overflow:"hidden"},"canvas-datagrid-autocomplete-item":{background:e.style.contextMenuBackground,color:e.style.contextMenuColor},"canvas-datagrid-autocomplete-item:hover":{background:e.style.contextMenuHoverBackground,color:e.style.contextMenuHoverColor},"canvas-datagrid-canvas":{position:"absolute",zIndex:"-1"},"canvas-datagrid":{position:"absolute",background:e.style.backgroundColor,zIndex:"1",boxSizing:"content-box",padding:"0"},"canvas-datagrid-control-input":{position:"fixed",top:"-5px",left:"-5px",border:"none",opacity:"0",cursor:"pointer",width:"1px",height:"1px",lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.contextMenuFontFamily,fontSize:e.style.contextMenuFontSize},"canvas-datagrid-edit-input":{boxSizing:"content-box",outline:"none",margin:"0",padding:"0 0 0 "+e.style.editCellPaddingLeft+"px",lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.editCellFontFamily,fontSize:e.style.editCellFontSize,boxShadow:e.style.editCellBoxShadow,border:e.style.editCellBorder,color:e.style.editCellColor,background:e.style.editCellBackgroundColor,appearance:"none",webkitAppearance:"none",mozAppearance:"none",borderRadius:"0"},"canvas-datagrid-context-menu-item":{lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.contextMenuFontFamily,fontSize:e.style.contextMenuFontSize,color:"inherit",background:"inherit",margin:e.style.contextMenuItemMargin,borderRadius:e.style.contextMenuItemBorderRadius,verticalAlign:"middle"},"canvas-datagrid-context-menu-item:hover":{background:e.style.contextMenuHoverBackground,color:e.style.contextMenuHoverColor},"canvas-datagrid-context-menu-label":{margin:e.style.contextMenuLabelMargin,display:e.style.contextMenuLabelDisplay,minWidth:e.style.contextMenuLabelMinWidth,maxWidth:e.style.contextMenuLabelMaxWidth},"canvas-datagrid-context-menu":{lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.contextMenuFontFamily,fontSize:e.style.contextMenuFontSize,background:e.style.contextMenuBackground,color:e.style.contextMenuColor,border:e.style.contextMenuBorder,padding:e.style.contextMenuPadding,borderRadius:e.style.contextMenuBorderRadius,opacity:e.style.contextMenuOpacity,overflow:"hidden"},"canvas-datagrid-invalid-search-regExp":{background:e.style.contextMenuFilterInvalidExpresion}};r[o]&&Object.keys(r[o]).map(function(e){t.style[e]=r[o][e]})},e.appendTo=function(t){e.parentNode=t,e.height=e.parentNode.offsetHeight,e.width=e.parentNode.offsetWidth,e.parentNode&&/canvas-datagrid-(cell|tree)/.test(e.parentNode.nodeType)?(e.isChildGrid=!0,e.parentGrid=e.parentNode.parentGrid,e.ctx=e.parentGrid.context,e.canvas=e.parentGrid.canvas,e.controlInput=e.parentGrid.controlInput,e.eventParent=e.canvas,e.intf.offsetParent=e.parentNode):(e.controlInput=document.createElement("input"),e.controlInput.onblur=e.intf.blur,e.createInlineStyle(e.controlInput,"canvas-datagrid-control-input"),e.isChildGrid=!1,e.parentDOMNode=e.parentNode,e.parentNode=e.parentDOMNode,e.parentIsCanvas=/canvas/i.test(e.parentDOMNode.tagName),e.parentIsCanvas?e.canvas=e.parentDOMNode:(e.canvas=document.createElement("canvas"),e.parentDOMNode.appendChild(e.canvas)),e.ctx=e.canvas.getContext("2d"),e.ctx.textBaseline="alphabetic",document.body.appendChild(e.controlInput),e.eventParent=e.canvas),e.controlInput.addEventListener("blur",function(t){t.target!==e.canvas&&(e.hasFocus=!1)}),window.addEventListener("resize",e.resize),MutationObserver&&(e.observer=new MutationObserver(function(t){t.forEach(function(t){e.resize(!0)})}),[e.canvas.parentNode].forEach(function(t){e.observer.observe(t,{attributes:!0})})),e.eventParent.addEventListener("scroll",e.resize,!1),e.eventParent.addEventListener("touchstart",e.touchstart,!1),e.eventParent.addEventListener("mouseup",e.mouseup,!1),e.eventParent.addEventListener("mousedown",e.mousedown,!1),e.eventParent.addEventListener("dblclick",e.dblclick,!1),e.eventParent.addEventListener("click",e.click,!1),e.eventParent.addEventListener("mousemove",e.mousemove),e.eventParent.addEventListener("wheel",e.scrollWheel,!1),e.canvas.addEventListener("contextmenu",e.contextmenuEvent,!1),(e.isChildGrid?e.parentGrid:document).addEventListener("copy",e.copy),e.controlInput.addEventListener("keypress",e.keypress,!1),e.controlInput.addEventListener("keyup",e.keyup,!1),e.controlInput.addEventListener("keydown",e.keydown,!1)},e.setDom=function(){e.appendTo(e.args.parentNode)}}}.apply(t,r))&&(e.exports=n)},function(e,t,o){var r,n;r=[],void 0!==(n=function(){"use strict";return function(e){e.integerToAlpha=function(e){for(var t="a".charCodeAt(0),o="z".charCodeAt(0),r=o-t+1,n="";e>=0;)n=String.fromCharCode(e%r+t)+n,e=Math.floor(e/r)-1;return n},e.insertColumn=function(t,o){var r=e.getSchema();if(r.lengthn)throw new Error("Impossible row index");for(;rn.length-1)throw new Error("Impossible column index");for(;r0&&r.y>0&&r.x+r.widtha;a+=1)l(a)}o||r||(e.selections=[],e.activeCell.columnIndex=t,e.activeCell.rowIndex=e.scrollIndexTop),o&&e.isColumnSelected(t)?function(t){e.data.forEach(function(o,r){e.selections[r]=e.selections[r]||[],-1!==e.selections[r].indexOf(t)&&e.selections[r].splice(e.selections[r].indexOf(t),1)})}(t):l(t),n||e.dispatchEvent("selectionchanged",{selectedData:e.getSelectedData(),selections:e.selections,selectionBounds:e.selectionBounds})},e.selectRow=function(t,o,r,n){function l(t){e.selections[t]=[],e.selections[t].push(-1),c.forEach(function(o){e.selections[t].push(o.index)})}var i,s,a,c=e.getSchema();if((!1===e.dragAddToSelection||void 0===e.dragObject)&&e.selections[t]&&e.selections[t].length-1===c.length&&o)return void(e.selections[t]=[]);if(!0===e.dragAddToSelection||void 0===e.dragObject)if(r&&void 0===e.dragObject){if(!e.activeCell)return;for(s=Math.min(e.activeCell.rowIndex,t),a=Math.max(e.activeCell.rowIndex,t),i=s;a>=i;i+=1)l(i)}else l(t);n||e.dispatchEvent("selectionchanged",{selectedData:e.getSelectedData(),selections:e.selections,selectionBounds:e.selectionBounds})},e.collapseTree=function(t){var o=e.data[t][e.uniqueId];e.dispatchEvent("collapsetree",{childGrid:e.childGrids[o],data:e.data[t],rowIndex:t}),e.openChildren[o].blur(),e.openChildren[o].dispose(),delete e.openChildren[o],delete e.sizes.trees[o],delete e.childGrids[o],e.dispatchEvent("resizerow",{cellHeight:e.style.cellHeight}),e.resize(!0),e.draw(!0)},e.expandTree=function(t){var o,r=e.getRowHeaderCellHeight(),n=e.sizes.columns.cornerCell||e.style.rowHeaderCellWidth,l=e.data[t][e.uniqueId],i=e.sizes.trees[l]||e.style.treeGridHeight;e.childGrids[l]||(o=e.createGrid({debug:e.attributes.debug,name:e.attributes.saveAppearance?e.attributes.name+"tree"+l:void 0,parentNode:{parentGrid:e.intf,nodeType:"canvas-datagrid-tree",offsetHeight:i,offsetWidth:e.width-n,header:{width:e.width-n},offsetLeft:n,offsetTop:r,offsetParent:e.intf.parentNode,parentNode:e.intf.parentNode,style:"tree",data:e.data[t]}}),e.childGrids[l]=o),o=e.childGrids[l],o.visible=!0,e.dispatchEvent("expandtree",{treeGrid:o,data:e.data[t],rowIndex:t}),e.openChildren[l]=o,e.sizes.trees[l]=i,e.dispatchEvent("resizerow",{height:e.style.cellHeight}),e.resize(!0)},e.toggleTree=function(t){if(e.openChildren[e.data[t][e.uniqueId]])return e.collapseTree(t);e.expandTree(t)},e.getHeaderByName=function(t){var o,r=e.getSchema();for(o=0;oe.width||t.y<0||t.y>e.height)},e.getVisibleCellByIndex=function(t,o){return e.visibleCells.filter(function(e){return e.columnIndex===t&&e.rowIndex===o})[0]},e.getCellAt=function(t,o,r){var n,l,i=r?e.attributes.touchScrollZone:0,s=e.visibleCells.length;if(e.visibleCells&&e.visibleCells.length){if(e.hasFocus=!0,!(o0&&t0))return e.hasFocus=!1,{dragContext:"inherit",context:"inherit"};for(n=0;nt&&l.y-e.style.cellBorderWidtho)return/vertical-scroll-(bar|box)/.test(l.style)?(l.dragContext="vertical-scroll-box",l.context="vertical-scroll-box",l.isScrollBar=!0,l.isVerticalScrollBar=!0,o>e.scrollBox.box.v.y+e.scrollBox.scrollBoxHeight?(l.dragContext="vertical-scroll-bottom",l.context="vertical-scroll-bottom"):oe.scrollBox.box.h.x+e.scrollBox.scrollBoxWidth?(l.dragContext="horizontal-scroll-right",l.context="horizontal-scroll-right"):tt&&e.attributes.allowColumnResize&&(e.attributes.allowColumnResizeFromCell&&"cell"===l.style||"cell"!==l.style)&&(e.attributes.allowRowHeaderResize&&-1!==["rowHeaderCell","cornerCell"].indexOf(l.style)||-1===["rowHeaderCell","cornerCell"].indexOf(l.style))?(l.context="ew-resize",l.dragContext="ew-resize",l):l.y+l.height-.4*e.attributes.borderResizeZoneo&&e.attributes.allowRowResize&&(e.attributes.allowRowResizeFromCell&&"cell"===l.style||"cell"!==l.style)&&"columnHeaderCell"!==l.style?(l.context="ns-resize",l.dragContext="ns-resize",l):"columnHeaderCell"===l.style?(l.context="cell",l.dragContext="column-reorder",l):"rowHeaderCell"===l.style?(l.context="cell",l.dragContext="row-reorder",l):l.isGrid?(e.hasFocus=!1,l.dragContext="cell-grid",l.context="cell-grid",l):"tree-grid"===l.style?(e.hasFocus=!1,l.dragContext="tree",l.context="tree",l):(l.dragContext="cell",l.context="cell",l);return e.hasFocus=!0,e.canvas.style.cursor="default",{dragContext:"background",context:"background",style:"background",isBackground:!0}}},e.getSelectionBounds=function(){var t={x:1/0,y:1/0},o={x:-1/0,y:-1/0};return e.data.forEach(function(r,n){var l,i;e.selections[n]&&e.selections[n].length&&(t.y=no.y?n:o.y,l=Math.max.apply(null,e.selections[n]),i=Math.min.apply(null,e.selections[n]),t.x=io.x?l:o.x)}),{top:t.y,left:t.x,bottom:o.y,right:o.x}},e.getSchemaFromData=function(){return Object.keys(e.data[0]||{" ":""}).map(function(t,o){var r=e.getBestGuessDataType(t),n={name:t,title:isNaN(parseInt(t,10))?t:e.integerToAlpha(t).toUpperCase(),width:e.style.columnWidth,index:o,type:r,filter:e.filter(r)};return t===e.uniqueId&&(n.hidden=!0),n[e.uniqueId]=e.getSchemaNameHash(t),n})},e.clearChangeLog=function(){e.changes=[]},e.selectArea=function(t,o){e.selectionBounds=t||e.selectionBounds;var r,n,l=e.getSchema();if(o||(e.selections=[]),e.selectionBounds.top<-1||e.selectionBounds.bottom>e.data.length||e.selectionBounds.left<-1||e.selectionBounds.right>l.length)throw new Error("Impossible selection area");for(r=e.selectionBounds.top;r<=e.selectionBounds.bottom;r+=1)for(e.selections[r]=[],n=e.selectionBounds.left;n<=e.selectionBounds.right;n+=1)-1===e.selections[r].indexOf(n)&&e.selections[r].push(n);e.dispatchEvent("selectionchanged",{selectedData:e.getSelectedData(),selections:e.selections,selectionBounds:e.selectionBounds})},e.findColumnMaxTextLength=function(t){var o=-1/0;return"cornerCell"===t?(e.ctx.font=e.style.rowHeaderCellFont,e.ctx.measureText((e.data.length+(e.attributes.showNewRow?1:0)).toString()).width+e.style.autosizePadding+e.style.autosizeHeaderCellPadding+e.style.rowHeaderCellPaddingRight+e.style.rowHeaderCellPaddingLeft+(e.attributes.tree?e.style.treeArrowWidth+e.style.treeArrowMarginLeft+e.style.treeArrowMarginRight:0)):(e.getSchema().forEach(function(r){if(r.name===t){e.ctx.font=e.style.columnHeaderCellFont;var n=e.ctx.measureText(r.title||r.name).width+e.style.headerCellPaddingRight+e.style.headerCellPaddingLeft;o=n>o?n:o}}),e.data.forEach(function(r){e.ctx.font=e.style.cellFont;var n=e.ctx.measureText(r[t]).width+e.style.cellPaddingRight+e.style.cellPaddingLeft+e.style.cellAutoResizePadding;o=n>o?n:o}),o)},e.getHeaderWidth=function(){return e.getVisibleSchema().reduce(function(e,t){return e+t.width},0)},e.formatters.string=function(e){return void 0!==e.cell.value?e.cell.value:""},e.formatters.rowHeaderCell=e.formatters.string,e.formatters.headerCell=e.formatters.string,e.formatters.number=e.formatters.string,e.formatters.int=e.formatters.string,e.formatters.html=e.formatters.string,e.sorters.string=function(e,t){var o="asc"===t;return function(t,r){return void 0===t[e]||null===t[e]?1:void 0===r[e]||null===r[e]?0:o?t[e].localeCompare?t[e].localeCompare(r[e]):1:r[e].localeCompare?r[e].localeCompare(t[e]):1}},e.sorters.number=function(e,t){var o="asc"===t;return function(t,r){return o?t[e]-r[e]:r[e]-t[e]}},e.sorters.date=function(e,t){var o="asc"===t;return function(t,r){return o?new Date(t[e]).getTime()-new Date(r[e]).getTime():new Date(r[e]).getTime()-new Date(t[e]).getTime()}}}}.apply(t,r))&&(e.exports=n)}])}); +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.canvasDatagrid=t():e.canvasDatagrid=t()}(this,function(){return function(e){function t(r){if(o[r])return o[r].exports;var n=o[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var o={};return t.m=e,t.c=o,t.d=function(e,o,r){t.o(e,o)||Object.defineProperty(e,o,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var o=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(o,"a",o),o},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,o){var r,n;r=[o(1),o(2),o(3),o(4),o(5),o(6),o(7)],void 0!==(n=function(){"use strict";function t(e){e=e||{};var r={};return r.args=e,r.createGrid=t,o.forEach(function(e){e(r)}),r.init(),r.intf}var o=Array.prototype.slice.call(arguments);return!window||window.canvasDatagrid||window.require||(window.canvasDatagrid=t),e.exports=t,t}.apply(t,r))&&(e.exports=n)},function(e,t,o){var r,n;r=[],void 0!==(n=function(){"use strict";return function(e){function t(){var t=!0;Object.keys(e.htmlImageCache).forEach(function(o){e.htmlImageCache[o].complete||(t=!1)}),t&&e.draw()}function o(o){var r,n=o.innerHTML||o.formattedValue,l=o.x+e.canvasOffsetLeft,i=o.y+e.canvasOffsetTop;if(e.htmlImageCache[n]){if(r=e.htmlImageCache[n],r.height===o.height&&r.width===o.width){if(!r.complete)return;return e.ctx.drawImage(r,l,i)}e.htmlImageCache[n]=void 0}r=new Image(o.width,o.height),e.htmlImageCache[n]=r,r.onload=function(){e.ctx.drawImage(r,l,i),t()},r.src="data:image/svg+xml;base64,"+btoa('\n\n\n'+n+"\n\n\n")}function r(t,o){return t+=e.canvasOffsetLeft,o+=e.canvasOffsetTop,e.ctx.fillStyle=e.style.columnHeaderOrderByArrowColor,e.ctx.strokeStyle=e.style.columnHeaderOrderByArrowBorderColor,e.ctx.beginPath(),t+=e.style.columnHeaderOrderByArrowMarginLeft,o+=e.style.columnHeaderOrderByArrowMarginTop,"asc"===e.orderDirection?(e.ctx.moveTo(t,o),e.ctx.lineTo(t+e.style.columnHeaderOrderByArrowWidth,o),e.ctx.lineTo(t+.5*e.style.columnHeaderOrderByArrowWidth,o+e.style.columnHeaderOrderByArrowHeight),e.ctx.moveTo(t,o)):(e.ctx.lineTo(t,o+e.style.columnHeaderOrderByArrowHeight),e.ctx.lineTo(t+e.style.columnHeaderOrderByArrowWidth,o+e.style.columnHeaderOrderByArrowHeight),e.ctx.lineTo(t+.5*e.style.columnHeaderOrderByArrowWidth,o),e.ctx.lineTo(t,o+e.style.columnHeaderOrderByArrowHeight)),e.ctx.stroke(),e.ctx.fill(),e.style.columnHeaderOrderByArrowMarginLeft+e.style.columnHeaderOrderByArrowWidth+e.style.columnHeaderOrderByArrowMarginRight}function n(t,o,r){return o+=e.canvasOffsetLeft,r+=e.canvasOffsetTop,e.ctx.fillStyle=e.style.treeArrowColor,e.ctx.strokeStyle=e.style.treeArrowBorderColor,e.ctx.beginPath(),o+=e.style.treeArrowMarginLeft,r+=e.style.treeArrowMarginTop,e.openChildren[t.data[e.uniqueId]]?(e.ctx.moveTo(o,r),e.ctx.lineTo(o+e.style.treeArrowWidth,r),e.ctx.lineTo(o+.5*e.style.treeArrowWidth,r+e.style.treeArrowHeight),e.ctx.moveTo(o,r)):(e.ctx.lineTo(o,r),e.ctx.lineTo(o+e.style.treeArrowHeight,r+.5*e.style.treeArrowWidth),e.ctx.lineTo(o,r+e.style.treeArrowWidth),e.ctx.lineTo(o,r)),e.ctx.stroke(),e.ctx.fill(),e.style.treeArrowMarginLeft+e.style.treeArrowWidth+e.style.treeArrowMarginRight}function l(t,o,r,n,l){t+=e.canvasOffsetLeft,o+=e.canvasOffsetTop;var i=t+r,s=o+n;e.ctx.beginPath(),e.ctx.moveTo(t+l,o),e.ctx.lineTo(i-l,o),e.ctx.quadraticCurveTo(i,o,i,o+l),e.ctx.lineTo(i,o+n-l),e.ctx.quadraticCurveTo(i,s,i-l,s),e.ctx.lineTo(t+l,s),e.ctx.quadraticCurveTo(t,s,t,s-l),e.ctx.lineTo(t,o+l),e.ctx.quadraticCurveTo(t,o,t+l,o)}function i(t,o,r,n){t+=e.canvasOffsetLeft,o+=e.canvasOffsetTop,e.ctx.fillRect(t,o,r,n)}function s(t,o,r,n){t+=e.canvasOffsetLeft,o+=e.canvasOffsetTop,e.ctx.strokeRect(t,o,r,n)}function a(t,o,r){o+=e.canvasOffsetLeft,r+=e.canvasOffsetTop,e.ctx.fillText(t,o,r)}function c(t,o){e.ctx.beginPath(),{t:function(){e.ctx.moveTo(t.x+e.canvasOffsetLeft,t.y+e.canvasOffsetTop),e.ctx.lineTo(t.x+e.canvasOffsetLeft+t.width,t.y+e.canvasOffsetTop)},r:function(){e.ctx.moveTo(t.x+e.canvasOffsetLeft+t.width,t.y+e.canvasOffsetTop),e.ctx.lineTo(t.x+e.canvasOffsetLeft+t.width,t.y+e.canvasOffsetTop+t.height)},b:function(){e.ctx.moveTo(t.x+e.canvasOffsetLeft,t.y+e.canvasOffsetTop+t.height),e.ctx.lineTo(t.x+e.canvasOffsetLeft+t.width,t.y+e.canvasOffsetTop+t.height)},l:function(){e.ctx.moveTo(t.x+e.canvasOffsetLeft,t.y+e.canvasOffsetTop),e.ctx.lineTo(t.x+e.canvasOffsetLeft,t.y+e.canvasOffsetTop+t.height)}}[o](),e.ctx.stroke()}function d(t,o){var r,n=0;return e.ellipsisCache[t]&&e.ellipsisCache[t][o]?e.ellipsisCache[t][o]:(n=e.ctx.measureText(t).width,e.ellipsisCache[t]=e.ellipsisCache[t]||{},r={value:t,width:n},e.ellipsisCache[t][o]=r,r)}function u(t){var o=e.style[t.style+"PaddingLeft"],r=e.style[t.style+"PaddingTop"],n=e.style[t.style+"PaddingRight"],l=e.style[t.style+"PaddingBottom"],i=r+t.height-.5*t.height,s=o+t.treeArrowWidth+t.orderByArrowWidth;t.text=d(t.formattedValue,t.width-n-o),t.text.height=t.fontHeight,"right"===t.horizontalAlignment?s=t.width-t.text.width-n:"center"===t.horizontalAlignment&&(s=t.width/2-t.text.width/2),"top"===t.verticalAlignment?i=r+t.text.height:"bottom"===t.verticalAlignment&&(i=t.height-l-t.text.height),t.text.x=t.x+s,t.text.y=t.y+i,a(t.text.value,t.text.x,t.text.y)}var h=[],f=0,g=20;e.htmlImageCache={},e.draw=function(t){function d(t,a,c){return function(d,h,f){var g,x,p,y=d.style||"cell",v=/HeaderCell/.test(y),b=/cornerCell/.test(y),S="rowHeaderCell"===y,T="columnHeaderCell"===y,O=e.selections[c]&&-1!==e.selections[c].indexOf(f),z=e.hovers[t[e.uniqueId]]&&-1!==e.hovers[t[e.uniqueId]].indexOf(f),P=e.activeCell.rowIndex===c&&e.activeCell.columnIndex===f,W="object"==typeof t[d.name]&&null!==t[d.name]&&void 0!==t[d.name],F=!(e.orders.rows[e.activeCell.rowIndex]!==c&&e.orders.columns[e.activeCell.columnIndex]!==f||-1!==f&&-1!==c)&&(S?"activeRowHeaderCell":"activeColumnHeaderCell"),D=e.formatters[d.type||"string"],j=0,G=0,q=e.sizes.columns[S?"cornerCell":d[e.uniqueId]]||d.width,V={value:t[d.name],row:t,header:d};if("headerCellCap"===y&&(q=L-M),void 0===q&&(q=e.style.columnWidth),M+q+e.style.cellBorderWidth<0&&(M+=q+e.style.cellBorderWidth),P&&(y="activeCell"),-1!==e.visibleRows.indexOf(a)||v||e.visibleRows.push(a),p=e.dispatchEvent("formatcellvalue",V),!e.dispatchEvent("beforerendercell",V))return w=M,C=H,"cornerCell"===y?(w=0,C=0):S?w=0:v&&(C=0),x={type:W?"canvas-datagrid-cell":d.type,style:y,nodeType:"canvas-datagrid-cell",x:w,y:C,horizontalAlignment:e.style[y+"HorizontalAlignment"],verticalAlignment:e.style[y+"VerticalAlignment"],offsetTop:e.canvasOffsetTop+C,offsetLeft:e.canvasOffsetLeft+w,scrollTop:e.scrollBox.scrollTop,scrollLeft:e.scrollBox.scrollLeft,active:P||F,hovered:z,selected:O,width:q,height:N,offsetWidth:q,offsetHeight:N,parentNode:e.intf.parentNode,offsetParent:e.intf.parentNode,data:t,isCorner:b,isHeader:v,isColumnHeader:T,isHeaderCellCap:!!d.isHeaderCellCap,isRowHeader:S,rowOpen:B,header:d,columnIndex:f,rowIndex:c,sortColumnIndex:h,sortRowIndex:a,isGrid:W,gridId:(e.attributes.name||"")+t[e.uniqueId]+":"+d[e.uniqueId],parentGrid:e.intf,innerHTML:"",activeHeader:F,value:v&&!S?d.title||d.name:t[d.name]},V.cell=x,x.userHeight=x.isHeader?e.sizes.rows[-1]:I,x.userWidth=x.isHeader?e.sizes.columns.cornerCell:e.sizes.columns[d[e.uniqueId]],x[e.uniqueId]=t[e.uniqueId],e.visibleCells.unshift(x),e.ctx.fillStyle=e.style[y+"BackgroundColor"],e.ctx.strokeStyle=e.style[y+"BorderColor"],e.ctx.lineWidth=e.style[y+"BorderWidth"],z&&(e.ctx.fillStyle=e.style[y+"HoverBackgroundColor"],e.ctx.strokeStyle=e.style[y+"HoverBorderColor"]),O&&(e.ctx.fillStyle=e.style[y+"SelectedBackgroundColor"],e.ctx.strokeStyle=e.style[y+"SelectedBorderColor"]),F&&(e.ctx.fillStyle=e.style[F+"BackgroundColor"]),e.dispatchEvent("rendercell",V),x.isGrid&&(x.height!==I&&(x.height=I||e.style.cellHeightWithChildGrid,m=!0),x.width=e.sizes.columns[d[e.uniqueId]]||e.style.cellWidthWithChildGrid),B&&!x.isRowHeader&&(x.height=e.sizes.rows[A[e.uniqueId]]||e.style.cellHeight),x.isGrid||(i(w,C,x.width,x.height),s(w,C,x.width,x.height)),e.ctx.save(),l(x.x,x.y,x.width,x.height,0),e.ctx.clip(),e.dispatchEvent("afterrendercell",V),x.height===N||B&&!x.isRowHeader||(e.sizes.rows[v?-1:t[e.uniqueId]]=x.height,m=!0),x.width!==q&&(e.sizes.columns[d[e.uniqueId]]=x.width,m=!0),S&&e.attributes.tree&&(e.dispatchEvent("rendertreearrow",V)||(G=n(x,e.style[y+"PaddingLeft"],C,0))),(e.attributes.showRowNumbers&&S||!S)&&(x.isGrid?(e.childGrids[x.gridId]||(g=e.args.childGridAttributes||e.args,g.name=e.attributes.saveAppearance?x.gridId:void 0,g.parentNode=x,g.data=t[d.name],e.childGrids[x.gridId]=e.createGrid(g),e.sizes.rows[A[e.uniqueId]]=e.sizes.rows[A[e.uniqueId]]||e.style.cellGridHeight,m=!0),x.grid=e.childGrids[x.gridId],x.grid.parentNode=x,x.grid.visible=!0,x.grid.draw(),e.dispatchEvent("rendercellgrid",V)):(e.childGrids[x.gridId]&&(e.childGrids[x.gridId].parentNode.offsetHeight=0),v&&e.orderBy===d.name&&(e.dispatchEvent("renderorderbyarrow",V)||(j=r(w+e.style[y+"PaddingLeft"],0))),e.ctx.fillStyle=e.style[y+"Color"],z&&(e.ctx.fillStyle=e.style[y+"HoverColor"]),O&&(e.ctx.fillStyle=e.style[y+"SelectedColor"]),F&&(e.ctx.fillStyle=e.style[F+"Color"]),e.ctx.font=e.style[y+"Font"],x.fontHeight=e.style[y+"FontHeight"],x.treeArrowWidth=G,x.orderByArrowWidth=j,p=void 0!==p?p:D?D(V):"",void 0!==p||D||(p="",console.warn("canvas-datagrid: Unknown format "+d.type+" add a cellFormater")),x.formattedValue=(void 0!==p&&null!==p?p:"").toString(),e.columnFilters&&void 0!==e.columnFilters[p]&&v&&(x.formattedValue=e.attributes.filterTextPrefix+p),e.dispatchEvent("rendertext",V)||(x.innerHTML||"html"===d.type?o(x):u(x)))),P&&(k=x),O&&!S&&(e.selections[x.rowIndex-1]&&-1!==e.selections[x.rowIndex-1].indexOf(x.columnIndex)&&0!==x.rowIndex||x.isHeader||R.push([x,"t"]),e.selections[x.rowIndex+1]&&-1!==e.selections[x.rowIndex+1].indexOf(x.columnIndex)||R.push([x,"b"]),e.selections[x.rowIndex]&&0!==x.columnIndex&&-1!==e.selections[x.rowIndex].indexOf(x.columnIndex-1)||R.push([x,"l"]),e.selections[x.rowIndex]&&x.columnIndex!==E.length&&-1!==e.selections[x.rowIndex].indexOf(x.columnIndex+1)||R.push([x,"r"])),e.ctx.restore(),M+=x.width+e.style.cellBorderWidth,x.width}}function x(t,o,r){var n;e.attributes.showRowHeaders&&(M=0,y={rowHeaderCell:o+1},y[e.uniqueId]=t[e.uniqueId],n={name:"rowHeaderCell",width:e.style.rowHeaderCellWidth,style:"rowHeaderCell",type:"string",data:t[e.uniqueId],index:-1},n[e.uniqueId]=t[e.uniqueId],B=e.openChildren[t[e.uniqueId]],d(y,o,r)(n,-1,-1))}function p(t,o){var r,n,l,i,s=E.length;if(H-2*N>O)return!1;if(A=e.data[t],B=e.openChildren[A[e.uniqueId]],l=e.sizes.rows[A[e.uniqueId]]||e.style.cellHeight,n=B?e.sizes.trees[A[e.uniqueId]]:0,I=l+n,H<-1*I)return!1;for(e.attributes.showRowHeaders&&(M+=j),N=I,i=e.scrollIndexLeft;ie.width));i+=1);return N=I,M=-1*e.scrollBox.scrollLeft+e.scrollPixelLeft+e.style.cellBorderWidth,b=e.childGrids[A[e.uniqueId]],t!==e.data.length&&B?(b.visible=!0,b.parentNode={offsetTop:H+l+e.canvasOffsetTop,offsetLeft:j-1+e.canvasOffsetLeft,offsetHeight:n,offsetWidth:e.width-j-e.style.scrollBarWidth-1,offsetParent:e.intf.parentNode,parentNode:e.intf.parentNode,style:e.style,nodeType:"canvas-datagrid-tree",scrollTop:e.scrollBox.scrollTop,scrollLeft:e.scrollBox.scrollLeft,rowIndex:t},e.visibleCells.unshift({rowIndex:M,columnIndex:0,y:b.parentNode.offsetTop,x:b.parentNode.offsetLeft,height:b.parentNode.offsetHeight,width:b.parentNode.offsetWidth,style:"tree-grid",type:b.parentNode.nodeType}),b.draw()):b&&(b.parentNode.offsetHeight=0,delete e.sizes.trees[A[e.uniqueId]]),P.push([A,t,o,H,I]),H+=N+e.style.cellBorderWidth,!0}if(!e.dispatchEvent("beforedraw",{})&&(e.isChildGrid||e.height&&e.width)){if(e.isChildGrid&&t)return void requestAnimationFrame(e.parentGrid.draw);if(!1!==e.intf.visible){var m,y,v,w,C,b,B,I,S,H,M,T,O,L,E,z,A,k,R=[],P=[],W=e.data.length,F=e.currentCell||{},D=e.getRowHeaderCellHeight(),j=e.getColumnHeaderCellWidth(),N=e.style.cellHeight;f+=1,v=performance.now(),e.data.length>e.orders.rows.length&&e.createRowOrders(),e.ctx.save(),function(){e.visibleRows=[],E=e.getVisibleSchema(),e.visibleCells=[],e.canvasOffsetTop=e.isChildGrid?e.parentNode.offsetTop:0,e.canvasOffsetLeft=e.isChildGrid?e.parentNode.offsetLeft:0,O=e.height,L=e.width,e.isChildGrid||e.ctx.scale(window.devicePixelRatio,window.devicePixelRatio)}(),function(){l(0,0,L,O,0),e.ctx.clip(),e.ctx.fillStyle=e.style.backgroundColor,i(0,0,L,O)}(),function(){var t,o,r,n=E.length;for(M=-1*e.scrollBox.scrollLeft+e.scrollPixelLeft+e.style.cellBorderWidth,H=-1*e.scrollBox.scrollTop+D+e.scrollPixelTop+e.style.cellBorderWidth,z=e.scrollIndexTop;ze.width+e.scrollBox.scrollLeft));t+=1);P.push([e.newRow,e.data.length,e.data.length,H,I])}}(),function(){e.ctx.lineWidth=e.style.selectionOverlayBorderWidth,e.ctx.strokeStyle=e.style.selectionOverlayBorderColor,R.forEach(function(e){c(e[0],e[1])})}(),function(){k&&(e.attributes.rowSelectionMode?e.activeCell&&e.activeCell.rowIndex===k.rowIndex&&(e.ctx.lineWidth=e.style.activeCellOverlayBorderWidth,e.ctx.strokeStyle=e.style.activeCellOverlayBorderColor,s(0,k.y,e.getHeaderWidth()+j,I)):(e.ctx.lineWidth=e.style.activeCellOverlayBorderWidth,e.ctx.strokeStyle=e.style.activeCellOverlayBorderColor,s(k.x,k.y,k.width,k.height)))}(),function(){var t,o,r,n,l,i=E.length;if(P.forEach(function(e){H=e[3],N=e[4],x(e[0],e[1],e[2])}),e.attributes.showColumnHeaders){for(M=-1*e.scrollBox.scrollLeft+e.scrollPixelLeft,e.attributes.showRowHeaders&&(M+=j),H=0,N=e.getRowHeaderCellHeight(),r=e.scrollIndexLeft;re.width+e.scrollBox.scrollLeft));r+=1);M1||e.touchHaltAnimation||a>1e3)return a=0,e.touchHaltAnimation=!1,void(o={scrollLeft:-1,scrollTop:-1});a+=1,r=e.easing(l,t.scrollLeft,-o.scrollLeft,s),n=e.easing(l,t.scrollTop,-o.scrollTop,s),e.scrollBox.scrollTo(r,n),requestAnimationFrame(e.touchEndAnimation)},e.touchend=function(r){if(!e.dispatchEvent("touchend",{NativeEvent:r})){var c=Math.abs(t.x)+Math.abs(t.y)0&&(e.scrollIndexLeft=Math.max(e.scrollIndexLeft-1,0),e.scrollPixelLeft=Math.max(e.scrollPixelLeft-(e.sizes.columns[r[e.scrollIndexLeft][e.uniqueId]]||r[e.scrollIndexLeft].width),0),e.scrollIndexTop=Math.max(e.scrollIndexTop-1,0),e.scrollPixelTop=Math.max(e.scrollPixelTop-(e.sizes.rows[e.data[e.scrollIndexTop][e.uniqueId]]||e.style.cellHeight)-(e.sizes.trees[e.data[e.scrollIndexTop][e.uniqueId]]||0),0)),e.ellipsisCache={},o||e.draw(!0),requestAnimationFrame(e.resizeEditInput),e.dispatchEvent("scroll",{top:e.scrollBox.scrollTop,left:e.scrollBox.scrollLeft})},e.mousemove=function(t,o){if(!e.contextMenu&&!e.input){e.mouse=o||e.getLayerPos(t);var r,n,l,i,s=t.controlKey||t.metaKey||e.attributes.persistantSelectionMode,a=e.getSchema(),c=e.mouse.x,d=e.mouse.y,u=e.getCellAt(c,d),h={NativeEvent:t,cell:u,x:c,y:d},f=e.currentCell;if(clearTimeout(e.scrollTimer),e.isInGrid({x:c,y:d})||(e.hasFocus=!1),!e.dispatchEvent("mousemove",h)&&(u&&e.currentCell&&(e.currentCell.rowIndex!==u.rowIndex||e.currentCell.columnIndex!==u.columnIndex)&&(e.cellBoundaryCrossed=!0,h.cell=f,e.dispatchEvent("cellmouseout",h),h.cell=u,e.dispatchEvent("cellmouseover",h)),e.currentCell=u,e.hasFocus)){if(e.hovers={},!e.draggingItem&&u&&-1===e.scrollModes.indexOf(u.context)&&(e.dragItem=u,e.dragMode=u.dragContext,e.canvas.style.cursor=u.context,"cell"===u.context&&u.data&&(e.canvas.style.cursor="pointer",e.hovers[u.data[e.uniqueId]]=[u.columnIndex]),(e.selecting||e.reorderObject)&&"cell"===u.context&&u.data)){if(l=e.getSelectionBounds(),i={x:Math.abs(e.dragStart.x-c),y:Math.abs(e.dragStart.y-d)},-1!==e.dragStartObject.columnIndex&&t.shiftKey&&(e.dragStartObject={rowIndex:e.activeCell.rowIndex,columnIndex:e.activeCell.columnIndex}),n={top:Math.min(e.dragStartObject.rowIndex,u.rowIndex),left:Math.min(e.dragStartObject.columnIndex,u.columnIndex),bottom:Math.max(e.dragStartObject.rowIndex,u.rowIndex),right:Math.max(e.dragStartObject.columnIndex,u.columnIndex)},-1===e.dragStartObject.columnIndex&&(n.left=-1,n.right=a.length-1,n.top=Math.min(l.top,u.rowIndex),n.bottom=Math.max(l.bottom,u.rowIndex)),e.dragStartObject.rowIndex===u.rowIndex&&e.dragStartObject.columnIndex===u.columnIndex||(e.ignoreNextClick=!0),(e.cellBoundaryCrossed||0===i.x&&0===i.y||e.attributes.rowSelectionMode)&&(e.attributes.rowSelectionMode||-1===e.dragStartObject.columnIndex?e.selectRow(u.rowIndex,s,null,!0):e.dragAddToSelection||void 0===u.rowIndex?(e.selections[u.rowIndex]=e.selections[u.rowIndex]||[],-1===e.selections[u.rowIndex].indexOf(u.columnIndex)&&e.selections[u.rowIndex].push(u.columnIndex)):e.selections[u.rowIndex]&&-1!==e.selections[u.rowIndex].indexOf(u.columnIndex)&&e.selections[u.rowIndex].splice(e.selections[u.rowIndex].indexOf(u.columnIndex),1)),!(e.selectionBounds&&n.top===e.selectionBounds.top&&n.left===e.selectionBounds.left&&n.bottom===e.selectionBounds.bottom&&n.right===e.selectionBounds.right||s))if(e.selections=[],l=n,e.attributes.rowSelectionMode)for(r=l.top;r<=l.bottom;r+=1)e.selectRow(r,!0,null,!0);else e.selectArea(l,!0);e.autoScrollZone(t,c,d,s)}e.cellBoundaryCrossed=!1,e.draw(!0)}}},e.click=function(t,o){function r(){l&&e.dispatchEvent("selectionchanged",{selectedData:e.getSelectedData(),selections:e.selections,selectionBounds:e.selectionBounds})}var n,l,i=t.controlKey||t.metaKey||e.attributes.persistantSelectionMode,s=o||e.getLayerPos(t);if(e.currentCell=e.getCellAt(s.x,s.y),void 0===e.currentCell.grid){if(e.input&&e.endEdit(),e.ignoreNextClick)return void(e.ignoreNextClick=!1);if(n=e.currentCell,!e.dispatchEvent("click",{NativeEvent:t,cell:e.currentCell})&&e.hasFocus){if("cell"===e.currentCell.context){if("cornerCell"===e.currentCell.style)return e.order(e.uniqueId,"asc",e.sorters.number),e.setFilter(),void r();if("columnHeaderCell"===e.currentCell.style){if("sort"===e.attributes.columnHeaderClickBehavior)return e.orderBy===n.header.name?e.orderDirection="asc"===e.orderDirection?"desc":"asc":e.orderDirection="asc",e.order(n.header.name,e.orderDirection),void r();if("select"===e.attributes.columnHeaderClickBehavior)return e.selectColumn(n.header.index,i,t.shiftKey,!0),r(),void e.draw()}if(-1!==["rowHeaderCell","columnHeaderCell"].indexOf(e.currentCell.style)||i||e.setActiveCell(n.columnIndex,n.rowIndex),e.selections[n.rowIndex]=e.selections[n.rowIndex]||[],e.attributes.rowSelectionMode||"rowHeaderCell"===e.currentCell.style){if("rowHeaderCell"===e.currentCell.style&&e.attributes.tree&&s.x>0&&s.x-e.currentCell.x0)return void e.toggleTree(n.rowIndex);l=!0,e.selectRow(n.rowIndex,i,null,!0)}t.shiftKey&&!i&&(e.selectionBounds=e.getSelectionBounds(),e.selectArea(void 0,!1))}r(),e.draw(!0)}}},e.dragResizeColumn=function(t){var o,r,n;return o=e.getLayerPos(t),r=e.resizingStartingWidth+o.x-e.dragStart.x,n=e.resizingStartingHeight+o.y-e.dragStart.y,re.scrollBox.scrollWidth-e.attributes.resizeScrollZone&&"ew-resize"===e.dragMode&&(e.resize(!0),e.scrollBox.scrollLeft+=r),"ew-resize"===e.dragMode?(e.sizes.columns["rowHeaderCell"===e.draggingItem.header.style?"cornerCell":e.draggingItem.header[e.uniqueId]]=r,-1!==["rowHeaderCell","cornerCell"].indexOf(e.draggingItem.header.style)&&e.resize(!0),void e.resizeChildGrids()):"ns-resize"===e.dragMode?(e.draggingItem.rowOpen?e.sizes.trees[e.draggingItem.data[e.uniqueId]]=n:e.attributes.globalRowResize?e.style.cellHeight=n:e.sizes.rows[e.draggingItem.data[e.uniqueId]]=n,e.dispatchEvent("resizerow",{row:n}),void e.resizeChildGrids()):void(e.ellipsisCache={}))},e.stopDragResize=function(){e.resize(),document.body.removeEventListener("mousemove",e.dragResizeColumn,!1),document.body.removeEventListener("mouseup",e.stopDragResize,!1),e.setStorageData(),e.draw(!0),e.ignoreNextClick=!0},e.scrollGrid=function(t){var o=e.getLayerPos(t);return e.attributes.scrollPointerLock&&e.pointerLockPosition&&-1!==["horizontal-scroll-box","vertical-scroll-box"].indexOf(e.scrollStartMode)&&(e.pointerLockPosition.x+=t.movementX,e.pointerLockPosition.y+=t.movementY,o=e.pointerLockPosition),e.scrollMode=e.getCellAt(o.x,o.y).context,"horizontal-scroll-box"===e.scrollMode&&"horizontal-scroll-box"!==e.scrollStartMode?(e.scrollStartMode="horizontal-scroll-box",e.dragStart=o,e.scrollStart.left=e.scrollBox.scrollLeft,void clearTimeout(e.scrollTimer)):"vertical-scroll-box"===e.scrollMode&&"vertical-scroll-box"!==e.scrollStartMode?(e.scrollStartMode="vertical-scroll-box",e.dragStart=o,e.scrollStart.top=e.scrollBox.scrollTop,void clearTimeout(e.scrollTimer)):("vertical-scroll-box"===e.scrollStartMode&&"vertical-scroll-box"!==e.scrollMode&&(e.scrollMode="vertical-scroll-box"),"horizontal-scroll-box"===e.scrollStartMode&&"horizontal-scroll-box"!==e.scrollMode&&(e.scrollMode="horizontal-scroll-box"),clearTimeout(e.scrollTimer),void(-1!==e.scrollModes.indexOf(e.scrollMode)&&("vertical-scroll-box"===e.scrollMode?e.scrollBox.scrollTop=e.scrollStart.top+(o.y-e.dragStart.y)/e.scrollBox.heightBoxRatio:"vertical-scroll-top"===e.scrollMode?(e.scrollBox.scrollTop-=e.page*e.style.cellHeight,e.scrollTimer=setTimeout(e.scrollGrid,e.attributes.scrollRepeatRate,t)):"vertical-scroll-bottom"===e.scrollMode&&(e.scrollBox.scrollTop+=e.page*e.style.cellHeight,e.scrollTimer=setTimeout(e.scrollGrid,e.attributes.scrollRepeatRate,t)),"horizontal-scroll-box"===e.scrollMode?e.scrollBox.scrollLeft=e.scrollStart.left+(o.x-e.dragStart.x)/e.scrollBox.widthBoxRatio:"horizontal-scroll-right"===e.scrollMode?(e.scrollBox.scrollLeft+=e.attributes.selectionScrollIncrement,e.scrollTimer=setTimeout(e.scrollGrid,e.attributes.scrollRepeatRate,t)):"horizontal-scroll-left"===e.scrollMode&&(e.scrollBox.scrollLeft-=e.attributes.selectionScrollIncrement,e.scrollTimer=setTimeout(e.scrollGrid,e.attributes.scrollRepeatRate,t)))))},e.stopScrollGrid=function(){clearTimeout(e.scrollTimer),document.exitPointerLock&&document.exitPointerLock(),document.body.removeEventListener("mousemove",e.scrollGrid,!1)},e.dragReorder=function(t){var o,r,n;o=e.getLayerPos(t),r=o.x-e.dragStart.x,n=o.y-e.dragStart.y,(e.attributes.allowColumnReordering||"column-reorder"!==e.dragMode)&&(e.attributes.allowRowReordering||"row-reorder"!==e.dragMode)&&(e.dispatchEvent("reordering",{NativeEvent:t,source:e.dragStartObject,target:e.currentCell,dragMode:e.dragMode})||(Math.abs(r)>e.attributes.reorderDeadZone||Math.abs(n)>e.attributes.reorderDeadZone)&&(e.reorderObject=e.dragStartObject,e.reorderTarget=e.currentCell,e.reorderObject.dragOffset={x:r,y:n},e.autoScrollZone(t,o.x,o.x,!1)))},e.stopDragReorder=function(t){var o={"row-reorder":e.orders.rows,"column-reorder":e.orders.columns},r={"row-reorder":"rowIndex","column-reorder":"columnIndex"}[e.dragMode];document.body.removeEventListener("mousemove",e.dragReorder,!1),document.body.removeEventListener("mouseup",e.stopDragReorder,!1),e.reorderObject&&e.reorderTarget&&(e.ignoreNextClick=!0,e.reorderObject[r]===e.reorderTarget[r]||e.dispatchEvent("reorder",{NativeEvent:t,source:e.reorderObject,target:e.reorderTarget,dragMode:e.dragMode})||(o[e.dragMode].splice(o[e.dragMode].indexOf(e.reorderObject[r]),1),o[e.dragMode].splice(o[e.dragMode].indexOf(e.reorderTarget[r]),0,e.reorderObject[r]),e.setStorageData())),e.reorderObject=void 0,e.reorderTarget=void 0,e.draw(!0)},e.mousedown=function(t,o){if(e.lastMouseDownTarget=t.target,!e.dispatchEvent("mousedown",{NativeEvent:t,cell:e.currentCell})&&e.hasFocus&&2!==t.button&&!e.input){var r=t.controlKey||t.metaKey;if(e.dragStart=o||e.getLayerPos(t),e.scrollStart={left:e.scrollBox.scrollLeft,top:e.scrollBox.scrollTop},e.dragStartObject=e.getCellAt(e.dragStart.x,e.dragStart.y),e.dragAddToSelection=!e.dragStartObject.selected,r||t.shiftKey||/(vertical|horizontal)-scroll-(bar|box)/.test(e.dragStartObject.context)||e.currentCell.isColumnHeader||(e.selections=[]),!e.dragStartObject.isGrid){if(-1!==e.scrollModes.indexOf(e.dragStartObject.context))return e.scrollMode=e.dragStartObject.context,e.scrollStartMode=e.dragStartObject.context,e.scrollGrid(t),e.attributes.scrollPointerLock&&-1!==["horizontal-scroll-box","vertical-scroll-box"].indexOf(e.scrollStartMode)&&(e.pointerLockPosition={x:e.dragStart.x,y:e.dragStart.y},e.canvas.requestPointerLock()),document.body.addEventListener("mousemove",e.scrollGrid,!1),document.body.addEventListener("mouseup",e.stopScrollGrid,!1),void(e.ignoreNextClick=!0);if("cell"===e.dragMode)return e.selecting=!0,e.attributes.rowSelectionMode&&e.selectRow(e.dragStartObject.rowIndex,r,null,!0),e.mousemove(t);-1!==["ns-resize","ew-resize"].indexOf(e.dragMode)&&(e.draggingItem=e.dragItem,e.draggingItem.rowOpen?e.resizingStartingHeight=e.sizes.trees[e.draggingItem.data[e.uniqueId]]:e.resizingStartingHeight=e.sizes.rows[e.draggingItem.data[e.uniqueId]]||e.style.cellHeight,e.resizingStartingWidth=e.sizes.columns["rowHeaderCell"===e.draggingItem.header.style?"cornerCell":e.draggingItem.header[e.uniqueId]]||e.draggingItem.header.width,document.body.addEventListener("mousemove",e.dragResizeColumn,!1),document.body.addEventListener("mouseup",e.stopDragResize,!1)),-1!==["row-reorder","column-reorder"].indexOf(e.dragMode)&&(e.draggingItem=e.dragItem,document.body.addEventListener("mousemove",e.dragReorder,!1),document.body.addEventListener("mouseup",e.stopDragReorder,!1))}}},e.mouseup=function(t){clearTimeout(e.scrollTimer),e.cellBoundaryCrossed=!0,e.selecting=void 0,e.draggingItem=void 0,e.dragStartObject=void 0,e.dispatchEvent("mouseup",{NativeEvent:t,cell:e.currentCell})||(e.hasFocus||t.target===e.canvas)&&(e.currentCell&&void 0!==e.currentCell.grid||e.contextMenu||e.input||(e.dragStart&&e.isInGrid(e.dragStart)&&e.controlInput.focus(),t.preventDefault()))},e.keydown=function(t){var o,r=e.activeCell.columnIndex,n=e.activeCell.rowIndex,l=t.controlKey||t.metaKey,i=e.data.length-1,s=e.getVisibleSchema().length-1;if(!e.dispatchEvent("keydown",{NativeEvent:t,cell:e.currentCell})&&e.hasFocus){if(e.page=e.visibleRows.length-3-e.attributes.pageUpDownOverlap,e.attributes.showNewRow&&(i+=1),9===t.keyCode&&t.preventDefault(),l&&65===t.keyCode?e.selectAll():40===t.keyCode?n+=1:38===t.keyCode?n-=1:37===t.keyCode||t.shiftKey&&9===t.keyCode?r-=1:39===t.keyCode||!t.shiftKey&&9===t.keyCode?r+=1:33===t.keyCode?(n-=e.page,t.preventDefault()):34===t.keyCode?(n+=e.page,t.preventDefault()):36===t.keyCode||l&&38===t.keyCode?n=0:35===t.keyCode||l&&40===t.keyCode?n=e.data.length-1:l&&39===t.keyCode?r=s:l&&37===t.keyCode&&(r=0),13===t.keyCode)return e.beginEditAt(r,n);if(32===t.keyCode){if(e.selections=[],e.selections[Math.max(n,0)]=[],e.selections[Math.max(n,0)].push(r),e.selectionBounds=e.getSelectionBounds(),e.attributes.rowSelectionMode)for(o=e.selectionBounds.top;o<=e.selectionBounds.bottom;o+=1)e.selectRow(o,l,null,!0);else e.selectArea(void 0,l);return t.preventDefault(),void e.draw(!0)}r<0&&(r=0),n>i&&(n=i),n<0&&(n=0),r>s&&(r=s),t.shiftKey&&-1!==[37,38,39,40].indexOf(t.keyCode)&&(e.selections[Math.max(n,0)]=e.selections[Math.max(n,0)]||[],e.selections[Math.max(n,0)].push(r),e.selectionBounds=e.getSelectionBounds(),e.selectArea(void 0,l),e.draw(!0)),r===e.activeCell.columnIndex&&n===e.activeCell.rowIndex||(e.scrollIntoView(r!==e.activeCell.columnIndex?r:void 0,n!==e.activeCell.rowIndex?n:void 0),e.setActiveCell(r,n),!t.shiftKey&&e.attributes.selectionFollowsActiveCell&&(l||(e.selections=[]),e.selections[n]=e.selections[n]||[],e.selections[n].push(r),e.dispatchEvent("selectionchanged",{selectedData:e.getSelectedData(),selections:e.selections,selectionBounds:e.selectionBounds})),e.draw(!0))}},e.keyup=function(t){e.dispatchEvent("keyup",{NativeEvent:t,cell:e.currentCell})||e.hasFocus&&(e.controlInput.value="")},e.keypress=function(t){e.hasFocus&&e.dispatchEvent("keypress",{NativeEvent:t,cell:e.currentCell})},e.dblclick=function(t){e.dispatchEvent("dblclick",{NativeEvent:t,cell:e.currentCell})||e.hasFocus&&("ew-resize"===e.currentCell.context&&"columnHeaderCell"===e.currentCell.style?e.fitColumnToValues(e.currentCell.header.name):"ew-resize"===e.currentCell.context&&"cornerCell"===e.currentCell.style?e.autosize():-1!==["cell","activeCell"].indexOf(e.currentCell.style)&&e.beginEditAt(e.currentCell.columnIndex,e.currentCell.rowIndex))},e.scrollWheel=function(t){if(!e.dispatchEvent("wheel",{NativeEvent:t})){e.touchHaltAnimation=!0;var o=e.scrollBox.scrollLeft,r=e.scrollBox.scrollTop;e.hasFocus&&(e.scrollBox.scrollTop+=t.deltaY,e.scrollBox.scrollLeft+=t.deltaX),r===e.scrollBox.scrollTop&&o===e.scrollBox.scrollLeft||t.preventDefault()}},e.copy=function(t){if(!e.dispatchEvent("copy",{NativeEvent:t})&&e.hasFocus&&t.clipboardData){var o=[],r=e.getSelectedData();r.length>0&&(r.forEach(function(e){if(e){var t=[];Object.keys(e).forEach(function(o){t.push('"'+e[o].replace(/"/g,'""')+'"')}),t.join(","),o.push(t)}}),t.clipboardData.setData("text/plain",o.join("\n")),t.preventDefault())}}}}.apply(t,r))&&(e.exports=n)},function(e,t,o){var r,n;r=[],void 0!==(n=function(){"use strict";return function(e){e.orders={rows:[],columns:[]},e.hasFocus=!1,e.activeCell={columnIndex:0,rowIndex:0},e.storageName="canvasDataGrid",e.invalidSearchExpClass="canvas-datagrid-invalid-search-regExp",e.localStyleLibraryStorageKey="canvas-datagrid-user-style-library",e.uniqueId="_canvasDataGridUniqueId",e.orderBy=e.uniqueId,e.orderDirection="asc",e.columnFilters={},e.filters={},e.ellipsisCache={},e.scrollBox={},e.visibleRows=[],e.sizes={rows:{},columns:{},trees:{}},e.currentFilter=function(){return!0},e.selections=[],e.hovers={},e.attributes={},e.style={},e.intf={},e.formatters={},e.sorters={},e.schemaHashes={},e.events={},e.uId=0,e.changes=[],e.scrollIndexTop=0,e.scrollPixelTop=0,e.scrollIndexLeft=0,e.scrollPixelLeft=0,e.childGrids={},e.openChildren={},e.scrollModes=["vertical-scroll-box","vertical-scroll-top","vertical-scroll-bottom","horizontal-scroll-box","horizontal-scroll-right","horizontal-scroll-left"],e.mouse={x:0,y:0},e.getSelectedData=function(t){var o=[],r=e.getSchema(),n=e.data.length;return e.selections.forEach(function(l,i){if(i!==n){if(0===l.length)return void(o[i]=null);o[i]={},t?r.forEach(function(t){o[i][t.name]=e.data[i][t.name]}):l.forEach(function(t){-1!==t&&(o[i][r[t].name]=e.data[i][r[t].name])})}}),o},e.scrollOffset=function(e){for(var t=0,o=0;e.parentNode;)"canvas-datagrid-tree"!==e.nodeType&&"canvas-datagrid-cell"!==e.nodeType&&(t-=e.scrollLeft,o-=e.scrollTop),e=e.parentNode;return{left:t,top:o}},e.position=function(t,o){for(var r,n,l=0,i=0,s=t;t.offsetParent;)l+=t.offsetLeft,i+=t.offsetTop,r=t.offsetHeight,n=t.offsetWidth,t=t.offsetParent;return o?{left:l,top:i,height:r,width:n}:(t=s,s=e.scrollOffset(t),{left:l+s.left,top:i+s.top,height:r,width:n})},e.getLayerPos=function(t){var o=e.canvas.getBoundingClientRect(),r={x:t.clientX-o.left,y:t.clientY-o.top};return e.isChildGrid&&(r.x-=e.canvasOffsetLeft,r.y-=e.canvasOffsetTop),{x:r.x,y:r.y,rect:o}},e.fillArray=function(e,t,o){o=o||1;var r,n=[];for(r=e;r<=t;r+=o)n[r]=r;return n},e.getRowHeaderCellHeight=function(){return e.attributes.showColumnHeaders?e.sizes.rows[-1]||e.style.columnHeaderCellHeight:0},e.getColumnHeaderCellWidth=function(){return e.attributes.showRowHeaders?e.sizes.columns.cornerCell||e.style.rowHeaderCellWidth:0},e.setStorageData=function(){e.attributes.saveAppearance&&localStorage.setItem(e.storageName+"-"+e.attributes.name,JSON.stringify({sizes:{rows:e.sizes.rows,columns:e.sizes.columns},orders:{rows:e.orders.rows,columns:e.orders.columns},orderBy:e.orderBy,orderDirection:e.orderDirection}))},e.getSchema=function(){return e.schema||e.tempSchema},e.createColumnOrders=function(){var t=e.getSchema();e.orders.columns=e.fillArray(0,t.length-1)},e.createRowOrders=function(){e.orders.rows=e.fillArray(0,e.data.length-1)},e.getVisibleSchema=function(){return e.getSchema().filter(function(e){return!e.hidden})},e.applyDefaultValue=function(t,o){var r=o.defaultValue||"";"function"==typeof r&&(r=r.apply(e.intf,[o])),t[o.name]=r},e.createNewRowData=function(){e.newRow={},e.newRow[e.uniqueId]=e.uId,e.uId+=1,e.getSchema().forEach(function(t){e.applyDefaultValue(e.newRow,t)})},e.getSchemaNameHash=function(t){for(var o=0;e.schemaHashes[t];)o+=1,t+=o;return t},e.filter=function(t){var o=e.filters[t];return o||void 0===t||(console.warn("Cannot find filter for type %s, falling back to substring match.",t),o=e.filters.string),o},e.getBestGuessDataType=function(t){var o,r,n=e.data.length;for(r=0;ri.x?l.x:i.x,y:l.y>i.y?l.y:i.y,h:l.he.width-e.attributes.selectionScrollZone&&oe.height-e.attributes.selectionScrollZone&&r0)throw new Error("A column with the name "+e.name+" already exists and cannot be added again.");return!0},e.setDefaults=function(e,t,o,r){e[o]=void 0===t[o]?r:t[o]},e.setAttributes=function(){e.defaults.attributes.forEach(function(t){e.setDefaults(e.attributes,e.args,t[0],t[1])})},e.setStyle=function(){e.defaults.styles.forEach(function(t){e.setDefaults(e.style,e.args.style||{},t[0],t[1])})},e.autosize=function(t){e.getVisibleSchema().forEach(function(o){o.name!==t&&void 0!==t||e.fitColumnToValues(o.name)}),e.fitColumnToValues("cornerCell")},e.dispose=function(){!e.isChildGrid&&e.canvas&&e.canvas.parentNode&&e.canvas.parentNode.removeChild(e.canvas),e.eventParent.removeEventListener("mouseup",e.mouseup,!1),e.eventParent.removeEventListener("mousedown",e.mousedown,!1),e.eventParent.removeEventListener("dblclick",e.dblclick,!1),e.eventParent.removeEventListener("click",e.click,!1),e.eventParent.removeEventListener("mousemove",e.mousemove),e.eventParent.removeEventListener("wheel",e.scrollWheel,!1),e.canvas.removeEventListener("contextmenu",e.contextmenu,!1),e.canvas.removeEventListener("copy",e.copy),e.controlInput.removeEventListener("keypress",e.keypress,!1),e.controlInput.removeEventListener("keyup",e.keyup,!1),e.controlInput.removeEventListener("keydown",e.keydown,!1),window.removeEventListener("resize",e.resize),e.observer&&e.observer.disconnect&&e.observer.disconnect()},e.tryLoadStoredOrders=function(){var t;e.storedSettings&&"object"==typeof e.storedSettings.orders&&(e.storedSettings.orders.rows.length>=e.data.length&&(e.orders.rows=e.storedSettings.orders.rows),t=e.getSchema(),e.orders.columns=e.storedSettings.orders.columns,t.forEach(function(t,o){-1===e.orders.columns.indexOf(o)&&e.orders.columns.push(o)}),e.orderBy=void 0===e.storedSettings.orderBy?e.uniqueId:e.storedSettings.orderBy,e.orderDirection=void 0===e.storedSettings.orderDirection?e.uniqueId:e.storedSettings.orderDirection,e.getHeaderByName(e.orderBy)&&e.orderDirection&&e.order(e.orderBy,e.orderDirection))},e.getFontHeight=function(e){return parseFloat(e,10)},e.parseFont=function(t){/Font/.test(t)&&(e.style[t+"Height"]=e.getFontHeight(e.style[t]))},e.initProp=function(t){e.args[t]&&Object.keys(e.args[t]).forEach(function(o){e[t][o]=e.args[t][o]})},e.init=function(){var t={};if(e.setAttributes(),e.setStyle(),e.initScrollBox(),e.setDom(),e.type="canvas-datagrid",Object.keys(e.style).forEach(e.parseFont),e.intf.type=e.type,e.intf.addEventListener=e.addEventListener,e.intf.removeEventListener=e.removeEventListener,e.intf.dispatchEvent=e.dispatchEvent,e.intf.dispose=e.dispose,e.intf.appendTo=e.appendTo,e.intf.filters=e.filters,e.intf.sorters=e.sorters,e.intf.autosize=e.autosize,e.intf.beginEditAt=e.beginEditAt,e.intf.endEdit=e.endEdit,e.intf.setActiveCell=e.setActiveCell,e.intf.scrollIntoView=e.scrollIntoView,e.intf.clearChangeLog=e.clearChangeLog,e.intf.gotoCell=e.gotoCell,e.intf.gotoRow=e.gotoRow,e.intf.findColumnScrollLeft=e.findColumnScrollLeft,e.intf.findRowScrollTop=e.findRowScrollTop,e.intf.fitColumnToValues=e.fitColumnToValues,e.intf.findColumnMaxTextLength=e.findColumnMaxTextLength,e.intf.disposeContextMenu=e.disposeContextMenu,e.intf.getCellAt=e.getCellAt,e.intf.isCellVisible=e.isCellVisible,e.intf.order=e.order,e.intf.draw=e.draw,e.intf.selectArea=e.selectArea,e.intf.clipElement=e.clipElement,e.intf.getSchemaFromData=e.getSchemaFromData,e.intf.setFilter=e.setFilter,e.intf.selectRow=e.selectRow,e.intf.parentGrid=e.parentGrid,e.intf.toggleTree=e.toggleTree,e.intf.expandTree=e.expandTree,e.intf.collapseTree=e.collapseTree,e.intf.canvas=e.canvas,e.intf.context=e.ctx,e.intf.insertRow=e.insertRow,e.intf.deleteRow=e.deleteRow,e.intf.addRow=e.addRow,e.intf.insertColumn=e.insertColumn,e.intf.deleteColumn=e.deleteColumn,e.intf.addColumn=e.addColumn,e.intf.getClippingRect=e.getClippingRect,e.intf.setRowHeight=e.setRowHeight,e.intf.setColumnWidth=e.setColumnWidth,e.intf.resetColumnWidths=e.resetColumnWidths,e.intf.resetRowHeights=e.resetRowHeights,e.intf.resize=e.resize,e.intf.selectColumn=e.selectColumn,e.intf.selectRow=e.selectRow,e.intf.selectAll=e.selectAll,e.intf.drawChildGrids=e.drawChildGrids,e.intf.assertPxColor=e.assertPxColor,e.intf.clearPxColorAssertions=e.clearPxColorAssertions,e.intf.integerToAlpha=e.integerToAlpha,e.intf.copy=e.copy,e.intf.style={},Object.keys(e.style).forEach(function(o){t[o]=void 0,Object.defineProperty(t,o,{get:function(){return e.style[o]},set:function(t){e.parseFont(t),e.style[o]=t,e.draw(!0),e.dispatchEvent("stylechanged",{name:o,value:t})}})}),Object.defineProperty(e.intf,"activeCell",{get:function(){return e.activeCell}}),Object.defineProperty(e.intf,"hasFocus",{get:function(){return e.hasFocus}}),Object.defineProperty(e.intf,"style",{get:function(){return t},set:function(t){Object.keys(t).forEach(function(o){e.parseFont(t),e.style[o]=t[o]}),e.draw(!0),e.dispatchEvent("stylechanged",{name:"style",value:t})}}),Object.keys(e.attributes).forEach(function(t){Object.defineProperty(e.intf.attributes,t,{get:function(){return e.attributes[t]},set:function(o){e.attributes[t]=o,e.draw(!0),e.dispatchEvent("attributechanged",{name:t,value:o[t]})}})}),e.filters.string=function(t,o){if(!o)return!0;var r;e.invalidFilterRegEx=void 0;try{r=new RegExp(o,"ig")}catch(t){return void(e.invalidFilterRegEx=t)}return r.test(t)},e.filters.number=function(e,t){return!t||e===t},e.attributes.name&&e.attributes.saveAppearance){if(e.storedSettings=localStorage.getItem(e.storageName+"-"+e.attributes.name),e.storedSettings)try{e.storedSettings=JSON.parse(e.storedSettings)}catch(t){console.warn("could not read settings from localStore",t),e.storedSettings=void 0}e.storedSettings&&"object"==typeof e.storedSettings.sizes&&(e.sizes.rows=e.storedSettings.sizes.rows,e.sizes.columns=e.storedSettings.sizes.columns,["trees","columns","rows"].forEach(function(t){e.sizes[t]||(e.sizes[t]={})}))}["formatters","filters","sorters"].forEach(e.initProp),e.args.data&&(e.intf.data=e.args.data),e.data||(e.intf.data=[]),e.args.schema&&(e.intf.schema=e.args.schema),e.isChildGrid?requestAnimationFrame(function(){e.resize(!0)}):e.resize(!0)},e.intf.blur=function(t){e.hasFocus=!1},e.intf.focus=function(){e.hasFocus=!0,e.controlInput.focus()},Object.defineProperty(e.intf,"height",{get:function(){return e.parentNode.height},set:function(t){e.parentNode.height=t,e.resize(!0)}}),Object.defineProperty(e.intf,"width",{get:function(){return e.parentNode.width},set:function(t){e.parentNode.width=t,e.resize(!0)}}),Object.defineProperty(e.intf,"openChildren",{get:function(){return e.openChildren}}),Object.defineProperty(e.intf,"childGrids",{get:function(){return Object.keys(e.childGrids).map(function(t){return e.childGrids[t]})}}),Object.defineProperty(e.intf,"isChildGrid",{get:function(){return e.isChildGrid}}),Object.defineProperty(e.intf,"parentNode",{get:function(){return e.parentNode},set:function(t){e.parentNode=t}}),Object.defineProperty(e.intf,"offsetParent",{get:function(){return e.parentNode},set:function(t){e.parentNode=t}}),Object.defineProperty(e.intf,"offsetLeft",{get:function(){return e.parentNode.offsetLeft}}),Object.defineProperty(e.intf,"offsetTop",{get:function(){return e.parentNode.offsetTop}}),Object.defineProperty(e.intf,"scrollHeight",{get:function(){return e.scrollBox.scrollHeight}}),Object.defineProperty(e.intf,"scrollWidth",{get:function(){return e.scrollBox.scrollWidth}}),Object.defineProperty(e.intf,"scrollTop",{get:function(){return e.scrollBox.scrollTop},set:function(t){e.scrollBox.scrollTop=t}}),Object.defineProperty(e.intf,"scrollLeft",{get:function(){return e.scrollBox.scrollLeft},set:function(t){e.scrollBox.scrollLeft=t}}),Object.defineProperty(e.intf,"sizes",{get:function(){return e.sizes}}),Object.defineProperty(e.intf,"input",{get:function(){return e.input}}),Object.defineProperty(e.intf,"controlInput",{get:function(){return e.controlInput}}),Object.defineProperty(e.intf,"currentCell",{get:function(){return e.currentCell}}),Object.defineProperty(e.intf,"visibleCells",{get:function(){return e.visibleCells}}),Object.defineProperty(e.intf,"visibleRows",{get:function(){return e.visibleRows}}),Object.defineProperty(e.intf,"selections",{get:function(){return e.selections}}),Object.defineProperty(e.intf,"dragMode",{get:function(){return e.dragMode}}),Object.defineProperty(e.intf,"changes",{get:function(){return e.changes}}),e.intf.attributes={},e.intf.formatters=e.formatters,e.normalizeDataset=function(t){var o,r,n,l;if(null===t||""===t||void 0===t)return[];if("string"!=typeof t&&"number"!=typeof t&&"boolean"!=typeof t||(t=[{0:t}]),Array.isArray(t)||"object"!=typeof t||(t=[t]),!Array.isArray(t[0])&&"object"==typeof t[0]||Array.isArray(t)&&0===t.length)return t;if("function"==typeof t&&(o=t.apply(e.intf,[function(t){l&&console.warn("Detected a callback to the data setter function after the same function already returned a value synchronously."),e.normalizeDataset(t)}]))&&(l=!0,e.normalizeDataset(o)),Array.isArray(t)||"object"!=typeof t||(t=[t]),Array.isArray(t))return Array.isArray(t[0])||(t=[t]),n=0,r=[],t.forEach(function(e){n=Math.max(n,e.length)}),t.forEach(function(e,t){var o;for(r[t]={},o=0;o0&&(e.tempSchema=e.getSchemaFromData()),e.schema||0!==e.data.length||(e.tempSchema=[{name:""}],e.tempSchema[0][e.uniqueId]=e.getSchemaNameHash("")),e.tempSchema&&!e.schema&&(e.createColumnOrders(),e.tryLoadStoredOrders(),e.dispatchEvent("schemachanged",{schema:e.tempSchema})),e.createNewRowData(),e.attributes.autoResizeColumns&&e.data.length>0&&void 0===e.storedSettings&&e.autosize(),e.fitColumnToValues("cornerCell",!0),e.resize()&&e.isChildGrid||e.draw(!0),e.createRowOrders(),e.tryLoadStoredOrders(),e.dispatchEvent("datachanged",{data:e.data})}}),e.initScrollBox=function(){function t(t,o){if(isNaN(t))throw new Error("ScrollTop value must be a number");t<0&&(t=0),t>s&&(t=s),s<0&&(t=0),l=t,o||e.scroll()}function o(t,o){if(isNaN(t))throw new Error("ScrollLeft value must be a number");t<0&&(t=0),t>a&&(t=a),a<0&&(t=0),i=t,o||e.scroll()}var r=0,n=0,l=0,i=0,s=0,a=0,c=20,d=20;e.scrollBox.scrollTo=function(e,r){o(e,!0),t(r)},Object.defineProperty(e.scrollBox,"scrollBoxHeight",{get:function(){return c},set:function(e){c=e}}),Object.defineProperty(e.scrollBox,"scrollBoxWidth",{get:function(){return d},set:function(e){d=e}}),Object.defineProperty(e.scrollBox,"height",{get:function(){return r},set:function(e){se&&(l=Math.max(e,0)),se&&(i=Math.max(e,0)),a=e}})}}}.apply(t,r))&&(e.exports=n)},function(e,t,o){var r,n;r=[],void 0!==(n=function(){"use strict";return function(e){function t(o,r,l,s){function a(){l.forEach(function(r){function n(e){e.relatedTarget!==g&&r.contextMenu.container!==e.relatedTarget&&s!==e.relatedTarget&&a!==e.relatedTarget&&(r.contextMenu.dispose(),m.splice(m.indexOf(r.contextMenu),1),r.contextMenu=void 0,a.removeEventListener("mouseout",n),g.removeEventListener("mouseout",n),a.setAttribute("contextOpen","0"),a.setAttribute("opening","0"))}function l(l){if("1"===a.getAttribute("opening")&&"1"!==a.getAttribute("contextOpen")){var i=a.getBoundingClientRect();i={left:i.left+e.style.childContextMenuMarginLeft+g.offsetWidth,top:i.top+e.style.childContextMenuMarginTop,bottom:i.bottom,right:i.right},r.contextMenu=t(o,i,l,v),a.setAttribute("contextOpen","1"),a.addEventListener("mouseout",n),g.addEventListener("mouseout",n),m.push(r.contextMenu)}}function i(){var e;if("1"!==a.getAttribute("contextOpen")){if(a.setAttribute("opening","1"),"function"==typeof r.items)return void(void 0!==(e=r.items.apply(v,[function(e){l(e)}]))&&Array.isArray(e)&&l(e));l(r.items)}}var s,a=document.createElement("div");!function(t){function r(t){return"function"==typeof t?r(t(o)):"object"==typeof t?void a.appendChild(t):(e.createInlineStyle(a,"canvas-datagrid-context-menu-item"),a.addEventListener("mouseover",function(){e.createInlineStyle(a,"canvas-datagrid-context-menu-item:hover")}),a.addEventListener("mouseout",function(){e.createInlineStyle(a,"canvas-datagrid-context-menu-item")}),void(a.innerHTML=t))}r(t.title),t.contextItemContainer=a,t.items&&t.items.length>0&&(s=document.createElement("div"),e.createInlineStyle(s,"canvas-datagrid-context-child-arrow"),s.innerHTML=e.style.childContextMenuArrowHTML,a.appendChild(s),a.addEventListener("mouseover",i),a.addEventListener("mouseout",function(){a.setAttribute("opening","0")})),t.click&&a.addEventListener("click",function(o){t.click.apply(e,[o])})}(r),g.appendChild(a)})}function c(e){l[e].contextItemContainer.dispatchEvent(new Event("click"))}function d(){g.scrollTop>0?document.body.appendChild(x):x.parentNode&&x.parentNode.removeChild(x),g.scrollTop>=g.scrollHeight-g.offsetHeight&&p.parentNode?p.parentNode.removeChild(p):g.scrollHeight-g.offsetHeight>0&&!(g.scrollTop>=g.scrollHeight-g.offsetHeight)&&document.body.appendChild(p)}function u(t){return function o(){var r=e.attributes.contextHoverScrollAmount;"up"===t&&0===g.scrollTop||"down"===t&&g.scrollTop===g.scrollHeight||(g.scrollTop+="up"===t?-r:r,n=setTimeout(o,e.attributes.contextHoverScrollRateMs,t))}}function h(e){return function(){clearTimeout(n)}}var f,g=document.createElement("div"),x=document.createElement("div"),p=document.createElement("div"),m=[],y=-1,v={};if(!Array.isArray(l))throw new Error("createContextMenu expects an array.");return v.parentGrid=e.intf,v.parentContextMenu=s,v.container=g,function(){var t={},o=e.scrollOffset(e.canvas);a(),e.createInlineStyle(g,"canvas-datagrid-context-menu"),t.x=r.left-o.left,t.y=r.top-o.top,t.height=0,i+=1,g.style.position="absolute",x.style.color=e.style.contextMenuArrowColor,p.style.color=e.style.contextMenuArrowColor,[x,p].forEach(function(e){e.style.textAlign="center",e.style.position="absolute",e.style.zIndex=i+1}),g.style.zIndex=i,s&&s.inputDropdown&&(g.style.maxHeight=window.innerHeight-t.y-e.style.autocompleteBottomMargin+"px",g.style.minWidth=r.width+"px",t.y+=r.height),g.style.left=t.x+"px",g.style.top=t.y+"px",g.addEventListener("scroll",d),g.addEventListener("wheel",function(t){e.hasFocus&&(g.scrollTop+=t.deltaY,g.scrollLeft+=t.deltaX),d()}),x.innerHTML=e.style.contextMenuArrowUpHTML,p.innerHTML=e.style.contextMenuArrowDownHTML,g.appendChild(x),document.body.appendChild(p),document.body.appendChild(g),f=g.getBoundingClientRect(),!(f.bottom>window.innerHeight)||s&&s.inputDropdown||(t.y=window.innerHeight-g.offsetHeight,t.y<0&&(t.y=0),g.offsetHeight>window.innerHeight&&(g.style.height=window.innerHeight-e.style.contextMenuWindowMargin+"px")),f.right>window.innerWidth&&(t.x=s?s.container.offsetLeft-g.offsetWidth:window.innerWidth-g.offsetWidth),g.style.left=t.x+"px",g.style.top=t.y+"px",f=g.getBoundingClientRect(),x.style.top=f.top+"px",p.style.top=f.top+f.height-p.offsetHeight+"px",x.style.left=f.left+"px",p.style.left=f.left+"px",p.style.width=g.offsetWidth+"px",x.style.width=g.offsetWidth+"px",p.addEventListener("mouseover",u("down")),p.addEventListener("mouseout",h("down")),x.addEventListener("mouseover",u("up")),x.addEventListener("mouseout",h("up")),d()}(),v.clickIndex=c,v.rect=f,v.items=l,v.upArrow=x,v.downArrow=p,v.dispose=function(){clearTimeout(n),m.forEach(function(e){e.dispose()}),[p,x,g].forEach(function(e){e.parentNode&&e.parentNode.removeChild(e)})},Object.defineProperty(v,"selectedIndex",{get:function(){return y},set:function(t){if("number"!=typeof t||isNaN(t||!isFinite(t)))throw new Error("Context menu selected index must be a sane number.");y=t,y>l.length-1&&(y=l.length-1),y<0&&(y=0),l.forEach(function(t,o){if(o===y)return e.createInlineStyle(t.contextItemContainer,"canvas-datagrid-context-menu-item:hover");e.createInlineStyle(t.contextItemContainer,"canvas-datagrid-context-menu-item")})}}),v}function o(o){function r(){i={},e.data.forEach(function(t){var r=t[o.cell.header.name];i[r]||(i[r]={title:e.formatters[o.cell.header.type||"string"]({cell:{value:r}}),click:function(t){u.value=r,t.stopPropagation(),u.dispatchEvent(new Event("keyup")),e.disposeAutocomplete()}})}),i=Object.keys(i).map(function(e){return i[e]})}function n(e){e&&-1!==[40,38,13,9,27].indexOf(e.keyCode)||(r(),s=u.getBoundingClientRect(),l&&(l.dispose(),l=void 0),l=t(o,{left:s.left,top:s.top,right:s.right,bottom:s.bottom,height:s.height,width:s.width},i,{inputDropdown:!0}),l.selectedIndex=0)}var i,s,a=document.createElement("div"),c=document.createElement("div"),d=document.createElement("button"),u=document.createElement("input"),h=o.cell&&o.cell.header?o.cell.header.title||o.cell.header.name:"";e.createInlineStyle(c,"canvas-datagrid-context-menu-label"),e.createInlineStyle(d,"canvas-datagrid-context-menu-filter-button"),e.createInlineStyle(u,"canvas-datagrid-context-menu-filter-input"),u.onclick=e.disposeAutocomplete,u.addEventListener("keydown",function(t){40===t.keyCode&&(l.selectedIndex+=1),38===t.keyCode&&(l.selectedIndex-=1),13===t.keyCode&&(l.clickIndex(l.selectedIndex),e.disposeContextMenu()),9===t.keyCode&&(l.clickIndex(l.selectedIndex),t.preventDefault()),27===t.keyCode&&e.disposeContextMenu()}),u.addEventListener("keyup",function(){e.setFilter(o.cell.header.name,u.value)}),u.addEventListener("keyup",n),u.value=o.cell.header?e.columnFilters[o.cell.header.name]||"":"",c.innerHTML=e.attributes.filterOptionText.replace(/%s/g,h),d.onclick=function(){if(l)return e.disposeAutocomplete();n()},d.innerHTML=e.style.contextFilterButtonHTML,a.addEventListener("click",function(e){return e.stopPropagation()}),a.appendChild(c),a.appendChild(u),a.appendChild(d),o.items.push({title:a}),Object.keys(e.columnFilters).length&&Object.keys(e.columnFilters).forEach(function(t){var r=e.getHeaderByName(t);o.items.push({title:e.attributes.removeFilterOptionText.replace(/%s/g,r.title||r.name),click:function(o){o.preventDefault(),e.setFilter(t,""),e.controlInput.focus()}})})}function r(t){var r=!(t.cell.isBackground||t.cell.isHeaderCellCap||t.cell.isScrollBar||t.cell.isCorner||t.cell.isRowHeader)&&t.cell.header;e.attributes.showFilter&&r&&o(t),e.attributes.showCopy&&e.selections.reduce(function(e,t){return e+t.length},0)>0&&t.items.push({title:e.attributes.copyText,click:function(){document.execCommand("copy"),e.disposeContextMenu(),e.controlInput.focus()}}),e.attributes.saveAppearance&&e.attributes.showClearSettingsOption&&(Object.keys(e.sizes.rows).length>0||Object.keys(e.sizes.columns).length>0)&&t.items.push({title:e.attributes.clearSettingsOptionText,click:function(t){t.preventDefault(),e.sizes.rows={},e.sizes.columns={},e.createRowOrders(),e.createColumnOrders(),e.storedSettings=void 0,e.dispatchEvent("resizecolumn",{columnWidth:e.style.columnWidth}),e.dispatchEvent("resizerow",{cellHeight:e.style.cellHeight}),e.setStorageData(),e.resize(!0),e.disposeContextMenu(),e.controlInput.focus()}}),e.attributes.allowSorting&&e.attributes.showOrderByOption&&r&&(t.items.push({title:e.attributes.showOrderByOptionTextAsc.replace("%s",t.cell.header.title||t.cell.header.name),click:function(o){o.preventDefault(),e.order(t.cell.header.name,"asc"),e.controlInput.focus()}}),t.items.push({title:e.attributes.showOrderByOptionTextDesc.replace("%s",t.cell.header.title||t.cell.header.name),click:function(o){o.preventDefault(),e.order(t.cell.header.name,"desc"),e.disposeContextMenu(),e.controlInput.focus()}}))}var n,l,i=2;e.disposeAutocomplete=function(){l&&(l.dispose(),l=void 0)},e.disposeContextMenu=function(){document.removeEventListener("click",e.disposeContextMenu),i=2,e.disposeAutocomplete(),e.contextMenu&&e.contextMenu.dispose(),e.contextMenu=void 0},e.contextmenuEvent=function(o,n){if(e.hasFocus||o.target===e.canvas){var l=[],i=n||e.getLayerPos(o,!0),s={NativeEvent:o,cell:e.getCellAt(i.x,i.y),items:l};s.cell.isGrid||r(s),e.dispatchEvent("contextmenu",s)||s.cell.isGrid||(e.contextMenu&&e.disposeContextMenu(),e.contextMenu=t(s,{left:i.x+i.rect.left+e.style.contextMenuMarginLeft+e.canvasOffsetLeft,top:i.y+i.rect.top+e.style.contextMenuMarginTop+e.canvasOffsetTop,right:s.cell.width+s.cell.x+i.rect.left,bottom:s.cell.height+s.cell.y+i.rect.top,height:s.cell.height,width:s.cell.width},l),document.addEventListener("click",e.disposeContextMenu),o.preventDefault())}}}}.apply(t,r))&&(e.exports=n)},function(e,t,o){var r,n;r=[],void 0!==(n=function(){"use strict";return function(e){e.defaults={attributes:[["name",""],["tree",!1],["showNewRow",!1],["treeHorizontalScroll",!1],["saveAppearance",!0],["selectionFollowsActiveCell",!1],["multiLine",!1],["editable",!0],["allowColumnReordering",!0],["allowRowReordering",!1],["allowSorting",!0],["showFilter",!0],["globalRowResize",!1],["pageUpDownOverlap",1],["persistantSelectionMode",!1],["rowSelectionMode",!1],["autoResizeColumns",!1],["allowRowHeaderResize",!0],["allowColumnResize",!0],["allowRowResize",!0],["allowRowResizeFromCell",!1],["allowColumnResizeFromCell",!1],["debug",!1],["borderResizeZone",10],["showColumnHeaders",!0],["showRowNumbers",!0],["showRowHeaders",!0],["scrollRepeatRate",75],["selectionScrollZone",20],["resizeScrollZone",20],["contextHoverScrollRateMs",5],["contextHoverScrollAmount",2],["selectionScrollIncrement",20],["reorderDeadZone",3],["showClearSettingsOption",!0],["showOrderByOption",!0],["clearSettingsOptionText","Clear saved settings"],["showOrderByOptionTextAsc","Order by %s ascending"],["showOrderByOptionTextDesc","Order by %s descending"],["removeFilterOptionText","Remove filter on %s"],["filterOptionText","Filter %s"],["filterTextPrefix","(filtered) "],["touchReleaseAnimationDurationMs",1e3],["touchReleaseAcceleration",30],["touchDeadZone",3],["touchSelectTimeMs",800],["touchScrollZone",40],["copyText","Copy"],["showCopy",!0],["columnHeaderClickBehavior","sort"],["scrollPointerLock",!0]],styles:[["activeCellBackgroundColor","rgba(255, 255, 255, 1)"],["activeCellBorderColor","rgba(110, 168, 255, 1)"],["activeCellBorderWidth",.25],["activeCellColor","rgba(0, 0, 0, 1)"],["activeCellFont","16px sans-serif"],["activeCellHoverBackgroundColor","rgba(255, 255, 255, 1)"],["activeCellHoverColor","rgba(0, 0, 0, 1)"],["activeCellOverlayBorderColor","rgba(66, 133, 244, 1)"],["activeCellOverlayBorderWidth",.5],["activeCellPaddingBottom",5],["activeCellPaddingLeft",5],["activeCellPaddingRight",7],["activeCellPaddingTop",5],["activeCellSelectedBackgroundColor","rgba(236, 243, 255, 1)"],["activeCellSelectedColor","rgba(0, 0, 0, 1)"],["activeColumnHeaderCellBackgroundColor","rgba(225, 225, 225, 1)"],["activeColumnHeaderCellColor","rgba(0, 0, 0, 1)"],["activeRowHeaderCellBackgroundColor","rgba(225, 225, 225, 1)"],["activeRowHeaderCellColor","rgba(0, 0, 0, 1)"],["autocompleteBottomMargin",60],["autosizeHeaderCellPadding",8],["autosizePadding",5],["backgroundColor","rgba(240, 240, 240, 1)"],["cellAutoResizePadding",13],["cellBackgroundColor","rgba(255, 255, 255, 1)"],["cellBorderColor","rgba(195, 199, 202, 1)"],["cellBorderWidth",.5],["cellColor","rgba(0, 0, 0, 1)"],["cellFont","16px sans-serif"],["cellGridHeight",250],["cellHeight",24],["cellHeightWithChildGrid",150],["cellHorizontalAlignment","left"],["cellHoverBackgroundColor","rgba(255, 255, 255, 1)"],["cellHoverColor","rgba(0, 0, 0, 1)"],["cellPaddingBottom",5],["cellPaddingLeft",5],["cellPaddingRight",7],["cellPaddingTop",5],["cellSelectedBackgroundColor","rgba(236, 243, 255, 1)"],["cellSelectedColor","rgba(0, 0, 0, 1)"],["cellVerticalAlignment","center"],["cellWidthWithChildGrid",250],["childContextMenuArrowColor","rgba(43, 48, 43, 1)"],["childContextMenuArrowHTML","►"],["childContextMenuMarginLeft",-15],["childContextMenuMarginTop",0],["columnHeaderCellBackgroundColor","rgba(240, 240, 240, 1)"],["columnHeaderCellBorderColor","rgba(152, 152, 152, 1)"],["columnHeaderCellBorderWidth",.25],["columnHeaderCellColor","rgba(50, 50, 50, 1)"],["columnHeaderCellFont","16px sans-serif"],["columnHeaderCellHeight",25],["columnHeaderCellHorizontalAlignment","left"],["columnHeaderCellHoverBackgroundColor","rgba(235, 235, 235, 1)"],["columnHeaderCellHoverColor","rgba(0, 0, 0, 1)"],["columnHeaderCellPaddingBottom",5],["columnHeaderCellPaddingLeft",5],["columnHeaderCellPaddingRight",7],["columnHeaderCellPaddingTop",5],["columnHeaderCellVerticalAlignment","center"],["columnWidth",250],["contextFilterButtonBorder","solid 1px rgba(158, 163, 169, 1)"],["contextFilterButtonBorderRadius","3px"],["contextFilterButtonHTML","▼"],["contextFilterInputBackground","rgba(255,255,255,1)"],["contextFilterInputBorder","solid 1px rgba(158, 163, 169, 1)"],["contextFilterInputBorderRadius","0"],["contextFilterInputColor","rgba(0,0,0,1)"],["contextFilterInputFontFamily","sans-serif"],["contextFilterInputFontSize","14px"],["contextMenuArrowColor","rgba(43, 48, 43, 1)"],["contextMenuArrowDownHTML","▼"],["contextMenuArrowUpHTML","▲"],["contextMenuBackground","rgba(240, 240, 240, 1)"],["contextMenuBorder","solid 1px rgba(158, 163, 169, 1)"],["contextMenuBorderRadius","3px"],["contextMenuChildArrowFontSize","12px"],["contextMenuColor","rgba(43, 48, 43, 1)"],["contextMenuFilterButtonFontFamily","sans-serif"],["contextMenuFilterButtonFontSize","10px"],["contextMenuFilterInvalidExpresion","rgba(237, 155, 156, 1)"],["contextMenuFontFamily","sans-serif"],["contextMenuFontSize","16px"],["contextMenuHoverBackground","rgba(182, 205, 250, 1)"],["contextMenuHoverColor","rgba(43, 48, 153, 1)"],["contextMenuItemBorderRadius","3px"],["contextMenuItemMargin","2px"],["contextMenuLabelDisplay","inline-block"],["contextMenuLabelMargin","0 3px 0 0"],["contextMenuLabelMaxWidth","700px"],["contextMenuLabelMinWidth","75px"],["contextMenuMarginLeft",3],["contextMenuMarginTop",-3],["contextMenuOpacity","0.98"],["contextMenuPadding","2px"],["contextMenuWindowMargin",6],["cornerCellBackgroundColor","rgba(240, 240, 240, 1)"],["cornerCellBorderColor","rgba(202, 202, 202, 1)"],["editCellBackgroundColor","white"],["editCellBorder","solid 1px rgba(110, 168, 255, 1)"],["editCellBoxShadow","0 2px 5px rgba(0,0,0,0.4)"],["editCellColor","black"],["editCellFontFamily","sans-serif"],["editCellFontSize","16px"],["editCellPaddingLeft",4],["gridBorderColor","rgba(202, 202, 202, 1)"],["gridBorderWidth",1],["columnHeaderOrderByArrowBorderColor","rgba(195, 199, 202, 1)"],["columnHeaderOrderByArrowBorderWidth",1],["columnHeaderOrderByArrowColor","rgba(155, 155, 155, 1)"],["columnHeaderOrderByArrowHeight",8],["columnHeaderOrderByArrowMarginLeft",0],["columnHeaderOrderByArrowMarginRight",5],["columnHeaderOrderByArrowMarginTop",6],["columnHeaderOrderByArrowWidth",13],["minColumnWidth",45],["minHeight",24],["minRowHeight",24],["name","default"],["reorderMarkerBackgroundColor","rgba(0, 0, 0, 0.1)"],["reorderMarkerBorderColor","rgba(0, 0, 0, 0.2)"],["reorderMarkerBorderWidth",1.25],["reorderMarkerIndexBorderColor","rgba(66, 133, 244, 1)"],["reorderMarkerIndexBorderWidth",2.75],["rowHeaderCellBackgroundColor","rgba(240, 240, 240, 1)"],["rowHeaderCellBorderColor","rgba(200, 200, 200, 1)"],["rowHeaderCellBorderWidth",1],["rowHeaderCellColor","rgba(50, 50, 50, 1)"],["rowHeaderCellFont","16px sans-serif"],["rowHeaderCellHeight",25],["rowHeaderCellHorizontalAlignment","left"],["rowHeaderCellHoverBackgroundColor","rgba(235, 235, 235, 1)"],["rowHeaderCellHoverColor","rgba(0, 0, 0, 1)"],["rowHeaderCellPaddingBottom",5],["rowHeaderCellPaddingLeft",5],["rowHeaderCellPaddingRight",5],["rowHeaderCellPaddingTop",5],["rowHeaderCellSelectedBackgroundColor","rgba(217, 217, 217, 1)"],["rowHeaderCellSelectedColor","rgba(50, 50, 50, 1)"],["rowHeaderCellVerticalAlignment","center"],["rowHeaderCellWidth",57],["scrollBarActiveColor","rgba(125, 125, 125, 1)"],["scrollBarBackgroundColor","rgba(240, 240, 240, 1)"],["scrollBarBorderColor","rgba(202, 202, 202, 1)"],["scrollBarBorderWidth",.5],["scrollBarBoxBorderRadius",4.125],["scrollBarBoxColor","rgba(192, 192, 192, 1)"],["scrollBarBoxMargin",2],["scrollBarBoxMinSize",15],["scrollBarBoxWidth",8],["scrollBarCornerBackgroundColor","rgba(240, 240, 240, 1)"],["scrollBarCornerBorderColor","rgba(202, 202, 202, 1)"],["scrollBarWidth",11],["selectionOverlayBorderColor","rgba(66, 133, 244, 1)"],["selectionOverlayBorderWidth",.75],["treeArrowBorderColor","rgba(195, 199, 202, 1)"],["treeArrowBorderWidth",1],["treeArrowClickRadius",5],["treeArrowColor","rgba(155, 155, 155, 1)"],["treeArrowHeight",8],["treeArrowMarginLeft",0],["treeArrowMarginRight",5],["treeArrowMarginTop",6],["treeArrowWidth",13],["treeGridHeight",250]]}}}.apply(t,r))&&(e.exports=n)},function(e,t,o){var r,n;r=[],void 0!==(n=function(){"use strict";return function(e){e.endEdit=function(t){function o(){t=!0}var r=e.input.editCell,n=r.rowIndex;if(e.dispatchEvent("beforeendedit",{cell:r,newValue:e.input.value,oldValue:r.value,abort:o,input:e.input}))return!1;if(e.input.value!==r.value&&!t){if(e.changes[n]=e.changes[n]||{},e.changes[n][r.header.name]=e.input.value,r.data[r.header.name]=e.input.value,n===e.data.length){if(e.dispatchEvent("newrow",{value:e.input.value,defaultValue:r.value,aborted:t,cell:r,input:e.input}))return!1;e.uId+=1,e.addRow(r.data),e.createNewRowData()}e.draw(!0)}return document.body.removeChild(e.input),e.controlInput.focus(),e.dispatchEvent("endedit",{cell:r,value:e.input.value,aborted:t,input:e.input}),e.input=void 0,!0},e.beginEditAt=function(t,o){if(e.attributes.editable){var r,n=e.getVisibleCellByIndex(t,o),l=e.getVisibleSchema();if(e.dispatchEvent("beforebeginedit",{cell:n}))return!1;e.scrollIntoView(t,o),e.setActiveCell(t,o),n.header.enum?e.input=document.createElement("select"):e.input=document.createElement(e.attributes.multiLine?"textarea":"input"),function(){var i,s;n=e.getVisibleCellByIndex(t,o),n.header.enum&&("function"==typeof n.header.enum?r=n.header.enum.apply(e.intf,[{cell:n}]):Array.isArray(n.header.enum)&&(r=n.header.enum),r.forEach(function(t){var o,r,l=document.createElement("option");Array.isArray(t)?(o=t[0],r=t[1]):(o=t,r=t),o===n.value&&(s=!0),l.value=o,l.innerHTML=r,e.input.appendChild(l)}),s||(i=document.createElement("option"),i.value=n.value,i.innerHTML=n.value,e.input.appendChild(i)),e.input.addEventListener("change",function(){e.endEdit(),e.draw(!0)})),document.body.appendChild(e.input),e.createInlineStyle(e.input,"canvas-datagrid-edit-input"),e.input.style.position="absolute",e.input.editCell=n,e.resizeEditInput(),e.input.style.zIndex="2",e.input.value=n.value,e.input.focus(),e.input.addEventListener("click",e.stopPropagation),e.input.addEventListener("dblclick",e.stopPropagation),e.input.addEventListener("mouseup",e.stopPropagation),e.input.addEventListener("mousedown",e.stopPropagation),e.input.addEventListener("keydown",function(t){var o=n.columnIndex,r=n.rowIndex;if(27===t.keyCode)e.endEdit(!0),e.draw(!0);else if(13===t.keyCode&&(!e.attributes.multiLine||e.attributes.multiLine&&t.shiftKey))e.endEdit(),e.draw(!0);else if(9===t.keyCode){if(t.preventDefault(),!e.endEdit())return;t.shiftKey?o-=1:o+=1,o<0&&(o=l.length-1,r-=1),o>l.length-1&&(o=0,r+=1),r<0&&(r=e.data.length-1),r>e.data.length-1&&(r=0),e.scrollIntoView(o,r),e.beginEditAt(o,r)}})}(),e.dispatchEvent("beginedit",{cell:n,input:e.input})}},e.createInlineStyle=function(t,o){var r={"canvas-datagrid-context-menu-filter-input":{height:"19px",verticalAlign:"bottom",marginLeft:"2px",padding:"0",background:e.style.contextFilterInputBackground,color:e.style.contextFilterInputColor,border:e.style.contextFilterInputBorder,borderRadius:e.style.contextFilterInputBorderRadius,lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.contextFilterInputFontFamily,fontSize:e.style.contextFilterInputFontSize},"canvas-datagrid-context-menu-filter-button":{height:"19px",verticalAlign:"bottom",marginLeft:"2px",padding:"0",background:e.style.contextMenuBackground,color:e.style.contextMenuColor,border:e.style.contextFilterButtonBorder,borderRadius:e.style.contextFilterButtonBorderRadius,lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.contextMenuFilterButtonFontFamily,fontSize:e.style.contextMenuFilterButtonFontSize},"canvas-datagrid-context-child-arrow":{cssFloat:"right",color:e.style.childContextMenuArrowColor,fontSize:e.style.contextMenuChildArrowFontSize,fontFamily:e.style.contextMenuFontFamily,verticalAlign:"middle"},"canvas-datagrid-autocomplete":{fontFamily:e.style.contextMenuFontFamily,fontSize:e.style.contextMenuFontSize,background:e.style.contextMenuBackground,color:e.style.contextMenuColor,border:e.style.contextMenuBorder,padding:e.style.contextMenuPadding,borderRadius:e.style.contextMenuBorderRadius,opacity:e.style.contextMenuOpacity,position:"absolute",zIndex:3,overflow:"hidden"},"canvas-datagrid-autocomplete-item":{background:e.style.contextMenuBackground,color:e.style.contextMenuColor},"canvas-datagrid-autocomplete-item:hover":{background:e.style.contextMenuHoverBackground,color:e.style.contextMenuHoverColor},"canvas-datagrid-canvas":{position:"absolute",zIndex:"-1"},"canvas-datagrid":{position:"absolute",background:e.style.backgroundColor,zIndex:"1",boxSizing:"content-box",padding:"0"},"canvas-datagrid-control-input":{position:"fixed",top:"-5px",left:"-5px",border:"none",opacity:"0",cursor:"pointer",width:"1px",height:"1px",lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.contextMenuFontFamily,fontSize:e.style.contextMenuFontSize},"canvas-datagrid-edit-input":{boxSizing:"content-box",outline:"none",margin:"0",padding:"0 0 0 "+e.style.editCellPaddingLeft+"px",lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.editCellFontFamily,fontSize:e.style.editCellFontSize,boxShadow:e.style.editCellBoxShadow,border:e.style.editCellBorder,color:e.style.editCellColor,background:e.style.editCellBackgroundColor,appearance:"none",webkitAppearance:"none",mozAppearance:"none",borderRadius:"0"},"canvas-datagrid-context-menu-item":{lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.contextMenuFontFamily,fontSize:e.style.contextMenuFontSize,color:"inherit",background:"inherit",margin:e.style.contextMenuItemMargin,borderRadius:e.style.contextMenuItemBorderRadius,verticalAlign:"middle"},"canvas-datagrid-context-menu-item:hover":{background:e.style.contextMenuHoverBackground,color:e.style.contextMenuHoverColor},"canvas-datagrid-context-menu-label":{margin:e.style.contextMenuLabelMargin,display:e.style.contextMenuLabelDisplay,minWidth:e.style.contextMenuLabelMinWidth,maxWidth:e.style.contextMenuLabelMaxWidth},"canvas-datagrid-context-menu":{lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.contextMenuFontFamily,fontSize:e.style.contextMenuFontSize,background:e.style.contextMenuBackground,color:e.style.contextMenuColor,border:e.style.contextMenuBorder,padding:e.style.contextMenuPadding,borderRadius:e.style.contextMenuBorderRadius,opacity:e.style.contextMenuOpacity,overflow:"hidden"},"canvas-datagrid-invalid-search-regExp":{background:e.style.contextMenuFilterInvalidExpresion}};r[o]&&Object.keys(r[o]).map(function(e){t.style[e]=r[o][e]})},e.appendTo=function(t){e.parentNode=t,e.height=e.parentNode.offsetHeight,e.width=e.parentNode.offsetWidth,e.parentNode&&/canvas-datagrid-(cell|tree)/.test(e.parentNode.nodeType)?(e.isChildGrid=!0,e.parentGrid=e.parentNode.parentGrid,e.ctx=e.parentGrid.context,e.canvas=e.parentGrid.canvas,e.controlInput=e.parentGrid.controlInput,e.eventParent=e.canvas,e.intf.offsetParent=e.parentNode):(e.controlInput=document.createElement("input"),e.controlInput.onblur=e.intf.blur,e.createInlineStyle(e.controlInput,"canvas-datagrid-control-input"),e.isChildGrid=!1,e.parentDOMNode=e.parentNode,e.parentNode=e.parentDOMNode,e.parentIsCanvas=/canvas/i.test(e.parentDOMNode.tagName),e.parentIsCanvas?e.canvas=e.parentDOMNode:(e.canvas=document.createElement("canvas"),e.parentDOMNode.appendChild(e.canvas)),e.ctx=e.canvas.getContext("2d"),e.ctx.textBaseline="alphabetic",document.body.appendChild(e.controlInput),e.eventParent=e.canvas),e.controlInput.addEventListener("blur",function(t){t.target!==e.canvas&&(e.hasFocus=!1)}),window.addEventListener("resize",e.resize),MutationObserver&&(e.observer=new MutationObserver(function(t){t.forEach(function(t){e.resize(!0)})}),[e.canvas.parentNode].forEach(function(t){e.observer.observe(t,{attributes:!0})})),e.eventParent.addEventListener("scroll",e.resize,!1),e.eventParent.addEventListener("touchstart",e.touchstart,!1),e.eventParent.addEventListener("mouseup",e.mouseup,!1),e.eventParent.addEventListener("mousedown",e.mousedown,!1),e.eventParent.addEventListener("dblclick",e.dblclick,!1),e.eventParent.addEventListener("click",e.click,!1),e.eventParent.addEventListener("mousemove",e.mousemove),e.eventParent.addEventListener("wheel",e.scrollWheel,!1),e.canvas.addEventListener("contextmenu",e.contextmenuEvent,!1),(e.isChildGrid?e.parentGrid:document).addEventListener("copy",e.copy),e.controlInput.addEventListener("keypress",e.keypress,!1),e.controlInput.addEventListener("keyup",e.keyup,!1),e.controlInput.addEventListener("keydown",e.keydown,!1)},e.setDom=function(){e.appendTo(e.args.parentNode)}}}.apply(t,r))&&(e.exports=n)},function(e,t,o){var r,n;r=[],void 0!==(n=function(){"use strict";return function(e){e.integerToAlpha=function(e){for(var t="a".charCodeAt(0),o="z".charCodeAt(0),r=o-t+1,n="";e>=0;)n=String.fromCharCode(e%r+t)+n,e=Math.floor(e/r)-1;return n},e.insertColumn=function(t,o){var r=e.getSchema();if(r.lengthn)throw new Error("Impossible row index");for(;rn.length-1)throw new Error("Impossible column index");for(;r0&&r.y>0&&r.x+r.widtha;a+=1)l(a)}o||r||(e.selections=[],e.activeCell.columnIndex=t,e.activeCell.rowIndex=e.scrollIndexTop),o&&e.isColumnSelected(t)?function(t){e.data.forEach(function(o,r){e.selections[r]=e.selections[r]||[],-1!==e.selections[r].indexOf(t)&&e.selections[r].splice(e.selections[r].indexOf(t),1)})}(t):l(t),n||e.dispatchEvent("selectionchanged",{selectedData:e.getSelectedData(),selections:e.selections,selectionBounds:e.selectionBounds})},e.selectRow=function(t,o,r,n){function l(t){e.selections[t]=[],e.selections[t].push(-1),c.forEach(function(o){e.selections[t].push(o.index)})}var i,s,a,c=e.getSchema();if((!1===e.dragAddToSelection||void 0===e.dragObject)&&e.selections[t]&&e.selections[t].length-1===c.length&&o)return void(e.selections[t]=[]);if(!0===e.dragAddToSelection||void 0===e.dragObject)if(r&&void 0===e.dragObject){if(!e.activeCell)return;for(s=Math.min(e.activeCell.rowIndex,t),a=Math.max(e.activeCell.rowIndex,t),i=s;a>=i;i+=1)l(i)}else l(t);n||e.dispatchEvent("selectionchanged",{selectedData:e.getSelectedData(),selections:e.selections,selectionBounds:e.selectionBounds})},e.collapseTree=function(t){var o=e.data[t][e.uniqueId];e.dispatchEvent("collapsetree",{childGrid:e.childGrids[o],data:e.data[t],rowIndex:t}),e.openChildren[o].blur(),e.openChildren[o].dispose(),delete e.openChildren[o],delete e.sizes.trees[o],delete e.childGrids[o],e.dispatchEvent("resizerow",{cellHeight:e.style.cellHeight}),e.resize(!0),e.draw(!0)},e.expandTree=function(t){var o,r=e.getRowHeaderCellHeight(),n=e.sizes.columns.cornerCell||e.style.rowHeaderCellWidth,l=e.data[t][e.uniqueId],i=e.sizes.trees[l]||e.style.treeGridHeight;e.childGrids[l]||(o=e.createGrid({debug:e.attributes.debug,name:e.attributes.saveAppearance?e.attributes.name+"tree"+l:void 0,parentNode:{parentGrid:e.intf,nodeType:"canvas-datagrid-tree",offsetHeight:i,offsetWidth:e.width-n,header:{width:e.width-n},offsetLeft:n,offsetTop:r,offsetParent:e.intf.parentNode,parentNode:e.intf.parentNode,style:"tree",data:e.data[t]}}),e.childGrids[l]=o),o=e.childGrids[l],o.visible=!0,e.dispatchEvent("expandtree",{treeGrid:o,data:e.data[t],rowIndex:t}),e.openChildren[l]=o,e.sizes.trees[l]=i,e.dispatchEvent("resizerow",{height:e.style.cellHeight}),e.resize(!0)},e.toggleTree=function(t){if(e.openChildren[e.data[t][e.uniqueId]])return e.collapseTree(t);e.expandTree(t)},e.getHeaderByName=function(t){var o,r=e.getSchema();for(o=0;oe.width||t.y<0||t.y>e.height)},e.getVisibleCellByIndex=function(t,o){return e.visibleCells.filter(function(e){return e.columnIndex===t&&e.rowIndex===o})[0]},e.getCellAt=function(t,o,r){var n,l,i=r?e.attributes.touchScrollZone:0,s=e.visibleCells.length;if(e.visibleCells&&e.visibleCells.length){if(e.hasFocus=!0,!(o0&&t0))return e.hasFocus=!1,{dragContext:"inherit",context:"inherit"};for(n=0;nt&&l.y-e.style.cellBorderWidtho)return/vertical-scroll-(bar|box)/.test(l.style)?(l.dragContext="vertical-scroll-box",l.context="vertical-scroll-box",l.isScrollBar=!0,l.isVerticalScrollBar=!0,o>e.scrollBox.box.v.y+e.scrollBox.scrollBoxHeight?(l.dragContext="vertical-scroll-bottom",l.context="vertical-scroll-bottom"):oe.scrollBox.box.h.x+e.scrollBox.scrollBoxWidth?(l.dragContext="horizontal-scroll-right",l.context="horizontal-scroll-right"):tt&&e.attributes.allowColumnResize&&(e.attributes.allowColumnResizeFromCell&&"cell"===l.style||"cell"!==l.style)&&(e.attributes.allowRowHeaderResize&&-1!==["rowHeaderCell","cornerCell"].indexOf(l.style)||-1===["rowHeaderCell","cornerCell"].indexOf(l.style))?(l.context="ew-resize",l.dragContext="ew-resize",l):l.y+l.height-.4*e.attributes.borderResizeZoneo&&e.attributes.allowRowResize&&(e.attributes.allowRowResizeFromCell&&"cell"===l.style||"cell"!==l.style)&&"columnHeaderCell"!==l.style?(l.context="ns-resize",l.dragContext="ns-resize",l):"columnHeaderCell"===l.style?(l.context="cell",l.dragContext="column-reorder",l):"rowHeaderCell"===l.style?(l.context="cell",l.dragContext="row-reorder",l):l.isGrid?(e.hasFocus=!1,l.dragContext="cell-grid",l.context="cell-grid",l):"tree-grid"===l.style?(e.hasFocus=!1,l.dragContext="tree",l.context="tree",l):(l.dragContext="cell",l.context="cell",l);return e.hasFocus=!0,e.canvas.style.cursor="default",{dragContext:"background",context:"background",style:"background",isBackground:!0}}},e.getSelectionBounds=function(){var t={x:1/0,y:1/0},o={x:-1/0,y:-1/0};return e.data.forEach(function(r,n){var l,i;e.selections[n]&&e.selections[n].length&&(t.y=no.y?n:o.y,l=Math.max.apply(null,e.selections[n]),i=Math.min.apply(null,e.selections[n]),t.x=io.x?l:o.x)}),{top:t.y,left:t.x,bottom:o.y,right:o.x}},e.getSchemaFromData=function(){return Object.keys(e.data[0]||{" ":""}).map(function(t,o){var r=e.getBestGuessDataType(t),n={name:t,title:isNaN(parseInt(t,10))?t:e.integerToAlpha(t).toUpperCase(),width:e.style.columnWidth,index:o,type:r,filter:e.filter(r)};return t===e.uniqueId&&(n.hidden=!0),n[e.uniqueId]=e.getSchemaNameHash(t),n})},e.clearChangeLog=function(){e.changes=[]},e.selectArea=function(t,o){e.selectionBounds=t||e.selectionBounds;var r,n,l=e.getSchema();if(o||(e.selections=[]),e.selectionBounds.top<-1||e.selectionBounds.bottom>e.data.length||e.selectionBounds.left<-1||e.selectionBounds.right>l.length)throw new Error("Impossible selection area");for(r=e.selectionBounds.top;r<=e.selectionBounds.bottom;r+=1)for(e.selections[r]=[],n=e.selectionBounds.left;n<=e.selectionBounds.right;n+=1)-1===e.selections[r].indexOf(n)&&e.selections[r].push(n);e.dispatchEvent("selectionchanged",{selectedData:e.getSelectedData(),selections:e.selections,selectionBounds:e.selectionBounds})},e.findColumnMaxTextLength=function(t){var o=-1/0;return"cornerCell"===t?(e.ctx.font=e.style.rowHeaderCellFont,e.ctx.measureText((e.data.length+(e.attributes.showNewRow?1:0)).toString()).width+e.style.autosizePadding+e.style.autosizeHeaderCellPadding+e.style.rowHeaderCellPaddingRight+e.style.rowHeaderCellPaddingLeft+(e.attributes.tree?e.style.treeArrowWidth+e.style.treeArrowMarginLeft+e.style.treeArrowMarginRight:0)):(e.getSchema().forEach(function(r){if(r.name===t){e.ctx.font=e.style.columnHeaderCellFont;var n=e.ctx.measureText(r.title||r.name).width+e.style.headerCellPaddingRight+e.style.headerCellPaddingLeft;o=n>o?n:o}}),e.data.forEach(function(r){e.ctx.font=e.style.cellFont;var n=e.ctx.measureText(r[t]).width+e.style.cellPaddingRight+e.style.cellPaddingLeft+e.style.cellAutoResizePadding;o=n>o?n:o}),o)},e.getHeaderWidth=function(){return e.getVisibleSchema().reduce(function(e,t){return e+t.width},0)},e.formatters.string=function(e){return void 0!==e.cell.value?e.cell.value:""},e.formatters.rowHeaderCell=e.formatters.string,e.formatters.headerCell=e.formatters.string,e.formatters.number=e.formatters.string,e.formatters.int=e.formatters.string,e.formatters.html=e.formatters.string,e.sorters.string=function(e,t){var o="asc"===t;return function(t,r){return void 0===t[e]||null===t[e]?1:void 0===r[e]||null===r[e]?0:o?t[e].localeCompare?t[e].localeCompare(r[e]):1:r[e].localeCompare?r[e].localeCompare(t[e]):1}},e.sorters.number=function(e,t){var o="asc"===t;return function(t,r){return o?t[e]-r[e]:r[e]-t[e]}},e.sorters.date=function(e,t){var o="asc"===t;return function(t,r){return o?new Date(t[e]).getTime()-new Date(r[e]).getTime():new Date(r[e]).getTime()-new Date(t[e]).getTime()}}}}.apply(t,r))&&(e.exports=n)}])}); //# sourceMappingURL=canvas-datagrid.map \ No newline at end of file diff --git a/dist/canvas-datagrid.map b/dist/canvas-datagrid.map index fb56a920..854da4a2 100644 --- a/dist/canvas-datagrid.map +++ b/dist/canvas-datagrid.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///canvas-datagrid.js","webpack:///webpack/bootstrap 52b02f53a9172f48f3b3","webpack:///./lib/main.js","webpack:///./lib/draw.js","webpack:///./lib/events.js","webpack:///./lib/intf.js","webpack:///./lib/contextMenu.js","webpack:///./lib/defaults.js","webpack:///./lib/dom.js","webpack:///./lib/publicMethods.js"],"names":["root","factory","exports","module","define","amd","this","modules","__webpack_require__","moduleId","installedModules","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","__WEBPACK_AMD_DEFINE_ARRAY__","__WEBPACK_AMD_DEFINE_RESULT__","undefined","grid","args","self","createGrid","forEach","init","intf","Array","slice","arguments","window","canvasDatagrid","require","apply","drawOnAllImagesLoaded","loaded","keys","htmlImageCache","html","complete","draw","drawHtml","cell","img","v","innerHTML","formattedValue","x","canvasOffsetLeft","y","canvasOffsetTop","height","width","ctx","drawImage","Image","onload","src","btoa","drawOrderByArrow","fillStyle","style","columnHeaderOrderByArrowColor","strokeStyle","columnHeaderOrderByArrowBorderColor","beginPath","columnHeaderOrderByArrowMarginLeft","columnHeaderOrderByArrowMarginTop","orderDirection","moveTo","lineTo","columnHeaderOrderByArrowWidth","columnHeaderOrderByArrowHeight","stroke","fill","columnHeaderOrderByArrowMarginRight","drawTreeArrow","treeArrowColor","treeArrowBorderColor","treeArrowMarginLeft","treeArrowMarginTop","openChildren","data","uniqueId","treeArrowWidth","treeArrowHeight","treeArrowMarginRight","radiusRect","w","h","radius","r","b","quadraticCurveTo","fillRect","strokeRect","fillText","text","addBorderLine","pos","t","addEllipsis","ellipsisCache","measureText","value","drawText","paddingLeft","paddingTop","paddingRight","paddingBottom","vPos","hPos","orderByArrowWidth","fontHeight","horizontalAlignment","verticalAlignment","perfCounters","drawCount","perfWindowSize","internal","drawCell","rowIndex","rowOrderIndex","header","headerIndex","columnOrderIndex","childGridAttributes","val","cellStyle","isHeader","test","isCorner","isRowHeader","isColumnHeader","selected","selections","indexOf","hovered","hovers","active","activeCell","columnIndex","isGrid","activeHeader","orders","rows","columns","f","formatters","type","orderByArrowSize","treeArrowSize","cellWidth","sizes","ev","row","columnWidth","cellBorderWidth","visibleRows","push","dispatchEvent","cx","cy","nodeType","offsetTop","offsetLeft","scrollTop","scrollBox","scrollLeft","cellHeight","offsetWidth","offsetHeight","parentNode","offsetParent","isHeaderCellCap","rowOpen","sortColumnIndex","sortRowIndex","gridId","attributes","parentGrid","title","userHeight","rowHeight","userWidth","cornerCell","visibleCells","unshift","lineWidth","cellHeightWithChildGrid","checkScrollHeight","cellWidthWithChildGrid","rd","save","clip","tree","showRowNumbers","childGrids","saveAppearance","cellGridHeight","visible","orderBy","font","console","warn","toString","columnFilters","filterTextPrefix","aCell","selectionBorders","length","restore","drawRowHeader","rowData","index","a","showRowHeaders","rowHeaderCell","rowHeaderCellWidth","drawRow","treeHeight","rowSansTreeHeight","g","trees","columnHeaderCellWidth","scrollIndexLeft","scrollPixelLeft","treeGrid","scrollBarWidth","rowHeaders","isChildGrid","requestAnimationFrame","u","currentCell","rowHeaderCellHeight","getRowHeaderCellHeight","getColumnHeaderCellWidth","performance","now","createRowOrders","getVisibleSchema","scale","devicePixelRatio","backgroundColor","scrollPixelTop","scrollIndexTop","showNewRow","newRow","selectionOverlayBorderWidth","selectionOverlayBorderColor","rowSelectionMode","activeCellOverlayBorderWidth","activeCellOverlayBorderColor","getHeaderWidth","columnHeaderCell","rArgs","showColumnHeaders","order","isHeaderCell","endCap","reorderObject","dragOffset","heigth","reorderMarkerBackgroundColor","reorderMarkerBorderWidth","reorderMarkerBorderColor","dragMode","reorderMarkerIndexBorderWidth","reorderMarkerIndexBorderColor","vb","nb","co","isScrollBoxCorner","scrollBarBoxMargin","scrollBarBorderColor","scrollBarBorderWidth","scrollBarBackgroundColor","scrollBoxHeight","scrollHeight","scrollBarBoxWidth","scrollBarBoxColor","context","scrollBarActiveColor","scrollBarBoxBorderRadius","scrollBoxWidth","scrollWidth","scrollBarCornerBorderColor","scrollBarCornerBackgroundColor","bar","box","resize","gridBorderWidth","gridBorderColor","debug","perf","reduce","toFixed","map","join","htmlImages","mousex","mouse","mousey","touchx","touchStart","touchy","entities","hasFocus","dragContext","key","touchDelta","touchAnimateTo","touchSigma","xPPS","yPPS","touchingCell","startingCell","animationFrames","getTouchPos","e","rect","canvas","getBoundingClientRect","touches","clientX","left","clientY","top","calculatePPS","touchCell","clearInterval","touchCalcTimeout","Math","abs","touchDeadZone","getCellAt","mousemove","mousedown","touchstart","NativeEvent","stopPropagation","preventDefault","contextmenu","touchScrollStart","touchmove","clearTimeout","touchTimeout","setTimeout","touchSelectTimeMs","setInterval","touchHaltAnimation","document","body","addEventListener","passive","touchend","touchcancel","easing","touchEndAnimation","scrollTo","touchReleaseAnimationDurationMs","dz","mouseup","beginEditAt","click","removeEventListener","touchReleaseAcceleration","fn","events","sfn","idx","splice","defaultPrevented","drawAfterResize","cellBorder","columnHeaderCellBorder","columnHeaderCellBorderWidth","parentDOMNode","parentIsCanvas","accumulator","column","hidden","widthBoxRatio","heightBoxRatio","max","scrollBarBoxMinSize","page","pageUpDownOverlap","resizeEditInput","scroll","input","scrollOffset","bx2","getVisibleCellByIndex","editCell","cellPaddingLeft","clipElement","dontDraw","overridePos","contextMenu","getLayerPos","dragBounds","sBounds","delta","ctrl","controlKey","metaKey","persistantSelectionMode","getSchema","previousCell","scrollTimer","isInGrid","cellBoundaryCrossed","draggingItem","scrollModes","dragItem","cursor","selecting","getSelectionBounds","dragStart","dragStartObject","shiftKey","min","bottom","right","ignoreNextClick","selectRow","dragAddToSelection","selectionBounds","selectArea","autoScrollZone","checkSelectionChange","selectionChanged","selectedData","getSelectedData","endEdit","sorters","number","setFilter","columnHeaderClickBehavior","selectColumn","setActiveCell","treeArrowClickRadius","toggleTree","dragResizeColumn","resizingStartingWidth","resizingStartingHeight","minColumnWidth","minRowHeight","resizeScrollZone","resizeChildGrids","globalRowResize","stopDragResize","setStorageData","scrollGrid","scrollPointerLock","pointerLockPosition","scrollStartMode","movementX","movementY","scrollMode","scrollStart","scrollRepeatRate","selectionScrollIncrement","stopScrollGrid","exitPointerLock","dragReorder","allowColumnReordering","allowRowReordering","source","target","reorderDeadZone","reorderTarget","stopDragReorder","cr","row-reorder","column-reorder","lastMouseDownTarget","button","requestPointerLock","controlInput","focus","keydown","last","cols","keyCode","selectAll","scrollIntoView","selectionFollowsActiveCell","keyup","keypress","dblclick","fitColumnToValues","autosize","scrollWheel","deltaY","deltaX","copy","clipboardData","sData","setData","storageName","invalidSearchExpClass","localStyleLibraryStorageKey","filters","currentFilter","schemaHashes","uId","changes","expandToRow","col","position","ignoreScrollOffset","fillArray","low","high","step","columnHeaderCellHeight","localStorage","setItem","JSON","stringify","schema","tempSchema","createColumnOrders","filter","applyDefaultValue","defaultValue","createNewRowData","getSchemaNameHash","string","getBestGuessDataType","columnName","drawChildGrids","gridKey","getClippingRect","ele","boundingRect","eleRect","clipRect","parentRect","Infinity","setTimer","selectionScrollZone","refreshFromOrigialData","originalData","validateColumn","Error","setDefaults","obj1","obj2","def","setAttributes","defaults","setStyle","styles","colName","dispose","removeChild","eventParent","observer","disconnect","tryLoadStoredOrders","storedSettings","getHeaderByName","getFontHeight","fontStyle","parseFloat","parseFont","initProp","propName","publicStyleKeyIntf","initScrollBox","setDom","appendTo","clearChangeLog","gotoCell","gotoRow","findColumnScrollLeft","findRowScrollTop","findColumnMaxTextLength","disposeContextMenu","isCellVisible","getSchemaFromData","expandTree","collapseTree","insertRow","deleteRow","addRow","insertColumn","deleteColumn","addColumn","setRowHeight","setColumnWidth","resetColumnWidths","resetRowHeights","assertPxColor","clearPxColorAssertions","integerToAlpha","set","filterFor","filterRegExp","invalidFilterRegEx","RegExp","getItem","parse","blur","normalizeDataset","syncFnInvoked","0","isArray","autoResizeColumns","setScrollTop","preventScrollEvent","isNaN","setScrollLeft","sHeight","sWidth","createContextMenu","items","parentContextMenu","createItems","item","removeChildContext","relatedTarget","container","childMenuArrow","contextItemContainer","children","setAttribute","contextAddCallback","getAttribute","cPos","childContextMenuMarginLeft","childContextMenuMarginTop","createChildContext","createElement","addContent","content","appendChild","createInlineStyle","childContextMenuArrowHTML","clickIndex","Event","checkArrowVisibility","upArrow","downArrow","startHoverScroll","contextHoverScrollAmount","hoverScrollTimeout","contextHoverScrollRateMs","endHoverScroll","selectedIndex","loc","zIndexTop","color","contextMenuArrowColor","el","textAlign","zIndex","inputDropdown","maxHeight","innerHeight","autocompleteBottomMargin","minWidth","contextMenuArrowUpHTML","contextMenuArrowDownHTML","contextMenuWindowMargin","innerWidth","isFinite","createFilterContextMenuItems","fillAutoComplete","autoCompleteItems","filterInput","disposeAutocomplete","createAutoCompleteContext","iRect","autoCompleteContext","filterContainer","filterLabel","filterAutoCompleteButton","onclick","filterOptionText","replace","contextFilterButtonHTML","cf","removeFilterOptionText","addDefaultContextMenuItem","isNormalCell","isBackground","isScrollBar","showFilter","showCopy","copyText","execCommand","showClearSettingsOption","clearSettingsOptionText","allowSorting","showOrderByOption","showOrderByOptionTextAsc","showOrderByOptionTextDesc","contextmenuEvent","contextMenuMarginLeft","contextMenuMarginTop","abort","abortEdit","newValue","oldValue","aborted","editable","enumItems","enum","multiLine","option","valueInEnum","nx","ny","className","css","canvas-datagrid-context-menu-filter-input","verticalAlign","marginLeft","padding","background","contextFilterInputBackground","contextFilterInputColor","border","contextFilterInputBorder","borderRadius","contextFilterInputBorderRadius","lineHeight","fontWeight","fontFamily","contextFilterInputFontFamily","fontSize","contextFilterInputFontSize","canvas-datagrid-context-menu-filter-button","contextMenuBackground","contextMenuColor","contextFilterButtonBorder","contextFilterButtonBorderRadius","contextMenuFilterButtonFontFamily","contextMenuFilterButtonFontSize","canvas-datagrid-context-child-arrow","cssFloat","childContextMenuArrowColor","contextMenuChildArrowFontSize","contextMenuFontFamily","canvas-datagrid-autocomplete","contextMenuFontSize","contextMenuBorder","contextMenuPadding","contextMenuBorderRadius","opacity","contextMenuOpacity","overflow","canvas-datagrid-autocomplete-item","canvas-datagrid-autocomplete-item:hover","contextMenuHoverBackground","contextMenuHoverColor","canvas-datagrid-canvas","canvas-datagrid","boxSizing","canvas-datagrid-control-input","canvas-datagrid-edit-input","outline","margin","editCellPaddingLeft","editCellFontFamily","editCellFontSize","boxShadow","editCellBoxShadow","editCellBorder","editCellColor","editCellBackgroundColor","appearance","webkitAppearance","mozAppearance","canvas-datagrid-context-menu-item","contextMenuItemMargin","contextMenuItemBorderRadius","canvas-datagrid-context-menu-item:hover","canvas-datagrid-context-menu-label","contextMenuLabelMargin","display","contextMenuLabelDisplay","contextMenuLabelMinWidth","maxWidth","contextMenuLabelMaxWidth","canvas-datagrid-context-menu","canvas-datagrid-invalid-search-regExp","contextMenuFilterInvalidExpresion","prop","onblur","tagName","getContext","textBaseline","MutationObserver","mutations","mutation","observe","ordA","charCodeAt","ordZ","len","String","fromCharCode","floor","colIndex","applyFilter","isColumnSelected","colIsSelected","shift","supressEvent","addCol","ri","st","en","dragObject","rowId","childGrid","treeGridHeight","direction","sortFunction","dontSetStorageData","sort","useTouchScrollZones","tsz","touchScrollZone","isVerticalScrollBar","isHorizontalScrollBar","borderResizeZone","allowColumnResize","allowColumnResizeFromCell","allowRowHeaderResize","allowRowResize","allowRowResizeFromCell","maxCol","minCol"," ","parseInt","toUpperCase","bounds","rowHeaderCellFont","autosizePadding","autosizeHeaderCellPadding","rowHeaderCellPaddingRight","rowHeaderCellPaddingLeft","columnHeaderCellFont","headerCellPaddingRight","headerCellPaddingLeft","cellFont","cellPaddingRight","cellAutoResizePadding","total","headerCell","int","asc","localeCompare","date","Date","getTime"],"mappings":"CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,IACA,kBAAAG,gBAAAC,IACAD,UAAAH,GACA,gBAAAC,SACAA,QAAA,eAAAD,IAEAD,EAAA,eAAAC,KACCK,KAAA,WACD,MCAgB,UAAUC,GCN1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAP,OAGA,IAAAC,GAAAO,EAAAD,IACAE,EAAAF,EACAG,GAAA,EACAV,WAUA,OANAK,GAAAE,GAAAI,KAAAV,EAAAD,QAAAC,IAAAD,QAAAM,GAGAL,EAAAS,GAAA,EAGAT,EAAAD,QAvBA,GAAAQ,KA4DA,OAhCAF,GAAAM,EAAAP,EAGAC,EAAAO,EAAAL,EAGAF,EAAAQ,EAAA,SAAAd,EAAAe,EAAAC,GACAV,EAAAW,EAAAjB,EAAAe,IACAG,OAAAC,eAAAnB,EAAAe,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAV,EAAAiB,EAAA,SAAAtB,GACA,GAAAe,GAAAf,KAAAuB,WACA,WAA2B,MAAAvB,GAAA,SAC3B,WAAiC,MAAAA,GAEjC,OADAK,GAAAQ,EAAAE,EAAA,IAAAA,GACAA,GAIA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EAAA+iB,oBACAtQ,EAAAsB,sBAKCpT,MAAA/C,EAAA+B,MAAA9B,EAAAD,QAAAgC,IN+6FK,SAAU/B,EAAQD,EAASM,GOv4GjC,GAAAyB,GAAAC,CAEAD,UAmOCE,MAnODD,EAAA,WACA,YACA,iBAAAI,GACAA,EAAAmhB,UACAtX,aACA,YACA,YACA,kBACA,4BACA,sBACA,kCACA,iBACA,gBACA,6BACA,0BACA,oBACA,kBACA,uBACA,wBACA,+BACA,wBACA,yBACA,4BACA,yBACA,sBACA,8BACA,iCACA,aACA,wBACA,yBACA,sBACA,sBACA,wBACA,2BACA,wBACA,+BACA,+BACA,gCACA,sBACA,+BACA,yBACA,mDACA,qDACA,uDACA,iDACA,iCACA,mCACA,wCACA,gCACA,oBACA,0BACA,uBACA,oBACA,gBACA,qCACA,yBAEAwX,SACA,uDACA,mDACA,8BACA,uCACA,qCACA,4DACA,4CACA,yDACA,oCACA,8BACA,4BACA,6BACA,2BACA,+DACA,+CACA,mEACA,mDACA,gEACA,gDACA,gCACA,gCACA,sBACA,6CACA,6BACA,iDACA,6CACA,uBACA,iCACA,+BACA,uBACA,kBACA,gCACA,mCACA,sDACA,sCACA,wBACA,sBACA,uBACA,qBACA,yDACA,yCACA,mCACA,+BACA,qDACA,yCACA,mCACA,gCACA,6DACA,yDACA,oCACA,gDACA,2CACA,8BACA,+CACA,kEACA,kDACA,oCACA,kCACA,mCACA,iCACA,+CACA,oBACA,iEACA,0CACA,uCACA,uDACA,gEACA,uCACA,4CACA,8CACA,sCACA,gDACA,wCACA,sCACA,mDACA,yDACA,kCACA,yCACA,2CACA,mDACA,2CACA,+DACA,uCACA,+BACA,wDACA,iDACA,sCACA,gCACA,2CACA,uCACA,qCACA,oCACA,4BACA,4BACA,8BACA,6BACA,8BACA,uDACA,mDACA,oCACA,sDACA,kDACA,0BACA,oCACA,4BACA,0BACA,6CACA,sBACA,iEACA,0CACA,2DACA,qCACA,yCACA,0CACA,wCACA,qCACA,sBACA,iBACA,oB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,WAAAmsB,WAAAj0B,EAAA8H,WAAA8X,OACA5f,EAAA8H,WAAAiS,OAAA/Z,EAAA8H,WAAA8X,OACA5f,EAAA8H,WAAAosB,IAAAl0B,EAAA8H,WAAA8X,OACA5f,EAAA8H,WAAA9G,KAAAhB,EAAA8H,WAAA8X,OACA5f,EAAA8Z,QAAA8F,OAAA,SAAAE,EAAAkS,GACA,GAAAmC,GAAA,QAAAnC,CACA,iBAAA/lB,EAAA3H,GACA,WAAAzE,KAAAoM,EAAA6T,IAAA,OAAA7T,EAAA6T,GACA,MAEAjgB,KAAAyE,EAAAwb,IAAA,OAAAxb,EAAAwb,GACA,EAEAqU,EACAloB,EAAA6T,GAAAsU,cACAnoB,EAAA6T,GAAAsU,cAAA9vB,EAAAwb,IADuD,EAGvDxb,EAAAwb,GAAAsU,cACA9vB,EAAAwb,GAAAsU,cAAAnoB,EAAA6T,IADmD,IAInD9f,EAAA8Z,QAAAC,OAAA,SAAA+F,EAAAkS,GACA,GAAAmC,GAAA,QAAAnC,CACA,iBAAA/lB,EAAA3H,GACA,MAAA6vB,GACAloB,EAAA6T,GAAAxb,EAAAwb,GAEAxb,EAAAwb,GAAA7T,EAAA6T,KAGA9f,EAAA8Z,QAAAua,KAAA,SAAAvU,EAAAkS,GACA,GAAAmC,GAAA,QAAAnC,CACA,iBAAA/lB,EAAA3H,GACA,MAAA6vB,GACA,GAAAG,MAAAroB,EAAA6T,IAAAyU,UACA,GAAAD,MAAAhwB,EAAAwb,IAAAyU,UAEA,GAAAD,MAAAhwB,EAAAwb,IAAAyU,UACA,GAAAD,MAAAroB,EAAA6T,IAAAyU,cAIC5zB,MAAA/C,EAAA+B,MAAA9B,EAAAD,QAAAgC","file":"canvas-datagrid.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"canvasDatagrid\"] = factory();\n\telse\n\t\troot[\"canvasDatagrid\"] = factory();\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"canvasDatagrid\"] = factory();\n\telse\n\t\troot[\"canvasDatagrid\"] = factory();\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*jslint browser: true, unparam: true, todo: true*/\n/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/\n!(__WEBPACK_AMD_DEFINE_ARRAY__ = [\n __webpack_require__(1),\n __webpack_require__(2),\n __webpack_require__(3),\n __webpack_require__(4),\n __webpack_require__(5),\n __webpack_require__(6),\n __webpack_require__(7)\n], __WEBPACK_AMD_DEFINE_RESULT__ = function context() {\n 'use strict';\n var modules = Array.prototype.slice.call(arguments);\n function grid(args) {\n args = args || {};\n var self = {};\n self.args = args;\n self.createGrid = grid;\n modules.forEach(function (module) {\n module(self);\n });\n self.init();\n return self.intf;\n }\n if (window && !window.canvasDatagrid && !window.require) {\n window.canvasDatagrid = grid;\n }\n module.exports = grid;\n return grid;\n}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*jslint browser: true, unparam: true, todo: true*/\n/*globals XMLSerializer: false, define: true, Blob: false, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/\n!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {\n 'use strict';\n return function (self) {\n var perfCounters = [],\n drawCount = 0,\n perfWindowSize = 20;\n self.htmlImageCache = {};\n function drawOnAllImagesLoaded() {\n var loaded = true;\n Object.keys(self.htmlImageCache).forEach(function (html) {\n if (!self.htmlImageCache[html].complete) {\n loaded = false;\n }\n });\n if (loaded) {\n self.draw();\n }\n }\n function drawHtml(cell) {\n var img,\n v = cell.innerHTML || cell.formattedValue,\n x = cell.x + self.canvasOffsetLeft,\n y = cell.y + self.canvasOffsetTop;\n if (self.htmlImageCache[v]) {\n img = self.htmlImageCache[v];\n if (img.height !== cell.height || img.width !== cell.width) {\n // height and width of the cell has changed, invalidate cache\n self.htmlImageCache[v] = undefined;\n } else {\n if (!img.complete) {\n return;\n }\n return self.ctx.drawImage(img, x, y);\n }\n }\n img = new Image(cell.width, cell.height);\n self.htmlImageCache[v] = img;\n img.onload = function () {\n self.ctx.drawImage(img, x, y);\n drawOnAllImagesLoaded();\n };\n img.src = 'data:image/svg+xml;base64,' + btoa(\n '\\n' +\n '\\n' +\n '\\n' +\n v + '\\n' +\n '' +\n '\\n' +\n '\\n'\n );\n }\n function drawOrderByArrow(x, y) {\n x += self.canvasOffsetLeft;\n y += self.canvasOffsetTop;\n self.ctx.fillStyle = self.style.columnHeaderOrderByArrowColor;\n self.ctx.strokeStyle = self.style.columnHeaderOrderByArrowBorderColor;\n self.ctx.beginPath();\n x = x + self.style.columnHeaderOrderByArrowMarginLeft;\n y = y + self.style.columnHeaderOrderByArrowMarginTop;\n if (self.orderDirection === 'asc') {\n self.ctx.moveTo(x, y);\n self.ctx.lineTo(x + self.style.columnHeaderOrderByArrowWidth, y);\n self.ctx.lineTo(x + (self.style.columnHeaderOrderByArrowWidth * 0.5), y + self.style.columnHeaderOrderByArrowHeight);\n self.ctx.moveTo(x, y);\n } else {\n self.ctx.lineTo(x, y + self.style.columnHeaderOrderByArrowHeight);\n self.ctx.lineTo(x + self.style.columnHeaderOrderByArrowWidth, y + self.style.columnHeaderOrderByArrowHeight);\n self.ctx.lineTo(x + (self.style.columnHeaderOrderByArrowWidth * 0.5), y);\n self.ctx.lineTo(x, y + self.style.columnHeaderOrderByArrowHeight);\n }\n self.ctx.stroke();\n self.ctx.fill();\n return self.style.columnHeaderOrderByArrowMarginLeft\n + self.style.columnHeaderOrderByArrowWidth\n + self.style.columnHeaderOrderByArrowMarginRight;\n }\n function drawTreeArrow(cell, x, y) {\n x += self.canvasOffsetLeft;\n y += self.canvasOffsetTop;\n self.ctx.fillStyle = self.style.treeArrowColor;\n self.ctx.strokeStyle = self.style.treeArrowBorderColor;\n self.ctx.beginPath();\n x = x + self.style.treeArrowMarginLeft;\n y = y + self.style.treeArrowMarginTop;\n if (self.openChildren[cell.data[self.uniqueId]]) {\n self.ctx.moveTo(x, y);\n self.ctx.lineTo(x + self.style.treeArrowWidth, y);\n self.ctx.lineTo(x + (self.style.treeArrowWidth * 0.5), y + self.style.treeArrowHeight);\n self.ctx.moveTo(x, y);\n } else {\n self.ctx.lineTo(x, y);\n self.ctx.lineTo(x + self.style.treeArrowHeight, y + (self.style.treeArrowWidth * 0.5));\n self.ctx.lineTo(x, y + self.style.treeArrowWidth);\n self.ctx.lineTo(x, y);\n }\n self.ctx.stroke();\n self.ctx.fill();\n return self.style.treeArrowMarginLeft\n + self.style.treeArrowWidth\n + self.style.treeArrowMarginRight;\n }\n function radiusRect(x, y, w, h, radius) {\n x += self.canvasOffsetLeft;\n y += self.canvasOffsetTop;\n var r = x + w, b = y + h;\n self.ctx.beginPath();\n self.ctx.moveTo(x + radius, y);\n self.ctx.lineTo(r - radius, y);\n self.ctx.quadraticCurveTo(r, y, r, y + radius);\n self.ctx.lineTo(r, y + h - radius);\n self.ctx.quadraticCurveTo(r, b, r - radius, b);\n self.ctx.lineTo(x + radius, b);\n self.ctx.quadraticCurveTo(x, b, x, b - radius);\n self.ctx.lineTo(x, y + radius);\n self.ctx.quadraticCurveTo(x, y, x + radius, y);\n }\n function fillRect(x, y, w, h) {\n x += self.canvasOffsetLeft;\n y += self.canvasOffsetTop;\n self.ctx.fillRect(x, y, w, h);\n }\n function strokeRect(x, y, w, h) {\n x += self.canvasOffsetLeft;\n y += self.canvasOffsetTop;\n self.ctx.strokeRect(x, y, w, h);\n }\n function fillText(text, x, y) {\n x += self.canvasOffsetLeft;\n y += self.canvasOffsetTop;\n self.ctx.fillText(text, x, y);\n }\n function addBorderLine(c, pos) {\n self.ctx.beginPath();\n var p = {\n t: function () {\n self.ctx.moveTo(c.x + self.canvasOffsetLeft, c.y + self.canvasOffsetTop);\n self.ctx.lineTo(c.x + self.canvasOffsetLeft + c.width, c.y + self.canvasOffsetTop);\n },\n r: function () {\n self.ctx.moveTo(c.x + self.canvasOffsetLeft + c.width, c.y + self.canvasOffsetTop);\n self.ctx.lineTo(c.x + self.canvasOffsetLeft + c.width, c.y + self.canvasOffsetTop + c.height);\n },\n b: function () {\n self.ctx.moveTo(c.x + self.canvasOffsetLeft, c.y + self.canvasOffsetTop + c.height);\n self.ctx.lineTo(c.x + self.canvasOffsetLeft + c.width, c.y + self.canvasOffsetTop + c.height);\n },\n l: function () {\n self.ctx.moveTo(c.x + self.canvasOffsetLeft, c.y + self.canvasOffsetTop);\n self.ctx.lineTo(c.x + self.canvasOffsetLeft, c.y + self.canvasOffsetTop + c.height);\n },\n };\n p[pos]();\n self.ctx.stroke();\n }\n function addEllipsis(text, width) {\n var c, w = 0;\n if (self.ellipsisCache[text] && self.ellipsisCache[text][width]) {\n return self.ellipsisCache[text][width];\n }\n //TODO Add ellipsis back when there is a fast way to do it\n w = self.ctx.measureText(text).width;\n self.ellipsisCache[text] = self.ellipsisCache[text] || {};\n c = {value: text, width: w};\n self.ellipsisCache[text][width] = c;\n return c;\n }\n function drawText(cell) {\n var paddingLeft = self.style[cell.style + 'PaddingLeft'],\n paddingTop = self.style[cell.style + 'PaddingTop'],\n paddingRight = self.style[cell.style + 'PaddingRight'],\n paddingBottom = self.style[cell.style + 'PaddingBottom'],\n vPos = paddingTop + cell.height - (cell.height * 0.5),\n hPos = paddingLeft + cell.treeArrowWidth + cell.orderByArrowWidth;\n cell.text = addEllipsis(cell.formattedValue, cell.width - paddingRight - paddingLeft);\n cell.text.height = cell.fontHeight;\n if (cell.horizontalAlignment === 'right') {\n hPos = cell.width - cell.text.width - paddingRight;\n } else if (cell.horizontalAlignment === 'center') {\n hPos = (cell.width / 2) - (cell.text.width / 2);\n }\n if (cell.verticalAlignment === 'top') {\n vPos = paddingTop + cell.text.height;\n } else if (cell.verticalAlignment === 'bottom') {\n vPos = cell.height - paddingBottom - cell.text.height;\n }\n cell.text.x = cell.x + hPos;\n cell.text.y = cell.y + vPos;\n fillText(cell.text.value, cell.text.x, cell.text.y);\n }\n /**\n * Redraws the grid. No matter what the change, this is the only method required to refresh everything.\n * @memberof canvasDataGrid\n * @name draw\n * @method\n */\n self.draw = function (internal) {\n if (self.dispatchEvent('beforedraw', {})) { return; }\n if (!self.isChildGrid && (!self.height || !self.width)) {\n return;\n }\n if (self.isChildGrid && internal) {\n requestAnimationFrame(self.parentGrid.draw);\n return;\n }\n if (self.intf.visible === false) {\n return;\n }\n // initial values\n var checkScrollHeight, rowHeaderCell, p, cx, cy, treeGrid, rowOpen,\n rowHeight, cornerCell, y, x, c, h, w, s, r, rd, aCell,\n selectionBorders = [],\n rowHeaders = [],\n l = self.data.length,\n u = self.currentCell || {},\n rowHeaderCellHeight = self.getRowHeaderCellHeight(),\n columnHeaderCellWidth = self.getColumnHeaderCellWidth(),\n cellHeight = self.style.cellHeight;\n drawCount += 1;\n p = performance.now();\n // if data length has changed, there is no way to know\n if (self.data.length > self.orders.rows.length) {\n self.createRowOrders();\n }\n function drawScrollBars() {\n var v = {\n x: 0,\n y: 0,\n height: 0,\n width: 0,\n style: 'vertical-scroll-bar'\n },\n n = {\n x: 0,\n y: 0,\n height: 0,\n width: 0,\n style: 'horizontal-scroll-bar'\n },\n vb = {\n x: 0,\n y: 0,\n height: 0,\n width: 0,\n style: 'vertical-scroll-box'\n },\n nb = {\n x: 0,\n y: 0,\n height: 0,\n width: 0,\n style: 'horizontal-scroll-box'\n },\n co = {\n x: 0,\n y: 0,\n height: 0,\n width: 0,\n isCorner: true,\n isScrollBoxCorner: true,\n style: 'scroll-box-corner'\n },\n m = (self.style.scrollBarBoxMargin * 2),\n d = self.style.scrollBarBoxMargin * 0.5;\n self.ctx.strokeStyle = self.style.scrollBarBorderColor;\n self.ctx.lineWidth = self.style.scrollBarBorderWidth;\n // vertical\n v.x += w - self.style.scrollBarWidth - self.style.scrollBarBorderWidth - d;\n v.y += rowHeaderCellHeight;\n v.width = self.style.scrollBarWidth + self.style.scrollBarBorderWidth + d;\n v.height = h - rowHeaderCellHeight - self.style.scrollBarWidth - d - m;\n self.ctx.fillStyle = self.style.scrollBarBackgroundColor;\n fillRect(v.x, v.y, v.width, v.height + m);\n strokeRect(v.x, v.y, v.width, v.height + m);\n // vertical box\n vb.x = v.x + self.style.scrollBarBoxMargin;\n vb.y = rowHeaderCellHeight + self.style.scrollBarBoxMargin\n + ((v.height - self.scrollBox.scrollBoxHeight)\n * (self.scrollBox.scrollTop / self.scrollBox.scrollHeight));\n vb.width = self.style.scrollBarBoxWidth;\n vb.height = self.scrollBox.scrollBoxHeight;\n self.ctx.fillStyle = self.style.scrollBarBoxColor;\n if (/vertical/.test(u.context)) {\n self.ctx.fillStyle = self.style.scrollBarActiveColor;\n }\n if (vb.height < v.height) {\n radiusRect(vb.x, vb.y, vb.width, vb.height, self.style.scrollBarBoxBorderRadius);\n self.ctx.stroke();\n self.ctx.fill();\n }\n // horizontal\n n.x += columnHeaderCellWidth;\n n.y += h - self.style.scrollBarWidth - d;\n n.width = w - self.style.scrollBarWidth - columnHeaderCellWidth - d - m;\n n.height = self.style.scrollBarWidth + self.style.scrollBarBorderWidth + d;\n self.ctx.fillStyle = self.style.scrollBarBackgroundColor;\n fillRect(n.x, n.y, n.width + m, n.height);\n strokeRect(n.x, n.y, n.width + m, n.height);\n // horizontal box\n nb.y = n.y + self.style.scrollBarBoxMargin;\n nb.x = columnHeaderCellWidth + self.style.scrollBarBoxMargin\n + ((n.width - self.scrollBox.scrollBoxWidth)\n * (self.scrollBox.scrollLeft / self.scrollBox.scrollWidth));\n nb.width = self.scrollBox.scrollBoxWidth;\n nb.height = self.style.scrollBarBoxWidth;\n self.ctx.fillStyle = self.style.scrollBarBoxColor;\n if (/horizontal/.test(u.context)) {\n self.ctx.fillStyle = self.style.scrollBarActiveColor;\n }\n if (nb.width < n.width) {\n radiusRect(nb.x, nb.y, nb.width, nb.height, self.style.scrollBarBoxBorderRadius);\n self.ctx.stroke();\n self.ctx.fill();\n }\n //corner\n self.ctx.strokeStyle = self.style.scrollBarCornerBorderColor;\n self.ctx.fillStyle = self.style.scrollBarCornerBackgroundColor;\n co.x = n.x + n.width + m;\n co.y = v.y + v.height + m;\n co.width = self.style.scrollBarWidth + self.style.scrollBarBorderWidth;\n co.height = self.style.scrollBarWidth + self.style.scrollBarBorderWidth;\n radiusRect(co.x, co.y, co.width, co.height, 0);\n self.ctx.stroke();\n self.ctx.fill();\n self.visibleCells.unshift(v);\n self.visibleCells.unshift(vb);\n self.visibleCells.unshift(n);\n self.visibleCells.unshift(nb);\n self.visibleCells.unshift(co);\n self.scrollBox.bar = {\n v: v,\n h: n\n };\n self.scrollBox.box = {\n v: vb,\n h: nb\n };\n }\n function drawCell(d, rowIndex, rowOrderIndex) {\n return function drawEach(header, headerIndex, columnOrderIndex) {\n var cellStyle = header.style || 'cell',\n childGridAttributes,\n cell,\n isHeader = /HeaderCell/.test(cellStyle),\n isCorner = /cornerCell/.test(cellStyle),\n isRowHeader = 'rowHeaderCell' === cellStyle,\n isColumnHeader = 'columnHeaderCell' === cellStyle,\n selected = self.selections[rowOrderIndex] && self.selections[rowOrderIndex].indexOf(columnOrderIndex) !== -1,\n hovered = self.hovers[d[self.uniqueId]] && self.hovers[d[self.uniqueId]].indexOf(columnOrderIndex) !== -1,\n active = self.activeCell.rowIndex === rowOrderIndex && self.activeCell.columnIndex === columnOrderIndex,\n isGrid = typeof d[header.name] === 'object' && d[header.name] !== null && d[header.name] !== undefined,\n activeHeader = (self.orders.rows[self.activeCell.rowIndex] === rowOrderIndex\n || self.orders.columns[self.activeCell.columnIndex] === columnOrderIndex)\n && (columnOrderIndex === -1 || rowOrderIndex === -1)\n ? (isRowHeader ? 'activeRowHeaderCell' : 'activeColumnHeaderCell') : false,\n val,\n f = self.formatters[header.type || 'string'],\n orderByArrowSize = 0,\n treeArrowSize = 0,\n cellWidth = self.sizes.columns[isRowHeader ? 'cornerCell' : header[self.uniqueId]] || header.width,\n ev = {\n value: d[header.name],\n row: d,\n header: header\n };\n if (cellStyle === 'headerCellCap') {\n cellWidth = w - x;\n }\n // if no data or schema are defined, a width is provided to the stub column\n if (cellWidth === undefined) {\n cellWidth = self.style.columnWidth;\n }\n if (x + cellWidth + self.style.cellBorderWidth < 0) {\n x += cellWidth + self.style.cellBorderWidth;\n }\n if (active) {\n cellStyle = 'activeCell';\n }\n if (self.visibleRows.indexOf(rowIndex) === -1 && !isHeader) {\n self.visibleRows.push(rowIndex);\n }\n val = self.dispatchEvent('formatcellvalue', ev);\n if (!self.dispatchEvent('beforerendercell', ev)) {\n cx = x;\n cy = y;\n if (cellStyle === 'cornerCell') {\n cx = 0;\n cy = 0;\n } else if (isRowHeader) {\n cx = 0;\n } else if (isHeader) {\n cy = 0;\n }\n cell = {\n type: isGrid ? 'canvas-datagrid-cell' : header.type,\n style: cellStyle,\n nodeType: 'canvas-datagrid-cell',\n x: cx,\n y: cy,\n horizontalAlignment: self.style[cellStyle + 'HorizontalAlignment'],\n verticalAlignment: self.style[cellStyle + 'VerticalAlignment'],\n offsetTop: self.canvasOffsetTop + cy,\n offsetLeft: self.canvasOffsetLeft + cx,\n scrollTop: self.scrollBox.scrollTop,\n scrollLeft: self.scrollBox.scrollLeft,\n active: active || activeHeader,\n hovered: hovered,\n selected: selected,\n width: cellWidth,\n height: cellHeight,\n offsetWidth: cellWidth,\n offsetHeight: cellHeight,\n parentNode: self.intf.parentNode,\n offsetParent: self.intf.parentNode,\n data: d,\n isCorner: isCorner,\n isHeader: isHeader,\n isColumnHeader: isColumnHeader,\n isHeaderCellCap: !!header.isHeaderCellCap,\n isRowHeader: isRowHeader,\n rowOpen: rowOpen,\n header: header,\n columnIndex: columnOrderIndex,\n rowIndex: rowOrderIndex,\n sortColumnIndex: headerIndex,\n sortRowIndex: rowIndex,\n isGrid: isGrid,\n gridId: (self.attributes.name || '') + d[self.uniqueId] + ':' + header[self.uniqueId],\n parentGrid: self.intf,\n innerHTML: '',\n activeHeader: activeHeader,\n value: isHeader && !isRowHeader ? (header.title || header.name) : d[header.name]\n };\n ev.cell = cell;\n cell.userHeight = cell.isHeader ? self.sizes.rows[-1] : rowHeight;\n cell.userWidth = cell.isHeader ? self.sizes.columns.cornerCell : self.sizes.columns[header[self.uniqueId]];\n cell[self.uniqueId] = d[self.uniqueId];\n self.visibleCells.unshift(cell);\n self.ctx.fillStyle = self.style[cellStyle + 'BackgroundColor'];\n self.ctx.strokeStyle = self.style[cellStyle + 'BorderColor'];\n self.ctx.lineWidth = self.style[cellStyle + 'BorderWidth'];\n if (hovered) {\n self.ctx.fillStyle = self.style[cellStyle + 'HoverBackgroundColor'];\n self.ctx.strokeStyle = self.style[cellStyle + 'HoverBorderColor'];\n }\n if (selected) {\n self.ctx.fillStyle = self.style[cellStyle + 'SelectedBackgroundColor'];\n self.ctx.strokeStyle = self.style[cellStyle + 'SelectedBorderColor'];\n }\n if (activeHeader) {\n self.ctx.fillStyle = self.style[activeHeader + 'BackgroundColor'];\n }\n self.dispatchEvent('rendercell', ev);\n if (cell.isGrid) {\n if (cell.height !== rowHeight) {\n cell.height = rowHeight || self.style.cellHeightWithChildGrid;\n checkScrollHeight = true;\n }\n cell.width = self.sizes.columns[header[self.uniqueId]] || self.style.cellWidthWithChildGrid;\n }\n if (rowOpen && !cell.isRowHeader) {\n cell.height = self.sizes.rows[rd[self.uniqueId]] || self.style.cellHeight;\n }\n if (!cell.isGrid) {\n fillRect(cx, cy, cell.width, cell.height);\n strokeRect(cx, cy, cell.width, cell.height);\n }\n self.ctx.save();\n radiusRect(cell.x, cell.y, cell.width, cell.height, 0);\n self.ctx.clip();\n self.dispatchEvent('afterrendercell', ev);\n if (cell.height !== cellHeight && !(rowOpen && !cell.isRowHeader)) {\n self.sizes.rows[isHeader ? -1 : d[self.uniqueId]] = cell.height;\n checkScrollHeight = true;\n }\n if (cell.width !== cellWidth) {\n self.sizes.columns[header[self.uniqueId]] = cell.width;\n checkScrollHeight = true;\n }\n if (isRowHeader && self.attributes.tree) {\n if (!self.dispatchEvent('rendertreearrow', ev)) {\n treeArrowSize = drawTreeArrow(cell, self.style[cellStyle + 'PaddingLeft'], cy, 0);\n }\n }\n if ((self.attributes.showRowNumbers && isRowHeader)\n || !isRowHeader) {\n if (cell.isGrid) {\n if (!self.childGrids[cell.gridId]) {\n childGridAttributes = self.args.childGridAttributes || self.args;\n childGridAttributes.name = self.attributes.saveAppearance ? cell.gridId : undefined;\n childGridAttributes.parentNode = cell;\n childGridAttributes.data = d[header.name];\n self.childGrids[cell.gridId] = self.createGrid(childGridAttributes);\n self.sizes.rows[rd[self.uniqueId]]\n = self.sizes.rows[rd[self.uniqueId]] || self.style.cellGridHeight;\n checkScrollHeight = true;\n }\n cell.grid = self.childGrids[cell.gridId];\n cell.grid.parentNode = cell;\n cell.grid.visible = true;\n cell.grid.draw();\n self.dispatchEvent('rendercellgrid', ev);\n } else {\n if (self.childGrids[cell.gridId]) {\n self.childGrids[cell.gridId].parentNode.offsetHeight = 0;\n }\n if (isHeader && self.orderBy === header.name) {\n if (!self.dispatchEvent('renderorderbyarrow', ev)) {\n orderByArrowSize = drawOrderByArrow(cx + self.style[cellStyle + 'PaddingLeft'], 0);\n }\n }\n self.ctx.fillStyle = self.style[cellStyle + 'Color'];\n if (hovered) {\n self.ctx.fillStyle = self.style[cellStyle + 'HoverColor'];\n }\n if (selected) {\n self.ctx.fillStyle = self.style[cellStyle + 'SelectedColor'];\n }\n if (activeHeader) {\n self.ctx.fillStyle = self.style[activeHeader + 'Color'];\n }\n self.ctx.font = self.style[cellStyle + 'Font'];\n cell.fontHeight = self.style[cellStyle + 'FontHeight'];\n cell.treeArrowWidth = treeArrowSize;\n cell.orderByArrowWidth = orderByArrowSize;\n val = val !== undefined ? val : f\n ? f(ev) : '';\n if (val === undefined && !f) {\n val = '';\n console.warn('canvas-datagrid: Unknown format '\n + header.type + ' add a cellFormater');\n }\n cell.formattedValue = ((val !== undefined && val !== null) ? val : '').toString();\n if (self.columnFilters && self.columnFilters[val] !== undefined && isHeader) {\n cell.formattedValue = self.attributes.filterTextPrefix + val;\n }\n if (!self.dispatchEvent('rendertext', ev)) {\n if (cell.innerHTML || header.type === 'html') {\n drawHtml(cell);\n } else {\n drawText(cell);\n }\n }\n }\n }\n if (active) {\n aCell = cell;\n }\n if (selected && !isRowHeader) {\n if ((!self.selections[cell.rowIndex - 1]\n || self.selections[cell.rowIndex - 1].indexOf(cell.columnIndex) === -1\n || cell.rowIndex === 0)\n && !cell.isHeader) {\n selectionBorders.push([cell, 't']);\n }\n if (!self.selections[cell.rowIndex + 1]\n || self.selections[cell.rowIndex + 1].indexOf(cell.columnIndex) === -1) {\n selectionBorders.push([cell, 'b']);\n }\n if (!self.selections[cell.rowIndex] || cell.columnIndex === 0\n || self.selections[cell.rowIndex].indexOf(cell.columnIndex - 1) === -1) {\n selectionBorders.push([cell, 'l']);\n }\n if (!self.selections[cell.rowIndex] || cell.columnIndex === s.length\n || self.selections[cell.rowIndex].indexOf(cell.columnIndex + 1) === -1) {\n selectionBorders.push([cell, 'r']);\n }\n }\n self.ctx.restore();\n x += cell.width + self.style.cellBorderWidth;\n return cell.width;\n }\n };\n }\n function drawRowHeader(rowData, index, rowOrderIndex) {\n var a;\n if (self.attributes.showRowHeaders) {\n x = 0;\n rowHeaderCell = {'rowHeaderCell': index + 1 };\n rowHeaderCell[self.uniqueId] = rowData[self.uniqueId];\n a = {\n name: 'rowHeaderCell',\n width: self.style.rowHeaderCellWidth,\n style: 'rowHeaderCell',\n type: 'string',\n data: rowData[self.uniqueId],\n index: -1\n };\n a[self.uniqueId] = rowData[self.uniqueId];\n rowOpen = self.openChildren[rowData[self.uniqueId]];\n drawCell(rowHeaderCell, index, rowOrderIndex)(a, -1, -1);\n }\n }\n function drawHeaders() {\n var d, g = s.length, i, o, columnHeaderCell, header;\n rowHeaders.forEach(function (rArgs) {\n y = rArgs[3];\n cellHeight = rArgs[4];\n drawRowHeader(rArgs[0], rArgs[1], rArgs[2]);\n });\n if (self.attributes.showColumnHeaders) {\n x = (self.scrollBox.scrollLeft * -1) + self.scrollPixelLeft;\n if (self.attributes.showRowHeaders) {\n x += columnHeaderCellWidth;\n }\n y = 0;\n // cell height might have changed during drawing\n cellHeight = self.getRowHeaderCellHeight();\n for (o = self.scrollIndexLeft; o < g; o += 1) {\n i = self.orders.columns[o];\n header = s[i];\n d = {\n title: header.title,\n name: header.name,\n width: header.width,\n style: 'columnHeaderCell',\n type: 'string',\n index: o,\n order: i\n };\n columnHeaderCell = {'columnHeaderCell': header.title || header.name};\n columnHeaderCell[self.uniqueId] = 'h' + header[self.uniqueId];\n d[self.uniqueId] = header[self.uniqueId];\n x += drawCell(columnHeaderCell, -1, -1)(d, o, i);\n if (x > self.width + self.scrollBox.scrollLeft) {\n break;\n }\n }\n // fill in the space right of the headers\n if (x < w) {\n c = {\n name: '',\n width: self.style.scrollBarWidth,\n style: 'headerCellCap',\n isHeaderCell: true,\n isHeaderCellCap: true,\n type: 'string',\n index: s.length\n };\n c[self.uniqueId] = 'columnHeaderCell';\n drawCell({endCap: ''}, -1, -1)(c, -1, -1);\n }\n // fill in the space right of the headers\n if (self.attributes.showRowHeaders) {\n cornerCell = {'cornerCell': '' };\n cornerCell[self.uniqueId] = 'cornerCell';\n x = 0;\n c = {\n name: 'cornerCell',\n width: self.style.rowHeaderCellWidth,\n style: 'cornerCell',\n type: 'string',\n index: -1\n };\n c[self.uniqueId] = 'cornerCell';\n drawCell(cornerCell, -1, -1)(c, -1, -1);\n }\n }\n }\n function drawRow(r, d) {\n var i, treeHeight, rowSansTreeHeight, o, g = s.length;\n if (y - (cellHeight * 2) > h) {\n return false;\n }\n rd = self.data[r];\n rowOpen = self.openChildren[rd[self.uniqueId]];\n rowSansTreeHeight = self.sizes.rows[rd[self.uniqueId]] || self.style.cellHeight;\n treeHeight = (rowOpen ? self.sizes.trees[rd[self.uniqueId]] : 0);\n rowHeight = rowSansTreeHeight + treeHeight;\n if (y < rowHeight * -1) {\n return false;\n }\n if (self.attributes.showRowHeaders) {\n x += columnHeaderCellWidth;\n }\n cellHeight = rowHeight;\n for (o = self.scrollIndexLeft; o < g; o += 1) {\n i = self.orders.columns[o];\n x += drawCell(rd, r, d)(s[i], i, o);\n if (x > self.width) {\n break;\n }\n }\n // cell height might have changed during drawing\n cellHeight = rowHeight;\n x = (self.scrollBox.scrollLeft * -1) + self.scrollPixelLeft + self.style.cellBorderWidth;\n // don't draw a tree for the new row\n treeGrid = self.childGrids[rd[self.uniqueId]];\n if (r !== self.data.length && rowOpen) {\n treeGrid.visible = true;\n treeGrid.parentNode = {\n offsetTop: y + rowSansTreeHeight + self.canvasOffsetTop,\n offsetLeft: columnHeaderCellWidth - 1 + self.canvasOffsetLeft,\n offsetHeight: treeHeight,\n offsetWidth: self.width - columnHeaderCellWidth - self.style.scrollBarWidth - 1,\n offsetParent: self.intf.parentNode,\n parentNode: self.intf.parentNode,\n style: self.style,\n nodeType: 'canvas-datagrid-tree',\n scrollTop: self.scrollBox.scrollTop,\n scrollLeft: self.scrollBox.scrollLeft,\n rowIndex: r\n };\n self.visibleCells.unshift({\n rowIndex: x,\n columnIndex: 0,\n y: treeGrid.parentNode.offsetTop,\n x: treeGrid.parentNode.offsetLeft,\n height: treeGrid.parentNode.offsetHeight,\n width: treeGrid.parentNode.offsetWidth,\n style: 'tree-grid',\n type: treeGrid.parentNode.nodeType\n });\n treeGrid.draw();\n } else if (treeGrid) {\n treeGrid.parentNode.offsetHeight = 0;\n delete self.sizes.trees[rd[self.uniqueId]];\n }\n rowHeaders.push([rd, r, d, y, rowHeight]);\n y += cellHeight + self.style.cellBorderWidth;\n return true;\n }\n function initDraw() {\n self.visibleRows = [];\n s = self.getVisibleSchema();\n self.visibleCells = [];\n self.canvasOffsetTop = self.isChildGrid ? self.parentNode.offsetTop : 0;\n self.canvasOffsetLeft = self.isChildGrid ? self.parentNode.offsetLeft : 0;\n h = self.height;\n w = self.width;\n if (!self.isChildGrid) {\n self.ctx.scale(window.devicePixelRatio, window.devicePixelRatio);\n }\n }\n function drawBackground() {\n radiusRect(0, 0, w, h, 0);\n self.ctx.clip();\n self.ctx.fillStyle = self.style.backgroundColor;\n fillRect(0, 0, w, h);\n }\n function drawRows() {\n var o, n, i, g = s.length;\n x = (self.scrollBox.scrollLeft * -1) + self.scrollPixelLeft + self.style.cellBorderWidth;\n y = (self.scrollBox.scrollTop * -1) + rowHeaderCellHeight + self.scrollPixelTop + self.style.cellBorderWidth;\n for (r = self.scrollIndexTop; r < l; r += 1) {\n n = self.orders.rows[r];\n if (!drawRow(n, r)) {\n break;\n }\n }\n if (self.attributes.showNewRow) {\n if (self.attributes.showRowHeaders) {\n x += columnHeaderCellWidth;\n }\n rowHeight = cellHeight = self.style.cellHeight;\n rowOpen = false;\n for (o = self.scrollIndexLeft; o < g; o += 1) {\n i = self.orders.columns[o];\n x += drawCell(self.newRow, self.data.length, self.data.length)(s[i], i, o);\n if (x > self.width + self.scrollBox.scrollLeft) {\n break;\n }\n }\n rowHeaders.push([self.newRow, self.data.length, self.data.length, y, rowHeight]);\n }\n }\n function drawReorderMarkers() {\n if (!self.reorderObject) { return; }\n var b = {\n height: self.reorderObject.height,\n width: self.reorderObject.width,\n x: self.reorderObject.x + self.reorderObject.dragOffset.x,\n y: self.reorderObject.y + self.reorderObject.dragOffset.y\n },\n m = {\n width: w,\n heigth: h,\n x: 0,\n y: 0\n };\n self.ctx.fillStyle = self.style.reorderMarkerBackgroundColor;\n self.ctx.lineWidth = self.style.reorderMarkerBorderWidth;\n self.ctx.strokeStyle = self.style.reorderMarkerBorderColor;\n if (self.dragMode === 'row-reorder') {\n b.width = w;\n b.x = 0;\n m.width = w;\n m.y = self.currentCell.y;\n fillRect(b.x, b.y, b.width, b.height);\n strokeRect(b.x, b.y, b.width, b.height);\n self.ctx.lineWidth = self.style.reorderMarkerIndexBorderWidth;\n self.ctx.strokeStyle = self.style.reorderMarkerIndexBorderColor;\n if (self.currentCell.rowIndex !== self.reorderObject.rowIndex\n && self.currentCell.rowIndex - 1 !== self.reorderObject.rowIndex) {\n addBorderLine(m, 't');\n }\n } else if (self.dragMode === 'column-reorder' && self.reorderObject) {\n b.height = h;\n b.y = 0;\n m.height = h;\n m.x = self.currentCell.x;\n fillRect(b.x, b.y, b.width, b.height);\n strokeRect(b.x, b.y, b.width, b.height);\n self.ctx.lineWidth = self.style.reorderMarkerIndexBorderWidth;\n self.ctx.strokeStyle = self.style.reorderMarkerIndexBorderColor;\n if (self.currentCell.columnIndex !== self.reorderObject.columnIndex\n && self.currentCell.columnIndex - 1 !== self.reorderObject.columnIndex) {\n addBorderLine(m, 'l');\n }\n }\n }\n function drawBorder() {\n self.ctx.lineWidth = self.style.gridBorderWidth;\n self.ctx.strokeStyle = self.style.gridBorderColor;\n strokeRect(0, 0, self.width, self.height);\n }\n function drawSelectionBorders() {\n self.ctx.lineWidth = self.style.selectionOverlayBorderWidth;\n self.ctx.strokeStyle = self.style.selectionOverlayBorderColor;\n selectionBorders.forEach(function (c) {\n addBorderLine(c[0], c[1]);\n });\n }\n function drawActiveCell() {\n if (!aCell) { return; }\n if (self.attributes.rowSelectionMode) {\n if (self.activeCell && self.activeCell.rowIndex === aCell.rowIndex) {\n self.ctx.lineWidth = self.style.activeCellOverlayBorderWidth;\n self.ctx.strokeStyle = self.style.activeCellOverlayBorderColor;\n strokeRect(0, aCell.y, self.getHeaderWidth() + columnHeaderCellWidth, rowHeight);\n }\n } else {\n self.ctx.lineWidth = self.style.activeCellOverlayBorderWidth;\n self.ctx.strokeStyle = self.style.activeCellOverlayBorderColor;\n strokeRect(aCell.x, aCell.y, aCell.width, aCell.height);\n }\n\n }\n function drawDebug() {\n perfCounters[drawCount % perfWindowSize] = performance.now() - p;\n var d;\n if (self.attributes.debug) {\n self.ctx.font = '11px sans-serif';\n d = {};\n d.perf = (perfCounters.reduce(function (a, b) {\n return a + b;\n }, 0) / perfCounters.length).toFixed(1)\n + 'ms (' +\n perfCounters.map(function (a) { return a.toFixed(1); }).join(', ') + ')';\n d.htmlImages = Object.keys(self.htmlImageCache).length;\n d.scrollLeft = self.scrollBox.scrollLeft;\n d.scrollTop = self.scrollBox.scrollTop;\n d.scrollIndexTop = self.scrollIndexTop;\n d.scrollPixelTop = self.scrollPixelTop;\n d.scrollIndexLeft = self.scrollIndexLeft;\n d.scrollPixelLeft = self.scrollPixelLeft;\n d.canvasOffsetLeft = self.canvasOffsetLeft;\n d.canvasOffsetTop = self.canvasOffsetTop;\n d.width = self.width;\n d.height = self.height;\n d.mousex = self.mouse.x;\n d.mousey = self.mouse.y;\n d.touchx = !self.touchStart ? 0 : self.touchStart.x;\n d.touchy = !self.touchStart ? 0 : self.touchStart.y;\n d.entities = self.visibleCells.length;\n d.hasFocus = self.hasFocus;\n d.dragMode = self.dragMode;\n if (self.currentCell) {\n d.columnIndex = self.currentCell.columnIndex;\n d.rowIndex = self.currentCell.rowIndex;\n d.sortColumnIndex = self.currentCell.sortColumnIndex;\n d.sortRowIndex = self.currentCell.sortRowIndex;\n d.context = self.currentCell.context;\n d.dragContext = self.currentCell.dragContext;\n d.style = self.currentCell.style;\n d.type = self.currentCell.type;\n }\n self.ctx.save();\n Object.keys(d).forEach(function (key, index) {\n var m = key + ': ' + d[key],\n lh = 14;\n self.ctx.fillStyle = 'rgba(255, 255, 255, 0.8)';\n fillRect(columnHeaderCellWidth, lh + (index * lh), 100, lh);\n self.ctx.fillStyle = 'rgba(0, 0, 0, 1)';\n fillText(m, columnHeaderCellWidth + 1, rowHeaderCellHeight + (index * lh));\n });\n self.ctx.restore();\n }\n }\n self.ctx.save();\n initDraw();\n drawBackground();\n drawRows();\n drawSelectionBorders();\n drawActiveCell();\n drawHeaders();\n drawReorderMarkers();\n drawScrollBars();\n if (checkScrollHeight) {\n self.resize(true);\n }\n drawBorder();\n drawDebug();\n if (self.dispatchEvent('afterdraw', {})) { return; }\n self.ctx.restore();\n };\n };\n}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*jslint browser: true, unparam: true, todo: true*/\n/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/\n!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {\n 'use strict';\n return function (self) {\n var touchDelta = {x: 0, y: 0, scrollTop: 0, scrollLeft: 0},\n touchAnimateTo = {scrollLeft: 0, scrollTop: 0},\n touchSigma = {scrollLeft: 0, scrollTop: 0},\n xPPS = 0,\n yPPS = 0,\n touchingCell = false,\n startingCell = false,\n animationFrames = 0;\n self.getTouchPos = function (e) {\n var rect = self.canvas.getBoundingClientRect(),\n pos = {\n x: e.touches[0].clientX - rect.left,\n y: e.touches[0].clientY - rect.top\n };\n if (self.isChildGrid) {\n pos.x -= self.canvasOffsetLeft;\n pos.y -= self.canvasOffsetTop;\n }\n return {\n x: pos.x,\n y: pos.y,\n rect: rect\n };\n };\n self.calculatePPS = function () {\n xPPS = ((touchDelta.scrollLeft - touchSigma.scrollLeft) / (touchDelta.t - touchSigma.t));\n yPPS = ((touchDelta.scrollTop - touchSigma.scrollTop) / (touchDelta.t - touchSigma.t));\n touchSigma = {\n scrollLeft: touchDelta.scrollLeft,\n scrollTop: touchDelta.scrollTop,\n t: performance.now() / 1000\n };\n };\n self.touchCell = function (e) {\n return function () {\n clearInterval(self.touchCalcTimeout);\n var pos = self.getTouchPos(e);\n if (Math.abs(touchDelta.x) + Math.abs(touchDelta.y) < self.attributes.touchDeadZone) {\n touchingCell = self.getCellAt(pos.x, pos.y);\n self.mousemove(e, pos);\n self.mousedown(e, pos);\n self.mousemove(e, pos);\n self.draw();\n }\n };\n };\n self.touchstart = function (e) {\n touchingCell = false;\n self.touchStart = self.getTouchPos(e);\n startingCell = self.getCellAt(self.touchStart.x, self.touchStart.y, true);\n if (self.dispatchEvent('touchstart', {NativeEvent: e, cell: self.startingCell})) { return; }\n if (!self.hasFocus) { return; }\n self.stopPropagation(e);\n e.preventDefault();\n if (e.touches.length === 2) {\n return self.contextmenu(e, self.touchStart);\n }\n self.touchScrollStart = {\n scrollLeft: self.scrollBox.scrollLeft,\n scrollTop: self.scrollBox.scrollTop,\n t: performance.now() / 1000\n };\n touchDelta = {\n x: self.touchStart.x,\n y: self.touchStart.y,\n scrollLeft: self.scrollBox.scrollLeft,\n scrollTop: self.scrollBox.scrollTop,\n t: 0\n };\n self.touchmove(e);\n clearTimeout(self.touchTimeout);\n clearInterval(self.touchCalcTimeout);\n self.touchTimeout = setTimeout(self.touchCell(e), self.attributes.touchSelectTimeMs);\n self.touchCalcTimeout = setInterval(self.calculatePPS, 20);\n self.touchHaltAnimation = true;\n document.body.addEventListener('touchmove', self.touchmove, {passive: false});\n document.body.addEventListener('touchend', self.touchend, false);\n document.body.addEventListener('touchcancel', self.touchcancel, false);\n };\n self.easing = function (t, b, c, d) {\n return c * (t / d) * (2 - t) + b;\n };\n self.touchEndAnimation = function () {\n if (!self.canvas || !self.scrollBox.scrollTo) { return requestAnimationFrame(self.touchEndAnimation); }\n var x,\n y,\n n = performance.now() / 1000,\n d = (self.attributes.touchReleaseAnimationDurationMs / 1000),\n t;\n touchDelta.t = touchDelta.t || n + d;\n t = n - touchDelta.t + 1;\n if (t > 1 || self.touchHaltAnimation || (animationFrames > 1000)) {\n animationFrames = 0;\n self.touchHaltAnimation = false;\n touchAnimateTo = {scrollLeft: -1, scrollTop: -1};\n return;\n }\n animationFrames += 1;\n x = self.easing(t, touchDelta.scrollLeft, -touchAnimateTo.scrollLeft, d);\n y = self.easing(t, touchDelta.scrollTop, -touchAnimateTo.scrollTop, d);\n self.scrollBox.scrollTo(x, y);\n requestAnimationFrame(self.touchEndAnimation);\n };\n self.touchend = function (e) {\n if (self.dispatchEvent('touchend', {NativeEvent: e})) { return; }\n var dz = Math.abs(touchDelta.x) + Math.abs(touchDelta.y) < self.attributes.touchDeadZone,\n pos = {\n x: self.touchStart.x + touchDelta.x,\n y: self.touchStart.y + touchDelta.y\n },\n cell = self.getCellAt(pos.x, pos.y);\n if (!self.hasFocus) { return; }\n if (touchingCell) {\n self.mouseup(e, self.touchStart);\n } else if (dz) {\n if (cell.active) {\n self.beginEditAt(cell.columnIndex, cell.rowIndex);\n } else {\n self.mousedown(e, self.touchStart);\n self.mouseup(e, self.touchStart);\n self.click(e, self.touchStart);\n }\n }\n touchingCell = false;\n document.body.removeEventListener('touchmove', self.touchmove, {passive: false});\n document.body.removeEventListener('touchend', self.touchend, false);\n document.body.removeEventListener('touchcancel', self.touchcancel, false);\n clearTimeout(self.touchTimeout);\n clearInterval(self.touchCalcTimeout);\n self.calculatePPS();\n touchAnimateTo.scrollLeft = xPPS * self.attributes.touchReleaseAcceleration;\n touchAnimateTo.scrollTop = yPPS * self.attributes.touchReleaseAcceleration;\n self.touchHaltAnimation = false;\n if (animationFrames === 0 && !/-scroll-/.test(startingCell.style) && !dz) {\n self.touchEndAnimation();\n }\n };\n self.touchmove = function (e) {\n var d = self.getTouchPos(e);\n if (self.dispatchEvent('touchmove', {NativeEvent: e, cell: self.currentCell})) { return; }\n self.stopPropagation(e);\n e.preventDefault();\n if (!self.hasFocus) { return; }\n touchDelta = {\n x: d.x - self.touchStart.x,\n y: d.y - self.touchStart.y,\n scrollLeft: self.scrollBox.scrollLeft,\n scrollTop: self.scrollBox.scrollTop,\n t: 0\n };\n if (/vertical-scroll-/.test(startingCell.style)) {\n self.scrollBox.scrollTop = self.scrollBox.scrollHeight * (d.y / self.height);\n } else if (/horizontal-scroll-/.test(startingCell.style)) {\n self.scrollBox.scrollLeft = self.scrollBox.scrollWidth * (d.x / self.width);\n } else if (touchingCell) {\n self.mousemove(e, d);\n self.draw();\n } else {\n if (animationFrames === 0) {\n self.scrollBox.scrollTo(self.touchScrollStart.scrollLeft - touchDelta.x,\n self.touchScrollStart.scrollTop - touchDelta.y);\n }\n }\n };\n self.touchcancel = function (e) {\n if (self.dispatchEvent('touchcancel', {NativeEvent: e, cell: self.currentCell})) { return; }\n if (!self.hasFocus) { return; }\n self.touchend(e);\n touchingCell = false;\n document.body.removeEventListener('touchmove', self.touchmove, {passive: false});\n document.body.removeEventListener('touchend', self.touchend, false);\n document.body.removeEventListener('touchcancel', self.touchcancel, false);\n return;\n };\n self.stopPropagation = function (e) { e.stopPropagation(); };\n self.addEventListener = function (ev, fn) {\n self.events[ev] = self.events[ev] || [];\n self.events[ev].unshift(fn);\n };\n self.removeEventListener = function (ev, fn) {\n (self.events[ev] || []).forEach(function removeEachListener(sfn, idx) {\n if (fn === sfn) {\n self.events[ev].splice(idx, 1);\n }\n });\n };\n self.dispatchEvent = function (ev, e) {\n var defaultPrevented;\n function preventDefault() {\n defaultPrevented = true;\n }\n if (!self.events[ev]) { return; }\n self.events[ev].forEach(function dispatchEachEvent(fn) {\n e.ctx = self.ctx;\n e.preventDefault = preventDefault;\n fn.apply(self.intf, [e]);\n });\n return defaultPrevented;\n };\n self.resize = function (drawAfterResize) {\n var cellBorder = self.style.cellBorderWidth * 2,\n columnHeaderCellBorder = self.style.columnHeaderCellBorderWidth * 2,\n scrollHeight,\n scrollWidth,\n rowHeaderCellHeight = self.getRowHeaderCellHeight(),\n columnHeaderCellWidth = self.getColumnHeaderCellWidth(),\n // TODO: What the hell are these numbers!? They are probably some value in the style.\n scrollDragPositionOffsetY = 30,\n scrollDragPositionOffsetX = 15;\n if (self.isChildGrid) {\n self.height = self.parentNode.offsetHeight;\n self.width = self.parentNode.offsetWidth;\n } else {\n self.parentNode = self.parentDOMNode;\n if (!self.parentIsCanvas) {\n self.height = self.parentDOMNode.offsetHeight;\n self.width = self.parentDOMNode.offsetWidth;\n self.canvas.height = self.height * window.devicePixelRatio;\n self.canvas.width = self.width * window.devicePixelRatio;\n self.canvas.style.height = self.height + 'px';\n self.canvas.style.width = self.width + 'px';\n }\n self.canvasOffsetTop = self.args.canvasOffsetTop || 0;\n self.canvasOffsetLeft = self.args.canvasOffsetLeft || 0;\n }\n scrollHeight = self.data.reduce(function reduceData(accumulator, row) {\n return accumulator\n + (self.sizes.rows[row[self.uniqueId]] || self.style.cellHeight)\n + (self.sizes.trees[row[self.uniqueId]] || 0)\n + cellBorder;\n }, 0) || 0;\n scrollWidth = self.getVisibleSchema().reduce(function reduceSchema(accumulator, column) {\n if (column.hidden) { return accumulator; }\n return accumulator + (self.sizes.columns[column[self.uniqueId]] || column.width || self.style.columnWidth) + cellBorder;\n }, 0) || 0;\n if (self.attributes.showNewRow) {\n scrollHeight += self.style.cellHeight + cellBorder;\n }\n self.scrollBox.width = self.width - columnHeaderCellWidth;\n self.scrollBox.height = self.height - rowHeaderCellHeight - columnHeaderCellBorder;\n self.scrollBox.top = rowHeaderCellHeight + columnHeaderCellBorder;\n self.scrollBox.left = columnHeaderCellWidth;\n self.scrollBox.scrollHeight = scrollHeight + self.style.scrollBarWidth - self.scrollBox.height;\n self.scrollBox.scrollWidth = scrollWidth + self.style.scrollBarWidth - self.scrollBox.width;\n self.scrollBox.widthBoxRatio = ((self.scrollBox.width - scrollDragPositionOffsetX)\n / (self.scrollBox.scrollWidth + self.scrollBox.width - scrollDragPositionOffsetX));\n self.scrollBox.scrollBoxWidth = self.scrollBox.width\n * self.scrollBox.widthBoxRatio\n - self.style.scrollBarWidth;\n self.scrollBox.heightBoxRatio = ((self.scrollBox.height - scrollDragPositionOffsetY)\n / (self.scrollBox.scrollHeight + (self.scrollBox.height - scrollDragPositionOffsetY)));\n self.scrollBox.scrollBoxHeight = self.scrollBox.height\n * self.scrollBox.heightBoxRatio\n - self.style.scrollBarWidth;\n self.scrollBox.scrollBoxWidth = Math.max(self.scrollBox.scrollBoxWidth, self.style.scrollBarBoxMinSize);\n self.scrollBox.scrollBoxHeight = Math.max(self.scrollBox.scrollBoxHeight, self.style.scrollBarBoxMinSize);\n self.page = self.visibleRows.length - 3 - self.attributes.pageUpDownOverlap;\n self.resizeEditInput();\n self.scroll(true);\n if (drawAfterResize) {\n self.draw(true);\n }\n self.dispatchEvent('resize', {});\n return true;\n };\n self.resizeEditInput = function () {\n if (self.input) {\n var pos = self.canvas.getBoundingClientRect(),\n s = self.scrollOffset(self.canvas),\n bx2 = (self.style.cellBorderWidth * 2),\n cell = self.getVisibleCellByIndex(self.input.editCell.columnIndex, self.input.editCell.rowIndex)\n || {x: -100, y: -100, height: 0, width: 0};\n self.input.style.left = pos.left + cell.x - self.style.cellBorderWidth + self.canvasOffsetLeft - s.left + 'px';\n self.input.style.top = pos.top + cell.y - bx2 + self.canvasOffsetTop - s.top + 'px';\n self.input.style.height = cell.height - bx2 - 1 + 'px';\n self.input.style.width = cell.width - bx2 - self.style.cellPaddingLeft + 'px';\n self.clipElement(self.input);\n }\n };\n self.scroll = function (e, dontDraw) {\n var s = self.getVisibleSchema(),\n cellBorder = self.style.cellBorderWidth * 2;\n self.scrollIndexTop = 0;\n self.scrollPixelTop = 0;\n self.scrollIndexLeft = 0;\n self.scrollPixelLeft = 0;\n while (self.scrollPixelTop < self.scrollBox.scrollTop && self.scrollIndexTop < self.data.length) {\n self.scrollPixelTop +=\n (self.sizes.rows[self.data[self.scrollIndexTop][self.uniqueId]] || self.style.cellHeight)\n + (self.sizes.trees[self.data[self.scrollIndexTop][self.uniqueId]] || 0)\n + cellBorder;\n self.scrollIndexTop += 1;\n }\n while (self.scrollPixelLeft < self.scrollBox.scrollLeft && self.scrollIndexLeft < s.length) {\n self.scrollPixelLeft +=\n (self.sizes.columns[s[self.scrollIndexLeft][self.uniqueId]] || s[self.scrollIndexLeft].width);\n self.scrollIndexLeft += 1;\n }\n if (self.data.length > 0) {\n self.scrollIndexLeft = Math.max(self.scrollIndexLeft - 1, 0);\n self.scrollPixelLeft = Math.max(self.scrollPixelLeft\n - (self.sizes.columns[s[self.scrollIndexLeft][self.uniqueId]] || s[self.scrollIndexLeft].width), 0);\n self.scrollIndexTop = Math.max(self.scrollIndexTop - 1, 0);\n self.scrollPixelTop = Math.max(self.scrollPixelTop\n - (self.sizes.rows[self.data[self.scrollIndexTop][self.uniqueId]] || self.style.cellHeight)\n - (self.sizes.trees[self.data[self.scrollIndexTop][self.uniqueId]] || 0), 0);\n }\n self.ellipsisCache = {};\n if (!dontDraw) {\n self.draw(true);\n }\n //TODO: figure out why this has to be delayed for child grids\n //BUG: scrolling event on 3rd level hierarchy fails to move input box\n requestAnimationFrame(self.resizeEditInput);\n self.dispatchEvent('scroll', {top: self.scrollBox.scrollTop, left: self.scrollBox.scrollLeft});\n };\n self.mousemove = function (e, overridePos) {\n if (self.contextMenu || self.input) {\n return;\n }\n self.mouse = overridePos || self.getLayerPos(e);\n var ctrl = (e.controlKey || e.metaKey || self.attributes.persistantSelectionMode),\n i,\n s = self.getSchema(),\n dragBounds,\n sBounds,\n x = self.mouse.x,\n y = self.mouse.y,\n o = self.getCellAt(x, y),\n delta,\n ev = {NativeEvent: e, cell: o, x: x, y: y},\n previousCell = self.currentCell;\n clearTimeout(self.scrollTimer);\n if (!self.isInGrid({x: x, y: y})) {\n self.hasFocus = false;\n }\n if (self.dispatchEvent('mousemove', ev)) {\n return;\n }\n if (o && self.currentCell && (self.currentCell.rowIndex !== o.rowIndex\n || self.currentCell.columnIndex !== o.columnIndex)) {\n self.cellBoundaryCrossed = true;\n ev.cell = previousCell;\n self.dispatchEvent('cellmouseout', ev);\n ev.cell = o;\n self.dispatchEvent('cellmouseover', ev);\n }\n self.currentCell = o;\n if (!self.hasFocus) {\n return;\n }\n self.hovers = {};\n if (!self.draggingItem\n && o\n && self.scrollModes.indexOf(o.context) === -1) {\n self.dragItem = o;\n self.dragMode = o.dragContext;\n self.canvas.style.cursor = o.context;\n if (o.context === 'cell' && o.data) {\n self.canvas.style.cursor = 'pointer';\n self.hovers[o.data[self.uniqueId]] = [o.columnIndex];\n }\n if ((self.selecting || self.reorderObject)\n && o.context === 'cell'\n && o.data) {\n sBounds = self.getSelectionBounds();\n delta = {\n x: Math.abs(self.dragStart.x - x),\n y: Math.abs(self.dragStart.y - y),\n };\n if (self.dragStartObject.columnIndex !== -1 && e.shiftKey) {\n self.dragStartObject = {\n rowIndex: self.activeCell.rowIndex,\n columnIndex: self.activeCell.columnIndex\n };\n }\n dragBounds = {\n top: Math.min(self.dragStartObject.rowIndex, o.rowIndex),\n left: Math.min(self.dragStartObject.columnIndex, o.columnIndex),\n bottom: Math.max(self.dragStartObject.rowIndex, o.rowIndex),\n right: Math.max(self.dragStartObject.columnIndex, o.columnIndex)\n };\n if (self.dragStartObject.columnIndex === -1) {\n dragBounds.left = -1;\n dragBounds.right = s.length - 1;\n dragBounds.top = Math.min(sBounds.top, o.rowIndex);\n dragBounds.bottom = Math.max(sBounds.bottom, o.rowIndex);\n }\n if (self.dragStartObject.rowIndex !== o.rowIndex\n || self.dragStartObject.columnIndex !== o.columnIndex) {\n self.ignoreNextClick = true;\n }\n if (self.cellBoundaryCrossed || (delta.x === 0 && delta.y === 0) || self.attributes.rowSelectionMode) {\n if (self.attributes.rowSelectionMode || self.dragStartObject.columnIndex === -1) {\n self.selectRow(o.rowIndex, ctrl, null, true);\n } else {\n if (!self.dragAddToSelection && o.rowIndex !== undefined) {\n if (self.selections[o.rowIndex] && self.selections[o.rowIndex].indexOf(o.columnIndex) !== -1) {\n self.selections[o.rowIndex].splice(self.selections[o.rowIndex].indexOf(o.columnIndex), 1);\n }\n } else {\n self.selections[o.rowIndex] = self.selections[o.rowIndex] || [];\n if (self.selections[o.rowIndex].indexOf(o.columnIndex) === -1) {\n self.selections[o.rowIndex].push(o.columnIndex);\n }\n }\n }\n }\n if ((!self.selectionBounds || (dragBounds.top !== self.selectionBounds.top\n || dragBounds.left !== self.selectionBounds.left\n || dragBounds.bottom !== self.selectionBounds.bottom\n || dragBounds.right !== self.selectionBounds.right)) && !ctrl) {\n self.selections = [];\n sBounds = dragBounds;\n if (self.attributes.rowSelectionMode) {\n for (i = sBounds.top; i <= sBounds.bottom; i += 1) {\n self.selectRow(i, true, null, true);\n }\n } else {\n self.selectArea(sBounds, true);\n }\n }\n self.autoScrollZone(e, x, y, ctrl);\n }\n }\n self.cellBoundaryCrossed = false;\n self.draw(true);\n };\n self.click = function (e, overridePos) {\n var i,\n selectionChanged,\n ctrl = (e.controlKey || e.metaKey || self.attributes.persistantSelectionMode),\n pos = overridePos || self.getLayerPos(e);\n self.currentCell = self.getCellAt(pos.x, pos.y);\n if (self.currentCell.grid !== undefined) {\n return;\n }\n function checkSelectionChange() {\n if (!selectionChanged) { return; }\n self.dispatchEvent('selectionchanged', {\n selectedData: self.getSelectedData(),\n selections: self.selections,\n selectionBounds: self.selectionBounds\n });\n }\n if (self.input) {\n self.endEdit();\n }\n if (self.ignoreNextClick) {\n self.ignoreNextClick = false;\n return;\n }\n i = self.currentCell;\n if (self.dispatchEvent('click', {NativeEvent: e, cell: self.currentCell})) { return; }\n if (!self.hasFocus) {\n return;\n }\n if (self.currentCell.context === 'cell') {\n if (self.currentCell.style === 'cornerCell') {\n self.order(self.uniqueId, 'asc', self.sorters.number);\n self.setFilter();\n checkSelectionChange();\n return;\n }\n if (self.currentCell.style === 'columnHeaderCell') {\n if (self.attributes.columnHeaderClickBehavior === 'sort') {\n if (self.orderBy === i.header.name) {\n self.orderDirection = self.orderDirection === 'asc' ? 'desc' : 'asc';\n } else {\n self.orderDirection = 'asc';\n }\n self.order(i.header.name, self.orderDirection);\n checkSelectionChange();\n return;\n }\n if (self.attributes.columnHeaderClickBehavior === 'select') {\n self.selectColumn(i.header.index, ctrl, e.shiftKey, true);\n checkSelectionChange();\n self.draw();\n return;\n }\n }\n if (['rowHeaderCell', 'columnHeaderCell'].indexOf(self.currentCell.style) === -1 && !ctrl) {\n self.setActiveCell(i.columnIndex, i.rowIndex);\n }\n self.selections[i.rowIndex] = self.selections[i.rowIndex] || [];\n if ((self.attributes.rowSelectionMode || self.currentCell.style === 'rowHeaderCell')) {\n if (self.currentCell.style === 'rowHeaderCell'\n && self.attributes.tree && pos.x > 0\n && pos.x - self.currentCell.x < self.style.treeArrowWidth\n + self.style.treeArrowMarginLeft\n + self.style.treeArrowMarginRight + self.style.treeArrowClickRadius\n && pos.y - self.currentCell.y < self.style.treeArrowHeight\n + self.style.treeArrowMarginTop + self.style.treeArrowClickRadius\n && pos.y > 0) {\n self.toggleTree(i.rowIndex);\n return;\n }\n selectionChanged = true;\n self.selectRow(i.rowIndex, ctrl, null, true);\n }\n if (e.shiftKey && !ctrl) {\n self.selectionBounds = self.getSelectionBounds();\n self.selectArea(undefined, false);\n }\n }\n checkSelectionChange();\n self.draw(true);\n };\n self.dragResizeColumn = function (e) {\n var pos, x, y;\n pos = self.getLayerPos(e);\n x = self.resizingStartingWidth + pos.x - self.dragStart.x;\n y = self.resizingStartingHeight + pos.y - self.dragStart.y;\n if (x < self.style.minColumnWidth) {\n x = self.style.minColumnWidth;\n }\n if (y < self.style.minRowHeight) {\n y = self.style.minRowHeight;\n }\n if (self.dispatchEvent('resizecolumn', {x: x, y: y, draggingItem: self.draggingItem})) { return false; }\n if (self.scrollBox.scrollLeft > self.scrollBox.scrollWidth - self.attributes.resizeScrollZone\n && self.dragMode === 'ew-resize') {\n self.resize(true);\n self.scrollBox.scrollLeft += x;\n }\n if (self.dragMode === 'ew-resize') {\n self.sizes.columns[self.draggingItem.header.style === 'rowHeaderCell'\n ? 'cornerCell' : self.draggingItem.header[self.uniqueId]] = x;\n if (['rowHeaderCell', 'cornerCell'].indexOf(self.draggingItem.header.style) !== -1) {\n self.resize(true);\n }\n self.resizeChildGrids();\n return;\n }\n if (self.dragMode === 'ns-resize') {\n if (self.draggingItem.rowOpen) {\n self.sizes.trees[self.draggingItem.data[self.uniqueId]] = y;\n } else if (self.attributes.globalRowResize) {\n self.style.cellHeight = y;\n } else {\n self.sizes.rows[self.draggingItem.data[self.uniqueId]] = y;\n }\n self.dispatchEvent('resizerow', {row: y});\n self.resizeChildGrids();\n return;\n }\n self.ellipsisCache = {};\n };\n self.stopDragResize = function () {\n self.resize();\n document.body.removeEventListener('mousemove', self.dragResizeColumn, false);\n document.body.removeEventListener('mouseup', self.stopDragResize, false);\n self.setStorageData();\n self.draw(true);\n self.ignoreNextClick = true;\n };\n self.scrollGrid = function (e) {\n var pos = self.getLayerPos(e);\n if (self.attributes.scrollPointerLock && self.pointerLockPosition\n && ['horizontal-scroll-box', 'vertical-scroll-box'].indexOf(self.scrollStartMode) !== -1) {\n self.pointerLockPosition.x += e.movementX;\n self.pointerLockPosition.y += e.movementY;\n pos = self.pointerLockPosition;\n }\n self.scrollMode = self.getCellAt(pos.x, pos.y).context;\n if (self.scrollMode === 'horizontal-scroll-box' && self.scrollStartMode !== 'horizontal-scroll-box') {\n self.scrollStartMode = 'horizontal-scroll-box';\n self.dragStart = pos;\n self.scrollStart.left = self.scrollBox.scrollLeft;\n clearTimeout(self.scrollTimer);\n return;\n }\n if (self.scrollMode === 'vertical-scroll-box' && self.scrollStartMode !== 'vertical-scroll-box') {\n self.scrollStartMode = 'vertical-scroll-box';\n self.dragStart = pos;\n self.scrollStart.top = self.scrollBox.scrollTop;\n clearTimeout(self.scrollTimer);\n return;\n }\n if (self.scrollStartMode === 'vertical-scroll-box'\n && self.scrollMode !== 'vertical-scroll-box') {\n self.scrollMode = 'vertical-scroll-box';\n }\n if (self.scrollStartMode === 'horizontal-scroll-box'\n && self.scrollMode !== 'horizontal-scroll-box') {\n self.scrollMode = 'horizontal-scroll-box';\n }\n clearTimeout(self.scrollTimer);\n if (self.scrollModes.indexOf(self.scrollMode) === -1) {\n return;\n }\n if (self.scrollMode === 'vertical-scroll-box') {\n self.scrollBox.scrollTop = self.scrollStart.top + ((pos.y - self.dragStart.y)\n / self.scrollBox.heightBoxRatio);\n } else if (self.scrollMode === 'vertical-scroll-top') {\n self.scrollBox.scrollTop -= (self.page * self.style.cellHeight);\n self.scrollTimer = setTimeout(self.scrollGrid, self.attributes.scrollRepeatRate, e);\n } else if (self.scrollMode === 'vertical-scroll-bottom') {\n self.scrollBox.scrollTop += (self.page * self.style.cellHeight);\n self.scrollTimer = setTimeout(self.scrollGrid, self.attributes.scrollRepeatRate, e);\n }\n if (self.scrollMode === 'horizontal-scroll-box') {\n self.scrollBox.scrollLeft = self.scrollStart.left + ((pos.x - self.dragStart.x)\n / self.scrollBox.widthBoxRatio);\n } else if (self.scrollMode === 'horizontal-scroll-right') {\n self.scrollBox.scrollLeft += self.attributes.selectionScrollIncrement;\n self.scrollTimer = setTimeout(self.scrollGrid, self.attributes.scrollRepeatRate, e);\n } else if (self.scrollMode === 'horizontal-scroll-left') {\n self.scrollBox.scrollLeft -= self.attributes.selectionScrollIncrement;\n self.scrollTimer = setTimeout(self.scrollGrid, self.attributes.scrollRepeatRate, e);\n }\n };\n self.stopScrollGrid = function () {\n clearTimeout(self.scrollTimer);\n if (document.exitPointerLock) {\n document.exitPointerLock();\n }\n document.body.removeEventListener('mousemove', self.scrollGrid, false);\n };\n self.dragReorder = function (e) {\n var pos, x, y;\n pos = self.getLayerPos(e);\n x = pos.x - self.dragStart.x;\n y = pos.y - self.dragStart.y;\n if (!self.attributes.allowColumnReordering && self.dragMode === 'column-reorder') {\n return;\n }\n if (!self.attributes.allowRowReordering && self.dragMode === 'row-reorder') {\n return;\n }\n if (self.dispatchEvent('reordering', {\n NativeEvent: e,\n source: self.dragStartObject,\n target: self.currentCell,\n dragMode: self.dragMode\n })) {\n return;\n }\n if (Math.abs(x) > self.attributes.reorderDeadZone || Math.abs(y) > self.attributes.reorderDeadZone) {\n self.reorderObject = self.dragStartObject;\n self.reorderTarget = self.currentCell;\n self.reorderObject.dragOffset = {\n x: x,\n y: y\n };\n self.autoScrollZone(e, pos.x, pos.x, false);\n }\n };\n self.stopDragReorder = function (e) {\n var cr = {\n 'row-reorder': self.orders.rows,\n 'column-reorder': self.orders.columns\n },\n i = {\n 'row-reorder': 'rowIndex',\n 'column-reorder': 'columnIndex'\n }[self.dragMode];\n document.body.removeEventListener('mousemove', self.dragReorder, false);\n document.body.removeEventListener('mouseup', self.stopDragReorder, false);\n if (self.reorderObject\n && self.reorderTarget) {\n self.ignoreNextClick = true;\n if (self.reorderObject[i] !== self.reorderTarget[i]\n && !self.dispatchEvent('reorder', {\n NativeEvent: e,\n source: self.reorderObject,\n target: self.reorderTarget,\n dragMode: self.dragMode\n })) {\n cr[self.dragMode].splice(cr[self.dragMode].indexOf(self.reorderObject[i]), 1);\n cr[self.dragMode].splice(cr[self.dragMode].indexOf(self.reorderTarget[i]), 0, self.reorderObject[i]);\n self.setStorageData();\n }\n }\n self.reorderObject = undefined;\n self.reorderTarget = undefined;\n self.draw(true);\n };\n self.mousedown = function (e, overridePos) {\n self.lastMouseDownTarget = e.target;\n if (self.dispatchEvent('mousedown', {NativeEvent: e, cell: self.currentCell})) { return; }\n if (!self.hasFocus) {\n return;\n }\n if (e.button === 2 || self.input) { return; }\n var ctrl = (e.controlKey || e.metaKey);\n self.dragStart = overridePos || self.getLayerPos(e);\n self.scrollStart = {\n left: self.scrollBox.scrollLeft,\n top: self.scrollBox.scrollTop\n };\n self.dragStartObject = self.getCellAt(self.dragStart.x, self.dragStart.y);\n self.dragAddToSelection = !self.dragStartObject.selected;\n if (!ctrl && !e.shiftKey && !/(vertical|horizontal)-scroll-(bar|box)/\n .test(self.dragStartObject.context) && !self.currentCell.isColumnHeader) {\n self.selections = [];\n }\n if (self.dragStartObject.isGrid) {\n return;\n }\n if (self.scrollModes.indexOf(self.dragStartObject.context) !== -1) {\n self.scrollMode = self.dragStartObject.context;\n self.scrollStartMode = self.dragStartObject.context;\n self.scrollGrid(e);\n if (self.attributes.scrollPointerLock\n && ['horizontal-scroll-box', 'vertical-scroll-box'].indexOf(self.scrollStartMode) !== -1) {\n self.pointerLockPosition = {\n x: self.dragStart.x,\n y: self.dragStart.y\n };\n self.canvas.requestPointerLock();\n }\n document.body.addEventListener('mousemove', self.scrollGrid, false);\n document.body.addEventListener('mouseup', self.stopScrollGrid, false);\n self.ignoreNextClick = true;\n return;\n }\n if (self.dragMode === 'cell') {\n self.selecting = true;\n if (self.attributes.rowSelectionMode) {\n self.selectRow(self.dragStartObject.rowIndex, ctrl, null, true);\n }\n return self.mousemove(e);\n }\n if (['ns-resize', 'ew-resize'].indexOf(self.dragMode) !== -1) {\n self.draggingItem = self.dragItem;\n if (self.draggingItem.rowOpen) {\n self.resizingStartingHeight = self.sizes.trees[self.draggingItem.data[self.uniqueId]];\n } else {\n self.resizingStartingHeight = self.sizes.rows[self.draggingItem.data[self.uniqueId]] || self.style.cellHeight;\n }\n self.resizingStartingWidth = self.sizes.columns[self.draggingItem.header.style === 'rowHeaderCell'\n ? 'cornerCell' : self.draggingItem.header[self.uniqueId]] || self.draggingItem.header.width;\n document.body.addEventListener('mousemove', self.dragResizeColumn, false);\n document.body.addEventListener('mouseup', self.stopDragResize, false);\n }\n if (['row-reorder', 'column-reorder'].indexOf(self.dragMode) !== -1) {\n self.draggingItem = self.dragItem;\n document.body.addEventListener('mousemove', self.dragReorder, false);\n document.body.addEventListener('mouseup', self.stopDragReorder, false);\n }\n };\n self.mouseup = function (e) {\n clearTimeout(self.scrollTimer);\n self.cellBoundaryCrossed = true;\n self.selecting = undefined;\n self.draggingItem = undefined;\n self.dragStartObject = undefined;\n if (self.dispatchEvent('mouseup', {NativeEvent: e, cell: self.currentCell})) { return; }\n if (!self.hasFocus && e.target !== self.canvas) {\n return;\n }\n if (self.currentCell && self.currentCell.grid !== undefined) {\n return;\n }\n if (self.contextMenu || self.input) { return; }\n if (self.dragStart && self.isInGrid(self.dragStart)) {\n self.controlInput.focus();\n }\n e.preventDefault();\n };\n self.keydown = function (e) {\n var i,\n x = self.activeCell.columnIndex,\n y = self.activeCell.rowIndex,\n ctrl = (e.controlKey || e.metaKey),\n last = self.data.length - 1,\n cols = self.getVisibleSchema().length - 1;\n if (self.dispatchEvent('keydown', {NativeEvent: e, cell: self.currentCell})) { return; }\n if (!self.hasFocus) {\n return;\n }\n self.page = self.visibleRows.length - 3 - self.attributes.pageUpDownOverlap;\n if (self.attributes.showNewRow) {\n last += 1;\n }\n if (e.keyCode === 9) {\n e.preventDefault();\n }\n // ctrl + a\n if (ctrl && e.keyCode === 65) {\n self.selectAll();\n //ArrowDown\n } else if (e.keyCode === 40) {\n y += 1;\n //ArrowUp\n } else if (e.keyCode === 38) {\n y -= 1;\n //ArrowLeft Tab\n } else if (e.keyCode === 37 || (e.shiftKey && e.keyCode === 9)) {\n x -= 1;\n //ArrowRight Tab\n } else if (e.keyCode === 39 || (!e.shiftKey && e.keyCode === 9)) {\n x += 1;\n //PageUp\n } else if (e.keyCode === 33) {\n y -= self.page;\n e.preventDefault();\n //PageDown\n } else if (e.keyCode === 34) {\n y += self.page;\n e.preventDefault();\n //Home ArrowUp\n } else if (e.keyCode === 36 || (ctrl && e.keyCode === 38)) {\n y = 0;\n //End ArrowDown\n } else if (e.keyCode === 35 || (ctrl && e.keyCode === 40)) {\n y = self.data.length - 1;\n //ArrowRight\n } else if (ctrl && e.keyCode === 39) {\n x = cols;\n //ArrowLeft\n } else if (ctrl && e.keyCode === 37) {\n x = 0;\n }\n //Enter\n if (e.keyCode === 13) {\n return self.beginEditAt(x, y);\n }\n //Space\n if (e.keyCode === 32) {\n self.selections = [];\n self.selections[Math.max(y, 0)] = [];\n self.selections[Math.max(y, 0)].push(x);\n self.selectionBounds = self.getSelectionBounds();\n if (self.attributes.rowSelectionMode) {\n for (i = self.selectionBounds.top; i <= self.selectionBounds.bottom; i += 1) {\n self.selectRow(i, ctrl, null, true);\n }\n } else {\n self.selectArea(undefined, ctrl);\n }\n e.preventDefault();\n self.draw(true);\n return;\n }\n if (x < 0) {\n x = 0;\n }\n if (y > last) {\n y = last;\n }\n if (y < 0) {\n y = 0;\n }\n if (x > cols) {\n x = cols;\n }\n // Arrows\n if (e.shiftKey && [37, 38, 39, 40].indexOf(e.keyCode) !== -1) {\n self.selections[Math.max(y, 0)] = self.selections[Math.max(y, 0)] || [];\n self.selections[Math.max(y, 0)].push(x);\n self.selectionBounds = self.getSelectionBounds();\n self.selectArea(undefined, ctrl);\n self.draw(true);\n }\n if (x !== self.activeCell.columnIndex || y !== self.activeCell.rowIndex) {\n self.scrollIntoView(x !== self.activeCell.columnIndex ? x : undefined, y !== self.activeCell.rowIndex ? y : undefined);\n self.setActiveCell(x, y);\n if (!e.shiftKey && self.attributes.selectionFollowsActiveCell) {\n if (!ctrl) {\n self.selections = [];\n }\n self.selections[y] = self.selections[y] || [];\n self.selections[y].push(x);\n self.dispatchEvent('selectionchanged', {\n selectedData: self.getSelectedData(),\n selections: self.selections,\n selectionBounds: self.selectionBounds\n });\n }\n self.draw(true);\n }\n };\n self.keyup = function (e) {\n if (self.dispatchEvent('keyup', {NativeEvent: e, cell: self.currentCell})) { return; }\n if (!self.hasFocus) {\n return;\n }\n self.controlInput.value = '';\n };\n self.keypress = function (e) {\n if (!self.hasFocus) {\n return;\n }\n if (self.dispatchEvent('keypress', {NativeEvent: e, cell: self.currentCell})) { return; }\n };\n self.dblclick = function (e) {\n if (self.dispatchEvent('dblclick', {NativeEvent: e, cell: self.currentCell})) { return; }\n if (!self.hasFocus) {\n return;\n }\n if (self.currentCell.context === 'ew-resize'\n && self.currentCell.style === 'columnHeaderCell') {\n self.fitColumnToValues(self.currentCell.header.name);\n } else if (self.currentCell.context === 'ew-resize'\n && self.currentCell.style === 'cornerCell') {\n self.autosize();\n } else if (['cell', 'activeCell'].indexOf(self.currentCell.style) !== -1) {\n self.beginEditAt(self.currentCell.columnIndex, self.currentCell.rowIndex);\n }\n };\n self.scrollWheel = function (e) {\n if (self.dispatchEvent('wheel', {NativeEvent: e})) {\n return;\n }\n self.touchHaltAnimation = true;\n var l = self.scrollBox.scrollLeft,\n t = self.scrollBox.scrollTop;\n if (self.hasFocus) {\n self.scrollBox.scrollTop += e.deltaY;\n self.scrollBox.scrollLeft += e.deltaX;\n }\n if (t !== self.scrollBox.scrollTop || l !== self.scrollBox.scrollLeft) {\n e.preventDefault();\n }\n };\n self.copy = function (e) {\n if (self.dispatchEvent('copy', {NativeEvent: e})) { return; }\n if (!self.hasFocus || !e.clipboardData) { return; }\n var rows = [], sData = self.getSelectedData();\n if (sData.length > 0) {\n sData.forEach(function (row) {\n if (row) {\n var r = [];\n Object.keys(row).forEach(function (key) {\n r.push(row[key]);\n });\n r.join(',');\n rows.push(r);\n }\n });\n e.clipboardData.setData('text/plain', rows.join('\\n'));\n e.preventDefault();\n }\n };\n return;\n };\n}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*jslint browser: true, unparam: true, todo: true*/\n/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/\n!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {\n 'use strict';\n return function (self) {\n self.orders = {\n rows: [],\n columns: []\n };\n self.hasFocus = false;\n self.activeCell = {\n columnIndex: 0,\n rowIndex: 0\n };\n self.storageName = 'canvasDataGrid';\n self.invalidSearchExpClass = 'canvas-datagrid-invalid-search-regExp';\n self.localStyleLibraryStorageKey = 'canvas-datagrid-user-style-library';\n self.uniqueId = '_canvasDataGridUniqueId';\n self.orderBy = self.uniqueId;\n self.orderDirection = 'asc';\n self.columnFilters = {};\n self.filters = {};\n self.ellipsisCache = {};\n self.scrollBox = {};\n self.visibleRows = [];\n self.sizes = {\n rows: {},\n columns: {},\n trees: {}\n };\n self.currentFilter = function () {\n return true;\n };\n self.selections = [];\n self.hovers = {};\n self.attributes = {};\n self.style = {};\n self.intf = {};\n self.formatters = {};\n self.sorters = {};\n self.schemaHashes = {};\n self.events = {};\n self.uId = 0;\n self.changes = [];\n self.scrollIndexTop = 0;\n self.scrollPixelTop = 0;\n self.scrollIndexLeft = 0;\n self.scrollPixelLeft = 0;\n self.childGrids = {};\n self.openChildren = {};\n self.scrollModes = [\n 'vertical-scroll-box',\n 'vertical-scroll-top',\n 'vertical-scroll-bottom',\n 'horizontal-scroll-box',\n 'horizontal-scroll-right',\n 'horizontal-scroll-left'\n ];\n self.mouse = { x: 0, y: 0};\n self.getSelectedData = function (expandToRow) {\n var d = [], s = self.getSchema(), l = self.data.length;\n self.selections.forEach(function (row, index) {\n if (index === l) { return; }\n if (row.length === 0) {\n d[index] = null;\n return;\n }\n d[index] = {};\n if (expandToRow) {\n s.forEach(function (column) {\n d[index][column.name] = self.data[index][column.name];\n });\n } else {\n row.forEach(function (col) {\n if (col === -1) { return; }\n d[index][s[col].name] = self.data[index][s[col].name];\n });\n }\n });\n return d;\n };\n self.scrollOffset = function (e) {\n var x = 0, y = 0;\n while (e.parentNode) {\n if (e.nodeType !== 'canvas-datagrid-tree'\n && e.nodeType !== 'canvas-datagrid-cell') {\n x -= e.scrollLeft;\n y -= e.scrollTop;\n }\n e = e.parentNode;\n }\n return {left: x, top: y};\n };\n self.position = function (e, ignoreScrollOffset) {\n var x = 0, y = 0, s = e, h, w;\n while (e.offsetParent) {\n x += e.offsetLeft;\n y += e.offsetTop;\n h = e.offsetHeight;\n w = e.offsetWidth;\n e = e.offsetParent;\n }\n if (ignoreScrollOffset) {\n return {left: x, top: y, height: h, width: w};\n }\n e = s;\n s = self.scrollOffset(e);\n return { left: x + s.left, top: y + s.top, height: h, width: w };\n };\n self.getLayerPos = function (e) {\n var rect = self.canvas.getBoundingClientRect(),\n pos = {\n x: e.clientX - rect.left,\n y: e.clientY - rect.top\n };\n if (self.isChildGrid) {\n pos.x -= self.canvasOffsetLeft;\n pos.y -= self.canvasOffsetTop;\n }\n return {\n x: pos.x,\n y: pos.y,\n rect: rect\n };\n };\n self.fillArray = function (low, high, step) {\n step = step || 1;\n var i = [], x;\n for (x = low; x <= high; x += step) {\n i[x] = x;\n }\n return i;\n };\n self.getRowHeaderCellHeight = function () {\n if (!self.attributes.showColumnHeaders) { return 0; }\n return self.sizes.rows[-1] || self.style.columnHeaderCellHeight;\n };\n self.getColumnHeaderCellWidth = function () {\n if (!self.attributes.showRowHeaders) { return 0; }\n return self.sizes.columns.cornerCell || self.style.rowHeaderCellWidth;\n };\n self.setStorageData = function () {\n if (!self.attributes.saveAppearance) { return; }\n localStorage.setItem(self.storageName + '-' + self.attributes.name, JSON.stringify({\n sizes: {\n rows: self.sizes.rows,\n columns: self.sizes.columns\n },\n orders: {\n rows: self.orders.rows,\n columns: self.orders.columns\n },\n orderBy: self.orderBy,\n orderDirection: self.orderDirection\n }));\n };\n self.getSchema = function () {\n return self.schema || self.tempSchema;\n };\n self.createColumnOrders = function () {\n var s = self.getSchema();\n self.orders.columns = self.fillArray(0, s.length - 1);\n };\n self.createRowOrders = function () {\n self.orders.rows = self.fillArray(0, self.data.length - 1);\n };\n self.getVisibleSchema = function () {\n return self.getSchema().filter(function (col) { return !col.hidden; });\n };\n self.applyDefaultValue = function (row, header) {\n var d = header.defaultValue || '';\n if (typeof d === 'function') {\n d = d.apply(self.intf, [header]);\n }\n row[header.name] = d;\n };\n self.createNewRowData = function () {\n self.newRow = {};\n self.newRow[self.uniqueId] = self.uId;\n self.uId += 1;\n self.getSchema().forEach(function forEachHeader(header) {\n self.applyDefaultValue(self.newRow, header);\n });\n };\n self.getSchemaNameHash = function (key) {\n var n = 0;\n while (self.schemaHashes[key]) {\n n += 1;\n key = key + n;\n }\n return key;\n };\n self.filter = function (type) {\n var f = self.filters[type];\n if (!f && type !== undefined) {\n console.warn('Cannot find filter for type %s, falling back to substring match.', type);\n f = self.filters.string;\n }\n return f;\n };\n self.getBestGuessDataType = function (columnName) {\n var t, x, l = self.data.length;\n for (x = 0; x < l; x += 1) {\n if ([null, undefined].indexOf(self.data[x][columnName]) !== -1) {\n t = typeof self.data[x];\n return t === 'object' ? 'string' : t;\n }\n }\n return 'string';\n };\n self.drawChildGrids = function () {\n Object.keys(self.childGrids).forEach(function (gridKey) {\n self.childGrids[gridKey].draw();\n });\n };\n self.resizeChildGrids = function () {\n Object.keys(self.childGrids).forEach(function (gridKey) {\n self.childGrids[gridKey].resize();\n });\n };\n self.getClippingRect = function (ele) {\n var boundingRect = self.position(self.parentNode),\n eleRect = self.position(ele),\n s = self.scrollOffset(self.canvas),\n clipRect = {\n x: 0,\n y: 0,\n h: 0,\n w: 0\n },\n parentRect = {\n x: -Infinity,\n y: -Infinity,\n h: Infinity,\n w: Infinity\n },\n rowHeaderCellHeight = self.getRowHeaderCellHeight(),\n columnHeaderCellWidth = self.getColumnHeaderCellWidth();\n boundingRect.top -= s.top;\n boundingRect.left -= s.left;\n eleRect.top -= s.top;\n eleRect.left -= s.left;\n clipRect.h = boundingRect.top + boundingRect.height - ele.offsetTop - self.style.scrollBarWidth;\n clipRect.w = boundingRect.left + boundingRect.width - ele.offsetLeft - self.style.scrollBarWidth;\n clipRect.x = boundingRect.left + (eleRect.left * -1) + columnHeaderCellWidth;\n clipRect.y = boundingRect.top + (eleRect.top * -1) + rowHeaderCellHeight;\n return {\n x: clipRect.x > parentRect.x ? clipRect.x : parentRect.x,\n y: clipRect.y > parentRect.y ? clipRect.y : parentRect.y,\n h: clipRect.h < parentRect.h ? clipRect.h : parentRect.h,\n w: clipRect.w < parentRect.w ? clipRect.w : parentRect.w\n };\n };\n self.clipElement = function (ele) {\n var clipRect = self.getClippingRect(ele);\n if (clipRect.w < 0) { clipRect.w = 0; }\n if (clipRect.h < 0) { clipRect.h = 0; }\n ele.style.clip = 'rect('\n + clipRect.y + 'px,'\n + clipRect.w + 'px,'\n + clipRect.h + 'px,'\n + clipRect.x + 'px'\n + ')';\n // INFO https://developer.mozilla.org/en-US/docs/Web/CSS/clip\n // clip has been \"deprecated\" for clipPath. Of course nothing but chrome\n // supports clip path, so we'll keep using clip until someday clipPath becomes\n // more widely support. The code below works correctly, but setting clipPath and clip\n // at the same time has undesirable results.\n // ele.style.clipPath = 'polygon('\n // + clipRect.x + 'px ' + clipRect.y + 'px,'\n // + clipRect.x + 'px ' + clipRect.h + 'px,'\n // + clipRect.w + 'px ' + clipRect.h + 'px,'\n // + clipRect.w + 'px ' + clipRect.y + 'px'\n // + ')';\n };\n self.autoScrollZone = function (e, x, y, ctrl) {\n var setTimer,\n columnHeaderCellWidth = self.getColumnHeaderCellWidth(),\n rowHeaderCellHeight = self.getRowHeaderCellHeight();\n if (x > self.width - self.attributes.selectionScrollZone && x < self.width) {\n self.scrollBox.scrollLeft += self.attributes.selectionScrollIncrement;\n setTimer = true;\n }\n if (y > self.height - self.attributes.selectionScrollZone && y < self.height) {\n self.scrollBox.scrollTop += self.attributes.selectionScrollIncrement;\n setTimer = true;\n }\n if (x - self.attributes.selectionScrollZone - columnHeaderCellWidth < 0) {\n self.scrollBox.scrollLeft -= self.attributes.selectionScrollIncrement;\n setTimer = true;\n }\n if (y - self.attributes.selectionScrollZone - rowHeaderCellHeight < 0) {\n self.scrollBox.scrollTop -= self.attributes.selectionScrollIncrement;\n setTimer = true;\n }\n if (setTimer && !ctrl && self.currentCell && self.currentCell.columnIndex !== -1) {\n self.scrollTimer = setTimeout(self.mousemove, self.attributes.scrollRepeatRate, e);\n }\n };\n self.refreshFromOrigialData = function () {\n self.data = self.originalData.filter(function (row) {\n return true;\n });\n };\n self.validateColumn = function (c, s) {\n if (!c.name) {\n throw new Error('A column must contain at least a name.');\n }\n if (s.filter(function (i) { return i.name === c.name; }).length > 0) {\n throw new Error('A column with the name '\n + c.name + ' already exists and cannot be added again.');\n }\n return true;\n };\n self.setDefaults = function (obj1, obj2, key, def) {\n obj1[key] = obj2[key] === undefined ? def : obj2[key];\n };\n self.setAttributes = function () {\n self.defaults.attributes.forEach(function eachAttribute(i) {\n self.setDefaults(self.attributes, self.args, i[0], i[1]);\n });\n };\n self.setStyle = function () {\n self.defaults.styles.forEach(function eachStyle(i) {\n self.setDefaults(self.style, self.args.style || {}, i[0], i[1]);\n });\n };\n self.autosize = function (colName) {\n self.getVisibleSchema().forEach(function (col) {\n if (col.name === colName || colName === undefined) {\n self.fitColumnToValues(col.name);\n }\n });\n self.fitColumnToValues('cornerCell');\n };\n self.dispose = function () {\n if (!self.isChildGrid && self.canvas && self.canvas.parentNode) {\n self.canvas.parentNode.removeChild(self.canvas);\n }\n self.eventParent.removeEventListener('mouseup', self.mouseup, false);\n self.eventParent.removeEventListener('mousedown', self.mousedown, false);\n self.eventParent.removeEventListener('dblclick', self.dblclick, false);\n self.eventParent.removeEventListener('click', self.click, false);\n self.eventParent.removeEventListener('mousemove', self.mousemove);\n self.eventParent.removeEventListener('wheel', self.scrollWheel, false);\n self.canvas.removeEventListener('contextmenu', self.contextmenu, false);\n self.canvas.removeEventListener('copy', self.copy);\n self.controlInput.removeEventListener('keypress', self.keypress, false);\n self.controlInput.removeEventListener('keyup', self.keyup, false);\n self.controlInput.removeEventListener('keydown', self.keydown, false);\n window.removeEventListener('resize', self.resize);\n if (self.observer && self.observer.disconnect) {\n self.observer.disconnect();\n }\n };\n self.tryLoadStoredOrders = function () {\n var s;\n if (self.storedSettings && typeof self.storedSettings.orders === 'object') {\n if (self.storedSettings.orders.rows.length >= self.data.length) {\n self.orders.rows = self.storedSettings.orders.rows;\n }\n s = self.getSchema();\n self.orders.columns = self.storedSettings.orders.columns;\n s.forEach(function (h, i) {\n if (self.orders.columns.indexOf(i) === -1) {\n self.orders.columns.push(i);\n }\n });\n self.orderBy = self.storedSettings.orderBy === undefined\n ? self.uniqueId : self.storedSettings.orderBy;\n self.orderDirection = self.storedSettings.orderDirection === undefined\n ? self.uniqueId : self.storedSettings.orderDirection;\n if (self.getHeaderByName(self.orderBy) && self.orderDirection) {\n self.order(self.orderBy, self.orderDirection);\n }\n }\n };\n self.getFontHeight = function (fontStyle) {\n return parseFloat(fontStyle, 10);\n };\n self.parseFont = function (key) {\n if (/Font/.test(key)) {\n self.style[key + 'Height'] = self.getFontHeight(self.style[key]);\n }\n };\n self.initProp = function (propName) {\n if (!self.args[propName]) { return; }\n Object.keys(self.args[propName]).forEach(function (key) {\n self[propName][key] = self.args[propName][key];\n });\n };\n self.init = function () {\n var publicStyleKeyIntf = {};\n self.setAttributes();\n self.setStyle();\n self.initScrollBox();\n self.setDom();\n self.type = 'canvas-datagrid';\n Object.keys(self.style).forEach(self.parseFont);\n self.intf.type = self.type;\n self.intf.addEventListener = self.addEventListener;\n self.intf.removeEventListener = self.removeEventListener;\n self.intf.dispatchEvent = self.dispatchEvent;\n self.intf.dispose = self.dispose;\n self.intf.appendTo = self.appendTo;\n self.intf.filters = self.filters;\n self.intf.sorters = self.sorters;\n self.intf.autosize = self.autosize;\n self.intf.beginEditAt = self.beginEditAt;\n self.intf.endEdit = self.endEdit;\n self.intf.setActiveCell = self.setActiveCell;\n self.intf.scrollIntoView = self.scrollIntoView;\n self.intf.clearChangeLog = self.clearChangeLog;\n self.intf.gotoCell = self.gotoCell;\n self.intf.gotoRow = self.gotoRow;\n self.intf.findColumnScrollLeft = self.findColumnScrollLeft;\n self.intf.findRowScrollTop = self.findRowScrollTop;\n self.intf.fitColumnToValues = self.fitColumnToValues;\n self.intf.findColumnMaxTextLength = self.findColumnMaxTextLength;\n self.intf.disposeContextMenu = self.disposeContextMenu;\n self.intf.getCellAt = self.getCellAt;\n self.intf.isCellVisible = self.isCellVisible;\n self.intf.order = self.order;\n self.intf.draw = self.draw;\n self.intf.selectArea = self.selectArea;\n self.intf.clipElement = self.clipElement;\n self.intf.getSchemaFromData = self.getSchemaFromData;\n self.intf.setFilter = self.setFilter;\n self.intf.selectRow = self.selectRow;\n self.intf.parentGrid = self.parentGrid;\n self.intf.toggleTree = self.toggleTree;\n self.intf.expandTree = self.expandTree;\n self.intf.collapseTree = self.collapseTree;\n self.intf.canvas = self.canvas;\n self.intf.context = self.ctx;\n self.intf.insertRow = self.insertRow;\n self.intf.deleteRow = self.deleteRow;\n self.intf.addRow = self.addRow;\n self.intf.insertColumn = self.insertColumn;\n self.intf.deleteColumn = self.deleteColumn;\n self.intf.addColumn = self.addColumn;\n self.intf.getClippingRect = self.getClippingRect;\n self.intf.setRowHeight = self.setRowHeight;\n self.intf.setColumnWidth = self.setColumnWidth;\n self.intf.resetColumnWidths = self.resetColumnWidths;\n self.intf.resetRowHeights = self.resetRowHeights;\n self.intf.resize = self.resize;\n self.intf.selectColumn = self.selectColumn;\n self.intf.selectRow = self.selectRow;\n self.intf.selectAll = self.selectAll;\n self.intf.drawChildGrids = self.drawChildGrids;\n self.intf.assertPxColor = self.assertPxColor;\n self.intf.clearPxColorAssertions = self.clearPxColorAssertions;\n self.intf.integerToAlpha = self.integerToAlpha;\n self.intf.style = {};\n Object.keys(self.style).forEach(function (key) {\n // unless this line is here, Object.keys() will not work on .style\n publicStyleKeyIntf[key] = undefined;\n Object.defineProperty(publicStyleKeyIntf, key, {\n get: function () {\n return self.style[key];\n },\n set: function (value) {\n self.parseFont(value);\n self.style[key] = value;\n self.draw(true);\n self.dispatchEvent('stylechanged', {name: key, value: value});\n }\n });\n });\n Object.defineProperty(self.intf, 'activeCell', {\n get: function () {\n return self.activeCell;\n }\n });\n /**\n * When true, the grid is has focus.\n * @memberof canvasDataGrid\n * @property hasFocus\n * @readonly\n */\n Object.defineProperty(self.intf, 'hasFocus', {\n get: function () {\n return self.hasFocus;\n }\n });\n Object.defineProperty(self.intf, 'style', {\n get: function () {\n return publicStyleKeyIntf;\n },\n set: function (value) {\n Object.keys(value).forEach(function (key) {\n self.parseFont(value);\n self.style[key] = value[key];\n });\n self.draw(true);\n self.dispatchEvent('stylechanged', {name: 'style', value: value});\n }\n });\n Object.keys(self.attributes).forEach(function (key) {\n Object.defineProperty(self.intf.attributes, key, {\n get: function () {\n return self.attributes[key];\n },\n set: function (value) {\n self.attributes[key] = value;\n self.draw(true);\n self.dispatchEvent('attributechanged', {name: key, value: value[key]});\n }\n });\n });\n self.filters.string = function (value, filterFor) {\n if (!filterFor) { return true; }\n var filterRegExp;\n self.invalidFilterRegEx = undefined;\n try {\n filterRegExp = new RegExp(filterFor, 'ig');\n } catch (e) {\n self.invalidFilterRegEx = e;\n return;\n }\n return filterRegExp.test(value);\n };\n self.filters.number = function (value, filterFor) {\n if (!filterFor) { return true; }\n return value === filterFor;\n };\n if (self.attributes.name && self.attributes.saveAppearance) {\n self.storedSettings = localStorage.getItem(self.storageName + '-' + self.attributes.name);\n if (self.storedSettings) {\n try {\n self.storedSettings = JSON.parse(self.storedSettings);\n } catch (e) {\n console.warn('could not read settings from localStore', e);\n self.storedSettings = undefined;\n }\n }\n if (self.storedSettings) {\n if (typeof self.storedSettings.sizes === 'object') {\n self.sizes.rows = self.storedSettings.sizes.rows;\n self.sizes.columns = self.storedSettings.sizes.columns;\n ['trees', 'columns', 'rows'].forEach(function (i) {\n if (!self.sizes[i]) {\n self.sizes[i] = {};\n }\n });\n }\n }\n }\n ['formatters', 'filters', 'sorters'].forEach(self.initProp);\n if (self.args.data) {\n self.intf.data = self.args.data;\n }\n if (!self.data) {\n self.intf.data = [];\n }\n if (self.args.schema) {\n self.intf.schema = self.args.schema;\n }\n if (self.isChildGrid) {\n requestAnimationFrame(function () { self.resize(true); });\n } else {\n self.resize(true);\n }\n };\n /**\n * Removes focus from the grid.\n * @memberof canvasDataGrid\n * @name blur\n * @method\n */\n self.intf.blur = function (e) {\n self.hasFocus = false;\n };\n /**\n * Focuses on the grid.\n * @memberof canvasDataGrid\n * @name focus\n * @method\n */\n self.intf.focus = function () {\n self.hasFocus = true;\n self.controlInput.focus();\n };\n Object.defineProperty(self.intf, 'height', {\n get: function () {\n return self.parentNode.height;\n },\n set: function (value) {\n self.parentNode.height = value;\n self.resize(true);\n }\n });\n Object.defineProperty(self.intf, 'width', {\n get: function () {\n return self.parentNode.width;\n },\n set: function (value) {\n self.parentNode.width = value;\n self.resize(true);\n }\n });\n Object.defineProperty(self.intf, 'openChildren', {\n get: function () {\n return self.openChildren;\n }\n });\n Object.defineProperty(self.intf, 'childGrids', {\n get: function () {\n return Object.keys(self.childGrids).map(function (gridId) {\n return self.childGrids[gridId];\n });\n }\n });\n Object.defineProperty(self.intf, 'isChildGrid', {\n get: function () {\n return self.isChildGrid;\n }\n });\n Object.defineProperty(self.intf, 'parentNode', {\n get: function () {\n return self.parentNode;\n },\n set: function (value) {\n self.parentNode = value;\n }\n });\n Object.defineProperty(self.intf, 'offsetParent', {\n get: function () {\n return self.parentNode;\n },\n set: function (value) {\n self.parentNode = value;\n }\n });\n Object.defineProperty(self.intf, 'offsetLeft', {\n get: function () {\n return self.parentNode.offsetLeft;\n }\n });\n Object.defineProperty(self.intf, 'offsetTop', {\n get: function () {\n return self.parentNode.offsetTop;\n }\n });\n Object.defineProperty(self.intf, 'scrollHeight', {\n get: function () {\n return self.scrollBox.scrollHeight;\n }\n });\n Object.defineProperty(self.intf, 'scrollWidth', {\n get: function () {\n return self.scrollBox.scrollWidth;\n }\n });\n Object.defineProperty(self.intf, 'scrollTop', {\n get: function () {\n return self.scrollBox.scrollTop;\n },\n set: function (value) {\n self.scrollBox.scrollTop = value;\n }\n });\n Object.defineProperty(self.intf, 'scrollLeft', {\n get: function () {\n return self.scrollBox.scrollLeft;\n },\n set: function (value) {\n self.scrollBox.scrollLeft = value;\n }\n });\n Object.defineProperty(self.intf, 'sizes', {\n get: function () {\n return self.sizes;\n }\n });\n Object.defineProperty(self.intf, 'input', {\n get: function () {\n return self.input;\n }\n });\n Object.defineProperty(self.intf, 'controlInput', {\n get: function () {\n return self.controlInput;\n }\n });\n Object.defineProperty(self.intf, 'currentCell', {\n get: function () {\n return self.currentCell;\n }\n });\n Object.defineProperty(self.intf, 'visibleCells', {\n get: function () {\n return self.visibleCells;\n }\n });\n Object.defineProperty(self.intf, 'visibleRows', {\n get: function () {\n return self.visibleRows;\n }\n });\n Object.defineProperty(self.intf, 'selections', {\n get: function () {\n return self.selections;\n }\n });\n Object.defineProperty(self.intf, 'dragMode', {\n get: function () {\n return self.dragMode;\n }\n });\n Object.defineProperty(self.intf, 'changes', {\n get: function () {\n return self.changes;\n }\n });\n self.intf.attributes = {};\n self.intf.formatters = self.formatters;\n self.normalizeDataset = function (data) {\n var i, d, max, syncFnInvoked;\n if (data === null || data === '' || data === undefined) {\n return [];\n }\n if (typeof data === 'string'\n || typeof data === 'number'\n || typeof data === 'boolean') {\n data = [{'0': data}];\n }\n if (!Array.isArray(data) && typeof data === 'object') {\n data = [data];\n }\n if ((!Array.isArray(data[0]) && typeof data[0] === 'object')\n || (Array.isArray(data) && data.length === 0)) {\n return data;\n }\n if (typeof data === 'function') {\n i = data.apply(self.intf, [function (d) {\n if (syncFnInvoked) {\n console.warn('Detected a callback to the data setter function after the same function already returned a value synchronously.');\n }\n self.normalizeDataset(d);\n }]);\n if (i) {\n syncFnInvoked = true;\n self.normalizeDataset(i);\n }\n }\n if (!Array.isArray(data) && typeof data === 'object') {\n data = [data];\n }\n if (Array.isArray(data)) {\n if (!Array.isArray(data[0])) {\n //array of something? throw it all into 1 row!\n data = [data];\n }\n // find the longest length\n max = 0;\n d = [];\n data.forEach(function (row) {\n max = Math.max(max, row.length);\n });\n // map against length indexes\n data.forEach(function (row, index) {\n var x;\n d[index] = {};\n for (x = 0; x < max; x += 1) {\n d[index][x] = row[x] || null;\n }\n });\n return d;\n }\n throw new Error('Unsupported data type. Must be an array of arrays or an array of objects, function or string.');\n };\n Object.defineProperty(self.intf, 'selectionBounds', {\n get: function () {\n return self.getSelectionBounds();\n }\n });\n Object.defineProperty(self.intf, 'selectedRows', {\n get: function () {\n return self.getSelectedData(true);\n }\n });\n Object.defineProperty(self.intf, 'selectedCells', {\n get: function () {\n return self.getSelectedData();\n }\n });\n Object.defineProperty(self.intf, 'visibleSchema', {\n get: function () {\n return self.getVisibleSchema().map(function eachDataRow(col) {\n return col;\n });\n }\n });\n Object.defineProperty(self.intf, 'ctx', {\n get: function () {\n return self.ctx;\n }\n });\n Object.defineProperty(self.intf, 'schema', {\n get: function schemaGetter() {\n return self.getSchema();\n },\n set: function schemaSetter(value) {\n if (!Array.isArray(value) || typeof value[0] !== 'object') {\n throw new Error('Schema must be an array of objects.');\n }\n if (value[0].name === undefined) {\n throw new Error('Expected schema to contain an object with at least a name property.');\n }\n self.schema = value.map(function eachSchemaColumn(column, index) {\n column.width = column.width || self.style.columnWidth;\n column[self.uniqueId] = self.getSchemaNameHash(column.name);\n column.filter = column.filter || self.filter(column.type);\n column.type = column.type || 'string';\n column.index = index;\n column.columnIndex = index;\n column.rowIndex = -1;\n return column;\n });\n self.tempSchema = undefined;\n self.createNewRowData();\n self.createColumnOrders();\n self.tryLoadStoredOrders();\n self.resize(true);\n self.dispatchEvent('schemachanged', {schema: self.schema});\n }\n });\n Object.defineProperty(self.intf, 'data', {\n get: function dataGetter() {\n return self.data.map(function (row) {\n delete row[self.uniqueId];\n return row;\n });\n },\n set: function dataSetter(value) {\n self.originalData = self.normalizeDataset(value).map(function eachDataRow(row) {\n row[self.uniqueId] = self.uId;\n self.uId += 1;\n return row;\n });\n self.changes = [];\n //TODO apply filter to incoming dataset\n self.data = self.originalData;\n if (!self.schema && self.data.length > 0) {\n self.tempSchema = self.getSchemaFromData();\n }\n if (!self.schema && self.data.length === 0) {\n self.tempSchema = [{name: ''}];\n self.tempSchema[0][self.uniqueId] = self.getSchemaNameHash('');\n }\n if (self.tempSchema && !self.schema) {\n self.createColumnOrders();\n self.tryLoadStoredOrders();\n self.dispatchEvent('schemachanged', {schema: self.tempSchema});\n }\n self.createNewRowData();\n if (self.attributes.autoResizeColumns && self.data.length > 0\n && self.storedSettings === undefined) {\n self.autosize();\n }\n self.fitColumnToValues('cornerCell', true);\n if (!self.resize() || !self.isChildGrid) { self.draw(true); }\n self.createRowOrders();\n self.tryLoadStoredOrders();\n self.dispatchEvent('datachanged', {data: self.data});\n }\n });\n self.initScrollBox = function () {\n var sHeight = 0,\n sWidth = 0,\n scrollTop = 0,\n scrollLeft = 0,\n scrollHeight = 0,\n scrollWidth = 0,\n scrollBoxHeight = 20,\n scrollBoxWidth = 20;\n function setScrollTop(value, preventScrollEvent) {\n if (isNaN(value)) {\n throw new Error('ScrollTop value must be a number');\n }\n if (value < 0) {\n value = 0;\n }\n if (value > scrollHeight) {\n value = scrollHeight;\n }\n if (scrollHeight < 0) {\n value = 0;\n }\n scrollTop = value;\n if (!preventScrollEvent) {\n self.scroll();\n }\n }\n function setScrollLeft(value, preventScrollEvent) {\n if (isNaN(value)) {\n throw new Error('ScrollLeft value must be a number');\n }\n if (value < 0) {\n value = 0;\n }\n if (value > scrollWidth) {\n value = scrollWidth;\n }\n if (scrollWidth < 0) {\n value = 0;\n }\n scrollLeft = value;\n if (!preventScrollEvent) {\n self.scroll();\n }\n }\n self.scrollBox.scrollTo = function (x, y) {\n setScrollLeft(x, true);\n setScrollTop(y);\n };\n Object.defineProperty(self.scrollBox, 'scrollBoxHeight', {\n get: function () {\n return scrollBoxHeight;\n },\n set: function (value) {\n scrollBoxHeight = value;\n }\n });\n Object.defineProperty(self.scrollBox, 'scrollBoxWidth', {\n get: function () {\n return scrollBoxWidth;\n },\n set: function (value) {\n scrollBoxWidth = value;\n }\n });\n Object.defineProperty(self.scrollBox, 'height', {\n get: function () {\n return sHeight;\n },\n set: function (value) {\n if (scrollHeight < value) {\n scrollTop = 0;\n }\n sHeight = value;\n }\n });\n Object.defineProperty(self.scrollBox, 'width', {\n get: function () {\n return sWidth;\n },\n set: function (value) {\n sWidth = value;\n }\n });\n Object.defineProperty(self.scrollBox, 'scrollTop', {\n get: function () {\n return scrollTop;\n },\n set: setScrollTop\n });\n Object.defineProperty(self.scrollBox, 'scrollLeft', {\n get: function () {\n return scrollLeft;\n },\n set: setScrollLeft\n });\n Object.defineProperty(self.scrollBox, 'scrollHeight', {\n get: function () {\n return scrollHeight;\n },\n set: function (value) {\n if (scrollTop > value) {\n scrollTop = Math.max(value, 0);\n }\n if (scrollHeight < sHeight) {\n scrollTop = 0;\n }\n scrollHeight = value;\n }\n });\n Object.defineProperty(self.scrollBox, 'scrollWidth', {\n get: function () {\n return scrollWidth;\n },\n set: function (value) {\n if (scrollLeft > value) {\n scrollLeft = Math.max(value, 0);\n }\n scrollWidth = value;\n }\n });\n };\n return;\n };\n}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*jslint browser: true, unparam: true, todo: true*/\n/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false, Event: false*/\n!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {\n 'use strict';\n return function (self) {\n var zIndexTop = 2, hoverScrollTimeout, autoCompleteContext;\n function createContextMenu(ev, pos, items, parentContextMenu) {\n var container = document.createElement('div'),\n upArrow = document.createElement('div'),\n downArrow = document.createElement('div'),\n children = [],\n selectedIndex = -1,\n intf = {},\n rect;\n if (!Array.isArray(items)) { throw new Error('createContextMenu expects an array.'); }\n function createItems() {\n items.forEach(function (item) {\n var contextItemContainer = document.createElement('div'),\n childMenuArrow;\n function removeChildContext(e) {\n if (e.relatedTarget === container\n || item.contextMenu.container === e.relatedTarget\n || childMenuArrow === e.relatedTarget\n || (contextItemContainer === e.relatedTarget)\n ) { return; }\n item.contextMenu.dispose();\n children.splice(children.indexOf(item.contextMenu), 1);\n item.contextMenu = undefined;\n contextItemContainer.removeEventListener('mouseout', removeChildContext);\n container.removeEventListener('mouseout', removeChildContext);\n contextItemContainer.setAttribute('contextOpen', '0');\n contextItemContainer.setAttribute('opening', '0');\n }\n function contextAddCallback(items) {\n // check yet again if the user hasn't moved off\n if (contextItemContainer.getAttribute('opening') !== '1' ||\n contextItemContainer.getAttribute('contextOpen') === '1') {\n return;\n }\n var cPos = contextItemContainer.getBoundingClientRect();\n cPos = {\n left: cPos.left + self.style.childContextMenuMarginLeft + container.offsetWidth,\n top: cPos.top + self.style.childContextMenuMarginTop,\n bottom: cPos.bottom,\n right: cPos.right,\n };\n item.contextMenu = createContextMenu(ev, cPos, items, intf);\n contextItemContainer.setAttribute('contextOpen', '1');\n contextItemContainer.addEventListener('mouseout', removeChildContext);\n container.addEventListener('mouseout', removeChildContext);\n children.push(item.contextMenu);\n }\n function createChildContext() {\n var i;\n if (contextItemContainer.getAttribute('contextOpen') === '1') {\n return;\n }\n contextItemContainer.setAttribute('opening', '1');\n if (typeof item.items === 'function') {\n i = item.items.apply(intf, [function (items) {\n contextAddCallback(items);\n }]);\n if (i !== undefined && Array.isArray(i)) {\n contextAddCallback(i);\n }\n return;\n }\n contextAddCallback(item.items);\n }\n function addItem(item) {\n function addContent(content) {\n if (typeof content === 'function') {\n return addContent(content(ev));\n }\n if (typeof content === 'object') {\n contextItemContainer.appendChild(content);\n return;\n }\n self.createInlineStyle(contextItemContainer, 'canvas-datagrid-context-menu-item');\n contextItemContainer.addEventListener('mouseover', function () {\n self.createInlineStyle(contextItemContainer, 'canvas-datagrid-context-menu-item:hover');\n });\n contextItemContainer.addEventListener('mouseout', function () {\n self.createInlineStyle(contextItemContainer, 'canvas-datagrid-context-menu-item');\n });\n contextItemContainer.innerHTML = content;\n return;\n }\n addContent(item.title);\n item.contextItemContainer = contextItemContainer;\n if (item.items && item.items.length > 0) {\n childMenuArrow = document.createElement('div');\n self.createInlineStyle(childMenuArrow, 'canvas-datagrid-context-child-arrow');\n childMenuArrow.innerHTML = self.style.childContextMenuArrowHTML;\n contextItemContainer.appendChild(childMenuArrow);\n contextItemContainer.addEventListener('mouseover', createChildContext);\n contextItemContainer.addEventListener('mouseout', function () {\n contextItemContainer.setAttribute('opening', '0');\n });\n }\n if (item.click) {\n contextItemContainer.addEventListener('click', function (ev) {\n item.click.apply(self, [ev]);\n });\n }\n }\n addItem(item);\n container.appendChild(contextItemContainer);\n });\n }\n function clickIndex(idx) {\n items[idx].contextItemContainer.dispatchEvent(new Event('click'));\n }\n function checkArrowVisibility() {\n if (container.scrollTop > 0) {\n document.body.appendChild(upArrow);\n } else if (upArrow.parentNode) {\n upArrow.parentNode.removeChild(upArrow);\n }\n if (container.scrollTop >= container.scrollHeight - container.offsetHeight && downArrow.parentNode) {\n downArrow.parentNode.removeChild(downArrow);\n } else if (container.scrollHeight - container.offsetHeight > 0\n && !(container.scrollTop >= container.scrollHeight - container.offsetHeight)) {\n document.body.appendChild(downArrow);\n }\n }\n function startHoverScroll(type) {\n return function t() {\n var a = self.attributes.contextHoverScrollAmount;\n if (type === 'up' && container.scrollTop === 0) { return; }\n if (type === 'down' && container.scrollTop === container.scrollHeight) { return; }\n container.scrollTop += (type === 'up' ? -a : a);\n hoverScrollTimeout = setTimeout(t, self.attributes.contextHoverScrollRateMs, type);\n };\n }\n function endHoverScroll(type) {\n return function () {\n clearTimeout(hoverScrollTimeout);\n };\n }\n function init() {\n var loc = {},\n s = self.scrollOffset(self.canvas);\n createItems();\n self.createInlineStyle(container, 'canvas-datagrid-context-menu');\n loc.x = pos.left - s.left;\n loc.y = pos.top - s.top;\n loc.height = 0;\n zIndexTop += 1;\n container.style.position = 'absolute';\n upArrow.style.color = self.style.contextMenuArrowColor;\n downArrow.style.color = self.style.contextMenuArrowColor;\n [upArrow, downArrow].forEach(function (el) {\n el.style.textAlign = 'center';\n el.style.position = 'absolute';\n el.style.zIndex = zIndexTop + 1;\n });\n container.style.zIndex = zIndexTop;\n if (parentContextMenu && parentContextMenu.inputDropdown) {\n container.style.maxHeight = window.innerHeight - loc.y - self.style.autocompleteBottomMargin + 'px';\n container.style.minWidth = pos.width + 'px';\n loc.y += pos.height;\n }\n container.style.left = loc.x + 'px';\n container.style.top = loc.y + 'px';\n container.addEventListener('scroll', checkArrowVisibility);\n container.addEventListener('wheel', function (e) {\n if (self.hasFocus) {\n container.scrollTop += e.deltaY;\n container.scrollLeft += e.deltaX;\n }\n checkArrowVisibility();\n });\n upArrow.innerHTML = self.style.contextMenuArrowUpHTML;\n downArrow.innerHTML = self.style.contextMenuArrowDownHTML;\n container.appendChild(upArrow);\n document.body.appendChild(downArrow);\n document.body.appendChild(container);\n rect = container.getBoundingClientRect();\n if (rect.bottom > window.innerHeight && !(parentContextMenu && parentContextMenu.inputDropdown)) {\n loc.y = window.innerHeight - container.offsetHeight;\n if (loc.y < 0) { loc.y = 0; }\n if (container.offsetHeight > window.innerHeight) {\n container.style.height = window.innerHeight - self.style.contextMenuWindowMargin + 'px';\n }\n }\n if (rect.right > window.innerWidth) {\n if (parentContextMenu) {\n loc.x = parentContextMenu.container.offsetLeft - container.offsetWidth;\n } else {\n loc.x = window.innerWidth - container.offsetWidth;\n }\n }\n container.style.left = loc.x + 'px';\n container.style.top = loc.y + 'px';\n rect = container.getBoundingClientRect();\n upArrow.style.top = rect.top + 'px';\n downArrow.style.top = rect.top + rect.height - downArrow.offsetHeight + 'px';\n upArrow.style.left = rect.left + 'px';\n downArrow.style.left = rect.left + 'px';\n downArrow.style.width = container.offsetWidth + 'px';\n upArrow.style.width = container.offsetWidth + 'px';\n downArrow.addEventListener('mouseover', startHoverScroll('down'));\n downArrow.addEventListener('mouseout', endHoverScroll('down'));\n upArrow.addEventListener('mouseover', startHoverScroll('up'));\n upArrow.addEventListener('mouseout', endHoverScroll('up'));\n checkArrowVisibility();\n }\n intf.parentGrid = self.intf;\n intf.parentContextMenu = parentContextMenu;\n intf.container = container;\n init();\n intf.clickIndex = clickIndex;\n intf.rect = rect;\n intf.items = items;\n intf.upArrow = upArrow;\n intf.downArrow = downArrow;\n intf.dispose = function () {\n clearTimeout(hoverScrollTimeout);\n children.forEach(function (c) {\n c.dispose();\n });\n [downArrow, upArrow, container].forEach(function (el) {\n if (el.parentNode) { el.parentNode.removeChild(el); }\n });\n };\n Object.defineProperty(intf, 'selectedIndex', {\n get: function () {\n return selectedIndex;\n },\n set: function (value) {\n if (typeof value !== 'number' || isNaN(value || !isFinite(value))) {\n throw new Error('Context menu selected index must be a sane number.');\n }\n selectedIndex = value;\n if (selectedIndex > items.length - 1) {\n selectedIndex = items.length - 1;\n }\n if (selectedIndex < 0) {\n selectedIndex = 0;\n }\n items.forEach(function (item, index) {\n if (index === selectedIndex) {\n return self.createInlineStyle(item.contextItemContainer, 'canvas-datagrid-context-menu-item:hover');\n }\n self.createInlineStyle(item.contextItemContainer, 'canvas-datagrid-context-menu-item');\n });\n }\n });\n return intf;\n }\n function createFilterContextMenuItems(e) {\n var filterContainer = document.createElement('div'),\n filterLabel = document.createElement('div'),\n filterAutoCompleteButton = document.createElement('button'),\n filterInput = document.createElement('input'),\n n = e.cell && e.cell.header ? e.cell.header.title || e.cell.header.name : '',\n autoCompleteItems,\n iRect;\n function fillAutoComplete() {\n autoCompleteItems = {};\n self.data.forEach(function (row) {\n var value = row[e.cell.header.name];\n if (autoCompleteItems[value]) { return; }\n autoCompleteItems[value] = {\n title: self.formatters[e.cell.header.type || 'string']({ cell: { value: value }}),\n click: function (e) {\n filterInput.value = value;\n e.stopPropagation();\n filterInput.dispatchEvent(new Event('keyup'));\n self.disposeAutocomplete();\n return;\n }\n };\n });\n autoCompleteItems = Object.keys(autoCompleteItems).map(function (key) {\n return autoCompleteItems[key];\n });\n }\n function createAutoCompleteContext(ev) {\n if (ev && [40, 38, 13, 9, 27].indexOf(ev.keyCode) !== -1) { return; }\n fillAutoComplete();\n iRect = filterInput.getBoundingClientRect();\n if (autoCompleteContext) {\n autoCompleteContext.dispose();\n autoCompleteContext = undefined;\n }\n autoCompleteContext = createContextMenu(e, {\n left: iRect.left,\n top: iRect.top,\n right: iRect.right,\n bottom: iRect.bottom,\n height: iRect.height,\n width: iRect.width\n }, autoCompleteItems, {inputDropdown: true});\n autoCompleteContext.selectedIndex = 0;\n }\n self.createInlineStyle(filterLabel, 'canvas-datagrid-context-menu-label');\n self.createInlineStyle(filterAutoCompleteButton, 'canvas-datagrid-context-menu-filter-button');\n self.createInlineStyle(filterInput, 'canvas-datagrid-context-menu-filter-input');\n filterInput.onclick = self.disposeAutocomplete;\n filterInput.addEventListener('keydown', function (e) {\n //down\n if (e.keyCode === 40) {\n autoCompleteContext.selectedIndex += 1;\n }\n //up\n if (e.keyCode === 38) {\n autoCompleteContext.selectedIndex -= 1;\n }\n //enter\n if (e.keyCode === 13) {\n autoCompleteContext.clickIndex(autoCompleteContext.selectedIndex);\n self.disposeContextMenu();\n }\n //tab\n if (e.keyCode === 9) {\n autoCompleteContext.clickIndex(autoCompleteContext.selectedIndex);\n e.preventDefault();\n }\n //esc\n if (e.keyCode === 27) {\n self.disposeContextMenu();\n }\n });\n filterInput.addEventListener('keyup', function () {\n self.setFilter(e.cell.header.name, filterInput.value);\n });\n filterInput.addEventListener('keyup', createAutoCompleteContext);\n filterInput.value = e.cell.header ? self.columnFilters[e.cell.header.name] || '' : '';\n filterLabel.innerHTML = self.attributes.filterOptionText.replace(/%s/g, n);\n filterAutoCompleteButton.onclick = function () {\n if (autoCompleteContext) {\n return self.disposeAutocomplete();\n }\n createAutoCompleteContext();\n };\n filterAutoCompleteButton.innerHTML = self.style.contextFilterButtonHTML;\n filterContainer.addEventListener('click', function (e) {\n return e.stopPropagation();\n });\n filterContainer.appendChild(filterLabel);\n filterContainer.appendChild(filterInput);\n filterContainer.appendChild(filterAutoCompleteButton);\n e.items.push({\n title: filterContainer\n });\n if (Object.keys(self.columnFilters).length) {\n Object.keys(self.columnFilters).forEach(function (cf) {\n var h = self.getHeaderByName(cf);\n e.items.push({\n title: self.attributes.removeFilterOptionText.replace(/%s/g, h.title || h.name),\n click: function removeFilterClick(e) {\n e.preventDefault();\n self.setFilter(cf, '');\n self.controlInput.focus();\n }\n });\n });\n }\n }\n function addDefaultContextMenuItem(e) {\n var isNormalCell = !(e.cell.isBackground || e.cell.isHeaderCellCap\n || e.cell.isScrollBar || e.cell.isCorner || e.cell.isRowHeader)\n && e.cell.header;\n if (self.attributes.showFilter && isNormalCell) {\n createFilterContextMenuItems(e);\n }\n if (self.attributes.showCopy\n && self.selections.reduce(function (p, r) {\n return p + r.length;\n }, 0) > 0) {\n e.items.push({\n title: self.attributes.copyText,\n click: function () {\n document.execCommand('copy');\n self.disposeContextMenu();\n self.controlInput.focus();\n }\n });\n }\n if (self.attributes.saveAppearance && self.attributes.showClearSettingsOption\n && (Object.keys(self.sizes.rows).length > 0\n || Object.keys(self.sizes.columns).length > 0)) {\n e.items.push({\n title: self.attributes.clearSettingsOptionText,\n click: function (e) {\n e.preventDefault();\n self.sizes.rows = {};\n self.sizes.columns = {};\n self.createRowOrders();\n self.createColumnOrders();\n self.storedSettings = undefined;\n self.dispatchEvent('resizecolumn', {columnWidth: self.style.columnWidth});\n self.dispatchEvent('resizerow', {cellHeight: self.style.cellHeight});\n self.setStorageData();\n self.resize(true);\n self.disposeContextMenu();\n self.controlInput.focus();\n }\n });\n }\n if (self.attributes.allowSorting && self.attributes.showOrderByOption && isNormalCell) {\n e.items.push({\n title: self.attributes.showOrderByOptionTextAsc.replace('%s', e.cell.header.title || e.cell.header.name),\n click: function (ev) {\n ev.preventDefault();\n self.order(e.cell.header.name, 'asc');\n self.controlInput.focus();\n }\n });\n e.items.push({\n title: self.attributes.showOrderByOptionTextDesc.replace('%s', e.cell.header.title || e.cell.header.name),\n click: function (ev) {\n ev.preventDefault();\n self.order(e.cell.header.name, 'desc');\n self.disposeContextMenu();\n self.controlInput.focus();\n }\n });\n }\n }\n self.disposeAutocomplete = function () {\n if (autoCompleteContext) {\n autoCompleteContext.dispose();\n autoCompleteContext = undefined;\n }\n };\n self.disposeContextMenu = function () {\n document.removeEventListener('click', self.disposeContextMenu);\n zIndexTop = 2;\n self.disposeAutocomplete();\n if (self.contextMenu) {\n self.contextMenu.dispose();\n }\n self.contextMenu = undefined;\n };\n self.contextmenuEvent = function (e, overridePos) {\n if (!self.hasFocus && e.target !== self.canvas) {\n return;\n }\n var items = [],\n pos = overridePos || self.getLayerPos(e, true),\n ev = {\n NativeEvent: e,\n cell: self.getCellAt(pos.x, pos.y),\n items: items\n };\n if (!ev.cell.isGrid) {\n addDefaultContextMenuItem(ev);\n }\n if (self.dispatchEvent('contextmenu', ev)) {\n return;\n }\n if (!ev.cell.isGrid) {\n if (self.contextMenu) {\n self.disposeContextMenu();\n }\n self.contextMenu = createContextMenu(ev, {\n left: pos.x + pos.rect.left + self.style.contextMenuMarginLeft + self.canvasOffsetLeft,\n top: pos.y + pos.rect.top + self.style.contextMenuMarginTop + self.canvasOffsetTop,\n right: ev.cell.width + ev.cell.x + pos.rect.left,\n bottom: ev.cell.height + ev.cell.y + pos.rect.top,\n height: ev.cell.height,\n width: ev.cell.width\n }, items);\n document.addEventListener('click', self.disposeContextMenu);\n e.preventDefault();\n }\n };\n return;\n };\n}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*jslint browser: true, unparam: true, todo: true*/\n/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/\n!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {\n 'use strict';\n return function (self) {\n self.defaults = {\n attributes: [\n ['name', ''],\n ['tree', false],\n ['showNewRow', false],\n ['treeHorizontalScroll', false],\n ['saveAppearance', true],\n ['selectionFollowsActiveCell', false],\n ['multiLine', false],\n ['editable', true],\n ['allowColumnReordering', true],\n ['allowRowReordering', false],\n ['allowSorting', true],\n ['showFilter', true],\n ['globalRowResize', false],\n ['pageUpDownOverlap', 1],\n ['persistantSelectionMode', false],\n ['rowSelectionMode', false],\n ['autoResizeColumns', false],\n ['allowRowHeaderResize', true],\n ['allowColumnResize', true],\n ['allowRowResize', true],\n ['allowRowResizeFromCell', false],\n ['allowColumnResizeFromCell', false],\n ['debug', false],\n ['borderResizeZone', 10],\n ['showColumnHeaders', true],\n ['showRowNumbers', true],\n ['showRowHeaders', true],\n ['scrollRepeatRate', 75],\n ['selectionScrollZone', 20],\n ['resizeScrollZone', 20],\n ['contextHoverScrollRateMs', 5],\n ['contextHoverScrollAmount', 2],\n ['selectionScrollIncrement', 20],\n ['reorderDeadZone', 3],\n ['showClearSettingsOption', true],\n ['showOrderByOption', true],\n ['clearSettingsOptionText', 'Clear saved settings'],\n ['showOrderByOptionTextAsc', 'Order by %s ascending'],\n ['showOrderByOptionTextDesc', 'Order by %s descending'],\n ['removeFilterOptionText', 'Remove filter on %s'],\n ['filterOptionText', 'Filter %s'],\n ['filterTextPrefix', '(filtered) '],\n ['touchReleaseAnimationDurationMs', 1000],\n ['touchReleaseAcceleration', 30],\n ['touchDeadZone', 3],\n ['touchSelectTimeMs', 800],\n ['touchScrollZone', 40],\n ['copyText', 'Copy'],\n ['showCopy', true],\n ['columnHeaderClickBehavior', 'sort'],\n ['scrollPointerLock', true]\n ],\n styles: [\n ['activeCellBackgroundColor', 'rgba(255, 255, 255, 1)'],\n ['activeCellBorderColor', 'rgba(110, 168, 255, 1)'],\n ['activeCellBorderWidth', 0.25],\n ['activeCellColor', 'rgba(0, 0, 0, 1)'],\n ['activeCellFont', '16px sans-serif'],\n ['activeCellHoverBackgroundColor', 'rgba(255, 255, 255, 1)'],\n ['activeCellHoverColor', 'rgba(0, 0, 0, 1)'],\n ['activeCellOverlayBorderColor', 'rgba(66, 133, 244, 1)'],\n ['activeCellOverlayBorderWidth', 0.5],\n ['activeCellPaddingBottom', 5],\n ['activeCellPaddingLeft', 5],\n ['activeCellPaddingRight', 7],\n ['activeCellPaddingTop', 5],\n ['activeCellSelectedBackgroundColor', 'rgba(236, 243, 255, 1)'],\n ['activeCellSelectedColor', 'rgba(0, 0, 0, 1)'],\n ['activeColumnHeaderCellBackgroundColor', 'rgba(225, 225, 225, 1)'],\n ['activeColumnHeaderCellColor', 'rgba(0, 0, 0, 1)'],\n ['activeRowHeaderCellBackgroundColor', 'rgba(225, 225, 225, 1)'],\n ['activeRowHeaderCellColor', 'rgba(0, 0, 0, 1)'],\n ['autocompleteBottomMargin', 60],\n ['autosizeHeaderCellPadding', 8],\n ['autosizePadding', 5],\n ['backgroundColor', 'rgba(240, 240, 240, 1)'],\n ['cellAutoResizePadding', 13],\n ['cellBackgroundColor', 'rgba(255, 255, 255, 1)'],\n ['cellBorderColor', 'rgba(195, 199, 202, 1)'],\n ['cellBorderWidth', 0.5],\n ['cellColor', 'rgba(0, 0, 0, 1)'],\n ['cellFont', '16px sans-serif'],\n ['cellGridHeight', 250],\n ['cellHeight', 24],\n ['cellHeightWithChildGrid', 150],\n ['cellHorizontalAlignment', 'left'],\n ['cellHoverBackgroundColor', 'rgba(255, 255, 255, 1)'],\n ['cellHoverColor', 'rgba(0, 0, 0, 1)'],\n ['cellPaddingBottom', 5],\n ['cellPaddingLeft', 5],\n ['cellPaddingRight', 7],\n ['cellPaddingTop', 5],\n ['cellSelectedBackgroundColor', 'rgba(236, 243, 255, 1)'],\n ['cellSelectedColor', 'rgba(0, 0, 0, 1)'],\n ['cellVerticalAlignment', 'center'],\n ['cellWidthWithChildGrid', 250],\n ['childContextMenuArrowColor', 'rgba(43, 48, 43, 1)'],\n ['childContextMenuArrowHTML', '►'],\n ['childContextMenuMarginLeft', -15],\n ['childContextMenuMarginTop', 0],\n ['columnHeaderCellBackgroundColor', 'rgba(240, 240, 240, 1)'],\n ['columnHeaderCellBorderColor', 'rgba(152, 152, 152, 1)'],\n ['columnHeaderCellBorderWidth', 0.25],\n ['columnHeaderCellColor', 'rgba(50, 50, 50, 1)'],\n ['columnHeaderCellFont', '16px sans-serif'],\n ['columnHeaderCellHeight', 25],\n ['columnHeaderCellHorizontalAlignment', 'left'],\n ['columnHeaderCellHoverBackgroundColor', 'rgba(235, 235, 235, 1)'],\n ['columnHeaderCellHoverColor', 'rgba(0, 0, 0, 1)'],\n ['columnHeaderCellPaddingBottom', 5],\n ['columnHeaderCellPaddingLeft', 5],\n ['columnHeaderCellPaddingRight', 7],\n ['columnHeaderCellPaddingTop', 5],\n ['columnHeaderCellVerticalAlignment', 'center'],\n ['columnWidth', 250],\n ['contextFilterButtonBorder', 'solid 1px rgba(158, 163, 169, 1)'],\n ['contextFilterButtonBorderRadius', '3px'],\n ['contextFilterButtonHTML', '▼'],\n ['contextFilterInputBackground', 'rgba(255,255,255,1)'],\n ['contextFilterInputBorder', 'solid 1px rgba(158, 163, 169, 1)'],\n ['contextFilterInputBorderRadius', '0'],\n ['contextFilterInputColor', 'rgba(0,0,0,1)'],\n ['contextFilterInputFontFamily', 'sans-serif'],\n ['contextFilterInputFontSize', '14px'],\n ['contextMenuArrowColor', 'rgba(43, 48, 43, 1)'],\n ['contextMenuArrowDownHTML', '▼'],\n ['contextMenuArrowUpHTML', '▲'],\n ['contextMenuBackground', 'rgba(240, 240, 240, 1)'],\n ['contextMenuBorder', 'solid 1px rgba(158, 163, 169, 1)'],\n ['contextMenuBorderRadius', '3px'],\n ['contextMenuChildArrowFontSize', '12px'],\n ['contextMenuColor', 'rgba(43, 48, 43, 1)'],\n ['contextMenuFilterButtonFontFamily', 'sans-serif'],\n ['contextMenuFilterButtonFontSize', '10px'],\n ['contextMenuFilterInvalidExpresion', 'rgba(237, 155, 156, 1)'],\n ['contextMenuFontFamily', 'sans-serif'],\n ['contextMenuFontSize', '16px'],\n ['contextMenuHoverBackground', 'rgba(182, 205, 250, 1)'],\n ['contextMenuHoverColor', 'rgba(43, 48, 153, 1)'],\n ['contextMenuItemBorderRadius', '3px'],\n ['contextMenuItemMargin', '2px'],\n ['contextMenuLabelDisplay', 'inline-block'],\n ['contextMenuLabelMargin', '0 3px 0 0'],\n ['contextMenuLabelMaxWidth', '700px'],\n ['contextMenuLabelMinWidth', '75px'],\n ['contextMenuMarginLeft', 3],\n ['contextMenuMarginTop', -3],\n ['contextMenuOpacity', '0.98'],\n ['contextMenuPadding', '2px'],\n ['contextMenuWindowMargin', 6],\n ['cornerCellBackgroundColor', 'rgba(240, 240, 240, 1)'],\n ['cornerCellBorderColor', 'rgba(202, 202, 202, 1)'],\n ['editCellBackgroundColor', 'white'],\n ['editCellBorder', 'solid 1px rgba(110, 168, 255, 1)'],\n ['editCellBoxShadow', '0 2px 5px rgba(0,0,0,0.4)'],\n ['editCellColor', 'black'],\n ['editCellFontFamily', 'sans-serif'],\n ['editCellFontSize', '16px'],\n ['editCellPaddingLeft', 4],\n ['gridBorderColor', 'rgba(202, 202, 202, 1)'],\n ['gridBorderWidth', 1],\n ['columnHeaderOrderByArrowBorderColor', 'rgba(195, 199, 202, 1)'],\n ['columnHeaderOrderByArrowBorderWidth', 1],\n ['columnHeaderOrderByArrowColor', 'rgba(155, 155, 155, 1)'],\n ['columnHeaderOrderByArrowHeight', 8],\n ['columnHeaderOrderByArrowMarginLeft', 0],\n ['columnHeaderOrderByArrowMarginRight', 5],\n ['columnHeaderOrderByArrowMarginTop', 6],\n ['columnHeaderOrderByArrowWidth', 13],\n ['minColumnWidth', 45],\n ['minHeight', 24],\n ['minRowHeight', 24],\n ['name', 'default'],\n ['reorderMarkerBackgroundColor', 'rgba(0, 0, 0, 0.1)'],\n ['reorderMarkerBorderColor', 'rgba(0, 0, 0, 0.2)'],\n ['reorderMarkerBorderWidth', 1.25],\n ['reorderMarkerIndexBorderColor', 'rgba(66, 133, 244, 1)'],\n ['reorderMarkerIndexBorderWidth', 2.75],\n ['rowHeaderCellBackgroundColor', 'rgba(240, 240, 240, 1)'],\n ['rowHeaderCellBorderColor', 'rgba(200, 200, 200, 1)'],\n ['rowHeaderCellBorderWidth', 1],\n ['rowHeaderCellColor', 'rgba(50, 50, 50, 1)'],\n ['rowHeaderCellFont', '16px sans-serif'],\n ['rowHeaderCellHeight', 25],\n ['rowHeaderCellHorizontalAlignment', 'left'],\n ['rowHeaderCellHoverBackgroundColor', 'rgba(235, 235, 235, 1)'],\n ['rowHeaderCellHoverColor', 'rgba(0, 0, 0, 1)'],\n ['rowHeaderCellPaddingBottom', 5],\n ['rowHeaderCellPaddingLeft', 5],\n ['rowHeaderCellPaddingRight', 5],\n ['rowHeaderCellPaddingTop', 5],\n ['rowHeaderCellSelectedBackgroundColor', 'rgba(217, 217, 217, 1)'],\n ['rowHeaderCellSelectedColor', 'rgba(50, 50, 50, 1)'],\n ['rowHeaderCellVerticalAlignment', 'center'],\n ['rowHeaderCellWidth', 57],\n ['scrollBarActiveColor', 'rgba(125, 125, 125, 1)'],\n ['scrollBarBackgroundColor', 'rgba(240, 240, 240, 1)'],\n ['scrollBarBorderColor', 'rgba(202, 202, 202, 1)'],\n ['scrollBarBorderWidth', 0.5],\n ['scrollBarBoxBorderRadius', 4.125],\n ['scrollBarBoxColor', 'rgba(192, 192, 192, 1)'],\n ['scrollBarBoxMargin', 2],\n ['scrollBarBoxMinSize', 15],\n ['scrollBarBoxWidth', 8],\n ['scrollBarCornerBackgroundColor', 'rgba(240, 240, 240, 1)'],\n ['scrollBarCornerBorderColor', 'rgba(202, 202, 202, 1)'],\n ['scrollBarWidth', 11],\n ['selectionOverlayBorderColor', 'rgba(66, 133, 244, 1)'],\n ['selectionOverlayBorderWidth', 0.75],\n ['treeArrowBorderColor', 'rgba(195, 199, 202, 1)'],\n ['treeArrowBorderWidth', 1],\n ['treeArrowClickRadius', 5],\n ['treeArrowColor', 'rgba(155, 155, 155, 1)'],\n ['treeArrowHeight', 8],\n ['treeArrowMarginLeft', 0],\n ['treeArrowMarginRight', 5],\n ['treeArrowMarginTop', 6],\n ['treeArrowWidth', 13],\n ['treeGridHeight', 250]\n ]\n };\n };\n}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*jslint browser: true, unparam: true, todo: true*/\n/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/\n!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {\n 'use strict';\n return function (self) {\n /**\n * Ends editing, optionally aborting the edit.\n * @memberof canvasDataGrid\n * @name endEdit\n * @method\n * @param {boolean} abort When true, abort the edit.\n */\n self.endEdit = function (abort) {\n var cell = self.input.editCell,\n y = cell.rowIndex;\n function abortEdit() {\n abort = true;\n }\n if (self.dispatchEvent('beforeendedit', {\n cell: cell,\n newValue: self.input.value,\n oldValue: cell.value,\n abort: abortEdit,\n input: self.input\n })) { return false; }\n if (self.input.value !== cell.value && !abort) {\n self.changes[y] = self.changes[y] || {};\n self.changes[y][cell.header.name] = self.input.value;\n cell.data[cell.header.name] = self.input.value;\n if (y === self.data.length) {\n if (self.dispatchEvent('newrow', {\n value: self.input.value,\n defaultValue: cell.value,\n aborted: abort,\n cell: cell,\n input: self.input\n })) { return false; }\n self.uId += 1;\n self.addRow(cell.data);\n self.createNewRowData();\n }\n self.draw(true);\n }\n document.body.removeChild(self.input);\n self.controlInput.focus();\n self.dispatchEvent('endedit', {\n cell: cell,\n value: self.input.value,\n aborted: abort,\n input: self.input\n });\n self.input = undefined;\n return true;\n };\n /**\n * Begins editing at cell x, row y.\n * @memberof canvasDataGrid\n * @name beginEditAt\n * @method\n * @param {number} x The column index of the cell to edit.\n * @param {number} y The row index of the cell to edit.\n */\n self.beginEditAt = function (x, y) {\n if (!self.attributes.editable) { return; }\n var cell = self.getVisibleCellByIndex(x, y),\n s = self.getVisibleSchema(),\n enumItems;\n if (self.dispatchEvent('beforebeginedit', {cell: cell})) { return false; }\n self.scrollIntoView(x, y);\n self.setActiveCell(x, y);\n if (cell.header.enum) {\n self.input = document.createElement('select');\n } else {\n self.input = document.createElement(self.attributes.multiLine\n ? 'textarea' : 'input');\n }\n function postDraw() {\n var option, valueInEnum;\n cell = self.getVisibleCellByIndex(x, y);\n if (cell.header.enum) {\n // add enums\n if (typeof cell.header.enum === 'function') {\n enumItems = cell.header.enum.apply(self.intf, [{cell: cell}]);\n } else if (Array.isArray(cell.header.enum)) {\n enumItems = cell.header.enum;\n }\n enumItems.forEach(function (e) {\n var i = document.createElement('option'),\n val,\n title;\n if (Array.isArray(e)) {\n val = e[0];\n title = e[1];\n } else {\n val = e;\n title = e;\n }\n if (val === cell.value) { valueInEnum = true; }\n i.value = val;\n i.innerHTML = title;\n self.input.appendChild(i);\n });\n if (!valueInEnum) {\n option = document.createElement('option');\n option.value = cell.value;\n option.innerHTML = cell.value;\n self.input.appendChild(option);\n }\n self.input.addEventListener('change', function () {\n self.endEdit();\n self.draw(true);\n });\n }\n document.body.appendChild(self.input);\n self.createInlineStyle(self.input, 'canvas-datagrid-edit-input');\n self.input.style.position = 'absolute';\n self.input.editCell = cell;\n self.resizeEditInput();\n self.input.style.zIndex = '2';\n self.input.value = cell.value;\n self.input.focus();\n self.input.addEventListener('click', self.stopPropagation);\n self.input.addEventListener('dblclick', self.stopPropagation);\n self.input.addEventListener('mouseup', self.stopPropagation);\n self.input.addEventListener('mousedown', self.stopPropagation);\n self.input.addEventListener('keydown', function (e) {\n var nx = cell.columnIndex,\n ny = cell.rowIndex;\n // esc\n if (e.keyCode === 27) {\n self.endEdit(true);\n self.draw(true);\n // enter\n } else if (e.keyCode === 13\n && (!self.attributes.multiLine\n || (self.attributes.multiLine && e.shiftKey))) {\n self.endEdit();\n self.draw(true);\n } else if (e.keyCode === 9) {\n e.preventDefault();\n if (!self.endEdit()) {\n return;\n }\n if (e.shiftKey) {\n nx -= 1;\n } else {\n nx += 1;\n }\n if (nx < 0) {\n nx = s.length - 1;\n ny -= 1;\n }\n if (nx > s.length - 1) {\n nx = 0;\n ny += 1;\n }\n if (ny < 0) {\n ny = self.data.length - 1;\n }\n if (ny > self.data.length - 1) {\n ny = 0;\n }\n self.beginEditAt(nx, ny);\n }\n });\n }\n postDraw();\n self.dispatchEvent('beginedit', {cell: cell, input: self.input});\n };\n self.createInlineStyle = function (el, className) {\n var css = {\n 'canvas-datagrid-context-menu-filter-input': {\n height: '19px',\n verticalAlign: 'bottom',\n marginLeft: '2px',\n padding: '0',\n background: self.style.contextFilterInputBackground,\n color: self.style.contextFilterInputColor,\n border: self.style.contextFilterInputBorder,\n borderRadius: self.style.contextFilterInputBorderRadius,\n lineHeight: 'normal',\n fontWeight: 'normal',\n fontFamily: self.style.contextFilterInputFontFamily,\n fontSize: self.style.contextFilterInputFontSize\n },\n 'canvas-datagrid-context-menu-filter-button': {\n height: '19px',\n verticalAlign: 'bottom',\n marginLeft: '2px',\n padding: '0',\n background: self.style.contextMenuBackground,\n color: self.style.contextMenuColor,\n border: self.style.contextFilterButtonBorder,\n borderRadius: self.style.contextFilterButtonBorderRadius,\n lineHeight: 'normal',\n fontWeight: 'normal',\n fontFamily: self.style.contextMenuFilterButtonFontFamily,\n fontSize: self.style.contextMenuFilterButtonFontSize\n },\n 'canvas-datagrid-context-child-arrow': {\n cssFloat: 'right',\n color: self.style.childContextMenuArrowColor,\n fontSize: self.style.contextMenuChildArrowFontSize,\n fontFamily: self.style.contextMenuFontFamily,\n verticalAlign: 'middle'\n },\n 'canvas-datagrid-autocomplete': {\n fontFamily: self.style.contextMenuFontFamily,\n fontSize: self.style.contextMenuFontSize,\n background: self.style.contextMenuBackground,\n color: self.style.contextMenuColor,\n border: self.style.contextMenuBorder,\n padding: self.style.contextMenuPadding,\n borderRadius: self.style.contextMenuBorderRadius,\n opacity: self.style.contextMenuOpacity,\n position: 'absolute',\n zIndex: 3,\n overflow: 'hidden'\n },\n 'canvas-datagrid-autocomplete-item': {\n background: self.style.contextMenuBackground,\n color: self.style.contextMenuColor\n },\n 'canvas-datagrid-autocomplete-item:hover': {\n background: self.style.contextMenuHoverBackground,\n color: self.style.contextMenuHoverColor\n },\n 'canvas-datagrid-canvas': {\n position: 'absolute',\n zIndex: '-1'\n },\n 'canvas-datagrid': {\n position: 'absolute',\n background: self.style.backgroundColor,\n zIndex: '1',\n boxSizing: 'content-box',\n padding: '0'\n },\n 'canvas-datagrid-control-input': {\n position: 'fixed',\n top: '-5px',\n left: '-5px',\n border: 'none',\n opacity: '0',\n cursor: 'pointer',\n width: '1px',\n height: '1px',\n lineHeight: 'normal',\n fontWeight: 'normal',\n fontFamily: self.style.contextMenuFontFamily,\n fontSize: self.style.contextMenuFontSize\n },\n 'canvas-datagrid-edit-input': {\n boxSizing: 'content-box',\n outline: 'none',\n margin: '0',\n padding: '0 0 0 ' + self.style.editCellPaddingLeft + 'px',\n lineHeight: 'normal',\n fontWeight: 'normal',\n fontFamily: self.style.editCellFontFamily,\n fontSize: self.style.editCellFontSize,\n boxShadow: self.style.editCellBoxShadow,\n border: self.style.editCellBorder,\n color: self.style.editCellColor,\n background: self.style.editCellBackgroundColor,\n appearance: 'none',\n webkitAppearance: 'none',\n mozAppearance: 'none',\n borderRadius: '0'\n },\n 'canvas-datagrid-context-menu-item': {\n lineHeight: 'normal',\n fontWeight: 'normal',\n fontFamily: self.style.contextMenuFontFamily,\n fontSize: self.style.contextMenuFontSize,\n color: 'inherit',\n background: 'inherit',\n margin: self.style.contextMenuItemMargin,\n borderRadius: self.style.contextMenuItemBorderRadius,\n verticalAlign: 'middle'\n },\n 'canvas-datagrid-context-menu-item:hover': {\n background: self.style.contextMenuHoverBackground,\n color: self.style.contextMenuHoverColor\n },\n 'canvas-datagrid-context-menu-label': {\n margin: self.style.contextMenuLabelMargin,\n display: self.style.contextMenuLabelDisplay,\n minWidth: self.style.contextMenuLabelMinWidth,\n maxWidth: self.style.contextMenuLabelMaxWidth\n },\n 'canvas-datagrid-context-menu': {\n lineHeight: 'normal',\n fontWeight: 'normal',\n fontFamily: self.style.contextMenuFontFamily,\n fontSize: self.style.contextMenuFontSize,\n background: self.style.contextMenuBackground,\n color: self.style.contextMenuColor,\n border: self.style.contextMenuBorder,\n padding: self.style.contextMenuPadding,\n borderRadius: self.style.contextMenuBorderRadius,\n opacity: self.style.contextMenuOpacity,\n overflow: 'hidden'\n },\n 'canvas-datagrid-invalid-search-regExp': {\n background: self.style.contextMenuFilterInvalidExpresion\n }\n };\n if (css[className]) {\n Object.keys(css[className]).map(function (prop) {\n el.style[prop] = css[className][prop];\n });\n }\n return;\n };\n self.appendTo = function (n) {\n self.parentNode = n;\n self.height = self.parentNode.offsetHeight;\n self.width = self.parentNode.offsetWidth;\n if (self.parentNode && /canvas-datagrid-(cell|tree)/.test(self.parentNode.nodeType)) {\n self.isChildGrid = true;\n self.parentGrid = self.parentNode.parentGrid;\n self.ctx = self.parentGrid.context;\n self.canvas = self.parentGrid.canvas;\n self.controlInput = self.parentGrid.controlInput;\n self.eventParent = self.canvas;\n self.intf.offsetParent = self.parentNode;\n } else {\n self.controlInput = document.createElement('input');\n self.controlInput.onblur = self.intf.blur;\n self.createInlineStyle(self.controlInput, 'canvas-datagrid-control-input');\n self.isChildGrid = false;\n self.parentDOMNode = self.parentNode;\n self.parentNode = self.parentDOMNode;\n self.parentIsCanvas = /canvas/i.test(self.parentDOMNode.tagName);\n if (self.parentIsCanvas) {\n self.canvas = self.parentDOMNode;\n } else {\n self.canvas = document.createElement('canvas');\n self.parentDOMNode.appendChild(self.canvas);\n }\n self.ctx = self.canvas.getContext('2d');\n self.ctx.textBaseline = 'alphabetic';\n document.body.appendChild(self.controlInput);\n self.eventParent = self.canvas;\n }\n self.controlInput.addEventListener('blur', function (e) {\n if (e.target !== self.canvas) {\n self.hasFocus = false;\n }\n });\n window.addEventListener('resize', self.resize);\n if (MutationObserver) {\n self.observer = new MutationObserver(function (mutations) {\n mutations.forEach(function (mutation) {\n self.resize(true);\n });\n });\n [self.canvas.parentNode].forEach(function (el) {\n self.observer.observe(el, { attributes: true });\n });\n }\n self.eventParent.addEventListener('scroll', self.resize, false);\n self.eventParent.addEventListener('touchstart', self.touchstart, false);\n self.eventParent.addEventListener('mouseup', self.mouseup, false);\n self.eventParent.addEventListener('mousedown', self.mousedown, false);\n self.eventParent.addEventListener('dblclick', self.dblclick, false);\n self.eventParent.addEventListener('click', self.click, false);\n self.eventParent.addEventListener('mousemove', self.mousemove);\n self.eventParent.addEventListener('wheel', self.scrollWheel, false);\n self.canvas.addEventListener('contextmenu', self.contextmenuEvent, false);\n (self.isChildGrid ? self.parentGrid : document).addEventListener('copy', self.copy);\n self.controlInput.addEventListener('keypress', self.keypress, false);\n self.controlInput.addEventListener('keyup', self.keyup, false);\n self.controlInput.addEventListener('keydown', self.keydown, false);\n };\n self.setDom = function () {\n self.appendTo(self.args.parentNode);\n };\n };\n}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*jslint browser: true, unparam: true, todo: true*/\n/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/\n!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {\n 'use strict';\n return function (self) {\n // all methods here are exposed by intf\n // to users\n /**\n * Converts a integer into a letter A - ZZZZZ...\n * @memberof canvasDataGrid\n * @name integerToAlpha\n * @method\n * @param {column} n The number to convert.\n */\n self.integerToAlpha = function (n) {\n var ordA = 'a'.charCodeAt(0),\n ordZ = 'z'.charCodeAt(0),\n len = ordZ - ordA + 1,\n s = '';\n while (n >= 0) {\n s = String.fromCharCode(n % len + ordA) + s;\n n = Math.floor(n / len) - 1;\n }\n return s;\n };\n /**\n * Inserts a new column before the specified index into the schema.\n * @see canvasDataGrid#schema\n * @tutorial schema\n * @memberof canvasDataGrid\n * @name insertColumn\n * @method\n * @param {column} c The column to insert into the schema.\n * @param {number} index The index of the column to insert before.\n */\n self.insertColumn = function (c, index) {\n var s = self.getSchema();\n if (s.length < index) {\n throw new Error('Index is beyond the length of the schema.');\n }\n self.validateColumn(c, s);\n s.splice(index, 0, c);\n self.data.forEach(function (row) {\n self.applyDefaultValue(row, c);\n });\n self.intf.schema = s;\n };\n /**\n * Deletes a column from the schema at the specified index.\n * @memberof canvasDataGrid\n * @name deleteColumn\n * @tutorial schema\n * @method\n * @param {number} index The index of the column to delete.\n */\n self.deleteColumn = function (index) {\n var s = self.getSchema();\n // remove data matching this column name from data\n self.data.forEach(function (row) {\n delete row[s[index].name];\n });\n s.splice(index, 1);\n self.intf.schema = s;\n };\n /**\n * Adds a new column into the schema.\n * @see canvasDataGrid#schema\n * @tutorial schema\n * @memberof canvasDataGrid\n * @name addColumn\n * @method\n * @param {column} c The column to add to the schema.\n */\n self.addColumn = function (c) {\n var s = self.getSchema();\n self.validateColumn(c, s);\n s.push(c);\n self.data.forEach(function (row) {\n self.applyDefaultValue(row, c);\n });\n self.intf.schema = s;\n };\n /**\n * Deletes a row from the dataset at the specified index.\n * @memberof canvasDataGrid\n * @name deleteRow\n * @method\n * @param {number} index The index of the row to delete.\n */\n self.deleteRow = function (index) {\n self.originalData.splice(index, 1);\n self.setFilter();\n self.resize(true);\n };\n /**\n * Inserts a new row into the dataset before the specified index.\n * @memberof canvasDataGrid\n * @name insertRow\n * @method\n * @param {object} d data.\n * @param {number} index The index of the row to insert before.\n */\n self.insertRow = function (d, index) {\n if (self.originalData.length < index) {\n throw new Error('Index is beyond the length of the dataset.');\n }\n self.originalData.splice(index, 0, d);\n self.getSchema().forEach(function (c) {\n if (d[c.name] === undefined) {\n self.applyDefaultValue(self.originalData[index], c);\n }\n });\n self.setFilter();\n self.resize(true);\n };\n /**\n * Adds a new row into the dataset.\n * @memberof canvasDataGrid\n * @name addRow\n * @method\n * @param {object} d data.\n */\n self.addRow = function (d) {\n self.originalData.push(d);\n self.getSchema().forEach(function (c) {\n if (d[c.name] === undefined) {\n self.applyDefaultValue(self.originalData[self.originalData.length - 1], c);\n }\n });\n self.setFilter();\n self.resize(true);\n };\n /**\n * Sets the height of a given row by index number.\n * @memberof canvasDataGrid\n * @name setRowHeight\n * @method\n * @param {number} rowIndex The index of the row to set.\n * @param {number} height Height to set the row to.\n */\n self.setRowHeight = function (rowIndex, height) {\n self.sizes.rows[self.data[rowIndex][self.uniqueId]] = height;\n self.draw(true);\n };\n /**\n * Sets the width of a given column by index number.\n * @memberof canvasDataGrid\n * @name setColumnWidth\n * @method\n * @param {number} colIndex The index of the column to set.\n * @param {number} width Width to set the column to.\n */\n self.setColumnWidth = function (colIndex, width) {\n var s = self.getSchema();\n self.sizes.columns[s[colIndex][self.uniqueId]] = width;\n self.draw(true);\n };\n /**\n * Removes any changes to the width of the columns due to user or api interaction, setting them back to the schema or style default.\n * @memberof canvasDataGrid\n * @name resetColumnWidths\n * @tutorial schema\n * @method\n */\n self.resetColumnWidths = function () {\n self.sizes.columns = {};\n self.draw(true);\n };\n /**\n * Removes any changes to the height of the rows due to user or api interaction, setting them back to the schema or style default.\n * @memberof canvasDataGrid\n * @name resetRowHeights\n * @tutorial schema\n * @method\n */\n self.resetRowHeights = function () {\n self.sizes.rows = {};\n self.draw(true);\n };\n /**\n * Sets the value of the filter.\n * @memberof canvasDataGrid\n * @name setFilter\n * @method\n * @param {string} column Name of the column to filter.\n * @param {string} value The value to filter for.\n */\n self.setFilter = function (column, value) {\n function applyFilter() {\n self.refreshFromOrigialData();\n Object.keys(self.columnFilters).forEach(function (filter) {\n var header = self.getHeaderByName(column);\n if (!header) {\n return;\n }\n self.currentFilter = header.filter || self.filter(column.type || 'string');\n self.data = self.data.filter(function (row) {\n return self.currentFilter(row[filter], self.columnFilters[filter]);\n });\n });\n self.resize();\n self.draw(true);\n }\n if (column === undefined && value === undefined) {\n self.columnFilters = {};\n return applyFilter();\n }\n if (column && (value === '' || value === undefined)) {\n delete self.columnFilters[column];\n } else {\n self.columnFilters[column] = value;\n }\n applyFilter();\n };\n /**\n * Returns the number of pixels to scroll down to line up with row rowIndex.\n * @memberof canvasDataGrid\n * @name findRowScrollTop\n * @method\n * @param {number} rowIndex The row index of the row to scroll find.\n */\n self.findRowScrollTop = function (rowIndex) {\n var top = 0, x = 0, l = self.data.length,\n cellBorder = self.style.cellBorderWidth * 2;\n if (!self.attributes.showNewRow) {\n l -= 1;\n }\n if (rowIndex > l) {\n throw new Error('Impossible row index');\n }\n while (x < rowIndex) {\n top += (self.sizes.rows[self.data[x][self.uniqueId]] || self.style.cellHeight) + cellBorder;\n x += 1;\n }\n //TODO: This is not super accurate, causes pageUp/Dn to not move around right\n return top - (self.sizes.rows[self.data[rowIndex][self.uniqueId]] || self.style.cellHeight);\n };\n /**\n * Returns the number of pixels to scroll to the left to line up with column columnIndex.\n * @memberof canvasDataGrid\n * @name findColumnScrollLeft\n * @method\n * @param {number} columnIndex The column index of the column to find.\n */\n self.findColumnScrollLeft = function (columnIndex) {\n var left = 0, y = 0, s = self.getSchema(), l = s.length - 1;\n if (columnIndex > l) {\n throw new Error('Impossible column index');\n }\n while (y < columnIndex) {\n left += self.sizes.columns[s[y][self.uniqueId]] || s[y].width;\n y += 1;\n }\n return left;\n };\n /**\n * Scrolls the cell at cell x, row y.\n * @memberof canvasDataGrid\n * @name gotoCell\n * @method\n * @param {number} x The column index of the cell to scroll to.\n * @param {number} y The row index of the cell to scroll to.\n */\n self.gotoCell = function (x, y) {\n if (x !== undefined) {\n self.scrollBox.scrollLeft = self.findColumnScrollLeft(x);\n }\n if (y !== undefined) {\n self.scrollBox.scrollTop = self.findRowScrollTop(y);\n }\n };\n /**\n * Scrolls the row y.\n * @memberof canvasDataGrid\n * @name gotoRow\n * @method\n * @param {number} y The row index of the cell to scroll to.\n */\n self.gotoRow = function (y) {\n self.gotoCell(0, y);\n };\n /**\n * Scrolls the cell at cell x, row y into view if it is not already.\n * @memberof canvasDataGrid\n * @name scrollIntoView\n * @method\n * @param {number} x The column index of the cell to scroll into view.\n * @param {number} y The row index of the cell to scroll into view.\n */\n self.scrollIntoView = function (x, y) {\n if (self.visibleCells.filter(function (cell) {\n return (cell.rowIndex === y || y === undefined)\n && (cell.columnIndex === x || x === undefined)\n && cell.x > 0\n && cell.y > 0\n && cell.x + cell.width < self.width\n && cell.y + cell.height < self.height;\n }).length === 0) {\n self.gotoCell(x, y);\n }\n };\n /**\n * Sets the active cell. Requires redrawing.\n * @memberof canvasDataGrid\n * @name setActiveCell\n * @method\n * @param {number} x The column index of the cell to set active.\n * @param {number} y The row index of the cell to set active.\n */\n self.setActiveCell = function (x, y) {\n self.activeCell = {\n rowIndex: y,\n columnIndex: x\n };\n };\n /**\n * Selects every visible cell.\n * @memberof canvasDataGrid\n * @name selectAll\n * @method\n */\n self.selectAll = function () {\n self.selectArea({\n top: 0,\n left: 0,\n right: self.getVisibleSchema().length - 1,\n bottom: self.data.length - 1\n });\n };\n /**\n * Returns true if the selected columnIndex is selected on every row.\n * @memberof canvasDataGrid\n * @name isColumnSelected\n * @method\n * @param {number} columnIndex The column index to check.\n */\n self.isColumnSelected = function (columnIndex) {\n var colIsSelected = true;\n self.data.forEach(function (row, rowIndex) {\n if (!self.selections[rowIndex] || self.selections[rowIndex].indexOf(self.orders.columns[columnIndex]) === -1) {\n colIsSelected = false;\n }\n });\n return colIsSelected;\n };\n /**\n * Selects a column.\n * @memberof canvasDataGrid\n * @name selectColumn\n * @method\n * @param {number} columnIndex The column index to select.\n * @param {boolean} toggleSelectMode When true, behaves as if you were holding control/command when you clicked the column.\n * @param {boolean} shift When true, behaves as if you were holding shift when you clicked the column.\n * @param {boolean} supressSelectionchangedEvent When true, prevents the selectionchanged event from firing.\n */\n self.selectColumn = function (columnIndex, ctrl, shift, supressEvent) {\n var s, e, x;\n function addCol(i) {\n self.data.forEach(function (row, rowIndex) {\n self.selections[rowIndex] = self.selections[rowIndex] || [];\n if (self.selections[rowIndex].indexOf(i) === -1) {\n self.selections[rowIndex].push(i);\n }\n });\n }\n function removeCol(i) {\n self.data.forEach(function (row, rowIndex) {\n self.selections[rowIndex] = self.selections[rowIndex] || [];\n if (self.selections[rowIndex].indexOf(i) !== -1) {\n self.selections[rowIndex].splice(self.selections[rowIndex].indexOf(i), 1);\n }\n });\n }\n if (shift) {\n if (!self.activeCell) { return; }\n s = Math.min(self.activeCell.columnIndex, columnIndex);\n e = Math.max(self.activeCell.columnIndex, columnIndex);\n for (x = s; e > x; x += 1) {\n addCol(x);\n }\n }\n if (!ctrl && !shift) {\n self.selections = [];\n self.activeCell.columnIndex = columnIndex;\n self.activeCell.rowIndex = self.scrollIndexTop;\n }\n if (ctrl && self.isColumnSelected(columnIndex)) {\n removeCol(columnIndex);\n } else {\n addCol(columnIndex);\n }\n if (supressEvent) { return; }\n self.dispatchEvent('selectionchanged', {\n selectedData: self.getSelectedData(),\n selections: self.selections,\n selectionBounds: self.selectionBounds\n });\n };\n /**\n * Selects a row.\n * @memberof canvasDataGrid\n * @name selectRow\n * @method\n * @param {number} rowIndex The row index to select.\n * @param {boolean} ctrl When true, behaves as if you were holding control/command when you clicked the row.\n * @param {boolean} shift When true, behaves as if you were holding shift when you clicked the row.\n * @param {boolean} supressSelectionchangedEvent When true, prevents the selectionchanged event from firing.\n */\n self.selectRow = function (rowIndex, ctrl, shift, supressEvent) {\n var x, st, en, s = self.getSchema();\n function addRow(ri) {\n self.selections[ri] = [];\n self.selections[ri].push(-1);\n s.forEach(function (col) {\n self.selections[ri].push(col.index);\n });\n }\n if (self.dragAddToSelection === false || self.dragObject === undefined) {\n if (self.selections[rowIndex] && self.selections[rowIndex].length - 1 === s.length) {\n if (ctrl) {\n self.selections[rowIndex] = [];\n return;\n }\n }\n }\n if (self.dragAddToSelection === true || self.dragObject === undefined) {\n if (shift && self.dragObject === undefined) {\n if (!self.activeCell) { return; }\n st = Math.min(self.activeCell.rowIndex, rowIndex);\n en = Math.max(self.activeCell.rowIndex, rowIndex);\n for (x = st; en >= x; x += 1) {\n addRow(x);\n }\n } else {\n addRow(rowIndex);\n }\n }\n if (supressEvent) { return; }\n self.dispatchEvent('selectionchanged', {\n selectedData: self.getSelectedData(),\n selections: self.selections,\n selectionBounds: self.selectionBounds\n });\n };\n /**\n * Collapse a tree grid by row index.\n * @memberof canvasDataGrid\n * @name collapseTree\n * @method\n * @param {number} index The index of the row to collapse.\n */\n self.collapseTree = function (rowIndex) {\n var rowId = self.data[rowIndex][self.uniqueId];\n self.dispatchEvent('collapsetree', {\n childGrid: self.childGrids[rowId],\n data: self.data[rowIndex],\n rowIndex: rowIndex\n });\n self.openChildren[rowId].blur();\n self.openChildren[rowId].dispose();\n delete self.openChildren[rowId];\n delete self.sizes.trees[rowId];\n delete self.childGrids[rowId];\n self.dispatchEvent('resizerow', {\n cellHeight: self.style.cellHeight\n });\n self.resize(true);\n self.draw(true);\n };\n /**\n * Expands a tree grid by row index.\n * @memberof canvasDataGrid\n * @name expandTree\n * @method\n * @param {number} index The index of the row to expand.\n */\n self.expandTree = function (rowIndex) {\n var rowHeaderCellHeight = self.getRowHeaderCellHeight(),\n columnHeaderCellWidth = self.sizes.columns.cornerCell || self.style.rowHeaderCellWidth,\n rowId = self.data[rowIndex][self.uniqueId],\n h = self.sizes.trees[rowId] || self.style.treeGridHeight,\n treeGrid;\n if (!self.childGrids[rowId]) {\n treeGrid = self.createGrid({\n debug: self.attributes.debug,\n name: self.attributes.saveAppearance\n ? self.attributes.name + 'tree' + rowId : undefined,\n parentNode: {\n parentGrid: self.intf,\n nodeType: 'canvas-datagrid-tree',\n offsetHeight: h,\n offsetWidth: self.width - columnHeaderCellWidth,\n header: { width: self.width - columnHeaderCellWidth },\n offsetLeft: columnHeaderCellWidth,\n offsetTop: rowHeaderCellHeight,\n offsetParent: self.intf.parentNode,\n parentNode: self.intf.parentNode,\n style: 'tree',\n data: self.data[rowIndex]\n }\n });\n self.childGrids[rowId] = treeGrid;\n }\n treeGrid = self.childGrids[rowId];\n treeGrid.visible = true;\n self.dispatchEvent('expandtree', {\n treeGrid: treeGrid,\n data: self.data[rowIndex],\n rowIndex: rowIndex\n });\n self.openChildren[rowId] = treeGrid;\n self.sizes.trees[rowId] = h;\n self.dispatchEvent('resizerow', {height: self.style.cellHeight});\n self.resize(true);\n };\n /**\n * Toggles tree grid open and close by row index.\n * @memberof canvasDataGrid\n * @name toggleTree\n * @method\n * @param {number} index The index of the row to toggle.\n */\n self.toggleTree = function (rowIndex) {\n var i = self.openChildren[self.data[rowIndex][self.uniqueId]];\n if (i) {\n return self.collapseTree(rowIndex);\n }\n self.expandTree(rowIndex);\n };\n /**\n * Returns a header from the schema by name.\n * @memberof canvasDataGrid\n * @name getHeaderByName\n * @tutorial schema\n * @method\n * @returns {header} header with the selected name, or undefined.\n * @param {string} name The name of the column to resize.\n */\n self.getHeaderByName = function (name) {\n var x, i = self.getSchema();\n for (x = 0; x < i.length; x += 1) {\n if (i[x].name === name) {\n return i[x];\n }\n }\n };\n /**\n * Resizes a column to fit the longest value in the column. Call without a value to resize all columns.\n * Warning, can be slow on very large record sets (1m records ~3-5 seconds on an i7).\n * @memberof canvasDataGrid\n * @name fitColumnToValues\n * @method\n * @param {string} name The name of the column to resize.\n */\n self.fitColumnToValues = function (name, internal) {\n self.sizes.columns[name === 'cornerCell' ? name : self.getHeaderByName(name)[self.uniqueId]]\n = self.findColumnMaxTextLength(name);\n if (!internal) {\n self.resize();\n self.draw(true);\n }\n };\n /**\n * Checks if a cell is currently visible.\n * @memberof canvasDataGrid\n * @name isCellVisible\n * @method\n * @returns {boolean} when true, the cell is visible, when false the cell is not currently drawn.\n * @param {cell} cell The cell to check for. Alternatively you can pass an object { x: , y: }.\n */\n self.isCellVisible = function (cell) {\n var x, l = self.visibleCells.length;\n for (x = 0; x < l; x += 1) {\n if (cell.x === self.visibleCells[x].x && cell.y === self.visibleCells[x].y) {\n return true;\n }\n }\n return false;\n };\n /**\n * Sets the order of the data.\n * @memberof canvasDataGrid\n * @name order\n * @method\n * @returns {cell} cell at the selected location.\n * @param {number} columnName Number of pixels from the left.\n * @param {string} direction `asc` for ascending or `desc` for descending.\n * @param {function} [sortFunction] When defined, override the default sorting method defined in the column's schema and use this one.\n * @param {bool} [dontSetStorageData] Don't store this setting for future use.\n */\n self.order = function (columnName, direction, sortFunction, dontSetStorageData) {\n var f,\n c = self.getSchema().filter(function (col) {\n return col.name === columnName;\n });\n self.orderBy = columnName;\n if (c.length === 0) {\n throw new Error('Cannot sort. No such column name');\n }\n f = sortFunction || self.sorters[c[0].type];\n if (!f && c[0].type !== undefined) {\n console.warn('Cannot sort type \"%s\" falling back to string sort.', c[0].type);\n }\n self.data = self.data.sort(typeof f === 'function' ? f(columnName, direction) : self.sorters.string);\n self.dispatchEvent('ordercolumn', {name: columnName, direction: direction});\n self.draw(true);\n if (dontSetStorageData) { return; }\n self.setStorageData();\n };\n self.isInGrid = function (e) {\n if (e.x < 0\n || e.x > self.width\n || e.y < 0\n || e.y > self.height) {\n return false;\n }\n return true;\n };\n /**\n * Gets the cell at columnIndex and rowIndex.\n * @memberof canvasDataGrid\n * @name getVisibleCellByIndex\n * @method\n * @returns {cell} cell at the selected location.\n * @param {number} x Column index.\n * @param {number} y Row index.\n */\n self.getVisibleCellByIndex = function (x, y) {\n return self.visibleCells.filter(function (c) {\n return c.columnIndex === x && c.rowIndex === y;\n })[0];\n };\n /**\n * Gets the cell at grid pixel coordinate x and y.\n * @memberof canvasDataGrid\n * @name getCellAt\n * @method\n * @returns {cell} cell at the selected location.\n * @param {number} x Number of pixels from the left.\n * @param {number} y Number of pixels from the top.\n */\n self.getCellAt = function (x, y, useTouchScrollZones) {\n var tsz = useTouchScrollZones ? self.attributes.touchScrollZone : 0, i, l = self.visibleCells.length, cell;\n if (!self.visibleCells || !self.visibleCells.length) { return; }\n self.hasFocus = true;\n if (!(y < self.height\n && y > 0\n && x < self.width\n && x > 0)) {\n self.hasFocus = false;\n return {\n dragContext: 'inherit',\n context: 'inherit'\n };\n }\n for (i = 0; i < l; i += 1) {\n cell = self.visibleCells[i];\n if (useTouchScrollZones && /(vertical|horizontal)-scroll-/.test(cell.style)) {\n cell.x -= tsz;\n cell.y -= tsz;\n cell.height += tsz;\n cell.width += tsz;\n }\n if (cell.x - self.style.cellBorderWidth < x\n && cell.x + cell.width + self.style.cellBorderWidth > x\n && cell.y - self.style.cellBorderWidth < y\n && cell.y + cell.height + self.style.cellBorderWidth > y) {\n if (/vertical-scroll-(bar|box)/.test(cell.style)) {\n cell.dragContext = 'vertical-scroll-box';\n cell.context = 'vertical-scroll-box';\n cell.isScrollBar = true;\n cell.isVerticalScrollBar = true;\n if (y > self.scrollBox.box.v.y + self.scrollBox.scrollBoxHeight) {\n cell.dragContext = 'vertical-scroll-bottom';\n cell.context = 'vertical-scroll-bottom';\n } else if (y < self.scrollBox.box.v.y) {\n cell.dragContext = 'vertical-scroll-top';\n cell.context = 'vertical-scroll-top';\n }\n self.canvas.style.cursor = 'default';\n return cell;\n }\n if (/horizontal-scroll-(bar|box)/.test(cell.style)) {\n cell.dragContext = 'horizontal-scroll-box';\n cell.context = 'horizontal-scroll-box';\n cell.isScrollBar = true;\n cell.isHorizontalScrollBar = true;\n if (x > self.scrollBox.box.h.x + self.scrollBox.scrollBoxWidth) {\n cell.dragContext = 'horizontal-scroll-right';\n cell.context = 'horizontal-scroll-right';\n } else if (x < self.scrollBox.box.h.x) {\n cell.dragContext = 'horizontal-scroll-left';\n cell.context = 'horizontal-scroll-left';\n }\n self.canvas.style.cursor = 'default';\n return cell;\n }\n if (cell.x + cell.width - (self.attributes.borderResizeZone * 0.4) < x\n && cell.x + cell.width + (self.attributes.borderResizeZone * 0.6) > x\n && self.attributes.allowColumnResize\n && ((self.attributes.allowColumnResizeFromCell && cell.style === 'cell')\n || cell.style !== 'cell')\n && ((self.attributes.allowRowHeaderResize\n && ['rowHeaderCell', 'cornerCell'].indexOf(cell.style) !== -1)\n || ['rowHeaderCell', 'cornerCell'].indexOf(cell.style) === -1)) {\n cell.context = 'ew-resize';\n cell.dragContext = 'ew-resize';\n return cell;\n }\n if (cell.y + cell.height - (self.attributes.borderResizeZone * 0.4) < y\n && cell.y + cell.height + (self.attributes.borderResizeZone * 0.6) > y\n && self.attributes.allowRowResize\n && ((self.attributes.allowRowResizeFromCell && cell.style === 'cell')\n || cell.style !== 'cell')\n && cell.style !== 'columnHeaderCell') {\n cell.context = 'ns-resize';\n cell.dragContext = 'ns-resize';\n return cell;\n }\n if (cell.style === 'columnHeaderCell') {\n cell.context = 'cell';\n cell.dragContext = 'column-reorder';\n return cell;\n }\n if (cell.style === 'rowHeaderCell') {\n cell.context = 'cell';\n cell.dragContext = 'row-reorder';\n return cell;\n }\n if (cell.isGrid) {\n self.hasFocus = false;\n cell.dragContext = 'cell-grid';\n cell.context = 'cell-grid';\n return cell;\n }\n if (cell.style === 'tree-grid') {\n self.hasFocus = false;\n cell.dragContext = 'tree';\n cell.context = 'tree';\n return cell;\n }\n cell.dragContext = 'cell';\n cell.context = 'cell';\n return cell;\n }\n }\n self.hasFocus = true;\n self.canvas.style.cursor = 'default';\n return {\n dragContext: 'background',\n context: 'background',\n style: 'background',\n isBackground: true\n };\n };\n /**\n * Gets the bounds of current selection. \n * @returns {rect} selection.\n * @memberof canvasDataGrid\n * @name getSelectionBounds\n * @method\n */\n self.getSelectionBounds = function () {\n var low = {x: Infinity, y: Infinity},\n high = {x: -Infinity, y: -Infinity};\n self.data.forEach(function (row, rowIndex) {\n var maxCol, minCol;\n if (self.selections[rowIndex] && self.selections[rowIndex].length) {\n low.y = rowIndex < low.y ? rowIndex : low.y;\n high.y = rowIndex > high.y ? rowIndex : high.y;\n maxCol = Math.max.apply(null, self.selections[rowIndex]);\n minCol = Math.min.apply(null, self.selections[rowIndex]);\n low.x = minCol < low.x ? minCol : low.x;\n high.x = maxCol > high.x ? maxCol : high.x;\n }\n });\n return {\n top: low.y,\n left: low.x,\n bottom: high.y,\n right: high.x\n };\n };\n /**\n * Returns an auto generated schema based on data structure.\n * @memberof canvasDataGrid\n * @name getSchemaFromData\n * @method\n * @tutorial schema\n * @returns {schema} schema A schema based on the first item in the data array.\n */\n self.getSchemaFromData = function () {\n return Object.keys(self.data[0] || {' ': ''}).map(function mapEachSchemaColumn(key, index) {\n var type = self.getBestGuessDataType(key),\n i = {\n name: key,\n title: isNaN(parseInt(key, 10)) ? key : self.integerToAlpha(key).toUpperCase(),\n width: self.style.columnWidth,\n index: index,\n type: type,\n filter: self.filter(type)\n };\n if (key === self.uniqueId) {\n i.hidden = true;\n }\n i[self.uniqueId] = self.getSchemaNameHash(key);\n return i;\n });\n };\n /**\n * Clears the change log grid.changes that keeps track of changes to the data set.\n * This does not undo changes or alter data it is simply a convince array to keep\n * track of changes made to the data since last this method was called.\n * @memberof canvasDataGrid\n * @name clearChangeLog\n * @method\n */\n self.clearChangeLog = function () {\n self.changes = [];\n };\n /**\n * Selects an area of the grid.\n * @memberof canvasDataGrid\n * @name selectArea\n * @method\n * @param {rect} bounds A rect object representing the selected values.\n */\n self.selectArea = function (bounds, ctrl) {\n self.selectionBounds = bounds || self.selectionBounds;\n var x, y, s = self.getSchema();\n if (!ctrl) {\n self.selections = [];\n }\n if (self.selectionBounds.top < -1\n || self.selectionBounds.bottom > self.data.length\n || self.selectionBounds.left < -1\n || self.selectionBounds.right > s.length) {\n throw new Error('Impossible selection area');\n }\n for (x = self.selectionBounds.top; x <= self.selectionBounds.bottom; x += 1) {\n self.selections[x] = [];\n for (y = self.selectionBounds.left; y <= self.selectionBounds.right; y += 1) {\n if (self.selections[x].indexOf(y) === -1) {\n self.selections[x].push(y);\n }\n }\n }\n self.dispatchEvent('selectionchanged', {\n selectedData: self.getSelectedData(),\n selections: self.selections,\n selectionBounds: self.selectionBounds\n });\n };\n /**\n * Returns the maximum text width for a given column by column name.\n * @memberof canvasDataGrid\n * @name findColumnMaxTextLength\n * @method\n * @returns {number} The number of pixels wide the maximum width value in the selected column.\n * @param {string} name The name of the column to calculate the value's width of.\n */\n self.findColumnMaxTextLength = function (name) {\n var m = -Infinity;\n if (name === 'cornerCell') {\n self.ctx.font = self.style.rowHeaderCellFont;\n return self.ctx.measureText((self.data.length + (self.attributes.showNewRow ? 1 : 0)).toString()).width\n + self.style.autosizePadding + self.style.autosizeHeaderCellPadding\n + self.style.rowHeaderCellPaddingRight\n + self.style.rowHeaderCellPaddingLeft\n + (self.attributes.tree ? self.style.treeArrowWidth\n + self.style.treeArrowMarginLeft + self.style.treeArrowMarginRight : 0);\n }\n self.getSchema().forEach(function (col) {\n if (col.name !== name) { return; }\n self.ctx.font = self.style.columnHeaderCellFont;\n var t = self.ctx.measureText(col.title || col.name).width\n + self.style.headerCellPaddingRight\n + self.style.headerCellPaddingLeft;\n m = t > m ? t : m;\n });\n self.data.forEach(function (row) {\n self.ctx.font = self.style.cellFont;\n var t = self.ctx.measureText(row[name]).width\n + self.style.cellPaddingRight\n + self.style.cellPaddingLeft + self.style.cellAutoResizePadding;\n m = t > m ? t : m;\n });\n return m;\n };\n /**\n * Gets the total width of all header columns.\n * @memberof canvasDataGrid\n * @name getHeaderWidth\n * @method\n */\n self.getHeaderWidth = function () {\n return self.getVisibleSchema().reduce(function (total, header) {\n return total + header.width;\n }, 0);\n };\n self.formatters.string = function cellFormatterString(e) {\n return e.cell.value !== undefined ? e.cell.value : '';\n };\n self.formatters.rowHeaderCell = self.formatters.string;\n self.formatters.headerCell = self.formatters.string;\n self.formatters.number = self.formatters.string;\n self.formatters.int = self.formatters.string;\n self.formatters.html = self.formatters.string;\n self.sorters.string = function (columnName, direction) {\n var asc = direction === 'asc';\n return function (a, b) {\n if (a[columnName] === undefined || a[columnName] === null) {\n return 1;\n }\n if (b[columnName] === undefined || b[columnName] === null) {\n return 0;\n }\n if (asc) {\n if (!a[columnName].localeCompare) { return 1; }\n return a[columnName].localeCompare(b[columnName]);\n }\n if (!b[columnName].localeCompare) { return 1; }\n return b[columnName].localeCompare(a[columnName]);\n };\n };\n self.sorters.number = function (columnName, direction) {\n var asc = direction === 'asc';\n return function (a, b) {\n if (asc) {\n return a[columnName] - b[columnName];\n }\n return b[columnName] - a[columnName];\n };\n };\n self.sorters.date = function (columnName, direction) {\n var asc = direction === 'asc';\n return function (a, b) {\n if (asc) {\n return new Date(a[columnName]).getTime()\n - new Date(b[columnName]).getTime();\n }\n return new Date(b[columnName]).getTime()\n - new Date(a[columnName]).getTime();\n };\n };\n };\n}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\n\n/***/ })\n/******/ ]);\n});\n\n\n// WEBPACK FOOTER //\n// canvas-datagrid.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 52b02f53a9172f48f3b3","/*jslint browser: true, unparam: true, todo: true*/\n/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/\ndefine([\n './draw',\n './events',\n './intf',\n './contextMenu',\n './defaults',\n './dom',\n './publicMethods'\n], function context() {\n 'use strict';\n var modules = Array.prototype.slice.call(arguments);\n function grid(args) {\n args = args || {};\n var self = {};\n self.args = args;\n self.createGrid = grid;\n modules.forEach(function (module) {\n module(self);\n });\n self.init();\n return self.intf;\n }\n if (window && !window.canvasDatagrid && !window.require) {\n window.canvasDatagrid = grid;\n }\n module.exports = grid;\n return grid;\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/main.js\n// module id = 0\n// module chunks = 0","/*jslint browser: true, unparam: true, todo: true*/\n/*globals XMLSerializer: false, define: true, Blob: false, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/\ndefine([], function () {\n 'use strict';\n return function (self) {\n var perfCounters = [],\n drawCount = 0,\n perfWindowSize = 20;\n self.htmlImageCache = {};\n function drawOnAllImagesLoaded() {\n var loaded = true;\n Object.keys(self.htmlImageCache).forEach(function (html) {\n if (!self.htmlImageCache[html].complete) {\n loaded = false;\n }\n });\n if (loaded) {\n self.draw();\n }\n }\n function drawHtml(cell) {\n var img,\n v = cell.innerHTML || cell.formattedValue,\n x = cell.x + self.canvasOffsetLeft,\n y = cell.y + self.canvasOffsetTop;\n if (self.htmlImageCache[v]) {\n img = self.htmlImageCache[v];\n if (img.height !== cell.height || img.width !== cell.width) {\n // height and width of the cell has changed, invalidate cache\n self.htmlImageCache[v] = undefined;\n } else {\n if (!img.complete) {\n return;\n }\n return self.ctx.drawImage(img, x, y);\n }\n }\n img = new Image(cell.width, cell.height);\n self.htmlImageCache[v] = img;\n img.onload = function () {\n self.ctx.drawImage(img, x, y);\n drawOnAllImagesLoaded();\n };\n img.src = 'data:image/svg+xml;base64,' + btoa(\n '\\n' +\n '\\n' +\n '\\n' +\n v + '\\n' +\n '' +\n '\\n' +\n '\\n'\n );\n }\n function drawOrderByArrow(x, y) {\n x += self.canvasOffsetLeft;\n y += self.canvasOffsetTop;\n self.ctx.fillStyle = self.style.columnHeaderOrderByArrowColor;\n self.ctx.strokeStyle = self.style.columnHeaderOrderByArrowBorderColor;\n self.ctx.beginPath();\n x = x + self.style.columnHeaderOrderByArrowMarginLeft;\n y = y + self.style.columnHeaderOrderByArrowMarginTop;\n if (self.orderDirection === 'asc') {\n self.ctx.moveTo(x, y);\n self.ctx.lineTo(x + self.style.columnHeaderOrderByArrowWidth, y);\n self.ctx.lineTo(x + (self.style.columnHeaderOrderByArrowWidth * 0.5), y + self.style.columnHeaderOrderByArrowHeight);\n self.ctx.moveTo(x, y);\n } else {\n self.ctx.lineTo(x, y + self.style.columnHeaderOrderByArrowHeight);\n self.ctx.lineTo(x + self.style.columnHeaderOrderByArrowWidth, y + self.style.columnHeaderOrderByArrowHeight);\n self.ctx.lineTo(x + (self.style.columnHeaderOrderByArrowWidth * 0.5), y);\n self.ctx.lineTo(x, y + self.style.columnHeaderOrderByArrowHeight);\n }\n self.ctx.stroke();\n self.ctx.fill();\n return self.style.columnHeaderOrderByArrowMarginLeft\n + self.style.columnHeaderOrderByArrowWidth\n + self.style.columnHeaderOrderByArrowMarginRight;\n }\n function drawTreeArrow(cell, x, y) {\n x += self.canvasOffsetLeft;\n y += self.canvasOffsetTop;\n self.ctx.fillStyle = self.style.treeArrowColor;\n self.ctx.strokeStyle = self.style.treeArrowBorderColor;\n self.ctx.beginPath();\n x = x + self.style.treeArrowMarginLeft;\n y = y + self.style.treeArrowMarginTop;\n if (self.openChildren[cell.data[self.uniqueId]]) {\n self.ctx.moveTo(x, y);\n self.ctx.lineTo(x + self.style.treeArrowWidth, y);\n self.ctx.lineTo(x + (self.style.treeArrowWidth * 0.5), y + self.style.treeArrowHeight);\n self.ctx.moveTo(x, y);\n } else {\n self.ctx.lineTo(x, y);\n self.ctx.lineTo(x + self.style.treeArrowHeight, y + (self.style.treeArrowWidth * 0.5));\n self.ctx.lineTo(x, y + self.style.treeArrowWidth);\n self.ctx.lineTo(x, y);\n }\n self.ctx.stroke();\n self.ctx.fill();\n return self.style.treeArrowMarginLeft\n + self.style.treeArrowWidth\n + self.style.treeArrowMarginRight;\n }\n function radiusRect(x, y, w, h, radius) {\n x += self.canvasOffsetLeft;\n y += self.canvasOffsetTop;\n var r = x + w, b = y + h;\n self.ctx.beginPath();\n self.ctx.moveTo(x + radius, y);\n self.ctx.lineTo(r - radius, y);\n self.ctx.quadraticCurveTo(r, y, r, y + radius);\n self.ctx.lineTo(r, y + h - radius);\n self.ctx.quadraticCurveTo(r, b, r - radius, b);\n self.ctx.lineTo(x + radius, b);\n self.ctx.quadraticCurveTo(x, b, x, b - radius);\n self.ctx.lineTo(x, y + radius);\n self.ctx.quadraticCurveTo(x, y, x + radius, y);\n }\n function fillRect(x, y, w, h) {\n x += self.canvasOffsetLeft;\n y += self.canvasOffsetTop;\n self.ctx.fillRect(x, y, w, h);\n }\n function strokeRect(x, y, w, h) {\n x += self.canvasOffsetLeft;\n y += self.canvasOffsetTop;\n self.ctx.strokeRect(x, y, w, h);\n }\n function fillText(text, x, y) {\n x += self.canvasOffsetLeft;\n y += self.canvasOffsetTop;\n self.ctx.fillText(text, x, y);\n }\n function addBorderLine(c, pos) {\n self.ctx.beginPath();\n var p = {\n t: function () {\n self.ctx.moveTo(c.x + self.canvasOffsetLeft, c.y + self.canvasOffsetTop);\n self.ctx.lineTo(c.x + self.canvasOffsetLeft + c.width, c.y + self.canvasOffsetTop);\n },\n r: function () {\n self.ctx.moveTo(c.x + self.canvasOffsetLeft + c.width, c.y + self.canvasOffsetTop);\n self.ctx.lineTo(c.x + self.canvasOffsetLeft + c.width, c.y + self.canvasOffsetTop + c.height);\n },\n b: function () {\n self.ctx.moveTo(c.x + self.canvasOffsetLeft, c.y + self.canvasOffsetTop + c.height);\n self.ctx.lineTo(c.x + self.canvasOffsetLeft + c.width, c.y + self.canvasOffsetTop + c.height);\n },\n l: function () {\n self.ctx.moveTo(c.x + self.canvasOffsetLeft, c.y + self.canvasOffsetTop);\n self.ctx.lineTo(c.x + self.canvasOffsetLeft, c.y + self.canvasOffsetTop + c.height);\n },\n };\n p[pos]();\n self.ctx.stroke();\n }\n function addEllipsis(text, width) {\n var c, w = 0;\n if (self.ellipsisCache[text] && self.ellipsisCache[text][width]) {\n return self.ellipsisCache[text][width];\n }\n //TODO Add ellipsis back when there is a fast way to do it\n w = self.ctx.measureText(text).width;\n self.ellipsisCache[text] = self.ellipsisCache[text] || {};\n c = {value: text, width: w};\n self.ellipsisCache[text][width] = c;\n return c;\n }\n function drawText(cell) {\n var paddingLeft = self.style[cell.style + 'PaddingLeft'],\n paddingTop = self.style[cell.style + 'PaddingTop'],\n paddingRight = self.style[cell.style + 'PaddingRight'],\n paddingBottom = self.style[cell.style + 'PaddingBottom'],\n vPos = paddingTop + cell.height - (cell.height * 0.5),\n hPos = paddingLeft + cell.treeArrowWidth + cell.orderByArrowWidth;\n cell.text = addEllipsis(cell.formattedValue, cell.width - paddingRight - paddingLeft);\n cell.text.height = cell.fontHeight;\n if (cell.horizontalAlignment === 'right') {\n hPos = cell.width - cell.text.width - paddingRight;\n } else if (cell.horizontalAlignment === 'center') {\n hPos = (cell.width / 2) - (cell.text.width / 2);\n }\n if (cell.verticalAlignment === 'top') {\n vPos = paddingTop + cell.text.height;\n } else if (cell.verticalAlignment === 'bottom') {\n vPos = cell.height - paddingBottom - cell.text.height;\n }\n cell.text.x = cell.x + hPos;\n cell.text.y = cell.y + vPos;\n fillText(cell.text.value, cell.text.x, cell.text.y);\n }\n /**\n * Redraws the grid. No matter what the change, this is the only method required to refresh everything.\n * @memberof canvasDataGrid\n * @name draw\n * @method\n */\n self.draw = function (internal) {\n if (self.dispatchEvent('beforedraw', {})) { return; }\n if (!self.isChildGrid && (!self.height || !self.width)) {\n return;\n }\n if (self.isChildGrid && internal) {\n requestAnimationFrame(self.parentGrid.draw);\n return;\n }\n if (self.intf.visible === false) {\n return;\n }\n // initial values\n var checkScrollHeight, rowHeaderCell, p, cx, cy, treeGrid, rowOpen,\n rowHeight, cornerCell, y, x, c, h, w, s, r, rd, aCell,\n selectionBorders = [],\n rowHeaders = [],\n l = self.data.length,\n u = self.currentCell || {},\n rowHeaderCellHeight = self.getRowHeaderCellHeight(),\n columnHeaderCellWidth = self.getColumnHeaderCellWidth(),\n cellHeight = self.style.cellHeight;\n drawCount += 1;\n p = performance.now();\n // if data length has changed, there is no way to know\n if (self.data.length > self.orders.rows.length) {\n self.createRowOrders();\n }\n function drawScrollBars() {\n var v = {\n x: 0,\n y: 0,\n height: 0,\n width: 0,\n style: 'vertical-scroll-bar'\n },\n n = {\n x: 0,\n y: 0,\n height: 0,\n width: 0,\n style: 'horizontal-scroll-bar'\n },\n vb = {\n x: 0,\n y: 0,\n height: 0,\n width: 0,\n style: 'vertical-scroll-box'\n },\n nb = {\n x: 0,\n y: 0,\n height: 0,\n width: 0,\n style: 'horizontal-scroll-box'\n },\n co = {\n x: 0,\n y: 0,\n height: 0,\n width: 0,\n isCorner: true,\n isScrollBoxCorner: true,\n style: 'scroll-box-corner'\n },\n m = (self.style.scrollBarBoxMargin * 2),\n d = self.style.scrollBarBoxMargin * 0.5;\n self.ctx.strokeStyle = self.style.scrollBarBorderColor;\n self.ctx.lineWidth = self.style.scrollBarBorderWidth;\n // vertical\n v.x += w - self.style.scrollBarWidth - self.style.scrollBarBorderWidth - d;\n v.y += rowHeaderCellHeight;\n v.width = self.style.scrollBarWidth + self.style.scrollBarBorderWidth + d;\n v.height = h - rowHeaderCellHeight - self.style.scrollBarWidth - d - m;\n self.ctx.fillStyle = self.style.scrollBarBackgroundColor;\n fillRect(v.x, v.y, v.width, v.height + m);\n strokeRect(v.x, v.y, v.width, v.height + m);\n // vertical box\n vb.x = v.x + self.style.scrollBarBoxMargin;\n vb.y = rowHeaderCellHeight + self.style.scrollBarBoxMargin\n + ((v.height - self.scrollBox.scrollBoxHeight)\n * (self.scrollBox.scrollTop / self.scrollBox.scrollHeight));\n vb.width = self.style.scrollBarBoxWidth;\n vb.height = self.scrollBox.scrollBoxHeight;\n self.ctx.fillStyle = self.style.scrollBarBoxColor;\n if (/vertical/.test(u.context)) {\n self.ctx.fillStyle = self.style.scrollBarActiveColor;\n }\n if (vb.height < v.height) {\n radiusRect(vb.x, vb.y, vb.width, vb.height, self.style.scrollBarBoxBorderRadius);\n self.ctx.stroke();\n self.ctx.fill();\n }\n // horizontal\n n.x += columnHeaderCellWidth;\n n.y += h - self.style.scrollBarWidth - d;\n n.width = w - self.style.scrollBarWidth - columnHeaderCellWidth - d - m;\n n.height = self.style.scrollBarWidth + self.style.scrollBarBorderWidth + d;\n self.ctx.fillStyle = self.style.scrollBarBackgroundColor;\n fillRect(n.x, n.y, n.width + m, n.height);\n strokeRect(n.x, n.y, n.width + m, n.height);\n // horizontal box\n nb.y = n.y + self.style.scrollBarBoxMargin;\n nb.x = columnHeaderCellWidth + self.style.scrollBarBoxMargin\n + ((n.width - self.scrollBox.scrollBoxWidth)\n * (self.scrollBox.scrollLeft / self.scrollBox.scrollWidth));\n nb.width = self.scrollBox.scrollBoxWidth;\n nb.height = self.style.scrollBarBoxWidth;\n self.ctx.fillStyle = self.style.scrollBarBoxColor;\n if (/horizontal/.test(u.context)) {\n self.ctx.fillStyle = self.style.scrollBarActiveColor;\n }\n if (nb.width < n.width) {\n radiusRect(nb.x, nb.y, nb.width, nb.height, self.style.scrollBarBoxBorderRadius);\n self.ctx.stroke();\n self.ctx.fill();\n }\n //corner\n self.ctx.strokeStyle = self.style.scrollBarCornerBorderColor;\n self.ctx.fillStyle = self.style.scrollBarCornerBackgroundColor;\n co.x = n.x + n.width + m;\n co.y = v.y + v.height + m;\n co.width = self.style.scrollBarWidth + self.style.scrollBarBorderWidth;\n co.height = self.style.scrollBarWidth + self.style.scrollBarBorderWidth;\n radiusRect(co.x, co.y, co.width, co.height, 0);\n self.ctx.stroke();\n self.ctx.fill();\n self.visibleCells.unshift(v);\n self.visibleCells.unshift(vb);\n self.visibleCells.unshift(n);\n self.visibleCells.unshift(nb);\n self.visibleCells.unshift(co);\n self.scrollBox.bar = {\n v: v,\n h: n\n };\n self.scrollBox.box = {\n v: vb,\n h: nb\n };\n }\n function drawCell(d, rowIndex, rowOrderIndex) {\n return function drawEach(header, headerIndex, columnOrderIndex) {\n var cellStyle = header.style || 'cell',\n childGridAttributes,\n cell,\n isHeader = /HeaderCell/.test(cellStyle),\n isCorner = /cornerCell/.test(cellStyle),\n isRowHeader = 'rowHeaderCell' === cellStyle,\n isColumnHeader = 'columnHeaderCell' === cellStyle,\n selected = self.selections[rowOrderIndex] && self.selections[rowOrderIndex].indexOf(columnOrderIndex) !== -1,\n hovered = self.hovers[d[self.uniqueId]] && self.hovers[d[self.uniqueId]].indexOf(columnOrderIndex) !== -1,\n active = self.activeCell.rowIndex === rowOrderIndex && self.activeCell.columnIndex === columnOrderIndex,\n isGrid = typeof d[header.name] === 'object' && d[header.name] !== null && d[header.name] !== undefined,\n activeHeader = (self.orders.rows[self.activeCell.rowIndex] === rowOrderIndex\n || self.orders.columns[self.activeCell.columnIndex] === columnOrderIndex)\n && (columnOrderIndex === -1 || rowOrderIndex === -1)\n ? (isRowHeader ? 'activeRowHeaderCell' : 'activeColumnHeaderCell') : false,\n val,\n f = self.formatters[header.type || 'string'],\n orderByArrowSize = 0,\n treeArrowSize = 0,\n cellWidth = self.sizes.columns[isRowHeader ? 'cornerCell' : header[self.uniqueId]] || header.width,\n ev = {\n value: d[header.name],\n row: d,\n header: header\n };\n if (cellStyle === 'headerCellCap') {\n cellWidth = w - x;\n }\n // if no data or schema are defined, a width is provided to the stub column\n if (cellWidth === undefined) {\n cellWidth = self.style.columnWidth;\n }\n if (x + cellWidth + self.style.cellBorderWidth < 0) {\n x += cellWidth + self.style.cellBorderWidth;\n }\n if (active) {\n cellStyle = 'activeCell';\n }\n if (self.visibleRows.indexOf(rowIndex) === -1 && !isHeader) {\n self.visibleRows.push(rowIndex);\n }\n val = self.dispatchEvent('formatcellvalue', ev);\n if (!self.dispatchEvent('beforerendercell', ev)) {\n cx = x;\n cy = y;\n if (cellStyle === 'cornerCell') {\n cx = 0;\n cy = 0;\n } else if (isRowHeader) {\n cx = 0;\n } else if (isHeader) {\n cy = 0;\n }\n cell = {\n type: isGrid ? 'canvas-datagrid-cell' : header.type,\n style: cellStyle,\n nodeType: 'canvas-datagrid-cell',\n x: cx,\n y: cy,\n horizontalAlignment: self.style[cellStyle + 'HorizontalAlignment'],\n verticalAlignment: self.style[cellStyle + 'VerticalAlignment'],\n offsetTop: self.canvasOffsetTop + cy,\n offsetLeft: self.canvasOffsetLeft + cx,\n scrollTop: self.scrollBox.scrollTop,\n scrollLeft: self.scrollBox.scrollLeft,\n active: active || activeHeader,\n hovered: hovered,\n selected: selected,\n width: cellWidth,\n height: cellHeight,\n offsetWidth: cellWidth,\n offsetHeight: cellHeight,\n parentNode: self.intf.parentNode,\n offsetParent: self.intf.parentNode,\n data: d,\n isCorner: isCorner,\n isHeader: isHeader,\n isColumnHeader: isColumnHeader,\n isHeaderCellCap: !!header.isHeaderCellCap,\n isRowHeader: isRowHeader,\n rowOpen: rowOpen,\n header: header,\n columnIndex: columnOrderIndex,\n rowIndex: rowOrderIndex,\n sortColumnIndex: headerIndex,\n sortRowIndex: rowIndex,\n isGrid: isGrid,\n gridId: (self.attributes.name || '') + d[self.uniqueId] + ':' + header[self.uniqueId],\n parentGrid: self.intf,\n innerHTML: '',\n activeHeader: activeHeader,\n value: isHeader && !isRowHeader ? (header.title || header.name) : d[header.name]\n };\n ev.cell = cell;\n cell.userHeight = cell.isHeader ? self.sizes.rows[-1] : rowHeight;\n cell.userWidth = cell.isHeader ? self.sizes.columns.cornerCell : self.sizes.columns[header[self.uniqueId]];\n cell[self.uniqueId] = d[self.uniqueId];\n self.visibleCells.unshift(cell);\n self.ctx.fillStyle = self.style[cellStyle + 'BackgroundColor'];\n self.ctx.strokeStyle = self.style[cellStyle + 'BorderColor'];\n self.ctx.lineWidth = self.style[cellStyle + 'BorderWidth'];\n if (hovered) {\n self.ctx.fillStyle = self.style[cellStyle + 'HoverBackgroundColor'];\n self.ctx.strokeStyle = self.style[cellStyle + 'HoverBorderColor'];\n }\n if (selected) {\n self.ctx.fillStyle = self.style[cellStyle + 'SelectedBackgroundColor'];\n self.ctx.strokeStyle = self.style[cellStyle + 'SelectedBorderColor'];\n }\n if (activeHeader) {\n self.ctx.fillStyle = self.style[activeHeader + 'BackgroundColor'];\n }\n self.dispatchEvent('rendercell', ev);\n if (cell.isGrid) {\n if (cell.height !== rowHeight) {\n cell.height = rowHeight || self.style.cellHeightWithChildGrid;\n checkScrollHeight = true;\n }\n cell.width = self.sizes.columns[header[self.uniqueId]] || self.style.cellWidthWithChildGrid;\n }\n if (rowOpen && !cell.isRowHeader) {\n cell.height = self.sizes.rows[rd[self.uniqueId]] || self.style.cellHeight;\n }\n if (!cell.isGrid) {\n fillRect(cx, cy, cell.width, cell.height);\n strokeRect(cx, cy, cell.width, cell.height);\n }\n self.ctx.save();\n radiusRect(cell.x, cell.y, cell.width, cell.height, 0);\n self.ctx.clip();\n self.dispatchEvent('afterrendercell', ev);\n if (cell.height !== cellHeight && !(rowOpen && !cell.isRowHeader)) {\n self.sizes.rows[isHeader ? -1 : d[self.uniqueId]] = cell.height;\n checkScrollHeight = true;\n }\n if (cell.width !== cellWidth) {\n self.sizes.columns[header[self.uniqueId]] = cell.width;\n checkScrollHeight = true;\n }\n if (isRowHeader && self.attributes.tree) {\n if (!self.dispatchEvent('rendertreearrow', ev)) {\n treeArrowSize = drawTreeArrow(cell, self.style[cellStyle + 'PaddingLeft'], cy, 0);\n }\n }\n if ((self.attributes.showRowNumbers && isRowHeader)\n || !isRowHeader) {\n if (cell.isGrid) {\n if (!self.childGrids[cell.gridId]) {\n childGridAttributes = self.args.childGridAttributes || self.args;\n childGridAttributes.name = self.attributes.saveAppearance ? cell.gridId : undefined;\n childGridAttributes.parentNode = cell;\n childGridAttributes.data = d[header.name];\n self.childGrids[cell.gridId] = self.createGrid(childGridAttributes);\n self.sizes.rows[rd[self.uniqueId]]\n = self.sizes.rows[rd[self.uniqueId]] || self.style.cellGridHeight;\n checkScrollHeight = true;\n }\n cell.grid = self.childGrids[cell.gridId];\n cell.grid.parentNode = cell;\n cell.grid.visible = true;\n cell.grid.draw();\n self.dispatchEvent('rendercellgrid', ev);\n } else {\n if (self.childGrids[cell.gridId]) {\n self.childGrids[cell.gridId].parentNode.offsetHeight = 0;\n }\n if (isHeader && self.orderBy === header.name) {\n if (!self.dispatchEvent('renderorderbyarrow', ev)) {\n orderByArrowSize = drawOrderByArrow(cx + self.style[cellStyle + 'PaddingLeft'], 0);\n }\n }\n self.ctx.fillStyle = self.style[cellStyle + 'Color'];\n if (hovered) {\n self.ctx.fillStyle = self.style[cellStyle + 'HoverColor'];\n }\n if (selected) {\n self.ctx.fillStyle = self.style[cellStyle + 'SelectedColor'];\n }\n if (activeHeader) {\n self.ctx.fillStyle = self.style[activeHeader + 'Color'];\n }\n self.ctx.font = self.style[cellStyle + 'Font'];\n cell.fontHeight = self.style[cellStyle + 'FontHeight'];\n cell.treeArrowWidth = treeArrowSize;\n cell.orderByArrowWidth = orderByArrowSize;\n val = val !== undefined ? val : f\n ? f(ev) : '';\n if (val === undefined && !f) {\n val = '';\n console.warn('canvas-datagrid: Unknown format '\n + header.type + ' add a cellFormater');\n }\n cell.formattedValue = ((val !== undefined && val !== null) ? val : '').toString();\n if (self.columnFilters && self.columnFilters[val] !== undefined && isHeader) {\n cell.formattedValue = self.attributes.filterTextPrefix + val;\n }\n if (!self.dispatchEvent('rendertext', ev)) {\n if (cell.innerHTML || header.type === 'html') {\n drawHtml(cell);\n } else {\n drawText(cell);\n }\n }\n }\n }\n if (active) {\n aCell = cell;\n }\n if (selected && !isRowHeader) {\n if ((!self.selections[cell.rowIndex - 1]\n || self.selections[cell.rowIndex - 1].indexOf(cell.columnIndex) === -1\n || cell.rowIndex === 0)\n && !cell.isHeader) {\n selectionBorders.push([cell, 't']);\n }\n if (!self.selections[cell.rowIndex + 1]\n || self.selections[cell.rowIndex + 1].indexOf(cell.columnIndex) === -1) {\n selectionBorders.push([cell, 'b']);\n }\n if (!self.selections[cell.rowIndex] || cell.columnIndex === 0\n || self.selections[cell.rowIndex].indexOf(cell.columnIndex - 1) === -1) {\n selectionBorders.push([cell, 'l']);\n }\n if (!self.selections[cell.rowIndex] || cell.columnIndex === s.length\n || self.selections[cell.rowIndex].indexOf(cell.columnIndex + 1) === -1) {\n selectionBorders.push([cell, 'r']);\n }\n }\n self.ctx.restore();\n x += cell.width + self.style.cellBorderWidth;\n return cell.width;\n }\n };\n }\n function drawRowHeader(rowData, index, rowOrderIndex) {\n var a;\n if (self.attributes.showRowHeaders) {\n x = 0;\n rowHeaderCell = {'rowHeaderCell': index + 1 };\n rowHeaderCell[self.uniqueId] = rowData[self.uniqueId];\n a = {\n name: 'rowHeaderCell',\n width: self.style.rowHeaderCellWidth,\n style: 'rowHeaderCell',\n type: 'string',\n data: rowData[self.uniqueId],\n index: -1\n };\n a[self.uniqueId] = rowData[self.uniqueId];\n rowOpen = self.openChildren[rowData[self.uniqueId]];\n drawCell(rowHeaderCell, index, rowOrderIndex)(a, -1, -1);\n }\n }\n function drawHeaders() {\n var d, g = s.length, i, o, columnHeaderCell, header;\n rowHeaders.forEach(function (rArgs) {\n y = rArgs[3];\n cellHeight = rArgs[4];\n drawRowHeader(rArgs[0], rArgs[1], rArgs[2]);\n });\n if (self.attributes.showColumnHeaders) {\n x = (self.scrollBox.scrollLeft * -1) + self.scrollPixelLeft;\n if (self.attributes.showRowHeaders) {\n x += columnHeaderCellWidth;\n }\n y = 0;\n // cell height might have changed during drawing\n cellHeight = self.getRowHeaderCellHeight();\n for (o = self.scrollIndexLeft; o < g; o += 1) {\n i = self.orders.columns[o];\n header = s[i];\n d = {\n title: header.title,\n name: header.name,\n width: header.width,\n style: 'columnHeaderCell',\n type: 'string',\n index: o,\n order: i\n };\n columnHeaderCell = {'columnHeaderCell': header.title || header.name};\n columnHeaderCell[self.uniqueId] = 'h' + header[self.uniqueId];\n d[self.uniqueId] = header[self.uniqueId];\n x += drawCell(columnHeaderCell, -1, -1)(d, o, i);\n if (x > self.width + self.scrollBox.scrollLeft) {\n break;\n }\n }\n // fill in the space right of the headers\n if (x < w) {\n c = {\n name: '',\n width: self.style.scrollBarWidth,\n style: 'headerCellCap',\n isHeaderCell: true,\n isHeaderCellCap: true,\n type: 'string',\n index: s.length\n };\n c[self.uniqueId] = 'columnHeaderCell';\n drawCell({endCap: ''}, -1, -1)(c, -1, -1);\n }\n // fill in the space right of the headers\n if (self.attributes.showRowHeaders) {\n cornerCell = {'cornerCell': '' };\n cornerCell[self.uniqueId] = 'cornerCell';\n x = 0;\n c = {\n name: 'cornerCell',\n width: self.style.rowHeaderCellWidth,\n style: 'cornerCell',\n type: 'string',\n index: -1\n };\n c[self.uniqueId] = 'cornerCell';\n drawCell(cornerCell, -1, -1)(c, -1, -1);\n }\n }\n }\n function drawRow(r, d) {\n var i, treeHeight, rowSansTreeHeight, o, g = s.length;\n if (y - (cellHeight * 2) > h) {\n return false;\n }\n rd = self.data[r];\n rowOpen = self.openChildren[rd[self.uniqueId]];\n rowSansTreeHeight = self.sizes.rows[rd[self.uniqueId]] || self.style.cellHeight;\n treeHeight = (rowOpen ? self.sizes.trees[rd[self.uniqueId]] : 0);\n rowHeight = rowSansTreeHeight + treeHeight;\n if (y < rowHeight * -1) {\n return false;\n }\n if (self.attributes.showRowHeaders) {\n x += columnHeaderCellWidth;\n }\n cellHeight = rowHeight;\n for (o = self.scrollIndexLeft; o < g; o += 1) {\n i = self.orders.columns[o];\n x += drawCell(rd, r, d)(s[i], i, o);\n if (x > self.width) {\n break;\n }\n }\n // cell height might have changed during drawing\n cellHeight = rowHeight;\n x = (self.scrollBox.scrollLeft * -1) + self.scrollPixelLeft + self.style.cellBorderWidth;\n // don't draw a tree for the new row\n treeGrid = self.childGrids[rd[self.uniqueId]];\n if (r !== self.data.length && rowOpen) {\n treeGrid.visible = true;\n treeGrid.parentNode = {\n offsetTop: y + rowSansTreeHeight + self.canvasOffsetTop,\n offsetLeft: columnHeaderCellWidth - 1 + self.canvasOffsetLeft,\n offsetHeight: treeHeight,\n offsetWidth: self.width - columnHeaderCellWidth - self.style.scrollBarWidth - 1,\n offsetParent: self.intf.parentNode,\n parentNode: self.intf.parentNode,\n style: self.style,\n nodeType: 'canvas-datagrid-tree',\n scrollTop: self.scrollBox.scrollTop,\n scrollLeft: self.scrollBox.scrollLeft,\n rowIndex: r\n };\n self.visibleCells.unshift({\n rowIndex: x,\n columnIndex: 0,\n y: treeGrid.parentNode.offsetTop,\n x: treeGrid.parentNode.offsetLeft,\n height: treeGrid.parentNode.offsetHeight,\n width: treeGrid.parentNode.offsetWidth,\n style: 'tree-grid',\n type: treeGrid.parentNode.nodeType\n });\n treeGrid.draw();\n } else if (treeGrid) {\n treeGrid.parentNode.offsetHeight = 0;\n delete self.sizes.trees[rd[self.uniqueId]];\n }\n rowHeaders.push([rd, r, d, y, rowHeight]);\n y += cellHeight + self.style.cellBorderWidth;\n return true;\n }\n function initDraw() {\n self.visibleRows = [];\n s = self.getVisibleSchema();\n self.visibleCells = [];\n self.canvasOffsetTop = self.isChildGrid ? self.parentNode.offsetTop : 0;\n self.canvasOffsetLeft = self.isChildGrid ? self.parentNode.offsetLeft : 0;\n h = self.height;\n w = self.width;\n if (!self.isChildGrid) {\n self.ctx.scale(window.devicePixelRatio, window.devicePixelRatio);\n }\n }\n function drawBackground() {\n radiusRect(0, 0, w, h, 0);\n self.ctx.clip();\n self.ctx.fillStyle = self.style.backgroundColor;\n fillRect(0, 0, w, h);\n }\n function drawRows() {\n var o, n, i, g = s.length;\n x = (self.scrollBox.scrollLeft * -1) + self.scrollPixelLeft + self.style.cellBorderWidth;\n y = (self.scrollBox.scrollTop * -1) + rowHeaderCellHeight + self.scrollPixelTop + self.style.cellBorderWidth;\n for (r = self.scrollIndexTop; r < l; r += 1) {\n n = self.orders.rows[r];\n if (!drawRow(n, r)) {\n break;\n }\n }\n if (self.attributes.showNewRow) {\n if (self.attributes.showRowHeaders) {\n x += columnHeaderCellWidth;\n }\n rowHeight = cellHeight = self.style.cellHeight;\n rowOpen = false;\n for (o = self.scrollIndexLeft; o < g; o += 1) {\n i = self.orders.columns[o];\n x += drawCell(self.newRow, self.data.length, self.data.length)(s[i], i, o);\n if (x > self.width + self.scrollBox.scrollLeft) {\n break;\n }\n }\n rowHeaders.push([self.newRow, self.data.length, self.data.length, y, rowHeight]);\n }\n }\n function drawReorderMarkers() {\n if (!self.reorderObject) { return; }\n var b = {\n height: self.reorderObject.height,\n width: self.reorderObject.width,\n x: self.reorderObject.x + self.reorderObject.dragOffset.x,\n y: self.reorderObject.y + self.reorderObject.dragOffset.y\n },\n m = {\n width: w,\n heigth: h,\n x: 0,\n y: 0\n };\n self.ctx.fillStyle = self.style.reorderMarkerBackgroundColor;\n self.ctx.lineWidth = self.style.reorderMarkerBorderWidth;\n self.ctx.strokeStyle = self.style.reorderMarkerBorderColor;\n if (self.dragMode === 'row-reorder') {\n b.width = w;\n b.x = 0;\n m.width = w;\n m.y = self.currentCell.y;\n fillRect(b.x, b.y, b.width, b.height);\n strokeRect(b.x, b.y, b.width, b.height);\n self.ctx.lineWidth = self.style.reorderMarkerIndexBorderWidth;\n self.ctx.strokeStyle = self.style.reorderMarkerIndexBorderColor;\n if (self.currentCell.rowIndex !== self.reorderObject.rowIndex\n && self.currentCell.rowIndex - 1 !== self.reorderObject.rowIndex) {\n addBorderLine(m, 't');\n }\n } else if (self.dragMode === 'column-reorder' && self.reorderObject) {\n b.height = h;\n b.y = 0;\n m.height = h;\n m.x = self.currentCell.x;\n fillRect(b.x, b.y, b.width, b.height);\n strokeRect(b.x, b.y, b.width, b.height);\n self.ctx.lineWidth = self.style.reorderMarkerIndexBorderWidth;\n self.ctx.strokeStyle = self.style.reorderMarkerIndexBorderColor;\n if (self.currentCell.columnIndex !== self.reorderObject.columnIndex\n && self.currentCell.columnIndex - 1 !== self.reorderObject.columnIndex) {\n addBorderLine(m, 'l');\n }\n }\n }\n function drawBorder() {\n self.ctx.lineWidth = self.style.gridBorderWidth;\n self.ctx.strokeStyle = self.style.gridBorderColor;\n strokeRect(0, 0, self.width, self.height);\n }\n function drawSelectionBorders() {\n self.ctx.lineWidth = self.style.selectionOverlayBorderWidth;\n self.ctx.strokeStyle = self.style.selectionOverlayBorderColor;\n selectionBorders.forEach(function (c) {\n addBorderLine(c[0], c[1]);\n });\n }\n function drawActiveCell() {\n if (!aCell) { return; }\n if (self.attributes.rowSelectionMode) {\n if (self.activeCell && self.activeCell.rowIndex === aCell.rowIndex) {\n self.ctx.lineWidth = self.style.activeCellOverlayBorderWidth;\n self.ctx.strokeStyle = self.style.activeCellOverlayBorderColor;\n strokeRect(0, aCell.y, self.getHeaderWidth() + columnHeaderCellWidth, rowHeight);\n }\n } else {\n self.ctx.lineWidth = self.style.activeCellOverlayBorderWidth;\n self.ctx.strokeStyle = self.style.activeCellOverlayBorderColor;\n strokeRect(aCell.x, aCell.y, aCell.width, aCell.height);\n }\n\n }\n function drawDebug() {\n perfCounters[drawCount % perfWindowSize] = performance.now() - p;\n var d;\n if (self.attributes.debug) {\n self.ctx.font = '11px sans-serif';\n d = {};\n d.perf = (perfCounters.reduce(function (a, b) {\n return a + b;\n }, 0) / perfCounters.length).toFixed(1)\n + 'ms (' +\n perfCounters.map(function (a) { return a.toFixed(1); }).join(', ') + ')';\n d.htmlImages = Object.keys(self.htmlImageCache).length;\n d.scrollLeft = self.scrollBox.scrollLeft;\n d.scrollTop = self.scrollBox.scrollTop;\n d.scrollIndexTop = self.scrollIndexTop;\n d.scrollPixelTop = self.scrollPixelTop;\n d.scrollIndexLeft = self.scrollIndexLeft;\n d.scrollPixelLeft = self.scrollPixelLeft;\n d.canvasOffsetLeft = self.canvasOffsetLeft;\n d.canvasOffsetTop = self.canvasOffsetTop;\n d.width = self.width;\n d.height = self.height;\n d.mousex = self.mouse.x;\n d.mousey = self.mouse.y;\n d.touchx = !self.touchStart ? 0 : self.touchStart.x;\n d.touchy = !self.touchStart ? 0 : self.touchStart.y;\n d.entities = self.visibleCells.length;\n d.hasFocus = self.hasFocus;\n d.dragMode = self.dragMode;\n if (self.currentCell) {\n d.columnIndex = self.currentCell.columnIndex;\n d.rowIndex = self.currentCell.rowIndex;\n d.sortColumnIndex = self.currentCell.sortColumnIndex;\n d.sortRowIndex = self.currentCell.sortRowIndex;\n d.context = self.currentCell.context;\n d.dragContext = self.currentCell.dragContext;\n d.style = self.currentCell.style;\n d.type = self.currentCell.type;\n }\n self.ctx.save();\n Object.keys(d).forEach(function (key, index) {\n var m = key + ': ' + d[key],\n lh = 14;\n self.ctx.fillStyle = 'rgba(255, 255, 255, 0.8)';\n fillRect(columnHeaderCellWidth, lh + (index * lh), 100, lh);\n self.ctx.fillStyle = 'rgba(0, 0, 0, 1)';\n fillText(m, columnHeaderCellWidth + 1, rowHeaderCellHeight + (index * lh));\n });\n self.ctx.restore();\n }\n }\n self.ctx.save();\n initDraw();\n drawBackground();\n drawRows();\n drawSelectionBorders();\n drawActiveCell();\n drawHeaders();\n drawReorderMarkers();\n drawScrollBars();\n if (checkScrollHeight) {\n self.resize(true);\n }\n drawBorder();\n drawDebug();\n if (self.dispatchEvent('afterdraw', {})) { return; }\n self.ctx.restore();\n };\n };\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/draw.js\n// module id = 1\n// module chunks = 0","/*jslint browser: true, unparam: true, todo: true*/\n/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/\ndefine([], function () {\n 'use strict';\n return function (self) {\n var touchDelta = {x: 0, y: 0, scrollTop: 0, scrollLeft: 0},\n touchAnimateTo = {scrollLeft: 0, scrollTop: 0},\n touchSigma = {scrollLeft: 0, scrollTop: 0},\n xPPS = 0,\n yPPS = 0,\n touchingCell = false,\n startingCell = false,\n animationFrames = 0;\n self.getTouchPos = function (e) {\n var rect = self.canvas.getBoundingClientRect(),\n pos = {\n x: e.touches[0].clientX - rect.left,\n y: e.touches[0].clientY - rect.top\n };\n if (self.isChildGrid) {\n pos.x -= self.canvasOffsetLeft;\n pos.y -= self.canvasOffsetTop;\n }\n return {\n x: pos.x,\n y: pos.y,\n rect: rect\n };\n };\n self.calculatePPS = function () {\n xPPS = ((touchDelta.scrollLeft - touchSigma.scrollLeft) / (touchDelta.t - touchSigma.t));\n yPPS = ((touchDelta.scrollTop - touchSigma.scrollTop) / (touchDelta.t - touchSigma.t));\n touchSigma = {\n scrollLeft: touchDelta.scrollLeft,\n scrollTop: touchDelta.scrollTop,\n t: performance.now() / 1000\n };\n };\n self.touchCell = function (e) {\n return function () {\n clearInterval(self.touchCalcTimeout);\n var pos = self.getTouchPos(e);\n if (Math.abs(touchDelta.x) + Math.abs(touchDelta.y) < self.attributes.touchDeadZone) {\n touchingCell = self.getCellAt(pos.x, pos.y);\n self.mousemove(e, pos);\n self.mousedown(e, pos);\n self.mousemove(e, pos);\n self.draw();\n }\n };\n };\n self.touchstart = function (e) {\n touchingCell = false;\n self.touchStart = self.getTouchPos(e);\n startingCell = self.getCellAt(self.touchStart.x, self.touchStart.y, true);\n if (self.dispatchEvent('touchstart', {NativeEvent: e, cell: self.startingCell})) { return; }\n if (!self.hasFocus) { return; }\n self.stopPropagation(e);\n e.preventDefault();\n if (e.touches.length === 2) {\n return self.contextmenu(e, self.touchStart);\n }\n self.touchScrollStart = {\n scrollLeft: self.scrollBox.scrollLeft,\n scrollTop: self.scrollBox.scrollTop,\n t: performance.now() / 1000\n };\n touchDelta = {\n x: self.touchStart.x,\n y: self.touchStart.y,\n scrollLeft: self.scrollBox.scrollLeft,\n scrollTop: self.scrollBox.scrollTop,\n t: 0\n };\n self.touchmove(e);\n clearTimeout(self.touchTimeout);\n clearInterval(self.touchCalcTimeout);\n self.touchTimeout = setTimeout(self.touchCell(e), self.attributes.touchSelectTimeMs);\n self.touchCalcTimeout = setInterval(self.calculatePPS, 20);\n self.touchHaltAnimation = true;\n document.body.addEventListener('touchmove', self.touchmove, {passive: false});\n document.body.addEventListener('touchend', self.touchend, false);\n document.body.addEventListener('touchcancel', self.touchcancel, false);\n };\n self.easing = function (t, b, c, d) {\n return c * (t / d) * (2 - t) + b;\n };\n self.touchEndAnimation = function () {\n if (!self.canvas || !self.scrollBox.scrollTo) { return requestAnimationFrame(self.touchEndAnimation); }\n var x,\n y,\n n = performance.now() / 1000,\n d = (self.attributes.touchReleaseAnimationDurationMs / 1000),\n t;\n touchDelta.t = touchDelta.t || n + d;\n t = n - touchDelta.t + 1;\n if (t > 1 || self.touchHaltAnimation || (animationFrames > 1000)) {\n animationFrames = 0;\n self.touchHaltAnimation = false;\n touchAnimateTo = {scrollLeft: -1, scrollTop: -1};\n return;\n }\n animationFrames += 1;\n x = self.easing(t, touchDelta.scrollLeft, -touchAnimateTo.scrollLeft, d);\n y = self.easing(t, touchDelta.scrollTop, -touchAnimateTo.scrollTop, d);\n self.scrollBox.scrollTo(x, y);\n requestAnimationFrame(self.touchEndAnimation);\n };\n self.touchend = function (e) {\n if (self.dispatchEvent('touchend', {NativeEvent: e})) { return; }\n var dz = Math.abs(touchDelta.x) + Math.abs(touchDelta.y) < self.attributes.touchDeadZone,\n pos = {\n x: self.touchStart.x + touchDelta.x,\n y: self.touchStart.y + touchDelta.y\n },\n cell = self.getCellAt(pos.x, pos.y);\n if (!self.hasFocus) { return; }\n if (touchingCell) {\n self.mouseup(e, self.touchStart);\n } else if (dz) {\n if (cell.active) {\n self.beginEditAt(cell.columnIndex, cell.rowIndex);\n } else {\n self.mousedown(e, self.touchStart);\n self.mouseup(e, self.touchStart);\n self.click(e, self.touchStart);\n }\n }\n touchingCell = false;\n document.body.removeEventListener('touchmove', self.touchmove, {passive: false});\n document.body.removeEventListener('touchend', self.touchend, false);\n document.body.removeEventListener('touchcancel', self.touchcancel, false);\n clearTimeout(self.touchTimeout);\n clearInterval(self.touchCalcTimeout);\n self.calculatePPS();\n touchAnimateTo.scrollLeft = xPPS * self.attributes.touchReleaseAcceleration;\n touchAnimateTo.scrollTop = yPPS * self.attributes.touchReleaseAcceleration;\n self.touchHaltAnimation = false;\n if (animationFrames === 0 && !/-scroll-/.test(startingCell.style) && !dz) {\n self.touchEndAnimation();\n }\n };\n self.touchmove = function (e) {\n var d = self.getTouchPos(e);\n if (self.dispatchEvent('touchmove', {NativeEvent: e, cell: self.currentCell})) { return; }\n self.stopPropagation(e);\n e.preventDefault();\n if (!self.hasFocus) { return; }\n touchDelta = {\n x: d.x - self.touchStart.x,\n y: d.y - self.touchStart.y,\n scrollLeft: self.scrollBox.scrollLeft,\n scrollTop: self.scrollBox.scrollTop,\n t: 0\n };\n if (/vertical-scroll-/.test(startingCell.style)) {\n self.scrollBox.scrollTop = self.scrollBox.scrollHeight * (d.y / self.height);\n } else if (/horizontal-scroll-/.test(startingCell.style)) {\n self.scrollBox.scrollLeft = self.scrollBox.scrollWidth * (d.x / self.width);\n } else if (touchingCell) {\n self.mousemove(e, d);\n self.draw();\n } else {\n if (animationFrames === 0) {\n self.scrollBox.scrollTo(self.touchScrollStart.scrollLeft - touchDelta.x,\n self.touchScrollStart.scrollTop - touchDelta.y);\n }\n }\n };\n self.touchcancel = function (e) {\n if (self.dispatchEvent('touchcancel', {NativeEvent: e, cell: self.currentCell})) { return; }\n if (!self.hasFocus) { return; }\n self.touchend(e);\n touchingCell = false;\n document.body.removeEventListener('touchmove', self.touchmove, {passive: false});\n document.body.removeEventListener('touchend', self.touchend, false);\n document.body.removeEventListener('touchcancel', self.touchcancel, false);\n return;\n };\n self.stopPropagation = function (e) { e.stopPropagation(); };\n self.addEventListener = function (ev, fn) {\n self.events[ev] = self.events[ev] || [];\n self.events[ev].unshift(fn);\n };\n self.removeEventListener = function (ev, fn) {\n (self.events[ev] || []).forEach(function removeEachListener(sfn, idx) {\n if (fn === sfn) {\n self.events[ev].splice(idx, 1);\n }\n });\n };\n self.dispatchEvent = function (ev, e) {\n var defaultPrevented;\n function preventDefault() {\n defaultPrevented = true;\n }\n if (!self.events[ev]) { return; }\n self.events[ev].forEach(function dispatchEachEvent(fn) {\n e.ctx = self.ctx;\n e.preventDefault = preventDefault;\n fn.apply(self.intf, [e]);\n });\n return defaultPrevented;\n };\n self.resize = function (drawAfterResize) {\n var cellBorder = self.style.cellBorderWidth * 2,\n columnHeaderCellBorder = self.style.columnHeaderCellBorderWidth * 2,\n scrollHeight,\n scrollWidth,\n rowHeaderCellHeight = self.getRowHeaderCellHeight(),\n columnHeaderCellWidth = self.getColumnHeaderCellWidth(),\n // TODO: What the hell are these numbers!? They are probably some value in the style.\n scrollDragPositionOffsetY = 30,\n scrollDragPositionOffsetX = 15;\n if (self.isChildGrid) {\n self.height = self.parentNode.offsetHeight;\n self.width = self.parentNode.offsetWidth;\n } else {\n self.parentNode = self.parentDOMNode;\n if (!self.parentIsCanvas) {\n self.height = self.parentDOMNode.offsetHeight;\n self.width = self.parentDOMNode.offsetWidth;\n self.canvas.height = self.height * window.devicePixelRatio;\n self.canvas.width = self.width * window.devicePixelRatio;\n self.canvas.style.height = self.height + 'px';\n self.canvas.style.width = self.width + 'px';\n }\n self.canvasOffsetTop = self.args.canvasOffsetTop || 0;\n self.canvasOffsetLeft = self.args.canvasOffsetLeft || 0;\n }\n scrollHeight = self.data.reduce(function reduceData(accumulator, row) {\n return accumulator\n + (self.sizes.rows[row[self.uniqueId]] || self.style.cellHeight)\n + (self.sizes.trees[row[self.uniqueId]] || 0)\n + cellBorder;\n }, 0) || 0;\n scrollWidth = self.getVisibleSchema().reduce(function reduceSchema(accumulator, column) {\n if (column.hidden) { return accumulator; }\n return accumulator + (self.sizes.columns[column[self.uniqueId]] || column.width || self.style.columnWidth) + cellBorder;\n }, 0) || 0;\n if (self.attributes.showNewRow) {\n scrollHeight += self.style.cellHeight + cellBorder;\n }\n self.scrollBox.width = self.width - columnHeaderCellWidth;\n self.scrollBox.height = self.height - rowHeaderCellHeight - columnHeaderCellBorder;\n self.scrollBox.top = rowHeaderCellHeight + columnHeaderCellBorder;\n self.scrollBox.left = columnHeaderCellWidth;\n self.scrollBox.scrollHeight = scrollHeight + self.style.scrollBarWidth - self.scrollBox.height;\n self.scrollBox.scrollWidth = scrollWidth + self.style.scrollBarWidth - self.scrollBox.width;\n self.scrollBox.widthBoxRatio = ((self.scrollBox.width - scrollDragPositionOffsetX)\n / (self.scrollBox.scrollWidth + self.scrollBox.width - scrollDragPositionOffsetX));\n self.scrollBox.scrollBoxWidth = self.scrollBox.width\n * self.scrollBox.widthBoxRatio\n - self.style.scrollBarWidth;\n self.scrollBox.heightBoxRatio = ((self.scrollBox.height - scrollDragPositionOffsetY)\n / (self.scrollBox.scrollHeight + (self.scrollBox.height - scrollDragPositionOffsetY)));\n self.scrollBox.scrollBoxHeight = self.scrollBox.height\n * self.scrollBox.heightBoxRatio\n - self.style.scrollBarWidth;\n self.scrollBox.scrollBoxWidth = Math.max(self.scrollBox.scrollBoxWidth, self.style.scrollBarBoxMinSize);\n self.scrollBox.scrollBoxHeight = Math.max(self.scrollBox.scrollBoxHeight, self.style.scrollBarBoxMinSize);\n self.page = self.visibleRows.length - 3 - self.attributes.pageUpDownOverlap;\n self.resizeEditInput();\n self.scroll(true);\n if (drawAfterResize) {\n self.draw(true);\n }\n self.dispatchEvent('resize', {});\n return true;\n };\n self.resizeEditInput = function () {\n if (self.input) {\n var pos = self.canvas.getBoundingClientRect(),\n s = self.scrollOffset(self.canvas),\n bx2 = (self.style.cellBorderWidth * 2),\n cell = self.getVisibleCellByIndex(self.input.editCell.columnIndex, self.input.editCell.rowIndex)\n || {x: -100, y: -100, height: 0, width: 0};\n self.input.style.left = pos.left + cell.x - self.style.cellBorderWidth + self.canvasOffsetLeft - s.left + 'px';\n self.input.style.top = pos.top + cell.y - bx2 + self.canvasOffsetTop - s.top + 'px';\n self.input.style.height = cell.height - bx2 - 1 + 'px';\n self.input.style.width = cell.width - bx2 - self.style.cellPaddingLeft + 'px';\n self.clipElement(self.input);\n }\n };\n self.scroll = function (e, dontDraw) {\n var s = self.getVisibleSchema(),\n cellBorder = self.style.cellBorderWidth * 2;\n self.scrollIndexTop = 0;\n self.scrollPixelTop = 0;\n self.scrollIndexLeft = 0;\n self.scrollPixelLeft = 0;\n while (self.scrollPixelTop < self.scrollBox.scrollTop && self.scrollIndexTop < self.data.length) {\n self.scrollPixelTop +=\n (self.sizes.rows[self.data[self.scrollIndexTop][self.uniqueId]] || self.style.cellHeight)\n + (self.sizes.trees[self.data[self.scrollIndexTop][self.uniqueId]] || 0)\n + cellBorder;\n self.scrollIndexTop += 1;\n }\n while (self.scrollPixelLeft < self.scrollBox.scrollLeft && self.scrollIndexLeft < s.length) {\n self.scrollPixelLeft +=\n (self.sizes.columns[s[self.scrollIndexLeft][self.uniqueId]] || s[self.scrollIndexLeft].width);\n self.scrollIndexLeft += 1;\n }\n if (self.data.length > 0) {\n self.scrollIndexLeft = Math.max(self.scrollIndexLeft - 1, 0);\n self.scrollPixelLeft = Math.max(self.scrollPixelLeft\n - (self.sizes.columns[s[self.scrollIndexLeft][self.uniqueId]] || s[self.scrollIndexLeft].width), 0);\n self.scrollIndexTop = Math.max(self.scrollIndexTop - 1, 0);\n self.scrollPixelTop = Math.max(self.scrollPixelTop\n - (self.sizes.rows[self.data[self.scrollIndexTop][self.uniqueId]] || self.style.cellHeight)\n - (self.sizes.trees[self.data[self.scrollIndexTop][self.uniqueId]] || 0), 0);\n }\n self.ellipsisCache = {};\n if (!dontDraw) {\n self.draw(true);\n }\n //TODO: figure out why this has to be delayed for child grids\n //BUG: scrolling event on 3rd level hierarchy fails to move input box\n requestAnimationFrame(self.resizeEditInput);\n self.dispatchEvent('scroll', {top: self.scrollBox.scrollTop, left: self.scrollBox.scrollLeft});\n };\n self.mousemove = function (e, overridePos) {\n if (self.contextMenu || self.input) {\n return;\n }\n self.mouse = overridePos || self.getLayerPos(e);\n var ctrl = (e.controlKey || e.metaKey || self.attributes.persistantSelectionMode),\n i,\n s = self.getSchema(),\n dragBounds,\n sBounds,\n x = self.mouse.x,\n y = self.mouse.y,\n o = self.getCellAt(x, y),\n delta,\n ev = {NativeEvent: e, cell: o, x: x, y: y},\n previousCell = self.currentCell;\n clearTimeout(self.scrollTimer);\n if (!self.isInGrid({x: x, y: y})) {\n self.hasFocus = false;\n }\n if (self.dispatchEvent('mousemove', ev)) {\n return;\n }\n if (o && self.currentCell && (self.currentCell.rowIndex !== o.rowIndex\n || self.currentCell.columnIndex !== o.columnIndex)) {\n self.cellBoundaryCrossed = true;\n ev.cell = previousCell;\n self.dispatchEvent('cellmouseout', ev);\n ev.cell = o;\n self.dispatchEvent('cellmouseover', ev);\n }\n self.currentCell = o;\n if (!self.hasFocus) {\n return;\n }\n self.hovers = {};\n if (!self.draggingItem\n && o\n && self.scrollModes.indexOf(o.context) === -1) {\n self.dragItem = o;\n self.dragMode = o.dragContext;\n self.canvas.style.cursor = o.context;\n if (o.context === 'cell' && o.data) {\n self.canvas.style.cursor = 'pointer';\n self.hovers[o.data[self.uniqueId]] = [o.columnIndex];\n }\n if ((self.selecting || self.reorderObject)\n && o.context === 'cell'\n && o.data) {\n sBounds = self.getSelectionBounds();\n delta = {\n x: Math.abs(self.dragStart.x - x),\n y: Math.abs(self.dragStart.y - y),\n };\n if (self.dragStartObject.columnIndex !== -1 && e.shiftKey) {\n self.dragStartObject = {\n rowIndex: self.activeCell.rowIndex,\n columnIndex: self.activeCell.columnIndex\n };\n }\n dragBounds = {\n top: Math.min(self.dragStartObject.rowIndex, o.rowIndex),\n left: Math.min(self.dragStartObject.columnIndex, o.columnIndex),\n bottom: Math.max(self.dragStartObject.rowIndex, o.rowIndex),\n right: Math.max(self.dragStartObject.columnIndex, o.columnIndex)\n };\n if (self.dragStartObject.columnIndex === -1) {\n dragBounds.left = -1;\n dragBounds.right = s.length - 1;\n dragBounds.top = Math.min(sBounds.top, o.rowIndex);\n dragBounds.bottom = Math.max(sBounds.bottom, o.rowIndex);\n }\n if (self.dragStartObject.rowIndex !== o.rowIndex\n || self.dragStartObject.columnIndex !== o.columnIndex) {\n self.ignoreNextClick = true;\n }\n if (self.cellBoundaryCrossed || (delta.x === 0 && delta.y === 0) || self.attributes.rowSelectionMode) {\n if (self.attributes.rowSelectionMode || self.dragStartObject.columnIndex === -1) {\n self.selectRow(o.rowIndex, ctrl, null, true);\n } else {\n if (!self.dragAddToSelection && o.rowIndex !== undefined) {\n if (self.selections[o.rowIndex] && self.selections[o.rowIndex].indexOf(o.columnIndex) !== -1) {\n self.selections[o.rowIndex].splice(self.selections[o.rowIndex].indexOf(o.columnIndex), 1);\n }\n } else {\n self.selections[o.rowIndex] = self.selections[o.rowIndex] || [];\n if (self.selections[o.rowIndex].indexOf(o.columnIndex) === -1) {\n self.selections[o.rowIndex].push(o.columnIndex);\n }\n }\n }\n }\n if ((!self.selectionBounds || (dragBounds.top !== self.selectionBounds.top\n || dragBounds.left !== self.selectionBounds.left\n || dragBounds.bottom !== self.selectionBounds.bottom\n || dragBounds.right !== self.selectionBounds.right)) && !ctrl) {\n self.selections = [];\n sBounds = dragBounds;\n if (self.attributes.rowSelectionMode) {\n for (i = sBounds.top; i <= sBounds.bottom; i += 1) {\n self.selectRow(i, true, null, true);\n }\n } else {\n self.selectArea(sBounds, true);\n }\n }\n self.autoScrollZone(e, x, y, ctrl);\n }\n }\n self.cellBoundaryCrossed = false;\n self.draw(true);\n };\n self.click = function (e, overridePos) {\n var i,\n selectionChanged,\n ctrl = (e.controlKey || e.metaKey || self.attributes.persistantSelectionMode),\n pos = overridePos || self.getLayerPos(e);\n self.currentCell = self.getCellAt(pos.x, pos.y);\n if (self.currentCell.grid !== undefined) {\n return;\n }\n function checkSelectionChange() {\n if (!selectionChanged) { return; }\n self.dispatchEvent('selectionchanged', {\n selectedData: self.getSelectedData(),\n selections: self.selections,\n selectionBounds: self.selectionBounds\n });\n }\n if (self.input) {\n self.endEdit();\n }\n if (self.ignoreNextClick) {\n self.ignoreNextClick = false;\n return;\n }\n i = self.currentCell;\n if (self.dispatchEvent('click', {NativeEvent: e, cell: self.currentCell})) { return; }\n if (!self.hasFocus) {\n return;\n }\n if (self.currentCell.context === 'cell') {\n if (self.currentCell.style === 'cornerCell') {\n self.order(self.uniqueId, 'asc', self.sorters.number);\n self.setFilter();\n checkSelectionChange();\n return;\n }\n if (self.currentCell.style === 'columnHeaderCell') {\n if (self.attributes.columnHeaderClickBehavior === 'sort') {\n if (self.orderBy === i.header.name) {\n self.orderDirection = self.orderDirection === 'asc' ? 'desc' : 'asc';\n } else {\n self.orderDirection = 'asc';\n }\n self.order(i.header.name, self.orderDirection);\n checkSelectionChange();\n return;\n }\n if (self.attributes.columnHeaderClickBehavior === 'select') {\n self.selectColumn(i.header.index, ctrl, e.shiftKey, true);\n checkSelectionChange();\n self.draw();\n return;\n }\n }\n if (['rowHeaderCell', 'columnHeaderCell'].indexOf(self.currentCell.style) === -1 && !ctrl) {\n self.setActiveCell(i.columnIndex, i.rowIndex);\n }\n self.selections[i.rowIndex] = self.selections[i.rowIndex] || [];\n if ((self.attributes.rowSelectionMode || self.currentCell.style === 'rowHeaderCell')) {\n if (self.currentCell.style === 'rowHeaderCell'\n && self.attributes.tree && pos.x > 0\n && pos.x - self.currentCell.x < self.style.treeArrowWidth\n + self.style.treeArrowMarginLeft\n + self.style.treeArrowMarginRight + self.style.treeArrowClickRadius\n && pos.y - self.currentCell.y < self.style.treeArrowHeight\n + self.style.treeArrowMarginTop + self.style.treeArrowClickRadius\n && pos.y > 0) {\n self.toggleTree(i.rowIndex);\n return;\n }\n selectionChanged = true;\n self.selectRow(i.rowIndex, ctrl, null, true);\n }\n if (e.shiftKey && !ctrl) {\n self.selectionBounds = self.getSelectionBounds();\n self.selectArea(undefined, false);\n }\n }\n checkSelectionChange();\n self.draw(true);\n };\n self.dragResizeColumn = function (e) {\n var pos, x, y;\n pos = self.getLayerPos(e);\n x = self.resizingStartingWidth + pos.x - self.dragStart.x;\n y = self.resizingStartingHeight + pos.y - self.dragStart.y;\n if (x < self.style.minColumnWidth) {\n x = self.style.minColumnWidth;\n }\n if (y < self.style.minRowHeight) {\n y = self.style.minRowHeight;\n }\n if (self.dispatchEvent('resizecolumn', {x: x, y: y, draggingItem: self.draggingItem})) { return false; }\n if (self.scrollBox.scrollLeft > self.scrollBox.scrollWidth - self.attributes.resizeScrollZone\n && self.dragMode === 'ew-resize') {\n self.resize(true);\n self.scrollBox.scrollLeft += x;\n }\n if (self.dragMode === 'ew-resize') {\n self.sizes.columns[self.draggingItem.header.style === 'rowHeaderCell'\n ? 'cornerCell' : self.draggingItem.header[self.uniqueId]] = x;\n if (['rowHeaderCell', 'cornerCell'].indexOf(self.draggingItem.header.style) !== -1) {\n self.resize(true);\n }\n self.resizeChildGrids();\n return;\n }\n if (self.dragMode === 'ns-resize') {\n if (self.draggingItem.rowOpen) {\n self.sizes.trees[self.draggingItem.data[self.uniqueId]] = y;\n } else if (self.attributes.globalRowResize) {\n self.style.cellHeight = y;\n } else {\n self.sizes.rows[self.draggingItem.data[self.uniqueId]] = y;\n }\n self.dispatchEvent('resizerow', {row: y});\n self.resizeChildGrids();\n return;\n }\n self.ellipsisCache = {};\n };\n self.stopDragResize = function () {\n self.resize();\n document.body.removeEventListener('mousemove', self.dragResizeColumn, false);\n document.body.removeEventListener('mouseup', self.stopDragResize, false);\n self.setStorageData();\n self.draw(true);\n self.ignoreNextClick = true;\n };\n self.scrollGrid = function (e) {\n var pos = self.getLayerPos(e);\n if (self.attributes.scrollPointerLock && self.pointerLockPosition\n && ['horizontal-scroll-box', 'vertical-scroll-box'].indexOf(self.scrollStartMode) !== -1) {\n self.pointerLockPosition.x += e.movementX;\n self.pointerLockPosition.y += e.movementY;\n pos = self.pointerLockPosition;\n }\n self.scrollMode = self.getCellAt(pos.x, pos.y).context;\n if (self.scrollMode === 'horizontal-scroll-box' && self.scrollStartMode !== 'horizontal-scroll-box') {\n self.scrollStartMode = 'horizontal-scroll-box';\n self.dragStart = pos;\n self.scrollStart.left = self.scrollBox.scrollLeft;\n clearTimeout(self.scrollTimer);\n return;\n }\n if (self.scrollMode === 'vertical-scroll-box' && self.scrollStartMode !== 'vertical-scroll-box') {\n self.scrollStartMode = 'vertical-scroll-box';\n self.dragStart = pos;\n self.scrollStart.top = self.scrollBox.scrollTop;\n clearTimeout(self.scrollTimer);\n return;\n }\n if (self.scrollStartMode === 'vertical-scroll-box'\n && self.scrollMode !== 'vertical-scroll-box') {\n self.scrollMode = 'vertical-scroll-box';\n }\n if (self.scrollStartMode === 'horizontal-scroll-box'\n && self.scrollMode !== 'horizontal-scroll-box') {\n self.scrollMode = 'horizontal-scroll-box';\n }\n clearTimeout(self.scrollTimer);\n if (self.scrollModes.indexOf(self.scrollMode) === -1) {\n return;\n }\n if (self.scrollMode === 'vertical-scroll-box') {\n self.scrollBox.scrollTop = self.scrollStart.top + ((pos.y - self.dragStart.y)\n / self.scrollBox.heightBoxRatio);\n } else if (self.scrollMode === 'vertical-scroll-top') {\n self.scrollBox.scrollTop -= (self.page * self.style.cellHeight);\n self.scrollTimer = setTimeout(self.scrollGrid, self.attributes.scrollRepeatRate, e);\n } else if (self.scrollMode === 'vertical-scroll-bottom') {\n self.scrollBox.scrollTop += (self.page * self.style.cellHeight);\n self.scrollTimer = setTimeout(self.scrollGrid, self.attributes.scrollRepeatRate, e);\n }\n if (self.scrollMode === 'horizontal-scroll-box') {\n self.scrollBox.scrollLeft = self.scrollStart.left + ((pos.x - self.dragStart.x)\n / self.scrollBox.widthBoxRatio);\n } else if (self.scrollMode === 'horizontal-scroll-right') {\n self.scrollBox.scrollLeft += self.attributes.selectionScrollIncrement;\n self.scrollTimer = setTimeout(self.scrollGrid, self.attributes.scrollRepeatRate, e);\n } else if (self.scrollMode === 'horizontal-scroll-left') {\n self.scrollBox.scrollLeft -= self.attributes.selectionScrollIncrement;\n self.scrollTimer = setTimeout(self.scrollGrid, self.attributes.scrollRepeatRate, e);\n }\n };\n self.stopScrollGrid = function () {\n clearTimeout(self.scrollTimer);\n if (document.exitPointerLock) {\n document.exitPointerLock();\n }\n document.body.removeEventListener('mousemove', self.scrollGrid, false);\n };\n self.dragReorder = function (e) {\n var pos, x, y;\n pos = self.getLayerPos(e);\n x = pos.x - self.dragStart.x;\n y = pos.y - self.dragStart.y;\n if (!self.attributes.allowColumnReordering && self.dragMode === 'column-reorder') {\n return;\n }\n if (!self.attributes.allowRowReordering && self.dragMode === 'row-reorder') {\n return;\n }\n if (self.dispatchEvent('reordering', {\n NativeEvent: e,\n source: self.dragStartObject,\n target: self.currentCell,\n dragMode: self.dragMode\n })) {\n return;\n }\n if (Math.abs(x) > self.attributes.reorderDeadZone || Math.abs(y) > self.attributes.reorderDeadZone) {\n self.reorderObject = self.dragStartObject;\n self.reorderTarget = self.currentCell;\n self.reorderObject.dragOffset = {\n x: x,\n y: y\n };\n self.autoScrollZone(e, pos.x, pos.x, false);\n }\n };\n self.stopDragReorder = function (e) {\n var cr = {\n 'row-reorder': self.orders.rows,\n 'column-reorder': self.orders.columns\n },\n i = {\n 'row-reorder': 'rowIndex',\n 'column-reorder': 'columnIndex'\n }[self.dragMode];\n document.body.removeEventListener('mousemove', self.dragReorder, false);\n document.body.removeEventListener('mouseup', self.stopDragReorder, false);\n if (self.reorderObject\n && self.reorderTarget) {\n self.ignoreNextClick = true;\n if (self.reorderObject[i] !== self.reorderTarget[i]\n && !self.dispatchEvent('reorder', {\n NativeEvent: e,\n source: self.reorderObject,\n target: self.reorderTarget,\n dragMode: self.dragMode\n })) {\n cr[self.dragMode].splice(cr[self.dragMode].indexOf(self.reorderObject[i]), 1);\n cr[self.dragMode].splice(cr[self.dragMode].indexOf(self.reorderTarget[i]), 0, self.reorderObject[i]);\n self.setStorageData();\n }\n }\n self.reorderObject = undefined;\n self.reorderTarget = undefined;\n self.draw(true);\n };\n self.mousedown = function (e, overridePos) {\n self.lastMouseDownTarget = e.target;\n if (self.dispatchEvent('mousedown', {NativeEvent: e, cell: self.currentCell})) { return; }\n if (!self.hasFocus) {\n return;\n }\n if (e.button === 2 || self.input) { return; }\n var ctrl = (e.controlKey || e.metaKey);\n self.dragStart = overridePos || self.getLayerPos(e);\n self.scrollStart = {\n left: self.scrollBox.scrollLeft,\n top: self.scrollBox.scrollTop\n };\n self.dragStartObject = self.getCellAt(self.dragStart.x, self.dragStart.y);\n self.dragAddToSelection = !self.dragStartObject.selected;\n if (!ctrl && !e.shiftKey && !/(vertical|horizontal)-scroll-(bar|box)/\n .test(self.dragStartObject.context) && !self.currentCell.isColumnHeader) {\n self.selections = [];\n }\n if (self.dragStartObject.isGrid) {\n return;\n }\n if (self.scrollModes.indexOf(self.dragStartObject.context) !== -1) {\n self.scrollMode = self.dragStartObject.context;\n self.scrollStartMode = self.dragStartObject.context;\n self.scrollGrid(e);\n if (self.attributes.scrollPointerLock\n && ['horizontal-scroll-box', 'vertical-scroll-box'].indexOf(self.scrollStartMode) !== -1) {\n self.pointerLockPosition = {\n x: self.dragStart.x,\n y: self.dragStart.y\n };\n self.canvas.requestPointerLock();\n }\n document.body.addEventListener('mousemove', self.scrollGrid, false);\n document.body.addEventListener('mouseup', self.stopScrollGrid, false);\n self.ignoreNextClick = true;\n return;\n }\n if (self.dragMode === 'cell') {\n self.selecting = true;\n if (self.attributes.rowSelectionMode) {\n self.selectRow(self.dragStartObject.rowIndex, ctrl, null, true);\n }\n return self.mousemove(e);\n }\n if (['ns-resize', 'ew-resize'].indexOf(self.dragMode) !== -1) {\n self.draggingItem = self.dragItem;\n if (self.draggingItem.rowOpen) {\n self.resizingStartingHeight = self.sizes.trees[self.draggingItem.data[self.uniqueId]];\n } else {\n self.resizingStartingHeight = self.sizes.rows[self.draggingItem.data[self.uniqueId]] || self.style.cellHeight;\n }\n self.resizingStartingWidth = self.sizes.columns[self.draggingItem.header.style === 'rowHeaderCell'\n ? 'cornerCell' : self.draggingItem.header[self.uniqueId]] || self.draggingItem.header.width;\n document.body.addEventListener('mousemove', self.dragResizeColumn, false);\n document.body.addEventListener('mouseup', self.stopDragResize, false);\n }\n if (['row-reorder', 'column-reorder'].indexOf(self.dragMode) !== -1) {\n self.draggingItem = self.dragItem;\n document.body.addEventListener('mousemove', self.dragReorder, false);\n document.body.addEventListener('mouseup', self.stopDragReorder, false);\n }\n };\n self.mouseup = function (e) {\n clearTimeout(self.scrollTimer);\n self.cellBoundaryCrossed = true;\n self.selecting = undefined;\n self.draggingItem = undefined;\n self.dragStartObject = undefined;\n if (self.dispatchEvent('mouseup', {NativeEvent: e, cell: self.currentCell})) { return; }\n if (!self.hasFocus && e.target !== self.canvas) {\n return;\n }\n if (self.currentCell && self.currentCell.grid !== undefined) {\n return;\n }\n if (self.contextMenu || self.input) { return; }\n if (self.dragStart && self.isInGrid(self.dragStart)) {\n self.controlInput.focus();\n }\n e.preventDefault();\n };\n self.keydown = function (e) {\n var i,\n x = self.activeCell.columnIndex,\n y = self.activeCell.rowIndex,\n ctrl = (e.controlKey || e.metaKey),\n last = self.data.length - 1,\n cols = self.getVisibleSchema().length - 1;\n if (self.dispatchEvent('keydown', {NativeEvent: e, cell: self.currentCell})) { return; }\n if (!self.hasFocus) {\n return;\n }\n self.page = self.visibleRows.length - 3 - self.attributes.pageUpDownOverlap;\n if (self.attributes.showNewRow) {\n last += 1;\n }\n if (e.keyCode === 9) {\n e.preventDefault();\n }\n // ctrl + a\n if (ctrl && e.keyCode === 65) {\n self.selectAll();\n //ArrowDown\n } else if (e.keyCode === 40) {\n y += 1;\n //ArrowUp\n } else if (e.keyCode === 38) {\n y -= 1;\n //ArrowLeft Tab\n } else if (e.keyCode === 37 || (e.shiftKey && e.keyCode === 9)) {\n x -= 1;\n //ArrowRight Tab\n } else if (e.keyCode === 39 || (!e.shiftKey && e.keyCode === 9)) {\n x += 1;\n //PageUp\n } else if (e.keyCode === 33) {\n y -= self.page;\n e.preventDefault();\n //PageDown\n } else if (e.keyCode === 34) {\n y += self.page;\n e.preventDefault();\n //Home ArrowUp\n } else if (e.keyCode === 36 || (ctrl && e.keyCode === 38)) {\n y = 0;\n //End ArrowDown\n } else if (e.keyCode === 35 || (ctrl && e.keyCode === 40)) {\n y = self.data.length - 1;\n //ArrowRight\n } else if (ctrl && e.keyCode === 39) {\n x = cols;\n //ArrowLeft\n } else if (ctrl && e.keyCode === 37) {\n x = 0;\n }\n //Enter\n if (e.keyCode === 13) {\n return self.beginEditAt(x, y);\n }\n //Space\n if (e.keyCode === 32) {\n self.selections = [];\n self.selections[Math.max(y, 0)] = [];\n self.selections[Math.max(y, 0)].push(x);\n self.selectionBounds = self.getSelectionBounds();\n if (self.attributes.rowSelectionMode) {\n for (i = self.selectionBounds.top; i <= self.selectionBounds.bottom; i += 1) {\n self.selectRow(i, ctrl, null, true);\n }\n } else {\n self.selectArea(undefined, ctrl);\n }\n e.preventDefault();\n self.draw(true);\n return;\n }\n if (x < 0) {\n x = 0;\n }\n if (y > last) {\n y = last;\n }\n if (y < 0) {\n y = 0;\n }\n if (x > cols) {\n x = cols;\n }\n // Arrows\n if (e.shiftKey && [37, 38, 39, 40].indexOf(e.keyCode) !== -1) {\n self.selections[Math.max(y, 0)] = self.selections[Math.max(y, 0)] || [];\n self.selections[Math.max(y, 0)].push(x);\n self.selectionBounds = self.getSelectionBounds();\n self.selectArea(undefined, ctrl);\n self.draw(true);\n }\n if (x !== self.activeCell.columnIndex || y !== self.activeCell.rowIndex) {\n self.scrollIntoView(x !== self.activeCell.columnIndex ? x : undefined, y !== self.activeCell.rowIndex ? y : undefined);\n self.setActiveCell(x, y);\n if (!e.shiftKey && self.attributes.selectionFollowsActiveCell) {\n if (!ctrl) {\n self.selections = [];\n }\n self.selections[y] = self.selections[y] || [];\n self.selections[y].push(x);\n self.dispatchEvent('selectionchanged', {\n selectedData: self.getSelectedData(),\n selections: self.selections,\n selectionBounds: self.selectionBounds\n });\n }\n self.draw(true);\n }\n };\n self.keyup = function (e) {\n if (self.dispatchEvent('keyup', {NativeEvent: e, cell: self.currentCell})) { return; }\n if (!self.hasFocus) {\n return;\n }\n self.controlInput.value = '';\n };\n self.keypress = function (e) {\n if (!self.hasFocus) {\n return;\n }\n if (self.dispatchEvent('keypress', {NativeEvent: e, cell: self.currentCell})) { return; }\n };\n self.dblclick = function (e) {\n if (self.dispatchEvent('dblclick', {NativeEvent: e, cell: self.currentCell})) { return; }\n if (!self.hasFocus) {\n return;\n }\n if (self.currentCell.context === 'ew-resize'\n && self.currentCell.style === 'columnHeaderCell') {\n self.fitColumnToValues(self.currentCell.header.name);\n } else if (self.currentCell.context === 'ew-resize'\n && self.currentCell.style === 'cornerCell') {\n self.autosize();\n } else if (['cell', 'activeCell'].indexOf(self.currentCell.style) !== -1) {\n self.beginEditAt(self.currentCell.columnIndex, self.currentCell.rowIndex);\n }\n };\n self.scrollWheel = function (e) {\n if (self.dispatchEvent('wheel', {NativeEvent: e})) {\n return;\n }\n self.touchHaltAnimation = true;\n var l = self.scrollBox.scrollLeft,\n t = self.scrollBox.scrollTop;\n if (self.hasFocus) {\n self.scrollBox.scrollTop += e.deltaY;\n self.scrollBox.scrollLeft += e.deltaX;\n }\n if (t !== self.scrollBox.scrollTop || l !== self.scrollBox.scrollLeft) {\n e.preventDefault();\n }\n };\n self.copy = function (e) {\n if (self.dispatchEvent('copy', {NativeEvent: e})) { return; }\n if (!self.hasFocus || !e.clipboardData) { return; }\n var rows = [], sData = self.getSelectedData();\n if (sData.length > 0) {\n sData.forEach(function (row) {\n if (row) {\n var r = [];\n Object.keys(row).forEach(function (key) {\n r.push(row[key]);\n });\n r.join(',');\n rows.push(r);\n }\n });\n e.clipboardData.setData('text/plain', rows.join('\\n'));\n e.preventDefault();\n }\n };\n return;\n };\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/events.js\n// module id = 2\n// module chunks = 0","/*jslint browser: true, unparam: true, todo: true*/\n/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/\ndefine([], function () {\n 'use strict';\n return function (self) {\n self.orders = {\n rows: [],\n columns: []\n };\n self.hasFocus = false;\n self.activeCell = {\n columnIndex: 0,\n rowIndex: 0\n };\n self.storageName = 'canvasDataGrid';\n self.invalidSearchExpClass = 'canvas-datagrid-invalid-search-regExp';\n self.localStyleLibraryStorageKey = 'canvas-datagrid-user-style-library';\n self.uniqueId = '_canvasDataGridUniqueId';\n self.orderBy = self.uniqueId;\n self.orderDirection = 'asc';\n self.columnFilters = {};\n self.filters = {};\n self.ellipsisCache = {};\n self.scrollBox = {};\n self.visibleRows = [];\n self.sizes = {\n rows: {},\n columns: {},\n trees: {}\n };\n self.currentFilter = function () {\n return true;\n };\n self.selections = [];\n self.hovers = {};\n self.attributes = {};\n self.style = {};\n self.intf = {};\n self.formatters = {};\n self.sorters = {};\n self.schemaHashes = {};\n self.events = {};\n self.uId = 0;\n self.changes = [];\n self.scrollIndexTop = 0;\n self.scrollPixelTop = 0;\n self.scrollIndexLeft = 0;\n self.scrollPixelLeft = 0;\n self.childGrids = {};\n self.openChildren = {};\n self.scrollModes = [\n 'vertical-scroll-box',\n 'vertical-scroll-top',\n 'vertical-scroll-bottom',\n 'horizontal-scroll-box',\n 'horizontal-scroll-right',\n 'horizontal-scroll-left'\n ];\n self.mouse = { x: 0, y: 0};\n self.getSelectedData = function (expandToRow) {\n var d = [], s = self.getSchema(), l = self.data.length;\n self.selections.forEach(function (row, index) {\n if (index === l) { return; }\n if (row.length === 0) {\n d[index] = null;\n return;\n }\n d[index] = {};\n if (expandToRow) {\n s.forEach(function (column) {\n d[index][column.name] = self.data[index][column.name];\n });\n } else {\n row.forEach(function (col) {\n if (col === -1) { return; }\n d[index][s[col].name] = self.data[index][s[col].name];\n });\n }\n });\n return d;\n };\n self.scrollOffset = function (e) {\n var x = 0, y = 0;\n while (e.parentNode) {\n if (e.nodeType !== 'canvas-datagrid-tree'\n && e.nodeType !== 'canvas-datagrid-cell') {\n x -= e.scrollLeft;\n y -= e.scrollTop;\n }\n e = e.parentNode;\n }\n return {left: x, top: y};\n };\n self.position = function (e, ignoreScrollOffset) {\n var x = 0, y = 0, s = e, h, w;\n while (e.offsetParent) {\n x += e.offsetLeft;\n y += e.offsetTop;\n h = e.offsetHeight;\n w = e.offsetWidth;\n e = e.offsetParent;\n }\n if (ignoreScrollOffset) {\n return {left: x, top: y, height: h, width: w};\n }\n e = s;\n s = self.scrollOffset(e);\n return { left: x + s.left, top: y + s.top, height: h, width: w };\n };\n self.getLayerPos = function (e) {\n var rect = self.canvas.getBoundingClientRect(),\n pos = {\n x: e.clientX - rect.left,\n y: e.clientY - rect.top\n };\n if (self.isChildGrid) {\n pos.x -= self.canvasOffsetLeft;\n pos.y -= self.canvasOffsetTop;\n }\n return {\n x: pos.x,\n y: pos.y,\n rect: rect\n };\n };\n self.fillArray = function (low, high, step) {\n step = step || 1;\n var i = [], x;\n for (x = low; x <= high; x += step) {\n i[x] = x;\n }\n return i;\n };\n self.getRowHeaderCellHeight = function () {\n if (!self.attributes.showColumnHeaders) { return 0; }\n return self.sizes.rows[-1] || self.style.columnHeaderCellHeight;\n };\n self.getColumnHeaderCellWidth = function () {\n if (!self.attributes.showRowHeaders) { return 0; }\n return self.sizes.columns.cornerCell || self.style.rowHeaderCellWidth;\n };\n self.setStorageData = function () {\n if (!self.attributes.saveAppearance) { return; }\n localStorage.setItem(self.storageName + '-' + self.attributes.name, JSON.stringify({\n sizes: {\n rows: self.sizes.rows,\n columns: self.sizes.columns\n },\n orders: {\n rows: self.orders.rows,\n columns: self.orders.columns\n },\n orderBy: self.orderBy,\n orderDirection: self.orderDirection\n }));\n };\n self.getSchema = function () {\n return self.schema || self.tempSchema;\n };\n self.createColumnOrders = function () {\n var s = self.getSchema();\n self.orders.columns = self.fillArray(0, s.length - 1);\n };\n self.createRowOrders = function () {\n self.orders.rows = self.fillArray(0, self.data.length - 1);\n };\n self.getVisibleSchema = function () {\n return self.getSchema().filter(function (col) { return !col.hidden; });\n };\n self.applyDefaultValue = function (row, header) {\n var d = header.defaultValue || '';\n if (typeof d === 'function') {\n d = d.apply(self.intf, [header]);\n }\n row[header.name] = d;\n };\n self.createNewRowData = function () {\n self.newRow = {};\n self.newRow[self.uniqueId] = self.uId;\n self.uId += 1;\n self.getSchema().forEach(function forEachHeader(header) {\n self.applyDefaultValue(self.newRow, header);\n });\n };\n self.getSchemaNameHash = function (key) {\n var n = 0;\n while (self.schemaHashes[key]) {\n n += 1;\n key = key + n;\n }\n return key;\n };\n self.filter = function (type) {\n var f = self.filters[type];\n if (!f && type !== undefined) {\n console.warn('Cannot find filter for type %s, falling back to substring match.', type);\n f = self.filters.string;\n }\n return f;\n };\n self.getBestGuessDataType = function (columnName) {\n var t, x, l = self.data.length;\n for (x = 0; x < l; x += 1) {\n if ([null, undefined].indexOf(self.data[x][columnName]) !== -1) {\n t = typeof self.data[x];\n return t === 'object' ? 'string' : t;\n }\n }\n return 'string';\n };\n self.drawChildGrids = function () {\n Object.keys(self.childGrids).forEach(function (gridKey) {\n self.childGrids[gridKey].draw();\n });\n };\n self.resizeChildGrids = function () {\n Object.keys(self.childGrids).forEach(function (gridKey) {\n self.childGrids[gridKey].resize();\n });\n };\n self.getClippingRect = function (ele) {\n var boundingRect = self.position(self.parentNode),\n eleRect = self.position(ele),\n s = self.scrollOffset(self.canvas),\n clipRect = {\n x: 0,\n y: 0,\n h: 0,\n w: 0\n },\n parentRect = {\n x: -Infinity,\n y: -Infinity,\n h: Infinity,\n w: Infinity\n },\n rowHeaderCellHeight = self.getRowHeaderCellHeight(),\n columnHeaderCellWidth = self.getColumnHeaderCellWidth();\n boundingRect.top -= s.top;\n boundingRect.left -= s.left;\n eleRect.top -= s.top;\n eleRect.left -= s.left;\n clipRect.h = boundingRect.top + boundingRect.height - ele.offsetTop - self.style.scrollBarWidth;\n clipRect.w = boundingRect.left + boundingRect.width - ele.offsetLeft - self.style.scrollBarWidth;\n clipRect.x = boundingRect.left + (eleRect.left * -1) + columnHeaderCellWidth;\n clipRect.y = boundingRect.top + (eleRect.top * -1) + rowHeaderCellHeight;\n return {\n x: clipRect.x > parentRect.x ? clipRect.x : parentRect.x,\n y: clipRect.y > parentRect.y ? clipRect.y : parentRect.y,\n h: clipRect.h < parentRect.h ? clipRect.h : parentRect.h,\n w: clipRect.w < parentRect.w ? clipRect.w : parentRect.w\n };\n };\n self.clipElement = function (ele) {\n var clipRect = self.getClippingRect(ele);\n if (clipRect.w < 0) { clipRect.w = 0; }\n if (clipRect.h < 0) { clipRect.h = 0; }\n ele.style.clip = 'rect('\n + clipRect.y + 'px,'\n + clipRect.w + 'px,'\n + clipRect.h + 'px,'\n + clipRect.x + 'px'\n + ')';\n // INFO https://developer.mozilla.org/en-US/docs/Web/CSS/clip\n // clip has been \"deprecated\" for clipPath. Of course nothing but chrome\n // supports clip path, so we'll keep using clip until someday clipPath becomes\n // more widely support. The code below works correctly, but setting clipPath and clip\n // at the same time has undesirable results.\n // ele.style.clipPath = 'polygon('\n // + clipRect.x + 'px ' + clipRect.y + 'px,'\n // + clipRect.x + 'px ' + clipRect.h + 'px,'\n // + clipRect.w + 'px ' + clipRect.h + 'px,'\n // + clipRect.w + 'px ' + clipRect.y + 'px'\n // + ')';\n };\n self.autoScrollZone = function (e, x, y, ctrl) {\n var setTimer,\n columnHeaderCellWidth = self.getColumnHeaderCellWidth(),\n rowHeaderCellHeight = self.getRowHeaderCellHeight();\n if (x > self.width - self.attributes.selectionScrollZone && x < self.width) {\n self.scrollBox.scrollLeft += self.attributes.selectionScrollIncrement;\n setTimer = true;\n }\n if (y > self.height - self.attributes.selectionScrollZone && y < self.height) {\n self.scrollBox.scrollTop += self.attributes.selectionScrollIncrement;\n setTimer = true;\n }\n if (x - self.attributes.selectionScrollZone - columnHeaderCellWidth < 0) {\n self.scrollBox.scrollLeft -= self.attributes.selectionScrollIncrement;\n setTimer = true;\n }\n if (y - self.attributes.selectionScrollZone - rowHeaderCellHeight < 0) {\n self.scrollBox.scrollTop -= self.attributes.selectionScrollIncrement;\n setTimer = true;\n }\n if (setTimer && !ctrl && self.currentCell && self.currentCell.columnIndex !== -1) {\n self.scrollTimer = setTimeout(self.mousemove, self.attributes.scrollRepeatRate, e);\n }\n };\n self.refreshFromOrigialData = function () {\n self.data = self.originalData.filter(function (row) {\n return true;\n });\n };\n self.validateColumn = function (c, s) {\n if (!c.name) {\n throw new Error('A column must contain at least a name.');\n }\n if (s.filter(function (i) { return i.name === c.name; }).length > 0) {\n throw new Error('A column with the name '\n + c.name + ' already exists and cannot be added again.');\n }\n return true;\n };\n self.setDefaults = function (obj1, obj2, key, def) {\n obj1[key] = obj2[key] === undefined ? def : obj2[key];\n };\n self.setAttributes = function () {\n self.defaults.attributes.forEach(function eachAttribute(i) {\n self.setDefaults(self.attributes, self.args, i[0], i[1]);\n });\n };\n self.setStyle = function () {\n self.defaults.styles.forEach(function eachStyle(i) {\n self.setDefaults(self.style, self.args.style || {}, i[0], i[1]);\n });\n };\n self.autosize = function (colName) {\n self.getVisibleSchema().forEach(function (col) {\n if (col.name === colName || colName === undefined) {\n self.fitColumnToValues(col.name);\n }\n });\n self.fitColumnToValues('cornerCell');\n };\n self.dispose = function () {\n if (!self.isChildGrid && self.canvas && self.canvas.parentNode) {\n self.canvas.parentNode.removeChild(self.canvas);\n }\n self.eventParent.removeEventListener('mouseup', self.mouseup, false);\n self.eventParent.removeEventListener('mousedown', self.mousedown, false);\n self.eventParent.removeEventListener('dblclick', self.dblclick, false);\n self.eventParent.removeEventListener('click', self.click, false);\n self.eventParent.removeEventListener('mousemove', self.mousemove);\n self.eventParent.removeEventListener('wheel', self.scrollWheel, false);\n self.canvas.removeEventListener('contextmenu', self.contextmenu, false);\n self.canvas.removeEventListener('copy', self.copy);\n self.controlInput.removeEventListener('keypress', self.keypress, false);\n self.controlInput.removeEventListener('keyup', self.keyup, false);\n self.controlInput.removeEventListener('keydown', self.keydown, false);\n window.removeEventListener('resize', self.resize);\n if (self.observer && self.observer.disconnect) {\n self.observer.disconnect();\n }\n };\n self.tryLoadStoredOrders = function () {\n var s;\n if (self.storedSettings && typeof self.storedSettings.orders === 'object') {\n if (self.storedSettings.orders.rows.length >= self.data.length) {\n self.orders.rows = self.storedSettings.orders.rows;\n }\n s = self.getSchema();\n self.orders.columns = self.storedSettings.orders.columns;\n s.forEach(function (h, i) {\n if (self.orders.columns.indexOf(i) === -1) {\n self.orders.columns.push(i);\n }\n });\n self.orderBy = self.storedSettings.orderBy === undefined\n ? self.uniqueId : self.storedSettings.orderBy;\n self.orderDirection = self.storedSettings.orderDirection === undefined\n ? self.uniqueId : self.storedSettings.orderDirection;\n if (self.getHeaderByName(self.orderBy) && self.orderDirection) {\n self.order(self.orderBy, self.orderDirection);\n }\n }\n };\n self.getFontHeight = function (fontStyle) {\n return parseFloat(fontStyle, 10);\n };\n self.parseFont = function (key) {\n if (/Font/.test(key)) {\n self.style[key + 'Height'] = self.getFontHeight(self.style[key]);\n }\n };\n self.initProp = function (propName) {\n if (!self.args[propName]) { return; }\n Object.keys(self.args[propName]).forEach(function (key) {\n self[propName][key] = self.args[propName][key];\n });\n };\n self.init = function () {\n var publicStyleKeyIntf = {};\n self.setAttributes();\n self.setStyle();\n self.initScrollBox();\n self.setDom();\n self.type = 'canvas-datagrid';\n Object.keys(self.style).forEach(self.parseFont);\n self.intf.type = self.type;\n self.intf.addEventListener = self.addEventListener;\n self.intf.removeEventListener = self.removeEventListener;\n self.intf.dispatchEvent = self.dispatchEvent;\n self.intf.dispose = self.dispose;\n self.intf.appendTo = self.appendTo;\n self.intf.filters = self.filters;\n self.intf.sorters = self.sorters;\n self.intf.autosize = self.autosize;\n self.intf.beginEditAt = self.beginEditAt;\n self.intf.endEdit = self.endEdit;\n self.intf.setActiveCell = self.setActiveCell;\n self.intf.scrollIntoView = self.scrollIntoView;\n self.intf.clearChangeLog = self.clearChangeLog;\n self.intf.gotoCell = self.gotoCell;\n self.intf.gotoRow = self.gotoRow;\n self.intf.findColumnScrollLeft = self.findColumnScrollLeft;\n self.intf.findRowScrollTop = self.findRowScrollTop;\n self.intf.fitColumnToValues = self.fitColumnToValues;\n self.intf.findColumnMaxTextLength = self.findColumnMaxTextLength;\n self.intf.disposeContextMenu = self.disposeContextMenu;\n self.intf.getCellAt = self.getCellAt;\n self.intf.isCellVisible = self.isCellVisible;\n self.intf.order = self.order;\n self.intf.draw = self.draw;\n self.intf.selectArea = self.selectArea;\n self.intf.clipElement = self.clipElement;\n self.intf.getSchemaFromData = self.getSchemaFromData;\n self.intf.setFilter = self.setFilter;\n self.intf.selectRow = self.selectRow;\n self.intf.parentGrid = self.parentGrid;\n self.intf.toggleTree = self.toggleTree;\n self.intf.expandTree = self.expandTree;\n self.intf.collapseTree = self.collapseTree;\n self.intf.canvas = self.canvas;\n self.intf.context = self.ctx;\n self.intf.insertRow = self.insertRow;\n self.intf.deleteRow = self.deleteRow;\n self.intf.addRow = self.addRow;\n self.intf.insertColumn = self.insertColumn;\n self.intf.deleteColumn = self.deleteColumn;\n self.intf.addColumn = self.addColumn;\n self.intf.getClippingRect = self.getClippingRect;\n self.intf.setRowHeight = self.setRowHeight;\n self.intf.setColumnWidth = self.setColumnWidth;\n self.intf.resetColumnWidths = self.resetColumnWidths;\n self.intf.resetRowHeights = self.resetRowHeights;\n self.intf.resize = self.resize;\n self.intf.selectColumn = self.selectColumn;\n self.intf.selectRow = self.selectRow;\n self.intf.selectAll = self.selectAll;\n self.intf.drawChildGrids = self.drawChildGrids;\n self.intf.assertPxColor = self.assertPxColor;\n self.intf.clearPxColorAssertions = self.clearPxColorAssertions;\n self.intf.integerToAlpha = self.integerToAlpha;\n self.intf.style = {};\n Object.keys(self.style).forEach(function (key) {\n // unless this line is here, Object.keys() will not work on .style\n publicStyleKeyIntf[key] = undefined;\n Object.defineProperty(publicStyleKeyIntf, key, {\n get: function () {\n return self.style[key];\n },\n set: function (value) {\n self.parseFont(value);\n self.style[key] = value;\n self.draw(true);\n self.dispatchEvent('stylechanged', {name: key, value: value});\n }\n });\n });\n Object.defineProperty(self.intf, 'activeCell', {\n get: function () {\n return self.activeCell;\n }\n });\n /**\n * When true, the grid is has focus.\n * @memberof canvasDataGrid\n * @property hasFocus\n * @readonly\n */\n Object.defineProperty(self.intf, 'hasFocus', {\n get: function () {\n return self.hasFocus;\n }\n });\n Object.defineProperty(self.intf, 'style', {\n get: function () {\n return publicStyleKeyIntf;\n },\n set: function (value) {\n Object.keys(value).forEach(function (key) {\n self.parseFont(value);\n self.style[key] = value[key];\n });\n self.draw(true);\n self.dispatchEvent('stylechanged', {name: 'style', value: value});\n }\n });\n Object.keys(self.attributes).forEach(function (key) {\n Object.defineProperty(self.intf.attributes, key, {\n get: function () {\n return self.attributes[key];\n },\n set: function (value) {\n self.attributes[key] = value;\n self.draw(true);\n self.dispatchEvent('attributechanged', {name: key, value: value[key]});\n }\n });\n });\n self.filters.string = function (value, filterFor) {\n if (!filterFor) { return true; }\n var filterRegExp;\n self.invalidFilterRegEx = undefined;\n try {\n filterRegExp = new RegExp(filterFor, 'ig');\n } catch (e) {\n self.invalidFilterRegEx = e;\n return;\n }\n return filterRegExp.test(value);\n };\n self.filters.number = function (value, filterFor) {\n if (!filterFor) { return true; }\n return value === filterFor;\n };\n if (self.attributes.name && self.attributes.saveAppearance) {\n self.storedSettings = localStorage.getItem(self.storageName + '-' + self.attributes.name);\n if (self.storedSettings) {\n try {\n self.storedSettings = JSON.parse(self.storedSettings);\n } catch (e) {\n console.warn('could not read settings from localStore', e);\n self.storedSettings = undefined;\n }\n }\n if (self.storedSettings) {\n if (typeof self.storedSettings.sizes === 'object') {\n self.sizes.rows = self.storedSettings.sizes.rows;\n self.sizes.columns = self.storedSettings.sizes.columns;\n ['trees', 'columns', 'rows'].forEach(function (i) {\n if (!self.sizes[i]) {\n self.sizes[i] = {};\n }\n });\n }\n }\n }\n ['formatters', 'filters', 'sorters'].forEach(self.initProp);\n if (self.args.data) {\n self.intf.data = self.args.data;\n }\n if (!self.data) {\n self.intf.data = [];\n }\n if (self.args.schema) {\n self.intf.schema = self.args.schema;\n }\n if (self.isChildGrid) {\n requestAnimationFrame(function () { self.resize(true); });\n } else {\n self.resize(true);\n }\n };\n /**\n * Removes focus from the grid.\n * @memberof canvasDataGrid\n * @name blur\n * @method\n */\n self.intf.blur = function (e) {\n self.hasFocus = false;\n };\n /**\n * Focuses on the grid.\n * @memberof canvasDataGrid\n * @name focus\n * @method\n */\n self.intf.focus = function () {\n self.hasFocus = true;\n self.controlInput.focus();\n };\n Object.defineProperty(self.intf, 'height', {\n get: function () {\n return self.parentNode.height;\n },\n set: function (value) {\n self.parentNode.height = value;\n self.resize(true);\n }\n });\n Object.defineProperty(self.intf, 'width', {\n get: function () {\n return self.parentNode.width;\n },\n set: function (value) {\n self.parentNode.width = value;\n self.resize(true);\n }\n });\n Object.defineProperty(self.intf, 'openChildren', {\n get: function () {\n return self.openChildren;\n }\n });\n Object.defineProperty(self.intf, 'childGrids', {\n get: function () {\n return Object.keys(self.childGrids).map(function (gridId) {\n return self.childGrids[gridId];\n });\n }\n });\n Object.defineProperty(self.intf, 'isChildGrid', {\n get: function () {\n return self.isChildGrid;\n }\n });\n Object.defineProperty(self.intf, 'parentNode', {\n get: function () {\n return self.parentNode;\n },\n set: function (value) {\n self.parentNode = value;\n }\n });\n Object.defineProperty(self.intf, 'offsetParent', {\n get: function () {\n return self.parentNode;\n },\n set: function (value) {\n self.parentNode = value;\n }\n });\n Object.defineProperty(self.intf, 'offsetLeft', {\n get: function () {\n return self.parentNode.offsetLeft;\n }\n });\n Object.defineProperty(self.intf, 'offsetTop', {\n get: function () {\n return self.parentNode.offsetTop;\n }\n });\n Object.defineProperty(self.intf, 'scrollHeight', {\n get: function () {\n return self.scrollBox.scrollHeight;\n }\n });\n Object.defineProperty(self.intf, 'scrollWidth', {\n get: function () {\n return self.scrollBox.scrollWidth;\n }\n });\n Object.defineProperty(self.intf, 'scrollTop', {\n get: function () {\n return self.scrollBox.scrollTop;\n },\n set: function (value) {\n self.scrollBox.scrollTop = value;\n }\n });\n Object.defineProperty(self.intf, 'scrollLeft', {\n get: function () {\n return self.scrollBox.scrollLeft;\n },\n set: function (value) {\n self.scrollBox.scrollLeft = value;\n }\n });\n Object.defineProperty(self.intf, 'sizes', {\n get: function () {\n return self.sizes;\n }\n });\n Object.defineProperty(self.intf, 'input', {\n get: function () {\n return self.input;\n }\n });\n Object.defineProperty(self.intf, 'controlInput', {\n get: function () {\n return self.controlInput;\n }\n });\n Object.defineProperty(self.intf, 'currentCell', {\n get: function () {\n return self.currentCell;\n }\n });\n Object.defineProperty(self.intf, 'visibleCells', {\n get: function () {\n return self.visibleCells;\n }\n });\n Object.defineProperty(self.intf, 'visibleRows', {\n get: function () {\n return self.visibleRows;\n }\n });\n Object.defineProperty(self.intf, 'selections', {\n get: function () {\n return self.selections;\n }\n });\n Object.defineProperty(self.intf, 'dragMode', {\n get: function () {\n return self.dragMode;\n }\n });\n Object.defineProperty(self.intf, 'changes', {\n get: function () {\n return self.changes;\n }\n });\n self.intf.attributes = {};\n self.intf.formatters = self.formatters;\n self.normalizeDataset = function (data) {\n var i, d, max, syncFnInvoked;\n if (data === null || data === '' || data === undefined) {\n return [];\n }\n if (typeof data === 'string'\n || typeof data === 'number'\n || typeof data === 'boolean') {\n data = [{'0': data}];\n }\n if (!Array.isArray(data) && typeof data === 'object') {\n data = [data];\n }\n if ((!Array.isArray(data[0]) && typeof data[0] === 'object')\n || (Array.isArray(data) && data.length === 0)) {\n return data;\n }\n if (typeof data === 'function') {\n i = data.apply(self.intf, [function (d) {\n if (syncFnInvoked) {\n console.warn('Detected a callback to the data setter function after the same function already returned a value synchronously.');\n }\n self.normalizeDataset(d);\n }]);\n if (i) {\n syncFnInvoked = true;\n self.normalizeDataset(i);\n }\n }\n if (!Array.isArray(data) && typeof data === 'object') {\n data = [data];\n }\n if (Array.isArray(data)) {\n if (!Array.isArray(data[0])) {\n //array of something? throw it all into 1 row!\n data = [data];\n }\n // find the longest length\n max = 0;\n d = [];\n data.forEach(function (row) {\n max = Math.max(max, row.length);\n });\n // map against length indexes\n data.forEach(function (row, index) {\n var x;\n d[index] = {};\n for (x = 0; x < max; x += 1) {\n d[index][x] = row[x] || null;\n }\n });\n return d;\n }\n throw new Error('Unsupported data type. Must be an array of arrays or an array of objects, function or string.');\n };\n Object.defineProperty(self.intf, 'selectionBounds', {\n get: function () {\n return self.getSelectionBounds();\n }\n });\n Object.defineProperty(self.intf, 'selectedRows', {\n get: function () {\n return self.getSelectedData(true);\n }\n });\n Object.defineProperty(self.intf, 'selectedCells', {\n get: function () {\n return self.getSelectedData();\n }\n });\n Object.defineProperty(self.intf, 'visibleSchema', {\n get: function () {\n return self.getVisibleSchema().map(function eachDataRow(col) {\n return col;\n });\n }\n });\n Object.defineProperty(self.intf, 'ctx', {\n get: function () {\n return self.ctx;\n }\n });\n Object.defineProperty(self.intf, 'schema', {\n get: function schemaGetter() {\n return self.getSchema();\n },\n set: function schemaSetter(value) {\n if (!Array.isArray(value) || typeof value[0] !== 'object') {\n throw new Error('Schema must be an array of objects.');\n }\n if (value[0].name === undefined) {\n throw new Error('Expected schema to contain an object with at least a name property.');\n }\n self.schema = value.map(function eachSchemaColumn(column, index) {\n column.width = column.width || self.style.columnWidth;\n column[self.uniqueId] = self.getSchemaNameHash(column.name);\n column.filter = column.filter || self.filter(column.type);\n column.type = column.type || 'string';\n column.index = index;\n column.columnIndex = index;\n column.rowIndex = -1;\n return column;\n });\n self.tempSchema = undefined;\n self.createNewRowData();\n self.createColumnOrders();\n self.tryLoadStoredOrders();\n self.resize(true);\n self.dispatchEvent('schemachanged', {schema: self.schema});\n }\n });\n Object.defineProperty(self.intf, 'data', {\n get: function dataGetter() {\n return self.data.map(function (row) {\n delete row[self.uniqueId];\n return row;\n });\n },\n set: function dataSetter(value) {\n self.originalData = self.normalizeDataset(value).map(function eachDataRow(row) {\n row[self.uniqueId] = self.uId;\n self.uId += 1;\n return row;\n });\n self.changes = [];\n //TODO apply filter to incoming dataset\n self.data = self.originalData;\n if (!self.schema && self.data.length > 0) {\n self.tempSchema = self.getSchemaFromData();\n }\n if (!self.schema && self.data.length === 0) {\n self.tempSchema = [{name: ''}];\n self.tempSchema[0][self.uniqueId] = self.getSchemaNameHash('');\n }\n if (self.tempSchema && !self.schema) {\n self.createColumnOrders();\n self.tryLoadStoredOrders();\n self.dispatchEvent('schemachanged', {schema: self.tempSchema});\n }\n self.createNewRowData();\n if (self.attributes.autoResizeColumns && self.data.length > 0\n && self.storedSettings === undefined) {\n self.autosize();\n }\n self.fitColumnToValues('cornerCell', true);\n if (!self.resize() || !self.isChildGrid) { self.draw(true); }\n self.createRowOrders();\n self.tryLoadStoredOrders();\n self.dispatchEvent('datachanged', {data: self.data});\n }\n });\n self.initScrollBox = function () {\n var sHeight = 0,\n sWidth = 0,\n scrollTop = 0,\n scrollLeft = 0,\n scrollHeight = 0,\n scrollWidth = 0,\n scrollBoxHeight = 20,\n scrollBoxWidth = 20;\n function setScrollTop(value, preventScrollEvent) {\n if (isNaN(value)) {\n throw new Error('ScrollTop value must be a number');\n }\n if (value < 0) {\n value = 0;\n }\n if (value > scrollHeight) {\n value = scrollHeight;\n }\n if (scrollHeight < 0) {\n value = 0;\n }\n scrollTop = value;\n if (!preventScrollEvent) {\n self.scroll();\n }\n }\n function setScrollLeft(value, preventScrollEvent) {\n if (isNaN(value)) {\n throw new Error('ScrollLeft value must be a number');\n }\n if (value < 0) {\n value = 0;\n }\n if (value > scrollWidth) {\n value = scrollWidth;\n }\n if (scrollWidth < 0) {\n value = 0;\n }\n scrollLeft = value;\n if (!preventScrollEvent) {\n self.scroll();\n }\n }\n self.scrollBox.scrollTo = function (x, y) {\n setScrollLeft(x, true);\n setScrollTop(y);\n };\n Object.defineProperty(self.scrollBox, 'scrollBoxHeight', {\n get: function () {\n return scrollBoxHeight;\n },\n set: function (value) {\n scrollBoxHeight = value;\n }\n });\n Object.defineProperty(self.scrollBox, 'scrollBoxWidth', {\n get: function () {\n return scrollBoxWidth;\n },\n set: function (value) {\n scrollBoxWidth = value;\n }\n });\n Object.defineProperty(self.scrollBox, 'height', {\n get: function () {\n return sHeight;\n },\n set: function (value) {\n if (scrollHeight < value) {\n scrollTop = 0;\n }\n sHeight = value;\n }\n });\n Object.defineProperty(self.scrollBox, 'width', {\n get: function () {\n return sWidth;\n },\n set: function (value) {\n sWidth = value;\n }\n });\n Object.defineProperty(self.scrollBox, 'scrollTop', {\n get: function () {\n return scrollTop;\n },\n set: setScrollTop\n });\n Object.defineProperty(self.scrollBox, 'scrollLeft', {\n get: function () {\n return scrollLeft;\n },\n set: setScrollLeft\n });\n Object.defineProperty(self.scrollBox, 'scrollHeight', {\n get: function () {\n return scrollHeight;\n },\n set: function (value) {\n if (scrollTop > value) {\n scrollTop = Math.max(value, 0);\n }\n if (scrollHeight < sHeight) {\n scrollTop = 0;\n }\n scrollHeight = value;\n }\n });\n Object.defineProperty(self.scrollBox, 'scrollWidth', {\n get: function () {\n return scrollWidth;\n },\n set: function (value) {\n if (scrollLeft > value) {\n scrollLeft = Math.max(value, 0);\n }\n scrollWidth = value;\n }\n });\n };\n return;\n };\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/intf.js\n// module id = 3\n// module chunks = 0","/*jslint browser: true, unparam: true, todo: true*/\n/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false, Event: false*/\ndefine([], function () {\n 'use strict';\n return function (self) {\n var zIndexTop = 2, hoverScrollTimeout, autoCompleteContext;\n function createContextMenu(ev, pos, items, parentContextMenu) {\n var container = document.createElement('div'),\n upArrow = document.createElement('div'),\n downArrow = document.createElement('div'),\n children = [],\n selectedIndex = -1,\n intf = {},\n rect;\n if (!Array.isArray(items)) { throw new Error('createContextMenu expects an array.'); }\n function createItems() {\n items.forEach(function (item) {\n var contextItemContainer = document.createElement('div'),\n childMenuArrow;\n function removeChildContext(e) {\n if (e.relatedTarget === container\n || item.contextMenu.container === e.relatedTarget\n || childMenuArrow === e.relatedTarget\n || (contextItemContainer === e.relatedTarget)\n ) { return; }\n item.contextMenu.dispose();\n children.splice(children.indexOf(item.contextMenu), 1);\n item.contextMenu = undefined;\n contextItemContainer.removeEventListener('mouseout', removeChildContext);\n container.removeEventListener('mouseout', removeChildContext);\n contextItemContainer.setAttribute('contextOpen', '0');\n contextItemContainer.setAttribute('opening', '0');\n }\n function contextAddCallback(items) {\n // check yet again if the user hasn't moved off\n if (contextItemContainer.getAttribute('opening') !== '1' ||\n contextItemContainer.getAttribute('contextOpen') === '1') {\n return;\n }\n var cPos = contextItemContainer.getBoundingClientRect();\n cPos = {\n left: cPos.left + self.style.childContextMenuMarginLeft + container.offsetWidth,\n top: cPos.top + self.style.childContextMenuMarginTop,\n bottom: cPos.bottom,\n right: cPos.right,\n };\n item.contextMenu = createContextMenu(ev, cPos, items, intf);\n contextItemContainer.setAttribute('contextOpen', '1');\n contextItemContainer.addEventListener('mouseout', removeChildContext);\n container.addEventListener('mouseout', removeChildContext);\n children.push(item.contextMenu);\n }\n function createChildContext() {\n var i;\n if (contextItemContainer.getAttribute('contextOpen') === '1') {\n return;\n }\n contextItemContainer.setAttribute('opening', '1');\n if (typeof item.items === 'function') {\n i = item.items.apply(intf, [function (items) {\n contextAddCallback(items);\n }]);\n if (i !== undefined && Array.isArray(i)) {\n contextAddCallback(i);\n }\n return;\n }\n contextAddCallback(item.items);\n }\n function addItem(item) {\n function addContent(content) {\n if (typeof content === 'function') {\n return addContent(content(ev));\n }\n if (typeof content === 'object') {\n contextItemContainer.appendChild(content);\n return;\n }\n self.createInlineStyle(contextItemContainer, 'canvas-datagrid-context-menu-item');\n contextItemContainer.addEventListener('mouseover', function () {\n self.createInlineStyle(contextItemContainer, 'canvas-datagrid-context-menu-item:hover');\n });\n contextItemContainer.addEventListener('mouseout', function () {\n self.createInlineStyle(contextItemContainer, 'canvas-datagrid-context-menu-item');\n });\n contextItemContainer.innerHTML = content;\n return;\n }\n addContent(item.title);\n item.contextItemContainer = contextItemContainer;\n if (item.items && item.items.length > 0) {\n childMenuArrow = document.createElement('div');\n self.createInlineStyle(childMenuArrow, 'canvas-datagrid-context-child-arrow');\n childMenuArrow.innerHTML = self.style.childContextMenuArrowHTML;\n contextItemContainer.appendChild(childMenuArrow);\n contextItemContainer.addEventListener('mouseover', createChildContext);\n contextItemContainer.addEventListener('mouseout', function () {\n contextItemContainer.setAttribute('opening', '0');\n });\n }\n if (item.click) {\n contextItemContainer.addEventListener('click', function (ev) {\n item.click.apply(self, [ev]);\n });\n }\n }\n addItem(item);\n container.appendChild(contextItemContainer);\n });\n }\n function clickIndex(idx) {\n items[idx].contextItemContainer.dispatchEvent(new Event('click'));\n }\n function checkArrowVisibility() {\n if (container.scrollTop > 0) {\n document.body.appendChild(upArrow);\n } else if (upArrow.parentNode) {\n upArrow.parentNode.removeChild(upArrow);\n }\n if (container.scrollTop >= container.scrollHeight - container.offsetHeight && downArrow.parentNode) {\n downArrow.parentNode.removeChild(downArrow);\n } else if (container.scrollHeight - container.offsetHeight > 0\n && !(container.scrollTop >= container.scrollHeight - container.offsetHeight)) {\n document.body.appendChild(downArrow);\n }\n }\n function startHoverScroll(type) {\n return function t() {\n var a = self.attributes.contextHoverScrollAmount;\n if (type === 'up' && container.scrollTop === 0) { return; }\n if (type === 'down' && container.scrollTop === container.scrollHeight) { return; }\n container.scrollTop += (type === 'up' ? -a : a);\n hoverScrollTimeout = setTimeout(t, self.attributes.contextHoverScrollRateMs, type);\n };\n }\n function endHoverScroll(type) {\n return function () {\n clearTimeout(hoverScrollTimeout);\n };\n }\n function init() {\n var loc = {},\n s = self.scrollOffset(self.canvas);\n createItems();\n self.createInlineStyle(container, 'canvas-datagrid-context-menu');\n loc.x = pos.left - s.left;\n loc.y = pos.top - s.top;\n loc.height = 0;\n zIndexTop += 1;\n container.style.position = 'absolute';\n upArrow.style.color = self.style.contextMenuArrowColor;\n downArrow.style.color = self.style.contextMenuArrowColor;\n [upArrow, downArrow].forEach(function (el) {\n el.style.textAlign = 'center';\n el.style.position = 'absolute';\n el.style.zIndex = zIndexTop + 1;\n });\n container.style.zIndex = zIndexTop;\n if (parentContextMenu && parentContextMenu.inputDropdown) {\n container.style.maxHeight = window.innerHeight - loc.y - self.style.autocompleteBottomMargin + 'px';\n container.style.minWidth = pos.width + 'px';\n loc.y += pos.height;\n }\n container.style.left = loc.x + 'px';\n container.style.top = loc.y + 'px';\n container.addEventListener('scroll', checkArrowVisibility);\n container.addEventListener('wheel', function (e) {\n if (self.hasFocus) {\n container.scrollTop += e.deltaY;\n container.scrollLeft += e.deltaX;\n }\n checkArrowVisibility();\n });\n upArrow.innerHTML = self.style.contextMenuArrowUpHTML;\n downArrow.innerHTML = self.style.contextMenuArrowDownHTML;\n container.appendChild(upArrow);\n document.body.appendChild(downArrow);\n document.body.appendChild(container);\n rect = container.getBoundingClientRect();\n if (rect.bottom > window.innerHeight && !(parentContextMenu && parentContextMenu.inputDropdown)) {\n loc.y = window.innerHeight - container.offsetHeight;\n if (loc.y < 0) { loc.y = 0; }\n if (container.offsetHeight > window.innerHeight) {\n container.style.height = window.innerHeight - self.style.contextMenuWindowMargin + 'px';\n }\n }\n if (rect.right > window.innerWidth) {\n if (parentContextMenu) {\n loc.x = parentContextMenu.container.offsetLeft - container.offsetWidth;\n } else {\n loc.x = window.innerWidth - container.offsetWidth;\n }\n }\n container.style.left = loc.x + 'px';\n container.style.top = loc.y + 'px';\n rect = container.getBoundingClientRect();\n upArrow.style.top = rect.top + 'px';\n downArrow.style.top = rect.top + rect.height - downArrow.offsetHeight + 'px';\n upArrow.style.left = rect.left + 'px';\n downArrow.style.left = rect.left + 'px';\n downArrow.style.width = container.offsetWidth + 'px';\n upArrow.style.width = container.offsetWidth + 'px';\n downArrow.addEventListener('mouseover', startHoverScroll('down'));\n downArrow.addEventListener('mouseout', endHoverScroll('down'));\n upArrow.addEventListener('mouseover', startHoverScroll('up'));\n upArrow.addEventListener('mouseout', endHoverScroll('up'));\n checkArrowVisibility();\n }\n intf.parentGrid = self.intf;\n intf.parentContextMenu = parentContextMenu;\n intf.container = container;\n init();\n intf.clickIndex = clickIndex;\n intf.rect = rect;\n intf.items = items;\n intf.upArrow = upArrow;\n intf.downArrow = downArrow;\n intf.dispose = function () {\n clearTimeout(hoverScrollTimeout);\n children.forEach(function (c) {\n c.dispose();\n });\n [downArrow, upArrow, container].forEach(function (el) {\n if (el.parentNode) { el.parentNode.removeChild(el); }\n });\n };\n Object.defineProperty(intf, 'selectedIndex', {\n get: function () {\n return selectedIndex;\n },\n set: function (value) {\n if (typeof value !== 'number' || isNaN(value || !isFinite(value))) {\n throw new Error('Context menu selected index must be a sane number.');\n }\n selectedIndex = value;\n if (selectedIndex > items.length - 1) {\n selectedIndex = items.length - 1;\n }\n if (selectedIndex < 0) {\n selectedIndex = 0;\n }\n items.forEach(function (item, index) {\n if (index === selectedIndex) {\n return self.createInlineStyle(item.contextItemContainer, 'canvas-datagrid-context-menu-item:hover');\n }\n self.createInlineStyle(item.contextItemContainer, 'canvas-datagrid-context-menu-item');\n });\n }\n });\n return intf;\n }\n function createFilterContextMenuItems(e) {\n var filterContainer = document.createElement('div'),\n filterLabel = document.createElement('div'),\n filterAutoCompleteButton = document.createElement('button'),\n filterInput = document.createElement('input'),\n n = e.cell && e.cell.header ? e.cell.header.title || e.cell.header.name : '',\n autoCompleteItems,\n iRect;\n function fillAutoComplete() {\n autoCompleteItems = {};\n self.data.forEach(function (row) {\n var value = row[e.cell.header.name];\n if (autoCompleteItems[value]) { return; }\n autoCompleteItems[value] = {\n title: self.formatters[e.cell.header.type || 'string']({ cell: { value: value }}),\n click: function (e) {\n filterInput.value = value;\n e.stopPropagation();\n filterInput.dispatchEvent(new Event('keyup'));\n self.disposeAutocomplete();\n return;\n }\n };\n });\n autoCompleteItems = Object.keys(autoCompleteItems).map(function (key) {\n return autoCompleteItems[key];\n });\n }\n function createAutoCompleteContext(ev) {\n if (ev && [40, 38, 13, 9, 27].indexOf(ev.keyCode) !== -1) { return; }\n fillAutoComplete();\n iRect = filterInput.getBoundingClientRect();\n if (autoCompleteContext) {\n autoCompleteContext.dispose();\n autoCompleteContext = undefined;\n }\n autoCompleteContext = createContextMenu(e, {\n left: iRect.left,\n top: iRect.top,\n right: iRect.right,\n bottom: iRect.bottom,\n height: iRect.height,\n width: iRect.width\n }, autoCompleteItems, {inputDropdown: true});\n autoCompleteContext.selectedIndex = 0;\n }\n self.createInlineStyle(filterLabel, 'canvas-datagrid-context-menu-label');\n self.createInlineStyle(filterAutoCompleteButton, 'canvas-datagrid-context-menu-filter-button');\n self.createInlineStyle(filterInput, 'canvas-datagrid-context-menu-filter-input');\n filterInput.onclick = self.disposeAutocomplete;\n filterInput.addEventListener('keydown', function (e) {\n //down\n if (e.keyCode === 40) {\n autoCompleteContext.selectedIndex += 1;\n }\n //up\n if (e.keyCode === 38) {\n autoCompleteContext.selectedIndex -= 1;\n }\n //enter\n if (e.keyCode === 13) {\n autoCompleteContext.clickIndex(autoCompleteContext.selectedIndex);\n self.disposeContextMenu();\n }\n //tab\n if (e.keyCode === 9) {\n autoCompleteContext.clickIndex(autoCompleteContext.selectedIndex);\n e.preventDefault();\n }\n //esc\n if (e.keyCode === 27) {\n self.disposeContextMenu();\n }\n });\n filterInput.addEventListener('keyup', function () {\n self.setFilter(e.cell.header.name, filterInput.value);\n });\n filterInput.addEventListener('keyup', createAutoCompleteContext);\n filterInput.value = e.cell.header ? self.columnFilters[e.cell.header.name] || '' : '';\n filterLabel.innerHTML = self.attributes.filterOptionText.replace(/%s/g, n);\n filterAutoCompleteButton.onclick = function () {\n if (autoCompleteContext) {\n return self.disposeAutocomplete();\n }\n createAutoCompleteContext();\n };\n filterAutoCompleteButton.innerHTML = self.style.contextFilterButtonHTML;\n filterContainer.addEventListener('click', function (e) {\n return e.stopPropagation();\n });\n filterContainer.appendChild(filterLabel);\n filterContainer.appendChild(filterInput);\n filterContainer.appendChild(filterAutoCompleteButton);\n e.items.push({\n title: filterContainer\n });\n if (Object.keys(self.columnFilters).length) {\n Object.keys(self.columnFilters).forEach(function (cf) {\n var h = self.getHeaderByName(cf);\n e.items.push({\n title: self.attributes.removeFilterOptionText.replace(/%s/g, h.title || h.name),\n click: function removeFilterClick(e) {\n e.preventDefault();\n self.setFilter(cf, '');\n self.controlInput.focus();\n }\n });\n });\n }\n }\n function addDefaultContextMenuItem(e) {\n var isNormalCell = !(e.cell.isBackground || e.cell.isHeaderCellCap\n || e.cell.isScrollBar || e.cell.isCorner || e.cell.isRowHeader)\n && e.cell.header;\n if (self.attributes.showFilter && isNormalCell) {\n createFilterContextMenuItems(e);\n }\n if (self.attributes.showCopy\n && self.selections.reduce(function (p, r) {\n return p + r.length;\n }, 0) > 0) {\n e.items.push({\n title: self.attributes.copyText,\n click: function () {\n document.execCommand('copy');\n self.disposeContextMenu();\n self.controlInput.focus();\n }\n });\n }\n if (self.attributes.saveAppearance && self.attributes.showClearSettingsOption\n && (Object.keys(self.sizes.rows).length > 0\n || Object.keys(self.sizes.columns).length > 0)) {\n e.items.push({\n title: self.attributes.clearSettingsOptionText,\n click: function (e) {\n e.preventDefault();\n self.sizes.rows = {};\n self.sizes.columns = {};\n self.createRowOrders();\n self.createColumnOrders();\n self.storedSettings = undefined;\n self.dispatchEvent('resizecolumn', {columnWidth: self.style.columnWidth});\n self.dispatchEvent('resizerow', {cellHeight: self.style.cellHeight});\n self.setStorageData();\n self.resize(true);\n self.disposeContextMenu();\n self.controlInput.focus();\n }\n });\n }\n if (self.attributes.allowSorting && self.attributes.showOrderByOption && isNormalCell) {\n e.items.push({\n title: self.attributes.showOrderByOptionTextAsc.replace('%s', e.cell.header.title || e.cell.header.name),\n click: function (ev) {\n ev.preventDefault();\n self.order(e.cell.header.name, 'asc');\n self.controlInput.focus();\n }\n });\n e.items.push({\n title: self.attributes.showOrderByOptionTextDesc.replace('%s', e.cell.header.title || e.cell.header.name),\n click: function (ev) {\n ev.preventDefault();\n self.order(e.cell.header.name, 'desc');\n self.disposeContextMenu();\n self.controlInput.focus();\n }\n });\n }\n }\n self.disposeAutocomplete = function () {\n if (autoCompleteContext) {\n autoCompleteContext.dispose();\n autoCompleteContext = undefined;\n }\n };\n self.disposeContextMenu = function () {\n document.removeEventListener('click', self.disposeContextMenu);\n zIndexTop = 2;\n self.disposeAutocomplete();\n if (self.contextMenu) {\n self.contextMenu.dispose();\n }\n self.contextMenu = undefined;\n };\n self.contextmenuEvent = function (e, overridePos) {\n if (!self.hasFocus && e.target !== self.canvas) {\n return;\n }\n var items = [],\n pos = overridePos || self.getLayerPos(e, true),\n ev = {\n NativeEvent: e,\n cell: self.getCellAt(pos.x, pos.y),\n items: items\n };\n if (!ev.cell.isGrid) {\n addDefaultContextMenuItem(ev);\n }\n if (self.dispatchEvent('contextmenu', ev)) {\n return;\n }\n if (!ev.cell.isGrid) {\n if (self.contextMenu) {\n self.disposeContextMenu();\n }\n self.contextMenu = createContextMenu(ev, {\n left: pos.x + pos.rect.left + self.style.contextMenuMarginLeft + self.canvasOffsetLeft,\n top: pos.y + pos.rect.top + self.style.contextMenuMarginTop + self.canvasOffsetTop,\n right: ev.cell.width + ev.cell.x + pos.rect.left,\n bottom: ev.cell.height + ev.cell.y + pos.rect.top,\n height: ev.cell.height,\n width: ev.cell.width\n }, items);\n document.addEventListener('click', self.disposeContextMenu);\n e.preventDefault();\n }\n };\n return;\n };\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/contextMenu.js\n// module id = 4\n// module chunks = 0","/*jslint browser: true, unparam: true, todo: true*/\n/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/\ndefine([], function () {\n 'use strict';\n return function (self) {\n self.defaults = {\n attributes: [\n ['name', ''],\n ['tree', false],\n ['showNewRow', false],\n ['treeHorizontalScroll', false],\n ['saveAppearance', true],\n ['selectionFollowsActiveCell', false],\n ['multiLine', false],\n ['editable', true],\n ['allowColumnReordering', true],\n ['allowRowReordering', false],\n ['allowSorting', true],\n ['showFilter', true],\n ['globalRowResize', false],\n ['pageUpDownOverlap', 1],\n ['persistantSelectionMode', false],\n ['rowSelectionMode', false],\n ['autoResizeColumns', false],\n ['allowRowHeaderResize', true],\n ['allowColumnResize', true],\n ['allowRowResize', true],\n ['allowRowResizeFromCell', false],\n ['allowColumnResizeFromCell', false],\n ['debug', false],\n ['borderResizeZone', 10],\n ['showColumnHeaders', true],\n ['showRowNumbers', true],\n ['showRowHeaders', true],\n ['scrollRepeatRate', 75],\n ['selectionScrollZone', 20],\n ['resizeScrollZone', 20],\n ['contextHoverScrollRateMs', 5],\n ['contextHoverScrollAmount', 2],\n ['selectionScrollIncrement', 20],\n ['reorderDeadZone', 3],\n ['showClearSettingsOption', true],\n ['showOrderByOption', true],\n ['clearSettingsOptionText', 'Clear saved settings'],\n ['showOrderByOptionTextAsc', 'Order by %s ascending'],\n ['showOrderByOptionTextDesc', 'Order by %s descending'],\n ['removeFilterOptionText', 'Remove filter on %s'],\n ['filterOptionText', 'Filter %s'],\n ['filterTextPrefix', '(filtered) '],\n ['touchReleaseAnimationDurationMs', 1000],\n ['touchReleaseAcceleration', 30],\n ['touchDeadZone', 3],\n ['touchSelectTimeMs', 800],\n ['touchScrollZone', 40],\n ['copyText', 'Copy'],\n ['showCopy', true],\n ['columnHeaderClickBehavior', 'sort'],\n ['scrollPointerLock', true]\n ],\n styles: [\n ['activeCellBackgroundColor', 'rgba(255, 255, 255, 1)'],\n ['activeCellBorderColor', 'rgba(110, 168, 255, 1)'],\n ['activeCellBorderWidth', 0.25],\n ['activeCellColor', 'rgba(0, 0, 0, 1)'],\n ['activeCellFont', '16px sans-serif'],\n ['activeCellHoverBackgroundColor', 'rgba(255, 255, 255, 1)'],\n ['activeCellHoverColor', 'rgba(0, 0, 0, 1)'],\n ['activeCellOverlayBorderColor', 'rgba(66, 133, 244, 1)'],\n ['activeCellOverlayBorderWidth', 0.5],\n ['activeCellPaddingBottom', 5],\n ['activeCellPaddingLeft', 5],\n ['activeCellPaddingRight', 7],\n ['activeCellPaddingTop', 5],\n ['activeCellSelectedBackgroundColor', 'rgba(236, 243, 255, 1)'],\n ['activeCellSelectedColor', 'rgba(0, 0, 0, 1)'],\n ['activeColumnHeaderCellBackgroundColor', 'rgba(225, 225, 225, 1)'],\n ['activeColumnHeaderCellColor', 'rgba(0, 0, 0, 1)'],\n ['activeRowHeaderCellBackgroundColor', 'rgba(225, 225, 225, 1)'],\n ['activeRowHeaderCellColor', 'rgba(0, 0, 0, 1)'],\n ['autocompleteBottomMargin', 60],\n ['autosizeHeaderCellPadding', 8],\n ['autosizePadding', 5],\n ['backgroundColor', 'rgba(240, 240, 240, 1)'],\n ['cellAutoResizePadding', 13],\n ['cellBackgroundColor', 'rgba(255, 255, 255, 1)'],\n ['cellBorderColor', 'rgba(195, 199, 202, 1)'],\n ['cellBorderWidth', 0.5],\n ['cellColor', 'rgba(0, 0, 0, 1)'],\n ['cellFont', '16px sans-serif'],\n ['cellGridHeight', 250],\n ['cellHeight', 24],\n ['cellHeightWithChildGrid', 150],\n ['cellHorizontalAlignment', 'left'],\n ['cellHoverBackgroundColor', 'rgba(255, 255, 255, 1)'],\n ['cellHoverColor', 'rgba(0, 0, 0, 1)'],\n ['cellPaddingBottom', 5],\n ['cellPaddingLeft', 5],\n ['cellPaddingRight', 7],\n ['cellPaddingTop', 5],\n ['cellSelectedBackgroundColor', 'rgba(236, 243, 255, 1)'],\n ['cellSelectedColor', 'rgba(0, 0, 0, 1)'],\n ['cellVerticalAlignment', 'center'],\n ['cellWidthWithChildGrid', 250],\n ['childContextMenuArrowColor', 'rgba(43, 48, 43, 1)'],\n ['childContextMenuArrowHTML', '►'],\n ['childContextMenuMarginLeft', -15],\n ['childContextMenuMarginTop', 0],\n ['columnHeaderCellBackgroundColor', 'rgba(240, 240, 240, 1)'],\n ['columnHeaderCellBorderColor', 'rgba(152, 152, 152, 1)'],\n ['columnHeaderCellBorderWidth', 0.25],\n ['columnHeaderCellColor', 'rgba(50, 50, 50, 1)'],\n ['columnHeaderCellFont', '16px sans-serif'],\n ['columnHeaderCellHeight', 25],\n ['columnHeaderCellHorizontalAlignment', 'left'],\n ['columnHeaderCellHoverBackgroundColor', 'rgba(235, 235, 235, 1)'],\n ['columnHeaderCellHoverColor', 'rgba(0, 0, 0, 1)'],\n ['columnHeaderCellPaddingBottom', 5],\n ['columnHeaderCellPaddingLeft', 5],\n ['columnHeaderCellPaddingRight', 7],\n ['columnHeaderCellPaddingTop', 5],\n ['columnHeaderCellVerticalAlignment', 'center'],\n ['columnWidth', 250],\n ['contextFilterButtonBorder', 'solid 1px rgba(158, 163, 169, 1)'],\n ['contextFilterButtonBorderRadius', '3px'],\n ['contextFilterButtonHTML', '▼'],\n ['contextFilterInputBackground', 'rgba(255,255,255,1)'],\n ['contextFilterInputBorder', 'solid 1px rgba(158, 163, 169, 1)'],\n ['contextFilterInputBorderRadius', '0'],\n ['contextFilterInputColor', 'rgba(0,0,0,1)'],\n ['contextFilterInputFontFamily', 'sans-serif'],\n ['contextFilterInputFontSize', '14px'],\n ['contextMenuArrowColor', 'rgba(43, 48, 43, 1)'],\n ['contextMenuArrowDownHTML', '▼'],\n ['contextMenuArrowUpHTML', '▲'],\n ['contextMenuBackground', 'rgba(240, 240, 240, 1)'],\n ['contextMenuBorder', 'solid 1px rgba(158, 163, 169, 1)'],\n ['contextMenuBorderRadius', '3px'],\n ['contextMenuChildArrowFontSize', '12px'],\n ['contextMenuColor', 'rgba(43, 48, 43, 1)'],\n ['contextMenuFilterButtonFontFamily', 'sans-serif'],\n ['contextMenuFilterButtonFontSize', '10px'],\n ['contextMenuFilterInvalidExpresion', 'rgba(237, 155, 156, 1)'],\n ['contextMenuFontFamily', 'sans-serif'],\n ['contextMenuFontSize', '16px'],\n ['contextMenuHoverBackground', 'rgba(182, 205, 250, 1)'],\n ['contextMenuHoverColor', 'rgba(43, 48, 153, 1)'],\n ['contextMenuItemBorderRadius', '3px'],\n ['contextMenuItemMargin', '2px'],\n ['contextMenuLabelDisplay', 'inline-block'],\n ['contextMenuLabelMargin', '0 3px 0 0'],\n ['contextMenuLabelMaxWidth', '700px'],\n ['contextMenuLabelMinWidth', '75px'],\n ['contextMenuMarginLeft', 3],\n ['contextMenuMarginTop', -3],\n ['contextMenuOpacity', '0.98'],\n ['contextMenuPadding', '2px'],\n ['contextMenuWindowMargin', 6],\n ['cornerCellBackgroundColor', 'rgba(240, 240, 240, 1)'],\n ['cornerCellBorderColor', 'rgba(202, 202, 202, 1)'],\n ['editCellBackgroundColor', 'white'],\n ['editCellBorder', 'solid 1px rgba(110, 168, 255, 1)'],\n ['editCellBoxShadow', '0 2px 5px rgba(0,0,0,0.4)'],\n ['editCellColor', 'black'],\n ['editCellFontFamily', 'sans-serif'],\n ['editCellFontSize', '16px'],\n ['editCellPaddingLeft', 4],\n ['gridBorderColor', 'rgba(202, 202, 202, 1)'],\n ['gridBorderWidth', 1],\n ['columnHeaderOrderByArrowBorderColor', 'rgba(195, 199, 202, 1)'],\n ['columnHeaderOrderByArrowBorderWidth', 1],\n ['columnHeaderOrderByArrowColor', 'rgba(155, 155, 155, 1)'],\n ['columnHeaderOrderByArrowHeight', 8],\n ['columnHeaderOrderByArrowMarginLeft', 0],\n ['columnHeaderOrderByArrowMarginRight', 5],\n ['columnHeaderOrderByArrowMarginTop', 6],\n ['columnHeaderOrderByArrowWidth', 13],\n ['minColumnWidth', 45],\n ['minHeight', 24],\n ['minRowHeight', 24],\n ['name', 'default'],\n ['reorderMarkerBackgroundColor', 'rgba(0, 0, 0, 0.1)'],\n ['reorderMarkerBorderColor', 'rgba(0, 0, 0, 0.2)'],\n ['reorderMarkerBorderWidth', 1.25],\n ['reorderMarkerIndexBorderColor', 'rgba(66, 133, 244, 1)'],\n ['reorderMarkerIndexBorderWidth', 2.75],\n ['rowHeaderCellBackgroundColor', 'rgba(240, 240, 240, 1)'],\n ['rowHeaderCellBorderColor', 'rgba(200, 200, 200, 1)'],\n ['rowHeaderCellBorderWidth', 1],\n ['rowHeaderCellColor', 'rgba(50, 50, 50, 1)'],\n ['rowHeaderCellFont', '16px sans-serif'],\n ['rowHeaderCellHeight', 25],\n ['rowHeaderCellHorizontalAlignment', 'left'],\n ['rowHeaderCellHoverBackgroundColor', 'rgba(235, 235, 235, 1)'],\n ['rowHeaderCellHoverColor', 'rgba(0, 0, 0, 1)'],\n ['rowHeaderCellPaddingBottom', 5],\n ['rowHeaderCellPaddingLeft', 5],\n ['rowHeaderCellPaddingRight', 5],\n ['rowHeaderCellPaddingTop', 5],\n ['rowHeaderCellSelectedBackgroundColor', 'rgba(217, 217, 217, 1)'],\n ['rowHeaderCellSelectedColor', 'rgba(50, 50, 50, 1)'],\n ['rowHeaderCellVerticalAlignment', 'center'],\n ['rowHeaderCellWidth', 57],\n ['scrollBarActiveColor', 'rgba(125, 125, 125, 1)'],\n ['scrollBarBackgroundColor', 'rgba(240, 240, 240, 1)'],\n ['scrollBarBorderColor', 'rgba(202, 202, 202, 1)'],\n ['scrollBarBorderWidth', 0.5],\n ['scrollBarBoxBorderRadius', 4.125],\n ['scrollBarBoxColor', 'rgba(192, 192, 192, 1)'],\n ['scrollBarBoxMargin', 2],\n ['scrollBarBoxMinSize', 15],\n ['scrollBarBoxWidth', 8],\n ['scrollBarCornerBackgroundColor', 'rgba(240, 240, 240, 1)'],\n ['scrollBarCornerBorderColor', 'rgba(202, 202, 202, 1)'],\n ['scrollBarWidth', 11],\n ['selectionOverlayBorderColor', 'rgba(66, 133, 244, 1)'],\n ['selectionOverlayBorderWidth', 0.75],\n ['treeArrowBorderColor', 'rgba(195, 199, 202, 1)'],\n ['treeArrowBorderWidth', 1],\n ['treeArrowClickRadius', 5],\n ['treeArrowColor', 'rgba(155, 155, 155, 1)'],\n ['treeArrowHeight', 8],\n ['treeArrowMarginLeft', 0],\n ['treeArrowMarginRight', 5],\n ['treeArrowMarginTop', 6],\n ['treeArrowWidth', 13],\n ['treeGridHeight', 250]\n ]\n };\n };\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/defaults.js\n// module id = 5\n// module chunks = 0","/*jslint browser: true, unparam: true, todo: true*/\n/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/\ndefine([], function () {\n 'use strict';\n return function (self) {\n /**\n * Ends editing, optionally aborting the edit.\n * @memberof canvasDataGrid\n * @name endEdit\n * @method\n * @param {boolean} abort When true, abort the edit.\n */\n self.endEdit = function (abort) {\n var cell = self.input.editCell,\n y = cell.rowIndex;\n function abortEdit() {\n abort = true;\n }\n if (self.dispatchEvent('beforeendedit', {\n cell: cell,\n newValue: self.input.value,\n oldValue: cell.value,\n abort: abortEdit,\n input: self.input\n })) { return false; }\n if (self.input.value !== cell.value && !abort) {\n self.changes[y] = self.changes[y] || {};\n self.changes[y][cell.header.name] = self.input.value;\n cell.data[cell.header.name] = self.input.value;\n if (y === self.data.length) {\n if (self.dispatchEvent('newrow', {\n value: self.input.value,\n defaultValue: cell.value,\n aborted: abort,\n cell: cell,\n input: self.input\n })) { return false; }\n self.uId += 1;\n self.addRow(cell.data);\n self.createNewRowData();\n }\n self.draw(true);\n }\n document.body.removeChild(self.input);\n self.controlInput.focus();\n self.dispatchEvent('endedit', {\n cell: cell,\n value: self.input.value,\n aborted: abort,\n input: self.input\n });\n self.input = undefined;\n return true;\n };\n /**\n * Begins editing at cell x, row y.\n * @memberof canvasDataGrid\n * @name beginEditAt\n * @method\n * @param {number} x The column index of the cell to edit.\n * @param {number} y The row index of the cell to edit.\n */\n self.beginEditAt = function (x, y) {\n if (!self.attributes.editable) { return; }\n var cell = self.getVisibleCellByIndex(x, y),\n s = self.getVisibleSchema(),\n enumItems;\n if (self.dispatchEvent('beforebeginedit', {cell: cell})) { return false; }\n self.scrollIntoView(x, y);\n self.setActiveCell(x, y);\n if (cell.header.enum) {\n self.input = document.createElement('select');\n } else {\n self.input = document.createElement(self.attributes.multiLine\n ? 'textarea' : 'input');\n }\n function postDraw() {\n var option, valueInEnum;\n cell = self.getVisibleCellByIndex(x, y);\n if (cell.header.enum) {\n // add enums\n if (typeof cell.header.enum === 'function') {\n enumItems = cell.header.enum.apply(self.intf, [{cell: cell}]);\n } else if (Array.isArray(cell.header.enum)) {\n enumItems = cell.header.enum;\n }\n enumItems.forEach(function (e) {\n var i = document.createElement('option'),\n val,\n title;\n if (Array.isArray(e)) {\n val = e[0];\n title = e[1];\n } else {\n val = e;\n title = e;\n }\n if (val === cell.value) { valueInEnum = true; }\n i.value = val;\n i.innerHTML = title;\n self.input.appendChild(i);\n });\n if (!valueInEnum) {\n option = document.createElement('option');\n option.value = cell.value;\n option.innerHTML = cell.value;\n self.input.appendChild(option);\n }\n self.input.addEventListener('change', function () {\n self.endEdit();\n self.draw(true);\n });\n }\n document.body.appendChild(self.input);\n self.createInlineStyle(self.input, 'canvas-datagrid-edit-input');\n self.input.style.position = 'absolute';\n self.input.editCell = cell;\n self.resizeEditInput();\n self.input.style.zIndex = '2';\n self.input.value = cell.value;\n self.input.focus();\n self.input.addEventListener('click', self.stopPropagation);\n self.input.addEventListener('dblclick', self.stopPropagation);\n self.input.addEventListener('mouseup', self.stopPropagation);\n self.input.addEventListener('mousedown', self.stopPropagation);\n self.input.addEventListener('keydown', function (e) {\n var nx = cell.columnIndex,\n ny = cell.rowIndex;\n // esc\n if (e.keyCode === 27) {\n self.endEdit(true);\n self.draw(true);\n // enter\n } else if (e.keyCode === 13\n && (!self.attributes.multiLine\n || (self.attributes.multiLine && e.shiftKey))) {\n self.endEdit();\n self.draw(true);\n } else if (e.keyCode === 9) {\n e.preventDefault();\n if (!self.endEdit()) {\n return;\n }\n if (e.shiftKey) {\n nx -= 1;\n } else {\n nx += 1;\n }\n if (nx < 0) {\n nx = s.length - 1;\n ny -= 1;\n }\n if (nx > s.length - 1) {\n nx = 0;\n ny += 1;\n }\n if (ny < 0) {\n ny = self.data.length - 1;\n }\n if (ny > self.data.length - 1) {\n ny = 0;\n }\n self.beginEditAt(nx, ny);\n }\n });\n }\n postDraw();\n self.dispatchEvent('beginedit', {cell: cell, input: self.input});\n };\n self.createInlineStyle = function (el, className) {\n var css = {\n 'canvas-datagrid-context-menu-filter-input': {\n height: '19px',\n verticalAlign: 'bottom',\n marginLeft: '2px',\n padding: '0',\n background: self.style.contextFilterInputBackground,\n color: self.style.contextFilterInputColor,\n border: self.style.contextFilterInputBorder,\n borderRadius: self.style.contextFilterInputBorderRadius,\n lineHeight: 'normal',\n fontWeight: 'normal',\n fontFamily: self.style.contextFilterInputFontFamily,\n fontSize: self.style.contextFilterInputFontSize\n },\n 'canvas-datagrid-context-menu-filter-button': {\n height: '19px',\n verticalAlign: 'bottom',\n marginLeft: '2px',\n padding: '0',\n background: self.style.contextMenuBackground,\n color: self.style.contextMenuColor,\n border: self.style.contextFilterButtonBorder,\n borderRadius: self.style.contextFilterButtonBorderRadius,\n lineHeight: 'normal',\n fontWeight: 'normal',\n fontFamily: self.style.contextMenuFilterButtonFontFamily,\n fontSize: self.style.contextMenuFilterButtonFontSize\n },\n 'canvas-datagrid-context-child-arrow': {\n cssFloat: 'right',\n color: self.style.childContextMenuArrowColor,\n fontSize: self.style.contextMenuChildArrowFontSize,\n fontFamily: self.style.contextMenuFontFamily,\n verticalAlign: 'middle'\n },\n 'canvas-datagrid-autocomplete': {\n fontFamily: self.style.contextMenuFontFamily,\n fontSize: self.style.contextMenuFontSize,\n background: self.style.contextMenuBackground,\n color: self.style.contextMenuColor,\n border: self.style.contextMenuBorder,\n padding: self.style.contextMenuPadding,\n borderRadius: self.style.contextMenuBorderRadius,\n opacity: self.style.contextMenuOpacity,\n position: 'absolute',\n zIndex: 3,\n overflow: 'hidden'\n },\n 'canvas-datagrid-autocomplete-item': {\n background: self.style.contextMenuBackground,\n color: self.style.contextMenuColor\n },\n 'canvas-datagrid-autocomplete-item:hover': {\n background: self.style.contextMenuHoverBackground,\n color: self.style.contextMenuHoverColor\n },\n 'canvas-datagrid-canvas': {\n position: 'absolute',\n zIndex: '-1'\n },\n 'canvas-datagrid': {\n position: 'absolute',\n background: self.style.backgroundColor,\n zIndex: '1',\n boxSizing: 'content-box',\n padding: '0'\n },\n 'canvas-datagrid-control-input': {\n position: 'fixed',\n top: '-5px',\n left: '-5px',\n border: 'none',\n opacity: '0',\n cursor: 'pointer',\n width: '1px',\n height: '1px',\n lineHeight: 'normal',\n fontWeight: 'normal',\n fontFamily: self.style.contextMenuFontFamily,\n fontSize: self.style.contextMenuFontSize\n },\n 'canvas-datagrid-edit-input': {\n boxSizing: 'content-box',\n outline: 'none',\n margin: '0',\n padding: '0 0 0 ' + self.style.editCellPaddingLeft + 'px',\n lineHeight: 'normal',\n fontWeight: 'normal',\n fontFamily: self.style.editCellFontFamily,\n fontSize: self.style.editCellFontSize,\n boxShadow: self.style.editCellBoxShadow,\n border: self.style.editCellBorder,\n color: self.style.editCellColor,\n background: self.style.editCellBackgroundColor,\n appearance: 'none',\n webkitAppearance: 'none',\n mozAppearance: 'none',\n borderRadius: '0'\n },\n 'canvas-datagrid-context-menu-item': {\n lineHeight: 'normal',\n fontWeight: 'normal',\n fontFamily: self.style.contextMenuFontFamily,\n fontSize: self.style.contextMenuFontSize,\n color: 'inherit',\n background: 'inherit',\n margin: self.style.contextMenuItemMargin,\n borderRadius: self.style.contextMenuItemBorderRadius,\n verticalAlign: 'middle'\n },\n 'canvas-datagrid-context-menu-item:hover': {\n background: self.style.contextMenuHoverBackground,\n color: self.style.contextMenuHoverColor\n },\n 'canvas-datagrid-context-menu-label': {\n margin: self.style.contextMenuLabelMargin,\n display: self.style.contextMenuLabelDisplay,\n minWidth: self.style.contextMenuLabelMinWidth,\n maxWidth: self.style.contextMenuLabelMaxWidth\n },\n 'canvas-datagrid-context-menu': {\n lineHeight: 'normal',\n fontWeight: 'normal',\n fontFamily: self.style.contextMenuFontFamily,\n fontSize: self.style.contextMenuFontSize,\n background: self.style.contextMenuBackground,\n color: self.style.contextMenuColor,\n border: self.style.contextMenuBorder,\n padding: self.style.contextMenuPadding,\n borderRadius: self.style.contextMenuBorderRadius,\n opacity: self.style.contextMenuOpacity,\n overflow: 'hidden'\n },\n 'canvas-datagrid-invalid-search-regExp': {\n background: self.style.contextMenuFilterInvalidExpresion\n }\n };\n if (css[className]) {\n Object.keys(css[className]).map(function (prop) {\n el.style[prop] = css[className][prop];\n });\n }\n return;\n };\n self.appendTo = function (n) {\n self.parentNode = n;\n self.height = self.parentNode.offsetHeight;\n self.width = self.parentNode.offsetWidth;\n if (self.parentNode && /canvas-datagrid-(cell|tree)/.test(self.parentNode.nodeType)) {\n self.isChildGrid = true;\n self.parentGrid = self.parentNode.parentGrid;\n self.ctx = self.parentGrid.context;\n self.canvas = self.parentGrid.canvas;\n self.controlInput = self.parentGrid.controlInput;\n self.eventParent = self.canvas;\n self.intf.offsetParent = self.parentNode;\n } else {\n self.controlInput = document.createElement('input');\n self.controlInput.onblur = self.intf.blur;\n self.createInlineStyle(self.controlInput, 'canvas-datagrid-control-input');\n self.isChildGrid = false;\n self.parentDOMNode = self.parentNode;\n self.parentNode = self.parentDOMNode;\n self.parentIsCanvas = /canvas/i.test(self.parentDOMNode.tagName);\n if (self.parentIsCanvas) {\n self.canvas = self.parentDOMNode;\n } else {\n self.canvas = document.createElement('canvas');\n self.parentDOMNode.appendChild(self.canvas);\n }\n self.ctx = self.canvas.getContext('2d');\n self.ctx.textBaseline = 'alphabetic';\n document.body.appendChild(self.controlInput);\n self.eventParent = self.canvas;\n }\n self.controlInput.addEventListener('blur', function (e) {\n if (e.target !== self.canvas) {\n self.hasFocus = false;\n }\n });\n window.addEventListener('resize', self.resize);\n if (MutationObserver) {\n self.observer = new MutationObserver(function (mutations) {\n mutations.forEach(function (mutation) {\n self.resize(true);\n });\n });\n [self.canvas.parentNode].forEach(function (el) {\n self.observer.observe(el, { attributes: true });\n });\n }\n self.eventParent.addEventListener('scroll', self.resize, false);\n self.eventParent.addEventListener('touchstart', self.touchstart, false);\n self.eventParent.addEventListener('mouseup', self.mouseup, false);\n self.eventParent.addEventListener('mousedown', self.mousedown, false);\n self.eventParent.addEventListener('dblclick', self.dblclick, false);\n self.eventParent.addEventListener('click', self.click, false);\n self.eventParent.addEventListener('mousemove', self.mousemove);\n self.eventParent.addEventListener('wheel', self.scrollWheel, false);\n self.canvas.addEventListener('contextmenu', self.contextmenuEvent, false);\n (self.isChildGrid ? self.parentGrid : document).addEventListener('copy', self.copy);\n self.controlInput.addEventListener('keypress', self.keypress, false);\n self.controlInput.addEventListener('keyup', self.keyup, false);\n self.controlInput.addEventListener('keydown', self.keydown, false);\n };\n self.setDom = function () {\n self.appendTo(self.args.parentNode);\n };\n };\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/dom.js\n// module id = 6\n// module chunks = 0","/*jslint browser: true, unparam: true, todo: true*/\n/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/\ndefine([], function () {\n 'use strict';\n return function (self) {\n // all methods here are exposed by intf\n // to users\n /**\n * Converts a integer into a letter A - ZZZZZ...\n * @memberof canvasDataGrid\n * @name integerToAlpha\n * @method\n * @param {column} n The number to convert.\n */\n self.integerToAlpha = function (n) {\n var ordA = 'a'.charCodeAt(0),\n ordZ = 'z'.charCodeAt(0),\n len = ordZ - ordA + 1,\n s = '';\n while (n >= 0) {\n s = String.fromCharCode(n % len + ordA) + s;\n n = Math.floor(n / len) - 1;\n }\n return s;\n };\n /**\n * Inserts a new column before the specified index into the schema.\n * @see canvasDataGrid#schema\n * @tutorial schema\n * @memberof canvasDataGrid\n * @name insertColumn\n * @method\n * @param {column} c The column to insert into the schema.\n * @param {number} index The index of the column to insert before.\n */\n self.insertColumn = function (c, index) {\n var s = self.getSchema();\n if (s.length < index) {\n throw new Error('Index is beyond the length of the schema.');\n }\n self.validateColumn(c, s);\n s.splice(index, 0, c);\n self.data.forEach(function (row) {\n self.applyDefaultValue(row, c);\n });\n self.intf.schema = s;\n };\n /**\n * Deletes a column from the schema at the specified index.\n * @memberof canvasDataGrid\n * @name deleteColumn\n * @tutorial schema\n * @method\n * @param {number} index The index of the column to delete.\n */\n self.deleteColumn = function (index) {\n var s = self.getSchema();\n // remove data matching this column name from data\n self.data.forEach(function (row) {\n delete row[s[index].name];\n });\n s.splice(index, 1);\n self.intf.schema = s;\n };\n /**\n * Adds a new column into the schema.\n * @see canvasDataGrid#schema\n * @tutorial schema\n * @memberof canvasDataGrid\n * @name addColumn\n * @method\n * @param {column} c The column to add to the schema.\n */\n self.addColumn = function (c) {\n var s = self.getSchema();\n self.validateColumn(c, s);\n s.push(c);\n self.data.forEach(function (row) {\n self.applyDefaultValue(row, c);\n });\n self.intf.schema = s;\n };\n /**\n * Deletes a row from the dataset at the specified index.\n * @memberof canvasDataGrid\n * @name deleteRow\n * @method\n * @param {number} index The index of the row to delete.\n */\n self.deleteRow = function (index) {\n self.originalData.splice(index, 1);\n self.setFilter();\n self.resize(true);\n };\n /**\n * Inserts a new row into the dataset before the specified index.\n * @memberof canvasDataGrid\n * @name insertRow\n * @method\n * @param {object} d data.\n * @param {number} index The index of the row to insert before.\n */\n self.insertRow = function (d, index) {\n if (self.originalData.length < index) {\n throw new Error('Index is beyond the length of the dataset.');\n }\n self.originalData.splice(index, 0, d);\n self.getSchema().forEach(function (c) {\n if (d[c.name] === undefined) {\n self.applyDefaultValue(self.originalData[index], c);\n }\n });\n self.setFilter();\n self.resize(true);\n };\n /**\n * Adds a new row into the dataset.\n * @memberof canvasDataGrid\n * @name addRow\n * @method\n * @param {object} d data.\n */\n self.addRow = function (d) {\n self.originalData.push(d);\n self.getSchema().forEach(function (c) {\n if (d[c.name] === undefined) {\n self.applyDefaultValue(self.originalData[self.originalData.length - 1], c);\n }\n });\n self.setFilter();\n self.resize(true);\n };\n /**\n * Sets the height of a given row by index number.\n * @memberof canvasDataGrid\n * @name setRowHeight\n * @method\n * @param {number} rowIndex The index of the row to set.\n * @param {number} height Height to set the row to.\n */\n self.setRowHeight = function (rowIndex, height) {\n self.sizes.rows[self.data[rowIndex][self.uniqueId]] = height;\n self.draw(true);\n };\n /**\n * Sets the width of a given column by index number.\n * @memberof canvasDataGrid\n * @name setColumnWidth\n * @method\n * @param {number} colIndex The index of the column to set.\n * @param {number} width Width to set the column to.\n */\n self.setColumnWidth = function (colIndex, width) {\n var s = self.getSchema();\n self.sizes.columns[s[colIndex][self.uniqueId]] = width;\n self.draw(true);\n };\n /**\n * Removes any changes to the width of the columns due to user or api interaction, setting them back to the schema or style default.\n * @memberof canvasDataGrid\n * @name resetColumnWidths\n * @tutorial schema\n * @method\n */\n self.resetColumnWidths = function () {\n self.sizes.columns = {};\n self.draw(true);\n };\n /**\n * Removes any changes to the height of the rows due to user or api interaction, setting them back to the schema or style default.\n * @memberof canvasDataGrid\n * @name resetRowHeights\n * @tutorial schema\n * @method\n */\n self.resetRowHeights = function () {\n self.sizes.rows = {};\n self.draw(true);\n };\n /**\n * Sets the value of the filter.\n * @memberof canvasDataGrid\n * @name setFilter\n * @method\n * @param {string} column Name of the column to filter.\n * @param {string} value The value to filter for.\n */\n self.setFilter = function (column, value) {\n function applyFilter() {\n self.refreshFromOrigialData();\n Object.keys(self.columnFilters).forEach(function (filter) {\n var header = self.getHeaderByName(column);\n if (!header) {\n return;\n }\n self.currentFilter = header.filter || self.filter(column.type || 'string');\n self.data = self.data.filter(function (row) {\n return self.currentFilter(row[filter], self.columnFilters[filter]);\n });\n });\n self.resize();\n self.draw(true);\n }\n if (column === undefined && value === undefined) {\n self.columnFilters = {};\n return applyFilter();\n }\n if (column && (value === '' || value === undefined)) {\n delete self.columnFilters[column];\n } else {\n self.columnFilters[column] = value;\n }\n applyFilter();\n };\n /**\n * Returns the number of pixels to scroll down to line up with row rowIndex.\n * @memberof canvasDataGrid\n * @name findRowScrollTop\n * @method\n * @param {number} rowIndex The row index of the row to scroll find.\n */\n self.findRowScrollTop = function (rowIndex) {\n var top = 0, x = 0, l = self.data.length,\n cellBorder = self.style.cellBorderWidth * 2;\n if (!self.attributes.showNewRow) {\n l -= 1;\n }\n if (rowIndex > l) {\n throw new Error('Impossible row index');\n }\n while (x < rowIndex) {\n top += (self.sizes.rows[self.data[x][self.uniqueId]] || self.style.cellHeight) + cellBorder;\n x += 1;\n }\n //TODO: This is not super accurate, causes pageUp/Dn to not move around right\n return top - (self.sizes.rows[self.data[rowIndex][self.uniqueId]] || self.style.cellHeight);\n };\n /**\n * Returns the number of pixels to scroll to the left to line up with column columnIndex.\n * @memberof canvasDataGrid\n * @name findColumnScrollLeft\n * @method\n * @param {number} columnIndex The column index of the column to find.\n */\n self.findColumnScrollLeft = function (columnIndex) {\n var left = 0, y = 0, s = self.getSchema(), l = s.length - 1;\n if (columnIndex > l) {\n throw new Error('Impossible column index');\n }\n while (y < columnIndex) {\n left += self.sizes.columns[s[y][self.uniqueId]] || s[y].width;\n y += 1;\n }\n return left;\n };\n /**\n * Scrolls the cell at cell x, row y.\n * @memberof canvasDataGrid\n * @name gotoCell\n * @method\n * @param {number} x The column index of the cell to scroll to.\n * @param {number} y The row index of the cell to scroll to.\n */\n self.gotoCell = function (x, y) {\n if (x !== undefined) {\n self.scrollBox.scrollLeft = self.findColumnScrollLeft(x);\n }\n if (y !== undefined) {\n self.scrollBox.scrollTop = self.findRowScrollTop(y);\n }\n };\n /**\n * Scrolls the row y.\n * @memberof canvasDataGrid\n * @name gotoRow\n * @method\n * @param {number} y The row index of the cell to scroll to.\n */\n self.gotoRow = function (y) {\n self.gotoCell(0, y);\n };\n /**\n * Scrolls the cell at cell x, row y into view if it is not already.\n * @memberof canvasDataGrid\n * @name scrollIntoView\n * @method\n * @param {number} x The column index of the cell to scroll into view.\n * @param {number} y The row index of the cell to scroll into view.\n */\n self.scrollIntoView = function (x, y) {\n if (self.visibleCells.filter(function (cell) {\n return (cell.rowIndex === y || y === undefined)\n && (cell.columnIndex === x || x === undefined)\n && cell.x > 0\n && cell.y > 0\n && cell.x + cell.width < self.width\n && cell.y + cell.height < self.height;\n }).length === 0) {\n self.gotoCell(x, y);\n }\n };\n /**\n * Sets the active cell. Requires redrawing.\n * @memberof canvasDataGrid\n * @name setActiveCell\n * @method\n * @param {number} x The column index of the cell to set active.\n * @param {number} y The row index of the cell to set active.\n */\n self.setActiveCell = function (x, y) {\n self.activeCell = {\n rowIndex: y,\n columnIndex: x\n };\n };\n /**\n * Selects every visible cell.\n * @memberof canvasDataGrid\n * @name selectAll\n * @method\n */\n self.selectAll = function () {\n self.selectArea({\n top: 0,\n left: 0,\n right: self.getVisibleSchema().length - 1,\n bottom: self.data.length - 1\n });\n };\n /**\n * Returns true if the selected columnIndex is selected on every row.\n * @memberof canvasDataGrid\n * @name isColumnSelected\n * @method\n * @param {number} columnIndex The column index to check.\n */\n self.isColumnSelected = function (columnIndex) {\n var colIsSelected = true;\n self.data.forEach(function (row, rowIndex) {\n if (!self.selections[rowIndex] || self.selections[rowIndex].indexOf(self.orders.columns[columnIndex]) === -1) {\n colIsSelected = false;\n }\n });\n return colIsSelected;\n };\n /**\n * Selects a column.\n * @memberof canvasDataGrid\n * @name selectColumn\n * @method\n * @param {number} columnIndex The column index to select.\n * @param {boolean} toggleSelectMode When true, behaves as if you were holding control/command when you clicked the column.\n * @param {boolean} shift When true, behaves as if you were holding shift when you clicked the column.\n * @param {boolean} supressSelectionchangedEvent When true, prevents the selectionchanged event from firing.\n */\n self.selectColumn = function (columnIndex, ctrl, shift, supressEvent) {\n var s, e, x;\n function addCol(i) {\n self.data.forEach(function (row, rowIndex) {\n self.selections[rowIndex] = self.selections[rowIndex] || [];\n if (self.selections[rowIndex].indexOf(i) === -1) {\n self.selections[rowIndex].push(i);\n }\n });\n }\n function removeCol(i) {\n self.data.forEach(function (row, rowIndex) {\n self.selections[rowIndex] = self.selections[rowIndex] || [];\n if (self.selections[rowIndex].indexOf(i) !== -1) {\n self.selections[rowIndex].splice(self.selections[rowIndex].indexOf(i), 1);\n }\n });\n }\n if (shift) {\n if (!self.activeCell) { return; }\n s = Math.min(self.activeCell.columnIndex, columnIndex);\n e = Math.max(self.activeCell.columnIndex, columnIndex);\n for (x = s; e > x; x += 1) {\n addCol(x);\n }\n }\n if (!ctrl && !shift) {\n self.selections = [];\n self.activeCell.columnIndex = columnIndex;\n self.activeCell.rowIndex = self.scrollIndexTop;\n }\n if (ctrl && self.isColumnSelected(columnIndex)) {\n removeCol(columnIndex);\n } else {\n addCol(columnIndex);\n }\n if (supressEvent) { return; }\n self.dispatchEvent('selectionchanged', {\n selectedData: self.getSelectedData(),\n selections: self.selections,\n selectionBounds: self.selectionBounds\n });\n };\n /**\n * Selects a row.\n * @memberof canvasDataGrid\n * @name selectRow\n * @method\n * @param {number} rowIndex The row index to select.\n * @param {boolean} ctrl When true, behaves as if you were holding control/command when you clicked the row.\n * @param {boolean} shift When true, behaves as if you were holding shift when you clicked the row.\n * @param {boolean} supressSelectionchangedEvent When true, prevents the selectionchanged event from firing.\n */\n self.selectRow = function (rowIndex, ctrl, shift, supressEvent) {\n var x, st, en, s = self.getSchema();\n function addRow(ri) {\n self.selections[ri] = [];\n self.selections[ri].push(-1);\n s.forEach(function (col) {\n self.selections[ri].push(col.index);\n });\n }\n if (self.dragAddToSelection === false || self.dragObject === undefined) {\n if (self.selections[rowIndex] && self.selections[rowIndex].length - 1 === s.length) {\n if (ctrl) {\n self.selections[rowIndex] = [];\n return;\n }\n }\n }\n if (self.dragAddToSelection === true || self.dragObject === undefined) {\n if (shift && self.dragObject === undefined) {\n if (!self.activeCell) { return; }\n st = Math.min(self.activeCell.rowIndex, rowIndex);\n en = Math.max(self.activeCell.rowIndex, rowIndex);\n for (x = st; en >= x; x += 1) {\n addRow(x);\n }\n } else {\n addRow(rowIndex);\n }\n }\n if (supressEvent) { return; }\n self.dispatchEvent('selectionchanged', {\n selectedData: self.getSelectedData(),\n selections: self.selections,\n selectionBounds: self.selectionBounds\n });\n };\n /**\n * Collapse a tree grid by row index.\n * @memberof canvasDataGrid\n * @name collapseTree\n * @method\n * @param {number} index The index of the row to collapse.\n */\n self.collapseTree = function (rowIndex) {\n var rowId = self.data[rowIndex][self.uniqueId];\n self.dispatchEvent('collapsetree', {\n childGrid: self.childGrids[rowId],\n data: self.data[rowIndex],\n rowIndex: rowIndex\n });\n self.openChildren[rowId].blur();\n self.openChildren[rowId].dispose();\n delete self.openChildren[rowId];\n delete self.sizes.trees[rowId];\n delete self.childGrids[rowId];\n self.dispatchEvent('resizerow', {\n cellHeight: self.style.cellHeight\n });\n self.resize(true);\n self.draw(true);\n };\n /**\n * Expands a tree grid by row index.\n * @memberof canvasDataGrid\n * @name expandTree\n * @method\n * @param {number} index The index of the row to expand.\n */\n self.expandTree = function (rowIndex) {\n var rowHeaderCellHeight = self.getRowHeaderCellHeight(),\n columnHeaderCellWidth = self.sizes.columns.cornerCell || self.style.rowHeaderCellWidth,\n rowId = self.data[rowIndex][self.uniqueId],\n h = self.sizes.trees[rowId] || self.style.treeGridHeight,\n treeGrid;\n if (!self.childGrids[rowId]) {\n treeGrid = self.createGrid({\n debug: self.attributes.debug,\n name: self.attributes.saveAppearance\n ? self.attributes.name + 'tree' + rowId : undefined,\n parentNode: {\n parentGrid: self.intf,\n nodeType: 'canvas-datagrid-tree',\n offsetHeight: h,\n offsetWidth: self.width - columnHeaderCellWidth,\n header: { width: self.width - columnHeaderCellWidth },\n offsetLeft: columnHeaderCellWidth,\n offsetTop: rowHeaderCellHeight,\n offsetParent: self.intf.parentNode,\n parentNode: self.intf.parentNode,\n style: 'tree',\n data: self.data[rowIndex]\n }\n });\n self.childGrids[rowId] = treeGrid;\n }\n treeGrid = self.childGrids[rowId];\n treeGrid.visible = true;\n self.dispatchEvent('expandtree', {\n treeGrid: treeGrid,\n data: self.data[rowIndex],\n rowIndex: rowIndex\n });\n self.openChildren[rowId] = treeGrid;\n self.sizes.trees[rowId] = h;\n self.dispatchEvent('resizerow', {height: self.style.cellHeight});\n self.resize(true);\n };\n /**\n * Toggles tree grid open and close by row index.\n * @memberof canvasDataGrid\n * @name toggleTree\n * @method\n * @param {number} index The index of the row to toggle.\n */\n self.toggleTree = function (rowIndex) {\n var i = self.openChildren[self.data[rowIndex][self.uniqueId]];\n if (i) {\n return self.collapseTree(rowIndex);\n }\n self.expandTree(rowIndex);\n };\n /**\n * Returns a header from the schema by name.\n * @memberof canvasDataGrid\n * @name getHeaderByName\n * @tutorial schema\n * @method\n * @returns {header} header with the selected name, or undefined.\n * @param {string} name The name of the column to resize.\n */\n self.getHeaderByName = function (name) {\n var x, i = self.getSchema();\n for (x = 0; x < i.length; x += 1) {\n if (i[x].name === name) {\n return i[x];\n }\n }\n };\n /**\n * Resizes a column to fit the longest value in the column. Call without a value to resize all columns.\n * Warning, can be slow on very large record sets (1m records ~3-5 seconds on an i7).\n * @memberof canvasDataGrid\n * @name fitColumnToValues\n * @method\n * @param {string} name The name of the column to resize.\n */\n self.fitColumnToValues = function (name, internal) {\n self.sizes.columns[name === 'cornerCell' ? name : self.getHeaderByName(name)[self.uniqueId]]\n = self.findColumnMaxTextLength(name);\n if (!internal) {\n self.resize();\n self.draw(true);\n }\n };\n /**\n * Checks if a cell is currently visible.\n * @memberof canvasDataGrid\n * @name isCellVisible\n * @method\n * @returns {boolean} when true, the cell is visible, when false the cell is not currently drawn.\n * @param {cell} cell The cell to check for. Alternatively you can pass an object { x: , y: }.\n */\n self.isCellVisible = function (cell) {\n var x, l = self.visibleCells.length;\n for (x = 0; x < l; x += 1) {\n if (cell.x === self.visibleCells[x].x && cell.y === self.visibleCells[x].y) {\n return true;\n }\n }\n return false;\n };\n /**\n * Sets the order of the data.\n * @memberof canvasDataGrid\n * @name order\n * @method\n * @returns {cell} cell at the selected location.\n * @param {number} columnName Number of pixels from the left.\n * @param {string} direction `asc` for ascending or `desc` for descending.\n * @param {function} [sortFunction] When defined, override the default sorting method defined in the column's schema and use this one.\n * @param {bool} [dontSetStorageData] Don't store this setting for future use.\n */\n self.order = function (columnName, direction, sortFunction, dontSetStorageData) {\n var f,\n c = self.getSchema().filter(function (col) {\n return col.name === columnName;\n });\n self.orderBy = columnName;\n if (c.length === 0) {\n throw new Error('Cannot sort. No such column name');\n }\n f = sortFunction || self.sorters[c[0].type];\n if (!f && c[0].type !== undefined) {\n console.warn('Cannot sort type \"%s\" falling back to string sort.', c[0].type);\n }\n self.data = self.data.sort(typeof f === 'function' ? f(columnName, direction) : self.sorters.string);\n self.dispatchEvent('ordercolumn', {name: columnName, direction: direction});\n self.draw(true);\n if (dontSetStorageData) { return; }\n self.setStorageData();\n };\n self.isInGrid = function (e) {\n if (e.x < 0\n || e.x > self.width\n || e.y < 0\n || e.y > self.height) {\n return false;\n }\n return true;\n };\n /**\n * Gets the cell at columnIndex and rowIndex.\n * @memberof canvasDataGrid\n * @name getVisibleCellByIndex\n * @method\n * @returns {cell} cell at the selected location.\n * @param {number} x Column index.\n * @param {number} y Row index.\n */\n self.getVisibleCellByIndex = function (x, y) {\n return self.visibleCells.filter(function (c) {\n return c.columnIndex === x && c.rowIndex === y;\n })[0];\n };\n /**\n * Gets the cell at grid pixel coordinate x and y.\n * @memberof canvasDataGrid\n * @name getCellAt\n * @method\n * @returns {cell} cell at the selected location.\n * @param {number} x Number of pixels from the left.\n * @param {number} y Number of pixels from the top.\n */\n self.getCellAt = function (x, y, useTouchScrollZones) {\n var tsz = useTouchScrollZones ? self.attributes.touchScrollZone : 0, i, l = self.visibleCells.length, cell;\n if (!self.visibleCells || !self.visibleCells.length) { return; }\n self.hasFocus = true;\n if (!(y < self.height\n && y > 0\n && x < self.width\n && x > 0)) {\n self.hasFocus = false;\n return {\n dragContext: 'inherit',\n context: 'inherit'\n };\n }\n for (i = 0; i < l; i += 1) {\n cell = self.visibleCells[i];\n if (useTouchScrollZones && /(vertical|horizontal)-scroll-/.test(cell.style)) {\n cell.x -= tsz;\n cell.y -= tsz;\n cell.height += tsz;\n cell.width += tsz;\n }\n if (cell.x - self.style.cellBorderWidth < x\n && cell.x + cell.width + self.style.cellBorderWidth > x\n && cell.y - self.style.cellBorderWidth < y\n && cell.y + cell.height + self.style.cellBorderWidth > y) {\n if (/vertical-scroll-(bar|box)/.test(cell.style)) {\n cell.dragContext = 'vertical-scroll-box';\n cell.context = 'vertical-scroll-box';\n cell.isScrollBar = true;\n cell.isVerticalScrollBar = true;\n if (y > self.scrollBox.box.v.y + self.scrollBox.scrollBoxHeight) {\n cell.dragContext = 'vertical-scroll-bottom';\n cell.context = 'vertical-scroll-bottom';\n } else if (y < self.scrollBox.box.v.y) {\n cell.dragContext = 'vertical-scroll-top';\n cell.context = 'vertical-scroll-top';\n }\n self.canvas.style.cursor = 'default';\n return cell;\n }\n if (/horizontal-scroll-(bar|box)/.test(cell.style)) {\n cell.dragContext = 'horizontal-scroll-box';\n cell.context = 'horizontal-scroll-box';\n cell.isScrollBar = true;\n cell.isHorizontalScrollBar = true;\n if (x > self.scrollBox.box.h.x + self.scrollBox.scrollBoxWidth) {\n cell.dragContext = 'horizontal-scroll-right';\n cell.context = 'horizontal-scroll-right';\n } else if (x < self.scrollBox.box.h.x) {\n cell.dragContext = 'horizontal-scroll-left';\n cell.context = 'horizontal-scroll-left';\n }\n self.canvas.style.cursor = 'default';\n return cell;\n }\n if (cell.x + cell.width - (self.attributes.borderResizeZone * 0.4) < x\n && cell.x + cell.width + (self.attributes.borderResizeZone * 0.6) > x\n && self.attributes.allowColumnResize\n && ((self.attributes.allowColumnResizeFromCell && cell.style === 'cell')\n || cell.style !== 'cell')\n && ((self.attributes.allowRowHeaderResize\n && ['rowHeaderCell', 'cornerCell'].indexOf(cell.style) !== -1)\n || ['rowHeaderCell', 'cornerCell'].indexOf(cell.style) === -1)) {\n cell.context = 'ew-resize';\n cell.dragContext = 'ew-resize';\n return cell;\n }\n if (cell.y + cell.height - (self.attributes.borderResizeZone * 0.4) < y\n && cell.y + cell.height + (self.attributes.borderResizeZone * 0.6) > y\n && self.attributes.allowRowResize\n && ((self.attributes.allowRowResizeFromCell && cell.style === 'cell')\n || cell.style !== 'cell')\n && cell.style !== 'columnHeaderCell') {\n cell.context = 'ns-resize';\n cell.dragContext = 'ns-resize';\n return cell;\n }\n if (cell.style === 'columnHeaderCell') {\n cell.context = 'cell';\n cell.dragContext = 'column-reorder';\n return cell;\n }\n if (cell.style === 'rowHeaderCell') {\n cell.context = 'cell';\n cell.dragContext = 'row-reorder';\n return cell;\n }\n if (cell.isGrid) {\n self.hasFocus = false;\n cell.dragContext = 'cell-grid';\n cell.context = 'cell-grid';\n return cell;\n }\n if (cell.style === 'tree-grid') {\n self.hasFocus = false;\n cell.dragContext = 'tree';\n cell.context = 'tree';\n return cell;\n }\n cell.dragContext = 'cell';\n cell.context = 'cell';\n return cell;\n }\n }\n self.hasFocus = true;\n self.canvas.style.cursor = 'default';\n return {\n dragContext: 'background',\n context: 'background',\n style: 'background',\n isBackground: true\n };\n };\n /**\n * Gets the bounds of current selection. \n * @returns {rect} selection.\n * @memberof canvasDataGrid\n * @name getSelectionBounds\n * @method\n */\n self.getSelectionBounds = function () {\n var low = {x: Infinity, y: Infinity},\n high = {x: -Infinity, y: -Infinity};\n self.data.forEach(function (row, rowIndex) {\n var maxCol, minCol;\n if (self.selections[rowIndex] && self.selections[rowIndex].length) {\n low.y = rowIndex < low.y ? rowIndex : low.y;\n high.y = rowIndex > high.y ? rowIndex : high.y;\n maxCol = Math.max.apply(null, self.selections[rowIndex]);\n minCol = Math.min.apply(null, self.selections[rowIndex]);\n low.x = minCol < low.x ? minCol : low.x;\n high.x = maxCol > high.x ? maxCol : high.x;\n }\n });\n return {\n top: low.y,\n left: low.x,\n bottom: high.y,\n right: high.x\n };\n };\n /**\n * Returns an auto generated schema based on data structure.\n * @memberof canvasDataGrid\n * @name getSchemaFromData\n * @method\n * @tutorial schema\n * @returns {schema} schema A schema based on the first item in the data array.\n */\n self.getSchemaFromData = function () {\n return Object.keys(self.data[0] || {' ': ''}).map(function mapEachSchemaColumn(key, index) {\n var type = self.getBestGuessDataType(key),\n i = {\n name: key,\n title: isNaN(parseInt(key, 10)) ? key : self.integerToAlpha(key).toUpperCase(),\n width: self.style.columnWidth,\n index: index,\n type: type,\n filter: self.filter(type)\n };\n if (key === self.uniqueId) {\n i.hidden = true;\n }\n i[self.uniqueId] = self.getSchemaNameHash(key);\n return i;\n });\n };\n /**\n * Clears the change log grid.changes that keeps track of changes to the data set.\n * This does not undo changes or alter data it is simply a convince array to keep\n * track of changes made to the data since last this method was called.\n * @memberof canvasDataGrid\n * @name clearChangeLog\n * @method\n */\n self.clearChangeLog = function () {\n self.changes = [];\n };\n /**\n * Selects an area of the grid.\n * @memberof canvasDataGrid\n * @name selectArea\n * @method\n * @param {rect} bounds A rect object representing the selected values.\n */\n self.selectArea = function (bounds, ctrl) {\n self.selectionBounds = bounds || self.selectionBounds;\n var x, y, s = self.getSchema();\n if (!ctrl) {\n self.selections = [];\n }\n if (self.selectionBounds.top < -1\n || self.selectionBounds.bottom > self.data.length\n || self.selectionBounds.left < -1\n || self.selectionBounds.right > s.length) {\n throw new Error('Impossible selection area');\n }\n for (x = self.selectionBounds.top; x <= self.selectionBounds.bottom; x += 1) {\n self.selections[x] = [];\n for (y = self.selectionBounds.left; y <= self.selectionBounds.right; y += 1) {\n if (self.selections[x].indexOf(y) === -1) {\n self.selections[x].push(y);\n }\n }\n }\n self.dispatchEvent('selectionchanged', {\n selectedData: self.getSelectedData(),\n selections: self.selections,\n selectionBounds: self.selectionBounds\n });\n };\n /**\n * Returns the maximum text width for a given column by column name.\n * @memberof canvasDataGrid\n * @name findColumnMaxTextLength\n * @method\n * @returns {number} The number of pixels wide the maximum width value in the selected column.\n * @param {string} name The name of the column to calculate the value's width of.\n */\n self.findColumnMaxTextLength = function (name) {\n var m = -Infinity;\n if (name === 'cornerCell') {\n self.ctx.font = self.style.rowHeaderCellFont;\n return self.ctx.measureText((self.data.length + (self.attributes.showNewRow ? 1 : 0)).toString()).width\n + self.style.autosizePadding + self.style.autosizeHeaderCellPadding\n + self.style.rowHeaderCellPaddingRight\n + self.style.rowHeaderCellPaddingLeft\n + (self.attributes.tree ? self.style.treeArrowWidth\n + self.style.treeArrowMarginLeft + self.style.treeArrowMarginRight : 0);\n }\n self.getSchema().forEach(function (col) {\n if (col.name !== name) { return; }\n self.ctx.font = self.style.columnHeaderCellFont;\n var t = self.ctx.measureText(col.title || col.name).width\n + self.style.headerCellPaddingRight\n + self.style.headerCellPaddingLeft;\n m = t > m ? t : m;\n });\n self.data.forEach(function (row) {\n self.ctx.font = self.style.cellFont;\n var t = self.ctx.measureText(row[name]).width\n + self.style.cellPaddingRight\n + self.style.cellPaddingLeft + self.style.cellAutoResizePadding;\n m = t > m ? t : m;\n });\n return m;\n };\n /**\n * Gets the total width of all header columns.\n * @memberof canvasDataGrid\n * @name getHeaderWidth\n * @method\n */\n self.getHeaderWidth = function () {\n return self.getVisibleSchema().reduce(function (total, header) {\n return total + header.width;\n }, 0);\n };\n self.formatters.string = function cellFormatterString(e) {\n return e.cell.value !== undefined ? e.cell.value : '';\n };\n self.formatters.rowHeaderCell = self.formatters.string;\n self.formatters.headerCell = self.formatters.string;\n self.formatters.number = self.formatters.string;\n self.formatters.int = self.formatters.string;\n self.formatters.html = self.formatters.string;\n self.sorters.string = function (columnName, direction) {\n var asc = direction === 'asc';\n return function (a, b) {\n if (a[columnName] === undefined || a[columnName] === null) {\n return 1;\n }\n if (b[columnName] === undefined || b[columnName] === null) {\n return 0;\n }\n if (asc) {\n if (!a[columnName].localeCompare) { return 1; }\n return a[columnName].localeCompare(b[columnName]);\n }\n if (!b[columnName].localeCompare) { return 1; }\n return b[columnName].localeCompare(a[columnName]);\n };\n };\n self.sorters.number = function (columnName, direction) {\n var asc = direction === 'asc';\n return function (a, b) {\n if (asc) {\n return a[columnName] - b[columnName];\n }\n return b[columnName] - a[columnName];\n };\n };\n self.sorters.date = function (columnName, direction) {\n var asc = direction === 'asc';\n return function (a, b) {\n if (asc) {\n return new Date(a[columnName]).getTime()\n - new Date(b[columnName]).getTime();\n }\n return new Date(b[columnName]).getTime()\n - new Date(a[columnName]).getTime();\n };\n };\n };\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/publicMethods.js\n// module id = 7\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///canvas-datagrid.js","webpack:///webpack/bootstrap 175ab65163330d6d3b73","webpack:///./lib/main.js","webpack:///./lib/draw.js","webpack:///./lib/events.js","webpack:///./lib/intf.js","webpack:///./lib/contextMenu.js","webpack:///./lib/defaults.js","webpack:///./lib/dom.js","webpack:///./lib/publicMethods.js"],"names":["root","factory","exports","module","define","amd","this","modules","__webpack_require__","moduleId","installedModules","i","l","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","object","property","prototype","hasOwnProperty","p","s","__WEBPACK_AMD_DEFINE_ARRAY__","__WEBPACK_AMD_DEFINE_RESULT__","undefined","grid","args","self","createGrid","forEach","init","intf","Array","slice","arguments","window","canvasDatagrid","require","apply","drawOnAllImagesLoaded","loaded","keys","htmlImageCache","html","complete","draw","drawHtml","cell","img","v","innerHTML","formattedValue","x","canvasOffsetLeft","y","canvasOffsetTop","height","width","ctx","drawImage","Image","onload","src","btoa","drawOrderByArrow","fillStyle","style","columnHeaderOrderByArrowColor","strokeStyle","columnHeaderOrderByArrowBorderColor","beginPath","columnHeaderOrderByArrowMarginLeft","columnHeaderOrderByArrowMarginTop","orderDirection","moveTo","lineTo","columnHeaderOrderByArrowWidth","columnHeaderOrderByArrowHeight","stroke","fill","columnHeaderOrderByArrowMarginRight","drawTreeArrow","treeArrowColor","treeArrowBorderColor","treeArrowMarginLeft","treeArrowMarginTop","openChildren","data","uniqueId","treeArrowWidth","treeArrowHeight","treeArrowMarginRight","radiusRect","w","h","radius","r","b","quadraticCurveTo","fillRect","strokeRect","fillText","text","addBorderLine","pos","t","addEllipsis","ellipsisCache","measureText","value","drawText","paddingLeft","paddingTop","paddingRight","paddingBottom","vPos","hPos","orderByArrowWidth","fontHeight","horizontalAlignment","verticalAlignment","perfCounters","drawCount","perfWindowSize","internal","drawCell","rowIndex","rowOrderIndex","header","headerIndex","columnOrderIndex","childGridAttributes","val","cellStyle","isHeader","test","isCorner","isRowHeader","isColumnHeader","selected","selections","indexOf","hovered","hovers","active","activeCell","columnIndex","isGrid","activeHeader","orders","rows","columns","f","formatters","type","orderByArrowSize","treeArrowSize","cellWidth","sizes","ev","row","columnWidth","cellBorderWidth","visibleRows","push","dispatchEvent","cx","cy","nodeType","offsetTop","offsetLeft","scrollTop","scrollBox","scrollLeft","cellHeight","offsetWidth","offsetHeight","parentNode","offsetParent","isHeaderCellCap","rowOpen","sortColumnIndex","sortRowIndex","gridId","attributes","parentGrid","title","userHeight","rowHeight","userWidth","cornerCell","visibleCells","unshift","lineWidth","cellHeightWithChildGrid","checkScrollHeight","cellWidthWithChildGrid","rd","save","clip","tree","showRowNumbers","childGrids","saveAppearance","cellGridHeight","visible","orderBy","font","console","warn","toString","columnFilters","filterTextPrefix","aCell","selectionBorders","length","restore","drawRowHeader","rowData","index","a","showRowHeaders","rowHeaderCell","rowHeaderCellWidth","drawRow","treeHeight","rowSansTreeHeight","g","trees","columnHeaderCellWidth","scrollIndexLeft","scrollPixelLeft","treeGrid","scrollBarWidth","rowHeaders","isChildGrid","requestAnimationFrame","u","currentCell","rowHeaderCellHeight","getRowHeaderCellHeight","getColumnHeaderCellWidth","performance","now","createRowOrders","getVisibleSchema","scale","devicePixelRatio","backgroundColor","scrollPixelTop","scrollIndexTop","showNewRow","newRow","selectionOverlayBorderWidth","selectionOverlayBorderColor","rowSelectionMode","activeCellOverlayBorderWidth","activeCellOverlayBorderColor","getHeaderWidth","columnHeaderCell","rArgs","showColumnHeaders","order","isHeaderCell","endCap","reorderObject","dragOffset","heigth","reorderMarkerBackgroundColor","reorderMarkerBorderWidth","reorderMarkerBorderColor","dragMode","reorderMarkerIndexBorderWidth","reorderMarkerIndexBorderColor","vb","nb","co","isScrollBoxCorner","scrollBarBoxMargin","scrollBarBorderColor","scrollBarBorderWidth","scrollBarBackgroundColor","scrollBoxHeight","scrollHeight","scrollBarBoxWidth","scrollBarBoxColor","context","scrollBarActiveColor","scrollBarBoxBorderRadius","scrollBoxWidth","scrollWidth","scrollBarCornerBorderColor","scrollBarCornerBackgroundColor","bar","box","resize","gridBorderWidth","gridBorderColor","debug","perf","reduce","toFixed","map","join","htmlImages","mousex","mouse","mousey","touchx","touchStart","touchy","entities","hasFocus","dragContext","key","touchDelta","touchAnimateTo","touchSigma","xPPS","yPPS","touchingCell","startingCell","animationFrames","getTouchPos","e","rect","canvas","getBoundingClientRect","touches","clientX","left","clientY","top","calculatePPS","touchCell","clearInterval","touchCalcTimeout","Math","abs","touchDeadZone","getCellAt","mousemove","mousedown","touchstart","NativeEvent","stopPropagation","preventDefault","contextmenu","touchScrollStart","touchmove","clearTimeout","touchTimeout","setTimeout","touchSelectTimeMs","setInterval","touchHaltAnimation","document","body","addEventListener","passive","touchend","touchcancel","easing","touchEndAnimation","scrollTo","touchReleaseAnimationDurationMs","dz","mouseup","beginEditAt","click","removeEventListener","touchReleaseAcceleration","fn","events","sfn","idx","splice","defaultPrevented","drawAfterResize","cellBorder","columnHeaderCellBorder","columnHeaderCellBorderWidth","parentDOMNode","parentIsCanvas","accumulator","column","hidden","widthBoxRatio","heightBoxRatio","max","scrollBarBoxMinSize","page","pageUpDownOverlap","resizeEditInput","scroll","input","scrollOffset","bx2","getVisibleCellByIndex","editCell","cellPaddingLeft","clipElement","dontDraw","overridePos","contextMenu","getLayerPos","dragBounds","sBounds","delta","ctrl","controlKey","metaKey","persistantSelectionMode","getSchema","previousCell","scrollTimer","isInGrid","cellBoundaryCrossed","draggingItem","scrollModes","dragItem","cursor","selecting","getSelectionBounds","dragStart","dragStartObject","shiftKey","min","bottom","right","ignoreNextClick","selectRow","dragAddToSelection","selectionBounds","selectArea","autoScrollZone","checkSelectionChange","selectionChanged","selectedData","getSelectedData","endEdit","sorters","number","setFilter","columnHeaderClickBehavior","selectColumn","setActiveCell","treeArrowClickRadius","toggleTree","dragResizeColumn","resizingStartingWidth","resizingStartingHeight","minColumnWidth","minRowHeight","resizeScrollZone","resizeChildGrids","globalRowResize","stopDragResize","setStorageData","scrollGrid","scrollPointerLock","pointerLockPosition","scrollStartMode","movementX","movementY","scrollMode","scrollStart","scrollRepeatRate","selectionScrollIncrement","stopScrollGrid","exitPointerLock","dragReorder","allowColumnReordering","allowRowReordering","source","target","reorderDeadZone","reorderTarget","stopDragReorder","cr","row-reorder","column-reorder","lastMouseDownTarget","button","requestPointerLock","controlInput","focus","keydown","last","cols","keyCode","selectAll","scrollIntoView","selectionFollowsActiveCell","keyup","keypress","dblclick","fitColumnToValues","autosize","scrollWheel","deltaY","deltaX","copy","clipboardData","sData","replace","setData","storageName","invalidSearchExpClass","localStyleLibraryStorageKey","filters","currentFilter","schemaHashes","uId","changes","expandToRow","col","position","ignoreScrollOffset","fillArray","low","high","step","columnHeaderCellHeight","localStorage","setItem","JSON","stringify","schema","tempSchema","createColumnOrders","filter","applyDefaultValue","defaultValue","createNewRowData","getSchemaNameHash","string","getBestGuessDataType","columnName","drawChildGrids","gridKey","getClippingRect","ele","boundingRect","eleRect","clipRect","parentRect","Infinity","setTimer","selectionScrollZone","refreshFromOrigialData","originalData","validateColumn","Error","setDefaults","obj1","obj2","def","setAttributes","defaults","setStyle","styles","colName","dispose","removeChild","eventParent","observer","disconnect","tryLoadStoredOrders","storedSettings","getHeaderByName","getFontHeight","fontStyle","parseFloat","parseFont","initProp","propName","publicStyleKeyIntf","initScrollBox","setDom","appendTo","clearChangeLog","gotoCell","gotoRow","findColumnScrollLeft","findRowScrollTop","findColumnMaxTextLength","disposeContextMenu","isCellVisible","getSchemaFromData","expandTree","collapseTree","insertRow","deleteRow","addRow","insertColumn","deleteColumn","addColumn","setRowHeight","setColumnWidth","resetColumnWidths","resetRowHeights","assertPxColor","clearPxColorAssertions","integerToAlpha","set","filterFor","filterRegExp","invalidFilterRegEx","RegExp","getItem","parse","blur","normalizeDataset","syncFnInvoked","0","isArray","autoResizeColumns","setScrollTop","preventScrollEvent","isNaN","setScrollLeft","sHeight","sWidth","createContextMenu","items","parentContextMenu","createItems","item","removeChildContext","relatedTarget","container","childMenuArrow","contextItemContainer","children","setAttribute","contextAddCallback","getAttribute","cPos","childContextMenuMarginLeft","childContextMenuMarginTop","createChildContext","createElement","addContent","content","appendChild","createInlineStyle","childContextMenuArrowHTML","clickIndex","Event","checkArrowVisibility","upArrow","downArrow","startHoverScroll","contextHoverScrollAmount","hoverScrollTimeout","contextHoverScrollRateMs","endHoverScroll","selectedIndex","loc","zIndexTop","color","contextMenuArrowColor","el","textAlign","zIndex","inputDropdown","maxHeight","innerHeight","autocompleteBottomMargin","minWidth","contextMenuArrowUpHTML","contextMenuArrowDownHTML","contextMenuWindowMargin","innerWidth","isFinite","createFilterContextMenuItems","fillAutoComplete","autoCompleteItems","filterInput","disposeAutocomplete","createAutoCompleteContext","iRect","autoCompleteContext","filterContainer","filterLabel","filterAutoCompleteButton","onclick","filterOptionText","contextFilterButtonHTML","cf","removeFilterOptionText","addDefaultContextMenuItem","isNormalCell","isBackground","isScrollBar","showFilter","showCopy","copyText","execCommand","showClearSettingsOption","clearSettingsOptionText","allowSorting","showOrderByOption","showOrderByOptionTextAsc","showOrderByOptionTextDesc","contextmenuEvent","contextMenuMarginLeft","contextMenuMarginTop","abort","abortEdit","newValue","oldValue","aborted","editable","enumItems","enum","multiLine","option","valueInEnum","nx","ny","className","css","canvas-datagrid-context-menu-filter-input","verticalAlign","marginLeft","padding","background","contextFilterInputBackground","contextFilterInputColor","border","contextFilterInputBorder","borderRadius","contextFilterInputBorderRadius","lineHeight","fontWeight","fontFamily","contextFilterInputFontFamily","fontSize","contextFilterInputFontSize","canvas-datagrid-context-menu-filter-button","contextMenuBackground","contextMenuColor","contextFilterButtonBorder","contextFilterButtonBorderRadius","contextMenuFilterButtonFontFamily","contextMenuFilterButtonFontSize","canvas-datagrid-context-child-arrow","cssFloat","childContextMenuArrowColor","contextMenuChildArrowFontSize","contextMenuFontFamily","canvas-datagrid-autocomplete","contextMenuFontSize","contextMenuBorder","contextMenuPadding","contextMenuBorderRadius","opacity","contextMenuOpacity","overflow","canvas-datagrid-autocomplete-item","canvas-datagrid-autocomplete-item:hover","contextMenuHoverBackground","contextMenuHoverColor","canvas-datagrid-canvas","canvas-datagrid","boxSizing","canvas-datagrid-control-input","canvas-datagrid-edit-input","outline","margin","editCellPaddingLeft","editCellFontFamily","editCellFontSize","boxShadow","editCellBoxShadow","editCellBorder","editCellColor","editCellBackgroundColor","appearance","webkitAppearance","mozAppearance","canvas-datagrid-context-menu-item","contextMenuItemMargin","contextMenuItemBorderRadius","canvas-datagrid-context-menu-item:hover","canvas-datagrid-context-menu-label","contextMenuLabelMargin","display","contextMenuLabelDisplay","contextMenuLabelMinWidth","maxWidth","contextMenuLabelMaxWidth","canvas-datagrid-context-menu","canvas-datagrid-invalid-search-regExp","contextMenuFilterInvalidExpresion","prop","onblur","tagName","getContext","textBaseline","MutationObserver","mutations","mutation","observe","ordA","charCodeAt","ordZ","len","String","fromCharCode","floor","colIndex","applyFilter","isColumnSelected","colIsSelected","shift","supressEvent","addCol","ri","st","en","dragObject","rowId","childGrid","treeGridHeight","direction","sortFunction","dontSetStorageData","sort","useTouchScrollZones","tsz","touchScrollZone","isVerticalScrollBar","isHorizontalScrollBar","borderResizeZone","allowColumnResize","allowColumnResizeFromCell","allowRowHeaderResize","allowRowResize","allowRowResizeFromCell","maxCol","minCol"," ","parseInt","toUpperCase","bounds","rowHeaderCellFont","autosizePadding","autosizeHeaderCellPadding","rowHeaderCellPaddingRight","rowHeaderCellPaddingLeft","columnHeaderCellFont","headerCellPaddingRight","headerCellPaddingLeft","cellFont","cellPaddingRight","cellAutoResizePadding","total","headerCell","int","asc","localeCompare","date","Date","getTime"],"mappings":"CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,IACA,kBAAAG,gBAAAC,IACAD,UAAAH,GACA,gBAAAC,SACAA,QAAA,eAAAD,IAEAD,EAAA,eAAAC,KACCK,KAAA,WACD,MCAgB,UAAUC,GCN1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAP,OAGA,IAAAC,GAAAO,EAAAD,IACAE,EAAAF,EACAG,GAAA,EACAV,WAUA,OANAK,GAAAE,GAAAI,KAAAV,EAAAD,QAAAC,IAAAD,QAAAM,GAGAL,EAAAS,GAAA,EAGAT,EAAAD,QAvBA,GAAAQ,KA4DA,OAhCAF,GAAAM,EAAAP,EAGAC,EAAAO,EAAAL,EAGAF,EAAAQ,EAAA,SAAAd,EAAAe,EAAAC,GACAV,EAAAW,EAAAjB,EAAAe,IACAG,OAAAC,eAAAnB,EAAAe,GACAK,cAAA,EACAC,YAAA,EACAC,IAAAN,KAMAV,EAAAiB,EAAA,SAAAtB,GACA,GAAAe,GAAAf,KAAAuB,WACA,WAA2B,MAAAvB,GAAA,SAC3B,WAAiC,MAAAA,GAEjC,OADAK,GAAAQ,EAAAE,EAAA,IAAAA,GACAA,GAIAV,EAAAW,EAAA,SAAAQ,EAAAC,GAAsD,MAAAR,QAAAS,UAAAC,eAAAjB,KAAAc,EAAAC,IAGtDpB,EAAAuB,EAAA,GAGAvB,IAAAwB,EAAA,KDgBM,SAAU7B,EAAQD,EA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,EAAQD,EAASM,GOx4GjC,GAAAyB,GAAAC,CAEAD,UAmOCE,MAnODD,EAAA,WACA,YACA,iBAAAI,GACAA,EAAAohB,UACAvX,aACA,YACA,YACA,kBACA,4BACA,sBACA,kCACA,iBACA,gBACA,6BACA,0BACA,oBACA,kBACA,uBACA,wBACA,+BACA,wBACA,yBACA,4BACA,yBACA,sBACA,8BACA,iCACA,aACA,wBACA,yBACA,sBACA,sBACA,wBACA,2BACA,wBACA,+BACA,+BACA,gCACA,sBACA,+BACA,yBACA,mDACA,qDACA,uDACA,iDACA,iCACA,mCACA,wCACA,gCACA,oBACA,0BACA,uBACA,oBACA,gBACA,qCACA,yBAEAyX,SACA,uDACA,mDACA,8BACA,uCACA,qCACA,4DACA,4CACA,yDACA,oCACA,8BACA,4BACA,6BACA,2BACA,+DACA,+CACA,mEACA,mDACA,gEACA,gDACA,gCACA,gCACA,sBACA,6CACA,6BACA,iDACA,6CACA,uBACA,iCACA,+BACA,uBACA,kBACA,gCACA,mCACA,sDACA,sCACA,wBACA,sBACA,uBACA,qBACA,yDACA,yCACA,mCACA,+BACA,qDACA,yCACA,mCACA,gCACA,6DACA,yDACA,oCACA,gDACA,2CACA,8BACA,+CACA,kEACA,kDACA,oCACA,kCACA,mCACA,iCACA,+CACA,oBACA,iEACA,0CACA,uCACA,uDACA,gEACA,uCACA,4CACA,8CACA,sCACA,gDACA,wCACA,sCACA,mDACA,yDACA,kCACA,yCACA,2CACA,mDACA,2CACA,+DACA,uCACA,+BACA,wDACA,iDACA,sCACA,gCACA,2CACA,uCACA,qCACA,oCACA,4BACA,4BACA,8BACA,6BACA,8BACA,uDACA,mDACA,oCACA,sDACA,kDACA,0BACA,oCACA,4BACA,0BACA,6CACA,sBACA,iEACA,0CACA,2DACA,qCACA,yCACA,0CACA,wCACA,qCACA,sBACA,iBACA,oBACA,mBACA,sDACA,kDACA,kCACA,0DACA,uCACA,0DACA,sDACA,+BACA,6CACA,wCACA,2BACA,4CACA,+DACA,+CACA,i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OAAA/Z,EAAA8H,WAAA+X,OACA7f,EAAA8H,WAAAosB,IAAAl0B,EAAA8H,WAAA+X,OACA7f,EAAA8H,WAAA9G,KAAAhB,EAAA8H,WAAA+X,OACA7f,EAAA8Z,QAAA+F,OAAA,SAAAE,EAAAiS,GACA,GAAAmC,GAAA,QAAAnC,CACA,iBAAA/lB,EAAA3H,GACA,WAAAzE,KAAAoM,EAAA8T,IAAA,OAAA9T,EAAA8T,GACA,MAEAlgB,KAAAyE,EAAAyb,IAAA,OAAAzb,EAAAyb,GACA,EAEAoU,EACAloB,EAAA8T,GAAAqU,cACAnoB,EAAA8T,GAAAqU,cAAA9vB,EAAAyb,IADuD,EAGvDzb,EAAAyb,GAAAqU,cACA9vB,EAAAyb,GAAAqU,cAAAnoB,EAAA8T,IADmD,IAInD/f,EAAA8Z,QAAAC,OAAA,SAAAgG,EAAAiS,GACA,GAAAmC,GAAA,QAAAnC,CACA,iBAAA/lB,EAAA3H,GACA,MAAA6vB,GACAloB,EAAA8T,GAAAzb,EAAAyb,GAEAzb,EAAAyb,GAAA9T,EAAA8T,KAGA/f,EAAA8Z,QAAAua,KAAA,SAAAtU,EAAAiS,GACA,GAAAmC,GAAA,QAAAnC,CACA,iBAAA/lB,EAAA3H,GACA,MAAA6vB,GACA,GAAAG,MAAAroB,EAAA8T,IAAAwU,UACA,GAAAD,MAAAhwB,EAAAyb,IAAAwU,UAEA,GAAAD,MAAAhwB,EAAAyb,IAAAwU,UACA,GAAAD,MAAAroB,EAAA8T,IAAAwU,cAIC5zB,MAAA/C,EAAA+B,MAAA9B,EAAAD,QAAAgC","file":"canvas-datagrid.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"canvasDatagrid\"] = factory();\n\telse\n\t\troot[\"canvasDatagrid\"] = factory();\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"canvasDatagrid\"] = factory();\n\telse\n\t\troot[\"canvasDatagrid\"] = factory();\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*jslint browser: true, unparam: true, todo: true*/\n/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/\n!(__WEBPACK_AMD_DEFINE_ARRAY__ = [\n __webpack_require__(1),\n __webpack_require__(2),\n __webpack_require__(3),\n __webpack_require__(4),\n __webpack_require__(5),\n __webpack_require__(6),\n __webpack_require__(7)\n], __WEBPACK_AMD_DEFINE_RESULT__ = function context() {\n 'use strict';\n var modules = Array.prototype.slice.call(arguments);\n function grid(args) {\n args = args || {};\n var self = {};\n self.args = args;\n self.createGrid = grid;\n modules.forEach(function (module) {\n module(self);\n });\n self.init();\n return self.intf;\n }\n if (window && !window.canvasDatagrid && !window.require) {\n window.canvasDatagrid = grid;\n }\n module.exports = grid;\n return grid;\n}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*jslint browser: true, unparam: true, todo: true*/\n/*globals XMLSerializer: false, define: true, Blob: false, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/\n!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {\n 'use strict';\n return function (self) {\n var perfCounters = [],\n drawCount = 0,\n perfWindowSize = 20;\n self.htmlImageCache = {};\n function drawOnAllImagesLoaded() {\n var loaded = true;\n Object.keys(self.htmlImageCache).forEach(function (html) {\n if (!self.htmlImageCache[html].complete) {\n loaded = false;\n }\n });\n if (loaded) {\n self.draw();\n }\n }\n function drawHtml(cell) {\n var img,\n v = cell.innerHTML || cell.formattedValue,\n x = cell.x + self.canvasOffsetLeft,\n y = cell.y + self.canvasOffsetTop;\n if (self.htmlImageCache[v]) {\n img = self.htmlImageCache[v];\n if (img.height !== cell.height || img.width !== cell.width) {\n // height and width of the cell has changed, invalidate cache\n self.htmlImageCache[v] = undefined;\n } else {\n if (!img.complete) {\n return;\n }\n return self.ctx.drawImage(img, x, y);\n }\n }\n img = new Image(cell.width, cell.height);\n self.htmlImageCache[v] = img;\n img.onload = function () {\n self.ctx.drawImage(img, x, y);\n drawOnAllImagesLoaded();\n };\n img.src = 'data:image/svg+xml;base64,' + btoa(\n '\\n' +\n '\\n' +\n '\\n' +\n v + '\\n' +\n '' +\n '\\n' +\n '\\n'\n );\n }\n function drawOrderByArrow(x, y) {\n x += self.canvasOffsetLeft;\n y += self.canvasOffsetTop;\n self.ctx.fillStyle = self.style.columnHeaderOrderByArrowColor;\n self.ctx.strokeStyle = self.style.columnHeaderOrderByArrowBorderColor;\n self.ctx.beginPath();\n x = x + self.style.columnHeaderOrderByArrowMarginLeft;\n y = y + self.style.columnHeaderOrderByArrowMarginTop;\n if (self.orderDirection === 'asc') {\n self.ctx.moveTo(x, y);\n self.ctx.lineTo(x + self.style.columnHeaderOrderByArrowWidth, y);\n self.ctx.lineTo(x + (self.style.columnHeaderOrderByArrowWidth * 0.5), y + self.style.columnHeaderOrderByArrowHeight);\n self.ctx.moveTo(x, y);\n } else {\n self.ctx.lineTo(x, y + self.style.columnHeaderOrderByArrowHeight);\n self.ctx.lineTo(x + self.style.columnHeaderOrderByArrowWidth, y + self.style.columnHeaderOrderByArrowHeight);\n self.ctx.lineTo(x + (self.style.columnHeaderOrderByArrowWidth * 0.5), y);\n self.ctx.lineTo(x, y + self.style.columnHeaderOrderByArrowHeight);\n }\n self.ctx.stroke();\n self.ctx.fill();\n return self.style.columnHeaderOrderByArrowMarginLeft\n + self.style.columnHeaderOrderByArrowWidth\n + self.style.columnHeaderOrderByArrowMarginRight;\n }\n function drawTreeArrow(cell, x, y) {\n x += self.canvasOffsetLeft;\n y += self.canvasOffsetTop;\n self.ctx.fillStyle = self.style.treeArrowColor;\n self.ctx.strokeStyle = self.style.treeArrowBorderColor;\n self.ctx.beginPath();\n x = x + self.style.treeArrowMarginLeft;\n y = y + self.style.treeArrowMarginTop;\n if (self.openChildren[cell.data[self.uniqueId]]) {\n self.ctx.moveTo(x, y);\n self.ctx.lineTo(x + self.style.treeArrowWidth, y);\n self.ctx.lineTo(x + (self.style.treeArrowWidth * 0.5), y + self.style.treeArrowHeight);\n self.ctx.moveTo(x, y);\n } else {\n self.ctx.lineTo(x, y);\n self.ctx.lineTo(x + self.style.treeArrowHeight, y + (self.style.treeArrowWidth * 0.5));\n self.ctx.lineTo(x, y + self.style.treeArrowWidth);\n self.ctx.lineTo(x, y);\n }\n self.ctx.stroke();\n self.ctx.fill();\n return self.style.treeArrowMarginLeft\n + self.style.treeArrowWidth\n + self.style.treeArrowMarginRight;\n }\n function radiusRect(x, y, w, h, radius) {\n x += self.canvasOffsetLeft;\n y += self.canvasOffsetTop;\n var r = x + w, b = y + h;\n self.ctx.beginPath();\n self.ctx.moveTo(x + radius, y);\n self.ctx.lineTo(r - radius, y);\n self.ctx.quadraticCurveTo(r, y, r, y + radius);\n self.ctx.lineTo(r, y + h - radius);\n self.ctx.quadraticCurveTo(r, b, r - radius, b);\n self.ctx.lineTo(x + radius, b);\n self.ctx.quadraticCurveTo(x, b, x, b - radius);\n self.ctx.lineTo(x, y + radius);\n self.ctx.quadraticCurveTo(x, y, x + radius, y);\n }\n function fillRect(x, y, w, h) {\n x += self.canvasOffsetLeft;\n y += self.canvasOffsetTop;\n self.ctx.fillRect(x, y, w, h);\n }\n function strokeRect(x, y, w, h) {\n x += self.canvasOffsetLeft;\n y += self.canvasOffsetTop;\n self.ctx.strokeRect(x, y, w, h);\n }\n function fillText(text, x, y) {\n x += self.canvasOffsetLeft;\n y += self.canvasOffsetTop;\n self.ctx.fillText(text, x, y);\n }\n function addBorderLine(c, pos) {\n self.ctx.beginPath();\n var p = {\n t: function () {\n self.ctx.moveTo(c.x + self.canvasOffsetLeft, c.y + self.canvasOffsetTop);\n self.ctx.lineTo(c.x + self.canvasOffsetLeft + c.width, c.y + self.canvasOffsetTop);\n },\n r: function () {\n self.ctx.moveTo(c.x + self.canvasOffsetLeft + c.width, c.y + self.canvasOffsetTop);\n self.ctx.lineTo(c.x + self.canvasOffsetLeft + c.width, c.y + self.canvasOffsetTop + c.height);\n },\n b: function () {\n self.ctx.moveTo(c.x + self.canvasOffsetLeft, c.y + self.canvasOffsetTop + c.height);\n self.ctx.lineTo(c.x + self.canvasOffsetLeft + c.width, c.y + self.canvasOffsetTop + c.height);\n },\n l: function () {\n self.ctx.moveTo(c.x + self.canvasOffsetLeft, c.y + self.canvasOffsetTop);\n self.ctx.lineTo(c.x + self.canvasOffsetLeft, c.y + self.canvasOffsetTop + c.height);\n },\n };\n p[pos]();\n self.ctx.stroke();\n }\n function addEllipsis(text, width) {\n var c, w = 0;\n if (self.ellipsisCache[text] && self.ellipsisCache[text][width]) {\n return self.ellipsisCache[text][width];\n }\n //TODO Add ellipsis back when there is a fast way to do it\n w = self.ctx.measureText(text).width;\n self.ellipsisCache[text] = self.ellipsisCache[text] || {};\n c = {value: text, width: w};\n self.ellipsisCache[text][width] = c;\n return c;\n }\n function drawText(cell) {\n var paddingLeft = self.style[cell.style + 'PaddingLeft'],\n paddingTop = self.style[cell.style + 'PaddingTop'],\n paddingRight = self.style[cell.style + 'PaddingRight'],\n paddingBottom = self.style[cell.style + 'PaddingBottom'],\n vPos = paddingTop + cell.height - (cell.height * 0.5),\n hPos = paddingLeft + cell.treeArrowWidth + cell.orderByArrowWidth;\n cell.text = addEllipsis(cell.formattedValue, cell.width - paddingRight - paddingLeft);\n cell.text.height = cell.fontHeight;\n if (cell.horizontalAlignment === 'right') {\n hPos = cell.width - cell.text.width - paddingRight;\n } else if (cell.horizontalAlignment === 'center') {\n hPos = (cell.width / 2) - (cell.text.width / 2);\n }\n if (cell.verticalAlignment === 'top') {\n vPos = paddingTop + cell.text.height;\n } else if (cell.verticalAlignment === 'bottom') {\n vPos = cell.height - paddingBottom - cell.text.height;\n }\n cell.text.x = cell.x + hPos;\n cell.text.y = cell.y + vPos;\n fillText(cell.text.value, cell.text.x, cell.text.y);\n }\n /**\n * Redraws the grid. No matter what the change, this is the only method required to refresh everything.\n * @memberof canvasDataGrid\n * @name draw\n * @method\n */\n self.draw = function (internal) {\n if (self.dispatchEvent('beforedraw', {})) { return; }\n if (!self.isChildGrid && (!self.height || !self.width)) {\n return;\n }\n if (self.isChildGrid && internal) {\n requestAnimationFrame(self.parentGrid.draw);\n return;\n }\n if (self.intf.visible === false) {\n return;\n }\n // initial values\n var checkScrollHeight, rowHeaderCell, p, cx, cy, treeGrid, rowOpen,\n rowHeight, cornerCell, y, x, c, h, w, s, r, rd, aCell,\n selectionBorders = [],\n rowHeaders = [],\n l = self.data.length,\n u = self.currentCell || {},\n rowHeaderCellHeight = self.getRowHeaderCellHeight(),\n columnHeaderCellWidth = self.getColumnHeaderCellWidth(),\n cellHeight = self.style.cellHeight;\n drawCount += 1;\n p = performance.now();\n // if data length has changed, there is no way to know\n if (self.data.length > self.orders.rows.length) {\n self.createRowOrders();\n }\n function drawScrollBars() {\n var v = {\n x: 0,\n y: 0,\n height: 0,\n width: 0,\n style: 'vertical-scroll-bar'\n },\n n = {\n x: 0,\n y: 0,\n height: 0,\n width: 0,\n style: 'horizontal-scroll-bar'\n },\n vb = {\n x: 0,\n y: 0,\n height: 0,\n width: 0,\n style: 'vertical-scroll-box'\n },\n nb = {\n x: 0,\n y: 0,\n height: 0,\n width: 0,\n style: 'horizontal-scroll-box'\n },\n co = {\n x: 0,\n y: 0,\n height: 0,\n width: 0,\n isCorner: true,\n isScrollBoxCorner: true,\n style: 'scroll-box-corner'\n },\n m = (self.style.scrollBarBoxMargin * 2),\n d = self.style.scrollBarBoxMargin * 0.5;\n self.ctx.strokeStyle = self.style.scrollBarBorderColor;\n self.ctx.lineWidth = self.style.scrollBarBorderWidth;\n // vertical\n v.x += w - self.style.scrollBarWidth - self.style.scrollBarBorderWidth - d;\n v.y += rowHeaderCellHeight;\n v.width = self.style.scrollBarWidth + self.style.scrollBarBorderWidth + d;\n v.height = h - rowHeaderCellHeight - self.style.scrollBarWidth - d - m;\n self.ctx.fillStyle = self.style.scrollBarBackgroundColor;\n fillRect(v.x, v.y, v.width, v.height + m);\n strokeRect(v.x, v.y, v.width, v.height + m);\n // vertical box\n vb.x = v.x + self.style.scrollBarBoxMargin;\n vb.y = rowHeaderCellHeight + self.style.scrollBarBoxMargin\n + ((v.height - self.scrollBox.scrollBoxHeight)\n * (self.scrollBox.scrollTop / self.scrollBox.scrollHeight));\n vb.width = self.style.scrollBarBoxWidth;\n vb.height = self.scrollBox.scrollBoxHeight;\n self.ctx.fillStyle = self.style.scrollBarBoxColor;\n if (/vertical/.test(u.context)) {\n self.ctx.fillStyle = self.style.scrollBarActiveColor;\n }\n if (vb.height < v.height) {\n radiusRect(vb.x, vb.y, vb.width, vb.height, self.style.scrollBarBoxBorderRadius);\n self.ctx.stroke();\n self.ctx.fill();\n }\n // horizontal\n n.x += columnHeaderCellWidth;\n n.y += h - self.style.scrollBarWidth - d;\n n.width = w - self.style.scrollBarWidth - columnHeaderCellWidth - d - m;\n n.height = self.style.scrollBarWidth + self.style.scrollBarBorderWidth + d;\n self.ctx.fillStyle = self.style.scrollBarBackgroundColor;\n fillRect(n.x, n.y, n.width + m, n.height);\n strokeRect(n.x, n.y, n.width + m, n.height);\n // horizontal box\n nb.y = n.y + self.style.scrollBarBoxMargin;\n nb.x = columnHeaderCellWidth + self.style.scrollBarBoxMargin\n + ((n.width - self.scrollBox.scrollBoxWidth)\n * (self.scrollBox.scrollLeft / self.scrollBox.scrollWidth));\n nb.width = self.scrollBox.scrollBoxWidth;\n nb.height = self.style.scrollBarBoxWidth;\n self.ctx.fillStyle = self.style.scrollBarBoxColor;\n if (/horizontal/.test(u.context)) {\n self.ctx.fillStyle = self.style.scrollBarActiveColor;\n }\n if (nb.width < n.width) {\n radiusRect(nb.x, nb.y, nb.width, nb.height, self.style.scrollBarBoxBorderRadius);\n self.ctx.stroke();\n self.ctx.fill();\n }\n //corner\n self.ctx.strokeStyle = self.style.scrollBarCornerBorderColor;\n self.ctx.fillStyle = self.style.scrollBarCornerBackgroundColor;\n co.x = n.x + n.width + m;\n co.y = v.y + v.height + m;\n co.width = self.style.scrollBarWidth + self.style.scrollBarBorderWidth;\n co.height = self.style.scrollBarWidth + self.style.scrollBarBorderWidth;\n radiusRect(co.x, co.y, co.width, co.height, 0);\n self.ctx.stroke();\n self.ctx.fill();\n self.visibleCells.unshift(v);\n self.visibleCells.unshift(vb);\n self.visibleCells.unshift(n);\n self.visibleCells.unshift(nb);\n self.visibleCells.unshift(co);\n self.scrollBox.bar = {\n v: v,\n h: n\n };\n self.scrollBox.box = {\n v: vb,\n h: nb\n };\n }\n function drawCell(d, rowIndex, rowOrderIndex) {\n return function drawEach(header, headerIndex, columnOrderIndex) {\n var cellStyle = header.style || 'cell',\n childGridAttributes,\n cell,\n isHeader = /HeaderCell/.test(cellStyle),\n isCorner = /cornerCell/.test(cellStyle),\n isRowHeader = 'rowHeaderCell' === cellStyle,\n isColumnHeader = 'columnHeaderCell' === cellStyle,\n selected = self.selections[rowOrderIndex] && self.selections[rowOrderIndex].indexOf(columnOrderIndex) !== -1,\n hovered = self.hovers[d[self.uniqueId]] && self.hovers[d[self.uniqueId]].indexOf(columnOrderIndex) !== -1,\n active = self.activeCell.rowIndex === rowOrderIndex && self.activeCell.columnIndex === columnOrderIndex,\n isGrid = typeof d[header.name] === 'object' && d[header.name] !== null && d[header.name] !== undefined,\n activeHeader = (self.orders.rows[self.activeCell.rowIndex] === rowOrderIndex\n || self.orders.columns[self.activeCell.columnIndex] === columnOrderIndex)\n && (columnOrderIndex === -1 || rowOrderIndex === -1)\n ? (isRowHeader ? 'activeRowHeaderCell' : 'activeColumnHeaderCell') : false,\n val,\n f = self.formatters[header.type || 'string'],\n orderByArrowSize = 0,\n treeArrowSize = 0,\n cellWidth = self.sizes.columns[isRowHeader ? 'cornerCell' : header[self.uniqueId]] || header.width,\n ev = {\n value: d[header.name],\n row: d,\n header: header\n };\n if (cellStyle === 'headerCellCap') {\n cellWidth = w - x;\n }\n // if no data or schema are defined, a width is provided to the stub column\n if (cellWidth === undefined) {\n cellWidth = self.style.columnWidth;\n }\n if (x + cellWidth + self.style.cellBorderWidth < 0) {\n x += cellWidth + self.style.cellBorderWidth;\n }\n if (active) {\n cellStyle = 'activeCell';\n }\n if (self.visibleRows.indexOf(rowIndex) === -1 && !isHeader) {\n self.visibleRows.push(rowIndex);\n }\n val = self.dispatchEvent('formatcellvalue', ev);\n if (!self.dispatchEvent('beforerendercell', ev)) {\n cx = x;\n cy = y;\n if (cellStyle === 'cornerCell') {\n cx = 0;\n cy = 0;\n } else if (isRowHeader) {\n cx = 0;\n } else if (isHeader) {\n cy = 0;\n }\n cell = {\n type: isGrid ? 'canvas-datagrid-cell' : header.type,\n style: cellStyle,\n nodeType: 'canvas-datagrid-cell',\n x: cx,\n y: cy,\n horizontalAlignment: self.style[cellStyle + 'HorizontalAlignment'],\n verticalAlignment: self.style[cellStyle + 'VerticalAlignment'],\n offsetTop: self.canvasOffsetTop + cy,\n offsetLeft: self.canvasOffsetLeft + cx,\n scrollTop: self.scrollBox.scrollTop,\n scrollLeft: self.scrollBox.scrollLeft,\n active: active || activeHeader,\n hovered: hovered,\n selected: selected,\n width: cellWidth,\n height: cellHeight,\n offsetWidth: cellWidth,\n offsetHeight: cellHeight,\n parentNode: self.intf.parentNode,\n offsetParent: self.intf.parentNode,\n data: d,\n isCorner: isCorner,\n isHeader: isHeader,\n isColumnHeader: isColumnHeader,\n isHeaderCellCap: !!header.isHeaderCellCap,\n isRowHeader: isRowHeader,\n rowOpen: rowOpen,\n header: header,\n columnIndex: columnOrderIndex,\n rowIndex: rowOrderIndex,\n sortColumnIndex: headerIndex,\n sortRowIndex: rowIndex,\n isGrid: isGrid,\n gridId: (self.attributes.name || '') + d[self.uniqueId] + ':' + header[self.uniqueId],\n parentGrid: self.intf,\n innerHTML: '',\n activeHeader: activeHeader,\n value: isHeader && !isRowHeader ? (header.title || header.name) : d[header.name]\n };\n ev.cell = cell;\n cell.userHeight = cell.isHeader ? self.sizes.rows[-1] : rowHeight;\n cell.userWidth = cell.isHeader ? self.sizes.columns.cornerCell : self.sizes.columns[header[self.uniqueId]];\n cell[self.uniqueId] = d[self.uniqueId];\n self.visibleCells.unshift(cell);\n self.ctx.fillStyle = self.style[cellStyle + 'BackgroundColor'];\n self.ctx.strokeStyle = self.style[cellStyle + 'BorderColor'];\n self.ctx.lineWidth = self.style[cellStyle + 'BorderWidth'];\n if (hovered) {\n self.ctx.fillStyle = self.style[cellStyle + 'HoverBackgroundColor'];\n self.ctx.strokeStyle = self.style[cellStyle + 'HoverBorderColor'];\n }\n if (selected) {\n self.ctx.fillStyle = self.style[cellStyle + 'SelectedBackgroundColor'];\n self.ctx.strokeStyle = self.style[cellStyle + 'SelectedBorderColor'];\n }\n if (activeHeader) {\n self.ctx.fillStyle = self.style[activeHeader + 'BackgroundColor'];\n }\n self.dispatchEvent('rendercell', ev);\n if (cell.isGrid) {\n if (cell.height !== rowHeight) {\n cell.height = rowHeight || self.style.cellHeightWithChildGrid;\n checkScrollHeight = true;\n }\n cell.width = self.sizes.columns[header[self.uniqueId]] || self.style.cellWidthWithChildGrid;\n }\n if (rowOpen && !cell.isRowHeader) {\n cell.height = self.sizes.rows[rd[self.uniqueId]] || self.style.cellHeight;\n }\n if (!cell.isGrid) {\n fillRect(cx, cy, cell.width, cell.height);\n strokeRect(cx, cy, cell.width, cell.height);\n }\n self.ctx.save();\n radiusRect(cell.x, cell.y, cell.width, cell.height, 0);\n self.ctx.clip();\n self.dispatchEvent('afterrendercell', ev);\n if (cell.height !== cellHeight && !(rowOpen && !cell.isRowHeader)) {\n self.sizes.rows[isHeader ? -1 : d[self.uniqueId]] = cell.height;\n checkScrollHeight = true;\n }\n if (cell.width !== cellWidth) {\n self.sizes.columns[header[self.uniqueId]] = cell.width;\n checkScrollHeight = true;\n }\n if (isRowHeader && self.attributes.tree) {\n if (!self.dispatchEvent('rendertreearrow', ev)) {\n treeArrowSize = drawTreeArrow(cell, self.style[cellStyle + 'PaddingLeft'], cy, 0);\n }\n }\n if ((self.attributes.showRowNumbers && isRowHeader)\n || !isRowHeader) {\n if (cell.isGrid) {\n if (!self.childGrids[cell.gridId]) {\n childGridAttributes = self.args.childGridAttributes || self.args;\n childGridAttributes.name = self.attributes.saveAppearance ? cell.gridId : undefined;\n childGridAttributes.parentNode = cell;\n childGridAttributes.data = d[header.name];\n self.childGrids[cell.gridId] = self.createGrid(childGridAttributes);\n self.sizes.rows[rd[self.uniqueId]]\n = self.sizes.rows[rd[self.uniqueId]] || self.style.cellGridHeight;\n checkScrollHeight = true;\n }\n cell.grid = self.childGrids[cell.gridId];\n cell.grid.parentNode = cell;\n cell.grid.visible = true;\n cell.grid.draw();\n self.dispatchEvent('rendercellgrid', ev);\n } else {\n if (self.childGrids[cell.gridId]) {\n self.childGrids[cell.gridId].parentNode.offsetHeight = 0;\n }\n if (isHeader && self.orderBy === header.name) {\n if (!self.dispatchEvent('renderorderbyarrow', ev)) {\n orderByArrowSize = drawOrderByArrow(cx + self.style[cellStyle + 'PaddingLeft'], 0);\n }\n }\n self.ctx.fillStyle = self.style[cellStyle + 'Color'];\n if (hovered) {\n self.ctx.fillStyle = self.style[cellStyle + 'HoverColor'];\n }\n if (selected) {\n self.ctx.fillStyle = self.style[cellStyle + 'SelectedColor'];\n }\n if (activeHeader) {\n self.ctx.fillStyle = self.style[activeHeader + 'Color'];\n }\n self.ctx.font = self.style[cellStyle + 'Font'];\n cell.fontHeight = self.style[cellStyle + 'FontHeight'];\n cell.treeArrowWidth = treeArrowSize;\n cell.orderByArrowWidth = orderByArrowSize;\n val = val !== undefined ? val : f\n ? f(ev) : '';\n if (val === undefined && !f) {\n val = '';\n console.warn('canvas-datagrid: Unknown format '\n + header.type + ' add a cellFormater');\n }\n cell.formattedValue = ((val !== undefined && val !== null) ? val : '').toString();\n if (self.columnFilters && self.columnFilters[val] !== undefined && isHeader) {\n cell.formattedValue = self.attributes.filterTextPrefix + val;\n }\n if (!self.dispatchEvent('rendertext', ev)) {\n if (cell.innerHTML || header.type === 'html') {\n drawHtml(cell);\n } else {\n drawText(cell);\n }\n }\n }\n }\n if (active) {\n aCell = cell;\n }\n if (selected && !isRowHeader) {\n if ((!self.selections[cell.rowIndex - 1]\n || self.selections[cell.rowIndex - 1].indexOf(cell.columnIndex) === -1\n || cell.rowIndex === 0)\n && !cell.isHeader) {\n selectionBorders.push([cell, 't']);\n }\n if (!self.selections[cell.rowIndex + 1]\n || self.selections[cell.rowIndex + 1].indexOf(cell.columnIndex) === -1) {\n selectionBorders.push([cell, 'b']);\n }\n if (!self.selections[cell.rowIndex] || cell.columnIndex === 0\n || self.selections[cell.rowIndex].indexOf(cell.columnIndex - 1) === -1) {\n selectionBorders.push([cell, 'l']);\n }\n if (!self.selections[cell.rowIndex] || cell.columnIndex === s.length\n || self.selections[cell.rowIndex].indexOf(cell.columnIndex + 1) === -1) {\n selectionBorders.push([cell, 'r']);\n }\n }\n self.ctx.restore();\n x += cell.width + self.style.cellBorderWidth;\n return cell.width;\n }\n };\n }\n function drawRowHeader(rowData, index, rowOrderIndex) {\n var a;\n if (self.attributes.showRowHeaders) {\n x = 0;\n rowHeaderCell = {'rowHeaderCell': index + 1 };\n rowHeaderCell[self.uniqueId] = rowData[self.uniqueId];\n a = {\n name: 'rowHeaderCell',\n width: self.style.rowHeaderCellWidth,\n style: 'rowHeaderCell',\n type: 'string',\n data: rowData[self.uniqueId],\n index: -1\n };\n a[self.uniqueId] = rowData[self.uniqueId];\n rowOpen = self.openChildren[rowData[self.uniqueId]];\n drawCell(rowHeaderCell, index, rowOrderIndex)(a, -1, -1);\n }\n }\n function drawHeaders() {\n var d, g = s.length, i, o, columnHeaderCell, header;\n rowHeaders.forEach(function (rArgs) {\n y = rArgs[3];\n cellHeight = rArgs[4];\n drawRowHeader(rArgs[0], rArgs[1], rArgs[2]);\n });\n if (self.attributes.showColumnHeaders) {\n x = (self.scrollBox.scrollLeft * -1) + self.scrollPixelLeft;\n if (self.attributes.showRowHeaders) {\n x += columnHeaderCellWidth;\n }\n y = 0;\n // cell height might have changed during drawing\n cellHeight = self.getRowHeaderCellHeight();\n for (o = self.scrollIndexLeft; o < g; o += 1) {\n i = self.orders.columns[o];\n header = s[i];\n d = {\n title: header.title,\n name: header.name,\n width: header.width,\n style: 'columnHeaderCell',\n type: 'string',\n index: o,\n order: i\n };\n columnHeaderCell = {'columnHeaderCell': header.title || header.name};\n columnHeaderCell[self.uniqueId] = 'h' + header[self.uniqueId];\n d[self.uniqueId] = header[self.uniqueId];\n x += drawCell(columnHeaderCell, -1, -1)(d, o, i);\n if (x > self.width + self.scrollBox.scrollLeft) {\n break;\n }\n }\n // fill in the space right of the headers\n if (x < w) {\n c = {\n name: '',\n width: self.style.scrollBarWidth,\n style: 'headerCellCap',\n isHeaderCell: true,\n isHeaderCellCap: true,\n type: 'string',\n index: s.length\n };\n c[self.uniqueId] = 'columnHeaderCell';\n drawCell({endCap: ''}, -1, -1)(c, -1, -1);\n }\n // fill in the space right of the headers\n if (self.attributes.showRowHeaders) {\n cornerCell = {'cornerCell': '' };\n cornerCell[self.uniqueId] = 'cornerCell';\n x = 0;\n c = {\n name: 'cornerCell',\n width: self.style.rowHeaderCellWidth,\n style: 'cornerCell',\n type: 'string',\n index: -1\n };\n c[self.uniqueId] = 'cornerCell';\n drawCell(cornerCell, -1, -1)(c, -1, -1);\n }\n }\n }\n function drawRow(r, d) {\n var i, treeHeight, rowSansTreeHeight, o, g = s.length;\n if (y - (cellHeight * 2) > h) {\n return false;\n }\n rd = self.data[r];\n rowOpen = self.openChildren[rd[self.uniqueId]];\n rowSansTreeHeight = self.sizes.rows[rd[self.uniqueId]] || self.style.cellHeight;\n treeHeight = (rowOpen ? self.sizes.trees[rd[self.uniqueId]] : 0);\n rowHeight = rowSansTreeHeight + treeHeight;\n if (y < rowHeight * -1) {\n return false;\n }\n if (self.attributes.showRowHeaders) {\n x += columnHeaderCellWidth;\n }\n cellHeight = rowHeight;\n for (o = self.scrollIndexLeft; o < g; o += 1) {\n i = self.orders.columns[o];\n x += drawCell(rd, r, d)(s[i], i, o);\n if (x > self.width) {\n break;\n }\n }\n // cell height might have changed during drawing\n cellHeight = rowHeight;\n x = (self.scrollBox.scrollLeft * -1) + self.scrollPixelLeft + self.style.cellBorderWidth;\n // don't draw a tree for the new row\n treeGrid = self.childGrids[rd[self.uniqueId]];\n if (r !== self.data.length && rowOpen) {\n treeGrid.visible = true;\n treeGrid.parentNode = {\n offsetTop: y + rowSansTreeHeight + self.canvasOffsetTop,\n offsetLeft: columnHeaderCellWidth - 1 + self.canvasOffsetLeft,\n offsetHeight: treeHeight,\n offsetWidth: self.width - columnHeaderCellWidth - self.style.scrollBarWidth - 1,\n offsetParent: self.intf.parentNode,\n parentNode: self.intf.parentNode,\n style: self.style,\n nodeType: 'canvas-datagrid-tree',\n scrollTop: self.scrollBox.scrollTop,\n scrollLeft: self.scrollBox.scrollLeft,\n rowIndex: r\n };\n self.visibleCells.unshift({\n rowIndex: x,\n columnIndex: 0,\n y: treeGrid.parentNode.offsetTop,\n x: treeGrid.parentNode.offsetLeft,\n height: treeGrid.parentNode.offsetHeight,\n width: treeGrid.parentNode.offsetWidth,\n style: 'tree-grid',\n type: treeGrid.parentNode.nodeType\n });\n treeGrid.draw();\n } else if (treeGrid) {\n treeGrid.parentNode.offsetHeight = 0;\n delete self.sizes.trees[rd[self.uniqueId]];\n }\n rowHeaders.push([rd, r, d, y, rowHeight]);\n y += cellHeight + self.style.cellBorderWidth;\n return true;\n }\n function initDraw() {\n self.visibleRows = [];\n s = self.getVisibleSchema();\n self.visibleCells = [];\n self.canvasOffsetTop = self.isChildGrid ? self.parentNode.offsetTop : 0;\n self.canvasOffsetLeft = self.isChildGrid ? self.parentNode.offsetLeft : 0;\n h = self.height;\n w = self.width;\n if (!self.isChildGrid) {\n self.ctx.scale(window.devicePixelRatio, window.devicePixelRatio);\n }\n }\n function drawBackground() {\n radiusRect(0, 0, w, h, 0);\n self.ctx.clip();\n self.ctx.fillStyle = self.style.backgroundColor;\n fillRect(0, 0, w, h);\n }\n function drawRows() {\n var o, n, i, g = s.length;\n x = (self.scrollBox.scrollLeft * -1) + self.scrollPixelLeft + self.style.cellBorderWidth;\n y = (self.scrollBox.scrollTop * -1) + rowHeaderCellHeight + self.scrollPixelTop + self.style.cellBorderWidth;\n for (r = self.scrollIndexTop; r < l; r += 1) {\n n = self.orders.rows[r];\n if (!drawRow(n, r)) {\n break;\n }\n }\n if (self.attributes.showNewRow) {\n if (self.attributes.showRowHeaders) {\n x += columnHeaderCellWidth;\n }\n rowHeight = cellHeight = self.style.cellHeight;\n rowOpen = false;\n for (o = self.scrollIndexLeft; o < g; o += 1) {\n i = self.orders.columns[o];\n x += drawCell(self.newRow, self.data.length, self.data.length)(s[i], i, o);\n if (x > self.width + self.scrollBox.scrollLeft) {\n break;\n }\n }\n rowHeaders.push([self.newRow, self.data.length, self.data.length, y, rowHeight]);\n }\n }\n function drawReorderMarkers() {\n if (!self.reorderObject) { return; }\n var b = {\n height: self.reorderObject.height,\n width: self.reorderObject.width,\n x: self.reorderObject.x + self.reorderObject.dragOffset.x,\n y: self.reorderObject.y + self.reorderObject.dragOffset.y\n },\n m = {\n width: w,\n heigth: h,\n x: 0,\n y: 0\n };\n self.ctx.fillStyle = self.style.reorderMarkerBackgroundColor;\n self.ctx.lineWidth = self.style.reorderMarkerBorderWidth;\n self.ctx.strokeStyle = self.style.reorderMarkerBorderColor;\n if (self.dragMode === 'row-reorder') {\n b.width = w;\n b.x = 0;\n m.width = w;\n m.y = self.currentCell.y;\n fillRect(b.x, b.y, b.width, b.height);\n strokeRect(b.x, b.y, b.width, b.height);\n self.ctx.lineWidth = self.style.reorderMarkerIndexBorderWidth;\n self.ctx.strokeStyle = self.style.reorderMarkerIndexBorderColor;\n if (self.currentCell.rowIndex !== self.reorderObject.rowIndex\n && self.currentCell.rowIndex - 1 !== self.reorderObject.rowIndex) {\n addBorderLine(m, 't');\n }\n } else if (self.dragMode === 'column-reorder' && self.reorderObject) {\n b.height = h;\n b.y = 0;\n m.height = h;\n m.x = self.currentCell.x;\n fillRect(b.x, b.y, b.width, b.height);\n strokeRect(b.x, b.y, b.width, b.height);\n self.ctx.lineWidth = self.style.reorderMarkerIndexBorderWidth;\n self.ctx.strokeStyle = self.style.reorderMarkerIndexBorderColor;\n if (self.currentCell.columnIndex !== self.reorderObject.columnIndex\n && self.currentCell.columnIndex - 1 !== self.reorderObject.columnIndex) {\n addBorderLine(m, 'l');\n }\n }\n }\n function drawBorder() {\n self.ctx.lineWidth = self.style.gridBorderWidth;\n self.ctx.strokeStyle = self.style.gridBorderColor;\n strokeRect(0, 0, self.width, self.height);\n }\n function drawSelectionBorders() {\n self.ctx.lineWidth = self.style.selectionOverlayBorderWidth;\n self.ctx.strokeStyle = self.style.selectionOverlayBorderColor;\n selectionBorders.forEach(function (c) {\n addBorderLine(c[0], c[1]);\n });\n }\n function drawActiveCell() {\n if (!aCell) { return; }\n if (self.attributes.rowSelectionMode) {\n if (self.activeCell && self.activeCell.rowIndex === aCell.rowIndex) {\n self.ctx.lineWidth = self.style.activeCellOverlayBorderWidth;\n self.ctx.strokeStyle = self.style.activeCellOverlayBorderColor;\n strokeRect(0, aCell.y, self.getHeaderWidth() + columnHeaderCellWidth, rowHeight);\n }\n } else {\n self.ctx.lineWidth = self.style.activeCellOverlayBorderWidth;\n self.ctx.strokeStyle = self.style.activeCellOverlayBorderColor;\n strokeRect(aCell.x, aCell.y, aCell.width, aCell.height);\n }\n\n }\n function drawDebug() {\n perfCounters[drawCount % perfWindowSize] = performance.now() - p;\n var d;\n if (self.attributes.debug) {\n self.ctx.font = '11px sans-serif';\n d = {};\n d.perf = (perfCounters.reduce(function (a, b) {\n return a + b;\n }, 0) / perfCounters.length).toFixed(1)\n + 'ms (' +\n perfCounters.map(function (a) { return a.toFixed(1); }).join(', ') + ')';\n d.htmlImages = Object.keys(self.htmlImageCache).length;\n d.scrollLeft = self.scrollBox.scrollLeft;\n d.scrollTop = self.scrollBox.scrollTop;\n d.scrollIndexTop = self.scrollIndexTop;\n d.scrollPixelTop = self.scrollPixelTop;\n d.scrollIndexLeft = self.scrollIndexLeft;\n d.scrollPixelLeft = self.scrollPixelLeft;\n d.canvasOffsetLeft = self.canvasOffsetLeft;\n d.canvasOffsetTop = self.canvasOffsetTop;\n d.width = self.width;\n d.height = self.height;\n d.mousex = self.mouse.x;\n d.mousey = self.mouse.y;\n d.touchx = !self.touchStart ? 0 : self.touchStart.x;\n d.touchy = !self.touchStart ? 0 : self.touchStart.y;\n d.entities = self.visibleCells.length;\n d.hasFocus = self.hasFocus;\n d.dragMode = self.dragMode;\n if (self.currentCell) {\n d.columnIndex = self.currentCell.columnIndex;\n d.rowIndex = self.currentCell.rowIndex;\n d.sortColumnIndex = self.currentCell.sortColumnIndex;\n d.sortRowIndex = self.currentCell.sortRowIndex;\n d.context = self.currentCell.context;\n d.dragContext = self.currentCell.dragContext;\n d.style = self.currentCell.style;\n d.type = self.currentCell.type;\n }\n self.ctx.save();\n Object.keys(d).forEach(function (key, index) {\n var m = key + ': ' + d[key],\n lh = 14;\n self.ctx.fillStyle = 'rgba(255, 255, 255, 0.8)';\n fillRect(columnHeaderCellWidth, lh + (index * lh), 100, lh);\n self.ctx.fillStyle = 'rgba(0, 0, 0, 1)';\n fillText(m, columnHeaderCellWidth + 1, rowHeaderCellHeight + (index * lh));\n });\n self.ctx.restore();\n }\n }\n self.ctx.save();\n initDraw();\n drawBackground();\n drawRows();\n drawSelectionBorders();\n drawActiveCell();\n drawHeaders();\n drawReorderMarkers();\n drawScrollBars();\n if (checkScrollHeight) {\n self.resize(true);\n }\n drawBorder();\n drawDebug();\n if (self.dispatchEvent('afterdraw', {})) { return; }\n self.ctx.restore();\n };\n };\n}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*jslint browser: true, unparam: true, todo: true*/\n/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/\n!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {\n 'use strict';\n return function (self) {\n var touchDelta = {x: 0, y: 0, scrollTop: 0, scrollLeft: 0},\n touchAnimateTo = {scrollLeft: 0, scrollTop: 0},\n touchSigma = {scrollLeft: 0, scrollTop: 0},\n xPPS = 0,\n yPPS = 0,\n touchingCell = false,\n startingCell = false,\n animationFrames = 0;\n self.getTouchPos = function (e) {\n var rect = self.canvas.getBoundingClientRect(),\n pos = {\n x: e.touches[0].clientX - rect.left,\n y: e.touches[0].clientY - rect.top\n };\n if (self.isChildGrid) {\n pos.x -= self.canvasOffsetLeft;\n pos.y -= self.canvasOffsetTop;\n }\n return {\n x: pos.x,\n y: pos.y,\n rect: rect\n };\n };\n self.calculatePPS = function () {\n xPPS = ((touchDelta.scrollLeft - touchSigma.scrollLeft) / (touchDelta.t - touchSigma.t));\n yPPS = ((touchDelta.scrollTop - touchSigma.scrollTop) / (touchDelta.t - touchSigma.t));\n touchSigma = {\n scrollLeft: touchDelta.scrollLeft,\n scrollTop: touchDelta.scrollTop,\n t: performance.now() / 1000\n };\n };\n self.touchCell = function (e) {\n return function () {\n clearInterval(self.touchCalcTimeout);\n var pos = self.getTouchPos(e);\n if (Math.abs(touchDelta.x) + Math.abs(touchDelta.y) < self.attributes.touchDeadZone) {\n touchingCell = self.getCellAt(pos.x, pos.y);\n self.mousemove(e, pos);\n self.mousedown(e, pos);\n self.mousemove(e, pos);\n self.draw();\n }\n };\n };\n self.touchstart = function (e) {\n touchingCell = false;\n self.touchStart = self.getTouchPos(e);\n startingCell = self.getCellAt(self.touchStart.x, self.touchStart.y, true);\n if (self.dispatchEvent('touchstart', {NativeEvent: e, cell: self.startingCell})) { return; }\n if (!self.hasFocus) { return; }\n self.stopPropagation(e);\n e.preventDefault();\n if (e.touches.length === 2) {\n return self.contextmenu(e, self.touchStart);\n }\n self.touchScrollStart = {\n scrollLeft: self.scrollBox.scrollLeft,\n scrollTop: self.scrollBox.scrollTop,\n t: performance.now() / 1000\n };\n touchDelta = {\n x: self.touchStart.x,\n y: self.touchStart.y,\n scrollLeft: self.scrollBox.scrollLeft,\n scrollTop: self.scrollBox.scrollTop,\n t: 0\n };\n self.touchmove(e);\n clearTimeout(self.touchTimeout);\n clearInterval(self.touchCalcTimeout);\n self.touchTimeout = setTimeout(self.touchCell(e), self.attributes.touchSelectTimeMs);\n self.touchCalcTimeout = setInterval(self.calculatePPS, 20);\n self.touchHaltAnimation = true;\n document.body.addEventListener('touchmove', self.touchmove, {passive: false});\n document.body.addEventListener('touchend', self.touchend, false);\n document.body.addEventListener('touchcancel', self.touchcancel, false);\n };\n self.easing = function (t, b, c, d) {\n return c * (t / d) * (2 - t) + b;\n };\n self.touchEndAnimation = function () {\n if (!self.canvas || !self.scrollBox.scrollTo) { return requestAnimationFrame(self.touchEndAnimation); }\n var x,\n y,\n n = performance.now() / 1000,\n d = (self.attributes.touchReleaseAnimationDurationMs / 1000),\n t;\n touchDelta.t = touchDelta.t || n + d;\n t = n - touchDelta.t + 1;\n if (t > 1 || self.touchHaltAnimation || (animationFrames > 1000)) {\n animationFrames = 0;\n self.touchHaltAnimation = false;\n touchAnimateTo = {scrollLeft: -1, scrollTop: -1};\n return;\n }\n animationFrames += 1;\n x = self.easing(t, touchDelta.scrollLeft, -touchAnimateTo.scrollLeft, d);\n y = self.easing(t, touchDelta.scrollTop, -touchAnimateTo.scrollTop, d);\n self.scrollBox.scrollTo(x, y);\n requestAnimationFrame(self.touchEndAnimation);\n };\n self.touchend = function (e) {\n if (self.dispatchEvent('touchend', {NativeEvent: e})) { return; }\n var dz = Math.abs(touchDelta.x) + Math.abs(touchDelta.y) < self.attributes.touchDeadZone,\n pos = {\n x: self.touchStart.x + touchDelta.x,\n y: self.touchStart.y + touchDelta.y\n },\n cell = self.getCellAt(pos.x, pos.y);\n if (!self.hasFocus) { return; }\n if (touchingCell) {\n self.mouseup(e, self.touchStart);\n } else if (dz) {\n if (cell.active) {\n self.beginEditAt(cell.columnIndex, cell.rowIndex);\n } else {\n self.mousedown(e, self.touchStart);\n self.mouseup(e, self.touchStart);\n self.click(e, self.touchStart);\n }\n }\n touchingCell = false;\n document.body.removeEventListener('touchmove', self.touchmove, {passive: false});\n document.body.removeEventListener('touchend', self.touchend, false);\n document.body.removeEventListener('touchcancel', self.touchcancel, false);\n clearTimeout(self.touchTimeout);\n clearInterval(self.touchCalcTimeout);\n self.calculatePPS();\n touchAnimateTo.scrollLeft = xPPS * self.attributes.touchReleaseAcceleration;\n touchAnimateTo.scrollTop = yPPS * self.attributes.touchReleaseAcceleration;\n self.touchHaltAnimation = false;\n if (animationFrames === 0 && !/-scroll-/.test(startingCell.style) && !dz) {\n self.touchEndAnimation();\n }\n };\n self.touchmove = function (e) {\n var d = self.getTouchPos(e);\n if (self.dispatchEvent('touchmove', {NativeEvent: e, cell: self.currentCell})) { return; }\n self.stopPropagation(e);\n e.preventDefault();\n if (!self.hasFocus) { return; }\n touchDelta = {\n x: d.x - self.touchStart.x,\n y: d.y - self.touchStart.y,\n scrollLeft: self.scrollBox.scrollLeft,\n scrollTop: self.scrollBox.scrollTop,\n t: 0\n };\n if (/vertical-scroll-/.test(startingCell.style)) {\n self.scrollBox.scrollTop = self.scrollBox.scrollHeight * (d.y / self.height);\n } else if (/horizontal-scroll-/.test(startingCell.style)) {\n self.scrollBox.scrollLeft = self.scrollBox.scrollWidth * (d.x / self.width);\n } else if (touchingCell) {\n self.mousemove(e, d);\n self.draw();\n } else {\n if (animationFrames === 0) {\n self.scrollBox.scrollTo(self.touchScrollStart.scrollLeft - touchDelta.x,\n self.touchScrollStart.scrollTop - touchDelta.y);\n }\n }\n };\n self.touchcancel = function (e) {\n if (self.dispatchEvent('touchcancel', {NativeEvent: e, cell: self.currentCell})) { return; }\n if (!self.hasFocus) { return; }\n self.touchend(e);\n touchingCell = false;\n document.body.removeEventListener('touchmove', self.touchmove, {passive: false});\n document.body.removeEventListener('touchend', self.touchend, false);\n document.body.removeEventListener('touchcancel', self.touchcancel, false);\n return;\n };\n self.stopPropagation = function (e) { e.stopPropagation(); };\n self.addEventListener = function (ev, fn) {\n self.events[ev] = self.events[ev] || [];\n self.events[ev].unshift(fn);\n };\n self.removeEventListener = function (ev, fn) {\n (self.events[ev] || []).forEach(function removeEachListener(sfn, idx) {\n if (fn === sfn) {\n self.events[ev].splice(idx, 1);\n }\n });\n };\n self.dispatchEvent = function (ev, e) {\n var defaultPrevented;\n function preventDefault() {\n defaultPrevented = true;\n }\n if (!self.events[ev]) { return; }\n self.events[ev].forEach(function dispatchEachEvent(fn) {\n e.ctx = self.ctx;\n e.preventDefault = preventDefault;\n fn.apply(self.intf, [e]);\n });\n return defaultPrevented;\n };\n self.resize = function (drawAfterResize) {\n var cellBorder = self.style.cellBorderWidth * 2,\n columnHeaderCellBorder = self.style.columnHeaderCellBorderWidth * 2,\n scrollHeight,\n scrollWidth,\n rowHeaderCellHeight = self.getRowHeaderCellHeight(),\n columnHeaderCellWidth = self.getColumnHeaderCellWidth(),\n // TODO: What the hell are these numbers!? They are probably some value in the style.\n scrollDragPositionOffsetY = 30,\n scrollDragPositionOffsetX = 15;\n if (self.isChildGrid) {\n self.height = self.parentNode.offsetHeight;\n self.width = self.parentNode.offsetWidth;\n } else {\n self.parentNode = self.parentDOMNode;\n if (!self.parentIsCanvas) {\n self.height = self.parentDOMNode.offsetHeight;\n self.width = self.parentDOMNode.offsetWidth;\n self.canvas.height = self.height * window.devicePixelRatio;\n self.canvas.width = self.width * window.devicePixelRatio;\n self.canvas.style.height = self.height + 'px';\n self.canvas.style.width = self.width + 'px';\n }\n self.canvasOffsetTop = self.args.canvasOffsetTop || 0;\n self.canvasOffsetLeft = self.args.canvasOffsetLeft || 0;\n }\n scrollHeight = self.data.reduce(function reduceData(accumulator, row) {\n return accumulator\n + (self.sizes.rows[row[self.uniqueId]] || self.style.cellHeight)\n + (self.sizes.trees[row[self.uniqueId]] || 0)\n + cellBorder;\n }, 0) || 0;\n scrollWidth = self.getVisibleSchema().reduce(function reduceSchema(accumulator, column) {\n if (column.hidden) { return accumulator; }\n return accumulator + (self.sizes.columns[column[self.uniqueId]] || column.width || self.style.columnWidth) + cellBorder;\n }, 0) || 0;\n if (self.attributes.showNewRow) {\n scrollHeight += self.style.cellHeight + cellBorder;\n }\n self.scrollBox.width = self.width - columnHeaderCellWidth;\n self.scrollBox.height = self.height - rowHeaderCellHeight - columnHeaderCellBorder;\n self.scrollBox.top = rowHeaderCellHeight + columnHeaderCellBorder;\n self.scrollBox.left = columnHeaderCellWidth;\n self.scrollBox.scrollHeight = scrollHeight + self.style.scrollBarWidth - self.scrollBox.height;\n self.scrollBox.scrollWidth = scrollWidth + self.style.scrollBarWidth - self.scrollBox.width;\n self.scrollBox.widthBoxRatio = ((self.scrollBox.width - scrollDragPositionOffsetX)\n / (self.scrollBox.scrollWidth + self.scrollBox.width - scrollDragPositionOffsetX));\n self.scrollBox.scrollBoxWidth = self.scrollBox.width\n * self.scrollBox.widthBoxRatio\n - self.style.scrollBarWidth;\n self.scrollBox.heightBoxRatio = ((self.scrollBox.height - scrollDragPositionOffsetY)\n / (self.scrollBox.scrollHeight + (self.scrollBox.height - scrollDragPositionOffsetY)));\n self.scrollBox.scrollBoxHeight = self.scrollBox.height\n * self.scrollBox.heightBoxRatio\n - self.style.scrollBarWidth;\n self.scrollBox.scrollBoxWidth = Math.max(self.scrollBox.scrollBoxWidth, self.style.scrollBarBoxMinSize);\n self.scrollBox.scrollBoxHeight = Math.max(self.scrollBox.scrollBoxHeight, self.style.scrollBarBoxMinSize);\n self.page = self.visibleRows.length - 3 - self.attributes.pageUpDownOverlap;\n self.resizeEditInput();\n self.scroll(true);\n if (drawAfterResize) {\n self.draw(true);\n }\n self.dispatchEvent('resize', {});\n return true;\n };\n self.resizeEditInput = function () {\n if (self.input) {\n var pos = self.canvas.getBoundingClientRect(),\n s = self.scrollOffset(self.canvas),\n bx2 = (self.style.cellBorderWidth * 2),\n cell = self.getVisibleCellByIndex(self.input.editCell.columnIndex, self.input.editCell.rowIndex)\n || {x: -100, y: -100, height: 0, width: 0};\n self.input.style.left = pos.left + cell.x - self.style.cellBorderWidth + self.canvasOffsetLeft - s.left + 'px';\n self.input.style.top = pos.top + cell.y - bx2 + self.canvasOffsetTop - s.top + 'px';\n self.input.style.height = cell.height - bx2 - 1 + 'px';\n self.input.style.width = cell.width - bx2 - self.style.cellPaddingLeft + 'px';\n self.clipElement(self.input);\n }\n };\n self.scroll = function (e, dontDraw) {\n var s = self.getVisibleSchema(),\n cellBorder = self.style.cellBorderWidth * 2;\n self.scrollIndexTop = 0;\n self.scrollPixelTop = 0;\n self.scrollIndexLeft = 0;\n self.scrollPixelLeft = 0;\n while (self.scrollPixelTop < self.scrollBox.scrollTop && self.scrollIndexTop < self.data.length) {\n self.scrollPixelTop +=\n (self.sizes.rows[self.data[self.scrollIndexTop][self.uniqueId]] || self.style.cellHeight)\n + (self.sizes.trees[self.data[self.scrollIndexTop][self.uniqueId]] || 0)\n + cellBorder;\n self.scrollIndexTop += 1;\n }\n while (self.scrollPixelLeft < self.scrollBox.scrollLeft && self.scrollIndexLeft < s.length) {\n self.scrollPixelLeft +=\n (self.sizes.columns[s[self.scrollIndexLeft][self.uniqueId]] || s[self.scrollIndexLeft].width);\n self.scrollIndexLeft += 1;\n }\n if (self.data.length > 0) {\n self.scrollIndexLeft = Math.max(self.scrollIndexLeft - 1, 0);\n self.scrollPixelLeft = Math.max(self.scrollPixelLeft\n - (self.sizes.columns[s[self.scrollIndexLeft][self.uniqueId]] || s[self.scrollIndexLeft].width), 0);\n self.scrollIndexTop = Math.max(self.scrollIndexTop - 1, 0);\n self.scrollPixelTop = Math.max(self.scrollPixelTop\n - (self.sizes.rows[self.data[self.scrollIndexTop][self.uniqueId]] || self.style.cellHeight)\n - (self.sizes.trees[self.data[self.scrollIndexTop][self.uniqueId]] || 0), 0);\n }\n self.ellipsisCache = {};\n if (!dontDraw) {\n self.draw(true);\n }\n //TODO: figure out why this has to be delayed for child grids\n //BUG: scrolling event on 3rd level hierarchy fails to move input box\n requestAnimationFrame(self.resizeEditInput);\n self.dispatchEvent('scroll', {top: self.scrollBox.scrollTop, left: self.scrollBox.scrollLeft});\n };\n self.mousemove = function (e, overridePos) {\n if (self.contextMenu || self.input) {\n return;\n }\n self.mouse = overridePos || self.getLayerPos(e);\n var ctrl = (e.controlKey || e.metaKey || self.attributes.persistantSelectionMode),\n i,\n s = self.getSchema(),\n dragBounds,\n sBounds,\n x = self.mouse.x,\n y = self.mouse.y,\n o = self.getCellAt(x, y),\n delta,\n ev = {NativeEvent: e, cell: o, x: x, y: y},\n previousCell = self.currentCell;\n clearTimeout(self.scrollTimer);\n if (!self.isInGrid({x: x, y: y})) {\n self.hasFocus = false;\n }\n if (self.dispatchEvent('mousemove', ev)) {\n return;\n }\n if (o && self.currentCell && (self.currentCell.rowIndex !== o.rowIndex\n || self.currentCell.columnIndex !== o.columnIndex)) {\n self.cellBoundaryCrossed = true;\n ev.cell = previousCell;\n self.dispatchEvent('cellmouseout', ev);\n ev.cell = o;\n self.dispatchEvent('cellmouseover', ev);\n }\n self.currentCell = o;\n if (!self.hasFocus) {\n return;\n }\n self.hovers = {};\n if (!self.draggingItem\n && o\n && self.scrollModes.indexOf(o.context) === -1) {\n self.dragItem = o;\n self.dragMode = o.dragContext;\n self.canvas.style.cursor = o.context;\n if (o.context === 'cell' && o.data) {\n self.canvas.style.cursor = 'pointer';\n self.hovers[o.data[self.uniqueId]] = [o.columnIndex];\n }\n if ((self.selecting || self.reorderObject)\n && o.context === 'cell'\n && o.data) {\n sBounds = self.getSelectionBounds();\n delta = {\n x: Math.abs(self.dragStart.x - x),\n y: Math.abs(self.dragStart.y - y),\n };\n if (self.dragStartObject.columnIndex !== -1 && e.shiftKey) {\n self.dragStartObject = {\n rowIndex: self.activeCell.rowIndex,\n columnIndex: self.activeCell.columnIndex\n };\n }\n dragBounds = {\n top: Math.min(self.dragStartObject.rowIndex, o.rowIndex),\n left: Math.min(self.dragStartObject.columnIndex, o.columnIndex),\n bottom: Math.max(self.dragStartObject.rowIndex, o.rowIndex),\n right: Math.max(self.dragStartObject.columnIndex, o.columnIndex)\n };\n if (self.dragStartObject.columnIndex === -1) {\n dragBounds.left = -1;\n dragBounds.right = s.length - 1;\n dragBounds.top = Math.min(sBounds.top, o.rowIndex);\n dragBounds.bottom = Math.max(sBounds.bottom, o.rowIndex);\n }\n if (self.dragStartObject.rowIndex !== o.rowIndex\n || self.dragStartObject.columnIndex !== o.columnIndex) {\n self.ignoreNextClick = true;\n }\n if (self.cellBoundaryCrossed || (delta.x === 0 && delta.y === 0) || self.attributes.rowSelectionMode) {\n if (self.attributes.rowSelectionMode || self.dragStartObject.columnIndex === -1) {\n self.selectRow(o.rowIndex, ctrl, null, true);\n } else {\n if (!self.dragAddToSelection && o.rowIndex !== undefined) {\n if (self.selections[o.rowIndex] && self.selections[o.rowIndex].indexOf(o.columnIndex) !== -1) {\n self.selections[o.rowIndex].splice(self.selections[o.rowIndex].indexOf(o.columnIndex), 1);\n }\n } else {\n self.selections[o.rowIndex] = self.selections[o.rowIndex] || [];\n if (self.selections[o.rowIndex].indexOf(o.columnIndex) === -1) {\n self.selections[o.rowIndex].push(o.columnIndex);\n }\n }\n }\n }\n if ((!self.selectionBounds || (dragBounds.top !== self.selectionBounds.top\n || dragBounds.left !== self.selectionBounds.left\n || dragBounds.bottom !== self.selectionBounds.bottom\n || dragBounds.right !== self.selectionBounds.right)) && !ctrl) {\n self.selections = [];\n sBounds = dragBounds;\n if (self.attributes.rowSelectionMode) {\n for (i = sBounds.top; i <= sBounds.bottom; i += 1) {\n self.selectRow(i, true, null, true);\n }\n } else {\n self.selectArea(sBounds, true);\n }\n }\n self.autoScrollZone(e, x, y, ctrl);\n }\n }\n self.cellBoundaryCrossed = false;\n self.draw(true);\n };\n self.click = function (e, overridePos) {\n var i,\n selectionChanged,\n ctrl = (e.controlKey || e.metaKey || self.attributes.persistantSelectionMode),\n pos = overridePos || self.getLayerPos(e);\n self.currentCell = self.getCellAt(pos.x, pos.y);\n if (self.currentCell.grid !== undefined) {\n return;\n }\n function checkSelectionChange() {\n if (!selectionChanged) { return; }\n self.dispatchEvent('selectionchanged', {\n selectedData: self.getSelectedData(),\n selections: self.selections,\n selectionBounds: self.selectionBounds\n });\n }\n if (self.input) {\n self.endEdit();\n }\n if (self.ignoreNextClick) {\n self.ignoreNextClick = false;\n return;\n }\n i = self.currentCell;\n if (self.dispatchEvent('click', {NativeEvent: e, cell: self.currentCell})) { return; }\n if (!self.hasFocus) {\n return;\n }\n if (self.currentCell.context === 'cell') {\n if (self.currentCell.style === 'cornerCell') {\n self.order(self.uniqueId, 'asc', self.sorters.number);\n self.setFilter();\n checkSelectionChange();\n return;\n }\n if (self.currentCell.style === 'columnHeaderCell') {\n if (self.attributes.columnHeaderClickBehavior === 'sort') {\n if (self.orderBy === i.header.name) {\n self.orderDirection = self.orderDirection === 'asc' ? 'desc' : 'asc';\n } else {\n self.orderDirection = 'asc';\n }\n self.order(i.header.name, self.orderDirection);\n checkSelectionChange();\n return;\n }\n if (self.attributes.columnHeaderClickBehavior === 'select') {\n self.selectColumn(i.header.index, ctrl, e.shiftKey, true);\n checkSelectionChange();\n self.draw();\n return;\n }\n }\n if (['rowHeaderCell', 'columnHeaderCell'].indexOf(self.currentCell.style) === -1 && !ctrl) {\n self.setActiveCell(i.columnIndex, i.rowIndex);\n }\n self.selections[i.rowIndex] = self.selections[i.rowIndex] || [];\n if ((self.attributes.rowSelectionMode || self.currentCell.style === 'rowHeaderCell')) {\n if (self.currentCell.style === 'rowHeaderCell'\n && self.attributes.tree && pos.x > 0\n && pos.x - self.currentCell.x < self.style.treeArrowWidth\n + self.style.treeArrowMarginLeft\n + self.style.treeArrowMarginRight + self.style.treeArrowClickRadius\n && pos.y - self.currentCell.y < self.style.treeArrowHeight\n + self.style.treeArrowMarginTop + self.style.treeArrowClickRadius\n && pos.y > 0) {\n self.toggleTree(i.rowIndex);\n return;\n }\n selectionChanged = true;\n self.selectRow(i.rowIndex, ctrl, null, true);\n }\n if (e.shiftKey && !ctrl) {\n self.selectionBounds = self.getSelectionBounds();\n self.selectArea(undefined, false);\n }\n }\n checkSelectionChange();\n self.draw(true);\n };\n self.dragResizeColumn = function (e) {\n var pos, x, y;\n pos = self.getLayerPos(e);\n x = self.resizingStartingWidth + pos.x - self.dragStart.x;\n y = self.resizingStartingHeight + pos.y - self.dragStart.y;\n if (x < self.style.minColumnWidth) {\n x = self.style.minColumnWidth;\n }\n if (y < self.style.minRowHeight) {\n y = self.style.minRowHeight;\n }\n if (self.dispatchEvent('resizecolumn', {x: x, y: y, draggingItem: self.draggingItem})) { return false; }\n if (self.scrollBox.scrollLeft > self.scrollBox.scrollWidth - self.attributes.resizeScrollZone\n && self.dragMode === 'ew-resize') {\n self.resize(true);\n self.scrollBox.scrollLeft += x;\n }\n if (self.dragMode === 'ew-resize') {\n self.sizes.columns[self.draggingItem.header.style === 'rowHeaderCell'\n ? 'cornerCell' : self.draggingItem.header[self.uniqueId]] = x;\n if (['rowHeaderCell', 'cornerCell'].indexOf(self.draggingItem.header.style) !== -1) {\n self.resize(true);\n }\n self.resizeChildGrids();\n return;\n }\n if (self.dragMode === 'ns-resize') {\n if (self.draggingItem.rowOpen) {\n self.sizes.trees[self.draggingItem.data[self.uniqueId]] = y;\n } else if (self.attributes.globalRowResize) {\n self.style.cellHeight = y;\n } else {\n self.sizes.rows[self.draggingItem.data[self.uniqueId]] = y;\n }\n self.dispatchEvent('resizerow', {row: y});\n self.resizeChildGrids();\n return;\n }\n self.ellipsisCache = {};\n };\n self.stopDragResize = function () {\n self.resize();\n document.body.removeEventListener('mousemove', self.dragResizeColumn, false);\n document.body.removeEventListener('mouseup', self.stopDragResize, false);\n self.setStorageData();\n self.draw(true);\n self.ignoreNextClick = true;\n };\n self.scrollGrid = function (e) {\n var pos = self.getLayerPos(e);\n if (self.attributes.scrollPointerLock && self.pointerLockPosition\n && ['horizontal-scroll-box', 'vertical-scroll-box'].indexOf(self.scrollStartMode) !== -1) {\n self.pointerLockPosition.x += e.movementX;\n self.pointerLockPosition.y += e.movementY;\n pos = self.pointerLockPosition;\n }\n self.scrollMode = self.getCellAt(pos.x, pos.y).context;\n if (self.scrollMode === 'horizontal-scroll-box' && self.scrollStartMode !== 'horizontal-scroll-box') {\n self.scrollStartMode = 'horizontal-scroll-box';\n self.dragStart = pos;\n self.scrollStart.left = self.scrollBox.scrollLeft;\n clearTimeout(self.scrollTimer);\n return;\n }\n if (self.scrollMode === 'vertical-scroll-box' && self.scrollStartMode !== 'vertical-scroll-box') {\n self.scrollStartMode = 'vertical-scroll-box';\n self.dragStart = pos;\n self.scrollStart.top = self.scrollBox.scrollTop;\n clearTimeout(self.scrollTimer);\n return;\n }\n if (self.scrollStartMode === 'vertical-scroll-box'\n && self.scrollMode !== 'vertical-scroll-box') {\n self.scrollMode = 'vertical-scroll-box';\n }\n if (self.scrollStartMode === 'horizontal-scroll-box'\n && self.scrollMode !== 'horizontal-scroll-box') {\n self.scrollMode = 'horizontal-scroll-box';\n }\n clearTimeout(self.scrollTimer);\n if (self.scrollModes.indexOf(self.scrollMode) === -1) {\n return;\n }\n if (self.scrollMode === 'vertical-scroll-box') {\n self.scrollBox.scrollTop = self.scrollStart.top + ((pos.y - self.dragStart.y)\n / self.scrollBox.heightBoxRatio);\n } else if (self.scrollMode === 'vertical-scroll-top') {\n self.scrollBox.scrollTop -= (self.page * self.style.cellHeight);\n self.scrollTimer = setTimeout(self.scrollGrid, self.attributes.scrollRepeatRate, e);\n } else if (self.scrollMode === 'vertical-scroll-bottom') {\n self.scrollBox.scrollTop += (self.page * self.style.cellHeight);\n self.scrollTimer = setTimeout(self.scrollGrid, self.attributes.scrollRepeatRate, e);\n }\n if (self.scrollMode === 'horizontal-scroll-box') {\n self.scrollBox.scrollLeft = self.scrollStart.left + ((pos.x - self.dragStart.x)\n / self.scrollBox.widthBoxRatio);\n } else if (self.scrollMode === 'horizontal-scroll-right') {\n self.scrollBox.scrollLeft += self.attributes.selectionScrollIncrement;\n self.scrollTimer = setTimeout(self.scrollGrid, self.attributes.scrollRepeatRate, e);\n } else if (self.scrollMode === 'horizontal-scroll-left') {\n self.scrollBox.scrollLeft -= self.attributes.selectionScrollIncrement;\n self.scrollTimer = setTimeout(self.scrollGrid, self.attributes.scrollRepeatRate, e);\n }\n };\n self.stopScrollGrid = function () {\n clearTimeout(self.scrollTimer);\n if (document.exitPointerLock) {\n document.exitPointerLock();\n }\n document.body.removeEventListener('mousemove', self.scrollGrid, false);\n };\n self.dragReorder = function (e) {\n var pos, x, y;\n pos = self.getLayerPos(e);\n x = pos.x - self.dragStart.x;\n y = pos.y - self.dragStart.y;\n if (!self.attributes.allowColumnReordering && self.dragMode === 'column-reorder') {\n return;\n }\n if (!self.attributes.allowRowReordering && self.dragMode === 'row-reorder') {\n return;\n }\n if (self.dispatchEvent('reordering', {\n NativeEvent: e,\n source: self.dragStartObject,\n target: self.currentCell,\n dragMode: self.dragMode\n })) {\n return;\n }\n if (Math.abs(x) > self.attributes.reorderDeadZone || Math.abs(y) > self.attributes.reorderDeadZone) {\n self.reorderObject = self.dragStartObject;\n self.reorderTarget = self.currentCell;\n self.reorderObject.dragOffset = {\n x: x,\n y: y\n };\n self.autoScrollZone(e, pos.x, pos.x, false);\n }\n };\n self.stopDragReorder = function (e) {\n var cr = {\n 'row-reorder': self.orders.rows,\n 'column-reorder': self.orders.columns\n },\n i = {\n 'row-reorder': 'rowIndex',\n 'column-reorder': 'columnIndex'\n }[self.dragMode];\n document.body.removeEventListener('mousemove', self.dragReorder, false);\n document.body.removeEventListener('mouseup', self.stopDragReorder, false);\n if (self.reorderObject\n && self.reorderTarget) {\n self.ignoreNextClick = true;\n if (self.reorderObject[i] !== self.reorderTarget[i]\n && !self.dispatchEvent('reorder', {\n NativeEvent: e,\n source: self.reorderObject,\n target: self.reorderTarget,\n dragMode: self.dragMode\n })) {\n cr[self.dragMode].splice(cr[self.dragMode].indexOf(self.reorderObject[i]), 1);\n cr[self.dragMode].splice(cr[self.dragMode].indexOf(self.reorderTarget[i]), 0, self.reorderObject[i]);\n self.setStorageData();\n }\n }\n self.reorderObject = undefined;\n self.reorderTarget = undefined;\n self.draw(true);\n };\n self.mousedown = function (e, overridePos) {\n self.lastMouseDownTarget = e.target;\n if (self.dispatchEvent('mousedown', {NativeEvent: e, cell: self.currentCell})) { return; }\n if (!self.hasFocus) {\n return;\n }\n if (e.button === 2 || self.input) { return; }\n var ctrl = (e.controlKey || e.metaKey);\n self.dragStart = overridePos || self.getLayerPos(e);\n self.scrollStart = {\n left: self.scrollBox.scrollLeft,\n top: self.scrollBox.scrollTop\n };\n self.dragStartObject = self.getCellAt(self.dragStart.x, self.dragStart.y);\n self.dragAddToSelection = !self.dragStartObject.selected;\n if (!ctrl && !e.shiftKey && !/(vertical|horizontal)-scroll-(bar|box)/\n .test(self.dragStartObject.context) && !self.currentCell.isColumnHeader) {\n self.selections = [];\n }\n if (self.dragStartObject.isGrid) {\n return;\n }\n if (self.scrollModes.indexOf(self.dragStartObject.context) !== -1) {\n self.scrollMode = self.dragStartObject.context;\n self.scrollStartMode = self.dragStartObject.context;\n self.scrollGrid(e);\n if (self.attributes.scrollPointerLock\n && ['horizontal-scroll-box', 'vertical-scroll-box'].indexOf(self.scrollStartMode) !== -1) {\n self.pointerLockPosition = {\n x: self.dragStart.x,\n y: self.dragStart.y\n };\n self.canvas.requestPointerLock();\n }\n document.body.addEventListener('mousemove', self.scrollGrid, false);\n document.body.addEventListener('mouseup', self.stopScrollGrid, false);\n self.ignoreNextClick = true;\n return;\n }\n if (self.dragMode === 'cell') {\n self.selecting = true;\n if (self.attributes.rowSelectionMode) {\n self.selectRow(self.dragStartObject.rowIndex, ctrl, null, true);\n }\n return self.mousemove(e);\n }\n if (['ns-resize', 'ew-resize'].indexOf(self.dragMode) !== -1) {\n self.draggingItem = self.dragItem;\n if (self.draggingItem.rowOpen) {\n self.resizingStartingHeight = self.sizes.trees[self.draggingItem.data[self.uniqueId]];\n } else {\n self.resizingStartingHeight = self.sizes.rows[self.draggingItem.data[self.uniqueId]] || self.style.cellHeight;\n }\n self.resizingStartingWidth = self.sizes.columns[self.draggingItem.header.style === 'rowHeaderCell'\n ? 'cornerCell' : self.draggingItem.header[self.uniqueId]] || self.draggingItem.header.width;\n document.body.addEventListener('mousemove', self.dragResizeColumn, false);\n document.body.addEventListener('mouseup', self.stopDragResize, false);\n }\n if (['row-reorder', 'column-reorder'].indexOf(self.dragMode) !== -1) {\n self.draggingItem = self.dragItem;\n document.body.addEventListener('mousemove', self.dragReorder, false);\n document.body.addEventListener('mouseup', self.stopDragReorder, false);\n }\n };\n self.mouseup = function (e) {\n clearTimeout(self.scrollTimer);\n self.cellBoundaryCrossed = true;\n self.selecting = undefined;\n self.draggingItem = undefined;\n self.dragStartObject = undefined;\n if (self.dispatchEvent('mouseup', {NativeEvent: e, cell: self.currentCell})) { return; }\n if (!self.hasFocus && e.target !== self.canvas) {\n return;\n }\n if (self.currentCell && self.currentCell.grid !== undefined) {\n return;\n }\n if (self.contextMenu || self.input) { return; }\n if (self.dragStart && self.isInGrid(self.dragStart)) {\n self.controlInput.focus();\n }\n e.preventDefault();\n };\n self.keydown = function (e) {\n var i,\n x = self.activeCell.columnIndex,\n y = self.activeCell.rowIndex,\n ctrl = (e.controlKey || e.metaKey),\n last = self.data.length - 1,\n cols = self.getVisibleSchema().length - 1;\n if (self.dispatchEvent('keydown', {NativeEvent: e, cell: self.currentCell})) { return; }\n if (!self.hasFocus) {\n return;\n }\n self.page = self.visibleRows.length - 3 - self.attributes.pageUpDownOverlap;\n if (self.attributes.showNewRow) {\n last += 1;\n }\n if (e.keyCode === 9) {\n e.preventDefault();\n }\n // ctrl + a\n if (ctrl && e.keyCode === 65) {\n self.selectAll();\n //ArrowDown\n } else if (e.keyCode === 40) {\n y += 1;\n //ArrowUp\n } else if (e.keyCode === 38) {\n y -= 1;\n //ArrowLeft Tab\n } else if (e.keyCode === 37 || (e.shiftKey && e.keyCode === 9)) {\n x -= 1;\n //ArrowRight Tab\n } else if (e.keyCode === 39 || (!e.shiftKey && e.keyCode === 9)) {\n x += 1;\n //PageUp\n } else if (e.keyCode === 33) {\n y -= self.page;\n e.preventDefault();\n //PageDown\n } else if (e.keyCode === 34) {\n y += self.page;\n e.preventDefault();\n //Home ArrowUp\n } else if (e.keyCode === 36 || (ctrl && e.keyCode === 38)) {\n y = 0;\n //End ArrowDown\n } else if (e.keyCode === 35 || (ctrl && e.keyCode === 40)) {\n y = self.data.length - 1;\n //ArrowRight\n } else if (ctrl && e.keyCode === 39) {\n x = cols;\n //ArrowLeft\n } else if (ctrl && e.keyCode === 37) {\n x = 0;\n }\n //Enter\n if (e.keyCode === 13) {\n return self.beginEditAt(x, y);\n }\n //Space\n if (e.keyCode === 32) {\n self.selections = [];\n self.selections[Math.max(y, 0)] = [];\n self.selections[Math.max(y, 0)].push(x);\n self.selectionBounds = self.getSelectionBounds();\n if (self.attributes.rowSelectionMode) {\n for (i = self.selectionBounds.top; i <= self.selectionBounds.bottom; i += 1) {\n self.selectRow(i, ctrl, null, true);\n }\n } else {\n self.selectArea(undefined, ctrl);\n }\n e.preventDefault();\n self.draw(true);\n return;\n }\n if (x < 0) {\n x = 0;\n }\n if (y > last) {\n y = last;\n }\n if (y < 0) {\n y = 0;\n }\n if (x > cols) {\n x = cols;\n }\n // Arrows\n if (e.shiftKey && [37, 38, 39, 40].indexOf(e.keyCode) !== -1) {\n self.selections[Math.max(y, 0)] = self.selections[Math.max(y, 0)] || [];\n self.selections[Math.max(y, 0)].push(x);\n self.selectionBounds = self.getSelectionBounds();\n self.selectArea(undefined, ctrl);\n self.draw(true);\n }\n if (x !== self.activeCell.columnIndex || y !== self.activeCell.rowIndex) {\n self.scrollIntoView(x !== self.activeCell.columnIndex ? x : undefined, y !== self.activeCell.rowIndex ? y : undefined);\n self.setActiveCell(x, y);\n if (!e.shiftKey && self.attributes.selectionFollowsActiveCell) {\n if (!ctrl) {\n self.selections = [];\n }\n self.selections[y] = self.selections[y] || [];\n self.selections[y].push(x);\n self.dispatchEvent('selectionchanged', {\n selectedData: self.getSelectedData(),\n selections: self.selections,\n selectionBounds: self.selectionBounds\n });\n }\n self.draw(true);\n }\n };\n self.keyup = function (e) {\n if (self.dispatchEvent('keyup', {NativeEvent: e, cell: self.currentCell})) { return; }\n if (!self.hasFocus) {\n return;\n }\n self.controlInput.value = '';\n };\n self.keypress = function (e) {\n if (!self.hasFocus) {\n return;\n }\n if (self.dispatchEvent('keypress', {NativeEvent: e, cell: self.currentCell})) { return; }\n };\n self.dblclick = function (e) {\n if (self.dispatchEvent('dblclick', {NativeEvent: e, cell: self.currentCell})) { return; }\n if (!self.hasFocus) {\n return;\n }\n if (self.currentCell.context === 'ew-resize'\n && self.currentCell.style === 'columnHeaderCell') {\n self.fitColumnToValues(self.currentCell.header.name);\n } else if (self.currentCell.context === 'ew-resize'\n && self.currentCell.style === 'cornerCell') {\n self.autosize();\n } else if (['cell', 'activeCell'].indexOf(self.currentCell.style) !== -1) {\n self.beginEditAt(self.currentCell.columnIndex, self.currentCell.rowIndex);\n }\n };\n self.scrollWheel = function (e) {\n if (self.dispatchEvent('wheel', {NativeEvent: e})) {\n return;\n }\n self.touchHaltAnimation = true;\n var l = self.scrollBox.scrollLeft,\n t = self.scrollBox.scrollTop;\n if (self.hasFocus) {\n self.scrollBox.scrollTop += e.deltaY;\n self.scrollBox.scrollLeft += e.deltaX;\n }\n if (t !== self.scrollBox.scrollTop || l !== self.scrollBox.scrollLeft) {\n e.preventDefault();\n }\n };\n self.copy = function (e) {\n if (self.dispatchEvent('copy', {NativeEvent: e})) { return; }\n if (!self.hasFocus || !e.clipboardData) { return; }\n var rows = [], sData = self.getSelectedData();\n if (sData.length > 0) {\n sData.forEach(function (row) {\n if (row) {\n var r = [];\n Object.keys(row).forEach(function (key) {\n r.push('\"' + row[key].replace(/\"/g, '\"\"') + '\"');\n });\n r.join(',');\n rows.push(r);\n }\n });\n e.clipboardData.setData('text/plain', rows.join('\\n'));\n e.preventDefault();\n }\n };\n return;\n };\n}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*jslint browser: true, unparam: true, todo: true*/\n/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/\n!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {\n 'use strict';\n return function (self) {\n self.orders = {\n rows: [],\n columns: []\n };\n self.hasFocus = false;\n self.activeCell = {\n columnIndex: 0,\n rowIndex: 0\n };\n self.storageName = 'canvasDataGrid';\n self.invalidSearchExpClass = 'canvas-datagrid-invalid-search-regExp';\n self.localStyleLibraryStorageKey = 'canvas-datagrid-user-style-library';\n self.uniqueId = '_canvasDataGridUniqueId';\n self.orderBy = self.uniqueId;\n self.orderDirection = 'asc';\n self.columnFilters = {};\n self.filters = {};\n self.ellipsisCache = {};\n self.scrollBox = {};\n self.visibleRows = [];\n self.sizes = {\n rows: {},\n columns: {},\n trees: {}\n };\n self.currentFilter = function () {\n return true;\n };\n self.selections = [];\n self.hovers = {};\n self.attributes = {};\n self.style = {};\n self.intf = {};\n self.formatters = {};\n self.sorters = {};\n self.schemaHashes = {};\n self.events = {};\n self.uId = 0;\n self.changes = [];\n self.scrollIndexTop = 0;\n self.scrollPixelTop = 0;\n self.scrollIndexLeft = 0;\n self.scrollPixelLeft = 0;\n self.childGrids = {};\n self.openChildren = {};\n self.scrollModes = [\n 'vertical-scroll-box',\n 'vertical-scroll-top',\n 'vertical-scroll-bottom',\n 'horizontal-scroll-box',\n 'horizontal-scroll-right',\n 'horizontal-scroll-left'\n ];\n self.mouse = { x: 0, y: 0};\n self.getSelectedData = function (expandToRow) {\n var d = [], s = self.getSchema(), l = self.data.length;\n self.selections.forEach(function (row, index) {\n if (index === l) { return; }\n if (row.length === 0) {\n d[index] = null;\n return;\n }\n d[index] = {};\n if (expandToRow) {\n s.forEach(function (column) {\n d[index][column.name] = self.data[index][column.name];\n });\n } else {\n row.forEach(function (col) {\n if (col === -1) { return; }\n d[index][s[col].name] = self.data[index][s[col].name];\n });\n }\n });\n return d;\n };\n self.scrollOffset = function (e) {\n var x = 0, y = 0;\n while (e.parentNode) {\n if (e.nodeType !== 'canvas-datagrid-tree'\n && e.nodeType !== 'canvas-datagrid-cell') {\n x -= e.scrollLeft;\n y -= e.scrollTop;\n }\n e = e.parentNode;\n }\n return {left: x, top: y};\n };\n self.position = function (e, ignoreScrollOffset) {\n var x = 0, y = 0, s = e, h, w;\n while (e.offsetParent) {\n x += e.offsetLeft;\n y += e.offsetTop;\n h = e.offsetHeight;\n w = e.offsetWidth;\n e = e.offsetParent;\n }\n if (ignoreScrollOffset) {\n return {left: x, top: y, height: h, width: w};\n }\n e = s;\n s = self.scrollOffset(e);\n return { left: x + s.left, top: y + s.top, height: h, width: w };\n };\n self.getLayerPos = function (e) {\n var rect = self.canvas.getBoundingClientRect(),\n pos = {\n x: e.clientX - rect.left,\n y: e.clientY - rect.top\n };\n if (self.isChildGrid) {\n pos.x -= self.canvasOffsetLeft;\n pos.y -= self.canvasOffsetTop;\n }\n return {\n x: pos.x,\n y: pos.y,\n rect: rect\n };\n };\n self.fillArray = function (low, high, step) {\n step = step || 1;\n var i = [], x;\n for (x = low; x <= high; x += step) {\n i[x] = x;\n }\n return i;\n };\n self.getRowHeaderCellHeight = function () {\n if (!self.attributes.showColumnHeaders) { return 0; }\n return self.sizes.rows[-1] || self.style.columnHeaderCellHeight;\n };\n self.getColumnHeaderCellWidth = function () {\n if (!self.attributes.showRowHeaders) { return 0; }\n return self.sizes.columns.cornerCell || self.style.rowHeaderCellWidth;\n };\n self.setStorageData = function () {\n if (!self.attributes.saveAppearance) { return; }\n localStorage.setItem(self.storageName + '-' + self.attributes.name, JSON.stringify({\n sizes: {\n rows: self.sizes.rows,\n columns: self.sizes.columns\n },\n orders: {\n rows: self.orders.rows,\n columns: self.orders.columns\n },\n orderBy: self.orderBy,\n orderDirection: self.orderDirection\n }));\n };\n self.getSchema = function () {\n return self.schema || self.tempSchema;\n };\n self.createColumnOrders = function () {\n var s = self.getSchema();\n self.orders.columns = self.fillArray(0, s.length - 1);\n };\n self.createRowOrders = function () {\n self.orders.rows = self.fillArray(0, self.data.length - 1);\n };\n self.getVisibleSchema = function () {\n return self.getSchema().filter(function (col) { return !col.hidden; });\n };\n self.applyDefaultValue = function (row, header) {\n var d = header.defaultValue || '';\n if (typeof d === 'function') {\n d = d.apply(self.intf, [header]);\n }\n row[header.name] = d;\n };\n self.createNewRowData = function () {\n self.newRow = {};\n self.newRow[self.uniqueId] = self.uId;\n self.uId += 1;\n self.getSchema().forEach(function forEachHeader(header) {\n self.applyDefaultValue(self.newRow, header);\n });\n };\n self.getSchemaNameHash = function (key) {\n var n = 0;\n while (self.schemaHashes[key]) {\n n += 1;\n key = key + n;\n }\n return key;\n };\n self.filter = function (type) {\n var f = self.filters[type];\n if (!f && type !== undefined) {\n console.warn('Cannot find filter for type %s, falling back to substring match.', type);\n f = self.filters.string;\n }\n return f;\n };\n self.getBestGuessDataType = function (columnName) {\n var t, x, l = self.data.length;\n for (x = 0; x < l; x += 1) {\n if ([null, undefined].indexOf(self.data[x][columnName]) !== -1) {\n t = typeof self.data[x];\n return t === 'object' ? 'string' : t;\n }\n }\n return 'string';\n };\n self.drawChildGrids = function () {\n Object.keys(self.childGrids).forEach(function (gridKey) {\n self.childGrids[gridKey].draw();\n });\n };\n self.resizeChildGrids = function () {\n Object.keys(self.childGrids).forEach(function (gridKey) {\n self.childGrids[gridKey].resize();\n });\n };\n self.getClippingRect = function (ele) {\n var boundingRect = self.position(self.parentNode),\n eleRect = self.position(ele),\n s = self.scrollOffset(self.canvas),\n clipRect = {\n x: 0,\n y: 0,\n h: 0,\n w: 0\n },\n parentRect = {\n x: -Infinity,\n y: -Infinity,\n h: Infinity,\n w: Infinity\n },\n rowHeaderCellHeight = self.getRowHeaderCellHeight(),\n columnHeaderCellWidth = self.getColumnHeaderCellWidth();\n boundingRect.top -= s.top;\n boundingRect.left -= s.left;\n eleRect.top -= s.top;\n eleRect.left -= s.left;\n clipRect.h = boundingRect.top + boundingRect.height - ele.offsetTop - self.style.scrollBarWidth;\n clipRect.w = boundingRect.left + boundingRect.width - ele.offsetLeft - self.style.scrollBarWidth;\n clipRect.x = boundingRect.left + (eleRect.left * -1) + columnHeaderCellWidth;\n clipRect.y = boundingRect.top + (eleRect.top * -1) + rowHeaderCellHeight;\n return {\n x: clipRect.x > parentRect.x ? clipRect.x : parentRect.x,\n y: clipRect.y > parentRect.y ? clipRect.y : parentRect.y,\n h: clipRect.h < parentRect.h ? clipRect.h : parentRect.h,\n w: clipRect.w < parentRect.w ? clipRect.w : parentRect.w\n };\n };\n self.clipElement = function (ele) {\n var clipRect = self.getClippingRect(ele);\n if (clipRect.w < 0) { clipRect.w = 0; }\n if (clipRect.h < 0) { clipRect.h = 0; }\n ele.style.clip = 'rect('\n + clipRect.y + 'px,'\n + clipRect.w + 'px,'\n + clipRect.h + 'px,'\n + clipRect.x + 'px'\n + ')';\n // INFO https://developer.mozilla.org/en-US/docs/Web/CSS/clip\n // clip has been \"deprecated\" for clipPath. Of course nothing but chrome\n // supports clip path, so we'll keep using clip until someday clipPath becomes\n // more widely support. The code below works correctly, but setting clipPath and clip\n // at the same time has undesirable results.\n // ele.style.clipPath = 'polygon('\n // + clipRect.x + 'px ' + clipRect.y + 'px,'\n // + clipRect.x + 'px ' + clipRect.h + 'px,'\n // + clipRect.w + 'px ' + clipRect.h + 'px,'\n // + clipRect.w + 'px ' + clipRect.y + 'px'\n // + ')';\n };\n self.autoScrollZone = function (e, x, y, ctrl) {\n var setTimer,\n columnHeaderCellWidth = self.getColumnHeaderCellWidth(),\n rowHeaderCellHeight = self.getRowHeaderCellHeight();\n if (x > self.width - self.attributes.selectionScrollZone && x < self.width) {\n self.scrollBox.scrollLeft += self.attributes.selectionScrollIncrement;\n setTimer = true;\n }\n if (y > self.height - self.attributes.selectionScrollZone && y < self.height) {\n self.scrollBox.scrollTop += self.attributes.selectionScrollIncrement;\n setTimer = true;\n }\n if (x - self.attributes.selectionScrollZone - columnHeaderCellWidth < 0) {\n self.scrollBox.scrollLeft -= self.attributes.selectionScrollIncrement;\n setTimer = true;\n }\n if (y - self.attributes.selectionScrollZone - rowHeaderCellHeight < 0) {\n self.scrollBox.scrollTop -= self.attributes.selectionScrollIncrement;\n setTimer = true;\n }\n if (setTimer && !ctrl && self.currentCell && self.currentCell.columnIndex !== -1) {\n self.scrollTimer = setTimeout(self.mousemove, self.attributes.scrollRepeatRate, e);\n }\n };\n self.refreshFromOrigialData = function () {\n self.data = self.originalData.filter(function (row) {\n return true;\n });\n };\n self.validateColumn = function (c, s) {\n if (!c.name) {\n throw new Error('A column must contain at least a name.');\n }\n if (s.filter(function (i) { return i.name === c.name; }).length > 0) {\n throw new Error('A column with the name '\n + c.name + ' already exists and cannot be added again.');\n }\n return true;\n };\n self.setDefaults = function (obj1, obj2, key, def) {\n obj1[key] = obj2[key] === undefined ? def : obj2[key];\n };\n self.setAttributes = function () {\n self.defaults.attributes.forEach(function eachAttribute(i) {\n self.setDefaults(self.attributes, self.args, i[0], i[1]);\n });\n };\n self.setStyle = function () {\n self.defaults.styles.forEach(function eachStyle(i) {\n self.setDefaults(self.style, self.args.style || {}, i[0], i[1]);\n });\n };\n self.autosize = function (colName) {\n self.getVisibleSchema().forEach(function (col) {\n if (col.name === colName || colName === undefined) {\n self.fitColumnToValues(col.name);\n }\n });\n self.fitColumnToValues('cornerCell');\n };\n self.dispose = function () {\n if (!self.isChildGrid && self.canvas && self.canvas.parentNode) {\n self.canvas.parentNode.removeChild(self.canvas);\n }\n self.eventParent.removeEventListener('mouseup', self.mouseup, false);\n self.eventParent.removeEventListener('mousedown', self.mousedown, false);\n self.eventParent.removeEventListener('dblclick', self.dblclick, false);\n self.eventParent.removeEventListener('click', self.click, false);\n self.eventParent.removeEventListener('mousemove', self.mousemove);\n self.eventParent.removeEventListener('wheel', self.scrollWheel, false);\n self.canvas.removeEventListener('contextmenu', self.contextmenu, false);\n self.canvas.removeEventListener('copy', self.copy);\n self.controlInput.removeEventListener('keypress', self.keypress, false);\n self.controlInput.removeEventListener('keyup', self.keyup, false);\n self.controlInput.removeEventListener('keydown', self.keydown, false);\n window.removeEventListener('resize', self.resize);\n if (self.observer && self.observer.disconnect) {\n self.observer.disconnect();\n }\n };\n self.tryLoadStoredOrders = function () {\n var s;\n if (self.storedSettings && typeof self.storedSettings.orders === 'object') {\n if (self.storedSettings.orders.rows.length >= self.data.length) {\n self.orders.rows = self.storedSettings.orders.rows;\n }\n s = self.getSchema();\n self.orders.columns = self.storedSettings.orders.columns;\n s.forEach(function (h, i) {\n if (self.orders.columns.indexOf(i) === -1) {\n self.orders.columns.push(i);\n }\n });\n self.orderBy = self.storedSettings.orderBy === undefined\n ? self.uniqueId : self.storedSettings.orderBy;\n self.orderDirection = self.storedSettings.orderDirection === undefined\n ? self.uniqueId : self.storedSettings.orderDirection;\n if (self.getHeaderByName(self.orderBy) && self.orderDirection) {\n self.order(self.orderBy, self.orderDirection);\n }\n }\n };\n self.getFontHeight = function (fontStyle) {\n return parseFloat(fontStyle, 10);\n };\n self.parseFont = function (key) {\n if (/Font/.test(key)) {\n self.style[key + 'Height'] = self.getFontHeight(self.style[key]);\n }\n };\n self.initProp = function (propName) {\n if (!self.args[propName]) { return; }\n Object.keys(self.args[propName]).forEach(function (key) {\n self[propName][key] = self.args[propName][key];\n });\n };\n self.init = function () {\n var publicStyleKeyIntf = {};\n self.setAttributes();\n self.setStyle();\n self.initScrollBox();\n self.setDom();\n self.type = 'canvas-datagrid';\n Object.keys(self.style).forEach(self.parseFont);\n self.intf.type = self.type;\n self.intf.addEventListener = self.addEventListener;\n self.intf.removeEventListener = self.removeEventListener;\n self.intf.dispatchEvent = self.dispatchEvent;\n self.intf.dispose = self.dispose;\n self.intf.appendTo = self.appendTo;\n self.intf.filters = self.filters;\n self.intf.sorters = self.sorters;\n self.intf.autosize = self.autosize;\n self.intf.beginEditAt = self.beginEditAt;\n self.intf.endEdit = self.endEdit;\n self.intf.setActiveCell = self.setActiveCell;\n self.intf.scrollIntoView = self.scrollIntoView;\n self.intf.clearChangeLog = self.clearChangeLog;\n self.intf.gotoCell = self.gotoCell;\n self.intf.gotoRow = self.gotoRow;\n self.intf.findColumnScrollLeft = self.findColumnScrollLeft;\n self.intf.findRowScrollTop = self.findRowScrollTop;\n self.intf.fitColumnToValues = self.fitColumnToValues;\n self.intf.findColumnMaxTextLength = self.findColumnMaxTextLength;\n self.intf.disposeContextMenu = self.disposeContextMenu;\n self.intf.getCellAt = self.getCellAt;\n self.intf.isCellVisible = self.isCellVisible;\n self.intf.order = self.order;\n self.intf.draw = self.draw;\n self.intf.selectArea = self.selectArea;\n self.intf.clipElement = self.clipElement;\n self.intf.getSchemaFromData = self.getSchemaFromData;\n self.intf.setFilter = self.setFilter;\n self.intf.selectRow = self.selectRow;\n self.intf.parentGrid = self.parentGrid;\n self.intf.toggleTree = self.toggleTree;\n self.intf.expandTree = self.expandTree;\n self.intf.collapseTree = self.collapseTree;\n self.intf.canvas = self.canvas;\n self.intf.context = self.ctx;\n self.intf.insertRow = self.insertRow;\n self.intf.deleteRow = self.deleteRow;\n self.intf.addRow = self.addRow;\n self.intf.insertColumn = self.insertColumn;\n self.intf.deleteColumn = self.deleteColumn;\n self.intf.addColumn = self.addColumn;\n self.intf.getClippingRect = self.getClippingRect;\n self.intf.setRowHeight = self.setRowHeight;\n self.intf.setColumnWidth = self.setColumnWidth;\n self.intf.resetColumnWidths = self.resetColumnWidths;\n self.intf.resetRowHeights = self.resetRowHeights;\n self.intf.resize = self.resize;\n self.intf.selectColumn = self.selectColumn;\n self.intf.selectRow = self.selectRow;\n self.intf.selectAll = self.selectAll;\n self.intf.drawChildGrids = self.drawChildGrids;\n self.intf.assertPxColor = self.assertPxColor;\n self.intf.clearPxColorAssertions = self.clearPxColorAssertions;\n self.intf.integerToAlpha = self.integerToAlpha;\n self.intf.copy = self.copy;\n self.intf.style = {};\n Object.keys(self.style).forEach(function (key) {\n // unless this line is here, Object.keys() will not work on .style\n publicStyleKeyIntf[key] = undefined;\n Object.defineProperty(publicStyleKeyIntf, key, {\n get: function () {\n return self.style[key];\n },\n set: function (value) {\n self.parseFont(value);\n self.style[key] = value;\n self.draw(true);\n self.dispatchEvent('stylechanged', {name: key, value: value});\n }\n });\n });\n Object.defineProperty(self.intf, 'activeCell', {\n get: function () {\n return self.activeCell;\n }\n });\n /**\n * When true, the grid is has focus.\n * @memberof canvasDataGrid\n * @property hasFocus\n * @readonly\n */\n Object.defineProperty(self.intf, 'hasFocus', {\n get: function () {\n return self.hasFocus;\n }\n });\n Object.defineProperty(self.intf, 'style', {\n get: function () {\n return publicStyleKeyIntf;\n },\n set: function (value) {\n Object.keys(value).forEach(function (key) {\n self.parseFont(value);\n self.style[key] = value[key];\n });\n self.draw(true);\n self.dispatchEvent('stylechanged', {name: 'style', value: value});\n }\n });\n Object.keys(self.attributes).forEach(function (key) {\n Object.defineProperty(self.intf.attributes, key, {\n get: function () {\n return self.attributes[key];\n },\n set: function (value) {\n self.attributes[key] = value;\n self.draw(true);\n self.dispatchEvent('attributechanged', {name: key, value: value[key]});\n }\n });\n });\n self.filters.string = function (value, filterFor) {\n if (!filterFor) { return true; }\n var filterRegExp;\n self.invalidFilterRegEx = undefined;\n try {\n filterRegExp = new RegExp(filterFor, 'ig');\n } catch (e) {\n self.invalidFilterRegEx = e;\n return;\n }\n return filterRegExp.test(value);\n };\n self.filters.number = function (value, filterFor) {\n if (!filterFor) { return true; }\n return value === filterFor;\n };\n if (self.attributes.name && self.attributes.saveAppearance) {\n self.storedSettings = localStorage.getItem(self.storageName + '-' + self.attributes.name);\n if (self.storedSettings) {\n try {\n self.storedSettings = JSON.parse(self.storedSettings);\n } catch (e) {\n console.warn('could not read settings from localStore', e);\n self.storedSettings = undefined;\n }\n }\n if (self.storedSettings) {\n if (typeof self.storedSettings.sizes === 'object') {\n self.sizes.rows = self.storedSettings.sizes.rows;\n self.sizes.columns = self.storedSettings.sizes.columns;\n ['trees', 'columns', 'rows'].forEach(function (i) {\n if (!self.sizes[i]) {\n self.sizes[i] = {};\n }\n });\n }\n }\n }\n ['formatters', 'filters', 'sorters'].forEach(self.initProp);\n if (self.args.data) {\n self.intf.data = self.args.data;\n }\n if (!self.data) {\n self.intf.data = [];\n }\n if (self.args.schema) {\n self.intf.schema = self.args.schema;\n }\n if (self.isChildGrid) {\n requestAnimationFrame(function () { self.resize(true); });\n } else {\n self.resize(true);\n }\n };\n /**\n * Removes focus from the grid.\n * @memberof canvasDataGrid\n * @name blur\n * @method\n */\n self.intf.blur = function (e) {\n self.hasFocus = false;\n };\n /**\n * Focuses on the grid.\n * @memberof canvasDataGrid\n * @name focus\n * @method\n */\n self.intf.focus = function () {\n self.hasFocus = true;\n self.controlInput.focus();\n };\n Object.defineProperty(self.intf, 'height', {\n get: function () {\n return self.parentNode.height;\n },\n set: function (value) {\n self.parentNode.height = value;\n self.resize(true);\n }\n });\n Object.defineProperty(self.intf, 'width', {\n get: function () {\n return self.parentNode.width;\n },\n set: function (value) {\n self.parentNode.width = value;\n self.resize(true);\n }\n });\n Object.defineProperty(self.intf, 'openChildren', {\n get: function () {\n return self.openChildren;\n }\n });\n Object.defineProperty(self.intf, 'childGrids', {\n get: function () {\n return Object.keys(self.childGrids).map(function (gridId) {\n return self.childGrids[gridId];\n });\n }\n });\n Object.defineProperty(self.intf, 'isChildGrid', {\n get: function () {\n return self.isChildGrid;\n }\n });\n Object.defineProperty(self.intf, 'parentNode', {\n get: function () {\n return self.parentNode;\n },\n set: function (value) {\n self.parentNode = value;\n }\n });\n Object.defineProperty(self.intf, 'offsetParent', {\n get: function () {\n return self.parentNode;\n },\n set: function (value) {\n self.parentNode = value;\n }\n });\n Object.defineProperty(self.intf, 'offsetLeft', {\n get: function () {\n return self.parentNode.offsetLeft;\n }\n });\n Object.defineProperty(self.intf, 'offsetTop', {\n get: function () {\n return self.parentNode.offsetTop;\n }\n });\n Object.defineProperty(self.intf, 'scrollHeight', {\n get: function () {\n return self.scrollBox.scrollHeight;\n }\n });\n Object.defineProperty(self.intf, 'scrollWidth', {\n get: function () {\n return self.scrollBox.scrollWidth;\n }\n });\n Object.defineProperty(self.intf, 'scrollTop', {\n get: function () {\n return self.scrollBox.scrollTop;\n },\n set: function (value) {\n self.scrollBox.scrollTop = value;\n }\n });\n Object.defineProperty(self.intf, 'scrollLeft', {\n get: function () {\n return self.scrollBox.scrollLeft;\n },\n set: function (value) {\n self.scrollBox.scrollLeft = value;\n }\n });\n Object.defineProperty(self.intf, 'sizes', {\n get: function () {\n return self.sizes;\n }\n });\n Object.defineProperty(self.intf, 'input', {\n get: function () {\n return self.input;\n }\n });\n Object.defineProperty(self.intf, 'controlInput', {\n get: function () {\n return self.controlInput;\n }\n });\n Object.defineProperty(self.intf, 'currentCell', {\n get: function () {\n return self.currentCell;\n }\n });\n Object.defineProperty(self.intf, 'visibleCells', {\n get: function () {\n return self.visibleCells;\n }\n });\n Object.defineProperty(self.intf, 'visibleRows', {\n get: function () {\n return self.visibleRows;\n }\n });\n Object.defineProperty(self.intf, 'selections', {\n get: function () {\n return self.selections;\n }\n });\n Object.defineProperty(self.intf, 'dragMode', {\n get: function () {\n return self.dragMode;\n }\n });\n Object.defineProperty(self.intf, 'changes', {\n get: function () {\n return self.changes;\n }\n });\n self.intf.attributes = {};\n self.intf.formatters = self.formatters;\n self.normalizeDataset = function (data) {\n var i, d, max, syncFnInvoked;\n if (data === null || data === '' || data === undefined) {\n return [];\n }\n if (typeof data === 'string'\n || typeof data === 'number'\n || typeof data === 'boolean') {\n data = [{'0': data}];\n }\n if (!Array.isArray(data) && typeof data === 'object') {\n data = [data];\n }\n if ((!Array.isArray(data[0]) && typeof data[0] === 'object')\n || (Array.isArray(data) && data.length === 0)) {\n return data;\n }\n if (typeof data === 'function') {\n i = data.apply(self.intf, [function (d) {\n if (syncFnInvoked) {\n console.warn('Detected a callback to the data setter function after the same function already returned a value synchronously.');\n }\n self.normalizeDataset(d);\n }]);\n if (i) {\n syncFnInvoked = true;\n self.normalizeDataset(i);\n }\n }\n if (!Array.isArray(data) && typeof data === 'object') {\n data = [data];\n }\n if (Array.isArray(data)) {\n if (!Array.isArray(data[0])) {\n //array of something? throw it all into 1 row!\n data = [data];\n }\n // find the longest length\n max = 0;\n d = [];\n data.forEach(function (row) {\n max = Math.max(max, row.length);\n });\n // map against length indexes\n data.forEach(function (row, index) {\n var x;\n d[index] = {};\n for (x = 0; x < max; x += 1) {\n d[index][x] = row[x] || null;\n }\n });\n return d;\n }\n throw new Error('Unsupported data type. Must be an array of arrays or an array of objects, function or string.');\n };\n Object.defineProperty(self.intf, 'selectionBounds', {\n get: function () {\n return self.getSelectionBounds();\n }\n });\n Object.defineProperty(self.intf, 'selectedRows', {\n get: function () {\n return self.getSelectedData(true);\n }\n });\n Object.defineProperty(self.intf, 'selectedCells', {\n get: function () {\n return self.getSelectedData();\n }\n });\n Object.defineProperty(self.intf, 'visibleSchema', {\n get: function () {\n return self.getVisibleSchema().map(function eachDataRow(col) {\n return col;\n });\n }\n });\n Object.defineProperty(self.intf, 'ctx', {\n get: function () {\n return self.ctx;\n }\n });\n Object.defineProperty(self.intf, 'schema', {\n get: function schemaGetter() {\n return self.getSchema();\n },\n set: function schemaSetter(value) {\n if (!Array.isArray(value) || typeof value[0] !== 'object') {\n throw new Error('Schema must be an array of objects.');\n }\n if (value[0].name === undefined) {\n throw new Error('Expected schema to contain an object with at least a name property.');\n }\n self.schema = value.map(function eachSchemaColumn(column, index) {\n column.width = column.width || self.style.columnWidth;\n column[self.uniqueId] = self.getSchemaNameHash(column.name);\n column.filter = column.filter || self.filter(column.type);\n column.type = column.type || 'string';\n column.index = index;\n column.columnIndex = index;\n column.rowIndex = -1;\n return column;\n });\n self.tempSchema = undefined;\n self.createNewRowData();\n self.createColumnOrders();\n self.tryLoadStoredOrders();\n self.resize(true);\n self.dispatchEvent('schemachanged', {schema: self.schema});\n }\n });\n Object.defineProperty(self.intf, 'data', {\n get: function dataGetter() {\n return self.data.map(function (row) {\n delete row[self.uniqueId];\n return row;\n });\n },\n set: function dataSetter(value) {\n self.originalData = self.normalizeDataset(value).map(function eachDataRow(row) {\n row[self.uniqueId] = self.uId;\n self.uId += 1;\n return row;\n });\n self.changes = [];\n //TODO apply filter to incoming dataset\n self.data = self.originalData;\n if (!self.schema && self.data.length > 0) {\n self.tempSchema = self.getSchemaFromData();\n }\n if (!self.schema && self.data.length === 0) {\n self.tempSchema = [{name: ''}];\n self.tempSchema[0][self.uniqueId] = self.getSchemaNameHash('');\n }\n if (self.tempSchema && !self.schema) {\n self.createColumnOrders();\n self.tryLoadStoredOrders();\n self.dispatchEvent('schemachanged', {schema: self.tempSchema});\n }\n self.createNewRowData();\n if (self.attributes.autoResizeColumns && self.data.length > 0\n && self.storedSettings === undefined) {\n self.autosize();\n }\n self.fitColumnToValues('cornerCell', true);\n if (!self.resize() || !self.isChildGrid) { self.draw(true); }\n self.createRowOrders();\n self.tryLoadStoredOrders();\n self.dispatchEvent('datachanged', {data: self.data});\n }\n });\n self.initScrollBox = function () {\n var sHeight = 0,\n sWidth = 0,\n scrollTop = 0,\n scrollLeft = 0,\n scrollHeight = 0,\n scrollWidth = 0,\n scrollBoxHeight = 20,\n scrollBoxWidth = 20;\n function setScrollTop(value, preventScrollEvent) {\n if (isNaN(value)) {\n throw new Error('ScrollTop value must be a number');\n }\n if (value < 0) {\n value = 0;\n }\n if (value > scrollHeight) {\n value = scrollHeight;\n }\n if (scrollHeight < 0) {\n value = 0;\n }\n scrollTop = value;\n if (!preventScrollEvent) {\n self.scroll();\n }\n }\n function setScrollLeft(value, preventScrollEvent) {\n if (isNaN(value)) {\n throw new Error('ScrollLeft value must be a number');\n }\n if (value < 0) {\n value = 0;\n }\n if (value > scrollWidth) {\n value = scrollWidth;\n }\n if (scrollWidth < 0) {\n value = 0;\n }\n scrollLeft = value;\n if (!preventScrollEvent) {\n self.scroll();\n }\n }\n self.scrollBox.scrollTo = function (x, y) {\n setScrollLeft(x, true);\n setScrollTop(y);\n };\n Object.defineProperty(self.scrollBox, 'scrollBoxHeight', {\n get: function () {\n return scrollBoxHeight;\n },\n set: function (value) {\n scrollBoxHeight = value;\n }\n });\n Object.defineProperty(self.scrollBox, 'scrollBoxWidth', {\n get: function () {\n return scrollBoxWidth;\n },\n set: function (value) {\n scrollBoxWidth = value;\n }\n });\n Object.defineProperty(self.scrollBox, 'height', {\n get: function () {\n return sHeight;\n },\n set: function (value) {\n if (scrollHeight < value) {\n scrollTop = 0;\n }\n sHeight = value;\n }\n });\n Object.defineProperty(self.scrollBox, 'width', {\n get: function () {\n return sWidth;\n },\n set: function (value) {\n sWidth = value;\n }\n });\n Object.defineProperty(self.scrollBox, 'scrollTop', {\n get: function () {\n return scrollTop;\n },\n set: setScrollTop\n });\n Object.defineProperty(self.scrollBox, 'scrollLeft', {\n get: function () {\n return scrollLeft;\n },\n set: setScrollLeft\n });\n Object.defineProperty(self.scrollBox, 'scrollHeight', {\n get: function () {\n return scrollHeight;\n },\n set: function (value) {\n if (scrollTop > value) {\n scrollTop = Math.max(value, 0);\n }\n if (scrollHeight < sHeight) {\n scrollTop = 0;\n }\n scrollHeight = value;\n }\n });\n Object.defineProperty(self.scrollBox, 'scrollWidth', {\n get: function () {\n return scrollWidth;\n },\n set: function (value) {\n if (scrollLeft > value) {\n scrollLeft = Math.max(value, 0);\n }\n scrollWidth = value;\n }\n });\n };\n return;\n };\n}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*jslint browser: true, unparam: true, todo: true*/\n/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false, Event: false*/\n!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {\n 'use strict';\n return function (self) {\n var zIndexTop = 2, hoverScrollTimeout, autoCompleteContext;\n function createContextMenu(ev, pos, items, parentContextMenu) {\n var container = document.createElement('div'),\n upArrow = document.createElement('div'),\n downArrow = document.createElement('div'),\n children = [],\n selectedIndex = -1,\n intf = {},\n rect;\n if (!Array.isArray(items)) { throw new Error('createContextMenu expects an array.'); }\n function createItems() {\n items.forEach(function (item) {\n var contextItemContainer = document.createElement('div'),\n childMenuArrow;\n function removeChildContext(e) {\n if (e.relatedTarget === container\n || item.contextMenu.container === e.relatedTarget\n || childMenuArrow === e.relatedTarget\n || (contextItemContainer === e.relatedTarget)\n ) { return; }\n item.contextMenu.dispose();\n children.splice(children.indexOf(item.contextMenu), 1);\n item.contextMenu = undefined;\n contextItemContainer.removeEventListener('mouseout', removeChildContext);\n container.removeEventListener('mouseout', removeChildContext);\n contextItemContainer.setAttribute('contextOpen', '0');\n contextItemContainer.setAttribute('opening', '0');\n }\n function contextAddCallback(items) {\n // check yet again if the user hasn't moved off\n if (contextItemContainer.getAttribute('opening') !== '1' ||\n contextItemContainer.getAttribute('contextOpen') === '1') {\n return;\n }\n var cPos = contextItemContainer.getBoundingClientRect();\n cPos = {\n left: cPos.left + self.style.childContextMenuMarginLeft + container.offsetWidth,\n top: cPos.top + self.style.childContextMenuMarginTop,\n bottom: cPos.bottom,\n right: cPos.right,\n };\n item.contextMenu = createContextMenu(ev, cPos, items, intf);\n contextItemContainer.setAttribute('contextOpen', '1');\n contextItemContainer.addEventListener('mouseout', removeChildContext);\n container.addEventListener('mouseout', removeChildContext);\n children.push(item.contextMenu);\n }\n function createChildContext() {\n var i;\n if (contextItemContainer.getAttribute('contextOpen') === '1') {\n return;\n }\n contextItemContainer.setAttribute('opening', '1');\n if (typeof item.items === 'function') {\n i = item.items.apply(intf, [function (items) {\n contextAddCallback(items);\n }]);\n if (i !== undefined && Array.isArray(i)) {\n contextAddCallback(i);\n }\n return;\n }\n contextAddCallback(item.items);\n }\n function addItem(item) {\n function addContent(content) {\n if (typeof content === 'function') {\n return addContent(content(ev));\n }\n if (typeof content === 'object') {\n contextItemContainer.appendChild(content);\n return;\n }\n self.createInlineStyle(contextItemContainer, 'canvas-datagrid-context-menu-item');\n contextItemContainer.addEventListener('mouseover', function () {\n self.createInlineStyle(contextItemContainer, 'canvas-datagrid-context-menu-item:hover');\n });\n contextItemContainer.addEventListener('mouseout', function () {\n self.createInlineStyle(contextItemContainer, 'canvas-datagrid-context-menu-item');\n });\n contextItemContainer.innerHTML = content;\n return;\n }\n addContent(item.title);\n item.contextItemContainer = contextItemContainer;\n if (item.items && item.items.length > 0) {\n childMenuArrow = document.createElement('div');\n self.createInlineStyle(childMenuArrow, 'canvas-datagrid-context-child-arrow');\n childMenuArrow.innerHTML = self.style.childContextMenuArrowHTML;\n contextItemContainer.appendChild(childMenuArrow);\n contextItemContainer.addEventListener('mouseover', createChildContext);\n contextItemContainer.addEventListener('mouseout', function () {\n contextItemContainer.setAttribute('opening', '0');\n });\n }\n if (item.click) {\n contextItemContainer.addEventListener('click', function (ev) {\n item.click.apply(self, [ev]);\n });\n }\n }\n addItem(item);\n container.appendChild(contextItemContainer);\n });\n }\n function clickIndex(idx) {\n items[idx].contextItemContainer.dispatchEvent(new Event('click'));\n }\n function checkArrowVisibility() {\n if (container.scrollTop > 0) {\n document.body.appendChild(upArrow);\n } else if (upArrow.parentNode) {\n upArrow.parentNode.removeChild(upArrow);\n }\n if (container.scrollTop >= container.scrollHeight - container.offsetHeight && downArrow.parentNode) {\n downArrow.parentNode.removeChild(downArrow);\n } else if (container.scrollHeight - container.offsetHeight > 0\n && !(container.scrollTop >= container.scrollHeight - container.offsetHeight)) {\n document.body.appendChild(downArrow);\n }\n }\n function startHoverScroll(type) {\n return function t() {\n var a = self.attributes.contextHoverScrollAmount;\n if (type === 'up' && container.scrollTop === 0) { return; }\n if (type === 'down' && container.scrollTop === container.scrollHeight) { return; }\n container.scrollTop += (type === 'up' ? -a : a);\n hoverScrollTimeout = setTimeout(t, self.attributes.contextHoverScrollRateMs, type);\n };\n }\n function endHoverScroll(type) {\n return function () {\n clearTimeout(hoverScrollTimeout);\n };\n }\n function init() {\n var loc = {},\n s = self.scrollOffset(self.canvas);\n createItems();\n self.createInlineStyle(container, 'canvas-datagrid-context-menu');\n loc.x = pos.left - s.left;\n loc.y = pos.top - s.top;\n loc.height = 0;\n zIndexTop += 1;\n container.style.position = 'absolute';\n upArrow.style.color = self.style.contextMenuArrowColor;\n downArrow.style.color = self.style.contextMenuArrowColor;\n [upArrow, downArrow].forEach(function (el) {\n el.style.textAlign = 'center';\n el.style.position = 'absolute';\n el.style.zIndex = zIndexTop + 1;\n });\n container.style.zIndex = zIndexTop;\n if (parentContextMenu && parentContextMenu.inputDropdown) {\n container.style.maxHeight = window.innerHeight - loc.y - self.style.autocompleteBottomMargin + 'px';\n container.style.minWidth = pos.width + 'px';\n loc.y += pos.height;\n }\n container.style.left = loc.x + 'px';\n container.style.top = loc.y + 'px';\n container.addEventListener('scroll', checkArrowVisibility);\n container.addEventListener('wheel', function (e) {\n if (self.hasFocus) {\n container.scrollTop += e.deltaY;\n container.scrollLeft += e.deltaX;\n }\n checkArrowVisibility();\n });\n upArrow.innerHTML = self.style.contextMenuArrowUpHTML;\n downArrow.innerHTML = self.style.contextMenuArrowDownHTML;\n container.appendChild(upArrow);\n document.body.appendChild(downArrow);\n document.body.appendChild(container);\n rect = container.getBoundingClientRect();\n if (rect.bottom > window.innerHeight && !(parentContextMenu && parentContextMenu.inputDropdown)) {\n loc.y = window.innerHeight - container.offsetHeight;\n if (loc.y < 0) { loc.y = 0; }\n if (container.offsetHeight > window.innerHeight) {\n container.style.height = window.innerHeight - self.style.contextMenuWindowMargin + 'px';\n }\n }\n if (rect.right > window.innerWidth) {\n if (parentContextMenu) {\n loc.x = parentContextMenu.container.offsetLeft - container.offsetWidth;\n } else {\n loc.x = window.innerWidth - container.offsetWidth;\n }\n }\n container.style.left = loc.x + 'px';\n container.style.top = loc.y + 'px';\n rect = container.getBoundingClientRect();\n upArrow.style.top = rect.top + 'px';\n downArrow.style.top = rect.top + rect.height - downArrow.offsetHeight + 'px';\n upArrow.style.left = rect.left + 'px';\n downArrow.style.left = rect.left + 'px';\n downArrow.style.width = container.offsetWidth + 'px';\n upArrow.style.width = container.offsetWidth + 'px';\n downArrow.addEventListener('mouseover', startHoverScroll('down'));\n downArrow.addEventListener('mouseout', endHoverScroll('down'));\n upArrow.addEventListener('mouseover', startHoverScroll('up'));\n upArrow.addEventListener('mouseout', endHoverScroll('up'));\n checkArrowVisibility();\n }\n intf.parentGrid = self.intf;\n intf.parentContextMenu = parentContextMenu;\n intf.container = container;\n init();\n intf.clickIndex = clickIndex;\n intf.rect = rect;\n intf.items = items;\n intf.upArrow = upArrow;\n intf.downArrow = downArrow;\n intf.dispose = function () {\n clearTimeout(hoverScrollTimeout);\n children.forEach(function (c) {\n c.dispose();\n });\n [downArrow, upArrow, container].forEach(function (el) {\n if (el.parentNode) { el.parentNode.removeChild(el); }\n });\n };\n Object.defineProperty(intf, 'selectedIndex', {\n get: function () {\n return selectedIndex;\n },\n set: function (value) {\n if (typeof value !== 'number' || isNaN(value || !isFinite(value))) {\n throw new Error('Context menu selected index must be a sane number.');\n }\n selectedIndex = value;\n if (selectedIndex > items.length - 1) {\n selectedIndex = items.length - 1;\n }\n if (selectedIndex < 0) {\n selectedIndex = 0;\n }\n items.forEach(function (item, index) {\n if (index === selectedIndex) {\n return self.createInlineStyle(item.contextItemContainer, 'canvas-datagrid-context-menu-item:hover');\n }\n self.createInlineStyle(item.contextItemContainer, 'canvas-datagrid-context-menu-item');\n });\n }\n });\n return intf;\n }\n function createFilterContextMenuItems(e) {\n var filterContainer = document.createElement('div'),\n filterLabel = document.createElement('div'),\n filterAutoCompleteButton = document.createElement('button'),\n filterInput = document.createElement('input'),\n n = e.cell && e.cell.header ? e.cell.header.title || e.cell.header.name : '',\n autoCompleteItems,\n iRect;\n function fillAutoComplete() {\n autoCompleteItems = {};\n self.data.forEach(function (row) {\n var value = row[e.cell.header.name];\n if (autoCompleteItems[value]) { return; }\n autoCompleteItems[value] = {\n title: self.formatters[e.cell.header.type || 'string']({ cell: { value: value }}),\n click: function (e) {\n filterInput.value = value;\n e.stopPropagation();\n filterInput.dispatchEvent(new Event('keyup'));\n self.disposeAutocomplete();\n return;\n }\n };\n });\n autoCompleteItems = Object.keys(autoCompleteItems).map(function (key) {\n return autoCompleteItems[key];\n });\n }\n function createAutoCompleteContext(ev) {\n if (ev && [40, 38, 13, 9, 27].indexOf(ev.keyCode) !== -1) { return; }\n fillAutoComplete();\n iRect = filterInput.getBoundingClientRect();\n if (autoCompleteContext) {\n autoCompleteContext.dispose();\n autoCompleteContext = undefined;\n }\n autoCompleteContext = createContextMenu(e, {\n left: iRect.left,\n top: iRect.top,\n right: iRect.right,\n bottom: iRect.bottom,\n height: iRect.height,\n width: iRect.width\n }, autoCompleteItems, {inputDropdown: true});\n autoCompleteContext.selectedIndex = 0;\n }\n self.createInlineStyle(filterLabel, 'canvas-datagrid-context-menu-label');\n self.createInlineStyle(filterAutoCompleteButton, 'canvas-datagrid-context-menu-filter-button');\n self.createInlineStyle(filterInput, 'canvas-datagrid-context-menu-filter-input');\n filterInput.onclick = self.disposeAutocomplete;\n filterInput.addEventListener('keydown', function (e) {\n //down\n if (e.keyCode === 40) {\n autoCompleteContext.selectedIndex += 1;\n }\n //up\n if (e.keyCode === 38) {\n autoCompleteContext.selectedIndex -= 1;\n }\n //enter\n if (e.keyCode === 13) {\n autoCompleteContext.clickIndex(autoCompleteContext.selectedIndex);\n self.disposeContextMenu();\n }\n //tab\n if (e.keyCode === 9) {\n autoCompleteContext.clickIndex(autoCompleteContext.selectedIndex);\n e.preventDefault();\n }\n //esc\n if (e.keyCode === 27) {\n self.disposeContextMenu();\n }\n });\n filterInput.addEventListener('keyup', function () {\n self.setFilter(e.cell.header.name, filterInput.value);\n });\n filterInput.addEventListener('keyup', createAutoCompleteContext);\n filterInput.value = e.cell.header ? self.columnFilters[e.cell.header.name] || '' : '';\n filterLabel.innerHTML = self.attributes.filterOptionText.replace(/%s/g, n);\n filterAutoCompleteButton.onclick = function () {\n if (autoCompleteContext) {\n return self.disposeAutocomplete();\n }\n createAutoCompleteContext();\n };\n filterAutoCompleteButton.innerHTML = self.style.contextFilterButtonHTML;\n filterContainer.addEventListener('click', function (e) {\n return e.stopPropagation();\n });\n filterContainer.appendChild(filterLabel);\n filterContainer.appendChild(filterInput);\n filterContainer.appendChild(filterAutoCompleteButton);\n e.items.push({\n title: filterContainer\n });\n if (Object.keys(self.columnFilters).length) {\n Object.keys(self.columnFilters).forEach(function (cf) {\n var h = self.getHeaderByName(cf);\n e.items.push({\n title: self.attributes.removeFilterOptionText.replace(/%s/g, h.title || h.name),\n click: function removeFilterClick(e) {\n e.preventDefault();\n self.setFilter(cf, '');\n self.controlInput.focus();\n }\n });\n });\n }\n }\n function addDefaultContextMenuItem(e) {\n var isNormalCell = !(e.cell.isBackground || e.cell.isHeaderCellCap\n || e.cell.isScrollBar || e.cell.isCorner || e.cell.isRowHeader)\n && e.cell.header;\n if (self.attributes.showFilter && isNormalCell) {\n createFilterContextMenuItems(e);\n }\n if (self.attributes.showCopy\n && self.selections.reduce(function (p, r) {\n return p + r.length;\n }, 0) > 0) {\n e.items.push({\n title: self.attributes.copyText,\n click: function () {\n document.execCommand('copy');\n self.disposeContextMenu();\n self.controlInput.focus();\n }\n });\n }\n if (self.attributes.saveAppearance && self.attributes.showClearSettingsOption\n && (Object.keys(self.sizes.rows).length > 0\n || Object.keys(self.sizes.columns).length > 0)) {\n e.items.push({\n title: self.attributes.clearSettingsOptionText,\n click: function (e) {\n e.preventDefault();\n self.sizes.rows = {};\n self.sizes.columns = {};\n self.createRowOrders();\n self.createColumnOrders();\n self.storedSettings = undefined;\n self.dispatchEvent('resizecolumn', {columnWidth: self.style.columnWidth});\n self.dispatchEvent('resizerow', {cellHeight: self.style.cellHeight});\n self.setStorageData();\n self.resize(true);\n self.disposeContextMenu();\n self.controlInput.focus();\n }\n });\n }\n if (self.attributes.allowSorting && self.attributes.showOrderByOption && isNormalCell) {\n e.items.push({\n title: self.attributes.showOrderByOptionTextAsc.replace('%s', e.cell.header.title || e.cell.header.name),\n click: function (ev) {\n ev.preventDefault();\n self.order(e.cell.header.name, 'asc');\n self.controlInput.focus();\n }\n });\n e.items.push({\n title: self.attributes.showOrderByOptionTextDesc.replace('%s', e.cell.header.title || e.cell.header.name),\n click: function (ev) {\n ev.preventDefault();\n self.order(e.cell.header.name, 'desc');\n self.disposeContextMenu();\n self.controlInput.focus();\n }\n });\n }\n }\n self.disposeAutocomplete = function () {\n if (autoCompleteContext) {\n autoCompleteContext.dispose();\n autoCompleteContext = undefined;\n }\n };\n self.disposeContextMenu = function () {\n document.removeEventListener('click', self.disposeContextMenu);\n zIndexTop = 2;\n self.disposeAutocomplete();\n if (self.contextMenu) {\n self.contextMenu.dispose();\n }\n self.contextMenu = undefined;\n };\n self.contextmenuEvent = function (e, overridePos) {\n if (!self.hasFocus && e.target !== self.canvas) {\n return;\n }\n var items = [],\n pos = overridePos || self.getLayerPos(e, true),\n ev = {\n NativeEvent: e,\n cell: self.getCellAt(pos.x, pos.y),\n items: items\n };\n if (!ev.cell.isGrid) {\n addDefaultContextMenuItem(ev);\n }\n if (self.dispatchEvent('contextmenu', ev)) {\n return;\n }\n if (!ev.cell.isGrid) {\n if (self.contextMenu) {\n self.disposeContextMenu();\n }\n self.contextMenu = createContextMenu(ev, {\n left: pos.x + pos.rect.left + self.style.contextMenuMarginLeft + self.canvasOffsetLeft,\n top: pos.y + pos.rect.top + self.style.contextMenuMarginTop + self.canvasOffsetTop,\n right: ev.cell.width + ev.cell.x + pos.rect.left,\n bottom: ev.cell.height + ev.cell.y + pos.rect.top,\n height: ev.cell.height,\n width: ev.cell.width\n }, items);\n document.addEventListener('click', self.disposeContextMenu);\n e.preventDefault();\n }\n };\n return;\n };\n}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*jslint browser: true, unparam: true, todo: true*/\n/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/\n!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {\n 'use strict';\n return function (self) {\n self.defaults = {\n attributes: [\n ['name', ''],\n ['tree', false],\n ['showNewRow', false],\n ['treeHorizontalScroll', false],\n ['saveAppearance', true],\n ['selectionFollowsActiveCell', false],\n ['multiLine', false],\n ['editable', true],\n ['allowColumnReordering', true],\n ['allowRowReordering', false],\n ['allowSorting', true],\n ['showFilter', true],\n ['globalRowResize', false],\n ['pageUpDownOverlap', 1],\n ['persistantSelectionMode', false],\n ['rowSelectionMode', false],\n ['autoResizeColumns', false],\n ['allowRowHeaderResize', true],\n ['allowColumnResize', true],\n ['allowRowResize', true],\n ['allowRowResizeFromCell', false],\n ['allowColumnResizeFromCell', false],\n ['debug', false],\n ['borderResizeZone', 10],\n ['showColumnHeaders', true],\n ['showRowNumbers', true],\n ['showRowHeaders', true],\n ['scrollRepeatRate', 75],\n ['selectionScrollZone', 20],\n ['resizeScrollZone', 20],\n ['contextHoverScrollRateMs', 5],\n ['contextHoverScrollAmount', 2],\n ['selectionScrollIncrement', 20],\n ['reorderDeadZone', 3],\n ['showClearSettingsOption', true],\n ['showOrderByOption', true],\n ['clearSettingsOptionText', 'Clear saved settings'],\n ['showOrderByOptionTextAsc', 'Order by %s ascending'],\n ['showOrderByOptionTextDesc', 'Order by %s descending'],\n ['removeFilterOptionText', 'Remove filter on %s'],\n ['filterOptionText', 'Filter %s'],\n ['filterTextPrefix', '(filtered) '],\n ['touchReleaseAnimationDurationMs', 1000],\n ['touchReleaseAcceleration', 30],\n ['touchDeadZone', 3],\n ['touchSelectTimeMs', 800],\n ['touchScrollZone', 40],\n ['copyText', 'Copy'],\n ['showCopy', true],\n ['columnHeaderClickBehavior', 'sort'],\n ['scrollPointerLock', true]\n ],\n styles: [\n ['activeCellBackgroundColor', 'rgba(255, 255, 255, 1)'],\n ['activeCellBorderColor', 'rgba(110, 168, 255, 1)'],\n ['activeCellBorderWidth', 0.25],\n ['activeCellColor', 'rgba(0, 0, 0, 1)'],\n ['activeCellFont', '16px sans-serif'],\n ['activeCellHoverBackgroundColor', 'rgba(255, 255, 255, 1)'],\n ['activeCellHoverColor', 'rgba(0, 0, 0, 1)'],\n ['activeCellOverlayBorderColor', 'rgba(66, 133, 244, 1)'],\n ['activeCellOverlayBorderWidth', 0.5],\n ['activeCellPaddingBottom', 5],\n ['activeCellPaddingLeft', 5],\n ['activeCellPaddingRight', 7],\n ['activeCellPaddingTop', 5],\n ['activeCellSelectedBackgroundColor', 'rgba(236, 243, 255, 1)'],\n ['activeCellSelectedColor', 'rgba(0, 0, 0, 1)'],\n ['activeColumnHeaderCellBackgroundColor', 'rgba(225, 225, 225, 1)'],\n ['activeColumnHeaderCellColor', 'rgba(0, 0, 0, 1)'],\n ['activeRowHeaderCellBackgroundColor', 'rgba(225, 225, 225, 1)'],\n ['activeRowHeaderCellColor', 'rgba(0, 0, 0, 1)'],\n ['autocompleteBottomMargin', 60],\n ['autosizeHeaderCellPadding', 8],\n ['autosizePadding', 5],\n ['backgroundColor', 'rgba(240, 240, 240, 1)'],\n ['cellAutoResizePadding', 13],\n ['cellBackgroundColor', 'rgba(255, 255, 255, 1)'],\n ['cellBorderColor', 'rgba(195, 199, 202, 1)'],\n ['cellBorderWidth', 0.5],\n ['cellColor', 'rgba(0, 0, 0, 1)'],\n ['cellFont', '16px sans-serif'],\n ['cellGridHeight', 250],\n ['cellHeight', 24],\n ['cellHeightWithChildGrid', 150],\n ['cellHorizontalAlignment', 'left'],\n ['cellHoverBackgroundColor', 'rgba(255, 255, 255, 1)'],\n ['cellHoverColor', 'rgba(0, 0, 0, 1)'],\n ['cellPaddingBottom', 5],\n ['cellPaddingLeft', 5],\n ['cellPaddingRight', 7],\n ['cellPaddingTop', 5],\n ['cellSelectedBackgroundColor', 'rgba(236, 243, 255, 1)'],\n ['cellSelectedColor', 'rgba(0, 0, 0, 1)'],\n ['cellVerticalAlignment', 'center'],\n ['cellWidthWithChildGrid', 250],\n ['childContextMenuArrowColor', 'rgba(43, 48, 43, 1)'],\n ['childContextMenuArrowHTML', '►'],\n ['childContextMenuMarginLeft', -15],\n ['childContextMenuMarginTop', 0],\n ['columnHeaderCellBackgroundColor', 'rgba(240, 240, 240, 1)'],\n ['columnHeaderCellBorderColor', 'rgba(152, 152, 152, 1)'],\n ['columnHeaderCellBorderWidth', 0.25],\n ['columnHeaderCellColor', 'rgba(50, 50, 50, 1)'],\n ['columnHeaderCellFont', '16px sans-serif'],\n ['columnHeaderCellHeight', 25],\n ['columnHeaderCellHorizontalAlignment', 'left'],\n ['columnHeaderCellHoverBackgroundColor', 'rgba(235, 235, 235, 1)'],\n ['columnHeaderCellHoverColor', 'rgba(0, 0, 0, 1)'],\n ['columnHeaderCellPaddingBottom', 5],\n ['columnHeaderCellPaddingLeft', 5],\n ['columnHeaderCellPaddingRight', 7],\n ['columnHeaderCellPaddingTop', 5],\n ['columnHeaderCellVerticalAlignment', 'center'],\n ['columnWidth', 250],\n ['contextFilterButtonBorder', 'solid 1px rgba(158, 163, 169, 1)'],\n ['contextFilterButtonBorderRadius', '3px'],\n ['contextFilterButtonHTML', '▼'],\n ['contextFilterInputBackground', 'rgba(255,255,255,1)'],\n ['contextFilterInputBorder', 'solid 1px rgba(158, 163, 169, 1)'],\n ['contextFilterInputBorderRadius', '0'],\n ['contextFilterInputColor', 'rgba(0,0,0,1)'],\n ['contextFilterInputFontFamily', 'sans-serif'],\n ['contextFilterInputFontSize', '14px'],\n ['contextMenuArrowColor', 'rgba(43, 48, 43, 1)'],\n ['contextMenuArrowDownHTML', '▼'],\n ['contextMenuArrowUpHTML', '▲'],\n ['contextMenuBackground', 'rgba(240, 240, 240, 1)'],\n ['contextMenuBorder', 'solid 1px rgba(158, 163, 169, 1)'],\n ['contextMenuBorderRadius', '3px'],\n ['contextMenuChildArrowFontSize', '12px'],\n ['contextMenuColor', 'rgba(43, 48, 43, 1)'],\n ['contextMenuFilterButtonFontFamily', 'sans-serif'],\n ['contextMenuFilterButtonFontSize', '10px'],\n ['contextMenuFilterInvalidExpresion', 'rgba(237, 155, 156, 1)'],\n ['contextMenuFontFamily', 'sans-serif'],\n ['contextMenuFontSize', '16px'],\n ['contextMenuHoverBackground', 'rgba(182, 205, 250, 1)'],\n ['contextMenuHoverColor', 'rgba(43, 48, 153, 1)'],\n ['contextMenuItemBorderRadius', '3px'],\n ['contextMenuItemMargin', '2px'],\n ['contextMenuLabelDisplay', 'inline-block'],\n ['contextMenuLabelMargin', '0 3px 0 0'],\n ['contextMenuLabelMaxWidth', '700px'],\n ['contextMenuLabelMinWidth', '75px'],\n ['contextMenuMarginLeft', 3],\n ['contextMenuMarginTop', -3],\n ['contextMenuOpacity', '0.98'],\n ['contextMenuPadding', '2px'],\n ['contextMenuWindowMargin', 6],\n ['cornerCellBackgroundColor', 'rgba(240, 240, 240, 1)'],\n ['cornerCellBorderColor', 'rgba(202, 202, 202, 1)'],\n ['editCellBackgroundColor', 'white'],\n ['editCellBorder', 'solid 1px rgba(110, 168, 255, 1)'],\n ['editCellBoxShadow', '0 2px 5px rgba(0,0,0,0.4)'],\n ['editCellColor', 'black'],\n ['editCellFontFamily', 'sans-serif'],\n ['editCellFontSize', '16px'],\n ['editCellPaddingLeft', 4],\n ['gridBorderColor', 'rgba(202, 202, 202, 1)'],\n ['gridBorderWidth', 1],\n ['columnHeaderOrderByArrowBorderColor', 'rgba(195, 199, 202, 1)'],\n ['columnHeaderOrderByArrowBorderWidth', 1],\n ['columnHeaderOrderByArrowColor', 'rgba(155, 155, 155, 1)'],\n ['columnHeaderOrderByArrowHeight', 8],\n ['columnHeaderOrderByArrowMarginLeft', 0],\n ['columnHeaderOrderByArrowMarginRight', 5],\n ['columnHeaderOrderByArrowMarginTop', 6],\n ['columnHeaderOrderByArrowWidth', 13],\n ['minColumnWidth', 45],\n ['minHeight', 24],\n ['minRowHeight', 24],\n ['name', 'default'],\n ['reorderMarkerBackgroundColor', 'rgba(0, 0, 0, 0.1)'],\n ['reorderMarkerBorderColor', 'rgba(0, 0, 0, 0.2)'],\n ['reorderMarkerBorderWidth', 1.25],\n ['reorderMarkerIndexBorderColor', 'rgba(66, 133, 244, 1)'],\n ['reorderMarkerIndexBorderWidth', 2.75],\n ['rowHeaderCellBackgroundColor', 'rgba(240, 240, 240, 1)'],\n ['rowHeaderCellBorderColor', 'rgba(200, 200, 200, 1)'],\n ['rowHeaderCellBorderWidth', 1],\n ['rowHeaderCellColor', 'rgba(50, 50, 50, 1)'],\n ['rowHeaderCellFont', '16px sans-serif'],\n ['rowHeaderCellHeight', 25],\n ['rowHeaderCellHorizontalAlignment', 'left'],\n ['rowHeaderCellHoverBackgroundColor', 'rgba(235, 235, 235, 1)'],\n ['rowHeaderCellHoverColor', 'rgba(0, 0, 0, 1)'],\n ['rowHeaderCellPaddingBottom', 5],\n ['rowHeaderCellPaddingLeft', 5],\n ['rowHeaderCellPaddingRight', 5],\n ['rowHeaderCellPaddingTop', 5],\n ['rowHeaderCellSelectedBackgroundColor', 'rgba(217, 217, 217, 1)'],\n ['rowHeaderCellSelectedColor', 'rgba(50, 50, 50, 1)'],\n ['rowHeaderCellVerticalAlignment', 'center'],\n ['rowHeaderCellWidth', 57],\n ['scrollBarActiveColor', 'rgba(125, 125, 125, 1)'],\n ['scrollBarBackgroundColor', 'rgba(240, 240, 240, 1)'],\n ['scrollBarBorderColor', 'rgba(202, 202, 202, 1)'],\n ['scrollBarBorderWidth', 0.5],\n ['scrollBarBoxBorderRadius', 4.125],\n ['scrollBarBoxColor', 'rgba(192, 192, 192, 1)'],\n ['scrollBarBoxMargin', 2],\n ['scrollBarBoxMinSize', 15],\n ['scrollBarBoxWidth', 8],\n ['scrollBarCornerBackgroundColor', 'rgba(240, 240, 240, 1)'],\n ['scrollBarCornerBorderColor', 'rgba(202, 202, 202, 1)'],\n ['scrollBarWidth', 11],\n ['selectionOverlayBorderColor', 'rgba(66, 133, 244, 1)'],\n ['selectionOverlayBorderWidth', 0.75],\n ['treeArrowBorderColor', 'rgba(195, 199, 202, 1)'],\n ['treeArrowBorderWidth', 1],\n ['treeArrowClickRadius', 5],\n ['treeArrowColor', 'rgba(155, 155, 155, 1)'],\n ['treeArrowHeight', 8],\n ['treeArrowMarginLeft', 0],\n ['treeArrowMarginRight', 5],\n ['treeArrowMarginTop', 6],\n ['treeArrowWidth', 13],\n ['treeGridHeight', 250]\n ]\n };\n };\n}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*jslint browser: true, unparam: true, todo: true*/\n/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/\n!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {\n 'use strict';\n return function (self) {\n /**\n * Ends editing, optionally aborting the edit.\n * @memberof canvasDataGrid\n * @name endEdit\n * @method\n * @param {boolean} abort When true, abort the edit.\n */\n self.endEdit = function (abort) {\n var cell = self.input.editCell,\n y = cell.rowIndex;\n function abortEdit() {\n abort = true;\n }\n if (self.dispatchEvent('beforeendedit', {\n cell: cell,\n newValue: self.input.value,\n oldValue: cell.value,\n abort: abortEdit,\n input: self.input\n })) { return false; }\n if (self.input.value !== cell.value && !abort) {\n self.changes[y] = self.changes[y] || {};\n self.changes[y][cell.header.name] = self.input.value;\n cell.data[cell.header.name] = self.input.value;\n if (y === self.data.length) {\n if (self.dispatchEvent('newrow', {\n value: self.input.value,\n defaultValue: cell.value,\n aborted: abort,\n cell: cell,\n input: self.input\n })) { return false; }\n self.uId += 1;\n self.addRow(cell.data);\n self.createNewRowData();\n }\n self.draw(true);\n }\n document.body.removeChild(self.input);\n self.controlInput.focus();\n self.dispatchEvent('endedit', {\n cell: cell,\n value: self.input.value,\n aborted: abort,\n input: self.input\n });\n self.input = undefined;\n return true;\n };\n /**\n * Begins editing at cell x, row y.\n * @memberof canvasDataGrid\n * @name beginEditAt\n * @method\n * @param {number} x The column index of the cell to edit.\n * @param {number} y The row index of the cell to edit.\n */\n self.beginEditAt = function (x, y) {\n if (!self.attributes.editable) { return; }\n var cell = self.getVisibleCellByIndex(x, y),\n s = self.getVisibleSchema(),\n enumItems;\n if (self.dispatchEvent('beforebeginedit', {cell: cell})) { return false; }\n self.scrollIntoView(x, y);\n self.setActiveCell(x, y);\n if (cell.header.enum) {\n self.input = document.createElement('select');\n } else {\n self.input = document.createElement(self.attributes.multiLine\n ? 'textarea' : 'input');\n }\n function postDraw() {\n var option, valueInEnum;\n cell = self.getVisibleCellByIndex(x, y);\n if (cell.header.enum) {\n // add enums\n if (typeof cell.header.enum === 'function') {\n enumItems = cell.header.enum.apply(self.intf, [{cell: cell}]);\n } else if (Array.isArray(cell.header.enum)) {\n enumItems = cell.header.enum;\n }\n enumItems.forEach(function (e) {\n var i = document.createElement('option'),\n val,\n title;\n if (Array.isArray(e)) {\n val = e[0];\n title = e[1];\n } else {\n val = e;\n title = e;\n }\n if (val === cell.value) { valueInEnum = true; }\n i.value = val;\n i.innerHTML = title;\n self.input.appendChild(i);\n });\n if (!valueInEnum) {\n option = document.createElement('option');\n option.value = cell.value;\n option.innerHTML = cell.value;\n self.input.appendChild(option);\n }\n self.input.addEventListener('change', function () {\n self.endEdit();\n self.draw(true);\n });\n }\n document.body.appendChild(self.input);\n self.createInlineStyle(self.input, 'canvas-datagrid-edit-input');\n self.input.style.position = 'absolute';\n self.input.editCell = cell;\n self.resizeEditInput();\n self.input.style.zIndex = '2';\n self.input.value = cell.value;\n self.input.focus();\n self.input.addEventListener('click', self.stopPropagation);\n self.input.addEventListener('dblclick', self.stopPropagation);\n self.input.addEventListener('mouseup', self.stopPropagation);\n self.input.addEventListener('mousedown', self.stopPropagation);\n self.input.addEventListener('keydown', function (e) {\n var nx = cell.columnIndex,\n ny = cell.rowIndex;\n // esc\n if (e.keyCode === 27) {\n self.endEdit(true);\n self.draw(true);\n // enter\n } else if (e.keyCode === 13\n && (!self.attributes.multiLine\n || (self.attributes.multiLine && e.shiftKey))) {\n self.endEdit();\n self.draw(true);\n } else if (e.keyCode === 9) {\n e.preventDefault();\n if (!self.endEdit()) {\n return;\n }\n if (e.shiftKey) {\n nx -= 1;\n } else {\n nx += 1;\n }\n if (nx < 0) {\n nx = s.length - 1;\n ny -= 1;\n }\n if (nx > s.length - 1) {\n nx = 0;\n ny += 1;\n }\n if (ny < 0) {\n ny = self.data.length - 1;\n }\n if (ny > self.data.length - 1) {\n ny = 0;\n }\n self.scrollIntoView(nx, ny);\n self.beginEditAt(nx, ny);\n }\n });\n }\n postDraw();\n self.dispatchEvent('beginedit', {cell: cell, input: self.input});\n };\n self.createInlineStyle = function (el, className) {\n var css = {\n 'canvas-datagrid-context-menu-filter-input': {\n height: '19px',\n verticalAlign: 'bottom',\n marginLeft: '2px',\n padding: '0',\n background: self.style.contextFilterInputBackground,\n color: self.style.contextFilterInputColor,\n border: self.style.contextFilterInputBorder,\n borderRadius: self.style.contextFilterInputBorderRadius,\n lineHeight: 'normal',\n fontWeight: 'normal',\n fontFamily: self.style.contextFilterInputFontFamily,\n fontSize: self.style.contextFilterInputFontSize\n },\n 'canvas-datagrid-context-menu-filter-button': {\n height: '19px',\n verticalAlign: 'bottom',\n marginLeft: '2px',\n padding: '0',\n background: self.style.contextMenuBackground,\n color: self.style.contextMenuColor,\n border: self.style.contextFilterButtonBorder,\n borderRadius: self.style.contextFilterButtonBorderRadius,\n lineHeight: 'normal',\n fontWeight: 'normal',\n fontFamily: self.style.contextMenuFilterButtonFontFamily,\n fontSize: self.style.contextMenuFilterButtonFontSize\n },\n 'canvas-datagrid-context-child-arrow': {\n cssFloat: 'right',\n color: self.style.childContextMenuArrowColor,\n fontSize: self.style.contextMenuChildArrowFontSize,\n fontFamily: self.style.contextMenuFontFamily,\n verticalAlign: 'middle'\n },\n 'canvas-datagrid-autocomplete': {\n fontFamily: self.style.contextMenuFontFamily,\n fontSize: self.style.contextMenuFontSize,\n background: self.style.contextMenuBackground,\n color: self.style.contextMenuColor,\n border: self.style.contextMenuBorder,\n padding: self.style.contextMenuPadding,\n borderRadius: self.style.contextMenuBorderRadius,\n opacity: self.style.contextMenuOpacity,\n position: 'absolute',\n zIndex: 3,\n overflow: 'hidden'\n },\n 'canvas-datagrid-autocomplete-item': {\n background: self.style.contextMenuBackground,\n color: self.style.contextMenuColor\n },\n 'canvas-datagrid-autocomplete-item:hover': {\n background: self.style.contextMenuHoverBackground,\n color: self.style.contextMenuHoverColor\n },\n 'canvas-datagrid-canvas': {\n position: 'absolute',\n zIndex: '-1'\n },\n 'canvas-datagrid': {\n position: 'absolute',\n background: self.style.backgroundColor,\n zIndex: '1',\n boxSizing: 'content-box',\n padding: '0'\n },\n 'canvas-datagrid-control-input': {\n position: 'fixed',\n top: '-5px',\n left: '-5px',\n border: 'none',\n opacity: '0',\n cursor: 'pointer',\n width: '1px',\n height: '1px',\n lineHeight: 'normal',\n fontWeight: 'normal',\n fontFamily: self.style.contextMenuFontFamily,\n fontSize: self.style.contextMenuFontSize\n },\n 'canvas-datagrid-edit-input': {\n boxSizing: 'content-box',\n outline: 'none',\n margin: '0',\n padding: '0 0 0 ' + self.style.editCellPaddingLeft + 'px',\n lineHeight: 'normal',\n fontWeight: 'normal',\n fontFamily: self.style.editCellFontFamily,\n fontSize: self.style.editCellFontSize,\n boxShadow: self.style.editCellBoxShadow,\n border: self.style.editCellBorder,\n color: self.style.editCellColor,\n background: self.style.editCellBackgroundColor,\n appearance: 'none',\n webkitAppearance: 'none',\n mozAppearance: 'none',\n borderRadius: '0'\n },\n 'canvas-datagrid-context-menu-item': {\n lineHeight: 'normal',\n fontWeight: 'normal',\n fontFamily: self.style.contextMenuFontFamily,\n fontSize: self.style.contextMenuFontSize,\n color: 'inherit',\n background: 'inherit',\n margin: self.style.contextMenuItemMargin,\n borderRadius: self.style.contextMenuItemBorderRadius,\n verticalAlign: 'middle'\n },\n 'canvas-datagrid-context-menu-item:hover': {\n background: self.style.contextMenuHoverBackground,\n color: self.style.contextMenuHoverColor\n },\n 'canvas-datagrid-context-menu-label': {\n margin: self.style.contextMenuLabelMargin,\n display: self.style.contextMenuLabelDisplay,\n minWidth: self.style.contextMenuLabelMinWidth,\n maxWidth: self.style.contextMenuLabelMaxWidth\n },\n 'canvas-datagrid-context-menu': {\n lineHeight: 'normal',\n fontWeight: 'normal',\n fontFamily: self.style.contextMenuFontFamily,\n fontSize: self.style.contextMenuFontSize,\n background: self.style.contextMenuBackground,\n color: self.style.contextMenuColor,\n border: self.style.contextMenuBorder,\n padding: self.style.contextMenuPadding,\n borderRadius: self.style.contextMenuBorderRadius,\n opacity: self.style.contextMenuOpacity,\n overflow: 'hidden'\n },\n 'canvas-datagrid-invalid-search-regExp': {\n background: self.style.contextMenuFilterInvalidExpresion\n }\n };\n if (css[className]) {\n Object.keys(css[className]).map(function (prop) {\n el.style[prop] = css[className][prop];\n });\n }\n return;\n };\n self.appendTo = function (n) {\n self.parentNode = n;\n self.height = self.parentNode.offsetHeight;\n self.width = self.parentNode.offsetWidth;\n if (self.parentNode && /canvas-datagrid-(cell|tree)/.test(self.parentNode.nodeType)) {\n self.isChildGrid = true;\n self.parentGrid = self.parentNode.parentGrid;\n self.ctx = self.parentGrid.context;\n self.canvas = self.parentGrid.canvas;\n self.controlInput = self.parentGrid.controlInput;\n self.eventParent = self.canvas;\n self.intf.offsetParent = self.parentNode;\n } else {\n self.controlInput = document.createElement('input');\n self.controlInput.onblur = self.intf.blur;\n self.createInlineStyle(self.controlInput, 'canvas-datagrid-control-input');\n self.isChildGrid = false;\n self.parentDOMNode = self.parentNode;\n self.parentNode = self.parentDOMNode;\n self.parentIsCanvas = /canvas/i.test(self.parentDOMNode.tagName);\n if (self.parentIsCanvas) {\n self.canvas = self.parentDOMNode;\n } else {\n self.canvas = document.createElement('canvas');\n self.parentDOMNode.appendChild(self.canvas);\n }\n self.ctx = self.canvas.getContext('2d');\n self.ctx.textBaseline = 'alphabetic';\n document.body.appendChild(self.controlInput);\n self.eventParent = self.canvas;\n }\n self.controlInput.addEventListener('blur', function (e) {\n if (e.target !== self.canvas) {\n self.hasFocus = false;\n }\n });\n window.addEventListener('resize', self.resize);\n if (MutationObserver) {\n self.observer = new MutationObserver(function (mutations) {\n mutations.forEach(function (mutation) {\n self.resize(true);\n });\n });\n [self.canvas.parentNode].forEach(function (el) {\n self.observer.observe(el, { attributes: true });\n });\n }\n self.eventParent.addEventListener('scroll', self.resize, false);\n self.eventParent.addEventListener('touchstart', self.touchstart, false);\n self.eventParent.addEventListener('mouseup', self.mouseup, false);\n self.eventParent.addEventListener('mousedown', self.mousedown, false);\n self.eventParent.addEventListener('dblclick', self.dblclick, false);\n self.eventParent.addEventListener('click', self.click, false);\n self.eventParent.addEventListener('mousemove', self.mousemove);\n self.eventParent.addEventListener('wheel', self.scrollWheel, false);\n self.canvas.addEventListener('contextmenu', self.contextmenuEvent, false);\n (self.isChildGrid ? self.parentGrid : document).addEventListener('copy', self.copy);\n self.controlInput.addEventListener('keypress', self.keypress, false);\n self.controlInput.addEventListener('keyup', self.keyup, false);\n self.controlInput.addEventListener('keydown', self.keydown, false);\n };\n self.setDom = function () {\n self.appendTo(self.args.parentNode);\n };\n };\n}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*jslint browser: true, unparam: true, todo: true*/\n/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/\n!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {\n 'use strict';\n return function (self) {\n // all methods here are exposed by intf\n // to users\n /**\n * Converts a integer into a letter A - ZZZZZ...\n * @memberof canvasDataGrid\n * @name integerToAlpha\n * @method\n * @param {column} n The number to convert.\n */\n self.integerToAlpha = function (n) {\n var ordA = 'a'.charCodeAt(0),\n ordZ = 'z'.charCodeAt(0),\n len = ordZ - ordA + 1,\n s = '';\n while (n >= 0) {\n s = String.fromCharCode(n % len + ordA) + s;\n n = Math.floor(n / len) - 1;\n }\n return s;\n };\n /**\n * Inserts a new column before the specified index into the schema.\n * @see canvasDataGrid#schema\n * @tutorial schema\n * @memberof canvasDataGrid\n * @name insertColumn\n * @method\n * @param {column} c The column to insert into the schema.\n * @param {number} index The index of the column to insert before.\n */\n self.insertColumn = function (c, index) {\n var s = self.getSchema();\n if (s.length < index) {\n throw new Error('Index is beyond the length of the schema.');\n }\n self.validateColumn(c, s);\n s.splice(index, 0, c);\n self.data.forEach(function (row) {\n self.applyDefaultValue(row, c);\n });\n self.intf.schema = s;\n };\n /**\n * Deletes a column from the schema at the specified index.\n * @memberof canvasDataGrid\n * @name deleteColumn\n * @tutorial schema\n * @method\n * @param {number} index The index of the column to delete.\n */\n self.deleteColumn = function (index) {\n var s = self.getSchema();\n // remove data matching this column name from data\n self.data.forEach(function (row) {\n delete row[s[index].name];\n });\n s.splice(index, 1);\n self.intf.schema = s;\n };\n /**\n * Adds a new column into the schema.\n * @see canvasDataGrid#schema\n * @tutorial schema\n * @memberof canvasDataGrid\n * @name addColumn\n * @method\n * @param {column} c The column to add to the schema.\n */\n self.addColumn = function (c) {\n var s = self.getSchema();\n self.validateColumn(c, s);\n s.push(c);\n self.data.forEach(function (row) {\n self.applyDefaultValue(row, c);\n });\n self.intf.schema = s;\n };\n /**\n * Deletes a row from the dataset at the specified index.\n * @memberof canvasDataGrid\n * @name deleteRow\n * @method\n * @param {number} index The index of the row to delete.\n */\n self.deleteRow = function (index) {\n self.originalData.splice(index, 1);\n self.setFilter();\n self.resize(true);\n };\n /**\n * Inserts a new row into the dataset before the specified index.\n * @memberof canvasDataGrid\n * @name insertRow\n * @method\n * @param {object} d data.\n * @param {number} index The index of the row to insert before.\n */\n self.insertRow = function (d, index) {\n if (self.originalData.length < index) {\n throw new Error('Index is beyond the length of the dataset.');\n }\n self.originalData.splice(index, 0, d);\n self.getSchema().forEach(function (c) {\n if (d[c.name] === undefined) {\n self.applyDefaultValue(self.originalData[index], c);\n }\n });\n self.setFilter();\n self.resize(true);\n };\n /**\n * Adds a new row into the dataset.\n * @memberof canvasDataGrid\n * @name addRow\n * @method\n * @param {object} d data.\n */\n self.addRow = function (d) {\n self.originalData.push(d);\n self.getSchema().forEach(function (c) {\n if (d[c.name] === undefined) {\n self.applyDefaultValue(self.originalData[self.originalData.length - 1], c);\n }\n });\n self.setFilter();\n self.resize(true);\n };\n /**\n * Sets the height of a given row by index number.\n * @memberof canvasDataGrid\n * @name setRowHeight\n * @method\n * @param {number} rowIndex The index of the row to set.\n * @param {number} height Height to set the row to.\n */\n self.setRowHeight = function (rowIndex, height) {\n self.sizes.rows[self.data[rowIndex][self.uniqueId]] = height;\n self.draw(true);\n };\n /**\n * Sets the width of a given column by index number.\n * @memberof canvasDataGrid\n * @name setColumnWidth\n * @method\n * @param {number} colIndex The index of the column to set.\n * @param {number} width Width to set the column to.\n */\n self.setColumnWidth = function (colIndex, width) {\n var s = self.getSchema();\n self.sizes.columns[s[colIndex][self.uniqueId]] = width;\n self.draw(true);\n };\n /**\n * Removes any changes to the width of the columns due to user or api interaction, setting them back to the schema or style default.\n * @memberof canvasDataGrid\n * @name resetColumnWidths\n * @tutorial schema\n * @method\n */\n self.resetColumnWidths = function () {\n self.sizes.columns = {};\n self.draw(true);\n };\n /**\n * Removes any changes to the height of the rows due to user or api interaction, setting them back to the schema or style default.\n * @memberof canvasDataGrid\n * @name resetRowHeights\n * @tutorial schema\n * @method\n */\n self.resetRowHeights = function () {\n self.sizes.rows = {};\n self.draw(true);\n };\n /**\n * Sets the value of the filter.\n * @memberof canvasDataGrid\n * @name setFilter\n * @method\n * @param {string} column Name of the column to filter.\n * @param {string} value The value to filter for.\n */\n self.setFilter = function (column, value) {\n function applyFilter() {\n self.refreshFromOrigialData();\n Object.keys(self.columnFilters).forEach(function (filter) {\n var header = self.getHeaderByName(column);\n if (!header) {\n return;\n }\n self.currentFilter = header.filter || self.filter(column.type || 'string');\n self.data = self.data.filter(function (row) {\n return self.currentFilter(row[filter], self.columnFilters[filter]);\n });\n });\n self.resize();\n self.draw(true);\n }\n if (column === undefined && value === undefined) {\n self.columnFilters = {};\n return applyFilter();\n }\n if (column && (value === '' || value === undefined)) {\n delete self.columnFilters[column];\n } else {\n self.columnFilters[column] = value;\n }\n applyFilter();\n };\n /**\n * Returns the number of pixels to scroll down to line up with row rowIndex.\n * @memberof canvasDataGrid\n * @name findRowScrollTop\n * @method\n * @param {number} rowIndex The row index of the row to scroll find.\n */\n self.findRowScrollTop = function (rowIndex) {\n var top = 0, x = 0, l = self.data.length,\n cellBorder = self.style.cellBorderWidth * 2;\n if (!self.attributes.showNewRow) {\n l -= 1;\n }\n if (rowIndex > l) {\n throw new Error('Impossible row index');\n }\n while (x < rowIndex) {\n top += (self.sizes.rows[self.data[x][self.uniqueId]] || self.style.cellHeight) + cellBorder;\n x += 1;\n }\n //TODO: This is not super accurate, causes pageUp/Dn to not move around right\n return top - (self.sizes.rows[self.data[rowIndex][self.uniqueId]] || self.style.cellHeight);\n };\n /**\n * Returns the number of pixels to scroll to the left to line up with column columnIndex.\n * @memberof canvasDataGrid\n * @name findColumnScrollLeft\n * @method\n * @param {number} columnIndex The column index of the column to find.\n */\n self.findColumnScrollLeft = function (columnIndex) {\n var left = 0, y = 0, s = self.getSchema(), l = s.length - 1;\n if (columnIndex > l) {\n throw new Error('Impossible column index');\n }\n while (y < columnIndex) {\n left += self.sizes.columns[s[y][self.uniqueId]] || s[y].width;\n y += 1;\n }\n return left;\n };\n /**\n * Scrolls the cell at cell x, row y.\n * @memberof canvasDataGrid\n * @name gotoCell\n * @method\n * @param {number} x The column index of the cell to scroll to.\n * @param {number} y The row index of the cell to scroll to.\n */\n self.gotoCell = function (x, y) {\n if (x !== undefined) {\n self.scrollBox.scrollLeft = self.findColumnScrollLeft(x);\n }\n if (y !== undefined) {\n self.scrollBox.scrollTop = self.findRowScrollTop(y);\n }\n };\n /**\n * Scrolls the row y.\n * @memberof canvasDataGrid\n * @name gotoRow\n * @method\n * @param {number} y The row index of the cell to scroll to.\n */\n self.gotoRow = function (y) {\n self.gotoCell(0, y);\n };\n /**\n * Scrolls the cell at cell x, row y into view if it is not already.\n * @memberof canvasDataGrid\n * @name scrollIntoView\n * @method\n * @param {number} x The column index of the cell to scroll into view.\n * @param {number} y The row index of the cell to scroll into view.\n */\n self.scrollIntoView = function (x, y) {\n if (self.visibleCells.filter(function (cell) {\n return (cell.rowIndex === y || y === undefined)\n && (cell.columnIndex === x || x === undefined)\n && cell.x > 0\n && cell.y > 0\n && cell.x + cell.width < self.width\n && cell.y + cell.height < self.height;\n }).length === 0) {\n self.gotoCell(x, y);\n }\n };\n /**\n * Sets the active cell. Requires redrawing.\n * @memberof canvasDataGrid\n * @name setActiveCell\n * @method\n * @param {number} x The column index of the cell to set active.\n * @param {number} y The row index of the cell to set active.\n */\n self.setActiveCell = function (x, y) {\n self.activeCell = {\n rowIndex: y,\n columnIndex: x\n };\n };\n /**\n * Selects every visible cell.\n * @memberof canvasDataGrid\n * @name selectAll\n * @method\n */\n self.selectAll = function () {\n self.selectArea({\n top: 0,\n left: 0,\n right: self.getVisibleSchema().length - 1,\n bottom: self.data.length - 1\n });\n };\n /**\n * Returns true if the selected columnIndex is selected on every row.\n * @memberof canvasDataGrid\n * @name isColumnSelected\n * @method\n * @param {number} columnIndex The column index to check.\n */\n self.isColumnSelected = function (columnIndex) {\n var colIsSelected = true;\n self.data.forEach(function (row, rowIndex) {\n if (!self.selections[rowIndex] || self.selections[rowIndex].indexOf(self.orders.columns[columnIndex]) === -1) {\n colIsSelected = false;\n }\n });\n return colIsSelected;\n };\n /**\n * Selects a column.\n * @memberof canvasDataGrid\n * @name selectColumn\n * @method\n * @param {number} columnIndex The column index to select.\n * @param {boolean} toggleSelectMode When true, behaves as if you were holding control/command when you clicked the column.\n * @param {boolean} shift When true, behaves as if you were holding shift when you clicked the column.\n * @param {boolean} supressSelectionchangedEvent When true, prevents the selectionchanged event from firing.\n */\n self.selectColumn = function (columnIndex, ctrl, shift, supressEvent) {\n var s, e, x;\n function addCol(i) {\n self.data.forEach(function (row, rowIndex) {\n self.selections[rowIndex] = self.selections[rowIndex] || [];\n if (self.selections[rowIndex].indexOf(i) === -1) {\n self.selections[rowIndex].push(i);\n }\n });\n }\n function removeCol(i) {\n self.data.forEach(function (row, rowIndex) {\n self.selections[rowIndex] = self.selections[rowIndex] || [];\n if (self.selections[rowIndex].indexOf(i) !== -1) {\n self.selections[rowIndex].splice(self.selections[rowIndex].indexOf(i), 1);\n }\n });\n }\n if (shift) {\n if (!self.activeCell) { return; }\n s = Math.min(self.activeCell.columnIndex, columnIndex);\n e = Math.max(self.activeCell.columnIndex, columnIndex);\n for (x = s; e > x; x += 1) {\n addCol(x);\n }\n }\n if (!ctrl && !shift) {\n self.selections = [];\n self.activeCell.columnIndex = columnIndex;\n self.activeCell.rowIndex = self.scrollIndexTop;\n }\n if (ctrl && self.isColumnSelected(columnIndex)) {\n removeCol(columnIndex);\n } else {\n addCol(columnIndex);\n }\n if (supressEvent) { return; }\n self.dispatchEvent('selectionchanged', {\n selectedData: self.getSelectedData(),\n selections: self.selections,\n selectionBounds: self.selectionBounds\n });\n };\n /**\n * Selects a row.\n * @memberof canvasDataGrid\n * @name selectRow\n * @method\n * @param {number} rowIndex The row index to select.\n * @param {boolean} ctrl When true, behaves as if you were holding control/command when you clicked the row.\n * @param {boolean} shift When true, behaves as if you were holding shift when you clicked the row.\n * @param {boolean} supressSelectionchangedEvent When true, prevents the selectionchanged event from firing.\n */\n self.selectRow = function (rowIndex, ctrl, shift, supressEvent) {\n var x, st, en, s = self.getSchema();\n function addRow(ri) {\n self.selections[ri] = [];\n self.selections[ri].push(-1);\n s.forEach(function (col) {\n self.selections[ri].push(col.index);\n });\n }\n if (self.dragAddToSelection === false || self.dragObject === undefined) {\n if (self.selections[rowIndex] && self.selections[rowIndex].length - 1 === s.length) {\n if (ctrl) {\n self.selections[rowIndex] = [];\n return;\n }\n }\n }\n if (self.dragAddToSelection === true || self.dragObject === undefined) {\n if (shift && self.dragObject === undefined) {\n if (!self.activeCell) { return; }\n st = Math.min(self.activeCell.rowIndex, rowIndex);\n en = Math.max(self.activeCell.rowIndex, rowIndex);\n for (x = st; en >= x; x += 1) {\n addRow(x);\n }\n } else {\n addRow(rowIndex);\n }\n }\n if (supressEvent) { return; }\n self.dispatchEvent('selectionchanged', {\n selectedData: self.getSelectedData(),\n selections: self.selections,\n selectionBounds: self.selectionBounds\n });\n };\n /**\n * Collapse a tree grid by row index.\n * @memberof canvasDataGrid\n * @name collapseTree\n * @method\n * @param {number} index The index of the row to collapse.\n */\n self.collapseTree = function (rowIndex) {\n var rowId = self.data[rowIndex][self.uniqueId];\n self.dispatchEvent('collapsetree', {\n childGrid: self.childGrids[rowId],\n data: self.data[rowIndex],\n rowIndex: rowIndex\n });\n self.openChildren[rowId].blur();\n self.openChildren[rowId].dispose();\n delete self.openChildren[rowId];\n delete self.sizes.trees[rowId];\n delete self.childGrids[rowId];\n self.dispatchEvent('resizerow', {\n cellHeight: self.style.cellHeight\n });\n self.resize(true);\n self.draw(true);\n };\n /**\n * Expands a tree grid by row index.\n * @memberof canvasDataGrid\n * @name expandTree\n * @method\n * @param {number} index The index of the row to expand.\n */\n self.expandTree = function (rowIndex) {\n var rowHeaderCellHeight = self.getRowHeaderCellHeight(),\n columnHeaderCellWidth = self.sizes.columns.cornerCell || self.style.rowHeaderCellWidth,\n rowId = self.data[rowIndex][self.uniqueId],\n h = self.sizes.trees[rowId] || self.style.treeGridHeight,\n treeGrid;\n if (!self.childGrids[rowId]) {\n treeGrid = self.createGrid({\n debug: self.attributes.debug,\n name: self.attributes.saveAppearance\n ? self.attributes.name + 'tree' + rowId : undefined,\n parentNode: {\n parentGrid: self.intf,\n nodeType: 'canvas-datagrid-tree',\n offsetHeight: h,\n offsetWidth: self.width - columnHeaderCellWidth,\n header: { width: self.width - columnHeaderCellWidth },\n offsetLeft: columnHeaderCellWidth,\n offsetTop: rowHeaderCellHeight,\n offsetParent: self.intf.parentNode,\n parentNode: self.intf.parentNode,\n style: 'tree',\n data: self.data[rowIndex]\n }\n });\n self.childGrids[rowId] = treeGrid;\n }\n treeGrid = self.childGrids[rowId];\n treeGrid.visible = true;\n self.dispatchEvent('expandtree', {\n treeGrid: treeGrid,\n data: self.data[rowIndex],\n rowIndex: rowIndex\n });\n self.openChildren[rowId] = treeGrid;\n self.sizes.trees[rowId] = h;\n self.dispatchEvent('resizerow', {height: self.style.cellHeight});\n self.resize(true);\n };\n /**\n * Toggles tree grid open and close by row index.\n * @memberof canvasDataGrid\n * @name toggleTree\n * @method\n * @param {number} index The index of the row to toggle.\n */\n self.toggleTree = function (rowIndex) {\n var i = self.openChildren[self.data[rowIndex][self.uniqueId]];\n if (i) {\n return self.collapseTree(rowIndex);\n }\n self.expandTree(rowIndex);\n };\n /**\n * Returns a header from the schema by name.\n * @memberof canvasDataGrid\n * @name getHeaderByName\n * @tutorial schema\n * @method\n * @returns {header} header with the selected name, or undefined.\n * @param {string} name The name of the column to resize.\n */\n self.getHeaderByName = function (name) {\n var x, i = self.getSchema();\n for (x = 0; x < i.length; x += 1) {\n if (i[x].name === name) {\n return i[x];\n }\n }\n };\n /**\n * Resizes a column to fit the longest value in the column. Call without a value to resize all columns.\n * Warning, can be slow on very large record sets (1m records ~3-5 seconds on an i7).\n * @memberof canvasDataGrid\n * @name fitColumnToValues\n * @method\n * @param {string} name The name of the column to resize.\n */\n self.fitColumnToValues = function (name, internal) {\n self.sizes.columns[name === 'cornerCell' ? name : self.getHeaderByName(name)[self.uniqueId]]\n = self.findColumnMaxTextLength(name);\n if (!internal) {\n self.resize();\n self.draw(true);\n }\n };\n /**\n * Checks if a cell is currently visible.\n * @memberof canvasDataGrid\n * @name isCellVisible\n * @method\n * @returns {boolean} when true, the cell is visible, when false the cell is not currently drawn.\n * @param {cell} cell The cell to check for. Alternatively you can pass an object { x: , y: }.\n */\n self.isCellVisible = function (cell) {\n var x, l = self.visibleCells.length;\n for (x = 0; x < l; x += 1) {\n if (cell.x === self.visibleCells[x].x && cell.y === self.visibleCells[x].y) {\n return true;\n }\n }\n return false;\n };\n /**\n * Sets the order of the data.\n * @memberof canvasDataGrid\n * @name order\n * @method\n * @returns {cell} cell at the selected location.\n * @param {number} columnName Number of pixels from the left.\n * @param {string} direction `asc` for ascending or `desc` for descending.\n * @param {function} [sortFunction] When defined, override the default sorting method defined in the column's schema and use this one.\n * @param {bool} [dontSetStorageData] Don't store this setting for future use.\n */\n self.order = function (columnName, direction, sortFunction, dontSetStorageData) {\n var f,\n c = self.getSchema().filter(function (col) {\n return col.name === columnName;\n });\n self.orderBy = columnName;\n if (c.length === 0) {\n throw new Error('Cannot sort. No such column name');\n }\n f = sortFunction || self.sorters[c[0].type];\n if (!f && c[0].type !== undefined) {\n console.warn('Cannot sort type \"%s\" falling back to string sort.', c[0].type);\n }\n self.data = self.data.sort(typeof f === 'function' ? f(columnName, direction) : self.sorters.string);\n self.dispatchEvent('ordercolumn', {name: columnName, direction: direction});\n self.draw(true);\n if (dontSetStorageData) { return; }\n self.setStorageData();\n };\n self.isInGrid = function (e) {\n if (e.x < 0\n || e.x > self.width\n || e.y < 0\n || e.y > self.height) {\n return false;\n }\n return true;\n };\n /**\n * Gets the cell at columnIndex and rowIndex.\n * @memberof canvasDataGrid\n * @name getVisibleCellByIndex\n * @method\n * @returns {cell} cell at the selected location.\n * @param {number} x Column index.\n * @param {number} y Row index.\n */\n self.getVisibleCellByIndex = function (x, y) {\n return self.visibleCells.filter(function (c) {\n return c.columnIndex === x && c.rowIndex === y;\n })[0];\n };\n /**\n * Gets the cell at grid pixel coordinate x and y.\n * @memberof canvasDataGrid\n * @name getCellAt\n * @method\n * @returns {cell} cell at the selected location.\n * @param {number} x Number of pixels from the left.\n * @param {number} y Number of pixels from the top.\n */\n self.getCellAt = function (x, y, useTouchScrollZones) {\n var tsz = useTouchScrollZones ? self.attributes.touchScrollZone : 0, i, l = self.visibleCells.length, cell;\n if (!self.visibleCells || !self.visibleCells.length) { return; }\n self.hasFocus = true;\n if (!(y < self.height\n && y > 0\n && x < self.width\n && x > 0)) {\n self.hasFocus = false;\n return {\n dragContext: 'inherit',\n context: 'inherit'\n };\n }\n for (i = 0; i < l; i += 1) {\n cell = self.visibleCells[i];\n if (useTouchScrollZones && /(vertical|horizontal)-scroll-/.test(cell.style)) {\n cell.x -= tsz;\n cell.y -= tsz;\n cell.height += tsz;\n cell.width += tsz;\n }\n if (cell.x - self.style.cellBorderWidth < x\n && cell.x + cell.width + self.style.cellBorderWidth > x\n && cell.y - self.style.cellBorderWidth < y\n && cell.y + cell.height + self.style.cellBorderWidth > y) {\n if (/vertical-scroll-(bar|box)/.test(cell.style)) {\n cell.dragContext = 'vertical-scroll-box';\n cell.context = 'vertical-scroll-box';\n cell.isScrollBar = true;\n cell.isVerticalScrollBar = true;\n if (y > self.scrollBox.box.v.y + self.scrollBox.scrollBoxHeight) {\n cell.dragContext = 'vertical-scroll-bottom';\n cell.context = 'vertical-scroll-bottom';\n } else if (y < self.scrollBox.box.v.y) {\n cell.dragContext = 'vertical-scroll-top';\n cell.context = 'vertical-scroll-top';\n }\n self.canvas.style.cursor = 'default';\n return cell;\n }\n if (/horizontal-scroll-(bar|box)/.test(cell.style)) {\n cell.dragContext = 'horizontal-scroll-box';\n cell.context = 'horizontal-scroll-box';\n cell.isScrollBar = true;\n cell.isHorizontalScrollBar = true;\n if (x > self.scrollBox.box.h.x + self.scrollBox.scrollBoxWidth) {\n cell.dragContext = 'horizontal-scroll-right';\n cell.context = 'horizontal-scroll-right';\n } else if (x < self.scrollBox.box.h.x) {\n cell.dragContext = 'horizontal-scroll-left';\n cell.context = 'horizontal-scroll-left';\n }\n self.canvas.style.cursor = 'default';\n return cell;\n }\n if (cell.x + cell.width - (self.attributes.borderResizeZone * 0.4) < x\n && cell.x + cell.width + (self.attributes.borderResizeZone * 0.6) > x\n && self.attributes.allowColumnResize\n && ((self.attributes.allowColumnResizeFromCell && cell.style === 'cell')\n || cell.style !== 'cell')\n && ((self.attributes.allowRowHeaderResize\n && ['rowHeaderCell', 'cornerCell'].indexOf(cell.style) !== -1)\n || ['rowHeaderCell', 'cornerCell'].indexOf(cell.style) === -1)) {\n cell.context = 'ew-resize';\n cell.dragContext = 'ew-resize';\n return cell;\n }\n if (cell.y + cell.height - (self.attributes.borderResizeZone * 0.4) < y\n && cell.y + cell.height + (self.attributes.borderResizeZone * 0.6) > y\n && self.attributes.allowRowResize\n && ((self.attributes.allowRowResizeFromCell && cell.style === 'cell')\n || cell.style !== 'cell')\n && cell.style !== 'columnHeaderCell') {\n cell.context = 'ns-resize';\n cell.dragContext = 'ns-resize';\n return cell;\n }\n if (cell.style === 'columnHeaderCell') {\n cell.context = 'cell';\n cell.dragContext = 'column-reorder';\n return cell;\n }\n if (cell.style === 'rowHeaderCell') {\n cell.context = 'cell';\n cell.dragContext = 'row-reorder';\n return cell;\n }\n if (cell.isGrid) {\n self.hasFocus = false;\n cell.dragContext = 'cell-grid';\n cell.context = 'cell-grid';\n return cell;\n }\n if (cell.style === 'tree-grid') {\n self.hasFocus = false;\n cell.dragContext = 'tree';\n cell.context = 'tree';\n return cell;\n }\n cell.dragContext = 'cell';\n cell.context = 'cell';\n return cell;\n }\n }\n self.hasFocus = true;\n self.canvas.style.cursor = 'default';\n return {\n dragContext: 'background',\n context: 'background',\n style: 'background',\n isBackground: true\n };\n };\n /**\n * Gets the bounds of current selection. \n * @returns {rect} selection.\n * @memberof canvasDataGrid\n * @name getSelectionBounds\n * @method\n */\n self.getSelectionBounds = function () {\n var low = {x: Infinity, y: Infinity},\n high = {x: -Infinity, y: -Infinity};\n self.data.forEach(function (row, rowIndex) {\n var maxCol, minCol;\n if (self.selections[rowIndex] && self.selections[rowIndex].length) {\n low.y = rowIndex < low.y ? rowIndex : low.y;\n high.y = rowIndex > high.y ? rowIndex : high.y;\n maxCol = Math.max.apply(null, self.selections[rowIndex]);\n minCol = Math.min.apply(null, self.selections[rowIndex]);\n low.x = minCol < low.x ? minCol : low.x;\n high.x = maxCol > high.x ? maxCol : high.x;\n }\n });\n return {\n top: low.y,\n left: low.x,\n bottom: high.y,\n right: high.x\n };\n };\n /**\n * Returns an auto generated schema based on data structure.\n * @memberof canvasDataGrid\n * @name getSchemaFromData\n * @method\n * @tutorial schema\n * @returns {schema} schema A schema based on the first item in the data array.\n */\n self.getSchemaFromData = function () {\n return Object.keys(self.data[0] || {' ': ''}).map(function mapEachSchemaColumn(key, index) {\n var type = self.getBestGuessDataType(key),\n i = {\n name: key,\n title: isNaN(parseInt(key, 10)) ? key : self.integerToAlpha(key).toUpperCase(),\n width: self.style.columnWidth,\n index: index,\n type: type,\n filter: self.filter(type)\n };\n if (key === self.uniqueId) {\n i.hidden = true;\n }\n i[self.uniqueId] = self.getSchemaNameHash(key);\n return i;\n });\n };\n /**\n * Clears the change log grid.changes that keeps track of changes to the data set.\n * This does not undo changes or alter data it is simply a convince array to keep\n * track of changes made to the data since last this method was called.\n * @memberof canvasDataGrid\n * @name clearChangeLog\n * @method\n */\n self.clearChangeLog = function () {\n self.changes = [];\n };\n /**\n * Selects an area of the grid.\n * @memberof canvasDataGrid\n * @name selectArea\n * @method\n * @param {rect} bounds A rect object representing the selected values.\n */\n self.selectArea = function (bounds, ctrl) {\n self.selectionBounds = bounds || self.selectionBounds;\n var x, y, s = self.getSchema();\n if (!ctrl) {\n self.selections = [];\n }\n if (self.selectionBounds.top < -1\n || self.selectionBounds.bottom > self.data.length\n || self.selectionBounds.left < -1\n || self.selectionBounds.right > s.length) {\n throw new Error('Impossible selection area');\n }\n for (x = self.selectionBounds.top; x <= self.selectionBounds.bottom; x += 1) {\n self.selections[x] = [];\n for (y = self.selectionBounds.left; y <= self.selectionBounds.right; y += 1) {\n if (self.selections[x].indexOf(y) === -1) {\n self.selections[x].push(y);\n }\n }\n }\n self.dispatchEvent('selectionchanged', {\n selectedData: self.getSelectedData(),\n selections: self.selections,\n selectionBounds: self.selectionBounds\n });\n };\n /**\n * Returns the maximum text width for a given column by column name.\n * @memberof canvasDataGrid\n * @name findColumnMaxTextLength\n * @method\n * @returns {number} The number of pixels wide the maximum width value in the selected column.\n * @param {string} name The name of the column to calculate the value's width of.\n */\n self.findColumnMaxTextLength = function (name) {\n var m = -Infinity;\n if (name === 'cornerCell') {\n self.ctx.font = self.style.rowHeaderCellFont;\n return self.ctx.measureText((self.data.length + (self.attributes.showNewRow ? 1 : 0)).toString()).width\n + self.style.autosizePadding + self.style.autosizeHeaderCellPadding\n + self.style.rowHeaderCellPaddingRight\n + self.style.rowHeaderCellPaddingLeft\n + (self.attributes.tree ? self.style.treeArrowWidth\n + self.style.treeArrowMarginLeft + self.style.treeArrowMarginRight : 0);\n }\n self.getSchema().forEach(function (col) {\n if (col.name !== name) { return; }\n self.ctx.font = self.style.columnHeaderCellFont;\n var t = self.ctx.measureText(col.title || col.name).width\n + self.style.headerCellPaddingRight\n + self.style.headerCellPaddingLeft;\n m = t > m ? t : m;\n });\n self.data.forEach(function (row) {\n self.ctx.font = self.style.cellFont;\n var t = self.ctx.measureText(row[name]).width\n + self.style.cellPaddingRight\n + self.style.cellPaddingLeft + self.style.cellAutoResizePadding;\n m = t > m ? t : m;\n });\n return m;\n };\n /**\n * Gets the total width of all header columns.\n * @memberof canvasDataGrid\n * @name getHeaderWidth\n * @method\n */\n self.getHeaderWidth = function () {\n return self.getVisibleSchema().reduce(function (total, header) {\n return total + header.width;\n }, 0);\n };\n self.formatters.string = function cellFormatterString(e) {\n return e.cell.value !== undefined ? e.cell.value : '';\n };\n self.formatters.rowHeaderCell = self.formatters.string;\n self.formatters.headerCell = self.formatters.string;\n self.formatters.number = self.formatters.string;\n self.formatters.int = self.formatters.string;\n self.formatters.html = self.formatters.string;\n self.sorters.string = function (columnName, direction) {\n var asc = direction === 'asc';\n return function (a, b) {\n if (a[columnName] === undefined || a[columnName] === null) {\n return 1;\n }\n if (b[columnName] === undefined || b[columnName] === null) {\n return 0;\n }\n if (asc) {\n if (!a[columnName].localeCompare) { return 1; }\n return a[columnName].localeCompare(b[columnName]);\n }\n if (!b[columnName].localeCompare) { return 1; }\n return b[columnName].localeCompare(a[columnName]);\n };\n };\n self.sorters.number = function (columnName, direction) {\n var asc = direction === 'asc';\n return function (a, b) {\n if (asc) {\n return a[columnName] - b[columnName];\n }\n return b[columnName] - a[columnName];\n };\n };\n self.sorters.date = function (columnName, direction) {\n var asc = direction === 'asc';\n return function (a, b) {\n if (asc) {\n return new Date(a[columnName]).getTime()\n - new Date(b[columnName]).getTime();\n }\n return new Date(b[columnName]).getTime()\n - new Date(a[columnName]).getTime();\n };\n };\n };\n}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\n\n/***/ })\n/******/ ]);\n});\n\n\n// WEBPACK FOOTER //\n// canvas-datagrid.js"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 175ab65163330d6d3b73","/*jslint browser: true, unparam: true, todo: true*/\n/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/\ndefine([\n './draw',\n './events',\n './intf',\n './contextMenu',\n './defaults',\n './dom',\n './publicMethods'\n], function context() {\n 'use strict';\n var modules = Array.prototype.slice.call(arguments);\n function grid(args) {\n args = args || {};\n var self = {};\n self.args = args;\n self.createGrid = grid;\n modules.forEach(function (module) {\n module(self);\n });\n self.init();\n return self.intf;\n }\n if (window && !window.canvasDatagrid && !window.require) {\n window.canvasDatagrid = grid;\n }\n module.exports = grid;\n return grid;\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/main.js\n// module id = 0\n// module chunks = 0","/*jslint browser: true, unparam: true, todo: true*/\n/*globals XMLSerializer: false, define: true, Blob: false, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/\ndefine([], function () {\n 'use strict';\n return function (self) {\n var perfCounters = [],\n drawCount = 0,\n perfWindowSize = 20;\n self.htmlImageCache = {};\n function drawOnAllImagesLoaded() {\n var loaded = true;\n Object.keys(self.htmlImageCache).forEach(function (html) {\n if (!self.htmlImageCache[html].complete) {\n loaded = false;\n }\n });\n if (loaded) {\n self.draw();\n }\n }\n function drawHtml(cell) {\n var img,\n v = cell.innerHTML || cell.formattedValue,\n x = cell.x + self.canvasOffsetLeft,\n y = cell.y + self.canvasOffsetTop;\n if (self.htmlImageCache[v]) {\n img = self.htmlImageCache[v];\n if (img.height !== cell.height || img.width !== cell.width) {\n // height and width of the cell has changed, invalidate cache\n self.htmlImageCache[v] = undefined;\n } else {\n if (!img.complete) {\n return;\n }\n return self.ctx.drawImage(img, x, y);\n }\n }\n img = new Image(cell.width, cell.height);\n self.htmlImageCache[v] = img;\n img.onload = function () {\n self.ctx.drawImage(img, x, y);\n drawOnAllImagesLoaded();\n };\n img.src = 'data:image/svg+xml;base64,' + btoa(\n '\\n' +\n '\\n' +\n '\\n' +\n v + '\\n' +\n '' +\n '\\n' +\n '\\n'\n );\n }\n function drawOrderByArrow(x, y) {\n x += self.canvasOffsetLeft;\n y += self.canvasOffsetTop;\n self.ctx.fillStyle = self.style.columnHeaderOrderByArrowColor;\n self.ctx.strokeStyle = self.style.columnHeaderOrderByArrowBorderColor;\n self.ctx.beginPath();\n x = x + self.style.columnHeaderOrderByArrowMarginLeft;\n y = y + self.style.columnHeaderOrderByArrowMarginTop;\n if (self.orderDirection === 'asc') {\n self.ctx.moveTo(x, y);\n self.ctx.lineTo(x + self.style.columnHeaderOrderByArrowWidth, y);\n self.ctx.lineTo(x + (self.style.columnHeaderOrderByArrowWidth * 0.5), y + self.style.columnHeaderOrderByArrowHeight);\n self.ctx.moveTo(x, y);\n } else {\n self.ctx.lineTo(x, y + self.style.columnHeaderOrderByArrowHeight);\n self.ctx.lineTo(x + self.style.columnHeaderOrderByArrowWidth, y + self.style.columnHeaderOrderByArrowHeight);\n self.ctx.lineTo(x + (self.style.columnHeaderOrderByArrowWidth * 0.5), y);\n self.ctx.lineTo(x, y + self.style.columnHeaderOrderByArrowHeight);\n }\n self.ctx.stroke();\n self.ctx.fill();\n return self.style.columnHeaderOrderByArrowMarginLeft\n + self.style.columnHeaderOrderByArrowWidth\n + self.style.columnHeaderOrderByArrowMarginRight;\n }\n function drawTreeArrow(cell, x, y) {\n x += self.canvasOffsetLeft;\n y += self.canvasOffsetTop;\n self.ctx.fillStyle = self.style.treeArrowColor;\n self.ctx.strokeStyle = self.style.treeArrowBorderColor;\n self.ctx.beginPath();\n x = x + self.style.treeArrowMarginLeft;\n y = y + self.style.treeArrowMarginTop;\n if (self.openChildren[cell.data[self.uniqueId]]) {\n self.ctx.moveTo(x, y);\n self.ctx.lineTo(x + self.style.treeArrowWidth, y);\n self.ctx.lineTo(x + (self.style.treeArrowWidth * 0.5), y + self.style.treeArrowHeight);\n self.ctx.moveTo(x, y);\n } else {\n self.ctx.lineTo(x, y);\n self.ctx.lineTo(x + self.style.treeArrowHeight, y + (self.style.treeArrowWidth * 0.5));\n self.ctx.lineTo(x, y + self.style.treeArrowWidth);\n self.ctx.lineTo(x, y);\n }\n self.ctx.stroke();\n self.ctx.fill();\n return self.style.treeArrowMarginLeft\n + self.style.treeArrowWidth\n + self.style.treeArrowMarginRight;\n }\n function radiusRect(x, y, w, h, radius) {\n x += self.canvasOffsetLeft;\n y += self.canvasOffsetTop;\n var r = x + w, b = y + h;\n self.ctx.beginPath();\n self.ctx.moveTo(x + radius, y);\n self.ctx.lineTo(r - radius, y);\n self.ctx.quadraticCurveTo(r, y, r, y + radius);\n self.ctx.lineTo(r, y + h - radius);\n self.ctx.quadraticCurveTo(r, b, r - radius, b);\n self.ctx.lineTo(x + radius, b);\n self.ctx.quadraticCurveTo(x, b, x, b - radius);\n self.ctx.lineTo(x, y + radius);\n self.ctx.quadraticCurveTo(x, y, x + radius, y);\n }\n function fillRect(x, y, w, h) {\n x += self.canvasOffsetLeft;\n y += self.canvasOffsetTop;\n self.ctx.fillRect(x, y, w, h);\n }\n function strokeRect(x, y, w, h) {\n x += self.canvasOffsetLeft;\n y += self.canvasOffsetTop;\n self.ctx.strokeRect(x, y, w, h);\n }\n function fillText(text, x, y) {\n x += self.canvasOffsetLeft;\n y += self.canvasOffsetTop;\n self.ctx.fillText(text, x, y);\n }\n function addBorderLine(c, pos) {\n self.ctx.beginPath();\n var p = {\n t: function () {\n self.ctx.moveTo(c.x + self.canvasOffsetLeft, c.y + self.canvasOffsetTop);\n self.ctx.lineTo(c.x + self.canvasOffsetLeft + c.width, c.y + self.canvasOffsetTop);\n },\n r: function () {\n self.ctx.moveTo(c.x + self.canvasOffsetLeft + c.width, c.y + self.canvasOffsetTop);\n self.ctx.lineTo(c.x + self.canvasOffsetLeft + c.width, c.y + self.canvasOffsetTop + c.height);\n },\n b: function () {\n self.ctx.moveTo(c.x + self.canvasOffsetLeft, c.y + self.canvasOffsetTop + c.height);\n self.ctx.lineTo(c.x + self.canvasOffsetLeft + c.width, c.y + self.canvasOffsetTop + c.height);\n },\n l: function () {\n self.ctx.moveTo(c.x + self.canvasOffsetLeft, c.y + self.canvasOffsetTop);\n self.ctx.lineTo(c.x + self.canvasOffsetLeft, c.y + self.canvasOffsetTop + c.height);\n },\n };\n p[pos]();\n self.ctx.stroke();\n }\n function addEllipsis(text, width) {\n var c, w = 0;\n if (self.ellipsisCache[text] && self.ellipsisCache[text][width]) {\n return self.ellipsisCache[text][width];\n }\n //TODO Add ellipsis back when there is a fast way to do it\n w = self.ctx.measureText(text).width;\n self.ellipsisCache[text] = self.ellipsisCache[text] || {};\n c = {value: text, width: w};\n self.ellipsisCache[text][width] = c;\n return c;\n }\n function drawText(cell) {\n var paddingLeft = self.style[cell.style + 'PaddingLeft'],\n paddingTop = self.style[cell.style + 'PaddingTop'],\n paddingRight = self.style[cell.style + 'PaddingRight'],\n paddingBottom = self.style[cell.style + 'PaddingBottom'],\n vPos = paddingTop + cell.height - (cell.height * 0.5),\n hPos = paddingLeft + cell.treeArrowWidth + cell.orderByArrowWidth;\n cell.text = addEllipsis(cell.formattedValue, cell.width - paddingRight - paddingLeft);\n cell.text.height = cell.fontHeight;\n if (cell.horizontalAlignment === 'right') {\n hPos = cell.width - cell.text.width - paddingRight;\n } else if (cell.horizontalAlignment === 'center') {\n hPos = (cell.width / 2) - (cell.text.width / 2);\n }\n if (cell.verticalAlignment === 'top') {\n vPos = paddingTop + cell.text.height;\n } else if (cell.verticalAlignment === 'bottom') {\n vPos = cell.height - paddingBottom - cell.text.height;\n }\n cell.text.x = cell.x + hPos;\n cell.text.y = cell.y + vPos;\n fillText(cell.text.value, cell.text.x, cell.text.y);\n }\n /**\n * Redraws the grid. No matter what the change, this is the only method required to refresh everything.\n * @memberof canvasDataGrid\n * @name draw\n * @method\n */\n self.draw = function (internal) {\n if (self.dispatchEvent('beforedraw', {})) { return; }\n if (!self.isChildGrid && (!self.height || !self.width)) {\n return;\n }\n if (self.isChildGrid && internal) {\n requestAnimationFrame(self.parentGrid.draw);\n return;\n }\n if (self.intf.visible === false) {\n return;\n }\n // initial values\n var checkScrollHeight, rowHeaderCell, p, cx, cy, treeGrid, rowOpen,\n rowHeight, cornerCell, y, x, c, h, w, s, r, rd, aCell,\n selectionBorders = [],\n rowHeaders = [],\n l = self.data.length,\n u = self.currentCell || {},\n rowHeaderCellHeight = self.getRowHeaderCellHeight(),\n columnHeaderCellWidth = self.getColumnHeaderCellWidth(),\n cellHeight = self.style.cellHeight;\n drawCount += 1;\n p = performance.now();\n // if data length has changed, there is no way to know\n if (self.data.length > self.orders.rows.length) {\n self.createRowOrders();\n }\n function drawScrollBars() {\n var v = {\n x: 0,\n y: 0,\n height: 0,\n width: 0,\n style: 'vertical-scroll-bar'\n },\n n = {\n x: 0,\n y: 0,\n height: 0,\n width: 0,\n style: 'horizontal-scroll-bar'\n },\n vb = {\n x: 0,\n y: 0,\n height: 0,\n width: 0,\n style: 'vertical-scroll-box'\n },\n nb = {\n x: 0,\n y: 0,\n height: 0,\n width: 0,\n style: 'horizontal-scroll-box'\n },\n co = {\n x: 0,\n y: 0,\n height: 0,\n width: 0,\n isCorner: true,\n isScrollBoxCorner: true,\n style: 'scroll-box-corner'\n },\n m = (self.style.scrollBarBoxMargin * 2),\n d = self.style.scrollBarBoxMargin * 0.5;\n self.ctx.strokeStyle = self.style.scrollBarBorderColor;\n self.ctx.lineWidth = self.style.scrollBarBorderWidth;\n // vertical\n v.x += w - self.style.scrollBarWidth - self.style.scrollBarBorderWidth - d;\n v.y += rowHeaderCellHeight;\n v.width = self.style.scrollBarWidth + self.style.scrollBarBorderWidth + d;\n v.height = h - rowHeaderCellHeight - self.style.scrollBarWidth - d - m;\n self.ctx.fillStyle = self.style.scrollBarBackgroundColor;\n fillRect(v.x, v.y, v.width, v.height + m);\n strokeRect(v.x, v.y, v.width, v.height + m);\n // vertical box\n vb.x = v.x + self.style.scrollBarBoxMargin;\n vb.y = rowHeaderCellHeight + self.style.scrollBarBoxMargin\n + ((v.height - self.scrollBox.scrollBoxHeight)\n * (self.scrollBox.scrollTop / self.scrollBox.scrollHeight));\n vb.width = self.style.scrollBarBoxWidth;\n vb.height = self.scrollBox.scrollBoxHeight;\n self.ctx.fillStyle = self.style.scrollBarBoxColor;\n if (/vertical/.test(u.context)) {\n self.ctx.fillStyle = self.style.scrollBarActiveColor;\n }\n if (vb.height < v.height) {\n radiusRect(vb.x, vb.y, vb.width, vb.height, self.style.scrollBarBoxBorderRadius);\n self.ctx.stroke();\n self.ctx.fill();\n }\n // horizontal\n n.x += columnHeaderCellWidth;\n n.y += h - self.style.scrollBarWidth - d;\n n.width = w - self.style.scrollBarWidth - columnHeaderCellWidth - d - m;\n n.height = self.style.scrollBarWidth + self.style.scrollBarBorderWidth + d;\n self.ctx.fillStyle = self.style.scrollBarBackgroundColor;\n fillRect(n.x, n.y, n.width + m, n.height);\n strokeRect(n.x, n.y, n.width + m, n.height);\n // horizontal box\n nb.y = n.y + self.style.scrollBarBoxMargin;\n nb.x = columnHeaderCellWidth + self.style.scrollBarBoxMargin\n + ((n.width - self.scrollBox.scrollBoxWidth)\n * (self.scrollBox.scrollLeft / self.scrollBox.scrollWidth));\n nb.width = self.scrollBox.scrollBoxWidth;\n nb.height = self.style.scrollBarBoxWidth;\n self.ctx.fillStyle = self.style.scrollBarBoxColor;\n if (/horizontal/.test(u.context)) {\n self.ctx.fillStyle = self.style.scrollBarActiveColor;\n }\n if (nb.width < n.width) {\n radiusRect(nb.x, nb.y, nb.width, nb.height, self.style.scrollBarBoxBorderRadius);\n self.ctx.stroke();\n self.ctx.fill();\n }\n //corner\n self.ctx.strokeStyle = self.style.scrollBarCornerBorderColor;\n self.ctx.fillStyle = self.style.scrollBarCornerBackgroundColor;\n co.x = n.x + n.width + m;\n co.y = v.y + v.height + m;\n co.width = self.style.scrollBarWidth + self.style.scrollBarBorderWidth;\n co.height = self.style.scrollBarWidth + self.style.scrollBarBorderWidth;\n radiusRect(co.x, co.y, co.width, co.height, 0);\n self.ctx.stroke();\n self.ctx.fill();\n self.visibleCells.unshift(v);\n self.visibleCells.unshift(vb);\n self.visibleCells.unshift(n);\n self.visibleCells.unshift(nb);\n self.visibleCells.unshift(co);\n self.scrollBox.bar = {\n v: v,\n h: n\n };\n self.scrollBox.box = {\n v: vb,\n h: nb\n };\n }\n function drawCell(d, rowIndex, rowOrderIndex) {\n return function drawEach(header, headerIndex, columnOrderIndex) {\n var cellStyle = header.style || 'cell',\n childGridAttributes,\n cell,\n isHeader = /HeaderCell/.test(cellStyle),\n isCorner = /cornerCell/.test(cellStyle),\n isRowHeader = 'rowHeaderCell' === cellStyle,\n isColumnHeader = 'columnHeaderCell' === cellStyle,\n selected = self.selections[rowOrderIndex] && self.selections[rowOrderIndex].indexOf(columnOrderIndex) !== -1,\n hovered = self.hovers[d[self.uniqueId]] && self.hovers[d[self.uniqueId]].indexOf(columnOrderIndex) !== -1,\n active = self.activeCell.rowIndex === rowOrderIndex && self.activeCell.columnIndex === columnOrderIndex,\n isGrid = typeof d[header.name] === 'object' && d[header.name] !== null && d[header.name] !== undefined,\n activeHeader = (self.orders.rows[self.activeCell.rowIndex] === rowOrderIndex\n || self.orders.columns[self.activeCell.columnIndex] === columnOrderIndex)\n && (columnOrderIndex === -1 || rowOrderIndex === -1)\n ? (isRowHeader ? 'activeRowHeaderCell' : 'activeColumnHeaderCell') : false,\n val,\n f = self.formatters[header.type || 'string'],\n orderByArrowSize = 0,\n treeArrowSize = 0,\n cellWidth = self.sizes.columns[isRowHeader ? 'cornerCell' : header[self.uniqueId]] || header.width,\n ev = {\n value: d[header.name],\n row: d,\n header: header\n };\n if (cellStyle === 'headerCellCap') {\n cellWidth = w - x;\n }\n // if no data or schema are defined, a width is provided to the stub column\n if (cellWidth === undefined) {\n cellWidth = self.style.columnWidth;\n }\n if (x + cellWidth + self.style.cellBorderWidth < 0) {\n x += cellWidth + self.style.cellBorderWidth;\n }\n if (active) {\n cellStyle = 'activeCell';\n }\n if (self.visibleRows.indexOf(rowIndex) === -1 && !isHeader) {\n self.visibleRows.push(rowIndex);\n }\n val = self.dispatchEvent('formatcellvalue', ev);\n if (!self.dispatchEvent('beforerendercell', ev)) {\n cx = x;\n cy = y;\n if (cellStyle === 'cornerCell') {\n cx = 0;\n cy = 0;\n } else if (isRowHeader) {\n cx = 0;\n } else if (isHeader) {\n cy = 0;\n }\n cell = {\n type: isGrid ? 'canvas-datagrid-cell' : header.type,\n style: cellStyle,\n nodeType: 'canvas-datagrid-cell',\n x: cx,\n y: cy,\n horizontalAlignment: self.style[cellStyle + 'HorizontalAlignment'],\n verticalAlignment: self.style[cellStyle + 'VerticalAlignment'],\n offsetTop: self.canvasOffsetTop + cy,\n offsetLeft: self.canvasOffsetLeft + cx,\n scrollTop: self.scrollBox.scrollTop,\n scrollLeft: self.scrollBox.scrollLeft,\n active: active || activeHeader,\n hovered: hovered,\n selected: selected,\n width: cellWidth,\n height: cellHeight,\n offsetWidth: cellWidth,\n offsetHeight: cellHeight,\n parentNode: self.intf.parentNode,\n offsetParent: self.intf.parentNode,\n data: d,\n isCorner: isCorner,\n isHeader: isHeader,\n isColumnHeader: isColumnHeader,\n isHeaderCellCap: !!header.isHeaderCellCap,\n isRowHeader: isRowHeader,\n rowOpen: rowOpen,\n header: header,\n columnIndex: columnOrderIndex,\n rowIndex: rowOrderIndex,\n sortColumnIndex: headerIndex,\n sortRowIndex: rowIndex,\n isGrid: isGrid,\n gridId: (self.attributes.name || '') + d[self.uniqueId] + ':' + header[self.uniqueId],\n parentGrid: self.intf,\n innerHTML: '',\n activeHeader: activeHeader,\n value: isHeader && !isRowHeader ? (header.title || header.name) : d[header.name]\n };\n ev.cell = cell;\n cell.userHeight = cell.isHeader ? self.sizes.rows[-1] : rowHeight;\n cell.userWidth = cell.isHeader ? self.sizes.columns.cornerCell : self.sizes.columns[header[self.uniqueId]];\n cell[self.uniqueId] = d[self.uniqueId];\n self.visibleCells.unshift(cell);\n self.ctx.fillStyle = self.style[cellStyle + 'BackgroundColor'];\n self.ctx.strokeStyle = self.style[cellStyle + 'BorderColor'];\n self.ctx.lineWidth = self.style[cellStyle + 'BorderWidth'];\n if (hovered) {\n self.ctx.fillStyle = self.style[cellStyle + 'HoverBackgroundColor'];\n self.ctx.strokeStyle = self.style[cellStyle + 'HoverBorderColor'];\n }\n if (selected) {\n self.ctx.fillStyle = self.style[cellStyle + 'SelectedBackgroundColor'];\n self.ctx.strokeStyle = self.style[cellStyle + 'SelectedBorderColor'];\n }\n if (activeHeader) {\n self.ctx.fillStyle = self.style[activeHeader + 'BackgroundColor'];\n }\n self.dispatchEvent('rendercell', ev);\n if (cell.isGrid) {\n if (cell.height !== rowHeight) {\n cell.height = rowHeight || self.style.cellHeightWithChildGrid;\n checkScrollHeight = true;\n }\n cell.width = self.sizes.columns[header[self.uniqueId]] || self.style.cellWidthWithChildGrid;\n }\n if (rowOpen && !cell.isRowHeader) {\n cell.height = self.sizes.rows[rd[self.uniqueId]] || self.style.cellHeight;\n }\n if (!cell.isGrid) {\n fillRect(cx, cy, cell.width, cell.height);\n strokeRect(cx, cy, cell.width, cell.height);\n }\n self.ctx.save();\n radiusRect(cell.x, cell.y, cell.width, cell.height, 0);\n self.ctx.clip();\n self.dispatchEvent('afterrendercell', ev);\n if (cell.height !== cellHeight && !(rowOpen && !cell.isRowHeader)) {\n self.sizes.rows[isHeader ? -1 : d[self.uniqueId]] = cell.height;\n checkScrollHeight = true;\n }\n if (cell.width !== cellWidth) {\n self.sizes.columns[header[self.uniqueId]] = cell.width;\n checkScrollHeight = true;\n }\n if (isRowHeader && self.attributes.tree) {\n if (!self.dispatchEvent('rendertreearrow', ev)) {\n treeArrowSize = drawTreeArrow(cell, self.style[cellStyle + 'PaddingLeft'], cy, 0);\n }\n }\n if ((self.attributes.showRowNumbers && isRowHeader)\n || !isRowHeader) {\n if (cell.isGrid) {\n if (!self.childGrids[cell.gridId]) {\n childGridAttributes = self.args.childGridAttributes || self.args;\n childGridAttributes.name = self.attributes.saveAppearance ? cell.gridId : undefined;\n childGridAttributes.parentNode = cell;\n childGridAttributes.data = d[header.name];\n self.childGrids[cell.gridId] = self.createGrid(childGridAttributes);\n self.sizes.rows[rd[self.uniqueId]]\n = self.sizes.rows[rd[self.uniqueId]] || self.style.cellGridHeight;\n checkScrollHeight = true;\n }\n cell.grid = self.childGrids[cell.gridId];\n cell.grid.parentNode = cell;\n cell.grid.visible = true;\n cell.grid.draw();\n self.dispatchEvent('rendercellgrid', ev);\n } else {\n if (self.childGrids[cell.gridId]) {\n self.childGrids[cell.gridId].parentNode.offsetHeight = 0;\n }\n if (isHeader && self.orderBy === header.name) {\n if (!self.dispatchEvent('renderorderbyarrow', ev)) {\n orderByArrowSize = drawOrderByArrow(cx + self.style[cellStyle + 'PaddingLeft'], 0);\n }\n }\n self.ctx.fillStyle = self.style[cellStyle + 'Color'];\n if (hovered) {\n self.ctx.fillStyle = self.style[cellStyle + 'HoverColor'];\n }\n if (selected) {\n self.ctx.fillStyle = self.style[cellStyle + 'SelectedColor'];\n }\n if (activeHeader) {\n self.ctx.fillStyle = self.style[activeHeader + 'Color'];\n }\n self.ctx.font = self.style[cellStyle + 'Font'];\n cell.fontHeight = self.style[cellStyle + 'FontHeight'];\n cell.treeArrowWidth = treeArrowSize;\n cell.orderByArrowWidth = orderByArrowSize;\n val = val !== undefined ? val : f\n ? f(ev) : '';\n if (val === undefined && !f) {\n val = '';\n console.warn('canvas-datagrid: Unknown format '\n + header.type + ' add a cellFormater');\n }\n cell.formattedValue = ((val !== undefined && val !== null) ? val : '').toString();\n if (self.columnFilters && self.columnFilters[val] !== undefined && isHeader) {\n cell.formattedValue = self.attributes.filterTextPrefix + val;\n }\n if (!self.dispatchEvent('rendertext', ev)) {\n if (cell.innerHTML || header.type === 'html') {\n drawHtml(cell);\n } else {\n drawText(cell);\n }\n }\n }\n }\n if (active) {\n aCell = cell;\n }\n if (selected && !isRowHeader) {\n if ((!self.selections[cell.rowIndex - 1]\n || self.selections[cell.rowIndex - 1].indexOf(cell.columnIndex) === -1\n || cell.rowIndex === 0)\n && !cell.isHeader) {\n selectionBorders.push([cell, 't']);\n }\n if (!self.selections[cell.rowIndex + 1]\n || self.selections[cell.rowIndex + 1].indexOf(cell.columnIndex) === -1) {\n selectionBorders.push([cell, 'b']);\n }\n if (!self.selections[cell.rowIndex] || cell.columnIndex === 0\n || self.selections[cell.rowIndex].indexOf(cell.columnIndex - 1) === -1) {\n selectionBorders.push([cell, 'l']);\n }\n if (!self.selections[cell.rowIndex] || cell.columnIndex === s.length\n || self.selections[cell.rowIndex].indexOf(cell.columnIndex + 1) === -1) {\n selectionBorders.push([cell, 'r']);\n }\n }\n self.ctx.restore();\n x += cell.width + self.style.cellBorderWidth;\n return cell.width;\n }\n };\n }\n function drawRowHeader(rowData, index, rowOrderIndex) {\n var a;\n if (self.attributes.showRowHeaders) {\n x = 0;\n rowHeaderCell = {'rowHeaderCell': index + 1 };\n rowHeaderCell[self.uniqueId] = rowData[self.uniqueId];\n a = {\n name: 'rowHeaderCell',\n width: self.style.rowHeaderCellWidth,\n style: 'rowHeaderCell',\n type: 'string',\n data: rowData[self.uniqueId],\n index: -1\n };\n a[self.uniqueId] = rowData[self.uniqueId];\n rowOpen = self.openChildren[rowData[self.uniqueId]];\n drawCell(rowHeaderCell, index, rowOrderIndex)(a, -1, -1);\n }\n }\n function drawHeaders() {\n var d, g = s.length, i, o, columnHeaderCell, header;\n rowHeaders.forEach(function (rArgs) {\n y = rArgs[3];\n cellHeight = rArgs[4];\n drawRowHeader(rArgs[0], rArgs[1], rArgs[2]);\n });\n if (self.attributes.showColumnHeaders) {\n x = (self.scrollBox.scrollLeft * -1) + self.scrollPixelLeft;\n if (self.attributes.showRowHeaders) {\n x += columnHeaderCellWidth;\n }\n y = 0;\n // cell height might have changed during drawing\n cellHeight = self.getRowHeaderCellHeight();\n for (o = self.scrollIndexLeft; o < g; o += 1) {\n i = self.orders.columns[o];\n header = s[i];\n d = {\n title: header.title,\n name: header.name,\n width: header.width,\n style: 'columnHeaderCell',\n type: 'string',\n index: o,\n order: i\n };\n columnHeaderCell = {'columnHeaderCell': header.title || header.name};\n columnHeaderCell[self.uniqueId] = 'h' + header[self.uniqueId];\n d[self.uniqueId] = header[self.uniqueId];\n x += drawCell(columnHeaderCell, -1, -1)(d, o, i);\n if (x > self.width + self.scrollBox.scrollLeft) {\n break;\n }\n }\n // fill in the space right of the headers\n if (x < w) {\n c = {\n name: '',\n width: self.style.scrollBarWidth,\n style: 'headerCellCap',\n isHeaderCell: true,\n isHeaderCellCap: true,\n type: 'string',\n index: s.length\n };\n c[self.uniqueId] = 'columnHeaderCell';\n drawCell({endCap: ''}, -1, -1)(c, -1, -1);\n }\n // fill in the space right of the headers\n if (self.attributes.showRowHeaders) {\n cornerCell = {'cornerCell': '' };\n cornerCell[self.uniqueId] = 'cornerCell';\n x = 0;\n c = {\n name: 'cornerCell',\n width: self.style.rowHeaderCellWidth,\n style: 'cornerCell',\n type: 'string',\n index: -1\n };\n c[self.uniqueId] = 'cornerCell';\n drawCell(cornerCell, -1, -1)(c, -1, -1);\n }\n }\n }\n function drawRow(r, d) {\n var i, treeHeight, rowSansTreeHeight, o, g = s.length;\n if (y - (cellHeight * 2) > h) {\n return false;\n }\n rd = self.data[r];\n rowOpen = self.openChildren[rd[self.uniqueId]];\n rowSansTreeHeight = self.sizes.rows[rd[self.uniqueId]] || self.style.cellHeight;\n treeHeight = (rowOpen ? self.sizes.trees[rd[self.uniqueId]] : 0);\n rowHeight = rowSansTreeHeight + treeHeight;\n if (y < rowHeight * -1) {\n return false;\n }\n if (self.attributes.showRowHeaders) {\n x += columnHeaderCellWidth;\n }\n cellHeight = rowHeight;\n for (o = self.scrollIndexLeft; o < g; o += 1) {\n i = self.orders.columns[o];\n x += drawCell(rd, r, d)(s[i], i, o);\n if (x > self.width) {\n break;\n }\n }\n // cell height might have changed during drawing\n cellHeight = rowHeight;\n x = (self.scrollBox.scrollLeft * -1) + self.scrollPixelLeft + self.style.cellBorderWidth;\n // don't draw a tree for the new row\n treeGrid = self.childGrids[rd[self.uniqueId]];\n if (r !== self.data.length && rowOpen) {\n treeGrid.visible = true;\n treeGrid.parentNode = {\n offsetTop: y + rowSansTreeHeight + self.canvasOffsetTop,\n offsetLeft: columnHeaderCellWidth - 1 + self.canvasOffsetLeft,\n offsetHeight: treeHeight,\n offsetWidth: self.width - columnHeaderCellWidth - self.style.scrollBarWidth - 1,\n offsetParent: self.intf.parentNode,\n parentNode: self.intf.parentNode,\n style: self.style,\n nodeType: 'canvas-datagrid-tree',\n scrollTop: self.scrollBox.scrollTop,\n scrollLeft: self.scrollBox.scrollLeft,\n rowIndex: r\n };\n self.visibleCells.unshift({\n rowIndex: x,\n columnIndex: 0,\n y: treeGrid.parentNode.offsetTop,\n x: treeGrid.parentNode.offsetLeft,\n height: treeGrid.parentNode.offsetHeight,\n width: treeGrid.parentNode.offsetWidth,\n style: 'tree-grid',\n type: treeGrid.parentNode.nodeType\n });\n treeGrid.draw();\n } else if (treeGrid) {\n treeGrid.parentNode.offsetHeight = 0;\n delete self.sizes.trees[rd[self.uniqueId]];\n }\n rowHeaders.push([rd, r, d, y, rowHeight]);\n y += cellHeight + self.style.cellBorderWidth;\n return true;\n }\n function initDraw() {\n self.visibleRows = [];\n s = self.getVisibleSchema();\n self.visibleCells = [];\n self.canvasOffsetTop = self.isChildGrid ? self.parentNode.offsetTop : 0;\n self.canvasOffsetLeft = self.isChildGrid ? self.parentNode.offsetLeft : 0;\n h = self.height;\n w = self.width;\n if (!self.isChildGrid) {\n self.ctx.scale(window.devicePixelRatio, window.devicePixelRatio);\n }\n }\n function drawBackground() {\n radiusRect(0, 0, w, h, 0);\n self.ctx.clip();\n self.ctx.fillStyle = self.style.backgroundColor;\n fillRect(0, 0, w, h);\n }\n function drawRows() {\n var o, n, i, g = s.length;\n x = (self.scrollBox.scrollLeft * -1) + self.scrollPixelLeft + self.style.cellBorderWidth;\n y = (self.scrollBox.scrollTop * -1) + rowHeaderCellHeight + self.scrollPixelTop + self.style.cellBorderWidth;\n for (r = self.scrollIndexTop; r < l; r += 1) {\n n = self.orders.rows[r];\n if (!drawRow(n, r)) {\n break;\n }\n }\n if (self.attributes.showNewRow) {\n if (self.attributes.showRowHeaders) {\n x += columnHeaderCellWidth;\n }\n rowHeight = cellHeight = self.style.cellHeight;\n rowOpen = false;\n for (o = self.scrollIndexLeft; o < g; o += 1) {\n i = self.orders.columns[o];\n x += drawCell(self.newRow, self.data.length, self.data.length)(s[i], i, o);\n if (x > self.width + self.scrollBox.scrollLeft) {\n break;\n }\n }\n rowHeaders.push([self.newRow, self.data.length, self.data.length, y, rowHeight]);\n }\n }\n function drawReorderMarkers() {\n if (!self.reorderObject) { return; }\n var b = {\n height: self.reorderObject.height,\n width: self.reorderObject.width,\n x: self.reorderObject.x + self.reorderObject.dragOffset.x,\n y: self.reorderObject.y + self.reorderObject.dragOffset.y\n },\n m = {\n width: w,\n heigth: h,\n x: 0,\n y: 0\n };\n self.ctx.fillStyle = self.style.reorderMarkerBackgroundColor;\n self.ctx.lineWidth = self.style.reorderMarkerBorderWidth;\n self.ctx.strokeStyle = self.style.reorderMarkerBorderColor;\n if (self.dragMode === 'row-reorder') {\n b.width = w;\n b.x = 0;\n m.width = w;\n m.y = self.currentCell.y;\n fillRect(b.x, b.y, b.width, b.height);\n strokeRect(b.x, b.y, b.width, b.height);\n self.ctx.lineWidth = self.style.reorderMarkerIndexBorderWidth;\n self.ctx.strokeStyle = self.style.reorderMarkerIndexBorderColor;\n if (self.currentCell.rowIndex !== self.reorderObject.rowIndex\n && self.currentCell.rowIndex - 1 !== self.reorderObject.rowIndex) {\n addBorderLine(m, 't');\n }\n } else if (self.dragMode === 'column-reorder' && self.reorderObject) {\n b.height = h;\n b.y = 0;\n m.height = h;\n m.x = self.currentCell.x;\n fillRect(b.x, b.y, b.width, b.height);\n strokeRect(b.x, b.y, b.width, b.height);\n self.ctx.lineWidth = self.style.reorderMarkerIndexBorderWidth;\n self.ctx.strokeStyle = self.style.reorderMarkerIndexBorderColor;\n if (self.currentCell.columnIndex !== self.reorderObject.columnIndex\n && self.currentCell.columnIndex - 1 !== self.reorderObject.columnIndex) {\n addBorderLine(m, 'l');\n }\n }\n }\n function drawBorder() {\n self.ctx.lineWidth = self.style.gridBorderWidth;\n self.ctx.strokeStyle = self.style.gridBorderColor;\n strokeRect(0, 0, self.width, self.height);\n }\n function drawSelectionBorders() {\n self.ctx.lineWidth = self.style.selectionOverlayBorderWidth;\n self.ctx.strokeStyle = self.style.selectionOverlayBorderColor;\n selectionBorders.forEach(function (c) {\n addBorderLine(c[0], c[1]);\n });\n }\n function drawActiveCell() {\n if (!aCell) { return; }\n if (self.attributes.rowSelectionMode) {\n if (self.activeCell && self.activeCell.rowIndex === aCell.rowIndex) {\n self.ctx.lineWidth = self.style.activeCellOverlayBorderWidth;\n self.ctx.strokeStyle = self.style.activeCellOverlayBorderColor;\n strokeRect(0, aCell.y, self.getHeaderWidth() + columnHeaderCellWidth, rowHeight);\n }\n } else {\n self.ctx.lineWidth = self.style.activeCellOverlayBorderWidth;\n self.ctx.strokeStyle = self.style.activeCellOverlayBorderColor;\n strokeRect(aCell.x, aCell.y, aCell.width, aCell.height);\n }\n\n }\n function drawDebug() {\n perfCounters[drawCount % perfWindowSize] = performance.now() - p;\n var d;\n if (self.attributes.debug) {\n self.ctx.font = '11px sans-serif';\n d = {};\n d.perf = (perfCounters.reduce(function (a, b) {\n return a + b;\n }, 0) / perfCounters.length).toFixed(1)\n + 'ms (' +\n perfCounters.map(function (a) { return a.toFixed(1); }).join(', ') + ')';\n d.htmlImages = Object.keys(self.htmlImageCache).length;\n d.scrollLeft = self.scrollBox.scrollLeft;\n d.scrollTop = self.scrollBox.scrollTop;\n d.scrollIndexTop = self.scrollIndexTop;\n d.scrollPixelTop = self.scrollPixelTop;\n d.scrollIndexLeft = self.scrollIndexLeft;\n d.scrollPixelLeft = self.scrollPixelLeft;\n d.canvasOffsetLeft = self.canvasOffsetLeft;\n d.canvasOffsetTop = self.canvasOffsetTop;\n d.width = self.width;\n d.height = self.height;\n d.mousex = self.mouse.x;\n d.mousey = self.mouse.y;\n d.touchx = !self.touchStart ? 0 : self.touchStart.x;\n d.touchy = !self.touchStart ? 0 : self.touchStart.y;\n d.entities = self.visibleCells.length;\n d.hasFocus = self.hasFocus;\n d.dragMode = self.dragMode;\n if (self.currentCell) {\n d.columnIndex = self.currentCell.columnIndex;\n d.rowIndex = self.currentCell.rowIndex;\n d.sortColumnIndex = self.currentCell.sortColumnIndex;\n d.sortRowIndex = self.currentCell.sortRowIndex;\n d.context = self.currentCell.context;\n d.dragContext = self.currentCell.dragContext;\n d.style = self.currentCell.style;\n d.type = self.currentCell.type;\n }\n self.ctx.save();\n Object.keys(d).forEach(function (key, index) {\n var m = key + ': ' + d[key],\n lh = 14;\n self.ctx.fillStyle = 'rgba(255, 255, 255, 0.8)';\n fillRect(columnHeaderCellWidth, lh + (index * lh), 100, lh);\n self.ctx.fillStyle = 'rgba(0, 0, 0, 1)';\n fillText(m, columnHeaderCellWidth + 1, rowHeaderCellHeight + (index * lh));\n });\n self.ctx.restore();\n }\n }\n self.ctx.save();\n initDraw();\n drawBackground();\n drawRows();\n drawSelectionBorders();\n drawActiveCell();\n drawHeaders();\n drawReorderMarkers();\n drawScrollBars();\n if (checkScrollHeight) {\n self.resize(true);\n }\n drawBorder();\n drawDebug();\n if (self.dispatchEvent('afterdraw', {})) { return; }\n self.ctx.restore();\n };\n };\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/draw.js\n// module id = 1\n// module chunks = 0","/*jslint browser: true, unparam: true, todo: true*/\n/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/\ndefine([], function () {\n 'use strict';\n return function (self) {\n var touchDelta = {x: 0, y: 0, scrollTop: 0, scrollLeft: 0},\n touchAnimateTo = {scrollLeft: 0, scrollTop: 0},\n touchSigma = {scrollLeft: 0, scrollTop: 0},\n xPPS = 0,\n yPPS = 0,\n touchingCell = false,\n startingCell = false,\n animationFrames = 0;\n self.getTouchPos = function (e) {\n var rect = self.canvas.getBoundingClientRect(),\n pos = {\n x: e.touches[0].clientX - rect.left,\n y: e.touches[0].clientY - rect.top\n };\n if (self.isChildGrid) {\n pos.x -= self.canvasOffsetLeft;\n pos.y -= self.canvasOffsetTop;\n }\n return {\n x: pos.x,\n y: pos.y,\n rect: rect\n };\n };\n self.calculatePPS = function () {\n xPPS = ((touchDelta.scrollLeft - touchSigma.scrollLeft) / (touchDelta.t - touchSigma.t));\n yPPS = ((touchDelta.scrollTop - touchSigma.scrollTop) / (touchDelta.t - touchSigma.t));\n touchSigma = {\n scrollLeft: touchDelta.scrollLeft,\n scrollTop: touchDelta.scrollTop,\n t: performance.now() / 1000\n };\n };\n self.touchCell = function (e) {\n return function () {\n clearInterval(self.touchCalcTimeout);\n var pos = self.getTouchPos(e);\n if (Math.abs(touchDelta.x) + Math.abs(touchDelta.y) < self.attributes.touchDeadZone) {\n touchingCell = self.getCellAt(pos.x, pos.y);\n self.mousemove(e, pos);\n self.mousedown(e, pos);\n self.mousemove(e, pos);\n self.draw();\n }\n };\n };\n self.touchstart = function (e) {\n touchingCell = false;\n self.touchStart = self.getTouchPos(e);\n startingCell = self.getCellAt(self.touchStart.x, self.touchStart.y, true);\n if (self.dispatchEvent('touchstart', {NativeEvent: e, cell: self.startingCell})) { return; }\n if (!self.hasFocus) { return; }\n self.stopPropagation(e);\n e.preventDefault();\n if (e.touches.length === 2) {\n return self.contextmenu(e, self.touchStart);\n }\n self.touchScrollStart = {\n scrollLeft: self.scrollBox.scrollLeft,\n scrollTop: self.scrollBox.scrollTop,\n t: performance.now() / 1000\n };\n touchDelta = {\n x: self.touchStart.x,\n y: self.touchStart.y,\n scrollLeft: self.scrollBox.scrollLeft,\n scrollTop: self.scrollBox.scrollTop,\n t: 0\n };\n self.touchmove(e);\n clearTimeout(self.touchTimeout);\n clearInterval(self.touchCalcTimeout);\n self.touchTimeout = setTimeout(self.touchCell(e), self.attributes.touchSelectTimeMs);\n self.touchCalcTimeout = setInterval(self.calculatePPS, 20);\n self.touchHaltAnimation = true;\n document.body.addEventListener('touchmove', self.touchmove, {passive: false});\n document.body.addEventListener('touchend', self.touchend, false);\n document.body.addEventListener('touchcancel', self.touchcancel, false);\n };\n self.easing = function (t, b, c, d) {\n return c * (t / d) * (2 - t) + b;\n };\n self.touchEndAnimation = function () {\n if (!self.canvas || !self.scrollBox.scrollTo) { return requestAnimationFrame(self.touchEndAnimation); }\n var x,\n y,\n n = performance.now() / 1000,\n d = (self.attributes.touchReleaseAnimationDurationMs / 1000),\n t;\n touchDelta.t = touchDelta.t || n + d;\n t = n - touchDelta.t + 1;\n if (t > 1 || self.touchHaltAnimation || (animationFrames > 1000)) {\n animationFrames = 0;\n self.touchHaltAnimation = false;\n touchAnimateTo = {scrollLeft: -1, scrollTop: -1};\n return;\n }\n animationFrames += 1;\n x = self.easing(t, touchDelta.scrollLeft, -touchAnimateTo.scrollLeft, d);\n y = self.easing(t, touchDelta.scrollTop, -touchAnimateTo.scrollTop, d);\n self.scrollBox.scrollTo(x, y);\n requestAnimationFrame(self.touchEndAnimation);\n };\n self.touchend = function (e) {\n if (self.dispatchEvent('touchend', {NativeEvent: e})) { return; }\n var dz = Math.abs(touchDelta.x) + Math.abs(touchDelta.y) < self.attributes.touchDeadZone,\n pos = {\n x: self.touchStart.x + touchDelta.x,\n y: self.touchStart.y + touchDelta.y\n },\n cell = self.getCellAt(pos.x, pos.y);\n if (!self.hasFocus) { return; }\n if (touchingCell) {\n self.mouseup(e, self.touchStart);\n } else if (dz) {\n if (cell.active) {\n self.beginEditAt(cell.columnIndex, cell.rowIndex);\n } else {\n self.mousedown(e, self.touchStart);\n self.mouseup(e, self.touchStart);\n self.click(e, self.touchStart);\n }\n }\n touchingCell = false;\n document.body.removeEventListener('touchmove', self.touchmove, {passive: false});\n document.body.removeEventListener('touchend', self.touchend, false);\n document.body.removeEventListener('touchcancel', self.touchcancel, false);\n clearTimeout(self.touchTimeout);\n clearInterval(self.touchCalcTimeout);\n self.calculatePPS();\n touchAnimateTo.scrollLeft = xPPS * self.attributes.touchReleaseAcceleration;\n touchAnimateTo.scrollTop = yPPS * self.attributes.touchReleaseAcceleration;\n self.touchHaltAnimation = false;\n if (animationFrames === 0 && !/-scroll-/.test(startingCell.style) && !dz) {\n self.touchEndAnimation();\n }\n };\n self.touchmove = function (e) {\n var d = self.getTouchPos(e);\n if (self.dispatchEvent('touchmove', {NativeEvent: e, cell: self.currentCell})) { return; }\n self.stopPropagation(e);\n e.preventDefault();\n if (!self.hasFocus) { return; }\n touchDelta = {\n x: d.x - self.touchStart.x,\n y: d.y - self.touchStart.y,\n scrollLeft: self.scrollBox.scrollLeft,\n scrollTop: self.scrollBox.scrollTop,\n t: 0\n };\n if (/vertical-scroll-/.test(startingCell.style)) {\n self.scrollBox.scrollTop = self.scrollBox.scrollHeight * (d.y / self.height);\n } else if (/horizontal-scroll-/.test(startingCell.style)) {\n self.scrollBox.scrollLeft = self.scrollBox.scrollWidth * (d.x / self.width);\n } else if (touchingCell) {\n self.mousemove(e, d);\n self.draw();\n } else {\n if (animationFrames === 0) {\n self.scrollBox.scrollTo(self.touchScrollStart.scrollLeft - touchDelta.x,\n self.touchScrollStart.scrollTop - touchDelta.y);\n }\n }\n };\n self.touchcancel = function (e) {\n if (self.dispatchEvent('touchcancel', {NativeEvent: e, cell: self.currentCell})) { return; }\n if (!self.hasFocus) { return; }\n self.touchend(e);\n touchingCell = false;\n document.body.removeEventListener('touchmove', self.touchmove, {passive: false});\n document.body.removeEventListener('touchend', self.touchend, false);\n document.body.removeEventListener('touchcancel', self.touchcancel, false);\n return;\n };\n self.stopPropagation = function (e) { e.stopPropagation(); };\n self.addEventListener = function (ev, fn) {\n self.events[ev] = self.events[ev] || [];\n self.events[ev].unshift(fn);\n };\n self.removeEventListener = function (ev, fn) {\n (self.events[ev] || []).forEach(function removeEachListener(sfn, idx) {\n if (fn === sfn) {\n self.events[ev].splice(idx, 1);\n }\n });\n };\n self.dispatchEvent = function (ev, e) {\n var defaultPrevented;\n function preventDefault() {\n defaultPrevented = true;\n }\n if (!self.events[ev]) { return; }\n self.events[ev].forEach(function dispatchEachEvent(fn) {\n e.ctx = self.ctx;\n e.preventDefault = preventDefault;\n fn.apply(self.intf, [e]);\n });\n return defaultPrevented;\n };\n self.resize = function (drawAfterResize) {\n var cellBorder = self.style.cellBorderWidth * 2,\n columnHeaderCellBorder = self.style.columnHeaderCellBorderWidth * 2,\n scrollHeight,\n scrollWidth,\n rowHeaderCellHeight = self.getRowHeaderCellHeight(),\n columnHeaderCellWidth = self.getColumnHeaderCellWidth(),\n // TODO: What the hell are these numbers!? They are probably some value in the style.\n scrollDragPositionOffsetY = 30,\n scrollDragPositionOffsetX = 15;\n if (self.isChildGrid) {\n self.height = self.parentNode.offsetHeight;\n self.width = self.parentNode.offsetWidth;\n } else {\n self.parentNode = self.parentDOMNode;\n if (!self.parentIsCanvas) {\n self.height = self.parentDOMNode.offsetHeight;\n self.width = self.parentDOMNode.offsetWidth;\n self.canvas.height = self.height * window.devicePixelRatio;\n self.canvas.width = self.width * window.devicePixelRatio;\n self.canvas.style.height = self.height + 'px';\n self.canvas.style.width = self.width + 'px';\n }\n self.canvasOffsetTop = self.args.canvasOffsetTop || 0;\n self.canvasOffsetLeft = self.args.canvasOffsetLeft || 0;\n }\n scrollHeight = self.data.reduce(function reduceData(accumulator, row) {\n return accumulator\n + (self.sizes.rows[row[self.uniqueId]] || self.style.cellHeight)\n + (self.sizes.trees[row[self.uniqueId]] || 0)\n + cellBorder;\n }, 0) || 0;\n scrollWidth = self.getVisibleSchema().reduce(function reduceSchema(accumulator, column) {\n if (column.hidden) { return accumulator; }\n return accumulator + (self.sizes.columns[column[self.uniqueId]] || column.width || self.style.columnWidth) + cellBorder;\n }, 0) || 0;\n if (self.attributes.showNewRow) {\n scrollHeight += self.style.cellHeight + cellBorder;\n }\n self.scrollBox.width = self.width - columnHeaderCellWidth;\n self.scrollBox.height = self.height - rowHeaderCellHeight - columnHeaderCellBorder;\n self.scrollBox.top = rowHeaderCellHeight + columnHeaderCellBorder;\n self.scrollBox.left = columnHeaderCellWidth;\n self.scrollBox.scrollHeight = scrollHeight + self.style.scrollBarWidth - self.scrollBox.height;\n self.scrollBox.scrollWidth = scrollWidth + self.style.scrollBarWidth - self.scrollBox.width;\n self.scrollBox.widthBoxRatio = ((self.scrollBox.width - scrollDragPositionOffsetX)\n / (self.scrollBox.scrollWidth + self.scrollBox.width - scrollDragPositionOffsetX));\n self.scrollBox.scrollBoxWidth = self.scrollBox.width\n * self.scrollBox.widthBoxRatio\n - self.style.scrollBarWidth;\n self.scrollBox.heightBoxRatio = ((self.scrollBox.height - scrollDragPositionOffsetY)\n / (self.scrollBox.scrollHeight + (self.scrollBox.height - scrollDragPositionOffsetY)));\n self.scrollBox.scrollBoxHeight = self.scrollBox.height\n * self.scrollBox.heightBoxRatio\n - self.style.scrollBarWidth;\n self.scrollBox.scrollBoxWidth = Math.max(self.scrollBox.scrollBoxWidth, self.style.scrollBarBoxMinSize);\n self.scrollBox.scrollBoxHeight = Math.max(self.scrollBox.scrollBoxHeight, self.style.scrollBarBoxMinSize);\n self.page = self.visibleRows.length - 3 - self.attributes.pageUpDownOverlap;\n self.resizeEditInput();\n self.scroll(true);\n if (drawAfterResize) {\n self.draw(true);\n }\n self.dispatchEvent('resize', {});\n return true;\n };\n self.resizeEditInput = function () {\n if (self.input) {\n var pos = self.canvas.getBoundingClientRect(),\n s = self.scrollOffset(self.canvas),\n bx2 = (self.style.cellBorderWidth * 2),\n cell = self.getVisibleCellByIndex(self.input.editCell.columnIndex, self.input.editCell.rowIndex)\n || {x: -100, y: -100, height: 0, width: 0};\n self.input.style.left = pos.left + cell.x - self.style.cellBorderWidth + self.canvasOffsetLeft - s.left + 'px';\n self.input.style.top = pos.top + cell.y - bx2 + self.canvasOffsetTop - s.top + 'px';\n self.input.style.height = cell.height - bx2 - 1 + 'px';\n self.input.style.width = cell.width - bx2 - self.style.cellPaddingLeft + 'px';\n self.clipElement(self.input);\n }\n };\n self.scroll = function (e, dontDraw) {\n var s = self.getVisibleSchema(),\n cellBorder = self.style.cellBorderWidth * 2;\n self.scrollIndexTop = 0;\n self.scrollPixelTop = 0;\n self.scrollIndexLeft = 0;\n self.scrollPixelLeft = 0;\n while (self.scrollPixelTop < self.scrollBox.scrollTop && self.scrollIndexTop < self.data.length) {\n self.scrollPixelTop +=\n (self.sizes.rows[self.data[self.scrollIndexTop][self.uniqueId]] || self.style.cellHeight)\n + (self.sizes.trees[self.data[self.scrollIndexTop][self.uniqueId]] || 0)\n + cellBorder;\n self.scrollIndexTop += 1;\n }\n while (self.scrollPixelLeft < self.scrollBox.scrollLeft && self.scrollIndexLeft < s.length) {\n self.scrollPixelLeft +=\n (self.sizes.columns[s[self.scrollIndexLeft][self.uniqueId]] || s[self.scrollIndexLeft].width);\n self.scrollIndexLeft += 1;\n }\n if (self.data.length > 0) {\n self.scrollIndexLeft = Math.max(self.scrollIndexLeft - 1, 0);\n self.scrollPixelLeft = Math.max(self.scrollPixelLeft\n - (self.sizes.columns[s[self.scrollIndexLeft][self.uniqueId]] || s[self.scrollIndexLeft].width), 0);\n self.scrollIndexTop = Math.max(self.scrollIndexTop - 1, 0);\n self.scrollPixelTop = Math.max(self.scrollPixelTop\n - (self.sizes.rows[self.data[self.scrollIndexTop][self.uniqueId]] || self.style.cellHeight)\n - (self.sizes.trees[self.data[self.scrollIndexTop][self.uniqueId]] || 0), 0);\n }\n self.ellipsisCache = {};\n if (!dontDraw) {\n self.draw(true);\n }\n //TODO: figure out why this has to be delayed for child grids\n //BUG: scrolling event on 3rd level hierarchy fails to move input box\n requestAnimationFrame(self.resizeEditInput);\n self.dispatchEvent('scroll', {top: self.scrollBox.scrollTop, left: self.scrollBox.scrollLeft});\n };\n self.mousemove = function (e, overridePos) {\n if (self.contextMenu || self.input) {\n return;\n }\n self.mouse = overridePos || self.getLayerPos(e);\n var ctrl = (e.controlKey || e.metaKey || self.attributes.persistantSelectionMode),\n i,\n s = self.getSchema(),\n dragBounds,\n sBounds,\n x = self.mouse.x,\n y = self.mouse.y,\n o = self.getCellAt(x, y),\n delta,\n ev = {NativeEvent: e, cell: o, x: x, y: y},\n previousCell = self.currentCell;\n clearTimeout(self.scrollTimer);\n if (!self.isInGrid({x: x, y: y})) {\n self.hasFocus = false;\n }\n if (self.dispatchEvent('mousemove', ev)) {\n return;\n }\n if (o && self.currentCell && (self.currentCell.rowIndex !== o.rowIndex\n || self.currentCell.columnIndex !== o.columnIndex)) {\n self.cellBoundaryCrossed = true;\n ev.cell = previousCell;\n self.dispatchEvent('cellmouseout', ev);\n ev.cell = o;\n self.dispatchEvent('cellmouseover', ev);\n }\n self.currentCell = o;\n if (!self.hasFocus) {\n return;\n }\n self.hovers = {};\n if (!self.draggingItem\n && o\n && self.scrollModes.indexOf(o.context) === -1) {\n self.dragItem = o;\n self.dragMode = o.dragContext;\n self.canvas.style.cursor = o.context;\n if (o.context === 'cell' && o.data) {\n self.canvas.style.cursor = 'pointer';\n self.hovers[o.data[self.uniqueId]] = [o.columnIndex];\n }\n if ((self.selecting || self.reorderObject)\n && o.context === 'cell'\n && o.data) {\n sBounds = self.getSelectionBounds();\n delta = {\n x: Math.abs(self.dragStart.x - x),\n y: Math.abs(self.dragStart.y - y),\n };\n if (self.dragStartObject.columnIndex !== -1 && e.shiftKey) {\n self.dragStartObject = {\n rowIndex: self.activeCell.rowIndex,\n columnIndex: self.activeCell.columnIndex\n };\n }\n dragBounds = {\n top: Math.min(self.dragStartObject.rowIndex, o.rowIndex),\n left: Math.min(self.dragStartObject.columnIndex, o.columnIndex),\n bottom: Math.max(self.dragStartObject.rowIndex, o.rowIndex),\n right: Math.max(self.dragStartObject.columnIndex, o.columnIndex)\n };\n if (self.dragStartObject.columnIndex === -1) {\n dragBounds.left = -1;\n dragBounds.right = s.length - 1;\n dragBounds.top = Math.min(sBounds.top, o.rowIndex);\n dragBounds.bottom = Math.max(sBounds.bottom, o.rowIndex);\n }\n if (self.dragStartObject.rowIndex !== o.rowIndex\n || self.dragStartObject.columnIndex !== o.columnIndex) {\n self.ignoreNextClick = true;\n }\n if (self.cellBoundaryCrossed || (delta.x === 0 && delta.y === 0) || self.attributes.rowSelectionMode) {\n if (self.attributes.rowSelectionMode || self.dragStartObject.columnIndex === -1) {\n self.selectRow(o.rowIndex, ctrl, null, true);\n } else {\n if (!self.dragAddToSelection && o.rowIndex !== undefined) {\n if (self.selections[o.rowIndex] && self.selections[o.rowIndex].indexOf(o.columnIndex) !== -1) {\n self.selections[o.rowIndex].splice(self.selections[o.rowIndex].indexOf(o.columnIndex), 1);\n }\n } else {\n self.selections[o.rowIndex] = self.selections[o.rowIndex] || [];\n if (self.selections[o.rowIndex].indexOf(o.columnIndex) === -1) {\n self.selections[o.rowIndex].push(o.columnIndex);\n }\n }\n }\n }\n if ((!self.selectionBounds || (dragBounds.top !== self.selectionBounds.top\n || dragBounds.left !== self.selectionBounds.left\n || dragBounds.bottom !== self.selectionBounds.bottom\n || dragBounds.right !== self.selectionBounds.right)) && !ctrl) {\n self.selections = [];\n sBounds = dragBounds;\n if (self.attributes.rowSelectionMode) {\n for (i = sBounds.top; i <= sBounds.bottom; i += 1) {\n self.selectRow(i, true, null, true);\n }\n } else {\n self.selectArea(sBounds, true);\n }\n }\n self.autoScrollZone(e, x, y, ctrl);\n }\n }\n self.cellBoundaryCrossed = false;\n self.draw(true);\n };\n self.click = function (e, overridePos) {\n var i,\n selectionChanged,\n ctrl = (e.controlKey || e.metaKey || self.attributes.persistantSelectionMode),\n pos = overridePos || self.getLayerPos(e);\n self.currentCell = self.getCellAt(pos.x, pos.y);\n if (self.currentCell.grid !== undefined) {\n return;\n }\n function checkSelectionChange() {\n if (!selectionChanged) { return; }\n self.dispatchEvent('selectionchanged', {\n selectedData: self.getSelectedData(),\n selections: self.selections,\n selectionBounds: self.selectionBounds\n });\n }\n if (self.input) {\n self.endEdit();\n }\n if (self.ignoreNextClick) {\n self.ignoreNextClick = false;\n return;\n }\n i = self.currentCell;\n if (self.dispatchEvent('click', {NativeEvent: e, cell: self.currentCell})) { return; }\n if (!self.hasFocus) {\n return;\n }\n if (self.currentCell.context === 'cell') {\n if (self.currentCell.style === 'cornerCell') {\n self.order(self.uniqueId, 'asc', self.sorters.number);\n self.setFilter();\n checkSelectionChange();\n return;\n }\n if (self.currentCell.style === 'columnHeaderCell') {\n if (self.attributes.columnHeaderClickBehavior === 'sort') {\n if (self.orderBy === i.header.name) {\n self.orderDirection = self.orderDirection === 'asc' ? 'desc' : 'asc';\n } else {\n self.orderDirection = 'asc';\n }\n self.order(i.header.name, self.orderDirection);\n checkSelectionChange();\n return;\n }\n if (self.attributes.columnHeaderClickBehavior === 'select') {\n self.selectColumn(i.header.index, ctrl, e.shiftKey, true);\n checkSelectionChange();\n self.draw();\n return;\n }\n }\n if (['rowHeaderCell', 'columnHeaderCell'].indexOf(self.currentCell.style) === -1 && !ctrl) {\n self.setActiveCell(i.columnIndex, i.rowIndex);\n }\n self.selections[i.rowIndex] = self.selections[i.rowIndex] || [];\n if ((self.attributes.rowSelectionMode || self.currentCell.style === 'rowHeaderCell')) {\n if (self.currentCell.style === 'rowHeaderCell'\n && self.attributes.tree && pos.x > 0\n && pos.x - self.currentCell.x < self.style.treeArrowWidth\n + self.style.treeArrowMarginLeft\n + self.style.treeArrowMarginRight + self.style.treeArrowClickRadius\n && pos.y - self.currentCell.y < self.style.treeArrowHeight\n + self.style.treeArrowMarginTop + self.style.treeArrowClickRadius\n && pos.y > 0) {\n self.toggleTree(i.rowIndex);\n return;\n }\n selectionChanged = true;\n self.selectRow(i.rowIndex, ctrl, null, true);\n }\n if (e.shiftKey && !ctrl) {\n self.selectionBounds = self.getSelectionBounds();\n self.selectArea(undefined, false);\n }\n }\n checkSelectionChange();\n self.draw(true);\n };\n self.dragResizeColumn = function (e) {\n var pos, x, y;\n pos = self.getLayerPos(e);\n x = self.resizingStartingWidth + pos.x - self.dragStart.x;\n y = self.resizingStartingHeight + pos.y - self.dragStart.y;\n if (x < self.style.minColumnWidth) {\n x = self.style.minColumnWidth;\n }\n if (y < self.style.minRowHeight) {\n y = self.style.minRowHeight;\n }\n if (self.dispatchEvent('resizecolumn', {x: x, y: y, draggingItem: self.draggingItem})) { return false; }\n if (self.scrollBox.scrollLeft > self.scrollBox.scrollWidth - self.attributes.resizeScrollZone\n && self.dragMode === 'ew-resize') {\n self.resize(true);\n self.scrollBox.scrollLeft += x;\n }\n if (self.dragMode === 'ew-resize') {\n self.sizes.columns[self.draggingItem.header.style === 'rowHeaderCell'\n ? 'cornerCell' : self.draggingItem.header[self.uniqueId]] = x;\n if (['rowHeaderCell', 'cornerCell'].indexOf(self.draggingItem.header.style) !== -1) {\n self.resize(true);\n }\n self.resizeChildGrids();\n return;\n }\n if (self.dragMode === 'ns-resize') {\n if (self.draggingItem.rowOpen) {\n self.sizes.trees[self.draggingItem.data[self.uniqueId]] = y;\n } else if (self.attributes.globalRowResize) {\n self.style.cellHeight = y;\n } else {\n self.sizes.rows[self.draggingItem.data[self.uniqueId]] = y;\n }\n self.dispatchEvent('resizerow', {row: y});\n self.resizeChildGrids();\n return;\n }\n self.ellipsisCache = {};\n };\n self.stopDragResize = function () {\n self.resize();\n document.body.removeEventListener('mousemove', self.dragResizeColumn, false);\n document.body.removeEventListener('mouseup', self.stopDragResize, false);\n self.setStorageData();\n self.draw(true);\n self.ignoreNextClick = true;\n };\n self.scrollGrid = function (e) {\n var pos = self.getLayerPos(e);\n if (self.attributes.scrollPointerLock && self.pointerLockPosition\n && ['horizontal-scroll-box', 'vertical-scroll-box'].indexOf(self.scrollStartMode) !== -1) {\n self.pointerLockPosition.x += e.movementX;\n self.pointerLockPosition.y += e.movementY;\n pos = self.pointerLockPosition;\n }\n self.scrollMode = self.getCellAt(pos.x, pos.y).context;\n if (self.scrollMode === 'horizontal-scroll-box' && self.scrollStartMode !== 'horizontal-scroll-box') {\n self.scrollStartMode = 'horizontal-scroll-box';\n self.dragStart = pos;\n self.scrollStart.left = self.scrollBox.scrollLeft;\n clearTimeout(self.scrollTimer);\n return;\n }\n if (self.scrollMode === 'vertical-scroll-box' && self.scrollStartMode !== 'vertical-scroll-box') {\n self.scrollStartMode = 'vertical-scroll-box';\n self.dragStart = pos;\n self.scrollStart.top = self.scrollBox.scrollTop;\n clearTimeout(self.scrollTimer);\n return;\n }\n if (self.scrollStartMode === 'vertical-scroll-box'\n && self.scrollMode !== 'vertical-scroll-box') {\n self.scrollMode = 'vertical-scroll-box';\n }\n if (self.scrollStartMode === 'horizontal-scroll-box'\n && self.scrollMode !== 'horizontal-scroll-box') {\n self.scrollMode = 'horizontal-scroll-box';\n }\n clearTimeout(self.scrollTimer);\n if (self.scrollModes.indexOf(self.scrollMode) === -1) {\n return;\n }\n if (self.scrollMode === 'vertical-scroll-box') {\n self.scrollBox.scrollTop = self.scrollStart.top + ((pos.y - self.dragStart.y)\n / self.scrollBox.heightBoxRatio);\n } else if (self.scrollMode === 'vertical-scroll-top') {\n self.scrollBox.scrollTop -= (self.page * self.style.cellHeight);\n self.scrollTimer = setTimeout(self.scrollGrid, self.attributes.scrollRepeatRate, e);\n } else if (self.scrollMode === 'vertical-scroll-bottom') {\n self.scrollBox.scrollTop += (self.page * self.style.cellHeight);\n self.scrollTimer = setTimeout(self.scrollGrid, self.attributes.scrollRepeatRate, e);\n }\n if (self.scrollMode === 'horizontal-scroll-box') {\n self.scrollBox.scrollLeft = self.scrollStart.left + ((pos.x - self.dragStart.x)\n / self.scrollBox.widthBoxRatio);\n } else if (self.scrollMode === 'horizontal-scroll-right') {\n self.scrollBox.scrollLeft += self.attributes.selectionScrollIncrement;\n self.scrollTimer = setTimeout(self.scrollGrid, self.attributes.scrollRepeatRate, e);\n } else if (self.scrollMode === 'horizontal-scroll-left') {\n self.scrollBox.scrollLeft -= self.attributes.selectionScrollIncrement;\n self.scrollTimer = setTimeout(self.scrollGrid, self.attributes.scrollRepeatRate, e);\n }\n };\n self.stopScrollGrid = function () {\n clearTimeout(self.scrollTimer);\n if (document.exitPointerLock) {\n document.exitPointerLock();\n }\n document.body.removeEventListener('mousemove', self.scrollGrid, false);\n };\n self.dragReorder = function (e) {\n var pos, x, y;\n pos = self.getLayerPos(e);\n x = pos.x - self.dragStart.x;\n y = pos.y - self.dragStart.y;\n if (!self.attributes.allowColumnReordering && self.dragMode === 'column-reorder') {\n return;\n }\n if (!self.attributes.allowRowReordering && self.dragMode === 'row-reorder') {\n return;\n }\n if (self.dispatchEvent('reordering', {\n NativeEvent: e,\n source: self.dragStartObject,\n target: self.currentCell,\n dragMode: self.dragMode\n })) {\n return;\n }\n if (Math.abs(x) > self.attributes.reorderDeadZone || Math.abs(y) > self.attributes.reorderDeadZone) {\n self.reorderObject = self.dragStartObject;\n self.reorderTarget = self.currentCell;\n self.reorderObject.dragOffset = {\n x: x,\n y: y\n };\n self.autoScrollZone(e, pos.x, pos.x, false);\n }\n };\n self.stopDragReorder = function (e) {\n var cr = {\n 'row-reorder': self.orders.rows,\n 'column-reorder': self.orders.columns\n },\n i = {\n 'row-reorder': 'rowIndex',\n 'column-reorder': 'columnIndex'\n }[self.dragMode];\n document.body.removeEventListener('mousemove', self.dragReorder, false);\n document.body.removeEventListener('mouseup', self.stopDragReorder, false);\n if (self.reorderObject\n && self.reorderTarget) {\n self.ignoreNextClick = true;\n if (self.reorderObject[i] !== self.reorderTarget[i]\n && !self.dispatchEvent('reorder', {\n NativeEvent: e,\n source: self.reorderObject,\n target: self.reorderTarget,\n dragMode: self.dragMode\n })) {\n cr[self.dragMode].splice(cr[self.dragMode].indexOf(self.reorderObject[i]), 1);\n cr[self.dragMode].splice(cr[self.dragMode].indexOf(self.reorderTarget[i]), 0, self.reorderObject[i]);\n self.setStorageData();\n }\n }\n self.reorderObject = undefined;\n self.reorderTarget = undefined;\n self.draw(true);\n };\n self.mousedown = function (e, overridePos) {\n self.lastMouseDownTarget = e.target;\n if (self.dispatchEvent('mousedown', {NativeEvent: e, cell: self.currentCell})) { return; }\n if (!self.hasFocus) {\n return;\n }\n if (e.button === 2 || self.input) { return; }\n var ctrl = (e.controlKey || e.metaKey);\n self.dragStart = overridePos || self.getLayerPos(e);\n self.scrollStart = {\n left: self.scrollBox.scrollLeft,\n top: self.scrollBox.scrollTop\n };\n self.dragStartObject = self.getCellAt(self.dragStart.x, self.dragStart.y);\n self.dragAddToSelection = !self.dragStartObject.selected;\n if (!ctrl && !e.shiftKey && !/(vertical|horizontal)-scroll-(bar|box)/\n .test(self.dragStartObject.context) && !self.currentCell.isColumnHeader) {\n self.selections = [];\n }\n if (self.dragStartObject.isGrid) {\n return;\n }\n if (self.scrollModes.indexOf(self.dragStartObject.context) !== -1) {\n self.scrollMode = self.dragStartObject.context;\n self.scrollStartMode = self.dragStartObject.context;\n self.scrollGrid(e);\n if (self.attributes.scrollPointerLock\n && ['horizontal-scroll-box', 'vertical-scroll-box'].indexOf(self.scrollStartMode) !== -1) {\n self.pointerLockPosition = {\n x: self.dragStart.x,\n y: self.dragStart.y\n };\n self.canvas.requestPointerLock();\n }\n document.body.addEventListener('mousemove', self.scrollGrid, false);\n document.body.addEventListener('mouseup', self.stopScrollGrid, false);\n self.ignoreNextClick = true;\n return;\n }\n if (self.dragMode === 'cell') {\n self.selecting = true;\n if (self.attributes.rowSelectionMode) {\n self.selectRow(self.dragStartObject.rowIndex, ctrl, null, true);\n }\n return self.mousemove(e);\n }\n if (['ns-resize', 'ew-resize'].indexOf(self.dragMode) !== -1) {\n self.draggingItem = self.dragItem;\n if (self.draggingItem.rowOpen) {\n self.resizingStartingHeight = self.sizes.trees[self.draggingItem.data[self.uniqueId]];\n } else {\n self.resizingStartingHeight = self.sizes.rows[self.draggingItem.data[self.uniqueId]] || self.style.cellHeight;\n }\n self.resizingStartingWidth = self.sizes.columns[self.draggingItem.header.style === 'rowHeaderCell'\n ? 'cornerCell' : self.draggingItem.header[self.uniqueId]] || self.draggingItem.header.width;\n document.body.addEventListener('mousemove', self.dragResizeColumn, false);\n document.body.addEventListener('mouseup', self.stopDragResize, false);\n }\n if (['row-reorder', 'column-reorder'].indexOf(self.dragMode) !== -1) {\n self.draggingItem = self.dragItem;\n document.body.addEventListener('mousemove', self.dragReorder, false);\n document.body.addEventListener('mouseup', self.stopDragReorder, false);\n }\n };\n self.mouseup = function (e) {\n clearTimeout(self.scrollTimer);\n self.cellBoundaryCrossed = true;\n self.selecting = undefined;\n self.draggingItem = undefined;\n self.dragStartObject = undefined;\n if (self.dispatchEvent('mouseup', {NativeEvent: e, cell: self.currentCell})) { return; }\n if (!self.hasFocus && e.target !== self.canvas) {\n return;\n }\n if (self.currentCell && self.currentCell.grid !== undefined) {\n return;\n }\n if (self.contextMenu || self.input) { return; }\n if (self.dragStart && self.isInGrid(self.dragStart)) {\n self.controlInput.focus();\n }\n e.preventDefault();\n };\n self.keydown = function (e) {\n var i,\n x = self.activeCell.columnIndex,\n y = self.activeCell.rowIndex,\n ctrl = (e.controlKey || e.metaKey),\n last = self.data.length - 1,\n cols = self.getVisibleSchema().length - 1;\n if (self.dispatchEvent('keydown', {NativeEvent: e, cell: self.currentCell})) { return; }\n if (!self.hasFocus) {\n return;\n }\n self.page = self.visibleRows.length - 3 - self.attributes.pageUpDownOverlap;\n if (self.attributes.showNewRow) {\n last += 1;\n }\n if (e.keyCode === 9) {\n e.preventDefault();\n }\n // ctrl + a\n if (ctrl && e.keyCode === 65) {\n self.selectAll();\n //ArrowDown\n } else if (e.keyCode === 40) {\n y += 1;\n //ArrowUp\n } else if (e.keyCode === 38) {\n y -= 1;\n //ArrowLeft Tab\n } else if (e.keyCode === 37 || (e.shiftKey && e.keyCode === 9)) {\n x -= 1;\n //ArrowRight Tab\n } else if (e.keyCode === 39 || (!e.shiftKey && e.keyCode === 9)) {\n x += 1;\n //PageUp\n } else if (e.keyCode === 33) {\n y -= self.page;\n e.preventDefault();\n //PageDown\n } else if (e.keyCode === 34) {\n y += self.page;\n e.preventDefault();\n //Home ArrowUp\n } else if (e.keyCode === 36 || (ctrl && e.keyCode === 38)) {\n y = 0;\n //End ArrowDown\n } else if (e.keyCode === 35 || (ctrl && e.keyCode === 40)) {\n y = self.data.length - 1;\n //ArrowRight\n } else if (ctrl && e.keyCode === 39) {\n x = cols;\n //ArrowLeft\n } else if (ctrl && e.keyCode === 37) {\n x = 0;\n }\n //Enter\n if (e.keyCode === 13) {\n return self.beginEditAt(x, y);\n }\n //Space\n if (e.keyCode === 32) {\n self.selections = [];\n self.selections[Math.max(y, 0)] = [];\n self.selections[Math.max(y, 0)].push(x);\n self.selectionBounds = self.getSelectionBounds();\n if (self.attributes.rowSelectionMode) {\n for (i = self.selectionBounds.top; i <= self.selectionBounds.bottom; i += 1) {\n self.selectRow(i, ctrl, null, true);\n }\n } else {\n self.selectArea(undefined, ctrl);\n }\n e.preventDefault();\n self.draw(true);\n return;\n }\n if (x < 0) {\n x = 0;\n }\n if (y > last) {\n y = last;\n }\n if (y < 0) {\n y = 0;\n }\n if (x > cols) {\n x = cols;\n }\n // Arrows\n if (e.shiftKey && [37, 38, 39, 40].indexOf(e.keyCode) !== -1) {\n self.selections[Math.max(y, 0)] = self.selections[Math.max(y, 0)] || [];\n self.selections[Math.max(y, 0)].push(x);\n self.selectionBounds = self.getSelectionBounds();\n self.selectArea(undefined, ctrl);\n self.draw(true);\n }\n if (x !== self.activeCell.columnIndex || y !== self.activeCell.rowIndex) {\n self.scrollIntoView(x !== self.activeCell.columnIndex ? x : undefined, y !== self.activeCell.rowIndex ? y : undefined);\n self.setActiveCell(x, y);\n if (!e.shiftKey && self.attributes.selectionFollowsActiveCell) {\n if (!ctrl) {\n self.selections = [];\n }\n self.selections[y] = self.selections[y] || [];\n self.selections[y].push(x);\n self.dispatchEvent('selectionchanged', {\n selectedData: self.getSelectedData(),\n selections: self.selections,\n selectionBounds: self.selectionBounds\n });\n }\n self.draw(true);\n }\n };\n self.keyup = function (e) {\n if (self.dispatchEvent('keyup', {NativeEvent: e, cell: self.currentCell})) { return; }\n if (!self.hasFocus) {\n return;\n }\n self.controlInput.value = '';\n };\n self.keypress = function (e) {\n if (!self.hasFocus) {\n return;\n }\n if (self.dispatchEvent('keypress', {NativeEvent: e, cell: self.currentCell})) { return; }\n };\n self.dblclick = function (e) {\n if (self.dispatchEvent('dblclick', {NativeEvent: e, cell: self.currentCell})) { return; }\n if (!self.hasFocus) {\n return;\n }\n if (self.currentCell.context === 'ew-resize'\n && self.currentCell.style === 'columnHeaderCell') {\n self.fitColumnToValues(self.currentCell.header.name);\n } else if (self.currentCell.context === 'ew-resize'\n && self.currentCell.style === 'cornerCell') {\n self.autosize();\n } else if (['cell', 'activeCell'].indexOf(self.currentCell.style) !== -1) {\n self.beginEditAt(self.currentCell.columnIndex, self.currentCell.rowIndex);\n }\n };\n self.scrollWheel = function (e) {\n if (self.dispatchEvent('wheel', {NativeEvent: e})) {\n return;\n }\n self.touchHaltAnimation = true;\n var l = self.scrollBox.scrollLeft,\n t = self.scrollBox.scrollTop;\n if (self.hasFocus) {\n self.scrollBox.scrollTop += e.deltaY;\n self.scrollBox.scrollLeft += e.deltaX;\n }\n if (t !== self.scrollBox.scrollTop || l !== self.scrollBox.scrollLeft) {\n e.preventDefault();\n }\n };\n self.copy = function (e) {\n if (self.dispatchEvent('copy', {NativeEvent: e})) { return; }\n if (!self.hasFocus || !e.clipboardData) { return; }\n var rows = [], sData = self.getSelectedData();\n if (sData.length > 0) {\n sData.forEach(function (row) {\n if (row) {\n var r = [];\n Object.keys(row).forEach(function (key) {\n r.push('\"' + row[key].replace(/\"/g, '\"\"') + '\"');\n });\n r.join(',');\n rows.push(r);\n }\n });\n e.clipboardData.setData('text/plain', rows.join('\\n'));\n e.preventDefault();\n }\n };\n return;\n };\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/events.js\n// module id = 2\n// module chunks = 0","/*jslint browser: true, unparam: true, todo: true*/\n/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/\ndefine([], function () {\n 'use strict';\n return function (self) {\n self.orders = {\n rows: [],\n columns: []\n };\n self.hasFocus = false;\n self.activeCell = {\n columnIndex: 0,\n rowIndex: 0\n };\n self.storageName = 'canvasDataGrid';\n self.invalidSearchExpClass = 'canvas-datagrid-invalid-search-regExp';\n self.localStyleLibraryStorageKey = 'canvas-datagrid-user-style-library';\n self.uniqueId = '_canvasDataGridUniqueId';\n self.orderBy = self.uniqueId;\n self.orderDirection = 'asc';\n self.columnFilters = {};\n self.filters = {};\n self.ellipsisCache = {};\n self.scrollBox = {};\n self.visibleRows = [];\n self.sizes = {\n rows: {},\n columns: {},\n trees: {}\n };\n self.currentFilter = function () {\n return true;\n };\n self.selections = [];\n self.hovers = {};\n self.attributes = {};\n self.style = {};\n self.intf = {};\n self.formatters = {};\n self.sorters = {};\n self.schemaHashes = {};\n self.events = {};\n self.uId = 0;\n self.changes = [];\n self.scrollIndexTop = 0;\n self.scrollPixelTop = 0;\n self.scrollIndexLeft = 0;\n self.scrollPixelLeft = 0;\n self.childGrids = {};\n self.openChildren = {};\n self.scrollModes = [\n 'vertical-scroll-box',\n 'vertical-scroll-top',\n 'vertical-scroll-bottom',\n 'horizontal-scroll-box',\n 'horizontal-scroll-right',\n 'horizontal-scroll-left'\n ];\n self.mouse = { x: 0, y: 0};\n self.getSelectedData = function (expandToRow) {\n var d = [], s = self.getSchema(), l = self.data.length;\n self.selections.forEach(function (row, index) {\n if (index === l) { return; }\n if (row.length === 0) {\n d[index] = null;\n return;\n }\n d[index] = {};\n if (expandToRow) {\n s.forEach(function (column) {\n d[index][column.name] = self.data[index][column.name];\n });\n } else {\n row.forEach(function (col) {\n if (col === -1) { return; }\n d[index][s[col].name] = self.data[index][s[col].name];\n });\n }\n });\n return d;\n };\n self.scrollOffset = function (e) {\n var x = 0, y = 0;\n while (e.parentNode) {\n if (e.nodeType !== 'canvas-datagrid-tree'\n && e.nodeType !== 'canvas-datagrid-cell') {\n x -= e.scrollLeft;\n y -= e.scrollTop;\n }\n e = e.parentNode;\n }\n return {left: x, top: y};\n };\n self.position = function (e, ignoreScrollOffset) {\n var x = 0, y = 0, s = e, h, w;\n while (e.offsetParent) {\n x += e.offsetLeft;\n y += e.offsetTop;\n h = e.offsetHeight;\n w = e.offsetWidth;\n e = e.offsetParent;\n }\n if (ignoreScrollOffset) {\n return {left: x, top: y, height: h, width: w};\n }\n e = s;\n s = self.scrollOffset(e);\n return { left: x + s.left, top: y + s.top, height: h, width: w };\n };\n self.getLayerPos = function (e) {\n var rect = self.canvas.getBoundingClientRect(),\n pos = {\n x: e.clientX - rect.left,\n y: e.clientY - rect.top\n };\n if (self.isChildGrid) {\n pos.x -= self.canvasOffsetLeft;\n pos.y -= self.canvasOffsetTop;\n }\n return {\n x: pos.x,\n y: pos.y,\n rect: rect\n };\n };\n self.fillArray = function (low, high, step) {\n step = step || 1;\n var i = [], x;\n for (x = low; x <= high; x += step) {\n i[x] = x;\n }\n return i;\n };\n self.getRowHeaderCellHeight = function () {\n if (!self.attributes.showColumnHeaders) { return 0; }\n return self.sizes.rows[-1] || self.style.columnHeaderCellHeight;\n };\n self.getColumnHeaderCellWidth = function () {\n if (!self.attributes.showRowHeaders) { return 0; }\n return self.sizes.columns.cornerCell || self.style.rowHeaderCellWidth;\n };\n self.setStorageData = function () {\n if (!self.attributes.saveAppearance) { return; }\n localStorage.setItem(self.storageName + '-' + self.attributes.name, JSON.stringify({\n sizes: {\n rows: self.sizes.rows,\n columns: self.sizes.columns\n },\n orders: {\n rows: self.orders.rows,\n columns: self.orders.columns\n },\n orderBy: self.orderBy,\n orderDirection: self.orderDirection\n }));\n };\n self.getSchema = function () {\n return self.schema || self.tempSchema;\n };\n self.createColumnOrders = function () {\n var s = self.getSchema();\n self.orders.columns = self.fillArray(0, s.length - 1);\n };\n self.createRowOrders = function () {\n self.orders.rows = self.fillArray(0, self.data.length - 1);\n };\n self.getVisibleSchema = function () {\n return self.getSchema().filter(function (col) { return !col.hidden; });\n };\n self.applyDefaultValue = function (row, header) {\n var d = header.defaultValue || '';\n if (typeof d === 'function') {\n d = d.apply(self.intf, [header]);\n }\n row[header.name] = d;\n };\n self.createNewRowData = function () {\n self.newRow = {};\n self.newRow[self.uniqueId] = self.uId;\n self.uId += 1;\n self.getSchema().forEach(function forEachHeader(header) {\n self.applyDefaultValue(self.newRow, header);\n });\n };\n self.getSchemaNameHash = function (key) {\n var n = 0;\n while (self.schemaHashes[key]) {\n n += 1;\n key = key + n;\n }\n return key;\n };\n self.filter = function (type) {\n var f = self.filters[type];\n if (!f && type !== undefined) {\n console.warn('Cannot find filter for type %s, falling back to substring match.', type);\n f = self.filters.string;\n }\n return f;\n };\n self.getBestGuessDataType = function (columnName) {\n var t, x, l = self.data.length;\n for (x = 0; x < l; x += 1) {\n if ([null, undefined].indexOf(self.data[x][columnName]) !== -1) {\n t = typeof self.data[x];\n return t === 'object' ? 'string' : t;\n }\n }\n return 'string';\n };\n self.drawChildGrids = function () {\n Object.keys(self.childGrids).forEach(function (gridKey) {\n self.childGrids[gridKey].draw();\n });\n };\n self.resizeChildGrids = function () {\n Object.keys(self.childGrids).forEach(function (gridKey) {\n self.childGrids[gridKey].resize();\n });\n };\n self.getClippingRect = function (ele) {\n var boundingRect = self.position(self.parentNode),\n eleRect = self.position(ele),\n s = self.scrollOffset(self.canvas),\n clipRect = {\n x: 0,\n y: 0,\n h: 0,\n w: 0\n },\n parentRect = {\n x: -Infinity,\n y: -Infinity,\n h: Infinity,\n w: Infinity\n },\n rowHeaderCellHeight = self.getRowHeaderCellHeight(),\n columnHeaderCellWidth = self.getColumnHeaderCellWidth();\n boundingRect.top -= s.top;\n boundingRect.left -= s.left;\n eleRect.top -= s.top;\n eleRect.left -= s.left;\n clipRect.h = boundingRect.top + boundingRect.height - ele.offsetTop - self.style.scrollBarWidth;\n clipRect.w = boundingRect.left + boundingRect.width - ele.offsetLeft - self.style.scrollBarWidth;\n clipRect.x = boundingRect.left + (eleRect.left * -1) + columnHeaderCellWidth;\n clipRect.y = boundingRect.top + (eleRect.top * -1) + rowHeaderCellHeight;\n return {\n x: clipRect.x > parentRect.x ? clipRect.x : parentRect.x,\n y: clipRect.y > parentRect.y ? clipRect.y : parentRect.y,\n h: clipRect.h < parentRect.h ? clipRect.h : parentRect.h,\n w: clipRect.w < parentRect.w ? clipRect.w : parentRect.w\n };\n };\n self.clipElement = function (ele) {\n var clipRect = self.getClippingRect(ele);\n if (clipRect.w < 0) { clipRect.w = 0; }\n if (clipRect.h < 0) { clipRect.h = 0; }\n ele.style.clip = 'rect('\n + clipRect.y + 'px,'\n + clipRect.w + 'px,'\n + clipRect.h + 'px,'\n + clipRect.x + 'px'\n + ')';\n // INFO https://developer.mozilla.org/en-US/docs/Web/CSS/clip\n // clip has been \"deprecated\" for clipPath. Of course nothing but chrome\n // supports clip path, so we'll keep using clip until someday clipPath becomes\n // more widely support. The code below works correctly, but setting clipPath and clip\n // at the same time has undesirable results.\n // ele.style.clipPath = 'polygon('\n // + clipRect.x + 'px ' + clipRect.y + 'px,'\n // + clipRect.x + 'px ' + clipRect.h + 'px,'\n // + clipRect.w + 'px ' + clipRect.h + 'px,'\n // + clipRect.w + 'px ' + clipRect.y + 'px'\n // + ')';\n };\n self.autoScrollZone = function (e, x, y, ctrl) {\n var setTimer,\n columnHeaderCellWidth = self.getColumnHeaderCellWidth(),\n rowHeaderCellHeight = self.getRowHeaderCellHeight();\n if (x > self.width - self.attributes.selectionScrollZone && x < self.width) {\n self.scrollBox.scrollLeft += self.attributes.selectionScrollIncrement;\n setTimer = true;\n }\n if (y > self.height - self.attributes.selectionScrollZone && y < self.height) {\n self.scrollBox.scrollTop += self.attributes.selectionScrollIncrement;\n setTimer = true;\n }\n if (x - self.attributes.selectionScrollZone - columnHeaderCellWidth < 0) {\n self.scrollBox.scrollLeft -= self.attributes.selectionScrollIncrement;\n setTimer = true;\n }\n if (y - self.attributes.selectionScrollZone - rowHeaderCellHeight < 0) {\n self.scrollBox.scrollTop -= self.attributes.selectionScrollIncrement;\n setTimer = true;\n }\n if (setTimer && !ctrl && self.currentCell && self.currentCell.columnIndex !== -1) {\n self.scrollTimer = setTimeout(self.mousemove, self.attributes.scrollRepeatRate, e);\n }\n };\n self.refreshFromOrigialData = function () {\n self.data = self.originalData.filter(function (row) {\n return true;\n });\n };\n self.validateColumn = function (c, s) {\n if (!c.name) {\n throw new Error('A column must contain at least a name.');\n }\n if (s.filter(function (i) { return i.name === c.name; }).length > 0) {\n throw new Error('A column with the name '\n + c.name + ' already exists and cannot be added again.');\n }\n return true;\n };\n self.setDefaults = function (obj1, obj2, key, def) {\n obj1[key] = obj2[key] === undefined ? def : obj2[key];\n };\n self.setAttributes = function () {\n self.defaults.attributes.forEach(function eachAttribute(i) {\n self.setDefaults(self.attributes, self.args, i[0], i[1]);\n });\n };\n self.setStyle = function () {\n self.defaults.styles.forEach(function eachStyle(i) {\n self.setDefaults(self.style, self.args.style || {}, i[0], i[1]);\n });\n };\n self.autosize = function (colName) {\n self.getVisibleSchema().forEach(function (col) {\n if (col.name === colName || colName === undefined) {\n self.fitColumnToValues(col.name);\n }\n });\n self.fitColumnToValues('cornerCell');\n };\n self.dispose = function () {\n if (!self.isChildGrid && self.canvas && self.canvas.parentNode) {\n self.canvas.parentNode.removeChild(self.canvas);\n }\n self.eventParent.removeEventListener('mouseup', self.mouseup, false);\n self.eventParent.removeEventListener('mousedown', self.mousedown, false);\n self.eventParent.removeEventListener('dblclick', self.dblclick, false);\n self.eventParent.removeEventListener('click', self.click, false);\n self.eventParent.removeEventListener('mousemove', self.mousemove);\n self.eventParent.removeEventListener('wheel', self.scrollWheel, false);\n self.canvas.removeEventListener('contextmenu', self.contextmenu, false);\n self.canvas.removeEventListener('copy', self.copy);\n self.controlInput.removeEventListener('keypress', self.keypress, false);\n self.controlInput.removeEventListener('keyup', self.keyup, false);\n self.controlInput.removeEventListener('keydown', self.keydown, false);\n window.removeEventListener('resize', self.resize);\n if (self.observer && self.observer.disconnect) {\n self.observer.disconnect();\n }\n };\n self.tryLoadStoredOrders = function () {\n var s;\n if (self.storedSettings && typeof self.storedSettings.orders === 'object') {\n if (self.storedSettings.orders.rows.length >= self.data.length) {\n self.orders.rows = self.storedSettings.orders.rows;\n }\n s = self.getSchema();\n self.orders.columns = self.storedSettings.orders.columns;\n s.forEach(function (h, i) {\n if (self.orders.columns.indexOf(i) === -1) {\n self.orders.columns.push(i);\n }\n });\n self.orderBy = self.storedSettings.orderBy === undefined\n ? self.uniqueId : self.storedSettings.orderBy;\n self.orderDirection = self.storedSettings.orderDirection === undefined\n ? self.uniqueId : self.storedSettings.orderDirection;\n if (self.getHeaderByName(self.orderBy) && self.orderDirection) {\n self.order(self.orderBy, self.orderDirection);\n }\n }\n };\n self.getFontHeight = function (fontStyle) {\n return parseFloat(fontStyle, 10);\n };\n self.parseFont = function (key) {\n if (/Font/.test(key)) {\n self.style[key + 'Height'] = self.getFontHeight(self.style[key]);\n }\n };\n self.initProp = function (propName) {\n if (!self.args[propName]) { return; }\n Object.keys(self.args[propName]).forEach(function (key) {\n self[propName][key] = self.args[propName][key];\n });\n };\n self.init = function () {\n var publicStyleKeyIntf = {};\n self.setAttributes();\n self.setStyle();\n self.initScrollBox();\n self.setDom();\n self.type = 'canvas-datagrid';\n Object.keys(self.style).forEach(self.parseFont);\n self.intf.type = self.type;\n self.intf.addEventListener = self.addEventListener;\n self.intf.removeEventListener = self.removeEventListener;\n self.intf.dispatchEvent = self.dispatchEvent;\n self.intf.dispose = self.dispose;\n self.intf.appendTo = self.appendTo;\n self.intf.filters = self.filters;\n self.intf.sorters = self.sorters;\n self.intf.autosize = self.autosize;\n self.intf.beginEditAt = self.beginEditAt;\n self.intf.endEdit = self.endEdit;\n self.intf.setActiveCell = self.setActiveCell;\n self.intf.scrollIntoView = self.scrollIntoView;\n self.intf.clearChangeLog = self.clearChangeLog;\n self.intf.gotoCell = self.gotoCell;\n self.intf.gotoRow = self.gotoRow;\n self.intf.findColumnScrollLeft = self.findColumnScrollLeft;\n self.intf.findRowScrollTop = self.findRowScrollTop;\n self.intf.fitColumnToValues = self.fitColumnToValues;\n self.intf.findColumnMaxTextLength = self.findColumnMaxTextLength;\n self.intf.disposeContextMenu = self.disposeContextMenu;\n self.intf.getCellAt = self.getCellAt;\n self.intf.isCellVisible = self.isCellVisible;\n self.intf.order = self.order;\n self.intf.draw = self.draw;\n self.intf.selectArea = self.selectArea;\n self.intf.clipElement = self.clipElement;\n self.intf.getSchemaFromData = self.getSchemaFromData;\n self.intf.setFilter = self.setFilter;\n self.intf.selectRow = self.selectRow;\n self.intf.parentGrid = self.parentGrid;\n self.intf.toggleTree = self.toggleTree;\n self.intf.expandTree = self.expandTree;\n self.intf.collapseTree = self.collapseTree;\n self.intf.canvas = self.canvas;\n self.intf.context = self.ctx;\n self.intf.insertRow = self.insertRow;\n self.intf.deleteRow = self.deleteRow;\n self.intf.addRow = self.addRow;\n self.intf.insertColumn = self.insertColumn;\n self.intf.deleteColumn = self.deleteColumn;\n self.intf.addColumn = self.addColumn;\n self.intf.getClippingRect = self.getClippingRect;\n self.intf.setRowHeight = self.setRowHeight;\n self.intf.setColumnWidth = self.setColumnWidth;\n self.intf.resetColumnWidths = self.resetColumnWidths;\n self.intf.resetRowHeights = self.resetRowHeights;\n self.intf.resize = self.resize;\n self.intf.selectColumn = self.selectColumn;\n self.intf.selectRow = self.selectRow;\n self.intf.selectAll = self.selectAll;\n self.intf.drawChildGrids = self.drawChildGrids;\n self.intf.assertPxColor = self.assertPxColor;\n self.intf.clearPxColorAssertions = self.clearPxColorAssertions;\n self.intf.integerToAlpha = self.integerToAlpha;\n self.intf.copy = self.copy;\n self.intf.style = {};\n Object.keys(self.style).forEach(function (key) {\n // unless this line is here, Object.keys() will not work on .style\n publicStyleKeyIntf[key] = undefined;\n Object.defineProperty(publicStyleKeyIntf, key, {\n get: function () {\n return self.style[key];\n },\n set: function (value) {\n self.parseFont(value);\n self.style[key] = value;\n self.draw(true);\n self.dispatchEvent('stylechanged', {name: key, value: value});\n }\n });\n });\n Object.defineProperty(self.intf, 'activeCell', {\n get: function () {\n return self.activeCell;\n }\n });\n /**\n * When true, the grid is has focus.\n * @memberof canvasDataGrid\n * @property hasFocus\n * @readonly\n */\n Object.defineProperty(self.intf, 'hasFocus', {\n get: function () {\n return self.hasFocus;\n }\n });\n Object.defineProperty(self.intf, 'style', {\n get: function () {\n return publicStyleKeyIntf;\n },\n set: function (value) {\n Object.keys(value).forEach(function (key) {\n self.parseFont(value);\n self.style[key] = value[key];\n });\n self.draw(true);\n self.dispatchEvent('stylechanged', {name: 'style', value: value});\n }\n });\n Object.keys(self.attributes).forEach(function (key) {\n Object.defineProperty(self.intf.attributes, key, {\n get: function () {\n return self.attributes[key];\n },\n set: function (value) {\n self.attributes[key] = value;\n self.draw(true);\n self.dispatchEvent('attributechanged', {name: key, value: value[key]});\n }\n });\n });\n self.filters.string = function (value, filterFor) {\n if (!filterFor) { return true; }\n var filterRegExp;\n self.invalidFilterRegEx = undefined;\n try {\n filterRegExp = new RegExp(filterFor, 'ig');\n } catch (e) {\n self.invalidFilterRegEx = e;\n return;\n }\n return filterRegExp.test(value);\n };\n self.filters.number = function (value, filterFor) {\n if (!filterFor) { return true; }\n return value === filterFor;\n };\n if (self.attributes.name && self.attributes.saveAppearance) {\n self.storedSettings = localStorage.getItem(self.storageName + '-' + self.attributes.name);\n if (self.storedSettings) {\n try {\n self.storedSettings = JSON.parse(self.storedSettings);\n } catch (e) {\n console.warn('could not read settings from localStore', e);\n self.storedSettings = undefined;\n }\n }\n if (self.storedSettings) {\n if (typeof self.storedSettings.sizes === 'object') {\n self.sizes.rows = self.storedSettings.sizes.rows;\n self.sizes.columns = self.storedSettings.sizes.columns;\n ['trees', 'columns', 'rows'].forEach(function (i) {\n if (!self.sizes[i]) {\n self.sizes[i] = {};\n }\n });\n }\n }\n }\n ['formatters', 'filters', 'sorters'].forEach(self.initProp);\n if (self.args.data) {\n self.intf.data = self.args.data;\n }\n if (!self.data) {\n self.intf.data = [];\n }\n if (self.args.schema) {\n self.intf.schema = self.args.schema;\n }\n if (self.isChildGrid) {\n requestAnimationFrame(function () { self.resize(true); });\n } else {\n self.resize(true);\n }\n };\n /**\n * Removes focus from the grid.\n * @memberof canvasDataGrid\n * @name blur\n * @method\n */\n self.intf.blur = function (e) {\n self.hasFocus = false;\n };\n /**\n * Focuses on the grid.\n * @memberof canvasDataGrid\n * @name focus\n * @method\n */\n self.intf.focus = function () {\n self.hasFocus = true;\n self.controlInput.focus();\n };\n Object.defineProperty(self.intf, 'height', {\n get: function () {\n return self.parentNode.height;\n },\n set: function (value) {\n self.parentNode.height = value;\n self.resize(true);\n }\n });\n Object.defineProperty(self.intf, 'width', {\n get: function () {\n return self.parentNode.width;\n },\n set: function (value) {\n self.parentNode.width = value;\n self.resize(true);\n }\n });\n Object.defineProperty(self.intf, 'openChildren', {\n get: function () {\n return self.openChildren;\n }\n });\n Object.defineProperty(self.intf, 'childGrids', {\n get: function () {\n return Object.keys(self.childGrids).map(function (gridId) {\n return self.childGrids[gridId];\n });\n }\n });\n Object.defineProperty(self.intf, 'isChildGrid', {\n get: function () {\n return self.isChildGrid;\n }\n });\n Object.defineProperty(self.intf, 'parentNode', {\n get: function () {\n return self.parentNode;\n },\n set: function (value) {\n self.parentNode = value;\n }\n });\n Object.defineProperty(self.intf, 'offsetParent', {\n get: function () {\n return self.parentNode;\n },\n set: function (value) {\n self.parentNode = value;\n }\n });\n Object.defineProperty(self.intf, 'offsetLeft', {\n get: function () {\n return self.parentNode.offsetLeft;\n }\n });\n Object.defineProperty(self.intf, 'offsetTop', {\n get: function () {\n return self.parentNode.offsetTop;\n }\n });\n Object.defineProperty(self.intf, 'scrollHeight', {\n get: function () {\n return self.scrollBox.scrollHeight;\n }\n });\n Object.defineProperty(self.intf, 'scrollWidth', {\n get: function () {\n return self.scrollBox.scrollWidth;\n }\n });\n Object.defineProperty(self.intf, 'scrollTop', {\n get: function () {\n return self.scrollBox.scrollTop;\n },\n set: function (value) {\n self.scrollBox.scrollTop = value;\n }\n });\n Object.defineProperty(self.intf, 'scrollLeft', {\n get: function () {\n return self.scrollBox.scrollLeft;\n },\n set: function (value) {\n self.scrollBox.scrollLeft = value;\n }\n });\n Object.defineProperty(self.intf, 'sizes', {\n get: function () {\n return self.sizes;\n }\n });\n Object.defineProperty(self.intf, 'input', {\n get: function () {\n return self.input;\n }\n });\n Object.defineProperty(self.intf, 'controlInput', {\n get: function () {\n return self.controlInput;\n }\n });\n Object.defineProperty(self.intf, 'currentCell', {\n get: function () {\n return self.currentCell;\n }\n });\n Object.defineProperty(self.intf, 'visibleCells', {\n get: function () {\n return self.visibleCells;\n }\n });\n Object.defineProperty(self.intf, 'visibleRows', {\n get: function () {\n return self.visibleRows;\n }\n });\n Object.defineProperty(self.intf, 'selections', {\n get: function () {\n return self.selections;\n }\n });\n Object.defineProperty(self.intf, 'dragMode', {\n get: function () {\n return self.dragMode;\n }\n });\n Object.defineProperty(self.intf, 'changes', {\n get: function () {\n return self.changes;\n }\n });\n self.intf.attributes = {};\n self.intf.formatters = self.formatters;\n self.normalizeDataset = function (data) {\n var i, d, max, syncFnInvoked;\n if (data === null || data === '' || data === undefined) {\n return [];\n }\n if (typeof data === 'string'\n || typeof data === 'number'\n || typeof data === 'boolean') {\n data = [{'0': data}];\n }\n if (!Array.isArray(data) && typeof data === 'object') {\n data = [data];\n }\n if ((!Array.isArray(data[0]) && typeof data[0] === 'object')\n || (Array.isArray(data) && data.length === 0)) {\n return data;\n }\n if (typeof data === 'function') {\n i = data.apply(self.intf, [function (d) {\n if (syncFnInvoked) {\n console.warn('Detected a callback to the data setter function after the same function already returned a value synchronously.');\n }\n self.normalizeDataset(d);\n }]);\n if (i) {\n syncFnInvoked = true;\n self.normalizeDataset(i);\n }\n }\n if (!Array.isArray(data) && typeof data === 'object') {\n data = [data];\n }\n if (Array.isArray(data)) {\n if (!Array.isArray(data[0])) {\n //array of something? throw it all into 1 row!\n data = [data];\n }\n // find the longest length\n max = 0;\n d = [];\n data.forEach(function (row) {\n max = Math.max(max, row.length);\n });\n // map against length indexes\n data.forEach(function (row, index) {\n var x;\n d[index] = {};\n for (x = 0; x < max; x += 1) {\n d[index][x] = row[x] || null;\n }\n });\n return d;\n }\n throw new Error('Unsupported data type. Must be an array of arrays or an array of objects, function or string.');\n };\n Object.defineProperty(self.intf, 'selectionBounds', {\n get: function () {\n return self.getSelectionBounds();\n }\n });\n Object.defineProperty(self.intf, 'selectedRows', {\n get: function () {\n return self.getSelectedData(true);\n }\n });\n Object.defineProperty(self.intf, 'selectedCells', {\n get: function () {\n return self.getSelectedData();\n }\n });\n Object.defineProperty(self.intf, 'visibleSchema', {\n get: function () {\n return self.getVisibleSchema().map(function eachDataRow(col) {\n return col;\n });\n }\n });\n Object.defineProperty(self.intf, 'ctx', {\n get: function () {\n return self.ctx;\n }\n });\n Object.defineProperty(self.intf, 'schema', {\n get: function schemaGetter() {\n return self.getSchema();\n },\n set: function schemaSetter(value) {\n if (!Array.isArray(value) || typeof value[0] !== 'object') {\n throw new Error('Schema must be an array of objects.');\n }\n if (value[0].name === undefined) {\n throw new Error('Expected schema to contain an object with at least a name property.');\n }\n self.schema = value.map(function eachSchemaColumn(column, index) {\n column.width = column.width || self.style.columnWidth;\n column[self.uniqueId] = self.getSchemaNameHash(column.name);\n column.filter = column.filter || self.filter(column.type);\n column.type = column.type || 'string';\n column.index = index;\n column.columnIndex = index;\n column.rowIndex = -1;\n return column;\n });\n self.tempSchema = undefined;\n self.createNewRowData();\n self.createColumnOrders();\n self.tryLoadStoredOrders();\n self.resize(true);\n self.dispatchEvent('schemachanged', {schema: self.schema});\n }\n });\n Object.defineProperty(self.intf, 'data', {\n get: function dataGetter() {\n return self.data.map(function (row) {\n delete row[self.uniqueId];\n return row;\n });\n },\n set: function dataSetter(value) {\n self.originalData = self.normalizeDataset(value).map(function eachDataRow(row) {\n row[self.uniqueId] = self.uId;\n self.uId += 1;\n return row;\n });\n self.changes = [];\n //TODO apply filter to incoming dataset\n self.data = self.originalData;\n if (!self.schema && self.data.length > 0) {\n self.tempSchema = self.getSchemaFromData();\n }\n if (!self.schema && self.data.length === 0) {\n self.tempSchema = [{name: ''}];\n self.tempSchema[0][self.uniqueId] = self.getSchemaNameHash('');\n }\n if (self.tempSchema && !self.schema) {\n self.createColumnOrders();\n self.tryLoadStoredOrders();\n self.dispatchEvent('schemachanged', {schema: self.tempSchema});\n }\n self.createNewRowData();\n if (self.attributes.autoResizeColumns && self.data.length > 0\n && self.storedSettings === undefined) {\n self.autosize();\n }\n self.fitColumnToValues('cornerCell', true);\n if (!self.resize() || !self.isChildGrid) { self.draw(true); }\n self.createRowOrders();\n self.tryLoadStoredOrders();\n self.dispatchEvent('datachanged', {data: self.data});\n }\n });\n self.initScrollBox = function () {\n var sHeight = 0,\n sWidth = 0,\n scrollTop = 0,\n scrollLeft = 0,\n scrollHeight = 0,\n scrollWidth = 0,\n scrollBoxHeight = 20,\n scrollBoxWidth = 20;\n function setScrollTop(value, preventScrollEvent) {\n if (isNaN(value)) {\n throw new Error('ScrollTop value must be a number');\n }\n if (value < 0) {\n value = 0;\n }\n if (value > scrollHeight) {\n value = scrollHeight;\n }\n if (scrollHeight < 0) {\n value = 0;\n }\n scrollTop = value;\n if (!preventScrollEvent) {\n self.scroll();\n }\n }\n function setScrollLeft(value, preventScrollEvent) {\n if (isNaN(value)) {\n throw new Error('ScrollLeft value must be a number');\n }\n if (value < 0) {\n value = 0;\n }\n if (value > scrollWidth) {\n value = scrollWidth;\n }\n if (scrollWidth < 0) {\n value = 0;\n }\n scrollLeft = value;\n if (!preventScrollEvent) {\n self.scroll();\n }\n }\n self.scrollBox.scrollTo = function (x, y) {\n setScrollLeft(x, true);\n setScrollTop(y);\n };\n Object.defineProperty(self.scrollBox, 'scrollBoxHeight', {\n get: function () {\n return scrollBoxHeight;\n },\n set: function (value) {\n scrollBoxHeight = value;\n }\n });\n Object.defineProperty(self.scrollBox, 'scrollBoxWidth', {\n get: function () {\n return scrollBoxWidth;\n },\n set: function (value) {\n scrollBoxWidth = value;\n }\n });\n Object.defineProperty(self.scrollBox, 'height', {\n get: function () {\n return sHeight;\n },\n set: function (value) {\n if (scrollHeight < value) {\n scrollTop = 0;\n }\n sHeight = value;\n }\n });\n Object.defineProperty(self.scrollBox, 'width', {\n get: function () {\n return sWidth;\n },\n set: function (value) {\n sWidth = value;\n }\n });\n Object.defineProperty(self.scrollBox, 'scrollTop', {\n get: function () {\n return scrollTop;\n },\n set: setScrollTop\n });\n Object.defineProperty(self.scrollBox, 'scrollLeft', {\n get: function () {\n return scrollLeft;\n },\n set: setScrollLeft\n });\n Object.defineProperty(self.scrollBox, 'scrollHeight', {\n get: function () {\n return scrollHeight;\n },\n set: function (value) {\n if (scrollTop > value) {\n scrollTop = Math.max(value, 0);\n }\n if (scrollHeight < sHeight) {\n scrollTop = 0;\n }\n scrollHeight = value;\n }\n });\n Object.defineProperty(self.scrollBox, 'scrollWidth', {\n get: function () {\n return scrollWidth;\n },\n set: function (value) {\n if (scrollLeft > value) {\n scrollLeft = Math.max(value, 0);\n }\n scrollWidth = value;\n }\n });\n };\n return;\n };\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/intf.js\n// module id = 3\n// module chunks = 0","/*jslint browser: true, unparam: true, todo: true*/\n/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false, Event: false*/\ndefine([], function () {\n 'use strict';\n return function (self) {\n var zIndexTop = 2, hoverScrollTimeout, autoCompleteContext;\n function createContextMenu(ev, pos, items, parentContextMenu) {\n var container = document.createElement('div'),\n upArrow = document.createElement('div'),\n downArrow = document.createElement('div'),\n children = [],\n selectedIndex = -1,\n intf = {},\n rect;\n if (!Array.isArray(items)) { throw new Error('createContextMenu expects an array.'); }\n function createItems() {\n items.forEach(function (item) {\n var contextItemContainer = document.createElement('div'),\n childMenuArrow;\n function removeChildContext(e) {\n if (e.relatedTarget === container\n || item.contextMenu.container === e.relatedTarget\n || childMenuArrow === e.relatedTarget\n || (contextItemContainer === e.relatedTarget)\n ) { return; }\n item.contextMenu.dispose();\n children.splice(children.indexOf(item.contextMenu), 1);\n item.contextMenu = undefined;\n contextItemContainer.removeEventListener('mouseout', removeChildContext);\n container.removeEventListener('mouseout', removeChildContext);\n contextItemContainer.setAttribute('contextOpen', '0');\n contextItemContainer.setAttribute('opening', '0');\n }\n function contextAddCallback(items) {\n // check yet again if the user hasn't moved off\n if (contextItemContainer.getAttribute('opening') !== '1' ||\n contextItemContainer.getAttribute('contextOpen') === '1') {\n return;\n }\n var cPos = contextItemContainer.getBoundingClientRect();\n cPos = {\n left: cPos.left + self.style.childContextMenuMarginLeft + container.offsetWidth,\n top: cPos.top + self.style.childContextMenuMarginTop,\n bottom: cPos.bottom,\n right: cPos.right,\n };\n item.contextMenu = createContextMenu(ev, cPos, items, intf);\n contextItemContainer.setAttribute('contextOpen', '1');\n contextItemContainer.addEventListener('mouseout', removeChildContext);\n container.addEventListener('mouseout', removeChildContext);\n children.push(item.contextMenu);\n }\n function createChildContext() {\n var i;\n if (contextItemContainer.getAttribute('contextOpen') === '1') {\n return;\n }\n contextItemContainer.setAttribute('opening', '1');\n if (typeof item.items === 'function') {\n i = item.items.apply(intf, [function (items) {\n contextAddCallback(items);\n }]);\n if (i !== undefined && Array.isArray(i)) {\n contextAddCallback(i);\n }\n return;\n }\n contextAddCallback(item.items);\n }\n function addItem(item) {\n function addContent(content) {\n if (typeof content === 'function') {\n return addContent(content(ev));\n }\n if (typeof content === 'object') {\n contextItemContainer.appendChild(content);\n return;\n }\n self.createInlineStyle(contextItemContainer, 'canvas-datagrid-context-menu-item');\n contextItemContainer.addEventListener('mouseover', function () {\n self.createInlineStyle(contextItemContainer, 'canvas-datagrid-context-menu-item:hover');\n });\n contextItemContainer.addEventListener('mouseout', function () {\n self.createInlineStyle(contextItemContainer, 'canvas-datagrid-context-menu-item');\n });\n contextItemContainer.innerHTML = content;\n return;\n }\n addContent(item.title);\n item.contextItemContainer = contextItemContainer;\n if (item.items && item.items.length > 0) {\n childMenuArrow = document.createElement('div');\n self.createInlineStyle(childMenuArrow, 'canvas-datagrid-context-child-arrow');\n childMenuArrow.innerHTML = self.style.childContextMenuArrowHTML;\n contextItemContainer.appendChild(childMenuArrow);\n contextItemContainer.addEventListener('mouseover', createChildContext);\n contextItemContainer.addEventListener('mouseout', function () {\n contextItemContainer.setAttribute('opening', '0');\n });\n }\n if (item.click) {\n contextItemContainer.addEventListener('click', function (ev) {\n item.click.apply(self, [ev]);\n });\n }\n }\n addItem(item);\n container.appendChild(contextItemContainer);\n });\n }\n function clickIndex(idx) {\n items[idx].contextItemContainer.dispatchEvent(new Event('click'));\n }\n function checkArrowVisibility() {\n if (container.scrollTop > 0) {\n document.body.appendChild(upArrow);\n } else if (upArrow.parentNode) {\n upArrow.parentNode.removeChild(upArrow);\n }\n if (container.scrollTop >= container.scrollHeight - container.offsetHeight && downArrow.parentNode) {\n downArrow.parentNode.removeChild(downArrow);\n } else if (container.scrollHeight - container.offsetHeight > 0\n && !(container.scrollTop >= container.scrollHeight - container.offsetHeight)) {\n document.body.appendChild(downArrow);\n }\n }\n function startHoverScroll(type) {\n return function t() {\n var a = self.attributes.contextHoverScrollAmount;\n if (type === 'up' && container.scrollTop === 0) { return; }\n if (type === 'down' && container.scrollTop === container.scrollHeight) { return; }\n container.scrollTop += (type === 'up' ? -a : a);\n hoverScrollTimeout = setTimeout(t, self.attributes.contextHoverScrollRateMs, type);\n };\n }\n function endHoverScroll(type) {\n return function () {\n clearTimeout(hoverScrollTimeout);\n };\n }\n function init() {\n var loc = {},\n s = self.scrollOffset(self.canvas);\n createItems();\n self.createInlineStyle(container, 'canvas-datagrid-context-menu');\n loc.x = pos.left - s.left;\n loc.y = pos.top - s.top;\n loc.height = 0;\n zIndexTop += 1;\n container.style.position = 'absolute';\n upArrow.style.color = self.style.contextMenuArrowColor;\n downArrow.style.color = self.style.contextMenuArrowColor;\n [upArrow, downArrow].forEach(function (el) {\n el.style.textAlign = 'center';\n el.style.position = 'absolute';\n el.style.zIndex = zIndexTop + 1;\n });\n container.style.zIndex = zIndexTop;\n if (parentContextMenu && parentContextMenu.inputDropdown) {\n container.style.maxHeight = window.innerHeight - loc.y - self.style.autocompleteBottomMargin + 'px';\n container.style.minWidth = pos.width + 'px';\n loc.y += pos.height;\n }\n container.style.left = loc.x + 'px';\n container.style.top = loc.y + 'px';\n container.addEventListener('scroll', checkArrowVisibility);\n container.addEventListener('wheel', function (e) {\n if (self.hasFocus) {\n container.scrollTop += e.deltaY;\n container.scrollLeft += e.deltaX;\n }\n checkArrowVisibility();\n });\n upArrow.innerHTML = self.style.contextMenuArrowUpHTML;\n downArrow.innerHTML = self.style.contextMenuArrowDownHTML;\n container.appendChild(upArrow);\n document.body.appendChild(downArrow);\n document.body.appendChild(container);\n rect = container.getBoundingClientRect();\n if (rect.bottom > window.innerHeight && !(parentContextMenu && parentContextMenu.inputDropdown)) {\n loc.y = window.innerHeight - container.offsetHeight;\n if (loc.y < 0) { loc.y = 0; }\n if (container.offsetHeight > window.innerHeight) {\n container.style.height = window.innerHeight - self.style.contextMenuWindowMargin + 'px';\n }\n }\n if (rect.right > window.innerWidth) {\n if (parentContextMenu) {\n loc.x = parentContextMenu.container.offsetLeft - container.offsetWidth;\n } else {\n loc.x = window.innerWidth - container.offsetWidth;\n }\n }\n container.style.left = loc.x + 'px';\n container.style.top = loc.y + 'px';\n rect = container.getBoundingClientRect();\n upArrow.style.top = rect.top + 'px';\n downArrow.style.top = rect.top + rect.height - downArrow.offsetHeight + 'px';\n upArrow.style.left = rect.left + 'px';\n downArrow.style.left = rect.left + 'px';\n downArrow.style.width = container.offsetWidth + 'px';\n upArrow.style.width = container.offsetWidth + 'px';\n downArrow.addEventListener('mouseover', startHoverScroll('down'));\n downArrow.addEventListener('mouseout', endHoverScroll('down'));\n upArrow.addEventListener('mouseover', startHoverScroll('up'));\n upArrow.addEventListener('mouseout', endHoverScroll('up'));\n checkArrowVisibility();\n }\n intf.parentGrid = self.intf;\n intf.parentContextMenu = parentContextMenu;\n intf.container = container;\n init();\n intf.clickIndex = clickIndex;\n intf.rect = rect;\n intf.items = items;\n intf.upArrow = upArrow;\n intf.downArrow = downArrow;\n intf.dispose = function () {\n clearTimeout(hoverScrollTimeout);\n children.forEach(function (c) {\n c.dispose();\n });\n [downArrow, upArrow, container].forEach(function (el) {\n if (el.parentNode) { el.parentNode.removeChild(el); }\n });\n };\n Object.defineProperty(intf, 'selectedIndex', {\n get: function () {\n return selectedIndex;\n },\n set: function (value) {\n if (typeof value !== 'number' || isNaN(value || !isFinite(value))) {\n throw new Error('Context menu selected index must be a sane number.');\n }\n selectedIndex = value;\n if (selectedIndex > items.length - 1) {\n selectedIndex = items.length - 1;\n }\n if (selectedIndex < 0) {\n selectedIndex = 0;\n }\n items.forEach(function (item, index) {\n if (index === selectedIndex) {\n return self.createInlineStyle(item.contextItemContainer, 'canvas-datagrid-context-menu-item:hover');\n }\n self.createInlineStyle(item.contextItemContainer, 'canvas-datagrid-context-menu-item');\n });\n }\n });\n return intf;\n }\n function createFilterContextMenuItems(e) {\n var filterContainer = document.createElement('div'),\n filterLabel = document.createElement('div'),\n filterAutoCompleteButton = document.createElement('button'),\n filterInput = document.createElement('input'),\n n = e.cell && e.cell.header ? e.cell.header.title || e.cell.header.name : '',\n autoCompleteItems,\n iRect;\n function fillAutoComplete() {\n autoCompleteItems = {};\n self.data.forEach(function (row) {\n var value = row[e.cell.header.name];\n if (autoCompleteItems[value]) { return; }\n autoCompleteItems[value] = {\n title: self.formatters[e.cell.header.type || 'string']({ cell: { value: value }}),\n click: function (e) {\n filterInput.value = value;\n e.stopPropagation();\n filterInput.dispatchEvent(new Event('keyup'));\n self.disposeAutocomplete();\n return;\n }\n };\n });\n autoCompleteItems = Object.keys(autoCompleteItems).map(function (key) {\n return autoCompleteItems[key];\n });\n }\n function createAutoCompleteContext(ev) {\n if (ev && [40, 38, 13, 9, 27].indexOf(ev.keyCode) !== -1) { return; }\n fillAutoComplete();\n iRect = filterInput.getBoundingClientRect();\n if (autoCompleteContext) {\n autoCompleteContext.dispose();\n autoCompleteContext = undefined;\n }\n autoCompleteContext = createContextMenu(e, {\n left: iRect.left,\n top: iRect.top,\n right: iRect.right,\n bottom: iRect.bottom,\n height: iRect.height,\n width: iRect.width\n }, autoCompleteItems, {inputDropdown: true});\n autoCompleteContext.selectedIndex = 0;\n }\n self.createInlineStyle(filterLabel, 'canvas-datagrid-context-menu-label');\n self.createInlineStyle(filterAutoCompleteButton, 'canvas-datagrid-context-menu-filter-button');\n self.createInlineStyle(filterInput, 'canvas-datagrid-context-menu-filter-input');\n filterInput.onclick = self.disposeAutocomplete;\n filterInput.addEventListener('keydown', function (e) {\n //down\n if (e.keyCode === 40) {\n autoCompleteContext.selectedIndex += 1;\n }\n //up\n if (e.keyCode === 38) {\n autoCompleteContext.selectedIndex -= 1;\n }\n //enter\n if (e.keyCode === 13) {\n autoCompleteContext.clickIndex(autoCompleteContext.selectedIndex);\n self.disposeContextMenu();\n }\n //tab\n if (e.keyCode === 9) {\n autoCompleteContext.clickIndex(autoCompleteContext.selectedIndex);\n e.preventDefault();\n }\n //esc\n if (e.keyCode === 27) {\n self.disposeContextMenu();\n }\n });\n filterInput.addEventListener('keyup', function () {\n self.setFilter(e.cell.header.name, filterInput.value);\n });\n filterInput.addEventListener('keyup', createAutoCompleteContext);\n filterInput.value = e.cell.header ? self.columnFilters[e.cell.header.name] || '' : '';\n filterLabel.innerHTML = self.attributes.filterOptionText.replace(/%s/g, n);\n filterAutoCompleteButton.onclick = function () {\n if (autoCompleteContext) {\n return self.disposeAutocomplete();\n }\n createAutoCompleteContext();\n };\n filterAutoCompleteButton.innerHTML = self.style.contextFilterButtonHTML;\n filterContainer.addEventListener('click', function (e) {\n return e.stopPropagation();\n });\n filterContainer.appendChild(filterLabel);\n filterContainer.appendChild(filterInput);\n filterContainer.appendChild(filterAutoCompleteButton);\n e.items.push({\n title: filterContainer\n });\n if (Object.keys(self.columnFilters).length) {\n Object.keys(self.columnFilters).forEach(function (cf) {\n var h = self.getHeaderByName(cf);\n e.items.push({\n title: self.attributes.removeFilterOptionText.replace(/%s/g, h.title || h.name),\n click: function removeFilterClick(e) {\n e.preventDefault();\n self.setFilter(cf, '');\n self.controlInput.focus();\n }\n });\n });\n }\n }\n function addDefaultContextMenuItem(e) {\n var isNormalCell = !(e.cell.isBackground || e.cell.isHeaderCellCap\n || e.cell.isScrollBar || e.cell.isCorner || e.cell.isRowHeader)\n && e.cell.header;\n if (self.attributes.showFilter && isNormalCell) {\n createFilterContextMenuItems(e);\n }\n if (self.attributes.showCopy\n && self.selections.reduce(function (p, r) {\n return p + r.length;\n }, 0) > 0) {\n e.items.push({\n title: self.attributes.copyText,\n click: function () {\n document.execCommand('copy');\n self.disposeContextMenu();\n self.controlInput.focus();\n }\n });\n }\n if (self.attributes.saveAppearance && self.attributes.showClearSettingsOption\n && (Object.keys(self.sizes.rows).length > 0\n || Object.keys(self.sizes.columns).length > 0)) {\n e.items.push({\n title: self.attributes.clearSettingsOptionText,\n click: function (e) {\n e.preventDefault();\n self.sizes.rows = {};\n self.sizes.columns = {};\n self.createRowOrders();\n self.createColumnOrders();\n self.storedSettings = undefined;\n self.dispatchEvent('resizecolumn', {columnWidth: self.style.columnWidth});\n self.dispatchEvent('resizerow', {cellHeight: self.style.cellHeight});\n self.setStorageData();\n self.resize(true);\n self.disposeContextMenu();\n self.controlInput.focus();\n }\n });\n }\n if (self.attributes.allowSorting && self.attributes.showOrderByOption && isNormalCell) {\n e.items.push({\n title: self.attributes.showOrderByOptionTextAsc.replace('%s', e.cell.header.title || e.cell.header.name),\n click: function (ev) {\n ev.preventDefault();\n self.order(e.cell.header.name, 'asc');\n self.controlInput.focus();\n }\n });\n e.items.push({\n title: self.attributes.showOrderByOptionTextDesc.replace('%s', e.cell.header.title || e.cell.header.name),\n click: function (ev) {\n ev.preventDefault();\n self.order(e.cell.header.name, 'desc');\n self.disposeContextMenu();\n self.controlInput.focus();\n }\n });\n }\n }\n self.disposeAutocomplete = function () {\n if (autoCompleteContext) {\n autoCompleteContext.dispose();\n autoCompleteContext = undefined;\n }\n };\n self.disposeContextMenu = function () {\n document.removeEventListener('click', self.disposeContextMenu);\n zIndexTop = 2;\n self.disposeAutocomplete();\n if (self.contextMenu) {\n self.contextMenu.dispose();\n }\n self.contextMenu = undefined;\n };\n self.contextmenuEvent = function (e, overridePos) {\n if (!self.hasFocus && e.target !== self.canvas) {\n return;\n }\n var items = [],\n pos = overridePos || self.getLayerPos(e, true),\n ev = {\n NativeEvent: e,\n cell: self.getCellAt(pos.x, pos.y),\n items: items\n };\n if (!ev.cell.isGrid) {\n addDefaultContextMenuItem(ev);\n }\n if (self.dispatchEvent('contextmenu', ev)) {\n return;\n }\n if (!ev.cell.isGrid) {\n if (self.contextMenu) {\n self.disposeContextMenu();\n }\n self.contextMenu = createContextMenu(ev, {\n left: pos.x + pos.rect.left + self.style.contextMenuMarginLeft + self.canvasOffsetLeft,\n top: pos.y + pos.rect.top + self.style.contextMenuMarginTop + self.canvasOffsetTop,\n right: ev.cell.width + ev.cell.x + pos.rect.left,\n bottom: ev.cell.height + ev.cell.y + pos.rect.top,\n height: ev.cell.height,\n width: ev.cell.width\n }, items);\n document.addEventListener('click', self.disposeContextMenu);\n e.preventDefault();\n }\n };\n return;\n };\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/contextMenu.js\n// module id = 4\n// module chunks = 0","/*jslint browser: true, unparam: true, todo: true*/\n/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/\ndefine([], function () {\n 'use strict';\n return function (self) {\n self.defaults = {\n attributes: [\n ['name', ''],\n ['tree', false],\n ['showNewRow', false],\n ['treeHorizontalScroll', false],\n ['saveAppearance', true],\n ['selectionFollowsActiveCell', false],\n ['multiLine', false],\n ['editable', true],\n ['allowColumnReordering', true],\n ['allowRowReordering', false],\n ['allowSorting', true],\n ['showFilter', true],\n ['globalRowResize', false],\n ['pageUpDownOverlap', 1],\n ['persistantSelectionMode', false],\n ['rowSelectionMode', false],\n ['autoResizeColumns', false],\n ['allowRowHeaderResize', true],\n ['allowColumnResize', true],\n ['allowRowResize', true],\n ['allowRowResizeFromCell', false],\n ['allowColumnResizeFromCell', false],\n ['debug', false],\n ['borderResizeZone', 10],\n ['showColumnHeaders', true],\n ['showRowNumbers', true],\n ['showRowHeaders', true],\n ['scrollRepeatRate', 75],\n ['selectionScrollZone', 20],\n ['resizeScrollZone', 20],\n ['contextHoverScrollRateMs', 5],\n ['contextHoverScrollAmount', 2],\n ['selectionScrollIncrement', 20],\n ['reorderDeadZone', 3],\n ['showClearSettingsOption', true],\n ['showOrderByOption', true],\n ['clearSettingsOptionText', 'Clear saved settings'],\n ['showOrderByOptionTextAsc', 'Order by %s ascending'],\n ['showOrderByOptionTextDesc', 'Order by %s descending'],\n ['removeFilterOptionText', 'Remove filter on %s'],\n ['filterOptionText', 'Filter %s'],\n ['filterTextPrefix', '(filtered) '],\n ['touchReleaseAnimationDurationMs', 1000],\n ['touchReleaseAcceleration', 30],\n ['touchDeadZone', 3],\n ['touchSelectTimeMs', 800],\n ['touchScrollZone', 40],\n ['copyText', 'Copy'],\n ['showCopy', true],\n ['columnHeaderClickBehavior', 'sort'],\n ['scrollPointerLock', true]\n ],\n styles: [\n ['activeCellBackgroundColor', 'rgba(255, 255, 255, 1)'],\n ['activeCellBorderColor', 'rgba(110, 168, 255, 1)'],\n ['activeCellBorderWidth', 0.25],\n ['activeCellColor', 'rgba(0, 0, 0, 1)'],\n ['activeCellFont', '16px sans-serif'],\n ['activeCellHoverBackgroundColor', 'rgba(255, 255, 255, 1)'],\n ['activeCellHoverColor', 'rgba(0, 0, 0, 1)'],\n ['activeCellOverlayBorderColor', 'rgba(66, 133, 244, 1)'],\n ['activeCellOverlayBorderWidth', 0.5],\n ['activeCellPaddingBottom', 5],\n ['activeCellPaddingLeft', 5],\n ['activeCellPaddingRight', 7],\n ['activeCellPaddingTop', 5],\n ['activeCellSelectedBackgroundColor', 'rgba(236, 243, 255, 1)'],\n ['activeCellSelectedColor', 'rgba(0, 0, 0, 1)'],\n ['activeColumnHeaderCellBackgroundColor', 'rgba(225, 225, 225, 1)'],\n ['activeColumnHeaderCellColor', 'rgba(0, 0, 0, 1)'],\n ['activeRowHeaderCellBackgroundColor', 'rgba(225, 225, 225, 1)'],\n ['activeRowHeaderCellColor', 'rgba(0, 0, 0, 1)'],\n ['autocompleteBottomMargin', 60],\n ['autosizeHeaderCellPadding', 8],\n ['autosizePadding', 5],\n ['backgroundColor', 'rgba(240, 240, 240, 1)'],\n ['cellAutoResizePadding', 13],\n ['cellBackgroundColor', 'rgba(255, 255, 255, 1)'],\n ['cellBorderColor', 'rgba(195, 199, 202, 1)'],\n ['cellBorderWidth', 0.5],\n ['cellColor', 'rgba(0, 0, 0, 1)'],\n ['cellFont', '16px sans-serif'],\n ['cellGridHeight', 250],\n ['cellHeight', 24],\n ['cellHeightWithChildGrid', 150],\n ['cellHorizontalAlignment', 'left'],\n ['cellHoverBackgroundColor', 'rgba(255, 255, 255, 1)'],\n ['cellHoverColor', 'rgba(0, 0, 0, 1)'],\n ['cellPaddingBottom', 5],\n ['cellPaddingLeft', 5],\n ['cellPaddingRight', 7],\n ['cellPaddingTop', 5],\n ['cellSelectedBackgroundColor', 'rgba(236, 243, 255, 1)'],\n ['cellSelectedColor', 'rgba(0, 0, 0, 1)'],\n ['cellVerticalAlignment', 'center'],\n ['cellWidthWithChildGrid', 250],\n ['childContextMenuArrowColor', 'rgba(43, 48, 43, 1)'],\n ['childContextMenuArrowHTML', '►'],\n ['childContextMenuMarginLeft', -15],\n ['childContextMenuMarginTop', 0],\n ['columnHeaderCellBackgroundColor', 'rgba(240, 240, 240, 1)'],\n ['columnHeaderCellBorderColor', 'rgba(152, 152, 152, 1)'],\n ['columnHeaderCellBorderWidth', 0.25],\n ['columnHeaderCellColor', 'rgba(50, 50, 50, 1)'],\n ['columnHeaderCellFont', '16px sans-serif'],\n ['columnHeaderCellHeight', 25],\n ['columnHeaderCellHorizontalAlignment', 'left'],\n ['columnHeaderCellHoverBackgroundColor', 'rgba(235, 235, 235, 1)'],\n ['columnHeaderCellHoverColor', 'rgba(0, 0, 0, 1)'],\n ['columnHeaderCellPaddingBottom', 5],\n ['columnHeaderCellPaddingLeft', 5],\n ['columnHeaderCellPaddingRight', 7],\n ['columnHeaderCellPaddingTop', 5],\n ['columnHeaderCellVerticalAlignment', 'center'],\n ['columnWidth', 250],\n ['contextFilterButtonBorder', 'solid 1px rgba(158, 163, 169, 1)'],\n ['contextFilterButtonBorderRadius', '3px'],\n ['contextFilterButtonHTML', '▼'],\n ['contextFilterInputBackground', 'rgba(255,255,255,1)'],\n ['contextFilterInputBorder', 'solid 1px rgba(158, 163, 169, 1)'],\n ['contextFilterInputBorderRadius', '0'],\n ['contextFilterInputColor', 'rgba(0,0,0,1)'],\n ['contextFilterInputFontFamily', 'sans-serif'],\n ['contextFilterInputFontSize', '14px'],\n ['contextMenuArrowColor', 'rgba(43, 48, 43, 1)'],\n ['contextMenuArrowDownHTML', '▼'],\n ['contextMenuArrowUpHTML', '▲'],\n ['contextMenuBackground', 'rgba(240, 240, 240, 1)'],\n ['contextMenuBorder', 'solid 1px rgba(158, 163, 169, 1)'],\n ['contextMenuBorderRadius', '3px'],\n ['contextMenuChildArrowFontSize', '12px'],\n ['contextMenuColor', 'rgba(43, 48, 43, 1)'],\n ['contextMenuFilterButtonFontFamily', 'sans-serif'],\n ['contextMenuFilterButtonFontSize', '10px'],\n ['contextMenuFilterInvalidExpresion', 'rgba(237, 155, 156, 1)'],\n ['contextMenuFontFamily', 'sans-serif'],\n ['contextMenuFontSize', '16px'],\n ['contextMenuHoverBackground', 'rgba(182, 205, 250, 1)'],\n ['contextMenuHoverColor', 'rgba(43, 48, 153, 1)'],\n ['contextMenuItemBorderRadius', '3px'],\n ['contextMenuItemMargin', '2px'],\n ['contextMenuLabelDisplay', 'inline-block'],\n ['contextMenuLabelMargin', '0 3px 0 0'],\n ['contextMenuLabelMaxWidth', '700px'],\n ['contextMenuLabelMinWidth', '75px'],\n ['contextMenuMarginLeft', 3],\n ['contextMenuMarginTop', -3],\n ['contextMenuOpacity', '0.98'],\n ['contextMenuPadding', '2px'],\n ['contextMenuWindowMargin', 6],\n ['cornerCellBackgroundColor', 'rgba(240, 240, 240, 1)'],\n ['cornerCellBorderColor', 'rgba(202, 202, 202, 1)'],\n ['editCellBackgroundColor', 'white'],\n ['editCellBorder', 'solid 1px rgba(110, 168, 255, 1)'],\n ['editCellBoxShadow', '0 2px 5px rgba(0,0,0,0.4)'],\n ['editCellColor', 'black'],\n ['editCellFontFamily', 'sans-serif'],\n ['editCellFontSize', '16px'],\n ['editCellPaddingLeft', 4],\n ['gridBorderColor', 'rgba(202, 202, 202, 1)'],\n ['gridBorderWidth', 1],\n ['columnHeaderOrderByArrowBorderColor', 'rgba(195, 199, 202, 1)'],\n ['columnHeaderOrderByArrowBorderWidth', 1],\n ['columnHeaderOrderByArrowColor', 'rgba(155, 155, 155, 1)'],\n ['columnHeaderOrderByArrowHeight', 8],\n ['columnHeaderOrderByArrowMarginLeft', 0],\n ['columnHeaderOrderByArrowMarginRight', 5],\n ['columnHeaderOrderByArrowMarginTop', 6],\n ['columnHeaderOrderByArrowWidth', 13],\n ['minColumnWidth', 45],\n ['minHeight', 24],\n ['minRowHeight', 24],\n ['name', 'default'],\n ['reorderMarkerBackgroundColor', 'rgba(0, 0, 0, 0.1)'],\n ['reorderMarkerBorderColor', 'rgba(0, 0, 0, 0.2)'],\n ['reorderMarkerBorderWidth', 1.25],\n ['reorderMarkerIndexBorderColor', 'rgba(66, 133, 244, 1)'],\n ['reorderMarkerIndexBorderWidth', 2.75],\n ['rowHeaderCellBackgroundColor', 'rgba(240, 240, 240, 1)'],\n ['rowHeaderCellBorderColor', 'rgba(200, 200, 200, 1)'],\n ['rowHeaderCellBorderWidth', 1],\n ['rowHeaderCellColor', 'rgba(50, 50, 50, 1)'],\n ['rowHeaderCellFont', '16px sans-serif'],\n ['rowHeaderCellHeight', 25],\n ['rowHeaderCellHorizontalAlignment', 'left'],\n ['rowHeaderCellHoverBackgroundColor', 'rgba(235, 235, 235, 1)'],\n ['rowHeaderCellHoverColor', 'rgba(0, 0, 0, 1)'],\n ['rowHeaderCellPaddingBottom', 5],\n ['rowHeaderCellPaddingLeft', 5],\n ['rowHeaderCellPaddingRight', 5],\n ['rowHeaderCellPaddingTop', 5],\n ['rowHeaderCellSelectedBackgroundColor', 'rgba(217, 217, 217, 1)'],\n ['rowHeaderCellSelectedColor', 'rgba(50, 50, 50, 1)'],\n ['rowHeaderCellVerticalAlignment', 'center'],\n ['rowHeaderCellWidth', 57],\n ['scrollBarActiveColor', 'rgba(125, 125, 125, 1)'],\n ['scrollBarBackgroundColor', 'rgba(240, 240, 240, 1)'],\n ['scrollBarBorderColor', 'rgba(202, 202, 202, 1)'],\n ['scrollBarBorderWidth', 0.5],\n ['scrollBarBoxBorderRadius', 4.125],\n ['scrollBarBoxColor', 'rgba(192, 192, 192, 1)'],\n ['scrollBarBoxMargin', 2],\n ['scrollBarBoxMinSize', 15],\n ['scrollBarBoxWidth', 8],\n ['scrollBarCornerBackgroundColor', 'rgba(240, 240, 240, 1)'],\n ['scrollBarCornerBorderColor', 'rgba(202, 202, 202, 1)'],\n ['scrollBarWidth', 11],\n ['selectionOverlayBorderColor', 'rgba(66, 133, 244, 1)'],\n ['selectionOverlayBorderWidth', 0.75],\n ['treeArrowBorderColor', 'rgba(195, 199, 202, 1)'],\n ['treeArrowBorderWidth', 1],\n ['treeArrowClickRadius', 5],\n ['treeArrowColor', 'rgba(155, 155, 155, 1)'],\n ['treeArrowHeight', 8],\n ['treeArrowMarginLeft', 0],\n ['treeArrowMarginRight', 5],\n ['treeArrowMarginTop', 6],\n ['treeArrowWidth', 13],\n ['treeGridHeight', 250]\n ]\n };\n };\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/defaults.js\n// module id = 5\n// module chunks = 0","/*jslint browser: true, unparam: true, todo: true*/\n/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/\ndefine([], function () {\n 'use strict';\n return function (self) {\n /**\n * Ends editing, optionally aborting the edit.\n * @memberof canvasDataGrid\n * @name endEdit\n * @method\n * @param {boolean} abort When true, abort the edit.\n */\n self.endEdit = function (abort) {\n var cell = self.input.editCell,\n y = cell.rowIndex;\n function abortEdit() {\n abort = true;\n }\n if (self.dispatchEvent('beforeendedit', {\n cell: cell,\n newValue: self.input.value,\n oldValue: cell.value,\n abort: abortEdit,\n input: self.input\n })) { return false; }\n if (self.input.value !== cell.value && !abort) {\n self.changes[y] = self.changes[y] || {};\n self.changes[y][cell.header.name] = self.input.value;\n cell.data[cell.header.name] = self.input.value;\n if (y === self.data.length) {\n if (self.dispatchEvent('newrow', {\n value: self.input.value,\n defaultValue: cell.value,\n aborted: abort,\n cell: cell,\n input: self.input\n })) { return false; }\n self.uId += 1;\n self.addRow(cell.data);\n self.createNewRowData();\n }\n self.draw(true);\n }\n document.body.removeChild(self.input);\n self.controlInput.focus();\n self.dispatchEvent('endedit', {\n cell: cell,\n value: self.input.value,\n aborted: abort,\n input: self.input\n });\n self.input = undefined;\n return true;\n };\n /**\n * Begins editing at cell x, row y.\n * @memberof canvasDataGrid\n * @name beginEditAt\n * @method\n * @param {number} x The column index of the cell to edit.\n * @param {number} y The row index of the cell to edit.\n */\n self.beginEditAt = function (x, y) {\n if (!self.attributes.editable) { return; }\n var cell = self.getVisibleCellByIndex(x, y),\n s = self.getVisibleSchema(),\n enumItems;\n if (self.dispatchEvent('beforebeginedit', {cell: cell})) { return false; }\n self.scrollIntoView(x, y);\n self.setActiveCell(x, y);\n if (cell.header.enum) {\n self.input = document.createElement('select');\n } else {\n self.input = document.createElement(self.attributes.multiLine\n ? 'textarea' : 'input');\n }\n function postDraw() {\n var option, valueInEnum;\n cell = self.getVisibleCellByIndex(x, y);\n if (cell.header.enum) {\n // add enums\n if (typeof cell.header.enum === 'function') {\n enumItems = cell.header.enum.apply(self.intf, [{cell: cell}]);\n } else if (Array.isArray(cell.header.enum)) {\n enumItems = cell.header.enum;\n }\n enumItems.forEach(function (e) {\n var i = document.createElement('option'),\n val,\n title;\n if (Array.isArray(e)) {\n val = e[0];\n title = e[1];\n } else {\n val = e;\n title = e;\n }\n if (val === cell.value) { valueInEnum = true; }\n i.value = val;\n i.innerHTML = title;\n self.input.appendChild(i);\n });\n if (!valueInEnum) {\n option = document.createElement('option');\n option.value = cell.value;\n option.innerHTML = cell.value;\n self.input.appendChild(option);\n }\n self.input.addEventListener('change', function () {\n self.endEdit();\n self.draw(true);\n });\n }\n document.body.appendChild(self.input);\n self.createInlineStyle(self.input, 'canvas-datagrid-edit-input');\n self.input.style.position = 'absolute';\n self.input.editCell = cell;\n self.resizeEditInput();\n self.input.style.zIndex = '2';\n self.input.value = cell.value;\n self.input.focus();\n self.input.addEventListener('click', self.stopPropagation);\n self.input.addEventListener('dblclick', self.stopPropagation);\n self.input.addEventListener('mouseup', self.stopPropagation);\n self.input.addEventListener('mousedown', self.stopPropagation);\n self.input.addEventListener('keydown', function (e) {\n var nx = cell.columnIndex,\n ny = cell.rowIndex;\n // esc\n if (e.keyCode === 27) {\n self.endEdit(true);\n self.draw(true);\n // enter\n } else if (e.keyCode === 13\n && (!self.attributes.multiLine\n || (self.attributes.multiLine && e.shiftKey))) {\n self.endEdit();\n self.draw(true);\n } else if (e.keyCode === 9) {\n e.preventDefault();\n if (!self.endEdit()) {\n return;\n }\n if (e.shiftKey) {\n nx -= 1;\n } else {\n nx += 1;\n }\n if (nx < 0) {\n nx = s.length - 1;\n ny -= 1;\n }\n if (nx > s.length - 1) {\n nx = 0;\n ny += 1;\n }\n if (ny < 0) {\n ny = self.data.length - 1;\n }\n if (ny > self.data.length - 1) {\n ny = 0;\n }\n self.scrollIntoView(nx, ny);\n self.beginEditAt(nx, ny);\n }\n });\n }\n postDraw();\n self.dispatchEvent('beginedit', {cell: cell, input: self.input});\n };\n self.createInlineStyle = function (el, className) {\n var css = {\n 'canvas-datagrid-context-menu-filter-input': {\n height: '19px',\n verticalAlign: 'bottom',\n marginLeft: '2px',\n padding: '0',\n background: self.style.contextFilterInputBackground,\n color: self.style.contextFilterInputColor,\n border: self.style.contextFilterInputBorder,\n borderRadius: self.style.contextFilterInputBorderRadius,\n lineHeight: 'normal',\n fontWeight: 'normal',\n fontFamily: self.style.contextFilterInputFontFamily,\n fontSize: self.style.contextFilterInputFontSize\n },\n 'canvas-datagrid-context-menu-filter-button': {\n height: '19px',\n verticalAlign: 'bottom',\n marginLeft: '2px',\n padding: '0',\n background: self.style.contextMenuBackground,\n color: self.style.contextMenuColor,\n border: self.style.contextFilterButtonBorder,\n borderRadius: self.style.contextFilterButtonBorderRadius,\n lineHeight: 'normal',\n fontWeight: 'normal',\n fontFamily: self.style.contextMenuFilterButtonFontFamily,\n fontSize: self.style.contextMenuFilterButtonFontSize\n },\n 'canvas-datagrid-context-child-arrow': {\n cssFloat: 'right',\n color: self.style.childContextMenuArrowColor,\n fontSize: self.style.contextMenuChildArrowFontSize,\n fontFamily: self.style.contextMenuFontFamily,\n verticalAlign: 'middle'\n },\n 'canvas-datagrid-autocomplete': {\n fontFamily: self.style.contextMenuFontFamily,\n fontSize: self.style.contextMenuFontSize,\n background: self.style.contextMenuBackground,\n color: self.style.contextMenuColor,\n border: self.style.contextMenuBorder,\n padding: self.style.contextMenuPadding,\n borderRadius: self.style.contextMenuBorderRadius,\n opacity: self.style.contextMenuOpacity,\n position: 'absolute',\n zIndex: 3,\n overflow: 'hidden'\n },\n 'canvas-datagrid-autocomplete-item': {\n background: self.style.contextMenuBackground,\n color: self.style.contextMenuColor\n },\n 'canvas-datagrid-autocomplete-item:hover': {\n background: self.style.contextMenuHoverBackground,\n color: self.style.contextMenuHoverColor\n },\n 'canvas-datagrid-canvas': {\n position: 'absolute',\n zIndex: '-1'\n },\n 'canvas-datagrid': {\n position: 'absolute',\n background: self.style.backgroundColor,\n zIndex: '1',\n boxSizing: 'content-box',\n padding: '0'\n },\n 'canvas-datagrid-control-input': {\n position: 'fixed',\n top: '-5px',\n left: '-5px',\n border: 'none',\n opacity: '0',\n cursor: 'pointer',\n width: '1px',\n height: '1px',\n lineHeight: 'normal',\n fontWeight: 'normal',\n fontFamily: self.style.contextMenuFontFamily,\n fontSize: self.style.contextMenuFontSize\n },\n 'canvas-datagrid-edit-input': {\n boxSizing: 'content-box',\n outline: 'none',\n margin: '0',\n padding: '0 0 0 ' + self.style.editCellPaddingLeft + 'px',\n lineHeight: 'normal',\n fontWeight: 'normal',\n fontFamily: self.style.editCellFontFamily,\n fontSize: self.style.editCellFontSize,\n boxShadow: self.style.editCellBoxShadow,\n border: self.style.editCellBorder,\n color: self.style.editCellColor,\n background: self.style.editCellBackgroundColor,\n appearance: 'none',\n webkitAppearance: 'none',\n mozAppearance: 'none',\n borderRadius: '0'\n },\n 'canvas-datagrid-context-menu-item': {\n lineHeight: 'normal',\n fontWeight: 'normal',\n fontFamily: self.style.contextMenuFontFamily,\n fontSize: self.style.contextMenuFontSize,\n color: 'inherit',\n background: 'inherit',\n margin: self.style.contextMenuItemMargin,\n borderRadius: self.style.contextMenuItemBorderRadius,\n verticalAlign: 'middle'\n },\n 'canvas-datagrid-context-menu-item:hover': {\n background: self.style.contextMenuHoverBackground,\n color: self.style.contextMenuHoverColor\n },\n 'canvas-datagrid-context-menu-label': {\n margin: self.style.contextMenuLabelMargin,\n display: self.style.contextMenuLabelDisplay,\n minWidth: self.style.contextMenuLabelMinWidth,\n maxWidth: self.style.contextMenuLabelMaxWidth\n },\n 'canvas-datagrid-context-menu': {\n lineHeight: 'normal',\n fontWeight: 'normal',\n fontFamily: self.style.contextMenuFontFamily,\n fontSize: self.style.contextMenuFontSize,\n background: self.style.contextMenuBackground,\n color: self.style.contextMenuColor,\n border: self.style.contextMenuBorder,\n padding: self.style.contextMenuPadding,\n borderRadius: self.style.contextMenuBorderRadius,\n opacity: self.style.contextMenuOpacity,\n overflow: 'hidden'\n },\n 'canvas-datagrid-invalid-search-regExp': {\n background: self.style.contextMenuFilterInvalidExpresion\n }\n };\n if (css[className]) {\n Object.keys(css[className]).map(function (prop) {\n el.style[prop] = css[className][prop];\n });\n }\n return;\n };\n self.appendTo = function (n) {\n self.parentNode = n;\n self.height = self.parentNode.offsetHeight;\n self.width = self.parentNode.offsetWidth;\n if (self.parentNode && /canvas-datagrid-(cell|tree)/.test(self.parentNode.nodeType)) {\n self.isChildGrid = true;\n self.parentGrid = self.parentNode.parentGrid;\n self.ctx = self.parentGrid.context;\n self.canvas = self.parentGrid.canvas;\n self.controlInput = self.parentGrid.controlInput;\n self.eventParent = self.canvas;\n self.intf.offsetParent = self.parentNode;\n } else {\n self.controlInput = document.createElement('input');\n self.controlInput.onblur = self.intf.blur;\n self.createInlineStyle(self.controlInput, 'canvas-datagrid-control-input');\n self.isChildGrid = false;\n self.parentDOMNode = self.parentNode;\n self.parentNode = self.parentDOMNode;\n self.parentIsCanvas = /canvas/i.test(self.parentDOMNode.tagName);\n if (self.parentIsCanvas) {\n self.canvas = self.parentDOMNode;\n } else {\n self.canvas = document.createElement('canvas');\n self.parentDOMNode.appendChild(self.canvas);\n }\n self.ctx = self.canvas.getContext('2d');\n self.ctx.textBaseline = 'alphabetic';\n document.body.appendChild(self.controlInput);\n self.eventParent = self.canvas;\n }\n self.controlInput.addEventListener('blur', function (e) {\n if (e.target !== self.canvas) {\n self.hasFocus = false;\n }\n });\n window.addEventListener('resize', self.resize);\n if (MutationObserver) {\n self.observer = new MutationObserver(function (mutations) {\n mutations.forEach(function (mutation) {\n self.resize(true);\n });\n });\n [self.canvas.parentNode].forEach(function (el) {\n self.observer.observe(el, { attributes: true });\n });\n }\n self.eventParent.addEventListener('scroll', self.resize, false);\n self.eventParent.addEventListener('touchstart', self.touchstart, false);\n self.eventParent.addEventListener('mouseup', self.mouseup, false);\n self.eventParent.addEventListener('mousedown', self.mousedown, false);\n self.eventParent.addEventListener('dblclick', self.dblclick, false);\n self.eventParent.addEventListener('click', self.click, false);\n self.eventParent.addEventListener('mousemove', self.mousemove);\n self.eventParent.addEventListener('wheel', self.scrollWheel, false);\n self.canvas.addEventListener('contextmenu', self.contextmenuEvent, false);\n (self.isChildGrid ? self.parentGrid : document).addEventListener('copy', self.copy);\n self.controlInput.addEventListener('keypress', self.keypress, false);\n self.controlInput.addEventListener('keyup', self.keyup, false);\n self.controlInput.addEventListener('keydown', self.keydown, false);\n };\n self.setDom = function () {\n self.appendTo(self.args.parentNode);\n };\n };\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/dom.js\n// module id = 6\n// module chunks = 0","/*jslint browser: true, unparam: true, todo: true*/\n/*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/\ndefine([], function () {\n 'use strict';\n return function (self) {\n // all methods here are exposed by intf\n // to users\n /**\n * Converts a integer into a letter A - ZZZZZ...\n * @memberof canvasDataGrid\n * @name integerToAlpha\n * @method\n * @param {column} n The number to convert.\n */\n self.integerToAlpha = function (n) {\n var ordA = 'a'.charCodeAt(0),\n ordZ = 'z'.charCodeAt(0),\n len = ordZ - ordA + 1,\n s = '';\n while (n >= 0) {\n s = String.fromCharCode(n % len + ordA) + s;\n n = Math.floor(n / len) - 1;\n }\n return s;\n };\n /**\n * Inserts a new column before the specified index into the schema.\n * @see canvasDataGrid#schema\n * @tutorial schema\n * @memberof canvasDataGrid\n * @name insertColumn\n * @method\n * @param {column} c The column to insert into the schema.\n * @param {number} index The index of the column to insert before.\n */\n self.insertColumn = function (c, index) {\n var s = self.getSchema();\n if (s.length < index) {\n throw new Error('Index is beyond the length of the schema.');\n }\n self.validateColumn(c, s);\n s.splice(index, 0, c);\n self.data.forEach(function (row) {\n self.applyDefaultValue(row, c);\n });\n self.intf.schema = s;\n };\n /**\n * Deletes a column from the schema at the specified index.\n * @memberof canvasDataGrid\n * @name deleteColumn\n * @tutorial schema\n * @method\n * @param {number} index The index of the column to delete.\n */\n self.deleteColumn = function (index) {\n var s = self.getSchema();\n // remove data matching this column name from data\n self.data.forEach(function (row) {\n delete row[s[index].name];\n });\n s.splice(index, 1);\n self.intf.schema = s;\n };\n /**\n * Adds a new column into the schema.\n * @see canvasDataGrid#schema\n * @tutorial schema\n * @memberof canvasDataGrid\n * @name addColumn\n * @method\n * @param {column} c The column to add to the schema.\n */\n self.addColumn = function (c) {\n var s = self.getSchema();\n self.validateColumn(c, s);\n s.push(c);\n self.data.forEach(function (row) {\n self.applyDefaultValue(row, c);\n });\n self.intf.schema = s;\n };\n /**\n * Deletes a row from the dataset at the specified index.\n * @memberof canvasDataGrid\n * @name deleteRow\n * @method\n * @param {number} index The index of the row to delete.\n */\n self.deleteRow = function (index) {\n self.originalData.splice(index, 1);\n self.setFilter();\n self.resize(true);\n };\n /**\n * Inserts a new row into the dataset before the specified index.\n * @memberof canvasDataGrid\n * @name insertRow\n * @method\n * @param {object} d data.\n * @param {number} index The index of the row to insert before.\n */\n self.insertRow = function (d, index) {\n if (self.originalData.length < index) {\n throw new Error('Index is beyond the length of the dataset.');\n }\n self.originalData.splice(index, 0, d);\n self.getSchema().forEach(function (c) {\n if (d[c.name] === undefined) {\n self.applyDefaultValue(self.originalData[index], c);\n }\n });\n self.setFilter();\n self.resize(true);\n };\n /**\n * Adds a new row into the dataset.\n * @memberof canvasDataGrid\n * @name addRow\n * @method\n * @param {object} d data.\n */\n self.addRow = function (d) {\n self.originalData.push(d);\n self.getSchema().forEach(function (c) {\n if (d[c.name] === undefined) {\n self.applyDefaultValue(self.originalData[self.originalData.length - 1], c);\n }\n });\n self.setFilter();\n self.resize(true);\n };\n /**\n * Sets the height of a given row by index number.\n * @memberof canvasDataGrid\n * @name setRowHeight\n * @method\n * @param {number} rowIndex The index of the row to set.\n * @param {number} height Height to set the row to.\n */\n self.setRowHeight = function (rowIndex, height) {\n self.sizes.rows[self.data[rowIndex][self.uniqueId]] = height;\n self.draw(true);\n };\n /**\n * Sets the width of a given column by index number.\n * @memberof canvasDataGrid\n * @name setColumnWidth\n * @method\n * @param {number} colIndex The index of the column to set.\n * @param {number} width Width to set the column to.\n */\n self.setColumnWidth = function (colIndex, width) {\n var s = self.getSchema();\n self.sizes.columns[s[colIndex][self.uniqueId]] = width;\n self.draw(true);\n };\n /**\n * Removes any changes to the width of the columns due to user or api interaction, setting them back to the schema or style default.\n * @memberof canvasDataGrid\n * @name resetColumnWidths\n * @tutorial schema\n * @method\n */\n self.resetColumnWidths = function () {\n self.sizes.columns = {};\n self.draw(true);\n };\n /**\n * Removes any changes to the height of the rows due to user or api interaction, setting them back to the schema or style default.\n * @memberof canvasDataGrid\n * @name resetRowHeights\n * @tutorial schema\n * @method\n */\n self.resetRowHeights = function () {\n self.sizes.rows = {};\n self.draw(true);\n };\n /**\n * Sets the value of the filter.\n * @memberof canvasDataGrid\n * @name setFilter\n * @method\n * @param {string} column Name of the column to filter.\n * @param {string} value The value to filter for.\n */\n self.setFilter = function (column, value) {\n function applyFilter() {\n self.refreshFromOrigialData();\n Object.keys(self.columnFilters).forEach(function (filter) {\n var header = self.getHeaderByName(column);\n if (!header) {\n return;\n }\n self.currentFilter = header.filter || self.filter(column.type || 'string');\n self.data = self.data.filter(function (row) {\n return self.currentFilter(row[filter], self.columnFilters[filter]);\n });\n });\n self.resize();\n self.draw(true);\n }\n if (column === undefined && value === undefined) {\n self.columnFilters = {};\n return applyFilter();\n }\n if (column && (value === '' || value === undefined)) {\n delete self.columnFilters[column];\n } else {\n self.columnFilters[column] = value;\n }\n applyFilter();\n };\n /**\n * Returns the number of pixels to scroll down to line up with row rowIndex.\n * @memberof canvasDataGrid\n * @name findRowScrollTop\n * @method\n * @param {number} rowIndex The row index of the row to scroll find.\n */\n self.findRowScrollTop = function (rowIndex) {\n var top = 0, x = 0, l = self.data.length,\n cellBorder = self.style.cellBorderWidth * 2;\n if (!self.attributes.showNewRow) {\n l -= 1;\n }\n if (rowIndex > l) {\n throw new Error('Impossible row index');\n }\n while (x < rowIndex) {\n top += (self.sizes.rows[self.data[x][self.uniqueId]] || self.style.cellHeight) + cellBorder;\n x += 1;\n }\n //TODO: This is not super accurate, causes pageUp/Dn to not move around right\n return top - (self.sizes.rows[self.data[rowIndex][self.uniqueId]] || self.style.cellHeight);\n };\n /**\n * Returns the number of pixels to scroll to the left to line up with column columnIndex.\n * @memberof canvasDataGrid\n * @name findColumnScrollLeft\n * @method\n * @param {number} columnIndex The column index of the column to find.\n */\n self.findColumnScrollLeft = function (columnIndex) {\n var left = 0, y = 0, s = self.getSchema(), l = s.length - 1;\n if (columnIndex > l) {\n throw new Error('Impossible column index');\n }\n while (y < columnIndex) {\n left += self.sizes.columns[s[y][self.uniqueId]] || s[y].width;\n y += 1;\n }\n return left;\n };\n /**\n * Scrolls the cell at cell x, row y.\n * @memberof canvasDataGrid\n * @name gotoCell\n * @method\n * @param {number} x The column index of the cell to scroll to.\n * @param {number} y The row index of the cell to scroll to.\n */\n self.gotoCell = function (x, y) {\n if (x !== undefined) {\n self.scrollBox.scrollLeft = self.findColumnScrollLeft(x);\n }\n if (y !== undefined) {\n self.scrollBox.scrollTop = self.findRowScrollTop(y);\n }\n };\n /**\n * Scrolls the row y.\n * @memberof canvasDataGrid\n * @name gotoRow\n * @method\n * @param {number} y The row index of the cell to scroll to.\n */\n self.gotoRow = function (y) {\n self.gotoCell(0, y);\n };\n /**\n * Scrolls the cell at cell x, row y into view if it is not already.\n * @memberof canvasDataGrid\n * @name scrollIntoView\n * @method\n * @param {number} x The column index of the cell to scroll into view.\n * @param {number} y The row index of the cell to scroll into view.\n */\n self.scrollIntoView = function (x, y) {\n if (self.visibleCells.filter(function (cell) {\n return (cell.rowIndex === y || y === undefined)\n && (cell.columnIndex === x || x === undefined)\n && cell.x > 0\n && cell.y > 0\n && cell.x + cell.width < self.width\n && cell.y + cell.height < self.height;\n }).length === 0) {\n self.gotoCell(x, y);\n }\n };\n /**\n * Sets the active cell. Requires redrawing.\n * @memberof canvasDataGrid\n * @name setActiveCell\n * @method\n * @param {number} x The column index of the cell to set active.\n * @param {number} y The row index of the cell to set active.\n */\n self.setActiveCell = function (x, y) {\n self.activeCell = {\n rowIndex: y,\n columnIndex: x\n };\n };\n /**\n * Selects every visible cell.\n * @memberof canvasDataGrid\n * @name selectAll\n * @method\n */\n self.selectAll = function () {\n self.selectArea({\n top: 0,\n left: 0,\n right: self.getVisibleSchema().length - 1,\n bottom: self.data.length - 1\n });\n };\n /**\n * Returns true if the selected columnIndex is selected on every row.\n * @memberof canvasDataGrid\n * @name isColumnSelected\n * @method\n * @param {number} columnIndex The column index to check.\n */\n self.isColumnSelected = function (columnIndex) {\n var colIsSelected = true;\n self.data.forEach(function (row, rowIndex) {\n if (!self.selections[rowIndex] || self.selections[rowIndex].indexOf(self.orders.columns[columnIndex]) === -1) {\n colIsSelected = false;\n }\n });\n return colIsSelected;\n };\n /**\n * Selects a column.\n * @memberof canvasDataGrid\n * @name selectColumn\n * @method\n * @param {number} columnIndex The column index to select.\n * @param {boolean} toggleSelectMode When true, behaves as if you were holding control/command when you clicked the column.\n * @param {boolean} shift When true, behaves as if you were holding shift when you clicked the column.\n * @param {boolean} supressSelectionchangedEvent When true, prevents the selectionchanged event from firing.\n */\n self.selectColumn = function (columnIndex, ctrl, shift, supressEvent) {\n var s, e, x;\n function addCol(i) {\n self.data.forEach(function (row, rowIndex) {\n self.selections[rowIndex] = self.selections[rowIndex] || [];\n if (self.selections[rowIndex].indexOf(i) === -1) {\n self.selections[rowIndex].push(i);\n }\n });\n }\n function removeCol(i) {\n self.data.forEach(function (row, rowIndex) {\n self.selections[rowIndex] = self.selections[rowIndex] || [];\n if (self.selections[rowIndex].indexOf(i) !== -1) {\n self.selections[rowIndex].splice(self.selections[rowIndex].indexOf(i), 1);\n }\n });\n }\n if (shift) {\n if (!self.activeCell) { return; }\n s = Math.min(self.activeCell.columnIndex, columnIndex);\n e = Math.max(self.activeCell.columnIndex, columnIndex);\n for (x = s; e > x; x += 1) {\n addCol(x);\n }\n }\n if (!ctrl && !shift) {\n self.selections = [];\n self.activeCell.columnIndex = columnIndex;\n self.activeCell.rowIndex = self.scrollIndexTop;\n }\n if (ctrl && self.isColumnSelected(columnIndex)) {\n removeCol(columnIndex);\n } else {\n addCol(columnIndex);\n }\n if (supressEvent) { return; }\n self.dispatchEvent('selectionchanged', {\n selectedData: self.getSelectedData(),\n selections: self.selections,\n selectionBounds: self.selectionBounds\n });\n };\n /**\n * Selects a row.\n * @memberof canvasDataGrid\n * @name selectRow\n * @method\n * @param {number} rowIndex The row index to select.\n * @param {boolean} ctrl When true, behaves as if you were holding control/command when you clicked the row.\n * @param {boolean} shift When true, behaves as if you were holding shift when you clicked the row.\n * @param {boolean} supressSelectionchangedEvent When true, prevents the selectionchanged event from firing.\n */\n self.selectRow = function (rowIndex, ctrl, shift, supressEvent) {\n var x, st, en, s = self.getSchema();\n function addRow(ri) {\n self.selections[ri] = [];\n self.selections[ri].push(-1);\n s.forEach(function (col) {\n self.selections[ri].push(col.index);\n });\n }\n if (self.dragAddToSelection === false || self.dragObject === undefined) {\n if (self.selections[rowIndex] && self.selections[rowIndex].length - 1 === s.length) {\n if (ctrl) {\n self.selections[rowIndex] = [];\n return;\n }\n }\n }\n if (self.dragAddToSelection === true || self.dragObject === undefined) {\n if (shift && self.dragObject === undefined) {\n if (!self.activeCell) { return; }\n st = Math.min(self.activeCell.rowIndex, rowIndex);\n en = Math.max(self.activeCell.rowIndex, rowIndex);\n for (x = st; en >= x; x += 1) {\n addRow(x);\n }\n } else {\n addRow(rowIndex);\n }\n }\n if (supressEvent) { return; }\n self.dispatchEvent('selectionchanged', {\n selectedData: self.getSelectedData(),\n selections: self.selections,\n selectionBounds: self.selectionBounds\n });\n };\n /**\n * Collapse a tree grid by row index.\n * @memberof canvasDataGrid\n * @name collapseTree\n * @method\n * @param {number} index The index of the row to collapse.\n */\n self.collapseTree = function (rowIndex) {\n var rowId = self.data[rowIndex][self.uniqueId];\n self.dispatchEvent('collapsetree', {\n childGrid: self.childGrids[rowId],\n data: self.data[rowIndex],\n rowIndex: rowIndex\n });\n self.openChildren[rowId].blur();\n self.openChildren[rowId].dispose();\n delete self.openChildren[rowId];\n delete self.sizes.trees[rowId];\n delete self.childGrids[rowId];\n self.dispatchEvent('resizerow', {\n cellHeight: self.style.cellHeight\n });\n self.resize(true);\n self.draw(true);\n };\n /**\n * Expands a tree grid by row index.\n * @memberof canvasDataGrid\n * @name expandTree\n * @method\n * @param {number} index The index of the row to expand.\n */\n self.expandTree = function (rowIndex) {\n var rowHeaderCellHeight = self.getRowHeaderCellHeight(),\n columnHeaderCellWidth = self.sizes.columns.cornerCell || self.style.rowHeaderCellWidth,\n rowId = self.data[rowIndex][self.uniqueId],\n h = self.sizes.trees[rowId] || self.style.treeGridHeight,\n treeGrid;\n if (!self.childGrids[rowId]) {\n treeGrid = self.createGrid({\n debug: self.attributes.debug,\n name: self.attributes.saveAppearance\n ? self.attributes.name + 'tree' + rowId : undefined,\n parentNode: {\n parentGrid: self.intf,\n nodeType: 'canvas-datagrid-tree',\n offsetHeight: h,\n offsetWidth: self.width - columnHeaderCellWidth,\n header: { width: self.width - columnHeaderCellWidth },\n offsetLeft: columnHeaderCellWidth,\n offsetTop: rowHeaderCellHeight,\n offsetParent: self.intf.parentNode,\n parentNode: self.intf.parentNode,\n style: 'tree',\n data: self.data[rowIndex]\n }\n });\n self.childGrids[rowId] = treeGrid;\n }\n treeGrid = self.childGrids[rowId];\n treeGrid.visible = true;\n self.dispatchEvent('expandtree', {\n treeGrid: treeGrid,\n data: self.data[rowIndex],\n rowIndex: rowIndex\n });\n self.openChildren[rowId] = treeGrid;\n self.sizes.trees[rowId] = h;\n self.dispatchEvent('resizerow', {height: self.style.cellHeight});\n self.resize(true);\n };\n /**\n * Toggles tree grid open and close by row index.\n * @memberof canvasDataGrid\n * @name toggleTree\n * @method\n * @param {number} index The index of the row to toggle.\n */\n self.toggleTree = function (rowIndex) {\n var i = self.openChildren[self.data[rowIndex][self.uniqueId]];\n if (i) {\n return self.collapseTree(rowIndex);\n }\n self.expandTree(rowIndex);\n };\n /**\n * Returns a header from the schema by name.\n * @memberof canvasDataGrid\n * @name getHeaderByName\n * @tutorial schema\n * @method\n * @returns {header} header with the selected name, or undefined.\n * @param {string} name The name of the column to resize.\n */\n self.getHeaderByName = function (name) {\n var x, i = self.getSchema();\n for (x = 0; x < i.length; x += 1) {\n if (i[x].name === name) {\n return i[x];\n }\n }\n };\n /**\n * Resizes a column to fit the longest value in the column. Call without a value to resize all columns.\n * Warning, can be slow on very large record sets (1m records ~3-5 seconds on an i7).\n * @memberof canvasDataGrid\n * @name fitColumnToValues\n * @method\n * @param {string} name The name of the column to resize.\n */\n self.fitColumnToValues = function (name, internal) {\n self.sizes.columns[name === 'cornerCell' ? name : self.getHeaderByName(name)[self.uniqueId]]\n = self.findColumnMaxTextLength(name);\n if (!internal) {\n self.resize();\n self.draw(true);\n }\n };\n /**\n * Checks if a cell is currently visible.\n * @memberof canvasDataGrid\n * @name isCellVisible\n * @method\n * @returns {boolean} when true, the cell is visible, when false the cell is not currently drawn.\n * @param {cell} cell The cell to check for. Alternatively you can pass an object { x: , y: }.\n */\n self.isCellVisible = function (cell) {\n var x, l = self.visibleCells.length;\n for (x = 0; x < l; x += 1) {\n if (cell.x === self.visibleCells[x].x && cell.y === self.visibleCells[x].y) {\n return true;\n }\n }\n return false;\n };\n /**\n * Sets the order of the data.\n * @memberof canvasDataGrid\n * @name order\n * @method\n * @returns {cell} cell at the selected location.\n * @param {number} columnName Number of pixels from the left.\n * @param {string} direction `asc` for ascending or `desc` for descending.\n * @param {function} [sortFunction] When defined, override the default sorting method defined in the column's schema and use this one.\n * @param {bool} [dontSetStorageData] Don't store this setting for future use.\n */\n self.order = function (columnName, direction, sortFunction, dontSetStorageData) {\n var f,\n c = self.getSchema().filter(function (col) {\n return col.name === columnName;\n });\n self.orderBy = columnName;\n if (c.length === 0) {\n throw new Error('Cannot sort. No such column name');\n }\n f = sortFunction || self.sorters[c[0].type];\n if (!f && c[0].type !== undefined) {\n console.warn('Cannot sort type \"%s\" falling back to string sort.', c[0].type);\n }\n self.data = self.data.sort(typeof f === 'function' ? f(columnName, direction) : self.sorters.string);\n self.dispatchEvent('ordercolumn', {name: columnName, direction: direction});\n self.draw(true);\n if (dontSetStorageData) { return; }\n self.setStorageData();\n };\n self.isInGrid = function (e) {\n if (e.x < 0\n || e.x > self.width\n || e.y < 0\n || e.y > self.height) {\n return false;\n }\n return true;\n };\n /**\n * Gets the cell at columnIndex and rowIndex.\n * @memberof canvasDataGrid\n * @name getVisibleCellByIndex\n * @method\n * @returns {cell} cell at the selected location.\n * @param {number} x Column index.\n * @param {number} y Row index.\n */\n self.getVisibleCellByIndex = function (x, y) {\n return self.visibleCells.filter(function (c) {\n return c.columnIndex === x && c.rowIndex === y;\n })[0];\n };\n /**\n * Gets the cell at grid pixel coordinate x and y.\n * @memberof canvasDataGrid\n * @name getCellAt\n * @method\n * @returns {cell} cell at the selected location.\n * @param {number} x Number of pixels from the left.\n * @param {number} y Number of pixels from the top.\n */\n self.getCellAt = function (x, y, useTouchScrollZones) {\n var tsz = useTouchScrollZones ? self.attributes.touchScrollZone : 0, i, l = self.visibleCells.length, cell;\n if (!self.visibleCells || !self.visibleCells.length) { return; }\n self.hasFocus = true;\n if (!(y < self.height\n && y > 0\n && x < self.width\n && x > 0)) {\n self.hasFocus = false;\n return {\n dragContext: 'inherit',\n context: 'inherit'\n };\n }\n for (i = 0; i < l; i += 1) {\n cell = self.visibleCells[i];\n if (useTouchScrollZones && /(vertical|horizontal)-scroll-/.test(cell.style)) {\n cell.x -= tsz;\n cell.y -= tsz;\n cell.height += tsz;\n cell.width += tsz;\n }\n if (cell.x - self.style.cellBorderWidth < x\n && cell.x + cell.width + self.style.cellBorderWidth > x\n && cell.y - self.style.cellBorderWidth < y\n && cell.y + cell.height + self.style.cellBorderWidth > y) {\n if (/vertical-scroll-(bar|box)/.test(cell.style)) {\n cell.dragContext = 'vertical-scroll-box';\n cell.context = 'vertical-scroll-box';\n cell.isScrollBar = true;\n cell.isVerticalScrollBar = true;\n if (y > self.scrollBox.box.v.y + self.scrollBox.scrollBoxHeight) {\n cell.dragContext = 'vertical-scroll-bottom';\n cell.context = 'vertical-scroll-bottom';\n } else if (y < self.scrollBox.box.v.y) {\n cell.dragContext = 'vertical-scroll-top';\n cell.context = 'vertical-scroll-top';\n }\n self.canvas.style.cursor = 'default';\n return cell;\n }\n if (/horizontal-scroll-(bar|box)/.test(cell.style)) {\n cell.dragContext = 'horizontal-scroll-box';\n cell.context = 'horizontal-scroll-box';\n cell.isScrollBar = true;\n cell.isHorizontalScrollBar = true;\n if (x > self.scrollBox.box.h.x + self.scrollBox.scrollBoxWidth) {\n cell.dragContext = 'horizontal-scroll-right';\n cell.context = 'horizontal-scroll-right';\n } else if (x < self.scrollBox.box.h.x) {\n cell.dragContext = 'horizontal-scroll-left';\n cell.context = 'horizontal-scroll-left';\n }\n self.canvas.style.cursor = 'default';\n return cell;\n }\n if (cell.x + cell.width - (self.attributes.borderResizeZone * 0.4) < x\n && cell.x + cell.width + (self.attributes.borderResizeZone * 0.6) > x\n && self.attributes.allowColumnResize\n && ((self.attributes.allowColumnResizeFromCell && cell.style === 'cell')\n || cell.style !== 'cell')\n && ((self.attributes.allowRowHeaderResize\n && ['rowHeaderCell', 'cornerCell'].indexOf(cell.style) !== -1)\n || ['rowHeaderCell', 'cornerCell'].indexOf(cell.style) === -1)) {\n cell.context = 'ew-resize';\n cell.dragContext = 'ew-resize';\n return cell;\n }\n if (cell.y + cell.height - (self.attributes.borderResizeZone * 0.4) < y\n && cell.y + cell.height + (self.attributes.borderResizeZone * 0.6) > y\n && self.attributes.allowRowResize\n && ((self.attributes.allowRowResizeFromCell && cell.style === 'cell')\n || cell.style !== 'cell')\n && cell.style !== 'columnHeaderCell') {\n cell.context = 'ns-resize';\n cell.dragContext = 'ns-resize';\n return cell;\n }\n if (cell.style === 'columnHeaderCell') {\n cell.context = 'cell';\n cell.dragContext = 'column-reorder';\n return cell;\n }\n if (cell.style === 'rowHeaderCell') {\n cell.context = 'cell';\n cell.dragContext = 'row-reorder';\n return cell;\n }\n if (cell.isGrid) {\n self.hasFocus = false;\n cell.dragContext = 'cell-grid';\n cell.context = 'cell-grid';\n return cell;\n }\n if (cell.style === 'tree-grid') {\n self.hasFocus = false;\n cell.dragContext = 'tree';\n cell.context = 'tree';\n return cell;\n }\n cell.dragContext = 'cell';\n cell.context = 'cell';\n return cell;\n }\n }\n self.hasFocus = true;\n self.canvas.style.cursor = 'default';\n return {\n dragContext: 'background',\n context: 'background',\n style: 'background',\n isBackground: true\n };\n };\n /**\n * Gets the bounds of current selection. \n * @returns {rect} selection.\n * @memberof canvasDataGrid\n * @name getSelectionBounds\n * @method\n */\n self.getSelectionBounds = function () {\n var low = {x: Infinity, y: Infinity},\n high = {x: -Infinity, y: -Infinity};\n self.data.forEach(function (row, rowIndex) {\n var maxCol, minCol;\n if (self.selections[rowIndex] && self.selections[rowIndex].length) {\n low.y = rowIndex < low.y ? rowIndex : low.y;\n high.y = rowIndex > high.y ? rowIndex : high.y;\n maxCol = Math.max.apply(null, self.selections[rowIndex]);\n minCol = Math.min.apply(null, self.selections[rowIndex]);\n low.x = minCol < low.x ? minCol : low.x;\n high.x = maxCol > high.x ? maxCol : high.x;\n }\n });\n return {\n top: low.y,\n left: low.x,\n bottom: high.y,\n right: high.x\n };\n };\n /**\n * Returns an auto generated schema based on data structure.\n * @memberof canvasDataGrid\n * @name getSchemaFromData\n * @method\n * @tutorial schema\n * @returns {schema} schema A schema based on the first item in the data array.\n */\n self.getSchemaFromData = function () {\n return Object.keys(self.data[0] || {' ': ''}).map(function mapEachSchemaColumn(key, index) {\n var type = self.getBestGuessDataType(key),\n i = {\n name: key,\n title: isNaN(parseInt(key, 10)) ? key : self.integerToAlpha(key).toUpperCase(),\n width: self.style.columnWidth,\n index: index,\n type: type,\n filter: self.filter(type)\n };\n if (key === self.uniqueId) {\n i.hidden = true;\n }\n i[self.uniqueId] = self.getSchemaNameHash(key);\n return i;\n });\n };\n /**\n * Clears the change log grid.changes that keeps track of changes to the data set.\n * This does not undo changes or alter data it is simply a convince array to keep\n * track of changes made to the data since last this method was called.\n * @memberof canvasDataGrid\n * @name clearChangeLog\n * @method\n */\n self.clearChangeLog = function () {\n self.changes = [];\n };\n /**\n * Selects an area of the grid.\n * @memberof canvasDataGrid\n * @name selectArea\n * @method\n * @param {rect} bounds A rect object representing the selected values.\n */\n self.selectArea = function (bounds, ctrl) {\n self.selectionBounds = bounds || self.selectionBounds;\n var x, y, s = self.getSchema();\n if (!ctrl) {\n self.selections = [];\n }\n if (self.selectionBounds.top < -1\n || self.selectionBounds.bottom > self.data.length\n || self.selectionBounds.left < -1\n || self.selectionBounds.right > s.length) {\n throw new Error('Impossible selection area');\n }\n for (x = self.selectionBounds.top; x <= self.selectionBounds.bottom; x += 1) {\n self.selections[x] = [];\n for (y = self.selectionBounds.left; y <= self.selectionBounds.right; y += 1) {\n if (self.selections[x].indexOf(y) === -1) {\n self.selections[x].push(y);\n }\n }\n }\n self.dispatchEvent('selectionchanged', {\n selectedData: self.getSelectedData(),\n selections: self.selections,\n selectionBounds: self.selectionBounds\n });\n };\n /**\n * Returns the maximum text width for a given column by column name.\n * @memberof canvasDataGrid\n * @name findColumnMaxTextLength\n * @method\n * @returns {number} The number of pixels wide the maximum width value in the selected column.\n * @param {string} name The name of the column to calculate the value's width of.\n */\n self.findColumnMaxTextLength = function (name) {\n var m = -Infinity;\n if (name === 'cornerCell') {\n self.ctx.font = self.style.rowHeaderCellFont;\n return self.ctx.measureText((self.data.length + (self.attributes.showNewRow ? 1 : 0)).toString()).width\n + self.style.autosizePadding + self.style.autosizeHeaderCellPadding\n + self.style.rowHeaderCellPaddingRight\n + self.style.rowHeaderCellPaddingLeft\n + (self.attributes.tree ? self.style.treeArrowWidth\n + self.style.treeArrowMarginLeft + self.style.treeArrowMarginRight : 0);\n }\n self.getSchema().forEach(function (col) {\n if (col.name !== name) { return; }\n self.ctx.font = self.style.columnHeaderCellFont;\n var t = self.ctx.measureText(col.title || col.name).width\n + self.style.headerCellPaddingRight\n + self.style.headerCellPaddingLeft;\n m = t > m ? t : m;\n });\n self.data.forEach(function (row) {\n self.ctx.font = self.style.cellFont;\n var t = self.ctx.measureText(row[name]).width\n + self.style.cellPaddingRight\n + self.style.cellPaddingLeft + self.style.cellAutoResizePadding;\n m = t > m ? t : m;\n });\n return m;\n };\n /**\n * Gets the total width of all header columns.\n * @memberof canvasDataGrid\n * @name getHeaderWidth\n * @method\n */\n self.getHeaderWidth = function () {\n return self.getVisibleSchema().reduce(function (total, header) {\n return total + header.width;\n }, 0);\n };\n self.formatters.string = function cellFormatterString(e) {\n return e.cell.value !== undefined ? e.cell.value : '';\n };\n self.formatters.rowHeaderCell = self.formatters.string;\n self.formatters.headerCell = self.formatters.string;\n self.formatters.number = self.formatters.string;\n self.formatters.int = self.formatters.string;\n self.formatters.html = self.formatters.string;\n self.sorters.string = function (columnName, direction) {\n var asc = direction === 'asc';\n return function (a, b) {\n if (a[columnName] === undefined || a[columnName] === null) {\n return 1;\n }\n if (b[columnName] === undefined || b[columnName] === null) {\n return 0;\n }\n if (asc) {\n if (!a[columnName].localeCompare) { return 1; }\n return a[columnName].localeCompare(b[columnName]);\n }\n if (!b[columnName].localeCompare) { return 1; }\n return b[columnName].localeCompare(a[columnName]);\n };\n };\n self.sorters.number = function (columnName, direction) {\n var asc = direction === 'asc';\n return function (a, b) {\n if (asc) {\n return a[columnName] - b[columnName];\n }\n return b[columnName] - a[columnName];\n };\n };\n self.sorters.date = function (columnName, direction) {\n var asc = direction === 'asc';\n return function (a, b) {\n if (asc) {\n return new Date(a[columnName]).getTime()\n - new Date(b[columnName]).getTime();\n }\n return new Date(b[columnName]).getTime()\n - new Date(a[columnName]).getTime();\n };\n };\n };\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/publicMethods.js\n// module id = 7\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/test/tests.js b/test/tests.js index a13e9e0d..8f74d53f 100644 --- a/test/tests.js +++ b/test/tests.js @@ -149,9 +149,16 @@ var p = bb(bbEl || el); de(el, 'touchmove', {touches: [{clientX: x + p.left, clientY: y + p.top }]}); } - function click(el, x, y, bbEl) { + function click(el, x, y, bbEl, ev) { var p = bb(bbEl || el); - de(el, 'click', {clientX: x + p.left, clientY: y + p.top }); + ev = ev || {}; + ev.clientX = x + p.left; + ev.clientY = y + p.top; + de(el, 'click', ev); + } + function dblclick(el, x, y, bbEl) { + var p = bb(bbEl || el); + de(el, 'dblclick', {clientX: x + p.left, clientY: y + p.top }); } function g(args) { var grid, @@ -824,6 +831,32 @@ }, 2000); }, 1); }).timeout(5000); + it('Scroll horizontally via wheel', function (done) { + var ev, grid = g({ + test: this.test, + data: makeData(30, 500) + }); + grid.focus(); + ev = new Event('wheel'); + ev.deltaX = 10; + ev.deltaY = 0; + grid.canvas.dispatchEvent(ev); + done(assertIf(grid.scrollLeft < 1, + 'Expected the scroll bar to be further along.')); + }); + it('Scroll vertically via wheel', function (done) { + var ev, grid = g({ + test: this.test, + data: makeData(30, 500) + }); + grid.focus(); + ev = new Event('wheel'); + ev.deltaX = 0; + ev.deltaY = 10; + grid.canvas.dispatchEvent(ev); + done(assertIf(grid.scrollTop < 1, + 'Expected the scroll bar to be further along.')); + }); }); describe('Touch', function () { it('Touch and drag should scroll the grid vertically and horizontally', function (done) { @@ -984,6 +1017,105 @@ && editInput.tagName !== 'SELECT', 'Expected an input to have appeared')); grid.endEdit(); }); + it('Begin editing by double clicking a cell.', function (done) { + var editInput, + grid = g({ + test: this.test, + data: [{d: ''}] + }); + mousemove(grid.canvas, 45, 37); + mousedown(grid.canvas, 45, 37); + mouseup(grid.canvas, 45, 37); + mousedown(grid.canvas, 45, 37); + mouseup(grid.canvas, 45, 37); + dblclick(grid.canvas, 45, 37); + editInput = document.body.lastChild; + done(assertIf(editInput.tagName !== 'INPUT', 'Expected an input to have appeared')); + grid.endEdit(); + }); + it('Should copy a value onto the simulated clipboard.', function (done) { + var grid = g({ + test: this.test, + data: [ + {d: 'Text with, a comma 1', e: 'Text that has no comma in in 1'}, + {d: 'Text with, a comma 2', e: 'Text that has no comma in in 2'} + ] + }); + grid.selectAll(); + grid.focus(); + setTimeout(function () { + grid.copy({ + clipboardData: { + setData: function (mime, data) { + done(assertIf(mime !== 'text/plain' + || data.indexOf('Text with') === -1, 'Expected data from the grid to be placed into the fake clipboard.')); + } + } + }); + }, 1); + }); + it('Begin editing, tab to next cell', function (done) { + var ev, + err, + editInput, + grid = g({ + test: this.test, + data: smallData + }); + grid.beginEditAt(0, 0); + editInput = document.body.lastChild; + ev = new Event('keydown'); + ev.keyCode = kcs.tab; + editInput.dispatchEvent(ev); + grid.addEventListener('endedit', function (e) { + if (e.cell.columnIndex === 1) { + done(); + } + }); + grid.endEdit(); + }); + it('Begin editing, shift tab to very last cell', function (done) { + var ev, + err, + editInput, + grid = g({ + test: this.test, + data: smallData + }); + grid.beginEditAt(0, 0); + editInput = document.body.lastChild; + ev = new Event('keydown'); + ev.shiftKey = true; + ev.keyCode = kcs.tab; + grid.addEventListener('endedit', function (e) { + if (e.cell.columnIndex === 2 && e.cell.rowIndex === 2) { + done(); + } + }); + editInput.dispatchEvent(ev); + grid.endEdit(); + }); + it('Begin editing, tab to next row by hitting tab three times', function (done) { + var ev, + err, + editInput, + grid = g({ + test: this.test, + data: smallData + }); + grid.beginEditAt(0, 0); + grid.addEventListener('endedit', function (e) { + if (e.cell.columnIndex === 0 && e.cell.rowIndex === 0) { + done(); + } + }); + ev = new Event('keydown'); + ev.keyCode = kcs.tab; + document.body.lastChild.dispatchEvent(ev); + document.body.lastChild.dispatchEvent(ev); + document.body.lastChild.dispatchEvent(ev); + grid.endEdit(); + }); }); describe('Key navigation', function () { it('Arrow down should move active cell down one', function (done) { @@ -1770,7 +1902,7 @@ it('Should allow column reordering when allowColumnReordering is true', function (done) { var grid = g({ test: this.test, - data: smallData, + data: makeData(3, 3, function (y, x) { return x + ':' + y; }), style: { columnWidth: 50 } @@ -1784,7 +1916,7 @@ mouseup(document.body, 200, 10, grid.canvas); grid.draw(); grid.addEventListener('click', function (e) { - done(assertIf(e.cell.value !== 0, 'Expected to see the value from column 2 here.')); + done(assertIf(e.cell.value !== '1:0', 'Expected to see the value from column 2 here, instead saw %n.', e.cell.value)); }); // lib intentionally ignoring next click - required to make the ux work as desired click(grid.canvas, 60, 37); @@ -1903,7 +2035,7 @@ }); contextmenu(grid.canvas, 60, 37); }); - it('Clicking the corner cell will return dataset to original sort order.', function (done) { + it('Clicking the corner cell will return dataset to original sort order and filter settings.', function (done) { var grid = g({ test: this.test, data: makeData(10, 10, function (x) { return x; }), @@ -1919,7 +2051,7 @@ done(assertIf(grid.data[0].a !== 0, 'Expected data to be sorted.')); }, 1); }); - it('Clicking a header cell with columnHeaderClickBehavior set to sort', function (done) { + it('Clicking a header cell with columnHeaderClickBehavior set to sort should sort the column asc', function (done) { var grid = g({ test: this.test, data: smallData, @@ -1930,7 +2062,54 @@ click(grid.canvas, 40, 12); done(assertIf(grid.data[0].col1 !== 'bar', 'Expected data to be sorted.')); }); - + it('Clicking a header cell with columnHeaderClickBehavior set to select should select the column', function (done) { + var grid = g({ + test: this.test, + data: smallData, + columnHeaderClickBehavior: 'select' + }); + marker(grid, 40, 12); + mousemove(grid.canvas, 40, 12); + click(grid.canvas, 40, 12); + done(assertIf(grid.selectedRows.length !== 3 + || grid.selectedCells[0].col2 !== undefined, 'Expected every row to be selected.')); + }); + it('Clicking a header cell with columnHeaderClickBehavior set to select then clicking another with ctrl held should add to the selection', function (done) { + var grid = g({ + test: this.test, + data: smallData, + columnHeaderClickBehavior: 'select', + style: { + columnWidth: 50 + } + }); + marker(grid, 40, 12); + mousemove(grid.canvas, 40, 12); + click(grid.canvas, 40, 12); + mousemove(grid.canvas, 175, 12); + click(grid.canvas, 175, 12, null, {controlKey: true}); + done(assertIf(grid.selectedRows.length !== 3 + || grid.selectedCells[0].col2 !== undefined + || grid.selectedCells[0].col3 !== 'a', 'Expected every row to be selected and column 2 to not be selected.')); + }); + it('Clicking a header cell with columnHeaderClickBehavior set to select then clicking another with shift held should add a range to the selection', function (done) { + var grid = g({ + test: this.test, + data: makeData(3, 3, function (y, x) { return x + ':' + y; }), + columnHeaderClickBehavior: 'select', + style: { + columnWidth: 50 + } + }); + marker(grid, 40, 12); + mousemove(grid.canvas, 40, 12); + click(grid.canvas, 40, 12); + mousemove(grid.canvas, 175, 12); + click(grid.canvas, 175, 12, null, {shiftKey: true}); + done(assertIf(grid.selectedRows.length !== 3 + || grid.selectedCells[0].c !== '2:0' + || grid.selectedCells[0].b !== '1:0', 'Expected everything to be selected.')); + }); }); }); });