diff --git a/README.md b/README.md index 90f173a..64ca8dd 100644 --- a/README.md +++ b/README.md @@ -479,6 +479,9 @@ Pull Request should include source code (./scr) changes, may include tests (./te ## Change log +### v1.8.2 + * Fixed edge cases when removing items. + ### v1.8.1 * Removed deprecated bind/unbind methods. diff --git a/bower.json b/bower.json index d25e625..3f8938f 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "angular-ui-scroll", "description": "AngularJS infinite scrolling module", - "version": "1.8.1", + "version": "1.8.2", "main": "./dist/ui-scroll.js", "homepage": "https://github.com/angular-ui/ui-scroll.git", "license": "MIT", diff --git a/dist/ui-scroll-grid.js b/dist/ui-scroll-grid.js index c83c741..2fff64c 100644 --- a/dist/ui-scroll-grid.js +++ b/dist/ui-scroll-grid.js @@ -1,7 +1,7 @@ /*! * angular-ui-scroll * https://github.com/angular-ui/ui-scroll - * Version: 1.8.1 -- 2020-05-13T13:54:15.842Z + * Version: 1.8.2 -- 2020-10-02T15:06:03.904Z * License: MIT */ /******/ (function(modules) { // webpackBootstrap diff --git a/dist/ui-scroll-grid.js.map b/dist/ui-scroll-grid.js.map index e4b95e0..3b3ee49 100644 --- a/dist/ui-scroll-grid.js.map +++ b/dist/ui-scroll-grid.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/ui-scroll-grid.js"],"names":["angular","module","directive","console","$timeout","GridAdapter","controller","getLayout","applyLayout","layout","columnFromPoint","x","y","Object","defineProperty","get","getColumns","ColumnAdapter","column","css","attr","arguments","value","length","header","forEachRow","row","id","moveBefore","index","exchangeWith","ColumnController","columns","mapTo","extend","applyCss","target","moveLast","insidePoint","result","element","offset","left","outerWidth","top","outerHeight","detach","before","parent","append","removeAttr","hasOwnProperty","GridController","scrollViewport","rowMap","Map","adapter","publicContext","gridAdapter","transform","scope","item","registerColumn","push","registerCell","cell","set","unregisterCell","i","indexOf","splice","delete","callback","forEach","slice","sort","a","b","layouts","Error","map","selected","columnId","next","c","find","col","undefined","visible","require","restrict","link","$scope","$attr","controllers","gridController","tdInitializer","uiScrollTdInitializer","linking","$on","onLink"],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;AClFAA,OAAO,CAACC,MAAR,CAAe,gBAAf,EAAiC,EAAjC,EACGC,SADH,CACa,YADb,EAC2B,CAAC,MAAD,EAAS,UAAT,EAAqB,UAASC,OAAT,EAAkBC,QAAlB,EAA4B;AAExE,WAASC,WAAT,CAAqBC,UAArB,EAAiC;AAE/B,SAAKC,SAAL,GAAiB;AAAA,aAAMD,UAAU,CAACC,SAAX,EAAN;AAAA,KAAjB;;AAEA,SAAKC,WAAL,GAAmB,UAACC,MAAD;AAAA,aAAYH,UAAU,CAACE,WAAX,CAAuBC,MAAvB,CAAZ;AAAA,KAAnB;;AAEA,SAAKC,eAAL,GAAuB,UAACC,CAAD,EAAIC,CAAJ;AAAA,aAAUN,UAAU,CAACI,eAAX,CAA2BC,CAA3B,EAA8BC,CAA9B,CAAV;AAAA,KAAvB;;AAEAC,UAAM,CAACC,cAAP,CAAsB,IAAtB,EAA4B,SAA5B,EAAuC;AAAEC,SAAG,EAAE;AAAA,eAAMT,UAAU,CAACU,UAAX,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BJ,KAA5B,EAAmCpB,OAAnC,CAAJ,EAAiD;AAC/CoD,cAAM,CAACO,GAAP,CAAW,UAAX,EAAuB;AAAA,iBAAMJ,cAAc,CAAC5B,cAAf,CAA8BP,KAA9B,EAAqCpB,OAArC,CAAN;AAAA,SAAvB;AACD;;AACD,UAAI,CAACwD,aAAa,CAACE,OAAnB,EAA4B;AAC1BF,qBAAa,CAACI,MAAd;AACD;AACF;AAxBI,GAAP;AA0BD,CA1QD,E","file":"ui-scroll-grid.js","sourcesContent":[" \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, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\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\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","angular.module('ui.scroll.grid', [])\n .directive('uiScrollTh', ['$log', '$timeout', function(console, $timeout) {\n\n function GridAdapter(controller) {\n\n this.getLayout = () => controller.getLayout();\n\n this.applyLayout = (layout) => controller.applyLayout(layout);\n\n this.columnFromPoint = (x, y) => controller.columnFromPoint(x, y);\n\n Object.defineProperty(this, 'columns', { get: () => controller.getColumns() });\n }\n\n function ColumnAdapter(controller, column) {\n\n this.css = function( /* attr, value */ ) {\n var attr = arguments[0];\n var value = arguments[1];\n if (arguments.length == 1) {\n return column.header.css(attr);\n }\n if (arguments.length == 2) {\n column.header.css(attr, value);\n controller.forEachRow((row) => row[column.id].css(attr, value));\n column.css[attr] = value;\n }\n };\n\n this.moveBefore = (index) => controller.moveBefore(column, index);\n\n this.exchangeWith = (index) => controller.exchangeWith(column, index);\n\n Object.defineProperty(this, 'columnId', { get: () => column.id });\n }\n\n function ColumnController(controller, columns, header) {\n\n this.header = header;\n this.css = {};\n this.mapTo = columns.length;\n this.id = columns.length;\n\n // controller api methods\n\n this.applyLayout = function(layout) {\n this.css = angular.extend({}, layout.css);\n this.mapTo = layout.mapTo;\n applyCss(this.header, this.css);\n };\n\n this.moveBefore = function(target) {\n if (target) {\n moveBefore(header, target.header);\n controller.forEachRow((row) => moveBefore(row[this.id], row[target.id]));\n } else {\n moveLast(header);\n controller.forEachRow((row) => moveLast(row[this.id]));\n }\n };\n\n this.columnFromPoint = function(x, y) {\n if (insidePoint(header, x, y)) {\n return this;\n }\n let result = null;\n controller.forEachRow((row) =>\n result = insidePoint(row[this.id], x, y) ? this : result\n );\n return result;\n };\n\n this.applyCss = function(target) {\n applyCss(target, this.css);\n };\n\n // function definitions\n\n function insidePoint(element, x, y) {\n let offset = element.offset();\n if (x < offset.left || offset.left + element.outerWidth(true) < x)\n return false;\n if (y < offset.top || offset.top + element.outerHeight(true) < y)\n return false;\n return true;\n }\n\n function moveBefore(element, target) {\n element.detach();\n target.before(element);\n }\n\n function moveLast(element) {\n let parent = element.parent();\n element.detach();\n parent.append(element);\n }\n\n function applyCss(target, css) {\n target.removeAttr('style');\n for (let attr in css) {\n if (css.hasOwnProperty(attr)) {\n target.css(attr, css[attr]);\n }\n }\n }\n\n }\n\n function GridController(scrollViewport) {\n let columns = [];\n let rowMap = new Map();\n\n $timeout(() => {\n scrollViewport.adapter.publicContext.gridAdapter = new GridAdapter(this);\n scrollViewport.adapter.transform = (scope, item) => transform(rowMap.get(scope), item);\n });\n\n this.registerColumn = function(header) {\n columns.push(new ColumnController(this, columns, header));\n };\n\n this.registerCell = function(scope, cell) {\n let row = rowMap.get(scope);\n if (!row) {\n row = [];\n rowMap.set(scope, row);\n }\n if (row.length >= columns.length) {\n return false;\n }\n row.push(cell);\n return true;\n };\n\n this.unregisterCell = function(scope, cell) {\n let row = rowMap.get(scope);\n let i = row.indexOf(cell);\n row.splice(i, 1);\n if (!row.length) {\n rowMap.delete(scope);\n }\n };\n\n this.forEachRow = function(callback) {\n rowMap.forEach(callback);\n };\n\n this.getColumns = function() {\n let result = [];\n columns.slice()\n .sort((a, b) => a.mapTo - b.mapTo)\n .forEach((column) => result.push(new ColumnAdapter(this, column)));\n return result;\n };\n\n this.getLayout = function() {\n let result = [];\n columns.forEach((column, index) => result.push({\n index: index,\n css: angular.extend({}, column.css),\n mapTo: column.mapTo\n }));\n return result;\n };\n\n this.applyLayout = function(layouts) {\n if (!layouts || layouts.length != columns.length) {\n throw new Error('Failed to apply layout - number of layouts should match number of columns');\n }\n layouts.forEach((layout, index) => columns[index].applyLayout(layout));\n transform(columns.map((column) => column.header));\n rowMap.forEach((row) => transform(row));\n };\n\n this.moveBefore = function(selected, target) {\n let index = target;\n\n if (target % 1 !== 0) {\n index = target ? columns[target.columnId].mapTo : columns.length;\n }\n if (index < 0 || index > columns.length) {\n return; // throw an error?\n }\n\n let mapTo = selected.mapTo,\n next = null;\n index -= mapTo < index ? 1 : 0;\n\n columns.forEach(c => {\n c.mapTo -= c.mapTo > mapTo ? 1 : 0;\n c.mapTo += c.mapTo >= index ? 1 : 0;\n next = c.mapTo === index + 1 ? c : next;\n });\n\n selected.mapTo = index;\n selected.moveBefore(next);\n };\n\n this.exchangeWith = function(selected, index) {\n if (index < 0 || index >= columns.length) {\n return;\n }\n columns.find(c => c.mapTo === index).mapTo = selected.mapTo;\n selected.mapTo = index;\n };\n\n this.columnFromPoint = function(x, y) {\n let column = columns.find(col => col.columnFromPoint(x, y));\n return column ? new ColumnAdapter(this, column) : undefined;\n };\n\n // function definitions\n\n function transform(row) {\n let parent = row[0].parent();\n let visible = [];\n\n row.forEach((cell, index) => {\n columns[index].applyCss(cell);\n visible[columns[index].mapTo] = row[index];\n row[index].detach();\n });\n\n visible.forEach(cell => parent.append(cell));\n }\n\n }\n\n return {\n require: ['^^uiScrollViewport'],\n restrict: 'A',\n link: ($scope, element, $attr, controllers) => {\n controllers[0].gridController = controllers[0].gridController || new GridController(controllers[0]);\n controllers[0].gridController.registerColumn(element);\n }\n };\n }])\n\n.directive('uiScrollTd', function() {\n return {\n require: ['?^^uiScrollViewport'],\n restrict: 'A',\n link: ($scope, element, $attr, controllers) => {\n if (!controllers[0]) {\n return;\n }\n let scope = $scope;\n let tdInitializer = $scope.uiScrollTdInitializer;\n if (!tdInitializer) {\n tdInitializer = $scope.uiScrollTdInitializer = {\n linking: true\n };\n }\n if (!tdInitializer.linking) {\n scope = tdInitializer.scope;\n }\n let gridController = controllers[0].gridController;\n if (gridController.registerCell(scope, element)) {\n $scope.$on('$destroy', () => gridController.unregisterCell(scope, element));\n }\n if (!tdInitializer.linking) {\n tdInitializer.onLink();\n }\n }\n };\n});\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/ui-scroll-grid.js"],"names":["angular","module","directive","console","$timeout","GridAdapter","controller","getLayout","applyLayout","layout","columnFromPoint","x","y","Object","defineProperty","get","getColumns","ColumnAdapter","column","css","attr","arguments","value","length","header","forEachRow","row","id","moveBefore","index","exchangeWith","ColumnController","columns","mapTo","extend","applyCss","target","moveLast","insidePoint","result","element","offset","left","outerWidth","top","outerHeight","detach","before","parent","append","removeAttr","hasOwnProperty","GridController","scrollViewport","rowMap","Map","adapter","publicContext","gridAdapter","transform","scope","item","registerColumn","push","registerCell","cell","set","unregisterCell","i","indexOf","splice","delete","callback","forEach","slice","sort","a","b","layouts","Error","map","selected","columnId","next","c","find","col","undefined","visible","require","restrict","link","$scope","$attr","controllers","gridController","tdInitializer","uiScrollTdInitializer","linking","$on","onLink"],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QA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":[" \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, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\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\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","angular.module('ui.scroll.grid', [])\r\n .directive('uiScrollTh', ['$log', '$timeout', function(console, $timeout) {\r\n\r\n function GridAdapter(controller) {\r\n\r\n this.getLayout = () => controller.getLayout();\r\n\r\n this.applyLayout = (layout) => controller.applyLayout(layout);\r\n\r\n this.columnFromPoint = (x, y) => controller.columnFromPoint(x, y);\r\n\r\n Object.defineProperty(this, 'columns', { get: () => controller.getColumns() });\r\n }\r\n\r\n function ColumnAdapter(controller, column) {\r\n\r\n this.css = function( /* attr, value */ ) {\r\n var attr = arguments[0];\r\n var value = arguments[1];\r\n if (arguments.length == 1) {\r\n return column.header.css(attr);\r\n }\r\n if (arguments.length == 2) {\r\n column.header.css(attr, value);\r\n controller.forEachRow((row) => row[column.id].css(attr, value));\r\n column.css[attr] = value;\r\n }\r\n };\r\n\r\n this.moveBefore = (index) => controller.moveBefore(column, index);\r\n\r\n this.exchangeWith = (index) => controller.exchangeWith(column, index);\r\n\r\n Object.defineProperty(this, 'columnId', { get: () => column.id });\r\n }\r\n\r\n function ColumnController(controller, columns, header) {\r\n\r\n this.header = header;\r\n this.css = {};\r\n this.mapTo = columns.length;\r\n this.id = columns.length;\r\n\r\n // controller api methods\r\n\r\n this.applyLayout = function(layout) {\r\n this.css = angular.extend({}, layout.css);\r\n this.mapTo = layout.mapTo;\r\n applyCss(this.header, this.css);\r\n };\r\n\r\n this.moveBefore = function(target) {\r\n if (target) {\r\n moveBefore(header, target.header);\r\n controller.forEachRow((row) => moveBefore(row[this.id], row[target.id]));\r\n } else {\r\n moveLast(header);\r\n controller.forEachRow((row) => moveLast(row[this.id]));\r\n }\r\n };\r\n\r\n this.columnFromPoint = function(x, y) {\r\n if (insidePoint(header, x, y)) {\r\n return this;\r\n }\r\n let result = null;\r\n controller.forEachRow((row) =>\r\n result = insidePoint(row[this.id], x, y) ? this : result\r\n );\r\n return result;\r\n };\r\n\r\n this.applyCss = function(target) {\r\n applyCss(target, this.css);\r\n };\r\n\r\n // function definitions\r\n\r\n function insidePoint(element, x, y) {\r\n let offset = element.offset();\r\n if (x < offset.left || offset.left + element.outerWidth(true) < x)\r\n return false;\r\n if (y < offset.top || offset.top + element.outerHeight(true) < y)\r\n return false;\r\n return true;\r\n }\r\n\r\n function moveBefore(element, target) {\r\n element.detach();\r\n target.before(element);\r\n }\r\n\r\n function moveLast(element) {\r\n let parent = element.parent();\r\n element.detach();\r\n parent.append(element);\r\n }\r\n\r\n function applyCss(target, css) {\r\n target.removeAttr('style');\r\n for (let attr in css) {\r\n if (css.hasOwnProperty(attr)) {\r\n target.css(attr, css[attr]);\r\n }\r\n }\r\n }\r\n\r\n }\r\n\r\n function GridController(scrollViewport) {\r\n let columns = [];\r\n let rowMap = new Map();\r\n\r\n $timeout(() => {\r\n scrollViewport.adapter.publicContext.gridAdapter = new GridAdapter(this);\r\n scrollViewport.adapter.transform = (scope, item) => transform(rowMap.get(scope), item);\r\n });\r\n\r\n this.registerColumn = function(header) {\r\n columns.push(new ColumnController(this, columns, header));\r\n };\r\n\r\n this.registerCell = function(scope, cell) {\r\n let row = rowMap.get(scope);\r\n if (!row) {\r\n row = [];\r\n rowMap.set(scope, row);\r\n }\r\n if (row.length >= columns.length) {\r\n return false;\r\n }\r\n row.push(cell);\r\n return true;\r\n };\r\n\r\n this.unregisterCell = function(scope, cell) {\r\n let row = rowMap.get(scope);\r\n let i = row.indexOf(cell);\r\n row.splice(i, 1);\r\n if (!row.length) {\r\n rowMap.delete(scope);\r\n }\r\n };\r\n\r\n this.forEachRow = function(callback) {\r\n rowMap.forEach(callback);\r\n };\r\n\r\n this.getColumns = function() {\r\n let result = [];\r\n columns.slice()\r\n .sort((a, b) => a.mapTo - b.mapTo)\r\n .forEach((column) => result.push(new ColumnAdapter(this, column)));\r\n return result;\r\n };\r\n\r\n this.getLayout = function() {\r\n let result = [];\r\n columns.forEach((column, index) => result.push({\r\n index: index,\r\n css: angular.extend({}, column.css),\r\n mapTo: column.mapTo\r\n }));\r\n return result;\r\n };\r\n\r\n this.applyLayout = function(layouts) {\r\n if (!layouts || layouts.length != columns.length) {\r\n throw new Error('Failed to apply layout - number of layouts should match number of columns');\r\n }\r\n layouts.forEach((layout, index) => columns[index].applyLayout(layout));\r\n transform(columns.map((column) => column.header));\r\n rowMap.forEach((row) => transform(row));\r\n };\r\n\r\n this.moveBefore = function(selected, target) {\r\n let index = target;\r\n\r\n if (target % 1 !== 0) {\r\n index = target ? columns[target.columnId].mapTo : columns.length;\r\n }\r\n if (index < 0 || index > columns.length) {\r\n return; // throw an error?\r\n }\r\n\r\n let mapTo = selected.mapTo,\r\n next = null;\r\n index -= mapTo < index ? 1 : 0;\r\n\r\n columns.forEach(c => {\r\n c.mapTo -= c.mapTo > mapTo ? 1 : 0;\r\n c.mapTo += c.mapTo >= index ? 1 : 0;\r\n next = c.mapTo === index + 1 ? c : next;\r\n });\r\n\r\n selected.mapTo = index;\r\n selected.moveBefore(next);\r\n };\r\n\r\n this.exchangeWith = function(selected, index) {\r\n if (index < 0 || index >= columns.length) {\r\n return;\r\n }\r\n columns.find(c => c.mapTo === index).mapTo = selected.mapTo;\r\n selected.mapTo = index;\r\n };\r\n\r\n this.columnFromPoint = function(x, y) {\r\n let column = columns.find(col => col.columnFromPoint(x, y));\r\n return column ? new ColumnAdapter(this, column) : undefined;\r\n };\r\n\r\n // function definitions\r\n\r\n function transform(row) {\r\n let parent = row[0].parent();\r\n let visible = [];\r\n\r\n row.forEach((cell, index) => {\r\n columns[index].applyCss(cell);\r\n visible[columns[index].mapTo] = row[index];\r\n row[index].detach();\r\n });\r\n\r\n visible.forEach(cell => parent.append(cell));\r\n }\r\n\r\n }\r\n\r\n return {\r\n require: ['^^uiScrollViewport'],\r\n restrict: 'A',\r\n link: ($scope, element, $attr, controllers) => {\r\n controllers[0].gridController = controllers[0].gridController || new GridController(controllers[0]);\r\n controllers[0].gridController.registerColumn(element);\r\n }\r\n };\r\n }])\r\n\r\n.directive('uiScrollTd', function() {\r\n return {\r\n require: ['?^^uiScrollViewport'],\r\n restrict: 'A',\r\n link: ($scope, element, $attr, controllers) => {\r\n if (!controllers[0]) {\r\n return;\r\n }\r\n let scope = $scope;\r\n let tdInitializer = $scope.uiScrollTdInitializer;\r\n if (!tdInitializer) {\r\n tdInitializer = $scope.uiScrollTdInitializer = {\r\n linking: true\r\n };\r\n }\r\n if (!tdInitializer.linking) {\r\n scope = tdInitializer.scope;\r\n }\r\n let gridController = controllers[0].gridController;\r\n if (gridController.registerCell(scope, element)) {\r\n $scope.$on('$destroy', () => gridController.unregisterCell(scope, element));\r\n }\r\n if (!tdInitializer.linking) {\r\n tdInitializer.onLink();\r\n }\r\n }\r\n };\r\n});\r\n"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/ui-scroll-grid.min.js.map b/dist/ui-scroll-grid.min.js.map index 7d351ad..41507d4 100644 --- a/dist/ui-scroll-grid.min.js.map +++ b/dist/ui-scroll-grid.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/ui-scroll-grid.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","angular","directive","console","$timeout","GridAdapter","controller","this","getLayout","applyLayout","layout","columnFromPoint","x","y","getColumns","ColumnAdapter","column","css","attr","arguments","length","header","forEachRow","row","id","moveBefore","index","exchangeWith","ColumnController","columns","insidePoint","element","offset","left","outerWidth","top","outerHeight","target","detach","before","moveLast","parent","append","applyCss","removeAttr","mapTo","extend","result","GridController","scrollViewport","rowMap","Map","transform","visible","forEach","cell","adapter","publicContext","gridAdapter","scope","item","registerColumn","push","registerCell","set","unregisterCell","indexOf","splice","delete","callback","slice","sort","a","b","layouts","Error","map","selected","columnId","next","find","col","undefined","require","restrict","link","$scope","$attr","controllers","gridController","tdInitializer","uiScrollTdInitializer","linking","$on","onLink"],"mappings":"aACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QAKfF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeb,EAAS,aAAc,CAAEmB,OAAO,KAQvDrB,EAAoBsB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQrB,EAAoBqB,IAC/B,EAAPE,EAAU,OAAOF,EACpB,GAAW,EAAPE,GAA8B,iBAAVF,GAAsBA,GAASA,EAAMG,WAAY,OAAOH,EAChF,IAAII,EAAKX,OAAOY,OAAO,MAGvB,GAFA1B,EAAoBkB,EAAEO,GACtBX,OAAOC,eAAeU,EAAI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aAAe,SAASkD,EAAUnD,GACjCA,EAAQ,GAAKA,GAASG,EAAQT,SAGlCS,EAAQmD,MAAK,SAAA1G,GAAC,OAAIA,EAAEuE,QAAUnB,KAAOmB,MAAQgC,EAAShC,MACtDgC,EAAShC,MAAQnB,IAGnBnB,KAAKI,gBAAkB,SAASC,EAAGC,GACjC,IAAIG,EAASa,EAAQmD,MAAK,SAAAC,GAAG,OAAIA,EAAItE,gBAAgBC,EAAGC,MACxD,OAAOG,EAAS,IAAID,EAAcR,KAAMS,QAAUkE,GAoBtD,MAAO,CACLC,QAAS,CAAC,sBACVC,SAAU,IACVC,KAAM,SAACC,EAAQvD,EAASwD,EAAOC,GAC7BA,EAAY,GAAGC,eAAiBD,EAAY,GAAGC,gBAAkB,IAAIzC,EAAewC,EAAY,IAChGA,EAAY,GAAGC,eAAe5B,eAAe9B,QAKpD7B,UAAU,cAAc,WACvB,MAAO,CACLiF,QAAS,CAAC,uBACVC,SAAU,IACVC,KAAM,SAACC,EAAQvD,EAASwD,EAAOC,GAC7B,GAAKA,EAAY,GAAjB,CAGA,IAAI7B,EAAQ2B,EACRI,EAAgBJ,EAAOK,sBACtBD,IACHA,EAAgBJ,EAAOK,sBAAwB,CAC7CC,SAAS,IAGRF,EAAcE,UACjBjC,EAAQ+B,EAAc/B,OAExB,IAAI8B,EAAiBD,EAAY,GAAGC,eAChCA,EAAe1B,aAAaJ,EAAO5B,IACrCuD,EAAOO,IAAI,YAAY,kBAAMJ,EAAexB,eAAeN,EAAO5B,MAE/D2D,EAAcE,SACjBF,EAAcI","file":"ui-scroll-grid.min.js","sourcesContent":[" \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, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\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\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","angular.module('ui.scroll.grid', [])\n .directive('uiScrollTh', ['$log', '$timeout', function(console, $timeout) {\n\n function GridAdapter(controller) {\n\n this.getLayout = () => controller.getLayout();\n\n this.applyLayout = (layout) => controller.applyLayout(layout);\n\n this.columnFromPoint = (x, y) => controller.columnFromPoint(x, y);\n\n Object.defineProperty(this, 'columns', { get: () => controller.getColumns() });\n }\n\n function ColumnAdapter(controller, column) {\n\n this.css = function( /* attr, value */ ) {\n var attr = arguments[0];\n var value = arguments[1];\n if (arguments.length == 1) {\n return column.header.css(attr);\n }\n if (arguments.length == 2) {\n column.header.css(attr, value);\n controller.forEachRow((row) => row[column.id].css(attr, value));\n column.css[attr] = value;\n }\n };\n\n this.moveBefore = (index) => controller.moveBefore(column, index);\n\n this.exchangeWith = (index) => controller.exchangeWith(column, index);\n\n Object.defineProperty(this, 'columnId', { get: () => column.id });\n }\n\n function ColumnController(controller, columns, header) {\n\n this.header = header;\n this.css = {};\n this.mapTo = columns.length;\n this.id = columns.length;\n\n // controller api methods\n\n this.applyLayout = function(layout) {\n this.css = angular.extend({}, layout.css);\n this.mapTo = layout.mapTo;\n applyCss(this.header, this.css);\n };\n\n this.moveBefore = function(target) {\n if (target) {\n moveBefore(header, target.header);\n controller.forEachRow((row) => moveBefore(row[this.id], row[target.id]));\n } else {\n moveLast(header);\n controller.forEachRow((row) => moveLast(row[this.id]));\n }\n };\n\n this.columnFromPoint = function(x, y) {\n if (insidePoint(header, x, y)) {\n return this;\n }\n let result = null;\n controller.forEachRow((row) =>\n result = insidePoint(row[this.id], x, y) ? this : result\n );\n return result;\n };\n\n this.applyCss = function(target) {\n applyCss(target, this.css);\n };\n\n // function definitions\n\n function insidePoint(element, x, y) {\n let offset = element.offset();\n if (x < offset.left || offset.left + element.outerWidth(true) < x)\n return false;\n if (y < offset.top || offset.top + element.outerHeight(true) < y)\n return false;\n return true;\n }\n\n function moveBefore(element, target) {\n element.detach();\n target.before(element);\n }\n\n function moveLast(element) {\n let parent = element.parent();\n element.detach();\n parent.append(element);\n }\n\n function applyCss(target, css) {\n target.removeAttr('style');\n for (let attr in css) {\n if (css.hasOwnProperty(attr)) {\n target.css(attr, css[attr]);\n }\n }\n }\n\n }\n\n function GridController(scrollViewport) {\n let columns = [];\n let rowMap = new Map();\n\n $timeout(() => {\n scrollViewport.adapter.publicContext.gridAdapter = new GridAdapter(this);\n scrollViewport.adapter.transform = (scope, item) => transform(rowMap.get(scope), item);\n });\n\n this.registerColumn = function(header) {\n columns.push(new ColumnController(this, columns, header));\n };\n\n this.registerCell = function(scope, cell) {\n let row = rowMap.get(scope);\n if (!row) {\n row = [];\n rowMap.set(scope, row);\n }\n if (row.length >= columns.length) {\n return false;\n }\n row.push(cell);\n return true;\n };\n\n this.unregisterCell = function(scope, cell) {\n let row = rowMap.get(scope);\n let i = row.indexOf(cell);\n row.splice(i, 1);\n if (!row.length) {\n rowMap.delete(scope);\n }\n };\n\n this.forEachRow = function(callback) {\n rowMap.forEach(callback);\n };\n\n this.getColumns = function() {\n let result = [];\n columns.slice()\n .sort((a, b) => a.mapTo - b.mapTo)\n .forEach((column) => result.push(new ColumnAdapter(this, column)));\n return result;\n };\n\n this.getLayout = function() {\n let result = [];\n columns.forEach((column, index) => result.push({\n index: index,\n css: angular.extend({}, column.css),\n mapTo: column.mapTo\n }));\n return result;\n };\n\n this.applyLayout = function(layouts) {\n if (!layouts || layouts.length != columns.length) {\n throw new Error('Failed to apply layout - number of layouts should match number of columns');\n }\n layouts.forEach((layout, index) => columns[index].applyLayout(layout));\n transform(columns.map((column) => column.header));\n rowMap.forEach((row) => transform(row));\n };\n\n this.moveBefore = function(selected, target) {\n let index = target;\n\n if (target % 1 !== 0) {\n index = target ? columns[target.columnId].mapTo : columns.length;\n }\n if (index < 0 || index > columns.length) {\n return; // throw an error?\n }\n\n let mapTo = selected.mapTo,\n next = null;\n index -= mapTo < index ? 1 : 0;\n\n columns.forEach(c => {\n c.mapTo -= c.mapTo > mapTo ? 1 : 0;\n c.mapTo += c.mapTo >= index ? 1 : 0;\n next = c.mapTo === index + 1 ? c : next;\n });\n\n selected.mapTo = index;\n selected.moveBefore(next);\n };\n\n this.exchangeWith = function(selected, index) {\n if (index < 0 || index >= columns.length) {\n return;\n }\n columns.find(c => c.mapTo === index).mapTo = selected.mapTo;\n selected.mapTo = index;\n };\n\n this.columnFromPoint = function(x, y) {\n let column = columns.find(col => col.columnFromPoint(x, y));\n return column ? new ColumnAdapter(this, column) : undefined;\n };\n\n // function definitions\n\n function transform(row) {\n let parent = row[0].parent();\n let visible = [];\n\n row.forEach((cell, index) => {\n columns[index].applyCss(cell);\n visible[columns[index].mapTo] = row[index];\n row[index].detach();\n });\n\n visible.forEach(cell => parent.append(cell));\n }\n\n }\n\n return {\n require: ['^^uiScrollViewport'],\n restrict: 'A',\n link: ($scope, element, $attr, controllers) => {\n controllers[0].gridController = controllers[0].gridController || new GridController(controllers[0]);\n controllers[0].gridController.registerColumn(element);\n }\n };\n }])\n\n.directive('uiScrollTd', function() {\n return {\n require: ['?^^uiScrollViewport'],\n restrict: 'A',\n link: ($scope, element, $attr, controllers) => {\n if (!controllers[0]) {\n return;\n }\n let scope = $scope;\n let tdInitializer = $scope.uiScrollTdInitializer;\n if (!tdInitializer) {\n tdInitializer = $scope.uiScrollTdInitializer = {\n linking: true\n };\n }\n if (!tdInitializer.linking) {\n scope = tdInitializer.scope;\n }\n let gridController = controllers[0].gridController;\n if (gridController.registerCell(scope, element)) {\n $scope.$on('$destroy', () => gridController.unregisterCell(scope, element));\n }\n if (!tdInitializer.linking) {\n tdInitializer.onLink();\n }\n }\n };\n});\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/ui-scroll-grid.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","angular","directive","console","$timeout","GridAdapter","controller","this","getLayout","applyLayout","layout","columnFromPoint","x","y","getColumns","ColumnAdapter","column","css","attr","arguments","length","header","forEachRow","row","id","moveBefore","index","exchangeWith","ColumnController","columns","insidePoint","element","offset","left","outerWidth","top","outerHeight","target","detach","before","moveLast","parent","append","applyCss","removeAttr","mapTo","extend","result","GridController","scrollViewport","rowMap","Map","transform","visible","forEach","cell","adapter","publicContext","gridAdapter","scope","item","registerColumn","push","registerCell","set","unregisterCell","indexOf","splice","delete","callback","slice","sort","a","b","layouts","Error","map","selected","columnId","next","find","col","undefined","require","restrict","link","$scope","$attr","controllers","gridController","tdInitializer","uiScrollTdInitializer","linking","$on","onLink"],"mappings":"aACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QAKfF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeb,EAAS,aAAc,CAAEmB,OAAO,KAQvDrB,EAAoBsB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAU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\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, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\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\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","angular.module('ui.scroll.grid', [])\r\n .directive('uiScrollTh', ['$log', '$timeout', function(console, $timeout) {\r\n\r\n function GridAdapter(controller) {\r\n\r\n this.getLayout = () => controller.getLayout();\r\n\r\n this.applyLayout = (layout) => controller.applyLayout(layout);\r\n\r\n this.columnFromPoint = (x, y) => controller.columnFromPoint(x, y);\r\n\r\n Object.defineProperty(this, 'columns', { get: () => controller.getColumns() });\r\n }\r\n\r\n function ColumnAdapter(controller, column) {\r\n\r\n this.css = function( /* attr, value */ ) {\r\n var attr = arguments[0];\r\n var value = arguments[1];\r\n if (arguments.length == 1) {\r\n return column.header.css(attr);\r\n }\r\n if (arguments.length == 2) {\r\n column.header.css(attr, value);\r\n controller.forEachRow((row) => row[column.id].css(attr, value));\r\n column.css[attr] = value;\r\n }\r\n };\r\n\r\n this.moveBefore = (index) => controller.moveBefore(column, index);\r\n\r\n this.exchangeWith = (index) => controller.exchangeWith(column, index);\r\n\r\n Object.defineProperty(this, 'columnId', { get: () => column.id });\r\n }\r\n\r\n function ColumnController(controller, columns, header) {\r\n\r\n this.header = header;\r\n this.css = {};\r\n this.mapTo = columns.length;\r\n this.id = columns.length;\r\n\r\n // controller api methods\r\n\r\n this.applyLayout = function(layout) {\r\n this.css = angular.extend({}, layout.css);\r\n this.mapTo = layout.mapTo;\r\n applyCss(this.header, this.css);\r\n };\r\n\r\n this.moveBefore = function(target) {\r\n if (target) {\r\n moveBefore(header, target.header);\r\n controller.forEachRow((row) => moveBefore(row[this.id], row[target.id]));\r\n } else {\r\n moveLast(header);\r\n controller.forEachRow((row) => moveLast(row[this.id]));\r\n }\r\n };\r\n\r\n this.columnFromPoint = function(x, y) {\r\n if (insidePoint(header, x, y)) {\r\n return this;\r\n }\r\n let result = null;\r\n controller.forEachRow((row) =>\r\n result = insidePoint(row[this.id], x, y) ? this : result\r\n );\r\n return result;\r\n };\r\n\r\n this.applyCss = function(target) {\r\n applyCss(target, this.css);\r\n };\r\n\r\n // function definitions\r\n\r\n function insidePoint(element, x, y) {\r\n let offset = element.offset();\r\n if (x < offset.left || offset.left + element.outerWidth(true) < x)\r\n return false;\r\n if (y < offset.top || offset.top + element.outerHeight(true) < y)\r\n return false;\r\n return true;\r\n }\r\n\r\n function moveBefore(element, target) {\r\n element.detach();\r\n target.before(element);\r\n }\r\n\r\n function moveLast(element) {\r\n let parent = element.parent();\r\n element.detach();\r\n parent.append(element);\r\n }\r\n\r\n function applyCss(target, css) {\r\n target.removeAttr('style');\r\n for (let attr in css) {\r\n if (css.hasOwnProperty(attr)) {\r\n target.css(attr, css[attr]);\r\n }\r\n }\r\n }\r\n\r\n }\r\n\r\n function GridController(scrollViewport) {\r\n let columns = [];\r\n let rowMap = new Map();\r\n\r\n $timeout(() => {\r\n scrollViewport.adapter.publicContext.gridAdapter = new GridAdapter(this);\r\n scrollViewport.adapter.transform = (scope, item) => transform(rowMap.get(scope), item);\r\n });\r\n\r\n this.registerColumn = function(header) {\r\n columns.push(new ColumnController(this, columns, header));\r\n };\r\n\r\n this.registerCell = function(scope, cell) {\r\n let row = rowMap.get(scope);\r\n if (!row) {\r\n row = [];\r\n rowMap.set(scope, row);\r\n }\r\n if (row.length >= columns.length) {\r\n return false;\r\n }\r\n row.push(cell);\r\n return true;\r\n };\r\n\r\n this.unregisterCell = function(scope, cell) {\r\n let row = rowMap.get(scope);\r\n let i = row.indexOf(cell);\r\n row.splice(i, 1);\r\n if (!row.length) {\r\n rowMap.delete(scope);\r\n }\r\n };\r\n\r\n this.forEachRow = function(callback) {\r\n rowMap.forEach(callback);\r\n };\r\n\r\n this.getColumns = function() {\r\n let result = [];\r\n columns.slice()\r\n .sort((a, b) => a.mapTo - b.mapTo)\r\n .forEach((column) => result.push(new ColumnAdapter(this, column)));\r\n return result;\r\n };\r\n\r\n this.getLayout = function() {\r\n let result = [];\r\n columns.forEach((column, index) => result.push({\r\n index: index,\r\n css: angular.extend({}, column.css),\r\n mapTo: column.mapTo\r\n }));\r\n return result;\r\n };\r\n\r\n this.applyLayout = function(layouts) {\r\n if (!layouts || layouts.length != columns.length) {\r\n throw new Error('Failed to apply layout - number of layouts should match number of columns');\r\n }\r\n layouts.forEach((layout, index) => columns[index].applyLayout(layout));\r\n transform(columns.map((column) => column.header));\r\n rowMap.forEach((row) => transform(row));\r\n };\r\n\r\n this.moveBefore = function(selected, target) {\r\n let index = target;\r\n\r\n if (target % 1 !== 0) {\r\n index = target ? columns[target.columnId].mapTo : columns.length;\r\n }\r\n if (index < 0 || index > columns.length) {\r\n return; // throw an error?\r\n }\r\n\r\n let mapTo = selected.mapTo,\r\n next = null;\r\n index -= mapTo < index ? 1 : 0;\r\n\r\n columns.forEach(c => {\r\n c.mapTo -= c.mapTo > mapTo ? 1 : 0;\r\n c.mapTo += c.mapTo >= index ? 1 : 0;\r\n next = c.mapTo === index + 1 ? c : next;\r\n });\r\n\r\n selected.mapTo = index;\r\n selected.moveBefore(next);\r\n };\r\n\r\n this.exchangeWith = function(selected, index) {\r\n if (index < 0 || index >= columns.length) {\r\n return;\r\n }\r\n columns.find(c => c.mapTo === index).mapTo = selected.mapTo;\r\n selected.mapTo = index;\r\n };\r\n\r\n this.columnFromPoint = function(x, y) {\r\n let column = columns.find(col => col.columnFromPoint(x, y));\r\n return column ? new ColumnAdapter(this, column) : undefined;\r\n };\r\n\r\n // function definitions\r\n\r\n function transform(row) {\r\n let parent = row[0].parent();\r\n let visible = [];\r\n\r\n row.forEach((cell, index) => {\r\n columns[index].applyCss(cell);\r\n visible[columns[index].mapTo] = row[index];\r\n row[index].detach();\r\n });\r\n\r\n visible.forEach(cell => parent.append(cell));\r\n }\r\n\r\n }\r\n\r\n return {\r\n require: ['^^uiScrollViewport'],\r\n restrict: 'A',\r\n link: ($scope, element, $attr, controllers) => {\r\n controllers[0].gridController = controllers[0].gridController || new GridController(controllers[0]);\r\n controllers[0].gridController.registerColumn(element);\r\n }\r\n };\r\n }])\r\n\r\n.directive('uiScrollTd', function() {\r\n return {\r\n require: ['?^^uiScrollViewport'],\r\n restrict: 'A',\r\n link: ($scope, element, $attr, controllers) => {\r\n if (!controllers[0]) {\r\n return;\r\n }\r\n let scope = $scope;\r\n let tdInitializer = $scope.uiScrollTdInitializer;\r\n if (!tdInitializer) {\r\n tdInitializer = $scope.uiScrollTdInitializer = {\r\n linking: true\r\n };\r\n }\r\n if (!tdInitializer.linking) {\r\n scope = tdInitializer.scope;\r\n }\r\n let gridController = controllers[0].gridController;\r\n if (gridController.registerCell(scope, element)) {\r\n $scope.$on('$destroy', () => gridController.unregisterCell(scope, element));\r\n }\r\n if (!tdInitializer.linking) {\r\n tdInitializer.onLink();\r\n }\r\n }\r\n };\r\n});\r\n"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/ui-scroll-jqlite.min.js b/dist/ui-scroll-jqlite.min.js index c542a1a..af1c87f 100644 --- a/dist/ui-scroll-jqlite.min.js +++ b/dist/ui-scroll-jqlite.min.js @@ -1,12 +1 @@ -/*! - * angular-ui-scroll - * https://github.com/angular-ui/ui-scroll.git - * This module is deprecated since 1.6.0 and will be removed in future versions! - * License: MIT - */ -(function () { - 'use strict'; - - angular.module('ui.scroll.jqlite', []); - -})(); \ No newline at end of file +!function(){"use strict";angular.module("ui.scroll.jqlite",[])}(); \ No newline at end of file diff --git a/dist/ui-scroll.js b/dist/ui-scroll.js index 328b220..385a5a5 100644 --- a/dist/ui-scroll.js +++ b/dist/ui-scroll.js @@ -1,7 +1,7 @@ /*! * angular-ui-scroll * https://github.com/angular-ui/ui-scroll - * Version: 1.8.1 -- 2020-05-13T13:54:15.842Z + * Version: 1.8.2 -- 2020-10-02T15:06:03.904Z * License: MIT */ /******/ (function(modules) { // webpackBootstrap @@ -509,7 +509,16 @@ function () { }(); +// CONCATENATED MODULE: ./src/modules/utils.js +var OPERATIONS = { + PREPEND: 'prepend', + APPEND: 'append', + INSERT: 'insert', + REMOVE: 'remove', + NONE: 'none' +}; // CONCATENATED MODULE: ./src/modules/buffer.js + function ScrollBuffer(elementRoutines, bufferSize, startIndex) { var buffer = Object.create(Array.prototype); angular.extend(buffer, { @@ -528,7 +537,7 @@ function ScrollBuffer(elementRoutines, bufferSize, startIndex) { append: function append(items) { items.forEach(function (item) { ++buffer.next; - buffer.insert('append', item); + buffer.insert(OPERATIONS.APPEND, item); }); buffer.maxIndex = buffer.eof ? buffer.next - 1 : Math.max(buffer.next - 1, buffer.maxIndex); }, @@ -540,7 +549,7 @@ function ScrollBuffer(elementRoutines, bufferSize, startIndex) { --buffer.first; } - buffer.insert('prepend', item); + buffer.insert(OPERATIONS.PREPEND, item); }); buffer.minIndex = buffer.bof ? buffer.minIndex = buffer.first : Math.min(buffer.first, buffer.minIndex); }, @@ -549,19 +558,19 @@ function ScrollBuffer(elementRoutines, bufferSize, startIndex) { * inserts wrapped element in the buffer * the first argument is either operation keyword (see below) or a number for operation 'insert' * for insert the number is the index for the buffer element the new one have to be inserted after - * operations: 'append', 'prepend', 'insert', 'remove', 'update', 'none' + * operations: 'append', 'prepend', 'insert', 'remove', 'none' */ - insert: function insert(operation, item, isTop) { + insert: function insert(operation, item, shiftTop) { var wrapper = { item: item }; if (operation % 1 === 0) { // it is an insert - wrapper.op = 'insert'; + wrapper.op = OPERATIONS.INSERT; buffer.splice(operation, 0, wrapper); - if (isTop) { + if (shiftTop) { buffer.first--; } else { buffer.next++; @@ -570,11 +579,11 @@ function ScrollBuffer(elementRoutines, bufferSize, startIndex) { wrapper.op = operation; switch (operation) { - case 'append': + case OPERATIONS.APPEND: buffer.push(wrapper); break; - case 'prepend': + case OPERATIONS.PREPEND: buffer.unshift(wrapper); break; } @@ -589,26 +598,25 @@ function ScrollBuffer(elementRoutines, bufferSize, startIndex) { } return buffer.splice(arg1, arg2 - arg1); - } // removes single item(wrapper) from the buffer + } // removes single item (wrapper) from the buffer buffer.splice(buffer.indexOf(arg1), 1); - if (arg1._op === 'isTop' && buffer.first === this.getAbsMinIndex()) { + if (arg1.shiftTop && buffer.first === this.getAbsMinIndex()) { this.incrementMinIndex(); } else { this.decrementMaxIndex(); } - if (arg1._op === 'isTop') { + if (arg1.shiftTop) { buffer.first++; } else { buffer.next--; } if (!buffer.length) { - buffer.first = 1; - buffer.next = 1; + buffer.minIndex = Math.min(buffer.maxIndex, buffer.minIndex); } return elementRoutines.removeElementAnimated(arg1); @@ -666,7 +674,7 @@ function ScrollBuffer(elementRoutines, bufferSize, startIndex) { }, getItems: function getItems() { return buffer.filter(function (item) { - return item.op === 'none'; + return item.op === OPERATIONS.NONE; }); }, getFirstItem: function getFirstItem() { @@ -727,9 +735,9 @@ function () { } }, { key: "remove", - value: function remove(argument, _isTop) { + value: function remove(argument, _shiftTop) { var index = argument % 1 === 0 ? argument : argument.scope.$index; - var isTop = argument % 1 === 0 ? _isTop : argument._op === 'isTop'; + var shiftTop = argument % 1 === 0 ? _shiftTop : argument.shiftTop; for (var i = this.length - 1; i >= 0; i--) { if (this[i].index === index) { @@ -738,7 +746,7 @@ function () { } } - if (!isTop) { + if (!shiftTop) { for (var _i = this.length - 1; _i >= 0; _i--) { if (this[_i].index > index) { this[_i].index--; @@ -1015,9 +1023,9 @@ function Viewport(elementRoutines, buffer, element, viewportController, $rootSco bottomPadding.height(0); bottomPadding.cache.clear(); }, - removeCacheItem: function removeCacheItem(item, isTop) { - topPadding.cache.remove(item, isTop); - bottomPadding.cache.remove(item, isTop); + removeCacheItem: function removeCacheItem(item, shiftTop) { + topPadding.cache.remove(item, shiftTop); + bottomPadding.cache.remove(item, shiftTop); }, removeItem: function removeItem(item) { this.removeCacheItem(item); @@ -1033,7 +1041,9 @@ function adapter_defineProperties(target, props) { for (var i = 0; i < props.len function adapter_createClass(Constructor, protoProps, staticProps) { if (protoProps) adapter_defineProperties(Constructor.prototype, protoProps); if (staticProps) adapter_defineProperties(Constructor, staticProps); return Constructor; } -var Adapter = + + +var adapter_Adapter = /*#__PURE__*/ function () { function Adapter($scope, $parse, $attr, viewport, buffer, doAdjust, reload) { @@ -1239,10 +1249,13 @@ function () { if (!newItems.reverse().some(function (newItem) { return newItem === wrapper.item; })) { - wrapper.op = 'remove'; + wrapper.op = OPERATIONS.REMOVE; // try to catch "first" edge case on remove - if (!options.immutableTop && position === 0 && !newItems.length) { - wrapper._op = 'isTop'; // to catch "first" edge case on remove + if (!options.immutableTop && !newItems.length) { + // this is the first item, or the previous one's part of the "shift-top" group + if (position === 0 && this.buffer.bof || position !== 0 && this.buffer[position - 1].shiftTop) { + wrapper.shiftTop = true; + } } } @@ -1250,7 +1263,7 @@ function () { if (newItem === wrapper.item) { position--; } else { - // 3 parameter (isTop) is to catch "first" edge case on insert + // 3 parameter (shiftTop) is to catch "first" edge case on insert _this3.buffer.insert(position + 1, newItem, !options.immutableTop && position === -1); } }); @@ -1317,13 +1330,14 @@ function () { return Adapter; }(); -/* harmony default export */ var modules_adapter = (Adapter); +/* harmony default export */ var modules_adapter = (adapter_Adapter); // CONCATENATED MODULE: ./src/ui-scroll.js + angular.module('ui.scroll', []).constant('JQLiteExtras', jqLiteExtras_JQLiteExtras).run(['JQLiteExtras', function (JQLiteExtras) { var elt = angular.element; !(window.jQuery && elt.fn && elt.fn.jquery) ? new JQLiteExtras().registerFor(elt) : null; @@ -1525,12 +1539,12 @@ angular.module('ui.scroll', []).constant('JQLiteExtras', jqLiteExtras_JQLiteExtr doAdjust(); } }; - /** - * Build padding elements - * - * Calling linker is the only way I found to get access to the tag name of the template - * to prevent the directive scope from pollution a new scope is created and destroyed - * right after the builder creation is completed + /** + * Build padding elements + * + * Calling linker is the only way I found to get access to the tag name of the template + * to prevent the directive scope from pollution a new scope is created and destroyed + * right after the builder creation is completed */ @@ -1647,23 +1661,23 @@ angular.module('ui.scroll', []).constant('JQLiteExtras', jqLiteExtras_JQLiteExtr var inserted = []; buffer.forEach(function (wrapper, i) { switch (wrapper.op) { - case 'prepend': + case OPERATIONS.PREPEND: toBePrepended.unshift(wrapper); break; - case 'append': + case OPERATIONS.APPEND: insertWrapperContent(wrapper, i); - wrapper.op = 'none'; + wrapper.op = OPERATIONS.NONE; inserted.push(wrapper); break; - case 'insert': + case OPERATIONS.INSERT: promises = promises.concat(createElement(wrapper, i, viewport.insertElementAnimated)); - wrapper.op = 'none'; + wrapper.op = OPERATIONS.NONE; inserted.push(wrapper); break; - case 'remove': + case OPERATIONS.REMOVE: toBeRemoved.push(wrapper); } }); @@ -1672,7 +1686,7 @@ angular.module('ui.scroll', []).constant('JQLiteExtras', jqLiteExtras_JQLiteExtr }); if (toBePrepended.length) toBePrepended.forEach(function (wrapper) { insertWrapperContent(wrapper); - wrapper.op = 'none'; + wrapper.op = OPERATIONS.NONE; }); buffer.forEach(function (item, i) { return item.scope.$index = buffer.first + i; diff --git a/dist/ui-scroll.js.map b/dist/ui-scroll.js.map index bbe8e4b..e7ab38f 100644 --- a/dist/ui-scroll.js.map +++ b/dist/ui-scroll.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/modules/jqLiteExtras.js","webpack:///./src/modules/elementRoutines.js","webpack:///./src/modules/buffer.js","webpack:///./src/modules/padding.js","webpack:///./src/modules/viewport.js","webpack:///./src/modules/adapter.js","webpack:///./src/ui-scroll.js"],"names":["JQLiteExtras","element","convertToPx","css","getStyle","isWindow","angular","prototype","name","value","self","elem","nodeType","style","call","obj","document","location","alert","setInterval","scrollTo","direction","top","left","method","prop","preserve","isValueDefined","documentElement","window","getComputedStyle","parseFloat","currentStyle","result","rs","rsLeft","core_pnum","source","rnumnonpx","RegExp","test","runtimeStyle","pixelLeft","getMeasurements","measure","base","borderA","borderB","computedMarginA","computedMarginB","computedStyle","dirA","dirB","marginA","marginB","paddingA","paddingB","height","width","padding","border","margin","offsetWidth","offsetHeight","getWidthHeight","measurements","outer","outerfull","forEach","before","newElem","children","i","j","parent","ref","contents","prepend","length","after","Error","outerHTML","isNumber","outerHeight","option","outerWidth","offset","docElem","win","box","doc","ownerDocument","arguments","undefined","getBoundingClientRect","defaultView","parentWindow","pageYOffset","scrollTop","clientTop","pageXOffset","scrollLeft","clientLeft","key","hideClassToken","ElementRoutines","selector","rules","sheet","styleSheets","index","cssRules","err","insertRule","addRule","$injector","$q","$animate","has","get","isAngularVersionLessThen1_3","version","major","minor","wrapper","addClass","removeClass","newElement","previousElement","remove","scope","$destroy","insertElement","deferred","defer","enter","resolve","promise","removeElement","leave","then","ScrollBuffer","elementRoutines","bufferSize","startIndex","buffer","Object","create","Array","extend","size","reset","eof","bof","first","next","minIndex","maxIndex","minIndexUser","maxIndexUser","append","items","item","insert","Math","max","immutableTop","reverse","min","operation","isTop","op","splice","push","unshift","arg1","arg2","indexOf","_op","getAbsMinIndex","incrementMinIndex","decrementMaxIndex","removeElementAnimated","getAbsMaxIndex","effectiveHeight","elements","Number","MAX_VALUE","bottom","NEGATIVE_INFINITY","offsetParent","getItems","filter","getFirstItem","list","getLastItem","CacheProto","$index","sort","a","b","argument","_isTop","Cache","instance","apply","setPrototypeOf","getOwnPropertyNames","methodName","generateElement","template","Node","ELEMENT_NODE","tagName","toLowerCase","table","find","Padding","cache","Viewport","viewportController","$rootScope","topPadding","bottomPadding","viewport","container","bufferPadding","getScope","createPaddingElements","applyContainerStyle","bottomDataPos","scrollHeight","topDataPos","bottomVisiblePos","topVisiblePos","e","sibling","insertElementAnimated","shouldLoadBottom","clipBottom","overage","overageHeight","itemHeight","emptySpaceHeight","add","adjustPaddings","shouldLoadTop","clipTop","visibleItemsHeight","reduce","summ","topPaddingHeight","topCount","bottomPaddingHeight","bottomCount","totalHeight","averageItemHeight","adjustTopPadding","adjustBottomPadding","topPaddingHeightAdd","bottomPaddingHeightAdd","onAfterMinIndexSet","topPaddingHeightOld","diff","onAfterPrepend","updates","prepended","paddingHeight","position","newPosition","synthetic","previous","resetTopPadding","clear","resetBottomPadding","removeCacheItem","removeItem","Adapter","$scope","$parse","$attr","doAdjust","reload","isLoading","disabled","viewportScope","startScope","$parent","publicContext","assignAdapter","adapter","generatePublicContext","adapterAttr","replace","adapterOnScope","assign","error","message","publicMethods","bind","publicProps","property","attr","defineProperty","set","publicPropsImmediate","newItems","options","arg3","applyUpdatesFunc","applyUpdatesIndex","cb","slice","applyUpdate","_index","isArray","some","newItem","rowTop","topHeight","topDone","bottomDone","itemTop","isEOF","module","constant","run","elt","jQuery","fn","jquery","registerFor","addCSSRules","directive","restrict","controller","child","console","$timeout","$interval","require","transclude","priority","terminal","link","controllers","linker","match","uiScroll","parseNumber","defaultValue","isFloat","floor","isNaN","parseNumericAttr","parseBooleanAttr","BUFFER_MIN","BUFFER_DEFAULT","PADDING_MIN","PADDING_DEFAULT","HANDLE_INERTIA_DEFAULT","START_INDEX_DEFAULT","MAX_VIEWPORT_DELAY","VIEWPORT_POLLING_INTERVAL","datasource","itemName","datasourceName","handleInertia","ridActual","pending","isDatasourceValid","toString","onRenderHandlers","onRenderHandlersRunner","handler","persistDatasourceIndex","propName","getter","id","defineDatasourceIndex","propUserName","descriptor","getOwnPropertyDescriptor","fetchNext","success","count","fetchPrevious","initialize","tryCount","timer","cancel","clone","$on","unbindEvents","off","wheelHandler","on","isInvalid","rid","$$destroyed","bindEvents","resizeAndScrollHandler","isElementVisible","visibilityWatcher","unregisterVisibilityWatcher","insertWrapperContent","insertAfter","createElement","$watch","hideElement","promises","transform","tdInitializer","uiScrollTdInitializer","linking","onLink","updateDOM","toBePrepended","toBeRemoved","inserted","concat","removed","animated","updatePaddings","all","enqueueFetch","loading","fetch","processUpdates","$$phase","$digest","w","showElement","calculateProperties","doAdjustAfterFetch","shift","fixInertia","oldPosition","requestAnimationFrame","event","yMax","clientHeight","preventDefault"],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;;;;;;;;;;;;;;;;;;;;AClFA;;;;;;;;;;IAWqBA,yB;;;;;;;;;gCAEPC,O,EAAS;AACnB,UAAIC,WAAJ,EAAiBC,GAAjB,EAAsBC,QAAtB,EAAgCC,QAAhC,CADmB,CAEnB;;AACAF,SAAG,GAAGG,OAAO,CAACL,OAAR,CAAgBM,SAAhB,CAA0BJ,GAAhC;;AAEAF,aAAO,CAACM,SAAR,CAAkBJ,GAAlB,GAAwB,UAAUK,IAAV,EAAgBC,KAAhB,EAAuB;AAC7C,YAAIC,IAAI,GAAG,IAAX;AACA,YAAIC,IAAI,GAAGD,IAAI,CAAC,CAAD,CAAf;;AACA,YAAI,EAAE,CAACC,IAAD,IAASA,IAAI,CAACC,QAAL,KAAkB,CAA3B,IAAgCD,IAAI,CAACC,QAAL,KAAkB,CAAlD,IAAuD,CAACD,IAAI,CAACE,KAA/D,CAAJ,EAA2E;AACzE,iBAAOV,GAAG,CAACW,IAAJ,CAASJ,IAAT,EAAeF,IAAf,EAAqBC,KAArB,CAAP;AACD;AACF,OAND,CALmB,CAanB;;;A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AqCvD,SAAS,KAAKsV,IAAd,IAAsB,CAACvS,MAAM,CAACO,GAAvE,EAA6E;AAC3E+R,eAAK,CAACG,cAAN;AACD;AACF;AACF;AACF;AAEF,CA3foB,CAhCzB,E","file":"ui-scroll.js","sourcesContent":[" \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, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\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\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n","/*!\r\n globals: angular, window\r\n List of used element methods available in JQuery but not in JQuery Lite\r\n element.before(elem)\r\n element.height()\r\n element.outerHeight(true)\r\n element.height(value) = only for Top/Bottom padding elements\r\n element.scrollTop()\r\n element.scrollTop(value)\r\n */\r\n\r\nexport default class JQLiteExtras {\r\n\r\n registerFor(element) {\r\n let convertToPx, css, getStyle, isWindow;\r\n // angular implementation blows up if elem is the window\r\n css = angular.element.prototype.css;\r\n\r\n element.prototype.css = function (name, value) {\r\n let self = this;\r\n let elem = self[0];\r\n if (!(!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style)) {\r\n return css.call(self, name, value);\r\n }\r\n };\r\n\r\n // as defined in angularjs v1.0.5\r\n isWindow = (obj) => obj && obj.document && obj.location && obj.alert && obj.setInterval;\r\n\r\n function scrollTo(self, direction, value) {\r\n let elem = self[0];\r\n let [method, prop, preserve] = {\r\n top: [\r\n 'scrollTop',\r\n 'pageYOffset',\r\n 'scrollLeft'\r\n ],\r\n left: [\r\n 'scrollLeft',\r\n 'pageXOffset',\r\n 'scrollTop'\r\n ]\r\n }[direction];\r\n\r\n const isValueDefined = typeof value !== 'undefined';\r\n if (isWindow(elem)) {\r\n if (isValueDefined) {\r\n return elem.scrollTo(self[preserve].call(self), value);\r\n }\r\n return (prop in elem) ? elem[prop] : elem.document.documentElement[method];\r\n } else {\r\n if (isValueDefined) {\r\n elem[method] = value;\r\n }\r\n return elem[method];\r\n }\r\n }\r\n\r\n if (window.getComputedStyle) {\r\n getStyle = (elem) => window.getComputedStyle(elem, null);\r\n convertToPx = (elem, value) => parseFloat(value);\r\n } else {\r\n getStyle = (elem) => elem.currentStyle;\r\n convertToPx = (elem, value) => {\r\n let left, result, rs, rsLeft, style;\r\n let core_pnum = /[+-]?(?:\\d*\\.|)\\d+(?:[eE][+-]?\\d+|)/.source;\r\n let rnumnonpx = new RegExp('^(' + core_pnum + ')(?!px)[a-z%]+$', 'i');\r\n\r\n if (!rnumnonpx.test(value)) {\r\n return parseFloat(value);\r\n }\r\n\r\n // ported from JQuery\r\n style = elem.style;\r\n left = style.left;\r\n rs = elem.runtimeStyle;\r\n rsLeft = rs && rs.left;\r\n if (rs) {\r\n rs.left = style.left;\r\n }\r\n // put in the new values to get a computed style out\r\n style.left = value;\r\n result = style.pixelLeft;\r\n style.left = left;\r\n if (rsLeft) {\r\n rs.left = rsLeft;\r\n }\r\n return result;\r\n };\r\n }\r\n\r\n function getMeasurements(elem, measure) {\r\n let base, borderA, borderB, computedMarginA, computedMarginB, computedStyle, dirA, dirB, marginA, marginB, paddingA, paddingB;\r\n\r\n if (isWindow(elem)) {\r\n base = document.documentElement[{height: 'clientHeight', width: 'clientWidth'}[measure]];\r\n\r\n return {\r\n base: base,\r\n padding: 0,\r\n border: 0,\r\n margin: 0\r\n };\r\n }\r\n\r\n // Start with offset property\r\n [\r\n base,\r\n dirA,\r\n dirB\r\n ] = {\r\n width: [\r\n elem.offsetWidth,\r\n 'Left',\r\n 'Right'\r\n ],\r\n height: [\r\n elem.offsetHeight,\r\n 'Top',\r\n 'Bottom'\r\n ]\r\n }[measure];\r\n\r\n computedStyle = getStyle(elem);\r\n paddingA = convertToPx(elem, computedStyle['padding' + dirA]) || 0;\r\n paddingB = convertToPx(elem, computedStyle['padding' + dirB]) || 0;\r\n borderA = convertToPx(elem, computedStyle['border' + dirA + 'Width']) || 0;\r\n borderB = convertToPx(elem, computedStyle['border' + dirB + 'Width']) || 0;\r\n computedMarginA = computedStyle['margin' + dirA];\r\n computedMarginB = computedStyle['margin' + dirB];\r\n\r\n // I do not care for width for now, so this hack is irrelevant\r\n // if ( !supportsPercentMargin )\r\n // computedMarginA = hackPercentMargin( elem, computedStyle, computedMarginA )\r\n // computedMarginB = hackPercentMargin( elem, computedStyle, computedMarginB )\r\n marginA = convertToPx(elem, computedMarginA) || 0;\r\n marginB = convertToPx(elem, computedMarginB) || 0;\r\n\r\n return {\r\n base: base,\r\n padding: paddingA + paddingB,\r\n border: borderA + borderB,\r\n margin: marginA + marginB\r\n };\r\n }\r\n\r\n function getWidthHeight(elem, direction, measure) {\r\n let computedStyle, result;\r\n\r\n let measurements = getMeasurements(elem, direction);\r\n\r\n if (measurements.base > 0) {\r\n return {\r\n base: measurements.base - measurements.padding - measurements.border,\r\n outer: measurements.base,\r\n outerfull: measurements.base + measurements.margin\r\n }[measure];\r\n }\r\n\r\n // Fall back to computed then uncomputed css if necessary\r\n computedStyle = getStyle(elem);\r\n result = computedStyle[direction];\r\n\r\n if (result < 0 || result === null) {\r\n result = elem.style[direction] || 0;\r\n }\r\n\r\n // Normalize \"\", auto, and prepare for extra\r\n result = parseFloat(result) || 0;\r\n\r\n return {\r\n base: result - measurements.padding - measurements.border,\r\n outer: result,\r\n outerfull: result + measurements.padding + measurements.border + measurements.margin\r\n }[measure];\r\n }\r\n\r\n // define missing methods\r\n return angular.forEach({\r\n before(newElem) {\r\n var children, elem, i, j, parent, ref, self;\r\n self = this;\r\n elem = self[0];\r\n parent = self.parent();\r\n children = parent.contents();\r\n if (children[0] === elem) {\r\n return parent.prepend(newElem);\r\n } else {\r\n for (i = j = 1, ref = children.length - 1; 1 <= ref ? j <= ref : j >= ref; i = 1 <= ref ? ++j : --j) {\r\n if (children[i] === elem) {\r\n angular.element(children[i - 1]).after(newElem);\r\n return;\r\n }\r\n }\r\n throw new Error('invalid DOM structure ' + elem.outerHTML);\r\n }\r\n },\r\n height (value){\r\n var self;\r\n self = this;\r\n if (typeof value !== 'undefined') {\r\n if (angular.isNumber(value)) {\r\n value = value + 'px';\r\n }\r\n return css.call(self, 'height', value);\r\n } else {\r\n return getWidthHeight(this[0], 'height', 'base');\r\n }\r\n },\r\n outerHeight(option) {\r\n return getWidthHeight(this[0], 'height', option ? 'outerfull' : 'outer');\r\n },\r\n outerWidth(option) {\r\n return getWidthHeight(this[0], 'width', option ? 'outerfull' : 'outer');\r\n },\r\n\r\n /*\r\n The offset setter method is not implemented\r\n */\r\n offset(value) {\r\n let docElem, win;\r\n let self = this;\r\n let box = {\r\n top: 0,\r\n left: 0\r\n };\r\n let elem = self[0];\r\n let doc = elem && elem.ownerDocument;\r\n\r\n if (arguments.length) {\r\n if (value === undefined) {\r\n return self;\r\n }\r\n // TODO: implement setter\r\n throw new Error('offset setter method is not implemented');\r\n }\r\n\r\n if (!doc) {\r\n return;\r\n }\r\n\r\n docElem = doc.documentElement;\r\n\r\n // TODO: Make sure it's not a disconnected DOM node\r\n\r\n if (elem.getBoundingClientRect != null) {\r\n box = elem.getBoundingClientRect();\r\n }\r\n\r\n win = doc.defaultView || doc.parentWindow;\r\n\r\n return {\r\n top: box.top + (win.pageYOffset || docElem.scrollTop) - (docElem.clientTop || 0),\r\n left: box.left + (win.pageXOffset || docElem.scrollLeft) - (docElem.clientLeft || 0)\r\n };\r\n },\r\n scrollTop(value) {\r\n return scrollTo(this, 'top', value);\r\n },\r\n scrollLeft(value) {\r\n return scrollTo(this, 'left', value);\r\n }\r\n }, (value, key) => {\r\n if (!element.prototype[key]) {\r\n return element.prototype[key] = value;\r\n }\r\n });\r\n }\r\n\r\n}\r\n","const hideClassToken = 'ng-ui-scroll-hide';\r\n\r\nexport default class ElementRoutines {\r\n\r\n static addCSSRules() {\r\n const selector = '.' + hideClassToken;\r\n const rules = 'display: none';\r\n const sheet = document.styleSheets[0];\r\n let index;\r\n try {\r\n index = sheet.cssRules.length;\r\n } catch (err) {\r\n index = 0;\r\n }\r\n if('insertRule' in sheet) {\r\n sheet.insertRule(selector + '{' + rules + '}', index);\r\n }\r\n else if('addRule' in sheet) {\r\n sheet.addRule(selector, rules, index);\r\n }\r\n }\r\n\r\n constructor($injector, $q) {\r\n this.$animate = ($injector.has && $injector.has('$animate')) ? $injector.get('$animate') : null;\r\n this.isAngularVersionLessThen1_3 = angular.version.major === 1 && angular.version.minor < 3;\r\n this.$q = $q;\r\n }\r\n\r\n hideElement(wrapper) {\r\n wrapper.element.addClass(hideClassToken);\r\n }\r\n\r\n showElement(wrapper) {\r\n wrapper.element.removeClass(hideClassToken);\r\n }\r\n\r\n insertElement(newElement, previousElement) {\r\n previousElement.after(newElement);\r\n return [];\r\n }\r\n\r\n removeElement(wrapper) {\r\n wrapper.element.remove();\r\n wrapper.scope.$destroy();\r\n return [];\r\n }\r\n\r\n insertElementAnimated(newElement, previousElement) {\r\n if (!this.$animate) {\r\n return this.insertElement(newElement, previousElement);\r\n }\r\n\r\n if (this.isAngularVersionLessThen1_3) {\r\n const deferred = this.$q.defer();\r\n // no need for parent - previous element is never null\r\n this.$animate.enter(newElement, null, previousElement, () => deferred.resolve());\r\n\r\n return [deferred.promise];\r\n }\r\n\r\n // no need for parent - previous element is never null\r\n return [this.$animate.enter(newElement, null, previousElement)];\r\n }\r\n\r\n removeElementAnimated(wrapper) {\r\n if (!this.$animate) {\r\n return this.removeElement(wrapper);\r\n }\r\n\r\n if (this.isAngularVersionLessThen1_3) {\r\n const deferred = this.$q.defer();\r\n this.$animate.leave(wrapper.element, () => {\r\n wrapper.scope.$destroy();\r\n return deferred.resolve();\r\n });\r\n\r\n return [deferred.promise];\r\n }\r\n\r\n return [(this.$animate.leave(wrapper.element)).then(() => wrapper.scope.$destroy())];\r\n }\r\n}","export default function ScrollBuffer(elementRoutines, bufferSize, startIndex) {\r\n const buffer = Object.create(Array.prototype);\r\n\r\n angular.extend(buffer, {\r\n size: bufferSize,\r\n\r\n reset(startIndex) {\r\n buffer.remove(0, buffer.length);\r\n buffer.eof = false;\r\n buffer.bof = false;\r\n buffer.first = startIndex;\r\n buffer.next = startIndex;\r\n buffer.minIndex = startIndex;\r\n buffer.maxIndex = startIndex;\r\n buffer.minIndexUser = null;\r\n buffer.maxIndexUser = null;\r\n },\r\n\r\n append(items) {\r\n items.forEach((item) => {\r\n ++buffer.next;\r\n buffer.insert('append', item);\r\n });\r\n buffer.maxIndex = buffer.eof ? buffer.next - 1 : Math.max(buffer.next - 1, buffer.maxIndex);\r\n },\r\n\r\n prepend(items, immutableTop) {\r\n items.reverse().forEach((item) => {\r\n if (immutableTop) {\r\n ++buffer.next;\r\n }\r\n else {\r\n --buffer.first;\r\n }\r\n buffer.insert('prepend', item);\r\n });\r\n buffer.minIndex = buffer.bof ? buffer.minIndex = buffer.first : Math.min(buffer.first, buffer.minIndex);\r\n },\r\n\r\n /**\r\n * inserts wrapped element in the buffer\r\n * the first argument is either operation keyword (see below) or a number for operation 'insert'\r\n * for insert the number is the index for the buffer element the new one have to be inserted after\r\n * operations: 'append', 'prepend', 'insert', 'remove', 'update', 'none'\r\n */\r\n insert(operation, item, isTop) {\r\n const wrapper = {\r\n item: item\r\n };\r\n\r\n if (operation % 1 === 0) {// it is an insert\r\n wrapper.op = 'insert';\r\n buffer.splice(operation, 0, wrapper);\r\n if(isTop) {\r\n buffer.first--;\r\n }\r\n else {\r\n buffer.next++;\r\n }\r\n } else {\r\n wrapper.op = operation;\r\n switch (operation) {\r\n case 'append':\r\n buffer.push(wrapper);\r\n break;\r\n case 'prepend':\r\n buffer.unshift(wrapper);\r\n break;\r\n }\r\n }\r\n },\r\n\r\n // removes elements from buffer\r\n remove(arg1, arg2) {\r\n if (angular.isNumber(arg1)) {\r\n // removes items from arg1 (including) through arg2 (excluding)\r\n for (let i = arg1; i < arg2; i++) {\r\n elementRoutines.removeElement(buffer[i]);\r\n }\r\n return buffer.splice(arg1, arg2 - arg1);\r\n }\r\n // removes single item(wrapper) from the buffer\r\n buffer.splice(buffer.indexOf(arg1), 1);\r\n if(arg1._op === 'isTop' && buffer.first === this.getAbsMinIndex()) {\r\n this.incrementMinIndex();\r\n }\r\n else {\r\n this.decrementMaxIndex();\r\n }\r\n if(arg1._op === 'isTop') {\r\n buffer.first++;\r\n }\r\n else {\r\n buffer.next--;\r\n }\r\n if(!buffer.length) {\r\n buffer.first = 1;\r\n buffer.next = 1;\r\n }\r\n\r\n return elementRoutines.removeElementAnimated(arg1);\r\n },\r\n\r\n incrementMinIndex() {\r\n if(buffer.minIndexUser !== null) {\r\n if(buffer.minIndex > buffer.minIndexUser) {\r\n buffer.minIndexUser++;\r\n return;\r\n }\r\n if(buffer.minIndex === buffer.minIndexUser) {\r\n buffer.minIndexUser++;\r\n }\r\n }\r\n buffer.minIndex++;\r\n },\r\n\r\n decrementMaxIndex() {\r\n if(buffer.maxIndexUser !== null && buffer.maxIndex <= buffer.maxIndexUser) {\r\n buffer.maxIndexUser--;\r\n }\r\n buffer.maxIndex--;\r\n },\r\n\r\n getAbsMinIndex() {\r\n if(buffer.minIndexUser !== null) {\r\n return Math.min(buffer.minIndexUser, buffer.minIndex);\r\n }\r\n return buffer.minIndex;\r\n },\r\n\r\n getAbsMaxIndex() {\r\n if(buffer.maxIndexUser !== null) {\r\n return Math.max(buffer.maxIndexUser, buffer.maxIndex);\r\n }\r\n return buffer.maxIndex;\r\n },\r\n\r\n effectiveHeight(elements) {\r\n if (!elements.length) {\r\n return 0;\r\n }\r\n let top = Number.MAX_VALUE;\r\n let bottom = Number.NEGATIVE_INFINITY;\r\n elements.forEach((wrapper) => {\r\n if (wrapper.element[0].offsetParent) {\r\n // element style is not display:none\r\n top = Math.min(top, wrapper.element.offset().top);\r\n bottom = Math.max(bottom, wrapper.element.offset().top + wrapper.element.outerHeight(true));\r\n }\r\n });\r\n return Math.max(0, bottom - top);\r\n },\r\n\r\n getItems() {\r\n return buffer.filter(item => item.op === 'none');\r\n },\r\n\r\n getFirstItem() {\r\n const list = buffer.getItems();\r\n if (!list.length) {\r\n return null;\r\n }\r\n return list[0].item;\r\n },\r\n\r\n getLastItem() {\r\n const list = buffer.getItems();\r\n if (!list.length) {\r\n return null;\r\n }\r\n return list[list.length - 1].item;\r\n }\r\n\r\n });\r\n\r\n buffer.reset(startIndex);\r\n\r\n return buffer;\r\n}\r\n","// Can't just extend the Array, due to Babel does not support built-in classes extending\r\n// This solution was taken from https://stackoverflow.com/questions/46897414/es6-class-extends-array-workaround-for-es5-babel-transpile\r\nclass CacheProto {\r\n add(item) {\r\n for (let i = this.length - 1; i >= 0; i--) {\r\n if (this[i].index === item.scope.$index) {\r\n this[i].height = item.element.outerHeight();\r\n return;\r\n }\r\n }\r\n this.push({\r\n index: item.scope.$index,\r\n height: item.element.outerHeight()\r\n });\r\n this.sort((a, b) => ((a.index < b.index) ? -1 : ((a.index > b.index) ? 1 : 0)));\r\n }\r\n\r\n remove(argument, _isTop) {\r\n const index = argument % 1 === 0 ? argument : argument.scope.$index;\r\n const isTop = argument % 1 === 0 ? _isTop : argument._op === 'isTop';\r\n for (let i = this.length - 1; i >= 0; i--) {\r\n if (this[i].index === index) {\r\n this.splice(i, 1);\r\n break;\r\n }\r\n }\r\n if(!isTop) {\r\n for (let i = this.length - 1; i >= 0; i--) {\r\n if (this[i].index > index) {\r\n this[i].index--;\r\n }\r\n }\r\n }\r\n }\r\n\r\n clear() {\r\n this.length = 0;\r\n }\r\n}\r\n\r\nfunction Cache() {\r\n const instance = [];\r\n instance.push.apply(instance, arguments);\r\n Object.setPrototypeOf(instance, Cache.prototype);\r\n return instance;\r\n}\r\nCache.prototype = Object.create(Array.prototype);\r\nObject.getOwnPropertyNames(CacheProto.prototype).forEach(methodName =>\r\n Cache.prototype[methodName] = CacheProto.prototype[methodName]\r\n);\r\n\r\nfunction generateElement(template) {\r\n if(template.nodeType !== Node.ELEMENT_NODE) {\r\n throw new Error('ui-scroll directive requires an Element node for templating the view');\r\n }\r\n let element;\r\n switch (template.tagName.toLowerCase()) {\r\n case 'dl':\r\n throw new Error(`ui-scroll directive does not support <${template.tagName}> as a repeating tag: ${template.outerHTML}`);\r\n case 'tr':\r\n let table = angular.element('
');\r\n element = table.find('tr');\r\n break;\r\n case 'li':\r\n element = angular.element('
  • ');\r\n break;\r\n default:\r\n element = angular.element('
    ');\r\n }\r\n return element;\r\n}\r\n\r\nclass Padding {\r\n constructor(template) {\r\n this.element = generateElement(template);\r\n this.cache = new Cache();\r\n }\r\n\r\n height() {\r\n return this.element.height.apply(this.element, arguments);\r\n }\r\n}\r\n\r\nexport default Padding;","import Padding from './padding';\r\n\r\nexport default function Viewport(elementRoutines, buffer, element, viewportController, $rootScope, padding) {\r\n let topPadding = null;\r\n let bottomPadding = null;\r\n const viewport = viewportController && viewportController.viewport ? viewportController.viewport : angular.element(window);\r\n const container = viewportController && viewportController.container ? viewportController.container : undefined;\r\n const scope = viewportController && viewportController.scope ? viewportController.scope : $rootScope;\r\n\r\n viewport.css({\r\n 'overflow-anchor': 'none',\r\n 'overflow-y': 'auto',\r\n 'display': 'block'\r\n });\r\n\r\n function bufferPadding() {\r\n return viewport.outerHeight() * padding; // some extra space to initiate preload\r\n }\r\n\r\n angular.extend(viewport, {\r\n getScope() {\r\n return scope;\r\n },\r\n\r\n createPaddingElements(template) {\r\n topPadding = new Padding(template);\r\n bottomPadding = new Padding(template);\r\n element.before(topPadding.element);\r\n element.after(bottomPadding.element);\r\n topPadding.height(0);\r\n bottomPadding.height(0);\r\n },\r\n\r\n applyContainerStyle() {\r\n if (!container) {\r\n return true;\r\n }\r\n if(container !== viewport) {\r\n viewport.css('height', window.getComputedStyle(container[0]).height);\r\n }\r\n return viewport.height() > 0;\r\n },\r\n\r\n bottomDataPos() {\r\n let scrollHeight = viewport[0].scrollHeight;\r\n scrollHeight = scrollHeight != null ? scrollHeight : viewport[0].document.documentElement.scrollHeight;\r\n return scrollHeight - bottomPadding.height();\r\n },\r\n\r\n topDataPos() {\r\n return topPadding.height();\r\n },\r\n\r\n bottomVisiblePos() {\r\n return viewport.scrollTop() + viewport.outerHeight();\r\n },\r\n\r\n topVisiblePos() {\r\n return viewport.scrollTop();\r\n },\r\n\r\n insertElement(e, sibling) {\r\n return elementRoutines.insertElement(e, sibling || topPadding.element);\r\n },\r\n\r\n insertElementAnimated(e, sibling) {\r\n return elementRoutines.insertElementAnimated(e, sibling || topPadding.element);\r\n },\r\n\r\n shouldLoadBottom() {\r\n return !buffer.eof && viewport.bottomDataPos() < viewport.bottomVisiblePos() + bufferPadding();\r\n },\r\n\r\n clipBottom() {\r\n // clip the invisible items off the bottom\r\n let overage = 0;\r\n let overageHeight = 0;\r\n let itemHeight = 0;\r\n let emptySpaceHeight = viewport.bottomDataPos() - viewport.bottomVisiblePos() - bufferPadding();\r\n\r\n for (let i = buffer.length - 1; i >= 0; i--) {\r\n itemHeight = buffer[i].element.outerHeight(true);\r\n if (overageHeight + itemHeight > emptySpaceHeight) {\r\n break;\r\n }\r\n bottomPadding.cache.add(buffer[i]);\r\n overageHeight += itemHeight;\r\n overage++;\r\n }\r\n\r\n if (overage > 0) {\r\n buffer.eof = false;\r\n buffer.remove(buffer.length - overage, buffer.length);\r\n buffer.next -= overage;\r\n viewport.adjustPaddings();\r\n }\r\n },\r\n\r\n shouldLoadTop() {\r\n return !buffer.bof && (viewport.topDataPos() > viewport.topVisiblePos() - bufferPadding());\r\n },\r\n\r\n clipTop() {\r\n // clip the invisible items off the top\r\n let overage = 0;\r\n let overageHeight = 0;\r\n let itemHeight = 0;\r\n let emptySpaceHeight = viewport.topVisiblePos() - viewport.topDataPos() - bufferPadding();\r\n\r\n for (let i = 0; i < buffer.length; i++) {\r\n itemHeight = buffer[i].element.outerHeight(true);\r\n if (overageHeight + itemHeight > emptySpaceHeight) {\r\n break;\r\n }\r\n topPadding.cache.add(buffer[i]);\r\n overageHeight += itemHeight;\r\n overage++;\r\n }\r\n\r\n if (overage > 0) {\r\n // we need to adjust top padding element before items are removed from top\r\n // to avoid strange behaviour of scroll bar during remove top items when we are at the very bottom\r\n topPadding.height(topPadding.height() + overageHeight);\r\n buffer.bof = false;\r\n buffer.remove(0, overage);\r\n buffer.first += overage;\r\n }\r\n },\r\n\r\n adjustPaddings() {\r\n if (!buffer.length) {\r\n return;\r\n }\r\n\r\n // precise heights calculation based on items that are in buffer or that were in buffer once\r\n const visibleItemsHeight = buffer.reduce((summ, item) => summ + item.element.outerHeight(true), 0);\r\n\r\n let topPaddingHeight = 0, topCount = 0;\r\n topPadding.cache.forEach(item => {\r\n if(item.index < buffer.first) {\r\n topPaddingHeight += item.height;\r\n topCount++;\r\n }\r\n });\r\n\r\n let bottomPaddingHeight = 0, bottomCount = 0;\r\n bottomPadding.cache.forEach(item => {\r\n if(item.index >= buffer.next) {\r\n bottomPaddingHeight += item.height;\r\n bottomCount++;\r\n }\r\n });\r\n\r\n const totalHeight = visibleItemsHeight + topPaddingHeight + bottomPaddingHeight;\r\n const averageItemHeight = totalHeight / (topCount + bottomCount + buffer.length);\r\n\r\n // average heights calculation, items that have never been reached\r\n let adjustTopPadding = buffer.minIndexUser !== null && buffer.minIndex > buffer.minIndexUser;\r\n let adjustBottomPadding = buffer.maxIndexUser !== null && buffer.maxIndex < buffer.maxIndexUser;\r\n let topPaddingHeightAdd = adjustTopPadding ? (buffer.minIndex - buffer.minIndexUser) * averageItemHeight : 0;\r\n let bottomPaddingHeightAdd = adjustBottomPadding ? (buffer.maxIndexUser - buffer.maxIndex) * averageItemHeight : 0;\r\n\r\n // paddings combine adjustment\r\n topPadding.height(topPaddingHeight + topPaddingHeightAdd);\r\n bottomPadding.height(bottomPaddingHeight + bottomPaddingHeightAdd);\r\n },\r\n\r\n onAfterMinIndexSet(topPaddingHeightOld) {\r\n // additional scrollTop adjustment in case of datasource.minIndex external set\r\n if (buffer.minIndexUser !== null && buffer.minIndex > buffer.minIndexUser) {\r\n let diff = topPadding.height() - topPaddingHeightOld;\r\n viewport.scrollTop(viewport.scrollTop() + diff);\r\n while((diff -= viewport.scrollTop()) > 0) {\r\n bottomPadding.height(bottomPadding.height() + diff);\r\n viewport.scrollTop(viewport.scrollTop() + diff);\r\n }\r\n }\r\n },\r\n\r\n onAfterPrepend(updates) {\r\n if (!updates.prepended.length) {\r\n return;\r\n }\r\n const height = buffer.effectiveHeight(updates.prepended);\r\n const paddingHeight = topPadding.height() - height;\r\n if (paddingHeight >= 0) {\r\n topPadding.height(paddingHeight);\r\n return;\r\n }\r\n const position = viewport.scrollTop();\r\n const newPosition = position - paddingHeight;\r\n viewport.synthetic = { previous: position, next: newPosition };\r\n topPadding.height(0);\r\n viewport.scrollTop(newPosition);\r\n },\r\n\r\n resetTopPadding() {\r\n topPadding.height(0);\r\n topPadding.cache.clear();\r\n },\r\n\r\n resetBottomPadding() {\r\n bottomPadding.height(0);\r\n bottomPadding.cache.clear();\r\n },\r\n\r\n removeCacheItem(item, isTop) {\r\n topPadding.cache.remove(item, isTop);\r\n bottomPadding.cache.remove(item, isTop);\r\n },\r\n\r\n removeItem(item) {\r\n this.removeCacheItem(item);\r\n return buffer.remove(item);\r\n }\r\n });\r\n\r\n return viewport;\r\n}\r\n","class Adapter {\r\n\r\n constructor($scope, $parse, $attr, viewport, buffer, doAdjust, reload) {\r\n this.$parse = $parse;\r\n this.$attr = $attr;\r\n this.viewport = viewport;\r\n this.buffer = buffer;\r\n\r\n this.doAdjust = doAdjust;\r\n this.reload = reload;\r\n\r\n this.isLoading = false;\r\n this.disabled = false;\r\n\r\n const viewportScope = viewport.getScope();\r\n this.startScope = viewportScope.$parent ? viewportScope : $scope;\r\n\r\n this.publicContext = {};\r\n this.assignAdapter($attr.adapter);\r\n this.generatePublicContext();\r\n }\r\n\r\n assignAdapter(adapterAttr) {\r\n if (!adapterAttr || !(adapterAttr = adapterAttr.replace(/^\\s+|\\s+$/gm, ''))) {\r\n return;\r\n }\r\n let adapterOnScope;\r\n\r\n try {\r\n this.$parse(adapterAttr).assign(this.startScope, {});\r\n adapterOnScope = this.$parse(adapterAttr)(this.startScope);\r\n }\r\n catch (error) {\r\n error.message = `Angular ui-scroll Adapter assignment exception.\\n` +\r\n `Can't parse \"${adapterAttr}\" expression.\\n` +\r\n error.message;\r\n throw error;\r\n }\r\n\r\n angular.extend(adapterOnScope, this.publicContext);\r\n this.publicContext = adapterOnScope;\r\n }\r\n\r\n generatePublicContext() {\r\n // these methods will be accessible out of ui-scroll via user defined adapter\r\n const publicMethods = ['reload', 'applyUpdates', 'append', 'prepend', 'isBOF', 'isEOF', 'isEmpty'];\r\n for (let i = publicMethods.length - 1; i >= 0; i--) {\r\n this.publicContext[publicMethods[i]] = this[publicMethods[i]].bind(this);\r\n }\r\n\r\n // these read-only props will be accessible out of ui-scroll via user defined adapter\r\n const publicProps = ['isLoading', 'topVisible', 'topVisibleElement', 'topVisibleScope', 'bottomVisible', 'bottomVisibleElement', 'bottomVisibleScope'];\r\n for (let i = publicProps.length - 1; i >= 0; i--) {\r\n let property, attr = this.$attr[publicProps[i]];\r\n Object.defineProperty(this, publicProps[i], {\r\n get: () => property,\r\n set: (value) => {\r\n property = value;\r\n this.publicContext[publicProps[i]] = value;\r\n if (attr) {\r\n this.$parse(attr).assign(this.startScope, value);\r\n }\r\n }\r\n });\r\n }\r\n\r\n // read-only immediately calculated public properties\r\n const publicPropsImmediate = ['bufferFirst', 'bufferLast', 'bufferLength'];\r\n for (let i = publicPropsImmediate.length - 1; i >= 0; i--) {\r\n Object.defineProperty(this.publicContext, publicPropsImmediate[i], {\r\n get: () => this[publicPropsImmediate[i]]\r\n });\r\n }\r\n\r\n // non-read-only public property\r\n Object.defineProperty(this.publicContext, 'disabled', {\r\n get: () => this.disabled,\r\n set: (value) => (!(this.disabled = value)) ? this.doAdjust() : null\r\n });\r\n }\r\n\r\n loading(value) {\r\n this.isLoading = value;\r\n }\r\n\r\n isBOF() {\r\n return this.buffer.bof;\r\n }\r\n\r\n isEOF() {\r\n return this.buffer.eof;\r\n }\r\n\r\n isEmpty() {\r\n return !this.buffer.length;\r\n }\r\n\r\n get bufferLength() {\r\n return this.buffer.getItems().length;\r\n }\r\n\r\n get bufferFirst() {\r\n return this.buffer.getFirstItem();\r\n }\r\n\r\n get bufferLast() {\r\n return this.buffer.getLastItem();\r\n }\r\n\r\n append(newItems) {\r\n this.buffer.append(newItems);\r\n this.doAdjust();\r\n this.viewport.clipTop();\r\n this.viewport.clipBottom();\r\n }\r\n\r\n prepend(newItems, options = {}) {\r\n this.buffer.prepend(newItems, options.immutableTop);\r\n this.doAdjust();\r\n this.viewport.clipTop();\r\n this.viewport.clipBottom();\r\n }\r\n\r\n applyUpdates(arg1, arg2, arg3) {\r\n if (typeof arg1 === 'function') {\r\n this.applyUpdatesFunc(arg1, arg2);\r\n } else {\r\n this.applyUpdatesIndex(arg1, arg2, arg3);\r\n }\r\n this.doAdjust();\r\n }\r\n\r\n applyUpdatesFunc(cb, options = {}) {\r\n this.buffer.slice(0).forEach((wrapper) => {\r\n // we need to do it on the buffer clone, because buffer content\r\n // may change as we iterate through\r\n this.applyUpdate(wrapper, cb(wrapper.item, wrapper.scope, wrapper.element), options);\r\n });\r\n }\r\n\r\n applyUpdatesIndex(index, newItems, options = {}) {\r\n if (index % 1 !== 0) {\r\n throw new Error('applyUpdates - ' + index + ' is not a valid index (should be an integer)');\r\n }\r\n const _index = index - this.buffer.first;\r\n\r\n // apply updates only within buffer\r\n if (_index >= 0 && _index < this.buffer.length) {\r\n this.applyUpdate(this.buffer[_index], newItems, options);\r\n }\r\n // out-of-buffer case: deletion may affect Paddings\r\n else if(index >= this.buffer.getAbsMinIndex() && index <= this.buffer.getAbsMaxIndex()) {\r\n if(angular.isArray(newItems) && !newItems.length) {\r\n this.viewport.removeCacheItem(index, !options.immutableTop && index === this.buffer.minIndex);\r\n if (!options.immutableTop && index === this.buffer.getAbsMinIndex()) {\r\n this.buffer.incrementMinIndex();\r\n }\r\n else {\r\n this.buffer.decrementMaxIndex();\r\n }\r\n }\r\n }\r\n }\r\n\r\n applyUpdate(wrapper, newItems, options = {}) {\r\n if (!angular.isArray(newItems)) {\r\n return;\r\n }\r\n let position = this.buffer.indexOf(wrapper);\r\n if (!newItems.reverse().some(newItem => newItem === wrapper.item)) {\r\n wrapper.op = 'remove';\r\n if (!options.immutableTop && position === 0 && !newItems.length) {\r\n wrapper._op = 'isTop'; // to catch \"first\" edge case on remove\r\n }\r\n }\r\n newItems.forEach((newItem) => {\r\n if (newItem === wrapper.item) {\r\n position--;\r\n } else {\r\n // 3 parameter (isTop) is to catch \"first\" edge case on insert\r\n this.buffer.insert(position + 1, newItem, !options.immutableTop && position === -1);\r\n }\r\n });\r\n }\r\n\r\n calculateProperties() {\r\n let rowTop = null, topHeight = 0;\r\n let topDone = false, bottomDone = false;\r\n const length = this.buffer.length;\r\n\r\n for (let i = 0; i < length; i++) {\r\n const item = this.buffer[i];\r\n const itemTop = item.element.offset().top;\r\n\r\n if (rowTop !== itemTop) { // a new row condition\r\n const itemHeight = item.element.outerHeight(true);\r\n const top = this.viewport.topDataPos() + topHeight + itemHeight;\r\n\r\n if (!topDone && top > this.viewport.topVisiblePos()) {\r\n topDone = true;\r\n this['topVisible'] = item.item;\r\n this['topVisibleElement'] = item.element;\r\n this['topVisibleScope'] = item.scope;\r\n }\r\n if (!bottomDone && (top >= this.viewport.bottomVisiblePos() || (i === length - 1 && this.isEOF()))) {\r\n bottomDone = true;\r\n this['bottomVisible'] = item.item;\r\n this['bottomVisibleElement'] = item.element;\r\n this['bottomVisibleScope'] = item.scope;\r\n }\r\n topHeight += itemHeight;\r\n }\r\n rowTop = itemTop;\r\n\r\n if (topDone && bottomDone) {\r\n break;\r\n }\r\n }\r\n }\r\n\r\n}\r\n\r\nexport default Adapter;\r\n","import JQLiteExtras from './modules/jqLiteExtras';\nimport ElementRoutines from './modules/elementRoutines.js';\nimport ScrollBuffer from './modules/buffer.js';\nimport Viewport from './modules/viewport.js';\nimport Adapter from './modules/adapter.js';\n\nangular.module('ui.scroll', [])\n\n .constant('JQLiteExtras', JQLiteExtras)\n .run(['JQLiteExtras', (JQLiteExtras) => {\n const elt = angular.element;\n !(window.jQuery && elt.fn && elt.fn.jquery) ? (new JQLiteExtras()).registerFor(elt) : null;\n ElementRoutines.addCSSRules();\n }])\n\n .directive('uiScrollViewport', function () {\n return {\n restrict: 'A',\n controller: [\n '$scope',\n '$element',\n function (scope, element) {\n this.container = element;\n this.viewport = element;\n this.scope = scope;\n\n angular.forEach(element.children(), child => {\n if (child.tagName.toLowerCase() === 'tbody') {\n this.viewport = angular.element(child);\n }\n });\n\n return this;\n }\n ]\n };\n })\n\n .directive('uiScroll', [\n '$log',\n '$injector',\n '$rootScope',\n '$timeout',\n '$interval',\n '$q',\n '$parse',\n function (console, $injector, $rootScope, $timeout, $interval, $q, $parse) {\n\n return {\n require: ['?^uiScrollViewport'],\n restrict: 'A',\n transclude: 'element',\n priority: 1000,\n terminal: true,\n link: link\n };\n\n function link($scope, element, $attr, controllers, linker) {\n const match = $attr.uiScroll.match(/^\\s*(\\w+)\\s+in\\s+([(\\w|\\$)\\.]+)\\s*$/);\n if (!match) {\n throw new Error('Expected uiScroll in form of \\'_item_ in _datasource_\\' but got \\'' + $attr.uiScroll + '\\'');\n }\n\n function parseNumber(value, defaultValue, isFloat) {\n if (!isFloat) {\n value = value === null ? defaultValue : Math.floor(value);\n }\n return isNaN(value) ? defaultValue : value;\n }\n\n function parseNumericAttr(value, defaultValue, isFloat) {\n const result = $parse(value)($scope);\n return parseNumber(result, defaultValue, isFloat);\n }\n\n function parseBooleanAttr(value, defaultValue) {\n const result = $parse(value)($scope);\n return typeof result === 'boolean' ? result : defaultValue;\n }\n\n const BUFFER_MIN = 3;\n const BUFFER_DEFAULT = 10;\n const PADDING_MIN = 0.3;\n const PADDING_DEFAULT = 0.5;\n const HANDLE_INERTIA_DEFAULT = true;\n const START_INDEX_DEFAULT = 1;\n const MAX_VIEWPORT_DELAY = 500;\n const VIEWPORT_POLLING_INTERVAL = 50;\n\n let datasource = null;\n const itemName = match[1];\n const datasourceName = match[2];\n const viewportController = controllers[0];\n const bufferSize = Math.max(BUFFER_MIN, parseNumericAttr($attr.bufferSize, BUFFER_DEFAULT));\n const padding = Math.max(PADDING_MIN, parseNumericAttr($attr.padding, PADDING_DEFAULT, true));\n const handleInertia = parseBooleanAttr($attr.handleInertia, HANDLE_INERTIA_DEFAULT);\n let startIndex = parseNumericAttr($attr.startIndex, START_INDEX_DEFAULT);\n let ridActual = 0; // current data revision id\n let pending = [];\n\n const elementRoutines = new ElementRoutines($injector, $q);\n const buffer = new ScrollBuffer(elementRoutines, bufferSize, startIndex);\n const viewport = new Viewport(elementRoutines, buffer, element, viewportController, $rootScope, padding);\n const adapter = new Adapter($scope, $parse, $attr, viewport, buffer, doAdjust, reload);\n\n if (viewportController) {\n viewportController.adapter = adapter;\n }\n\n const isDatasourceValid = () =>\n Object.prototype.toString.call(datasource) === '[object Object]' && typeof datasource.get === 'function';\n\n datasource = $parse(datasourceName)($scope); // try to get datasource on scope\n if (!isDatasourceValid()) {\n datasource = $injector.get(datasourceName); // try to inject datasource as service\n if (!isDatasourceValid()) {\n throw new Error(datasourceName + ' is not a valid datasource');\n }\n }\n\n let onRenderHandlers = [];\n function onRenderHandlersRunner() {\n onRenderHandlers.forEach(handler => handler.run());\n onRenderHandlers = [];\n }\n function persistDatasourceIndex(datasource, propName) {\n let getter;\n // need to postpone min/maxIndexUser processing if the view is empty\n if(angular.isNumber(datasource[propName])) {\n getter = datasource[propName];\n if(angular.isNumber(getter)) {\n onRenderHandlers = onRenderHandlers.filter(handler => handler.id !== propName);\n onRenderHandlers.push({\n id: propName,\n run: () => datasource[propName] = getter\n });\n }\n }\n }\n\n function defineDatasourceIndex(datasource, propName, propUserName) {\n const descriptor = Object.getOwnPropertyDescriptor(datasource, propName);\n if (descriptor && (descriptor.set || descriptor.get)) {\n return;\n }\n let getter;\n persistDatasourceIndex(datasource, propName);\n Object.defineProperty(datasource, propName, {\n set: (value) => {\n getter = value;\n if(pending.length && !buffer.length) {\n persistDatasourceIndex(datasource, propName);\n return;\n }\n buffer[propUserName] = value;\n const topPaddingHeightOld = viewport.topDataPos();\n viewport.adjustPaddings();\n if (propName === 'minIndex') {\n viewport.onAfterMinIndexSet(topPaddingHeightOld);\n }\n },\n get: () => getter\n });\n }\n\n defineDatasourceIndex(datasource, 'minIndex', 'minIndexUser');\n defineDatasourceIndex(datasource, 'maxIndex', 'maxIndexUser');\n\n const fetchNext = (datasource.get.length !== 2) ?\n (success) => datasource.get(buffer.next, bufferSize, success) :\n (success) => {\n datasource.get({\n index: buffer.next,\n append: buffer.length ? buffer[buffer.length - 1].item : void 0,\n count: bufferSize\n }, success);\n };\n\n const fetchPrevious = (datasource.get.length !== 2) ?\n (success) => datasource.get(buffer.first - bufferSize, bufferSize, success) :\n (success) => {\n datasource.get({\n index: buffer.first - bufferSize,\n prepend: buffer.length ? buffer[0].item : void 0,\n count: bufferSize\n }, success);\n };\n\n const initialize = () => {\n let tryCount = 0;\n if(!viewport.applyContainerStyle()) {\n const timer = $interval(() => {\n tryCount++;\n if(viewport.applyContainerStyle()) {\n $interval.cancel(timer);\n doAdjust();\n }\n if(tryCount * VIEWPORT_POLLING_INTERVAL >= MAX_VIEWPORT_DELAY) {\n $interval.cancel(timer);\n throw Error(`ui-scroll directive requires a viewport with non-zero height in ${MAX_VIEWPORT_DELAY}ms`);\n }\n }, VIEWPORT_POLLING_INTERVAL);\n }\n else {\n doAdjust();\n }\n };\n\n /**\n * Build padding elements\n *\n * Calling linker is the only way I found to get access to the tag name of the template\n * to prevent the directive scope from pollution a new scope is created and destroyed\n * right after the builder creation is completed\n */\n linker((clone, scope) => {\n viewport.createPaddingElements(clone[0]);\n // we do not include the clone in the DOM. It means that the nested directives will not\n // be able to reach the parent directives, but in this case it is intentional because we\n // created the clone to access the template tag name\n scope.$destroy();\n clone.remove();\n });\n\n $scope.$on('$destroy', () => {\n unbindEvents();\n viewport.off('mousewheel', wheelHandler);\n });\n\n viewport.on('mousewheel', wheelHandler);\n\n initialize();\n\n /* Private function definitions */\n\n function isInvalid(rid) {\n return (rid && rid !== ridActual) || $scope.$$destroyed;\n }\n\n function bindEvents() {\n viewport.on('resize', resizeAndScrollHandler);\n viewport.on('scroll', resizeAndScrollHandler);\n }\n\n function unbindEvents() {\n viewport.off('resize', resizeAndScrollHandler);\n viewport.off('scroll', resizeAndScrollHandler);\n }\n\n function reload() {\n unbindEvents();\n viewport.resetTopPadding();\n viewport.resetBottomPadding();\n if (arguments.length) {\n startIndex = parseNumber(arguments[0], START_INDEX_DEFAULT, false);\n }\n buffer.reset(startIndex);\n persistDatasourceIndex(datasource, 'minIndex');\n persistDatasourceIndex(datasource, 'maxIndex');\n doAdjust();\n }\n\n function isElementVisible(wrapper) {\n return wrapper.element.height() && wrapper.element[0].offsetParent;\n }\n\n function visibilityWatcher(wrapper) {\n if (isElementVisible(wrapper)) {\n buffer.forEach((item) => {\n if (typeof item.unregisterVisibilityWatcher === 'function') {\n item.unregisterVisibilityWatcher();\n delete item.unregisterVisibilityWatcher;\n }\n });\n if (!pending.length) {\n $timeout(() => doAdjust());\n }\n }\n }\n\n function insertWrapperContent(wrapper, insertAfter) {\n createElement(wrapper, insertAfter, viewport.insertElement);\n if (!isElementVisible(wrapper)) {\n wrapper.unregisterVisibilityWatcher = wrapper.scope.$watch(() => visibilityWatcher(wrapper));\n }\n elementRoutines.hideElement(wrapper); // hide inserted elements before data binding\n }\n\n function createElement(wrapper, insertAfter, insertElement) {\n let promises = null;\n const sibling = (insertAfter > 0) ? buffer[insertAfter - 1].element : undefined;\n linker((clone, scope) => {\n promises = insertElement(clone, sibling);\n wrapper.element = clone;\n wrapper.scope = scope;\n scope[itemName] = wrapper.item;\n });\n // ui-scroll-grid apply\n if (adapter.transform) {\n const tdInitializer = wrapper.scope.uiScrollTdInitializer;\n if (tdInitializer && tdInitializer.linking) {\n adapter.transform(wrapper.scope, wrapper.element);\n } else {\n wrapper.scope.uiScrollTdInitializer = {\n onLink: () => adapter.transform(wrapper.scope, wrapper.element),\n scope: wrapper.scope\n };\n }\n }\n return promises;\n }\n\n function updateDOM() {\n let promises = [];\n const toBePrepended = [];\n const toBeRemoved = [];\n const inserted = [];\n\n buffer.forEach((wrapper, i) => {\n switch (wrapper.op) {\n case 'prepend':\n toBePrepended.unshift(wrapper);\n break;\n case 'append':\n insertWrapperContent(wrapper, i);\n wrapper.op = 'none';\n inserted.push(wrapper);\n break;\n case 'insert':\n promises = promises.concat(createElement(wrapper, i, viewport.insertElementAnimated));\n wrapper.op = 'none';\n inserted.push(wrapper);\n break;\n case 'remove':\n toBeRemoved.push(wrapper);\n }\n });\n\n toBeRemoved.forEach((wrapper) => promises = promises.concat(viewport.removeItem(wrapper)));\n\n if (toBePrepended.length)\n toBePrepended.forEach((wrapper) => {\n insertWrapperContent(wrapper);\n wrapper.op = 'none';\n });\n\n buffer.forEach((item, i) => item.scope.$index = buffer.first + i);\n\n return {\n prepended: toBePrepended,\n removed: toBeRemoved,\n inserted: inserted,\n animated: promises\n };\n\n }\n\n function updatePaddings(rid, updates) {\n // schedule another doAdjust after animation completion\n if (updates.animated.length) {\n $q.all(updates.animated).then(() => {\n viewport.adjustPaddings();\n doAdjust(rid);\n });\n } else {\n viewport.adjustPaddings();\n }\n }\n\n function enqueueFetch(rid, updates) {\n if (viewport.shouldLoadBottom()) {\n if (!updates || buffer.effectiveHeight(updates.inserted) > 0) {\n // this means that at least one item appended in the last batch has height > 0\n if (pending.push(true) === 1) {\n adapter.loading(true);\n fetch(rid);\n }\n }\n } else if (viewport.shouldLoadTop()) {\n if ((!updates || buffer.effectiveHeight(updates.prepended) > 0) || pending[0]) {\n // this means that at least one item appended in the last batch has height > 0\n // pending[0] = true means that previous fetch was appending. We need to force at least one prepend\n // BTW there will always be at least 1 element in the pending array because bottom is fetched first\n if (pending.push(false) === 1) {\n adapter.loading(true);\n fetch(rid);\n }\n }\n }\n }\n\n function processUpdates() {\n const updates = updateDOM();\n\n // We need the item bindings to be processed before we can do adjustments\n !$scope.$$phase && !$rootScope.$$phase && $scope.$digest();\n\n updates.inserted.forEach(w => elementRoutines.showElement(w));\n updates.prepended.forEach(w => elementRoutines.showElement(w));\n return updates;\n }\n\n function doAdjust(rid) {\n if (!rid) { // dismiss pending requests\n pending = [];\n rid = ++ridActual;\n }\n\n const updates = processUpdates();\n\n if (isInvalid(rid)) {\n return;\n }\n\n updatePaddings(rid, updates);\n enqueueFetch(rid);\n\n if (!pending.length) {\n adapter.calculateProperties();\n }\n }\n\n function doAdjustAfterFetch(rid) {\n const updates = processUpdates();\n\n viewport.onAfterPrepend(updates);\n\n if (isInvalid(rid)) {\n return;\n }\n\n updatePaddings(rid, updates);\n onRenderHandlersRunner();\n enqueueFetch(rid, updates);\n pending.shift();\n\n if (pending.length)\n fetch(rid);\n else {\n adapter.loading(false);\n bindEvents();\n adapter.calculateProperties();\n }\n }\n\n function fetch(rid) {\n if (pending[0]) {// scrolling down\n if (buffer.length && !viewport.shouldLoadBottom()) {\n doAdjustAfterFetch(rid);\n } else {\n fetchNext((result) => {\n if (isInvalid(rid)) {\n return;\n }\n\n if (result.length < bufferSize) {\n buffer.eof = true;\n }\n\n if (result.length > 0) {\n viewport.clipTop();\n buffer.append(result);\n }\n\n doAdjustAfterFetch(rid);\n });\n }\n } else { // scrolling up\n if (buffer.length && !viewport.shouldLoadTop()) {\n doAdjustAfterFetch(rid);\n } else {\n fetchPrevious((result) => {\n if (isInvalid(rid)) {\n return;\n }\n\n if (result.length < bufferSize) {\n buffer.bof = true;\n // log 'bof is reached'\n }\n\n if (result.length > 0) {\n if (buffer.length) {\n viewport.clipBottom();\n }\n buffer.prepend(result);\n }\n\n doAdjustAfterFetch(rid);\n });\n }\n }\n }\n\n function fixInertia() {\n if (!viewport.synthetic) {\n return;\n }\n const oldPosition = viewport.synthetic.previous;\n const newPosition = viewport.synthetic.next;\n if (viewport.scrollTop() !== newPosition) {\n requestAnimationFrame(() => {\n const position = viewport.scrollTop();\n const diff = oldPosition - position;\n if (diff > 0) { // inertia over synthetic\n viewport.scrollTop(newPosition - diff);\n } else {\n viewport.scrollTop(newPosition);\n }\n viewport.synthetic = null;\n });\n return true;\n }\n viewport.synthetic = null;\n }\n\n function resizeAndScrollHandler() {\n if (handleInertia && fixInertia()) {\n return;\n }\n if (!$rootScope.$$phase && !adapter.isLoading && !adapter.disabled) {\n\n enqueueFetch(ridActual);\n\n if (pending.length) {\n unbindEvents();\n } else {\n adapter.calculateProperties();\n !$scope.$$phase && $scope.$digest();\n }\n }\n }\n\n function wheelHandler(event) {\n if (!adapter.disabled) {\n const scrollTop = viewport[0].scrollTop;\n const yMax = viewport[0].scrollHeight - viewport[0].clientHeight;\n\n if ((scrollTop === 0 && !buffer.bof) || (scrollTop === yMax && !buffer.eof)) {\n event.preventDefault();\n }\n }\n }\n }\n\n }\n ]);\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/modules/jqLiteExtras.js","webpack:///./src/modules/elementRoutines.js","webpack:///./src/modules/utils.js","webpack:///./src/modules/buffer.js","webpack:///./src/modules/padding.js","webpack:///./src/modules/viewport.js","webpack:///./src/modules/adapter.js","webpack:///./src/ui-scroll.js"],"names":["JQLiteExtras","element","convertToPx","css","getStyle","isWindow","angular","prototype","name","value","self","elem","nodeType","style","call","obj","document","location","alert","setInterval","scrollTo","direction","top","left","method","prop","preserve","isValueDefined","documentElement","window","getComputedStyle","parseFloat","currentStyle","result","rs","rsLeft","core_pnum","source","rnumnonpx","RegExp","test","runtimeStyle","pixelLeft","getMeasurements","measure","base","borderA","borderB","computedMarginA","computedMarginB","computedStyle","dirA","dirB","marginA","marginB","paddingA","paddingB","height","width","padding","border","margin","offsetWidth","offsetHeight","getWidthHeight","measurements","outer","outerfull","forEach","before","newElem","children","i","j","parent","ref","contents","prepend","length","after","Error","outerHTML","isNumber","outerHeight","option","outerWidth","offset","docElem","win","box","doc","ownerDocument","arguments","undefined","getBoundingClientRect","defaultView","parentWindow","pageYOffset","scrollTop","clientTop","pageXOffset","scrollLeft","clientLeft","key","hideClassToken","ElementRoutines","selector","rules","sheet","styleSheets","index","cssRules","err","insertRule","addRule","$injector","$q","$animate","has","get","isAngularVersionLessThen1_3","version","major","minor","wrapper","addClass","removeClass","newElement","previousElement","remove","scope","$destroy","insertElement","deferred","defer","enter","resolve","promise","removeElement","leave","then","OPERATIONS","PREPEND","APPEND","INSERT","REMOVE","NONE","ScrollBuffer","elementRoutines","bufferSize","startIndex","buffer","Object","create","Array","extend","size","reset","eof","bof","first","next","minIndex","maxIndex","minIndexUser","maxIndexUser","append","items","item","insert","Math","max","immutableTop","reverse","min","operation","shiftTop","op","splice","push","unshift","arg1","arg2","indexOf","getAbsMinIndex","incrementMinIndex","decrementMaxIndex","removeElementAnimated","getAbsMaxIndex","effectiveHeight","elements","Number","MAX_VALUE","bottom","NEGATIVE_INFINITY","offsetParent","getItems","filter","getFirstItem","list","getLastItem","CacheProto","$index","sort","a","b","argument","_shiftTop","Cache","instance","apply","setPrototypeOf","getOwnPropertyNames","methodName","generateElement","template","Node","ELEMENT_NODE","tagName","toLowerCase","table","find","Padding","cache","Viewport","viewportController","$rootScope","topPadding","bottomPadding","viewport","container","bufferPadding","getScope","createPaddingElements","applyContainerStyle","bottomDataPos","scrollHeight","topDataPos","bottomVisiblePos","topVisiblePos","e","sibling","insertElementAnimated","shouldLoadBottom","clipBottom","overage","overageHeight","itemHeight","emptySpaceHeight","add","adjustPaddings","shouldLoadTop","clipTop","visibleItemsHeight","reduce","summ","topPaddingHeight","topCount","bottomPaddingHeight","bottomCount","totalHeight","averageItemHeight","adjustTopPadding","adjustBottomPadding","topPaddingHeightAdd","bottomPaddingHeightAdd","onAfterMinIndexSet","topPaddingHeightOld","diff","onAfterPrepend","updates","prepended","paddingHeight","position","newPosition","synthetic","previous","resetTopPadding","clear","resetBottomPadding","removeCacheItem","removeItem","Adapter","$scope","$parse","$attr","doAdjust","reload","isLoading","disabled","viewportScope","startScope","$parent","publicContext","assignAdapter","adapter","generatePublicContext","adapterAttr","replace","adapterOnScope","assign","error","message","publicMethods","bind","publicProps","property","attr","defineProperty","set","publicPropsImmediate","newItems","options","arg3","applyUpdatesFunc","applyUpdatesIndex","cb","slice","applyUpdate","_index","isArray","some","newItem","rowTop","topHeight","topDone","bottomDone","itemTop","isEOF","module","constant","run","elt","jQuery","fn","jquery","registerFor","addCSSRules","directive","restrict","controller","child","console","$timeout","$interval","require","transclude","priority","terminal","link","controllers","linker","match","uiScroll","parseNumber","defaultValue","isFloat","floor","isNaN","parseNumericAttr","parseBooleanAttr","BUFFER_MIN","BUFFER_DEFAULT","PADDING_MIN","PADDING_DEFAULT","HANDLE_INERTIA_DEFAULT","START_INDEX_DEFAULT","MAX_VIEWPORT_DELAY","VIEWPORT_POLLING_INTERVAL","datasource","itemName","datasourceName","handleInertia","ridActual","pending","isDatasourceValid","toString","onRenderHandlers","onRenderHandlersRunner","handler","persistDatasourceIndex","propName","getter","id","defineDatasourceIndex","propUserName","descriptor","getOwnPropertyDescriptor","fetchNext","success","count","fetchPrevious","initialize","tryCount","timer","cancel","clone","$on","unbindEvents","off","wheelHandler","on","isInvalid","rid","$$destroyed","bindEvents","resizeAndScrollHandler","isElementVisible","visibilityWatcher","unregisterVisibilityWatcher","insertWrapperContent","insertAfter","createElement","$watch","hideElement","promises","transform","tdInitializer","uiScrollTdInitializer","linking","onLink","updateDOM","toBePrepended","toBeRemoved","inserted","concat","removed","animated","updatePaddings","all","enqueueFetch","loading","fetch","processUpdates","$$phase","$digest","w","showElement","calculateProperties","doAdjustAfterFetch","shift","fixInertia","oldPosition","requestAnimationFrame","event","yMax","clientHeight","preventDefault"],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QA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mBvJ,MAAM,CAACwJ,OAAP,EAAnB;AACD;AACF;AACF;;AAED,aAASnC,YAAT,CAAsB4C,KAAtB,EAA6B;AAC3B,UAAI,CAACrJ,OAAO,CAACN,QAAb,EAAuB;AACrB,YAAM/L,SAAS,GAAGmI,QAAQ,CAAC,CAAD,CAAR,CAAYnI,SAA9B;AACA,YAAM2V,IAAI,GAAGxN,QAAQ,CAAC,CAAD,CAAR,CAAYO,YAAZ,GAA2BP,QAAQ,CAAC,CAAD,CAAR,CAAYyN,YAApD;;AAEA,YAAK5V,SAAS,KAAK,CAAd,IAAmB,CAACqD,MAAM,CAACQ,GAA5B,IAAqC7D,SAAS,KAAK2V,IAAd,IAAsB,CAACtS,MAAM,CAACO,GAAvE,EAA6E;AAC3E8R,eAAK,CAACG,cAAN;AACD;AACF;AACF;AACF;AAEF,CA3foB,CAhCzB,E","file":"ui-scroll.js","sourcesContent":[" \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, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\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\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n","/*!\r\n globals: angular, window\r\n List of used element methods available in JQuery but not in JQuery Lite\r\n element.before(elem)\r\n element.height()\r\n element.outerHeight(true)\r\n element.height(value) = only for Top/Bottom padding elements\r\n element.scrollTop()\r\n element.scrollTop(value)\r\n */\r\n\r\nexport default class JQLiteExtras {\r\n\r\n registerFor(element) {\r\n let convertToPx, css, getStyle, isWindow;\r\n // angular implementation blows up if elem is the window\r\n css = angular.element.prototype.css;\r\n\r\n element.prototype.css = function (name, value) {\r\n let self = this;\r\n let elem = self[0];\r\n if (!(!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style)) {\r\n return css.call(self, name, value);\r\n }\r\n };\r\n\r\n // as defined in angularjs v1.0.5\r\n isWindow = (obj) => obj && obj.document && obj.location && obj.alert && obj.setInterval;\r\n\r\n function scrollTo(self, direction, value) {\r\n let elem = self[0];\r\n let [method, prop, preserve] = {\r\n top: [\r\n 'scrollTop',\r\n 'pageYOffset',\r\n 'scrollLeft'\r\n ],\r\n left: [\r\n 'scrollLeft',\r\n 'pageXOffset',\r\n 'scrollTop'\r\n ]\r\n }[direction];\r\n\r\n const isValueDefined = typeof value !== 'undefined';\r\n if (isWindow(elem)) {\r\n if (isValueDefined) {\r\n return elem.scrollTo(self[preserve].call(self), value);\r\n }\r\n return (prop in elem) ? elem[prop] : elem.document.documentElement[method];\r\n } else {\r\n if (isValueDefined) {\r\n elem[method] = value;\r\n }\r\n return elem[method];\r\n }\r\n }\r\n\r\n if (window.getComputedStyle) {\r\n getStyle = (elem) => window.getComputedStyle(elem, null);\r\n convertToPx = (elem, value) => parseFloat(value);\r\n } else {\r\n getStyle = (elem) => elem.currentStyle;\r\n convertToPx = (elem, value) => {\r\n let left, result, rs, rsLeft, style;\r\n let core_pnum = /[+-]?(?:\\d*\\.|)\\d+(?:[eE][+-]?\\d+|)/.source;\r\n let rnumnonpx = new RegExp('^(' + core_pnum + ')(?!px)[a-z%]+$', 'i');\r\n\r\n if (!rnumnonpx.test(value)) {\r\n return parseFloat(value);\r\n }\r\n\r\n // ported from JQuery\r\n style = elem.style;\r\n left = style.left;\r\n rs = elem.runtimeStyle;\r\n rsLeft = rs && rs.left;\r\n if (rs) {\r\n rs.left = style.left;\r\n }\r\n // put in the new values to get a computed style out\r\n style.left = value;\r\n result = style.pixelLeft;\r\n style.left = left;\r\n if (rsLeft) {\r\n rs.left = rsLeft;\r\n }\r\n return result;\r\n };\r\n }\r\n\r\n function getMeasurements(elem, measure) {\r\n let base, borderA, borderB, computedMarginA, computedMarginB, computedStyle, dirA, dirB, marginA, marginB, paddingA, paddingB;\r\n\r\n if (isWindow(elem)) {\r\n base = document.documentElement[{height: 'clientHeight', width: 'clientWidth'}[measure]];\r\n\r\n return {\r\n base: base,\r\n padding: 0,\r\n border: 0,\r\n margin: 0\r\n };\r\n }\r\n\r\n // Start with offset property\r\n [\r\n base,\r\n dirA,\r\n dirB\r\n ] = {\r\n width: [\r\n elem.offsetWidth,\r\n 'Left',\r\n 'Right'\r\n ],\r\n height: [\r\n elem.offsetHeight,\r\n 'Top',\r\n 'Bottom'\r\n ]\r\n }[measure];\r\n\r\n computedStyle = getStyle(elem);\r\n paddingA = convertToPx(elem, computedStyle['padding' + dirA]) || 0;\r\n paddingB = convertToPx(elem, computedStyle['padding' + dirB]) || 0;\r\n borderA = convertToPx(elem, computedStyle['border' + dirA + 'Width']) || 0;\r\n borderB = convertToPx(elem, computedStyle['border' + dirB + 'Width']) || 0;\r\n computedMarginA = computedStyle['margin' + dirA];\r\n computedMarginB = computedStyle['margin' + dirB];\r\n\r\n // I do not care for width for now, so this hack is irrelevant\r\n // if ( !supportsPercentMargin )\r\n // computedMarginA = hackPercentMargin( elem, computedStyle, computedMarginA )\r\n // computedMarginB = hackPercentMargin( elem, computedStyle, computedMarginB )\r\n marginA = convertToPx(elem, computedMarginA) || 0;\r\n marginB = convertToPx(elem, computedMarginB) || 0;\r\n\r\n return {\r\n base: base,\r\n padding: paddingA + paddingB,\r\n border: borderA + borderB,\r\n margin: marginA + marginB\r\n };\r\n }\r\n\r\n function getWidthHeight(elem, direction, measure) {\r\n let computedStyle, result;\r\n\r\n let measurements = getMeasurements(elem, direction);\r\n\r\n if (measurements.base > 0) {\r\n return {\r\n base: measurements.base - measurements.padding - measurements.border,\r\n outer: measurements.base,\r\n outerfull: measurements.base + measurements.margin\r\n }[measure];\r\n }\r\n\r\n // Fall back to computed then uncomputed css if necessary\r\n computedStyle = getStyle(elem);\r\n result = computedStyle[direction];\r\n\r\n if (result < 0 || result === null) {\r\n result = elem.style[direction] || 0;\r\n }\r\n\r\n // Normalize \"\", auto, and prepare for extra\r\n result = parseFloat(result) || 0;\r\n\r\n return {\r\n base: result - measurements.padding - measurements.border,\r\n outer: result,\r\n outerfull: result + measurements.padding + measurements.border + measurements.margin\r\n }[measure];\r\n }\r\n\r\n // define missing methods\r\n return angular.forEach({\r\n before(newElem) {\r\n var children, elem, i, j, parent, ref, self;\r\n self = this;\r\n elem = self[0];\r\n parent = self.parent();\r\n children = parent.contents();\r\n if (children[0] === elem) {\r\n return parent.prepend(newElem);\r\n } else {\r\n for (i = j = 1, ref = children.length - 1; 1 <= ref ? j <= ref : j >= ref; i = 1 <= ref ? ++j : --j) {\r\n if (children[i] === elem) {\r\n angular.element(children[i - 1]).after(newElem);\r\n return;\r\n }\r\n }\r\n throw new Error('invalid DOM structure ' + elem.outerHTML);\r\n }\r\n },\r\n height (value){\r\n var self;\r\n self = this;\r\n if (typeof value !== 'undefined') {\r\n if (angular.isNumber(value)) {\r\n value = value + 'px';\r\n }\r\n return css.call(self, 'height', value);\r\n } else {\r\n return getWidthHeight(this[0], 'height', 'base');\r\n }\r\n },\r\n outerHeight(option) {\r\n return getWidthHeight(this[0], 'height', option ? 'outerfull' : 'outer');\r\n },\r\n outerWidth(option) {\r\n return getWidthHeight(this[0], 'width', option ? 'outerfull' : 'outer');\r\n },\r\n\r\n /*\r\n The offset setter method is not implemented\r\n */\r\n offset(value) {\r\n let docElem, win;\r\n let self = this;\r\n let box = {\r\n top: 0,\r\n left: 0\r\n };\r\n let elem = self[0];\r\n let doc = elem && elem.ownerDocument;\r\n\r\n if (arguments.length) {\r\n if (value === undefined) {\r\n return self;\r\n }\r\n // TODO: implement setter\r\n throw new Error('offset setter method is not implemented');\r\n }\r\n\r\n if (!doc) {\r\n return;\r\n }\r\n\r\n docElem = doc.documentElement;\r\n\r\n // TODO: Make sure it's not a disconnected DOM node\r\n\r\n if (elem.getBoundingClientRect != null) {\r\n box = elem.getBoundingClientRect();\r\n }\r\n\r\n win = doc.defaultView || doc.parentWindow;\r\n\r\n return {\r\n top: box.top + (win.pageYOffset || docElem.scrollTop) - (docElem.clientTop || 0),\r\n left: box.left + (win.pageXOffset || docElem.scrollLeft) - (docElem.clientLeft || 0)\r\n };\r\n },\r\n scrollTop(value) {\r\n return scrollTo(this, 'top', value);\r\n },\r\n scrollLeft(value) {\r\n return scrollTo(this, 'left', value);\r\n }\r\n }, (value, key) => {\r\n if (!element.prototype[key]) {\r\n return element.prototype[key] = value;\r\n }\r\n });\r\n }\r\n\r\n}\r\n","const hideClassToken = 'ng-ui-scroll-hide';\r\n\r\nexport default class ElementRoutines {\r\n\r\n static addCSSRules() {\r\n const selector = '.' + hideClassToken;\r\n const rules = 'display: none';\r\n const sheet = document.styleSheets[0];\r\n let index;\r\n try {\r\n index = sheet.cssRules.length;\r\n } catch (err) {\r\n index = 0;\r\n }\r\n if('insertRule' in sheet) {\r\n sheet.insertRule(selector + '{' + rules + '}', index);\r\n }\r\n else if('addRule' in sheet) {\r\n sheet.addRule(selector, rules, index);\r\n }\r\n }\r\n\r\n constructor($injector, $q) {\r\n this.$animate = ($injector.has && $injector.has('$animate')) ? $injector.get('$animate') : null;\r\n this.isAngularVersionLessThen1_3 = angular.version.major === 1 && angular.version.minor < 3;\r\n this.$q = $q;\r\n }\r\n\r\n hideElement(wrapper) {\r\n wrapper.element.addClass(hideClassToken);\r\n }\r\n\r\n showElement(wrapper) {\r\n wrapper.element.removeClass(hideClassToken);\r\n }\r\n\r\n insertElement(newElement, previousElement) {\r\n previousElement.after(newElement);\r\n return [];\r\n }\r\n\r\n removeElement(wrapper) {\r\n wrapper.element.remove();\r\n wrapper.scope.$destroy();\r\n return [];\r\n }\r\n\r\n insertElementAnimated(newElement, previousElement) {\r\n if (!this.$animate) {\r\n return this.insertElement(newElement, previousElement);\r\n }\r\n\r\n if (this.isAngularVersionLessThen1_3) {\r\n const deferred = this.$q.defer();\r\n // no need for parent - previous element is never null\r\n this.$animate.enter(newElement, null, previousElement, () => deferred.resolve());\r\n\r\n return [deferred.promise];\r\n }\r\n\r\n // no need for parent - previous element is never null\r\n return [this.$animate.enter(newElement, null, previousElement)];\r\n }\r\n\r\n removeElementAnimated(wrapper) {\r\n if (!this.$animate) {\r\n return this.removeElement(wrapper);\r\n }\r\n\r\n if (this.isAngularVersionLessThen1_3) {\r\n const deferred = this.$q.defer();\r\n this.$animate.leave(wrapper.element, () => {\r\n wrapper.scope.$destroy();\r\n return deferred.resolve();\r\n });\r\n\r\n return [deferred.promise];\r\n }\r\n\r\n return [(this.$animate.leave(wrapper.element)).then(() => wrapper.scope.$destroy())];\r\n }\r\n}","export const OPERATIONS = {\r\n PREPEND: 'prepend',\r\n APPEND: 'append',\r\n INSERT: 'insert',\r\n REMOVE: 'remove',\r\n NONE: 'none'\r\n};\r\n","import { OPERATIONS } from './utils';\r\n\r\nexport default function ScrollBuffer(elementRoutines, bufferSize, startIndex) {\r\n const buffer = Object.create(Array.prototype);\r\n\r\n angular.extend(buffer, {\r\n size: bufferSize,\r\n\r\n reset(startIndex) {\r\n buffer.remove(0, buffer.length);\r\n buffer.eof = false;\r\n buffer.bof = false;\r\n buffer.first = startIndex;\r\n buffer.next = startIndex;\r\n buffer.minIndex = startIndex;\r\n buffer.maxIndex = startIndex;\r\n buffer.minIndexUser = null;\r\n buffer.maxIndexUser = null;\r\n },\r\n\r\n append(items) {\r\n items.forEach((item) => {\r\n ++buffer.next;\r\n buffer.insert(OPERATIONS.APPEND, item);\r\n });\r\n buffer.maxIndex = buffer.eof ? buffer.next - 1 : Math.max(buffer.next - 1, buffer.maxIndex);\r\n },\r\n\r\n prepend(items, immutableTop) {\r\n items.reverse().forEach((item) => {\r\n if (immutableTop) {\r\n ++buffer.next;\r\n }\r\n else {\r\n --buffer.first;\r\n }\r\n buffer.insert(OPERATIONS.PREPEND, item);\r\n });\r\n buffer.minIndex = buffer.bof ? buffer.minIndex = buffer.first : Math.min(buffer.first, buffer.minIndex);\r\n },\r\n\r\n /**\r\n * inserts wrapped element in the buffer\r\n * the first argument is either operation keyword (see below) or a number for operation 'insert'\r\n * for insert the number is the index for the buffer element the new one have to be inserted after\r\n * operations: 'append', 'prepend', 'insert', 'remove', 'none'\r\n */\r\n insert(operation, item, shiftTop) {\r\n const wrapper = {\r\n item: item\r\n };\r\n\r\n if (operation % 1 === 0) { // it is an insert\r\n wrapper.op = OPERATIONS.INSERT;\r\n buffer.splice(operation, 0, wrapper);\r\n if (shiftTop) {\r\n buffer.first--;\r\n }\r\n else {\r\n buffer.next++;\r\n }\r\n } else {\r\n wrapper.op = operation;\r\n switch (operation) {\r\n case OPERATIONS.APPEND:\r\n buffer.push(wrapper);\r\n break;\r\n case OPERATIONS.PREPEND:\r\n buffer.unshift(wrapper);\r\n break;\r\n }\r\n }\r\n },\r\n\r\n // removes elements from buffer\r\n remove(arg1, arg2) {\r\n if (angular.isNumber(arg1)) {\r\n // removes items from arg1 (including) through arg2 (excluding)\r\n for (let i = arg1; i < arg2; i++) {\r\n elementRoutines.removeElement(buffer[i]);\r\n }\r\n return buffer.splice(arg1, arg2 - arg1);\r\n }\r\n // removes single item (wrapper) from the buffer\r\n buffer.splice(buffer.indexOf(arg1), 1);\r\n if (arg1.shiftTop && buffer.first === this.getAbsMinIndex()) {\r\n this.incrementMinIndex();\r\n }\r\n else {\r\n this.decrementMaxIndex();\r\n }\r\n if (arg1.shiftTop) {\r\n buffer.first++;\r\n }\r\n else {\r\n buffer.next--;\r\n }\r\n if (!buffer.length) {\r\n buffer.minIndex = Math.min(buffer.maxIndex, buffer.minIndex);\r\n }\r\n\r\n return elementRoutines.removeElementAnimated(arg1);\r\n },\r\n\r\n incrementMinIndex() {\r\n if (buffer.minIndexUser !== null) {\r\n if (buffer.minIndex > buffer.minIndexUser) {\r\n buffer.minIndexUser++;\r\n return;\r\n }\r\n if (buffer.minIndex === buffer.minIndexUser) {\r\n buffer.minIndexUser++;\r\n }\r\n }\r\n buffer.minIndex++;\r\n },\r\n\r\n decrementMaxIndex() {\r\n if (buffer.maxIndexUser !== null && buffer.maxIndex <= buffer.maxIndexUser) {\r\n buffer.maxIndexUser--;\r\n }\r\n buffer.maxIndex--;\r\n },\r\n\r\n getAbsMinIndex() {\r\n if (buffer.minIndexUser !== null) {\r\n return Math.min(buffer.minIndexUser, buffer.minIndex);\r\n }\r\n return buffer.minIndex;\r\n },\r\n\r\n getAbsMaxIndex() {\r\n if (buffer.maxIndexUser !== null) {\r\n return Math.max(buffer.maxIndexUser, buffer.maxIndex);\r\n }\r\n return buffer.maxIndex;\r\n },\r\n\r\n effectiveHeight(elements) {\r\n if (!elements.length) {\r\n return 0;\r\n }\r\n let top = Number.MAX_VALUE;\r\n let bottom = Number.NEGATIVE_INFINITY;\r\n elements.forEach((wrapper) => {\r\n if (wrapper.element[0].offsetParent) {\r\n // element style is not display:none\r\n top = Math.min(top, wrapper.element.offset().top);\r\n bottom = Math.max(bottom, wrapper.element.offset().top + wrapper.element.outerHeight(true));\r\n }\r\n });\r\n return Math.max(0, bottom - top);\r\n },\r\n\r\n getItems() {\r\n return buffer.filter(item => item.op === OPERATIONS.NONE);\r\n },\r\n\r\n getFirstItem() {\r\n const list = buffer.getItems();\r\n if (!list.length) {\r\n return null;\r\n }\r\n return list[0].item;\r\n },\r\n\r\n getLastItem() {\r\n const list = buffer.getItems();\r\n if (!list.length) {\r\n return null;\r\n }\r\n return list[list.length - 1].item;\r\n }\r\n\r\n });\r\n\r\n buffer.reset(startIndex);\r\n\r\n return buffer;\r\n}\r\n","// Can't just extend the Array, due to Babel does not support built-in classes extending\r\n// This solution was taken from https://stackoverflow.com/questions/46897414/es6-class-extends-array-workaround-for-es5-babel-transpile\r\nclass CacheProto {\r\n add(item) {\r\n for (let i = this.length - 1; i >= 0; i--) {\r\n if (this[i].index === item.scope.$index) {\r\n this[i].height = item.element.outerHeight();\r\n return;\r\n }\r\n }\r\n this.push({\r\n index: item.scope.$index,\r\n height: item.element.outerHeight()\r\n });\r\n this.sort((a, b) => ((a.index < b.index) ? -1 : ((a.index > b.index) ? 1 : 0)));\r\n }\r\n\r\n remove(argument, _shiftTop) {\r\n const index = argument % 1 === 0 ? argument : argument.scope.$index;\r\n const shiftTop = argument % 1 === 0 ? _shiftTop : argument.shiftTop;\r\n for (let i = this.length - 1; i >= 0; i--) {\r\n if (this[i].index === index) {\r\n this.splice(i, 1);\r\n break;\r\n }\r\n }\r\n if (!shiftTop) {\r\n for (let i = this.length - 1; i >= 0; i--) {\r\n if (this[i].index > index) {\r\n this[i].index--;\r\n }\r\n }\r\n }\r\n }\r\n\r\n clear() {\r\n this.length = 0;\r\n }\r\n}\r\n\r\nfunction Cache() {\r\n const instance = [];\r\n instance.push.apply(instance, arguments);\r\n Object.setPrototypeOf(instance, Cache.prototype);\r\n return instance;\r\n}\r\nCache.prototype = Object.create(Array.prototype);\r\nObject.getOwnPropertyNames(CacheProto.prototype).forEach(methodName =>\r\n Cache.prototype[methodName] = CacheProto.prototype[methodName]\r\n);\r\n\r\nfunction generateElement(template) {\r\n if (template.nodeType !== Node.ELEMENT_NODE) {\r\n throw new Error('ui-scroll directive requires an Element node for templating the view');\r\n }\r\n let element;\r\n switch (template.tagName.toLowerCase()) {\r\n case 'dl':\r\n throw new Error(`ui-scroll directive does not support <${template.tagName}> as a repeating tag: ${template.outerHTML}`);\r\n case 'tr':\r\n let table = angular.element('
    ');\r\n element = table.find('tr');\r\n break;\r\n case 'li':\r\n element = angular.element('
  • ');\r\n break;\r\n default:\r\n element = angular.element('
    ');\r\n }\r\n return element;\r\n}\r\n\r\nclass Padding {\r\n constructor(template) {\r\n this.element = generateElement(template);\r\n this.cache = new Cache();\r\n }\r\n\r\n height() {\r\n return this.element.height.apply(this.element, arguments);\r\n }\r\n}\r\n\r\nexport default Padding;","import Padding from './padding';\r\n\r\nexport default function Viewport(elementRoutines, buffer, element, viewportController, $rootScope, padding) {\r\n let topPadding = null;\r\n let bottomPadding = null;\r\n const viewport = viewportController && viewportController.viewport ? viewportController.viewport : angular.element(window);\r\n const container = viewportController && viewportController.container ? viewportController.container : undefined;\r\n const scope = viewportController && viewportController.scope ? viewportController.scope : $rootScope;\r\n\r\n viewport.css({\r\n 'overflow-anchor': 'none',\r\n 'overflow-y': 'auto',\r\n 'display': 'block'\r\n });\r\n\r\n function bufferPadding() {\r\n return viewport.outerHeight() * padding; // some extra space to initiate preload\r\n }\r\n\r\n angular.extend(viewport, {\r\n getScope() {\r\n return scope;\r\n },\r\n\r\n createPaddingElements(template) {\r\n topPadding = new Padding(template);\r\n bottomPadding = new Padding(template);\r\n element.before(topPadding.element);\r\n element.after(bottomPadding.element);\r\n topPadding.height(0);\r\n bottomPadding.height(0);\r\n },\r\n\r\n applyContainerStyle() {\r\n if (!container) {\r\n return true;\r\n }\r\n if (container !== viewport) {\r\n viewport.css('height', window.getComputedStyle(container[0]).height);\r\n }\r\n return viewport.height() > 0;\r\n },\r\n\r\n bottomDataPos() {\r\n let scrollHeight = viewport[0].scrollHeight;\r\n scrollHeight = scrollHeight != null ? scrollHeight : viewport[0].document.documentElement.scrollHeight;\r\n return scrollHeight - bottomPadding.height();\r\n },\r\n\r\n topDataPos() {\r\n return topPadding.height();\r\n },\r\n\r\n bottomVisiblePos() {\r\n return viewport.scrollTop() + viewport.outerHeight();\r\n },\r\n\r\n topVisiblePos() {\r\n return viewport.scrollTop();\r\n },\r\n\r\n insertElement(e, sibling) {\r\n return elementRoutines.insertElement(e, sibling || topPadding.element);\r\n },\r\n\r\n insertElementAnimated(e, sibling) {\r\n return elementRoutines.insertElementAnimated(e, sibling || topPadding.element);\r\n },\r\n\r\n shouldLoadBottom() {\r\n return !buffer.eof && viewport.bottomDataPos() < viewport.bottomVisiblePos() + bufferPadding();\r\n },\r\n\r\n clipBottom() {\r\n // clip the invisible items off the bottom\r\n let overage = 0;\r\n let overageHeight = 0;\r\n let itemHeight = 0;\r\n let emptySpaceHeight = viewport.bottomDataPos() - viewport.bottomVisiblePos() - bufferPadding();\r\n\r\n for (let i = buffer.length - 1; i >= 0; i--) {\r\n itemHeight = buffer[i].element.outerHeight(true);\r\n if (overageHeight + itemHeight > emptySpaceHeight) {\r\n break;\r\n }\r\n bottomPadding.cache.add(buffer[i]);\r\n overageHeight += itemHeight;\r\n overage++;\r\n }\r\n\r\n if (overage > 0) {\r\n buffer.eof = false;\r\n buffer.remove(buffer.length - overage, buffer.length);\r\n buffer.next -= overage;\r\n viewport.adjustPaddings();\r\n }\r\n },\r\n\r\n shouldLoadTop() {\r\n return !buffer.bof && (viewport.topDataPos() > viewport.topVisiblePos() - bufferPadding());\r\n },\r\n\r\n clipTop() {\r\n // clip the invisible items off the top\r\n let overage = 0;\r\n let overageHeight = 0;\r\n let itemHeight = 0;\r\n let emptySpaceHeight = viewport.topVisiblePos() - viewport.topDataPos() - bufferPadding();\r\n\r\n for (let i = 0; i < buffer.length; i++) {\r\n itemHeight = buffer[i].element.outerHeight(true);\r\n if (overageHeight + itemHeight > emptySpaceHeight) {\r\n break;\r\n }\r\n topPadding.cache.add(buffer[i]);\r\n overageHeight += itemHeight;\r\n overage++;\r\n }\r\n\r\n if (overage > 0) {\r\n // we need to adjust top padding element before items are removed from top\r\n // to avoid strange behaviour of scroll bar during remove top items when we are at the very bottom\r\n topPadding.height(topPadding.height() + overageHeight);\r\n buffer.bof = false;\r\n buffer.remove(0, overage);\r\n buffer.first += overage;\r\n }\r\n },\r\n\r\n adjustPaddings() {\r\n if (!buffer.length) {\r\n return;\r\n }\r\n\r\n // precise heights calculation based on items that are in buffer or that were in buffer once\r\n const visibleItemsHeight = buffer.reduce((summ, item) => summ + item.element.outerHeight(true), 0);\r\n\r\n let topPaddingHeight = 0, topCount = 0;\r\n topPadding.cache.forEach(item => {\r\n if (item.index < buffer.first) {\r\n topPaddingHeight += item.height;\r\n topCount++;\r\n }\r\n });\r\n\r\n let bottomPaddingHeight = 0, bottomCount = 0;\r\n bottomPadding.cache.forEach(item => {\r\n if (item.index >= buffer.next) {\r\n bottomPaddingHeight += item.height;\r\n bottomCount++;\r\n }\r\n });\r\n\r\n const totalHeight = visibleItemsHeight + topPaddingHeight + bottomPaddingHeight;\r\n const averageItemHeight = totalHeight / (topCount + bottomCount + buffer.length);\r\n\r\n // average heights calculation, items that have never been reached\r\n let adjustTopPadding = buffer.minIndexUser !== null && buffer.minIndex > buffer.minIndexUser;\r\n let adjustBottomPadding = buffer.maxIndexUser !== null && buffer.maxIndex < buffer.maxIndexUser;\r\n let topPaddingHeightAdd = adjustTopPadding ? (buffer.minIndex - buffer.minIndexUser) * averageItemHeight : 0;\r\n let bottomPaddingHeightAdd = adjustBottomPadding ? (buffer.maxIndexUser - buffer.maxIndex) * averageItemHeight : 0;\r\n\r\n // paddings combine adjustment\r\n topPadding.height(topPaddingHeight + topPaddingHeightAdd);\r\n bottomPadding.height(bottomPaddingHeight + bottomPaddingHeightAdd);\r\n },\r\n\r\n onAfterMinIndexSet(topPaddingHeightOld) {\r\n // additional scrollTop adjustment in case of datasource.minIndex external set\r\n if (buffer.minIndexUser !== null && buffer.minIndex > buffer.minIndexUser) {\r\n let diff = topPadding.height() - topPaddingHeightOld;\r\n viewport.scrollTop(viewport.scrollTop() + diff);\r\n while((diff -= viewport.scrollTop()) > 0) {\r\n bottomPadding.height(bottomPadding.height() + diff);\r\n viewport.scrollTop(viewport.scrollTop() + diff);\r\n }\r\n }\r\n },\r\n\r\n onAfterPrepend(updates) {\r\n if (!updates.prepended.length) {\r\n return;\r\n }\r\n const height = buffer.effectiveHeight(updates.prepended);\r\n const paddingHeight = topPadding.height() - height;\r\n if (paddingHeight >= 0) {\r\n topPadding.height(paddingHeight);\r\n return;\r\n }\r\n const position = viewport.scrollTop();\r\n const newPosition = position - paddingHeight;\r\n viewport.synthetic = { previous: position, next: newPosition };\r\n topPadding.height(0);\r\n viewport.scrollTop(newPosition);\r\n },\r\n\r\n resetTopPadding() {\r\n topPadding.height(0);\r\n topPadding.cache.clear();\r\n },\r\n\r\n resetBottomPadding() {\r\n bottomPadding.height(0);\r\n bottomPadding.cache.clear();\r\n },\r\n\r\n removeCacheItem(item, shiftTop) {\r\n topPadding.cache.remove(item, shiftTop);\r\n bottomPadding.cache.remove(item, shiftTop);\r\n },\r\n\r\n removeItem(item) {\r\n this.removeCacheItem(item);\r\n return buffer.remove(item);\r\n }\r\n });\r\n\r\n return viewport;\r\n}\r\n","import { OPERATIONS } from './utils';\r\n\r\nclass Adapter {\r\n\r\n constructor($scope, $parse, $attr, viewport, buffer, doAdjust, reload) {\r\n this.$parse = $parse;\r\n this.$attr = $attr;\r\n this.viewport = viewport;\r\n this.buffer = buffer;\r\n\r\n this.doAdjust = doAdjust;\r\n this.reload = reload;\r\n\r\n this.isLoading = false;\r\n this.disabled = false;\r\n\r\n const viewportScope = viewport.getScope();\r\n this.startScope = viewportScope.$parent ? viewportScope : $scope;\r\n\r\n this.publicContext = {};\r\n this.assignAdapter($attr.adapter);\r\n this.generatePublicContext();\r\n }\r\n\r\n assignAdapter(adapterAttr) {\r\n if (!adapterAttr || !(adapterAttr = adapterAttr.replace(/^\\s+|\\s+$/gm, ''))) {\r\n return;\r\n }\r\n let adapterOnScope;\r\n\r\n try {\r\n this.$parse(adapterAttr).assign(this.startScope, {});\r\n adapterOnScope = this.$parse(adapterAttr)(this.startScope);\r\n }\r\n catch (error) {\r\n error.message = `Angular ui-scroll Adapter assignment exception.\\n` +\r\n `Can't parse \"${adapterAttr}\" expression.\\n` +\r\n error.message;\r\n throw error;\r\n }\r\n\r\n angular.extend(adapterOnScope, this.publicContext);\r\n this.publicContext = adapterOnScope;\r\n }\r\n\r\n generatePublicContext() {\r\n // these methods will be accessible out of ui-scroll via user defined adapter\r\n const publicMethods = ['reload', 'applyUpdates', 'append', 'prepend', 'isBOF', 'isEOF', 'isEmpty'];\r\n for (let i = publicMethods.length - 1; i >= 0; i--) {\r\n this.publicContext[publicMethods[i]] = this[publicMethods[i]].bind(this);\r\n }\r\n\r\n // these read-only props will be accessible out of ui-scroll via user defined adapter\r\n const publicProps = ['isLoading', 'topVisible', 'topVisibleElement', 'topVisibleScope', 'bottomVisible', 'bottomVisibleElement', 'bottomVisibleScope'];\r\n for (let i = publicProps.length - 1; i >= 0; i--) {\r\n let property, attr = this.$attr[publicProps[i]];\r\n Object.defineProperty(this, publicProps[i], {\r\n get: () => property,\r\n set: (value) => {\r\n property = value;\r\n this.publicContext[publicProps[i]] = value;\r\n if (attr) {\r\n this.$parse(attr).assign(this.startScope, value);\r\n }\r\n }\r\n });\r\n }\r\n\r\n // read-only immediately calculated public properties\r\n const publicPropsImmediate = ['bufferFirst', 'bufferLast', 'bufferLength'];\r\n for (let i = publicPropsImmediate.length - 1; i >= 0; i--) {\r\n Object.defineProperty(this.publicContext, publicPropsImmediate[i], {\r\n get: () => this[publicPropsImmediate[i]]\r\n });\r\n }\r\n\r\n // non-read-only public property\r\n Object.defineProperty(this.publicContext, 'disabled', {\r\n get: () => this.disabled,\r\n set: (value) => (!(this.disabled = value)) ? this.doAdjust() : null\r\n });\r\n }\r\n\r\n loading(value) {\r\n this.isLoading = value;\r\n }\r\n\r\n isBOF() {\r\n return this.buffer.bof;\r\n }\r\n\r\n isEOF() {\r\n return this.buffer.eof;\r\n }\r\n\r\n isEmpty() {\r\n return !this.buffer.length;\r\n }\r\n\r\n get bufferLength() {\r\n return this.buffer.getItems().length;\r\n }\r\n\r\n get bufferFirst() {\r\n return this.buffer.getFirstItem();\r\n }\r\n\r\n get bufferLast() {\r\n return this.buffer.getLastItem();\r\n }\r\n\r\n append(newItems) {\r\n this.buffer.append(newItems);\r\n this.doAdjust();\r\n this.viewport.clipTop();\r\n this.viewport.clipBottom();\r\n }\r\n\r\n prepend(newItems, options = {}) {\r\n this.buffer.prepend(newItems, options.immutableTop);\r\n this.doAdjust();\r\n this.viewport.clipTop();\r\n this.viewport.clipBottom();\r\n }\r\n\r\n applyUpdates(arg1, arg2, arg3) {\r\n if (typeof arg1 === 'function') {\r\n this.applyUpdatesFunc(arg1, arg2);\r\n } else {\r\n this.applyUpdatesIndex(arg1, arg2, arg3);\r\n }\r\n this.doAdjust();\r\n }\r\n\r\n applyUpdatesFunc(cb, options = {}) {\r\n this.buffer.slice(0).forEach((wrapper) => {\r\n // we need to do it on the buffer clone, because buffer content\r\n // may change as we iterate through\r\n this.applyUpdate(wrapper, cb(wrapper.item, wrapper.scope, wrapper.element), options);\r\n });\r\n }\r\n\r\n applyUpdatesIndex(index, newItems, options = {}) {\r\n if (index % 1 !== 0) {\r\n throw new Error('applyUpdates - ' + index + ' is not a valid index (should be an integer)');\r\n }\r\n const _index = index - this.buffer.first;\r\n\r\n // apply updates only within buffer\r\n if (_index >= 0 && _index < this.buffer.length) {\r\n this.applyUpdate(this.buffer[_index], newItems, options);\r\n }\r\n // out-of-buffer case: deletion may affect Paddings\r\n else if(index >= this.buffer.getAbsMinIndex() && index <= this.buffer.getAbsMaxIndex()) {\r\n if(angular.isArray(newItems) && !newItems.length) {\r\n this.viewport.removeCacheItem(index, !options.immutableTop && index === this.buffer.minIndex);\r\n if (!options.immutableTop && index === this.buffer.getAbsMinIndex()) {\r\n this.buffer.incrementMinIndex();\r\n }\r\n else {\r\n this.buffer.decrementMaxIndex();\r\n }\r\n }\r\n }\r\n }\r\n\r\n applyUpdate(wrapper, newItems, options = {}) {\r\n if (!angular.isArray(newItems)) {\r\n return;\r\n }\r\n let position = this.buffer.indexOf(wrapper);\r\n if (!newItems.reverse().some(newItem => newItem === wrapper.item)) {\r\n wrapper.op = OPERATIONS.REMOVE;\r\n // try to catch \"first\" edge case on remove\r\n if (!options.immutableTop && !newItems.length) {\r\n // this is the first item, or the previous one's part of the \"shift-top\" group\r\n if (\r\n (position === 0 && this.buffer.bof) ||\r\n (position !== 0 && this.buffer[position - 1].shiftTop)\r\n ) {\r\n wrapper.shiftTop = true;\r\n }\r\n }\r\n }\r\n newItems.forEach((newItem) => {\r\n if (newItem === wrapper.item) {\r\n position--;\r\n } else {\r\n // 3 parameter (shiftTop) is to catch \"first\" edge case on insert\r\n this.buffer.insert(position + 1, newItem, !options.immutableTop && position === -1);\r\n }\r\n });\r\n }\r\n\r\n calculateProperties() {\r\n let rowTop = null, topHeight = 0;\r\n let topDone = false, bottomDone = false;\r\n const length = this.buffer.length;\r\n\r\n for (let i = 0; i < length; i++) {\r\n const item = this.buffer[i];\r\n const itemTop = item.element.offset().top;\r\n\r\n if (rowTop !== itemTop) { // a new row condition\r\n const itemHeight = item.element.outerHeight(true);\r\n const top = this.viewport.topDataPos() + topHeight + itemHeight;\r\n\r\n if (!topDone && top > this.viewport.topVisiblePos()) {\r\n topDone = true;\r\n this['topVisible'] = item.item;\r\n this['topVisibleElement'] = item.element;\r\n this['topVisibleScope'] = item.scope;\r\n }\r\n if (!bottomDone && (top >= this.viewport.bottomVisiblePos() || (i === length - 1 && this.isEOF()))) {\r\n bottomDone = true;\r\n this['bottomVisible'] = item.item;\r\n this['bottomVisibleElement'] = item.element;\r\n this['bottomVisibleScope'] = item.scope;\r\n }\r\n topHeight += itemHeight;\r\n }\r\n rowTop = itemTop;\r\n\r\n if (topDone && bottomDone) {\r\n break;\r\n }\r\n }\r\n }\r\n\r\n}\r\n\r\nexport default Adapter;\r\n","import JQLiteExtras from './modules/jqLiteExtras';\r\nimport ElementRoutines from './modules/elementRoutines.js';\r\nimport ScrollBuffer from './modules/buffer.js';\r\nimport Viewport from './modules/viewport.js';\r\nimport Adapter from './modules/adapter.js';\r\nimport { OPERATIONS } from './modules/utils';\r\n\r\nangular.module('ui.scroll', [])\r\n\r\n .constant('JQLiteExtras', JQLiteExtras)\r\n .run(['JQLiteExtras', (JQLiteExtras) => {\r\n const elt = angular.element;\r\n !(window.jQuery && elt.fn && elt.fn.jquery) ? (new JQLiteExtras()).registerFor(elt) : null;\r\n ElementRoutines.addCSSRules();\r\n }])\r\n\r\n .directive('uiScrollViewport', function () {\r\n return {\r\n restrict: 'A',\r\n controller: [\r\n '$scope',\r\n '$element',\r\n function (scope, element) {\r\n this.container = element;\r\n this.viewport = element;\r\n this.scope = scope;\r\n\r\n angular.forEach(element.children(), child => {\r\n if (child.tagName.toLowerCase() === 'tbody') {\r\n this.viewport = angular.element(child);\r\n }\r\n });\r\n\r\n return this;\r\n }\r\n ]\r\n };\r\n })\r\n\r\n .directive('uiScroll', [\r\n '$log',\r\n '$injector',\r\n '$rootScope',\r\n '$timeout',\r\n '$interval',\r\n '$q',\r\n '$parse',\r\n function (console, $injector, $rootScope, $timeout, $interval, $q, $parse) {\r\n\r\n return {\r\n require: ['?^uiScrollViewport'],\r\n restrict: 'A',\r\n transclude: 'element',\r\n priority: 1000,\r\n terminal: true,\r\n link: link\r\n };\r\n\r\n function link($scope, element, $attr, controllers, linker) {\r\n const match = $attr.uiScroll.match(/^\\s*(\\w+)\\s+in\\s+([(\\w|\\$)\\.]+)\\s*$/);\r\n if (!match) {\r\n throw new Error('Expected uiScroll in form of \\'_item_ in _datasource_\\' but got \\'' + $attr.uiScroll + '\\'');\r\n }\r\n\r\n function parseNumber(value, defaultValue, isFloat) {\r\n if (!isFloat) {\r\n value = value === null ? defaultValue : Math.floor(value);\r\n }\r\n return isNaN(value) ? defaultValue : value;\r\n }\r\n\r\n function parseNumericAttr(value, defaultValue, isFloat) {\r\n const result = $parse(value)($scope);\r\n return parseNumber(result, defaultValue, isFloat);\r\n }\r\n\r\n function parseBooleanAttr(value, defaultValue) {\r\n const result = $parse(value)($scope);\r\n return typeof result === 'boolean' ? result : defaultValue;\r\n }\r\n\r\n const BUFFER_MIN = 3;\r\n const BUFFER_DEFAULT = 10;\r\n const PADDING_MIN = 0.3;\r\n const PADDING_DEFAULT = 0.5;\r\n const HANDLE_INERTIA_DEFAULT = true;\r\n const START_INDEX_DEFAULT = 1;\r\n const MAX_VIEWPORT_DELAY = 500;\r\n const VIEWPORT_POLLING_INTERVAL = 50;\r\n\r\n let datasource = null;\r\n const itemName = match[1];\r\n const datasourceName = match[2];\r\n const viewportController = controllers[0];\r\n const bufferSize = Math.max(BUFFER_MIN, parseNumericAttr($attr.bufferSize, BUFFER_DEFAULT));\r\n const padding = Math.max(PADDING_MIN, parseNumericAttr($attr.padding, PADDING_DEFAULT, true));\r\n const handleInertia = parseBooleanAttr($attr.handleInertia, HANDLE_INERTIA_DEFAULT);\r\n let startIndex = parseNumericAttr($attr.startIndex, START_INDEX_DEFAULT);\r\n let ridActual = 0; // current data revision id\r\n let pending = [];\r\n\r\n const elementRoutines = new ElementRoutines($injector, $q);\r\n const buffer = new ScrollBuffer(elementRoutines, bufferSize, startIndex);\r\n const viewport = new Viewport(elementRoutines, buffer, element, viewportController, $rootScope, padding);\r\n const adapter = new Adapter($scope, $parse, $attr, viewport, buffer, doAdjust, reload);\r\n\r\n if (viewportController) {\r\n viewportController.adapter = adapter;\r\n }\r\n\r\n const isDatasourceValid = () =>\r\n Object.prototype.toString.call(datasource) === '[object Object]' && typeof datasource.get === 'function';\r\n\r\n datasource = $parse(datasourceName)($scope); // try to get datasource on scope\r\n if (!isDatasourceValid()) {\r\n datasource = $injector.get(datasourceName); // try to inject datasource as service\r\n if (!isDatasourceValid()) {\r\n throw new Error(datasourceName + ' is not a valid datasource');\r\n }\r\n }\r\n\r\n let onRenderHandlers = [];\r\n function onRenderHandlersRunner() {\r\n onRenderHandlers.forEach(handler => handler.run());\r\n onRenderHandlers = [];\r\n }\r\n function persistDatasourceIndex(datasource, propName) {\r\n let getter;\r\n // need to postpone min/maxIndexUser processing if the view is empty\r\n if(angular.isNumber(datasource[propName])) {\r\n getter = datasource[propName];\r\n if(angular.isNumber(getter)) {\r\n onRenderHandlers = onRenderHandlers.filter(handler => handler.id !== propName);\r\n onRenderHandlers.push({\r\n id: propName,\r\n run: () => datasource[propName] = getter\r\n });\r\n }\r\n }\r\n }\r\n\r\n function defineDatasourceIndex(datasource, propName, propUserName) {\r\n const descriptor = Object.getOwnPropertyDescriptor(datasource, propName);\r\n if (descriptor && (descriptor.set || descriptor.get)) {\r\n return;\r\n }\r\n let getter;\r\n persistDatasourceIndex(datasource, propName);\r\n Object.defineProperty(datasource, propName, {\r\n set: (value) => {\r\n getter = value;\r\n if(pending.length && !buffer.length) {\r\n persistDatasourceIndex(datasource, propName);\r\n return;\r\n }\r\n buffer[propUserName] = value;\r\n const topPaddingHeightOld = viewport.topDataPos();\r\n viewport.adjustPaddings();\r\n if (propName === 'minIndex') {\r\n viewport.onAfterMinIndexSet(topPaddingHeightOld);\r\n }\r\n },\r\n get: () => getter\r\n });\r\n }\r\n\r\n defineDatasourceIndex(datasource, 'minIndex', 'minIndexUser');\r\n defineDatasourceIndex(datasource, 'maxIndex', 'maxIndexUser');\r\n\r\n const fetchNext = (datasource.get.length !== 2) ?\r\n (success) => datasource.get(buffer.next, bufferSize, success) :\r\n (success) => {\r\n datasource.get({\r\n index: buffer.next,\r\n append: buffer.length ? buffer[buffer.length - 1].item : void 0,\r\n count: bufferSize\r\n }, success);\r\n };\r\n\r\n const fetchPrevious = (datasource.get.length !== 2) ?\r\n (success) => datasource.get(buffer.first - bufferSize, bufferSize, success) :\r\n (success) => {\r\n datasource.get({\r\n index: buffer.first - bufferSize,\r\n prepend: buffer.length ? buffer[0].item : void 0,\r\n count: bufferSize\r\n }, success);\r\n };\r\n\r\n const initialize = () => {\r\n let tryCount = 0;\r\n if(!viewport.applyContainerStyle()) {\r\n const timer = $interval(() => {\r\n tryCount++;\r\n if(viewport.applyContainerStyle()) {\r\n $interval.cancel(timer);\r\n doAdjust();\r\n }\r\n if(tryCount * VIEWPORT_POLLING_INTERVAL >= MAX_VIEWPORT_DELAY) {\r\n $interval.cancel(timer);\r\n throw Error(`ui-scroll directive requires a viewport with non-zero height in ${MAX_VIEWPORT_DELAY}ms`);\r\n }\r\n }, VIEWPORT_POLLING_INTERVAL);\r\n }\r\n else {\r\n doAdjust();\r\n }\r\n };\r\n\r\n /**\r\n * Build padding elements\r\n *\r\n * Calling linker is the only way I found to get access to the tag name of the template\r\n * to prevent the directive scope from pollution a new scope is created and destroyed\r\n * right after the builder creation is completed\r\n */\r\n linker((clone, scope) => {\r\n viewport.createPaddingElements(clone[0]);\r\n // we do not include the clone in the DOM. It means that the nested directives will not\r\n // be able to reach the parent directives, but in this case it is intentional because we\r\n // created the clone to access the template tag name\r\n scope.$destroy();\r\n clone.remove();\r\n });\r\n\r\n $scope.$on('$destroy', () => {\r\n unbindEvents();\r\n viewport.off('mousewheel', wheelHandler);\r\n });\r\n\r\n viewport.on('mousewheel', wheelHandler);\r\n\r\n initialize();\r\n\r\n /* Private function definitions */\r\n\r\n function isInvalid(rid) {\r\n return (rid && rid !== ridActual) || $scope.$$destroyed;\r\n }\r\n\r\n function bindEvents() {\r\n viewport.on('resize', resizeAndScrollHandler);\r\n viewport.on('scroll', resizeAndScrollHandler);\r\n }\r\n\r\n function unbindEvents() {\r\n viewport.off('resize', resizeAndScrollHandler);\r\n viewport.off('scroll', resizeAndScrollHandler);\r\n }\r\n\r\n function reload() {\r\n unbindEvents();\r\n viewport.resetTopPadding();\r\n viewport.resetBottomPadding();\r\n if (arguments.length) {\r\n startIndex = parseNumber(arguments[0], START_INDEX_DEFAULT, false);\r\n }\r\n buffer.reset(startIndex);\r\n persistDatasourceIndex(datasource, 'minIndex');\r\n persistDatasourceIndex(datasource, 'maxIndex');\r\n doAdjust();\r\n }\r\n\r\n function isElementVisible(wrapper) {\r\n return wrapper.element.height() && wrapper.element[0].offsetParent;\r\n }\r\n\r\n function visibilityWatcher(wrapper) {\r\n if (isElementVisible(wrapper)) {\r\n buffer.forEach((item) => {\r\n if (typeof item.unregisterVisibilityWatcher === 'function') {\r\n item.unregisterVisibilityWatcher();\r\n delete item.unregisterVisibilityWatcher;\r\n }\r\n });\r\n if (!pending.length) {\r\n $timeout(() => doAdjust());\r\n }\r\n }\r\n }\r\n\r\n function insertWrapperContent(wrapper, insertAfter) {\r\n createElement(wrapper, insertAfter, viewport.insertElement);\r\n if (!isElementVisible(wrapper)) {\r\n wrapper.unregisterVisibilityWatcher = wrapper.scope.$watch(() => visibilityWatcher(wrapper));\r\n }\r\n elementRoutines.hideElement(wrapper); // hide inserted elements before data binding\r\n }\r\n\r\n function createElement(wrapper, insertAfter, insertElement) {\r\n let promises = null;\r\n const sibling = (insertAfter > 0) ? buffer[insertAfter - 1].element : undefined;\r\n linker((clone, scope) => {\r\n promises = insertElement(clone, sibling);\r\n wrapper.element = clone;\r\n wrapper.scope = scope;\r\n scope[itemName] = wrapper.item;\r\n });\r\n // ui-scroll-grid apply\r\n if (adapter.transform) {\r\n const tdInitializer = wrapper.scope.uiScrollTdInitializer;\r\n if (tdInitializer && tdInitializer.linking) {\r\n adapter.transform(wrapper.scope, wrapper.element);\r\n } else {\r\n wrapper.scope.uiScrollTdInitializer = {\r\n onLink: () => adapter.transform(wrapper.scope, wrapper.element),\r\n scope: wrapper.scope\r\n };\r\n }\r\n }\r\n return promises;\r\n }\r\n\r\n function updateDOM() {\r\n let promises = [];\r\n const toBePrepended = [];\r\n const toBeRemoved = [];\r\n const inserted = [];\r\n\r\n buffer.forEach((wrapper, i) => {\r\n switch (wrapper.op) {\r\n case OPERATIONS.PREPEND:\r\n toBePrepended.unshift(wrapper);\r\n break;\r\n case OPERATIONS.APPEND:\r\n insertWrapperContent(wrapper, i);\r\n wrapper.op = OPERATIONS.NONE;\r\n inserted.push(wrapper);\r\n break;\r\n case OPERATIONS.INSERT:\r\n promises = promises.concat(createElement(wrapper, i, viewport.insertElementAnimated));\r\n wrapper.op = OPERATIONS.NONE;\r\n inserted.push(wrapper);\r\n break;\r\n case OPERATIONS.REMOVE:\r\n toBeRemoved.push(wrapper);\r\n }\r\n });\r\n\r\n toBeRemoved.forEach((wrapper) => promises = promises.concat(viewport.removeItem(wrapper)));\r\n\r\n if (toBePrepended.length)\r\n toBePrepended.forEach((wrapper) => {\r\n insertWrapperContent(wrapper);\r\n wrapper.op = OPERATIONS.NONE;\r\n });\r\n\r\n buffer.forEach((item, i) => item.scope.$index = buffer.first + i);\r\n\r\n return {\r\n prepended: toBePrepended,\r\n removed: toBeRemoved,\r\n inserted: inserted,\r\n animated: promises\r\n };\r\n\r\n }\r\n\r\n function updatePaddings(rid, updates) {\r\n // schedule another doAdjust after animation completion\r\n if (updates.animated.length) {\r\n $q.all(updates.animated).then(() => {\r\n viewport.adjustPaddings();\r\n doAdjust(rid);\r\n });\r\n } else {\r\n viewport.adjustPaddings();\r\n }\r\n }\r\n\r\n function enqueueFetch(rid, updates) {\r\n if (viewport.shouldLoadBottom()) {\r\n if (!updates || buffer.effectiveHeight(updates.inserted) > 0) {\r\n // this means that at least one item appended in the last batch has height > 0\r\n if (pending.push(true) === 1) {\r\n adapter.loading(true);\r\n fetch(rid);\r\n }\r\n }\r\n } else if (viewport.shouldLoadTop()) {\r\n if ((!updates || buffer.effectiveHeight(updates.prepended) > 0) || pending[0]) {\r\n // this means that at least one item appended in the last batch has height > 0\r\n // pending[0] = true means that previous fetch was appending. We need to force at least one prepend\r\n // BTW there will always be at least 1 element in the pending array because bottom is fetched first\r\n if (pending.push(false) === 1) {\r\n adapter.loading(true);\r\n fetch(rid);\r\n }\r\n }\r\n }\r\n }\r\n\r\n function processUpdates() {\r\n const updates = updateDOM();\r\n\r\n // We need the item bindings to be processed before we can do adjustments\r\n !$scope.$$phase && !$rootScope.$$phase && $scope.$digest();\r\n\r\n updates.inserted.forEach(w => elementRoutines.showElement(w));\r\n updates.prepended.forEach(w => elementRoutines.showElement(w));\r\n return updates;\r\n }\r\n\r\n function doAdjust(rid) {\r\n if (!rid) { // dismiss pending requests\r\n pending = [];\r\n rid = ++ridActual;\r\n }\r\n\r\n const updates = processUpdates();\r\n\r\n if (isInvalid(rid)) {\r\n return;\r\n }\r\n\r\n updatePaddings(rid, updates);\r\n enqueueFetch(rid);\r\n\r\n if (!pending.length) {\r\n adapter.calculateProperties();\r\n }\r\n }\r\n\r\n function doAdjustAfterFetch(rid) {\r\n const updates = processUpdates();\r\n\r\n viewport.onAfterPrepend(updates);\r\n\r\n if (isInvalid(rid)) {\r\n return;\r\n }\r\n\r\n updatePaddings(rid, updates);\r\n onRenderHandlersRunner();\r\n enqueueFetch(rid, updates);\r\n pending.shift();\r\n\r\n if (pending.length)\r\n fetch(rid);\r\n else {\r\n adapter.loading(false);\r\n bindEvents();\r\n adapter.calculateProperties();\r\n }\r\n }\r\n\r\n function fetch(rid) {\r\n if (pending[0]) {// scrolling down\r\n if (buffer.length && !viewport.shouldLoadBottom()) {\r\n doAdjustAfterFetch(rid);\r\n } else {\r\n fetchNext((result) => {\r\n if (isInvalid(rid)) {\r\n return;\r\n }\r\n\r\n if (result.length < bufferSize) {\r\n buffer.eof = true;\r\n }\r\n\r\n if (result.length > 0) {\r\n viewport.clipTop();\r\n buffer.append(result);\r\n }\r\n\r\n doAdjustAfterFetch(rid);\r\n });\r\n }\r\n } else { // scrolling up\r\n if (buffer.length && !viewport.shouldLoadTop()) {\r\n doAdjustAfterFetch(rid);\r\n } else {\r\n fetchPrevious((result) => {\r\n if (isInvalid(rid)) {\r\n return;\r\n }\r\n\r\n if (result.length < bufferSize) {\r\n buffer.bof = true;\r\n // log 'bof is reached'\r\n }\r\n\r\n if (result.length > 0) {\r\n if (buffer.length) {\r\n viewport.clipBottom();\r\n }\r\n buffer.prepend(result);\r\n }\r\n\r\n doAdjustAfterFetch(rid);\r\n });\r\n }\r\n }\r\n }\r\n\r\n function fixInertia() {\r\n if (!viewport.synthetic) {\r\n return;\r\n }\r\n const oldPosition = viewport.synthetic.previous;\r\n const newPosition = viewport.synthetic.next;\r\n if (viewport.scrollTop() !== newPosition) {\r\n requestAnimationFrame(() => {\r\n const position = viewport.scrollTop();\r\n const diff = oldPosition - position;\r\n if (diff > 0) { // inertia over synthetic\r\n viewport.scrollTop(newPosition - diff);\r\n } else {\r\n viewport.scrollTop(newPosition);\r\n }\r\n viewport.synthetic = null;\r\n });\r\n return true;\r\n }\r\n viewport.synthetic = null;\r\n }\r\n\r\n function resizeAndScrollHandler() {\r\n if (handleInertia && fixInertia()) {\r\n return;\r\n }\r\n if (!$rootScope.$$phase && !adapter.isLoading && !adapter.disabled) {\r\n\r\n enqueueFetch(ridActual);\r\n\r\n if (pending.length) {\r\n unbindEvents();\r\n } else {\r\n adapter.calculateProperties();\r\n !$scope.$$phase && $scope.$digest();\r\n }\r\n }\r\n }\r\n\r\n function wheelHandler(event) {\r\n if (!adapter.disabled) {\r\n const scrollTop = viewport[0].scrollTop;\r\n const yMax = viewport[0].scrollHeight - viewport[0].clientHeight;\r\n\r\n if ((scrollTop === 0 && !buffer.bof) || (scrollTop === yMax && !buffer.eof)) {\r\n event.preventDefault();\r\n }\r\n }\r\n }\r\n }\r\n\r\n }\r\n ]);\r\n"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/ui-scroll.min.js b/dist/ui-scroll.min.js index a2e2175..1c721cf 100644 --- a/dist/ui-scroll.min.js +++ b/dist/ui-scroll.min.js @@ -1,2 +1,2 @@ -!function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([,function(e,t,n){"use strict";function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{r||null==u.return||u.return()}finally{if(i)throw o}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function i(e,t){for(var n=0;n0?{base:s.base-s.padding-s.border,outer:s.base,outerfull:s.base+s.margin}[a]:(((u=i(e)[n])<0||null===u)&&(u=e.style[n]||0),{base:(u=parseFloat(u)||0)-s.padding-s.border,outer:u,outerfull:u+s.padding+s.border+s.margin}[a])}return n=angular.element.prototype.css,e.prototype.css=function(e,t){var r=this[0];if(r&&3!==r.nodeType&&8!==r.nodeType&&r.style)return n.call(this,e,t)},o=function(e){return e&&e.document&&e.location&&e.alert&&e.setInterval},window.getComputedStyle?(i=function(e){return window.getComputedStyle(e,null)},t=function(e,t){return parseFloat(t)}):(i=function(e){return e.currentStyle},t=function(e,t){var n,r,i,o,a;return new RegExp("^("+/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source+")(?!px)[a-z%]+$","i").test(t)?(n=(a=e.style).left,o=(i=e.runtimeStyle)&&i.left,i&&(i.left=a.left),a.left=t,r=a.pixelLeft,a.left=n,o&&(i.left=o),r):parseFloat(t)}),angular.forEach({before:function(e){var t,n,r,i,o,a;if(n=this[0],(t=(o=this.parent()).contents())[0]===n)return o.prepend(e);for(r=i=1,a=t.length-1;1<=a?i<=a:i>=a;r=1<=a?++i:--i)if(t[r]===n)return void angular.element(t[r-1]).after(e);throw new Error("invalid DOM structure "+n.outerHTML)},height:function(e){return void 0!==e?(angular.isNumber(e)&&(e+="px"),n.call(this,"height",e)):u(this[0],"height","base")},outerHeight:function(e){return u(this[0],"height",e?"outerfull":"outer")},outerWidth:function(e){return u(this[0],"width",e?"outerfull":"outer")},offset:function(e){var t,n,r=this,i={top:0,left:0},o=r[0],a=o&&o.ownerDocument;if(arguments.length){if(void 0===e)return r;throw new Error("offset setter method is not implemented")}if(a)return t=a.documentElement,null!=o.getBoundingClientRect&&(i=o.getBoundingClientRect()),n=a.defaultView||a.parentWindow,{top:i.top+(n.pageYOffset||t.scrollTop)-(t.clientTop||0),left:i.left+(n.pageXOffset||t.scrollLeft)-(t.clientLeft||0)}},scrollTop:function(e){return a(this,"top",e)},scrollLeft:function(e){return a(this,"left",e)}},(function(t,n){if(!e.prototype[n])return e.prototype[n]=t}))}}])&&i(t.prototype,n),o&&i(t,o),e}();function a(e,t){for(var n=0;nr.minIndexUser)return void r.minIndexUser++;r.minIndex===r.minIndexUser&&r.minIndexUser++}r.minIndex++},decrementMaxIndex:function(){null!==r.maxIndexUser&&r.maxIndex<=r.maxIndexUser&&r.maxIndexUser--,r.maxIndex--},getAbsMinIndex:function(){return null!==r.minIndexUser?Math.min(r.minIndexUser,r.minIndex):r.minIndex},getAbsMaxIndex:function(){return null!==r.maxIndexUser?Math.max(r.maxIndexUser,r.maxIndex):r.maxIndex},effectiveHeight:function(e){if(!e.length)return 0;var t=Number.MAX_VALUE,n=Number.NEGATIVE_INFINITY;return e.forEach((function(e){e.element[0].offsetParent&&(t=Math.min(t,e.element.offset().top),n=Math.max(n,e.element.offset().top+e.element.outerHeight(!0)))})),Math.max(0,n-t)},getItems:function(){return r.filter((function(e){return"none"===e.op}))},getFirstItem:function(){var e=r.getItems();return e.length?e[0].item:null},getLastItem:function(){var e=r.getItems();return e.length?e[e.length-1].item:null}}),r.reset(n),r}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t){for(var n=0;n=0;t--)if(this[t].index===e.scope.$index)return void(this[t].height=e.element.outerHeight());this.push({index:e.scope.$index,height:e.element.outerHeight()}),this.sort((function(e,t){return e.indext.index?1:0}))}},{key:"remove",value:function(e,t){for(var n=e%1==0?e:e.scope.$index,r=e%1==0?t:"isTop"===e._op,i=this.length-1;i>=0;i--)if(this[i].index===n){this.splice(i,1);break}if(!r)for(var o=this.length-1;o>=0;o--)this[o].index>n&&this[o].index--}},{key:"clear",value:function(){this.length=0}}]),e}();function p(){var e=[];return e.push.apply(e,arguments),Object.setPrototypeOf(e,p.prototype),e}p.prototype=Object.create(Array.prototype),Object.getOwnPropertyNames(d.prototype).forEach((function(e){return p.prototype[e]=d.prototype[e]}));var m=function(){function e(t){c(this,e),this.element=function(e){if(e.nodeType!==Node.ELEMENT_NODE)throw new Error("ui-scroll directive requires an Element node for templating the view");var t;switch(e.tagName.toLowerCase()){case"dl":throw new Error("ui-scroll directive does not support <".concat(e.tagName,"> as a repeating tag: ").concat(e.outerHTML));case"tr":t=angular.element("
    ").find("tr");break;case"li":t=angular.element("
  • ");break;default:t=angular.element("
    ")}return t}(t),this.cache=new p}return h(e,[{key:"height",value:function(){return this.element.height.apply(this.element,arguments)}}]),e}();function g(e,t,n,r,i,o){var a=null,u=null,s=r&&r.viewport?r.viewport:angular.element(window),l=r&&r.container?r.container:void 0,c=r&&r.scope?r.scope:i;function f(){return s.outerHeight()*o}return s.css({"overflow-anchor":"none","overflow-y":"auto",display:"block"}),angular.extend(s,{getScope:function(){return c},createPaddingElements:function(e){a=new m(e),u=new m(e),n.before(a.element),n.after(u.element),a.height(0),u.height(0)},applyContainerStyle:function(){return!l||(l!==s&&s.css("height",window.getComputedStyle(l[0]).height),s.height()>0)},bottomDataPos:function(){var e=s[0].scrollHeight;return(e=null!=e?e:s[0].document.documentElement.scrollHeight)-u.height()},topDataPos:function(){return a.height()},bottomVisiblePos:function(){return s.scrollTop()+s.outerHeight()},topVisiblePos:function(){return s.scrollTop()},insertElement:function(t,n){return e.insertElement(t,n||a.element)},insertElementAnimated:function(t,n){return e.insertElementAnimated(t,n||a.element)},shouldLoadBottom:function(){return!t.eof&&s.bottomDataPos()=0&&!(n+(r=t[o].element.outerHeight(!0))>i);o--)u.cache.add(t[o]),n+=r,e++;e>0&&(t.eof=!1,t.remove(t.length-e,t.length),t.next-=e,s.adjustPaddings())},shouldLoadTop:function(){return!t.bof&&s.topDataPos()>s.topVisiblePos()-f()},clipTop:function(){for(var e=0,n=0,r=0,i=s.topVisiblePos()-s.topDataPos()-f(),o=0;oi);o++)a.cache.add(t[o]),n+=r,e++;e>0&&(a.height(a.height()+n),t.bof=!1,t.remove(0,e),t.first+=e)},adjustPaddings:function(){if(t.length){var e=t.reduce((function(e,t){return e+t.element.outerHeight(!0)}),0),n=0,r=0;a.cache.forEach((function(e){e.index=t.next&&(i+=e.height,o++)}));var s=(e+n+i)/(r+o+t.length),l=null!==t.minIndexUser&&t.minIndex>t.minIndexUser,c=null!==t.maxIndexUser&&t.maxIndext.minIndexUser){var n=a.height()-e;for(s.scrollTop(s.scrollTop()+n);(n-=s.scrollTop())>0;)u.height(u.height()+n),s.scrollTop(s.scrollTop()+n)}},onAfterPrepend:function(e){if(e.prepended.length){var n=t.effectiveHeight(e.prepended),r=a.height()-n;if(r>=0)a.height(r);else{var i=s.scrollTop(),o=i-r;s.synthetic={previous:i,next:o},a.height(0),s.scrollTop(o)}}},resetTopPadding:function(){a.height(0),a.cache.clear()},resetBottomPadding:function(){u.height(0),u.cache.clear()},removeCacheItem:function(e,t){a.cache.remove(e,t),u.cache.remove(e,t)},removeItem:function(e){return this.removeCacheItem(e),t.remove(e)}}),s}function v(e,t){for(var n=0;n=0;n--)this.publicContext[t[n]]=this[t[n]].bind(this);for(var r=["isLoading","topVisible","topVisibleElement","topVisibleScope","bottomVisible","bottomVisibleElement","bottomVisibleScope"],i=function(t){var n=void 0,i=e.$attr[r[t]];Object.defineProperty(e,r[t],{get:function(){return n},set:function(o){n=o,e.publicContext[r[t]]=o,i&&e.$parse(i).assign(e.startScope,o)}})},o=r.length-1;o>=0;o--)i(o);for(var a=["bufferFirst","bufferLast","bufferLength"],u=function(t){Object.defineProperty(e.publicContext,a[t],{get:function(){return e[a[t]]}})},s=a.length-1;s>=0;s--)u(s);Object.defineProperty(this.publicContext,"disabled",{get:function(){return e.disabled},set:function(t){return(e.disabled=t)?null:e.doAdjust()}})}},{key:"loading",value:function(e){this.isLoading=e}},{key:"isBOF",value:function(){return this.buffer.bof}},{key:"isEOF",value:function(){return this.buffer.eof}},{key:"isEmpty",value:function(){return!this.buffer.length}},{key:"append",value:function(e){this.buffer.append(e),this.doAdjust(),this.viewport.clipTop(),this.viewport.clipBottom()}},{key:"prepend",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.buffer.prepend(e,t.immutableTop),this.doAdjust(),this.viewport.clipTop(),this.viewport.clipBottom()}},{key:"applyUpdates",value:function(e,t,n){"function"==typeof e?this.applyUpdatesFunc(e,t):this.applyUpdatesIndex(e,t,n),this.doAdjust()}},{key:"applyUpdatesFunc",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.buffer.slice(0).forEach((function(r){t.applyUpdate(r,e(r.item,r.scope,r.element),n)}))}},{key:"applyUpdatesIndex",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e%1!=0)throw new Error("applyUpdates - "+e+" is not a valid index (should be an integer)");var r=e-this.buffer.first;r>=0&&r=this.buffer.getAbsMinIndex()&&e<=this.buffer.getAbsMaxIndex()&&angular.isArray(t)&&!t.length&&(this.viewport.removeCacheItem(e,!n.immutableTop&&e===this.buffer.minIndex),n.immutableTop||e!==this.buffer.getAbsMinIndex()?this.buffer.decrementMaxIndex():this.buffer.incrementMinIndex())}},{key:"applyUpdate",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(angular.isArray(t)){var i=this.buffer.indexOf(e);t.reverse().some((function(t){return t===e.item}))||(e.op="remove",r.immutableTop||0!==i||t.length||(e._op="isTop")),t.forEach((function(t){t===e.item?i--:n.buffer.insert(i+1,t,!r.immutableTop&&-1===i)}))}}},{key:"calculateProperties",value:function(){for(var e=null,t=0,n=!1,r=!1,i=this.buffer.length,o=0;othis.viewport.topVisiblePos()&&(n=!0,this.topVisible=a.item,this.topVisibleElement=a.element,this.topVisibleScope=a.scope),!r&&(l>=this.viewport.bottomVisiblePos()||o===i-1&&this.isEOF())&&(r=!0,this.bottomVisible=a.item,this.bottomVisibleElement=a.element,this.bottomVisibleScope=a.scope),t+=s}if(e=u,n&&r)break}}},{key:"bufferLength",get:function(){return this.buffer.getItems().length}},{key:"bufferFirst",get:function(){return this.buffer.getFirstItem()}},{key:"bufferLast",get:function(){return this.buffer.getLastItem()}}])&&v(t.prototype,n),r&&v(t,r),e}();angular.module("ui.scroll",[]).constant("JQLiteExtras",o).run(["JQLiteExtras",function(e){var t=angular.element;!(window.jQuery&&t.fn&&t.fn.jquery)&&(new e).registerFor(t),s.addCSSRules()}]).directive("uiScrollViewport",(function(){return{restrict:"A",controller:["$scope","$element",function(e,t){var n=this;return this.container=t,this.viewport=t,this.scope=e,angular.forEach(t.children(),(function(e){"tbody"===e.tagName.toLowerCase()&&(n.viewport=angular.element(e))})),this}]}})).directive("uiScroll",["$log","$injector","$rootScope","$timeout","$interval","$q","$parse",function(e,t,n,r,i,o,a){return{require:["?^uiScrollViewport"],restrict:"A",transclude:"element",priority:1e3,terminal:!0,link:function(e,u,c,f,h){var d=c.uiScroll.match(/^\s*(\w+)\s+in\s+([(\w|\$)\.]+)\s*$/);if(!d)throw new Error("Expected uiScroll in form of '_item_ in _datasource_' but got '"+c.uiScroll+"'");function p(e,t,n){return n||(e=null===e?t:Math.floor(e)),isNaN(e)?t:e}function m(t,n,r){return p(a(t)(e),n,r)}var v=null,x=d[1],y=d[2],w=f[0],I=Math.max(3,m(c.bufferSize,10)),E=Math.max(.3,m(c.padding,.5,!0)),T=(L=c.handleInertia,U=!0,M=a(L)(e),"boolean"==typeof M?M:U),$=m(c.startIndex,1),P=0,k=[],S=new s(t,o),A=new l(S,I,$),O=new g(S,A,u,w,n,E),j=new b(e,a,c,O,A,Y,(function(){D(),O.resetTopPadding(),O.resetBottomPadding(),arguments.length&&($=p(arguments[0],1,!1));A.reset($),H(v,"minIndex"),H(v,"maxIndex"),Y()}));var L,U,M;w&&(w.adapter=j);var V=function(){return"[object Object]"===Object.prototype.toString.call(v)&&"function"==typeof v.get};if(!(v=a(y)(e),V()||(v=t.get(y),V())))throw new Error(y+" is not a valid datasource");var C=[];function H(e,t){var n;angular.isNumber(e[t])&&(n=e[t],angular.isNumber(n)&&(C=C.filter((function(e){return e.id!==t}))).push({id:t,run:function(){return e[t]=n}}))}function _(e,t,n){var r,i=Object.getOwnPropertyDescriptor(e,t);i&&(i.set||i.get)||(H(e,t),Object.defineProperty(e,t,{set:function(i){if(r=i,!k.length||A.length){A[n]=i;var o=O.topDataPos();O.adjustPaddings(),"minIndex"===t&&O.onAfterMinIndexSet(o)}else H(e,t)},get:function(){return r}}))}_(v,"minIndex","minIndexUser"),_(v,"maxIndex","maxIndexUser");var F=2!==v.get.length?function(e){return v.get(A.next,I,e)}:function(e){v.get({index:A.next,append:A.length?A[A.length-1].item:void 0,count:I},e)},N=2!==v.get.length?function(e){return v.get(A.first-I,I,e)}:function(e){v.get({index:A.first-I,prepend:A.length?A[0].item:void 0,count:I},e)};function B(t){return t&&t!==P||e.$$destroyed}function D(){O.off("resize",K),O.off("scroll",K)}function R(e){return e.element.height()&&e.element[0].offsetParent}function W(e,t){q(e,t,O.insertElement),R(e)||(e.unregisterVisibilityWatcher=e.scope.$watch((function(){return function(e){R(e)&&(A.forEach((function(e){"function"==typeof e.unregisterVisibilityWatcher&&(e.unregisterVisibilityWatcher(),delete e.unregisterVisibilityWatcher)})),k.length||r((function(){return Y()})))}(e)}))),S.hideElement(e)}function q(e,t,n){var r=null,i=t>0?A[t-1].element:void 0;if(h((function(t,o){r=n(t,i),e.element=t,e.scope=o,o[x]=e.item})),j.transform){var o=e.scope.uiScrollTdInitializer;o&&o.linking?j.transform(e.scope,e.element):e.scope.uiScrollTdInitializer={onLink:function(){return j.transform(e.scope,e.element)},scope:e.scope}}return r}function z(e,t){t.animated.length?o.all(t.animated).then((function(){O.adjustPaddings(),Y(e)})):O.adjustPaddings()}function Q(e,t){O.shouldLoadBottom()?(!t||A.effectiveHeight(t.inserted)>0)&&1===k.push(!0)&&(j.loading(!0),G(e)):O.shouldLoadTop()&&(!t||A.effectiveHeight(t.prepended)>0||k[0])&&1===k.push(!1)&&(j.loading(!0),G(e))}function X(){var t,r,i,o,a=(t=[],r=[],i=[],o=[],A.forEach((function(e,n){switch(e.op){case"prepend":r.unshift(e);break;case"append":W(e,n),e.op="none",o.push(e);break;case"insert":t=t.concat(q(e,n,O.insertElementAnimated)),e.op="none",o.push(e);break;case"remove":i.push(e)}})),i.forEach((function(e){return t=t.concat(O.removeItem(e))})),r.length&&r.forEach((function(e){W(e),e.op="none"})),A.forEach((function(e,t){return e.scope.$index=A.first+t})),{prepended:r,removed:i,inserted:o,animated:t});return!e.$$phase&&!n.$$phase&&e.$digest(),a.inserted.forEach((function(e){return S.showElement(e)})),a.prepended.forEach((function(e){return S.showElement(e)})),a}function Y(e){e||(k=[],e=++P);var t=X();B(e)||(z(e,t),Q(e),k.length||j.calculateProperties())}function J(e){var t=X();O.onAfterPrepend(t),B(e)||(z(e,t),C.forEach((function(e){return e.run()})),C=[],Q(e,t),k.shift(),k.length?G(e):(j.loading(!1),O.on("resize",K),O.on("scroll",K),j.calculateProperties()))}function G(e){k[0]?A.length&&!O.shouldLoadBottom()?J(e):F((function(t){B(e)||(t.length0&&(O.clipTop(),A.append(t)),J(e))})):A.length&&!O.shouldLoadTop()?J(e):N((function(t){B(e)||(t.length0&&(A.length&&O.clipBottom(),A.prepend(t)),J(e))}))}function K(){T&&function(){if(O.synthetic){var e=O.synthetic.previous,t=O.synthetic.next;if(O.scrollTop()!==t)return requestAnimationFrame((function(){var n=O.scrollTop(),r=e-n;r>0?O.scrollTop(t-r):O.scrollTop(t),O.synthetic=null})),!0;O.synthetic=null}}()||n.$$phase||j.isLoading||j.disabled||(Q(P),k.length?D():(j.calculateProperties(),!e.$$phase&&e.$digest()))}function Z(e){if(!j.disabled){var t=O[0].scrollTop,n=O[0].scrollHeight-O[0].clientHeight;(0===t&&!A.bof||t===n&&!A.eof)&&e.preventDefault()}}h((function(e,t){O.createPaddingElements(e[0]),t.$destroy(),e.remove()})),e.$on("$destroy",(function(){D(),O.off("mousewheel",Z)})),O.on("mousewheel",Z),function(){var e=0;if(O.applyContainerStyle())Y();else var t=i((function(){if(e++,O.applyContainerStyle()&&(i.cancel(t),Y()),50*e>=500)throw i.cancel(t),Error("ui-scroll directive requires a viewport with non-zero height in ".concat(500,"ms"))}),50)}()}}}])}]); +!function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([,function(e,t,n){"use strict";function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var a,u=e[Symbol.iterator]();!(r=(a=u.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{r||null==u.return||u.return()}finally{if(i)throw o}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function i(e,t){for(var n=0;n0?{base:s.base-s.padding-s.border,outer:s.base,outerfull:s.base+s.margin}[a]:(((u=i(e)[n])<0||null===u)&&(u=e.style[n]||0),{base:(u=parseFloat(u)||0)-s.padding-s.border,outer:u,outerfull:u+s.padding+s.border+s.margin}[a])}return n=angular.element.prototype.css,e.prototype.css=function(e,t){var r=this[0];if(r&&3!==r.nodeType&&8!==r.nodeType&&r.style)return n.call(this,e,t)},o=function(e){return e&&e.document&&e.location&&e.alert&&e.setInterval},window.getComputedStyle?(i=function(e){return window.getComputedStyle(e,null)},t=function(e,t){return parseFloat(t)}):(i=function(e){return e.currentStyle},t=function(e,t){var n,r,i,o,a;return new RegExp("^("+/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source+")(?!px)[a-z%]+$","i").test(t)?(n=(a=e.style).left,o=(i=e.runtimeStyle)&&i.left,i&&(i.left=a.left),a.left=t,r=a.pixelLeft,a.left=n,o&&(i.left=o),r):parseFloat(t)}),angular.forEach({before:function(e){var t,n,r,i,o,a;if(n=this[0],(t=(o=this.parent()).contents())[0]===n)return o.prepend(e);for(r=i=1,a=t.length-1;1<=a?i<=a:i>=a;r=1<=a?++i:--i)if(t[r]===n)return void angular.element(t[r-1]).after(e);throw new Error("invalid DOM structure "+n.outerHTML)},height:function(e){return void 0!==e?(angular.isNumber(e)&&(e+="px"),n.call(this,"height",e)):u(this[0],"height","base")},outerHeight:function(e){return u(this[0],"height",e?"outerfull":"outer")},outerWidth:function(e){return u(this[0],"width",e?"outerfull":"outer")},offset:function(e){var t,n,r=this,i={top:0,left:0},o=r[0],a=o&&o.ownerDocument;if(arguments.length){if(void 0===e)return r;throw new Error("offset setter method is not implemented")}if(a)return t=a.documentElement,null!=o.getBoundingClientRect&&(i=o.getBoundingClientRect()),n=a.defaultView||a.parentWindow,{top:i.top+(n.pageYOffset||t.scrollTop)-(t.clientTop||0),left:i.left+(n.pageXOffset||t.scrollLeft)-(t.clientLeft||0)}},scrollTop:function(e){return a(this,"top",e)},scrollLeft:function(e){return a(this,"left",e)}},(function(t,n){if(!e.prototype[n])return e.prototype[n]=t}))}}])&&i(t.prototype,n),o&&i(t,o),e}();function a(e,t){for(var n=0;nr.minIndexUser)return void r.minIndexUser++;r.minIndex===r.minIndexUser&&r.minIndexUser++}r.minIndex++},decrementMaxIndex:function(){null!==r.maxIndexUser&&r.maxIndex<=r.maxIndexUser&&r.maxIndexUser--,r.maxIndex--},getAbsMinIndex:function(){return null!==r.minIndexUser?Math.min(r.minIndexUser,r.minIndex):r.minIndex},getAbsMaxIndex:function(){return null!==r.maxIndexUser?Math.max(r.maxIndexUser,r.maxIndex):r.maxIndex},effectiveHeight:function(e){if(!e.length)return 0;var t=Number.MAX_VALUE,n=Number.NEGATIVE_INFINITY;return e.forEach((function(e){e.element[0].offsetParent&&(t=Math.min(t,e.element.offset().top),n=Math.max(n,e.element.offset().top+e.element.outerHeight(!0)))})),Math.max(0,n-t)},getItems:function(){return r.filter((function(e){return e.op===p}))},getFirstItem:function(){var e=r.getItems();return e.length?e[0].item:null},getLastItem:function(){var e=r.getItems();return e.length?e[e.length-1].item:null}}),r.reset(n),r}function g(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function v(e,t){for(var n=0;n=0;t--)if(this[t].index===e.scope.$index)return void(this[t].height=e.element.outerHeight());this.push({index:e.scope.$index,height:e.element.outerHeight()}),this.sort((function(e,t){return e.indext.index?1:0}))}},{key:"remove",value:function(e,t){for(var n=e%1==0?e:e.scope.$index,r=e%1==0?t:e.shiftTop,i=this.length-1;i>=0;i--)if(this[i].index===n){this.splice(i,1);break}if(!r)for(var o=this.length-1;o>=0;o--)this[o].index>n&&this[o].index--}},{key:"clear",value:function(){this.length=0}}]),e}();function y(){var e=[];return e.push.apply(e,arguments),Object.setPrototypeOf(e,y.prototype),e}y.prototype=Object.create(Array.prototype),Object.getOwnPropertyNames(x.prototype).forEach((function(e){return y.prototype[e]=x.prototype[e]}));var I=function(){function e(t){g(this,e),this.element=function(e){if(e.nodeType!==Node.ELEMENT_NODE)throw new Error("ui-scroll directive requires an Element node for templating the view");var t;switch(e.tagName.toLowerCase()){case"dl":throw new Error("ui-scroll directive does not support <".concat(e.tagName,"> as a repeating tag: ").concat(e.outerHTML));case"tr":t=angular.element("
    ").find("tr");break;case"li":t=angular.element("
  • ");break;default:t=angular.element("
    ")}return t}(t),this.cache=new y}return b(e,[{key:"height",value:function(){return this.element.height.apply(this.element,arguments)}}]),e}();function w(e,t,n,r,i,o){var a=null,u=null,s=r&&r.viewport?r.viewport:angular.element(window),l=r&&r.container?r.container:void 0,c=r&&r.scope?r.scope:i;function f(){return s.outerHeight()*o}return s.css({"overflow-anchor":"none","overflow-y":"auto",display:"block"}),angular.extend(s,{getScope:function(){return c},createPaddingElements:function(e){a=new I(e),u=new I(e),n.before(a.element),n.after(u.element),a.height(0),u.height(0)},applyContainerStyle:function(){return!l||(l!==s&&s.css("height",window.getComputedStyle(l[0]).height),s.height()>0)},bottomDataPos:function(){var e=s[0].scrollHeight;return(e=null!=e?e:s[0].document.documentElement.scrollHeight)-u.height()},topDataPos:function(){return a.height()},bottomVisiblePos:function(){return s.scrollTop()+s.outerHeight()},topVisiblePos:function(){return s.scrollTop()},insertElement:function(t,n){return e.insertElement(t,n||a.element)},insertElementAnimated:function(t,n){return e.insertElementAnimated(t,n||a.element)},shouldLoadBottom:function(){return!t.eof&&s.bottomDataPos()=0&&!(n+(r=t[o].element.outerHeight(!0))>i);o--)u.cache.add(t[o]),n+=r,e++;e>0&&(t.eof=!1,t.remove(t.length-e,t.length),t.next-=e,s.adjustPaddings())},shouldLoadTop:function(){return!t.bof&&s.topDataPos()>s.topVisiblePos()-f()},clipTop:function(){for(var e=0,n=0,r=0,i=s.topVisiblePos()-s.topDataPos()-f(),o=0;oi);o++)a.cache.add(t[o]),n+=r,e++;e>0&&(a.height(a.height()+n),t.bof=!1,t.remove(0,e),t.first+=e)},adjustPaddings:function(){if(t.length){var e=t.reduce((function(e,t){return e+t.element.outerHeight(!0)}),0),n=0,r=0;a.cache.forEach((function(e){e.index=t.next&&(i+=e.height,o++)}));var s=(e+n+i)/(r+o+t.length),l=null!==t.minIndexUser&&t.minIndex>t.minIndexUser,c=null!==t.maxIndexUser&&t.maxIndext.minIndexUser){var n=a.height()-e;for(s.scrollTop(s.scrollTop()+n);(n-=s.scrollTop())>0;)u.height(u.height()+n),s.scrollTop(s.scrollTop()+n)}},onAfterPrepend:function(e){if(e.prepended.length){var n=t.effectiveHeight(e.prepended),r=a.height()-n;if(r>=0)a.height(r);else{var i=s.scrollTop(),o=i-r;s.synthetic={previous:i,next:o},a.height(0),s.scrollTop(o)}}},resetTopPadding:function(){a.height(0),a.cache.clear()},resetBottomPadding:function(){u.height(0),u.cache.clear()},removeCacheItem:function(e,t){a.cache.remove(e,t),u.cache.remove(e,t)},removeItem:function(e){return this.removeCacheItem(e),t.remove(e)}}),s}function E(e,t){for(var n=0;n=0;n--)this.publicContext[t[n]]=this[t[n]].bind(this);for(var r=["isLoading","topVisible","topVisibleElement","topVisibleScope","bottomVisible","bottomVisibleElement","bottomVisibleScope"],i=function(t){var n=void 0,i=e.$attr[r[t]];Object.defineProperty(e,r[t],{get:function(){return n},set:function(o){n=o,e.publicContext[r[t]]=o,i&&e.$parse(i).assign(e.startScope,o)}})},o=r.length-1;o>=0;o--)i(o);for(var a=["bufferFirst","bufferLast","bufferLength"],u=function(t){Object.defineProperty(e.publicContext,a[t],{get:function(){return e[a[t]]}})},s=a.length-1;s>=0;s--)u(s);Object.defineProperty(this.publicContext,"disabled",{get:function(){return e.disabled},set:function(t){return(e.disabled=t)?null:e.doAdjust()}})}},{key:"loading",value:function(e){this.isLoading=e}},{key:"isBOF",value:function(){return this.buffer.bof}},{key:"isEOF",value:function(){return this.buffer.eof}},{key:"isEmpty",value:function(){return!this.buffer.length}},{key:"append",value:function(e){this.buffer.append(e),this.doAdjust(),this.viewport.clipTop(),this.viewport.clipBottom()}},{key:"prepend",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.buffer.prepend(e,t.immutableTop),this.doAdjust(),this.viewport.clipTop(),this.viewport.clipBottom()}},{key:"applyUpdates",value:function(e,t,n){"function"==typeof e?this.applyUpdatesFunc(e,t):this.applyUpdatesIndex(e,t,n),this.doAdjust()}},{key:"applyUpdatesFunc",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.buffer.slice(0).forEach((function(r){t.applyUpdate(r,e(r.item,r.scope,r.element),n)}))}},{key:"applyUpdatesIndex",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e%1!=0)throw new Error("applyUpdates - "+e+" is not a valid index (should be an integer)");var r=e-this.buffer.first;r>=0&&r=this.buffer.getAbsMinIndex()&&e<=this.buffer.getAbsMaxIndex()&&angular.isArray(t)&&!t.length&&(this.viewport.removeCacheItem(e,!n.immutableTop&&e===this.buffer.minIndex),n.immutableTop||e!==this.buffer.getAbsMinIndex()?this.buffer.decrementMaxIndex():this.buffer.incrementMinIndex())}},{key:"applyUpdate",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(angular.isArray(t)){var i=this.buffer.indexOf(e);t.reverse().some((function(t){return t===e.item}))||(e.op=d,r.immutableTop||t.length||(0===i&&this.buffer.bof||0!==i&&this.buffer[i-1].shiftTop)&&(e.shiftTop=!0)),t.forEach((function(t){t===e.item?i--:n.buffer.insert(i+1,t,!r.immutableTop&&-1===i)}))}}},{key:"calculateProperties",value:function(){for(var e=null,t=0,n=!1,r=!1,i=this.buffer.length,o=0;othis.viewport.topVisiblePos()&&(n=!0,this.topVisible=a.item,this.topVisibleElement=a.element,this.topVisibleScope=a.scope),!r&&(l>=this.viewport.bottomVisiblePos()||o===i-1&&this.isEOF())&&(r=!0,this.bottomVisible=a.item,this.bottomVisibleElement=a.element,this.bottomVisibleScope=a.scope),t+=s}if(e=u,n&&r)break}}},{key:"bufferLength",get:function(){return this.buffer.getItems().length}},{key:"bufferFirst",get:function(){return this.buffer.getFirstItem()}},{key:"bufferLast",get:function(){return this.buffer.getLastItem()}}])&&E(t.prototype,n),r&&E(t,r),e}();angular.module("ui.scroll",[]).constant("JQLiteExtras",o).run(["JQLiteExtras",function(e){var t=angular.element;!(window.jQuery&&t.fn&&t.fn.jquery)&&(new e).registerFor(t),l.addCSSRules()}]).directive("uiScrollViewport",(function(){return{restrict:"A",controller:["$scope","$element",function(e,t){var n=this;return this.container=t,this.viewport=t,this.scope=e,angular.forEach(t.children(),(function(e){"tbody"===e.tagName.toLowerCase()&&(n.viewport=angular.element(e))})),this}]}})).directive("uiScroll",["$log","$injector","$rootScope","$timeout","$interval","$q","$parse",function(e,t,n,r,i,o,a){return{require:["?^uiScrollViewport"],restrict:"A",transclude:"element",priority:1e3,terminal:!0,link:function(e,u,s,g,v){var b=s.uiScroll.match(/^\s*(\w+)\s+in\s+([(\w|\$)\.]+)\s*$/);if(!b)throw new Error("Expected uiScroll in form of '_item_ in _datasource_' but got '"+s.uiScroll+"'");function x(e,t,n){return n||(e=null===e?t:Math.floor(e)),isNaN(e)?t:e}function y(t,n,r){return x(a(t)(e),n,r)}var I=null,E=b[1],$=b[2],P=g[0],k=Math.max(3,y(s.bufferSize,10)),S=Math.max(.3,y(s.padding,.5,!0)),A=(H=s.handleInertia,F=!0,N=a(H)(e),"boolean"==typeof N?N:F),O=y(s.startIndex,1),j=0,L=[],U=new l(t,o),M=new m(U,k,O),V=new w(U,M,u,P,n,S),C=new T(e,a,s,V,M,ee,(function(){Q(),V.resetTopPadding(),V.resetBottomPadding(),arguments.length&&(O=x(arguments[0],1,!1));M.reset(O),D(I,"minIndex"),D(I,"maxIndex"),ee()}));var H,F,N;P&&(P.adapter=C);var _=function(){return"[object Object]"===Object.prototype.toString.call(I)&&"function"==typeof I.get};if(!(I=a($)(e),_()||(I=t.get($),_())))throw new Error($+" is not a valid datasource");var B=[];function D(e,t){var n;angular.isNumber(e[t])&&(n=e[t],angular.isNumber(n)&&(B=B.filter((function(e){return e.id!==t}))).push({id:t,run:function(){return e[t]=n}}))}function R(e,t,n){var r,i=Object.getOwnPropertyDescriptor(e,t);i&&(i.set||i.get)||(D(e,t),Object.defineProperty(e,t,{set:function(i){if(r=i,!L.length||M.length){M[n]=i;var o=V.topDataPos();V.adjustPaddings(),"minIndex"===t&&V.onAfterMinIndexSet(o)}else D(e,t)},get:function(){return r}}))}R(I,"minIndex","minIndexUser"),R(I,"maxIndex","maxIndexUser");var W=2!==I.get.length?function(e){return I.get(M.next,k,e)}:function(e){I.get({index:M.next,append:M.length?M[M.length-1].item:void 0,count:k},e)},q=2!==I.get.length?function(e){return I.get(M.first-k,k,e)}:function(e){I.get({index:M.first-k,prepend:M.length?M[0].item:void 0,count:k},e)};function z(t){return t&&t!==j||e.$$destroyed}function Q(){V.off("resize",re),V.off("scroll",re)}function X(e){return e.element.height()&&e.element[0].offsetParent}function Y(e,t){J(e,t,V.insertElement),X(e)||(e.unregisterVisibilityWatcher=e.scope.$watch((function(){return function(e){X(e)&&(M.forEach((function(e){"function"==typeof e.unregisterVisibilityWatcher&&(e.unregisterVisibilityWatcher(),delete e.unregisterVisibilityWatcher)})),L.length||r((function(){return ee()})))}(e)}))),U.hideElement(e)}function J(e,t,n){var r=null,i=t>0?M[t-1].element:void 0;if(v((function(t,o){r=n(t,i),e.element=t,e.scope=o,o[E]=e.item})),C.transform){var o=e.scope.uiScrollTdInitializer;o&&o.linking?C.transform(e.scope,e.element):e.scope.uiScrollTdInitializer={onLink:function(){return C.transform(e.scope,e.element)},scope:e.scope}}return r}function G(e,t){t.animated.length?o.all(t.animated).then((function(){V.adjustPaddings(),ee(e)})):V.adjustPaddings()}function K(e,t){V.shouldLoadBottom()?(!t||M.effectiveHeight(t.inserted)>0)&&1===L.push(!0)&&(C.loading(!0),ne(e)):V.shouldLoadTop()&&(!t||M.effectiveHeight(t.prepended)>0||L[0])&&1===L.push(!1)&&(C.loading(!0),ne(e))}function Z(){var t,r,i,o,a=(t=[],r=[],i=[],o=[],M.forEach((function(e,n){switch(e.op){case c:r.unshift(e);break;case f:Y(e,n),e.op=p,o.push(e);break;case h:t=t.concat(J(e,n,V.insertElementAnimated)),e.op=p,o.push(e);break;case d:i.push(e)}})),i.forEach((function(e){return t=t.concat(V.removeItem(e))})),r.length&&r.forEach((function(e){Y(e),e.op=p})),M.forEach((function(e,t){return e.scope.$index=M.first+t})),{prepended:r,removed:i,inserted:o,animated:t});return!e.$$phase&&!n.$$phase&&e.$digest(),a.inserted.forEach((function(e){return U.showElement(e)})),a.prepended.forEach((function(e){return U.showElement(e)})),a}function ee(e){e||(L=[],e=++j);var t=Z();z(e)||(G(e,t),K(e),L.length||C.calculateProperties())}function te(e){var t=Z();V.onAfterPrepend(t),z(e)||(G(e,t),B.forEach((function(e){return e.run()})),B=[],K(e,t),L.shift(),L.length?ne(e):(C.loading(!1),V.on("resize",re),V.on("scroll",re),C.calculateProperties()))}function ne(e){L[0]?M.length&&!V.shouldLoadBottom()?te(e):W((function(t){z(e)||(t.length0&&(V.clipTop(),M.append(t)),te(e))})):M.length&&!V.shouldLoadTop()?te(e):q((function(t){z(e)||(t.length0&&(M.length&&V.clipBottom(),M.prepend(t)),te(e))}))}function re(){A&&function(){if(V.synthetic){var e=V.synthetic.previous,t=V.synthetic.next;if(V.scrollTop()!==t)return requestAnimationFrame((function(){var n=V.scrollTop(),r=e-n;r>0?V.scrollTop(t-r):V.scrollTop(t),V.synthetic=null})),!0;V.synthetic=null}}()||n.$$phase||C.isLoading||C.disabled||(K(j),L.length?Q():(C.calculateProperties(),!e.$$phase&&e.$digest()))}function ie(e){if(!C.disabled){var t=V[0].scrollTop,n=V[0].scrollHeight-V[0].clientHeight;(0===t&&!M.bof||t===n&&!M.eof)&&e.preventDefault()}}v((function(e,t){V.createPaddingElements(e[0]),t.$destroy(),e.remove()})),e.$on("$destroy",(function(){Q(),V.off("mousewheel",ie)})),V.on("mousewheel",ie),function(){var e=0;if(V.applyContainerStyle())ee();else var t=i((function(){if(e++,V.applyContainerStyle()&&(i.cancel(t),ee()),50*e>=500)throw i.cancel(t),Error("ui-scroll directive requires a viewport with non-zero height in ".concat(500,"ms"))}),50)}()}}}])}]); //# sourceMappingURL=ui-scroll.min.js.map \ No newline at end of file diff --git a/dist/ui-scroll.min.js.map b/dist/ui-scroll.min.js.map index 41d2ca3..20ca892 100644 --- a/dist/ui-scroll.min.js.map +++ b/dist/ui-scroll.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/modules/jqLiteExtras.js","webpack:///./src/modules/elementRoutines.js","webpack:///./src/modules/buffer.js","webpack:///./src/modules/padding.js","webpack:///./src/modules/viewport.js","webpack:///./src/modules/adapter.js","webpack:///./src/ui-scroll.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","JQLiteExtras","element","convertToPx","css","getStyle","isWindow","scrollTo","self","direction","elem","top","left","method","prop","preserve","isValueDefined","document","documentElement","getWidthHeight","measure","result","measurements","base","borderA","borderB","computedMarginA","computedMarginB","computedStyle","dirA","dirB","paddingA","paddingB","height","width","padding","border","margin","offsetWidth","offsetHeight","getMeasurements","outer","outerfull","style","parseFloat","angular","this","nodeType","obj","location","alert","setInterval","window","getComputedStyle","currentStyle","rs","rsLeft","RegExp","source","test","runtimeStyle","pixelLeft","forEach","before","newElem","children","j","parent","ref","contents","prepend","length","after","Error","outerHTML","isNumber","outerHeight","option","outerWidth","offset","docElem","win","box","doc","ownerDocument","arguments","undefined","getBoundingClientRect","defaultView","parentWindow","pageYOffset","scrollTop","clientTop","pageXOffset","scrollLeft","clientLeft","ElementRoutines","$injector","$q","$animate","has","isAngularVersionLessThen1_3","version","major","minor","index","sheet","styleSheets","cssRules","err","insertRule","selector","addRule","wrapper","addClass","removeClass","newElement","previousElement","remove","scope","$destroy","insertElement","deferred","defer","enter","resolve","promise","removeElement","leave","then","ScrollBuffer","elementRoutines","bufferSize","startIndex","buffer","Array","extend","size","reset","eof","bof","first","next","minIndex","maxIndex","minIndexUser","maxIndexUser","append","items","item","insert","Math","max","immutableTop","reverse","min","operation","isTop","op","splice","push","unshift","arg1","arg2","indexOf","_op","getAbsMinIndex","incrementMinIndex","decrementMaxIndex","removeElementAnimated","getAbsMaxIndex","effectiveHeight","elements","Number","MAX_VALUE","bottom","NEGATIVE_INFINITY","offsetParent","getItems","filter","getFirstItem","list","getLastItem","CacheProto","$index","sort","a","b","argument","_isTop","Cache","instance","apply","setPrototypeOf","getOwnPropertyNames","methodName","Padding","template","Node","ELEMENT_NODE","tagName","toLowerCase","find","generateElement","cache","Viewport","viewportController","$rootScope","topPadding","bottomPadding","viewport","container","bufferPadding","getScope","createPaddingElements","applyContainerStyle","bottomDataPos","scrollHeight","topDataPos","bottomVisiblePos","topVisiblePos","e","sibling","insertElementAnimated","shouldLoadBottom","clipBottom","overage","overageHeight","itemHeight","emptySpaceHeight","add","adjustPaddings","shouldLoadTop","clipTop","visibleItemsHeight","reduce","summ","topPaddingHeight","topCount","bottomPaddingHeight","bottomCount","averageItemHeight","adjustTopPadding","adjustBottomPadding","topPaddingHeightAdd","bottomPaddingHeightAdd","onAfterMinIndexSet","topPaddingHeightOld","diff","onAfterPrepend","updates","prepended","paddingHeight","position","newPosition","synthetic","previous","resetTopPadding","clear","resetBottomPadding","removeCacheItem","removeItem","Adapter","$scope","$parse","$attr","doAdjust","reload","isLoading","disabled","viewportScope","startScope","$parent","publicContext","assignAdapter","adapter","generatePublicContext","adapterAttr","replace","adapterOnScope","assign","error","message","publicMethods","publicProps","attr","set","publicPropsImmediate","newItems","options","arg3","applyUpdatesFunc","applyUpdatesIndex","cb","slice","applyUpdate","_index","isArray","some","newItem","rowTop","topHeight","topDone","bottomDone","itemTop","isEOF","constant","run","elt","jQuery","fn","jquery","registerFor","addCSSRules","directive","restrict","controller","child","console","$timeout","$interval","require","transclude","priority","terminal","link","controllers","linker","match","uiScroll","parseNumber","defaultValue","isFloat","floor","isNaN","parseNumericAttr","datasource","itemName","datasourceName","handleInertia","ridActual","pending","unbindEvents","persistDatasourceIndex","isDatasourceValid","toString","onRenderHandlers","propName","handler","id","defineDatasourceIndex","propUserName","descriptor","getOwnPropertyDescriptor","fetchNext","success","count","fetchPrevious","isInvalid","rid","$$destroyed","off","resizeAndScrollHandler","isElementVisible","insertWrapperContent","insertAfter","createElement","unregisterVisibilityWatcher","$watch","visibilityWatcher","hideElement","promises","clone","transform","tdInitializer","uiScrollTdInitializer","linking","onLink","updatePaddings","animated","all","enqueueFetch","inserted","loading","fetch","processUpdates","toBePrepended","toBeRemoved","concat","removed","$$phase","$digest","w","showElement","calculateProperties","doAdjustAfterFetch","shift","on","oldPosition","requestAnimationFrame","fixInertia","wheelHandler","event","yMax","clientHeight","preventDefault","$on","tryCount","timer","cancel","initialize"],"mappings":"aACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QAKfF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeb,EAAS,aAAc,CAAEmB,OAAO,KAQvDrB,EAAoBsB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQrB,EAAoBqB,IAC/B,EAAPE,EAAU,OAAOF,EACpB,GAAW,EAAPE,GAA8B,iBAAVF,GAAsBA,GAASA,EAAMG,WAAY,OAAOH,EAChF,IAAII,EAAKX,OAAOY,O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9E,GAAO,SAAC6C,EAAO7P,GACb2F,EAASI,sBAAsB8J,EAAM,IAIrC7P,EAAMC,WACN4P,EAAM9P,YAGRiJ,EAAO+I,IAAI,YAAY,WACrBhE,IACApI,EAASuJ,IAAI,aAAcwC,MAG7B/L,EAAS2L,GAAG,aAAcI,GAzCP,WACjB,IAAIM,EAAW,EACf,GAAIrM,EAASK,sBAcXmD,SAbA,IAAM8I,EAAQxF,GAAU,WAMtB,GALAuF,IACGrM,EAASK,wBACVyG,EAAUyF,OAAOD,GACjB9I,KA5G0B,GA8GzB6I,GA/GkB,IAiHnB,MADAvF,EAAUyF,OAAOD,GACX/U,MAAM,mEAAD,OAjHQ,IAiHR,SAhHe,IAgJlCiV","file":"ui-scroll.min.js","sourcesContent":[" \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, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\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\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n","/*!\r\n globals: angular, window\r\n List of used element methods available in JQuery but not in JQuery Lite\r\n element.before(elem)\r\n element.height()\r\n element.outerHeight(true)\r\n element.height(value) = only for Top/Bottom padding elements\r\n element.scrollTop()\r\n element.scrollTop(value)\r\n */\r\n\r\nexport default class JQLiteExtras {\r\n\r\n registerFor(element) {\r\n let convertToPx, css, getStyle, isWindow;\r\n // angular implementation blows up if elem is the window\r\n css = angular.element.prototype.css;\r\n\r\n element.prototype.css = function (name, value) {\r\n let self = this;\r\n let elem = self[0];\r\n if (!(!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style)) {\r\n return css.call(self, name, value);\r\n }\r\n };\r\n\r\n // as defined in angularjs v1.0.5\r\n isWindow = (obj) => obj && obj.document && obj.location && obj.alert && obj.setInterval;\r\n\r\n function scrollTo(self, direction, value) {\r\n let elem = self[0];\r\n let [method, prop, preserve] = {\r\n top: [\r\n 'scrollTop',\r\n 'pageYOffset',\r\n 'scrollLeft'\r\n ],\r\n left: [\r\n 'scrollLeft',\r\n 'pageXOffset',\r\n 'scrollTop'\r\n ]\r\n }[direction];\r\n\r\n const isValueDefined = typeof value !== 'undefined';\r\n if (isWindow(elem)) {\r\n if (isValueDefined) {\r\n return elem.scrollTo(self[preserve].call(self), value);\r\n }\r\n return (prop in elem) ? elem[prop] : elem.document.documentElement[method];\r\n } else {\r\n if (isValueDefined) {\r\n elem[method] = value;\r\n }\r\n return elem[method];\r\n }\r\n }\r\n\r\n if (window.getComputedStyle) {\r\n getStyle = (elem) => window.getComputedStyle(elem, null);\r\n convertToPx = (elem, value) => parseFloat(value);\r\n } else {\r\n getStyle = (elem) => elem.currentStyle;\r\n convertToPx = (elem, value) => {\r\n let left, result, rs, rsLeft, style;\r\n let core_pnum = /[+-]?(?:\\d*\\.|)\\d+(?:[eE][+-]?\\d+|)/.source;\r\n let rnumnonpx = new RegExp('^(' + core_pnum + ')(?!px)[a-z%]+$', 'i');\r\n\r\n if (!rnumnonpx.test(value)) {\r\n return parseFloat(value);\r\n }\r\n\r\n // ported from JQuery\r\n style = elem.style;\r\n left = style.left;\r\n rs = elem.runtimeStyle;\r\n rsLeft = rs && rs.left;\r\n if (rs) {\r\n rs.left = style.left;\r\n }\r\n // put in the new values to get a computed style out\r\n style.left = value;\r\n result = style.pixelLeft;\r\n style.left = left;\r\n if (rsLeft) {\r\n rs.left = rsLeft;\r\n }\r\n return result;\r\n };\r\n }\r\n\r\n function getMeasurements(elem, measure) {\r\n let base, borderA, borderB, computedMarginA, computedMarginB, computedStyle, dirA, dirB, marginA, marginB, paddingA, paddingB;\r\n\r\n if (isWindow(elem)) {\r\n base = document.documentElement[{height: 'clientHeight', width: 'clientWidth'}[measure]];\r\n\r\n return {\r\n base: base,\r\n padding: 0,\r\n border: 0,\r\n margin: 0\r\n };\r\n }\r\n\r\n // Start with offset property\r\n [\r\n base,\r\n dirA,\r\n dirB\r\n ] = {\r\n width: [\r\n elem.offsetWidth,\r\n 'Left',\r\n 'Right'\r\n ],\r\n height: [\r\n elem.offsetHeight,\r\n 'Top',\r\n 'Bottom'\r\n ]\r\n }[measure];\r\n\r\n computedStyle = getStyle(elem);\r\n paddingA = convertToPx(elem, computedStyle['padding' + dirA]) || 0;\r\n paddingB = convertToPx(elem, computedStyle['padding' + dirB]) || 0;\r\n borderA = convertToPx(elem, computedStyle['border' + dirA + 'Width']) || 0;\r\n borderB = convertToPx(elem, computedStyle['border' + dirB + 'Width']) || 0;\r\n computedMarginA = computedStyle['margin' + dirA];\r\n computedMarginB = computedStyle['margin' + dirB];\r\n\r\n // I do not care for width for now, so this hack is irrelevant\r\n // if ( !supportsPercentMargin )\r\n // computedMarginA = hackPercentMargin( elem, computedStyle, computedMarginA )\r\n // computedMarginB = hackPercentMargin( elem, computedStyle, computedMarginB )\r\n marginA = convertToPx(elem, computedMarginA) || 0;\r\n marginB = convertToPx(elem, computedMarginB) || 0;\r\n\r\n return {\r\n base: base,\r\n padding: paddingA + paddingB,\r\n border: borderA + borderB,\r\n margin: marginA + marginB\r\n };\r\n }\r\n\r\n function getWidthHeight(elem, direction, measure) {\r\n let computedStyle, result;\r\n\r\n let measurements = getMeasurements(elem, direction);\r\n\r\n if (measurements.base > 0) {\r\n return {\r\n base: measurements.base - measurements.padding - measurements.border,\r\n outer: measurements.base,\r\n outerfull: measurements.base + measurements.margin\r\n }[measure];\r\n }\r\n\r\n // Fall back to computed then uncomputed css if necessary\r\n computedStyle = getStyle(elem);\r\n result = computedStyle[direction];\r\n\r\n if (result < 0 || result === null) {\r\n result = elem.style[direction] || 0;\r\n }\r\n\r\n // Normalize \"\", auto, and prepare for extra\r\n result = parseFloat(result) || 0;\r\n\r\n return {\r\n base: result - measurements.padding - measurements.border,\r\n outer: result,\r\n outerfull: result + measurements.padding + measurements.border + measurements.margin\r\n }[measure];\r\n }\r\n\r\n // define missing methods\r\n return angular.forEach({\r\n before(newElem) {\r\n var children, elem, i, j, parent, ref, self;\r\n self = this;\r\n elem = self[0];\r\n parent = self.parent();\r\n children = parent.contents();\r\n if (children[0] === elem) {\r\n return parent.prepend(newElem);\r\n } else {\r\n for (i = j = 1, ref = children.length - 1; 1 <= ref ? j <= ref : j >= ref; i = 1 <= ref ? ++j : --j) {\r\n if (children[i] === elem) {\r\n angular.element(children[i - 1]).after(newElem);\r\n return;\r\n }\r\n }\r\n throw new Error('invalid DOM structure ' + elem.outerHTML);\r\n }\r\n },\r\n height (value){\r\n var self;\r\n self = this;\r\n if (typeof value !== 'undefined') {\r\n if (angular.isNumber(value)) {\r\n value = value + 'px';\r\n }\r\n return css.call(self, 'height', value);\r\n } else {\r\n return getWidthHeight(this[0], 'height', 'base');\r\n }\r\n },\r\n outerHeight(option) {\r\n return getWidthHeight(this[0], 'height', option ? 'outerfull' : 'outer');\r\n },\r\n outerWidth(option) {\r\n return getWidthHeight(this[0], 'width', option ? 'outerfull' : 'outer');\r\n },\r\n\r\n /*\r\n The offset setter method is not implemented\r\n */\r\n offset(value) {\r\n let docElem, win;\r\n let self = this;\r\n let box = {\r\n top: 0,\r\n left: 0\r\n };\r\n let elem = self[0];\r\n let doc = elem && elem.ownerDocument;\r\n\r\n if (arguments.length) {\r\n if (value === undefined) {\r\n return self;\r\n }\r\n // TODO: implement setter\r\n throw new Error('offset setter method is not implemented');\r\n }\r\n\r\n if (!doc) {\r\n return;\r\n }\r\n\r\n docElem = doc.documentElement;\r\n\r\n // TODO: Make sure it's not a disconnected DOM node\r\n\r\n if (elem.getBoundingClientRect != null) {\r\n box = elem.getBoundingClientRect();\r\n }\r\n\r\n win = doc.defaultView || doc.parentWindow;\r\n\r\n return {\r\n top: box.top + (win.pageYOffset || docElem.scrollTop) - (docElem.clientTop || 0),\r\n left: box.left + (win.pageXOffset || docElem.scrollLeft) - (docElem.clientLeft || 0)\r\n };\r\n },\r\n scrollTop(value) {\r\n return scrollTo(this, 'top', value);\r\n },\r\n scrollLeft(value) {\r\n return scrollTo(this, 'left', value);\r\n }\r\n }, (value, key) => {\r\n if (!element.prototype[key]) {\r\n return element.prototype[key] = value;\r\n }\r\n });\r\n }\r\n\r\n}\r\n","const hideClassToken = 'ng-ui-scroll-hide';\r\n\r\nexport default class ElementRoutines {\r\n\r\n static addCSSRules() {\r\n const selector = '.' + hideClassToken;\r\n const rules = 'display: none';\r\n const sheet = document.styleSheets[0];\r\n let index;\r\n try {\r\n index = sheet.cssRules.length;\r\n } catch (err) {\r\n index = 0;\r\n }\r\n if('insertRule' in sheet) {\r\n sheet.insertRule(selector + '{' + rules + '}', index);\r\n }\r\n else if('addRule' in sheet) {\r\n sheet.addRule(selector, rules, index);\r\n }\r\n }\r\n\r\n constructor($injector, $q) {\r\n this.$animate = ($injector.has && $injector.has('$animate')) ? $injector.get('$animate') : null;\r\n this.isAngularVersionLessThen1_3 = angular.version.major === 1 && angular.version.minor < 3;\r\n this.$q = $q;\r\n }\r\n\r\n hideElement(wrapper) {\r\n wrapper.element.addClass(hideClassToken);\r\n }\r\n\r\n showElement(wrapper) {\r\n wrapper.element.removeClass(hideClassToken);\r\n }\r\n\r\n insertElement(newElement, previousElement) {\r\n previousElement.after(newElement);\r\n return [];\r\n }\r\n\r\n removeElement(wrapper) {\r\n wrapper.element.remove();\r\n wrapper.scope.$destroy();\r\n return [];\r\n }\r\n\r\n insertElementAnimated(newElement, previousElement) {\r\n if (!this.$animate) {\r\n return this.insertElement(newElement, previousElement);\r\n }\r\n\r\n if (this.isAngularVersionLessThen1_3) {\r\n const deferred = this.$q.defer();\r\n // no need for parent - previous element is never null\r\n this.$animate.enter(newElement, null, previousElement, () => deferred.resolve());\r\n\r\n return [deferred.promise];\r\n }\r\n\r\n // no need for parent - previous element is never null\r\n return [this.$animate.enter(newElement, null, previousElement)];\r\n }\r\n\r\n removeElementAnimated(wrapper) {\r\n if (!this.$animate) {\r\n return this.removeElement(wrapper);\r\n }\r\n\r\n if (this.isAngularVersionLessThen1_3) {\r\n const deferred = this.$q.defer();\r\n this.$animate.leave(wrapper.element, () => {\r\n wrapper.scope.$destroy();\r\n return deferred.resolve();\r\n });\r\n\r\n return [deferred.promise];\r\n }\r\n\r\n return [(this.$animate.leave(wrapper.element)).then(() => wrapper.scope.$destroy())];\r\n }\r\n}","export default function ScrollBuffer(elementRoutines, bufferSize, startIndex) {\r\n const buffer = Object.create(Array.prototype);\r\n\r\n angular.extend(buffer, {\r\n size: bufferSize,\r\n\r\n reset(startIndex) {\r\n buffer.remove(0, buffer.length);\r\n buffer.eof = false;\r\n buffer.bof = false;\r\n buffer.first = startIndex;\r\n buffer.next = startIndex;\r\n buffer.minIndex = startIndex;\r\n buffer.maxIndex = startIndex;\r\n buffer.minIndexUser = null;\r\n buffer.maxIndexUser = null;\r\n },\r\n\r\n append(items) {\r\n items.forEach((item) => {\r\n ++buffer.next;\r\n buffer.insert('append', item);\r\n });\r\n buffer.maxIndex = buffer.eof ? buffer.next - 1 : Math.max(buffer.next - 1, buffer.maxIndex);\r\n },\r\n\r\n prepend(items, immutableTop) {\r\n items.reverse().forEach((item) => {\r\n if (immutableTop) {\r\n ++buffer.next;\r\n }\r\n else {\r\n --buffer.first;\r\n }\r\n buffer.insert('prepend', item);\r\n });\r\n buffer.minIndex = buffer.bof ? buffer.minIndex = buffer.first : Math.min(buffer.first, buffer.minIndex);\r\n },\r\n\r\n /**\r\n * inserts wrapped element in the buffer\r\n * the first argument is either operation keyword (see below) or a number for operation 'insert'\r\n * for insert the number is the index for the buffer element the new one have to be inserted after\r\n * operations: 'append', 'prepend', 'insert', 'remove', 'update', 'none'\r\n */\r\n insert(operation, item, isTop) {\r\n const wrapper = {\r\n item: item\r\n };\r\n\r\n if (operation % 1 === 0) {// it is an insert\r\n wrapper.op = 'insert';\r\n buffer.splice(operation, 0, wrapper);\r\n if(isTop) {\r\n buffer.first--;\r\n }\r\n else {\r\n buffer.next++;\r\n }\r\n } else {\r\n wrapper.op = operation;\r\n switch (operation) {\r\n case 'append':\r\n buffer.push(wrapper);\r\n break;\r\n case 'prepend':\r\n buffer.unshift(wrapper);\r\n break;\r\n }\r\n }\r\n },\r\n\r\n // removes elements from buffer\r\n remove(arg1, arg2) {\r\n if (angular.isNumber(arg1)) {\r\n // removes items from arg1 (including) through arg2 (excluding)\r\n for (let i = arg1; i < arg2; i++) {\r\n elementRoutines.removeElement(buffer[i]);\r\n }\r\n return buffer.splice(arg1, arg2 - arg1);\r\n }\r\n // removes single item(wrapper) from the buffer\r\n buffer.splice(buffer.indexOf(arg1), 1);\r\n if(arg1._op === 'isTop' && buffer.first === this.getAbsMinIndex()) {\r\n this.incrementMinIndex();\r\n }\r\n else {\r\n this.decrementMaxIndex();\r\n }\r\n if(arg1._op === 'isTop') {\r\n buffer.first++;\r\n }\r\n else {\r\n buffer.next--;\r\n }\r\n if(!buffer.length) {\r\n buffer.first = 1;\r\n buffer.next = 1;\r\n }\r\n\r\n return elementRoutines.removeElementAnimated(arg1);\r\n },\r\n\r\n incrementMinIndex() {\r\n if(buffer.minIndexUser !== null) {\r\n if(buffer.minIndex > buffer.minIndexUser) {\r\n buffer.minIndexUser++;\r\n return;\r\n }\r\n if(buffer.minIndex === buffer.minIndexUser) {\r\n buffer.minIndexUser++;\r\n }\r\n }\r\n buffer.minIndex++;\r\n },\r\n\r\n decrementMaxIndex() {\r\n if(buffer.maxIndexUser !== null && buffer.maxIndex <= buffer.maxIndexUser) {\r\n buffer.maxIndexUser--;\r\n }\r\n buffer.maxIndex--;\r\n },\r\n\r\n getAbsMinIndex() {\r\n if(buffer.minIndexUser !== null) {\r\n return Math.min(buffer.minIndexUser, buffer.minIndex);\r\n }\r\n return buffer.minIndex;\r\n },\r\n\r\n getAbsMaxIndex() {\r\n if(buffer.maxIndexUser !== null) {\r\n return Math.max(buffer.maxIndexUser, buffer.maxIndex);\r\n }\r\n return buffer.maxIndex;\r\n },\r\n\r\n effectiveHeight(elements) {\r\n if (!elements.length) {\r\n return 0;\r\n }\r\n let top = Number.MAX_VALUE;\r\n let bottom = Number.NEGATIVE_INFINITY;\r\n elements.forEach((wrapper) => {\r\n if (wrapper.element[0].offsetParent) {\r\n // element style is not display:none\r\n top = Math.min(top, wrapper.element.offset().top);\r\n bottom = Math.max(bottom, wrapper.element.offset().top + wrapper.element.outerHeight(true));\r\n }\r\n });\r\n return Math.max(0, bottom - top);\r\n },\r\n\r\n getItems() {\r\n return buffer.filter(item => item.op === 'none');\r\n },\r\n\r\n getFirstItem() {\r\n const list = buffer.getItems();\r\n if (!list.length) {\r\n return null;\r\n }\r\n return list[0].item;\r\n },\r\n\r\n getLastItem() {\r\n const list = buffer.getItems();\r\n if (!list.length) {\r\n return null;\r\n }\r\n return list[list.length - 1].item;\r\n }\r\n\r\n });\r\n\r\n buffer.reset(startIndex);\r\n\r\n return buffer;\r\n}\r\n","// Can't just extend the Array, due to Babel does not support built-in classes extending\r\n// This solution was taken from https://stackoverflow.com/questions/46897414/es6-class-extends-array-workaround-for-es5-babel-transpile\r\nclass CacheProto {\r\n add(item) {\r\n for (let i = this.length - 1; i >= 0; i--) {\r\n if (this[i].index === item.scope.$index) {\r\n this[i].height = item.element.outerHeight();\r\n return;\r\n }\r\n }\r\n this.push({\r\n index: item.scope.$index,\r\n height: item.element.outerHeight()\r\n });\r\n this.sort((a, b) => ((a.index < b.index) ? -1 : ((a.index > b.index) ? 1 : 0)));\r\n }\r\n\r\n remove(argument, _isTop) {\r\n const index = argument % 1 === 0 ? argument : argument.scope.$index;\r\n const isTop = argument % 1 === 0 ? _isTop : argument._op === 'isTop';\r\n for (let i = this.length - 1; i >= 0; i--) {\r\n if (this[i].index === index) {\r\n this.splice(i, 1);\r\n break;\r\n }\r\n }\r\n if(!isTop) {\r\n for (let i = this.length - 1; i >= 0; i--) {\r\n if (this[i].index > index) {\r\n this[i].index--;\r\n }\r\n }\r\n }\r\n }\r\n\r\n clear() {\r\n this.length = 0;\r\n }\r\n}\r\n\r\nfunction Cache() {\r\n const instance = [];\r\n instance.push.apply(instance, arguments);\r\n Object.setPrototypeOf(instance, Cache.prototype);\r\n return instance;\r\n}\r\nCache.prototype = Object.create(Array.prototype);\r\nObject.getOwnPropertyNames(CacheProto.prototype).forEach(methodName =>\r\n Cache.prototype[methodName] = CacheProto.prototype[methodName]\r\n);\r\n\r\nfunction generateElement(template) {\r\n if(template.nodeType !== Node.ELEMENT_NODE) {\r\n throw new Error('ui-scroll directive requires an Element node for templating the view');\r\n }\r\n let element;\r\n switch (template.tagName.toLowerCase()) {\r\n case 'dl':\r\n throw new Error(`ui-scroll directive does not support <${template.tagName}> as a repeating tag: ${template.outerHTML}`);\r\n case 'tr':\r\n let table = angular.element('
    ');\r\n element = table.find('tr');\r\n break;\r\n case 'li':\r\n element = angular.element('
  • ');\r\n break;\r\n default:\r\n element = angular.element('
    ');\r\n }\r\n return element;\r\n}\r\n\r\nclass Padding {\r\n constructor(template) {\r\n this.element = generateElement(template);\r\n this.cache = new Cache();\r\n }\r\n\r\n height() {\r\n return this.element.height.apply(this.element, arguments);\r\n }\r\n}\r\n\r\nexport default Padding;","import Padding from './padding';\r\n\r\nexport default function Viewport(elementRoutines, buffer, element, viewportController, $rootScope, padding) {\r\n let topPadding = null;\r\n let bottomPadding = null;\r\n const viewport = viewportController && viewportController.viewport ? viewportController.viewport : angular.element(window);\r\n const container = viewportController && viewportController.container ? viewportController.container : undefined;\r\n const scope = viewportController && viewportController.scope ? viewportController.scope : $rootScope;\r\n\r\n viewport.css({\r\n 'overflow-anchor': 'none',\r\n 'overflow-y': 'auto',\r\n 'display': 'block'\r\n });\r\n\r\n function bufferPadding() {\r\n return viewport.outerHeight() * padding; // some extra space to initiate preload\r\n }\r\n\r\n angular.extend(viewport, {\r\n getScope() {\r\n return scope;\r\n },\r\n\r\n createPaddingElements(template) {\r\n topPadding = new Padding(template);\r\n bottomPadding = new Padding(template);\r\n element.before(topPadding.element);\r\n element.after(bottomPadding.element);\r\n topPadding.height(0);\r\n bottomPadding.height(0);\r\n },\r\n\r\n applyContainerStyle() {\r\n if (!container) {\r\n return true;\r\n }\r\n if(container !== viewport) {\r\n viewport.css('height', window.getComputedStyle(container[0]).height);\r\n }\r\n return viewport.height() > 0;\r\n },\r\n\r\n bottomDataPos() {\r\n let scrollHeight = viewport[0].scrollHeight;\r\n scrollHeight = scrollHeight != null ? scrollHeight : viewport[0].document.documentElement.scrollHeight;\r\n return scrollHeight - bottomPadding.height();\r\n },\r\n\r\n topDataPos() {\r\n return topPadding.height();\r\n },\r\n\r\n bottomVisiblePos() {\r\n return viewport.scrollTop() + viewport.outerHeight();\r\n },\r\n\r\n topVisiblePos() {\r\n return viewport.scrollTop();\r\n },\r\n\r\n insertElement(e, sibling) {\r\n return elementRoutines.insertElement(e, sibling || topPadding.element);\r\n },\r\n\r\n insertElementAnimated(e, sibling) {\r\n return elementRoutines.insertElementAnimated(e, sibling || topPadding.element);\r\n },\r\n\r\n shouldLoadBottom() {\r\n return !buffer.eof && viewport.bottomDataPos() < viewport.bottomVisiblePos() + bufferPadding();\r\n },\r\n\r\n clipBottom() {\r\n // clip the invisible items off the bottom\r\n let overage = 0;\r\n let overageHeight = 0;\r\n let itemHeight = 0;\r\n let emptySpaceHeight = viewport.bottomDataPos() - viewport.bottomVisiblePos() - bufferPadding();\r\n\r\n for (let i = buffer.length - 1; i >= 0; i--) {\r\n itemHeight = buffer[i].element.outerHeight(true);\r\n if (overageHeight + itemHeight > emptySpaceHeight) {\r\n break;\r\n }\r\n bottomPadding.cache.add(buffer[i]);\r\n overageHeight += itemHeight;\r\n overage++;\r\n }\r\n\r\n if (overage > 0) {\r\n buffer.eof = false;\r\n buffer.remove(buffer.length - overage, buffer.length);\r\n buffer.next -= overage;\r\n viewport.adjustPaddings();\r\n }\r\n },\r\n\r\n shouldLoadTop() {\r\n return !buffer.bof && (viewport.topDataPos() > viewport.topVisiblePos() - bufferPadding());\r\n },\r\n\r\n clipTop() {\r\n // clip the invisible items off the top\r\n let overage = 0;\r\n let overageHeight = 0;\r\n let itemHeight = 0;\r\n let emptySpaceHeight = viewport.topVisiblePos() - viewport.topDataPos() - bufferPadding();\r\n\r\n for (let i = 0; i < buffer.length; i++) {\r\n itemHeight = buffer[i].element.outerHeight(true);\r\n if (overageHeight + itemHeight > emptySpaceHeight) {\r\n break;\r\n }\r\n topPadding.cache.add(buffer[i]);\r\n overageHeight += itemHeight;\r\n overage++;\r\n }\r\n\r\n if (overage > 0) {\r\n // we need to adjust top padding element before items are removed from top\r\n // to avoid strange behaviour of scroll bar during remove top items when we are at the very bottom\r\n topPadding.height(topPadding.height() + overageHeight);\r\n buffer.bof = false;\r\n buffer.remove(0, overage);\r\n buffer.first += overage;\r\n }\r\n },\r\n\r\n adjustPaddings() {\r\n if (!buffer.length) {\r\n return;\r\n }\r\n\r\n // precise heights calculation based on items that are in buffer or that were in buffer once\r\n const visibleItemsHeight = buffer.reduce((summ, item) => summ + item.element.outerHeight(true), 0);\r\n\r\n let topPaddingHeight = 0, topCount = 0;\r\n topPadding.cache.forEach(item => {\r\n if(item.index < buffer.first) {\r\n topPaddingHeight += item.height;\r\n topCount++;\r\n }\r\n });\r\n\r\n let bottomPaddingHeight = 0, bottomCount = 0;\r\n bottomPadding.cache.forEach(item => {\r\n if(item.index >= buffer.next) {\r\n bottomPaddingHeight += item.height;\r\n bottomCount++;\r\n }\r\n });\r\n\r\n const totalHeight = visibleItemsHeight + topPaddingHeight + bottomPaddingHeight;\r\n const averageItemHeight = totalHeight / (topCount + bottomCount + buffer.length);\r\n\r\n // average heights calculation, items that have never been reached\r\n let adjustTopPadding = buffer.minIndexUser !== null && buffer.minIndex > buffer.minIndexUser;\r\n let adjustBottomPadding = buffer.maxIndexUser !== null && buffer.maxIndex < buffer.maxIndexUser;\r\n let topPaddingHeightAdd = adjustTopPadding ? (buffer.minIndex - buffer.minIndexUser) * averageItemHeight : 0;\r\n let bottomPaddingHeightAdd = adjustBottomPadding ? (buffer.maxIndexUser - buffer.maxIndex) * averageItemHeight : 0;\r\n\r\n // paddings combine adjustment\r\n topPadding.height(topPaddingHeight + topPaddingHeightAdd);\r\n bottomPadding.height(bottomPaddingHeight + bottomPaddingHeightAdd);\r\n },\r\n\r\n onAfterMinIndexSet(topPaddingHeightOld) {\r\n // additional scrollTop adjustment in case of datasource.minIndex external set\r\n if (buffer.minIndexUser !== null && buffer.minIndex > buffer.minIndexUser) {\r\n let diff = topPadding.height() - topPaddingHeightOld;\r\n viewport.scrollTop(viewport.scrollTop() + diff);\r\n while((diff -= viewport.scrollTop()) > 0) {\r\n bottomPadding.height(bottomPadding.height() + diff);\r\n viewport.scrollTop(viewport.scrollTop() + diff);\r\n }\r\n }\r\n },\r\n\r\n onAfterPrepend(updates) {\r\n if (!updates.prepended.length) {\r\n return;\r\n }\r\n const height = buffer.effectiveHeight(updates.prepended);\r\n const paddingHeight = topPadding.height() - height;\r\n if (paddingHeight >= 0) {\r\n topPadding.height(paddingHeight);\r\n return;\r\n }\r\n const position = viewport.scrollTop();\r\n const newPosition = position - paddingHeight;\r\n viewport.synthetic = { previous: position, next: newPosition };\r\n topPadding.height(0);\r\n viewport.scrollTop(newPosition);\r\n },\r\n\r\n resetTopPadding() {\r\n topPadding.height(0);\r\n topPadding.cache.clear();\r\n },\r\n\r\n resetBottomPadding() {\r\n bottomPadding.height(0);\r\n bottomPadding.cache.clear();\r\n },\r\n\r\n removeCacheItem(item, isTop) {\r\n topPadding.cache.remove(item, isTop);\r\n bottomPadding.cache.remove(item, isTop);\r\n },\r\n\r\n removeItem(item) {\r\n this.removeCacheItem(item);\r\n return buffer.remove(item);\r\n }\r\n });\r\n\r\n return viewport;\r\n}\r\n","class Adapter {\r\n\r\n constructor($scope, $parse, $attr, viewport, buffer, doAdjust, reload) {\r\n this.$parse = $parse;\r\n this.$attr = $attr;\r\n this.viewport = viewport;\r\n this.buffer = buffer;\r\n\r\n this.doAdjust = doAdjust;\r\n this.reload = reload;\r\n\r\n this.isLoading = false;\r\n this.disabled = false;\r\n\r\n const viewportScope = viewport.getScope();\r\n this.startScope = viewportScope.$parent ? viewportScope : $scope;\r\n\r\n this.publicContext = {};\r\n this.assignAdapter($attr.adapter);\r\n this.generatePublicContext();\r\n }\r\n\r\n assignAdapter(adapterAttr) {\r\n if (!adapterAttr || !(adapterAttr = adapterAttr.replace(/^\\s+|\\s+$/gm, ''))) {\r\n return;\r\n }\r\n let adapterOnScope;\r\n\r\n try {\r\n this.$parse(adapterAttr).assign(this.startScope, {});\r\n adapterOnScope = this.$parse(adapterAttr)(this.startScope);\r\n }\r\n catch (error) {\r\n error.message = `Angular ui-scroll Adapter assignment exception.\\n` +\r\n `Can't parse \"${adapterAttr}\" expression.\\n` +\r\n error.message;\r\n throw error;\r\n }\r\n\r\n angular.extend(adapterOnScope, this.publicContext);\r\n this.publicContext = adapterOnScope;\r\n }\r\n\r\n generatePublicContext() {\r\n // these methods will be accessible out of ui-scroll via user defined adapter\r\n const publicMethods = ['reload', 'applyUpdates', 'append', 'prepend', 'isBOF', 'isEOF', 'isEmpty'];\r\n for (let i = publicMethods.length - 1; i >= 0; i--) {\r\n this.publicContext[publicMethods[i]] = this[publicMethods[i]].bind(this);\r\n }\r\n\r\n // these read-only props will be accessible out of ui-scroll via user defined adapter\r\n const publicProps = ['isLoading', 'topVisible', 'topVisibleElement', 'topVisibleScope', 'bottomVisible', 'bottomVisibleElement', 'bottomVisibleScope'];\r\n for (let i = publicProps.length - 1; i >= 0; i--) {\r\n let property, attr = this.$attr[publicProps[i]];\r\n Object.defineProperty(this, publicProps[i], {\r\n get: () => property,\r\n set: (value) => {\r\n property = value;\r\n this.publicContext[publicProps[i]] = value;\r\n if (attr) {\r\n this.$parse(attr).assign(this.startScope, value);\r\n }\r\n }\r\n });\r\n }\r\n\r\n // read-only immediately calculated public properties\r\n const publicPropsImmediate = ['bufferFirst', 'bufferLast', 'bufferLength'];\r\n for (let i = publicPropsImmediate.length - 1; i >= 0; i--) {\r\n Object.defineProperty(this.publicContext, publicPropsImmediate[i], {\r\n get: () => this[publicPropsImmediate[i]]\r\n });\r\n }\r\n\r\n // non-read-only public property\r\n Object.defineProperty(this.publicContext, 'disabled', {\r\n get: () => this.disabled,\r\n set: (value) => (!(this.disabled = value)) ? this.doAdjust() : null\r\n });\r\n }\r\n\r\n loading(value) {\r\n this.isLoading = value;\r\n }\r\n\r\n isBOF() {\r\n return this.buffer.bof;\r\n }\r\n\r\n isEOF() {\r\n return this.buffer.eof;\r\n }\r\n\r\n isEmpty() {\r\n return !this.buffer.length;\r\n }\r\n\r\n get bufferLength() {\r\n return this.buffer.getItems().length;\r\n }\r\n\r\n get bufferFirst() {\r\n return this.buffer.getFirstItem();\r\n }\r\n\r\n get bufferLast() {\r\n return this.buffer.getLastItem();\r\n }\r\n\r\n append(newItems) {\r\n this.buffer.append(newItems);\r\n this.doAdjust();\r\n this.viewport.clipTop();\r\n this.viewport.clipBottom();\r\n }\r\n\r\n prepend(newItems, options = {}) {\r\n this.buffer.prepend(newItems, options.immutableTop);\r\n this.doAdjust();\r\n this.viewport.clipTop();\r\n this.viewport.clipBottom();\r\n }\r\n\r\n applyUpdates(arg1, arg2, arg3) {\r\n if (typeof arg1 === 'function') {\r\n this.applyUpdatesFunc(arg1, arg2);\r\n } else {\r\n this.applyUpdatesIndex(arg1, arg2, arg3);\r\n }\r\n this.doAdjust();\r\n }\r\n\r\n applyUpdatesFunc(cb, options = {}) {\r\n this.buffer.slice(0).forEach((wrapper) => {\r\n // we need to do it on the buffer clone, because buffer content\r\n // may change as we iterate through\r\n this.applyUpdate(wrapper, cb(wrapper.item, wrapper.scope, wrapper.element), options);\r\n });\r\n }\r\n\r\n applyUpdatesIndex(index, newItems, options = {}) {\r\n if (index % 1 !== 0) {\r\n throw new Error('applyUpdates - ' + index + ' is not a valid index (should be an integer)');\r\n }\r\n const _index = index - this.buffer.first;\r\n\r\n // apply updates only within buffer\r\n if (_index >= 0 && _index < this.buffer.length) {\r\n this.applyUpdate(this.buffer[_index], newItems, options);\r\n }\r\n // out-of-buffer case: deletion may affect Paddings\r\n else if(index >= this.buffer.getAbsMinIndex() && index <= this.buffer.getAbsMaxIndex()) {\r\n if(angular.isArray(newItems) && !newItems.length) {\r\n this.viewport.removeCacheItem(index, !options.immutableTop && index === this.buffer.minIndex);\r\n if (!options.immutableTop && index === this.buffer.getAbsMinIndex()) {\r\n this.buffer.incrementMinIndex();\r\n }\r\n else {\r\n this.buffer.decrementMaxIndex();\r\n }\r\n }\r\n }\r\n }\r\n\r\n applyUpdate(wrapper, newItems, options = {}) {\r\n if (!angular.isArray(newItems)) {\r\n return;\r\n }\r\n let position = this.buffer.indexOf(wrapper);\r\n if (!newItems.reverse().some(newItem => newItem === wrapper.item)) {\r\n wrapper.op = 'remove';\r\n if (!options.immutableTop && position === 0 && !newItems.length) {\r\n wrapper._op = 'isTop'; // to catch \"first\" edge case on remove\r\n }\r\n }\r\n newItems.forEach((newItem) => {\r\n if (newItem === wrapper.item) {\r\n position--;\r\n } else {\r\n // 3 parameter (isTop) is to catch \"first\" edge case on insert\r\n this.buffer.insert(position + 1, newItem, !options.immutableTop && position === -1);\r\n }\r\n });\r\n }\r\n\r\n calculateProperties() {\r\n let rowTop = null, topHeight = 0;\r\n let topDone = false, bottomDone = false;\r\n const length = this.buffer.length;\r\n\r\n for (let i = 0; i < length; i++) {\r\n const item = this.buffer[i];\r\n const itemTop = item.element.offset().top;\r\n\r\n if (rowTop !== itemTop) { // a new row condition\r\n const itemHeight = item.element.outerHeight(true);\r\n const top = this.viewport.topDataPos() + topHeight + itemHeight;\r\n\r\n if (!topDone && top > this.viewport.topVisiblePos()) {\r\n topDone = true;\r\n this['topVisible'] = item.item;\r\n this['topVisibleElement'] = item.element;\r\n this['topVisibleScope'] = item.scope;\r\n }\r\n if (!bottomDone && (top >= this.viewport.bottomVisiblePos() || (i === length - 1 && this.isEOF()))) {\r\n bottomDone = true;\r\n this['bottomVisible'] = item.item;\r\n this['bottomVisibleElement'] = item.element;\r\n this['bottomVisibleScope'] = item.scope;\r\n }\r\n topHeight += itemHeight;\r\n }\r\n rowTop = itemTop;\r\n\r\n if (topDone && bottomDone) {\r\n break;\r\n }\r\n }\r\n }\r\n\r\n}\r\n\r\nexport default Adapter;\r\n","import JQLiteExtras from './modules/jqLiteExtras';\nimport ElementRoutines from './modules/elementRoutines.js';\nimport ScrollBuffer from './modules/buffer.js';\nimport Viewport from './modules/viewport.js';\nimport Adapter from './modules/adapter.js';\n\nangular.module('ui.scroll', [])\n\n .constant('JQLiteExtras', JQLiteExtras)\n .run(['JQLiteExtras', (JQLiteExtras) => {\n const elt = angular.element;\n !(window.jQuery && elt.fn && elt.fn.jquery) ? (new JQLiteExtras()).registerFor(elt) : null;\n ElementRoutines.addCSSRules();\n }])\n\n .directive('uiScrollViewport', function () {\n return {\n restrict: 'A',\n controller: [\n '$scope',\n '$element',\n function (scope, element) {\n this.container = element;\n this.viewport = element;\n this.scope = scope;\n\n angular.forEach(element.children(), child => {\n if (child.tagName.toLowerCase() === 'tbody') {\n this.viewport = angular.element(child);\n }\n });\n\n return this;\n }\n ]\n };\n })\n\n .directive('uiScroll', [\n '$log',\n '$injector',\n '$rootScope',\n '$timeout',\n '$interval',\n '$q',\n '$parse',\n function (console, $injector, $rootScope, $timeout, $interval, $q, $parse) {\n\n return {\n require: ['?^uiScrollViewport'],\n restrict: 'A',\n transclude: 'element',\n priority: 1000,\n terminal: true,\n link: link\n };\n\n function link($scope, element, $attr, controllers, linker) {\n const match = $attr.uiScroll.match(/^\\s*(\\w+)\\s+in\\s+([(\\w|\\$)\\.]+)\\s*$/);\n if (!match) {\n throw new Error('Expected uiScroll in form of \\'_item_ in _datasource_\\' but got \\'' + $attr.uiScroll + '\\'');\n }\n\n function parseNumber(value, defaultValue, isFloat) {\n if (!isFloat) {\n value = value === null ? defaultValue : Math.floor(value);\n }\n return isNaN(value) ? defaultValue : value;\n }\n\n function parseNumericAttr(value, defaultValue, isFloat) {\n const result = $parse(value)($scope);\n return parseNumber(result, defaultValue, isFloat);\n }\n\n function parseBooleanAttr(value, defaultValue) {\n const result = $parse(value)($scope);\n return typeof result === 'boolean' ? result : defaultValue;\n }\n\n const BUFFER_MIN = 3;\n const BUFFER_DEFAULT = 10;\n const PADDING_MIN = 0.3;\n const PADDING_DEFAULT = 0.5;\n const HANDLE_INERTIA_DEFAULT = true;\n const START_INDEX_DEFAULT = 1;\n const MAX_VIEWPORT_DELAY = 500;\n const VIEWPORT_POLLING_INTERVAL = 50;\n\n let datasource = null;\n const itemName = match[1];\n const datasourceName = match[2];\n const viewportController = controllers[0];\n const bufferSize = Math.max(BUFFER_MIN, parseNumericAttr($attr.bufferSize, BUFFER_DEFAULT));\n const padding = Math.max(PADDING_MIN, parseNumericAttr($attr.padding, PADDING_DEFAULT, true));\n const handleInertia = parseBooleanAttr($attr.handleInertia, HANDLE_INERTIA_DEFAULT);\n let startIndex = parseNumericAttr($attr.startIndex, START_INDEX_DEFAULT);\n let ridActual = 0; // current data revision id\n let pending = [];\n\n const elementRoutines = new ElementRoutines($injector, $q);\n const buffer = new ScrollBuffer(elementRoutines, bufferSize, startIndex);\n const viewport = new Viewport(elementRoutines, buffer, element, viewportController, $rootScope, padding);\n const adapter = new Adapter($scope, $parse, $attr, viewport, buffer, doAdjust, reload);\n\n if (viewportController) {\n viewportController.adapter = adapter;\n }\n\n const isDatasourceValid = () =>\n Object.prototype.toString.call(datasource) === '[object Object]' && typeof datasource.get === 'function';\n\n datasource = $parse(datasourceName)($scope); // try to get datasource on scope\n if (!isDatasourceValid()) {\n datasource = $injector.get(datasourceName); // try to inject datasource as service\n if (!isDatasourceValid()) {\n throw new Error(datasourceName + ' is not a valid datasource');\n }\n }\n\n let onRenderHandlers = [];\n function onRenderHandlersRunner() {\n onRenderHandlers.forEach(handler => handler.run());\n onRenderHandlers = [];\n }\n function persistDatasourceIndex(datasource, propName) {\n let getter;\n // need to postpone min/maxIndexUser processing if the view is empty\n if(angular.isNumber(datasource[propName])) {\n getter = datasource[propName];\n if(angular.isNumber(getter)) {\n onRenderHandlers = onRenderHandlers.filter(handler => handler.id !== propName);\n onRenderHandlers.push({\n id: propName,\n run: () => datasource[propName] = getter\n });\n }\n }\n }\n\n function defineDatasourceIndex(datasource, propName, propUserName) {\n const descriptor = Object.getOwnPropertyDescriptor(datasource, propName);\n if (descriptor && (descriptor.set || descriptor.get)) {\n return;\n }\n let getter;\n persistDatasourceIndex(datasource, propName);\n Object.defineProperty(datasource, propName, {\n set: (value) => {\n getter = value;\n if(pending.length && !buffer.length) {\n persistDatasourceIndex(datasource, propName);\n return;\n }\n buffer[propUserName] = value;\n const topPaddingHeightOld = viewport.topDataPos();\n viewport.adjustPaddings();\n if (propName === 'minIndex') {\n viewport.onAfterMinIndexSet(topPaddingHeightOld);\n }\n },\n get: () => getter\n });\n }\n\n defineDatasourceIndex(datasource, 'minIndex', 'minIndexUser');\n defineDatasourceIndex(datasource, 'maxIndex', 'maxIndexUser');\n\n const fetchNext = (datasource.get.length !== 2) ?\n (success) => datasource.get(buffer.next, bufferSize, success) :\n (success) => {\n datasource.get({\n index: buffer.next,\n append: buffer.length ? buffer[buffer.length - 1].item : void 0,\n count: bufferSize\n }, success);\n };\n\n const fetchPrevious = (datasource.get.length !== 2) ?\n (success) => datasource.get(buffer.first - bufferSize, bufferSize, success) :\n (success) => {\n datasource.get({\n index: buffer.first - bufferSize,\n prepend: buffer.length ? buffer[0].item : void 0,\n count: bufferSize\n }, success);\n };\n\n const initialize = () => {\n let tryCount = 0;\n if(!viewport.applyContainerStyle()) {\n const timer = $interval(() => {\n tryCount++;\n if(viewport.applyContainerStyle()) {\n $interval.cancel(timer);\n doAdjust();\n }\n if(tryCount * VIEWPORT_POLLING_INTERVAL >= MAX_VIEWPORT_DELAY) {\n $interval.cancel(timer);\n throw Error(`ui-scroll directive requires a viewport with non-zero height in ${MAX_VIEWPORT_DELAY}ms`);\n }\n }, VIEWPORT_POLLING_INTERVAL);\n }\n else {\n doAdjust();\n }\n };\n\n /**\n * Build padding elements\n *\n * Calling linker is the only way I found to get access to the tag name of the template\n * to prevent the directive scope from pollution a new scope is created and destroyed\n * right after the builder creation is completed\n */\n linker((clone, scope) => {\n viewport.createPaddingElements(clone[0]);\n // we do not include the clone in the DOM. It means that the nested directives will not\n // be able to reach the parent directives, but in this case it is intentional because we\n // created the clone to access the template tag name\n scope.$destroy();\n clone.remove();\n });\n\n $scope.$on('$destroy', () => {\n unbindEvents();\n viewport.off('mousewheel', wheelHandler);\n });\n\n viewport.on('mousewheel', wheelHandler);\n\n initialize();\n\n /* Private function definitions */\n\n function isInvalid(rid) {\n return (rid && rid !== ridActual) || $scope.$$destroyed;\n }\n\n function bindEvents() {\n viewport.on('resize', resizeAndScrollHandler);\n viewport.on('scroll', resizeAndScrollHandler);\n }\n\n function unbindEvents() {\n viewport.off('resize', resizeAndScrollHandler);\n viewport.off('scroll', resizeAndScrollHandler);\n }\n\n function reload() {\n unbindEvents();\n viewport.resetTopPadding();\n viewport.resetBottomPadding();\n if (arguments.length) {\n startIndex = parseNumber(arguments[0], START_INDEX_DEFAULT, false);\n }\n buffer.reset(startIndex);\n persistDatasourceIndex(datasource, 'minIndex');\n persistDatasourceIndex(datasource, 'maxIndex');\n doAdjust();\n }\n\n function isElementVisible(wrapper) {\n return wrapper.element.height() && wrapper.element[0].offsetParent;\n }\n\n function visibilityWatcher(wrapper) {\n if (isElementVisible(wrapper)) {\n buffer.forEach((item) => {\n if (typeof item.unregisterVisibilityWatcher === 'function') {\n item.unregisterVisibilityWatcher();\n delete item.unregisterVisibilityWatcher;\n }\n });\n if (!pending.length) {\n $timeout(() => doAdjust());\n }\n }\n }\n\n function insertWrapperContent(wrapper, insertAfter) {\n createElement(wrapper, insertAfter, viewport.insertElement);\n if (!isElementVisible(wrapper)) {\n wrapper.unregisterVisibilityWatcher = wrapper.scope.$watch(() => visibilityWatcher(wrapper));\n }\n elementRoutines.hideElement(wrapper); // hide inserted elements before data binding\n }\n\n function createElement(wrapper, insertAfter, insertElement) {\n let promises = null;\n const sibling = (insertAfter > 0) ? buffer[insertAfter - 1].element : undefined;\n linker((clone, scope) => {\n promises = insertElement(clone, sibling);\n wrapper.element = clone;\n wrapper.scope = scope;\n scope[itemName] = wrapper.item;\n });\n // ui-scroll-grid apply\n if (adapter.transform) {\n const tdInitializer = wrapper.scope.uiScrollTdInitializer;\n if (tdInitializer && tdInitializer.linking) {\n adapter.transform(wrapper.scope, wrapper.element);\n } else {\n wrapper.scope.uiScrollTdInitializer = {\n onLink: () => adapter.transform(wrapper.scope, wrapper.element),\n scope: wrapper.scope\n };\n }\n }\n return promises;\n }\n\n function updateDOM() {\n let promises = [];\n const toBePrepended = [];\n const toBeRemoved = [];\n const inserted = [];\n\n buffer.forEach((wrapper, i) => {\n switch (wrapper.op) {\n case 'prepend':\n toBePrepended.unshift(wrapper);\n break;\n case 'append':\n insertWrapperContent(wrapper, i);\n wrapper.op = 'none';\n inserted.push(wrapper);\n break;\n case 'insert':\n promises = promises.concat(createElement(wrapper, i, viewport.insertElementAnimated));\n wrapper.op = 'none';\n inserted.push(wrapper);\n break;\n case 'remove':\n toBeRemoved.push(wrapper);\n }\n });\n\n toBeRemoved.forEach((wrapper) => promises = promises.concat(viewport.removeItem(wrapper)));\n\n if (toBePrepended.length)\n toBePrepended.forEach((wrapper) => {\n insertWrapperContent(wrapper);\n wrapper.op = 'none';\n });\n\n buffer.forEach((item, i) => item.scope.$index = buffer.first + i);\n\n return {\n prepended: toBePrepended,\n removed: toBeRemoved,\n inserted: inserted,\n animated: promises\n };\n\n }\n\n function updatePaddings(rid, updates) {\n // schedule another doAdjust after animation completion\n if (updates.animated.length) {\n $q.all(updates.animated).then(() => {\n viewport.adjustPaddings();\n doAdjust(rid);\n });\n } else {\n viewport.adjustPaddings();\n }\n }\n\n function enqueueFetch(rid, updates) {\n if (viewport.shouldLoadBottom()) {\n if (!updates || buffer.effectiveHeight(updates.inserted) > 0) {\n // this means that at least one item appended in the last batch has height > 0\n if (pending.push(true) === 1) {\n adapter.loading(true);\n fetch(rid);\n }\n }\n } else if (viewport.shouldLoadTop()) {\n if ((!updates || buffer.effectiveHeight(updates.prepended) > 0) || pending[0]) {\n // this means that at least one item appended in the last batch has height > 0\n // pending[0] = true means that previous fetch was appending. We need to force at least one prepend\n // BTW there will always be at least 1 element in the pending array because bottom is fetched first\n if (pending.push(false) === 1) {\n adapter.loading(true);\n fetch(rid);\n }\n }\n }\n }\n\n function processUpdates() {\n const updates = updateDOM();\n\n // We need the item bindings to be processed before we can do adjustments\n !$scope.$$phase && !$rootScope.$$phase && $scope.$digest();\n\n updates.inserted.forEach(w => elementRoutines.showElement(w));\n updates.prepended.forEach(w => elementRoutines.showElement(w));\n return updates;\n }\n\n function doAdjust(rid) {\n if (!rid) { // dismiss pending requests\n pending = [];\n rid = ++ridActual;\n }\n\n const updates = processUpdates();\n\n if (isInvalid(rid)) {\n return;\n }\n\n updatePaddings(rid, updates);\n enqueueFetch(rid);\n\n if (!pending.length) {\n adapter.calculateProperties();\n }\n }\n\n function doAdjustAfterFetch(rid) {\n const updates = processUpdates();\n\n viewport.onAfterPrepend(updates);\n\n if (isInvalid(rid)) {\n return;\n }\n\n updatePaddings(rid, updates);\n onRenderHandlersRunner();\n enqueueFetch(rid, updates);\n pending.shift();\n\n if (pending.length)\n fetch(rid);\n else {\n adapter.loading(false);\n bindEvents();\n adapter.calculateProperties();\n }\n }\n\n function fetch(rid) {\n if (pending[0]) {// scrolling down\n if (buffer.length && !viewport.shouldLoadBottom()) {\n doAdjustAfterFetch(rid);\n } else {\n fetchNext((result) => {\n if (isInvalid(rid)) {\n return;\n }\n\n if (result.length < bufferSize) {\n buffer.eof = true;\n }\n\n if (result.length > 0) {\n viewport.clipTop();\n buffer.append(result);\n }\n\n doAdjustAfterFetch(rid);\n });\n }\n } else { // scrolling up\n if (buffer.length && !viewport.shouldLoadTop()) {\n doAdjustAfterFetch(rid);\n } else {\n fetchPrevious((result) => {\n if (isInvalid(rid)) {\n return;\n }\n\n if (result.length < bufferSize) {\n buffer.bof = true;\n // log 'bof is reached'\n }\n\n if (result.length > 0) {\n if (buffer.length) {\n viewport.clipBottom();\n }\n buffer.prepend(result);\n }\n\n doAdjustAfterFetch(rid);\n });\n }\n }\n }\n\n function fixInertia() {\n if (!viewport.synthetic) {\n return;\n }\n const oldPosition = viewport.synthetic.previous;\n const newPosition = viewport.synthetic.next;\n if (viewport.scrollTop() !== newPosition) {\n requestAnimationFrame(() => {\n const position = viewport.scrollTop();\n const diff = oldPosition - position;\n if (diff > 0) { // inertia over synthetic\n viewport.scrollTop(newPosition - diff);\n } else {\n viewport.scrollTop(newPosition);\n }\n viewport.synthetic = null;\n });\n return true;\n }\n viewport.synthetic = null;\n }\n\n function resizeAndScrollHandler() {\n if (handleInertia && fixInertia()) {\n return;\n }\n if (!$rootScope.$$phase && !adapter.isLoading && !adapter.disabled) {\n\n enqueueFetch(ridActual);\n\n if (pending.length) {\n unbindEvents();\n } else {\n adapter.calculateProperties();\n !$scope.$$phase && $scope.$digest();\n }\n }\n }\n\n function wheelHandler(event) {\n if (!adapter.disabled) {\n const scrollTop = viewport[0].scrollTop;\n const yMax = viewport[0].scrollHeight - viewport[0].clientHeight;\n\n if ((scrollTop === 0 && !buffer.bof) || (scrollTop === yMax && !buffer.eof)) {\n event.preventDefault();\n }\n }\n }\n }\n\n }\n ]);\n"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/modules/jqLiteExtras.js","webpack:///./src/modules/elementRoutines.js","webpack:///./src/modules/utils.js","webpack:///./src/modules/buffer.js","webpack:///./src/modules/padding.js","webpack:///./src/modules/viewport.js","webpack:///./src/modules/adapter.js","webpack:///./src/ui-scroll.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","JQLiteExtras","element","convertToPx","css","getStyle","isWindow","scrollTo","self","direction","elem","top","left","method","prop","preserve","isValueDefined","document","documentElement","getWidthHeight","measure","result","measurements","base","borderA","borderB","computedMarginA","computedMarginB","computedStyle","dirA","dirB","paddingA","paddingB","height","width","padding","border","margin","offsetWidth","offsetHeight","getMeasurements","outer","outerfull","style","parseFloat","angular","this","nodeType","obj","location","alert","setInterval","window","getComputedStyle","currentStyle","rs","rsLeft","RegExp","source","test","runtimeStyle","pixelLeft","forEach","before","newElem","children","j","parent","ref","contents","prepend","length","after","Error","outerHTML","isNumber","outerHeight","option","outerWidth","offset","docElem","win","box","doc","ownerDocument","arguments","undefined","getBoundingClientRect","defaultView","parentWindow","pageYOffset","scrollTop","clientTop","pageXOffset","scrollLeft","clientLeft","hideClassToken","ElementRoutines","$injector","$q","$animate","has","isAngularVersionLessThen1_3","version","major","minor","index","selector","rules","sheet","styleSheets","cssRules","err","insertRule","addRule","wrapper","addClass","removeClass","newElement","previousElement","remove","scope","$destroy","insertElement","deferred","defer","enter","resolve","promise","removeElement","leave","then","OPERATIONS","ScrollBuffer","elementRoutines","bufferSize","startIndex","buffer","Array","extend","size","reset","eof","bof","first","next","minIndex","maxIndex","minIndexUser","maxIndexUser","append","items","item","insert","Math","max","immutableTop","reverse","min","operation","shiftTop","op","splice","push","unshift","arg1","arg2","indexOf","getAbsMinIndex","incrementMinIndex","decrementMaxIndex","removeElementAnimated","getAbsMaxIndex","effectiveHeight","elements","Number","MAX_VALUE","bottom","NEGATIVE_INFINITY","offsetParent","getItems","filter","getFirstItem","list","getLastItem","CacheProto","$index","sort","a","b","argument","_shiftTop","Cache","instance","apply","setPrototypeOf","getOwnPropertyNames","methodName","Padding","template","Node","ELEMENT_NODE","tagName","toLowerCase","find","generateElement","cache","Viewport","viewportController","$rootScope","topPadding","bottomPadding","viewport","container","bufferPadding","getScope","createPaddingElements","applyContainerStyle","bottomDataPos","scrollHeight","topDataPos","bottomVisiblePos","topVisiblePos","e","sibling","insertElementAnimated","shouldLoadBottom","clipBottom","overage","overageHeight","itemHeight","emptySpaceHeight","add","adjustPaddings","shouldLoadTop","clipTop","visibleItemsHeight","reduce","summ","topPaddingHeight","topCount","bottomPaddingHeight","bottomCount","averageItemHeight","adjustTopPadding","adjustBottomPadding","topPaddingHeightAdd","bottomPaddingHeightAdd","onAfterMinIndexSet","topPaddingHeightOld","diff","onAfterPrepend","updates","prepended","paddingHeight","position","newPosition","synthetic","previous","resetTopPadding","clear","resetBottomPadding","removeCacheItem","removeItem","Adapter","$scope","$parse","$attr","doAdjust","reload","isLoading","disabled","viewportScope","startScope","$parent","publicContext","assignAdapter","adapter","generatePublicContext","adapterAttr","replace","adapterOnScope","assign","error","message","publicMethods","publicProps","attr","set","publicPropsImmediate","newItems","options","arg3","applyUpdatesFunc","applyUpdatesIndex","cb","slice","applyUpdate","_index","isArray","some","newItem","rowTop","topHeight","topDone","bottomDone","itemTop","isEOF","constant","run","elt","jQuery","fn","jquery","registerFor","addCSSRules","directive","restrict","controller","child","console","$timeout","$interval","require","transclude","priority","terminal","link","controllers","linker","match","uiScroll","parseNumber","defaultValue","isFloat","floor","isNaN","parseNumericAttr","datasource","itemName","datasourceName","handleInertia","ridActual","pending","unbindEvents","persistDatasourceIndex","isDatasourceValid","toString","onRenderHandlers","propName","handler","id","defineDatasourceIndex","propUserName","descriptor","getOwnPropertyDescriptor","fetchNext","success","count","fetchPrevious","isInvalid","rid","$$destroyed","off","resizeAndScrollHandler","isElementVisible","insertWrapperContent","insertAfter","createElement","unregisterVisibilityWatcher","$watch","visibilityWatcher","hideElement","promises","clone","transform","tdInitializer","uiScrollTdInitializer","linking","onLink","updatePaddings","animated","all","enqueueFetch","inserted","loading","fetch","processUpdates","toBePrepended","toBeRemoved","concat","removed","$$phase","$digest","w","showElement","calculateProperties","doAdjustAfterFetch","shift","on","oldPosition","requestAnimationFrame","fixInertia","wheelHandler","event","yMax","clientHe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OAG7B/L,EAAS2L,GAAG,aAAcI,IAzCP,WACjB,IAAIM,EAAW,EACf,GAAIrM,EAASK,sBAcXmD,UAbA,IAAM8I,EAAQxF,GAAU,WAMtB,GALAuF,IACGrM,EAASK,wBACVyG,EAAUyF,OAAOD,GACjB9I,MA5G0B,GA8GzB6I,GA/GkB,IAiHnB,MADAvF,EAAUyF,OAAOD,GACXjV,MAAM,mEAAD,OAjHQ,IAiHR,SAhHe,IAgJlCmV","file":"ui-scroll.min.js","sourcesContent":[" \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, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\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\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n","/*!\r\n globals: angular, window\r\n List of used element methods available in JQuery but not in JQuery Lite\r\n element.before(elem)\r\n element.height()\r\n element.outerHeight(true)\r\n element.height(value) = only for Top/Bottom padding elements\r\n element.scrollTop()\r\n element.scrollTop(value)\r\n */\r\n\r\nexport default class JQLiteExtras {\r\n\r\n registerFor(element) {\r\n let convertToPx, css, getStyle, isWindow;\r\n // angular implementation blows up if elem is the window\r\n css = angular.element.prototype.css;\r\n\r\n element.prototype.css = function (name, value) {\r\n let self = this;\r\n let elem = self[0];\r\n if (!(!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style)) {\r\n return css.call(self, name, value);\r\n }\r\n };\r\n\r\n // as defined in angularjs v1.0.5\r\n isWindow = (obj) => obj && obj.document && obj.location && obj.alert && obj.setInterval;\r\n\r\n function scrollTo(self, direction, value) {\r\n let elem = self[0];\r\n let [method, prop, preserve] = {\r\n top: [\r\n 'scrollTop',\r\n 'pageYOffset',\r\n 'scrollLeft'\r\n ],\r\n left: [\r\n 'scrollLeft',\r\n 'pageXOffset',\r\n 'scrollTop'\r\n ]\r\n }[direction];\r\n\r\n const isValueDefined = typeof value !== 'undefined';\r\n if (isWindow(elem)) {\r\n if (isValueDefined) {\r\n return elem.scrollTo(self[preserve].call(self), value);\r\n }\r\n return (prop in elem) ? elem[prop] : elem.document.documentElement[method];\r\n } else {\r\n if (isValueDefined) {\r\n elem[method] = value;\r\n }\r\n return elem[method];\r\n }\r\n }\r\n\r\n if (window.getComputedStyle) {\r\n getStyle = (elem) => window.getComputedStyle(elem, null);\r\n convertToPx = (elem, value) => parseFloat(value);\r\n } else {\r\n getStyle = (elem) => elem.currentStyle;\r\n convertToPx = (elem, value) => {\r\n let left, result, rs, rsLeft, style;\r\n let core_pnum = /[+-]?(?:\\d*\\.|)\\d+(?:[eE][+-]?\\d+|)/.source;\r\n let rnumnonpx = new RegExp('^(' + core_pnum + ')(?!px)[a-z%]+$', 'i');\r\n\r\n if (!rnumnonpx.test(value)) {\r\n return parseFloat(value);\r\n }\r\n\r\n // ported from JQuery\r\n style = elem.style;\r\n left = style.left;\r\n rs = elem.runtimeStyle;\r\n rsLeft = rs && rs.left;\r\n if (rs) {\r\n rs.left = style.left;\r\n }\r\n // put in the new values to get a computed style out\r\n style.left = value;\r\n result = style.pixelLeft;\r\n style.left = left;\r\n if (rsLeft) {\r\n rs.left = rsLeft;\r\n }\r\n return result;\r\n };\r\n }\r\n\r\n function getMeasurements(elem, measure) {\r\n let base, borderA, borderB, computedMarginA, computedMarginB, computedStyle, dirA, dirB, marginA, marginB, paddingA, paddingB;\r\n\r\n if (isWindow(elem)) {\r\n base = document.documentElement[{height: 'clientHeight', width: 'clientWidth'}[measure]];\r\n\r\n return {\r\n base: base,\r\n padding: 0,\r\n border: 0,\r\n margin: 0\r\n };\r\n }\r\n\r\n // Start with offset property\r\n [\r\n base,\r\n dirA,\r\n dirB\r\n ] = {\r\n width: [\r\n elem.offsetWidth,\r\n 'Left',\r\n 'Right'\r\n ],\r\n height: [\r\n elem.offsetHeight,\r\n 'Top',\r\n 'Bottom'\r\n ]\r\n }[measure];\r\n\r\n computedStyle = getStyle(elem);\r\n paddingA = convertToPx(elem, computedStyle['padding' + dirA]) || 0;\r\n paddingB = convertToPx(elem, computedStyle['padding' + dirB]) || 0;\r\n borderA = convertToPx(elem, computedStyle['border' + dirA + 'Width']) || 0;\r\n borderB = convertToPx(elem, computedStyle['border' + dirB + 'Width']) || 0;\r\n computedMarginA = computedStyle['margin' + dirA];\r\n computedMarginB = computedStyle['margin' + dirB];\r\n\r\n // I do not care for width for now, so this hack is irrelevant\r\n // if ( !supportsPercentMargin )\r\n // computedMarginA = hackPercentMargin( elem, computedStyle, computedMarginA )\r\n // computedMarginB = hackPercentMargin( elem, computedStyle, computedMarginB )\r\n marginA = convertToPx(elem, computedMarginA) || 0;\r\n marginB = convertToPx(elem, computedMarginB) || 0;\r\n\r\n return {\r\n base: base,\r\n padding: paddingA + paddingB,\r\n border: borderA + borderB,\r\n margin: marginA + marginB\r\n };\r\n }\r\n\r\n function getWidthHeight(elem, direction, measure) {\r\n let computedStyle, result;\r\n\r\n let measurements = getMeasurements(elem, direction);\r\n\r\n if (measurements.base > 0) {\r\n return {\r\n base: measurements.base - measurements.padding - measurements.border,\r\n outer: measurements.base,\r\n outerfull: measurements.base + measurements.margin\r\n }[measure];\r\n }\r\n\r\n // Fall back to computed then uncomputed css if necessary\r\n computedStyle = getStyle(elem);\r\n result = computedStyle[direction];\r\n\r\n if (result < 0 || result === null) {\r\n result = elem.style[direction] || 0;\r\n }\r\n\r\n // Normalize \"\", auto, and prepare for extra\r\n result = parseFloat(result) || 0;\r\n\r\n return {\r\n base: result - measurements.padding - measurements.border,\r\n outer: result,\r\n outerfull: result + measurements.padding + measurements.border + measurements.margin\r\n }[measure];\r\n }\r\n\r\n // define missing methods\r\n return angular.forEach({\r\n before(newElem) {\r\n var children, elem, i, j, parent, ref, self;\r\n self = this;\r\n elem = self[0];\r\n parent = self.parent();\r\n children = parent.contents();\r\n if (children[0] === elem) {\r\n return parent.prepend(newElem);\r\n } else {\r\n for (i = j = 1, ref = children.length - 1; 1 <= ref ? j <= ref : j >= ref; i = 1 <= ref ? ++j : --j) {\r\n if (children[i] === elem) {\r\n angular.element(children[i - 1]).after(newElem);\r\n return;\r\n }\r\n }\r\n throw new Error('invalid DOM structure ' + elem.outerHTML);\r\n }\r\n },\r\n height (value){\r\n var self;\r\n self = this;\r\n if (typeof value !== 'undefined') {\r\n if (angular.isNumber(value)) {\r\n value = value + 'px';\r\n }\r\n return css.call(self, 'height', value);\r\n } else {\r\n return getWidthHeight(this[0], 'height', 'base');\r\n }\r\n },\r\n outerHeight(option) {\r\n return getWidthHeight(this[0], 'height', option ? 'outerfull' : 'outer');\r\n },\r\n outerWidth(option) {\r\n return getWidthHeight(this[0], 'width', option ? 'outerfull' : 'outer');\r\n },\r\n\r\n /*\r\n The offset setter method is not implemented\r\n */\r\n offset(value) {\r\n let docElem, win;\r\n let self = this;\r\n let box = {\r\n top: 0,\r\n left: 0\r\n };\r\n let elem = self[0];\r\n let doc = elem && elem.ownerDocument;\r\n\r\n if (arguments.length) {\r\n if (value === undefined) {\r\n return self;\r\n }\r\n // TODO: implement setter\r\n throw new Error('offset setter method is not implemented');\r\n }\r\n\r\n if (!doc) {\r\n return;\r\n }\r\n\r\n docElem = doc.documentElement;\r\n\r\n // TODO: Make sure it's not a disconnected DOM node\r\n\r\n if (elem.getBoundingClientRect != null) {\r\n box = elem.getBoundingClientRect();\r\n }\r\n\r\n win = doc.defaultView || doc.parentWindow;\r\n\r\n return {\r\n top: box.top + (win.pageYOffset || docElem.scrollTop) - (docElem.clientTop || 0),\r\n left: box.left + (win.pageXOffset || docElem.scrollLeft) - (docElem.clientLeft || 0)\r\n };\r\n },\r\n scrollTop(value) {\r\n return scrollTo(this, 'top', value);\r\n },\r\n scrollLeft(value) {\r\n return scrollTo(this, 'left', value);\r\n }\r\n }, (value, key) => {\r\n if (!element.prototype[key]) {\r\n return element.prototype[key] = value;\r\n }\r\n });\r\n }\r\n\r\n}\r\n","const hideClassToken = 'ng-ui-scroll-hide';\r\n\r\nexport default class ElementRoutines {\r\n\r\n static addCSSRules() {\r\n const selector = '.' + hideClassToken;\r\n const rules = 'display: none';\r\n const sheet = document.styleSheets[0];\r\n let index;\r\n try {\r\n index = sheet.cssRules.length;\r\n } catch (err) {\r\n index = 0;\r\n }\r\n if('insertRule' in sheet) {\r\n sheet.insertRule(selector + '{' + rules + '}', index);\r\n }\r\n else if('addRule' in sheet) {\r\n sheet.addRule(selector, rules, index);\r\n }\r\n }\r\n\r\n constructor($injector, $q) {\r\n this.$animate = ($injector.has && $injector.has('$animate')) ? $injector.get('$animate') : null;\r\n this.isAngularVersionLessThen1_3 = angular.version.major === 1 && angular.version.minor < 3;\r\n this.$q = $q;\r\n }\r\n\r\n hideElement(wrapper) {\r\n wrapper.element.addClass(hideClassToken);\r\n }\r\n\r\n showElement(wrapper) {\r\n wrapper.element.removeClass(hideClassToken);\r\n }\r\n\r\n insertElement(newElement, previousElement) {\r\n previousElement.after(newElement);\r\n return [];\r\n }\r\n\r\n removeElement(wrapper) {\r\n wrapper.element.remove();\r\n wrapper.scope.$destroy();\r\n return [];\r\n }\r\n\r\n insertElementAnimated(newElement, previousElement) {\r\n if (!this.$animate) {\r\n return this.insertElement(newElement, previousElement);\r\n }\r\n\r\n if (this.isAngularVersionLessThen1_3) {\r\n const deferred = this.$q.defer();\r\n // no need for parent - previous element is never null\r\n this.$animate.enter(newElement, null, previousElement, () => deferred.resolve());\r\n\r\n return [deferred.promise];\r\n }\r\n\r\n // no need for parent - previous element is never null\r\n return [this.$animate.enter(newElement, null, previousElement)];\r\n }\r\n\r\n removeElementAnimated(wrapper) {\r\n if (!this.$animate) {\r\n return this.removeElement(wrapper);\r\n }\r\n\r\n if (this.isAngularVersionLessThen1_3) {\r\n const deferred = this.$q.defer();\r\n this.$animate.leave(wrapper.element, () => {\r\n wrapper.scope.$destroy();\r\n return deferred.resolve();\r\n });\r\n\r\n return [deferred.promise];\r\n }\r\n\r\n return [(this.$animate.leave(wrapper.element)).then(() => wrapper.scope.$destroy())];\r\n }\r\n}","export const OPERATIONS = {\r\n PREPEND: 'prepend',\r\n APPEND: 'append',\r\n INSERT: 'insert',\r\n REMOVE: 'remove',\r\n NONE: 'none'\r\n};\r\n","import { OPERATIONS } from './utils';\r\n\r\nexport default function ScrollBuffer(elementRoutines, bufferSize, startIndex) {\r\n const buffer = Object.create(Array.prototype);\r\n\r\n angular.extend(buffer, {\r\n size: bufferSize,\r\n\r\n reset(startIndex) {\r\n buffer.remove(0, buffer.length);\r\n buffer.eof = false;\r\n buffer.bof = false;\r\n buffer.first = startIndex;\r\n buffer.next = startIndex;\r\n buffer.minIndex = startIndex;\r\n buffer.maxIndex = startIndex;\r\n buffer.minIndexUser = null;\r\n buffer.maxIndexUser = null;\r\n },\r\n\r\n append(items) {\r\n items.forEach((item) => {\r\n ++buffer.next;\r\n buffer.insert(OPERATIONS.APPEND, item);\r\n });\r\n buffer.maxIndex = buffer.eof ? buffer.next - 1 : Math.max(buffer.next - 1, buffer.maxIndex);\r\n },\r\n\r\n prepend(items, immutableTop) {\r\n items.reverse().forEach((item) => {\r\n if (immutableTop) {\r\n ++buffer.next;\r\n }\r\n else {\r\n --buffer.first;\r\n }\r\n buffer.insert(OPERATIONS.PREPEND, item);\r\n });\r\n buffer.minIndex = buffer.bof ? buffer.minIndex = buffer.first : Math.min(buffer.first, buffer.minIndex);\r\n },\r\n\r\n /**\r\n * inserts wrapped element in the buffer\r\n * the first argument is either operation keyword (see below) or a number for operation 'insert'\r\n * for insert the number is the index for the buffer element the new one have to be inserted after\r\n * operations: 'append', 'prepend', 'insert', 'remove', 'none'\r\n */\r\n insert(operation, item, shiftTop) {\r\n const wrapper = {\r\n item: item\r\n };\r\n\r\n if (operation % 1 === 0) { // it is an insert\r\n wrapper.op = OPERATIONS.INSERT;\r\n buffer.splice(operation, 0, wrapper);\r\n if (shiftTop) {\r\n buffer.first--;\r\n }\r\n else {\r\n buffer.next++;\r\n }\r\n } else {\r\n wrapper.op = operation;\r\n switch (operation) {\r\n case OPERATIONS.APPEND:\r\n buffer.push(wrapper);\r\n break;\r\n case OPERATIONS.PREPEND:\r\n buffer.unshift(wrapper);\r\n break;\r\n }\r\n }\r\n },\r\n\r\n // removes elements from buffer\r\n remove(arg1, arg2) {\r\n if (angular.isNumber(arg1)) {\r\n // removes items from arg1 (including) through arg2 (excluding)\r\n for (let i = arg1; i < arg2; i++) {\r\n elementRoutines.removeElement(buffer[i]);\r\n }\r\n return buffer.splice(arg1, arg2 - arg1);\r\n }\r\n // removes single item (wrapper) from the buffer\r\n buffer.splice(buffer.indexOf(arg1), 1);\r\n if (arg1.shiftTop && buffer.first === this.getAbsMinIndex()) {\r\n this.incrementMinIndex();\r\n }\r\n else {\r\n this.decrementMaxIndex();\r\n }\r\n if (arg1.shiftTop) {\r\n buffer.first++;\r\n }\r\n else {\r\n buffer.next--;\r\n }\r\n if (!buffer.length) {\r\n buffer.minIndex = Math.min(buffer.maxIndex, buffer.minIndex);\r\n }\r\n\r\n return elementRoutines.removeElementAnimated(arg1);\r\n },\r\n\r\n incrementMinIndex() {\r\n if (buffer.minIndexUser !== null) {\r\n if (buffer.minIndex > buffer.minIndexUser) {\r\n buffer.minIndexUser++;\r\n return;\r\n }\r\n if (buffer.minIndex === buffer.minIndexUser) {\r\n buffer.minIndexUser++;\r\n }\r\n }\r\n buffer.minIndex++;\r\n },\r\n\r\n decrementMaxIndex() {\r\n if (buffer.maxIndexUser !== null && buffer.maxIndex <= buffer.maxIndexUser) {\r\n buffer.maxIndexUser--;\r\n }\r\n buffer.maxIndex--;\r\n },\r\n\r\n getAbsMinIndex() {\r\n if (buffer.minIndexUser !== null) {\r\n return Math.min(buffer.minIndexUser, buffer.minIndex);\r\n }\r\n return buffer.minIndex;\r\n },\r\n\r\n getAbsMaxIndex() {\r\n if (buffer.maxIndexUser !== null) {\r\n return Math.max(buffer.maxIndexUser, buffer.maxIndex);\r\n }\r\n return buffer.maxIndex;\r\n },\r\n\r\n effectiveHeight(elements) {\r\n if (!elements.length) {\r\n return 0;\r\n }\r\n let top = Number.MAX_VALUE;\r\n let bottom = Number.NEGATIVE_INFINITY;\r\n elements.forEach((wrapper) => {\r\n if (wrapper.element[0].offsetParent) {\r\n // element style is not display:none\r\n top = Math.min(top, wrapper.element.offset().top);\r\n bottom = Math.max(bottom, wrapper.element.offset().top + wrapper.element.outerHeight(true));\r\n }\r\n });\r\n return Math.max(0, bottom - top);\r\n },\r\n\r\n getItems() {\r\n return buffer.filter(item => item.op === OPERATIONS.NONE);\r\n },\r\n\r\n getFirstItem() {\r\n const list = buffer.getItems();\r\n if (!list.length) {\r\n return null;\r\n }\r\n return list[0].item;\r\n },\r\n\r\n getLastItem() {\r\n const list = buffer.getItems();\r\n if (!list.length) {\r\n return null;\r\n }\r\n return list[list.length - 1].item;\r\n }\r\n\r\n });\r\n\r\n buffer.reset(startIndex);\r\n\r\n return buffer;\r\n}\r\n","// Can't just extend the Array, due to Babel does not support built-in classes extending\r\n// This solution was taken from https://stackoverflow.com/questions/46897414/es6-class-extends-array-workaround-for-es5-babel-transpile\r\nclass CacheProto {\r\n add(item) {\r\n for (let i = this.length - 1; i >= 0; i--) {\r\n if (this[i].index === item.scope.$index) {\r\n this[i].height = item.element.outerHeight();\r\n return;\r\n }\r\n }\r\n this.push({\r\n index: item.scope.$index,\r\n height: item.element.outerHeight()\r\n });\r\n this.sort((a, b) => ((a.index < b.index) ? -1 : ((a.index > b.index) ? 1 : 0)));\r\n }\r\n\r\n remove(argument, _shiftTop) {\r\n const index = argument % 1 === 0 ? argument : argument.scope.$index;\r\n const shiftTop = argument % 1 === 0 ? _shiftTop : argument.shiftTop;\r\n for (let i = this.length - 1; i >= 0; i--) {\r\n if (this[i].index === index) {\r\n this.splice(i, 1);\r\n break;\r\n }\r\n }\r\n if (!shiftTop) {\r\n for (let i = this.length - 1; i >= 0; i--) {\r\n if (this[i].index > index) {\r\n this[i].index--;\r\n }\r\n }\r\n }\r\n }\r\n\r\n clear() {\r\n this.length = 0;\r\n }\r\n}\r\n\r\nfunction Cache() {\r\n const instance = [];\r\n instance.push.apply(instance, arguments);\r\n Object.setPrototypeOf(instance, Cache.prototype);\r\n return instance;\r\n}\r\nCache.prototype = Object.create(Array.prototype);\r\nObject.getOwnPropertyNames(CacheProto.prototype).forEach(methodName =>\r\n Cache.prototype[methodName] = CacheProto.prototype[methodName]\r\n);\r\n\r\nfunction generateElement(template) {\r\n if (template.nodeType !== Node.ELEMENT_NODE) {\r\n throw new Error('ui-scroll directive requires an Element node for templating the view');\r\n }\r\n let element;\r\n switch (template.tagName.toLowerCase()) {\r\n case 'dl':\r\n throw new Error(`ui-scroll directive does not support <${template.tagName}> as a repeating tag: ${template.outerHTML}`);\r\n case 'tr':\r\n let table = angular.element('
    ');\r\n element = table.find('tr');\r\n break;\r\n case 'li':\r\n element = angular.element('
  • ');\r\n break;\r\n default:\r\n element = angular.element('
    ');\r\n }\r\n return element;\r\n}\r\n\r\nclass Padding {\r\n constructor(template) {\r\n this.element = generateElement(template);\r\n this.cache = new Cache();\r\n }\r\n\r\n height() {\r\n return this.element.height.apply(this.element, arguments);\r\n }\r\n}\r\n\r\nexport default Padding;","import Padding from './padding';\r\n\r\nexport default function Viewport(elementRoutines, buffer, element, viewportController, $rootScope, padding) {\r\n let topPadding = null;\r\n let bottomPadding = null;\r\n const viewport = viewportController && viewportController.viewport ? viewportController.viewport : angular.element(window);\r\n const container = viewportController && viewportController.container ? viewportController.container : undefined;\r\n const scope = viewportController && viewportController.scope ? viewportController.scope : $rootScope;\r\n\r\n viewport.css({\r\n 'overflow-anchor': 'none',\r\n 'overflow-y': 'auto',\r\n 'display': 'block'\r\n });\r\n\r\n function bufferPadding() {\r\n return viewport.outerHeight() * padding; // some extra space to initiate preload\r\n }\r\n\r\n angular.extend(viewport, {\r\n getScope() {\r\n return scope;\r\n },\r\n\r\n createPaddingElements(template) {\r\n topPadding = new Padding(template);\r\n bottomPadding = new Padding(template);\r\n element.before(topPadding.element);\r\n element.after(bottomPadding.element);\r\n topPadding.height(0);\r\n bottomPadding.height(0);\r\n },\r\n\r\n applyContainerStyle() {\r\n if (!container) {\r\n return true;\r\n }\r\n if (container !== viewport) {\r\n viewport.css('height', window.getComputedStyle(container[0]).height);\r\n }\r\n return viewport.height() > 0;\r\n },\r\n\r\n bottomDataPos() {\r\n let scrollHeight = viewport[0].scrollHeight;\r\n scrollHeight = scrollHeight != null ? scrollHeight : viewport[0].document.documentElement.scrollHeight;\r\n return scrollHeight - bottomPadding.height();\r\n },\r\n\r\n topDataPos() {\r\n return topPadding.height();\r\n },\r\n\r\n bottomVisiblePos() {\r\n return viewport.scrollTop() + viewport.outerHeight();\r\n },\r\n\r\n topVisiblePos() {\r\n return viewport.scrollTop();\r\n },\r\n\r\n insertElement(e, sibling) {\r\n return elementRoutines.insertElement(e, sibling || topPadding.element);\r\n },\r\n\r\n insertElementAnimated(e, sibling) {\r\n return elementRoutines.insertElementAnimated(e, sibling || topPadding.element);\r\n },\r\n\r\n shouldLoadBottom() {\r\n return !buffer.eof && viewport.bottomDataPos() < viewport.bottomVisiblePos() + bufferPadding();\r\n },\r\n\r\n clipBottom() {\r\n // clip the invisible items off the bottom\r\n let overage = 0;\r\n let overageHeight = 0;\r\n let itemHeight = 0;\r\n let emptySpaceHeight = viewport.bottomDataPos() - viewport.bottomVisiblePos() - bufferPadding();\r\n\r\n for (let i = buffer.length - 1; i >= 0; i--) {\r\n itemHeight = buffer[i].element.outerHeight(true);\r\n if (overageHeight + itemHeight > emptySpaceHeight) {\r\n break;\r\n }\r\n bottomPadding.cache.add(buffer[i]);\r\n overageHeight += itemHeight;\r\n overage++;\r\n }\r\n\r\n if (overage > 0) {\r\n buffer.eof = false;\r\n buffer.remove(buffer.length - overage, buffer.length);\r\n buffer.next -= overage;\r\n viewport.adjustPaddings();\r\n }\r\n },\r\n\r\n shouldLoadTop() {\r\n return !buffer.bof && (viewport.topDataPos() > viewport.topVisiblePos() - bufferPadding());\r\n },\r\n\r\n clipTop() {\r\n // clip the invisible items off the top\r\n let overage = 0;\r\n let overageHeight = 0;\r\n let itemHeight = 0;\r\n let emptySpaceHeight = viewport.topVisiblePos() - viewport.topDataPos() - bufferPadding();\r\n\r\n for (let i = 0; i < buffer.length; i++) {\r\n itemHeight = buffer[i].element.outerHeight(true);\r\n if (overageHeight + itemHeight > emptySpaceHeight) {\r\n break;\r\n }\r\n topPadding.cache.add(buffer[i]);\r\n overageHeight += itemHeight;\r\n overage++;\r\n }\r\n\r\n if (overage > 0) {\r\n // we need to adjust top padding element before items are removed from top\r\n // to avoid strange behaviour of scroll bar during remove top items when we are at the very bottom\r\n topPadding.height(topPadding.height() + overageHeight);\r\n buffer.bof = false;\r\n buffer.remove(0, overage);\r\n buffer.first += overage;\r\n }\r\n },\r\n\r\n adjustPaddings() {\r\n if (!buffer.length) {\r\n return;\r\n }\r\n\r\n // precise heights calculation based on items that are in buffer or that were in buffer once\r\n const visibleItemsHeight = buffer.reduce((summ, item) => summ + item.element.outerHeight(true), 0);\r\n\r\n let topPaddingHeight = 0, topCount = 0;\r\n topPadding.cache.forEach(item => {\r\n if (item.index < buffer.first) {\r\n topPaddingHeight += item.height;\r\n topCount++;\r\n }\r\n });\r\n\r\n let bottomPaddingHeight = 0, bottomCount = 0;\r\n bottomPadding.cache.forEach(item => {\r\n if (item.index >= buffer.next) {\r\n bottomPaddingHeight += item.height;\r\n bottomCount++;\r\n }\r\n });\r\n\r\n const totalHeight = visibleItemsHeight + topPaddingHeight + bottomPaddingHeight;\r\n const averageItemHeight = totalHeight / (topCount + bottomCount + buffer.length);\r\n\r\n // average heights calculation, items that have never been reached\r\n let adjustTopPadding = buffer.minIndexUser !== null && buffer.minIndex > buffer.minIndexUser;\r\n let adjustBottomPadding = buffer.maxIndexUser !== null && buffer.maxIndex < buffer.maxIndexUser;\r\n let topPaddingHeightAdd = adjustTopPadding ? (buffer.minIndex - buffer.minIndexUser) * averageItemHeight : 0;\r\n let bottomPaddingHeightAdd = adjustBottomPadding ? (buffer.maxIndexUser - buffer.maxIndex) * averageItemHeight : 0;\r\n\r\n // paddings combine adjustment\r\n topPadding.height(topPaddingHeight + topPaddingHeightAdd);\r\n bottomPadding.height(bottomPaddingHeight + bottomPaddingHeightAdd);\r\n },\r\n\r\n onAfterMinIndexSet(topPaddingHeightOld) {\r\n // additional scrollTop adjustment in case of datasource.minIndex external set\r\n if (buffer.minIndexUser !== null && buffer.minIndex > buffer.minIndexUser) {\r\n let diff = topPadding.height() - topPaddingHeightOld;\r\n viewport.scrollTop(viewport.scrollTop() + diff);\r\n while((diff -= viewport.scrollTop()) > 0) {\r\n bottomPadding.height(bottomPadding.height() + diff);\r\n viewport.scrollTop(viewport.scrollTop() + diff);\r\n }\r\n }\r\n },\r\n\r\n onAfterPrepend(updates) {\r\n if (!updates.prepended.length) {\r\n return;\r\n }\r\n const height = buffer.effectiveHeight(updates.prepended);\r\n const paddingHeight = topPadding.height() - height;\r\n if (paddingHeight >= 0) {\r\n topPadding.height(paddingHeight);\r\n return;\r\n }\r\n const position = viewport.scrollTop();\r\n const newPosition = position - paddingHeight;\r\n viewport.synthetic = { previous: position, next: newPosition };\r\n topPadding.height(0);\r\n viewport.scrollTop(newPosition);\r\n },\r\n\r\n resetTopPadding() {\r\n topPadding.height(0);\r\n topPadding.cache.clear();\r\n },\r\n\r\n resetBottomPadding() {\r\n bottomPadding.height(0);\r\n bottomPadding.cache.clear();\r\n },\r\n\r\n removeCacheItem(item, shiftTop) {\r\n topPadding.cache.remove(item, shiftTop);\r\n bottomPadding.cache.remove(item, shiftTop);\r\n },\r\n\r\n removeItem(item) {\r\n this.removeCacheItem(item);\r\n return buffer.remove(item);\r\n }\r\n });\r\n\r\n return viewport;\r\n}\r\n","import { OPERATIONS } from './utils';\r\n\r\nclass Adapter {\r\n\r\n constructor($scope, $parse, $attr, viewport, buffer, doAdjust, reload) {\r\n this.$parse = $parse;\r\n this.$attr = $attr;\r\n this.viewport = viewport;\r\n this.buffer = buffer;\r\n\r\n this.doAdjust = doAdjust;\r\n this.reload = reload;\r\n\r\n this.isLoading = false;\r\n this.disabled = false;\r\n\r\n const viewportScope = viewport.getScope();\r\n this.startScope = viewportScope.$parent ? viewportScope : $scope;\r\n\r\n this.publicContext = {};\r\n this.assignAdapter($attr.adapter);\r\n this.generatePublicContext();\r\n }\r\n\r\n assignAdapter(adapterAttr) {\r\n if (!adapterAttr || !(adapterAttr = adapterAttr.replace(/^\\s+|\\s+$/gm, ''))) {\r\n return;\r\n }\r\n let adapterOnScope;\r\n\r\n try {\r\n this.$parse(adapterAttr).assign(this.startScope, {});\r\n adapterOnScope = this.$parse(adapterAttr)(this.startScope);\r\n }\r\n catch (error) {\r\n error.message = `Angular ui-scroll Adapter assignment exception.\\n` +\r\n `Can't parse \"${adapterAttr}\" expression.\\n` +\r\n error.message;\r\n throw error;\r\n }\r\n\r\n angular.extend(adapterOnScope, this.publicContext);\r\n this.publicContext = adapterOnScope;\r\n }\r\n\r\n generatePublicContext() {\r\n // these methods will be accessible out of ui-scroll via user defined adapter\r\n const publicMethods = ['reload', 'applyUpdates', 'append', 'prepend', 'isBOF', 'isEOF', 'isEmpty'];\r\n for (let i = publicMethods.length - 1; i >= 0; i--) {\r\n this.publicContext[publicMethods[i]] = this[publicMethods[i]].bind(this);\r\n }\r\n\r\n // these read-only props will be accessible out of ui-scroll via user defined adapter\r\n const publicProps = ['isLoading', 'topVisible', 'topVisibleElement', 'topVisibleScope', 'bottomVisible', 'bottomVisibleElement', 'bottomVisibleScope'];\r\n for (let i = publicProps.length - 1; i >= 0; i--) {\r\n let property, attr = this.$attr[publicProps[i]];\r\n Object.defineProperty(this, publicProps[i], {\r\n get: () => property,\r\n set: (value) => {\r\n property = value;\r\n this.publicContext[publicProps[i]] = value;\r\n if (attr) {\r\n this.$parse(attr).assign(this.startScope, value);\r\n }\r\n }\r\n });\r\n }\r\n\r\n // read-only immediately calculated public properties\r\n const publicPropsImmediate = ['bufferFirst', 'bufferLast', 'bufferLength'];\r\n for (let i = publicPropsImmediate.length - 1; i >= 0; i--) {\r\n Object.defineProperty(this.publicContext, publicPropsImmediate[i], {\r\n get: () => this[publicPropsImmediate[i]]\r\n });\r\n }\r\n\r\n // non-read-only public property\r\n Object.defineProperty(this.publicContext, 'disabled', {\r\n get: () => this.disabled,\r\n set: (value) => (!(this.disabled = value)) ? this.doAdjust() : null\r\n });\r\n }\r\n\r\n loading(value) {\r\n this.isLoading = value;\r\n }\r\n\r\n isBOF() {\r\n return this.buffer.bof;\r\n }\r\n\r\n isEOF() {\r\n return this.buffer.eof;\r\n }\r\n\r\n isEmpty() {\r\n return !this.buffer.length;\r\n }\r\n\r\n get bufferLength() {\r\n return this.buffer.getItems().length;\r\n }\r\n\r\n get bufferFirst() {\r\n return this.buffer.getFirstItem();\r\n }\r\n\r\n get bufferLast() {\r\n return this.buffer.getLastItem();\r\n }\r\n\r\n append(newItems) {\r\n this.buffer.append(newItems);\r\n this.doAdjust();\r\n this.viewport.clipTop();\r\n this.viewport.clipBottom();\r\n }\r\n\r\n prepend(newItems, options = {}) {\r\n this.buffer.prepend(newItems, options.immutableTop);\r\n this.doAdjust();\r\n this.viewport.clipTop();\r\n this.viewport.clipBottom();\r\n }\r\n\r\n applyUpdates(arg1, arg2, arg3) {\r\n if (typeof arg1 === 'function') {\r\n this.applyUpdatesFunc(arg1, arg2);\r\n } else {\r\n this.applyUpdatesIndex(arg1, arg2, arg3);\r\n }\r\n this.doAdjust();\r\n }\r\n\r\n applyUpdatesFunc(cb, options = {}) {\r\n this.buffer.slice(0).forEach((wrapper) => {\r\n // we need to do it on the buffer clone, because buffer content\r\n // may change as we iterate through\r\n this.applyUpdate(wrapper, cb(wrapper.item, wrapper.scope, wrapper.element), options);\r\n });\r\n }\r\n\r\n applyUpdatesIndex(index, newItems, options = {}) {\r\n if (index % 1 !== 0) {\r\n throw new Error('applyUpdates - ' + index + ' is not a valid index (should be an integer)');\r\n }\r\n const _index = index - this.buffer.first;\r\n\r\n // apply updates only within buffer\r\n if (_index >= 0 && _index < this.buffer.length) {\r\n this.applyUpdate(this.buffer[_index], newItems, options);\r\n }\r\n // out-of-buffer case: deletion may affect Paddings\r\n else if(index >= this.buffer.getAbsMinIndex() && index <= this.buffer.getAbsMaxIndex()) {\r\n if(angular.isArray(newItems) && !newItems.length) {\r\n this.viewport.removeCacheItem(index, !options.immutableTop && index === this.buffer.minIndex);\r\n if (!options.immutableTop && index === this.buffer.getAbsMinIndex()) {\r\n this.buffer.incrementMinIndex();\r\n }\r\n else {\r\n this.buffer.decrementMaxIndex();\r\n }\r\n }\r\n }\r\n }\r\n\r\n applyUpdate(wrapper, newItems, options = {}) {\r\n if (!angular.isArray(newItems)) {\r\n return;\r\n }\r\n let position = this.buffer.indexOf(wrapper);\r\n if (!newItems.reverse().some(newItem => newItem === wrapper.item)) {\r\n wrapper.op = OPERATIONS.REMOVE;\r\n // try to catch \"first\" edge case on remove\r\n if (!options.immutableTop && !newItems.length) {\r\n // this is the first item, or the previous one's part of the \"shift-top\" group\r\n if (\r\n (position === 0 && this.buffer.bof) ||\r\n (position !== 0 && this.buffer[position - 1].shiftTop)\r\n ) {\r\n wrapper.shiftTop = true;\r\n }\r\n }\r\n }\r\n newItems.forEach((newItem) => {\r\n if (newItem === wrapper.item) {\r\n position--;\r\n } else {\r\n // 3 parameter (shiftTop) is to catch \"first\" edge case on insert\r\n this.buffer.insert(position + 1, newItem, !options.immutableTop && position === -1);\r\n }\r\n });\r\n }\r\n\r\n calculateProperties() {\r\n let rowTop = null, topHeight = 0;\r\n let topDone = false, bottomDone = false;\r\n const length = this.buffer.length;\r\n\r\n for (let i = 0; i < length; i++) {\r\n const item = this.buffer[i];\r\n const itemTop = item.element.offset().top;\r\n\r\n if (rowTop !== itemTop) { // a new row condition\r\n const itemHeight = item.element.outerHeight(true);\r\n const top = this.viewport.topDataPos() + topHeight + itemHeight;\r\n\r\n if (!topDone && top > this.viewport.topVisiblePos()) {\r\n topDone = true;\r\n this['topVisible'] = item.item;\r\n this['topVisibleElement'] = item.element;\r\n this['topVisibleScope'] = item.scope;\r\n }\r\n if (!bottomDone && (top >= this.viewport.bottomVisiblePos() || (i === length - 1 && this.isEOF()))) {\r\n bottomDone = true;\r\n this['bottomVisible'] = item.item;\r\n this['bottomVisibleElement'] = item.element;\r\n this['bottomVisibleScope'] = item.scope;\r\n }\r\n topHeight += itemHeight;\r\n }\r\n rowTop = itemTop;\r\n\r\n if (topDone && bottomDone) {\r\n break;\r\n }\r\n }\r\n }\r\n\r\n}\r\n\r\nexport default Adapter;\r\n","import JQLiteExtras from './modules/jqLiteExtras';\r\nimport ElementRoutines from './modules/elementRoutines.js';\r\nimport ScrollBuffer from './modules/buffer.js';\r\nimport Viewport from './modules/viewport.js';\r\nimport Adapter from './modules/adapter.js';\r\nimport { OPERATIONS } from './modules/utils';\r\n\r\nangular.module('ui.scroll', [])\r\n\r\n .constant('JQLiteExtras', JQLiteExtras)\r\n .run(['JQLiteExtras', (JQLiteExtras) => {\r\n const elt = angular.element;\r\n !(window.jQuery && elt.fn && elt.fn.jquery) ? (new JQLiteExtras()).registerFor(elt) : null;\r\n ElementRoutines.addCSSRules();\r\n }])\r\n\r\n .directive('uiScrollViewport', function () {\r\n return {\r\n restrict: 'A',\r\n controller: [\r\n '$scope',\r\n '$element',\r\n function (scope, element) {\r\n this.container = element;\r\n this.viewport = element;\r\n this.scope = scope;\r\n\r\n angular.forEach(element.children(), child => {\r\n if (child.tagName.toLowerCase() === 'tbody') {\r\n this.viewport = angular.element(child);\r\n }\r\n });\r\n\r\n return this;\r\n }\r\n ]\r\n };\r\n })\r\n\r\n .directive('uiScroll', [\r\n '$log',\r\n '$injector',\r\n '$rootScope',\r\n '$timeout',\r\n '$interval',\r\n '$q',\r\n '$parse',\r\n function (console, $injector, $rootScope, $timeout, $interval, $q, $parse) {\r\n\r\n return {\r\n require: ['?^uiScrollViewport'],\r\n restrict: 'A',\r\n transclude: 'element',\r\n priority: 1000,\r\n terminal: true,\r\n link: link\r\n };\r\n\r\n function link($scope, element, $attr, controllers, linker) {\r\n const match = $attr.uiScroll.match(/^\\s*(\\w+)\\s+in\\s+([(\\w|\\$)\\.]+)\\s*$/);\r\n if (!match) {\r\n throw new Error('Expected uiScroll in form of \\'_item_ in _datasource_\\' but got \\'' + $attr.uiScroll + '\\'');\r\n }\r\n\r\n function parseNumber(value, defaultValue, isFloat) {\r\n if (!isFloat) {\r\n value = value === null ? defaultValue : Math.floor(value);\r\n }\r\n return isNaN(value) ? defaultValue : value;\r\n }\r\n\r\n function parseNumericAttr(value, defaultValue, isFloat) {\r\n const result = $parse(value)($scope);\r\n return parseNumber(result, defaultValue, isFloat);\r\n }\r\n\r\n function parseBooleanAttr(value, defaultValue) {\r\n const result = $parse(value)($scope);\r\n return typeof result === 'boolean' ? result : defaultValue;\r\n }\r\n\r\n const BUFFER_MIN = 3;\r\n const BUFFER_DEFAULT = 10;\r\n const PADDING_MIN = 0.3;\r\n const PADDING_DEFAULT = 0.5;\r\n const HANDLE_INERTIA_DEFAULT = true;\r\n const START_INDEX_DEFAULT = 1;\r\n const MAX_VIEWPORT_DELAY = 500;\r\n const VIEWPORT_POLLING_INTERVAL = 50;\r\n\r\n let datasource = null;\r\n const itemName = match[1];\r\n const datasourceName = match[2];\r\n const viewportController = controllers[0];\r\n const bufferSize = Math.max(BUFFER_MIN, parseNumericAttr($attr.bufferSize, BUFFER_DEFAULT));\r\n const padding = Math.max(PADDING_MIN, parseNumericAttr($attr.padding, PADDING_DEFAULT, true));\r\n const handleInertia = parseBooleanAttr($attr.handleInertia, HANDLE_INERTIA_DEFAULT);\r\n let startIndex = parseNumericAttr($attr.startIndex, START_INDEX_DEFAULT);\r\n let ridActual = 0; // current data revision id\r\n let pending = [];\r\n\r\n const elementRoutines = new ElementRoutines($injector, $q);\r\n const buffer = new ScrollBuffer(elementRoutines, bufferSize, startIndex);\r\n const viewport = new Viewport(elementRoutines, buffer, element, viewportController, $rootScope, padding);\r\n const adapter = new Adapter($scope, $parse, $attr, viewport, buffer, doAdjust, reload);\r\n\r\n if (viewportController) {\r\n viewportController.adapter = adapter;\r\n }\r\n\r\n const isDatasourceValid = () =>\r\n Object.prototype.toString.call(datasource) === '[object Object]' && typeof datasource.get === 'function';\r\n\r\n datasource = $parse(datasourceName)($scope); // try to get datasource on scope\r\n if (!isDatasourceValid()) {\r\n datasource = $injector.get(datasourceName); // try to inject datasource as service\r\n if (!isDatasourceValid()) {\r\n throw new Error(datasourceName + ' is not a valid datasource');\r\n }\r\n }\r\n\r\n let onRenderHandlers = [];\r\n function onRenderHandlersRunner() {\r\n onRenderHandlers.forEach(handler => handler.run());\r\n onRenderHandlers = [];\r\n }\r\n function persistDatasourceIndex(datasource, propName) {\r\n let getter;\r\n // need to postpone min/maxIndexUser processing if the view is empty\r\n if(angular.isNumber(datasource[propName])) {\r\n getter = datasource[propName];\r\n if(angular.isNumber(getter)) {\r\n onRenderHandlers = onRenderHandlers.filter(handler => handler.id !== propName);\r\n onRenderHandlers.push({\r\n id: propName,\r\n run: () => datasource[propName] = getter\r\n });\r\n }\r\n }\r\n }\r\n\r\n function defineDatasourceIndex(datasource, propName, propUserName) {\r\n const descriptor = Object.getOwnPropertyDescriptor(datasource, propName);\r\n if (descriptor && (descriptor.set || descriptor.get)) {\r\n return;\r\n }\r\n let getter;\r\n persistDatasourceIndex(datasource, propName);\r\n Object.defineProperty(datasource, propName, {\r\n set: (value) => {\r\n getter = value;\r\n if(pending.length && !buffer.length) {\r\n persistDatasourceIndex(datasource, propName);\r\n return;\r\n }\r\n buffer[propUserName] = value;\r\n const topPaddingHeightOld = viewport.topDataPos();\r\n viewport.adjustPaddings();\r\n if (propName === 'minIndex') {\r\n viewport.onAfterMinIndexSet(topPaddingHeightOld);\r\n }\r\n },\r\n get: () => getter\r\n });\r\n }\r\n\r\n defineDatasourceIndex(datasource, 'minIndex', 'minIndexUser');\r\n defineDatasourceIndex(datasource, 'maxIndex', 'maxIndexUser');\r\n\r\n const fetchNext = (datasource.get.length !== 2) ?\r\n (success) => datasource.get(buffer.next, bufferSize, success) :\r\n (success) => {\r\n datasource.get({\r\n index: buffer.next,\r\n append: buffer.length ? buffer[buffer.length - 1].item : void 0,\r\n count: bufferSize\r\n }, success);\r\n };\r\n\r\n const fetchPrevious = (datasource.get.length !== 2) ?\r\n (success) => datasource.get(buffer.first - bufferSize, bufferSize, success) :\r\n (success) => {\r\n datasource.get({\r\n index: buffer.first - bufferSize,\r\n prepend: buffer.length ? buffer[0].item : void 0,\r\n count: bufferSize\r\n }, success);\r\n };\r\n\r\n const initialize = () => {\r\n let tryCount = 0;\r\n if(!viewport.applyContainerStyle()) {\r\n const timer = $interval(() => {\r\n tryCount++;\r\n if(viewport.applyContainerStyle()) {\r\n $interval.cancel(timer);\r\n doAdjust();\r\n }\r\n if(tryCount * VIEWPORT_POLLING_INTERVAL >= MAX_VIEWPORT_DELAY) {\r\n $interval.cancel(timer);\r\n throw Error(`ui-scroll directive requires a viewport with non-zero height in ${MAX_VIEWPORT_DELAY}ms`);\r\n }\r\n }, VIEWPORT_POLLING_INTERVAL);\r\n }\r\n else {\r\n doAdjust();\r\n }\r\n };\r\n\r\n /**\r\n * Build padding elements\r\n *\r\n * Calling linker is the only way I found to get access to the tag name of the template\r\n * to prevent the directive scope from pollution a new scope is created and destroyed\r\n * right after the builder creation is completed\r\n */\r\n linker((clone, scope) => {\r\n viewport.createPaddingElements(clone[0]);\r\n // we do not include the clone in the DOM. It means that the nested directives will not\r\n // be able to reach the parent directives, but in this case it is intentional because we\r\n // created the clone to access the template tag name\r\n scope.$destroy();\r\n clone.remove();\r\n });\r\n\r\n $scope.$on('$destroy', () => {\r\n unbindEvents();\r\n viewport.off('mousewheel', wheelHandler);\r\n });\r\n\r\n viewport.on('mousewheel', wheelHandler);\r\n\r\n initialize();\r\n\r\n /* Private function definitions */\r\n\r\n function isInvalid(rid) {\r\n return (rid && rid !== ridActual) || $scope.$$destroyed;\r\n }\r\n\r\n function bindEvents() {\r\n viewport.on('resize', resizeAndScrollHandler);\r\n viewport.on('scroll', resizeAndScrollHandler);\r\n }\r\n\r\n function unbindEvents() {\r\n viewport.off('resize', resizeAndScrollHandler);\r\n viewport.off('scroll', resizeAndScrollHandler);\r\n }\r\n\r\n function reload() {\r\n unbindEvents();\r\n viewport.resetTopPadding();\r\n viewport.resetBottomPadding();\r\n if (arguments.length) {\r\n startIndex = parseNumber(arguments[0], START_INDEX_DEFAULT, false);\r\n }\r\n buffer.reset(startIndex);\r\n persistDatasourceIndex(datasource, 'minIndex');\r\n persistDatasourceIndex(datasource, 'maxIndex');\r\n doAdjust();\r\n }\r\n\r\n function isElementVisible(wrapper) {\r\n return wrapper.element.height() && wrapper.element[0].offsetParent;\r\n }\r\n\r\n function visibilityWatcher(wrapper) {\r\n if (isElementVisible(wrapper)) {\r\n buffer.forEach((item) => {\r\n if (typeof item.unregisterVisibilityWatcher === 'function') {\r\n item.unregisterVisibilityWatcher();\r\n delete item.unregisterVisibilityWatcher;\r\n }\r\n });\r\n if (!pending.length) {\r\n $timeout(() => doAdjust());\r\n }\r\n }\r\n }\r\n\r\n function insertWrapperContent(wrapper, insertAfter) {\r\n createElement(wrapper, insertAfter, viewport.insertElement);\r\n if (!isElementVisible(wrapper)) {\r\n wrapper.unregisterVisibilityWatcher = wrapper.scope.$watch(() => visibilityWatcher(wrapper));\r\n }\r\n elementRoutines.hideElement(wrapper); // hide inserted elements before data binding\r\n }\r\n\r\n function createElement(wrapper, insertAfter, insertElement) {\r\n let promises = null;\r\n const sibling = (insertAfter > 0) ? buffer[insertAfter - 1].element : undefined;\r\n linker((clone, scope) => {\r\n promises = insertElement(clone, sibling);\r\n wrapper.element = clone;\r\n wrapper.scope = scope;\r\n scope[itemName] = wrapper.item;\r\n });\r\n // ui-scroll-grid apply\r\n if (adapter.transform) {\r\n const tdInitializer = wrapper.scope.uiScrollTdInitializer;\r\n if (tdInitializer && tdInitializer.linking) {\r\n adapter.transform(wrapper.scope, wrapper.element);\r\n } else {\r\n wrapper.scope.uiScrollTdInitializer = {\r\n onLink: () => adapter.transform(wrapper.scope, wrapper.element),\r\n scope: wrapper.scope\r\n };\r\n }\r\n }\r\n return promises;\r\n }\r\n\r\n function updateDOM() {\r\n let promises = [];\r\n const toBePrepended = [];\r\n const toBeRemoved = [];\r\n const inserted = [];\r\n\r\n buffer.forEach((wrapper, i) => {\r\n switch (wrapper.op) {\r\n case OPERATIONS.PREPEND:\r\n toBePrepended.unshift(wrapper);\r\n break;\r\n case OPERATIONS.APPEND:\r\n insertWrapperContent(wrapper, i);\r\n wrapper.op = OPERATIONS.NONE;\r\n inserted.push(wrapper);\r\n break;\r\n case OPERATIONS.INSERT:\r\n promises = promises.concat(createElement(wrapper, i, viewport.insertElementAnimated));\r\n wrapper.op = OPERATIONS.NONE;\r\n inserted.push(wrapper);\r\n break;\r\n case OPERATIONS.REMOVE:\r\n toBeRemoved.push(wrapper);\r\n }\r\n });\r\n\r\n toBeRemoved.forEach((wrapper) => promises = promises.concat(viewport.removeItem(wrapper)));\r\n\r\n if (toBePrepended.length)\r\n toBePrepended.forEach((wrapper) => {\r\n insertWrapperContent(wrapper);\r\n wrapper.op = OPERATIONS.NONE;\r\n });\r\n\r\n buffer.forEach((item, i) => item.scope.$index = buffer.first + i);\r\n\r\n return {\r\n prepended: toBePrepended,\r\n removed: toBeRemoved,\r\n inserted: inserted,\r\n animated: promises\r\n };\r\n\r\n }\r\n\r\n function updatePaddings(rid, updates) {\r\n // schedule another doAdjust after animation completion\r\n if (updates.animated.length) {\r\n $q.all(updates.animated).then(() => {\r\n viewport.adjustPaddings();\r\n doAdjust(rid);\r\n });\r\n } else {\r\n viewport.adjustPaddings();\r\n }\r\n }\r\n\r\n function enqueueFetch(rid, updates) {\r\n if (viewport.shouldLoadBottom()) {\r\n if (!updates || buffer.effectiveHeight(updates.inserted) > 0) {\r\n // this means that at least one item appended in the last batch has height > 0\r\n if (pending.push(true) === 1) {\r\n adapter.loading(true);\r\n fetch(rid);\r\n }\r\n }\r\n } else if (viewport.shouldLoadTop()) {\r\n if ((!updates || buffer.effectiveHeight(updates.prepended) > 0) || pending[0]) {\r\n // this means that at least one item appended in the last batch has height > 0\r\n // pending[0] = true means that previous fetch was appending. We need to force at least one prepend\r\n // BTW there will always be at least 1 element in the pending array because bottom is fetched first\r\n if (pending.push(false) === 1) {\r\n adapter.loading(true);\r\n fetch(rid);\r\n }\r\n }\r\n }\r\n }\r\n\r\n function processUpdates() {\r\n const updates = updateDOM();\r\n\r\n // We need the item bindings to be processed before we can do adjustments\r\n !$scope.$$phase && !$rootScope.$$phase && $scope.$digest();\r\n\r\n updates.inserted.forEach(w => elementRoutines.showElement(w));\r\n updates.prepended.forEach(w => elementRoutines.showElement(w));\r\n return updates;\r\n }\r\n\r\n function doAdjust(rid) {\r\n if (!rid) { // dismiss pending requests\r\n pending = [];\r\n rid = ++ridActual;\r\n }\r\n\r\n const updates = processUpdates();\r\n\r\n if (isInvalid(rid)) {\r\n return;\r\n }\r\n\r\n updatePaddings(rid, updates);\r\n enqueueFetch(rid);\r\n\r\n if (!pending.length) {\r\n adapter.calculateProperties();\r\n }\r\n }\r\n\r\n function doAdjustAfterFetch(rid) {\r\n const updates = processUpdates();\r\n\r\n viewport.onAfterPrepend(updates);\r\n\r\n if (isInvalid(rid)) {\r\n return;\r\n }\r\n\r\n updatePaddings(rid, updates);\r\n onRenderHandlersRunner();\r\n enqueueFetch(rid, updates);\r\n pending.shift();\r\n\r\n if (pending.length)\r\n fetch(rid);\r\n else {\r\n adapter.loading(false);\r\n bindEvents();\r\n adapter.calculateProperties();\r\n }\r\n }\r\n\r\n function fetch(rid) {\r\n if (pending[0]) {// scrolling down\r\n if (buffer.length && !viewport.shouldLoadBottom()) {\r\n doAdjustAfterFetch(rid);\r\n } else {\r\n fetchNext((result) => {\r\n if (isInvalid(rid)) {\r\n return;\r\n }\r\n\r\n if (result.length < bufferSize) {\r\n buffer.eof = true;\r\n }\r\n\r\n if (result.length > 0) {\r\n viewport.clipTop();\r\n buffer.append(result);\r\n }\r\n\r\n doAdjustAfterFetch(rid);\r\n });\r\n }\r\n } else { // scrolling up\r\n if (buffer.length && !viewport.shouldLoadTop()) {\r\n doAdjustAfterFetch(rid);\r\n } else {\r\n fetchPrevious((result) => {\r\n if (isInvalid(rid)) {\r\n return;\r\n }\r\n\r\n if (result.length < bufferSize) {\r\n buffer.bof = true;\r\n // log 'bof is reached'\r\n }\r\n\r\n if (result.length > 0) {\r\n if (buffer.length) {\r\n viewport.clipBottom();\r\n }\r\n buffer.prepend(result);\r\n }\r\n\r\n doAdjustAfterFetch(rid);\r\n });\r\n }\r\n }\r\n }\r\n\r\n function fixInertia() {\r\n if (!viewport.synthetic) {\r\n return;\r\n }\r\n const oldPosition = viewport.synthetic.previous;\r\n const newPosition = viewport.synthetic.next;\r\n if (viewport.scrollTop() !== newPosition) {\r\n requestAnimationFrame(() => {\r\n const position = viewport.scrollTop();\r\n const diff = oldPosition - position;\r\n if (diff > 0) { // inertia over synthetic\r\n viewport.scrollTop(newPosition - diff);\r\n } else {\r\n viewport.scrollTop(newPosition);\r\n }\r\n viewport.synthetic = null;\r\n });\r\n return true;\r\n }\r\n viewport.synthetic = null;\r\n }\r\n\r\n function resizeAndScrollHandler() {\r\n if (handleInertia && fixInertia()) {\r\n return;\r\n }\r\n if (!$rootScope.$$phase && !adapter.isLoading && !adapter.disabled) {\r\n\r\n enqueueFetch(ridActual);\r\n\r\n if (pending.length) {\r\n unbindEvents();\r\n } else {\r\n adapter.calculateProperties();\r\n !$scope.$$phase && $scope.$digest();\r\n }\r\n }\r\n }\r\n\r\n function wheelHandler(event) {\r\n if (!adapter.disabled) {\r\n const scrollTop = viewport[0].scrollTop;\r\n const yMax = viewport[0].scrollHeight - viewport[0].clientHeight;\r\n\r\n if ((scrollTop === 0 && !buffer.bof) || (scrollTop === yMax && !buffer.eof)) {\r\n event.preventDefault();\r\n }\r\n }\r\n }\r\n }\r\n\r\n }\r\n ]);\r\n"],"sourceRoot":""} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 488f771..107c1b2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -822,6 +822,49 @@ "to-fast-properties": "^2.0.0" } }, + "@nodelib/fs.scandir": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.3.tgz", + "integrity": "sha512-eGmwYQn3gxo4r7jdQnkrrN6bY478C3P+a/y72IJukF8LjB6ZHeB3c+Ehacj3sYeSmUXGlnA67/PmbM9CVwL7Dw==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "2.0.3", + "run-parallel": "^1.1.9" + } + }, + "@nodelib/fs.stat": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.3.tgz", + "integrity": "sha512-bQBFruR2TAwoevBEd/NWMoAAtNGzTRgdrqnYCc7dhzfoNvqPzLyqlEQnzZ3kVnNrSp25iyxE00/3h2fqGAGArA==", + "dev": true + }, + "@nodelib/fs.walk": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.4.tgz", + "integrity": "sha512-1V9XOY4rDW0rehzbrcqAmHnz8e7SKvX27gh8Gt2WgB0+pdzdiLV83p72kZPU+jvMbS1qU5mauP2iOvO8rhmurQ==", + "dev": true, + "requires": { + "@nodelib/fs.scandir": "2.1.3", + "fastq": "^1.6.0" + } + }, + "@npmcli/move-file": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@npmcli/move-file/-/move-file-1.0.1.tgz", + "integrity": "sha512-Uv6h1sT+0DrblvIrolFtbvM1FgWm+/sy4B3pvLp67Zys+thcukzS5ekn7HsZFGpWP4Q3fYJCljbWQE/XivMRLw==", + "dev": true, + "requires": { + "mkdirp": "^1.0.4" + }, + "dependencies": { + "mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true + } + } + }, "@types/color-name": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", @@ -845,6 +888,12 @@ "@types/node": "*" } }, + "@types/json-schema": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.6.tgz", + "integrity": "sha512-3c+yGKvVP5Y9TYBEibGNR+kLtijnj7mYrXRg+WpFb2X9xm04g/DXYkfg4hmzJQosc9snFNUPkbYIhu+KAm6jJw==", + "dev": true + }, "@types/minimatch": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz", @@ -858,178 +907,177 @@ "dev": true }, "@webassemblyjs/ast": { - "version": "1.8.5", - "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.8.5.tgz", - "integrity": "sha512-aJMfngIZ65+t71C3y2nBBg5FFG0Okt9m0XEgWZ7Ywgn1oMAT8cNwx00Uv1cQyHtidq0Xn94R4TAywO+LCQ+ZAQ==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.9.0.tgz", + "integrity": "sha512-C6wW5L+b7ogSDVqymbkkvuW9kruN//YisMED04xzeBBqjHa2FYnmvOlS6Xj68xWQRgWvI9cIglsjFowH/RJyEA==", "dev": true, "requires": { - "@webassemblyjs/helper-module-context": "1.8.5", - "@webassemblyjs/helper-wasm-bytecode": "1.8.5", - "@webassemblyjs/wast-parser": "1.8.5" + "@webassemblyjs/helper-module-context": "1.9.0", + "@webassemblyjs/helper-wasm-bytecode": "1.9.0", + "@webassemblyjs/wast-parser": "1.9.0" } }, "@webassemblyjs/floating-point-hex-parser": { - "version": "1.8.5", - "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.8.5.tgz", - "integrity": "sha512-9p+79WHru1oqBh9ewP9zW95E3XAo+90oth7S5Re3eQnECGq59ly1Ri5tsIipKGpiStHsUYmY3zMLqtk3gTcOtQ==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.9.0.tgz", + "integrity": "sha512-TG5qcFsS8QB4g4MhrxK5TqfdNe7Ey/7YL/xN+36rRjl/BlGE/NcBvJcqsRgCP6Z92mRE+7N50pRIi8SmKUbcQA==", "dev": true }, "@webassemblyjs/helper-api-error": { - "version": "1.8.5", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.8.5.tgz", - "integrity": "sha512-Za/tnzsvnqdaSPOUXHyKJ2XI7PDX64kWtURyGiJJZKVEdFOsdKUCPTNEVFZq3zJ2R0G5wc2PZ5gvdTRFgm81zA==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.9.0.tgz", + "integrity": "sha512-NcMLjoFMXpsASZFxJ5h2HZRcEhDkvnNFOAKneP5RbKRzaWJN36NC4jqQHKwStIhGXu5mUWlUUk7ygdtrO8lbmw==", "dev": true }, "@webassemblyjs/helper-buffer": { - "version": "1.8.5", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.8.5.tgz", - "integrity": "sha512-Ri2R8nOS0U6G49Q86goFIPNgjyl6+oE1abW1pS84BuhP1Qcr5JqMwRFT3Ah3ADDDYGEgGs1iyb1DGX+kAi/c/Q==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.9.0.tgz", + "integrity": "sha512-qZol43oqhq6yBPx7YM3m9Bv7WMV9Eevj6kMi6InKOuZxhw+q9hOkvq5e/PpKSiLfyetpaBnogSbNCfBwyB00CA==", "dev": true }, "@webassemblyjs/helper-code-frame": { - "version": "1.8.5", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-code-frame/-/helper-code-frame-1.8.5.tgz", - "integrity": "sha512-VQAadSubZIhNpH46IR3yWO4kZZjMxN1opDrzePLdVKAZ+DFjkGD/rf4v1jap744uPVU6yjL/smZbRIIJTOUnKQ==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-code-frame/-/helper-code-frame-1.9.0.tgz", + "integrity": "sha512-ERCYdJBkD9Vu4vtjUYe8LZruWuNIToYq/ME22igL+2vj2dQ2OOujIZr3MEFvfEaqKoVqpsFKAGsRdBSBjrIvZA==", "dev": true, "requires": { - "@webassemblyjs/wast-printer": "1.8.5" + "@webassemblyjs/wast-printer": "1.9.0" } }, "@webassemblyjs/helper-fsm": { - "version": "1.8.5", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-fsm/-/helper-fsm-1.8.5.tgz", - "integrity": "sha512-kRuX/saORcg8se/ft6Q2UbRpZwP4y7YrWsLXPbbmtepKr22i8Z4O3V5QE9DbZK908dh5Xya4Un57SDIKwB9eow==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-fsm/-/helper-fsm-1.9.0.tgz", + "integrity": "sha512-OPRowhGbshCb5PxJ8LocpdX9Kl0uB4XsAjl6jH/dWKlk/mzsANvhwbiULsaiqT5GZGT9qinTICdj6PLuM5gslw==", "dev": true }, "@webassemblyjs/helper-module-context": { - "version": "1.8.5", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-module-context/-/helper-module-context-1.8.5.tgz", - "integrity": "sha512-/O1B236mN7UNEU4t9X7Pj38i4VoU8CcMHyy3l2cV/kIF4U5KoHXDVqcDuOs1ltkac90IM4vZdHc52t1x8Yfs3g==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-module-context/-/helper-module-context-1.9.0.tgz", + "integrity": "sha512-MJCW8iGC08tMk2enck1aPW+BE5Cw8/7ph/VGZxwyvGbJwjktKkDK7vy7gAmMDx88D7mhDTCNKAW5tED+gZ0W8g==", "dev": true, "requires": { - "@webassemblyjs/ast": "1.8.5", - "mamacro": "^0.0.3" + "@webassemblyjs/ast": "1.9.0" } }, "@webassemblyjs/helper-wasm-bytecode": { - "version": "1.8.5", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.8.5.tgz", - "integrity": "sha512-Cu4YMYG3Ddl72CbmpjU/wbP6SACcOPVbHN1dI4VJNJVgFwaKf1ppeFJrwydOG3NDHxVGuCfPlLZNyEdIYlQ6QQ==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.9.0.tgz", + "integrity": "sha512-R7FStIzyNcd7xKxCZH5lE0Bqy+hGTwS3LJjuv1ZVxd9O7eHCedSdrId/hMOd20I+v8wDXEn+bjfKDLzTepoaUw==", "dev": true }, "@webassemblyjs/helper-wasm-section": { - "version": "1.8.5", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.8.5.tgz", - "integrity": "sha512-VV083zwR+VTrIWWtgIUpqfvVdK4ff38loRmrdDBgBT8ADXYsEZ5mPQ4Nde90N3UYatHdYoDIFb7oHzMncI02tA==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.9.0.tgz", + "integrity": "sha512-XnMB8l3ek4tvrKUUku+IVaXNHz2YsJyOOmz+MMkZvh8h1uSJpSen6vYnw3IoQ7WwEuAhL8Efjms1ZWjqh2agvw==", "dev": true, "requires": { - "@webassemblyjs/ast": "1.8.5", - "@webassemblyjs/helper-buffer": "1.8.5", - "@webassemblyjs/helper-wasm-bytecode": "1.8.5", - "@webassemblyjs/wasm-gen": "1.8.5" + "@webassemblyjs/ast": "1.9.0", + "@webassemblyjs/helper-buffer": "1.9.0", + "@webassemblyjs/helper-wasm-bytecode": "1.9.0", + "@webassemblyjs/wasm-gen": "1.9.0" } }, "@webassemblyjs/ieee754": { - "version": "1.8.5", - "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.8.5.tgz", - "integrity": "sha512-aaCvQYrvKbY/n6wKHb/ylAJr27GglahUO89CcGXMItrOBqRarUMxWLJgxm9PJNuKULwN5n1csT9bYoMeZOGF3g==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.9.0.tgz", + "integrity": "sha512-dcX8JuYU/gvymzIHc9DgxTzUUTLexWwt8uCTWP3otys596io0L5aW02Gb1RjYpx2+0Jus1h4ZFqjla7umFniTg==", "dev": true, "requires": { "@xtuc/ieee754": "^1.2.0" } }, "@webassemblyjs/leb128": { - "version": "1.8.5", - "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.8.5.tgz", - "integrity": "sha512-plYUuUwleLIziknvlP8VpTgO4kqNaH57Y3JnNa6DLpu/sGcP6hbVdfdX5aHAV716pQBKrfuU26BJK29qY37J7A==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.9.0.tgz", + "integrity": "sha512-ENVzM5VwV1ojs9jam6vPys97B/S65YQtv/aanqnU7D8aSoHFX8GyhGg0CMfyKNIHBuAVjy3tlzd5QMMINa7wpw==", "dev": true, "requires": { "@xtuc/long": "4.2.2" } }, "@webassemblyjs/utf8": { - "version": "1.8.5", - "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.8.5.tgz", - "integrity": "sha512-U7zgftmQriw37tfD934UNInokz6yTmn29inT2cAetAsaU9YeVCveWEwhKL1Mg4yS7q//NGdzy79nlXh3bT8Kjw==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.9.0.tgz", + "integrity": "sha512-GZbQlWtopBTP0u7cHrEx+73yZKrQoBMpwkGEIqlacljhXCkVM1kMQge/Mf+csMJAjEdSwhOyLAS0AoR3AG5P8w==", "dev": true }, "@webassemblyjs/wasm-edit": { - "version": "1.8.5", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.8.5.tgz", - "integrity": "sha512-A41EMy8MWw5yvqj7MQzkDjU29K7UJq1VrX2vWLzfpRHt3ISftOXqrtojn7nlPsZ9Ijhp5NwuODuycSvfAO/26Q==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.9.0.tgz", + "integrity": "sha512-FgHzBm80uwz5M8WKnMTn6j/sVbqilPdQXTWraSjBwFXSYGirpkSWE2R9Qvz9tNiTKQvoKILpCuTjBKzOIm0nxw==", "dev": true, "requires": { - "@webassemblyjs/ast": "1.8.5", - "@webassemblyjs/helper-buffer": "1.8.5", - "@webassemblyjs/helper-wasm-bytecode": "1.8.5", - "@webassemblyjs/helper-wasm-section": "1.8.5", - "@webassemblyjs/wasm-gen": "1.8.5", - "@webassemblyjs/wasm-opt": "1.8.5", - "@webassemblyjs/wasm-parser": "1.8.5", - "@webassemblyjs/wast-printer": "1.8.5" + "@webassemblyjs/ast": "1.9.0", + "@webassemblyjs/helper-buffer": "1.9.0", + "@webassemblyjs/helper-wasm-bytecode": "1.9.0", + "@webassemblyjs/helper-wasm-section": "1.9.0", + "@webassemblyjs/wasm-gen": "1.9.0", + "@webassemblyjs/wasm-opt": "1.9.0", + "@webassemblyjs/wasm-parser": "1.9.0", + "@webassemblyjs/wast-printer": "1.9.0" } }, "@webassemblyjs/wasm-gen": { - "version": "1.8.5", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.8.5.tgz", - "integrity": "sha512-BCZBT0LURC0CXDzj5FXSc2FPTsxwp3nWcqXQdOZE4U7h7i8FqtFK5Egia6f9raQLpEKT1VL7zr4r3+QX6zArWg==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.9.0.tgz", + "integrity": "sha512-cPE3o44YzOOHvlsb4+E9qSqjc9Qf9Na1OO/BHFy4OI91XDE14MjFN4lTMezzaIWdPqHnsTodGGNP+iRSYfGkjA==", "dev": true, "requires": { - "@webassemblyjs/ast": "1.8.5", - "@webassemblyjs/helper-wasm-bytecode": "1.8.5", - "@webassemblyjs/ieee754": "1.8.5", - "@webassemblyjs/leb128": "1.8.5", - "@webassemblyjs/utf8": "1.8.5" + "@webassemblyjs/ast": "1.9.0", + "@webassemblyjs/helper-wasm-bytecode": "1.9.0", + "@webassemblyjs/ieee754": "1.9.0", + "@webassemblyjs/leb128": "1.9.0", + "@webassemblyjs/utf8": "1.9.0" } }, "@webassemblyjs/wasm-opt": { - "version": "1.8.5", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.8.5.tgz", - "integrity": "sha512-HKo2mO/Uh9A6ojzu7cjslGaHaUU14LdLbGEKqTR7PBKwT6LdPtLLh9fPY33rmr5wcOMrsWDbbdCHq4hQUdd37Q==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.9.0.tgz", + "integrity": "sha512-Qkjgm6Anhm+OMbIL0iokO7meajkzQD71ioelnfPEj6r4eOFuqm4YC3VBPqXjFyyNwowzbMD+hizmprP/Fwkl2A==", "dev": true, "requires": { - "@webassemblyjs/ast": "1.8.5", - "@webassemblyjs/helper-buffer": "1.8.5", - "@webassemblyjs/wasm-gen": "1.8.5", - "@webassemblyjs/wasm-parser": "1.8.5" + "@webassemblyjs/ast": "1.9.0", + "@webassemblyjs/helper-buffer": "1.9.0", + "@webassemblyjs/wasm-gen": "1.9.0", + "@webassemblyjs/wasm-parser": "1.9.0" } }, "@webassemblyjs/wasm-parser": { - "version": "1.8.5", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.8.5.tgz", - "integrity": "sha512-pi0SYE9T6tfcMkthwcgCpL0cM9nRYr6/6fjgDtL6q/ZqKHdMWvxitRi5JcZ7RI4SNJJYnYNaWy5UUrHQy998lw==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.9.0.tgz", + "integrity": "sha512-9+wkMowR2AmdSWQzsPEjFU7njh8HTO5MqO8vjwEHuM+AMHioNqSBONRdr0NQQ3dVQrzp0s8lTcYqzUdb7YgELA==", "dev": true, "requires": { - "@webassemblyjs/ast": "1.8.5", - "@webassemblyjs/helper-api-error": "1.8.5", - "@webassemblyjs/helper-wasm-bytecode": "1.8.5", - "@webassemblyjs/ieee754": "1.8.5", - "@webassemblyjs/leb128": "1.8.5", - "@webassemblyjs/utf8": "1.8.5" + "@webassemblyjs/ast": "1.9.0", + "@webassemblyjs/helper-api-error": "1.9.0", + "@webassemblyjs/helper-wasm-bytecode": "1.9.0", + "@webassemblyjs/ieee754": "1.9.0", + "@webassemblyjs/leb128": "1.9.0", + "@webassemblyjs/utf8": "1.9.0" } }, "@webassemblyjs/wast-parser": { - "version": "1.8.5", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-parser/-/wast-parser-1.8.5.tgz", - "integrity": "sha512-daXC1FyKWHF1i11obK086QRlsMsY4+tIOKgBqI1lxAnkp9xe9YMcgOxm9kLe+ttjs5aWV2KKE1TWJCN57/Btsg==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-parser/-/wast-parser-1.9.0.tgz", + "integrity": "sha512-qsqSAP3QQ3LyZjNC/0jBJ/ToSxfYJ8kYyuiGvtn/8MK89VrNEfwj7BPQzJVHi0jGTRK2dGdJ5PRqhtjzoww+bw==", "dev": true, "requires": { - "@webassemblyjs/ast": "1.8.5", - "@webassemblyjs/floating-point-hex-parser": "1.8.5", - "@webassemblyjs/helper-api-error": "1.8.5", - "@webassemblyjs/helper-code-frame": "1.8.5", - "@webassemblyjs/helper-fsm": "1.8.5", + "@webassemblyjs/ast": "1.9.0", + "@webassemblyjs/floating-point-hex-parser": "1.9.0", + "@webassemblyjs/helper-api-error": "1.9.0", + "@webassemblyjs/helper-code-frame": "1.9.0", + "@webassemblyjs/helper-fsm": "1.9.0", "@xtuc/long": "4.2.2" } }, "@webassemblyjs/wast-printer": { - "version": "1.8.5", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.8.5.tgz", - "integrity": "sha512-w0U0pD4EhlnvRyeJzBqaVSJAo9w/ce7/WPogeXLzGkO6hzhr4GnQIZ4W4uUt5b9ooAaXPtnXlj0gzsXEOUNYMg==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.9.0.tgz", + "integrity": "sha512-2J0nE95rHXHyQ24cWjMKJ1tqB/ds8z/cyeOZxJhcb+rW+SQASVjuznUSmdz5GpVJTzU8JkhYut0D3siFDD6wsA==", "dev": true, "requires": { - "@webassemblyjs/ast": "1.8.5", - "@webassemblyjs/wast-parser": "1.8.5", + "@webassemblyjs/ast": "1.9.0", + "@webassemblyjs/wast-parser": "1.9.0", "@xtuc/long": "4.2.2" } }, @@ -1225,14 +1273,23 @@ "dev": true }, "asn1.js": { - "version": "4.10.1", - "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.10.1.tgz", - "integrity": "sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw==", + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz", + "integrity": "sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==", "dev": true, "requires": { "bn.js": "^4.0.0", "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0" + "minimalistic-assert": "^1.0.0", + "safer-buffer": "^2.1.0" + }, + "dependencies": { + "bn.js": { + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==", + "dev": true + } } }, "assert": { @@ -1513,10 +1570,16 @@ "integrity": "sha512-gaqbzQPqOoamawKg0LGVd7SzLgXS+JH61oWprSLH+P+abTczqJbhTR8CmJ2u9/bUYNmHTGJx/UEmn6doAvvuig==", "dev": true }, + "bluebird": { + "version": "3.7.2", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", + "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==", + "dev": true + }, "bn.js": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", - "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==", + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.1.3.tgz", + "integrity": "sha512-GkTiFpjFtUzU9CbMeJ5iazkCzGL3jrhzerzZIuqLABjbwRaFt33I9tUdSNryIptM+RxDet6OKm2WnLXzW51KsQ==", "dev": true }, "body-parser": { @@ -1683,21 +1746,56 @@ "requires": { "bn.js": "^4.1.0", "randombytes": "^2.0.1" + }, + "dependencies": { + "bn.js": { + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==", + "dev": true + } } }, "browserify-sign": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.0.4.tgz", - "integrity": "sha1-qk62jl17ZYuqa/alfmMMvXqT0pg=", - "dev": true, - "requires": { - "bn.js": "^4.1.1", - "browserify-rsa": "^4.0.0", - "create-hash": "^1.1.0", - "create-hmac": "^1.1.2", - "elliptic": "^6.0.0", - "inherits": "^2.0.1", - "parse-asn1": "^5.0.0" + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.1.tgz", + "integrity": "sha512-/vrA5fguVAKKAVTNJjgSm1tRQDHUU6DbwO9IROu/0WAzC8PKhucDSh18J0RMvVeHAn5puMd+QHC2erPRNf8lmg==", + "dev": true, + "requires": { + "bn.js": "^5.1.1", + "browserify-rsa": "^4.0.1", + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "elliptic": "^6.5.3", + "inherits": "^2.0.4", + "parse-asn1": "^5.1.5", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" + }, + "dependencies": { + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true + } } }, "browserify-zlib": { @@ -1762,9 +1860,9 @@ "dev": true }, "cacache": { - "version": "12.0.3", - "resolved": "https://registry.npmjs.org/cacache/-/cacache-12.0.3.tgz", - "integrity": "sha512-kqdmfXEGFepesTuROHMs3MpFLWrPkSSpRqOw80RCflZXy/khxaArvFrQ7uJxSUduzAufc6G0g1VUCOZXxWavPw==", + "version": "12.0.4", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-12.0.4.tgz", + "integrity": "sha512-a0tMB40oefvuInr4Cwb3GerbL9xTj1D5yg0T5xrjGCGyfvbxseIXX7BAO/u/hIXdafzOI5JC3wDwHyf24buOAQ==", "dev": true, "requires": { "bluebird": "^3.5.5", @@ -1784,12 +1882,6 @@ "y18n": "^4.0.0" }, "dependencies": { - "bluebird": { - "version": "3.7.2", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", - "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==", - "dev": true - }, "glob": { "version": "7.1.6", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", @@ -1888,9 +1980,9 @@ } }, "chownr": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.1.tgz", - "integrity": "sha512-j38EvO5+LHX84jlo6h4UzmOwi0UgW61WRyPtJz4qaadK5eY3BTS5TY/S1Stc3Uk2lIM6TPevAlULiEJwie860g==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", "dev": true }, "chrome-trace-event": { @@ -2217,84 +2309,268 @@ "dev": true }, "copy-webpack-plugin": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-5.1.1.tgz", - "integrity": "sha512-P15M5ZC8dyCjQHWwd4Ia/dm0SgVvZJMYeykVIVYXbGyqO4dWB5oyPHp9i7wjwo5LhtlhKbiBCdS2NvM07Wlybg==", + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-6.1.1.tgz", + "integrity": "sha512-4TlkHFYkrZ3WppLA5XkPmBLI5lnEpFsXvpeqxCf5PzkratZiVklNXsvoQkLhUU43q7ZL3AOXtaHAd9jLNJoU0w==", "dev": true, "requires": { - "cacache": "^12.0.3", - "find-cache-dir": "^2.1.0", - "glob-parent": "^3.1.0", - "globby": "^7.1.1", - "is-glob": "^4.0.1", - "loader-utils": "^1.2.3", - "minimatch": "^3.0.4", + "cacache": "^15.0.5", + "fast-glob": "^3.2.4", + "find-cache-dir": "^3.3.1", + "glob-parent": "^5.1.1", + "globby": "^11.0.1", + "loader-utils": "^2.0.0", "normalize-path": "^3.0.0", - "p-limit": "^2.2.1", - "schema-utils": "^1.0.0", - "serialize-javascript": "^2.1.2", - "webpack-log": "^2.0.0" + "p-limit": "^3.0.2", + "schema-utils": "^2.7.1", + "serialize-javascript": "^5.0.1", + "webpack-sources": "^1.4.3" }, "dependencies": { + "ajv": { + "version": "6.12.5", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.5.tgz", + "integrity": "sha512-lRF8RORchjpKG50/WFf8xmg7sgCLFiYNNnqdKflk63whMQcWR5ngGjiSXkL9bjxy6B2npOK2HSMN49jEBMSkag==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ajv-keywords": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", + "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", + "dev": true + }, + "cacache": { + "version": "15.0.5", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-15.0.5.tgz", + "integrity": "sha512-lloiL22n7sOjEEXdL8NAjTgv9a1u43xICE9/203qonkZUCj5X1UEWIdf2/Y0d6QcCtMzbKQyhrcDbdvlZTs/+A==", + "dev": true, + "requires": { + "@npmcli/move-file": "^1.0.1", + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "glob": "^7.1.4", + "infer-owner": "^1.0.4", + "lru-cache": "^6.0.0", + "minipass": "^3.1.1", + "minipass-collect": "^1.0.2", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.2", + "mkdirp": "^1.0.3", + "p-map": "^4.0.0", + "promise-inflight": "^1.0.1", + "rimraf": "^3.0.2", + "ssri": "^8.0.0", + "tar": "^6.0.2", + "unique-filename": "^1.1.1" + } + }, + "chownr": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", + "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", + "dev": true + }, + "emojis-list": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz", + "integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==", + "dev": true + }, + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, "find-cache-dir": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-2.1.0.tgz", - "integrity": "sha512-Tq6PixE0w/VMFfCgbONnkiQIVol/JJL7nRMi20fqzA4NRs9AfeqMGeRdPi3wIhYkxjeBaWh2rxwapn5Tu3IqOQ==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.1.tgz", + "integrity": "sha512-t2GDMt3oGC/v+BMwzmllWDuJF/xcDtE5j/fCGbqDD7OLuJkj0cfh1YSA5VKPvwMeLFLNDBkwOKZ2X85jGLVftQ==", "dev": true, "requires": { "commondir": "^1.0.1", - "make-dir": "^2.0.0", - "pkg-dir": "^3.0.0" + "make-dir": "^3.0.2", + "pkg-dir": "^4.1.0" } }, - "is-glob": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", - "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", "dev": true, "requires": { - "is-extglob": "^2.1.1" + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-parent": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", + "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, + "json5": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.3.tgz", + "integrity": "sha512-KXPvOm8K9IJKFM0bmdn8QXh7udDh1g/giieX0NLCaMnb4hEiVFqnop2ImTXCc5e0/oHz3LTqmHGtExn5hfMkOA==", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + }, + "loader-utils": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz", + "integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==", + "dev": true, + "requires": { + "big.js": "^5.2.2", + "emojis-list": "^3.0.0", + "json5": "^2.1.2" + } + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" } }, "make-dir": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", - "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", "dev": true, "requires": { - "pify": "^4.0.1", - "semver": "^5.6.0" + "semver": "^6.0.0" } }, + "mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true + }, "p-limit": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.1.tgz", - "integrity": "sha512-85Tk+90UCVWvbDavCLKPOLC9vvY8OwEX/RtKF+/1OADJMVlFfEHOiMTPVyxg7mk/dKa+ipdHm0OUkTvCpMTuwg==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.0.2.tgz", + "integrity": "sha512-iwqZSOoWIW+Ew4kAGUlN16J4M7OB3ysMLSZtnhmqx7njIHFPlxWBX8xo3lVTyFVq6mI/lL9qt2IsN1sHwaxJkg==", "dev": true, "requires": { "p-try": "^2.0.0" } }, - "pify": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", - "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + }, + "dependencies": { + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + } + } + }, + "p-map": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", + "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==", + "dev": true, + "requires": { + "aggregate-error": "^3.0.0" + } + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", "dev": true }, - "serialize-javascript": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-2.1.2.tgz", - "integrity": "sha512-rs9OggEUF0V4jUSecXazOYsLfu7OGK2qIn3c7IPBiffz32XniEp/TX9Xmc9LQfK2nQ2QKHvZ2oygKUGU0lG4jQ==", + "pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "requires": { + "find-up": "^4.0.0" + } + }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "schema-utils": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-2.7.1.tgz", + "integrity": "sha512-SHiNtMOUGWBQJwzISiVYKu82GiV4QYGePp3odlY1tuKO7gPtphAT5R/py0fA6xtbgLL/RvtJZnU9b8s0F1q0Xg==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.5", + "ajv": "^6.12.4", + "ajv-keywords": "^3.5.2" + } + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "dev": true }, - "webpack-log": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/webpack-log/-/webpack-log-2.0.0.tgz", - "integrity": "sha512-cX8G2vR/85UYG59FgkoMamwHUIkSSlV3bBMRsbxVXVUk2j6NleCKjQ/WE9eYg9WY4w25O9w8wKP4rzNZFmUcUg==", + "serialize-javascript": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-5.0.1.tgz", + "integrity": "sha512-SaaNal9imEO737H2c05Og0/8LUXG7EnsZyMa8MzkmuHoELfT6txuj0cMqRj6zfPKnmQ1yasR4PCJc8x+M4JSPA==", + "dev": true, + "requires": { + "randombytes": "^2.1.0" + } + }, + "ssri": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/ssri/-/ssri-8.0.0.tgz", + "integrity": "sha512-aq/pz989nxVYwn16Tsbj1TqFpD5LLrQxHf5zaHuieFV+R0Bbr4y8qUsOA45hXT/N4/9UNXTarBjnjVmjSOVaAA==", "dev": true, "requires": { - "ansi-colors": "^3.0.0", - "uuid": "^3.3.2" + "minipass": "^3.1.1" } } } @@ -2306,13 +2582,21 @@ "dev": true }, "create-ecdh": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.3.tgz", - "integrity": "sha512-GbEHQPMOswGpKXM9kCWVrremUcBmjteUaQ01T9rkKCPDXfUHX0IoP9LpHYo2NPFampa4e+/pFDc3jQdxrxQLaw==", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.4.tgz", + "integrity": "sha512-mf+TCx8wWc9VpuxfP2ht0iSISLZnt0JgWlrOKZiNqyUZWnjIaCIVNQArMHnCZKfEYRg6IM7A+NeJoN8gf/Ws0A==", "dev": true, "requires": { "bn.js": "^4.1.0", - "elliptic": "^6.0.0" + "elliptic": "^6.5.3" + }, + "dependencies": { + "bn.js": { + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==", + "dev": true + } } }, "create-hash": { @@ -2381,9 +2665,9 @@ "dev": true }, "cyclist": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/cyclist/-/cyclist-0.2.2.tgz", - "integrity": "sha1-GzN5LhHpFKL9bW7WRHRkRE5fpkA=", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cyclist/-/cyclist-1.0.1.tgz", + "integrity": "sha1-WW6WmP0MgOEgOMK4LW6xs1tiJNk=", "dev": true }, "date-format": { @@ -2594,15 +2878,31 @@ "bn.js": "^4.1.0", "miller-rabin": "^4.0.0", "randombytes": "^2.0.0" + }, + "dependencies": { + "bn.js": { + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==", + "dev": true + } } }, "dir-glob": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-2.2.2.tgz", - "integrity": "sha512-f9LBi5QWzIW3I6e//uxZoLBlUt9kcp66qo0sSCxL6YZKc75R1c4MFCoe/LaZiBGmgujvQdxc5Bn3QhfyvK5Hsw==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", "dev": true, "requires": { - "path-type": "^3.0.0" + "path-type": "^4.0.0" + }, + "dependencies": { + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true + } } }, "dns-equal": { @@ -2728,6 +3028,14 @@ "inherits": "^2.0.1", "minimalistic-assert": "^1.0.0", "minimalistic-crypto-utils": "^1.0.0" + }, + "dependencies": { + "bn.js": { + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==", + "dev": true + } } }, "emoji-regex": { @@ -2838,9 +3146,9 @@ } }, "enhanced-resolve": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.1.1.tgz", - "integrity": "sha512-98p2zE+rL7/g/DzMHMTF4zZlCgeVdJ7yr6xzEpJRYwFYrGi9ANdn5DnJURg6RpBkyk60XYDnWIv51VfIhfNGuA==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.3.0.tgz", + "integrity": "sha512-3e87LvavsdxyoCfGusJnrZ5G8SLPOFeHSNpZI/ATL9a5leXo2k0w6MKnbqhdBad9qTobSfB20Ld7UmgoNbAZkQ==", "dev": true, "requires": { "graceful-fs": "^4.1.2", @@ -2938,12 +3246,20 @@ } }, "esrecurse": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", - "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", "dev": true, "requires": { - "estraverse": "^4.1.0" + "estraverse": "^5.2.0" + }, + "dependencies": { + "estraverse": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.2.0.tgz", + "integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==", + "dev": true + } } }, "estraverse": { @@ -2965,15 +3281,15 @@ "dev": true }, "eventemitter3": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.0.tgz", - "integrity": "sha512-ivIvhpq/Y0uSjcHDcOIccjmYjGLcP09MFGE7ysAwkAvkXfpZlC985pH2/ui64DKazbTW/4kN3yqozUxlXzI6cA==", + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", "dev": true }, "events": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/events/-/events-3.1.0.tgz", - "integrity": "sha512-Rv+u8MLHNOdMjTAFeT3nCjHn2aGlx435FP/sDHNaRhDEMwyI/aB22Kj2qIN8R0cw3z28psEQLYwxVKLsKrMgWg==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.2.0.tgz", + "integrity": "sha512-/46HWwbfCX2xTawVfkKLGxMifJYQBWMwY1mjywRtb4c9x8l5NP3KoJtnIOiL1hfdRkIuYhETxQlo62IF8tcnlg==", "dev": true }, "eventsource": { @@ -3357,12 +3673,89 @@ "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", "dev": true }, + "fast-glob": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.4.tgz", + "integrity": "sha512-kr/Oo6PX51265qeuCYsyGypiO5uJFgBS0jksyG7FUeCyQzNwYnzrNIMR1NXfkZXsMYXYLRAHgISHBz8gQcxKHQ==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.0", + "merge2": "^1.3.0", + "micromatch": "^4.0.2", + "picomatch": "^2.2.1" + }, + "dependencies": { + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "glob-parent": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", + "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "micromatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.2.tgz", + "integrity": "sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q==", + "dev": true, + "requires": { + "braces": "^3.0.1", + "picomatch": "^2.0.5" + } + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + } + } + }, "fast-json-stable-stringify": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", "dev": true }, + "fastq": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.8.0.tgz", + "integrity": "sha512-SMIZoZdLh/fgofivvIkmknUXyPnvxRE3DhtZ5Me3Mrsk5gyPL42F0xr51TdRXskBxHfMp+07bcYzfsYEsSQA9Q==", + "dev": true, + "requires": { + "reusify": "^1.0.4" + } + }, "faye-websocket": { "version": "0.10.0", "resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.10.0.tgz", @@ -3373,9 +3766,9 @@ } }, "figgy-pudding": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/figgy-pudding/-/figgy-pudding-3.5.1.tgz", - "integrity": "sha512-vNKxJHTEKNThjfrdJwHc7brvM6eVevuO5nTj6ez8ZQ1qbXTvGthucRF7S4vf2cr71QVnT70V34v0S1DyQsti0w==", + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/figgy-pudding/-/figgy-pudding-3.5.2.tgz", + "integrity": "sha512-0btnI/H8f2pavGMN8w40mlSKOfTK2SVJmBfBeVIj3kNw0swwgzyRq0d5TJVOwodFmtvpPeWPN/MCcfuWF0Ezbw==", "dev": true }, "file-uri-to-path": { @@ -3495,24 +3888,10 @@ } }, "follow-redirects": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.7.0.tgz", - "integrity": "sha512-m/pZQy4Gj287eNy94nivy5wchN3Kp+Q5WgUPNy5lJSZ3sgkVKSYV/ZChMAQVIgx1SqfZ2zBZtPA2YlXIWxxJOQ==", - "dev": true, - "requires": { - "debug": "^3.2.6" - }, - "dependencies": { - "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - } - } + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.0.tgz", + "integrity": "sha512-aq6gF1BEKje4a9i9+5jimNFIpq4Q1WiwBToeRK5NvZBd/TRsmW8BsJfOEGkr76TbOyPVD3OVDN910EcUNtRYEA==", + "dev": true }, "for-in": { "version": "1.0.2", @@ -4253,17 +4632,25 @@ "dev": true }, "globby": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/globby/-/globby-7.1.1.tgz", - "integrity": "sha1-+yzP+UAfhgCUXfral0QMypcrhoA=", + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.1.tgz", + "integrity": "sha512-iH9RmgwCmUJHi2z5o2l3eTtGBtXek1OYlHrbcxOYugyHLmAsZrPj43OtHThd62Buh/Vv6VyCBD2bdyWcGNQqoQ==", "dev": true, "requires": { - "array-union": "^1.0.1", - "dir-glob": "^2.0.0", - "glob": "^7.1.2", - "ignore": "^3.3.5", - "pify": "^3.0.0", - "slash": "^1.0.0" + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.1.1", + "ignore": "^5.1.4", + "merge2": "^1.3.0", + "slash": "^3.0.0" + }, + "dependencies": { + "array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true + } } }, "graceful-fs": { @@ -4355,13 +4742,39 @@ } }, "hash-base": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.4.tgz", - "integrity": "sha1-X8hoaEfs1zSZQDMZprCj8/auSRg=", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", + "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==", "dev": true, "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" + "inherits": "^2.0.4", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" + }, + "dependencies": { + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true + } } }, "hash.js": { @@ -4476,12 +4889,12 @@ } }, "http-proxy": { - "version": "1.17.0", - "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.17.0.tgz", - "integrity": "sha512-Taqn+3nNvYRfJ3bGvKfBSRwy1v6eePlm3oc/aWVxZp57DQr5Eq3xhKJi7Z4hZpS8PC3H4qI+Yly5EmFacGuA/g==", + "version": "1.18.1", + "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz", + "integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==", "dev": true, "requires": { - "eventemitter3": "^3.0.0", + "eventemitter3": "^4.0.0", "follow-redirects": "^1.0.0", "requires-port": "^1.0.0" } @@ -4526,9 +4939,9 @@ "dev": true }, "ignore": { - "version": "3.3.10", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.10.tgz", - "integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==", + "version": "5.1.8", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", + "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==", "dev": true }, "import-local": { @@ -4887,11 +5300,12 @@ "dev": true }, "jest-worker": { - "version": "25.1.0", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-25.1.0.tgz", - "integrity": "sha512-ZHhHtlxOWSxCoNOKHGbiLzXnl42ga9CxDr27H36Qn+15pQZd3R/F24jrmjDelw9j/iHUIWMWs08/u2QN50HHOg==", + "version": "26.3.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-26.3.0.tgz", + "integrity": "sha512-Vmpn2F6IASefL+DVBhPzI2J9/GJUsqzomdeN+P+dK8/jKxbh8R3BtFnx3FIta7wYlPU62cpJMJQo4kuOowcMnw==", "dev": true, "requires": { + "@types/node": "*", "merge-stream": "^2.0.0", "supports-color": "^7.0.0" }, @@ -4903,9 +5317,9 @@ "dev": true }, "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, "requires": { "has-flag": "^4.0.0" @@ -5297,6 +5711,15 @@ "js-tokens": "^3.0.0 || ^4.0.0" } }, + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, "make-dir": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", @@ -5315,12 +5738,6 @@ } } }, - "mamacro": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/mamacro/-/mamacro-0.0.3.tgz", - "integrity": "sha512-qMEwh+UujcQ+kbz3T6V+wAmO2U8veoq2w+3wY8MquqwVA3jChfwY+Tk52GZKDfACEPjuZ7r2oJLejwpt8jtwTA==", - "dev": true - }, "map-age-cleaner": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/map-age-cleaner/-/map-age-cleaner-0.1.3.tgz", @@ -5401,6 +5818,12 @@ "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", "dev": true }, + "merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true + }, "methods": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", @@ -5436,6 +5859,14 @@ "requires": { "bn.js": "^4.0.0", "brorand": "^1.0.1" + }, + "dependencies": { + "bn.js": { + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==", + "dev": true + } } }, "mime": { @@ -5536,6 +5967,16 @@ "minipass": "^3.0.0" } }, + "minizlib": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", + "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", + "dev": true, + "requires": { + "minipass": "^3.0.0", + "yallist": "^4.0.0" + } + }, "mississippi": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/mississippi/-/mississippi-3.0.0.tgz", @@ -5665,9 +6106,9 @@ "dev": true }, "node-forge": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.9.0.tgz", - "integrity": "sha512-7ASaDa3pD+lJ3WvXFsxekJQelBKRpne+GOVbLbtHYdd7pFspyeuJHnWfLplGf3SwKGbfs/aYl5V/JCIaHVUKKQ==", + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", + "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==", "dev": true }, "node-libs-browser": { @@ -6057,25 +6498,24 @@ "dev": true }, "parallel-transform": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/parallel-transform/-/parallel-transform-1.1.0.tgz", - "integrity": "sha1-1BDwZbBdojCB/NEPKIVMKb2jOwY=", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/parallel-transform/-/parallel-transform-1.2.0.tgz", + "integrity": "sha512-P2vSmIu38uIlvdcU7fDkyrxj33gTUy/ABO5ZUbGowxNCopBq/OoD42bP4UmMrJoPyk4Uqf0mu3mtWBhHCZD8yg==", "dev": true, "requires": { - "cyclist": "~0.2.2", + "cyclist": "^1.0.1", "inherits": "^2.0.3", "readable-stream": "^2.1.5" } }, "parse-asn1": { - "version": "5.1.5", - "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.5.tgz", - "integrity": "sha512-jkMYn1dcJqF6d5CpU689bq7w/b5ALS9ROVSpQDPrZsqqesUJii9qutvoT5ltGedNXMO2e16YUWIghG9KxaViTQ==", + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.6.tgz", + "integrity": "sha512-RnZRo1EPU6JBnra2vGHj0yhp6ebyjBZpmUCLHWiFhxlzvBCCpAuZ7elsBp1PVAbQN0/04VD/19rfzlBSwLstMw==", "dev": true, "requires": { - "asn1.js": "^4.0.0", + "asn1.js": "^5.2.0", "browserify-aes": "^1.0.0", - "create-hash": "^1.1.0", "evp_bytestokey": "^1.0.0", "pbkdf2": "^3.0.3", "safe-buffer": "^5.1.1" @@ -6185,9 +6625,9 @@ } }, "pbkdf2": { - "version": "3.0.17", - "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.17.tgz", - "integrity": "sha512-U/il5MsrZp7mGg3mSQfn742na2T+1/vHDCG5/iTI3X9MKUuYUZVLQhyRsg06mCgDBTd57TxzgZt7P+fYfjRLtA==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.1.tgz", + "integrity": "sha512-4Ejy1OPxi9f2tt1rRV7Go7zmfDQ+ZectEQz3VGUQhgq62HtIRPDyG/JtnwIxs6x3uNMwo2V7q1fMvKjb+Tnpqg==", "dev": true, "requires": { "create-hash": "^1.1.2", @@ -6319,6 +6759,14 @@ "parse-asn1": "^5.0.0", "randombytes": "^2.0.1", "safe-buffer": "^5.1.2" + }, + "dependencies": { + "bn.js": { + "version": "4.11.9", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.9.tgz", + "integrity": "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw==", + "dev": true + } } }, "pump": { @@ -6732,6 +7180,12 @@ "integrity": "sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs=", "dev": true }, + "reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true + }, "rfdc": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.1.4.tgz", @@ -6757,6 +7211,12 @@ "inherits": "^2.0.1" } }, + "run-parallel": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.1.9.tgz", + "integrity": "sha512-DEqnSRTDw/Tc3FXf49zedI638Z9onwUotBMiUFKmrO2sdFKIbXamXGQ3Axd4qgphxKB4kw/qP1w5kTxnfU1B9Q==", + "dev": true + }, "run-queue": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/run-queue/-/run-queue-1.0.3.tgz", @@ -6805,12 +7265,12 @@ "dev": true }, "selfsigned": { - "version": "1.10.7", - "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-1.10.7.tgz", - "integrity": "sha512-8M3wBCzeWIJnQfl43IKwOmC4H/RAp50S8DF60znzjW5GVqTcSe2vWclt7hmYVPkKPlHWOu5EaWOMZ2Y6W8ZXTA==", + "version": "1.10.8", + "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-1.10.8.tgz", + "integrity": "sha512-2P4PtieJeEwVgTU9QEcwIRDQ/mXJLX8/+I3ur+Pg16nS8oNbrGxEso9NyYWy8NAmXiNl4dlAp5MwoNeCWzON4w==", "dev": true, "requires": { - "node-forge": "0.9.0" + "node-forge": "^0.10.0" } }, "semver": { @@ -6897,10 +7357,13 @@ } }, "serialize-javascript": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-2.1.2.tgz", - "integrity": "sha512-rs9OggEUF0V4jUSecXazOYsLfu7OGK2qIn3c7IPBiffz32XniEp/TX9Xmc9LQfK2nQ2QKHvZ2oygKUGU0lG4jQ==", - "dev": true + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-4.0.0.tgz", + "integrity": "sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw==", + "dev": true, + "requires": { + "randombytes": "^2.1.0" + } }, "serve-index": { "version": "1.9.1", @@ -7046,9 +7509,9 @@ "dev": true }, "slash": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", - "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true }, "snapdragon": { @@ -7362,9 +7825,9 @@ } }, "source-map-support": { - "version": "0.5.16", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.16.tgz", - "integrity": "sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ==", + "version": "0.5.19", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", + "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", "dev": true, "requires": { "buffer-from": "^1.0.0", @@ -7536,9 +7999,9 @@ } }, "stream-shift": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.0.tgz", - "integrity": "sha1-1cdSgl5TZ+eG944Y5EXqIjoVWVI=", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.1.tgz", + "integrity": "sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ==", "dev": true }, "streamroller": { @@ -7930,10 +8393,38 @@ "integrity": "sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA==", "dev": true }, + "tar": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.0.5.tgz", + "integrity": "sha512-0b4HOimQHj9nXNEAA7zWwMM91Zhhba3pspja6sQbgTpynOJf+bkjBnfybNYzbpLbnwXnbyB4LOREvlyXLkCHSg==", + "dev": true, + "requires": { + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "minipass": "^3.0.0", + "minizlib": "^2.1.1", + "mkdirp": "^1.0.3", + "yallist": "^4.0.0" + }, + "dependencies": { + "chownr": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", + "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", + "dev": true + }, + "mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true + } + } + }, "terser": { - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/terser/-/terser-4.4.2.tgz", - "integrity": "sha512-Uufrsvhj9O1ikwgITGsZ5EZS6qPokUOkCegS7fYOdGTv+OA90vndUbU6PEjr5ePqHfNUbGyMO7xyIZv2MhsALQ==", + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-4.8.0.tgz", + "integrity": "sha512-EAPipTNeWsb/3wLPeup1tVPaXfIaU68xMnVdPafIL1TV05OhASArYyIfFvnvJCNrR2NIOvDVNNTFRa+Re2MWyw==", "dev": true, "requires": { "commander": "^2.20.0", @@ -7941,12 +8432,6 @@ "source-map-support": "~0.5.12" }, "dependencies": { - "commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", - "dev": true - }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -7956,26 +8441,26 @@ } }, "terser-webpack-plugin": { - "version": "2.3.5", - "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-2.3.5.tgz", - "integrity": "sha512-WlWksUoq+E4+JlJ+h+U+QUzXpcsMSSNXkDy9lBVkSqDn1w23Gg29L/ary9GeJVYCGiNJJX7LnVc4bwL1N3/g1w==", + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-4.2.2.tgz", + "integrity": "sha512-3qAQpykRTD5DReLu5/cwpsg7EZFzP3Q0Hp2XUWJUw2mpq2jfgOKTZr8IZKKnNieRVVo1UauROTdhbQJZveGKtQ==", "dev": true, "requires": { - "cacache": "^13.0.1", - "find-cache-dir": "^3.2.0", - "jest-worker": "^25.1.0", - "p-limit": "^2.2.2", - "schema-utils": "^2.6.4", - "serialize-javascript": "^2.1.2", + "cacache": "^15.0.5", + "find-cache-dir": "^3.3.1", + "jest-worker": "^26.3.0", + "p-limit": "^3.0.2", + "schema-utils": "^2.7.1", + "serialize-javascript": "^5.0.1", "source-map": "^0.6.1", - "terser": "^4.4.3", + "terser": "^5.3.2", "webpack-sources": "^1.4.3" }, "dependencies": { "ajv": { - "version": "6.12.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.0.tgz", - "integrity": "sha512-D6gFiFA0RRLyUbvijN74DWAjXSFxWKaWP7mldxkVhyhAV3+SWA9HEJPHQ2c9soIeTFJqcSdFDGFgdqs1iUU2Hw==", + "version": "6.12.5", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.5.tgz", + "integrity": "sha512-lRF8RORchjpKG50/WFf8xmg7sgCLFiYNNnqdKflk63whMQcWR5ngGjiSXkL9bjxy6B2npOK2HSMN49jEBMSkag==", "dev": true, "requires": { "fast-deep-equal": "^3.1.1", @@ -7985,47 +8470,46 @@ } }, "ajv-keywords": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.4.1.tgz", - "integrity": "sha512-RO1ibKvd27e6FEShVFfPALuHI3WjSVNeK5FIsmme/LYRNxjKuNj+Dt7bucLa6NdSv3JcVTyMlm9kGR84z1XpaQ==", + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", + "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", "dev": true }, "cacache": { - "version": "13.0.1", - "resolved": "https://registry.npmjs.org/cacache/-/cacache-13.0.1.tgz", - "integrity": "sha512-5ZvAxd05HDDU+y9BVvcqYu2LLXmPnQ0hW62h32g4xBTgL/MppR4/04NHfj/ycM2y6lmTnbw6HVi+1eN0Psba6w==", + "version": "15.0.5", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-15.0.5.tgz", + "integrity": "sha512-lloiL22n7sOjEEXdL8NAjTgv9a1u43xICE9/203qonkZUCj5X1UEWIdf2/Y0d6QcCtMzbKQyhrcDbdvlZTs/+A==", "dev": true, "requires": { - "chownr": "^1.1.2", - "figgy-pudding": "^3.5.1", + "@npmcli/move-file": "^1.0.1", + "chownr": "^2.0.0", "fs-minipass": "^2.0.0", "glob": "^7.1.4", - "graceful-fs": "^4.2.2", "infer-owner": "^1.0.4", - "lru-cache": "^5.1.1", - "minipass": "^3.0.0", + "lru-cache": "^6.0.0", + "minipass": "^3.1.1", "minipass-collect": "^1.0.2", "minipass-flush": "^1.0.5", "minipass-pipeline": "^1.2.2", - "mkdirp": "^0.5.1", - "move-concurrently": "^1.0.1", - "p-map": "^3.0.0", + "mkdirp": "^1.0.3", + "p-map": "^4.0.0", "promise-inflight": "^1.0.1", - "rimraf": "^2.7.1", - "ssri": "^7.0.0", + "rimraf": "^3.0.2", + "ssri": "^8.0.0", + "tar": "^6.0.2", "unique-filename": "^1.1.1" } }, "chownr": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", - "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", + "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", "dev": true }, "fast-deep-equal": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz", - "integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "dev": true }, "find-cache-dir": { @@ -8063,12 +8547,6 @@ "path-is-absolute": "^1.0.0" } }, - "graceful-fs": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", - "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", - "dev": true - }, "locate-path": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", @@ -8078,28 +8556,25 @@ "p-locate": "^4.1.0" } }, - "lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "dev": true, - "requires": { - "yallist": "^3.0.2" - } - }, "make-dir": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.2.tgz", - "integrity": "sha512-rYKABKutXa6vXTXhoV18cBE7PaewPXHe/Bdq4v+ZLMhxbWApkFFplT0LcbMW+6BbjnQXzZ/sAvSE/JdguApG5w==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", "dev": true, "requires": { "semver": "^6.0.0" } }, + "mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "dev": true + }, "p-limit": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.2.2.tgz", - "integrity": "sha512-WGR+xHecKTr7EbUEhyLSh5Dube9JtdiG78ufaeLxTgpudf/20KqyMioIUZJAezlTIi6evxuoUs9YXc11cU+yzQ==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.0.2.tgz", + "integrity": "sha512-iwqZSOoWIW+Ew4kAGUlN16J4M7OB3ysMLSZtnhmqx7njIHFPlxWBX8xo3lVTyFVq6mI/lL9qt2IsN1sHwaxJkg==", "dev": true, "requires": { "p-try": "^2.0.0" @@ -8112,12 +8587,23 @@ "dev": true, "requires": { "p-limit": "^2.2.0" + }, + "dependencies": { + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + } } }, "p-map": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-map/-/p-map-3.0.0.tgz", - "integrity": "sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", + "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==", "dev": true, "requires": { "aggregate-error": "^3.0.0" @@ -8139,22 +8625,23 @@ } }, "rimraf": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", - "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", "dev": true, "requires": { "glob": "^7.1.3" } }, "schema-utils": { - "version": "2.6.5", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-2.6.5.tgz", - "integrity": "sha512-5KXuwKziQrTVHh8j/Uxz+QUbxkaLW9X/86NBlx/gnKgtsZA2GIVMUn17qWhRFwF8jdYb3Dig5hRO/W5mZqy6SQ==", + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-2.7.1.tgz", + "integrity": "sha512-SHiNtMOUGWBQJwzISiVYKu82GiV4QYGePp3odlY1tuKO7gPtphAT5R/py0fA6xtbgLL/RvtJZnU9b8s0F1q0Xg==", "dev": true, "requires": { - "ajv": "^6.12.0", - "ajv-keywords": "^3.4.1" + "@types/json-schema": "^7.0.5", + "ajv": "^6.12.4", + "ajv-keywords": "^3.5.2" } }, "semver": { @@ -8163,38 +8650,58 @@ "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "dev": true }, + "serialize-javascript": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-5.0.1.tgz", + "integrity": "sha512-SaaNal9imEO737H2c05Og0/8LUXG7EnsZyMa8MzkmuHoELfT6txuj0cMqRj6zfPKnmQ1yasR4PCJc8x+M4JSPA==", + "dev": true, + "requires": { + "randombytes": "^2.1.0" + } + }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true }, + "source-map-support": { + "version": "0.5.19", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", + "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, "ssri": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/ssri/-/ssri-7.1.0.tgz", - "integrity": "sha512-77/WrDZUWocK0mvA5NTRQyveUf+wsrIc6vyrxpS8tVvYBcX215QbafrJR3KtkpskIzoFLqqNuuYQvxaMjXJ/0g==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/ssri/-/ssri-8.0.0.tgz", + "integrity": "sha512-aq/pz989nxVYwn16Tsbj1TqFpD5LLrQxHf5zaHuieFV+R0Bbr4y8qUsOA45hXT/N4/9UNXTarBjnjVmjSOVaAA==", "dev": true, "requires": { - "figgy-pudding": "^3.5.1", "minipass": "^3.1.1" } }, "terser": { - "version": "4.6.7", - "resolved": "https://registry.npmjs.org/terser/-/terser-4.6.7.tgz", - "integrity": "sha512-fmr7M1f7DBly5cX2+rFDvmGBAaaZyPrHYK4mMdHEDAdNTqXSZgSOfqsfGq2HqPGT/1V0foZZuCZFx8CHKgAk3g==", + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.3.3.tgz", + "integrity": "sha512-vRQDIlD+2Pg8YMwVK9kMM3yGylG95EIwzBai1Bw7Ot4OBfn3VP1TZn3EWx4ep2jERN/AmnVaTiGuelZSN7ds/A==", "dev": true, "requires": { "commander": "^2.20.0", - "source-map": "~0.6.1", - "source-map-support": "~0.5.12" + "source-map": "~0.7.2", + "source-map-support": "~0.5.19" + }, + "dependencies": { + "source-map": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", + "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", + "dev": true + } } - }, - "yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "dev": true } } }, @@ -8305,9 +8812,9 @@ "dev": true }, "tslib": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.11.1.tgz", - "integrity": "sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA==", + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz", + "integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==", "dev": true }, "tty-browserify": { @@ -8588,14 +9095,136 @@ "dev": true }, "watchpack": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.6.0.tgz", - "integrity": "sha512-i6dHe3EyLjMmDlU1/bGQpEw25XSjkJULPuAVKCbNRefQVq48yXKUpwg538F7AZTf9kyr57zj++pQFltUa5H7yA==", + "version": "1.7.4", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.7.4.tgz", + "integrity": "sha512-aWAgTW4MoSJzZPAicljkO1hsi1oKj/RRq/OJQh2PKI2UKL04c2Bs+MBOB+BBABHTXJpf9mCwHN7ANCvYsvY2sg==", "dev": true, "requires": { - "chokidar": "^2.0.2", + "chokidar": "^3.4.1", "graceful-fs": "^4.1.2", - "neo-async": "^2.5.0" + "neo-async": "^2.5.0", + "watchpack-chokidar2": "^2.0.0" + }, + "dependencies": { + "anymatch": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", + "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", + "dev": true, + "optional": true, + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, + "binary-extensions": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.1.0.tgz", + "integrity": "sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ==", + "dev": true, + "optional": true + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "optional": true, + "requires": { + "fill-range": "^7.0.1" + } + }, + "chokidar": { + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.2.tgz", + "integrity": "sha512-IZHaDeBeI+sZJRX7lGcXsdzgvZqKv6sECqsbErJA4mHWfpRrD8B97kSFN4cQz6nGBGiuFia1MKR4d6c1o8Cv7A==", + "dev": true, + "optional": true, + "requires": { + "anymatch": "~3.1.1", + "braces": "~3.0.2", + "fsevents": "~2.1.2", + "glob-parent": "~5.1.0", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.4.0" + } + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "optional": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "fsevents": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz", + "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==", + "dev": true, + "optional": true + }, + "glob-parent": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", + "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", + "dev": true, + "optional": true, + "requires": { + "is-glob": "^4.0.1" + } + }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "optional": true, + "requires": { + "binary-extensions": "^2.0.0" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "optional": true + }, + "readdirp": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.4.0.tgz", + "integrity": "sha512-0xe001vZBnJEK+uKcj8qOhyAKPzIT+gStxWr3LCB0DwcXR5NZJ3IaC+yGnHCYzB/S7ov3m3EEbZI2zeNvX+hGQ==", + "dev": true, + "optional": true, + "requires": { + "picomatch": "^2.2.1" + } + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "optional": true, + "requires": { + "is-number": "^7.0.0" + } + } + } + }, + "watchpack-chokidar2": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/watchpack-chokidar2/-/watchpack-chokidar2-2.0.0.tgz", + "integrity": "sha512-9TyfOyN/zLUbA288wZ8IsMZ+6cbzvsNyEzSBp6e/zkifi6xxbl8SmQ/CxQq32k8NNqrdVEVUVSEf56L4rQ/ZxA==", + "dev": true, + "optional": true, + "requires": { + "chokidar": "^2.1.8" } }, "wbuf": { @@ -8608,40 +9237,40 @@ } }, "webpack": { - "version": "4.42.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-4.42.0.tgz", - "integrity": "sha512-EzJRHvwQyBiYrYqhyjW9AqM90dE4+s1/XtCfn7uWg6cS72zH+2VPFAlsnW0+W0cDi0XRjNKUMoJtpSi50+Ph6w==", + "version": "4.44.2", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-4.44.2.tgz", + "integrity": "sha512-6KJVGlCxYdISyurpQ0IPTklv+DULv05rs2hseIXer6D7KrUicRDLFb4IUM1S6LUAKypPM/nSiVSuv8jHu1m3/Q==", "dev": true, "requires": { - "@webassemblyjs/ast": "1.8.5", - "@webassemblyjs/helper-module-context": "1.8.5", - "@webassemblyjs/wasm-edit": "1.8.5", - "@webassemblyjs/wasm-parser": "1.8.5", - "acorn": "^6.2.1", + "@webassemblyjs/ast": "1.9.0", + "@webassemblyjs/helper-module-context": "1.9.0", + "@webassemblyjs/wasm-edit": "1.9.0", + "@webassemblyjs/wasm-parser": "1.9.0", + "acorn": "^6.4.1", "ajv": "^6.10.2", "ajv-keywords": "^3.4.1", "chrome-trace-event": "^1.0.2", - "enhanced-resolve": "^4.1.0", + "enhanced-resolve": "^4.3.0", "eslint-scope": "^4.0.3", "json-parse-better-errors": "^1.0.2", "loader-runner": "^2.4.0", "loader-utils": "^1.2.3", "memory-fs": "^0.4.1", "micromatch": "^3.1.10", - "mkdirp": "^0.5.1", + "mkdirp": "^0.5.3", "neo-async": "^2.6.1", "node-libs-browser": "^2.2.1", "schema-utils": "^1.0.0", "tapable": "^1.1.3", "terser-webpack-plugin": "^1.4.3", - "watchpack": "^1.6.0", + "watchpack": "^1.7.4", "webpack-sources": "^1.4.1" }, "dependencies": { "ajv": { - "version": "6.12.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.0.tgz", - "integrity": "sha512-D6gFiFA0RRLyUbvijN74DWAjXSFxWKaWP7mldxkVhyhAV3+SWA9HEJPHQ2c9soIeTFJqcSdFDGFgdqs1iUU2Hw==", + "version": "6.12.5", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.5.tgz", + "integrity": "sha512-lRF8RORchjpKG50/WFf8xmg7sgCLFiYNNnqdKflk63whMQcWR5ngGjiSXkL9bjxy6B2npOK2HSMN49jEBMSkag==", "dev": true, "requires": { "fast-deep-equal": "^3.1.1", @@ -8651,42 +9280,15 @@ } }, "ajv-keywords": { - "version": "3.4.1", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.4.1.tgz", - "integrity": "sha512-RO1ibKvd27e6FEShVFfPALuHI3WjSVNeK5FIsmme/LYRNxjKuNj+Dt7bucLa6NdSv3JcVTyMlm9kGR84z1XpaQ==", + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", + "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", "dev": true }, "fast-deep-equal": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz", - "integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==", - "dev": true - }, - "find-cache-dir": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-2.1.0.tgz", - "integrity": "sha512-Tq6PixE0w/VMFfCgbONnkiQIVol/JJL7nRMi20fqzA4NRs9AfeqMGeRdPi3wIhYkxjeBaWh2rxwapn5Tu3IqOQ==", - "dev": true, - "requires": { - "commondir": "^1.0.1", - "make-dir": "^2.0.0", - "pkg-dir": "^3.0.0" - } - }, - "make-dir": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", - "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", - "dev": true, - "requires": { - "pify": "^4.0.1", - "semver": "^5.6.0" - } - }, - "pify": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", - "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "dev": true }, "source-map": { @@ -8696,16 +9298,16 @@ "dev": true }, "terser-webpack-plugin": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-1.4.3.tgz", - "integrity": "sha512-QMxecFz/gHQwteWwSo5nTc6UaICqN1bMedC5sMtUc7y3Ha3Q8y6ZO0iCR8pq4RJC8Hjf0FEPEHZqcMB/+DFCrA==", + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-1.4.5.tgz", + "integrity": "sha512-04Rfe496lN8EYruwi6oPQkG0vo8C+HT49X687FZnpPF0qMAIHONI6HEXYPKDOE8e5HjXTyKfqRd/agHtH0kOtw==", "dev": true, "requires": { "cacache": "^12.0.2", "find-cache-dir": "^2.1.0", "is-wsl": "^1.1.0", "schema-utils": "^1.0.0", - "serialize-javascript": "^2.1.2", + "serialize-javascript": "^4.0.0", "source-map": "^0.6.1", "terser": "^4.1.2", "webpack-sources": "^1.4.0", @@ -9206,9 +9808,9 @@ "dev": true }, "xtend": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", - "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", "dev": true }, "y18n": { @@ -9217,6 +9819,12 @@ "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", "dev": true }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, "yargs": { "version": "15.3.1", "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.3.1.tgz", diff --git a/package.json b/package.json index 73bc21b..f3d2150 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "angular-ui-scroll", "description": "AngularJS virtual scrolling module", - "version": "1.8.1", + "version": "1.8.2", "src": "./src/", "public": "./dist/", "main": "./dist/ui-scroll.js", @@ -44,7 +44,7 @@ "@babel/preset-env": "^7.3.1", "babel-loader": "^8.1.0", "clean-webpack-plugin": "^0.1.17", - "copy-webpack-plugin": "^5.1.1", + "copy-webpack-plugin": "^6.1.1", "jasmine-core": "^2.8.0", "jshint": "^2.10.1", "karma": "^5.0.5", @@ -54,7 +54,7 @@ "karma-sourcemap-loader": "^0.3.7", "karma-webpack": "^4.0.2", "npm-run-all": "^4.1.2", - "terser-webpack-plugin": "^2.3.5", + "terser-webpack-plugin": "^4.2.2", "webpack": "^4.42.0", "webpack-cli": "^3.3.1", "webpack-dev-server": "^3.11.0" diff --git a/src/modules/adapter.js b/src/modules/adapter.js index 5acd569..d0dafce 100644 --- a/src/modules/adapter.js +++ b/src/modules/adapter.js @@ -1,3 +1,5 @@ +import { OPERATIONS } from './utils'; + class Adapter { constructor($scope, $parse, $attr, viewport, buffer, doAdjust, reload) { @@ -168,16 +170,23 @@ class Adapter { } let position = this.buffer.indexOf(wrapper); if (!newItems.reverse().some(newItem => newItem === wrapper.item)) { - wrapper.op = 'remove'; - if (!options.immutableTop && position === 0 && !newItems.length) { - wrapper._op = 'isTop'; // to catch "first" edge case on remove + wrapper.op = OPERATIONS.REMOVE; + // try to catch "first" edge case on remove + if (!options.immutableTop && !newItems.length) { + // this is the first item, or the previous one's part of the "shift-top" group + if ( + (position === 0 && this.buffer.bof) || + (position !== 0 && this.buffer[position - 1].shiftTop) + ) { + wrapper.shiftTop = true; + } } } newItems.forEach((newItem) => { if (newItem === wrapper.item) { position--; } else { - // 3 parameter (isTop) is to catch "first" edge case on insert + // 3 parameter (shiftTop) is to catch "first" edge case on insert this.buffer.insert(position + 1, newItem, !options.immutableTop && position === -1); } }); diff --git a/src/modules/buffer.js b/src/modules/buffer.js index 4e08573..13b2910 100644 --- a/src/modules/buffer.js +++ b/src/modules/buffer.js @@ -1,3 +1,5 @@ +import { OPERATIONS } from './utils'; + export default function ScrollBuffer(elementRoutines, bufferSize, startIndex) { const buffer = Object.create(Array.prototype); @@ -19,7 +21,7 @@ export default function ScrollBuffer(elementRoutines, bufferSize, startIndex) { append(items) { items.forEach((item) => { ++buffer.next; - buffer.insert('append', item); + buffer.insert(OPERATIONS.APPEND, item); }); buffer.maxIndex = buffer.eof ? buffer.next - 1 : Math.max(buffer.next - 1, buffer.maxIndex); }, @@ -32,7 +34,7 @@ export default function ScrollBuffer(elementRoutines, bufferSize, startIndex) { else { --buffer.first; } - buffer.insert('prepend', item); + buffer.insert(OPERATIONS.PREPEND, item); }); buffer.minIndex = buffer.bof ? buffer.minIndex = buffer.first : Math.min(buffer.first, buffer.minIndex); }, @@ -41,17 +43,17 @@ export default function ScrollBuffer(elementRoutines, bufferSize, startIndex) { * inserts wrapped element in the buffer * the first argument is either operation keyword (see below) or a number for operation 'insert' * for insert the number is the index for the buffer element the new one have to be inserted after - * operations: 'append', 'prepend', 'insert', 'remove', 'update', 'none' + * operations: 'append', 'prepend', 'insert', 'remove', 'none' */ - insert(operation, item, isTop) { + insert(operation, item, shiftTop) { const wrapper = { item: item }; - if (operation % 1 === 0) {// it is an insert - wrapper.op = 'insert'; + if (operation % 1 === 0) { // it is an insert + wrapper.op = OPERATIONS.INSERT; buffer.splice(operation, 0, wrapper); - if(isTop) { + if (shiftTop) { buffer.first--; } else { @@ -60,10 +62,10 @@ export default function ScrollBuffer(elementRoutines, bufferSize, startIndex) { } else { wrapper.op = operation; switch (operation) { - case 'append': + case OPERATIONS.APPEND: buffer.push(wrapper); break; - case 'prepend': + case OPERATIONS.PREPEND: buffer.unshift(wrapper); break; } @@ -79,35 +81,34 @@ export default function ScrollBuffer(elementRoutines, bufferSize, startIndex) { } return buffer.splice(arg1, arg2 - arg1); } - // removes single item(wrapper) from the buffer + // removes single item (wrapper) from the buffer buffer.splice(buffer.indexOf(arg1), 1); - if(arg1._op === 'isTop' && buffer.first === this.getAbsMinIndex()) { + if (arg1.shiftTop && buffer.first === this.getAbsMinIndex()) { this.incrementMinIndex(); } else { this.decrementMaxIndex(); } - if(arg1._op === 'isTop') { + if (arg1.shiftTop) { buffer.first++; } else { buffer.next--; } - if(!buffer.length) { - buffer.first = 1; - buffer.next = 1; + if (!buffer.length) { + buffer.minIndex = Math.min(buffer.maxIndex, buffer.minIndex); } return elementRoutines.removeElementAnimated(arg1); }, incrementMinIndex() { - if(buffer.minIndexUser !== null) { - if(buffer.minIndex > buffer.minIndexUser) { + if (buffer.minIndexUser !== null) { + if (buffer.minIndex > buffer.minIndexUser) { buffer.minIndexUser++; return; } - if(buffer.minIndex === buffer.minIndexUser) { + if (buffer.minIndex === buffer.minIndexUser) { buffer.minIndexUser++; } } @@ -115,21 +116,21 @@ export default function ScrollBuffer(elementRoutines, bufferSize, startIndex) { }, decrementMaxIndex() { - if(buffer.maxIndexUser !== null && buffer.maxIndex <= buffer.maxIndexUser) { + if (buffer.maxIndexUser !== null && buffer.maxIndex <= buffer.maxIndexUser) { buffer.maxIndexUser--; } buffer.maxIndex--; }, getAbsMinIndex() { - if(buffer.minIndexUser !== null) { + if (buffer.minIndexUser !== null) { return Math.min(buffer.minIndexUser, buffer.minIndex); } return buffer.minIndex; }, getAbsMaxIndex() { - if(buffer.maxIndexUser !== null) { + if (buffer.maxIndexUser !== null) { return Math.max(buffer.maxIndexUser, buffer.maxIndex); } return buffer.maxIndex; @@ -152,7 +153,7 @@ export default function ScrollBuffer(elementRoutines, bufferSize, startIndex) { }, getItems() { - return buffer.filter(item => item.op === 'none'); + return buffer.filter(item => item.op === OPERATIONS.NONE); }, getFirstItem() { diff --git a/src/modules/padding.js b/src/modules/padding.js index ce66e22..2324537 100644 --- a/src/modules/padding.js +++ b/src/modules/padding.js @@ -15,16 +15,16 @@ class CacheProto { this.sort((a, b) => ((a.index < b.index) ? -1 : ((a.index > b.index) ? 1 : 0))); } - remove(argument, _isTop) { + remove(argument, _shiftTop) { const index = argument % 1 === 0 ? argument : argument.scope.$index; - const isTop = argument % 1 === 0 ? _isTop : argument._op === 'isTop'; + const shiftTop = argument % 1 === 0 ? _shiftTop : argument.shiftTop; for (let i = this.length - 1; i >= 0; i--) { if (this[i].index === index) { this.splice(i, 1); break; } } - if(!isTop) { + if (!shiftTop) { for (let i = this.length - 1; i >= 0; i--) { if (this[i].index > index) { this[i].index--; @@ -50,7 +50,7 @@ Object.getOwnPropertyNames(CacheProto.prototype).forEach(methodName => ); function generateElement(template) { - if(template.nodeType !== Node.ELEMENT_NODE) { + if (template.nodeType !== Node.ELEMENT_NODE) { throw new Error('ui-scroll directive requires an Element node for templating the view'); } let element; diff --git a/src/modules/utils.js b/src/modules/utils.js new file mode 100644 index 0000000..c0b7847 --- /dev/null +++ b/src/modules/utils.js @@ -0,0 +1,7 @@ +export const OPERATIONS = { + PREPEND: 'prepend', + APPEND: 'append', + INSERT: 'insert', + REMOVE: 'remove', + NONE: 'none' +}; diff --git a/src/modules/viewport.js b/src/modules/viewport.js index 707c8bf..96ecee3 100644 --- a/src/modules/viewport.js +++ b/src/modules/viewport.js @@ -35,7 +35,7 @@ export default function Viewport(elementRoutines, buffer, element, viewportContr if (!container) { return true; } - if(container !== viewport) { + if (container !== viewport) { viewport.css('height', window.getComputedStyle(container[0]).height); } return viewport.height() > 0; @@ -137,7 +137,7 @@ export default function Viewport(elementRoutines, buffer, element, viewportContr let topPaddingHeight = 0, topCount = 0; topPadding.cache.forEach(item => { - if(item.index < buffer.first) { + if (item.index < buffer.first) { topPaddingHeight += item.height; topCount++; } @@ -145,7 +145,7 @@ export default function Viewport(elementRoutines, buffer, element, viewportContr let bottomPaddingHeight = 0, bottomCount = 0; bottomPadding.cache.forEach(item => { - if(item.index >= buffer.next) { + if (item.index >= buffer.next) { bottomPaddingHeight += item.height; bottomCount++; } @@ -204,9 +204,9 @@ export default function Viewport(elementRoutines, buffer, element, viewportContr bottomPadding.cache.clear(); }, - removeCacheItem(item, isTop) { - topPadding.cache.remove(item, isTop); - bottomPadding.cache.remove(item, isTop); + removeCacheItem(item, shiftTop) { + topPadding.cache.remove(item, shiftTop); + bottomPadding.cache.remove(item, shiftTop); }, removeItem(item) { diff --git a/src/ui-scroll.js b/src/ui-scroll.js index c550f47..705f993 100644 --- a/src/ui-scroll.js +++ b/src/ui-scroll.js @@ -3,6 +3,7 @@ import ElementRoutines from './modules/elementRoutines.js'; import ScrollBuffer from './modules/buffer.js'; import Viewport from './modules/viewport.js'; import Adapter from './modules/adapter.js'; +import { OPERATIONS } from './modules/utils'; angular.module('ui.scroll', []) @@ -318,20 +319,20 @@ angular.module('ui.scroll', []) buffer.forEach((wrapper, i) => { switch (wrapper.op) { - case 'prepend': + case OPERATIONS.PREPEND: toBePrepended.unshift(wrapper); break; - case 'append': + case OPERATIONS.APPEND: insertWrapperContent(wrapper, i); - wrapper.op = 'none'; + wrapper.op = OPERATIONS.NONE; inserted.push(wrapper); break; - case 'insert': + case OPERATIONS.INSERT: promises = promises.concat(createElement(wrapper, i, viewport.insertElementAnimated)); - wrapper.op = 'none'; + wrapper.op = OPERATIONS.NONE; inserted.push(wrapper); break; - case 'remove': + case OPERATIONS.REMOVE: toBeRemoved.push(wrapper); } }); @@ -341,7 +342,7 @@ angular.module('ui.scroll', []) if (toBePrepended.length) toBePrepended.forEach((wrapper) => { insertWrapperContent(wrapper); - wrapper.op = 'none'; + wrapper.op = OPERATIONS.NONE; }); buffer.forEach((item, i) => item.scope.$index = buffer.first + i); diff --git a/test/.jshintrc b/test/.jshintrc index 70cbca9..1cb61f6 100644 --- a/test/.jshintrc +++ b/test/.jshintrc @@ -4,7 +4,7 @@ "browser": true, "eqeqeq": true, "expr": true, - "esversion": 6, + "esversion": 9, "forin": true, "freeze": true, "futurehostile": true, diff --git a/test/AdapterTestsSpec.js b/test/AdapterTestsSpec.js index c2cc991..dabe02c 100644 --- a/test/AdapterTestsSpec.js +++ b/test/AdapterTestsSpec.js @@ -21,17 +21,9 @@ describe('uiScroll', function () { function (viewport, scope) { expect(viewport.children().length).toBe(5); - var row1 = viewport.children()[1]; - expect(row1.tagName.toLowerCase()).toBe('div'); - expect(row1.innerHTML).toBe('1: one'); - - var row2 = viewport.children()[2]; - expect(row2.tagName.toLowerCase()).toBe('div'); - expect(row2.innerHTML).toBe('2: two'); - - var row3 = viewport.children()[3]; - expect(row3.tagName.toLowerCase()).toBe('div'); - expect(row3.innerHTML).toBe('3: three'); + expect(Helper.getRow(viewport, 1)).toBe('1: one'); + expect(Helper.getRow(viewport, 2)).toBe('2: two'); + expect(Helper.getRow(viewport, 3)).toBe('3: three'); expect(scope.adapter).toBeTruthy(); expect(scope.adapter.topVisibleElement[0].innerHTML).toBe('1: one'); @@ -51,17 +43,9 @@ describe('uiScroll', function () { ); expect(viewport.children().length).toBe(5); - var row1 = viewport.children()[1]; - expect(row1.tagName.toLowerCase()).toBe('div'); - expect(row1.innerHTML).toBe('1: one *1'); - - var row2 = viewport.children()[2]; - expect(row2.tagName.toLowerCase()).toBe('div'); - expect(row2.innerHTML).toBe('2: two *2'); - - var row3 = viewport.children()[3]; - expect(row3.tagName.toLowerCase()).toBe('div'); - expect(row3.innerHTML).toBe('3: three *3'); + expect(Helper.getRow(viewport, 1)).toBe('1: one *1'); + expect(Helper.getRow(viewport, 2)).toBe('2: two *2'); + expect(Helper.getRow(viewport, 3)).toBe('3: three *3'); expect(scope.adapter).toBeTruthy(); expect(scope.adapter.topVisibleElement[0].innerHTML).toBe('1: one *1'); @@ -83,18 +67,9 @@ describe('uiScroll', function () { ); expect(viewport.children().length).toBe(5); - - var row1 = viewport.children()[1]; - expect(row1.tagName.toLowerCase()).toBe('div'); - expect(row1.innerHTML).toBe('1: one *1'); - - var row2 = viewport.children()[2]; - expect(row2.tagName.toLowerCase()).toBe('div'); - expect(row2.innerHTML).toBe('2: two'); - - var row3 = viewport.children()[3]; - expect(row3.tagName.toLowerCase()).toBe('div'); - expect(row3.innerHTML).toBe('3: three'); + expect(Helper.getRow(viewport, 1)).toBe('1: one *1'); + expect(Helper.getRow(viewport, 2)).toBe('2: two'); + expect(Helper.getRow(viewport, 3)).toBe('3: three'); expect(scope.adapter).toBeTruthy(); expect(scope.adapter.topVisibleElement[0].innerHTML).toBe('1: one *1'); @@ -116,18 +91,9 @@ describe('uiScroll', function () { ); expect(viewport.children().length).toBe(5); - - var row1 = viewport.children()[1]; - expect(row1.tagName.toLowerCase()).toBe('div'); - expect(row1.innerHTML).toBe('1: one'); - - var row2 = viewport.children()[2]; - expect(row2.tagName.toLowerCase()).toBe('div'); - expect(row2.innerHTML).toBe('2: two *2'); - - var row3 = viewport.children()[3]; - expect(row3.tagName.toLowerCase()).toBe('div'); - expect(row3.innerHTML).toBe('3: three'); + expect(Helper.getRow(viewport, 1)).toBe('1: one'); + expect(Helper.getRow(viewport, 2)).toBe('2: two *2'); + expect(Helper.getRow(viewport, 3)).toBe('3: three'); expect(scope.adapter).toBeTruthy(); expect(scope.adapter.topVisibleElement[0].innerHTML).toBe('1: one'); @@ -149,18 +115,9 @@ describe('uiScroll', function () { ); expect(viewport.children().length).toBe(5); - - var row1 = viewport.children()[1]; - expect(row1.tagName.toLowerCase()).toBe('div'); - expect(row1.innerHTML).toBe('1: one'); - - var row2 = viewport.children()[2]; - expect(row2.tagName.toLowerCase()).toBe('div'); - expect(row2.innerHTML).toBe('2: two'); - - var row3 = viewport.children()[3]; - expect(row3.tagName.toLowerCase()).toBe('div'); - expect(row3.innerHTML).toBe('3: three *3'); + expect(Helper.getRow(viewport, 1)).toBe('1: one'); + expect(Helper.getRow(viewport, 2)).toBe('2: two'); + expect(Helper.getRow(viewport, 3)).toBe('3: three *3'); expect(scope.adapter).toBeTruthy(); expect(scope.adapter.topVisibleElement[0].innerHTML).toBe('1: one'); @@ -182,14 +139,8 @@ describe('uiScroll', function () { ); expect(viewport.children().length).toBe(4); - - var row2 = viewport.children()[1]; - expect(row2.tagName.toLowerCase()).toBe('div'); - expect(row2.innerHTML).toBe('2: two'); - - var row3 = viewport.children()[2]; - expect(row3.tagName.toLowerCase()).toBe('div'); - expect(row3.innerHTML).toBe('3: three'); + expect(Helper.getRow(viewport, 1)).toBe('2: two'); + expect(Helper.getRow(viewport, 2)).toBe('3: three'); expect(scope.adapter).toBeTruthy(); expect(scope.adapter.topVisibleElement[0].innerHTML).toBe('2: two'); @@ -214,14 +165,8 @@ describe('uiScroll', function () { ); expect(viewport.children().length).toBe(4); - - var row2 = viewport.children()[1]; - expect(row2.tagName.toLowerCase()).toBe('div'); - expect(row2.innerHTML).toBe('1: two'); - - var row3 = viewport.children()[2]; - expect(row3.tagName.toLowerCase()).toBe('div'); - expect(row3.innerHTML).toBe('2: three'); + expect(Helper.getRow(viewport, 1)).toBe('1: two'); + expect(Helper.getRow(viewport, 2)).toBe('2: three'); expect(scope.adapter).toBeTruthy(); expect(scope.adapter.topVisibleElement[0].innerHTML).toBe('1: two'); @@ -242,14 +187,8 @@ describe('uiScroll', function () { ); expect(viewport.children().length).toBe(4); - - var row1 = viewport.children()[1]; - expect(row1.tagName.toLowerCase()).toBe('div'); - expect(row1.innerHTML).toBe('1: one'); - - var row2 = viewport.children()[2]; - expect(row2.tagName.toLowerCase()).toBe('div'); - expect(row2.innerHTML).toBe('2: three'); + expect(Helper.getRow(viewport, 1)).toBe('1: one'); + expect(Helper.getRow(viewport, 2)).toBe('2: three'); expect(scope.adapter).toBeTruthy(); expect(scope.adapter.topVisibleElement[0].innerHTML).toBe('1: one'); @@ -283,14 +222,8 @@ describe('uiScroll', function () { ); expect(viewport.children().length).toBe(4); - - var row1 = viewport.children()[1]; - expect(row1.tagName.toLowerCase()).toBe('div'); - expect(row1.innerHTML).toBe('1: one'); - - var row2 = viewport.children()[2]; - expect(row2.tagName.toLowerCase()).toBe('div'); - expect(row2.innerHTML).toBe('2: two'); + expect(Helper.getRow(viewport, 1)).toBe('1: one'); + expect(Helper.getRow(viewport, 2)).toBe('2: two'); expect(scope.adapter).toBeTruthy(); expect(scope.adapter.topVisibleElement[0].innerHTML).toBe('1: one'); @@ -326,22 +259,10 @@ describe('uiScroll', function () { ); expect(viewport.children().length).toBe(6); - - var row0 = viewport.children()[1]; - expect(row0.tagName.toLowerCase()).toBe('div'); - expect(row0.innerHTML).toBe('0: before one'); - - var row1 = viewport.children()[2]; - expect(row1.tagName.toLowerCase()).toBe('div'); - expect(row1.innerHTML).toBe('1: one'); - - var row2 = viewport.children()[3]; - expect(row2.tagName.toLowerCase()).toBe('div'); - expect(row2.innerHTML).toBe('2: two'); - - var row3 = viewport.children()[4]; - expect(row3.tagName.toLowerCase()).toBe('div'); - expect(row3.innerHTML).toBe('3: three'); + expect(Helper.getRow(viewport, 1)).toBe('0: before one'); + expect(Helper.getRow(viewport, 2)).toBe('1: one'); + expect(Helper.getRow(viewport, 3)).toBe('2: two'); + expect(Helper.getRow(viewport, 4)).toBe('3: three'); expect(scope.adapter).toBeTruthy(); expect(scope.adapter.topVisibleElement[0].innerHTML).toBe('0: before one'); @@ -364,22 +285,10 @@ describe('uiScroll', function () { ); expect(viewport.children().length).toBe(6); - - var row0 = viewport.children()[1]; - expect(row0.tagName.toLowerCase()).toBe('div'); - expect(row0.innerHTML).toBe('1: before one'); - - var row1 = viewport.children()[2]; - expect(row1.tagName.toLowerCase()).toBe('div'); - expect(row1.innerHTML).toBe('2: one'); - - var row2 = viewport.children()[3]; - expect(row2.tagName.toLowerCase()).toBe('div'); - expect(row2.innerHTML).toBe('3: two'); - - var row3 = viewport.children()[4]; - expect(row3.tagName.toLowerCase()).toBe('div'); - expect(row3.innerHTML).toBe('4: three'); + expect(Helper.getRow(viewport, 1)).toBe('1: before one'); + expect(Helper.getRow(viewport, 2)).toBe('2: one'); + expect(Helper.getRow(viewport, 3)).toBe('3: two'); + expect(Helper.getRow(viewport, 4)).toBe('4: three'); expect(scope.adapter).toBeTruthy(); expect(scope.adapter.topVisibleElement[0].innerHTML).toBe('1: before one'); @@ -399,22 +308,10 @@ describe('uiScroll', function () { ); expect(viewport.children().length).toBe(6); - - var row0 = viewport.children()[1]; - expect(row0.tagName.toLowerCase()).toBe('div'); - expect(row0.innerHTML).toBe('1: one'); - - var row1 = viewport.children()[2]; - expect(row1.tagName.toLowerCase()).toBe('div'); - expect(row1.innerHTML).toBe('2: after one'); - - var row2 = viewport.children()[3]; - expect(row2.tagName.toLowerCase()).toBe('div'); - expect(row2.innerHTML).toBe('3: two'); - - var row3 = viewport.children()[4]; - expect(row3.tagName.toLowerCase()).toBe('div'); - expect(row3.innerHTML).toBe('4: three'); + expect(Helper.getRow(viewport, 1)).toBe('1: one'); + expect(Helper.getRow(viewport, 2)).toBe('2: after one'); + expect(Helper.getRow(viewport, 3)).toBe('3: two'); + expect(Helper.getRow(viewport, 4)).toBe('4: three'); expect(scope.adapter).toBeTruthy(); expect(scope.adapter.topVisibleElement[0].innerHTML).toBe('1: one'); @@ -450,22 +347,10 @@ describe('uiScroll', function () { ); expect(viewport.children().length).toBe(6); - - var row0 = viewport.children()[1]; - expect(row0.tagName.toLowerCase()).toBe('div'); - expect(row0.innerHTML).toBe('1: one'); - - var row1 = viewport.children()[2]; - expect(row1.tagName.toLowerCase()).toBe('div'); - expect(row1.innerHTML).toBe('2: before two'); - - var row2 = viewport.children()[3]; - expect(row2.tagName.toLowerCase()).toBe('div'); - expect(row2.innerHTML).toBe('3: two'); - - var row3 = viewport.children()[4]; - expect(row3.tagName.toLowerCase()).toBe('div'); - expect(row3.innerHTML).toBe('4: three'); + expect(Helper.getRow(viewport, 1)).toBe('1: one'); + expect(Helper.getRow(viewport, 2)).toBe('2: before two'); + expect(Helper.getRow(viewport, 3)).toBe('3: two'); + expect(Helper.getRow(viewport, 4)).toBe('4: three'); expect(scope.adapter).toBeTruthy(); expect(scope.adapter.topVisibleElement[0].innerHTML).toBe('1: one'); @@ -499,22 +384,10 @@ describe('uiScroll', function () { ); expect(viewport.children().length).toBe(6); - - var row0 = viewport.children()[1]; - expect(row0.tagName.toLowerCase()).toBe('div'); - expect(row0.innerHTML).toBe('1: one'); - - var row1 = viewport.children()[2]; - expect(row1.tagName.toLowerCase()).toBe('div'); - expect(row1.innerHTML).toBe('2: two'); - - var row2 = viewport.children()[3]; - expect(row2.tagName.toLowerCase()).toBe('div'); - expect(row2.innerHTML).toBe('3: three'); - - var row3 = viewport.children()[4]; - expect(row3.tagName.toLowerCase()).toBe('div'); - expect(row3.innerHTML).toBe('4: after three'); + expect(Helper.getRow(viewport, 1)).toBe('1: one'); + expect(Helper.getRow(viewport, 2)).toBe('2: two'); + expect(Helper.getRow(viewport, 3)).toBe('3: three'); + expect(Helper.getRow(viewport, 4)).toBe('4: after three'); expect(scope.adapter).toBeTruthy(); expect(scope.adapter.topVisibleElement[0].innerHTML).toBe('1: one'); @@ -548,18 +421,9 @@ describe('uiScroll', function () { scope.adapter.applyUpdates(1, ['one *1']); expect(viewport.children().length).toBe(5); - - var row1 = viewport.children()[1]; - expect(row1.tagName.toLowerCase()).toBe('div'); - expect(row1.innerHTML).toBe('1: one *1'); - - var row2 = viewport.children()[2]; - expect(row2.tagName.toLowerCase()).toBe('div'); - expect(row2.innerHTML).toBe('2: two'); - - var row3 = viewport.children()[3]; - expect(row3.tagName.toLowerCase()).toBe('div'); - expect(row3.innerHTML).toBe('3: three'); + expect(Helper.getRow(viewport, 1)).toBe('1: one *1'); + expect(Helper.getRow(viewport, 2)).toBe('2: two'); + expect(Helper.getRow(viewport, 3)).toBe('3: three'); expect(scope.adapter).toBeTruthy(); expect(scope.adapter.topVisibleElement[0].innerHTML).toBe('1: one *1'); @@ -575,18 +439,9 @@ describe('uiScroll', function () { scope.adapter.applyUpdates(0, ['invalid']); expect(viewport.children().length).toBe(5); - - var row1 = viewport.children()[1]; - expect(row1.tagName.toLowerCase()).toBe('div'); - expect(row1.innerHTML).toBe('1: one'); - - var row2 = viewport.children()[2]; - expect(row2.tagName.toLowerCase()).toBe('div'); - expect(row2.innerHTML).toBe('2: two'); - - var row3 = viewport.children()[3]; - expect(row3.tagName.toLowerCase()).toBe('div'); - expect(row3.innerHTML).toBe('3: three'); + expect(Helper.getRow(viewport, 1)).toBe('1: one'); + expect(Helper.getRow(viewport, 2)).toBe('2: two'); + expect(Helper.getRow(viewport, 3)).toBe('3: three'); expect(scope.adapter).toBeTruthy(); expect(scope.adapter.topVisibleElement[0].innerHTML).toBe('1: one'); @@ -602,18 +457,9 @@ describe('uiScroll', function () { scope.adapter.applyUpdates(4, ['invalid']); expect(viewport.children().length).toBe(5); - - var row1 = viewport.children()[1]; - expect(row1.tagName.toLowerCase()).toBe('div'); - expect(row1.innerHTML).toBe('1: one'); - - var row2 = viewport.children()[2]; - expect(row2.tagName.toLowerCase()).toBe('div'); - expect(row2.innerHTML).toBe('2: two'); - - var row3 = viewport.children()[3]; - expect(row3.tagName.toLowerCase()).toBe('div'); - expect(row3.innerHTML).toBe('3: three'); + expect(Helper.getRow(viewport, 1)).toBe('1: one'); + expect(Helper.getRow(viewport, 2)).toBe('2: two'); + expect(Helper.getRow(viewport, 3)).toBe('3: three'); expect(scope.adapter).toBeTruthy(); expect(scope.adapter.topVisibleElement[0].innerHTML).toBe('1: one'); @@ -629,18 +475,9 @@ describe('uiScroll', function () { scope.adapter.applyUpdates(2, ['two *2']); expect(viewport.children().length).toBe(5); - - var row1 = viewport.children()[1]; - expect(row1.tagName.toLowerCase()).toBe('div'); - expect(row1.innerHTML).toBe('1: one'); - - var row2 = viewport.children()[2]; - expect(row2.tagName.toLowerCase()).toBe('div'); - expect(row2.innerHTML).toBe('2: two *2'); - - var row3 = viewport.children()[3]; - expect(row3.tagName.toLowerCase()).toBe('div'); - expect(row3.innerHTML).toBe('3: three'); + expect(Helper.getRow(viewport, 1)).toBe('1: one'); + expect(Helper.getRow(viewport, 2)).toBe('2: two *2'); + expect(Helper.getRow(viewport, 3)).toBe('3: three'); expect(scope.adapter).toBeTruthy(); expect(scope.adapter.topVisibleElement[0].innerHTML).toBe('1: one'); @@ -656,18 +493,9 @@ describe('uiScroll', function () { scope.adapter.applyUpdates(3, ['three *3']); expect(viewport.children().length).toBe(5); - - var row1 = viewport.children()[1]; - expect(row1.tagName.toLowerCase()).toBe('div'); - expect(row1.innerHTML).toBe('1: one'); - - var row2 = viewport.children()[2]; - expect(row2.tagName.toLowerCase()).toBe('div'); - expect(row2.innerHTML).toBe('2: two'); - - var row3 = viewport.children()[3]; - expect(row3.tagName.toLowerCase()).toBe('div'); - expect(row3.innerHTML).toBe('3: three *3'); + expect(Helper.getRow(viewport, 1)).toBe('1: one'); + expect(Helper.getRow(viewport, 2)).toBe('2: two'); + expect(Helper.getRow(viewport, 3)).toBe('3: three *3'); expect(scope.adapter).toBeTruthy(); expect(scope.adapter.topVisibleElement[0].innerHTML).toBe('1: one'); @@ -683,14 +511,8 @@ describe('uiScroll', function () { scope.adapter.applyUpdates(1, []); expect(viewport.children().length).toBe(4); - - var row2 = viewport.children()[1]; - expect(row2.tagName.toLowerCase()).toBe('div'); - expect(row2.innerHTML).toBe('2: two'); - - var row3 = viewport.children()[2]; - expect(row3.tagName.toLowerCase()).toBe('div'); - expect(row3.innerHTML).toBe('3: three'); + expect(Helper.getRow(viewport, 1)).toBe('2: two'); + expect(Helper.getRow(viewport, 2)).toBe('3: three'); expect(scope.adapter).toBeTruthy(); expect(scope.adapter.topVisibleElement[0].innerHTML).toBe('2: two'); @@ -708,14 +530,8 @@ describe('uiScroll', function () { scope.adapter.applyUpdates(1, [], { immutableTop: true }); expect(viewport.children().length).toBe(4); - - var row2 = viewport.children()[1]; - expect(row2.tagName.toLowerCase()).toBe('div'); - expect(row2.innerHTML).toBe('1: two'); - - var row3 = viewport.children()[2]; - expect(row3.tagName.toLowerCase()).toBe('div'); - expect(row3.innerHTML).toBe('2: three'); + expect(Helper.getRow(viewport, 1)).toBe('1: two'); + expect(Helper.getRow(viewport, 2)).toBe('2: three'); expect(scope.adapter).toBeTruthy(); expect(scope.adapter.topVisibleElement[0].innerHTML).toBe('1: two'); @@ -728,14 +544,8 @@ describe('uiScroll', function () { scope.adapter.applyUpdates(2, [], options); expect(viewport.children().length).toBe(4); - - var row1 = viewport.children()[1]; - expect(row1.tagName.toLowerCase()).toBe('div'); - expect(row1.innerHTML).toBe('1: one'); - - var row2 = viewport.children()[2]; - expect(row2.tagName.toLowerCase()).toBe('div'); - expect(row2.innerHTML).toBe('2: three'); + expect(Helper.getRow(viewport, 1)).toBe('1: one'); + expect(Helper.getRow(viewport, 2)).toBe('2: three'); expect(scope.adapter).toBeTruthy(); expect(scope.adapter.topVisibleElement[0].innerHTML).toBe('1: one'); @@ -758,14 +568,8 @@ describe('uiScroll', function () { scope.adapter.applyUpdates(3, []); expect(viewport.children().length).toBe(4); - - var row1 = viewport.children()[1]; - expect(row1.tagName.toLowerCase()).toBe('div'); - expect(row1.innerHTML).toBe('1: one'); - - var row2 = viewport.children()[2]; - expect(row2.tagName.toLowerCase()).toBe('div'); - expect(row2.innerHTML).toBe('2: two'); + expect(Helper.getRow(viewport, 1)).toBe('1: one'); + expect(Helper.getRow(viewport, 2)).toBe('2: two'); expect(scope.adapter).toBeTruthy(); expect(scope.adapter.topVisibleElement[0].innerHTML).toBe('1: one'); @@ -791,22 +595,10 @@ describe('uiScroll', function () { scope.adapter.applyUpdates(1, ['before one', 'one']); expect(viewport.children().length).toBe(6); - - var row0 = viewport.children()[1]; - expect(row0.tagName.toLowerCase()).toBe('div'); - expect(row0.innerHTML).toBe('0: before one'); - - var row1 = viewport.children()[2]; - expect(row1.tagName.toLowerCase()).toBe('div'); - expect(row1.innerHTML).toBe('1: one'); - - var row2 = viewport.children()[3]; - expect(row2.tagName.toLowerCase()).toBe('div'); - expect(row2.innerHTML).toBe('2: two'); - - var row3 = viewport.children()[4]; - expect(row3.tagName.toLowerCase()).toBe('div'); - expect(row3.innerHTML).toBe('3: three'); + expect(Helper.getRow(viewport, 1)).toBe('0: before one'); + expect(Helper.getRow(viewport, 2)).toBe('1: one'); + expect(Helper.getRow(viewport, 3)).toBe('2: two'); + expect(Helper.getRow(viewport, 4)).toBe('3: three'); expect(scope.adapter).toBeTruthy(); expect(scope.adapter.topVisibleElement[0].innerHTML).toBe('0: before one'); @@ -824,22 +616,10 @@ describe('uiScroll', function () { scope.adapter.applyUpdates(1, ['before one', 'one'], { immutableTop: true }); expect(viewport.children().length).toBe(6); - - var row0 = viewport.children()[1]; - expect(row0.tagName.toLowerCase()).toBe('div'); - expect(row0.innerHTML).toBe('1: before one'); - - var row1 = viewport.children()[2]; - expect(row1.tagName.toLowerCase()).toBe('div'); - expect(row1.innerHTML).toBe('2: one'); - - var row2 = viewport.children()[3]; - expect(row2.tagName.toLowerCase()).toBe('div'); - expect(row2.innerHTML).toBe('3: two'); - - var row3 = viewport.children()[4]; - expect(row3.tagName.toLowerCase()).toBe('div'); - expect(row3.innerHTML).toBe('4: three'); + expect(Helper.getRow(viewport, 1)).toBe('1: before one'); + expect(Helper.getRow(viewport, 2)).toBe('2: one'); + expect(Helper.getRow(viewport, 3)).toBe('3: two'); + expect(Helper.getRow(viewport, 4)).toBe('4: three'); expect(scope.adapter).toBeTruthy(); expect(scope.adapter.topVisibleElement[0].innerHTML).toBe('1: before one'); @@ -852,22 +632,10 @@ describe('uiScroll', function () { scope.adapter.applyUpdates(1, ['one', 'after one'], options); expect(viewport.children().length).toBe(6); - - var row0 = viewport.children()[1]; - expect(row0.tagName.toLowerCase()).toBe('div'); - expect(row0.innerHTML).toBe('1: one'); - - var row1 = viewport.children()[2]; - expect(row1.tagName.toLowerCase()).toBe('div'); - expect(row1.innerHTML).toBe('2: after one'); - - var row2 = viewport.children()[3]; - expect(row2.tagName.toLowerCase()).toBe('div'); - expect(row2.innerHTML).toBe('3: two'); - - var row3 = viewport.children()[4]; - expect(row3.tagName.toLowerCase()).toBe('div'); - expect(row3.innerHTML).toBe('4: three'); + expect(Helper.getRow(viewport, 1)).toBe('1: one'); + expect(Helper.getRow(viewport, 2)).toBe('2: after one'); + expect(Helper.getRow(viewport, 3)).toBe('3: two'); + expect(Helper.getRow(viewport, 4)).toBe('4: three'); expect(scope.adapter).toBeTruthy(); expect(scope.adapter.topVisibleElement[0].innerHTML).toBe('1: one'); @@ -894,22 +662,10 @@ describe('uiScroll', function () { scope.adapter.applyUpdates(2, ['before two', 'two'], options); expect(viewport.children().length).toBe(6); - - var row0 = viewport.children()[1]; - expect(row0.tagName.toLowerCase()).toBe('div'); - expect(row0.innerHTML).toBe('1: one'); - - var row1 = viewport.children()[2]; - expect(row1.tagName.toLowerCase()).toBe('div'); - expect(row1.innerHTML).toBe('2: before two'); - - var row2 = viewport.children()[3]; - expect(row2.tagName.toLowerCase()).toBe('div'); - expect(row2.innerHTML).toBe('3: two'); - - var row3 = viewport.children()[4]; - expect(row3.tagName.toLowerCase()).toBe('div'); - expect(row3.innerHTML).toBe('4: three'); + expect(Helper.getRow(viewport, 1)).toBe('1: one'); + expect(Helper.getRow(viewport, 2)).toBe('2: before two'); + expect(Helper.getRow(viewport, 3)).toBe('3: two'); + expect(Helper.getRow(viewport, 4)).toBe('4: three'); expect(scope.adapter).toBeTruthy(); expect(scope.adapter.topVisibleElement[0].innerHTML).toBe('1: one'); @@ -936,22 +692,10 @@ describe('uiScroll', function () { scope.adapter.applyUpdates(3, ['three', 'after three'], options); expect(viewport.children().length).toBe(6); - - var row0 = viewport.children()[1]; - expect(row0.tagName.toLowerCase()).toBe('div'); - expect(row0.innerHTML).toBe('1: one'); - - var row1 = viewport.children()[2]; - expect(row1.tagName.toLowerCase()).toBe('div'); - expect(row1.innerHTML).toBe('2: two'); - - var row2 = viewport.children()[3]; - expect(row2.tagName.toLowerCase()).toBe('div'); - expect(row2.innerHTML).toBe('3: three'); - - var row3 = viewport.children()[4]; - expect(row3.tagName.toLowerCase()).toBe('div'); - expect(row3.innerHTML).toBe('4: after three'); + expect(Helper.getRow(viewport, 1)).toBe('1: one'); + expect(Helper.getRow(viewport, 2)).toBe('2: two'); + expect(Helper.getRow(viewport, 3)).toBe('3: three'); + expect(Helper.getRow(viewport, 4)).toBe('4: after three'); expect(scope.adapter).toBeTruthy(); expect(scope.adapter.topVisibleElement[0].innerHTML).toBe('1: one'); @@ -993,17 +737,9 @@ describe('uiScroll', function () { ); expect(viewport.children().length).toBe(5); - var row1 = viewport.children()[1]; - expect(row1.tagName.toLowerCase()).toBe('div'); - expect(row1.innerHTML).toBe('1: one *1'); - - var row2 = viewport.children()[2]; - expect(row2.tagName.toLowerCase()).toBe('div'); - expect(row2.innerHTML).toBe('2: two *2'); - - var row3 = viewport.children()[3]; - expect(row3.tagName.toLowerCase()).toBe('div'); - expect(row3.innerHTML).toBe('3: three *3'); + expect(Helper.getRow(viewport, 1)).toBe('1: one *1'); + expect(Helper.getRow(viewport, 2)).toBe('2: two *2'); + expect(Helper.getRow(viewport, 3)).toBe('3: three *3'); expect(scope.adapter).toBeTruthy(); expect(scope.adapter.topVisibleElement[0].innerHTML).toBe('1: one *1'); @@ -1027,18 +763,9 @@ describe('uiScroll', function () { ); expect(viewport.children().length).toBe(5); - var row1 = viewport.children()[1]; - expect(row1.tagName.toLowerCase()).toBe('div'); - expect(row1.innerHTML).toBe('1: one *1'); - - var row2 = viewport.children()[2]; - expect(row2.tagName.toLowerCase()).toBe('div'); - expect(row2.innerHTML).toBe('2: two *2'); - - var row3 = viewport.children()[3]; - expect(row3.tagName.toLowerCase()).toBe('div'); - expect(row3.innerHTML).toBe('3: three *3'); - + expect(Helper.getRow(viewport, 1)).toBe('1: one *1'); + expect(Helper.getRow(viewport, 2)).toBe('2: two *2'); + expect(Helper.getRow(viewport, 3)).toBe('3: three *3'); expect(scope.adapter).toBeTruthy(); expect(scope.adapter.topVisibleElement[0].innerHTML).toBe('1: one *1'); @@ -1067,35 +794,13 @@ describe('uiScroll', function () { ); expect(viewport.children().length).toBe(9); - var row1, row2, row3; - - row1 = viewport.children()[1]; - expect(row1.tagName.toLowerCase()).toBe('div'); - expect(row1.innerHTML).toBe('-1: one *1 before 1'); - - row1 = viewport.children()[2]; - expect(row1.tagName.toLowerCase()).toBe('div'); - expect(row1.innerHTML).toBe('0: one *1 before 2'); - - row1 = viewport.children()[3]; - expect(row1.tagName.toLowerCase()).toBe('div'); - expect(row1.innerHTML).toBe('1: one *1'); - - row1 = viewport.children()[4]; - expect(row1.tagName.toLowerCase()).toBe('div'); - expect(row1.innerHTML).toBe('2: one *1 after 1'); - - row1 = viewport.children()[5]; - expect(row1.tagName.toLowerCase()).toBe('div'); - expect(row1.innerHTML).toBe('3: one *1 after 2'); - - row2 = viewport.children()[6]; - expect(row2.tagName.toLowerCase()).toBe('div'); - expect(row2.innerHTML).toBe('4: two'); - - row3 = viewport.children()[7]; - expect(row3.tagName.toLowerCase()).toBe('div'); - expect(row3.innerHTML).toBe('5: three'); + expect(Helper.getRow(viewport, 1)).toBe('-1: one *1 before 1'); + expect(Helper.getRow(viewport, 2)).toBe('0: one *1 before 2'); + expect(Helper.getRow(viewport, 3)).toBe('1: one *1'); + expect(Helper.getRow(viewport, 4)).toBe('2: one *1 after 1'); + expect(Helper.getRow(viewport, 5)).toBe('3: one *1 after 2'); + expect(Helper.getRow(viewport, 6)).toBe('4: two'); + expect(Helper.getRow(viewport, 7)).toBe('5: three'); expect(scope.adapter).toBeTruthy(); expect(scope.adapter.topVisibleElement[0].innerHTML).toBe('-1: one *1 before 1'); @@ -1124,35 +829,13 @@ describe('uiScroll', function () { ); expect(viewport.children().length).toBe(9); - var row1, row2, row3; - - row1 = viewport.children()[1]; - expect(row1.tagName.toLowerCase()).toBe('div'); - expect(row1.innerHTML).toBe('1: one'); - - row1 = viewport.children()[2]; - expect(row1.tagName.toLowerCase()).toBe('div'); - expect(row1.innerHTML).toBe('2: two *2 before 1'); - - row1 = viewport.children()[3]; - expect(row1.tagName.toLowerCase()).toBe('div'); - expect(row1.innerHTML).toBe('3: two *2 before 2'); - - row2 = viewport.children()[4]; - expect(row2.tagName.toLowerCase()).toBe('div'); - expect(row2.innerHTML).toBe('4: two *2'); - - row1 = viewport.children()[5]; - expect(row1.tagName.toLowerCase()).toBe('div'); - expect(row1.innerHTML).toBe('5: two *2 after 1'); - - row1 = viewport.children()[6]; - expect(row1.tagName.toLowerCase()).toBe('div'); - expect(row1.innerHTML).toBe('6: two *2 after 2'); - - row3 = viewport.children()[7]; - expect(row3.tagName.toLowerCase()).toBe('div'); - expect(row3.innerHTML).toBe('7: three'); + expect(Helper.getRow(viewport, 1)).toBe('1: one'); + expect(Helper.getRow(viewport, 2)).toBe('2: two *2 before 1'); + expect(Helper.getRow(viewport, 3)).toBe('3: two *2 before 2'); + expect(Helper.getRow(viewport, 4)).toBe('4: two *2'); + expect(Helper.getRow(viewport, 5)).toBe('5: two *2 after 1'); + expect(Helper.getRow(viewport, 6)).toBe('6: two *2 after 2'); + expect(Helper.getRow(viewport, 7)).toBe('7: three'); expect(scope.adapter).toBeTruthy(); expect(scope.adapter.topVisibleElement[0].innerHTML).toBe('1: one'); @@ -1171,26 +854,11 @@ describe('uiScroll', function () { scope.adapter.append(['appended one', 'appended two']); expect(viewport.children().length).toBe(7); - - var row1 = viewport.children()[1]; - expect(row1.tagName.toLowerCase()).toBe('div'); - expect(row1.innerHTML).toBe('1: one'); - - var row2 = viewport.children()[2]; - expect(row2.tagName.toLowerCase()).toBe('div'); - expect(row2.innerHTML).toBe('2: two'); - - var row3 = viewport.children()[3]; - expect(row3.tagName.toLowerCase()).toBe('div'); - expect(row3.innerHTML).toBe('3: three'); - - var row4 = viewport.children()[4]; - expect(row4.tagName.toLowerCase()).toBe('div'); - expect(row4.innerHTML).toBe('4: appended one'); - - var row5 = viewport.children()[5]; - expect(row5.tagName.toLowerCase()).toBe('div'); - expect(row5.innerHTML).toBe('5: appended two'); + expect(Helper.getRow(viewport, 1)).toBe('1: one'); + expect(Helper.getRow(viewport, 2)).toBe('2: two'); + expect(Helper.getRow(viewport, 3)).toBe('3: three'); + expect(Helper.getRow(viewport, 4)).toBe('4: appended one'); + expect(Helper.getRow(viewport, 5)).toBe('5: appended two'); expect(scope.adapter).toBeTruthy(); expect(scope.adapter.topVisibleElement[0].innerHTML).toBe('1: one'); @@ -1206,14 +874,8 @@ describe('uiScroll', function () { scope.adapter.append(['appended one', 'appended two']); expect(viewport.children().length).toBe(4); - - var row4 = viewport.children()[1]; - expect(row4.tagName.toLowerCase()).toBe('div'); - expect(row4.innerHTML).toBe('1: appended one'); - - var row5 = viewport.children()[2]; - expect(row5.tagName.toLowerCase()).toBe('div'); - expect(row5.innerHTML).toBe('2: appended two'); + expect(Helper.getRow(viewport, 1)).toBe('1: appended one'); + expect(Helper.getRow(viewport, 2)).toBe('2: appended two'); expect(scope.adapter).toBeTruthy(); expect(scope.adapter.topVisibleElement[0].innerHTML).toBe('1: appended one'); @@ -1233,26 +895,11 @@ describe('uiScroll', function () { scope.adapter.prepend(['prepended one', 'prepended two']); expect(viewport.children().length).toBe(7); - - var row4 = viewport.children()[1]; - expect(row4.tagName.toLowerCase()).toBe('div'); - expect(row4.innerHTML).toBe('-1: prepended one'); - - var row5 = viewport.children()[2]; - expect(row5.tagName.toLowerCase()).toBe('div'); - expect(row5.innerHTML).toBe('0: prepended two'); - - var row1 = viewport.children()[3]; - expect(row1.tagName.toLowerCase()).toBe('div'); - expect(row1.innerHTML).toBe('1: one'); - - var row2 = viewport.children()[4]; - expect(row2.tagName.toLowerCase()).toBe('div'); - expect(row2.innerHTML).toBe('2: two'); - - var row3 = viewport.children()[5]; - expect(row3.tagName.toLowerCase()).toBe('div'); - expect(row3.innerHTML).toBe('3: three'); + expect(Helper.getRow(viewport, 1)).toBe('-1: prepended one'); + expect(Helper.getRow(viewport, 2)).toBe('0: prepended two'); + expect(Helper.getRow(viewport, 3)).toBe('1: one'); + expect(Helper.getRow(viewport, 4)).toBe('2: two'); + expect(Helper.getRow(viewport, 5)).toBe('3: three'); expect(scope.adapter).toBeTruthy(); expect(scope.adapter.topVisibleElement[0].innerHTML).toBe('-1: prepended one'); @@ -1268,11 +915,11 @@ describe('uiScroll', function () { scope.adapter.prepend(['prepended one', 'prepended two'], { immutableTop: true }); expect(viewport.children().length).toBe(7); - expect(viewport.children()[1].innerHTML).toBe('1: prepended one'); - expect(viewport.children()[2].innerHTML).toBe('2: prepended two'); - expect(viewport.children()[3].innerHTML).toBe('3: one'); - expect(viewport.children()[4].innerHTML).toBe('4: two'); - expect(viewport.children()[5].innerHTML).toBe('5: three'); + expect(Helper.getRow(viewport, 1)).toBe('1: prepended one'); + expect(Helper.getRow(viewport, 2)).toBe('2: prepended two'); + expect(Helper.getRow(viewport, 3)).toBe('3: one'); + expect(Helper.getRow(viewport, 4)).toBe('4: two'); + expect(Helper.getRow(viewport, 5)).toBe('5: three'); expect(scope.adapter).toBeTruthy(); expect(scope.adapter.topVisibleElement[0].innerHTML).toBe('1: prepended one'); @@ -1288,14 +935,8 @@ describe('uiScroll', function () { scope.adapter.prepend(['prepended one', 'prepended two']); expect(viewport.children().length).toBe(4); - - var row4 = viewport.children()[1]; - expect(row4.tagName.toLowerCase()).toBe('div'); - expect(row4.innerHTML).toBe('-1: prepended one'); - - var row5 = viewport.children()[2]; - expect(row5.tagName.toLowerCase()).toBe('div'); - expect(row5.innerHTML).toBe('0: prepended two'); + expect(Helper.getRow(viewport, 1)).toBe('-1: prepended one'); + expect(Helper.getRow(viewport, 2)).toBe('0: prepended two'); expect(scope.adapter).toBeTruthy(); expect(scope.adapter.topVisibleElement[0].innerHTML).toBe('-1: prepended one'); @@ -1311,8 +952,8 @@ describe('uiScroll', function () { scope.adapter.prepend(['prepended one', 'prepended two'], { immutableTop: true }); expect(viewport.children().length).toBe(4); - expect(viewport.children()[1].innerHTML).toBe('1: prepended one'); - expect(viewport.children()[2].innerHTML).toBe('2: prepended two'); + expect(Helper.getRow(viewport, 1)).toBe('1: prepended one'); + expect(Helper.getRow(viewport, 2)).toBe('2: prepended two'); expect(scope.adapter).toBeTruthy(); expect(scope.adapter.topVisibleElement[0].innerHTML).toBe('1: prepended one'); @@ -1516,9 +1157,7 @@ describe('uiScroll', function () { scope.adapter.append(['item1*', 'item2*', 'item3*']); expect(scope.adapter.isEOF()).toBe(true); expect(viewport.children().length).toBe(2 + 3 + 3); - - var lastRow = viewport.children()[viewport.children().length - 2]; - expect(lastRow.innerHTML).toBe('6: item3*'); + expect(Helper.getLastRow(viewport)).toBe('6: item3*'); } ); }); @@ -1534,9 +1173,7 @@ describe('uiScroll', function () { viewport.scrollTop(10000); expect(scope.adapter.isEOF()).toBe(true); expect(viewport.children().length).toBe(2 + 3 + 3); - - var lastRow = viewport.children()[viewport.children().length - 2]; - expect(lastRow.innerHTML).toBe('6: item3*'); + expect(Helper.getLastRow(viewport)).toBe('6: item3*'); } ); }); @@ -1556,11 +1193,8 @@ describe('uiScroll', function () { scope.adapter.append(['item7*', 'item8*', 'item9*', 'item10*']); expect(viewport.children().length).toBe(2 + 3 + 3 + 3); - var firstRow = viewport.children()[1]; - expect(firstRow.innerHTML).toBe('4: item1*'); - - var lastRow = viewport.children()[viewport.children().length - 2]; - expect(lastRow.innerHTML).toBe('12: item9*'); + expect(Helper.getFirstRow(viewport)).toBe('4: item1*'); + expect(Helper.getLastRow(viewport)).toBe('12: item9*'); } ); }); @@ -1574,7 +1208,9 @@ describe('uiScroll', function () { runTest(scrollSettings, function (viewport, scope) { expect(scope.adapter.bufferFirst).toBe('item1'); + expect(Helper.getFirstRow(viewport)).toBe('1: item1'); expect(scope.adapter.bufferLast).toBe('item10'); + expect(Helper.getLastRow(viewport)).toBe('10: item10'); expect(scope.adapter.bufferLength).toBe(10); } ); @@ -1582,15 +1218,16 @@ describe('uiScroll', function () { it('scroll to the bottom', function () { runTest(scrollSettings, - function (viewport, scope) { + function (viewport, scope) { viewport.scrollTop(10000); expect(scope.adapter.bufferFirst).toBe('item5'); + expect(Helper.getFirstRow(viewport)).toBe('5: item5'); expect(scope.adapter.bufferLast).toBe('item20'); + expect(Helper.getLastRow(viewport)).toBe('20: item20'); expect(scope.adapter.bufferLength).toBe(16); } ); }); - }); }); diff --git a/test/BufferCleanupSpec.js b/test/BufferCleanupSpec.js new file mode 100644 index 0000000..7130abc --- /dev/null +++ b/test/BufferCleanupSpec.js @@ -0,0 +1,209 @@ +describe('uiScroll', () => { + 'use strict'; + + let datasource; + beforeEach(module('ui.scroll')); + beforeEach(module('ui.scroll.test.datasources')); + + const injectDatasource = datasourceToken => + beforeEach( + inject([datasourceToken, _datasource => + datasource = _datasource + ]) + ); + + describe('buffer cleanup', () => { + const settings = { + datasource: 'myEdgeDatasource', // items range is [-5..6] + adapter: 'adapter', + viewportHeight: 60, + itemHeight: 20, + padding: 0.3, + startIndex: 3, + bufferSize: 3 + }; + + injectDatasource('myEdgeDatasource'); + + const cleanBuffer = (scope, applyUpdateOptions) => { + const get = datasource.get; + const removedItems = []; + // sync the datasource + datasource.get = (index, count, success) => { + if (removedItems.indexOf('item' + index) !== -1) { + index += removedItems.length; + } + get(index, count, success); + }; + // clean up the buffer + scope.adapter.applyUpdates(item => { + removedItems.push(item); + return []; + }, applyUpdateOptions); + }; + + const shouldWorkWhenEOF = (viewport, scope, options) => { + expect(scope.adapter.isBOF()).toBe(false); + expect(scope.adapter.isEOF()).toBe(true); + expect(scope.adapter.bufferFirst).toBe('item0'); + expect(scope.adapter.bufferLast).toBe('item6'); + + // remove items 0..6 items form -5..6 datasource + cleanBuffer(scope, options); + + // result [-5..-1] + expect(scope.adapter.isBOF()).toBe(true); + expect(scope.adapter.isEOF()).toBe(true); + expect(Helper.getRow(viewport, 1)).toBe('-5: item-5'); + expect(Helper.getRow(viewport, 2)).toBe('-4: item-4'); + expect(Helper.getRow(viewport, 3)).toBe('-3: item-3'); + expect(Helper.getRow(viewport, 4)).toBe('-2: item-2'); + expect(Helper.getRow(viewport, 5)).toBe('-1: item-1'); + expect(scope.adapter.bufferLength).toBe(5); + }; + + it('should be consistent on forward direction when eof with immutabeTop', () => + runTest(settings, (viewport, scope) => + shouldWorkWhenEOF(viewport, scope, { immutableTop: true }) + ) + ); + + it('should be consistent on forward direction when eof without immutabeTop', () => + runTest(settings, (viewport, scope) => + shouldWorkWhenEOF(viewport, scope) + ) + ); + + const shouldWorkWhenNotEOF = (viewport, scope, options) => { + expect(scope.adapter.isBOF()).toBe(false); + expect(scope.adapter.isEOF()).toBe(false); + expect(scope.adapter.bufferFirst).toBe('item-4'); + expect(scope.adapter.bufferLast).toBe('item1'); + + // remove items -4..1 items form -5..6 datasource + cleanBuffer(scope, options); + + // result [-5, 2, 3, 4] + expect(scope.adapter.isBOF()).toBe(true); + expect(scope.adapter.isEOF()).toBe(false); + expect(Helper.getRow(viewport, 1)).toBe('-5: item-5'); + expect(Helper.getRow(viewport, 2)).toBe('-4: item2'); + expect(Helper.getRow(viewport, 3)).toBe('-3: item3'); + expect(Helper.getRow(viewport, 4)).toBe('-2: item4'); + expect(scope.adapter.bufferLength).toBe(4); + }; + + it('should be consistent on forward direction when not eof with immutabeTop', () => + runTest({ + ...settings, + startIndex: -1, + viewportHeight: 40 + }, (viewport, scope) => + shouldWorkWhenNotEOF(viewport, scope, { immutableTop: true }) + ) + ); + + it('should be consistent on forward direction when not eof without immutabeTop', () => + runTest({ + ...settings, + startIndex: -1, + viewportHeight: 40 + }, (viewport, scope) => + shouldWorkWhenNotEOF(viewport, scope) + ) + ); + + it('should be consistent on backward direction when bof with immutableTop', () => + runTest({ + ...settings, + startIndex: -3, + padding: 0.5 + }, (viewport, scope) => { + expect(scope.adapter.isBOF()).toBe(true); + expect(scope.adapter.isEOF()).toBe(false); + expect(scope.adapter.bufferFirst).toBe('item-5'); + expect(scope.adapter.bufferLast).toBe('item1'); + + // remove items -5..1 items form -5..6 datasource + cleanBuffer(scope, { immutableTop: true }); + + // result [2..6] + expect(scope.adapter.isBOF()).toBe(true); + expect(scope.adapter.isEOF()).toBe(true); + expect(Helper.getRow(viewport, 1)).toBe('-5: item2'); + expect(Helper.getRow(viewport, 2)).toBe('-4: item3'); + expect(Helper.getRow(viewport, 3)).toBe('-3: item4'); + expect(Helper.getRow(viewport, 4)).toBe('-2: item5'); + expect(Helper.getRow(viewport, 5)).toBe('-1: item6'); + expect(scope.adapter.bufferLength).toBe(5); + }) + ); + + it('should be consistent on backward direction when bof without immutableTop', () => + runTest({ + ...settings, + startIndex: -3, + padding: 0.5 + }, (viewport, scope) => { + expect(scope.adapter.isBOF()).toBe(true); + expect(scope.adapter.isEOF()).toBe(false); + expect(scope.adapter.bufferFirst).toBe('item-5'); + expect(scope.adapter.bufferLast).toBe('item1'); + + // remove items -5..1 items form -5..6 datasource + cleanBuffer(scope); + + // result [2..6] + expect(scope.adapter.isBOF()).toBe(true); + expect(scope.adapter.isEOF()).toBe(true); + expect(Helper.getRow(viewport, 1)).toBe('2: item2'); + expect(Helper.getRow(viewport, 2)).toBe('3: item3'); + expect(Helper.getRow(viewport, 3)).toBe('4: item4'); + expect(Helper.getRow(viewport, 4)).toBe('5: item5'); + expect(Helper.getRow(viewport, 5)).toBe('6: item6'); + expect(scope.adapter.bufferLength).toBe(5); + }) + ); + + const shouldWorkWhenNotBOF = (viewport, scope, options) => { + expect(scope.adapter.isBOF()).toBe(false); + expect(scope.adapter.isEOF()).toBe(false); + expect(scope.adapter.bufferFirst).toBe('item-4'); + expect(scope.adapter.bufferLast).toBe('item2'); + + // remove items -4..2 items form -5..6 datasource + cleanBuffer(scope, options); + + // result [-5, 3, 4, 5, 6] + expect(scope.adapter.isBOF()).toBe(true); + expect(scope.adapter.isEOF()).toBe(true); + expect(Helper.getRow(viewport, 1)).toBe('-5: item-5'); + expect(Helper.getRow(viewport, 2)).toBe('-4: item3'); + expect(Helper.getRow(viewport, 3)).toBe('-3: item4'); + expect(Helper.getRow(viewport, 4)).toBe('-2: item5'); + expect(Helper.getRow(viewport, 5)).toBe('-1: item6'); + expect(scope.adapter.bufferLength).toBe(5); + }; + + it('should be consistent on backward direction when not bof with immutableTop', () => + runTest({ + ...settings, + startIndex: -1, + padding: 0.3 + }, (viewport, scope) => + shouldWorkWhenNotBOF(viewport, scope, { immutableTop: true }) + ) + ); + + it('should be consistent on backward direction when not bof without immutableTop', () => + runTest({ + ...settings, + startIndex: -1, + padding: 0.3 + }, (viewport, scope) => + shouldWorkWhenNotBOF(viewport, scope) + ) + ); + }); + +}); diff --git a/test/misc/helpers.js b/test/misc/helpers.js index cf272a1..ece545e 100644 --- a/test/misc/helpers.js +++ b/test/misc/helpers.js @@ -17,6 +17,24 @@ let Helper; const viewportChildren = viewport.children(); const bottomPadding = viewportChildren[viewportChildren.length - 1]; return parseInt(bottomPadding.style.height, 10); + }, + + getRow: (viewport, number) => { // number is index + 1 + const viewportChildren = viewport.children(); + if (viewportChildren.length < 2 + number) { + return; + } + return viewportChildren[number].innerHTML; + }, + + getFirstRow: (viewport) => Helper.getRow(viewport, 1), + + getLastRow: (viewport) => { + const viewportChildren = viewport.children(); + if (viewportChildren.length < 3) { + return; + } + return viewportChildren[viewportChildren.length - 2].innerHTML; } }; diff --git a/webpack.config.js b/webpack.config.js index 21466ff..a3dc1e8 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -113,10 +113,12 @@ if (ENV === 'production') { new CleanWebpackPlugin('dist', { root: __dirname }), - new CopyWebpackPlugin([ - { from: 'src/ui-scroll-jqlite.js', to: 'ui-scroll-jqlite.min.js' }, - { from: 'src/ui-scroll-jqlite.js', to: 'ui-scroll-jqlite.js' } - ], { copyUnmodified: true }), + new CopyWebpackPlugin({ + patterns: [ + { from: 'src/ui-scroll-jqlite.js', to: 'ui-scroll-jqlite.min.js' }, + { from: 'src/ui-scroll-jqlite.js', to: 'ui-scroll-jqlite.js' } + ] + }), new webpack.BannerPlugin(getBanner()) ],