ps-toolkit-ui 0.0.111 → 0.0.115

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.
@@ -146,6 +146,7 @@
146
146
  AccessDenied: 'عدم دسترسی',
147
147
  Image: 'تصویر',
148
148
  Grade: 'پایه تحصیلی',
149
+ Close: 'بستن',
149
150
  Desc: 'توضیحات',
150
151
  Admin: 'ادمین',
151
152
  Print: 'گزارش',
@@ -175,7 +176,9 @@
175
176
  ChooseMonth: 'انتخاب ماه',
176
177
  FullName: 'نام کامل',
177
178
  FirstName: 'نام',
179
+ Backup: 'بک آپ',
178
180
  LastName: 'نام خانوادگی',
181
+ OperationSuccessful: 'عملیات با موفقیت انجام شد',
179
182
  Reject: 'رد کردن',
180
183
  Code: 'کد تایید',
181
184
  InvalidRequest: 'درخواست شما نامعتبر است',
@@ -804,19 +807,21 @@
804
807
  PermissionTypeEnum[PermissionTypeEnum["Form"] = -1] = "Form";
805
808
  PermissionTypeEnum[PermissionTypeEnum["Item"] = 0] = "Item";
806
809
  PermissionTypeEnum[PermissionTypeEnum["Access"] = 1] = "Access";
807
- PermissionTypeEnum[PermissionTypeEnum["Button"] = 2] = "Button";
808
- PermissionTypeEnum[PermissionTypeEnum["Option"] = 3] = "Option";
809
- PermissionTypeEnum[PermissionTypeEnum["OptionLink"] = 4] = "OptionLink";
810
- PermissionTypeEnum[PermissionTypeEnum["OptionLinkNewTab"] = 5] = "OptionLinkNewTab";
811
- PermissionTypeEnum[PermissionTypeEnum["OptionReport"] = 6] = "OptionReport";
812
- PermissionTypeEnum[PermissionTypeEnum["OptionFile"] = 7] = "OptionFile";
813
- PermissionTypeEnum[PermissionTypeEnum["OptionModal"] = 8] = "OptionModal";
814
- PermissionTypeEnum[PermissionTypeEnum["OptionConfirm"] = 9] = "OptionConfirm";
810
+ PermissionTypeEnum[PermissionTypeEnum["Option"] = 2] = "Option";
815
811
  })(exports.PermissionTypeEnum || (exports.PermissionTypeEnum = {}));
816
- (function (PermissionOptionTypeEnum) {
817
- PermissionOptionTypeEnum[PermissionOptionTypeEnum["Icon"] = 0] = "Icon";
818
- PermissionOptionTypeEnum[PermissionOptionTypeEnum["Button"] = 1] = "Button";
819
- })(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 = {}));
820
825
  (function (VehicleType) {
821
826
  VehicleType[VehicleType["Car"] = 1] = "Car";
822
827
  VehicleType[VehicleType["Motorcycle"] = 2] = "Motorcycle";
@@ -1092,10 +1097,11 @@
1092
1097
  HelperClass.getName = function (n) {
1093
1098
  return n.replace(/ک/g, 'ك').replace(/ی/g, 'ي').replace(/آ/g, 'آ');
1094
1099
  };
1095
- HelperClass.addNotification = function (m) {
1100
+ HelperClass.addNotification = function (m, e) {
1101
+ if (e === void 0) { e = true; }
1096
1102
  var id = HelperClass.random(20);
1097
1103
  // tslint:disable-next-line
1098
- $__namespace('#Notifications').append('<div id="' + id + '" class="con"><div class="item"><i class="fas fa-times"></i><div>' + m + '</div></div></div>');
1104
+ $__namespace('#Notifications').append('<div id="' + id + '" class="con"><div class="item ' + (e ? 'error' : 'success') + '"><i class="fas fa-times"></i><div>' + m + '</div></div></div>');
1099
1105
  setTimeout(function () {
1100
1106
  var d = $__namespace('#' + id);
1101
1107
  d.fadeOut(300, function () {
@@ -2386,6 +2392,62 @@
2386
2392
  table: [{ type: core.Input }]
2387
2393
  };
2388
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
+
2389
2451
  var TableRowComponent = /** @class */ (function () {
2390
2452
  function TableRowComponent(service) {
2391
2453
  this.service = service;
@@ -2430,23 +2492,23 @@
2430
2492
  if (this.table.permissions.hasAccess('Insert')) {
2431
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');
2432
2494
  this.addChildren.onClick = function () {
2433
- _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);
2434
2496
  _this.table.form.onSuccessBase = function () {
2435
2497
  _this.table.modal.hide();
2436
2498
  _this.showChildren.type = exports.InputType.Icon;
2437
- _this.loadChildren(_this.row.Id);
2499
+ _this.loadChildren(_this.row.Data.Id);
2438
2500
  };
2439
2501
  _this.table.showInsertModal();
2440
2502
  };
2441
2503
  }
2442
- 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');
2443
2505
  this.showChildren.onClick = function () {
2444
2506
  if ($__namespace(_this.childrenDiv.nativeElement).is(':visible')) {
2445
2507
  $__namespace(_this.childrenDiv.nativeElement).hide();
2446
2508
  _this.showChildren.icon = 'fad fa-angle-left f-s-22';
2447
2509
  }
2448
2510
  else if (_this.children.length === 0) {
2449
- _this.loadChildren(_this.row.Id);
2511
+ _this.loadChildren(_this.row.Data.Id);
2450
2512
  }
2451
2513
  else {
2452
2514
  $__namespace(_this.childrenDiv.nativeElement).show();
@@ -2455,8 +2517,8 @@
2455
2517
  };
2456
2518
  }
2457
2519
  if (this.table.hasStatus) {
2458
- 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' : ''));
2459
- 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;
2460
2522
  this.optStatus.onClick = function (btn) {
2461
2523
  new RequestClass(_this.table.l).send(_this.table.url + '/Status/' + btn.row.Id, exports.Method.Post, null, btn, function (r) {
2462
2524
  btn.class = 'm-h-5 h-20 ' + (r ? 'green' : '');
@@ -2464,16 +2526,15 @@
2464
2526
  });
2465
2527
  };
2466
2528
  }
2467
- this.options = this.getOptions();
2468
2529
  if (this.optEdit !== null) {
2469
2530
  if (this.table.form) {
2470
2531
  this.optEdit.onClick = function () {
2471
- _this.table.form.url = _this.table.url + 'Update/' + _this.row.Id;
2472
- 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) {
2473
2534
  _this.table.form.onSuccessBase = function () {
2474
2535
  _this.table.modal.hide();
2475
2536
  if (_this.table.childrenAutoLoad) {
2476
- _this.loadParent.emit(_this.row.ParentId);
2537
+ _this.loadParent.emit(_this.row.Data.ParentId);
2477
2538
  }
2478
2539
  else {
2479
2540
  _this.table.load();
@@ -2493,7 +2554,7 @@
2493
2554
  };
2494
2555
  }
2495
2556
  else {
2496
- this.optEdit.url = this.table.url + '/Update/' + this.row.Id;
2557
+ this.optEdit.url = this.table.url + '/Update/' + this.row.Data.Id;
2497
2558
  }
2498
2559
  }
2499
2560
  if (this.optDelete != null) {
@@ -2502,13 +2563,13 @@
2502
2563
  _this.table.form.clear();
2503
2564
  }
2504
2565
  if (_this.table.permissions.Type === exports.PermissionTypeEnum.Form) {
2505
- _this.table.rows = _this.table.rows.filter(function (x) { return x.Id !== _this.row.Id; });
2506
- _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);
2507
2568
  }
2508
2569
  else {
2509
- _this.confirmShow.emit({ id: _this.row.Id, accept: function () {
2510
- if (_this.table.hasChildren && _this.table.childrenAutoLoad && _this.row.ParentId != null) {
2511
- _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);
2512
2573
  }
2513
2574
  else {
2514
2575
  _this.table.load();
@@ -2532,7 +2593,7 @@
2532
2593
  });
2533
2594
  };
2534
2595
  TableRowComponent.prototype.select = function () {
2535
- this.row.selected = !this.row.selected;
2596
+ this.row.Data.selected = !this.row.Data.selected;
2536
2597
  };
2537
2598
  TableRowComponent.prototype.onChangeRows = function (e) {
2538
2599
  return this.changeRows.emit(e);
@@ -2563,26 +2624,154 @@
2563
2624
  }, 500);
2564
2625
  };
2565
2626
  TableRowComponent.prototype.getOptions = function () {
2627
+ var e_1, _a;
2566
2628
  var _this = this;
2567
- return (this.addChildren !== null && (this.table.level === null || this.table.level > this.level) ? [this.addChildren] : [])
2568
- .concat(this.table.options.filter(function (x) { return x.condition == null ||
2569
- (x.condition.startsWith('!') ? !_this.row[x.condition.substring(1)] : _this.row[x.condition]); }).map(function (o) {
2570
- var i = HelperClass.clone(o);
2571
- if (i.url) {
2572
- 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
+ var _loop_1 = function (option) {
2632
+ if (this_1.table.options.filter(function (x) { return x.name === option.Name; }).length > 0) {
2633
+ return "continue";
2573
2634
  }
2574
- i.row = _this.row;
2575
- i.class = i.class + ' m-h-5 h-25 d-ib va-m f-u';
2576
- return i;
2577
- })).concat(this.table.hasStatus ? [this.optStatus] : [])
2578
- .concat(this.table.permissions.hasAccess('Update') ? [this.optEdit] : [])
2579
- .concat(this.table.permissions.hasAccess('Delete') ? [this.optDelete] : []);
2635
+ 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');
2636
+ opt.condition = option.Condition;
2637
+ if (option.InputAction === exports.PermissionInputActionEnum.Link || option.InputAction === exports.PermissionInputActionEnum.LinkNewTab) {
2638
+ var p = new PermissionClass();
2639
+ p.RelatedId = this_1.table.permissions.RelatedId;
2640
+ p.Area = this_1.table.permissions.Area;
2641
+ p.Controller = option.Controller ? option.Controller : this_1.table.permissions.Controller;
2642
+ p.Action = this_1.table.permissions.Action;
2643
+ opt.url = p.getUrl() + option.Action + '/{}';
2644
+ opt.urlNewTab = option.InputAction === exports.PermissionInputActionEnum.LinkNewTab;
2645
+ }
2646
+ else if (option.InputAction === exports.PermissionInputActionEnum.Modal) {
2647
+ opt.modal = option.Modal;
2648
+ opt.onClick = function (btn) {
2649
+ var e_2, _a;
2650
+ if (opt.modal.table) {
2651
+ var p = new PermissionClass();
2652
+ p.RelatedId = btn.row.Id;
2653
+ p.Area = _this.table.permissions.Area;
2654
+ p.Controller = _this.table.permissions.Controller;
2655
+ p.Action = option.Action;
2656
+ p.Accesses = option.Accesses;
2657
+ opt.modal.table.permissions = p;
2658
+ if (opt.modal.table.form) {
2659
+ opt.modal.table.form.url = p.getUrl() + 'Insert';
2660
+ opt.modal.table.form.baseUrl = p.getUrl() + 'Insert';
2661
+ }
2662
+ opt.modal.table.set();
2663
+ }
2664
+ if (opt.modal.form) {
2665
+ opt.modal.form.name = option.Name;
2666
+ opt.modal.form.url = opt.modal.form.baseUrl + 'Update/' + btn.row.Id;
2667
+ opt.modal.form.loadData(opt.modal.form.baseUrl + 'Get/' + btn.row.Id);
2668
+ opt.modal.form.onSuccessBase = function () {
2669
+ opt.modal.hide();
2670
+ };
2671
+ }
2672
+ if (opt.modal.accordion) {
2673
+ try {
2674
+ for (var _b = (e_2 = void 0, __values(opt.modal.accordion.rows)), _c = _b.next(); !_c.done; _c = _b.next()) {
2675
+ var r = _c.value;
2676
+ if (r.table) {
2677
+ var p = new PermissionClass();
2678
+ p.RelatedId = btn.row.Id;
2679
+ p.Area = _this.table.permissions.Area;
2680
+ p.Controller = _this.table.permissions.Controller;
2681
+ p.Action = r.name;
2682
+ p.Accesses = option.Accesses;
2683
+ r.table.permissions = p;
2684
+ if (r.table.form) {
2685
+ r.table.form.url = p.getUrl() + 'Insert';
2686
+ r.table.form.baseUrl = p.getUrl() + 'Insert';
2687
+ }
2688
+ r.table.set();
2689
+ }
2690
+ }
2691
+ }
2692
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
2693
+ finally {
2694
+ try {
2695
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
2696
+ }
2697
+ finally { if (e_2) throw e_2.error; }
2698
+ }
2699
+ }
2700
+ };
2701
+ }
2702
+ else if (option.InputAction === exports.PermissionInputActionEnum.Report) {
2703
+ var p = new PermissionClass();
2704
+ p.RelatedId = 'Index';
2705
+ p.Area = this_1.table.permissions.Area;
2706
+ p.Controller = 'Print';
2707
+ p.Action = option.Action;
2708
+ opt.url = '/Report' + p.getUrl() + '/{}';
2709
+ opt.urlNewTab = true;
2710
+ }
2711
+ else if (option.InputAction === exports.PermissionInputActionEnum.File) {
2712
+ var p = new PermissionClass();
2713
+ p.RelatedId = this_1.table.permissions.RelatedId;
2714
+ p.Area = this_1.table.permissions.Area;
2715
+ p.Controller = this_1.table.permissions.Controller;
2716
+ p.Action = (this_1.table.permissions.Action ? this_1.table.permissions.Action : '') + option.Action;
2717
+ opt.url = '/File' + p.getUrl() + '/{}';
2718
+ opt.urlNewTab = true;
2719
+ }
2720
+ else if (option.InputAction === exports.PermissionInputActionEnum.Confirm) {
2721
+ opt.onClick = function (btn) {
2722
+ var p = new PermissionClass();
2723
+ p.RelatedId = _this.table.permissions.RelatedId;
2724
+ p.Area = _this.table.permissions.Area;
2725
+ p.Controller = _this.table.permissions.Controller;
2726
+ p.Action = option.Action;
2727
+ _this.table.showConfirm(_this.table.l(option.Action + 'Confirm'), p.getUrl() + '/' + btn.row.Id, null, function () {
2728
+ _this.table.load();
2729
+ });
2730
+ };
2731
+ }
2732
+ else if (option.Type === exports.PermissionTypeEnum.Option) {
2733
+ if (option.OnClick) {
2734
+ opt.onClick = function (btn) {
2735
+ option.OnClick(btn);
2736
+ };
2737
+ }
2738
+ }
2739
+ opts.push(opt);
2740
+ };
2741
+ var this_1 = this;
2742
+ try {
2743
+ for (var _b = __values(this.row.Options), _c = _b.next(); !_c.done; _c = _b.next()) {
2744
+ var option = _c.value;
2745
+ _loop_1(option);
2746
+ }
2747
+ }
2748
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
2749
+ finally {
2750
+ try {
2751
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
2752
+ }
2753
+ finally { if (e_1) throw e_1.error; }
2754
+ }
2755
+ return opts;
2756
+ // return (this.addChildren !== null && (this.table.level === null || this.table.level > this.level) ? [this.addChildren] : [])
2757
+ // .concat(this.table.options.filter(x => x.condition == null ||
2758
+ // (x.condition.startsWith('!') ? !this.row.Data[x.condition.substring(1)] : this.row.Data[x.condition])).map((o) => {
2759
+ // const i = HelperClass.clone(o);
2760
+ // if (i.url){
2761
+ // i.url = i.url.replace('{}', this.row.Data.Id);
2762
+ // }
2763
+ // i.row = this.row.Data;
2764
+ // i.class = i.class + ' m-h-5 h-25 d-ib va-m f-u';
2765
+ // return i;
2766
+ // })).concat(this.table.hasStatus ? [this.optStatus] : [])
2767
+ // .concat(this.table.permissions.hasAccess('Update') ? [this.optEdit] : [])
2768
+ // .concat(this.table.permissions.hasAccess('Delete') ? [this.optDelete] : []);
2580
2769
  };
2581
2770
  TableRowComponent.prototype.getCell = function (col) {
2582
2771
  console.log('getCell');
2583
- var cv = _.get(this.row, col.name);
2772
+ var cv = _.get(this.row.Data, col.name);
2584
2773
  if (col.fun != null) {
2585
- return col.fun(this.row);
2774
+ return col.fun(this.row.Data);
2586
2775
  }
2587
2776
  else if (col.enum !== null) {
2588
2777
  return col.enum.get(cv);
@@ -2634,7 +2823,7 @@
2634
2823
  return this.table.l(cv);
2635
2824
  };
2636
2825
  TableRowComponent.prototype.getCol = function (n) {
2637
- var c = this.row;
2826
+ var c = this.row.Data;
2638
2827
  n.split('.').forEach(function (x) {
2639
2828
  c = c[x];
2640
2829
  });
@@ -2645,15 +2834,15 @@
2645
2834
  var editAccess = this.table.permissions.getAccess('Update');
2646
2835
  if (this.table.permissions.Type === exports.PermissionTypeEnum.Form) {
2647
2836
  this.table.form.name = editAccess.Name;
2648
- this.table.form.setData(this.row);
2649
- this.table.form.setButtons(this.table.form.onTop, true, this.row.Id);
2837
+ this.table.form.setData(this.row.Data);
2838
+ this.table.form.setButtons(this.table.form.onTop, true, this.row.Data.Id);
2650
2839
  this.table.form.inputs.filter(function (x) { return x.inEditDisabled; }).forEach(function (x) { return x.disabled = true; });
2651
2840
  this.table.form.inputs.filter(function (x) { return !x.inEditVisible; }).forEach(function (x) { return x.visible = false; });
2652
2841
  }
2653
2842
  else {
2654
- new RequestClass(this.table.environment, this.table.l).send(this.table.url + 'Get/' + this.row.Id, exports.Method.Post, null, this.optEdit, function (result) {
2843
+ 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) {
2655
2844
  _this.table.form.name = editAccess.Name;
2656
- _this.table.form.setButtons(_this.table.form.onTop, true, _this.row.Id);
2845
+ _this.table.form.setButtons(_this.table.form.onTop, true, _this.row.Data.Id);
2657
2846
  _this.table.form.setData(result);
2658
2847
  _this.table.form.inputs.filter(function (x) { return x.inEditDisabled; }).forEach(function (x) { return x.disabled = true; });
2659
2848
  _this.table.form.inputs.filter(function (x) { return !x.inEditVisible; }).forEach(function (x) { return x.visible = false; });
@@ -2665,7 +2854,7 @@
2665
2854
  };
2666
2855
  TableRowComponent.prototype.getChildren = function () {
2667
2856
  var _this = this;
2668
- return this.row.Id ? this.table.rows.filter(function (x) { return x.ParentId === _this.row.Id; }) : [];
2857
+ return this.row.Data.Id ? this.table.rows.filter(function (x) { return x.ParentId === _this.row.Data.Id; }) : [];
2669
2858
  };
2670
2859
  return TableRowComponent;
2671
2860
  }());
@@ -5047,57 +5236,6 @@
5047
5236
  inputLabel: [{ type: core.ViewChild, args: ['inputLabel',] }]
5048
5237
  };
5049
5238
 
5050
- var PermissionClass = /** @class */ (function () {
5051
- function PermissionClass(Name, Icon, Type, OptionType, Area, Controller, Action, Condition, Accesses) {
5052
- if (Name === void 0) { Name = ''; }
5053
- if (Icon === void 0) { Icon = ''; }
5054
- if (Type === void 0) { Type = null; }
5055
- if (OptionType === void 0) { OptionType = null; }
5056
- if (Area === void 0) { Area = ''; }
5057
- if (Controller === void 0) { Controller = ''; }
5058
- if (Action === void 0) { Action = ''; }
5059
- if (Condition === void 0) { Condition = null; }
5060
- if (Accesses === void 0) { Accesses = []; }
5061
- this.Name = Name;
5062
- this.Icon = Icon;
5063
- this.Type = Type;
5064
- this.OptionType = OptionType;
5065
- this.Area = Area;
5066
- this.Controller = Controller;
5067
- this.Action = Action;
5068
- this.Condition = Condition;
5069
- this.Accesses = Accesses;
5070
- this.RelatedId = null;
5071
- this.OnClick = null;
5072
- }
5073
- PermissionClass.prototype.getAccess = function (a) {
5074
- var c = this.Accesses.filter(function (x) { return x.Action === a && x.Type === exports.PermissionTypeEnum.Access; });
5075
- return c.length > 0 ? c[0] : null;
5076
- };
5077
- PermissionClass.prototype.hasAccess = function (a) {
5078
- return this.Accesses.filter(function (x) { return x.Action === a && x.Type === exports.PermissionTypeEnum.Access; }).length > 0;
5079
- };
5080
- PermissionClass.prototype.delete = function (a) {
5081
- this.Accesses = this.Accesses.filter(function (x) { return x.Action !== a; });
5082
- };
5083
- PermissionClass.prototype.hasOption = function (a) {
5084
- return this.Accesses.filter(function (x) { return x.Action === a && x.Type !== exports.PermissionTypeEnum.Access; }).length > 0;
5085
- };
5086
- PermissionClass.prototype.getOptions = function () {
5087
- return this.Accesses.filter(function (x) { return x.Type !== exports.PermissionTypeEnum.Access; });
5088
- };
5089
- PermissionClass.prototype.getOption = function (a) {
5090
- var c = this.Accesses.filter(function (x) { return x.Action === a && x.Type !== exports.PermissionTypeEnum.Access; });
5091
- return c.length > 0 ? c[0] : null;
5092
- };
5093
- PermissionClass.prototype.getUrl = function () {
5094
- return (this.Area ? '/' + this.Area : '') + '/' + this.Controller + '/' +
5095
- (this.RelatedId ? this.RelatedId + "/" : '') +
5096
- (this.Action ? this.Action : '');
5097
- };
5098
- return PermissionClass;
5099
- }());
5100
-
5101
5239
  var FormTableComponent = /** @class */ (function () {
5102
5240
  function FormTableComponent() {
5103
5241
  this.changeIndex = new core.EventEmitter();
@@ -5860,14 +5998,13 @@
5860
5998
  this.alert.form.inputs = [
5861
5999
  this.alertLabel
5862
6000
  ];
5863
- this.alert.form.addButtons('Accept', 'blue', false);
5864
6001
  }
5865
6002
  AlertComponent.prototype.show = function (l, accept) {
5866
6003
  var _this = this;
5867
6004
  this.alertLabel.value = l;
5868
- this.alert.form.onSuccess = function (btn) {
6005
+ this.alert.onHide = function () {
5869
6006
  _this.alert.hide();
5870
- accept(btn);
6007
+ accept();
5871
6008
  };
5872
6009
  this.alert.show();
5873
6010
  };
@@ -6826,7 +6963,7 @@
6826
6963
  { type: core.Component, args: [{
6827
6964
  selector: 'lib-notification',
6828
6965
  template: "<div id=\"Notifications\">\r\n</div>\r\n",
6829
- styles: ["#Notifications{bottom:20px;position:fixed;right:0;width:350px;z-index:9999}::ng-deep #Notifications .con{float:right;padding:5px 20px;width:calc(100% - 40px)}::ng-deep #Notifications .item{background-color:var(--red);border-radius:5px;box-shadow:var(--box-shadow);color:#fff;float:right;position:relative;text-align:center;width:100%}::ng-deep #Notifications .item i{cursor:pointer;float:right;height:30px;line-height:30px;width:30px}::ng-deep #Notifications .item i:hover{background-color:var(--red-dark)}::ng-deep #Notifications .item div{float:right;font-size:12px;line-height:20px;padding:10px;width:calc(100% - 30px)}"]
6966
+ styles: ["#Notifications{bottom:20px;position:fixed;right:0;width:350px;z-index:9999}::ng-deep #Notifications .con{float:right;padding:5px 20px;width:calc(100% - 40px)}::ng-deep #Notifications .item{background-color:var(--red);border-radius:5px;box-shadow:var(--box-shadow);color:#fff;float:right;position:relative;text-align:center;width:100%}::ng-deep #Notifications .item.success{background-color:var(--green)}::ng-deep #Notifications .item i{cursor:pointer;float:right;height:30px;line-height:30px;width:30px}::ng-deep #Notifications .item i:hover{background-color:var(--red-dark)}::ng-deep #Notifications .item.success i:hover{background-color:var(--green-dark)}::ng-deep #Notifications .item div{float:right;font-size:12px;line-height:20px;padding:10px;width:calc(100% - 30px)}"]
6830
6967
  },] }
6831
6968
  ];
6832
6969
  NotificationComponent.ctorParameters = function () { return []; };
@@ -6921,7 +7058,7 @@
6921
7058
  return p.length > 0 ? this.getPermissionClass(p[0]) : null;
6922
7059
  };
6923
7060
  BaseComponent.prototype.getPermissionClass = function (p) {
6924
- return new PermissionClass(p.Name, p.Icon, p.Type, p.OptionType, this.app.area, p.Controller, p.Action, p.Condition, this.getPermissionAccessesClass(p.Id));
7061
+ 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));
6925
7062
  };
6926
7063
  BaseComponent.prototype.getPermissionAccessesClass = function (parentId) {
6927
7064
  var _this = this;
@@ -7093,50 +7230,59 @@
7093
7230
  this.permission = false;
7094
7231
  return;
7095
7232
  }
7096
- var insertAccess = this.permissions.getAccess('Insert');
7097
- if (insertAccess != null) {
7098
- var insert = new InputClass(this.environment, this.l, insertAccess.Name, 'fad fa-plus fa-rotate-90', exports.InputType.Button, 'w-u green h-30');
7099
- if (this.form) {
7100
- this.form.url = this.form.baseUrl = this.url + 'Insert';
7101
- if (!this.form.onTop) {
7102
- insert.onClick = function () {
7103
- _this.form.onSuccessBase = function () {
7104
- _this.modal.hide();
7105
- _this.load();
7106
- };
7107
- _this.showInsertModal();
7108
- };
7109
- this.buttons.unshift(insert);
7110
- }
7111
- else {
7112
- this.form.displayLabel = false;
7113
- }
7114
- }
7115
- else {
7116
- this.buttons.unshift(insert);
7117
- if (this.modal) {
7118
- insert.onClick = function () {
7119
- _this.modal.show();
7120
- };
7233
+ try {
7234
+ for (var _b = __values(this.permissions.getAccesses().filter(function (x) { return x.InputAction !== exports.PermissionInputActionEnum.None; })), _c = _b.next(); !_c.done; _c = _b.next()) {
7235
+ var access = _c.value;
7236
+ 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');
7237
+ if (access.Action === 'Insert') {
7238
+ if (this.form) {
7239
+ this.form.url = this.form.baseUrl = this.url + 'Insert';
7240
+ if (!this.form.onTop) {
7241
+ accessInp.onClick = function () {
7242
+ _this.form.onSuccessBase = function () {
7243
+ _this.modal.hide();
7244
+ _this.load();
7245
+ };
7246
+ _this.showInsertModal();
7247
+ };
7248
+ this.buttons.unshift(accessInp);
7249
+ }
7250
+ else {
7251
+ this.form.displayLabel = false;
7252
+ }
7253
+ }
7254
+ else {
7255
+ this.buttons.unshift(accessInp);
7256
+ if (this.modal) {
7257
+ accessInp.onClick = function () {
7258
+ _this.modal.show();
7259
+ };
7260
+ }
7261
+ else {
7262
+ accessInp.url = this.url + 'Insert';
7263
+ }
7264
+ }
7121
7265
  }
7122
- else {
7123
- insert.url = this.url + 'Insert';
7266
+ else if (access.InputAction === exports.PermissionInputActionEnum.Report) {
7267
+ var p = new PermissionClass();
7268
+ p.RelatedId = 'Index';
7269
+ p.Area = this.permissions.Area;
7270
+ p.Controller = 'Print';
7271
+ p.Action = this.permissions.Controller;
7272
+ accessInp.url = '/Report' + p.getUrl();
7273
+ accessInp.urlNewTab = true;
7124
7274
  }
7275
+ this.buttons.push(accessInp);
7125
7276
  }
7126
7277
  }
7127
- var reportAccess = this.permissions.getAccess('Report');
7128
- if (reportAccess != null) {
7129
- var report = new InputClass(this.environment, this.l, reportAccess.Name, reportAccess.Icon, exports.InputType.Button, 'm-h-5');
7130
- var p = new PermissionClass();
7131
- p.RelatedId = 'Index';
7132
- p.Area = this.permissions.Area;
7133
- p.Controller = 'Print';
7134
- p.Action = this.permissions.Controller;
7135
- report.url = '/Report' + p.getUrl();
7136
- report.urlNewTab = true;
7137
- this.extraButtons.push(report);
7278
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
7279
+ finally {
7280
+ try {
7281
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
7282
+ }
7283
+ finally { if (e_2) throw e_2.error; }
7138
7284
  }
7139
- if ((this.permissions.hasAccess('Insert') || this.permissions.hasAccess('Update')) && this.form) {
7285
+ if ((this.permissions.hasAccess('Insert') || this.permissions.hasOption('Update')) && this.form) {
7140
7286
  this.form.addButtons('Save', 'green', true, this.permissions.Type === exports.PermissionTypeEnum.Form ? function (data) {
7141
7287
  if (data.Id) {
7142
7288
  var i = _this.rows.findIndex(function (x) { return x.Id === data.Id; });
@@ -7164,130 +7310,6 @@
7164
7310
  this.modal.form = this.form;
7165
7311
  }
7166
7312
  }
7167
- var _loop_1 = function (option) {
7168
- if (this_1.options.filter(function (x) { return x.name === option.Name; }).length > 0) {
7169
- return "continue";
7170
- }
7171
- 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');
7172
- opt.condition = option.Condition;
7173
- if (option.Type === exports.PermissionTypeEnum.OptionLink || option.Type === exports.PermissionTypeEnum.OptionLinkNewTab) {
7174
- var p = new PermissionClass();
7175
- p.RelatedId = this_1.permissions.RelatedId;
7176
- p.Area = this_1.permissions.Area;
7177
- p.Controller = option.Controller ? option.Controller : this_1.permissions.Controller;
7178
- p.Action = this_1.permissions.Action;
7179
- opt.url = p.getUrl() + option.Action + '/{}';
7180
- opt.urlNewTab = option.Type === exports.PermissionTypeEnum.OptionLinkNewTab;
7181
- }
7182
- else if (option.Type === exports.PermissionTypeEnum.OptionModal) {
7183
- opt.modal = option.Modal;
7184
- opt.onClick = function (btn) {
7185
- var e_3, _a;
7186
- if (opt.modal.table) {
7187
- var p = new PermissionClass();
7188
- p.RelatedId = btn.row.Id;
7189
- p.Area = _this.permissions.Area;
7190
- p.Controller = _this.permissions.Controller;
7191
- p.Action = option.Action;
7192
- p.Accesses = option.Accesses;
7193
- opt.modal.table.permissions = p;
7194
- if (opt.modal.table.form) {
7195
- opt.modal.table.form.url = p.getUrl() + 'Insert';
7196
- opt.modal.table.form.baseUrl = p.getUrl() + 'Insert';
7197
- }
7198
- opt.modal.table.set();
7199
- }
7200
- if (opt.modal.form) {
7201
- opt.modal.form.name = option.Name;
7202
- opt.modal.form.url = opt.modal.form.baseUrl + 'Update/' + btn.row.Id;
7203
- opt.modal.form.loadData(opt.modal.form.baseUrl + 'Get/' + btn.row.Id);
7204
- opt.modal.form.onSuccessBase = function () {
7205
- opt.modal.hide();
7206
- };
7207
- }
7208
- if (opt.modal.accordion) {
7209
- try {
7210
- for (var _b = (e_3 = void 0, __values(opt.modal.accordion.rows)), _c = _b.next(); !_c.done; _c = _b.next()) {
7211
- var r = _c.value;
7212
- if (r.table) {
7213
- var p = new PermissionClass();
7214
- p.RelatedId = btn.row.Id;
7215
- p.Area = _this.permissions.Area;
7216
- p.Controller = _this.permissions.Controller;
7217
- p.Action = r.name;
7218
- p.Accesses = option.Accesses;
7219
- r.table.permissions = p;
7220
- if (r.table.form) {
7221
- r.table.form.url = p.getUrl() + 'Insert';
7222
- r.table.form.baseUrl = p.getUrl() + 'Insert';
7223
- }
7224
- r.table.set();
7225
- }
7226
- }
7227
- }
7228
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
7229
- finally {
7230
- try {
7231
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
7232
- }
7233
- finally { if (e_3) throw e_3.error; }
7234
- }
7235
- }
7236
- };
7237
- }
7238
- else if (option.Type === exports.PermissionTypeEnum.OptionReport) {
7239
- var p = new PermissionClass();
7240
- p.RelatedId = 'Index';
7241
- p.Area = this_1.permissions.Area;
7242
- p.Controller = 'Print';
7243
- p.Action = option.Action;
7244
- opt.url = '/Report' + p.getUrl() + '/{}';
7245
- opt.urlNewTab = true;
7246
- }
7247
- else if (option.Type === exports.PermissionTypeEnum.OptionFile) {
7248
- var p = new PermissionClass();
7249
- p.RelatedId = this_1.permissions.RelatedId;
7250
- p.Area = this_1.permissions.Area;
7251
- p.Controller = this_1.permissions.Controller;
7252
- p.Action = (this_1.permissions.Action ? this_1.permissions.Action : '') + option.Action;
7253
- opt.url = '/File' + p.getUrl() + '/{}';
7254
- opt.urlNewTab = true;
7255
- }
7256
- else if (option.Type === exports.PermissionTypeEnum.OptionConfirm) {
7257
- opt.onClick = function (btn) {
7258
- var p = new PermissionClass();
7259
- p.RelatedId = _this.permissions.RelatedId;
7260
- p.Area = _this.permissions.Area;
7261
- p.Controller = _this.permissions.Controller;
7262
- p.Action = option.Action;
7263
- _this.showConfirm(_this.l(option.Action + 'Confirm'), p.getUrl() + '/' + btn.row.Id, null, function () {
7264
- _this.load();
7265
- });
7266
- };
7267
- }
7268
- else if (option.Type === exports.PermissionTypeEnum.Option) {
7269
- if (option.OnClick) {
7270
- opt.onClick = function (btn) {
7271
- option.OnClick(btn);
7272
- };
7273
- }
7274
- }
7275
- this_1.options.push(opt);
7276
- };
7277
- var this_1 = this;
7278
- try {
7279
- for (var _b = __values(this.permissions.getOptions()), _c = _b.next(); !_c.done; _c = _b.next()) {
7280
- var option = _c.value;
7281
- _loop_1(option);
7282
- }
7283
- }
7284
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
7285
- finally {
7286
- try {
7287
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
7288
- }
7289
- finally { if (e_2) throw e_2.error; }
7290
- }
7291
7313
  };
7292
7314
  return TableClass;
7293
7315
  }());