UNPKG

ngx-tree-select

Version:

Angular component for select with tree items.

117 lines 3.76 kB
var SelectableItem = /** @class */ (function () { /** * @param {?} id * @param {?} text * @param {?} data * @param {?} svc */ function SelectableItem(id, text, data, svc) { this.id = id; this.text = text; this.data = data; this.svc = svc; this._selected = false; this.isOpen = false; this.matchFilter = true; this.isVisible = false; } Object.defineProperty(SelectableItem.prototype, "hasChild", { /** * @return {?} */ get: function () { return this.children && this.children.length > 0; }, enumerable: true, configurable: true }); Object.defineProperty(SelectableItem.prototype, "checked", { /** * @return {?} */ get: function () { if (this.hasChild && this.svc.Configuration.allowMultiple) { if (this.children.every(function (child) { return child.selected; })) { return true; } else if (this.children.every(function (child) { return child.selected === false; })) { return this._selected; } return null; } return this._selected; }, enumerable: true, configurable: true }); Object.defineProperty(SelectableItem.prototype, "selected", { /** * @return {?} */ get: function () { if (this.hasChild && this.svc.Configuration.allowMultiple) { if (this.children.some(function (child) { return child.selected; })) { if (this.svc.Configuration.allowParentSelection) { this._selected = false; } return true; } else if (this.children.every(function (child) { return child.selected === false; })) { if (this.svc.Configuration.allowParentSelection) { return this._selected; } else { return this._selected = false; } } return false; } else if (this.hasChild && this._selected === true) { for (var _i = 0, _a = this.children; _i < _a.length; _i++) { var itm = _a[_i]; itm.selected = false; } } return this._selected; }, /** * @param {?} value * @return {?} */ set: function (value) { if (this.hasChild && !this.svc.Configuration.allowParentSelection) { if (value !== null) { this.children.forEach(function (child) { return child.selected = value; }); } } else { this._selected = value; } }, enumerable: true, configurable: true }); return SelectableItem; }()); export { SelectableItem }; function SelectableItem_tsickle_Closure_declarations() { /** @type {?} */ SelectableItem.prototype._selected; /** @type {?} */ SelectableItem.prototype.children; /** @type {?} */ SelectableItem.prototype.isOpen; /** @type {?} */ SelectableItem.prototype.matchFilter; /** @type {?} */ SelectableItem.prototype.isVisible; /** @type {?} */ SelectableItem.prototype.id; /** @type {?} */ SelectableItem.prototype.text; /** @type {?} */ SelectableItem.prototype.data; /** @type {?} */ SelectableItem.prototype.svc; } //# sourceMappingURL=selectable-item.js.map