ps-toolkit-ui 1.13.56 → 1.13.57

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.
@@ -1925,10 +1925,11 @@
1925
1925
  });
1926
1926
  return valid;
1927
1927
  };
1928
- FormClass.prototype.clear = function () {
1928
+ FormClass.prototype.clear = function (insertAccess) {
1929
+ if (insertAccess === void 0) { insertAccess = true; }
1929
1930
  this.method = exports.Method.Post;
1930
1931
  this.url = this.baseUrl;
1931
- this.setButtons(this.onTop, false);
1932
+ this.setButtons(this.onTop, false, insertAccess, false);
1932
1933
  this.clearInputs();
1933
1934
  if (this.onTop) {
1934
1935
  this.focus();
@@ -1939,12 +1940,15 @@
1939
1940
  inp.clear();
1940
1941
  });
1941
1942
  };
1942
- FormClass.prototype.setButtons = function (formOnTop, edit, id) {
1943
+ FormClass.prototype.setButtons = function (formOnTop, edit, insertAccess, updateAccess, id) {
1944
+ if (insertAccess === void 0) { insertAccess = false; }
1945
+ if (updateAccess === void 0) { updateAccess = false; }
1943
1946
  if (id === void 0) { id = null; }
1944
1947
  var s = this.inputs.find(function (x) { return x.type === exports.InputType.Submit; });
1945
1948
  if (!s) {
1946
1949
  return;
1947
1950
  }
1951
+ s.disabled = (edit && updateAccess) || (!edit && insertAccess);
1948
1952
  s.name = edit ? 'Accept' : 'Save';
1949
1953
  s.class = edit ? s.class.replace('green', 'blue') : s.class.replace('blue', 'green');
1950
1954
  };
@@ -1978,7 +1982,7 @@
1978
1982
  var erase = new InputClass(this.environment, this.l, null, 'fa-duotone fa-eraser', exports.InputType.Button, 'f-l w-u grey erase-form-btn ' + (this.onTop ? 'h-25 ' : 'h-30 '));
1979
1983
  erase.onClick = function () {
1980
1984
  if (_this.onTop) {
1981
- _this.clear();
1985
+ _this.clear(insertAccess);
1982
1986
  }
1983
1987
  else {
1984
1988
  _this.clearInputs();
@@ -3114,7 +3118,7 @@
3114
3118
  if (!_this.table.form.onTop) {
3115
3119
  _this.table.modal.hide();
3116
3120
  }
3117
- _this.table.form.clear();
3121
+ _this.table.form.clear(_this.table.insertAccess != null);
3118
3122
  _this.table.load();
3119
3123
  };
3120
3124
  }
@@ -3129,7 +3133,7 @@
3129
3133
  opt.class = opt.class.replace('blue', 'red');
3130
3134
  opt.onClick = function () {
3131
3135
  if (_this.table.form) {
3132
- _this.table.form.clear();
3136
+ _this.table.form.clear(_this.table.insertAccess != null);
3133
3137
  }
3134
3138
  if (_this.table.permissions.Type === exports.PermissionTypeEnum.Form) {
3135
3139
  _this.table.rows = _this.table.rows.filter(function (x) { return x.Data.Id !== _this.row.Data.Id; });
@@ -3395,7 +3399,7 @@
3395
3399
  if (this.table.permissions.Type === exports.PermissionTypeEnum.Form) {
3396
3400
  this.table.form.name = opt.name;
3397
3401
  this.table.form.setData(this.row.Data);
3398
- this.table.form.setButtons(this.table.form.onTop, true, this.row.Data.Id);
3402
+ this.table.form.setButtons(this.table.form.onTop, true, false, true, this.row.Data.Id);
3399
3403
  this.table.form.inputs.filter(function (x) { return x.inEditDisabled; }).forEach(function (x) { return x.disabled = true; });
3400
3404
  this.table.form.inputs.filter(function (x) { return !x.inEditVisible; }).forEach(function (x) { return x.visible = false; });
3401
3405
  this.table.form.inputs.forEach(function (x) { return x.required = x.inEditRequired; });
@@ -3407,7 +3411,7 @@
3407
3411
  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) {
3408
3412
  _this.table.form.name = opt.name;
3409
3413
  _this.table.form.setData(result);
3410
- _this.table.form.setButtons(_this.table.form.onTop, true, _this.row.Data.Id);
3414
+ _this.table.form.setButtons(_this.table.form.onTop, true, false, true, _this.row.Data.Id);
3411
3415
  _this.table.form.inputs.filter(function (x) { return x.inEditDisabled; }).forEach(function (x) { return x.disabled = true; });
3412
3416
  _this.table.form.inputs.filter(function (x) { return !x.inEditVisible; }).forEach(function (x) { return x.visible = false; });
3413
3417
  _this.table.form.inputs.forEach(function (x) { return x.required = x.inEditRequired; });
@@ -8613,6 +8617,8 @@
8613
8617
  this.searchForm = null;
8614
8618
  this.modal = null;
8615
8619
  this.level = null;
8620
+ this.listAccess = null;
8621
+ this.insertAccess = null;
8616
8622
  this.onLoad = null;
8617
8623
  this.onSort = null;
8618
8624
  this.getRowClass = null;
@@ -8699,10 +8705,9 @@
8699
8705
  };
8700
8706
  TableClass.prototype.showInsertModal = function (cId) {
8701
8707
  if (cId === void 0) { cId = null; }
8702
- var insertAccess = this.permissions.getAccess(exports.PermissionAccessTypeEnum.Insert);
8703
8708
  this.form.isEdit = false;
8704
- this.form.url = this.form.baseUrl = this.getUrl(insertAccess.Url) + (cId ? '/' + cId : '');
8705
- this.form.name = insertAccess.Name;
8709
+ this.form.url = this.form.baseUrl = this.getUrl(this.insertAccess.Url) + (cId ? '/' + cId : '');
8710
+ this.form.name = this.insertAccess.Name;
8706
8711
  this.form.method = exports.Method.Post;
8707
8712
  this.form.inputs.filter(function (x) { return x.inEditDisabled; }).forEach(function (x) { return x.disabled = false; });
8708
8713
  this.form.inputs.filter(function (x) { return !x.inEditVisible; }).forEach(function (x) { return x.visible = true; });
@@ -8715,10 +8720,11 @@
8715
8720
  if (changeRows === void 0) { changeRows = null; }
8716
8721
  this.permission = true;
8717
8722
  if (this.permissions) {
8718
- var listAccess = this.permissions.getAccess(exports.PermissionAccessTypeEnum.List);
8719
- if (listAccess !== null) {
8720
- this.title = listAccess.Name;
8721
- this.url = this.getUrl(listAccess.Url);
8723
+ this.listAccess = this.permissions.getAccess(exports.PermissionAccessTypeEnum.List);
8724
+ this.insertAccess = this.permissions.getAccess(exports.PermissionAccessTypeEnum.Insert);
8725
+ if (this.listAccess !== null) {
8726
+ this.title = this.listAccess.Name;
8727
+ this.url = this.getUrl(this.listAccess.Url);
8722
8728
  if (this.permissions.Type !== exports.PermissionTypeEnum.Form) {
8723
8729
  this.load();
8724
8730
  }
@@ -8860,11 +8866,11 @@
8860
8866
  if (changeRows) {
8861
8867
  changeRows.emit(data);
8862
8868
  }
8863
- _this.form.clear();
8869
+ _this.form.clear(_this.insertAccess != null);
8864
8870
  } : null);
8865
8871
  if (this.form.onTop) {
8866
8872
  this.form.onSuccessBase = function () {
8867
- _this.form.clear();
8873
+ _this.form.clear(_this.insertAccess != null);
8868
8874
  _this.load();
8869
8875
  };
8870
8876
  }