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.
@@ -125,6 +125,7 @@ const strings = {
125
125
  AccessDenied: 'عدم دسترسی',
126
126
  Image: 'تصویر',
127
127
  Grade: 'پایه تحصیلی',
128
+ Close: 'بستن',
128
129
  Desc: 'توضیحات',
129
130
  Admin: 'ادمین',
130
131
  Print: 'گزارش',
@@ -154,7 +155,9 @@ const strings = {
154
155
  ChooseMonth: 'انتخاب ماه',
155
156
  FullName: 'نام کامل',
156
157
  FirstName: 'نام',
158
+ Backup: 'بک آپ',
157
159
  LastName: 'نام خانوادگی',
160
+ OperationSuccessful: 'عملیات با موفقیت انجام شد',
158
161
  Reject: 'رد کردن',
159
162
  Code: 'کد تایید',
160
163
  InvalidRequest: 'درخواست شما نامعتبر است',
@@ -466,20 +469,23 @@ var PermissionTypeEnum;
466
469
  PermissionTypeEnum[PermissionTypeEnum["Form"] = -1] = "Form";
467
470
  PermissionTypeEnum[PermissionTypeEnum["Item"] = 0] = "Item";
468
471
  PermissionTypeEnum[PermissionTypeEnum["Access"] = 1] = "Access";
469
- PermissionTypeEnum[PermissionTypeEnum["Button"] = 2] = "Button";
470
- PermissionTypeEnum[PermissionTypeEnum["Option"] = 3] = "Option";
471
- PermissionTypeEnum[PermissionTypeEnum["OptionLink"] = 4] = "OptionLink";
472
- PermissionTypeEnum[PermissionTypeEnum["OptionLinkNewTab"] = 5] = "OptionLinkNewTab";
473
- PermissionTypeEnum[PermissionTypeEnum["OptionReport"] = 6] = "OptionReport";
474
- PermissionTypeEnum[PermissionTypeEnum["OptionFile"] = 7] = "OptionFile";
475
- PermissionTypeEnum[PermissionTypeEnum["OptionModal"] = 8] = "OptionModal";
476
- PermissionTypeEnum[PermissionTypeEnum["OptionConfirm"] = 9] = "OptionConfirm";
472
+ PermissionTypeEnum[PermissionTypeEnum["Option"] = 2] = "Option";
477
473
  })(PermissionTypeEnum || (PermissionTypeEnum = {}));
478
- var PermissionOptionTypeEnum;
479
- (function (PermissionOptionTypeEnum) {
480
- PermissionOptionTypeEnum[PermissionOptionTypeEnum["Icon"] = 0] = "Icon";
481
- PermissionOptionTypeEnum[PermissionOptionTypeEnum["Button"] = 1] = "Button";
482
- })(PermissionOptionTypeEnum || (PermissionOptionTypeEnum = {}));
474
+ var PermissionInputActionEnum;
475
+ (function (PermissionInputActionEnum) {
476
+ PermissionInputActionEnum[PermissionInputActionEnum["None"] = 0] = "None";
477
+ PermissionInputActionEnum[PermissionInputActionEnum["Link"] = 1] = "Link";
478
+ PermissionInputActionEnum[PermissionInputActionEnum["LinkNewTab"] = 2] = "LinkNewTab";
479
+ PermissionInputActionEnum[PermissionInputActionEnum["Report"] = 3] = "Report";
480
+ PermissionInputActionEnum[PermissionInputActionEnum["File"] = 4] = "File";
481
+ PermissionInputActionEnum[PermissionInputActionEnum["Modal"] = 5] = "Modal";
482
+ PermissionInputActionEnum[PermissionInputActionEnum["Confirm"] = 6] = "Confirm";
483
+ })(PermissionInputActionEnum || (PermissionInputActionEnum = {}));
484
+ var PermissionInputTypeEnum;
485
+ (function (PermissionInputTypeEnum) {
486
+ PermissionInputTypeEnum[PermissionInputTypeEnum["Icon"] = 0] = "Icon";
487
+ PermissionInputTypeEnum[PermissionInputTypeEnum["Button"] = 1] = "Button";
488
+ })(PermissionInputTypeEnum || (PermissionInputTypeEnum = {}));
483
489
  var VehicleType;
484
490
  (function (VehicleType) {
485
491
  VehicleType[VehicleType["Car"] = 1] = "Car";
@@ -739,10 +745,10 @@ class HelperClass {
739
745
  static getName(n) {
740
746
  return n.replace(/ک/g, 'ك').replace(/ی/g, 'ي').replace(/آ/g, 'آ');
741
747
  }
742
- static addNotification(m) {
748
+ static addNotification(m, e = true) {
743
749
  const id = HelperClass.random(20);
744
750
  // tslint:disable-next-line
745
- $('#Notifications').append('<div id="' + id + '" class="con"><div class="item"><i class="fas fa-times"></i><div>' + m + '</div></div></div>');
751
+ $('#Notifications').append('<div id="' + id + '" class="con"><div class="item ' + (e ? 'error' : 'success') + '"><i class="fas fa-times"></i><div>' + m + '</div></div></div>');
746
752
  setTimeout(() => {
747
753
  const d = $('#' + id);
748
754
  d.fadeOut(300, () => {
@@ -1999,7 +2005,6 @@ class TableRowComponent {
1999
2005
  }, 500);
2000
2006
  }
2001
2007
  getOptions() {
2002
- console.log(this.table.options, 'this.table.options');
2003
2008
  return (this.addChildren !== null && (this.table.level === null || this.table.level > this.level) ? [this.addChildren] : [])
2004
2009
  .concat(this.table.options.filter(x => x.condition == null ||
2005
2010
  (x.condition.startsWith('!') ? !this.row[x.condition.substring(1)] : this.row[x.condition])).map((o) => {
@@ -4259,11 +4264,12 @@ FormSelectComponent.propDecorators = {
4259
4264
  };
4260
4265
 
4261
4266
  class PermissionClass {
4262
- constructor(Name = '', Icon = '', Type = null, OptionType = null, Area = '', Controller = '', Action = '', Condition = null, Accesses = []) {
4267
+ constructor(Name = '', Icon = '', Type = null, InputType = null, InputAction = null, Area = '', Controller = '', Action = '', Condition = null, Accesses = []) {
4263
4268
  this.Name = Name;
4264
4269
  this.Icon = Icon;
4265
4270
  this.Type = Type;
4266
- this.OptionType = OptionType;
4271
+ this.InputType = InputType;
4272
+ this.InputAction = InputAction;
4267
4273
  this.Area = Area;
4268
4274
  this.Controller = Controller;
4269
4275
  this.Action = Action;
@@ -4279,17 +4285,20 @@ class PermissionClass {
4279
4285
  hasAccess(a) {
4280
4286
  return this.Accesses.filter(x => x.Action === a && x.Type === PermissionTypeEnum.Access).length > 0;
4281
4287
  }
4288
+ getAccesses() {
4289
+ return this.Accesses.filter(x => x.Type === PermissionTypeEnum.Access);
4290
+ }
4282
4291
  delete(a) {
4283
4292
  this.Accesses = this.Accesses.filter(x => x.Action !== a);
4284
4293
  }
4285
4294
  hasOption(a) {
4286
- return this.Accesses.filter(x => x.Action === a && x.Type !== PermissionTypeEnum.Access).length > 0;
4295
+ return this.Accesses.filter(x => x.Action === a && x.Type === PermissionTypeEnum.Option).length > 0;
4287
4296
  }
4288
4297
  getOptions() {
4289
- return this.Accesses.filter(x => x.Type !== PermissionTypeEnum.Access);
4298
+ return this.Accesses.filter(x => x.Type === PermissionTypeEnum.Option);
4290
4299
  }
4291
4300
  getOption(a) {
4292
- const c = this.Accesses.filter(x => x.Action === a && x.Type !== PermissionTypeEnum.Access);
4301
+ const c = this.Accesses.filter(x => x.Action === a && x.Type === PermissionTypeEnum.Option);
4293
4302
  return c.length > 0 ? c[0] : null;
4294
4303
  }
4295
4304
  getUrl() {
@@ -4999,13 +5008,12 @@ class AlertComponent {
4999
5008
  this.alert.form.inputs = [
5000
5009
  this.alertLabel
5001
5010
  ];
5002
- this.alert.form.addButtons('Accept', 'blue', false);
5003
5011
  }
5004
5012
  show(l, accept) {
5005
5013
  this.alertLabel.value = l;
5006
- this.alert.form.onSuccess = (btn) => {
5014
+ this.alert.onHide = () => {
5007
5015
  this.alert.hide();
5008
- accept(btn);
5016
+ accept();
5009
5017
  };
5010
5018
  this.alert.show();
5011
5019
  }
@@ -5911,7 +5919,7 @@ NotificationComponent.decorators = [
5911
5919
  { type: Component, args: [{
5912
5920
  selector: 'lib-notification',
5913
5921
  template: "<div id=\"Notifications\">\r\n</div>\r\n",
5914
- 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)}"]
5922
+ 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)}"]
5915
5923
  },] }
5916
5924
  ];
5917
5925
  NotificationComponent.ctorParameters = () => [];
@@ -5999,7 +6007,7 @@ class BaseComponent {
5999
6007
  return p.length > 0 ? this.getPermissionClass(p[0]) : null;
6000
6008
  }
6001
6009
  getPermissionClass(p) {
6002
- return new PermissionClass(p.Name, p.Icon, p.Type, p.OptionType, this.app.area, p.Controller, p.Action, p.Condition, this.getPermissionAccessesClass(p.Id));
6010
+ 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));
6003
6011
  }
6004
6012
  getPermissionAccessesClass(parentId) {
6005
6013
  return this.app.currentUser.Permissions.filter(x => x.ParentId === parentId).map(x => this.getPermissionClass(x));
@@ -6146,50 +6154,49 @@ class TableClass {
6146
6154
  this.permission = false;
6147
6155
  return;
6148
6156
  }
6149
- const insertAccess = this.permissions.getAccess('Insert');
6150
- if (insertAccess != null) {
6151
- const insert = new InputClass(this.environment, this.l, insertAccess.Name, 'fad fa-plus fa-rotate-90', InputType.Button, 'w-u green h-30');
6152
- if (this.form) {
6153
- this.form.url = this.form.baseUrl = this.url + 'Insert';
6154
- if (!this.form.onTop) {
6155
- insert.onClick = () => {
6156
- this.form.onSuccessBase = () => {
6157
- this.modal.hide();
6158
- this.load();
6157
+ for (const access of this.permissions.getAccesses()) {
6158
+ const accessInp = new InputClass(this.environment, this.l, access.Name, access.Icon, access.InputType === PermissionInputTypeEnum.Button ? InputType.Button : InputType.Icon, 'w-u h-30');
6159
+ if (access.Action === 'Insert') {
6160
+ if (this.form) {
6161
+ this.form.url = this.form.baseUrl = this.url + 'Insert';
6162
+ if (!this.form.onTop) {
6163
+ accessInp.onClick = () => {
6164
+ this.form.onSuccessBase = () => {
6165
+ this.modal.hide();
6166
+ this.load();
6167
+ };
6168
+ this.showInsertModal();
6159
6169
  };
6160
- this.showInsertModal();
6161
- };
6162
- this.buttons.unshift(insert);
6170
+ this.buttons.unshift(accessInp);
6171
+ }
6172
+ else {
6173
+ this.form.displayLabel = false;
6174
+ }
6163
6175
  }
6164
6176
  else {
6165
- this.form.displayLabel = false;
6177
+ this.buttons.unshift(accessInp);
6178
+ if (this.modal) {
6179
+ accessInp.onClick = () => {
6180
+ this.modal.show();
6181
+ };
6182
+ }
6183
+ else {
6184
+ accessInp.url = this.url + 'Insert';
6185
+ }
6166
6186
  }
6167
6187
  }
6168
- else {
6169
- this.buttons.unshift(insert);
6170
- if (this.modal) {
6171
- insert.onClick = () => {
6172
- this.modal.show();
6173
- };
6174
- }
6175
- else {
6176
- insert.url = this.url + 'Insert';
6177
- }
6188
+ else if (access.InputAction === PermissionInputActionEnum.Report) {
6189
+ const p = new PermissionClass();
6190
+ p.RelatedId = 'Index';
6191
+ p.Area = this.permissions.Area;
6192
+ p.Controller = 'Print';
6193
+ p.Action = this.permissions.Controller;
6194
+ accessInp.url = '/Report' + p.getUrl();
6195
+ accessInp.urlNewTab = true;
6178
6196
  }
6197
+ this.buttons.push(accessInp);
6179
6198
  }
6180
- const reportAccess = this.permissions.getAccess('Report');
6181
- if (reportAccess != null) {
6182
- const report = new InputClass(this.environment, this.l, reportAccess.Name, reportAccess.Icon, InputType.Button, 'm-h-5');
6183
- const p = new PermissionClass();
6184
- p.RelatedId = 'Index';
6185
- p.Area = this.permissions.Area;
6186
- p.Controller = 'Print';
6187
- p.Action = this.permissions.Controller;
6188
- report.url = '/Report' + p.getUrl();
6189
- report.urlNewTab = true;
6190
- this.extraButtons.push(report);
6191
- }
6192
- if ((this.permissions.hasAccess('Insert') || this.permissions.hasAccess('Update')) && this.form) {
6199
+ if ((this.permissions.hasAccess('Insert') || this.permissions.hasOption('Update')) && this.form) {
6193
6200
  this.form.addButtons('Save', 'green', true, this.permissions.Type === PermissionTypeEnum.Form ? (data) => {
6194
6201
  if (data.Id) {
6195
6202
  const i = this.rows.findIndex(x => x.Id === data.Id);
@@ -6221,18 +6228,18 @@ class TableClass {
6221
6228
  if (this.options.filter(x => x.name === option.Name).length > 0) {
6222
6229
  continue;
6223
6230
  }
6224
- const opt = new InputClass(this.environment, this.l, option.Name, option.Icon, option.OptionType === PermissionOptionTypeEnum.Icon ? InputType.Icon : InputType.Button, 'blue h-25 m-h-5 d-ib va-m f-u');
6231
+ const opt = new InputClass(this.environment, this.l, option.Name, option.Icon, option.InputType === PermissionInputTypeEnum.Icon ? InputType.Icon : InputType.Button, 'blue h-25 m-h-5 d-ib va-m f-u');
6225
6232
  opt.condition = option.Condition;
6226
- if (option.Type === PermissionTypeEnum.OptionLink || option.Type === PermissionTypeEnum.OptionLinkNewTab) {
6233
+ if (option.InputAction === PermissionInputActionEnum.Link || option.InputAction === PermissionInputActionEnum.LinkNewTab) {
6227
6234
  const p = new PermissionClass();
6228
6235
  p.RelatedId = this.permissions.RelatedId;
6229
6236
  p.Area = this.permissions.Area;
6230
6237
  p.Controller = option.Controller ? option.Controller : this.permissions.Controller;
6231
6238
  p.Action = this.permissions.Action;
6232
6239
  opt.url = p.getUrl() + option.Action + '/{}';
6233
- opt.urlNewTab = option.Type === PermissionTypeEnum.OptionLinkNewTab;
6240
+ opt.urlNewTab = option.InputAction === PermissionInputActionEnum.LinkNewTab;
6234
6241
  }
6235
- else if (option.Type === PermissionTypeEnum.OptionModal) {
6242
+ else if (option.InputAction === PermissionInputActionEnum.Modal) {
6236
6243
  opt.modal = option.Modal;
6237
6244
  opt.onClick = (btn) => {
6238
6245
  if (opt.modal.table) {
@@ -6277,7 +6284,7 @@ class TableClass {
6277
6284
  }
6278
6285
  };
6279
6286
  }
6280
- else if (option.Type === PermissionTypeEnum.OptionReport) {
6287
+ else if (option.InputAction === PermissionInputActionEnum.Report) {
6281
6288
  const p = new PermissionClass();
6282
6289
  p.RelatedId = 'Index';
6283
6290
  p.Area = this.permissions.Area;
@@ -6286,7 +6293,7 @@ class TableClass {
6286
6293
  opt.url = '/Report' + p.getUrl() + '/{}';
6287
6294
  opt.urlNewTab = true;
6288
6295
  }
6289
- else if (option.Type === PermissionTypeEnum.OptionFile) {
6296
+ else if (option.InputAction === PermissionInputActionEnum.File) {
6290
6297
  const p = new PermissionClass();
6291
6298
  p.RelatedId = this.permissions.RelatedId;
6292
6299
  p.Area = this.permissions.Area;
@@ -6295,7 +6302,7 @@ class TableClass {
6295
6302
  opt.url = '/File' + p.getUrl() + '/{}';
6296
6303
  opt.urlNewTab = true;
6297
6304
  }
6298
- else if (option.Type === PermissionTypeEnum.OptionConfirm) {
6305
+ else if (option.InputAction === PermissionInputActionEnum.Confirm) {
6299
6306
  opt.onClick = (btn) => {
6300
6307
  const p = new PermissionClass();
6301
6308
  p.RelatedId = this.permissions.RelatedId;
@@ -6347,5 +6354,5 @@ class TableRowClass {
6347
6354
  * Generated bundle index. Do not edit.
6348
6355
  */
6349
6356
 
6350
- export { AccordionClass, AccordionComponent, AccordionRowClass, AlertComponent, BaseComponent, ConfirmComponent, DayClass, EnumUtils, FooterComponent, FormBankCardComponent, FormButtonComponent, FormCarComponent, FormCarSearchComponent, FormCheckboxComponent, FormClass, FormComponent, FormDateComponent, FormDatetimeComponent, FormFileComponent, FormFingerComponent, FormIconComponent, FormLabelComponent, FormPlaqueComponent, FormPlaqueSelectComponent, FormRadioComponent, FormSelectComponent, FormTableComponent, FormTextareaComponent, FormTextboxComponent, FormTimeComponent, FormTreeComponent, HeaderComponent, HelperClass, InputClass, InputError, InputType, LangClass, LayoutComponent, LoadingComponent, LoginClass, LoginStepClass, Method, ModalClass, ModalComponent, NotfoundComponent, OperationEnum, OptionClass, PaymentStatusEnum, PermissionClass, PermissionOptionTypeEnum, PermissionTypeEnum, Progress, PsToolkitUiModule, RequestClass, ResultStatusEnum, SidebarClass, SidebarComponent, StatusEnum, StepsClass, StepsComponent, StepsItemClass, SubHeaderComponent, TableClass, TableCollClass, TableCollType, TableComponent, TableOptionType, TableRowClass, TooltipComponent, TreeRowClass, UserType, VehicleType, FormSelectItemComponent as ɵa, TablePaginationComponent as ɵb, SidebarItemComponent as ɵc, PsToolkitUiConfigService as ɵd, TableLoadingComponent as ɵe, FormTreeItemComponent as ɵf, TableRowComponent as ɵg, TableReportComponent as ɵh, SafeStylePipe as ɵi, LoginComponent as ɵj, NotificationComponent as ɵk };
6357
+ export { AccordionClass, AccordionComponent, AccordionRowClass, AlertComponent, BaseComponent, ConfirmComponent, DayClass, EnumUtils, FooterComponent, FormBankCardComponent, FormButtonComponent, FormCarComponent, FormCarSearchComponent, FormCheckboxComponent, FormClass, FormComponent, FormDateComponent, FormDatetimeComponent, FormFileComponent, FormFingerComponent, FormIconComponent, FormLabelComponent, FormPlaqueComponent, FormPlaqueSelectComponent, FormRadioComponent, FormSelectComponent, FormTableComponent, FormTextareaComponent, FormTextboxComponent, FormTimeComponent, FormTreeComponent, HeaderComponent, HelperClass, InputClass, InputError, InputType, LangClass, LayoutComponent, LoadingComponent, LoginClass, LoginStepClass, Method, ModalClass, ModalComponent, NotfoundComponent, OperationEnum, OptionClass, PaymentStatusEnum, PermissionClass, PermissionInputActionEnum, PermissionInputTypeEnum, PermissionTypeEnum, Progress, PsToolkitUiModule, RequestClass, ResultStatusEnum, SidebarClass, SidebarComponent, StatusEnum, StepsClass, StepsComponent, StepsItemClass, SubHeaderComponent, TableClass, TableCollClass, TableCollType, TableComponent, TableOptionType, TableRowClass, TooltipComponent, TreeRowClass, UserType, VehicleType, FormSelectItemComponent as ɵa, TablePaginationComponent as ɵb, SidebarItemComponent as ɵc, PsToolkitUiConfigService as ɵd, TableLoadingComponent as ɵe, FormTreeItemComponent as ɵf, TableRowComponent as ɵg, TableReportComponent as ɵh, SafeStylePipe as ɵi, LoginComponent as ɵj, NotificationComponent as ɵk };
6351
6358
  //# sourceMappingURL=ps-toolkit-ui.js.map