ps-toolkit-ui 0.0.109 → 0.0.113

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 () {
@@ -2564,7 +2570,6 @@
2564
2570
  };
2565
2571
  TableRowComponent.prototype.getOptions = function () {
2566
2572
  var _this = this;
2567
- console.log(this.table.options, 'this.table.options');
2568
2573
  return (this.addChildren !== null && (this.table.level === null || this.table.level > this.level) ? [this.addChildren] : [])
2569
2574
  .concat(this.table.options.filter(function (x) { return x.condition == null ||
2570
2575
  (x.condition.startsWith('!') ? !_this.row[x.condition.substring(1)] : _this.row[x.condition]); }).map(function (o) {
@@ -5049,11 +5054,12 @@
5049
5054
  };
5050
5055
 
5051
5056
  var PermissionClass = /** @class */ (function () {
5052
- function PermissionClass(Name, Icon, Type, OptionType, Area, Controller, Action, Condition, Accesses) {
5057
+ function PermissionClass(Name, Icon, Type, InputType, InputAction, Area, Controller, Action, Condition, Accesses) {
5053
5058
  if (Name === void 0) { Name = ''; }
5054
5059
  if (Icon === void 0) { Icon = ''; }
5055
5060
  if (Type === void 0) { Type = null; }
5056
- if (OptionType === void 0) { OptionType = null; }
5061
+ if (InputType === void 0) { InputType = null; }
5062
+ if (InputAction === void 0) { InputAction = null; }
5057
5063
  if (Area === void 0) { Area = ''; }
5058
5064
  if (Controller === void 0) { Controller = ''; }
5059
5065
  if (Action === void 0) { Action = ''; }
@@ -5062,7 +5068,8 @@
5062
5068
  this.Name = Name;
5063
5069
  this.Icon = Icon;
5064
5070
  this.Type = Type;
5065
- this.OptionType = OptionType;
5071
+ this.InputType = InputType;
5072
+ this.InputAction = InputAction;
5066
5073
  this.Area = Area;
5067
5074
  this.Controller = Controller;
5068
5075
  this.Action = Action;
@@ -5078,17 +5085,20 @@
5078
5085
  PermissionClass.prototype.hasAccess = function (a) {
5079
5086
  return this.Accesses.filter(function (x) { return x.Action === a && x.Type === exports.PermissionTypeEnum.Access; }).length > 0;
5080
5087
  };
5088
+ PermissionClass.prototype.getAccesses = function () {
5089
+ return this.Accesses.filter(function (x) { return x.Type === exports.PermissionTypeEnum.Access; });
5090
+ };
5081
5091
  PermissionClass.prototype.delete = function (a) {
5082
5092
  this.Accesses = this.Accesses.filter(function (x) { return x.Action !== a; });
5083
5093
  };
5084
5094
  PermissionClass.prototype.hasOption = function (a) {
5085
- return this.Accesses.filter(function (x) { return x.Action === a && x.Type !== exports.PermissionTypeEnum.Access; }).length > 0;
5095
+ return this.Accesses.filter(function (x) { return x.Action === a && x.Type === exports.PermissionTypeEnum.Option; }).length > 0;
5086
5096
  };
5087
5097
  PermissionClass.prototype.getOptions = function () {
5088
- return this.Accesses.filter(function (x) { return x.Type !== exports.PermissionTypeEnum.Access; });
5098
+ return this.Accesses.filter(function (x) { return x.Type === exports.PermissionTypeEnum.Option; });
5089
5099
  };
5090
5100
  PermissionClass.prototype.getOption = function (a) {
5091
- var c = this.Accesses.filter(function (x) { return x.Action === a && x.Type !== exports.PermissionTypeEnum.Access; });
5101
+ var c = this.Accesses.filter(function (x) { return x.Action === a && x.Type === exports.PermissionTypeEnum.Option; });
5092
5102
  return c.length > 0 ? c[0] : null;
5093
5103
  };
5094
5104
  PermissionClass.prototype.getUrl = function () {
@@ -5861,14 +5871,13 @@
5861
5871
  this.alert.form.inputs = [
5862
5872
  this.alertLabel
5863
5873
  ];
5864
- this.alert.form.addButtons('Accept', 'blue', false);
5865
5874
  }
5866
5875
  AlertComponent.prototype.show = function (l, accept) {
5867
5876
  var _this = this;
5868
5877
  this.alertLabel.value = l;
5869
- this.alert.form.onSuccess = function (btn) {
5878
+ this.alert.onHide = function () {
5870
5879
  _this.alert.hide();
5871
- accept(btn);
5880
+ accept();
5872
5881
  };
5873
5882
  this.alert.show();
5874
5883
  };
@@ -6827,7 +6836,7 @@
6827
6836
  { type: core.Component, args: [{
6828
6837
  selector: 'lib-notification',
6829
6838
  template: "<div id=\"Notifications\">\r\n</div>\r\n",
6830
- 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)}"]
6839
+ 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)}"]
6831
6840
  },] }
6832
6841
  ];
6833
6842
  NotificationComponent.ctorParameters = function () { return []; };
@@ -6922,7 +6931,7 @@
6922
6931
  return p.length > 0 ? this.getPermissionClass(p[0]) : null;
6923
6932
  };
6924
6933
  BaseComponent.prototype.getPermissionClass = function (p) {
6925
- return new PermissionClass(p.Name, p.Icon, p.Type, p.OptionType, this.app.area, p.Controller, p.Action, p.Condition, this.getPermissionAccessesClass(p.Id));
6934
+ 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));
6926
6935
  };
6927
6936
  BaseComponent.prototype.getPermissionAccessesClass = function (parentId) {
6928
6937
  var _this = this;
@@ -7073,7 +7082,7 @@
7073
7082
  this.modal.show();
7074
7083
  };
7075
7084
  TableClass.prototype.set = function (changeRows) {
7076
- var e_2, _a;
7085
+ var e_2, _a, e_3, _b;
7077
7086
  var _this = this;
7078
7087
  if (changeRows === void 0) { changeRows = null; }
7079
7088
  this.permission = true;
@@ -7094,50 +7103,59 @@
7094
7103
  this.permission = false;
7095
7104
  return;
7096
7105
  }
7097
- var insertAccess = this.permissions.getAccess('Insert');
7098
- if (insertAccess != null) {
7099
- var insert = new InputClass(this.environment, this.l, insertAccess.Name, 'fad fa-plus fa-rotate-90', exports.InputType.Button, 'w-u green h-30');
7100
- if (this.form) {
7101
- this.form.url = this.form.baseUrl = this.url + 'Insert';
7102
- if (!this.form.onTop) {
7103
- insert.onClick = function () {
7104
- _this.form.onSuccessBase = function () {
7105
- _this.modal.hide();
7106
- _this.load();
7107
- };
7108
- _this.showInsertModal();
7109
- };
7110
- this.buttons.unshift(insert);
7111
- }
7112
- else {
7113
- this.form.displayLabel = false;
7114
- }
7115
- }
7116
- else {
7117
- this.buttons.unshift(insert);
7118
- if (this.modal) {
7119
- insert.onClick = function () {
7120
- _this.modal.show();
7121
- };
7106
+ try {
7107
+ for (var _c = __values(this.permissions.getAccesses()), _d = _c.next(); !_d.done; _d = _c.next()) {
7108
+ var access = _d.value;
7109
+ 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');
7110
+ if (access.Action === 'Insert') {
7111
+ if (this.form) {
7112
+ this.form.url = this.form.baseUrl = this.url + 'Insert';
7113
+ if (!this.form.onTop) {
7114
+ accessInp.onClick = function () {
7115
+ _this.form.onSuccessBase = function () {
7116
+ _this.modal.hide();
7117
+ _this.load();
7118
+ };
7119
+ _this.showInsertModal();
7120
+ };
7121
+ this.buttons.unshift(accessInp);
7122
+ }
7123
+ else {
7124
+ this.form.displayLabel = false;
7125
+ }
7126
+ }
7127
+ else {
7128
+ this.buttons.unshift(accessInp);
7129
+ if (this.modal) {
7130
+ accessInp.onClick = function () {
7131
+ _this.modal.show();
7132
+ };
7133
+ }
7134
+ else {
7135
+ accessInp.url = this.url + 'Insert';
7136
+ }
7137
+ }
7122
7138
  }
7123
- else {
7124
- insert.url = this.url + 'Insert';
7139
+ else if (access.InputAction === exports.PermissionInputActionEnum.Report) {
7140
+ var p = new PermissionClass();
7141
+ p.RelatedId = 'Index';
7142
+ p.Area = this.permissions.Area;
7143
+ p.Controller = 'Print';
7144
+ p.Action = this.permissions.Controller;
7145
+ accessInp.url = '/Report' + p.getUrl();
7146
+ accessInp.urlNewTab = true;
7125
7147
  }
7148
+ this.buttons.push(accessInp);
7126
7149
  }
7127
7150
  }
7128
- var reportAccess = this.permissions.getAccess('Report');
7129
- if (reportAccess != null) {
7130
- var report = new InputClass(this.environment, this.l, reportAccess.Name, reportAccess.Icon, exports.InputType.Button, 'm-h-5');
7131
- var p = new PermissionClass();
7132
- p.RelatedId = 'Index';
7133
- p.Area = this.permissions.Area;
7134
- p.Controller = 'Print';
7135
- p.Action = this.permissions.Controller;
7136
- report.url = '/Report' + p.getUrl();
7137
- report.urlNewTab = true;
7138
- this.extraButtons.push(report);
7151
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
7152
+ finally {
7153
+ try {
7154
+ if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
7155
+ }
7156
+ finally { if (e_2) throw e_2.error; }
7139
7157
  }
7140
- if ((this.permissions.hasAccess('Insert') || this.permissions.hasAccess('Update')) && this.form) {
7158
+ if ((this.permissions.hasAccess('Insert') || this.permissions.hasOption('Update')) && this.form) {
7141
7159
  this.form.addButtons('Save', 'green', true, this.permissions.Type === exports.PermissionTypeEnum.Form ? function (data) {
7142
7160
  if (data.Id) {
7143
7161
  var i = _this.rows.findIndex(function (x) { return x.Id === data.Id; });
@@ -7169,21 +7187,21 @@
7169
7187
  if (this_1.options.filter(function (x) { return x.name === option.Name; }).length > 0) {
7170
7188
  return "continue";
7171
7189
  }
7172
- 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');
7190
+ var opt = new InputClass(this_1.environment, this_1.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');
7173
7191
  opt.condition = option.Condition;
7174
- if (option.Type === exports.PermissionTypeEnum.OptionLink || option.Type === exports.PermissionTypeEnum.OptionLinkNewTab) {
7192
+ if (option.InputAction === exports.PermissionInputActionEnum.Link || option.InputAction === exports.PermissionInputActionEnum.LinkNewTab) {
7175
7193
  var p = new PermissionClass();
7176
7194
  p.RelatedId = this_1.permissions.RelatedId;
7177
7195
  p.Area = this_1.permissions.Area;
7178
7196
  p.Controller = option.Controller ? option.Controller : this_1.permissions.Controller;
7179
7197
  p.Action = this_1.permissions.Action;
7180
7198
  opt.url = p.getUrl() + option.Action + '/{}';
7181
- opt.urlNewTab = option.Type === exports.PermissionTypeEnum.OptionLinkNewTab;
7199
+ opt.urlNewTab = option.InputAction === exports.PermissionInputActionEnum.LinkNewTab;
7182
7200
  }
7183
- else if (option.Type === exports.PermissionTypeEnum.OptionModal) {
7201
+ else if (option.InputAction === exports.PermissionInputActionEnum.Modal) {
7184
7202
  opt.modal = option.Modal;
7185
7203
  opt.onClick = function (btn) {
7186
- var e_3, _a;
7204
+ var e_4, _a;
7187
7205
  if (opt.modal.table) {
7188
7206
  var p = new PermissionClass();
7189
7207
  p.RelatedId = btn.row.Id;
@@ -7208,7 +7226,7 @@
7208
7226
  }
7209
7227
  if (opt.modal.accordion) {
7210
7228
  try {
7211
- for (var _b = (e_3 = void 0, __values(opt.modal.accordion.rows)), _c = _b.next(); !_c.done; _c = _b.next()) {
7229
+ for (var _b = (e_4 = void 0, __values(opt.modal.accordion.rows)), _c = _b.next(); !_c.done; _c = _b.next()) {
7212
7230
  var r = _c.value;
7213
7231
  if (r.table) {
7214
7232
  var p = new PermissionClass();
@@ -7226,17 +7244,17 @@
7226
7244
  }
7227
7245
  }
7228
7246
  }
7229
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
7247
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
7230
7248
  finally {
7231
7249
  try {
7232
7250
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
7233
7251
  }
7234
- finally { if (e_3) throw e_3.error; }
7252
+ finally { if (e_4) throw e_4.error; }
7235
7253
  }
7236
7254
  }
7237
7255
  };
7238
7256
  }
7239
- else if (option.Type === exports.PermissionTypeEnum.OptionReport) {
7257
+ else if (option.InputAction === exports.PermissionInputActionEnum.Report) {
7240
7258
  var p = new PermissionClass();
7241
7259
  p.RelatedId = 'Index';
7242
7260
  p.Area = this_1.permissions.Area;
@@ -7245,7 +7263,7 @@
7245
7263
  opt.url = '/Report' + p.getUrl() + '/{}';
7246
7264
  opt.urlNewTab = true;
7247
7265
  }
7248
- else if (option.Type === exports.PermissionTypeEnum.OptionFile) {
7266
+ else if (option.InputAction === exports.PermissionInputActionEnum.File) {
7249
7267
  var p = new PermissionClass();
7250
7268
  p.RelatedId = this_1.permissions.RelatedId;
7251
7269
  p.Area = this_1.permissions.Area;
@@ -7254,7 +7272,7 @@
7254
7272
  opt.url = '/File' + p.getUrl() + '/{}';
7255
7273
  opt.urlNewTab = true;
7256
7274
  }
7257
- else if (option.Type === exports.PermissionTypeEnum.OptionConfirm) {
7275
+ else if (option.InputAction === exports.PermissionInputActionEnum.Confirm) {
7258
7276
  opt.onClick = function (btn) {
7259
7277
  var p = new PermissionClass();
7260
7278
  p.RelatedId = _this.permissions.RelatedId;
@@ -7277,17 +7295,17 @@
7277
7295
  };
7278
7296
  var this_1 = this;
7279
7297
  try {
7280
- for (var _b = __values(this.permissions.getOptions()), _c = _b.next(); !_c.done; _c = _b.next()) {
7281
- var option = _c.value;
7298
+ for (var _e = __values(this.permissions.getOptions()), _f = _e.next(); !_f.done; _f = _e.next()) {
7299
+ var option = _f.value;
7282
7300
  _loop_1(option);
7283
7301
  }
7284
7302
  }
7285
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
7303
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
7286
7304
  finally {
7287
7305
  try {
7288
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
7306
+ if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
7289
7307
  }
7290
- finally { if (e_2) throw e_2.error; }
7308
+ finally { if (e_3) throw e_3.error; }
7291
7309
  }
7292
7310
  };
7293
7311
  return TableClass;