@smartbit4all/ng-client 3.1.14 → 3.1.16

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.
@@ -7532,6 +7532,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
7532
7532
  args: [MAT_SNACK_BAR_DATA]
7533
7533
  }] }, { type: SmartViewContextService }, { type: UiActionDescriptorService }]; } });
7534
7534
 
7535
+ class InvalidFieldsSnackBarComponent {
7536
+ constructor(data) {
7537
+ this.data = data;
7538
+ }
7539
+ ngOnInit() { }
7540
+ }
7541
+ InvalidFieldsSnackBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: InvalidFieldsSnackBarComponent, deps: [{ token: MAT_SNACK_BAR_DATA }], target: i0.ɵɵFactoryTarget.Component });
7542
+ InvalidFieldsSnackBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: InvalidFieldsSnackBarComponent, selector: "app-invalid-fields-snack-bar", ngImport: i0, template: "<div class=\"invalidFieldsSnackBar\">\r\n <!-- <div class=\"invalidFieldsSnackBarContainer\" *ngIf=\"data.message\">\r\n <span class=\"successSnakBarContainer\" matSnackBarLabel>\r\n {{ data.message }}\r\n </span>\r\n </div> -->\r\n <div class=\"invalidFieldsSnackBarContainer\" *ngIf=\"data.message\">\r\n <span class=\"invalidFieldsMessage\" matSnackBarLabel> Hi\u00E1nyos vagy hib\u00E1s adatok! </span>\r\n </div>\r\n</div>\r\n", styles: [".invalidFieldsSnackBar ::ng-deep .mat-snack-bar-container{text-align:center;border-radius:2rem}.invalidFieldsMessage{color:#fff}\n"], directives: [{ type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
7543
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: InvalidFieldsSnackBarComponent, decorators: [{
7544
+ type: Component,
7545
+ args: [{ selector: 'app-invalid-fields-snack-bar', template: "<div class=\"invalidFieldsSnackBar\">\r\n <!-- <div class=\"invalidFieldsSnackBarContainer\" *ngIf=\"data.message\">\r\n <span class=\"successSnakBarContainer\" matSnackBarLabel>\r\n {{ data.message }}\r\n </span>\r\n </div> -->\r\n <div class=\"invalidFieldsSnackBarContainer\" *ngIf=\"data.message\">\r\n <span class=\"invalidFieldsMessage\" matSnackBarLabel> Hi\u00E1nyos vagy hib\u00E1s adatok! </span>\r\n </div>\r\n</div>\r\n", styles: [".invalidFieldsSnackBar ::ng-deep .mat-snack-bar-container{text-align:center;border-radius:2rem}.invalidFieldsMessage{color:#fff}\n"] }]
7546
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
7547
+ type: Inject,
7548
+ args: [MAT_SNACK_BAR_DATA]
7549
+ }] }]; } });
7550
+
7535
7551
  class UiActionConfirmDialogComponent {
7536
7552
  constructor(service, manager) {
7537
7553
  this.service = service;
@@ -7920,6 +7936,11 @@ class UiActionService {
7920
7936
  }
7921
7937
  else {
7922
7938
  this.uiActionModel.serviceToUse.submitForm(validate);
7939
+ let invalidFields = this.uiActionModel.serviceToUse.getInvalidFields();
7940
+ if (validate && invalidFields.invalidFieldKeys.length) {
7941
+ this.showInvalidFieldsSnackbar(invalidFields);
7942
+ return;
7943
+ }
7923
7944
  }
7924
7945
  }
7925
7946
  if (uiAction.confirm) {
@@ -8051,6 +8072,13 @@ class UiActionService {
8051
8072
  data: uiAction,
8052
8073
  });
8053
8074
  }
8075
+ showInvalidFieldsSnackbar(invalidFields) {
8076
+ this._snackBar.openFromComponent(InvalidFieldsSnackBarComponent, {
8077
+ duration: 5 * 1000,
8078
+ panelClass: ['backgroundColor-warn'],
8079
+ data: invalidFields,
8080
+ });
8081
+ }
8054
8082
  }
8055
8083
  UiActionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiActionService, deps: [{ token: UiActionConfirmDialogService }, { token: UiActionInputDialogService }, { token: UiActionFileUploadDialogService }, { token: i1$3.MatSnackBar }], target: i0.ɵɵFactoryTarget.Injectable });
8056
8084
  UiActionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiActionService, providedIn: 'root' });
@@ -8170,7 +8198,8 @@ SmartViewContextModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0",
8170
8198
  UiActionToolbarComponent,
8171
8199
  UiActionInputDialogComponent,
8172
8200
  UiActionConfirmDialogComponent,
8173
- UiActionFileUploadDialogComponent], imports: [CommonModule,
8201
+ UiActionFileUploadDialogComponent,
8202
+ InvalidFieldsSnackBarComponent], imports: [CommonModule,
8174
8203
  HttpClientModule,
8175
8204
  MatCommonModule,
8176
8205
  MatButtonModule,
@@ -8207,6 +8236,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
8207
8236
  UiActionInputDialogComponent,
8208
8237
  UiActionConfirmDialogComponent,
8209
8238
  UiActionFileUploadDialogComponent,
8239
+ InvalidFieldsSnackBarComponent,
8210
8240
  ],
8211
8241
  imports: [
8212
8242
  CommonModule,
@@ -12549,13 +12579,27 @@ let SmartComponentApiClient = class SmartComponentApiClient {
12549
12579
  // this.model = await this.viewContext.load(this.uuid);
12550
12580
  await this.viewContext.load2(this.uuid);
12551
12581
  }
12552
- async execute(uiAction, options) {
12582
+ async executeUiAction(uiAction, options) {
12553
12583
  this.uiActionService.uiActionModel = {
12554
12584
  serviceToUse: this,
12555
12585
  uiAction: uiAction,
12556
12586
  };
12557
12587
  this.uiActionService.execute(uiAction, options);
12558
12588
  }
12589
+ getInvalidFields() {
12590
+ let aggregatedInvalidFields = {
12591
+ invalidFieldKeys: [],
12592
+ invalidFieldNames: [],
12593
+ };
12594
+ for (let entry of this.formWidgets.widgets) {
12595
+ let invalidFieldsOfForm = entry[1]?.getInvalidFields();
12596
+ if (invalidFieldsOfForm) {
12597
+ invalidFieldsOfForm.invalidFieldKeys.forEach((key) => aggregatedInvalidFields.invalidFieldKeys.push(key));
12598
+ invalidFieldsOfForm.invalidFieldNames.forEach((key) => aggregatedInvalidFields.invalidFieldNames.push(key));
12599
+ }
12600
+ }
12601
+ return aggregatedInvalidFields;
12602
+ }
12559
12603
  //#region UseUiAction
12560
12604
  getAdditionalParams(uiAction) {
12561
12605
  return {