ps-toolkit-ui 0.0.110 → 0.0.114

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' : '');
@@ -2468,12 +2530,12 @@
2468
2530
  if (this.optEdit !== null) {
2469
2531
  if (this.table.form) {
2470
2532
  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) {
2533
+ _this.table.form.url = _this.table.url + 'Update/' + _this.row.Data.Id;
2534
+ if (_this.table.hasChildren && _this.row.Data.ParentId != null) {
2473
2535
  _this.table.form.onSuccessBase = function () {
2474
2536
  _this.table.modal.hide();
2475
2537
  if (_this.table.childrenAutoLoad) {
2476
- _this.loadParent.emit(_this.row.ParentId);
2538
+ _this.loadParent.emit(_this.row.Data.ParentId);
2477
2539
  }
2478
2540
  else {
2479
2541
  _this.table.load();
@@ -2493,7 +2555,7 @@
2493
2555
  };
2494
2556
  }
2495
2557
  else {
2496
- this.optEdit.url = this.table.url + '/Update/' + this.row.Id;
2558
+ this.optEdit.url = this.table.url + '/Update/' + this.row.Data.Id;
2497
2559
  }
2498
2560
  }
2499
2561
  if (this.optDelete != null) {
@@ -2502,13 +2564,13 @@
2502
2564
  _this.table.form.clear();
2503
2565
  }
2504
2566
  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);
2567
+ _this.table.rows = _this.table.rows.filter(function (x) { return x.Id !== _this.row.Data.Id; });
2568
+ _this.changeRows.emit(_this.row.Data);
2507
2569
  }
2508
2570
  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);
2571
+ _this.confirmShow.emit({ id: _this.row.Data.Id, accept: function () {
2572
+ if (_this.table.hasChildren && _this.table.childrenAutoLoad && _this.row.Data.ParentId != null) {
2573
+ _this.loadParent.emit(_this.row.Data.ParentId);
2512
2574
  }
2513
2575
  else {
2514
2576
  _this.table.load();
@@ -2532,7 +2594,7 @@
2532
2594
  });
2533
2595
  };
2534
2596
  TableRowComponent.prototype.select = function () {
2535
- this.row.selected = !this.row.selected;
2597
+ this.row.Data.selected = !this.row.Data.selected;
2536
2598
  };
2537
2599
  TableRowComponent.prototype.onChangeRows = function (e) {
2538
2600
  return this.changeRows.emit(e);
@@ -2563,26 +2625,154 @@
2563
2625
  }, 500);
2564
2626
  };
2565
2627
  TableRowComponent.prototype.getOptions = function () {
2628
+ var e_1, _a;
2566
2629
  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);
2630
+ var opts = this.addChildren !== null && (this.table.level === null || this.table.level > this.level) ?
2631
+ [this.addChildren] : [];
2632
+ var _loop_1 = function (option) {
2633
+ if (this_1.options.filter(function (x) { return x.name === option.Name; }).length > 0) {
2634
+ return "continue";
2573
2635
  }
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] : []);
2636
+ 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');
2637
+ opt.condition = option.Condition;
2638
+ if (option.InputAction === exports.PermissionInputActionEnum.Link || option.InputAction === exports.PermissionInputActionEnum.LinkNewTab) {
2639
+ var p = new PermissionClass();
2640
+ p.RelatedId = this_1.table.permissions.RelatedId;
2641
+ p.Area = this_1.table.permissions.Area;
2642
+ p.Controller = option.Controller ? option.Controller : this_1.table.permissions.Controller;
2643
+ p.Action = this_1.table.permissions.Action;
2644
+ opt.url = p.getUrl() + option.Action + '/{}';
2645
+ opt.urlNewTab = option.InputAction === exports.PermissionInputActionEnum.LinkNewTab;
2646
+ }
2647
+ else if (option.InputAction === exports.PermissionInputActionEnum.Modal) {
2648
+ opt.modal = option.Modal;
2649
+ opt.onClick = function (btn) {
2650
+ var e_2, _a;
2651
+ if (opt.modal.table) {
2652
+ var p = new PermissionClass();
2653
+ p.RelatedId = btn.row.Id;
2654
+ p.Area = _this.table.permissions.Area;
2655
+ p.Controller = _this.table.permissions.Controller;
2656
+ p.Action = option.Action;
2657
+ p.Accesses = option.Accesses;
2658
+ opt.modal.table.permissions = p;
2659
+ if (opt.modal.table.form) {
2660
+ opt.modal.table.form.url = p.getUrl() + 'Insert';
2661
+ opt.modal.table.form.baseUrl = p.getUrl() + 'Insert';
2662
+ }
2663
+ opt.modal.table.set();
2664
+ }
2665
+ if (opt.modal.form) {
2666
+ opt.modal.form.name = option.Name;
2667
+ opt.modal.form.url = opt.modal.form.baseUrl + 'Update/' + btn.row.Id;
2668
+ opt.modal.form.loadData(opt.modal.form.baseUrl + 'Get/' + btn.row.Id);
2669
+ opt.modal.form.onSuccessBase = function () {
2670
+ opt.modal.hide();
2671
+ };
2672
+ }
2673
+ if (opt.modal.accordion) {
2674
+ try {
2675
+ for (var _b = (e_2 = void 0, __values(opt.modal.accordion.rows)), _c = _b.next(); !_c.done; _c = _b.next()) {
2676
+ var r = _c.value;
2677
+ if (r.table) {
2678
+ var p = new PermissionClass();
2679
+ p.RelatedId = btn.row.Id;
2680
+ p.Area = _this.table.permissions.Area;
2681
+ p.Controller = _this.table.permissions.Controller;
2682
+ p.Action = r.name;
2683
+ p.Accesses = option.Accesses;
2684
+ r.table.permissions = p;
2685
+ if (r.table.form) {
2686
+ r.table.form.url = p.getUrl() + 'Insert';
2687
+ r.table.form.baseUrl = p.getUrl() + 'Insert';
2688
+ }
2689
+ r.table.set();
2690
+ }
2691
+ }
2692
+ }
2693
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
2694
+ finally {
2695
+ try {
2696
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
2697
+ }
2698
+ finally { if (e_2) throw e_2.error; }
2699
+ }
2700
+ }
2701
+ };
2702
+ }
2703
+ else if (option.InputAction === exports.PermissionInputActionEnum.Report) {
2704
+ var p = new PermissionClass();
2705
+ p.RelatedId = 'Index';
2706
+ p.Area = this_1.table.permissions.Area;
2707
+ p.Controller = 'Print';
2708
+ p.Action = option.Action;
2709
+ opt.url = '/Report' + p.getUrl() + '/{}';
2710
+ opt.urlNewTab = true;
2711
+ }
2712
+ else if (option.InputAction === exports.PermissionInputActionEnum.File) {
2713
+ var p = new PermissionClass();
2714
+ p.RelatedId = this_1.table.permissions.RelatedId;
2715
+ p.Area = this_1.table.permissions.Area;
2716
+ p.Controller = this_1.table.permissions.Controller;
2717
+ p.Action = (this_1.table.permissions.Action ? this_1.table.permissions.Action : '') + option.Action;
2718
+ opt.url = '/File' + p.getUrl() + '/{}';
2719
+ opt.urlNewTab = true;
2720
+ }
2721
+ else if (option.InputAction === exports.PermissionInputActionEnum.Confirm) {
2722
+ opt.onClick = function (btn) {
2723
+ var p = new PermissionClass();
2724
+ p.RelatedId = _this.table.permissions.RelatedId;
2725
+ p.Area = _this.table.permissions.Area;
2726
+ p.Controller = _this.table.permissions.Controller;
2727
+ p.Action = option.Action;
2728
+ _this.table.showConfirm(_this.table.l(option.Action + 'Confirm'), p.getUrl() + '/' + btn.row.Id, null, function () {
2729
+ _this.table.load();
2730
+ });
2731
+ };
2732
+ }
2733
+ else if (option.Type === exports.PermissionTypeEnum.Option) {
2734
+ if (option.OnClick) {
2735
+ opt.onClick = function (btn) {
2736
+ option.OnClick(btn);
2737
+ };
2738
+ }
2739
+ }
2740
+ opts.push(opt);
2741
+ };
2742
+ var this_1 = this;
2743
+ try {
2744
+ for (var _b = __values(this.row.Options), _c = _b.next(); !_c.done; _c = _b.next()) {
2745
+ var option = _c.value;
2746
+ _loop_1(option);
2747
+ }
2748
+ }
2749
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
2750
+ finally {
2751
+ try {
2752
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
2753
+ }
2754
+ finally { if (e_1) throw e_1.error; }
2755
+ }
2756
+ return opts;
2757
+ // return (this.addChildren !== null && (this.table.level === null || this.table.level > this.level) ? [this.addChildren] : [])
2758
+ // .concat(this.table.options.filter(x => x.condition == null ||
2759
+ // (x.condition.startsWith('!') ? !this.row.Data[x.condition.substring(1)] : this.row.Data[x.condition])).map((o) => {
2760
+ // const i = HelperClass.clone(o);
2761
+ // if (i.url){
2762
+ // i.url = i.url.replace('{}', this.row.Data.Id);
2763
+ // }
2764
+ // i.row = this.row.Data;
2765
+ // i.class = i.class + ' m-h-5 h-25 d-ib va-m f-u';
2766
+ // return i;
2767
+ // })).concat(this.table.hasStatus ? [this.optStatus] : [])
2768
+ // .concat(this.table.permissions.hasAccess('Update') ? [this.optEdit] : [])
2769
+ // .concat(this.table.permissions.hasAccess('Delete') ? [this.optDelete] : []);
2580
2770
  };
2581
2771
  TableRowComponent.prototype.getCell = function (col) {
2582
2772
  console.log('getCell');
2583
- var cv = _.get(this.row, col.name);
2773
+ var cv = _.get(this.row.Data, col.name);
2584
2774
  if (col.fun != null) {
2585
- return col.fun(this.row);
2775
+ return col.fun(this.row.Data);
2586
2776
  }
2587
2777
  else if (col.enum !== null) {
2588
2778
  return col.enum.get(cv);
@@ -2634,7 +2824,7 @@
2634
2824
  return this.table.l(cv);
2635
2825
  };
2636
2826
  TableRowComponent.prototype.getCol = function (n) {
2637
- var c = this.row;
2827
+ var c = this.row.Data;
2638
2828
  n.split('.').forEach(function (x) {
2639
2829
  c = c[x];
2640
2830
  });
@@ -2645,15 +2835,15 @@
2645
2835
  var editAccess = this.table.permissions.getAccess('Update');
2646
2836
  if (this.table.permissions.Type === exports.PermissionTypeEnum.Form) {
2647
2837
  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);
2838
+ this.table.form.setData(this.row.Data);
2839
+ this.table.form.setButtons(this.table.form.onTop, true, this.row.Data.Id);
2650
2840
  this.table.form.inputs.filter(function (x) { return x.inEditDisabled; }).forEach(function (x) { return x.disabled = true; });
2651
2841
  this.table.form.inputs.filter(function (x) { return !x.inEditVisible; }).forEach(function (x) { return x.visible = false; });
2652
2842
  }
2653
2843
  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) {
2844
+ 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
2845
  _this.table.form.name = editAccess.Name;
2656
- _this.table.form.setButtons(_this.table.form.onTop, true, _this.row.Id);
2846
+ _this.table.form.setButtons(_this.table.form.onTop, true, _this.row.Data.Id);
2657
2847
  _this.table.form.setData(result);
2658
2848
  _this.table.form.inputs.filter(function (x) { return x.inEditDisabled; }).forEach(function (x) { return x.disabled = true; });
2659
2849
  _this.table.form.inputs.filter(function (x) { return !x.inEditVisible; }).forEach(function (x) { return x.visible = false; });
@@ -2665,7 +2855,7 @@
2665
2855
  };
2666
2856
  TableRowComponent.prototype.getChildren = function () {
2667
2857
  var _this = this;
2668
- return this.row.Id ? this.table.rows.filter(function (x) { return x.ParentId === _this.row.Id; }) : [];
2858
+ return this.row.Data.Id ? this.table.rows.filter(function (x) { return x.ParentId === _this.row.Data.Id; }) : [];
2669
2859
  };
2670
2860
  return TableRowComponent;
2671
2861
  }());
@@ -5047,57 +5237,6 @@
5047
5237
  inputLabel: [{ type: core.ViewChild, args: ['inputLabel',] }]
5048
5238
  };
5049
5239
 
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
5240
  var FormTableComponent = /** @class */ (function () {
5102
5241
  function FormTableComponent() {
5103
5242
  this.changeIndex = new core.EventEmitter();
@@ -5860,14 +5999,13 @@
5860
5999
  this.alert.form.inputs = [
5861
6000
  this.alertLabel
5862
6001
  ];
5863
- this.alert.form.addButtons('Accept', 'blue', false);
5864
6002
  }
5865
6003
  AlertComponent.prototype.show = function (l, accept) {
5866
6004
  var _this = this;
5867
6005
  this.alertLabel.value = l;
5868
- this.alert.form.onSuccess = function (btn) {
6006
+ this.alert.onHide = function () {
5869
6007
  _this.alert.hide();
5870
- accept(btn);
6008
+ accept();
5871
6009
  };
5872
6010
  this.alert.show();
5873
6011
  };
@@ -6826,7 +6964,7 @@
6826
6964
  { type: core.Component, args: [{
6827
6965
  selector: 'lib-notification',
6828
6966
  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)}"]
6967
+ 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
6968
  },] }
6831
6969
  ];
6832
6970
  NotificationComponent.ctorParameters = function () { return []; };
@@ -6921,7 +7059,7 @@
6921
7059
  return p.length > 0 ? this.getPermissionClass(p[0]) : null;
6922
7060
  };
6923
7061
  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));
7062
+ 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
7063
  };
6926
7064
  BaseComponent.prototype.getPermissionAccessesClass = function (parentId) {
6927
7065
  var _this = this;
@@ -7093,50 +7231,59 @@
7093
7231
  this.permission = false;
7094
7232
  return;
7095
7233
  }
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
- };
7234
+ try {
7235
+ for (var _b = __values(this.permissions.getAccesses().filter(function (x) { return x.InputAction !== exports.PermissionInputActionEnum.None; })), _c = _b.next(); !_c.done; _c = _b.next()) {
7236
+ var access = _c.value;
7237
+ 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');
7238
+ if (access.Action === 'Insert') {
7239
+ if (this.form) {
7240
+ this.form.url = this.form.baseUrl = this.url + 'Insert';
7241
+ if (!this.form.onTop) {
7242
+ accessInp.onClick = function () {
7243
+ _this.form.onSuccessBase = function () {
7244
+ _this.modal.hide();
7245
+ _this.load();
7246
+ };
7247
+ _this.showInsertModal();
7248
+ };
7249
+ this.buttons.unshift(accessInp);
7250
+ }
7251
+ else {
7252
+ this.form.displayLabel = false;
7253
+ }
7254
+ }
7255
+ else {
7256
+ this.buttons.unshift(accessInp);
7257
+ if (this.modal) {
7258
+ accessInp.onClick = function () {
7259
+ _this.modal.show();
7260
+ };
7261
+ }
7262
+ else {
7263
+ accessInp.url = this.url + 'Insert';
7264
+ }
7265
+ }
7121
7266
  }
7122
- else {
7123
- insert.url = this.url + 'Insert';
7267
+ else if (access.InputAction === exports.PermissionInputActionEnum.Report) {
7268
+ var p = new PermissionClass();
7269
+ p.RelatedId = 'Index';
7270
+ p.Area = this.permissions.Area;
7271
+ p.Controller = 'Print';
7272
+ p.Action = this.permissions.Controller;
7273
+ accessInp.url = '/Report' + p.getUrl();
7274
+ accessInp.urlNewTab = true;
7124
7275
  }
7276
+ this.buttons.push(accessInp);
7125
7277
  }
7126
7278
  }
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);
7279
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
7280
+ finally {
7281
+ try {
7282
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
7283
+ }
7284
+ finally { if (e_2) throw e_2.error; }
7138
7285
  }
7139
- if ((this.permissions.hasAccess('Insert') || this.permissions.hasAccess('Update')) && this.form) {
7286
+ if ((this.permissions.hasAccess('Insert') || this.permissions.hasOption('Update')) && this.form) {
7140
7287
  this.form.addButtons('Save', 'green', true, this.permissions.Type === exports.PermissionTypeEnum.Form ? function (data) {
7141
7288
  if (data.Id) {
7142
7289
  var i = _this.rows.findIndex(function (x) { return x.Id === data.Id; });
@@ -7164,136 +7311,6 @@
7164
7311
  this.modal.form = this.form;
7165
7312
  }
7166
7313
  }
7167
- var _loop_1 = function (option) {
7168
- console.log(option, 'option11111111');
7169
- if (this_1.options.filter(function (x) { return x.name === option.Name; }).length > 0) {
7170
- return "continue";
7171
- }
7172
- console.log(option, 'option22222222');
7173
- 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');
7174
- console.log(option.OptionType, 'option.OptionType');
7175
- console.log(option.Condition, 'option.Condition');
7176
- console.log(option.Type, 'option.Type');
7177
- console.log('-----------------');
7178
- opt.condition = option.Condition;
7179
- if (option.Type === exports.PermissionTypeEnum.OptionLink || option.Type === exports.PermissionTypeEnum.OptionLinkNewTab) {
7180
- var p = new PermissionClass();
7181
- p.RelatedId = this_1.permissions.RelatedId;
7182
- p.Area = this_1.permissions.Area;
7183
- p.Controller = option.Controller ? option.Controller : this_1.permissions.Controller;
7184
- p.Action = this_1.permissions.Action;
7185
- opt.url = p.getUrl() + option.Action + '/{}';
7186
- opt.urlNewTab = option.Type === exports.PermissionTypeEnum.OptionLinkNewTab;
7187
- }
7188
- else if (option.Type === exports.PermissionTypeEnum.OptionModal) {
7189
- opt.modal = option.Modal;
7190
- opt.onClick = function (btn) {
7191
- var e_3, _a;
7192
- if (opt.modal.table) {
7193
- var p = new PermissionClass();
7194
- p.RelatedId = btn.row.Id;
7195
- p.Area = _this.permissions.Area;
7196
- p.Controller = _this.permissions.Controller;
7197
- p.Action = option.Action;
7198
- p.Accesses = option.Accesses;
7199
- opt.modal.table.permissions = p;
7200
- if (opt.modal.table.form) {
7201
- opt.modal.table.form.url = p.getUrl() + 'Insert';
7202
- opt.modal.table.form.baseUrl = p.getUrl() + 'Insert';
7203
- }
7204
- opt.modal.table.set();
7205
- }
7206
- if (opt.modal.form) {
7207
- opt.modal.form.name = option.Name;
7208
- opt.modal.form.url = opt.modal.form.baseUrl + 'Update/' + btn.row.Id;
7209
- opt.modal.form.loadData(opt.modal.form.baseUrl + 'Get/' + btn.row.Id);
7210
- opt.modal.form.onSuccessBase = function () {
7211
- opt.modal.hide();
7212
- };
7213
- }
7214
- if (opt.modal.accordion) {
7215
- try {
7216
- for (var _b = (e_3 = void 0, __values(opt.modal.accordion.rows)), _c = _b.next(); !_c.done; _c = _b.next()) {
7217
- var r = _c.value;
7218
- if (r.table) {
7219
- var p = new PermissionClass();
7220
- p.RelatedId = btn.row.Id;
7221
- p.Area = _this.permissions.Area;
7222
- p.Controller = _this.permissions.Controller;
7223
- p.Action = r.name;
7224
- p.Accesses = option.Accesses;
7225
- r.table.permissions = p;
7226
- if (r.table.form) {
7227
- r.table.form.url = p.getUrl() + 'Insert';
7228
- r.table.form.baseUrl = p.getUrl() + 'Insert';
7229
- }
7230
- r.table.set();
7231
- }
7232
- }
7233
- }
7234
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
7235
- finally {
7236
- try {
7237
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
7238
- }
7239
- finally { if (e_3) throw e_3.error; }
7240
- }
7241
- }
7242
- };
7243
- }
7244
- else if (option.Type === exports.PermissionTypeEnum.OptionReport) {
7245
- var p = new PermissionClass();
7246
- p.RelatedId = 'Index';
7247
- p.Area = this_1.permissions.Area;
7248
- p.Controller = 'Print';
7249
- p.Action = option.Action;
7250
- opt.url = '/Report' + p.getUrl() + '/{}';
7251
- opt.urlNewTab = true;
7252
- }
7253
- else if (option.Type === exports.PermissionTypeEnum.OptionFile) {
7254
- var p = new PermissionClass();
7255
- p.RelatedId = this_1.permissions.RelatedId;
7256
- p.Area = this_1.permissions.Area;
7257
- p.Controller = this_1.permissions.Controller;
7258
- p.Action = (this_1.permissions.Action ? this_1.permissions.Action : '') + option.Action;
7259
- opt.url = '/File' + p.getUrl() + '/{}';
7260
- opt.urlNewTab = true;
7261
- }
7262
- else if (option.Type === exports.PermissionTypeEnum.OptionConfirm) {
7263
- opt.onClick = function (btn) {
7264
- var p = new PermissionClass();
7265
- p.RelatedId = _this.permissions.RelatedId;
7266
- p.Area = _this.permissions.Area;
7267
- p.Controller = _this.permissions.Controller;
7268
- p.Action = option.Action;
7269
- _this.showConfirm(_this.l(option.Action + 'Confirm'), p.getUrl() + '/' + btn.row.Id, null, function () {
7270
- _this.load();
7271
- });
7272
- };
7273
- }
7274
- else if (option.Type === exports.PermissionTypeEnum.Option) {
7275
- if (option.OnClick) {
7276
- opt.onClick = function (btn) {
7277
- option.OnClick(btn);
7278
- };
7279
- }
7280
- }
7281
- this_1.options.push(opt);
7282
- };
7283
- var this_1 = this;
7284
- try {
7285
- for (var _b = __values(this.permissions.getOptions()), _c = _b.next(); !_c.done; _c = _b.next()) {
7286
- var option = _c.value;
7287
- _loop_1(option);
7288
- }
7289
- }
7290
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
7291
- finally {
7292
- try {
7293
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
7294
- }
7295
- finally { if (e_2) throw e_2.error; }
7296
- }
7297
7314
  };
7298
7315
  return TableClass;
7299
7316
  }());