ps-toolkit-ui 0.0.112 → 0.0.116

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.
@@ -807,19 +807,21 @@
807
807
  PermissionTypeEnum[PermissionTypeEnum["Form"] = -1] = "Form";
808
808
  PermissionTypeEnum[PermissionTypeEnum["Item"] = 0] = "Item";
809
809
  PermissionTypeEnum[PermissionTypeEnum["Access"] = 1] = "Access";
810
- PermissionTypeEnum[PermissionTypeEnum["Button"] = 2] = "Button";
811
- PermissionTypeEnum[PermissionTypeEnum["Option"] = 3] = "Option";
812
- PermissionTypeEnum[PermissionTypeEnum["OptionLink"] = 4] = "OptionLink";
813
- PermissionTypeEnum[PermissionTypeEnum["OptionLinkNewTab"] = 5] = "OptionLinkNewTab";
814
- PermissionTypeEnum[PermissionTypeEnum["OptionReport"] = 6] = "OptionReport";
815
- PermissionTypeEnum[PermissionTypeEnum["OptionFile"] = 7] = "OptionFile";
816
- PermissionTypeEnum[PermissionTypeEnum["OptionModal"] = 8] = "OptionModal";
817
- PermissionTypeEnum[PermissionTypeEnum["OptionConfirm"] = 9] = "OptionConfirm";
810
+ PermissionTypeEnum[PermissionTypeEnum["Option"] = 2] = "Option";
818
811
  })(exports.PermissionTypeEnum || (exports.PermissionTypeEnum = {}));
819
- (function (PermissionOptionTypeEnum) {
820
- PermissionOptionTypeEnum[PermissionOptionTypeEnum["Icon"] = 0] = "Icon";
821
- PermissionOptionTypeEnum[PermissionOptionTypeEnum["Button"] = 1] = "Button";
822
- })(exports.PermissionOptionTypeEnum || (exports.PermissionOptionTypeEnum = {}));
812
+ (function (PermissionInputActionEnum) {
813
+ PermissionInputActionEnum[PermissionInputActionEnum["None"] = 0] = "None";
814
+ PermissionInputActionEnum[PermissionInputActionEnum["Link"] = 1] = "Link";
815
+ PermissionInputActionEnum[PermissionInputActionEnum["LinkNewTab"] = 2] = "LinkNewTab";
816
+ PermissionInputActionEnum[PermissionInputActionEnum["Report"] = 3] = "Report";
817
+ PermissionInputActionEnum[PermissionInputActionEnum["File"] = 4] = "File";
818
+ PermissionInputActionEnum[PermissionInputActionEnum["Modal"] = 5] = "Modal";
819
+ PermissionInputActionEnum[PermissionInputActionEnum["Confirm"] = 6] = "Confirm";
820
+ })(exports.PermissionInputActionEnum || (exports.PermissionInputActionEnum = {}));
821
+ (function (PermissionInputTypeEnum) {
822
+ PermissionInputTypeEnum[PermissionInputTypeEnum["Icon"] = 0] = "Icon";
823
+ PermissionInputTypeEnum[PermissionInputTypeEnum["Button"] = 1] = "Button";
824
+ })(exports.PermissionInputTypeEnum || (exports.PermissionInputTypeEnum = {}));
823
825
  (function (VehicleType) {
824
826
  VehicleType[VehicleType["Car"] = 1] = "Car";
825
827
  VehicleType[VehicleType["Motorcycle"] = 2] = "Motorcycle";
@@ -2390,6 +2392,62 @@
2390
2392
  table: [{ type: core.Input }]
2391
2393
  };
2392
2394
 
2395
+ var PermissionClass = /** @class */ (function () {
2396
+ function PermissionClass(Name, Icon, Type, InputType, InputAction, Area, Controller, Action, Condition, Accesses) {
2397
+ if (Name === void 0) { Name = ''; }
2398
+ if (Icon === void 0) { Icon = ''; }
2399
+ if (Type === void 0) { Type = null; }
2400
+ if (InputType === void 0) { InputType = null; }
2401
+ if (InputAction === void 0) { InputAction = null; }
2402
+ if (Area === void 0) { Area = ''; }
2403
+ if (Controller === void 0) { Controller = ''; }
2404
+ if (Action === void 0) { Action = ''; }
2405
+ if (Condition === void 0) { Condition = null; }
2406
+ if (Accesses === void 0) { Accesses = []; }
2407
+ this.Name = Name;
2408
+ this.Icon = Icon;
2409
+ this.Type = Type;
2410
+ this.InputType = InputType;
2411
+ this.InputAction = InputAction;
2412
+ this.Area = Area;
2413
+ this.Controller = Controller;
2414
+ this.Action = Action;
2415
+ this.Condition = Condition;
2416
+ this.Accesses = Accesses;
2417
+ this.RelatedId = null;
2418
+ this.OnClick = null;
2419
+ }
2420
+ PermissionClass.prototype.getAccess = function (a) {
2421
+ var c = this.Accesses.filter(function (x) { return x.Action === a && x.Type === exports.PermissionTypeEnum.Access; });
2422
+ return c.length > 0 ? c[0] : null;
2423
+ };
2424
+ PermissionClass.prototype.hasAccess = function (a) {
2425
+ return this.Accesses.filter(function (x) { return x.Action === a && x.Type === exports.PermissionTypeEnum.Access; }).length > 0;
2426
+ };
2427
+ PermissionClass.prototype.getAccesses = function () {
2428
+ return this.Accesses.filter(function (x) { return x.Type === exports.PermissionTypeEnum.Access; });
2429
+ };
2430
+ PermissionClass.prototype.delete = function (a) {
2431
+ this.Accesses = this.Accesses.filter(function (x) { return x.Action !== a; });
2432
+ };
2433
+ PermissionClass.prototype.hasOption = function (a) {
2434
+ return this.Accesses.filter(function (x) { return x.Action === a && x.Type === exports.PermissionTypeEnum.Option; }).length > 0;
2435
+ };
2436
+ PermissionClass.prototype.getOptions = function () {
2437
+ return this.Accesses.filter(function (x) { return x.Type === exports.PermissionTypeEnum.Option; });
2438
+ };
2439
+ PermissionClass.prototype.getOption = function (a) {
2440
+ var c = this.Accesses.filter(function (x) { return x.Action === a && x.Type === exports.PermissionTypeEnum.Option; });
2441
+ return c.length > 0 ? c[0] : null;
2442
+ };
2443
+ PermissionClass.prototype.getUrl = function () {
2444
+ return (this.Area ? '/' + this.Area : '') + '/' + this.Controller + '/' +
2445
+ (this.RelatedId ? this.RelatedId + "/" : '') +
2446
+ (this.Action ? this.Action : '');
2447
+ };
2448
+ return PermissionClass;
2449
+ }());
2450
+
2393
2451
  var TableRowComponent = /** @class */ (function () {
2394
2452
  function TableRowComponent(service) {
2395
2453
  this.service = service;
@@ -2434,23 +2492,23 @@
2434
2492
  if (this.table.permissions.hasAccess('Insert')) {
2435
2493
  this.addChildren = new InputClass(this.table.environment, this.table.l, this.table.name + 'AddSubsetTitle', 'fad fa-plus fa-rotate-90', exports.InputType.Icon, 'green m-h-5 h-25 d-ib va-m f-u');
2436
2494
  this.addChildren.onClick = function () {
2437
- _this.table.form.inputs.find(function (x) { return x.name === 'ParentId'; }).setValue(_this.row.Id, false);
2495
+ _this.table.form.inputs.find(function (x) { return x.name === 'ParentId'; }).setValue(_this.row.Data.Id, false);
2438
2496
  _this.table.form.onSuccessBase = function () {
2439
2497
  _this.table.modal.hide();
2440
2498
  _this.showChildren.type = exports.InputType.Icon;
2441
- _this.loadChildren(_this.row.Id);
2499
+ _this.loadChildren(_this.row.Data.Id);
2442
2500
  };
2443
2501
  _this.table.showInsertModal();
2444
2502
  };
2445
2503
  }
2446
- this.showChildren = new InputClass(this.table.environment, this.table.l, this.table.name + 'SubsetTitle', 'fad fa-angle-left f-s-22', this.row.CountChild > 0 || (!this.table.childrenAutoLoad && this.children.length > 0) ? exports.InputType.Icon : exports.InputType.Hidden, 'h-25 m-h-5 d-ib va-m f-u');
2504
+ this.showChildren = new InputClass(this.table.environment, this.table.l, this.table.name + 'SubsetTitle', 'fad fa-angle-left f-s-22', this.row.Data.CountChild > 0 || (!this.table.childrenAutoLoad && this.children.length > 0) ? exports.InputType.Icon : exports.InputType.Hidden, 'h-25 m-h-5 d-ib va-m f-u');
2447
2505
  this.showChildren.onClick = function () {
2448
2506
  if ($__namespace(_this.childrenDiv.nativeElement).is(':visible')) {
2449
2507
  $__namespace(_this.childrenDiv.nativeElement).hide();
2450
2508
  _this.showChildren.icon = 'fad fa-angle-left f-s-22';
2451
2509
  }
2452
2510
  else if (_this.children.length === 0) {
2453
- _this.loadChildren(_this.row.Id);
2511
+ _this.loadChildren(_this.row.Data.Id);
2454
2512
  }
2455
2513
  else {
2456
2514
  $__namespace(_this.childrenDiv.nativeElement).show();
@@ -2459,8 +2517,8 @@
2459
2517
  };
2460
2518
  }
2461
2519
  if (this.table.hasStatus) {
2462
- this.optStatus = new InputClass(this.table.environment, this.table.l, 'Status', this.row.Active ? 'fa-toggle-on' : 'fa-toggle-off', exports.InputType.Icon, 'm-h-5 h-20 ' + (this.row.Active ? 'green' : ''));
2463
- this.optStatus.row = this.row;
2520
+ this.optStatus = new InputClass(this.table.environment, this.table.l, 'Status', this.row.Data.Active ? 'fa-toggle-on' : 'fa-toggle-off', exports.InputType.Icon, 'm-h-5 h-20 ' + (this.row.Data.Active ? 'green' : ''));
2521
+ this.optStatus.row = this.row.Data;
2464
2522
  this.optStatus.onClick = function (btn) {
2465
2523
  new RequestClass(_this.table.l).send(_this.table.url + '/Status/' + btn.row.Id, exports.Method.Post, null, btn, function (r) {
2466
2524
  btn.class = 'm-h-5 h-20 ' + (r ? 'green' : '');
@@ -2468,16 +2526,15 @@
2468
2526
  });
2469
2527
  };
2470
2528
  }
2471
- this.options = this.getOptions();
2472
2529
  if (this.optEdit !== null) {
2473
2530
  if (this.table.form) {
2474
2531
  this.optEdit.onClick = function () {
2475
- _this.table.form.url = _this.table.url + 'Update/' + _this.row.Id;
2476
- if (_this.table.hasChildren && _this.row.ParentId != null) {
2532
+ _this.table.form.url = _this.table.url + 'Update/' + _this.row.Data.Id;
2533
+ if (_this.table.hasChildren && _this.row.Data.ParentId != null) {
2477
2534
  _this.table.form.onSuccessBase = function () {
2478
2535
  _this.table.modal.hide();
2479
2536
  if (_this.table.childrenAutoLoad) {
2480
- _this.loadParent.emit(_this.row.ParentId);
2537
+ _this.loadParent.emit(_this.row.Data.ParentId);
2481
2538
  }
2482
2539
  else {
2483
2540
  _this.table.load();
@@ -2497,7 +2554,7 @@
2497
2554
  };
2498
2555
  }
2499
2556
  else {
2500
- this.optEdit.url = this.table.url + '/Update/' + this.row.Id;
2557
+ this.optEdit.url = this.table.url + '/Update/' + this.row.Data.Id;
2501
2558
  }
2502
2559
  }
2503
2560
  if (this.optDelete != null) {
@@ -2506,13 +2563,13 @@
2506
2563
  _this.table.form.clear();
2507
2564
  }
2508
2565
  if (_this.table.permissions.Type === exports.PermissionTypeEnum.Form) {
2509
- _this.table.rows = _this.table.rows.filter(function (x) { return x.Id !== _this.row.Id; });
2510
- _this.changeRows.emit(_this.row);
2566
+ _this.table.rows = _this.table.rows.filter(function (x) { return x.Id !== _this.row.Data.Id; });
2567
+ _this.changeRows.emit(_this.row.Data);
2511
2568
  }
2512
2569
  else {
2513
- _this.confirmShow.emit({ id: _this.row.Id, accept: function () {
2514
- if (_this.table.hasChildren && _this.table.childrenAutoLoad && _this.row.ParentId != null) {
2515
- _this.loadParent.emit(_this.row.ParentId);
2570
+ _this.confirmShow.emit({ id: _this.row.Data.Id, accept: function () {
2571
+ if (_this.table.hasChildren && _this.table.childrenAutoLoad && _this.row.Data.ParentId != null) {
2572
+ _this.loadParent.emit(_this.row.Data.ParentId);
2516
2573
  }
2517
2574
  else {
2518
2575
  _this.table.load();
@@ -2536,7 +2593,7 @@
2536
2593
  });
2537
2594
  };
2538
2595
  TableRowComponent.prototype.select = function () {
2539
- this.row.selected = !this.row.selected;
2596
+ this.row.Data.selected = !this.row.Data.selected;
2540
2597
  };
2541
2598
  TableRowComponent.prototype.onChangeRows = function (e) {
2542
2599
  return this.changeRows.emit(e);
@@ -2567,26 +2624,157 @@
2567
2624
  }, 500);
2568
2625
  };
2569
2626
  TableRowComponent.prototype.getOptions = function () {
2627
+ var e_1, _a;
2570
2628
  var _this = this;
2571
- return (this.addChildren !== null && (this.table.level === null || this.table.level > this.level) ? [this.addChildren] : [])
2572
- .concat(this.table.options.filter(function (x) { return x.condition == null ||
2573
- (x.condition.startsWith('!') ? !_this.row[x.condition.substring(1)] : _this.row[x.condition]); }).map(function (o) {
2574
- var i = HelperClass.clone(o);
2575
- if (i.url) {
2576
- i.url = i.url.replace('{}', _this.row.Id);
2629
+ var opts = this.addChildren !== null && (this.table.level === null || this.table.level > this.level) ?
2630
+ [this.addChildren] : [];
2631
+ console.log(this.row.Options);
2632
+ var _loop_1 = function (option) {
2633
+ console.log(this_1.table.options.filter(function (x) { return x.name === option.Name; }).length);
2634
+ if (this_1.table.options.filter(function (x) { return x.name === option.Name; }).length > 0) {
2635
+ return "continue";
2577
2636
  }
2578
- i.row = _this.row;
2579
- i.class = i.class + ' m-h-5 h-25 d-ib va-m f-u';
2580
- return i;
2581
- })).concat(this.table.hasStatus ? [this.optStatus] : [])
2582
- .concat(this.table.permissions.hasAccess('Update') ? [this.optEdit] : [])
2583
- .concat(this.table.permissions.hasAccess('Delete') ? [this.optDelete] : []);
2637
+ var opt = new InputClass(this_1.table.environment, this_1.table.l, option.Name, option.Icon, option.InputType === exports.PermissionInputTypeEnum.Icon ? exports.InputType.Icon : exports.InputType.Button, 'blue h-25 m-h-5 d-ib va-m f-u');
2638
+ opt.condition = option.Condition;
2639
+ console.log(option.InputAction);
2640
+ if (option.InputAction === exports.PermissionInputActionEnum.Link || option.InputAction === exports.PermissionInputActionEnum.LinkNewTab) {
2641
+ var p = new PermissionClass();
2642
+ p.RelatedId = this_1.table.permissions.RelatedId;
2643
+ p.Area = this_1.table.permissions.Area;
2644
+ p.Controller = option.Controller ? option.Controller : this_1.table.permissions.Controller;
2645
+ p.Action = this_1.table.permissions.Action;
2646
+ opt.url = p.getUrl() + option.Action + '/{}';
2647
+ opt.urlNewTab = option.InputAction === exports.PermissionInputActionEnum.LinkNewTab;
2648
+ }
2649
+ else if (option.InputAction === exports.PermissionInputActionEnum.Modal) {
2650
+ opt.modal = option.Modal;
2651
+ opt.onClick = function (btn) {
2652
+ var e_2, _a;
2653
+ if (opt.modal.table) {
2654
+ var p = new PermissionClass();
2655
+ p.RelatedId = btn.row.Id;
2656
+ p.Area = _this.table.permissions.Area;
2657
+ p.Controller = _this.table.permissions.Controller;
2658
+ p.Action = option.Action;
2659
+ p.Accesses = option.Accesses;
2660
+ opt.modal.table.permissions = p;
2661
+ if (opt.modal.table.form) {
2662
+ opt.modal.table.form.url = p.getUrl() + 'Insert';
2663
+ opt.modal.table.form.baseUrl = p.getUrl() + 'Insert';
2664
+ }
2665
+ opt.modal.table.set();
2666
+ }
2667
+ if (opt.modal.form) {
2668
+ opt.modal.form.name = option.Name;
2669
+ opt.modal.form.url = opt.modal.form.baseUrl + 'Update/' + btn.row.Id;
2670
+ opt.modal.form.loadData(opt.modal.form.baseUrl + 'Get/' + btn.row.Id);
2671
+ opt.modal.form.onSuccessBase = function () {
2672
+ opt.modal.hide();
2673
+ };
2674
+ }
2675
+ if (opt.modal.accordion) {
2676
+ try {
2677
+ for (var _b = (e_2 = void 0, __values(opt.modal.accordion.rows)), _c = _b.next(); !_c.done; _c = _b.next()) {
2678
+ var r = _c.value;
2679
+ if (r.table) {
2680
+ var p = new PermissionClass();
2681
+ p.RelatedId = btn.row.Id;
2682
+ p.Area = _this.table.permissions.Area;
2683
+ p.Controller = _this.table.permissions.Controller;
2684
+ p.Action = r.name;
2685
+ p.Accesses = option.Accesses;
2686
+ r.table.permissions = p;
2687
+ if (r.table.form) {
2688
+ r.table.form.url = p.getUrl() + 'Insert';
2689
+ r.table.form.baseUrl = p.getUrl() + 'Insert';
2690
+ }
2691
+ r.table.set();
2692
+ }
2693
+ }
2694
+ }
2695
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
2696
+ finally {
2697
+ try {
2698
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
2699
+ }
2700
+ finally { if (e_2) throw e_2.error; }
2701
+ }
2702
+ }
2703
+ };
2704
+ }
2705
+ else if (option.InputAction === exports.PermissionInputActionEnum.Report) {
2706
+ var p = new PermissionClass();
2707
+ p.RelatedId = 'Index';
2708
+ p.Area = this_1.table.permissions.Area;
2709
+ p.Controller = 'Print';
2710
+ p.Action = option.Action;
2711
+ opt.url = '/Report' + p.getUrl() + '/{}';
2712
+ opt.urlNewTab = true;
2713
+ }
2714
+ else if (option.InputAction === exports.PermissionInputActionEnum.File) {
2715
+ var p = new PermissionClass();
2716
+ p.RelatedId = this_1.table.permissions.RelatedId;
2717
+ p.Area = this_1.table.permissions.Area;
2718
+ p.Controller = this_1.table.permissions.Controller;
2719
+ p.Action = (this_1.table.permissions.Action ? this_1.table.permissions.Action : '') + option.Action;
2720
+ opt.url = '/File' + p.getUrl() + '/{}';
2721
+ opt.urlNewTab = true;
2722
+ }
2723
+ else if (option.InputAction === exports.PermissionInputActionEnum.Confirm) {
2724
+ opt.onClick = function (btn) {
2725
+ var p = new PermissionClass();
2726
+ p.RelatedId = _this.table.permissions.RelatedId;
2727
+ p.Area = _this.table.permissions.Area;
2728
+ p.Controller = _this.table.permissions.Controller;
2729
+ p.Action = option.Action;
2730
+ _this.table.showConfirm(_this.table.l(option.Action + 'Confirm'), p.getUrl() + '/' + btn.row.Id, null, function () {
2731
+ _this.table.load();
2732
+ });
2733
+ };
2734
+ }
2735
+ else if (option.Type === exports.PermissionTypeEnum.Option) {
2736
+ if (option.OnClick) {
2737
+ opt.onClick = function (btn) {
2738
+ option.OnClick(btn);
2739
+ };
2740
+ }
2741
+ }
2742
+ opts.push(opt);
2743
+ };
2744
+ var this_1 = this;
2745
+ try {
2746
+ for (var _b = __values(this.row.Options), _c = _b.next(); !_c.done; _c = _b.next()) {
2747
+ var option = _c.value;
2748
+ _loop_1(option);
2749
+ }
2750
+ }
2751
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
2752
+ finally {
2753
+ try {
2754
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
2755
+ }
2756
+ finally { if (e_1) throw e_1.error; }
2757
+ }
2758
+ return opts;
2759
+ // return (this.addChildren !== null && (this.table.level === null || this.table.level > this.level) ? [this.addChildren] : [])
2760
+ // .concat(this.table.options.filter(x => x.condition == null ||
2761
+ // (x.condition.startsWith('!') ? !this.row.Data[x.condition.substring(1)] : this.row.Data[x.condition])).map((o) => {
2762
+ // const i = HelperClass.clone(o);
2763
+ // if (i.url){
2764
+ // i.url = i.url.replace('{}', this.row.Data.Id);
2765
+ // }
2766
+ // i.row = this.row.Data;
2767
+ // i.class = i.class + ' m-h-5 h-25 d-ib va-m f-u';
2768
+ // return i;
2769
+ // })).concat(this.table.hasStatus ? [this.optStatus] : [])
2770
+ // .concat(this.table.permissions.hasAccess('Update') ? [this.optEdit] : [])
2771
+ // .concat(this.table.permissions.hasAccess('Delete') ? [this.optDelete] : []);
2584
2772
  };
2585
2773
  TableRowComponent.prototype.getCell = function (col) {
2586
2774
  console.log('getCell');
2587
- var cv = _.get(this.row, col.name);
2775
+ var cv = _.get(this.row.Data, col.name);
2588
2776
  if (col.fun != null) {
2589
- return col.fun(this.row);
2777
+ return col.fun(this.row.Data);
2590
2778
  }
2591
2779
  else if (col.enum !== null) {
2592
2780
  return col.enum.get(cv);
@@ -2638,7 +2826,7 @@
2638
2826
  return this.table.l(cv);
2639
2827
  };
2640
2828
  TableRowComponent.prototype.getCol = function (n) {
2641
- var c = this.row;
2829
+ var c = this.row.Data;
2642
2830
  n.split('.').forEach(function (x) {
2643
2831
  c = c[x];
2644
2832
  });
@@ -2649,15 +2837,15 @@
2649
2837
  var editAccess = this.table.permissions.getAccess('Update');
2650
2838
  if (this.table.permissions.Type === exports.PermissionTypeEnum.Form) {
2651
2839
  this.table.form.name = editAccess.Name;
2652
- this.table.form.setData(this.row);
2653
- this.table.form.setButtons(this.table.form.onTop, true, this.row.Id);
2840
+ this.table.form.setData(this.row.Data);
2841
+ this.table.form.setButtons(this.table.form.onTop, true, this.row.Data.Id);
2654
2842
  this.table.form.inputs.filter(function (x) { return x.inEditDisabled; }).forEach(function (x) { return x.disabled = true; });
2655
2843
  this.table.form.inputs.filter(function (x) { return !x.inEditVisible; }).forEach(function (x) { return x.visible = false; });
2656
2844
  }
2657
2845
  else {
2658
- new RequestClass(this.table.environment, this.table.l).send(this.table.url + 'Get/' + this.row.Id, exports.Method.Post, null, this.optEdit, function (result) {
2846
+ new RequestClass(this.table.environment, this.table.l).send(this.table.url + 'Get/' + this.row.Data.Id, exports.Method.Post, null, this.optEdit, function (result) {
2659
2847
  _this.table.form.name = editAccess.Name;
2660
- _this.table.form.setButtons(_this.table.form.onTop, true, _this.row.Id);
2848
+ _this.table.form.setButtons(_this.table.form.onTop, true, _this.row.Data.Id);
2661
2849
  _this.table.form.setData(result);
2662
2850
  _this.table.form.inputs.filter(function (x) { return x.inEditDisabled; }).forEach(function (x) { return x.disabled = true; });
2663
2851
  _this.table.form.inputs.filter(function (x) { return !x.inEditVisible; }).forEach(function (x) { return x.visible = false; });
@@ -2669,7 +2857,7 @@
2669
2857
  };
2670
2858
  TableRowComponent.prototype.getChildren = function () {
2671
2859
  var _this = this;
2672
- return this.row.Id ? this.table.rows.filter(function (x) { return x.ParentId === _this.row.Id; }) : [];
2860
+ return this.row.Data.Id ? this.table.rows.filter(function (x) { return x.ParentId === _this.row.Data.Id; }) : [];
2673
2861
  };
2674
2862
  return TableRowComponent;
2675
2863
  }());
@@ -5051,57 +5239,6 @@
5051
5239
  inputLabel: [{ type: core.ViewChild, args: ['inputLabel',] }]
5052
5240
  };
5053
5241
 
5054
- var PermissionClass = /** @class */ (function () {
5055
- function PermissionClass(Name, Icon, Type, OptionType, Area, Controller, Action, Condition, Accesses) {
5056
- if (Name === void 0) { Name = ''; }
5057
- if (Icon === void 0) { Icon = ''; }
5058
- if (Type === void 0) { Type = null; }
5059
- if (OptionType === void 0) { OptionType = null; }
5060
- if (Area === void 0) { Area = ''; }
5061
- if (Controller === void 0) { Controller = ''; }
5062
- if (Action === void 0) { Action = ''; }
5063
- if (Condition === void 0) { Condition = null; }
5064
- if (Accesses === void 0) { Accesses = []; }
5065
- this.Name = Name;
5066
- this.Icon = Icon;
5067
- this.Type = Type;
5068
- this.OptionType = OptionType;
5069
- this.Area = Area;
5070
- this.Controller = Controller;
5071
- this.Action = Action;
5072
- this.Condition = Condition;
5073
- this.Accesses = Accesses;
5074
- this.RelatedId = null;
5075
- this.OnClick = null;
5076
- }
5077
- PermissionClass.prototype.getAccess = function (a) {
5078
- var c = this.Accesses.filter(function (x) { return x.Action === a && x.Type === exports.PermissionTypeEnum.Access; });
5079
- return c.length > 0 ? c[0] : null;
5080
- };
5081
- PermissionClass.prototype.hasAccess = function (a) {
5082
- return this.Accesses.filter(function (x) { return x.Action === a && x.Type === exports.PermissionTypeEnum.Access; }).length > 0;
5083
- };
5084
- PermissionClass.prototype.delete = function (a) {
5085
- this.Accesses = this.Accesses.filter(function (x) { return x.Action !== a; });
5086
- };
5087
- PermissionClass.prototype.hasOption = function (a) {
5088
- return this.Accesses.filter(function (x) { return x.Action === a && x.Type !== exports.PermissionTypeEnum.Access; }).length > 0;
5089
- };
5090
- PermissionClass.prototype.getOptions = function () {
5091
- return this.Accesses.filter(function (x) { return x.Type !== exports.PermissionTypeEnum.Access; });
5092
- };
5093
- PermissionClass.prototype.getOption = function (a) {
5094
- var c = this.Accesses.filter(function (x) { return x.Action === a && x.Type !== exports.PermissionTypeEnum.Access; });
5095
- return c.length > 0 ? c[0] : null;
5096
- };
5097
- PermissionClass.prototype.getUrl = function () {
5098
- return (this.Area ? '/' + this.Area : '') + '/' + this.Controller + '/' +
5099
- (this.RelatedId ? this.RelatedId + "/" : '') +
5100
- (this.Action ? this.Action : '');
5101
- };
5102
- return PermissionClass;
5103
- }());
5104
-
5105
5242
  var FormTableComponent = /** @class */ (function () {
5106
5243
  function FormTableComponent() {
5107
5244
  this.changeIndex = new core.EventEmitter();
@@ -6924,7 +7061,7 @@
6924
7061
  return p.length > 0 ? this.getPermissionClass(p[0]) : null;
6925
7062
  };
6926
7063
  BaseComponent.prototype.getPermissionClass = function (p) {
6927
- return new PermissionClass(p.Name, p.Icon, p.Type, p.OptionType, this.app.area, p.Controller, p.Action, p.Condition, this.getPermissionAccessesClass(p.Id));
7064
+ return new PermissionClass(p.Name, p.Icon, p.Type, p.InputType, p.InputAction, this.app.area, p.Controller, p.Action, p.Condition, this.getPermissionAccessesClass(p.Id));
6928
7065
  };
6929
7066
  BaseComponent.prototype.getPermissionAccessesClass = function (parentId) {
6930
7067
  var _this = this;
@@ -7096,50 +7233,59 @@
7096
7233
  this.permission = false;
7097
7234
  return;
7098
7235
  }
7099
- var insertAccess = this.permissions.getAccess('Insert');
7100
- if (insertAccess != null) {
7101
- var insert = new InputClass(this.environment, this.l, insertAccess.Name, 'fad fa-plus fa-rotate-90', exports.InputType.Button, 'w-u green h-30');
7102
- if (this.form) {
7103
- this.form.url = this.form.baseUrl = this.url + 'Insert';
7104
- if (!this.form.onTop) {
7105
- insert.onClick = function () {
7106
- _this.form.onSuccessBase = function () {
7107
- _this.modal.hide();
7108
- _this.load();
7109
- };
7110
- _this.showInsertModal();
7111
- };
7112
- this.buttons.unshift(insert);
7113
- }
7114
- else {
7115
- this.form.displayLabel = false;
7116
- }
7117
- }
7118
- else {
7119
- this.buttons.unshift(insert);
7120
- if (this.modal) {
7121
- insert.onClick = function () {
7122
- _this.modal.show();
7123
- };
7236
+ try {
7237
+ for (var _b = __values(this.permissions.getAccesses().filter(function (x) { return x.InputAction !== exports.PermissionInputActionEnum.None; })), _c = _b.next(); !_c.done; _c = _b.next()) {
7238
+ var access = _c.value;
7239
+ var accessInp = new InputClass(this.environment, this.l, access.Name, access.Icon, access.InputType === exports.PermissionInputTypeEnum.Button ? exports.InputType.Button : exports.InputType.Icon, 'w-u h-30');
7240
+ if (access.Action === 'Insert') {
7241
+ if (this.form) {
7242
+ this.form.url = this.form.baseUrl = this.url + 'Insert';
7243
+ if (!this.form.onTop) {
7244
+ accessInp.onClick = function () {
7245
+ _this.form.onSuccessBase = function () {
7246
+ _this.modal.hide();
7247
+ _this.load();
7248
+ };
7249
+ _this.showInsertModal();
7250
+ };
7251
+ this.buttons.unshift(accessInp);
7252
+ }
7253
+ else {
7254
+ this.form.displayLabel = false;
7255
+ }
7256
+ }
7257
+ else {
7258
+ this.buttons.unshift(accessInp);
7259
+ if (this.modal) {
7260
+ accessInp.onClick = function () {
7261
+ _this.modal.show();
7262
+ };
7263
+ }
7264
+ else {
7265
+ accessInp.url = this.url + 'Insert';
7266
+ }
7267
+ }
7124
7268
  }
7125
- else {
7126
- insert.url = this.url + 'Insert';
7269
+ else if (access.InputAction === exports.PermissionInputActionEnum.Report) {
7270
+ var p = new PermissionClass();
7271
+ p.RelatedId = 'Index';
7272
+ p.Area = this.permissions.Area;
7273
+ p.Controller = 'Print';
7274
+ p.Action = this.permissions.Controller;
7275
+ accessInp.url = '/Report' + p.getUrl();
7276
+ accessInp.urlNewTab = true;
7127
7277
  }
7278
+ this.buttons.push(accessInp);
7128
7279
  }
7129
7280
  }
7130
- var reportAccess = this.permissions.getAccess('Report');
7131
- if (reportAccess != null) {
7132
- var report = new InputClass(this.environment, this.l, reportAccess.Name, reportAccess.Icon, exports.InputType.Button, 'm-h-5');
7133
- var p = new PermissionClass();
7134
- p.RelatedId = 'Index';
7135
- p.Area = this.permissions.Area;
7136
- p.Controller = 'Print';
7137
- p.Action = this.permissions.Controller;
7138
- report.url = '/Report' + p.getUrl();
7139
- report.urlNewTab = true;
7140
- this.extraButtons.push(report);
7281
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
7282
+ finally {
7283
+ try {
7284
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
7285
+ }
7286
+ finally { if (e_2) throw e_2.error; }
7141
7287
  }
7142
- if ((this.permissions.hasAccess('Insert') || this.permissions.hasAccess('Update')) && this.form) {
7288
+ if ((this.permissions.hasAccess('Insert') || this.permissions.hasOption('Update')) && this.form) {
7143
7289
  this.form.addButtons('Save', 'green', true, this.permissions.Type === exports.PermissionTypeEnum.Form ? function (data) {
7144
7290
  if (data.Id) {
7145
7291
  var i = _this.rows.findIndex(function (x) { return x.Id === data.Id; });
@@ -7167,130 +7313,6 @@
7167
7313
  this.modal.form = this.form;
7168
7314
  }
7169
7315
  }
7170
- var _loop_1 = function (option) {
7171
- if (this_1.options.filter(function (x) { return x.name === option.Name; }).length > 0) {
7172
- return "continue";
7173
- }
7174
- var opt = new InputClass(this_1.environment, this_1.l, option.Name, option.Icon, option.OptionType === exports.PermissionOptionTypeEnum.Icon ? exports.InputType.Icon : exports.InputType.Button, 'blue h-25 m-h-5 d-ib va-m f-u');
7175
- opt.condition = option.Condition;
7176
- if (option.Type === exports.PermissionTypeEnum.OptionLink || option.Type === exports.PermissionTypeEnum.OptionLinkNewTab) {
7177
- var p = new PermissionClass();
7178
- p.RelatedId = this_1.permissions.RelatedId;
7179
- p.Area = this_1.permissions.Area;
7180
- p.Controller = option.Controller ? option.Controller : this_1.permissions.Controller;
7181
- p.Action = this_1.permissions.Action;
7182
- opt.url = p.getUrl() + option.Action + '/{}';
7183
- opt.urlNewTab = option.Type === exports.PermissionTypeEnum.OptionLinkNewTab;
7184
- }
7185
- else if (option.Type === exports.PermissionTypeEnum.OptionModal) {
7186
- opt.modal = option.Modal;
7187
- opt.onClick = function (btn) {
7188
- var e_3, _a;
7189
- if (opt.modal.table) {
7190
- var p = new PermissionClass();
7191
- p.RelatedId = btn.row.Id;
7192
- p.Area = _this.permissions.Area;
7193
- p.Controller = _this.permissions.Controller;
7194
- p.Action = option.Action;
7195
- p.Accesses = option.Accesses;
7196
- opt.modal.table.permissions = p;
7197
- if (opt.modal.table.form) {
7198
- opt.modal.table.form.url = p.getUrl() + 'Insert';
7199
- opt.modal.table.form.baseUrl = p.getUrl() + 'Insert';
7200
- }
7201
- opt.modal.table.set();
7202
- }
7203
- if (opt.modal.form) {
7204
- opt.modal.form.name = option.Name;
7205
- opt.modal.form.url = opt.modal.form.baseUrl + 'Update/' + btn.row.Id;
7206
- opt.modal.form.loadData(opt.modal.form.baseUrl + 'Get/' + btn.row.Id);
7207
- opt.modal.form.onSuccessBase = function () {
7208
- opt.modal.hide();
7209
- };
7210
- }
7211
- if (opt.modal.accordion) {
7212
- try {
7213
- for (var _b = (e_3 = void 0, __values(opt.modal.accordion.rows)), _c = _b.next(); !_c.done; _c = _b.next()) {
7214
- var r = _c.value;
7215
- if (r.table) {
7216
- var p = new PermissionClass();
7217
- p.RelatedId = btn.row.Id;
7218
- p.Area = _this.permissions.Area;
7219
- p.Controller = _this.permissions.Controller;
7220
- p.Action = r.name;
7221
- p.Accesses = option.Accesses;
7222
- r.table.permissions = p;
7223
- if (r.table.form) {
7224
- r.table.form.url = p.getUrl() + 'Insert';
7225
- r.table.form.baseUrl = p.getUrl() + 'Insert';
7226
- }
7227
- r.table.set();
7228
- }
7229
- }
7230
- }
7231
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
7232
- finally {
7233
- try {
7234
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
7235
- }
7236
- finally { if (e_3) throw e_3.error; }
7237
- }
7238
- }
7239
- };
7240
- }
7241
- else if (option.Type === exports.PermissionTypeEnum.OptionReport) {
7242
- var p = new PermissionClass();
7243
- p.RelatedId = 'Index';
7244
- p.Area = this_1.permissions.Area;
7245
- p.Controller = 'Print';
7246
- p.Action = option.Action;
7247
- opt.url = '/Report' + p.getUrl() + '/{}';
7248
- opt.urlNewTab = true;
7249
- }
7250
- else if (option.Type === exports.PermissionTypeEnum.OptionFile) {
7251
- var p = new PermissionClass();
7252
- p.RelatedId = this_1.permissions.RelatedId;
7253
- p.Area = this_1.permissions.Area;
7254
- p.Controller = this_1.permissions.Controller;
7255
- p.Action = (this_1.permissions.Action ? this_1.permissions.Action : '') + option.Action;
7256
- opt.url = '/File' + p.getUrl() + '/{}';
7257
- opt.urlNewTab = true;
7258
- }
7259
- else if (option.Type === exports.PermissionTypeEnum.OptionConfirm) {
7260
- opt.onClick = function (btn) {
7261
- var p = new PermissionClass();
7262
- p.RelatedId = _this.permissions.RelatedId;
7263
- p.Area = _this.permissions.Area;
7264
- p.Controller = _this.permissions.Controller;
7265
- p.Action = option.Action;
7266
- _this.showConfirm(_this.l(option.Action + 'Confirm'), p.getUrl() + '/' + btn.row.Id, null, function () {
7267
- _this.load();
7268
- });
7269
- };
7270
- }
7271
- else if (option.Type === exports.PermissionTypeEnum.Option) {
7272
- if (option.OnClick) {
7273
- opt.onClick = function (btn) {
7274
- option.OnClick(btn);
7275
- };
7276
- }
7277
- }
7278
- this_1.options.push(opt);
7279
- };
7280
- var this_1 = this;
7281
- try {
7282
- for (var _b = __values(this.permissions.getOptions()), _c = _b.next(); !_c.done; _c = _b.next()) {
7283
- var option = _c.value;
7284
- _loop_1(option);
7285
- }
7286
- }
7287
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
7288
- finally {
7289
- try {
7290
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
7291
- }
7292
- finally { if (e_2) throw e_2.error; }
7293
- }
7294
7316
  };
7295
7317
  return TableClass;
7296
7318
  }());