From bd4dc332400b8eff7b179be2ed7fd223aca6864a Mon Sep 17 00:00:00 2001 From: Tony Germaneri Date: Tue, 15 Aug 2017 01:34:26 -0700 Subject: [PATCH 1/3] clean build step added --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 73b5a54b..44b376d3 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "build-watch": "./node_modules/.bin/webpack --output-library=canvasDatagrid --output-library-target=umd --watch -d --entry=./lib/main.js --output-path=./dist --output-filename=canvas-datagrid.debug.js --devtool source-map --output-source-map-filename='canvas-datagrid.debug.map'", "build-dev": "./node_modules/.bin/webpack --output-library=canvasDatagrid --output-library-target=umd -d --entry=./lib/main.js --output-path=./dist --output-filename=canvas-datagrid.debug.js --devtool source-map --output-source-map-filename='canvas-datagrid.debug.map'", "test": "npm run build-instrument;npm run build-pack-instrument;npm run build-run-test;npm run build-run-report", - "build-instrument": "mkdir build || true;echo \"$((`cat build.txt` + 1))\" > build.txt;./node_modules/.bin/istanbul instrument ./lib -o ./build/lib", + "build-instrument": "rm -rf build;mkdir build;echo \"$((`cat build.txt` + 1))\" > build.txt;./node_modules/.bin/istanbul instrument ./lib -o ./build/lib", "build-pack-instrument": "./node_modules/.bin/webpack --output-library=canvasDatagrid --output-library-target=umd -d --entry=./build/lib/main.js --output-path=./build --output-filename=canvas-datagrid.instrument.js --devtool source-map --output-source-map-filename='canvas-datagrid.instrument.map'", "build-run-test": "./node_modules/.bin/phantomjs ./node_modules/mocha-phantomjs-core/mocha-phantomjs-core.js ./test/tests.html spec '{\"hooks\": \"mocha-phantomjs-istanbul\", \"coverageFile\": \"./build/coverage.json\"}'", "build-run-report": "./node_modules/.bin/istanbul report --root ./build --dir ./build/report --reporter text --reporter lcov", From 4888f6a8d598f8ac949ec4292d56c0096c4f46cc Mon Sep 17 00:00:00 2001 From: Tony Germaneri Date: Tue, 15 Aug 2017 09:25:27 -0700 Subject: [PATCH 2/3] reordered readme for mobile --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 95f79789..11bb8b2f 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,15 @@ Canvas Data Grid ================ -![coverage](https://coveralls.io/repos/github/TonyGermaneri/canvas-datagrid/badge.svg?branch=master) - [Demo](https://tonygermaneri.github.io/canvas-datagrid/tutorials/demo.html) ![canvas-datagrid](https://tonygermaneri.github.io/canvas-datagrid/images/datagrid1.png) -* High performance hierarchal canvas based data grid. +![coverage](https://coveralls.io/repos/github/TonyGermaneri/canvas-datagrid/badge.svg?branch=master) + * Support for millions of rows and columns. -* Extensible styling, filtering, formatting, resizing, selecting, and ordering. * Support for touch devices (phones and tablets). +* Extensible styling, filtering, formatting, resizing, selecting, and ordering. * Built in and custom styles. * Hierarchal context menu. * Per-user styles, settings using localStorage. From af2efee5a2549510d7fecf05549cb5de483bdc03 Mon Sep 17 00:00:00 2001 From: Tony Germaneri Date: Tue, 15 Aug 2017 15:03:13 -0700 Subject: [PATCH 3/3] updated assertPxColor to work with devicePixelRatio --- bower.json | 2 +- build.txt | 2 +- dist/canvas-datagrid.debug.js | 1 + dist/canvas-datagrid.debug.map | 2 +- dist/canvas-datagrid.js | 2 +- dist/canvas-datagrid.map | 2 +- lib/draw.js | 2 ++ lib/publicMethods.js | 2 ++ package.json | 5 +++-- test/tests.html | 2 ++ test/tests.js | 41 +++++++++++++++++++++++++++++----- 11 files changed, 51 insertions(+), 12 deletions(-) diff --git a/bower.json b/bower.json index 8c8719d0..14f57ea1 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "canvas-datagrid", "main": "lib/main.js", - "version": "0.14.2", + "version": "0.14.3", "ignore": [ "**/.*", "node_modules", diff --git a/build.txt b/build.txt index 88919176..4e6ee1e5 100644 --- a/build.txt +++ b/build.txt @@ -1 +1 @@ -1414 +1421 diff --git a/dist/canvas-datagrid.debug.js b/dist/canvas-datagrid.debug.js index 0337c26f..50183932 100644 --- a/dist/canvas-datagrid.debug.js +++ b/dist/canvas-datagrid.debug.js @@ -322,6 +322,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*jslint browser * @method */ self.draw = function (internal) { + if (self.dispatchEvent('beforedraw', {})) { return; } if (!self.isChildGrid && (!self.height || !self.width)) { return; } diff --git a/dist/canvas-datagrid.debug.map b/dist/canvas-datagrid.debug.map index 2b27b1e9..6c29d53d 100644 --- a/dist/canvas-datagrid.debug.map +++ b/dist/canvas-datagrid.debug.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 6ea96fb2d3de47c789b1","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;AACA;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,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;AACA;AACA;AACA,CAAC;AAAA;;;;;;;;;;;;ACz4BD;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,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,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,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,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;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,iBAAiB;AACjB;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,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,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,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;;;;;;;;;;;;AC3kCD;AACA;AACA;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,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,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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,qBAAqB;AAC9C,gCAAgC,uBAAuB;AACvD;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,qBAAqB;AACrB;AACA;AACA;AACA;AACA,4DAA4D,wBAAwB;AACpF;AACA,iBAAiB;AACjB,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;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;AACA;AACA;AACA;AACA,yBAAyB,QAAQ;AACjC;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,+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,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;AACA;AACA,iBAAiB;AACjB,qCAAqC,iBAAiB;AACtD;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;;;;;;;;;;;;ACh9BD;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,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,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,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAAA;;;;;;;;;;;;ACndD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;;;;;;;;;;;;ACpOD;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,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;;;;;;;;;;;;ACxND;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;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;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;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,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;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,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,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;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,mBAAmB,QAAQ;AAC3B,mBAAmB,QAAQ;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;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,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,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 6ea96fb2d3de47c789b1","/*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.isChildGrid && (!self.height || !self.width)) {\n return;\n }\n // if something asked a child to draw, ask the parent to draw, unless it was the parent that asked... then.. idk... stack overflow!\n // if (self.isChildGrid && internal) {\n // 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 = Array.isArray(d[header.name]),\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 checkScrollHeight = true;\n }\n cell.grid = self.childGrids[cell.gridId];\n cell.grid.parentNode = cell;\n cell.grid.visible = true;\n //cell.grid.resize(true);\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 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 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 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) {\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 self.draw(true);\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, true);\n } else {\n if (!self.dragAddToSelection && o.rowIndex) {\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, 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 /**\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 function postDraw() {\n var mEv, option, valueInEnum;\n cell = self.getVisibleCellByIndex(x, y);\n if (cell.header.enum) {\n self.input = document.createElement('select');\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 } else {\n self.input = document.createElement(self.attributes.multiLine ? 'textarea' : 'input');\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 requestAnimationFrame(postDraw);\n self.dispatchEvent('beginedit', {cell: cell, input: self.input});\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');\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, 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 document.exitPointerLock();\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, 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 === 'Tab') {\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, 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 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.createNewRowData = function () {\n self.newRow = {};\n self.newRow[self.uniqueId] = self.uId;\n self.uId += 1;\n self.getSchema().forEach(function forEachHeader(header, index) {\n var d = header.defaultValue || '';\n if (typeof d === 'function') {\n d = d.apply(self.intf, [header, index]);\n }\n self.newRow[header.name] = d;\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.getFontHeightLong = function (fontStyle) {\n var pixels,\n start,\n end,\n row,\n column,\n index,\n canvas = document.createElement('canvas'),\n ctx = canvas.getContext('2d');\n canvas.height = 5000;\n canvas.width = 5000;\n ctx.save();\n ctx.fillRect(0, 0, canvas.width, canvas.height);\n ctx.textBaseline = 'top';\n ctx.fillStyle = 'white';\n ctx.font = fontStyle;\n ctx.fillText('gM', 0, 0);\n pixels = ctx.getImageData(0, 0, canvas.width, canvas.height).data;\n start = -1;\n end = -1;\n for (row = 0; row < canvas.height; row += 1) {\n for (column = 0; column < canvas.width; column += 1) {\n index = (row * canvas.width + column) * 4;\n if (pixels[index] === 0) {\n if (column === canvas.width - 1 && start !== -1) {\n end = row;\n row = canvas.height;\n break;\n }\n } else {\n if (start === -1) {\n start = row;\n }\n break;\n }\n }\n }\n ctx.restore();\n console.log(end - start);\n return end - start;\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.init = function () {\n var publicStyleKeyIntf = {};\n self.setAttributes();\n self.setStyle();\n self.initScrollBox();\n self.setDom();\n Object.keys(self.style).forEach(self.parseFont);\n self.intf.type = 'canvas-datagrid';\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.drawChildGrids = self.drawChildGrids;\n self.intf.assertPxColor = self.assertPxColor;\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, '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 if (self.args.data) {\n self.intf.data = self.args.data;\n }\n if (self.args.schema) {\n self.intf.schema = self.args.schema;\n }\n if (!self.data) {\n self.intf.data = [];\n }\n self.resize(true);\n };\n self.intf.blur = function (e) {\n self.hasFocus = false;\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;\n if (data === null || data === '' || data === undefined) {\n return [];\n }\n if ((typeof data[0] === 'object' && data[0] !== null)\n || (Array.isArray(data) && data.length === 0)) {\n return data;\n }\n if (typeof data === 'number'\n || typeof data === 'boolean'\n || data !== null) {\n data = [{a: data}];\n }\n if (typeof data === 'function') {\n i = data.apply(self.intf, [function (d) {\n self.normalizeDataset(d);\n }]);\n if (i) {\n self.normalizeDataset(i);\n }\n }\n if (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][self.integerToAlpha(x).toUpperCase()] = 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.');\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;\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 // width cannot be determined correctly until after inserted into the dom?\n requestAnimationFrame(function () {\n self.fitColumnToValues('cornerCell');\n });\n if (!self.resize()) { 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.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 = 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 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 self.contextMenu.dispose();\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 ['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 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 * Used during testing to asertain a given pixel color on the canvas.\n * @memberof canvasDataGrid\n * @name assertPxColor\n * @method\n * @param {number} x The x coordinate of the pixel to check.\n * @param {number} x The y coordinate of the pixel to check.\n * @param {string} [expected] The expected joined rgba color string (e.g.: `rgba(225, 225, 225, 255)`).\n * @param {method} [callback] Callback method if any to be called 1 ms after the completion of this otherwise sync task.\n */\n self.assertPxColor = function (x, y, expected, callback) {\n var d = self.ctx.getImageData(x, y, 1, 1).data;\n d = 'rgb(' + [d['0'], d['1'], d['2']].join(', ') + ')';\n if (expected) {\n if (d !== expected) {\n throw new Error('Expected color ' + expected + ' but got color ' + d);\n }\n }\n if (callback) {\n setTimeout(function () {\n callback();\n }, 1);\n }\n return d;\n };\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} rowIndex The column to insert into the schema.\n * @param {number} index The index of the row 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 self.intf.schema = s.splice(index, 0, c);\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 self.intf.schema = s.splice(index, 1);\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.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.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.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 (self.coulumn === undefined && value === undefined) {\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 (self.dragAddToSelection === true) {\n if (ctrl && self.isColumnSelected(columnIndex)) {\n removeCol(columnIndex);\n } else {\n addCol(columnIndex);\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 * Selects a row.\n * @memberof canvasDataGrid\n * @name selectRow\n * @method\n * @param {number} rowIndex The row index to select.\n * @param {boolean} toggleSelectMode When true, behaves as if you were holding control/command when you clicked the row.\n * @param {boolean} supressSelectionchangedEvent When true, prevents the selectionchanged event from firing.\n */\n self.selectRow = function (rowIndex, ctrl, supressEvent) {\n var s = self.getSchema();\n if (self.dragAddToSelection === false) {\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) {\n self.selections[rowIndex] = [];\n self.selections[rowIndex].push(-1);\n s.forEach(function (col) {\n self.selections[rowIndex].push(col.index);\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) {\n self.sizes.columns[name === 'cornerCell' ? name : self.getHeaderByName(name)[self.uniqueId]]\n = self.findColumnMaxTextLength(name);\n self.resize();\n self.draw(true);\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 {bool} dontSetStorageData Don't store this setting for future use.\n */\n self.order = function (columnName, direction, 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 = 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: key,\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 4e015784759f804015c9","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;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,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;AACA;AACA;AACA,CAAC;AAAA;;;;;;;;;;;;AC14BD;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,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,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,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,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;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,iBAAiB;AACjB;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,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,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,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;;;;;;;;;;;;AC3kCD;AACA;AACA;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,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,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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB,qBAAqB;AAC9C,gCAAgC,uBAAuB;AACvD;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,qBAAqB;AACrB;AACA;AACA;AACA;AACA,4DAA4D,wBAAwB;AACpF;AACA,iBAAiB;AACjB,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;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;AACA;AACA;AACA;AACA,yBAAyB,QAAQ;AACjC;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,+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,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;AACA;AACA,iBAAiB;AACjB,qCAAqC,iBAAiB;AACtD;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;;;;;;;;;;;;ACh9BD;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,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,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,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAAA;;;;;;;;;;;;ACndD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;;;;;;;;;;;;ACpOD;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,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;;;;;;;;;;;;ACxND;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B,mBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;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;AACA;AACA;AACA;AACA;AACA,mBAAmB,OAAO;AAC1B;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,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;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,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,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;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,mBAAmB,QAAQ;AAC3B,mBAAmB,QAAQ;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;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,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,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 4e015784759f804015c9","/*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 something asked a child to draw, ask the parent to draw, unless it was the parent that asked... then.. idk... stack overflow!\n // if (self.isChildGrid && internal) {\n // 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 = Array.isArray(d[header.name]),\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 checkScrollHeight = true;\n }\n cell.grid = self.childGrids[cell.gridId];\n cell.grid.parentNode = cell;\n cell.grid.visible = true;\n //cell.grid.resize(true);\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 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 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 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) {\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 self.draw(true);\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, true);\n } else {\n if (!self.dragAddToSelection && o.rowIndex) {\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, 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 /**\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 function postDraw() {\n var mEv, option, valueInEnum;\n cell = self.getVisibleCellByIndex(x, y);\n if (cell.header.enum) {\n self.input = document.createElement('select');\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 } else {\n self.input = document.createElement(self.attributes.multiLine ? 'textarea' : 'input');\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 requestAnimationFrame(postDraw);\n self.dispatchEvent('beginedit', {cell: cell, input: self.input});\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');\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, 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 document.exitPointerLock();\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, 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 === 'Tab') {\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, 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 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.createNewRowData = function () {\n self.newRow = {};\n self.newRow[self.uniqueId] = self.uId;\n self.uId += 1;\n self.getSchema().forEach(function forEachHeader(header, index) {\n var d = header.defaultValue || '';\n if (typeof d === 'function') {\n d = d.apply(self.intf, [header, index]);\n }\n self.newRow[header.name] = d;\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.getFontHeightLong = function (fontStyle) {\n var pixels,\n start,\n end,\n row,\n column,\n index,\n canvas = document.createElement('canvas'),\n ctx = canvas.getContext('2d');\n canvas.height = 5000;\n canvas.width = 5000;\n ctx.save();\n ctx.fillRect(0, 0, canvas.width, canvas.height);\n ctx.textBaseline = 'top';\n ctx.fillStyle = 'white';\n ctx.font = fontStyle;\n ctx.fillText('gM', 0, 0);\n pixels = ctx.getImageData(0, 0, canvas.width, canvas.height).data;\n start = -1;\n end = -1;\n for (row = 0; row < canvas.height; row += 1) {\n for (column = 0; column < canvas.width; column += 1) {\n index = (row * canvas.width + column) * 4;\n if (pixels[index] === 0) {\n if (column === canvas.width - 1 && start !== -1) {\n end = row;\n row = canvas.height;\n break;\n }\n } else {\n if (start === -1) {\n start = row;\n }\n break;\n }\n }\n }\n ctx.restore();\n console.log(end - start);\n return end - start;\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.init = function () {\n var publicStyleKeyIntf = {};\n self.setAttributes();\n self.setStyle();\n self.initScrollBox();\n self.setDom();\n Object.keys(self.style).forEach(self.parseFont);\n self.intf.type = 'canvas-datagrid';\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.drawChildGrids = self.drawChildGrids;\n self.intf.assertPxColor = self.assertPxColor;\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, '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 if (self.args.data) {\n self.intf.data = self.args.data;\n }\n if (self.args.schema) {\n self.intf.schema = self.args.schema;\n }\n if (!self.data) {\n self.intf.data = [];\n }\n self.resize(true);\n };\n self.intf.blur = function (e) {\n self.hasFocus = false;\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;\n if (data === null || data === '' || data === undefined) {\n return [];\n }\n if ((typeof data[0] === 'object' && data[0] !== null)\n || (Array.isArray(data) && data.length === 0)) {\n return data;\n }\n if (typeof data === 'number'\n || typeof data === 'boolean'\n || data !== null) {\n data = [{a: data}];\n }\n if (typeof data === 'function') {\n i = data.apply(self.intf, [function (d) {\n self.normalizeDataset(d);\n }]);\n if (i) {\n self.normalizeDataset(i);\n }\n }\n if (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][self.integerToAlpha(x).toUpperCase()] = 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.');\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;\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 // width cannot be determined correctly until after inserted into the dom?\n requestAnimationFrame(function () {\n self.fitColumnToValues('cornerCell');\n });\n if (!self.resize()) { 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.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 = 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 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 self.contextMenu.dispose();\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 ['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 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 * Used during testing to asertain a given pixel color on the canvas.\n * @memberof canvasDataGrid\n * @name assertPxColor\n * @method\n * @param {number} x The x coordinate of the pixel to check.\n * @param {number} x The y coordinate of the pixel to check.\n * @param {string} [expected] The expected joined rgba color string (e.g.: `rgba(225, 225, 225, 255)`).\n * @param {method} [callback] Callback method if any to be called 1 ms after the completion of this otherwise sync task.\n */\n self.assertPxColor = function (x, y, expected, callback) {\n var d = self.ctx.getImageData(x, y, 1, 1).data;\n d = 'rgb(' + [d['0'], d['1'], d['2']].join(', ') + ')';\n if (expected) {\n if (d !== expected) {\n throw new Error('Expected color ' + expected + ' but got color ' + d);\n }\n }\n if (callback) {\n setTimeout(function () {\n callback();\n }, 1);\n }\n return d;\n };\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} rowIndex The column to insert into the schema.\n * @param {number} index The index of the row 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 self.intf.schema = s.splice(index, 0, c);\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 self.intf.schema = s.splice(index, 1);\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.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.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.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 (self.coulumn === undefined && value === undefined) {\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 (self.dragAddToSelection === true) {\n if (ctrl && self.isColumnSelected(columnIndex)) {\n removeCol(columnIndex);\n } else {\n addCol(columnIndex);\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 * Selects a row.\n * @memberof canvasDataGrid\n * @name selectRow\n * @method\n * @param {number} rowIndex The row index to select.\n * @param {boolean} toggleSelectMode When true, behaves as if you were holding control/command when you clicked the row.\n * @param {boolean} supressSelectionchangedEvent When true, prevents the selectionchanged event from firing.\n */\n self.selectRow = function (rowIndex, ctrl, supressEvent) {\n var s = self.getSchema();\n if (self.dragAddToSelection === false) {\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) {\n self.selections[rowIndex] = [];\n self.selections[rowIndex].push(-1);\n s.forEach(function (col) {\n self.selections[rowIndex].push(col.index);\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) {\n self.sizes.columns[name === 'cornerCell' ? name : self.getHeaderByName(name)[self.uniqueId]]\n = self.findColumnMaxTextLength(name);\n self.resize();\n self.draw(true);\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 {bool} dontSetStorageData Don't store this setting for future use.\n */\n self.order = function (columnName, direction, 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 = 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: key,\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 99ad7539..deb45811 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,M="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=Array.isArray(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-T),void 0===q&&(q=e.style.columnWidth),T+q+e.style.cellBorderWidth<0&&(T+=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=T,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:M,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[k[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),m=!0),x.grid=e.childGrids[x.gridId],x.grid.parentNode=x,x.grid.visible=!0,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&&(R=x),O&&!S&&(e.selections[x.rowIndex-1]&&-1!==e.selections[x.rowIndex-1].indexOf(x.columnIndex)&&0!==x.rowIndex||x.isHeader||A.push([x,"t"]),e.selections[x.rowIndex+1]&&-1!==e.selections[x.rowIndex+1].indexOf(x.columnIndex)||A.push([x,"b"]),e.selections[x.rowIndex]&&0!==x.columnIndex&&-1!==e.selections[x.rowIndex].indexOf(x.columnIndex-1)||A.push([x,"l"]),e.selections[x.rowIndex]&&x.columnIndex!==E.length&&-1!==e.selections[x.rowIndex].indexOf(x.columnIndex+1)||A.push([x,"r"])),e.ctx.restore(),T+=x.width+e.style.cellBorderWidth,x.width}}function x(t,o,r){var n;e.attributes.showRowHeaders&&(T=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(k=e.data[t],B=e.openChildren[k[e.uniqueId]],l=e.sizes.rows[k[e.uniqueId]]||e.style.cellHeight,n=B?e.sizes.trees[k[e.uniqueId]]:0,I=l+n,H<-1*I)return!1;for(e.attributes.showRowHeaders&&(T+=j),N=I,i=e.scrollIndexLeft;ie.width));i+=1);return N=I,T=-1*e.scrollBox.scrollLeft+e.scrollPixelLeft+e.style.cellBorderWidth,b=e.childGrids[k[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:T,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[k[e.uniqueId]]),P.push([k,t,o,H,I]),H+=N+e.style.cellBorderWidth,!0}if((e.isChildGrid||e.height&&e.width)&&!1!==e.intf.visible){var m,y,v,w,C,b,B,I,S,H,T,M,O,L,E,z,k,R,A=[],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(T=-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,A.forEach(function(e){c(e[0],e[1])})}(),function(){R&&(e.attributes.rowSelectionMode?e.activeCell&&e.activeCell.rowIndex===R.rowIndex&&(e.ctx.lineWidth=e.style.activeCellOverlayBorderWidth,e.ctx.strokeStyle=e.style.activeCellOverlayBorderColor,s(0,R.y,e.getHeaderWidth()+j,I)):(e.ctx.lineWidth=e.style.activeCellOverlayBorderWidth,e.ctx.strokeStyle=e.style.activeCellOverlayBorderColor,s(R.x,R.y,R.width,R.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(T=-1*e.scrollBox.scrollLeft+e.scrollPixelLeft,e.attributes.showRowHeaders&&(T+=j),H=0,N=e.getRowHeaderCellHeight(),r=e.scrollIndexLeft;re.width+e.scrollBox.scrollLeft));r+=1);T1||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[o[e.scrollIndexLeft][e.uniqueId]]||o[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={},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,!0):!e.dragAddToSelection&&u.rowIndex?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.selections[u.rowIndex]=e.selections[u.rowIndex]||[],-1===e.selections[u.rowIndex].indexOf(u.columnIndex)&&e.selections[u.rowIndex].push(u.columnIndex))),!(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,!0);else e.selectArea(l,!0);e.autoScrollZone(t,c,d,s)}e.cellBoundaryCrossed=!1,e.draw(!0)}}},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){function r(){var r,s;l=e.getVisibleCellByIndex(t,o),l.header.enum?(e.input=document.createElement("select"),"function"==typeof l.header.enum?n=l.header.enum.apply(e.intf,[{cell:l}]):Array.isArray(l.header.enum)&&(n=l.header.enum),n.forEach(function(t){var o,r,n=document.createElement("option");Array.isArray(t)?(o=t[0],r=t[1]):(o=t,r=t),o===l.value&&(s=!0),n.value=o,n.innerHTML=r,e.input.appendChild(n)}),s||(r=document.createElement("option"),r.value=l.value,r.innerHTML=l.value,e.input.appendChild(r)),e.input.addEventListener("change",function(){e.endEdit(),e.draw(!0)})):e.input=document.createElement(e.attributes.multiLine?"textarea":"input"),document.body.appendChild(e.input),e.createInlineStyle(e.input,"canvas-datagrid-edit-input"),e.input.style.position="absolute",e.input.editCell=l,e.resizeEditInput(),e.input.style.zIndex="2",e.input.value=l.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=l.columnIndex,r=l.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=i.length-1,r-=1),o>i.length-1&&(o=0,r+=1),r<0&&(r=e.data.length-1),r>e.data.length-1&&(r=0),e.beginEditAt(o,r)}})}if(e.attributes.editable){var n,l=e.getVisibleCellByIndex(t,o),i=e.getVisibleSchema();if(e.dispatchEvent("beforebeginedit",{cell:l}))return!1;e.scrollIntoView(t,o),e.setActiveCell(t,o),requestAnimationFrame(r),e.dispatchEvent("beginedit",{cell:l,input:e.input})}},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.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,!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.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,!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),"Tab"===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,!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){i!==n&&(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.createNewRowData=function(){e.newRow={},e.newRow[e.uniqueId]=e.uId,e.uId+=1,e.getSchema().forEach(function(t,o){var r=t.defaultValue||"";"function"==typeof r&&(r=r.apply(e.intf,[t,o])),e.newRow[t.name]=r})},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.getFontHeightLong=function(e){var t,o,r,n,l,i,s=document.createElement("canvas"),a=s.getContext("2d");for(s.height=5e3,s.width=5e3,a.save(),a.fillRect(0,0,s.width,s.height),a.textBaseline="top",a.fillStyle="white",a.font=e,a.fillText("gM",0,0),t=a.getImageData(0,0,s.width,s.height).data,o=-1,r=-1,n=0;n0&&(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(),requestAnimationFrame(function(){e.fitColumnToValues("cornerCell")}),e.resize()||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.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=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);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.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"],["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.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.assertPxColor=function(t,o,r,n){var l=e.ctx.getImageData(t,o,1,1).data;if(l="rgb("+[l[0],l[1],l[2]].join(", ")+")",r&&l!==r)throw new Error("Expected color "+r+" but got color "+l);return n&&setTimeout(function(){n()},1),l},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),!0===e.dragAddToSelection&&(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){var n=e.getSchema();if(!1===e.dragAddToSelection&&e.selections[t]&&e.selections[t].length-1===n.length&&o)return void(e.selections[t]=[]);!0===e.dragAddToSelection&&(e.selections[t]=[],e.selections[t].push(-1),n.forEach(function(o){e.selections[t].push(o.index)})),r||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:t,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,M="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=Array.isArray(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-T),void 0===q&&(q=e.style.columnWidth),T+q+e.style.cellBorderWidth<0&&(T+=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=T,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:M,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[k[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),m=!0),x.grid=e.childGrids[x.gridId],x.grid.parentNode=x,x.grid.visible=!0,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&&(R=x),O&&!S&&(e.selections[x.rowIndex-1]&&-1!==e.selections[x.rowIndex-1].indexOf(x.columnIndex)&&0!==x.rowIndex||x.isHeader||A.push([x,"t"]),e.selections[x.rowIndex+1]&&-1!==e.selections[x.rowIndex+1].indexOf(x.columnIndex)||A.push([x,"b"]),e.selections[x.rowIndex]&&0!==x.columnIndex&&-1!==e.selections[x.rowIndex].indexOf(x.columnIndex-1)||A.push([x,"l"]),e.selections[x.rowIndex]&&x.columnIndex!==E.length&&-1!==e.selections[x.rowIndex].indexOf(x.columnIndex+1)||A.push([x,"r"])),e.ctx.restore(),T+=x.width+e.style.cellBorderWidth,x.width}}function x(t,o,r){var n;e.attributes.showRowHeaders&&(T=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(k=e.data[t],B=e.openChildren[k[e.uniqueId]],l=e.sizes.rows[k[e.uniqueId]]||e.style.cellHeight,n=B?e.sizes.trees[k[e.uniqueId]]:0,I=l+n,H<-1*I)return!1;for(e.attributes.showRowHeaders&&(T+=j),N=I,i=e.scrollIndexLeft;ie.width));i+=1);return N=I,T=-1*e.scrollBox.scrollLeft+e.scrollPixelLeft+e.style.cellBorderWidth,b=e.childGrids[k[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:T,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[k[e.uniqueId]]),P.push([k,t,o,H,I]),H+=N+e.style.cellBorderWidth,!0}if(!e.dispatchEvent("beforedraw",{})&&(e.isChildGrid||e.height&&e.width)&&!1!==e.intf.visible){var m,y,v,w,C,b,B,I,S,H,T,M,O,L,E,z,k,R,A=[],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(T=-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,A.forEach(function(e){c(e[0],e[1])})}(),function(){R&&(e.attributes.rowSelectionMode?e.activeCell&&e.activeCell.rowIndex===R.rowIndex&&(e.ctx.lineWidth=e.style.activeCellOverlayBorderWidth,e.ctx.strokeStyle=e.style.activeCellOverlayBorderColor,s(0,R.y,e.getHeaderWidth()+j,I)):(e.ctx.lineWidth=e.style.activeCellOverlayBorderWidth,e.ctx.strokeStyle=e.style.activeCellOverlayBorderColor,s(R.x,R.y,R.width,R.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(T=-1*e.scrollBox.scrollLeft+e.scrollPixelLeft,e.attributes.showRowHeaders&&(T+=j),H=0,N=e.getRowHeaderCellHeight(),r=e.scrollIndexLeft;re.width+e.scrollBox.scrollLeft));r+=1);T1||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[o[e.scrollIndexLeft][e.uniqueId]]||o[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={},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,!0):!e.dragAddToSelection&&u.rowIndex?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.selections[u.rowIndex]=e.selections[u.rowIndex]||[],-1===e.selections[u.rowIndex].indexOf(u.columnIndex)&&e.selections[u.rowIndex].push(u.columnIndex))),!(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,!0);else e.selectArea(l,!0);e.autoScrollZone(t,c,d,s)}e.cellBoundaryCrossed=!1,e.draw(!0)}}},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){function r(){var r,s;l=e.getVisibleCellByIndex(t,o),l.header.enum?(e.input=document.createElement("select"),"function"==typeof l.header.enum?n=l.header.enum.apply(e.intf,[{cell:l}]):Array.isArray(l.header.enum)&&(n=l.header.enum),n.forEach(function(t){var o,r,n=document.createElement("option");Array.isArray(t)?(o=t[0],r=t[1]):(o=t,r=t),o===l.value&&(s=!0),n.value=o,n.innerHTML=r,e.input.appendChild(n)}),s||(r=document.createElement("option"),r.value=l.value,r.innerHTML=l.value,e.input.appendChild(r)),e.input.addEventListener("change",function(){e.endEdit(),e.draw(!0)})):e.input=document.createElement(e.attributes.multiLine?"textarea":"input"),document.body.appendChild(e.input),e.createInlineStyle(e.input,"canvas-datagrid-edit-input"),e.input.style.position="absolute",e.input.editCell=l,e.resizeEditInput(),e.input.style.zIndex="2",e.input.value=l.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=l.columnIndex,r=l.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=i.length-1,r-=1),o>i.length-1&&(o=0,r+=1),r<0&&(r=e.data.length-1),r>e.data.length-1&&(r=0),e.beginEditAt(o,r)}})}if(e.attributes.editable){var n,l=e.getVisibleCellByIndex(t,o),i=e.getVisibleSchema();if(e.dispatchEvent("beforebeginedit",{cell:l}))return!1;e.scrollIntoView(t,o),e.setActiveCell(t,o),requestAnimationFrame(r),e.dispatchEvent("beginedit",{cell:l,input:e.input})}},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.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,!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.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,!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),"Tab"===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,!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){i!==n&&(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.createNewRowData=function(){e.newRow={},e.newRow[e.uniqueId]=e.uId,e.uId+=1,e.getSchema().forEach(function(t,o){var r=t.defaultValue||"";"function"==typeof r&&(r=r.apply(e.intf,[t,o])),e.newRow[t.name]=r})},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.getFontHeightLong=function(e){var t,o,r,n,l,i,s=document.createElement("canvas"),a=s.getContext("2d");for(s.height=5e3,s.width=5e3,a.save(),a.fillRect(0,0,s.width,s.height),a.textBaseline="top",a.fillStyle="white",a.font=e,a.fillText("gM",0,0),t=a.getImageData(0,0,s.width,s.height).data,o=-1,r=-1,n=0;n0&&(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(),requestAnimationFrame(function(){e.fitColumnToValues("cornerCell")}),e.resize()||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.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=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);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.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"],["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.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.assertPxColor=function(t,o,r,n){var l=e.ctx.getImageData(t,o,1,1).data;if(l="rgb("+[l[0],l[1],l[2]].join(", ")+")",r&&l!==r)throw new Error("Expected color "+r+" but got color "+l);return n&&setTimeout(function(){n()},1),l},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),!0===e.dragAddToSelection&&(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){var n=e.getSchema();if(!1===e.dragAddToSelection&&e.selections[t]&&e.selections[t].length-1===n.length&&o)return void(e.selections[t]=[]);!0===e.dragAddToSelection&&(e.selections[t]=[],e.selections[t].push(-1),n.forEach(function(o){e.selections[t].push(o.index)})),r||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:t,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 8c79a270..c816d5d2 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 c8ee75ea9c933ee82be8","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","isArray","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","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","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","requestAnimationFrame","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","input","scrollOffset","bx2","getVisibleCellByIndex","editCell","cellPaddingLeft","clipElement","scroll","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","endEdit","abort","abortEdit","newValue","oldValue","changes","defaultValue","aborted","uId","addRow","createNewRowData","removeChild","controlInput","focus","postDraw","option","valueInEnum","enum","createElement","enumItems","appendChild","multiLine","createInlineStyle","position","zIndex","nx","ny","keyCode","editable","scrollIntoView","setActiveCell","checkSelectionChange","selectionChanged","selectedData","getSelectedData","setFilter","columnHeaderClickBehavior","selectColumn","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","keydown","last","cols","selectAll","selectionFollowsActiveCell","keyup","keypress","dblclick","fitColumnToValues","autosize","scrollWheel","deltaY","deltaX","copy","clipboardData","sData","setData","storageName","invalidSearchExpClass","localStyleLibraryStorageKey","filters","currentFilter","sorters","schemaHashes","expandToRow","col","ignoreScrollOffset","fillArray","low","high","step","columnHeaderCellHeight","localStorage","setItem","JSON","stringify","schema","tempSchema","createColumnOrders","filter","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","eventParent","observer","disconnect","tryLoadStoredOrders","storedSettings","getHeaderByName","getFontHeight","fontStyle","parseFloat","getFontHeightLong","pixels","start","end","getContext","textBaseline","getImageData","log","parseFont","publicStyleKeyIntf","initScrollBox","setDom","appendTo","clearChangeLog","gotoCell","gotoRow","findColumnScrollLeft","findRowScrollTop","findColumnMaxTextLength","disposeContextMenu","isCellVisible","getSchemaFromData","expandTree","collapseTree","insertRow","deleteRow","insertColumn","deleteColumn","addColumn","setRowHeight","setColumnWidth","resetColumnWidths","resetRowHeights","assertPxColor","integerToAlpha","set","filterFor","filterRegExp","invalidFilterRegEx","RegExp","number","getItem","parse","blur","normalizeDataset","toUpperCase","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","addContent","content","childContextMenuArrowHTML","clickIndex","Event","checkArrowVisibility","upArrow","downArrow","startHoverScroll","contextHoverScrollAmount","hoverScrollTimeout","contextHoverScrollRateMs","endHoverScroll","selectedIndex","loc","zIndexTop","color","contextMenuArrowColor","el","textAlign","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","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","MutationObserver","mutations","mutation","observe","expected","callback","ordA","charCodeAt","ordZ","len","String","fromCharCode","floor","colIndex","applyFilter","coulumn","isColumnSelected","colIsSelected","shift","supressEvent","addCol","rowId","childGrid","treeGridHeight","direction","dontSetStorageData","sort","useTouchScrollZones","tsz","touchScrollZone","isVerticalScrollBar","isHorizontalScrollBar","borderResizeZone","allowColumnResize","allowColumnResizeFromCell","allowRowHeaderResize","allowRowResize","allowRowResizeFromCell","maxCol","minCol"," ","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,EAASM,GE7EjC,GAAAyB,GAAAC,CAEAD,IACAzB,EAAA,GACAA,EAAA,GACAA,EAAA,GACAA,EAAA,GACAA,EAAA,GACAA,EAAA,GACAA,EAAA,QAoBC2B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jH,KAAAS,OACAC,MAAAuG,EAAAjH,KAAAU,OACiB0kB,GACjBhS,SAAAE,iBAAA,QAAA1U,EAAAqkB,oBACA7R,EAAAsB,sBAKCnT,MAAA/C,EAAA+B,MAAA9B,EAAAD,QAAAgC,INsjGK,SAAU/B,EAAQD,EAASM,GOzgHjC,GAAAyB,GAAAC,CAEAD,UAkOCE,MAlODD,EAAA,WACA,YACA,iBAAAI,GACAA,EAAAoiB,UACAtY,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,yBAEAwY,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,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,6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A,GAAAgC,GAAA,QAAAhC,CACA,iBAAA9lB,EAAA3H,GACA,WAAAzE,KAAAoM,EAAA8U,IAAA,OAAA9U,EAAA8U,GACA,MAEAlhB,KAAAyE,EAAAyc,IAAA,OAAAzc,EAAAyc,GACA,EAEAgT,EACA9nB,EAAA8U,GAAAiT,cACA/nB,EAAA8U,GAAAiT,cAAA1vB,EAAAyc,IADuD,EAGvDzc,EAAAyc,GAAAiT,cACA1vB,EAAAyc,GAAAiT,cAAA/nB,EAAA8U,IADmD,IAInD/gB,EAAA0f,QAAAgG,OAAA,SAAA3E,EAAAgR,GACA,GAAAgC,GAAA,QAAAhC,CACA,iBAAA9lB,EAAA3H,GACA,MAAAyvB,GACA9nB,EAAA8U,GAAAzc,EAAAyc,GAEAzc,EAAAyc,GAAA9U,EAAA8U,KAGA/gB,EAAA0f,QAAAuU,KAAA,SAAAlT,EAAAgR,GACA,GAAAgC,GAAA,QAAAhC,CACA,iBAAA9lB,EAAA3H,GACA,MAAAyvB,GACA,GAAAG,MAAAjoB,EAAA8U,IAAAoT,UACA,GAAAD,MAAA5vB,EAAAyc,IAAAoT,UAEA,GAAAD,MAAA5vB,EAAAyc,IAAAoT,UACA,GAAAD,MAAAjoB,EAAA8U,IAAAoT,cAICxzB,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.isChildGrid && (!self.height || !self.width)) {\n return;\n }\n // if something asked a child to draw, ask the parent to draw, unless it was the parent that asked... then.. idk... stack overflow!\n // if (self.isChildGrid && internal) {\n // 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 = Array.isArray(d[header.name]),\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 checkScrollHeight = true;\n }\n cell.grid = self.childGrids[cell.gridId];\n cell.grid.parentNode = cell;\n cell.grid.visible = true;\n //cell.grid.resize(true);\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 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 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 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) {\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 self.draw(true);\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, true);\n } else {\n if (!self.dragAddToSelection && o.rowIndex) {\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, 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 /**\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 function postDraw() {\n var mEv, option, valueInEnum;\n cell = self.getVisibleCellByIndex(x, y);\n if (cell.header.enum) {\n self.input = document.createElement('select');\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 } else {\n self.input = document.createElement(self.attributes.multiLine ? 'textarea' : 'input');\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 requestAnimationFrame(postDraw);\n self.dispatchEvent('beginedit', {cell: cell, input: self.input});\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');\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, 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 document.exitPointerLock();\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, 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 === 'Tab') {\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, 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 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.createNewRowData = function () {\n self.newRow = {};\n self.newRow[self.uniqueId] = self.uId;\n self.uId += 1;\n self.getSchema().forEach(function forEachHeader(header, index) {\n var d = header.defaultValue || '';\n if (typeof d === 'function') {\n d = d.apply(self.intf, [header, index]);\n }\n self.newRow[header.name] = d;\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.getFontHeightLong = function (fontStyle) {\n var pixels,\n start,\n end,\n row,\n column,\n index,\n canvas = document.createElement('canvas'),\n ctx = canvas.getContext('2d');\n canvas.height = 5000;\n canvas.width = 5000;\n ctx.save();\n ctx.fillRect(0, 0, canvas.width, canvas.height);\n ctx.textBaseline = 'top';\n ctx.fillStyle = 'white';\n ctx.font = fontStyle;\n ctx.fillText('gM', 0, 0);\n pixels = ctx.getImageData(0, 0, canvas.width, canvas.height).data;\n start = -1;\n end = -1;\n for (row = 0; row < canvas.height; row += 1) {\n for (column = 0; column < canvas.width; column += 1) {\n index = (row * canvas.width + column) * 4;\n if (pixels[index] === 0) {\n if (column === canvas.width - 1 && start !== -1) {\n end = row;\n row = canvas.height;\n break;\n }\n } else {\n if (start === -1) {\n start = row;\n }\n break;\n }\n }\n }\n ctx.restore();\n console.log(end - start);\n return end - start;\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.init = function () {\n var publicStyleKeyIntf = {};\n self.setAttributes();\n self.setStyle();\n self.initScrollBox();\n self.setDom();\n Object.keys(self.style).forEach(self.parseFont);\n self.intf.type = 'canvas-datagrid';\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.drawChildGrids = self.drawChildGrids;\n self.intf.assertPxColor = self.assertPxColor;\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, '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 if (self.args.data) {\n self.intf.data = self.args.data;\n }\n if (self.args.schema) {\n self.intf.schema = self.args.schema;\n }\n if (!self.data) {\n self.intf.data = [];\n }\n self.resize(true);\n };\n self.intf.blur = function (e) {\n self.hasFocus = false;\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;\n if (data === null || data === '' || data === undefined) {\n return [];\n }\n if ((typeof data[0] === 'object' && data[0] !== null)\n || (Array.isArray(data) && data.length === 0)) {\n return data;\n }\n if (typeof data === 'number'\n || typeof data === 'boolean'\n || data !== null) {\n data = [{a: data}];\n }\n if (typeof data === 'function') {\n i = data.apply(self.intf, [function (d) {\n self.normalizeDataset(d);\n }]);\n if (i) {\n self.normalizeDataset(i);\n }\n }\n if (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][self.integerToAlpha(x).toUpperCase()] = 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.');\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;\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 // width cannot be determined correctly until after inserted into the dom?\n requestAnimationFrame(function () {\n self.fitColumnToValues('cornerCell');\n });\n if (!self.resize()) { 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.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 = 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 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 self.contextMenu.dispose();\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 ['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 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 * Used during testing to asertain a given pixel color on the canvas.\n * @memberof canvasDataGrid\n * @name assertPxColor\n * @method\n * @param {number} x The x coordinate of the pixel to check.\n * @param {number} x The y coordinate of the pixel to check.\n * @param {string} [expected] The expected joined rgba color string (e.g.: `rgba(225, 225, 225, 255)`).\n * @param {method} [callback] Callback method if any to be called 1 ms after the completion of this otherwise sync task.\n */\n self.assertPxColor = function (x, y, expected, callback) {\n var d = self.ctx.getImageData(x, y, 1, 1).data;\n d = 'rgb(' + [d['0'], d['1'], d['2']].join(', ') + ')';\n if (expected) {\n if (d !== expected) {\n throw new Error('Expected color ' + expected + ' but got color ' + d);\n }\n }\n if (callback) {\n setTimeout(function () {\n callback();\n }, 1);\n }\n return d;\n };\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} rowIndex The column to insert into the schema.\n * @param {number} index The index of the row 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 self.intf.schema = s.splice(index, 0, c);\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 self.intf.schema = s.splice(index, 1);\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.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.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.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 (self.coulumn === undefined && value === undefined) {\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 (self.dragAddToSelection === true) {\n if (ctrl && self.isColumnSelected(columnIndex)) {\n removeCol(columnIndex);\n } else {\n addCol(columnIndex);\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 * Selects a row.\n * @memberof canvasDataGrid\n * @name selectRow\n * @method\n * @param {number} rowIndex The row index to select.\n * @param {boolean} toggleSelectMode When true, behaves as if you were holding control/command when you clicked the row.\n * @param {boolean} supressSelectionchangedEvent When true, prevents the selectionchanged event from firing.\n */\n self.selectRow = function (rowIndex, ctrl, supressEvent) {\n var s = self.getSchema();\n if (self.dragAddToSelection === false) {\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) {\n self.selections[rowIndex] = [];\n self.selections[rowIndex].push(-1);\n s.forEach(function (col) {\n self.selections[rowIndex].push(col.index);\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) {\n self.sizes.columns[name === 'cornerCell' ? name : self.getHeaderByName(name)[self.uniqueId]]\n = self.findColumnMaxTextLength(name);\n self.resize();\n self.draw(true);\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 {bool} dontSetStorageData Don't store this setting for future use.\n */\n self.order = function (columnName, direction, 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 = 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: key,\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 c8ee75ea9c933ee82be8","/*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.isChildGrid && (!self.height || !self.width)) {\n return;\n }\n // if something asked a child to draw, ask the parent to draw, unless it was the parent that asked... then.. idk... stack overflow!\n // if (self.isChildGrid && internal) {\n // 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 = Array.isArray(d[header.name]),\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 checkScrollHeight = true;\n }\n cell.grid = self.childGrids[cell.gridId];\n cell.grid.parentNode = cell;\n cell.grid.visible = true;\n //cell.grid.resize(true);\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 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 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 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) {\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 self.draw(true);\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, true);\n } else {\n if (!self.dragAddToSelection && o.rowIndex) {\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, 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 /**\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 function postDraw() {\n var mEv, option, valueInEnum;\n cell = self.getVisibleCellByIndex(x, y);\n if (cell.header.enum) {\n self.input = document.createElement('select');\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 } else {\n self.input = document.createElement(self.attributes.multiLine ? 'textarea' : 'input');\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 requestAnimationFrame(postDraw);\n self.dispatchEvent('beginedit', {cell: cell, input: self.input});\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');\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, 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 document.exitPointerLock();\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, 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 === 'Tab') {\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, 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 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.createNewRowData = function () {\n self.newRow = {};\n self.newRow[self.uniqueId] = self.uId;\n self.uId += 1;\n self.getSchema().forEach(function forEachHeader(header, index) {\n var d = header.defaultValue || '';\n if (typeof d === 'function') {\n d = d.apply(self.intf, [header, index]);\n }\n self.newRow[header.name] = d;\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.getFontHeightLong = function (fontStyle) {\n var pixels,\n start,\n end,\n row,\n column,\n index,\n canvas = document.createElement('canvas'),\n ctx = canvas.getContext('2d');\n canvas.height = 5000;\n canvas.width = 5000;\n ctx.save();\n ctx.fillRect(0, 0, canvas.width, canvas.height);\n ctx.textBaseline = 'top';\n ctx.fillStyle = 'white';\n ctx.font = fontStyle;\n ctx.fillText('gM', 0, 0);\n pixels = ctx.getImageData(0, 0, canvas.width, canvas.height).data;\n start = -1;\n end = -1;\n for (row = 0; row < canvas.height; row += 1) {\n for (column = 0; column < canvas.width; column += 1) {\n index = (row * canvas.width + column) * 4;\n if (pixels[index] === 0) {\n if (column === canvas.width - 1 && start !== -1) {\n end = row;\n row = canvas.height;\n break;\n }\n } else {\n if (start === -1) {\n start = row;\n }\n break;\n }\n }\n }\n ctx.restore();\n console.log(end - start);\n return end - start;\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.init = function () {\n var publicStyleKeyIntf = {};\n self.setAttributes();\n self.setStyle();\n self.initScrollBox();\n self.setDom();\n Object.keys(self.style).forEach(self.parseFont);\n self.intf.type = 'canvas-datagrid';\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.drawChildGrids = self.drawChildGrids;\n self.intf.assertPxColor = self.assertPxColor;\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, '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 if (self.args.data) {\n self.intf.data = self.args.data;\n }\n if (self.args.schema) {\n self.intf.schema = self.args.schema;\n }\n if (!self.data) {\n self.intf.data = [];\n }\n self.resize(true);\n };\n self.intf.blur = function (e) {\n self.hasFocus = false;\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;\n if (data === null || data === '' || data === undefined) {\n return [];\n }\n if ((typeof data[0] === 'object' && data[0] !== null)\n || (Array.isArray(data) && data.length === 0)) {\n return data;\n }\n if (typeof data === 'number'\n || typeof data === 'boolean'\n || data !== null) {\n data = [{a: data}];\n }\n if (typeof data === 'function') {\n i = data.apply(self.intf, [function (d) {\n self.normalizeDataset(d);\n }]);\n if (i) {\n self.normalizeDataset(i);\n }\n }\n if (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][self.integerToAlpha(x).toUpperCase()] = 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.');\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;\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 // width cannot be determined correctly until after inserted into the dom?\n requestAnimationFrame(function () {\n self.fitColumnToValues('cornerCell');\n });\n if (!self.resize()) { 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.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 = 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 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 self.contextMenu.dispose();\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 ['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 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 * Used during testing to asertain a given pixel color on the canvas.\n * @memberof canvasDataGrid\n * @name assertPxColor\n * @method\n * @param {number} x The x coordinate of the pixel to check.\n * @param {number} x The y coordinate of the pixel to check.\n * @param {string} [expected] The expected joined rgba color string (e.g.: `rgba(225, 225, 225, 255)`).\n * @param {method} [callback] Callback method if any to be called 1 ms after the completion of this otherwise sync task.\n */\n self.assertPxColor = function (x, y, expected, callback) {\n var d = self.ctx.getImageData(x, y, 1, 1).data;\n d = 'rgb(' + [d['0'], d['1'], d['2']].join(', ') + ')';\n if (expected) {\n if (d !== expected) {\n throw new Error('Expected color ' + expected + ' but got color ' + d);\n }\n }\n if (callback) {\n setTimeout(function () {\n callback();\n }, 1);\n }\n return d;\n };\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} rowIndex The column to insert into the schema.\n * @param {number} index The index of the row 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 self.intf.schema = s.splice(index, 0, c);\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 self.intf.schema = s.splice(index, 1);\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.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.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.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 (self.coulumn === undefined && value === undefined) {\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 (self.dragAddToSelection === true) {\n if (ctrl && self.isColumnSelected(columnIndex)) {\n removeCol(columnIndex);\n } else {\n addCol(columnIndex);\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 * Selects a row.\n * @memberof canvasDataGrid\n * @name selectRow\n * @method\n * @param {number} rowIndex The row index to select.\n * @param {boolean} toggleSelectMode When true, behaves as if you were holding control/command when you clicked the row.\n * @param {boolean} supressSelectionchangedEvent When true, prevents the selectionchanged event from firing.\n */\n self.selectRow = function (rowIndex, ctrl, supressEvent) {\n var s = self.getSchema();\n if (self.dragAddToSelection === false) {\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) {\n self.selections[rowIndex] = [];\n self.selections[rowIndex].push(-1);\n s.forEach(function (col) {\n self.selections[rowIndex].push(col.index);\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) {\n self.sizes.columns[name === 'cornerCell' ? name : self.getHeaderByName(name)[self.uniqueId]]\n = self.findColumnMaxTextLength(name);\n self.resize();\n self.draw(true);\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 {bool} dontSetStorageData Don't store this setting for future use.\n */\n self.order = function (columnName, direction, 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 = 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: key,\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 63b798d27e1499ad1b7c","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","isArray","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","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","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","requestAnimationFrame","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","input","scrollOffset","bx2","getVisibleCellByIndex","editCell","cellPaddingLeft","clipElement","scroll","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","endEdit","abort","abortEdit","newValue","oldValue","changes","defaultValue","aborted","uId","addRow","createNewRowData","removeChild","controlInput","focus","postDraw","option","valueInEnum","enum","createElement","enumItems","appendChild","multiLine","createInlineStyle","position","zIndex","nx","ny","keyCode","editable","scrollIntoView","setActiveCell","checkSelectionChange","selectionChanged","selectedData","getSelectedData","setFilter","columnHeaderClickBehavior","selectColumn","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","keydown","last","cols","selectAll","selectionFollowsActiveCell","keyup","keypress","dblclick","fitColumnToValues","autosize","scrollWheel","deltaY","deltaX","copy","clipboardData","sData","setData","storageName","invalidSearchExpClass","localStyleLibraryStorageKey","filters","currentFilter","sorters","schemaHashes","expandToRow","col","ignoreScrollOffset","fillArray","low","high","step","columnHeaderCellHeight","localStorage","setItem","JSON","stringify","schema","tempSchema","createColumnOrders","filter","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","eventParent","observer","disconnect","tryLoadStoredOrders","storedSettings","getHeaderByName","getFontHeight","fontStyle","parseFloat","getFontHeightLong","pixels","start","end","getContext","textBaseline","getImageData","log","parseFont","publicStyleKeyIntf","initScrollBox","setDom","appendTo","clearChangeLog","gotoCell","gotoRow","findColumnScrollLeft","findRowScrollTop","findColumnMaxTextLength","disposeContextMenu","isCellVisible","getSchemaFromData","expandTree","collapseTree","insertRow","deleteRow","insertColumn","deleteColumn","addColumn","setRowHeight","setColumnWidth","resetColumnWidths","resetRowHeights","assertPxColor","integerToAlpha","set","filterFor","filterRegExp","invalidFilterRegEx","RegExp","number","getItem","parse","blur","normalizeDataset","toUpperCase","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","addContent","content","childContextMenuArrowHTML","clickIndex","Event","checkArrowVisibility","upArrow","downArrow","startHoverScroll","contextHoverScrollAmount","hoverScrollTimeout","contextHoverScrollRateMs","endHoverScroll","selectedIndex","loc","zIndexTop","color","contextMenuArrowColor","el","textAlign","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","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","MutationObserver","mutations","mutation","observe","expected","callback","ordA","charCodeAt","ordZ","len","String","fromCharCode","floor","colIndex","applyFilter","coulumn","isColumnSelected","colIsSelected","shift","supressEvent","addCol","rowId","childGrid","treeGridHeight","direction","dontSetStorageData","sort","useTouchScrollZones","tsz","touchScrollZone","isVerticalScrollBar","isHorizontalScrollBar","borderResizeZone","allowColumnResize","allowColumnResizeFromCell","allowRowHeaderResize","allowRowResize","allowRowResizeFromCell","maxCol","minCol"," ","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,GAAA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A,sBACA,+BACA,yBACA,mDACA,qDACA,uDACA,iDACA,iCACA,mCACA,wCACA,gCACA,oBACA,0BACA,uBACA,oBACA,gBACA,qCACA,yBAEAwY,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,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,iCACA,+BACA,gCACA,8BACA,kEACA,qDACA,4CACA,0BACA,kDACA,sDACA,kDACA,4BACA,mCACA,+CACA,yBACA,2BACA,wBACA,4DACA,wDACA,sBACA,wDACA,oCACA,kDACA,2BACA,2BACA,4CACA,sBACA,0BACA,2BACA,yBACA,sBACA,0BAIC3hB,MAAA/C,EAAA+B,MAAA9B,EAAAD,QAAAgC,IPkhHK,SAAU/B,EAAQD,EAASM,GQtvHjC,GAAAyB,GAAAC,CAEAD,UAsNCE,MAt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AAAyc,GAAA9U,EAAA8U,KAGA/gB,EAAA0f,QAAAuU,KAAA,SAAAlT,EAAAgR,GACA,GAAAgC,GAAA,QAAAhC,CACA,iBAAA9lB,EAAA3H,GACA,MAAAyvB,GACA,GAAAG,MAAAjoB,EAAA8U,IAAAoT,UACA,GAAAD,MAAA5vB,EAAAyc,IAAAoT,UAEA,GAAAD,MAAA5vB,EAAAyc,IAAAoT,UACA,GAAAD,MAAAjoB,EAAA8U,IAAAoT,cAICxzB,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 something asked a child to draw, ask the parent to draw, unless it was the parent that asked... then.. idk... stack overflow!\n // if (self.isChildGrid && internal) {\n // 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 = Array.isArray(d[header.name]),\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 checkScrollHeight = true;\n }\n cell.grid = self.childGrids[cell.gridId];\n cell.grid.parentNode = cell;\n cell.grid.visible = true;\n //cell.grid.resize(true);\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 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 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 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) {\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 self.draw(true);\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, true);\n } else {\n if (!self.dragAddToSelection && o.rowIndex) {\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, 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 /**\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 function postDraw() {\n var mEv, option, valueInEnum;\n cell = self.getVisibleCellByIndex(x, y);\n if (cell.header.enum) {\n self.input = document.createElement('select');\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 } else {\n self.input = document.createElement(self.attributes.multiLine ? 'textarea' : 'input');\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 requestAnimationFrame(postDraw);\n self.dispatchEvent('beginedit', {cell: cell, input: self.input});\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');\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, 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 document.exitPointerLock();\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, 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 === 'Tab') {\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, 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 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.createNewRowData = function () {\n self.newRow = {};\n self.newRow[self.uniqueId] = self.uId;\n self.uId += 1;\n self.getSchema().forEach(function forEachHeader(header, index) {\n var d = header.defaultValue || '';\n if (typeof d === 'function') {\n d = d.apply(self.intf, [header, index]);\n }\n self.newRow[header.name] = d;\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.getFontHeightLong = function (fontStyle) {\n var pixels,\n start,\n end,\n row,\n column,\n index,\n canvas = document.createElement('canvas'),\n ctx = canvas.getContext('2d');\n canvas.height = 5000;\n canvas.width = 5000;\n ctx.save();\n ctx.fillRect(0, 0, canvas.width, canvas.height);\n ctx.textBaseline = 'top';\n ctx.fillStyle = 'white';\n ctx.font = fontStyle;\n ctx.fillText('gM', 0, 0);\n pixels = ctx.getImageData(0, 0, canvas.width, canvas.height).data;\n start = -1;\n end = -1;\n for (row = 0; row < canvas.height; row += 1) {\n for (column = 0; column < canvas.width; column += 1) {\n index = (row * canvas.width + column) * 4;\n if (pixels[index] === 0) {\n if (column === canvas.width - 1 && start !== -1) {\n end = row;\n row = canvas.height;\n break;\n }\n } else {\n if (start === -1) {\n start = row;\n }\n break;\n }\n }\n }\n ctx.restore();\n console.log(end - start);\n return end - start;\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.init = function () {\n var publicStyleKeyIntf = {};\n self.setAttributes();\n self.setStyle();\n self.initScrollBox();\n self.setDom();\n Object.keys(self.style).forEach(self.parseFont);\n self.intf.type = 'canvas-datagrid';\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.drawChildGrids = self.drawChildGrids;\n self.intf.assertPxColor = self.assertPxColor;\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, '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 if (self.args.data) {\n self.intf.data = self.args.data;\n }\n if (self.args.schema) {\n self.intf.schema = self.args.schema;\n }\n if (!self.data) {\n self.intf.data = [];\n }\n self.resize(true);\n };\n self.intf.blur = function (e) {\n self.hasFocus = false;\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;\n if (data === null || data === '' || data === undefined) {\n return [];\n }\n if ((typeof data[0] === 'object' && data[0] !== null)\n || (Array.isArray(data) && data.length === 0)) {\n return data;\n }\n if (typeof data === 'number'\n || typeof data === 'boolean'\n || data !== null) {\n data = [{a: data}];\n }\n if (typeof data === 'function') {\n i = data.apply(self.intf, [function (d) {\n self.normalizeDataset(d);\n }]);\n if (i) {\n self.normalizeDataset(i);\n }\n }\n if (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][self.integerToAlpha(x).toUpperCase()] = 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.');\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;\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 // width cannot be determined correctly until after inserted into the dom?\n requestAnimationFrame(function () {\n self.fitColumnToValues('cornerCell');\n });\n if (!self.resize()) { 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.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 = 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 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 self.contextMenu.dispose();\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 ['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 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 * Used during testing to asertain a given pixel color on the canvas.\n * @memberof canvasDataGrid\n * @name assertPxColor\n * @method\n * @param {number} x The x coordinate of the pixel to check.\n * @param {number} x The y coordinate of the pixel to check.\n * @param {string} [expected] The expected joined rgba color string (e.g.: `rgba(225, 225, 225, 255)`).\n * @param {method} [callback] Callback method if any to be called 1 ms after the completion of this otherwise sync task.\n */\n self.assertPxColor = function (x, y, expected, callback) {\n var d = self.ctx.getImageData(x, y, 1, 1).data;\n d = 'rgb(' + [d['0'], d['1'], d['2']].join(', ') + ')';\n if (expected) {\n if (d !== expected) {\n throw new Error('Expected color ' + expected + ' but got color ' + d);\n }\n }\n if (callback) {\n setTimeout(function () {\n callback();\n }, 1);\n }\n return d;\n };\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} rowIndex The column to insert into the schema.\n * @param {number} index The index of the row 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 self.intf.schema = s.splice(index, 0, c);\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 self.intf.schema = s.splice(index, 1);\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.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.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.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 (self.coulumn === undefined && value === undefined) {\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 (self.dragAddToSelection === true) {\n if (ctrl && self.isColumnSelected(columnIndex)) {\n removeCol(columnIndex);\n } else {\n addCol(columnIndex);\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 * Selects a row.\n * @memberof canvasDataGrid\n * @name selectRow\n * @method\n * @param {number} rowIndex The row index to select.\n * @param {boolean} toggleSelectMode When true, behaves as if you were holding control/command when you clicked the row.\n * @param {boolean} supressSelectionchangedEvent When true, prevents the selectionchanged event from firing.\n */\n self.selectRow = function (rowIndex, ctrl, supressEvent) {\n var s = self.getSchema();\n if (self.dragAddToSelection === false) {\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) {\n self.selections[rowIndex] = [];\n self.selections[rowIndex].push(-1);\n s.forEach(function (col) {\n self.selections[rowIndex].push(col.index);\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) {\n self.sizes.columns[name === 'cornerCell' ? name : self.getHeaderByName(name)[self.uniqueId]]\n = self.findColumnMaxTextLength(name);\n self.resize();\n self.draw(true);\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 {bool} dontSetStorageData Don't store this setting for future use.\n */\n self.order = function (columnName, direction, 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 = 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: key,\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 63b798d27e1499ad1b7c","/*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 something asked a child to draw, ask the parent to draw, unless it was the parent that asked... then.. idk... stack overflow!\n // if (self.isChildGrid && internal) {\n // 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 = Array.isArray(d[header.name]),\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 checkScrollHeight = true;\n }\n cell.grid = self.childGrids[cell.gridId];\n cell.grid.parentNode = cell;\n cell.grid.visible = true;\n //cell.grid.resize(true);\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 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 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 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) {\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 self.draw(true);\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, true);\n } else {\n if (!self.dragAddToSelection && o.rowIndex) {\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, 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 /**\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 function postDraw() {\n var mEv, option, valueInEnum;\n cell = self.getVisibleCellByIndex(x, y);\n if (cell.header.enum) {\n self.input = document.createElement('select');\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 } else {\n self.input = document.createElement(self.attributes.multiLine ? 'textarea' : 'input');\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 requestAnimationFrame(postDraw);\n self.dispatchEvent('beginedit', {cell: cell, input: self.input});\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');\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, 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 document.exitPointerLock();\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, 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 === 'Tab') {\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, 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 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.createNewRowData = function () {\n self.newRow = {};\n self.newRow[self.uniqueId] = self.uId;\n self.uId += 1;\n self.getSchema().forEach(function forEachHeader(header, index) {\n var d = header.defaultValue || '';\n if (typeof d === 'function') {\n d = d.apply(self.intf, [header, index]);\n }\n self.newRow[header.name] = d;\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.getFontHeightLong = function (fontStyle) {\n var pixels,\n start,\n end,\n row,\n column,\n index,\n canvas = document.createElement('canvas'),\n ctx = canvas.getContext('2d');\n canvas.height = 5000;\n canvas.width = 5000;\n ctx.save();\n ctx.fillRect(0, 0, canvas.width, canvas.height);\n ctx.textBaseline = 'top';\n ctx.fillStyle = 'white';\n ctx.font = fontStyle;\n ctx.fillText('gM', 0, 0);\n pixels = ctx.getImageData(0, 0, canvas.width, canvas.height).data;\n start = -1;\n end = -1;\n for (row = 0; row < canvas.height; row += 1) {\n for (column = 0; column < canvas.width; column += 1) {\n index = (row * canvas.width + column) * 4;\n if (pixels[index] === 0) {\n if (column === canvas.width - 1 && start !== -1) {\n end = row;\n row = canvas.height;\n break;\n }\n } else {\n if (start === -1) {\n start = row;\n }\n break;\n }\n }\n }\n ctx.restore();\n console.log(end - start);\n return end - start;\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.init = function () {\n var publicStyleKeyIntf = {};\n self.setAttributes();\n self.setStyle();\n self.initScrollBox();\n self.setDom();\n Object.keys(self.style).forEach(self.parseFont);\n self.intf.type = 'canvas-datagrid';\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.drawChildGrids = self.drawChildGrids;\n self.intf.assertPxColor = self.assertPxColor;\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, '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 if (self.args.data) {\n self.intf.data = self.args.data;\n }\n if (self.args.schema) {\n self.intf.schema = self.args.schema;\n }\n if (!self.data) {\n self.intf.data = [];\n }\n self.resize(true);\n };\n self.intf.blur = function (e) {\n self.hasFocus = false;\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;\n if (data === null || data === '' || data === undefined) {\n return [];\n }\n if ((typeof data[0] === 'object' && data[0] !== null)\n || (Array.isArray(data) && data.length === 0)) {\n return data;\n }\n if (typeof data === 'number'\n || typeof data === 'boolean'\n || data !== null) {\n data = [{a: data}];\n }\n if (typeof data === 'function') {\n i = data.apply(self.intf, [function (d) {\n self.normalizeDataset(d);\n }]);\n if (i) {\n self.normalizeDataset(i);\n }\n }\n if (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][self.integerToAlpha(x).toUpperCase()] = 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.');\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;\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 // width cannot be determined correctly until after inserted into the dom?\n requestAnimationFrame(function () {\n self.fitColumnToValues('cornerCell');\n });\n if (!self.resize()) { 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.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 = 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 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 self.contextMenu.dispose();\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 ['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 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 * Used during testing to asertain a given pixel color on the canvas.\n * @memberof canvasDataGrid\n * @name assertPxColor\n * @method\n * @param {number} x The x coordinate of the pixel to check.\n * @param {number} x The y coordinate of the pixel to check.\n * @param {string} [expected] The expected joined rgba color string (e.g.: `rgba(225, 225, 225, 255)`).\n * @param {method} [callback] Callback method if any to be called 1 ms after the completion of this otherwise sync task.\n */\n self.assertPxColor = function (x, y, expected, callback) {\n var d = self.ctx.getImageData(x, y, 1, 1).data;\n d = 'rgb(' + [d['0'], d['1'], d['2']].join(', ') + ')';\n if (expected) {\n if (d !== expected) {\n throw new Error('Expected color ' + expected + ' but got color ' + d);\n }\n }\n if (callback) {\n setTimeout(function () {\n callback();\n }, 1);\n }\n return d;\n };\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} rowIndex The column to insert into the schema.\n * @param {number} index The index of the row 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 self.intf.schema = s.splice(index, 0, c);\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 self.intf.schema = s.splice(index, 1);\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.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.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.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 (self.coulumn === undefined && value === undefined) {\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 (self.dragAddToSelection === true) {\n if (ctrl && self.isColumnSelected(columnIndex)) {\n removeCol(columnIndex);\n } else {\n addCol(columnIndex);\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 * Selects a row.\n * @memberof canvasDataGrid\n * @name selectRow\n * @method\n * @param {number} rowIndex The row index to select.\n * @param {boolean} toggleSelectMode When true, behaves as if you were holding control/command when you clicked the row.\n * @param {boolean} supressSelectionchangedEvent When true, prevents the selectionchanged event from firing.\n */\n self.selectRow = function (rowIndex, ctrl, supressEvent) {\n var s = self.getSchema();\n if (self.dragAddToSelection === false) {\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) {\n self.selections[rowIndex] = [];\n self.selections[rowIndex].push(-1);\n s.forEach(function (col) {\n self.selections[rowIndex].push(col.index);\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) {\n self.sizes.columns[name === 'cornerCell' ? name : self.getHeaderByName(name)[self.uniqueId]]\n = self.findColumnMaxTextLength(name);\n self.resize();\n self.draw(true);\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 {bool} dontSetStorageData Don't store this setting for future use.\n */\n self.order = function (columnName, direction, 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 = 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: key,\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/lib/draw.js b/lib/draw.js index 95498099..dd3d9174 100644 --- a/lib/draw.js +++ b/lib/draw.js @@ -196,6 +196,7 @@ define([], function () { * @method */ self.draw = function (internal) { + if (self.dispatchEvent('beforedraw', {})) { return; } if (!self.isChildGrid && (!self.height || !self.width)) { return; } @@ -900,6 +901,7 @@ define([], function () { } drawBorder(); drawDebug(); + if (self.dispatchEvent('afterdraw', {})) { return; } self.ctx.restore(); }; }; diff --git a/lib/publicMethods.js b/lib/publicMethods.js index 77e9343b..28676855 100644 --- a/lib/publicMethods.js +++ b/lib/publicMethods.js @@ -16,6 +16,8 @@ define([], function () { * @param {method} [callback] Callback method if any to be called 1 ms after the completion of this otherwise sync task. */ self.assertPxColor = function (x, y, expected, callback) { + x = x * window.devicePixelRatio; + y = y * window.devicePixelRatio; var d = self.ctx.getImageData(x, y, 1, 1).data; d = 'rgb(' + [d['0'], d['1'], d['2']].join(', ') + ')'; if (expected) { diff --git a/package.json b/package.json index 44b376d3..2edd5a63 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "canvas-datagrid", - "version": "0.14.2", + "version": "0.14.3", "description": "Canvas based data grid", "main": "./lib/main.js", "scripts": { @@ -53,13 +53,14 @@ }, "homepage": "https://github.com/TonyGermaneri/canvas-datagrid#readme", "devDependencies": { + "async": "^2.5.0", "ink-docstrap": "git+ssh://git@github.com:TonyGermaneri/docstrap.git#v1.2.6", - "node-coveralls": "git@github.com:nickmerwin/node-coveralls.git", "istanbul": "^0.4.5", "jsdoc": "^3.4.3", "mocha": "^3.5.0", "mocha-phantomjs": "^4.1.0", "mocha-phantomjs-core": "^2.1.2", + "node-coveralls": "git@github.com:nickmerwin/node-coveralls.git", "phantomjs": "^2.1.7", "should": "^11.2.1", "webpack": "^3.0.0" diff --git a/test/tests.html b/test/tests.html index bf3b653a..bb85f8da 100644 --- a/test/tests.html +++ b/test/tests.html @@ -21,6 +21,8 @@ + +