From 1a810b29a725700c8c037f747ea89222ed93a07b Mon Sep 17 00:00:00 2001 From: Philip Rieck Date: Fri, 19 Aug 2016 15:31:31 -0500 Subject: [PATCH 1/3] fix null handling --- dist/amd/au-table-pagination.js | 2 +- dist/amd/au-table.js | 11 +++++++---- dist/commonjs/au-table-pagination.js | 2 +- dist/commonjs/au-table.js | 11 +++++++---- dist/es2015/au-table-pagination.js | 2 +- dist/es2015/au-table.js | 11 +++++++---- dist/system/au-table-pagination.js | 2 +- dist/system/au-table.js | 11 +++++++---- src/au-table.js | 13 ++++++++----- 9 files changed, 40 insertions(+), 25 deletions(-) diff --git a/dist/amd/au-table-pagination.js b/dist/amd/au-table-pagination.js index 9d5f0ec..d54858b 100644 --- a/dist/amd/au-table-pagination.js +++ b/dist/amd/au-table-pagination.js @@ -57,7 +57,7 @@ define(["exports", "aurelia-framework"], function (exports, _aureliaFramework) { var _dec, _desc, _value, _class, _descriptor, _descriptor2, _descriptor3, _descriptor4; - var AutPaginationCustomElement = exports.AutPaginationCustomElement = (_dec = (0, _aureliaFramework.bindable)({defaultBindingMode: _aureliaFramework.bindingMode.twoWay}), (_class = function () { + var AutPaginationCustomElement = exports.AutPaginationCustomElement = (_dec = (0, _aureliaFramework.bindable)({ defaultBindingMode: _aureliaFramework.bindingMode.twoWay }), (_class = function () { function AutPaginationCustomElement() { _classCallCheck(this, AutPaginationCustomElement); diff --git a/dist/amd/au-table.js b/dist/amd/au-table.js index ec4718b..ddf42f2 100644 --- a/dist/amd/au-table.js +++ b/dist/amd/au-table.js @@ -183,11 +183,14 @@ define(["exports", "aurelia-framework"], function (exports, _aureliaFramework) { var key = _ref2; - var value = next[key].toString(); - if (value.toLowerCase().indexOf(this.filterText.toLowerCase()) > -1) { - filteredData.push(next); - break; + if (next[key]) { + var value = next[key].toString().toLowerCase(); + + if (value.indexOf(this.filterText.toLowerCase()) > -1) { + filteredData.push(next); + break; + } } } } diff --git a/dist/commonjs/au-table-pagination.js b/dist/commonjs/au-table-pagination.js index 9bc38cb..eaaa22c 100644 --- a/dist/commonjs/au-table-pagination.js +++ b/dist/commonjs/au-table-pagination.js @@ -54,7 +54,7 @@ function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.'); } -var AutPaginationCustomElement = exports.AutPaginationCustomElement = (_dec = (0, _aureliaFramework.bindable)({defaultBindingMode: _aureliaFramework.bindingMode.twoWay}), (_class = function () { +var AutPaginationCustomElement = exports.AutPaginationCustomElement = (_dec = (0, _aureliaFramework.bindable)({ defaultBindingMode: _aureliaFramework.bindingMode.twoWay }), (_class = function () { function AutPaginationCustomElement() { _classCallCheck(this, AutPaginationCustomElement); diff --git a/dist/commonjs/au-table.js b/dist/commonjs/au-table.js index 69e3bcf..4debad3 100644 --- a/dist/commonjs/au-table.js +++ b/dist/commonjs/au-table.js @@ -180,11 +180,14 @@ var AureliaTableCustomAttribute = exports.AureliaTableCustomAttribute = (_dec = var key = _ref2; - var value = next[key].toString(); - if (value.toLowerCase().indexOf(this.filterText.toLowerCase()) > -1) { - filteredData.push(next); - break; + if (next[key]) { + var value = next[key].toString().toLowerCase(); + + if (value.indexOf(this.filterText.toLowerCase()) > -1) { + filteredData.push(next); + break; + } } } } diff --git a/dist/es2015/au-table-pagination.js b/dist/es2015/au-table-pagination.js index 5045d7e..9eed9d5 100644 --- a/dist/es2015/au-table-pagination.js +++ b/dist/es2015/au-table-pagination.js @@ -45,7 +45,7 @@ function _initializerWarningHelper(descriptor, context) { import { bindable, bindingMode } from "aurelia-framework"; -export let AutPaginationCustomElement = (_dec = bindable({defaultBindingMode: bindingMode.twoWay}), (_class = class AutPaginationCustomElement { +export let AutPaginationCustomElement = (_dec = bindable({ defaultBindingMode: bindingMode.twoWay }), (_class = class AutPaginationCustomElement { constructor() { _initDefineProp(this, "currentPage", _descriptor, this); diff --git a/dist/es2015/au-table.js b/dist/es2015/au-table.js index 882a1b5..9537723 100644 --- a/dist/es2015/au-table.js +++ b/dist/es2015/au-table.js @@ -140,11 +140,14 @@ export let AureliaTableCustomAttribute = (_dec = inject(BindingEngine), _dec2 = for (let next of toFilter) { for (let key of this.filterKeys) { - let value = next[key].toString(); - if (value.toLowerCase().indexOf(this.filterText.toLowerCase()) > -1) { - filteredData.push(next); - break; + if (next[key]) { + let value = next[key].toString().toLowerCase(); + + if (value.indexOf(this.filterText.toLowerCase()) > -1) { + filteredData.push(next); + break; + } } } } diff --git a/dist/system/au-table-pagination.js b/dist/system/au-table-pagination.js index f48aa6e..d75773c 100644 --- a/dist/system/au-table-pagination.js +++ b/dist/system/au-table-pagination.js @@ -60,7 +60,7 @@ System.register(["aurelia-framework"], function (_export, _context) { bindingMode = _aureliaFramework.bindingMode; }], execute: function () { - _export("AutPaginationCustomElement", AutPaginationCustomElement = (_dec = bindable({defaultBindingMode: bindingMode.twoWay}), (_class = function () { + _export("AutPaginationCustomElement", AutPaginationCustomElement = (_dec = bindable({ defaultBindingMode: bindingMode.twoWay }), (_class = function () { function AutPaginationCustomElement() { _classCallCheck(this, AutPaginationCustomElement); diff --git a/dist/system/au-table.js b/dist/system/au-table.js index e81d922..3e6374b 100644 --- a/dist/system/au-table.js +++ b/dist/system/au-table.js @@ -188,11 +188,14 @@ System.register(["aurelia-framework"], function (_export, _context) { var key = _ref2; - var value = next[key].toString(); - if (value.toLowerCase().indexOf(this.filterText.toLowerCase()) > -1) { - filteredData.push(next); - break; + if (next[key]) { + var value = next[key].toString().toLowerCase(); + + if (value.indexOf(this.filterText.toLowerCase()) > -1) { + filteredData.push(next); + break; + } } } } diff --git a/src/au-table.js b/src/au-table.js index 796f997..7875062 100644 --- a/src/au-table.js +++ b/src/au-table.js @@ -101,14 +101,17 @@ export class AureliaTableCustomAttribute { doFilter(toFilter) { let filteredData = []; - + for (let next of toFilter) { for (let key of this.filterKeys) { - let value = next[key].toString(); - if (value.toLowerCase().indexOf(this.filterText.toLowerCase()) > -1) { - filteredData.push(next); - break; + if( next[key]){ + let value = next[key].toString().toLowerCase(); + + if (value.indexOf(this.filterText.toLowerCase()) > -1) { + filteredData.push(next); + break; + } } } } From c91e28d5041f6337d239edfb8bb6cc2abb46b2ad Mon Sep 17 00:00:00 2001 From: Philip Rieck Date: Fri, 19 Aug 2016 16:32:01 -0500 Subject: [PATCH 2/3] fix case when data is 0 --- src/au-table.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/au-table.js b/src/au-table.js index 7875062..4124dc8 100644 --- a/src/au-table.js +++ b/src/au-table.js @@ -105,7 +105,7 @@ export class AureliaTableCustomAttribute { for (let next of toFilter) { for (let key of this.filterKeys) { - if( next[key]){ + if( next[key]!= null ){ let value = next[key].toString().toLowerCase(); if (value.indexOf(this.filterText.toLowerCase()) > -1) { From 4f9e2420de153b24349cff423e12b571173b6b06 Mon Sep 17 00:00:00 2001 From: Philip Rieck Date: Fri, 19 Aug 2016 16:35:32 -0500 Subject: [PATCH 3/3] revert whitespace changes --- dist/amd/au-table-pagination.js | 2 +- dist/amd/au-table.js | 2 +- dist/commonjs/au-table-pagination.js | 2 +- dist/commonjs/au-table.js | 2 +- dist/es2015/au-table-pagination.js | 2 +- dist/es2015/au-table.js | 2 +- dist/system/au-table-pagination.js | 2 +- dist/system/au-table.js | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dist/amd/au-table-pagination.js b/dist/amd/au-table-pagination.js index d54858b..9d5f0ec 100644 --- a/dist/amd/au-table-pagination.js +++ b/dist/amd/au-table-pagination.js @@ -57,7 +57,7 @@ define(["exports", "aurelia-framework"], function (exports, _aureliaFramework) { var _dec, _desc, _value, _class, _descriptor, _descriptor2, _descriptor3, _descriptor4; - var AutPaginationCustomElement = exports.AutPaginationCustomElement = (_dec = (0, _aureliaFramework.bindable)({ defaultBindingMode: _aureliaFramework.bindingMode.twoWay }), (_class = function () { + var AutPaginationCustomElement = exports.AutPaginationCustomElement = (_dec = (0, _aureliaFramework.bindable)({defaultBindingMode: _aureliaFramework.bindingMode.twoWay}), (_class = function () { function AutPaginationCustomElement() { _classCallCheck(this, AutPaginationCustomElement); diff --git a/dist/amd/au-table.js b/dist/amd/au-table.js index ddf42f2..670879d 100644 --- a/dist/amd/au-table.js +++ b/dist/amd/au-table.js @@ -184,7 +184,7 @@ define(["exports", "aurelia-framework"], function (exports, _aureliaFramework) { var key = _ref2; - if (next[key]) { + if (next[key] != null) { var value = next[key].toString().toLowerCase(); if (value.indexOf(this.filterText.toLowerCase()) > -1) { diff --git a/dist/commonjs/au-table-pagination.js b/dist/commonjs/au-table-pagination.js index eaaa22c..9bc38cb 100644 --- a/dist/commonjs/au-table-pagination.js +++ b/dist/commonjs/au-table-pagination.js @@ -54,7 +54,7 @@ function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.'); } -var AutPaginationCustomElement = exports.AutPaginationCustomElement = (_dec = (0, _aureliaFramework.bindable)({ defaultBindingMode: _aureliaFramework.bindingMode.twoWay }), (_class = function () { +var AutPaginationCustomElement = exports.AutPaginationCustomElement = (_dec = (0, _aureliaFramework.bindable)({defaultBindingMode: _aureliaFramework.bindingMode.twoWay}), (_class = function () { function AutPaginationCustomElement() { _classCallCheck(this, AutPaginationCustomElement); diff --git a/dist/commonjs/au-table.js b/dist/commonjs/au-table.js index 4debad3..727dfa9 100644 --- a/dist/commonjs/au-table.js +++ b/dist/commonjs/au-table.js @@ -181,7 +181,7 @@ var AureliaTableCustomAttribute = exports.AureliaTableCustomAttribute = (_dec = var key = _ref2; - if (next[key]) { + if (next[key] != null) { var value = next[key].toString().toLowerCase(); if (value.indexOf(this.filterText.toLowerCase()) > -1) { diff --git a/dist/es2015/au-table-pagination.js b/dist/es2015/au-table-pagination.js index 9eed9d5..5045d7e 100644 --- a/dist/es2015/au-table-pagination.js +++ b/dist/es2015/au-table-pagination.js @@ -45,7 +45,7 @@ function _initializerWarningHelper(descriptor, context) { import { bindable, bindingMode } from "aurelia-framework"; -export let AutPaginationCustomElement = (_dec = bindable({ defaultBindingMode: bindingMode.twoWay }), (_class = class AutPaginationCustomElement { +export let AutPaginationCustomElement = (_dec = bindable({defaultBindingMode: bindingMode.twoWay}), (_class = class AutPaginationCustomElement { constructor() { _initDefineProp(this, "currentPage", _descriptor, this); diff --git a/dist/es2015/au-table.js b/dist/es2015/au-table.js index 9537723..c6e8cd0 100644 --- a/dist/es2015/au-table.js +++ b/dist/es2015/au-table.js @@ -141,7 +141,7 @@ export let AureliaTableCustomAttribute = (_dec = inject(BindingEngine), _dec2 = for (let next of toFilter) { for (let key of this.filterKeys) { - if (next[key]) { + if (next[key] != null) { let value = next[key].toString().toLowerCase(); if (value.indexOf(this.filterText.toLowerCase()) > -1) { diff --git a/dist/system/au-table-pagination.js b/dist/system/au-table-pagination.js index d75773c..f48aa6e 100644 --- a/dist/system/au-table-pagination.js +++ b/dist/system/au-table-pagination.js @@ -60,7 +60,7 @@ System.register(["aurelia-framework"], function (_export, _context) { bindingMode = _aureliaFramework.bindingMode; }], execute: function () { - _export("AutPaginationCustomElement", AutPaginationCustomElement = (_dec = bindable({ defaultBindingMode: bindingMode.twoWay }), (_class = function () { + _export("AutPaginationCustomElement", AutPaginationCustomElement = (_dec = bindable({defaultBindingMode: bindingMode.twoWay}), (_class = function () { function AutPaginationCustomElement() { _classCallCheck(this, AutPaginationCustomElement); diff --git a/dist/system/au-table.js b/dist/system/au-table.js index 3e6374b..76aca7f 100644 --- a/dist/system/au-table.js +++ b/dist/system/au-table.js @@ -189,7 +189,7 @@ System.register(["aurelia-framework"], function (_export, _context) { var key = _ref2; - if (next[key]) { + if (next[key] != null) { var value = next[key].toString().toLowerCase(); if (value.indexOf(this.filterText.toLowerCase()) > -1) {