ps-toolkit-ui 0.0.57 → 0.0.61

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.
@@ -1889,7 +1889,7 @@
1889
1889
  c.selected = false;
1890
1890
  if (onlyChild) {
1891
1891
  c.children.forEach(function (ch) {
1892
- _this.unCheck(ch);
1892
+ _this.unCheck(onlyChild, ch);
1893
1893
  });
1894
1894
  }
1895
1895
  };
@@ -5740,49 +5740,53 @@
5740
5740
  });
5741
5741
  return l;
5742
5742
  };
5743
- FormTreeComponent.prototype.check = function (ids) {
5743
+ FormTreeComponent.prototype.check = function (ids, chs) {
5744
5744
  var e_2, _a;
5745
- var _this = this;
5746
- var _loop_1 = function (r) {
5747
- setTimeout(function () { r.unCheck(); });
5748
- if (ids.includes(r.value)) {
5749
- setTimeout(function () { r.toggle(_this.inp.onlyChild); });
5750
- }
5751
- setTimeout(function () { _this.checkChildren(r.children, ids); });
5752
- };
5745
+ if (chs === void 0) { chs = this.inp.rows; }
5746
+ var isChecked = false;
5747
+ var cIsChecked = false;
5753
5748
  try {
5754
- for (var _b = __values(this.inp.rows), _c = _b.next(); !_c.done; _c = _b.next()) {
5755
- var r = _c.value;
5756
- _loop_1(r);
5749
+ for (var chs_1 = __values(chs), chs_1_1 = chs_1.next(); !chs_1_1.done; chs_1_1 = chs_1.next()) {
5750
+ var r = chs_1_1.value;
5751
+ r.selected = ids.includes(r.value);
5752
+ if (r.selected) {
5753
+ isChecked = true;
5754
+ }
5755
+ cIsChecked = this.check(ids, r.children);
5756
+ if (this.inp.onlyChild && cIsChecked) {
5757
+ r.selected = true;
5758
+ }
5757
5759
  }
5758
5760
  }
5759
5761
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
5760
5762
  finally {
5761
5763
  try {
5762
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
5764
+ if (chs_1_1 && !chs_1_1.done && (_a = chs_1.return)) _a.call(chs_1);
5763
5765
  }
5764
5766
  finally { if (e_2) throw e_2.error; }
5765
5767
  }
5768
+ return isChecked || cIsChecked;
5766
5769
  };
5767
5770
  FormTreeComponent.prototype.checkChildren = function (chs, ids) {
5768
5771
  var e_3, _a;
5769
5772
  var _this = this;
5770
- var _loop_2 = function (r) {
5773
+ var _loop_1 = function (r) {
5771
5774
  if (ids.includes(r.value)) {
5772
- setTimeout(function () { r.toggle(_this.inp.onlyChild); });
5775
+ r.toggle(this_1.inp.onlyChild);
5773
5776
  }
5774
5777
  setTimeout(function () { _this.checkChildren(r.children, ids); });
5775
5778
  };
5779
+ var this_1 = this;
5776
5780
  try {
5777
- for (var chs_1 = __values(chs), chs_1_1 = chs_1.next(); !chs_1_1.done; chs_1_1 = chs_1.next()) {
5778
- var r = chs_1_1.value;
5779
- _loop_2(r);
5781
+ for (var chs_2 = __values(chs), chs_2_1 = chs_2.next(); !chs_2_1.done; chs_2_1 = chs_2.next()) {
5782
+ var r = chs_2_1.value;
5783
+ _loop_1(r);
5780
5784
  }
5781
5785
  }
5782
5786
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
5783
5787
  finally {
5784
5788
  try {
5785
- if (chs_1_1 && !chs_1_1.done && (_a = chs_1.return)) _a.call(chs_1);
5789
+ if (chs_2_1 && !chs_2_1.done && (_a = chs_2.return)) _a.call(chs_2);
5786
5790
  }
5787
5791
  finally { if (e_3) throw e_3.error; }
5788
5792
  }