ps-toolkit-ui 0.0.132 → 0.0.136

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.
@@ -2424,32 +2424,43 @@
2424
2424
  this.RelatedId = null;
2425
2425
  this.OnClick = null;
2426
2426
  }
2427
- PermissionClass.prototype.getAccess = function (a, at) {
2428
- if (a === void 0) { a = null; }
2429
- if (at === void 0) { at = null; }
2430
- var c = this.Accesses.filter(function (x) { return ((a != null && x.Action === a) || (at != null && x.AccessType === at)) &&
2431
- x.Type === exports.PermissionTypeEnum.Access; });
2427
+ PermissionClass.prototype.getAccessByName = function (a) {
2428
+ var c = this.Accesses.filter(function (x) { return x.Action === a && x.Type === exports.PermissionTypeEnum.Access; });
2429
+ return c.length > 0 ? c[0] : null;
2430
+ };
2431
+ PermissionClass.prototype.getAccess = function (at) {
2432
+ var c = this.Accesses.filter(function (x) { return x.AccessType === at && x.Type === exports.PermissionTypeEnum.Access; });
2432
2433
  return c.length > 0 ? c[0] : null;
2433
2434
  };
2434
- PermissionClass.prototype.hasAccess = function (a) {
2435
+ PermissionClass.prototype.hasAccessByName = function (a) {
2435
2436
  return this.Accesses.filter(function (x) { return x.Action === a && x.Type === exports.PermissionTypeEnum.Access; }).length > 0;
2436
2437
  };
2438
+ PermissionClass.prototype.hasAccess = function (at) {
2439
+ return this.Accesses.filter(function (x) { return x.AccessType === at && x.Type === exports.PermissionTypeEnum.Access; }).length > 0;
2440
+ };
2437
2441
  PermissionClass.prototype.getAccesses = function () {
2438
2442
  return this.Accesses.filter(function (x) { return x.Type === exports.PermissionTypeEnum.Access; });
2439
2443
  };
2440
2444
  PermissionClass.prototype.delete = function (a) {
2441
2445
  this.Accesses = this.Accesses.filter(function (x) { return x.Action !== a; });
2442
2446
  };
2443
- PermissionClass.prototype.hasOption = function (a) {
2447
+ PermissionClass.prototype.hasOptionByName = function (a) {
2444
2448
  return this.Accesses.filter(function (x) { return x.Action === a && x.Type === exports.PermissionTypeEnum.Option; }).length > 0;
2445
2449
  };
2450
+ PermissionClass.prototype.hasOption = function (at) {
2451
+ return this.Accesses.filter(function (x) { return x.AccessType === at && x.Type === exports.PermissionTypeEnum.Option; }).length > 0;
2452
+ };
2446
2453
  PermissionClass.prototype.getOptions = function () {
2447
2454
  return this.Accesses.filter(function (x) { return x.Type === exports.PermissionTypeEnum.Option; });
2448
2455
  };
2449
- PermissionClass.prototype.getOption = function (a) {
2456
+ PermissionClass.prototype.getOptionByName = function (a) {
2450
2457
  var c = this.Accesses.filter(function (x) { return x.Action === a && x.Type === exports.PermissionTypeEnum.Option; });
2451
2458
  return c.length > 0 ? c[0] : null;
2452
2459
  };
2460
+ PermissionClass.prototype.getOption = function (at) {
2461
+ var c = this.Accesses.filter(function (x) { return x.AccessType === at && x.Type === exports.PermissionTypeEnum.Option; });
2462
+ return c.length > 0 ? c[0] : null;
2463
+ };
2453
2464
  PermissionClass.prototype.getUrl = function () {
2454
2465
  return (this.Area ? '/' + this.Area : '') + '/' + this.Controller + '/' +
2455
2466
  (this.RelatedId ? this.RelatedId + "/" : '') +
@@ -2489,7 +2500,7 @@
2489
2500
  if (!this.table.childrenAutoLoad) {
2490
2501
  this.children = this.getChildren();
2491
2502
  }
2492
- if (this.table.permissions.hasAccess('Insert')) {
2503
+ if (this.table.permissions.hasAccess(exports.PermissionAccessTypeEnum.Insert)) {
2493
2504
  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');
2494
2505
  this.addChildren.onClick = function () {
2495
2506
  _this.table.form.inputs.find(function (x) { return x.name === 'ParentId'; }).setValue(_this.row.Data.Id, false);
@@ -6525,7 +6536,7 @@
6525
6536
  this.optEdit = new InputClass(this.table.environment, this.table.l, this.table.name + 'Update', 'fad fa-pen', exports.InputType.Icon, 'blue h-25 m-h-5 d-ib va-m f-u');
6526
6537
  this.optDelete = new InputClass(this.table.environment, this.table.l, this.table.name + 'Delete', 'fad fa-trash', exports.InputType.Icon, 'red h-25 m-h-5 d-ib va-m f-u');
6527
6538
  if (this.table.hasChildren) {
6528
- if (this.table.permissions.hasAccess('Insert')) {
6539
+ if (this.table.permissions.hasAccess(exports.PermissionAccessTypeEnum.Insert)) {
6529
6540
  this.addChildren = new InputClass(this.table.environment, this.table.l, 'Add', 'fad fa-plus fa-rotate-90', exports.InputType.Icon, 'green m-h-5 h-25 d-ib va-m f-u');
6530
6541
  this.addChildren.onClick = function () {
6531
6542
  _this.table.form.url = _this.table.url + 'Insert';
@@ -7065,10 +7076,10 @@
7065
7076
  return this.app.currentUser.Permissions.filter(function (x) { return x.ParentId === parentId; }).map(function (x) { return _this.getPermissionClass(x); });
7066
7077
  };
7067
7078
  BaseComponent.prototype.hasAccess = function (a) {
7068
- return this.permissions ? this.permissions.hasAccess(a) : false;
7079
+ return this.permissions ? this.permissions.hasAccessByName(a) : false;
7069
7080
  };
7070
7081
  BaseComponent.prototype.hasOption = function (a) {
7071
- return this.permissions ? this.permissions.hasOption(a) : false;
7082
+ return this.permissions ? this.permissions.hasAccessByName(a) : false;
7072
7083
  };
7073
7084
  return BaseComponent;
7074
7085
  }());
@@ -7196,7 +7207,7 @@
7196
7207
  return this.url + 'List';
7197
7208
  };
7198
7209
  TableClass.prototype.showInsertModal = function () {
7199
- var insertAccess = this.permissions.getAccess('Insert');
7210
+ var insertAccess = this.permissions.getAccess(exports.PermissionAccessTypeEnum.Insert);
7200
7211
  this.form.url = this.form.baseUrl = this.url + 'Insert';
7201
7212
  this.form.name = insertAccess.Name;
7202
7213
  this.form.method = exports.Method.Post;
@@ -7210,7 +7221,7 @@
7210
7221
  if (changeRows === void 0) { changeRows = null; }
7211
7222
  this.permission = true;
7212
7223
  if (this.permissions) {
7213
- var listAccess = this.permissions.getAccess('List');
7224
+ var listAccess = this.permissions.getAccess(exports.PermissionAccessTypeEnum.List);
7214
7225
  if (listAccess !== null) {
7215
7226
  this.title = listAccess.Name;
7216
7227
  this.url = this.permissions.getUrl();
@@ -7226,48 +7237,58 @@
7226
7237
  this.permission = false;
7227
7238
  return;
7228
7239
  }
7229
- try {
7230
- for (var _b = __values(this.permissions.getAccesses().filter(function (x) { return x.InputAction !== exports.PermissionInputActionEnum.None; })), _c = _b.next(); !_c.done; _c = _b.next()) {
7231
- var access = _c.value;
7232
- var accessInp = new InputClass(this.environment, this.l, access.Name, access.Icon, access.InputType === exports.PermissionInputTypeEnum.Button ? exports.InputType.Button : exports.InputType.Icon, 'blue w-u h-30');
7233
- if (access.Action === 'Insert') {
7234
- accessInp.class = accessInp.class.replace('blue', 'green');
7235
- if (this.form) {
7236
- this.form.url = this.form.baseUrl = this.url + 'Insert';
7237
- if (!this.form.onTop) {
7238
- accessInp.onClick = function () {
7239
- _this.form.onSuccessBase = function () {
7240
- _this.modal.hide();
7241
- _this.load();
7242
- };
7243
- _this.showInsertModal();
7240
+ var _loop_1 = function (access) {
7241
+ if (this_1.buttons.filter(function (x) { return x.name === access.Name; }).length > 0) {
7242
+ return "continue";
7243
+ }
7244
+ var accessInp = new InputClass(this_1.environment, this_1.l, access.Name, access.Icon, access.InputType === exports.PermissionInputTypeEnum.Button ? exports.InputType.Button : exports.InputType.Icon, 'blue w-u h-30');
7245
+ if (access.Action === 'Insert') {
7246
+ accessInp.class = accessInp.class.replace('blue', 'green');
7247
+ console.log(this_1.form, '111111111111');
7248
+ if (this_1.form) {
7249
+ this_1.form.url = this_1.form.baseUrl = this_1.url + 'Insert';
7250
+ if (!this_1.form.onTop) {
7251
+ accessInp.onClick = function () {
7252
+ _this.form.onSuccessBase = function () {
7253
+ _this.modal.hide();
7254
+ _this.load();
7244
7255
  };
7245
- }
7246
- else {
7247
- this.form.displayLabel = false;
7248
- }
7256
+ _this.showInsertModal();
7257
+ };
7249
7258
  }
7250
7259
  else {
7251
- if (this.modal) {
7252
- accessInp.onClick = function () {
7253
- _this.modal.show();
7254
- };
7255
- }
7256
- else {
7257
- accessInp.url = this.url + 'Insert';
7258
- }
7260
+ this_1.form.displayLabel = false;
7261
+ console.log(this_1.form, '222222222');
7262
+ return "continue";
7259
7263
  }
7260
7264
  }
7261
- else if (access.InputAction === exports.PermissionInputActionEnum.Report) {
7262
- var p = new PermissionClass();
7263
- p.RelatedId = 'Index';
7264
- p.Area = this.permissions.Area;
7265
- p.Controller = 'Print';
7266
- p.Action = this.permissions.Controller;
7267
- accessInp.url = '/Report' + p.getUrl();
7268
- accessInp.urlNewTab = true;
7265
+ else {
7266
+ if (this_1.modal) {
7267
+ accessInp.onClick = function () {
7268
+ _this.modal.show();
7269
+ };
7270
+ }
7271
+ else {
7272
+ accessInp.url = this_1.url + 'Insert';
7273
+ }
7269
7274
  }
7270
- this.buttons.push(accessInp);
7275
+ }
7276
+ else if (access.InputAction === exports.PermissionInputActionEnum.Report) {
7277
+ var p = new PermissionClass();
7278
+ p.RelatedId = 'Index';
7279
+ p.Area = this_1.permissions.Area;
7280
+ p.Controller = 'Print';
7281
+ p.Action = this_1.permissions.Controller;
7282
+ accessInp.url = '/Report' + p.getUrl();
7283
+ accessInp.urlNewTab = true;
7284
+ }
7285
+ this_1.buttons.push(accessInp);
7286
+ };
7287
+ var this_1 = this;
7288
+ try {
7289
+ for (var _b = __values(this.permissions.getAccesses().filter(function (x) { return x.InputAction !== exports.PermissionInputActionEnum.None; })), _c = _b.next(); !_c.done; _c = _b.next()) {
7290
+ var access = _c.value;
7291
+ _loop_1(access);
7271
7292
  }
7272
7293
  }
7273
7294
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
@@ -7277,7 +7298,8 @@
7277
7298
  }
7278
7299
  finally { if (e_2) throw e_2.error; }
7279
7300
  }
7280
- if ((this.permissions.hasAccess('Insert') || this.permissions.hasOption('Update')) && this.form) {
7301
+ if ((this.permissions.hasAccess(exports.PermissionAccessTypeEnum.Insert) ||
7302
+ this.permissions.hasOption(exports.PermissionAccessTypeEnum.Update)) && this.form) {
7281
7303
  this.form.addButtons('Save', 'green', true, this.permissions.Type === exports.PermissionTypeEnum.Form ? function (data) {
7282
7304
  if (data.Id) {
7283
7305
  var i = _this.rows.findIndex(function (x) { return x.Id === data.Id; });