ps-toolkit-ui 1.12.98 → 1.13.0

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.
@@ -233,6 +233,7 @@
233
233
  Cancel: 'انصراف',
234
234
  UserDeActive: 'نام کاربری غیر فعال شده است',
235
235
  DeleteConfirm: 'آیا از حذف این مورد مطمئن هستید ؟',
236
+ DeleteConfirmMulti: 'آیا از حذف موارد انتخاب شده ({} مورد) مطمئن هستید ؟',
236
237
  ChooseFiles: 'انتخاب فایل ها',
237
238
  CodeNotExpired: 'کد تایید ارسال شده منقضی نشده است',
238
239
  ChooseFile: 'انتخاب فایل',
@@ -2999,9 +3000,6 @@
2999
3000
  }
3000
3001
  }, 500);
3001
3002
  };
3002
- TableRowComponent.prototype.getOptionUrl = function (url, relatedId, rowId) {
3003
- return (relatedId ? url.replace('{}', relatedId) : (url.match(/{}/g) || []).length > 1 ? url.replace('/{}', '') : url).replace('{}', rowId);
3004
- };
3005
3003
  TableRowComponent.prototype.setOptions = function () {
3006
3004
  var e_1, _b, e_2, _c;
3007
3005
  var _this = this;
@@ -3041,7 +3039,7 @@
3041
3039
  if (option.AccessType === exports.PermissionAccessTypeEnum.Update) {
3042
3040
  if (this_2.table.form) {
3043
3041
  opt.onClick = function () {
3044
- _this.table.form.url = _this.getOptionUrl(option.Url, _this.table.permissions.RelatedId, _this.row.Data.Id);
3042
+ _this.table.form.url = _this.table.getOptionUrl(option.Url, _this.table.permissions.RelatedId, _this.row.Data.Id);
3045
3043
  if (_this.table.hasChildren && _this.row.Data.ParentId != null) {
3046
3044
  _this.table.form.onSuccessBase = function () {
3047
3045
  _this.table.modal.hide();
@@ -3066,7 +3064,7 @@
3066
3064
  };
3067
3065
  }
3068
3066
  else {
3069
- opt.url = this_2.getOptionUrl(option.Url, this_2.table.permissions.RelatedId, this_2.row.Data.Id);
3067
+ opt.url = this_2.table.getOptionUrl(option.Url, this_2.table.permissions.RelatedId, this_2.row.Data.Id);
3070
3068
  }
3071
3069
  }
3072
3070
  else if (option.AccessType === exports.PermissionAccessTypeEnum.Delete) {
@@ -3082,7 +3080,7 @@
3082
3080
  else {
3083
3081
  _this.confirmShow.emit({
3084
3082
  action: option.Action,
3085
- url: _this.getOptionUrl(option.Url, _this.table.permissions.RelatedId, _this.row.Data.Id),
3083
+ url: _this.table.getOptionUrl(option.Url, _this.table.permissions.RelatedId, _this.row.Data.Id),
3086
3084
  accept: function () {
3087
3085
  if (_this.table.hasChildren && _this.table.childrenAutoLoad && _this.row.Data.ParentId != null) {
3088
3086
  _this.loadParent.emit(_this.row.Data.ParentId);
@@ -3096,7 +3094,7 @@
3096
3094
  };
3097
3095
  }
3098
3096
  else if (option.AccessType === exports.PermissionAccessTypeEnum.Report) {
3099
- opt.url = this_2.getOptionUrl('/report' + option.Url, this_2.table.permissions.RelatedId, this_2.row.Data.Id);
3097
+ opt.url = this_2.table.getOptionUrl('/report' + option.Url, this_2.table.permissions.RelatedId, this_2.row.Data.Id);
3100
3098
  opt.urlNewTab = true;
3101
3099
  }
3102
3100
  else if (option.InputAction === exports.PermissionInputActionEnum.Link || option.InputAction === exports.PermissionInputActionEnum.LinkNewTab) {
@@ -3170,7 +3168,7 @@
3170
3168
  p.Area = this_2.table.permissions.Area;
3171
3169
  p.Controller = option.Controller;
3172
3170
  p.Action = option.Action;
3173
- opt.url = '/file' + this_2.getOptionUrl(option.Url, this_2.table.permissions.RelatedId, this_2.row.Data.Id);
3171
+ opt.url = '/file' + this_2.table.getOptionUrl(option.Url, this_2.table.permissions.RelatedId, this_2.row.Data.Id);
3174
3172
  opt.urlNewTab = true;
3175
3173
  }
3176
3174
  else if (option.InputAction === exports.PermissionInputActionEnum.Confirm) {
@@ -3180,7 +3178,7 @@
3180
3178
  p.Area = _this.table.permissions.Area;
3181
3179
  p.Controller = option.Controller;
3182
3180
  p.Action = option.Action;
3183
- _this.table.showConfirm(_this.table.l(option.Action + 'Confirm'), _this.getOptionUrl(option.Url, _this.table.permissions.RelatedId, _this.row.Data.Id), null, function () {
3181
+ _this.table.showConfirm(_this.table.l(option.Action + 'Confirm'), _this.table.getOptionUrl(option.Url, _this.table.permissions.RelatedId, _this.row.Data.Id), null, function () {
3184
3182
  _this.table.load();
3185
3183
  });
3186
3184
  };
@@ -3345,7 +3343,7 @@
3345
3343
  this.table.form.inputs.forEach(function (x) { return x.required = x.inEditRequired; });
3346
3344
  }
3347
3345
  else {
3348
- new RequestClass(this.table.environment, this.table.l).send(this.getOptionUrl(option.Url.replace('update', 'get'), this.table.permissions.RelatedId, this.row.Data.Id), exports.Method.Post, null, opt, function (result) {
3346
+ new RequestClass(this.table.environment, this.table.l).send(this.table.getOptionUrl(option.Url.replace('update', 'get'), this.table.permissions.RelatedId, this.row.Data.Id), exports.Method.Post, null, opt, function (result) {
3349
3347
  _this.table.form.name = opt.name;
3350
3348
  _this.table.form.setData(result);
3351
3349
  _this.table.form.setButtons(_this.table.form.onTop, true, _this.row.Data.Id);
@@ -8598,6 +8596,9 @@
8598
8596
  TableClass.prototype.data = function () {
8599
8597
  return this.rows.filter(function (x) { return x.selected; }).map(function (x) { return x.Data; });
8600
8598
  };
8599
+ TableClass.prototype.getOptionUrl = function (url, relatedId, rowId) {
8600
+ return (relatedId ? url.replace('{}', relatedId) : (url.match(/{}/g) || []).length > 1 ? url.replace('/{}', '') : url).replace('{}', rowId);
8601
+ };
8601
8602
  TableClass.prototype.searchData = function (report) {
8602
8603
  var e_1, _a, e_2, _b;
8603
8604
  if (report === void 0) { report = false; }
@@ -8759,11 +8760,28 @@
8759
8760
  }
8760
8761
  finally { if (e_3) throw e_3.error; }
8761
8762
  }
8763
+ var _loop_2 = function (option) {
8764
+ var opt = new InputClass(this_2.environment, this_2.l, option.Name, option.Icon, exports.InputType.Icon, 'm-r-10-p');
8765
+ opt.onClick = function () {
8766
+ var p = new PermissionClass();
8767
+ p.RelatedId = _this.permissions.RelatedId;
8768
+ p.Area = _this.permissions.Area;
8769
+ p.Controller = option.Controller;
8770
+ p.Action = option.Action;
8771
+ var data = { Ids: _this.data().map(function (x) { return x.Id; }) };
8772
+ console.log(_this.getOptionUrl(option.Url, _this.permissions.RelatedId, ''));
8773
+ console.log(data);
8774
+ _this.showConfirm(_this.l(option.Action + 'ConfirmMulti', data.Ids.length), _this.getOptionUrl(option.Url, _this.permissions.RelatedId, ''), data, function () {
8775
+ _this.load();
8776
+ });
8777
+ };
8778
+ this_2.extraButtons.push(opt);
8779
+ };
8780
+ var this_2 = this;
8762
8781
  try {
8763
8782
  for (var _e = __values(this.permissions.getOptions().filter(function (x) { return x.Multi; })), _f = _e.next(); !_f.done; _f = _e.next()) {
8764
- var multiOptions = _f.value;
8765
- var option = new InputClass(this.environment, this.l, multiOptions.Name, multiOptions.Icon, exports.InputType.Icon, 'm-r-10-p');
8766
- this.extraButtons.push(option);
8783
+ var option = _f.value;
8784
+ _loop_2(option);
8767
8785
  }
8768
8786
  }
8769
8787
  catch (e_4_1) { e_4 = { error: e_4_1 }; }