@coolon/angular-ui-powerups 11.0.0-alpha.5 → 11.0.0-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3914,7 +3914,7 @@
3914
3914
  Object.defineProperty(DecoratedTreeNodeMixin.prototype, "decoratedSelf", {
3915
3915
  get: function () {
3916
3916
  var _this = this;
3917
- return this.memoize("decoratedSelf", function () {
3917
+ return this.memoize('decoratedSelf', function () {
3918
3918
  return _this.parent ? _this.parent.children.find(function (child) { return child.node === _this.node; }) : exports.DecoratedTreeNode.createRoot(_this.node);
3919
3919
  });
3920
3920
  },
@@ -3924,7 +3924,7 @@
3924
3924
  Object.defineProperty(DecoratedTreeNodeMixin.prototype, "children", {
3925
3925
  get: function () {
3926
3926
  var _this = this;
3927
- return this.memoize("children", function () {
3927
+ return this.memoize('children', function () {
3928
3928
  return _this.node.children ? _this.node.children.map(function (child) {
3929
3929
  return typescriptUtilities.Mixin.createProxy(child, new DecoratedTreeNodeMixin(_this.decoratedSelf, child));
3930
3930
  }) : [];
@@ -3935,7 +3935,7 @@
3935
3935
  });
3936
3936
  DecoratedTreeNodeMixin.prototype.descendants = function () {
3937
3937
  var _this = this;
3938
- return this.memoize("descendants", function () {
3938
+ return this.memoize('descendants', function () {
3939
3939
  var result = [];
3940
3940
  _this.visitDescendants(function (child) { return result.push(child); });
3941
3941
  return result;
@@ -3943,7 +3943,7 @@
3943
3943
  };
3944
3944
  DecoratedTreeNodeMixin.prototype.selfAndDescendants = function () {
3945
3945
  var _this = this;
3946
- return this.memoize("selfAndDescendants", function () {
3946
+ return this.memoize('selfAndDescendants', function () {
3947
3947
  var result = [];
3948
3948
  _this.visitSelfAndDescendants(function (child) { return result.push(child); });
3949
3949
  return result;
@@ -4014,29 +4014,24 @@
4014
4014
  };
4015
4015
  DecoratedTreeNodeMixin.prototype.ancestorsAndSelf = function () {
4016
4016
  var _this = this;
4017
- return this.memoize("ancestorsAndSelf", function () {
4017
+ return this.memoize('ancestorsAndSelf', function () {
4018
4018
  return _this.ancestors().concat([(_this.decoratedSelf)]);
4019
4019
  });
4020
4020
  };
4021
4021
  DecoratedTreeNodeMixin.prototype.pathToParent = function (parent) {
4022
- var _this = this;
4023
- return this.memoize("pathToParent", function () {
4024
- if (_this.node === parent.node) {
4025
- return [];
4026
- }
4027
- else if (_this.parent) {
4028
- return _this.parent.pathToParent(parent).concat([_this.parent]);
4029
- }
4030
- else {
4031
- throw new Error('parent is not an ancestor');
4032
- }
4033
- });
4022
+ if (this.node === parent.node) {
4023
+ return [];
4024
+ }
4025
+ else if (this.parent) {
4026
+ var pathToParent = this.parent.pathToParent(parent);
4027
+ return pathToParent.concat([this.parent]);
4028
+ }
4029
+ else {
4030
+ throw new Error('parent is not an ancestor');
4031
+ }
4034
4032
  };
4035
4033
  DecoratedTreeNodeMixin.prototype.pathToParentAndSelf = function (parent) {
4036
- var _this = this;
4037
- return this.memoize("pathToParentAndSelf", function () {
4038
- return _this.pathToParent(parent).concat([_this.decoratedSelf]);
4039
- });
4034
+ return this.pathToParent(parent).concat([this.decoratedSelf]);
4040
4035
  };
4041
4036
  DecoratedTreeNodeMixin.prototype.isRoot = function () {
4042
4037
  return !this.parent;
@@ -4052,20 +4047,20 @@
4052
4047
  return !this.isRoot() && this.node.children.length < 1;
4053
4048
  };
4054
4049
  DecoratedTreeNodeMixin.prototype.hasChildren = function () {
4055
- return this.node.children.length > 0;
4050
+ return this.node.children && this.node.children.length > 0;
4056
4051
  };
4057
4052
  DecoratedTreeNodeMixin.prototype.depthFromParent = function (parent) {
4058
4053
  return this.pathToParent(parent).length;
4059
4054
  };
4060
4055
  DecoratedTreeNodeMixin.prototype.treeDepth = function () {
4061
4056
  var _this = this;
4062
- return this.memoize("treeDepth", function () {
4057
+ return this.memoize('treeDepth', function () {
4063
4058
  return 1 + _this.descendants().map(function (child) { return child.depthFromParent(_this); }).reduce(function (prev, current) { return Math.max(prev, current); });
4064
4059
  });
4065
4060
  };
4066
4061
  DecoratedTreeNodeMixin.prototype.flatten = function () {
4067
4062
  var _this = this;
4068
- return this.memoize("flatten", function () {
4063
+ return this.memoize('flatten', function () {
4069
4064
  return _this.flattenInto([]);
4070
4065
  });
4071
4066
  };