ps-toolkit-ui 0.0.112 → 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.
@@ -807,19 +807,21 @@
807
807
  PermissionTypeEnum[PermissionTypeEnum["Form"] = -1] = "Form";
808
808
  PermissionTypeEnum[PermissionTypeEnum["Item"] = 0] = "Item";
809
809
  PermissionTypeEnum[PermissionTypeEnum["Access"] = 1] = "Access";
810
- PermissionTypeEnum[PermissionTypeEnum["Button"] = 2] = "Button";
811
- PermissionTypeEnum[PermissionTypeEnum["Option"] = 3] = "Option";
812
- PermissionTypeEnum[PermissionTypeEnum["OptionLink"] = 4] = "OptionLink";
813
- PermissionTypeEnum[PermissionTypeEnum["OptionLinkNewTab"] = 5] = "OptionLinkNewTab";
814
- PermissionTypeEnum[PermissionTypeEnum["OptionReport"] = 6] = "OptionReport";
815
- PermissionTypeEnum[PermissionTypeEnum["OptionFile"] = 7] = "OptionFile";
816
- PermissionTypeEnum[PermissionTypeEnum["OptionModal"] = 8] = "OptionModal";
817
- PermissionTypeEnum[PermissionTypeEnum["OptionConfirm"] = 9] = "OptionConfirm";
810
+ PermissionTypeEnum[PermissionTypeEnum["Option"] = 2] = "Option";
818
811
  })(exports.PermissionTypeEnum || (exports.PermissionTypeEnum = {}));
819
- (function (PermissionOptionTypeEnum) {
820
- PermissionOptionTypeEnum[PermissionOptionTypeEnum["Icon"] = 0] = "Icon";
821
- PermissionOptionTypeEnum[PermissionOptionTypeEnum["Button"] = 1] = "Button";
822
- })(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 = {}));
823
825
  (function (VehicleType) {
824
826
  VehicleType[VehicleType["Car"] = 1] = "Car";
825
827
  VehicleType[VehicleType["Motorcycle"] = 2] = "Motorcycle";
@@ -5052,11 +5054,12 @@
5052
5054
  };
5053
5055
 
5054
5056
  var PermissionClass = /** @class */ (function () {
5055
- function PermissionClass(Name, Icon, Type, OptionType, Area, Controller, Action, Condition, Accesses) {
5057
+ function PermissionClass(Name, Icon, Type, InputType, InputAction, Area, Controller, Action, Condition, Accesses) {
5056
5058
  if (Name === void 0) { Name = ''; }
5057
5059
  if (Icon === void 0) { Icon = ''; }
5058
5060
  if (Type === void 0) { Type = null; }
5059
- if (OptionType === void 0) { OptionType = null; }
5061
+ if (InputType === void 0) { InputType = null; }
5062
+ if (InputAction === void 0) { InputAction = null; }
5060
5063
  if (Area === void 0) { Area = ''; }
5061
5064
  if (Controller === void 0) { Controller = ''; }
5062
5065
  if (Action === void 0) { Action = ''; }
@@ -5065,7 +5068,8 @@
5065
5068
  this.Name = Name;
5066
5069
  this.Icon = Icon;
5067
5070
  this.Type = Type;
5068
- this.OptionType = OptionType;
5071
+ this.InputType = InputType;
5072
+ this.InputAction = InputAction;
5069
5073
  this.Area = Area;
5070
5074
  this.Controller = Controller;
5071
5075
  this.Action = Action;
@@ -5081,17 +5085,20 @@
5081
5085
  PermissionClass.prototype.hasAccess = function (a) {
5082
5086
  return this.Accesses.filter(function (x) { return x.Action === a && x.Type === exports.PermissionTypeEnum.Access; }).length > 0;
5083
5087
  };
5088
+ PermissionClass.prototype.getAccesses = function () {
5089
+ return this.Accesses.filter(function (x) { return x.Type === exports.PermissionTypeEnum.Access; });
5090
+ };
5084
5091
  PermissionClass.prototype.delete = function (a) {
5085
5092
  this.Accesses = this.Accesses.filter(function (x) { return x.Action !== a; });
5086
5093
  };
5087
5094
  PermissionClass.prototype.hasOption = function (a) {
5088
- 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;
5089
5096
  };
5090
5097
  PermissionClass.prototype.getOptions = function () {
5091
- 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; });
5092
5099
  };
5093
5100
  PermissionClass.prototype.getOption = function (a) {
5094
- 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; });
5095
5102
  return c.length > 0 ? c[0] : null;
5096
5103
  };
5097
5104
  PermissionClass.prototype.getUrl = function () {
@@ -6924,7 +6931,7 @@
6924
6931
  return p.length > 0 ? this.getPermissionClass(p[0]) : null;
6925
6932
  };
6926
6933
  BaseComponent.prototype.getPermissionClass = function (p) {
6927
- 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));
6928
6935
  };
6929
6936
  BaseComponent.prototype.getPermissionAccessesClass = function (parentId) {
6930
6937
  var _this = this;
@@ -7075,7 +7082,7 @@
7075
7082
  this.modal.show();
7076
7083
  };
7077
7084
  TableClass.prototype.set = function (changeRows) {
7078
- var e_2, _a;
7085
+ var e_2, _a, e_3, _b;
7079
7086
  var _this = this;
7080
7087
  if (changeRows === void 0) { changeRows = null; }
7081
7088
  this.permission = true;
@@ -7096,50 +7103,59 @@
7096
7103
  this.permission = false;
7097
7104
  return;
7098
7105
  }
7099
- var insertAccess = this.permissions.getAccess('Insert');
7100
- if (insertAccess != null) {
7101
- var insert = new InputClass(this.environment, this.l, insertAccess.Name, 'fad fa-plus fa-rotate-90', exports.InputType.Button, 'w-u green h-30');
7102
- if (this.form) {
7103
- this.form.url = this.form.baseUrl = this.url + 'Insert';
7104
- if (!this.form.onTop) {
7105
- insert.onClick = function () {
7106
- _this.form.onSuccessBase = function () {
7107
- _this.modal.hide();
7108
- _this.load();
7109
- };
7110
- _this.showInsertModal();
7111
- };
7112
- this.buttons.unshift(insert);
7113
- }
7114
- else {
7115
- this.form.displayLabel = false;
7116
- }
7117
- }
7118
- else {
7119
- this.buttons.unshift(insert);
7120
- if (this.modal) {
7121
- insert.onClick = function () {
7122
- _this.modal.show();
7123
- };
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
+ }
7124
7138
  }
7125
- else {
7126
- 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;
7127
7147
  }
7148
+ this.buttons.push(accessInp);
7128
7149
  }
7129
7150
  }
7130
- var reportAccess = this.permissions.getAccess('Report');
7131
- if (reportAccess != null) {
7132
- var report = new InputClass(this.environment, this.l, reportAccess.Name, reportAccess.Icon, exports.InputType.Button, 'm-h-5');
7133
- var p = new PermissionClass();
7134
- p.RelatedId = 'Index';
7135
- p.Area = this.permissions.Area;
7136
- p.Controller = 'Print';
7137
- p.Action = this.permissions.Controller;
7138
- report.url = '/Report' + p.getUrl();
7139
- report.urlNewTab = true;
7140
- 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; }
7141
7157
  }
7142
- if ((this.permissions.hasAccess('Insert') || this.permissions.hasAccess('Update')) && this.form) {
7158
+ if ((this.permissions.hasAccess('Insert') || this.permissions.hasOption('Update')) && this.form) {
7143
7159
  this.form.addButtons('Save', 'green', true, this.permissions.Type === exports.PermissionTypeEnum.Form ? function (data) {
7144
7160
  if (data.Id) {
7145
7161
  var i = _this.rows.findIndex(function (x) { return x.Id === data.Id; });
@@ -7171,21 +7187,21 @@
7171
7187
  if (this_1.options.filter(function (x) { return x.name === option.Name; }).length > 0) {
7172
7188
  return "continue";
7173
7189
  }
7174
- 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');
7175
7191
  opt.condition = option.Condition;
7176
- if (option.Type === exports.PermissionTypeEnum.OptionLink || option.Type === exports.PermissionTypeEnum.OptionLinkNewTab) {
7192
+ if (option.InputAction === exports.PermissionInputActionEnum.Link || option.InputAction === exports.PermissionInputActionEnum.LinkNewTab) {
7177
7193
  var p = new PermissionClass();
7178
7194
  p.RelatedId = this_1.permissions.RelatedId;
7179
7195
  p.Area = this_1.permissions.Area;
7180
7196
  p.Controller = option.Controller ? option.Controller : this_1.permissions.Controller;
7181
7197
  p.Action = this_1.permissions.Action;
7182
7198
  opt.url = p.getUrl() + option.Action + '/{}';
7183
- opt.urlNewTab = option.Type === exports.PermissionTypeEnum.OptionLinkNewTab;
7199
+ opt.urlNewTab = option.InputAction === exports.PermissionInputActionEnum.LinkNewTab;
7184
7200
  }
7185
- else if (option.Type === exports.PermissionTypeEnum.OptionModal) {
7201
+ else if (option.InputAction === exports.PermissionInputActionEnum.Modal) {
7186
7202
  opt.modal = option.Modal;
7187
7203
  opt.onClick = function (btn) {
7188
- var e_3, _a;
7204
+ var e_4, _a;
7189
7205
  if (opt.modal.table) {
7190
7206
  var p = new PermissionClass();
7191
7207
  p.RelatedId = btn.row.Id;
@@ -7210,7 +7226,7 @@
7210
7226
  }
7211
7227
  if (opt.modal.accordion) {
7212
7228
  try {
7213
- 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()) {
7214
7230
  var r = _c.value;
7215
7231
  if (r.table) {
7216
7232
  var p = new PermissionClass();
@@ -7228,17 +7244,17 @@
7228
7244
  }
7229
7245
  }
7230
7246
  }
7231
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
7247
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
7232
7248
  finally {
7233
7249
  try {
7234
7250
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
7235
7251
  }
7236
- finally { if (e_3) throw e_3.error; }
7252
+ finally { if (e_4) throw e_4.error; }
7237
7253
  }
7238
7254
  }
7239
7255
  };
7240
7256
  }
7241
- else if (option.Type === exports.PermissionTypeEnum.OptionReport) {
7257
+ else if (option.InputAction === exports.PermissionInputActionEnum.Report) {
7242
7258
  var p = new PermissionClass();
7243
7259
  p.RelatedId = 'Index';
7244
7260
  p.Area = this_1.permissions.Area;
@@ -7247,7 +7263,7 @@
7247
7263
  opt.url = '/Report' + p.getUrl() + '/{}';
7248
7264
  opt.urlNewTab = true;
7249
7265
  }
7250
- else if (option.Type === exports.PermissionTypeEnum.OptionFile) {
7266
+ else if (option.InputAction === exports.PermissionInputActionEnum.File) {
7251
7267
  var p = new PermissionClass();
7252
7268
  p.RelatedId = this_1.permissions.RelatedId;
7253
7269
  p.Area = this_1.permissions.Area;
@@ -7256,7 +7272,7 @@
7256
7272
  opt.url = '/File' + p.getUrl() + '/{}';
7257
7273
  opt.urlNewTab = true;
7258
7274
  }
7259
- else if (option.Type === exports.PermissionTypeEnum.OptionConfirm) {
7275
+ else if (option.InputAction === exports.PermissionInputActionEnum.Confirm) {
7260
7276
  opt.onClick = function (btn) {
7261
7277
  var p = new PermissionClass();
7262
7278
  p.RelatedId = _this.permissions.RelatedId;
@@ -7279,17 +7295,17 @@
7279
7295
  };
7280
7296
  var this_1 = this;
7281
7297
  try {
7282
- for (var _b = __values(this.permissions.getOptions()), _c = _b.next(); !_c.done; _c = _b.next()) {
7283
- 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;
7284
7300
  _loop_1(option);
7285
7301
  }
7286
7302
  }
7287
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
7303
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
7288
7304
  finally {
7289
7305
  try {
7290
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
7306
+ if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
7291
7307
  }
7292
- finally { if (e_2) throw e_2.error; }
7308
+ finally { if (e_3) throw e_3.error; }
7293
7309
  }
7294
7310
  };
7295
7311
  return TableClass;