ps-toolkit-ui 0.0.56 → 0.0.60

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.
@@ -5740,43 +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
- console.log(ids);
5746
- console.log(this.inp.rows);
5745
+ if (chs === void 0) { chs = this.inp.rows; }
5746
+ var isChecked = false;
5747
+ var cIsChecked = false;
5747
5748
  try {
5748
- for (var _b = __values(this.inp.rows), _c = _b.next(); !_c.done; _c = _b.next()) {
5749
- var r = _c.value;
5750
- r.unCheck();
5751
- if (ids.includes(r.value)) {
5752
- r.toggle(this.inp.onlyChild);
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;
5753
5758
  }
5754
- this.checkChildren(r.children, ids);
5755
5759
  }
5756
5760
  }
5757
5761
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
5758
5762
  finally {
5759
5763
  try {
5760
- 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);
5761
5765
  }
5762
5766
  finally { if (e_2) throw e_2.error; }
5763
5767
  }
5768
+ return isChecked || cIsChecked;
5764
5769
  };
5765
5770
  FormTreeComponent.prototype.checkChildren = function (chs, ids) {
5766
5771
  var e_3, _a;
5772
+ var _this = this;
5773
+ var _loop_1 = function (r) {
5774
+ if (ids.includes(r.value)) {
5775
+ r.toggle(this_1.inp.onlyChild);
5776
+ }
5777
+ setTimeout(function () { _this.checkChildren(r.children, ids); });
5778
+ };
5779
+ var this_1 = this;
5767
5780
  try {
5768
- for (var chs_1 = __values(chs), chs_1_1 = chs_1.next(); !chs_1_1.done; chs_1_1 = chs_1.next()) {
5769
- var r = chs_1_1.value;
5770
- if (ids.includes(r.value)) {
5771
- r.toggle(this.inp.onlyChild);
5772
- }
5773
- this.checkChildren(r.children, ids);
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);
5774
5784
  }
5775
5785
  }
5776
5786
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
5777
5787
  finally {
5778
5788
  try {
5779
- 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);
5780
5790
  }
5781
5791
  finally { if (e_3) throw e_3.error; }
5782
5792
  }