ps-toolkit-ui 1.17.82 → 1.17.84

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.
@@ -3299,7 +3299,7 @@
3299
3299
  });
3300
3300
  TableRowComponent.prototype.ngOnInit = function () {
3301
3301
  var _this = this;
3302
- if (this.table.hasChildren || this.table.subTable != null) {
3302
+ if (this.table.hasChildren) {
3303
3303
  if (!this.table.childrenAutoLoad) {
3304
3304
  this.children = this.getChildren();
3305
3305
  }
@@ -3314,15 +3314,28 @@
3314
3314
  _this.table.showInsertModal(_this.row.Data.Id, _this.level, _this.row.Data);
3315
3315
  };
3316
3316
  }
3317
+ }
3318
+ if (this.table.hasChildren || this.table.subTable != null) {
3317
3319
  this.showChildren = new InputClass(this.table.environment, this.table.l, this.table.name + 'SubsetTitle', 'fa-duotone fa-angle-left f-s-22', this.row.Data.CountChild > 0 || (!this.table.childrenAutoLoad && this.children.length > 0) || this.table.subTable != null ? exports.InputType.Icon : exports.InputType.Hidden, 'h-25 m-h-5 d-ib va-m f-u');
3318
3320
  this.showChildren.onClick = function () {
3321
+ var _a, _b;
3319
3322
  if ($__namespace(_this.childrenDiv.nativeElement).is(':visible')) {
3320
3323
  $__namespace(_this.childrenDiv.nativeElement).slideUp();
3321
3324
  _this.showChildren.icon = 'fa-duotone fa-angle-left f-s-22';
3322
3325
  }
3323
- else if (_this.children.length === 0) {
3326
+ else if (_this.table.hasChildren && _this.children.length === 0) {
3324
3327
  _this.loadChildren(_this.row.Data.Id);
3325
3328
  }
3329
+ else if (_this.table.subTable != null && _this.table.subTable.permissions == null) {
3330
+ var acc_1 = _this.row.Options.find(function (x) { return x.Action === _this.table.subTable.name; });
3331
+ var ps = new PermissionClass();
3332
+ ps.Area = acc_1.Area;
3333
+ ps.Controller = acc_1.Controller;
3334
+ ps.Action = acc_1.Action;
3335
+ ps.Accesses = (_b = (_a = _this.row.Options) === null || _a === void 0 ? void 0 : _a.filter(function (x) { return x.ParentId === acc_1.Id; })) !== null && _b !== void 0 ? _b : [];
3336
+ _this.table.subTable.permissions = ps;
3337
+ _this.table.load(_this.showChildren);
3338
+ }
3326
3339
  else {
3327
3340
  $__namespace(_this.childrenDiv.nativeElement).slideDown();
3328
3341
  _this.showChildren.icon = 'fa-duotone fa-angle-down f-s-22';
@@ -3390,7 +3403,7 @@
3390
3403
  }, 500);
3391
3404
  };
3392
3405
  TableRowComponent.prototype.setOptions = function () {
3393
- var e_1, _f, e_2, _g;
3406
+ var e_1, _e, e_2, _f;
3394
3407
  var _this = this;
3395
3408
  var _a, _b, _c, _d;
3396
3409
  var opts = [];
@@ -3409,15 +3422,15 @@
3409
3422
  };
3410
3423
  var this_1 = this;
3411
3424
  try {
3412
- for (var _h = __values(((_b = (_a = this.row.Options) === null || _a === void 0 ? void 0 : _a.filter(function (x) { return x.Type === exports.PermissionTypeEnum.Option && x.InputAction === exports.PermissionInputActionEnum.Input; })) !== null && _b !== void 0 ? _b : [])), _j = _h.next(); !_j.done; _j = _h.next()) {
3413
- var option = _j.value;
3425
+ for (var _g = __values(((_b = (_a = this.row.Options) === null || _a === void 0 ? void 0 : _a.filter(function (x) { return x.Type === exports.PermissionTypeEnum.Option && x.InputAction === exports.PermissionInputActionEnum.Input; })) !== null && _b !== void 0 ? _b : [])), _h = _g.next(); !_h.done; _h = _g.next()) {
3426
+ var option = _h.value;
3414
3427
  _loop_1(option);
3415
3428
  }
3416
3429
  }
3417
3430
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
3418
3431
  finally {
3419
3432
  try {
3420
- if (_j && !_j.done && (_f = _h.return)) _f.call(_h);
3433
+ if (_h && !_h.done && (_e = _g.return)) _e.call(_g);
3421
3434
  }
3422
3435
  finally { if (e_1) throw e_1.error; }
3423
3436
  }
@@ -3500,8 +3513,8 @@
3500
3513
  else if (option.InputAction === exports.PermissionInputActionEnum.Modal) {
3501
3514
  opt.modal = this_2.table.optionsActions.find(function (x) { return x.name === option.Action; });
3502
3515
  opt.onClick = function () {
3503
- var e_3, _f;
3504
- var _a, _b, _c, _d, _e;
3516
+ var e_3, _e;
3517
+ var _a, _b, _c;
3505
3518
  if (opt.modal.table) {
3506
3519
  var p = new PermissionClass();
3507
3520
  p.RelatedId = _this.row.Data.Id;
@@ -3510,17 +3523,6 @@
3510
3523
  p.Action = option.Action;
3511
3524
  p.Accesses = (_b = (_a = _this.row.Options) === null || _a === void 0 ? void 0 : _a.filter(function (x) { return x.ParentId === option.Id; })) !== null && _b !== void 0 ? _b : [];
3512
3525
  opt.modal.table.permissions = p;
3513
- if (opt.modal.table.subTable) {
3514
- console.log(_this.row);
3515
- var acc_1 = _this.row.Options.find(function (x) { return x.Action === opt.modal.table.subTable.name; });
3516
- var ps = new PermissionClass();
3517
- ps.Area = acc_1.Area;
3518
- ps.Controller = acc_1.Controller;
3519
- ps.Action = acc_1.Action;
3520
- ps.Accesses = (_d = (_c = _this.row.Options) === null || _c === void 0 ? void 0 : _c.filter(function (x) { return x.ParentId === acc_1.Id; })) !== null && _d !== void 0 ? _d : [];
3521
- opt.modal.table.subTable.permissions = ps;
3522
- console.log(ps);
3523
- }
3524
3526
  if (opt.modal.table.form) {
3525
3527
  opt.modal.table.form.url = option.Url.replace('{}', _this.row.Data.Id) + '-insert';
3526
3528
  opt.modal.table.form.baseUrl = option.Url.replace('{}', _this.row.Data.Id) + '-insert';
@@ -3539,7 +3541,7 @@
3539
3541
  if (opt.modal.accordion) {
3540
3542
  var _loop_3 = function (r) {
3541
3543
  if (r.table) {
3542
- var options = JSON.parse(JSON.stringify((_e = _this.row.Options) !== null && _e !== void 0 ? _e : []));
3544
+ var options = JSON.parse(JSON.stringify((_c = _this.row.Options) !== null && _c !== void 0 ? _c : []));
3543
3545
  var rowOption_1 = options.find(function (x) { return x.ParentId === option.Id && x.Action === r.name; });
3544
3546
  if (rowOption_1) {
3545
3547
  var p = new PermissionClass();
@@ -3558,15 +3560,15 @@
3558
3560
  }
3559
3561
  };
3560
3562
  try {
3561
- for (var _g = (e_3 = void 0, __values(opt.modal.accordion.rows)), _h = _g.next(); !_h.done; _h = _g.next()) {
3562
- var r = _h.value;
3563
+ for (var _f = (e_3 = void 0, __values(opt.modal.accordion.rows)), _g = _f.next(); !_g.done; _g = _f.next()) {
3564
+ var r = _g.value;
3563
3565
  _loop_3(r);
3564
3566
  }
3565
3567
  }
3566
3568
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
3567
3569
  finally {
3568
3570
  try {
3569
- if (_h && !_h.done && (_f = _g.return)) _f.call(_g);
3571
+ if (_g && !_g.done && (_e = _f.return)) _e.call(_f);
3570
3572
  }
3571
3573
  finally { if (e_3) throw e_3.error; }
3572
3574
  }
@@ -3603,15 +3605,15 @@
3603
3605
  };
3604
3606
  var this_2 = this;
3605
3607
  try {
3606
- for (var _k = __values(((_d = (_c = this.row.Options) === null || _c === void 0 ? void 0 : _c.filter(function (x) { return x.Type === exports.PermissionTypeEnum.Option && x.InputAction !== exports.PermissionInputActionEnum.Input; })) !== null && _d !== void 0 ? _d : [])), _l = _k.next(); !_l.done; _l = _k.next()) {
3607
- var option = _l.value;
3608
+ for (var _j = __values(((_d = (_c = this.row.Options) === null || _c === void 0 ? void 0 : _c.filter(function (x) { return x.Type === exports.PermissionTypeEnum.Option && x.InputAction !== exports.PermissionInputActionEnum.Input; })) !== null && _d !== void 0 ? _d : [])), _k = _j.next(); !_k.done; _k = _j.next()) {
3609
+ var option = _k.value;
3608
3610
  _loop_2(option);
3609
3611
  }
3610
3612
  }
3611
3613
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
3612
3614
  finally {
3613
3615
  try {
3614
- if (_l && !_l.done && (_g = _k.return)) _g.call(_k);
3616
+ if (_k && !_k.done && (_f = _j.return)) _f.call(_j);
3615
3617
  }
3616
3618
  finally { if (e_2) throw e_2.error; }
3617
3619
  }
@@ -3631,7 +3633,7 @@
3631
3633
  // .concat(this.table.permissions.hasAccess('Delete') ? [this.optDelete] : []);
3632
3634
  };
3633
3635
  TableRowComponent.prototype.getCell = function (col) {
3634
- var e_4, _f;
3636
+ var e_4, _e;
3635
3637
  // console.log('getCell');
3636
3638
  var cv = _.get(this.row.Data, col.name);
3637
3639
  if (cv === null) {
@@ -3699,7 +3701,7 @@
3699
3701
  catch (e_4_1) { e_4 = { error: e_4_1 }; }
3700
3702
  finally {
3701
3703
  try {
3702
- if (cv_1_1 && !cv_1_1.done && (_f = cv_1.return)) _f.call(cv_1);
3704
+ if (cv_1_1 && !cv_1_1.done && (_e = cv_1.return)) _e.call(cv_1);
3703
3705
  }
3704
3706
  finally { if (e_4) throw e_4.error; }
3705
3707
  }