ps-toolkit-ui 1.13.46 → 1.13.48

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.
@@ -935,6 +935,82 @@
935
935
  FileIcons["rar"] = "fa-duotone fa-file-zipper";
936
936
  })(exports.FileIcons || (exports.FileIcons = {}));
937
937
 
938
+ var PermissionClass = /** @class */ (function () {
939
+ function PermissionClass(Name, Icon, Type, InputType, AccessType, InputAction, Area, Controller, Action, Url, Multi, Condition, Accesses) {
940
+ if (Name === void 0) { Name = ''; }
941
+ if (Icon === void 0) { Icon = ''; }
942
+ if (Type === void 0) { Type = null; }
943
+ if (InputType === void 0) { InputType = null; }
944
+ if (AccessType === void 0) { AccessType = null; }
945
+ if (InputAction === void 0) { InputAction = null; }
946
+ if (Area === void 0) { Area = ''; }
947
+ if (Controller === void 0) { Controller = ''; }
948
+ if (Action === void 0) { Action = ''; }
949
+ if (Url === void 0) { Url = ''; }
950
+ if (Multi === void 0) { Multi = false; }
951
+ if (Condition === void 0) { Condition = null; }
952
+ if (Accesses === void 0) { Accesses = []; }
953
+ this.Name = Name;
954
+ this.Icon = Icon;
955
+ this.Type = Type;
956
+ this.InputType = InputType;
957
+ this.AccessType = AccessType;
958
+ this.InputAction = InputAction;
959
+ this.Area = Area;
960
+ this.Controller = Controller;
961
+ this.Action = Action;
962
+ this.Url = Url;
963
+ this.Multi = Multi;
964
+ this.Condition = Condition;
965
+ this.Accesses = Accesses;
966
+ this.RelatedId = null;
967
+ this.OnClick = null;
968
+ }
969
+ PermissionClass.prototype.getAccessByName = function (a) {
970
+ var c = this.Accesses.filter(function (x) { return x.Action === a && x.Type === exports.PermissionTypeEnum.Access; });
971
+ return c.length > 0 ? c[0] : null;
972
+ };
973
+ PermissionClass.prototype.getAccess = function (at) {
974
+ var c = this.Accesses.filter(function (x) { return x.AccessType === at && x.Type === exports.PermissionTypeEnum.Access; });
975
+ return c.length > 0 ? c[0] : null;
976
+ };
977
+ PermissionClass.prototype.hasAccessByName = function (a) {
978
+ return this.Accesses.filter(function (x) { return x.Action === a && x.Type === exports.PermissionTypeEnum.Access; }).length > 0;
979
+ };
980
+ PermissionClass.prototype.hasAccess = function (at) {
981
+ return this.Accesses.filter(function (x) { return x.AccessType === at && x.Type === exports.PermissionTypeEnum.Access; }).length > 0;
982
+ };
983
+ PermissionClass.prototype.getAccesses = function () {
984
+ return this.Accesses.filter(function (x) { return x.Type === exports.PermissionTypeEnum.Access; });
985
+ };
986
+ PermissionClass.prototype.delete = function (a) {
987
+ this.Accesses = this.Accesses.filter(function (x) { return x.Action !== a; });
988
+ };
989
+ PermissionClass.prototype.hasOptionByName = function (a) {
990
+ return this.Accesses.filter(function (x) { return x.Action === a && x.Type === exports.PermissionTypeEnum.Option; }).length > 0;
991
+ };
992
+ PermissionClass.prototype.hasOption = function (at) {
993
+ return this.Accesses.filter(function (x) { return x.AccessType === at && x.Type === exports.PermissionTypeEnum.Option; }).length > 0;
994
+ };
995
+ PermissionClass.prototype.getOptions = function () {
996
+ return this.Accesses.filter(function (x) { return x.Type === exports.PermissionTypeEnum.Option; });
997
+ };
998
+ PermissionClass.prototype.getOptionByName = function (a) {
999
+ var c = this.Accesses.filter(function (x) { return x.Action === a && x.Type === exports.PermissionTypeEnum.Option; });
1000
+ return c.length > 0 ? c[0] : null;
1001
+ };
1002
+ PermissionClass.prototype.getOption = function (at) {
1003
+ var c = this.Accesses.filter(function (x) { return x.AccessType === at && x.Type === exports.PermissionTypeEnum.Option; });
1004
+ return c.length > 0 ? c[0] : null;
1005
+ };
1006
+ PermissionClass.prototype.getUrl = function () {
1007
+ return (this.Area ? '/' + this.Area : '') + '/' + this.Controller + '/' +
1008
+ (this.RelatedId ? this.RelatedId + "/" : '') +
1009
+ (this.Action ? this.Action : '');
1010
+ };
1011
+ return PermissionClass;
1012
+ }());
1013
+
938
1014
  // @dynamic
939
1015
  var HelperClass = /** @class */ (function () {
940
1016
  function HelperClass() {
@@ -1356,7 +1432,57 @@
1356
1432
  return _.groupBy(data, iteratee);
1357
1433
  };
1358
1434
  return HelperClass;
1359
- }());
1435
+ }());
1436
+ HelperClass.getTablePermissions = function (l, i, u, d) {
1437
+ if (l === void 0) { l = true; }
1438
+ if (i === void 0) { i = true; }
1439
+ if (u === void 0) { u = true; }
1440
+ if (d === void 0) { d = true; }
1441
+ var p = new PermissionClass();
1442
+ p.Type = exports.PermissionTypeEnum.Form;
1443
+ var lAccess = new PermissionClass();
1444
+ lAccess.Action = 'List';
1445
+ lAccess.Type = exports.PermissionTypeEnum.Access;
1446
+ lAccess.AccessType = exports.PermissionAccessTypeEnum.List;
1447
+ lAccess.InputAction = exports.PermissionInputActionEnum.None;
1448
+ lAccess.InputType = exports.PermissionInputTypeEnum.Icon;
1449
+ var iAccess = new PermissionClass();
1450
+ iAccess.Action = 'Insert';
1451
+ iAccess.Type = exports.PermissionTypeEnum.Access;
1452
+ iAccess.InputAction = exports.PermissionInputActionEnum.Modal;
1453
+ iAccess.InputType = exports.PermissionInputTypeEnum.Button;
1454
+ iAccess.AccessType = exports.PermissionAccessTypeEnum.Insert;
1455
+ var uAccess = new PermissionClass();
1456
+ uAccess.Action = 'Update';
1457
+ uAccess.Type = exports.PermissionTypeEnum.Option;
1458
+ uAccess.InputAction = exports.PermissionInputActionEnum.None;
1459
+ uAccess.InputType = exports.PermissionInputTypeEnum.Icon;
1460
+ uAccess.AccessType = exports.PermissionAccessTypeEnum.Update;
1461
+ uAccess.Icon = 'fad fa-pen';
1462
+ uAccess.Name = 'Update';
1463
+ var dAccess = new PermissionClass();
1464
+ dAccess.Action = 'Delete';
1465
+ dAccess.Type = exports.PermissionTypeEnum.Option;
1466
+ dAccess.InputAction = exports.PermissionInputActionEnum.None;
1467
+ dAccess.InputType = exports.PermissionInputTypeEnum.Icon;
1468
+ dAccess.AccessType = exports.PermissionAccessTypeEnum.Delete;
1469
+ dAccess.Icon = 'fad fa-trash';
1470
+ dAccess.Name = 'Delete';
1471
+ p.Accesses = [];
1472
+ if (l) {
1473
+ p.Accesses.push(lAccess);
1474
+ }
1475
+ if (i) {
1476
+ p.Accesses.push(iAccess);
1477
+ }
1478
+ if (u) {
1479
+ p.Accesses.push(uAccess);
1480
+ }
1481
+ if (d) {
1482
+ p.Accesses.push(dAccess);
1483
+ }
1484
+ return p;
1485
+ };
1360
1486
 
1361
1487
  var RequestClass = /** @class */ (function () {
1362
1488
  function RequestClass(environment, l) {
@@ -2811,82 +2937,6 @@
2811
2937
  table: [{ type: core.Input }]
2812
2938
  };
2813
2939
 
2814
- var PermissionClass = /** @class */ (function () {
2815
- function PermissionClass(Name, Icon, Type, InputType, AccessType, InputAction, Area, Controller, Action, Url, Multi, Condition, Accesses) {
2816
- if (Name === void 0) { Name = ''; }
2817
- if (Icon === void 0) { Icon = ''; }
2818
- if (Type === void 0) { Type = null; }
2819
- if (InputType === void 0) { InputType = null; }
2820
- if (AccessType === void 0) { AccessType = null; }
2821
- if (InputAction === void 0) { InputAction = null; }
2822
- if (Area === void 0) { Area = ''; }
2823
- if (Controller === void 0) { Controller = ''; }
2824
- if (Action === void 0) { Action = ''; }
2825
- if (Url === void 0) { Url = ''; }
2826
- if (Multi === void 0) { Multi = false; }
2827
- if (Condition === void 0) { Condition = null; }
2828
- if (Accesses === void 0) { Accesses = []; }
2829
- this.Name = Name;
2830
- this.Icon = Icon;
2831
- this.Type = Type;
2832
- this.InputType = InputType;
2833
- this.AccessType = AccessType;
2834
- this.InputAction = InputAction;
2835
- this.Area = Area;
2836
- this.Controller = Controller;
2837
- this.Action = Action;
2838
- this.Url = Url;
2839
- this.Multi = Multi;
2840
- this.Condition = Condition;
2841
- this.Accesses = Accesses;
2842
- this.RelatedId = null;
2843
- this.OnClick = null;
2844
- }
2845
- PermissionClass.prototype.getAccessByName = function (a) {
2846
- var c = this.Accesses.filter(function (x) { return x.Action === a && x.Type === exports.PermissionTypeEnum.Access; });
2847
- return c.length > 0 ? c[0] : null;
2848
- };
2849
- PermissionClass.prototype.getAccess = function (at) {
2850
- var c = this.Accesses.filter(function (x) { return x.AccessType === at && x.Type === exports.PermissionTypeEnum.Access; });
2851
- return c.length > 0 ? c[0] : null;
2852
- };
2853
- PermissionClass.prototype.hasAccessByName = function (a) {
2854
- return this.Accesses.filter(function (x) { return x.Action === a && x.Type === exports.PermissionTypeEnum.Access; }).length > 0;
2855
- };
2856
- PermissionClass.prototype.hasAccess = function (at) {
2857
- return this.Accesses.filter(function (x) { return x.AccessType === at && x.Type === exports.PermissionTypeEnum.Access; }).length > 0;
2858
- };
2859
- PermissionClass.prototype.getAccesses = function () {
2860
- return this.Accesses.filter(function (x) { return x.Type === exports.PermissionTypeEnum.Access; });
2861
- };
2862
- PermissionClass.prototype.delete = function (a) {
2863
- this.Accesses = this.Accesses.filter(function (x) { return x.Action !== a; });
2864
- };
2865
- PermissionClass.prototype.hasOptionByName = function (a) {
2866
- return this.Accesses.filter(function (x) { return x.Action === a && x.Type === exports.PermissionTypeEnum.Option; }).length > 0;
2867
- };
2868
- PermissionClass.prototype.hasOption = function (at) {
2869
- return this.Accesses.filter(function (x) { return x.AccessType === at && x.Type === exports.PermissionTypeEnum.Option; }).length > 0;
2870
- };
2871
- PermissionClass.prototype.getOptions = function () {
2872
- return this.Accesses.filter(function (x) { return x.Type === exports.PermissionTypeEnum.Option; });
2873
- };
2874
- PermissionClass.prototype.getOptionByName = function (a) {
2875
- var c = this.Accesses.filter(function (x) { return x.Action === a && x.Type === exports.PermissionTypeEnum.Option; });
2876
- return c.length > 0 ? c[0] : null;
2877
- };
2878
- PermissionClass.prototype.getOption = function (at) {
2879
- var c = this.Accesses.filter(function (x) { return x.AccessType === at && x.Type === exports.PermissionTypeEnum.Option; });
2880
- return c.length > 0 ? c[0] : null;
2881
- };
2882
- PermissionClass.prototype.getUrl = function () {
2883
- return (this.Area ? '/' + this.Area : '') + '/' + this.Controller + '/' +
2884
- (this.RelatedId ? this.RelatedId + "/" : '') +
2885
- (this.Action ? this.Action : '');
2886
- };
2887
- return PermissionClass;
2888
- }());
2889
-
2890
2940
  var TableRowComponent = /** @class */ (function () {
2891
2941
  function TableRowComponent(service) {
2892
2942
  this.service = service;
@@ -6005,28 +6055,10 @@
6005
6055
  }
6006
6056
  FormTableComponent.prototype.ngOnInit = function () {
6007
6057
  var _this = this;
6008
- var p = new PermissionClass();
6009
- p.Type = exports.PermissionTypeEnum.Form;
6010
- var lAccess = new PermissionClass();
6011
- lAccess.Action = 'List';
6012
- lAccess.Type = exports.PermissionTypeEnum.Access;
6013
- lAccess.AccessType = exports.PermissionAccessTypeEnum.List;
6014
- lAccess.InputAction = exports.PermissionInputActionEnum.None;
6015
- lAccess.InputType = exports.PermissionInputTypeEnum.Icon;
6016
- var iAccess = new PermissionClass();
6017
- iAccess.Action = 'Insert';
6018
- iAccess.Type = exports.PermissionTypeEnum.Access;
6019
- iAccess.InputAction = exports.PermissionInputActionEnum.Modal;
6020
- iAccess.InputType = exports.PermissionInputTypeEnum.Button;
6021
- iAccess.AccessType = exports.PermissionAccessTypeEnum.Insert;
6022
- p.Accesses = [
6023
- lAccess,
6024
- iAccess,
6025
- ];
6026
- this.inp.table.permissions = p;
6058
+ var permissions = this.inp.table.permissions != null ? this.inp.table.permissions : HelperClass.getTablePermissions();
6059
+ this.inp.table.permissions = permissions;
6027
6060
  this.inp.table.displayLabel = false;
6028
6061
  this.inp.table.style = { padding: 0, boxShadow: 'unset' };
6029
- this.inp.table.permissions = p;
6030
6062
  this.inp.table.showExtraButtons = false;
6031
6063
  this.inp.table.loading = false;
6032
6064
  this.inp.table.cols.forEach(function (x) {
@@ -6041,27 +6073,12 @@
6041
6073
  x.class += ' h-30';
6042
6074
  });
6043
6075
  }
6044
- var uAccess = new PermissionClass();
6045
- uAccess.Action = 'Update';
6046
- uAccess.Type = exports.PermissionTypeEnum.Option;
6047
- uAccess.InputAction = exports.PermissionInputActionEnum.None;
6048
- uAccess.InputType = exports.PermissionInputTypeEnum.Icon;
6049
- uAccess.AccessType = exports.PermissionAccessTypeEnum.Update;
6050
- uAccess.Icon = 'fad fa-pen';
6051
- uAccess.Name = 'Update';
6052
- var dAccess = new PermissionClass();
6053
- dAccess.Action = 'Delete';
6054
- dAccess.Type = exports.PermissionTypeEnum.Option;
6055
- dAccess.InputAction = exports.PermissionInputActionEnum.None;
6056
- dAccess.InputType = exports.PermissionInputTypeEnum.Icon;
6057
- dAccess.AccessType = exports.PermissionAccessTypeEnum.Delete;
6058
- dAccess.Icon = 'fad fa-trash';
6059
- dAccess.Name = 'Delete';
6060
6076
  this.inp.setValue = function (v) {
6061
6077
  _this.inp.table.rows = v === null ? [] : v.map(function (x) {
6062
6078
  return {
6063
6079
  Data: x,
6064
- Options: _this.inp.table.form ? [uAccess, dAccess] : [dAccess]
6080
+ Options: _this.inp.table.form ? [permissions.getOption(exports.PermissionAccessTypeEnum.Update), permissions.getOption(exports.PermissionAccessTypeEnum.Delete)] :
6081
+ [permissions.getOption(exports.PermissionAccessTypeEnum.Delete)]
6065
6082
  };
6066
6083
  });
6067
6084
  };