Skip to content

Commit

Permalink
new build
Browse files Browse the repository at this point in the history
  • Loading branch information
Hector Romero committed Aug 25, 2016
1 parent ae2a645 commit b01cf57
Show file tree
Hide file tree
Showing 8 changed files with 182 additions and 52 deletions.
22 changes: 13 additions & 9 deletions dist/amd/au-table-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ define(["exports", "aurelia-framework", "./au-table"], function (exports, _aurel
this.element = element;
this.bindingEngine = bindingEngine;

this.rowSelectedListener = function (e) {
_this.handleRowSelected(e);
this.rowSelectedListener = function (event) {
_this.handleRowSelected(event);
};
}

Expand All @@ -84,7 +84,7 @@ define(["exports", "aurelia-framework", "./au-table"], function (exports, _aurel
this.element.style.cursor = 'pointer';
this.element.addEventListener('click', this.rowSelectedListener);

this.selectedSubscription = this.bindingEngine.propertyObserver(this.row, '$IsSelected').subscribe(function () {
this.selectedSubscription = this.bindingEngine.propertyObserver(this.row, '$isSelected').subscribe(function () {
return _this2.isSelectedChanged();
});

Expand All @@ -97,14 +97,14 @@ define(["exports", "aurelia-framework", "./au-table"], function (exports, _aurel
};

AutSelectCustomAttribute.prototype.setClass = function setClass() {
if (this.row.$IsSelected) {
if (this.row.$isSelected) {
this.element.classList.add(this.selectedClass);
} else {
this.element.classList.remove(this.selectedClass);
}
};

AutSelectCustomAttribute.prototype.handleRowSelected = function handleRowSelected(e) {
AutSelectCustomAttribute.prototype.handleRowSelected = function handleRowSelected(event) {
var source = event.target || event.srcElement;
if (source.tagName.toLowerCase() !== 'td') {
return;
Expand All @@ -114,16 +114,16 @@ define(["exports", "aurelia-framework", "./au-table"], function (exports, _aurel
this.deselectAll();
}

this.row.$IsSelected = this.row.$IsSelected ? false : true;
this.row.$isSelected = this.row.$isSelected ? false : true;
this.setClass();

if (this.row.$IsSelected) {
if (this.row.$isSelected) {
this.dispatchSelectedEvent();
}
};

AutSelectCustomAttribute.prototype.dispatchSelectedEvent = function dispatchSelectedEvent() {
var selectedEvent = {};
var selectedEvent = void 0;
if (window.CustomEvent) {
selectedEvent = new CustomEvent('select', {
detail: { row: this.row },
Expand All @@ -140,14 +140,18 @@ define(["exports", "aurelia-framework", "./au-table"], function (exports, _aurel

AutSelectCustomAttribute.prototype.isSelectedChanged = function isSelectedChanged() {
this.setClass();

if (this.row.$isSelected) {
dispatchSelectedEvent();
}
};

AutSelectCustomAttribute.prototype.deselectAll = function deselectAll() {
var _this3 = this;

this.auTable.data.forEach(function (item) {
if (item !== _this3.row) {
item.$IsSelected = false;
item.$isSelected = false;
}
});
};
Expand Down
37 changes: 33 additions & 4 deletions dist/amd/au-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ define(["exports", "aurelia-framework"], function (exports, _aureliaFramework) {
throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.');
}

var _dec, _dec2, _dec3, _dec4, _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7;
var _dec, _dec2, _dec3, _dec4, _dec5, _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8;

var AureliaTableCustomAttribute = exports.AureliaTableCustomAttribute = (_dec = (0, _aureliaFramework.inject)(_aureliaFramework.BindingEngine), _dec2 = (0, _aureliaFramework.bindable)({ defaultBindingMode: _aureliaFramework.bindingMode.twoWay }), _dec3 = (0, _aureliaFramework.bindable)({ defaultBindingMode: _aureliaFramework.bindingMode.twoWay }), _dec4 = (0, _aureliaFramework.bindable)({ defaultBindingMode: _aureliaFramework.bindingMode.twoWay }), _dec(_class = (_class2 = function () {
var AureliaTableCustomAttribute = exports.AureliaTableCustomAttribute = (_dec = (0, _aureliaFramework.inject)(_aureliaFramework.BindingEngine), _dec2 = (0, _aureliaFramework.bindable)({defaultBindingMode: _aureliaFramework.bindingMode.twoWay}), _dec3 = (0, _aureliaFramework.bindable)({defaultBindingMode: _aureliaFramework.bindingMode.twoWay}), _dec4 = (0, _aureliaFramework.bindable)({defaultBindingMode: _aureliaFramework.bindingMode.twoWay}), _dec5 = (0, _aureliaFramework.bindable)({defaultBindingMode: _aureliaFramework.bindingMode.twoWay}), _dec(_class = (_class2 = function () {
function AureliaTableCustomAttribute(bindingEngine) {
_classCallCheck(this, AureliaTableCustomAttribute);

Expand All @@ -75,8 +75,11 @@ define(["exports", "aurelia-framework"], function (exports, _aureliaFramework) {

_initDefineProp(this, "totalItems", _descriptor7, this);

_initDefineProp(this, "api", _descriptor8, this);

this.isAttached = false;
this.sortChangedListeners = [];
this.beforePagination = [];

this.bindingEngine = bindingEngine;
}
Expand All @@ -89,6 +92,12 @@ define(["exports", "aurelia-framework"], function (exports, _aureliaFramework) {
return _this.applyPlugins();
});
}

this.api = {
revealItem: function revealItem(item) {
return _this.revealItem(item);
}
};
};

AureliaTableCustomAttribute.prototype.attached = function attached() {
Expand Down Expand Up @@ -146,6 +155,7 @@ define(["exports", "aurelia-framework"], function (exports, _aureliaFramework) {
this.totalItems = localData.length;

if (this.hasPagination()) {
this.beforePagination = [].concat(localData);
localData = this.doPaginate(localData);
}

Expand Down Expand Up @@ -207,8 +217,8 @@ define(["exports", "aurelia-framework"], function (exports, _aureliaFramework) {
var val2 = void 0;

if (typeof sortKey === "function") {
val1 = sortKey(a);
val2 = sortKey(b);
val1 = sortKey(a, sortOrder);
val2 = sortKey(b, sortOrder);
} else {
val1 = a[sortKey];
val2 = b[sortKey];
Expand Down Expand Up @@ -308,6 +318,22 @@ define(["exports", "aurelia-framework"], function (exports, _aureliaFramework) {
}
};

AureliaTableCustomAttribute.prototype.revealItem = function revealItem(item) {
if (!this.hasPagination()) {
return true;
}

var index = this.beforePagination.indexOf(item);

if (index === -1) {
return false;
}

this.currentPage = Math.ceil((index + 1) / this.pageSize);

return true;
};

return AureliaTableCustomAttribute;
}(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "data", [_aureliaFramework.bindable], {
enumerable: true,
Expand All @@ -330,5 +356,8 @@ define(["exports", "aurelia-framework"], function (exports, _aureliaFramework) {
}), _descriptor7 = _applyDecoratedDescriptor(_class2.prototype, "totalItems", [_dec4], {
enumerable: true,
initializer: null
}), _descriptor8 = _applyDecoratedDescriptor(_class2.prototype, "api", [_dec5], {
enumerable: true,
initializer: null
})), _class2)) || _class);
});
22 changes: 13 additions & 9 deletions dist/commonjs/au-table-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ var AutSelectCustomAttribute = exports.AutSelectCustomAttribute = (_dec = (0, _a
this.element = element;
this.bindingEngine = bindingEngine;

this.rowSelectedListener = function (e) {
_this.handleRowSelected(e);
this.rowSelectedListener = function (event) {
_this.handleRowSelected(event);
};
}

Expand All @@ -83,7 +83,7 @@ var AutSelectCustomAttribute = exports.AutSelectCustomAttribute = (_dec = (0, _a
this.element.style.cursor = 'pointer';
this.element.addEventListener('click', this.rowSelectedListener);

this.selectedSubscription = this.bindingEngine.propertyObserver(this.row, '$IsSelected').subscribe(function () {
this.selectedSubscription = this.bindingEngine.propertyObserver(this.row, '$isSelected').subscribe(function () {
return _this2.isSelectedChanged();
});

Expand All @@ -96,14 +96,14 @@ var AutSelectCustomAttribute = exports.AutSelectCustomAttribute = (_dec = (0, _a
};

AutSelectCustomAttribute.prototype.setClass = function setClass() {
if (this.row.$IsSelected) {
if (this.row.$isSelected) {
this.element.classList.add(this.selectedClass);
} else {
this.element.classList.remove(this.selectedClass);
}
};

AutSelectCustomAttribute.prototype.handleRowSelected = function handleRowSelected(e) {
AutSelectCustomAttribute.prototype.handleRowSelected = function handleRowSelected(event) {
var source = event.target || event.srcElement;
if (source.tagName.toLowerCase() !== 'td') {
return;
Expand All @@ -113,16 +113,16 @@ var AutSelectCustomAttribute = exports.AutSelectCustomAttribute = (_dec = (0, _a
this.deselectAll();
}

this.row.$IsSelected = this.row.$IsSelected ? false : true;
this.row.$isSelected = this.row.$isSelected ? false : true;
this.setClass();

if (this.row.$IsSelected) {
if (this.row.$isSelected) {
this.dispatchSelectedEvent();
}
};

AutSelectCustomAttribute.prototype.dispatchSelectedEvent = function dispatchSelectedEvent() {
var selectedEvent = {};
var selectedEvent = void 0;
if (window.CustomEvent) {
selectedEvent = new CustomEvent('select', {
detail: { row: this.row },
Expand All @@ -139,14 +139,18 @@ var AutSelectCustomAttribute = exports.AutSelectCustomAttribute = (_dec = (0, _a

AutSelectCustomAttribute.prototype.isSelectedChanged = function isSelectedChanged() {
this.setClass();

if (this.row.$isSelected) {
dispatchSelectedEvent();
}
};

AutSelectCustomAttribute.prototype.deselectAll = function deselectAll() {
var _this3 = this;

this.auTable.data.forEach(function (item) {
if (item !== _this3.row) {
item.$IsSelected = false;
item.$isSelected = false;
}
});
};
Expand Down
37 changes: 33 additions & 4 deletions dist/commonjs/au-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
});
exports.AureliaTableCustomAttribute = undefined;

var _dec, _dec2, _dec3, _dec4, _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7;
var _dec, _dec2, _dec3, _dec4, _dec5, _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8;

var _aureliaFramework = require("aurelia-framework");

Expand Down Expand Up @@ -54,7 +54,7 @@ function _initializerWarningHelper(descriptor, context) {
throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.');
}

var AureliaTableCustomAttribute = exports.AureliaTableCustomAttribute = (_dec = (0, _aureliaFramework.inject)(_aureliaFramework.BindingEngine), _dec2 = (0, _aureliaFramework.bindable)({ defaultBindingMode: _aureliaFramework.bindingMode.twoWay }), _dec3 = (0, _aureliaFramework.bindable)({ defaultBindingMode: _aureliaFramework.bindingMode.twoWay }), _dec4 = (0, _aureliaFramework.bindable)({ defaultBindingMode: _aureliaFramework.bindingMode.twoWay }), _dec(_class = (_class2 = function () {
var AureliaTableCustomAttribute = exports.AureliaTableCustomAttribute = (_dec = (0, _aureliaFramework.inject)(_aureliaFramework.BindingEngine), _dec2 = (0, _aureliaFramework.bindable)({defaultBindingMode: _aureliaFramework.bindingMode.twoWay}), _dec3 = (0, _aureliaFramework.bindable)({defaultBindingMode: _aureliaFramework.bindingMode.twoWay}), _dec4 = (0, _aureliaFramework.bindable)({defaultBindingMode: _aureliaFramework.bindingMode.twoWay}), _dec5 = (0, _aureliaFramework.bindable)({defaultBindingMode: _aureliaFramework.bindingMode.twoWay}), _dec(_class = (_class2 = function () {
function AureliaTableCustomAttribute(bindingEngine) {
_classCallCheck(this, AureliaTableCustomAttribute);

Expand All @@ -72,8 +72,11 @@ var AureliaTableCustomAttribute = exports.AureliaTableCustomAttribute = (_dec =

_initDefineProp(this, "totalItems", _descriptor7, this);

_initDefineProp(this, "api", _descriptor8, this);

this.isAttached = false;
this.sortChangedListeners = [];
this.beforePagination = [];

this.bindingEngine = bindingEngine;
}
Expand All @@ -86,6 +89,12 @@ var AureliaTableCustomAttribute = exports.AureliaTableCustomAttribute = (_dec =
return _this.applyPlugins();
});
}

this.api = {
revealItem: function revealItem(item) {
return _this.revealItem(item);
}
};
};

AureliaTableCustomAttribute.prototype.attached = function attached() {
Expand Down Expand Up @@ -143,6 +152,7 @@ var AureliaTableCustomAttribute = exports.AureliaTableCustomAttribute = (_dec =
this.totalItems = localData.length;

if (this.hasPagination()) {
this.beforePagination = [].concat(localData);
localData = this.doPaginate(localData);
}

Expand Down Expand Up @@ -204,8 +214,8 @@ var AureliaTableCustomAttribute = exports.AureliaTableCustomAttribute = (_dec =
var val2 = void 0;

if (typeof sortKey === "function") {
val1 = sortKey(a);
val2 = sortKey(b);
val1 = sortKey(a, sortOrder);
val2 = sortKey(b, sortOrder);
} else {
val1 = a[sortKey];
val2 = b[sortKey];
Expand Down Expand Up @@ -305,6 +315,22 @@ var AureliaTableCustomAttribute = exports.AureliaTableCustomAttribute = (_dec =
}
};

AureliaTableCustomAttribute.prototype.revealItem = function revealItem(item) {
if (!this.hasPagination()) {
return true;
}

var index = this.beforePagination.indexOf(item);

if (index === -1) {
return false;
}

this.currentPage = Math.ceil((index + 1) / this.pageSize);

return true;
};

return AureliaTableCustomAttribute;
}(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "data", [_aureliaFramework.bindable], {
enumerable: true,
Expand All @@ -327,4 +353,7 @@ var AureliaTableCustomAttribute = exports.AureliaTableCustomAttribute = (_dec =
}), _descriptor7 = _applyDecoratedDescriptor(_class2.prototype, "totalItems", [_dec4], {
enumerable: true,
initializer: null
}), _descriptor8 = _applyDecoratedDescriptor(_class2.prototype, "api", [_dec5], {
enumerable: true,
initializer: null
})), _class2)) || _class);
Loading

0 comments on commit b01cf57

Please sign in to comment.