@smartbit4all/ng-client 1.0.10 → 1.0.12

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.
@@ -2913,27 +2913,27 @@ class UiActionDescriptorService {
2913
2913
  this.viewContext = viewContext;
2914
2914
  this._destroy$ = new Subject();
2915
2915
  this.languageChanged = new Subject();
2916
- this.keysToTranslate = ["title", "text", "placeholder", "caption", "feedbackText"];
2916
+ this.keysToTranslate = ['title', 'text', 'placeholder', 'caption', 'feedbackText'];
2917
2917
  this.basicActionDescriptors = new Map([
2918
2918
  [
2919
- "UNKOWN",
2919
+ 'UNKOWN',
2920
2920
  {
2921
- title: "",
2921
+ title: '',
2922
2922
  type: UiActionButtonType.Normal,
2923
- color: "accent",
2924
- icon: "Question",
2923
+ color: 'accent',
2924
+ icon: 'Question',
2925
2925
  iconColor: `text-primary`,
2926
2926
  iconPosition: UiActionButtonIconPos.Post,
2927
2927
  dialog: {
2928
- title: "",
2929
- placeholder: "placeholder",
2928
+ title: '',
2929
+ placeholder: 'placeholder',
2930
2930
  actionButton: {
2931
- caption: "",
2932
- color: "accent",
2931
+ caption: '',
2932
+ color: 'accent',
2933
2933
  },
2934
2934
  cancelButton: {
2935
- caption: "Mégse",
2936
- color: "",
2935
+ caption: 'Mégse',
2936
+ color: '',
2937
2937
  },
2938
2938
  },
2939
2939
  },
@@ -2943,9 +2943,7 @@ class UiActionDescriptorService {
2943
2943
  this.subscribeToTranslateService();
2944
2944
  }
2945
2945
  else {
2946
- this.viewContext.translateServiceChanged
2947
- .pipe(takeUntil(this._destroy$))
2948
- .subscribe(() => {
2946
+ this.viewContext.translateServiceChanged.pipe(takeUntil(this._destroy$)).subscribe(() => {
2949
2947
  this.subscribeToTranslateService();
2950
2948
  });
2951
2949
  }
@@ -2955,9 +2953,7 @@ class UiActionDescriptorService {
2955
2953
  this._destroy$.complete();
2956
2954
  }
2957
2955
  subscribeToTranslateService() {
2958
- this.viewContext
2959
- .translateService.onLangChange.pipe(takeUntil(this._destroy$))
2960
- .subscribe(() => {
2956
+ this.viewContext.translateService.onLangChange.pipe(takeUntil(this._destroy$)).subscribe(() => {
2961
2957
  this.languageChanged.next();
2962
2958
  });
2963
2959
  }
@@ -2966,11 +2962,11 @@ class UiActionDescriptorService {
2966
2962
  let actionDescriptorFromDescriptors = this.viewContext.getActionDescriptors()?.get(code);
2967
2963
  let actionDescriptor = JSON.parse(JSON.stringify(actionDescriptorFromDescriptors));
2968
2964
  if (!actionDescriptor) {
2969
- actionDescriptor = this.basicActionDescriptors.get("UNKOWN");
2965
+ actionDescriptor = this.basicActionDescriptors.get('UNKOWN');
2970
2966
  actionDescriptor.title = code;
2971
2967
  }
2972
2968
  if (!actionDescriptor.dialog) {
2973
- actionDescriptor = this.setUpUnkownDialogDescriptor(code, actionDescriptor, "dialog");
2969
+ actionDescriptor = this.setUpUnkownDialogDescriptor(code, actionDescriptor, 'dialog');
2974
2970
  }
2975
2971
  if (!actionDescriptor.feedbackType && uiAction.submit) {
2976
2972
  actionDescriptor.feedbackType = UiActionFeedbackType.Snackbar;
@@ -2984,23 +2980,24 @@ class UiActionDescriptorService {
2984
2980
  uiActionDescriptor = await this.deepTranslate(uiActionDescriptor);
2985
2981
  return uiActionDescriptor;
2986
2982
  }
2987
- async deepTranslate(model) {
2988
- Object.keys(model).map(async (key) => {
2983
+ async deepTranslate(_model) {
2984
+ let model = { ..._model };
2985
+ await Promise.all(Object.keys(model).map(async (key) => {
2989
2986
  if (model[key] !== undefined &&
2990
- typeof model[key] === "string" &&
2987
+ typeof model[key] === 'string' &&
2991
2988
  model[key].length &&
2992
2989
  this.keysToTranslate.includes(key)) {
2993
2990
  model[key] = await this.viewContext.translateService.get(model[key]).toPromise();
2994
2991
  }
2995
- else if (model[key] !== undefined && typeof model[key] === "object") {
2992
+ else if (model[key] !== undefined && typeof model[key] === 'object') {
2996
2993
  model[key] = await this.deepTranslate(model[key]);
2997
2994
  }
2998
2995
  return model;
2999
- });
2996
+ }));
3000
2997
  return model;
3001
2998
  }
3002
2999
  setUpUnkownDialogDescriptor(code, uiActionDescriptor, dialogType) {
3003
- let unkownDescriptor = this.basicActionDescriptors.get("UNKOWN");
3000
+ let unkownDescriptor = this.basicActionDescriptors.get('UNKOWN');
3004
3001
  uiActionDescriptor[dialogType] = unkownDescriptor.dialog;
3005
3002
  uiActionDescriptor[dialogType].title = code;
3006
3003
  uiActionDescriptor[dialogType].actionButton.caption = code;
@@ -3008,11 +3005,11 @@ class UiActionDescriptorService {
3008
3005
  }
3009
3006
  }
3010
3007
  UiActionDescriptorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionDescriptorService, deps: [{ token: SmartViewContextService }], target: i0.ɵɵFactoryTarget.Injectable });
3011
- UiActionDescriptorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionDescriptorService, providedIn: "root" });
3008
+ UiActionDescriptorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionDescriptorService, providedIn: 'root' });
3012
3009
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionDescriptorService, decorators: [{
3013
3010
  type: Injectable,
3014
3011
  args: [{
3015
- providedIn: "root",
3012
+ providedIn: 'root',
3016
3013
  }]
3017
3014
  }], ctorParameters: function () { return [{ type: SmartViewContextService }]; } });
3018
3015
 
@@ -3145,13 +3142,16 @@ class UiActionInputDialogComponent {
3145
3142
  this.dialogType = this.service.inputTypeName;
3146
3143
  }
3147
3144
  else {
3148
- this.dialogType = this.descriptor.inputDialog ? "inputDialog" : "dialog";
3145
+ this.dialogType = this.descriptor.inputDialog ? 'inputDialog' : 'dialog';
3149
3146
  }
3150
3147
  this.constructForm();
3151
3148
  }
3152
3149
  getTitle() {
3153
3150
  return this.descriptor[this.dialogType].title;
3154
3151
  }
3152
+ getText() {
3153
+ return this.descriptor[this.dialogType].text ?? '';
3154
+ }
3155
3155
  getActionButtonLabel() {
3156
3156
  return this.descriptor[this.dialogType].actionButton.caption;
3157
3157
  }
@@ -3167,17 +3167,17 @@ class UiActionInputDialogComponent {
3167
3167
  constructForm() {
3168
3168
  let model = {};
3169
3169
  let inputName;
3170
- if (this.service.inputTypeName === "inputDialog") {
3171
- inputName = "input";
3170
+ if (this.service.inputTypeName === 'inputDialog') {
3171
+ inputName = 'input';
3172
3172
  }
3173
3173
  else {
3174
- inputName = "input2";
3174
+ inputName = 'input2';
3175
3175
  }
3176
3176
  if (this.service.nodeName) {
3177
3177
  model[inputName] = this.service.nodeName;
3178
3178
  }
3179
3179
  else {
3180
- model[inputName] = "";
3180
+ model[inputName] = '';
3181
3181
  }
3182
3182
  let type;
3183
3183
  let inputType = `${inputName}Type`;
@@ -3193,17 +3193,17 @@ class UiActionInputDialogComponent {
3193
3193
  widgets: [
3194
3194
  {
3195
3195
  key: inputName,
3196
- label: "",
3196
+ label: '',
3197
3197
  type,
3198
- value: "",
3198
+ value: '',
3199
3199
  validators: [
3200
3200
  {
3201
3201
  validator: Validators.required,
3202
3202
  name: SmartValidatorName.required,
3203
- errorMessage: "Ez a mező kötelező",
3203
+ errorMessage: 'Ez a mező kötelező',
3204
3204
  },
3205
3205
  ],
3206
- placeholder: this.descriptor[this.dialogType].placeholder ?? "",
3206
+ placeholder: this.descriptor[this.dialogType].placeholder ?? '',
3207
3207
  showLabel: true,
3208
3208
  },
3209
3209
  ],
@@ -3212,7 +3212,7 @@ class UiActionInputDialogComponent {
3212
3212
  save() {
3213
3213
  let form = this.folderFormChild.submitForm();
3214
3214
  if (form.invalidFields) {
3215
- throw new Error("The form is invalid!");
3215
+ throw new Error('The form is invalid!');
3216
3216
  }
3217
3217
  this.service.onSave(form.model);
3218
3218
  }
@@ -3221,13 +3221,13 @@ class UiActionInputDialogComponent {
3221
3221
  }
3222
3222
  }
3223
3223
  UiActionInputDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionInputDialogComponent, deps: [{ token: UiActionInputDialogService }, { token: UiActionDescriptorService }], target: i0.ɵɵFactoryTarget.Component });
3224
- UiActionInputDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: UiActionInputDialogComponent, selector: "smart-ui-action-input-dialog", viewQueries: [{ propertyName: "folderFormChild", first: true, predicate: ["form"], descendants: true }], ngImport: i0, template: "<div class=\"folderNameDialogContainer\">\n\t<div class=\"headerContainer\">\n\t\t<h3 class=\"color-accent-700\">\n\t\t\t{{ getTitle() }}\n\t\t</h3>\n\t\t<button mat-icon-button title=\"close\" (click)=\"cancel()\">\n\t\t\t<smart-icon [color]=\"'primary'\" [icon]=\"'X'\"></smart-icon>\n\t\t</button>\n\t</div>\n\t<smartform #form [smartForm]=\"folderForm\"></smartform>\n\t<div class=\"folderNameDialogButtonsContainer\">\n\t\t<button mat-button color=\"accent\" [color]=\"getCancelButtonColor()\" (click)=\"cancel()\">\n\t\t\t{{ getCancelButtonLabel() }}\n\t\t</button>\n\t\t<button mat-raised-button [color]=\"getActionButtonColor()\" (click)=\"save()\">\n\t\t\t{{ getActionButtonLabel() }}\n\t\t</button>\n\t</div>\n</div>\n", styles: [".folderNameDialogContainer{width:25rem;display:flex;flex-direction:column;gap:1rem}.headerContainer{display:flex;flex-direction:row;justify-content:space-between}.headerContainer h3{margin:0}.folderNameDialogButtonsContainer{display:flex;flex-direction:row;justify-content:flex-end;gap:.5rem}\n"], components: [{ type: i2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i4$1.SmartIconComponent, selector: "smart-icon", inputs: ["icon", "color"] }, { type: i5$1.SmartformComponent, selector: "smartform", inputs: ["smartForm"] }] });
3224
+ UiActionInputDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: UiActionInputDialogComponent, selector: "smart-ui-action-input-dialog", viewQueries: [{ propertyName: "folderFormChild", first: true, predicate: ["form"], descendants: true }], ngImport: i0, template: "<div class=\"folderNameDialogContainer\">\n\t<div class=\"headerContainer\">\n\t\t<h3 class=\"color-accent-700\">\n\t\t\t{{ getTitle() }}\n\t\t</h3>\n\t\t<button mat-icon-button title=\"close\" (click)=\"cancel()\">\n\t\t\t<smart-icon [color]=\"'primary'\" [icon]=\"'X'\"></smart-icon>\n\t\t</button>\n\t</div>\n\t<p>\n\t\t{{ getText() }}\n\t</p>\n\t<smartform #form [smartForm]=\"folderForm\"></smartform>\n\t<div class=\"folderNameDialogButtonsContainer\">\n\t\t<button mat-button color=\"accent\" [color]=\"getCancelButtonColor()\" (click)=\"cancel()\">\n\t\t\t{{ getCancelButtonLabel() }}\n\t\t</button>\n\t\t<button mat-raised-button [color]=\"getActionButtonColor()\" (click)=\"save()\">\n\t\t\t{{ getActionButtonLabel() }}\n\t\t</button>\n\t</div>\n</div>\n", styles: [".folderNameDialogContainer{width:25rem;display:flex;flex-direction:column;gap:1rem}.headerContainer{display:flex;flex-direction:row;justify-content:space-between}.headerContainer h3{margin:0}.folderNameDialogButtonsContainer{display:flex;flex-direction:row;justify-content:flex-end;gap:.5rem}\n"], components: [{ type: i2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i4$1.SmartIconComponent, selector: "smart-icon", inputs: ["icon", "color"] }, { type: i5$1.SmartformComponent, selector: "smartform", inputs: ["smartForm"] }] });
3225
3225
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionInputDialogComponent, decorators: [{
3226
3226
  type: Component,
3227
- args: [{ selector: "smart-ui-action-input-dialog", template: "<div class=\"folderNameDialogContainer\">\n\t<div class=\"headerContainer\">\n\t\t<h3 class=\"color-accent-700\">\n\t\t\t{{ getTitle() }}\n\t\t</h3>\n\t\t<button mat-icon-button title=\"close\" (click)=\"cancel()\">\n\t\t\t<smart-icon [color]=\"'primary'\" [icon]=\"'X'\"></smart-icon>\n\t\t</button>\n\t</div>\n\t<smartform #form [smartForm]=\"folderForm\"></smartform>\n\t<div class=\"folderNameDialogButtonsContainer\">\n\t\t<button mat-button color=\"accent\" [color]=\"getCancelButtonColor()\" (click)=\"cancel()\">\n\t\t\t{{ getCancelButtonLabel() }}\n\t\t</button>\n\t\t<button mat-raised-button [color]=\"getActionButtonColor()\" (click)=\"save()\">\n\t\t\t{{ getActionButtonLabel() }}\n\t\t</button>\n\t</div>\n</div>\n", styles: [".folderNameDialogContainer{width:25rem;display:flex;flex-direction:column;gap:1rem}.headerContainer{display:flex;flex-direction:row;justify-content:space-between}.headerContainer h3{margin:0}.folderNameDialogButtonsContainer{display:flex;flex-direction:row;justify-content:flex-end;gap:.5rem}\n"] }]
3227
+ args: [{ selector: 'smart-ui-action-input-dialog', template: "<div class=\"folderNameDialogContainer\">\n\t<div class=\"headerContainer\">\n\t\t<h3 class=\"color-accent-700\">\n\t\t\t{{ getTitle() }}\n\t\t</h3>\n\t\t<button mat-icon-button title=\"close\" (click)=\"cancel()\">\n\t\t\t<smart-icon [color]=\"'primary'\" [icon]=\"'X'\"></smart-icon>\n\t\t</button>\n\t</div>\n\t<p>\n\t\t{{ getText() }}\n\t</p>\n\t<smartform #form [smartForm]=\"folderForm\"></smartform>\n\t<div class=\"folderNameDialogButtonsContainer\">\n\t\t<button mat-button color=\"accent\" [color]=\"getCancelButtonColor()\" (click)=\"cancel()\">\n\t\t\t{{ getCancelButtonLabel() }}\n\t\t</button>\n\t\t<button mat-raised-button [color]=\"getActionButtonColor()\" (click)=\"save()\">\n\t\t\t{{ getActionButtonLabel() }}\n\t\t</button>\n\t</div>\n</div>\n", styles: [".folderNameDialogContainer{width:25rem;display:flex;flex-direction:column;gap:1rem}.headerContainer{display:flex;flex-direction:row;justify-content:space-between}.headerContainer h3{margin:0}.folderNameDialogButtonsContainer{display:flex;flex-direction:row;justify-content:flex-end;gap:.5rem}\n"] }]
3228
3228
  }], ctorParameters: function () { return [{ type: UiActionInputDialogService }, { type: UiActionDescriptorService }]; }, propDecorators: { folderFormChild: [{
3229
3229
  type: ViewChild,
3230
- args: ["form"]
3230
+ args: ['form']
3231
3231
  }] } });
3232
3232
 
3233
3233
  class UiActionInputDialogService extends SmartdialogService {