@smartbit4all/ng-client 1.1.42 → 1.1.43

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.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, Injectable, Optional, Inject, PLATFORM_ID, NgModule, SkipSelf, Component, Pipe, CUSTOM_ELEMENTS_SCHEMA, ViewChild, Input } from '@angular/core';
2
+ import { InjectionToken, Injectable, Optional, Inject, PLATFORM_ID, NgModule, SkipSelf, Component, Pipe, CUSTOM_ELEMENTS_SCHEMA, Input, ViewChild } from '@angular/core';
3
3
  import { __awaiter, __decorate, __param } from 'tslib';
4
4
  import { Subject, takeUntil, map, catchError, throwError, from } from 'rxjs';
5
5
  import { SmartSubject } from '@smartbit4all/subject';
@@ -15,24 +15,25 @@ import * as i3$1 from '@smartbit4all/navigation';
15
15
  import * as i4$1 from '@smartbit4all/dialog';
16
16
  import { SmartdialogService, SmartdialogModule } from '@smartbit4all/dialog';
17
17
  import { MatCommonModule } from '@angular/material/core';
18
+ import { BrowserModule } from '@angular/platform-browser';
19
+ import * as i2$2 from '@smartbit4all/expandable-section';
20
+ import { SmartExpandableSectionModule } from '@smartbit4all/expandable-section';
21
+ import * as i1$2 from '@smartbit4all/form';
22
+ import { SmartFormWidgetDirection, SmartFormWidgetType, SmartValidatorName, SmartformModule } from '@smartbit4all/form';
23
+ import * as i3$2 from '@smartbit4all/grid';
24
+ import { SmartLayoutDef, GridUiActionType, SmartGridModule, SmartGridComponent } from '@smartbit4all/grid';
25
+ import * as i4$4 from '@smartbit4all/tree';
26
+ import { SmarttreeModule, SmarttreeGenericService } from '@smartbit4all/tree';
18
27
  import * as i4$3 from '@angular/material/expansion';
19
28
  import { MatExpansionModule } from '@angular/material/expansion';
20
- import { BrowserModule } from '@angular/platform-browser';
21
29
  import * as i4$2 from '@smartbit4all/icon';
22
30
  import { SmartIconModule } from '@smartbit4all/icon';
23
31
  import * as i1$1 from '@angular/material/dialog';
24
32
  import * as i2$1 from '@angular/router';
25
33
  import { catchError as catchError$1, switchMap } from 'rxjs/operators';
26
- import * as i4$4 from '@angular/material/snack-bar';
34
+ import * as i4$5 from '@angular/material/snack-bar';
27
35
  import { MAT_SNACK_BAR_DATA, MatSnackBarModule } from '@angular/material/snack-bar';
28
36
  import { Validators } from '@angular/forms';
29
- import * as i1$2 from '@smartbit4all/form';
30
- import { SmartFormWidgetType, SmartValidatorName, SmartFormWidgetDirection, SmartformModule } from '@smartbit4all/form';
31
- import * as i3$2 from '@smartbit4all/grid';
32
- import { SmartLayoutDef, GridUiActionType, SmartGridModule, SmartGridComponent } from '@smartbit4all/grid';
33
- import * as i2$2 from '@smartbit4all/expandable-section';
34
- import { SmartExpandableSectionModule } from '@smartbit4all/expandable-section';
35
- import { SmarttreeGenericService } from '@smartbit4all/tree';
36
37
 
37
38
  /**
38
39
  * Custom HttpParameterCodec
@@ -3388,1504 +3389,1528 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
3388
3389
  }]
3389
3390
  }] });
3390
3391
 
3391
- class SmartViewContextErrorDialogService extends SmartdialogService {
3392
- constructor(dialog, router, viewContext) {
3393
- super(dialog, router);
3394
- this.viewContext = viewContext;
3395
- this.dialogRefs = [];
3392
+ /**
3393
+ * Custom HttpParameterCodec
3394
+ * Workaround for https://github.com/angular/angular/issues/18261
3395
+ */
3396
+ class CustomHttpParameterCodec {
3397
+ encodeKey(k) {
3398
+ return encodeURIComponent(k);
3396
3399
  }
3397
- handleAfterClosed(result) { }
3398
- openDialog() {
3399
- const dialogData = {
3400
- content: {
3401
- title: '',
3402
- },
3403
- size: {},
3404
- customComponent: SmartViewContextErrorDialogComponent,
3405
- };
3406
- this.dialogRefs.push(this.createDialogRef(dialogData, SmartViewContextErrorDialogComponent));
3400
+ encodeValue(v) {
3401
+ return encodeURIComponent(v);
3407
3402
  }
3408
- closeDialog() {
3409
- return __awaiter(this, void 0, void 0, function* () {
3410
- let dialogRef = this.dialogRefs.pop();
3411
- dialogRef === null || dialogRef === void 0 ? void 0 : dialogRef.close();
3412
- });
3403
+ decodeKey(k) {
3404
+ return decodeURIComponent(k);
3413
3405
  }
3414
- getSmartViewContextApiError() {
3415
- var _a, _b, _c, _d, _e;
3416
- return __awaiter(this, void 0, void 0, function* () {
3417
- if ((_a = this.viewApiError) === null || _a === void 0 ? void 0 : _a.code) {
3418
- return yield this.viewContext.getSmartViewContextApiErrorByCode(this.viewApiError.code);
3419
- }
3420
- let dialogTitle;
3421
- let buttonLabel;
3422
- let message;
3423
- if (this.viewContext.translateService) {
3424
- dialogTitle = yield this.viewContext.translateService
3425
- .get(SmartViewContextErrorDialogTitle)
3426
- .toPromise();
3427
- buttonLabel = yield this.viewContext.translateService
3428
- .get(SmartViewContextErrorDialogButtonLabel)
3429
- .toPromise();
3430
- message = yield this.viewContext.translateService
3431
- .get(SmartViewContextErrorDialogMessage)
3432
- .toPromise();
3433
- }
3434
- else {
3435
- buttonLabel = 'Ok';
3436
- dialogTitle = 'Hiba';
3437
- message = 'An error has occured.';
3438
- }
3439
- return {
3440
- code: (_c = (_b = this.viewApiError) === null || _b === void 0 ? void 0 : _b.code) !== null && _c !== void 0 ? _c : '',
3441
- message: (_e = (_d = this.viewApiError) === null || _d === void 0 ? void 0 : _d.message) !== null && _e !== void 0 ? _e : message,
3442
- buttonLabel,
3443
- dialogTitle,
3444
- };
3445
- });
3406
+ decodeValue(v) {
3407
+ return decodeURIComponent(v);
3446
3408
  }
3447
3409
  }
3448
- SmartViewContextErrorDialogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartViewContextErrorDialogService, deps: [{ token: i1$1.MatDialog }, { token: i2$1.Router }, { token: SmartViewContextService }], target: i0.ɵɵFactoryTarget.Injectable });
3449
- SmartViewContextErrorDialogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartViewContextErrorDialogService, providedIn: 'root' });
3450
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartViewContextErrorDialogService, decorators: [{
3451
- type: Injectable,
3452
- args: [{
3453
- providedIn: 'root',
3454
- }]
3455
- }], ctorParameters: function () { return [{ type: i1$1.MatDialog }, { type: i2$1.Router }, { type: SmartViewContextService }]; } });
3456
3410
 
3457
- class SmartViewContextErrorDialogComponent {
3458
- constructor(service) {
3459
- this.service = service;
3460
- this.service
3461
- .getSmartViewContextApiError()
3462
- .then((smartViewContextApiError) => {
3463
- this.smartViewContextApiError = smartViewContextApiError;
3464
- });
3465
- }
3466
- ngOnInit() { }
3467
- onActionClick() {
3468
- var _a;
3469
- if ((_a = this.smartViewContextApiError) === null || _a === void 0 ? void 0 : _a.customAction) {
3470
- this.smartViewContextApiError.customAction();
3411
+ const BASE_PATH = new InjectionToken('basePath');
3412
+ const COLLECTION_FORMATS = {
3413
+ 'csv': ',',
3414
+ 'tsv': ' ',
3415
+ 'ssv': ' ',
3416
+ 'pipes': '|'
3417
+ };
3418
+
3419
+ class Configuration {
3420
+ constructor(configurationParameters = {}) {
3421
+ this.apiKeys = configurationParameters.apiKeys;
3422
+ this.username = configurationParameters.username;
3423
+ this.password = configurationParameters.password;
3424
+ this.accessToken = configurationParameters.accessToken;
3425
+ this.basePath = configurationParameters.basePath;
3426
+ this.withCredentials = configurationParameters.withCredentials;
3427
+ this.encoder = configurationParameters.encoder;
3428
+ if (configurationParameters.encodeParam) {
3429
+ this.encodeParam = configurationParameters.encodeParam;
3430
+ }
3431
+ else {
3432
+ this.encodeParam = param => this.defaultEncodeParam(param);
3433
+ }
3434
+ if (configurationParameters.credentials) {
3435
+ this.credentials = configurationParameters.credentials;
3436
+ }
3437
+ else {
3438
+ this.credentials = {};
3471
3439
  }
3472
- this.service.closeDialog();
3473
3440
  }
3474
- }
3475
- SmartViewContextErrorDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartViewContextErrorDialogComponent, deps: [{ token: SmartViewContextErrorDialogService }], target: i0.ɵɵFactoryTarget.Component });
3476
- SmartViewContextErrorDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: SmartViewContextErrorDialogComponent, selector: "lib-smart-view-context-error-dialog", ngImport: i0, template: "<div *ngIf=\"smartViewContextApiError\" class=\"container\">\n <h3 class=\"color-accent-700\">\n {{ smartViewContextApiError.dialogTitle }}\n </h3>\n <div class=\"content\">\n <p>\n {{ smartViewContextApiError.message }}\n </p>\n </div>\n <div class=\"buttonContainer\">\n <button mat-raised-button color=\"primary\" (click)=\"onActionClick()\">\n {{ smartViewContextApiError.buttonLabel }}\n </button>\n </div>\n</div>\n", styles: [".container{display:flex;flex-direction:column;gap:1em;min-width:25rem;max-width:50vw;height:auto;max-height:75vh}.content{flex:1;overflow:auto}.buttonContainer{display:flex;flex-direction:row;justify-content:flex-end}\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"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
3477
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartViewContextErrorDialogComponent, decorators: [{
3478
- type: Component,
3479
- args: [{ selector: 'lib-smart-view-context-error-dialog', template: "<div *ngIf=\"smartViewContextApiError\" class=\"container\">\n <h3 class=\"color-accent-700\">\n {{ smartViewContextApiError.dialogTitle }}\n </h3>\n <div class=\"content\">\n <p>\n {{ smartViewContextApiError.message }}\n </p>\n </div>\n <div class=\"buttonContainer\">\n <button mat-raised-button color=\"primary\" (click)=\"onActionClick()\">\n {{ smartViewContextApiError.buttonLabel }}\n </button>\n </div>\n</div>\n", styles: [".container{display:flex;flex-direction:column;gap:1em;min-width:25rem;max-width:50vw;height:auto;max-height:75vh}.content{flex:1;overflow:auto}.buttonContainer{display:flex;flex-direction:row;justify-content:flex-end}\n"] }]
3480
- }], ctorParameters: function () { return [{ type: SmartViewContextErrorDialogService }]; } });
3481
-
3482
- class SmartViewContextInterceptor {
3483
- constructor(viewContextErrorDialog) {
3484
- this.viewContextErrorDialog = viewContextErrorDialog;
3441
+ /**
3442
+ * Select the correct content-type to use for a request.
3443
+ * Uses {@link Configuration#isJsonMime} to determine the correct content-type.
3444
+ * If no content type is found return the first found type if the contentTypes is not empty
3445
+ * @param contentTypes - the array of content types that are available for selection
3446
+ * @returns the selected content-type or <code>undefined</code> if no selection could be made.
3447
+ */
3448
+ selectHeaderContentType(contentTypes) {
3449
+ if (contentTypes.length === 0) {
3450
+ return undefined;
3451
+ }
3452
+ const type = contentTypes.find((x) => this.isJsonMime(x));
3453
+ if (type === undefined) {
3454
+ return contentTypes[0];
3455
+ }
3456
+ return type;
3485
3457
  }
3486
- intercept(request, next) {
3487
- // parameter: async: True -> don't throw/open error (dialog)
3488
- if (request.body) {
3489
- try {
3490
- let body = request.body;
3491
- if (body.params[IS_ASYNC_PARAM_NAME]) {
3492
- return next.handle(request);
3493
- }
3494
- }
3495
- catch (error) { }
3458
+ /**
3459
+ * Select the correct accept content-type to use for a request.
3460
+ * Uses {@link Configuration#isJsonMime} to determine the correct accept content-type.
3461
+ * If no content type is found return the first found type if the contentTypes is not empty
3462
+ * @param accepts - the array of content types that are available for selection.
3463
+ * @returns the selected content-type or <code>undefined</code> if no selection could be made.
3464
+ */
3465
+ selectHeaderAccept(accepts) {
3466
+ if (accepts.length === 0) {
3467
+ return undefined;
3496
3468
  }
3497
- return next.handle(request).pipe(catchError((error) => {
3498
- if (error.status === 409 &&
3499
- (error.error.code || error.error.message)) {
3500
- this.openErrorDialog(error.error);
3501
- }
3502
- return throwError(error);
3503
- }));
3469
+ const type = accepts.find((x) => this.isJsonMime(x));
3470
+ if (type === undefined) {
3471
+ return accepts[0];
3472
+ }
3473
+ return type;
3504
3474
  }
3505
- openErrorDialog(viewApiError) {
3506
- this.viewContextErrorDialog.viewApiError = viewApiError;
3507
- this.viewContextErrorDialog.openDialog();
3475
+ /**
3476
+ * Check if the given MIME is a JSON MIME.
3477
+ * JSON MIME examples:
3478
+ * application/json
3479
+ * application/json; charset=UTF8
3480
+ * APPLICATION/JSON
3481
+ * application/vnd.company+json
3482
+ * @param mime - MIME (Multipurpose Internet Mail Extensions)
3483
+ * @return True if the given MIME is JSON, false otherwise.
3484
+ */
3485
+ isJsonMime(mime) {
3486
+ const jsonMime = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
3487
+ return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
3508
3488
  }
3509
- }
3510
- SmartViewContextInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartViewContextInterceptor, deps: [{ token: SmartViewContextErrorDialogService }], target: i0.ɵɵFactoryTarget.Injectable });
3511
- SmartViewContextInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartViewContextInterceptor });
3512
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartViewContextInterceptor, decorators: [{
3513
- type: Injectable
3514
- }], ctorParameters: function () { return [{ type: SmartViewContextErrorDialogService }]; } });
3515
-
3516
- class SmartViewRedirect {
3517
- constructor(service, navigation, route) {
3518
- this.service = service;
3519
- this.navigation = navigation;
3520
- this.route = route;
3521
- this.navigation.route = this.route;
3522
- this.navigation.subscribeToUrlChange((url) => {
3523
- let channel = this.route.snapshot.paramMap.get(SmartLinkChannelVariableInPath);
3524
- let uuid = this.route.snapshot.paramMap.get(SmartLinkUuidVariableInPath);
3525
- if (!channel || !uuid) {
3526
- throw new Error("channel or uuid is not reachable from the url!");
3527
- }
3528
- this.service.showPublishedView(channel, uuid);
3529
- });
3489
+ lookupCredential(key) {
3490
+ const value = this.credentials[key];
3491
+ return typeof value === 'function'
3492
+ ? value()
3493
+ : value;
3494
+ }
3495
+ defaultEncodeParam(param) {
3496
+ // This implementation exists as fallback for missing configuration
3497
+ // and for backwards compatibility to older typescript-angular generator versions.
3498
+ // It only works for the 'simple' parameter style.
3499
+ // Date-handling only works for the 'date-time' format.
3500
+ // All other styles and Date-formats are probably handled incorrectly.
3501
+ //
3502
+ // But: if that's all you need (i.e.: the most common use-case): no need for customization!
3503
+ const value = param.dataFormat === 'date-time' && param.value instanceof Date
3504
+ ? param.value.toISOString()
3505
+ : param.value;
3506
+ return encodeURIComponent(String(value));
3530
3507
  }
3531
3508
  }
3532
- SmartViewRedirect.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartViewRedirect, deps: [{ token: SmartViewContextService }, { token: i3$1.SmartNavigationService }, { token: i2$1.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component });
3533
- SmartViewRedirect.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: SmartViewRedirect, selector: "app-redirect", ngImport: i0, template: "<div>Smart redirect</div>", isInline: true });
3534
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartViewRedirect, decorators: [{
3535
- type: Component,
3536
- args: [{
3537
- selector: "app-redirect",
3538
- template: "<div>Smart redirect</div>",
3539
- }]
3540
- }], ctorParameters: function () { return [{ type: SmartViewContextService }, { type: i3$1.SmartNavigationService }, { type: i2$1.ActivatedRoute }]; } });
3541
- const SmartLinkChannelVariableInPath = "channel";
3542
- const SmartLinkUuidVariableInPath = "uuid";
3543
3509
 
3544
- class UiActionDescriptorService {
3545
- constructor(viewContext) {
3546
- this.viewContext = viewContext;
3547
- this._destroy$ = new Subject();
3548
- this.languageChanged = new SmartSubject(this._destroy$);
3549
- this.keysToTranslate = ['title', 'text', 'placeholder', 'caption', 'feedbackText'];
3550
- this.basicActionDescriptors = new Map([
3551
- [
3552
- 'UNKOWN',
3553
- {
3554
- title: '',
3555
- type: UiActionButtonType.Normal,
3556
- color: 'accent',
3557
- icon: 'Question',
3558
- iconColor: `text-primary`,
3559
- iconPosition: UiActionButtonIconPos.Post,
3560
- dialog: {
3561
- title: '',
3562
- placeholder: 'placeholder',
3563
- actionButton: {
3564
- caption: '',
3565
- color: 'accent',
3566
- },
3567
- cancelButton: {
3568
- caption: 'Mégse',
3569
- color: '',
3570
- },
3571
- },
3572
- },
3573
- ],
3574
- ]);
3575
- if (this.viewContext.translateService) {
3576
- this.subscribeToTranslateService();
3510
+ /**
3511
+ * Form layout definition
3512
+ * Contains form layout definition objects.
3513
+ *
3514
+ * The version of the OpenAPI document: 1.0.0
3515
+ * Contact: info@it4all.hu
3516
+ *
3517
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
3518
+ * https://openapi-generator.tech
3519
+ * Do not edit the class manually.
3520
+ */
3521
+ class DefaultService {
3522
+ constructor(httpClient, basePath, configuration) {
3523
+ this.httpClient = httpClient;
3524
+ this.basePath = 'http://localhost';
3525
+ this.defaultHeaders = new HttpHeaders();
3526
+ this.configuration = new Configuration();
3527
+ if (configuration) {
3528
+ this.configuration = configuration;
3577
3529
  }
3578
- else {
3579
- this.viewContext.translateServiceChanged.pipe(takeUntil(this._destroy$)).subscribe(() => {
3580
- this.subscribeToTranslateService();
3581
- });
3530
+ if (typeof this.configuration.basePath !== 'string') {
3531
+ if (Array.isArray(basePath) && basePath.length > 0) {
3532
+ basePath = basePath[0];
3533
+ }
3534
+ if (typeof basePath !== 'string') {
3535
+ basePath = this.basePath;
3536
+ }
3537
+ this.configuration.basePath = basePath;
3582
3538
  }
3539
+ this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
3583
3540
  }
3584
- ngOnDestroy() {
3585
- this._destroy$.next();
3586
- this._destroy$.complete();
3587
- }
3588
- subscribeToTranslateService() {
3589
- this.viewContext
3590
- .translateService.onLangChange.pipe(takeUntil(this._destroy$))
3591
- .subscribe(() => {
3592
- this.languageChanged.next();
3593
- });
3541
+ // @ts-ignore
3542
+ addToHttpParams(httpParams, value, key) {
3543
+ if (typeof value === "object" && value instanceof Date === false) {
3544
+ httpParams = this.addToHttpParamsRecursive(httpParams, value);
3545
+ }
3546
+ else {
3547
+ httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
3548
+ }
3549
+ return httpParams;
3594
3550
  }
3595
- getActionDescriptor(uiAction) {
3596
- var _a;
3597
- return __awaiter(this, void 0, void 0, function* () {
3598
- let code = uiAction.code;
3599
- let actionDescriptorFromDescriptors = (_a = this.viewContext.getActionDescriptors()) === null || _a === void 0 ? void 0 : _a.get(code);
3600
- let isUnkown = false;
3601
- let actionDescriptor;
3602
- if (actionDescriptorFromDescriptors) {
3603
- actionDescriptor = JSON.parse(JSON.stringify(actionDescriptorFromDescriptors));
3551
+ addToHttpParamsRecursive(httpParams, value, key) {
3552
+ if (value == null) {
3553
+ return httpParams;
3554
+ }
3555
+ if (typeof value === "object") {
3556
+ if (Array.isArray(value)) {
3557
+ value.forEach(elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
3604
3558
  }
3605
- if (!actionDescriptor) {
3606
- isUnkown = true;
3607
- let unkownActionDescriptor = this.basicActionDescriptors.get('UNKOWN');
3608
- actionDescriptor = Object.assign({}, unkownActionDescriptor);
3609
- actionDescriptor.title = code;
3559
+ else if (value instanceof Date) {
3560
+ if (key != null) {
3561
+ httpParams = httpParams.append(key, value.toISOString().substr(0, 10));
3562
+ }
3563
+ else {
3564
+ throw Error("key may not be null if value is Date");
3565
+ }
3610
3566
  }
3611
- if (!actionDescriptor.dialog) {
3612
- actionDescriptor = this.setUpUnkownDialogDescriptor(code, actionDescriptor, 'dialog');
3567
+ else {
3568
+ Object.keys(value).forEach(k => httpParams = this.addToHttpParamsRecursive(httpParams, value[k], key != null ? `${key}.${k}` : k));
3613
3569
  }
3614
- if (!actionDescriptor.feedbackType && uiAction.submit) {
3615
- actionDescriptor.feedbackType = UiActionFeedbackType.Snackbar;
3570
+ }
3571
+ else if (key != null) {
3572
+ httpParams = httpParams.append(key, value);
3573
+ }
3574
+ else {
3575
+ throw Error("key may not be null if value is not object or array");
3576
+ }
3577
+ return httpParams;
3578
+ }
3579
+ nopePost(observe = 'body', reportProgress = false, options) {
3580
+ let localVarHeaders = this.defaultHeaders;
3581
+ let localVarHttpHeaderAcceptSelected = options && options.httpHeaderAccept;
3582
+ if (localVarHttpHeaderAcceptSelected === undefined) {
3583
+ // to determine the Accept header
3584
+ const httpHeaderAccepts = [];
3585
+ localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
3586
+ }
3587
+ if (localVarHttpHeaderAcceptSelected !== undefined) {
3588
+ localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
3589
+ }
3590
+ let localVarHttpContext = options && options.context;
3591
+ if (localVarHttpContext === undefined) {
3592
+ localVarHttpContext = new HttpContext();
3593
+ }
3594
+ let responseType_ = 'json';
3595
+ if (localVarHttpHeaderAcceptSelected) {
3596
+ if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
3597
+ responseType_ = 'text';
3616
3598
  }
3617
- if (this.viewContext.translateService && actionDescriptor && !isUnkown) {
3618
- actionDescriptor = yield this.translateUiActionDescriptor(actionDescriptor);
3599
+ else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
3600
+ responseType_ = 'json';
3619
3601
  }
3620
- return actionDescriptor;
3621
- });
3622
- }
3623
- translateUiActionDescriptor(uiActionDescriptor) {
3624
- return __awaiter(this, void 0, void 0, function* () {
3625
- uiActionDescriptor = yield this.deepTranslate(uiActionDescriptor);
3626
- return uiActionDescriptor;
3627
- });
3628
- }
3629
- deepTranslate(_model) {
3630
- return __awaiter(this, void 0, void 0, function* () {
3631
- let model = Object.assign({}, _model);
3632
- yield Promise.all(Object.keys(model).map((key) => __awaiter(this, void 0, void 0, function* () {
3633
- if (model[key] !== undefined &&
3634
- typeof model[key] === 'string' &&
3635
- model[key].length &&
3636
- this.keysToTranslate.includes(key)) {
3637
- model[key] = yield this.viewContext.translateService.get(model[key]).toPromise();
3638
- }
3639
- else if (model[key] !== undefined && typeof model[key] === 'object') {
3640
- model[key] = yield this.deepTranslate(model[key]);
3641
- }
3642
- return model;
3643
- })));
3644
- return model;
3602
+ else {
3603
+ responseType_ = 'blob';
3604
+ }
3605
+ }
3606
+ let localVarPath = `/nope`;
3607
+ return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, {
3608
+ context: localVarHttpContext,
3609
+ responseType: responseType_,
3610
+ withCredentials: this.configuration.withCredentials,
3611
+ headers: localVarHeaders,
3612
+ observe: observe,
3613
+ reportProgress: reportProgress
3645
3614
  });
3646
3615
  }
3647
- setUpUnkownDialogDescriptor(code, uiActionDescriptor, dialogType) {
3648
- let unkownDescriptor = this.basicActionDescriptors.get('UNKOWN');
3649
- uiActionDescriptor[dialogType] = unkownDescriptor.dialog;
3650
- uiActionDescriptor[dialogType].title = code;
3651
- uiActionDescriptor[dialogType].actionButton.caption = code;
3652
- return uiActionDescriptor;
3653
- }
3654
3616
  }
3655
- UiActionDescriptorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionDescriptorService, deps: [{ token: SmartViewContextService }], target: i0.ɵɵFactoryTarget.Injectable });
3656
- UiActionDescriptorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionDescriptorService, providedIn: 'root' });
3657
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionDescriptorService, decorators: [{
3617
+ DefaultService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: DefaultService, deps: [{ token: i1.HttpClient }, { token: BASE_PATH, optional: true }, { token: Configuration, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
3618
+ DefaultService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: DefaultService, providedIn: 'root' });
3619
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: DefaultService, decorators: [{
3658
3620
  type: Injectable,
3659
3621
  args: [{
3660
- providedIn: 'root',
3622
+ providedIn: 'root'
3661
3623
  }]
3662
- }], ctorParameters: function () { return [{ type: SmartViewContextService }]; } });
3663
-
3664
- class SuccessSnackBarComponent {
3665
- constructor(data, viewContext, manager) {
3666
- this.data = data;
3667
- this.viewContext = viewContext;
3668
- this.manager = manager;
3669
- this.manager.getActionDescriptor(data).then((descriptor) => {
3670
- var _a;
3671
- if (descriptor.feedbackText) {
3672
- this.text = descriptor.feedbackText;
3673
- }
3674
- else {
3675
- this.text = (_a = this.viewContext.commonFeedbackText) !== null && _a !== void 0 ? _a : "A mentés sikeres volt!";
3676
- }
3677
- });
3678
- }
3679
- }
3680
- SuccessSnackBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SuccessSnackBarComponent, deps: [{ token: MAT_SNACK_BAR_DATA }, { token: SmartViewContextService }, { token: UiActionDescriptorService }], target: i0.ɵɵFactoryTarget.Component });
3681
- SuccessSnackBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: SuccessSnackBarComponent, selector: "app-success-snack-bar", ngImport: i0, template: "<span class=\"successSnakBarContainer\" matSnackBarLabel> {{ text }} </span>\n", styles: ["::ng-deep .mat-snack-bar-container{text-align:center;border-radius:2rem}.successSnakBarContainer{color:#fff}\n"] });
3682
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SuccessSnackBarComponent, decorators: [{
3683
- type: Component,
3684
- args: [{ selector: "app-success-snack-bar", template: "<span class=\"successSnakBarContainer\" matSnackBarLabel> {{ text }} </span>\n", styles: ["::ng-deep .mat-snack-bar-container{text-align:center;border-radius:2rem}.successSnakBarContainer{color:#fff}\n"] }]
3685
3624
  }], ctorParameters: function () {
3686
- return [{ type: undefined, decorators: [{
3625
+ return [{ type: i1.HttpClient }, { type: undefined, decorators: [{
3626
+ type: Optional
3627
+ }, {
3687
3628
  type: Inject,
3688
- args: [MAT_SNACK_BAR_DATA]
3689
- }] }, { type: SmartViewContextService }, { type: UiActionDescriptorService }];
3629
+ args: [BASE_PATH]
3630
+ }] }, { type: Configuration, decorators: [{
3631
+ type: Optional
3632
+ }] }];
3690
3633
  } });
3691
3634
 
3692
- class UiActionConfirmDialogComponent {
3693
- constructor(service, manager) {
3694
- this.service = service;
3695
- this.manager = manager;
3696
- this.code = this.service.action.code;
3697
- this.setUp();
3698
- }
3699
- setUp() {
3700
- return __awaiter(this, void 0, void 0, function* () {
3701
- this.descriptor = yield this.manager.getActionDescriptor(this.service.action);
3702
- this.dialogType = this.descriptor.confirmDialog ? "confirmDialog" : "dialog";
3703
- });
3704
- }
3705
- ngOnDestroy() {
3706
- this.service._destroy$.next();
3707
- this.cancel();
3708
- }
3709
- getTitle() {
3710
- return this.descriptor[this.dialogType].title;
3711
- }
3712
- getText() {
3713
- var _a;
3714
- return (_a = this.descriptor[this.dialogType].text) !== null && _a !== void 0 ? _a : "";
3715
- }
3716
- getActionButtonLabel() {
3717
- return this.descriptor[this.dialogType].actionButton.caption;
3635
+ const APIS = [DefaultService];
3636
+
3637
+ /**
3638
+ * Form layout definition
3639
+ * Contains form layout definition objects.
3640
+ *
3641
+ * The version of the OpenAPI document: 1.0.0
3642
+ * Contact: info@it4all.hu
3643
+ *
3644
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
3645
+ * https://openapi-generator.tech
3646
+ * Do not edit the class manually.
3647
+ */
3648
+ const ComponentType = {
3649
+ Container: 'container',
3650
+ Form: 'form',
3651
+ Widget: 'widget'
3652
+ };
3653
+
3654
+ /**
3655
+ * Form layout definition
3656
+ * Contains form layout definition objects.
3657
+ *
3658
+ * The version of the OpenAPI document: 1.0.0
3659
+ * Contact: info@it4all.hu
3660
+ *
3661
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
3662
+ * https://openapi-generator.tech
3663
+ * Do not edit the class manually.
3664
+ */
3665
+ const ComponentWidgetType = {
3666
+ Grid: 'grid',
3667
+ Filter: 'filter',
3668
+ Tree: 'tree'
3669
+ };
3670
+
3671
+ /**
3672
+ * Form layout definition
3673
+ * Contains form layout definition objects.
3674
+ *
3675
+ * The version of the OpenAPI document: 1.0.0
3676
+ * Contact: info@it4all.hu
3677
+ *
3678
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
3679
+ * https://openapi-generator.tech
3680
+ * Do not edit the class manually.
3681
+ */
3682
+ const LayoutDirection = {
3683
+ Horizontal: 'horizontal',
3684
+ Vertical: 'vertical'
3685
+ };
3686
+
3687
+ class ApiModule {
3688
+ constructor(parentModule, http) {
3689
+ if (parentModule) {
3690
+ throw new Error('ApiModule is already loaded. Import in your base AppModule only.');
3691
+ }
3692
+ if (!http) {
3693
+ throw new Error('You need to import the HttpClientModule in your AppModule! \n' +
3694
+ 'See also https://github.com/angular/angular/issues/20575');
3695
+ }
3718
3696
  }
3719
- getActionButtonColor() {
3720
- return this.descriptor[this.dialogType].actionButton.color;
3697
+ static forRoot(configurationFactory) {
3698
+ return {
3699
+ ngModule: ApiModule,
3700
+ providers: [{ provide: Configuration, useFactory: configurationFactory }]
3701
+ };
3721
3702
  }
3722
- getCancelButtonLabel() {
3723
- return this.descriptor[this.dialogType].cancelButton.caption;
3703
+ }
3704
+ ApiModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ApiModule, deps: [{ token: ApiModule, optional: true, skipSelf: true }, { token: i1.HttpClient, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
3705
+ ApiModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ApiModule });
3706
+ ApiModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ApiModule, providers: [], imports: [[]] });
3707
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ApiModule, decorators: [{
3708
+ type: NgModule,
3709
+ args: [{
3710
+ imports: [],
3711
+ declarations: [],
3712
+ exports: [],
3713
+ providers: []
3714
+ }]
3715
+ }], ctorParameters: function () {
3716
+ return [{ type: ApiModule, decorators: [{
3717
+ type: Optional
3718
+ }, {
3719
+ type: SkipSelf
3720
+ }] }, { type: i1.HttpClient, decorators: [{
3721
+ type: Optional
3722
+ }] }];
3723
+ } });
3724
+
3725
+ // import { SmartFilter, SmartFilterComponent } from '@smartbit4all/filter';
3726
+ class SmartComponentLayoutComponent {
3727
+ constructor(layoutService) {
3728
+ this.layoutService = layoutService;
3724
3729
  }
3725
- getCancelButtonColor() {
3726
- return this.descriptor[this.dialogType].cancelButton.color;
3730
+ ngOnInit() {
3731
+ if (this.smartComponentLayout) {
3732
+ this.setUp();
3733
+ }
3727
3734
  }
3728
- doAction() {
3729
- this.service.doAction();
3735
+ ngOnChanges(changes) {
3736
+ this.smartComponentLayout = changes['smartComponentLayout'].currentValue;
3737
+ if (this.smartComponentLayout) {
3738
+ this.setUp();
3739
+ }
3730
3740
  }
3731
- cancel() {
3732
- this.service.cancel();
3741
+ setUp() {
3742
+ var _a, _b, _c, _d, _e, _f, _g;
3743
+ this.parent = (_a = this.smartComponentLayout) === null || _a === void 0 ? void 0 : _a.parentComponent;
3744
+ this.uuid = this.parent.uuid;
3745
+ this.treeService = this.parent.smartTreeService;
3746
+ if ((_b = this.smartComponentLayout) === null || _b === void 0 ? void 0 : _b.expandable) {
3747
+ this.constructExpandableSection();
3748
+ }
3749
+ else if (((_c = this.smartComponentLayout) === null || _c === void 0 ? void 0 : _c.type) === ComponentType.Form) {
3750
+ this.constructForm();
3751
+ }
3752
+ else if (((_d = this.smartComponentLayout) === null || _d === void 0 ? void 0 : _d.type) === ComponentType.Widget) {
3753
+ if (((_e = this.smartComponentLayout.widget) === null || _e === void 0 ? void 0 : _e.type) === ComponentWidgetType.Grid) {
3754
+ this.constructGrid();
3755
+ }
3756
+ else if (((_f = this.smartComponentLayout.widget) === null || _f === void 0 ? void 0 : _f.type) === ComponentWidgetType.Filter) {
3757
+ this.constructFilter();
3758
+ }
3759
+ else if (((_g = this.smartComponentLayout.widget) === null || _g === void 0 ? void 0 : _g.type) === ComponentWidgetType.Tree) {
3760
+ this.constructTree();
3761
+ }
3762
+ }
3763
+ }
3764
+ type() {
3765
+ return ComponentType;
3766
+ }
3767
+ constructExpandableSection() {
3768
+ var _a, _b;
3769
+ let data = Object.assign({}, this.smartComponentLayout);
3770
+ data.expandable = false;
3771
+ this.expandableSection = {
3772
+ title: (_b = (_a = this.smartComponentLayout) === null || _a === void 0 ? void 0 : _a.expandableSectionLabel) !== null && _b !== void 0 ? _b : '',
3773
+ data,
3774
+ inputName: 'smartComponentLayout',
3775
+ customComponent: SmartComponentLayoutComponent,
3776
+ };
3777
+ }
3778
+ constructForm() {
3779
+ var _a, _b, _c, _d, _e;
3780
+ const widgets = this.layoutService.render({
3781
+ layoutDefinitions: (_a = this.smartComponentLayout) === null || _a === void 0 ? void 0 : _a.form,
3782
+ });
3783
+ this.smartForm = {
3784
+ direction: SmartFormWidgetDirection.COL,
3785
+ model: (_b = this.parent) === null || _b === void 0 ? void 0 : _b.model,
3786
+ constraints: (_d = (_c = this.parent) === null || _c === void 0 ? void 0 : _c.model) === null || _d === void 0 ? void 0 : _d.constraints,
3787
+ widgets,
3788
+ };
3789
+ (_e = this.parent) === null || _e === void 0 ? void 0 : _e.addForm(
3790
+ // unique identifier for the form
3791
+ `form_${this.makeid(5)}`, this.smartForm, this.formChild);
3792
+ }
3793
+ makeid(length) {
3794
+ let result = '';
3795
+ const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
3796
+ const charactersLength = characters.length;
3797
+ let counter = 0;
3798
+ while (counter < length) {
3799
+ result += characters.charAt(Math.floor(Math.random() * charactersLength));
3800
+ counter += 1;
3801
+ }
3802
+ return result;
3803
+ }
3804
+ constructGrid() {
3805
+ var _a, _b, _c;
3806
+ this.smartGrid = {
3807
+ gridIdentifier: (_b = (_a = this.smartComponentLayout) === null || _a === void 0 ? void 0 : _a.widget) === null || _b === void 0 ? void 0 : _b.gridIdentifier,
3808
+ gridModel: {
3809
+ page: {},
3810
+ },
3811
+ layoutDef: SmartLayoutDef.TABLE,
3812
+ };
3813
+ this.smartGrid = (_c = this.parent) === null || _c === void 0 ? void 0 : _c.addGrid(this.smartGrid, {
3814
+ rowUiActionType: GridUiActionType.POPUP_MENU,
3815
+ }, false, this.gridChild);
3816
+ }
3817
+ constructFilter() {
3818
+ // this.smartFilter = (this.smartComponentLayout!.parentComponent as any).addFilter(
3819
+ // `filter_${this.makeid(5)}`,
3820
+ // this.smartComponentLayout?.widget?.filterExpressionFieldList,
3821
+ // this.smartComponentLayout?.widget?.filterType,
3822
+ // this.filterChild
3823
+ // );
3824
+ }
3825
+ constructTree() {
3826
+ var _a, _b, _c;
3827
+ this.parent.setUpDefaultTree((_b = (_a = this.smartComponentLayout) === null || _a === void 0 ? void 0 : _a.widget) === null || _b === void 0 ? void 0 : _b.treeIdentifier);
3828
+ (_c = this.treeService) === null || _c === void 0 ? void 0 : _c.initialize();
3733
3829
  }
3734
3830
  }
3735
- UiActionConfirmDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionConfirmDialogComponent, deps: [{ token: UiActionConfirmDialogService }, { token: UiActionDescriptorService }], target: i0.ɵɵFactoryTarget.Component });
3736
- UiActionConfirmDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: UiActionConfirmDialogComponent, selector: "app-ui-action-confirm-dialog", 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<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)=\"doAction()\">\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$2.SmartIconComponent, selector: "smart-icon", inputs: ["icon", "color"] }] });
3737
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionConfirmDialogComponent, decorators: [{
3831
+ SmartComponentLayoutComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartComponentLayoutComponent, deps: [{ token: i1$2.SmartformLayoutDefinitionService }], target: i0.ɵɵFactoryTarget.Component });
3832
+ SmartComponentLayoutComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: SmartComponentLayoutComponent, selector: "smart-component-layout", inputs: { smartComponentLayout: "smartComponentLayout" }, viewQueries: [{ propertyName: "formChild", first: true, predicate: ["form"], descendants: true }, { propertyName: "gridChild", first: true, predicate: ["grid"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div *ngIf=\"smartComponentLayout?.expandable; then expandable; else normal\"> </div>\n\n<ng-template #expandable>\n <smart-expandable-section\n *ngIf=\"expandableSection\"\n [data]=\"expandableSection\"\n ></smart-expandable-section>\n</ng-template>\n\n<ng-template #normal>\n <div\n *ngIf=\"smartComponentLayout?.type === type().Container\"\n [ngClass]=\"smartComponentLayout?.direction ?? 'vertical'\"\n >\n <smart-component-layout\n [smartComponentLayout]=\"layout\"\n *ngFor=\"let layout of smartComponentLayout?.components\"\n ></smart-component-layout>\n </div>\n <smartform #form [smartForm]=\"smartForm\"></smartform>\n <smart-grid #grid [smartGrid]=\"smartGrid\" [uuid]=\"uuid!\"></smart-grid>\n <!-- <smart-filter #filter [filter]=\"smartFilter\"></smart-filter> -->\n <smart-tree [treeService]=\"treeService!\"></smart-tree>\n</ng-template>\n", styles: [".horizontal{display:flex;flex-direction:row}.vertical{display:flex;flex-direction:column}\n"], components: [{ type: i2$2.ExpandableSectionComponent, selector: "smart-expandable-section", inputs: ["data", "index"] }, { type: SmartComponentLayoutComponent, selector: "smart-component-layout", inputs: ["smartComponentLayout"] }, { type: i1$2.SmartformComponent, selector: "smartform", inputs: ["smartForm"] }, { type: i3$2.SmartGridComponent, selector: "smart-grid", inputs: ["smartGrid", "uuid", "dev"] }, { type: i4$4.SmartTreeComponent, selector: "smart-tree", inputs: ["treeStyle", "treeService"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
3833
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartComponentLayoutComponent, decorators: [{
3738
3834
  type: Component,
3739
- args: [{ selector: "app-ui-action-confirm-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<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)=\"doAction()\">\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"] }]
3740
- }], ctorParameters: function () { return [{ type: UiActionConfirmDialogService }, { type: UiActionDescriptorService }]; } });
3835
+ args: [{ selector: 'smart-component-layout', template: "<div *ngIf=\"smartComponentLayout?.expandable; then expandable; else normal\"> </div>\n\n<ng-template #expandable>\n <smart-expandable-section\n *ngIf=\"expandableSection\"\n [data]=\"expandableSection\"\n ></smart-expandable-section>\n</ng-template>\n\n<ng-template #normal>\n <div\n *ngIf=\"smartComponentLayout?.type === type().Container\"\n [ngClass]=\"smartComponentLayout?.direction ?? 'vertical'\"\n >\n <smart-component-layout\n [smartComponentLayout]=\"layout\"\n *ngFor=\"let layout of smartComponentLayout?.components\"\n ></smart-component-layout>\n </div>\n <smartform #form [smartForm]=\"smartForm\"></smartform>\n <smart-grid #grid [smartGrid]=\"smartGrid\" [uuid]=\"uuid!\"></smart-grid>\n <!-- <smart-filter #filter [filter]=\"smartFilter\"></smart-filter> -->\n <smart-tree [treeService]=\"treeService!\"></smart-tree>\n</ng-template>\n", styles: [".horizontal{display:flex;flex-direction:row}.vertical{display:flex;flex-direction:column}\n"] }]
3836
+ }], ctorParameters: function () { return [{ type: i1$2.SmartformLayoutDefinitionService }]; }, propDecorators: { smartComponentLayout: [{
3837
+ type: Input
3838
+ }], formChild: [{
3839
+ type: ViewChild,
3840
+ args: ['form']
3841
+ }], gridChild: [{
3842
+ type: ViewChild,
3843
+ args: ['grid']
3844
+ }] } });
3741
3845
 
3742
- class UiActionConfirmDialogService extends SmartdialogService {
3743
- constructor(dialog, router) {
3846
+ class SmartViewContextErrorDialogService extends SmartdialogService {
3847
+ constructor(dialog, router, viewContext) {
3744
3848
  super(dialog, router);
3745
- this._destroy$ = new Subject();
3746
- this.onAction = new SmartSubject(this._destroy$);
3747
- this.shouldDoAction = false;
3849
+ this.viewContext = viewContext;
3850
+ this.dialogRefs = [];
3748
3851
  }
3852
+ handleAfterClosed(result) { }
3749
3853
  openDialog() {
3750
- this.shouldDoAction = false;
3751
- this.onAction = new SmartSubject(this._destroy$);
3752
3854
  const dialogData = {
3753
3855
  content: {
3754
3856
  title: '',
3755
3857
  },
3756
3858
  size: {},
3757
- customComponent: UiActionConfirmDialogComponent,
3859
+ customComponent: SmartViewContextErrorDialogComponent,
3758
3860
  };
3759
- this.createDialog(dialogData, UiActionConfirmDialogComponent);
3760
- }
3761
- doAction() {
3762
- this.shouldDoAction = true;
3763
- this.onAction.complete();
3764
- this.closeDialog();
3765
- this.onAction = new SmartSubject(this._destroy$);
3766
- }
3767
- cancel() {
3768
- this.onAction.complete();
3769
- this.closeDialog();
3770
- this.onAction = new SmartSubject(this._destroy$);
3771
- }
3772
- }
3773
- UiActionConfirmDialogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionConfirmDialogService, deps: [{ token: i1$1.MatDialog }, { token: i2$1.Router }], target: i0.ɵɵFactoryTarget.Injectable });
3774
- UiActionConfirmDialogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionConfirmDialogService, providedIn: 'root' });
3775
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionConfirmDialogService, decorators: [{
3776
- type: Injectable,
3777
- args: [{
3778
- providedIn: 'root',
3779
- }]
3780
- }], ctorParameters: function () { return [{ type: i1$1.MatDialog }, { type: i2$1.Router }]; } });
3781
-
3782
- class UiActionInputDialogComponent {
3783
- constructor(service, manager) {
3784
- this.service = service;
3785
- this.manager = manager;
3786
- this.code = this.service.action.code;
3787
- this.setUp();
3788
- }
3789
- ngOnDestroy() {
3790
- this.service._destroy$.next();
3791
- this.cancel();
3861
+ this.dialogRefs.push(this.createDialogRef(dialogData, SmartViewContextErrorDialogComponent));
3792
3862
  }
3793
- setUp() {
3863
+ closeDialog() {
3794
3864
  return __awaiter(this, void 0, void 0, function* () {
3795
- this.descriptor = yield this.manager.getActionDescriptor(this.service.action);
3796
- if (this.descriptor[this.service.inputTypeName]) {
3797
- this.dialogType = this.service.inputTypeName;
3798
- }
3799
- else {
3800
- this.dialogType = this.descriptor.inputDialog ? 'inputDialog' : 'dialog';
3801
- }
3802
- this.constructForm();
3865
+ let dialogRef = this.dialogRefs.pop();
3866
+ dialogRef === null || dialogRef === void 0 ? void 0 : dialogRef.close();
3803
3867
  });
3804
3868
  }
3805
- getTitle() {
3806
- return this.descriptor[this.dialogType].title;
3807
- }
3808
- getText() {
3809
- var _a;
3810
- return (_a = this.descriptor[this.dialogType].text) !== null && _a !== void 0 ? _a : '';
3811
- }
3812
- getActionButtonLabel() {
3813
- return this.descriptor[this.dialogType].actionButton.caption;
3814
- }
3815
- getActionButtonColor() {
3816
- return this.descriptor[this.dialogType].actionButton.color;
3817
- }
3818
- getCancelButtonLabel() {
3819
- return this.descriptor[this.dialogType].cancelButton.caption;
3820
- }
3821
- getCancelButtonColor() {
3822
- return this.descriptor[this.dialogType].cancelButton.color;
3823
- }
3824
- constructForm() {
3825
- var _a, _b, _c;
3826
- let model = {};
3827
- let inputName;
3828
- if (this.service.inputTypeName === 'inputDialog') {
3829
- inputName = 'input';
3830
- }
3831
- else {
3832
- inputName = 'input2';
3833
- }
3834
- if (this.service.nodeName) {
3835
- model[inputName] = this.service.nodeName;
3836
- }
3837
- else {
3838
- model[inputName] = '';
3839
- }
3840
- let type;
3841
- let inputType = `${inputName}Type`;
3842
- if (this.service.action[inputType] === UiActionInputType.Textfield) {
3843
- type = SmartFormWidgetType.TEXT_FIELD;
3844
- }
3845
- else {
3846
- type = SmartFormWidgetType.TEXT_BOX;
3847
- }
3848
- let widgets = [
3849
- {
3850
- key: inputName,
3851
- label: '',
3852
- type,
3853
- value: '',
3854
- validators: [
3855
- {
3856
- validator: Validators.required,
3857
- name: SmartValidatorName.required,
3858
- errorMessage: 'Ez a mező kötelező',
3859
- },
3860
- ],
3861
- placeholder: (_a = this.descriptor[this.dialogType].placeholder) !== null && _a !== void 0 ? _a : '',
3862
- showLabel: true,
3863
- },
3864
- ];
3865
- if (widgets[0].type === SmartFormWidgetType.TEXT_FIELD && ((_b = this.descriptor[this.dialogType]) === null || _b === void 0 ? void 0 : _b.mask)) {
3866
- widgets[0].mask = (_c = this.descriptor[this.dialogType]) === null || _c === void 0 ? void 0 : _c.mask;
3867
- }
3868
- this.folderForm = {
3869
- direction: SmartFormWidgetDirection.COL,
3870
- model,
3871
- widgets,
3872
- };
3873
- }
3874
- save() {
3875
- let form = this.folderFormChild.submitForm();
3876
- if (form.invalidFields) {
3877
- throw new Error('The form is invalid!');
3878
- }
3879
- this.service.onSave(form.model);
3880
- }
3881
- cancel() {
3882
- this.service.cancel();
3883
- }
3884
- }
3885
- 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 });
3886
- 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$2.SmartIconComponent, selector: "smart-icon", inputs: ["icon", "color"] }, { type: i1$2.SmartformComponent, selector: "smartform", inputs: ["smartForm"] }] });
3887
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionInputDialogComponent, decorators: [{
3888
- type: Component,
3889
- 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"] }]
3890
- }], ctorParameters: function () { return [{ type: UiActionInputDialogService }, { type: UiActionDescriptorService }]; }, propDecorators: { folderFormChild: [{
3891
- type: ViewChild,
3892
- args: ['form']
3893
- }] } });
3894
-
3895
- class UiActionInputDialogService extends SmartdialogService {
3896
- constructor(dialog, router) {
3897
- super(dialog, router);
3898
- this._destroy$ = new Subject();
3899
- this.onAction = new SmartSubject(this._destroy$);
3900
- }
3901
- setDataAndOpenDialog(action, nodeName) {
3902
- this.action = action;
3903
- this.nodeName = nodeName;
3904
- this.openDialog();
3905
- }
3906
- openDialog() {
3907
- this.params = undefined;
3908
- this.onAction = new SmartSubject(this._destroy$);
3909
- const dialogData = {
3910
- content: {
3911
- title: '',
3912
- },
3913
- size: {},
3914
- customComponent: UiActionInputDialogComponent,
3915
- };
3916
- this.createDialog(dialogData, UiActionInputDialogComponent);
3917
- }
3918
- onSave(params) {
3869
+ getSmartViewContextApiError() {
3870
+ var _a, _b, _c, _d, _e;
3919
3871
  return __awaiter(this, void 0, void 0, function* () {
3920
- this.params = params;
3921
- this.onAction.complete();
3922
- this.closeDialog();
3923
- this.onAction = new SmartSubject(this._destroy$);
3872
+ if ((_a = this.viewApiError) === null || _a === void 0 ? void 0 : _a.code) {
3873
+ return yield this.viewContext.getSmartViewContextApiErrorByCode(this.viewApiError.code);
3874
+ }
3875
+ let dialogTitle;
3876
+ let buttonLabel;
3877
+ let message;
3878
+ if (this.viewContext.translateService) {
3879
+ dialogTitle = yield this.viewContext.translateService
3880
+ .get(SmartViewContextErrorDialogTitle)
3881
+ .toPromise();
3882
+ buttonLabel = yield this.viewContext.translateService
3883
+ .get(SmartViewContextErrorDialogButtonLabel)
3884
+ .toPromise();
3885
+ message = yield this.viewContext.translateService
3886
+ .get(SmartViewContextErrorDialogMessage)
3887
+ .toPromise();
3888
+ }
3889
+ else {
3890
+ buttonLabel = 'Ok';
3891
+ dialogTitle = 'Hiba';
3892
+ message = 'An error has occured.';
3893
+ }
3894
+ return {
3895
+ code: (_c = (_b = this.viewApiError) === null || _b === void 0 ? void 0 : _b.code) !== null && _c !== void 0 ? _c : '',
3896
+ message: (_e = (_d = this.viewApiError) === null || _d === void 0 ? void 0 : _d.message) !== null && _e !== void 0 ? _e : message,
3897
+ buttonLabel,
3898
+ dialogTitle,
3899
+ };
3924
3900
  });
3925
3901
  }
3926
- cancel() {
3927
- this.onAction.complete();
3928
- this.closeDialog();
3929
- this.onAction = new SmartSubject(this._destroy$);
3930
- }
3931
3902
  }
3932
- UiActionInputDialogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionInputDialogService, deps: [{ token: i1$1.MatDialog }, { token: i2$1.Router }], target: i0.ɵɵFactoryTarget.Injectable });
3933
- UiActionInputDialogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionInputDialogService, providedIn: 'root' });
3934
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionInputDialogService, decorators: [{
3903
+ SmartViewContextErrorDialogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartViewContextErrorDialogService, deps: [{ token: i1$1.MatDialog }, { token: i2$1.Router }, { token: SmartViewContextService }], target: i0.ɵɵFactoryTarget.Injectable });
3904
+ SmartViewContextErrorDialogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartViewContextErrorDialogService, providedIn: 'root' });
3905
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartViewContextErrorDialogService, decorators: [{
3935
3906
  type: Injectable,
3936
3907
  args: [{
3937
3908
  providedIn: 'root',
3938
3909
  }]
3939
- }], ctorParameters: function () { return [{ type: i1$1.MatDialog }, { type: i2$1.Router }]; } });
3910
+ }], ctorParameters: function () { return [{ type: i1$1.MatDialog }, { type: i2$1.Router }, { type: SmartViewContextService }]; } });
3940
3911
 
3941
- class UiActionFileUploadDialogComponent {
3942
- constructor(service, manager) {
3912
+ class SmartViewContextErrorDialogComponent {
3913
+ constructor(service) {
3943
3914
  this.service = service;
3944
- this.manager = manager;
3945
- this.code = this.service.action.code;
3946
- this.setUp();
3947
- }
3948
- ngOnDestroy() {
3949
- this.service._destroy$.next();
3950
- this.cancel();
3951
- }
3952
- setUp() {
3953
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
3954
- return __awaiter(this, void 0, void 0, function* () {
3955
- this.descriptor = yield this.manager.getActionDescriptor(this.service.action);
3956
- this.isMultiple = this.service.isMultiple;
3957
- this.i18n = {
3958
- addFile: (_b = (_a = this.descriptor.upload) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b : 'dokumentum hozzáadása',
3959
- browseOrDrag: (_d = (_c = this.descriptor.upload) === null || _c === void 0 ? void 0 : _c.description) !== null && _d !== void 0 ? _d : 'tallózás vagy behúzás',
3960
- formats: (_f = (_e = this.descriptor.upload) === null || _e === void 0 ? void 0 : _e.formats) !== null && _f !== void 0 ? _f : '',
3961
- maxSize: (_h = (_g = this.descriptor.upload) === null || _g === void 0 ? void 0 : _g.maxSize) !== null && _h !== void 0 ? _h : '',
3962
- upload: (_j = this.descriptor.upload) === null || _j === void 0 ? void 0 : _j.uploadButtonTitle,
3963
- };
3964
- // TODO set max size and file formats by UiAction.params
3965
- if (this.descriptor[this.service.inputTypeName]) {
3966
- this.dialogType = this.service.inputTypeName;
3967
- }
3968
- else {
3969
- this.dialogType = this.descriptor.inputDialog ? 'inputDialog' : 'dialog';
3970
- }
3915
+ this.service
3916
+ .getSmartViewContextApiError()
3917
+ .then((smartViewContextApiError) => {
3918
+ this.smartViewContextApiError = smartViewContextApiError;
3971
3919
  });
3972
3920
  }
3973
- getTitle() {
3974
- return this.descriptor[this.dialogType].title;
3975
- }
3976
- getText() {
3921
+ ngOnInit() { }
3922
+ onActionClick() {
3977
3923
  var _a;
3978
- return (_a = this.descriptor[this.dialogType].text) !== null && _a !== void 0 ? _a : '';
3979
- }
3980
- getActionButtonLabel() {
3981
- return this.descriptor[this.dialogType].actionButton.caption;
3982
- }
3983
- getActionButtonColor() {
3984
- return this.descriptor[this.dialogType].actionButton.color;
3985
- }
3986
- getCancelButtonLabel() {
3987
- return this.descriptor[this.dialogType].cancelButton.caption;
3988
- }
3989
- getCancelButtonColor() {
3990
- return this.descriptor[this.dialogType].cancelButton.color;
3991
- }
3992
- upload(files) {
3993
- this.service.onSave(files);
3994
- }
3995
- cancel() {
3996
- this.service.cancel();
3924
+ if ((_a = this.smartViewContextApiError) === null || _a === void 0 ? void 0 : _a.customAction) {
3925
+ this.smartViewContextApiError.customAction();
3926
+ }
3927
+ this.service.closeDialog();
3997
3928
  }
3998
3929
  }
3999
- UiActionFileUploadDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionFileUploadDialogComponent, deps: [{ token: UiActionFileUploadDialogService }, { token: UiActionDescriptorService }], target: i0.ɵɵFactoryTarget.Component });
4000
- UiActionFileUploadDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: UiActionFileUploadDialogComponent, selector: "lib-ui-action-file-upload-dialog", ngImport: i0, template: "<div class=\"folderNameDialogContainer\">\n <div class=\"headerContainer\">\n <h3 class=\"color-accent-700\">\n {{ getTitle() }}\n </h3>\n <button mat-icon-button title=\"close\" (click)=\"cancel()\">\n <smart-icon [color]=\"'primary'\" [icon]=\"'X'\"></smart-icon>\n </button>\n </div>\n <p>\n {{ getText() }}\n </p>\n <smartfileuploader\n [i18n]=\"i18n\"\n [fileFormats]=\"fileFormats\"\n [maxSizeMb]=\"maxSizeMb\"\n [uploadCallback]=\"upload.bind(this)\"\n [isMultiple]=\"isMultiple\"\n ></smartfileuploader>\n <div class=\"folderNameDialogButtonsContainer\">\n <button mat-button color=\"accent\" [color]=\"getCancelButtonColor()\" (click)=\"cancel()\">\n {{ getCancelButtonLabel() }}\n </button>\n <!-- <button mat-raised-button [color]=\"getActionButtonColor()\" (click)=\"upload()\">\n {{ getActionButtonLabel() }}\n </button> -->\n </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$2.SmartIconComponent, selector: "smart-icon", inputs: ["icon", "color"] }, { type: i1$2.SmartfileuploaderComponent, selector: "smartfileuploader", inputs: ["uploadCallback", "fileFormats", "maxSizeMb", "i18n", "useIconButton", "isMultiple"] }] });
4001
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionFileUploadDialogComponent, decorators: [{
3930
+ SmartViewContextErrorDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartViewContextErrorDialogComponent, deps: [{ token: SmartViewContextErrorDialogService }], target: i0.ɵɵFactoryTarget.Component });
3931
+ SmartViewContextErrorDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: SmartViewContextErrorDialogComponent, selector: "lib-smart-view-context-error-dialog", ngImport: i0, template: "<div *ngIf=\"smartViewContextApiError\" class=\"container\">\n <h3 class=\"color-accent-700\">\n {{ smartViewContextApiError.dialogTitle }}\n </h3>\n <div class=\"content\">\n <p>\n {{ smartViewContextApiError.message }}\n </p>\n </div>\n <div class=\"buttonContainer\">\n <button mat-raised-button color=\"primary\" (click)=\"onActionClick()\">\n {{ smartViewContextApiError.buttonLabel }}\n </button>\n </div>\n</div>\n", styles: [".container{display:flex;flex-direction:column;gap:1em;min-width:25rem;max-width:50vw;height:auto;max-height:75vh}.content{flex:1;overflow:auto}.buttonContainer{display:flex;flex-direction:row;justify-content:flex-end}\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"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
3932
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartViewContextErrorDialogComponent, decorators: [{
4002
3933
  type: Component,
4003
- args: [{ selector: 'lib-ui-action-file-upload-dialog', template: "<div class=\"folderNameDialogContainer\">\n <div class=\"headerContainer\">\n <h3 class=\"color-accent-700\">\n {{ getTitle() }}\n </h3>\n <button mat-icon-button title=\"close\" (click)=\"cancel()\">\n <smart-icon [color]=\"'primary'\" [icon]=\"'X'\"></smart-icon>\n </button>\n </div>\n <p>\n {{ getText() }}\n </p>\n <smartfileuploader\n [i18n]=\"i18n\"\n [fileFormats]=\"fileFormats\"\n [maxSizeMb]=\"maxSizeMb\"\n [uploadCallback]=\"upload.bind(this)\"\n [isMultiple]=\"isMultiple\"\n ></smartfileuploader>\n <div class=\"folderNameDialogButtonsContainer\">\n <button mat-button color=\"accent\" [color]=\"getCancelButtonColor()\" (click)=\"cancel()\">\n {{ getCancelButtonLabel() }}\n </button>\n <!-- <button mat-raised-button [color]=\"getActionButtonColor()\" (click)=\"upload()\">\n {{ getActionButtonLabel() }}\n </button> -->\n </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"] }]
4004
- }], ctorParameters: function () { return [{ type: UiActionFileUploadDialogService }, { type: UiActionDescriptorService }]; } });
3934
+ args: [{ selector: 'lib-smart-view-context-error-dialog', template: "<div *ngIf=\"smartViewContextApiError\" class=\"container\">\n <h3 class=\"color-accent-700\">\n {{ smartViewContextApiError.dialogTitle }}\n </h3>\n <div class=\"content\">\n <p>\n {{ smartViewContextApiError.message }}\n </p>\n </div>\n <div class=\"buttonContainer\">\n <button mat-raised-button color=\"primary\" (click)=\"onActionClick()\">\n {{ smartViewContextApiError.buttonLabel }}\n </button>\n </div>\n</div>\n", styles: [".container{display:flex;flex-direction:column;gap:1em;min-width:25rem;max-width:50vw;height:auto;max-height:75vh}.content{flex:1;overflow:auto}.buttonContainer{display:flex;flex-direction:row;justify-content:flex-end}\n"] }]
3935
+ }], ctorParameters: function () { return [{ type: SmartViewContextErrorDialogService }]; } });
4005
3936
 
4006
- class UiActionFileUploadDialogService extends SmartdialogService {
4007
- constructor(dialog, router) {
4008
- super(dialog, router);
4009
- this._destroy$ = new Subject();
4010
- this.onAction = new SmartSubject(this._destroy$);
4011
- this.isMultiple = false;
4012
- }
4013
- setDataAndOpenDialog(action, nodeName) {
4014
- this.action = action;
4015
- this.nodeName = nodeName;
4016
- this.openDialog();
4017
- }
4018
- openDialog() {
4019
- this.files = undefined;
4020
- this.onAction = new SmartSubject(this._destroy$);
4021
- const dialogData = {
4022
- content: {
4023
- title: '',
4024
- },
4025
- size: {},
4026
- customComponent: UiActionFileUploadDialogComponent,
4027
- };
4028
- this.createDialog(dialogData, UiActionFileUploadDialogComponent);
3937
+ class SmartViewContextInterceptor {
3938
+ constructor(viewContextErrorDialog) {
3939
+ this.viewContextErrorDialog = viewContextErrorDialog;
4029
3940
  }
4030
- onSave(files) {
4031
- return __awaiter(this, void 0, void 0, function* () {
4032
- this.files = files;
4033
- this.onAction.complete();
4034
- this.closeDialog();
4035
- this.onAction = new SmartSubject(this._destroy$);
4036
- });
3941
+ intercept(request, next) {
3942
+ // parameter: async: True -> don't throw/open error (dialog)
3943
+ if (request.body) {
3944
+ try {
3945
+ let body = request.body;
3946
+ if (body.params[IS_ASYNC_PARAM_NAME]) {
3947
+ return next.handle(request);
3948
+ }
3949
+ }
3950
+ catch (error) { }
3951
+ }
3952
+ return next.handle(request).pipe(catchError((error) => {
3953
+ if (error.status === 409 &&
3954
+ (error.error.code || error.error.message)) {
3955
+ this.openErrorDialog(error.error);
3956
+ }
3957
+ return throwError(error);
3958
+ }));
4037
3959
  }
4038
- cancel() {
4039
- this.onAction.complete();
4040
- this.closeDialog();
4041
- this.onAction = new SmartSubject(this._destroy$);
3960
+ openErrorDialog(viewApiError) {
3961
+ this.viewContextErrorDialog.viewApiError = viewApiError;
3962
+ this.viewContextErrorDialog.openDialog();
4042
3963
  }
4043
3964
  }
4044
- UiActionFileUploadDialogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionFileUploadDialogService, deps: [{ token: i1$1.MatDialog }, { token: i2$1.Router }], target: i0.ɵɵFactoryTarget.Injectable });
4045
- UiActionFileUploadDialogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionFileUploadDialogService, providedIn: 'root' });
4046
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionFileUploadDialogService, decorators: [{
4047
- type: Injectable,
3965
+ SmartViewContextInterceptor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartViewContextInterceptor, deps: [{ token: SmartViewContextErrorDialogService }], target: i0.ɵɵFactoryTarget.Injectable });
3966
+ SmartViewContextInterceptor.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartViewContextInterceptor });
3967
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartViewContextInterceptor, decorators: [{
3968
+ type: Injectable
3969
+ }], ctorParameters: function () { return [{ type: SmartViewContextErrorDialogService }]; } });
3970
+
3971
+ class SmartViewRedirect {
3972
+ constructor(service, navigation, route) {
3973
+ this.service = service;
3974
+ this.navigation = navigation;
3975
+ this.route = route;
3976
+ this.navigation.route = this.route;
3977
+ this.navigation.subscribeToUrlChange((url) => {
3978
+ let channel = this.route.snapshot.paramMap.get(SmartLinkChannelVariableInPath);
3979
+ let uuid = this.route.snapshot.paramMap.get(SmartLinkUuidVariableInPath);
3980
+ if (!channel || !uuid) {
3981
+ throw new Error("channel or uuid is not reachable from the url!");
3982
+ }
3983
+ this.service.showPublishedView(channel, uuid);
3984
+ });
3985
+ }
3986
+ }
3987
+ SmartViewRedirect.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartViewRedirect, deps: [{ token: SmartViewContextService }, { token: i3$1.SmartNavigationService }, { token: i2$1.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component });
3988
+ SmartViewRedirect.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: SmartViewRedirect, selector: "app-redirect", ngImport: i0, template: "<div>Smart redirect</div>", isInline: true });
3989
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartViewRedirect, decorators: [{
3990
+ type: Component,
4048
3991
  args: [{
4049
- providedIn: 'root',
3992
+ selector: "app-redirect",
3993
+ template: "<div>Smart redirect</div>",
4050
3994
  }]
4051
- }], ctorParameters: function () { return [{ type: i1$1.MatDialog }, { type: i2$1.Router }]; } });
3995
+ }], ctorParameters: function () { return [{ type: SmartViewContextService }, { type: i3$1.SmartNavigationService }, { type: i2$1.ActivatedRoute }]; } });
3996
+ const SmartLinkChannelVariableInPath = "channel";
3997
+ const SmartLinkUuidVariableInPath = "uuid";
4052
3998
 
4053
- class UiActionService {
4054
- constructor(confirmDialogService, textFieldDialogService, fileUploadDialogService, _snackBar) {
4055
- this.confirmDialogService = confirmDialogService;
4056
- this.textFieldDialogService = textFieldDialogService;
4057
- this.fileUploadDialogService = fileUploadDialogService;
4058
- this._snackBar = _snackBar;
3999
+ class UiActionDescriptorService {
4000
+ constructor(viewContext) {
4001
+ this.viewContext = viewContext;
4059
4002
  this._destroy$ = new Subject();
4003
+ this.languageChanged = new SmartSubject(this._destroy$);
4004
+ this.keysToTranslate = ['title', 'text', 'placeholder', 'caption', 'feedbackText'];
4005
+ this.basicActionDescriptors = new Map([
4006
+ [
4007
+ 'UNKOWN',
4008
+ {
4009
+ title: '',
4010
+ type: UiActionButtonType.Normal,
4011
+ color: 'accent',
4012
+ icon: 'Question',
4013
+ iconColor: `text-primary`,
4014
+ iconPosition: UiActionButtonIconPos.Post,
4015
+ dialog: {
4016
+ title: '',
4017
+ placeholder: 'placeholder',
4018
+ actionButton: {
4019
+ caption: '',
4020
+ color: 'accent',
4021
+ },
4022
+ cancelButton: {
4023
+ caption: 'Mégse',
4024
+ color: '',
4025
+ },
4026
+ },
4027
+ },
4028
+ ],
4029
+ ]);
4030
+ if (this.viewContext.translateService) {
4031
+ this.subscribeToTranslateService();
4032
+ }
4033
+ else {
4034
+ this.viewContext.translateServiceChanged.pipe(takeUntil(this._destroy$)).subscribe(() => {
4035
+ this.subscribeToTranslateService();
4036
+ });
4037
+ }
4060
4038
  }
4061
4039
  ngOnDestroy() {
4062
4040
  this._destroy$.next();
4063
4041
  this._destroy$.complete();
4064
4042
  }
4065
- execute(uiAction, options) {
4043
+ subscribeToTranslateService() {
4044
+ this.viewContext
4045
+ .translateService.onLangChange.pipe(takeUntil(this._destroy$))
4046
+ .subscribe(() => {
4047
+ this.languageChanged.next();
4048
+ });
4049
+ }
4050
+ getActionDescriptor(uiAction) {
4066
4051
  var _a;
4067
4052
  return __awaiter(this, void 0, void 0, function* () {
4068
- let uiActionRequest;
4069
- uiActionRequest = {
4070
- code: uiAction.code,
4071
- identifier: uiAction.identifier,
4072
- params: (_a = uiAction.params) !== null && _a !== void 0 ? _a : {},
4073
- };
4074
- if (uiAction.submit) {
4075
- this.uiActionModel.serviceToUse.submit.next();
4076
- try {
4077
- yield this.uiActionModel.serviceToUse.submit.toPromise();
4078
- this.uiActionModel.serviceToUse.submit = new SmartSubject(this._destroy$);
4079
- this.uiActionModel.serviceToUse.reSubscribeToChange.next();
4080
- }
4081
- catch (error) {
4082
- console.error(error);
4083
- this.uiActionModel.serviceToUse.submit = new SmartSubject(this._destroy$);
4084
- this.uiActionModel.serviceToUse.reSubscribeToChange.next();
4085
- return;
4086
- }
4053
+ let code = uiAction.code;
4054
+ let actionDescriptorFromDescriptors = (_a = this.viewContext.getActionDescriptors()) === null || _a === void 0 ? void 0 : _a.get(code);
4055
+ let isUnkown = false;
4056
+ let actionDescriptor;
4057
+ if (actionDescriptorFromDescriptors) {
4058
+ actionDescriptor = JSON.parse(JSON.stringify(actionDescriptorFromDescriptors));
4087
4059
  }
4088
- if (uiAction.confirm) {
4089
- this.confirmDialogService.action = uiAction;
4090
- this.confirmDialogService.openDialog();
4091
- yield this.confirmDialogService.onAction.toPromise();
4092
- if (!this.confirmDialogService.shouldDoAction) {
4093
- return;
4094
- }
4060
+ if (!actionDescriptor) {
4061
+ isUnkown = true;
4062
+ let unkownActionDescriptor = this.basicActionDescriptors.get('UNKOWN');
4063
+ actionDescriptor = Object.assign({}, unkownActionDescriptor);
4064
+ actionDescriptor.title = code;
4095
4065
  }
4096
- // InputType
4097
- if (uiAction.inputType) {
4098
- uiActionRequest = yield this.handleInputType(uiAction.inputType, uiAction, uiActionRequest, 'inputDialog');
4099
- if (!uiActionRequest) {
4100
- return;
4101
- }
4102
- yield new Promise((resolve) => setTimeout(resolve, 250));
4066
+ if (!actionDescriptor.dialog) {
4067
+ actionDescriptor = this.setUpUnkownDialogDescriptor(code, actionDescriptor, 'dialog');
4103
4068
  }
4104
- // Input2Type
4105
- if (uiAction.input2Type) {
4106
- uiActionRequest = yield this.handleInputType(uiAction.input2Type, uiAction, uiActionRequest, 'input2Dialog');
4107
- if (!uiActionRequest) {
4108
- return;
4109
- }
4069
+ if (!actionDescriptor.feedbackType && uiAction.submit) {
4070
+ actionDescriptor.feedbackType = UiActionFeedbackType.Snackbar;
4110
4071
  }
4111
- if (this.uiActionModel.exception) {
4112
- let response = yield this.uiActionModel.serviceToUse.handleSpecificDemandsAsynchronously(uiAction, uiActionRequest);
4113
- if (!response.shouldPerformAction || !response.uiActionRequest) {
4114
- return;
4115
- }
4116
- uiActionRequest = response.uiActionRequest;
4072
+ if (this.viewContext.translateService && actionDescriptor && !isUnkown) {
4073
+ actionDescriptor = yield this.translateUiActionDescriptor(actionDescriptor);
4117
4074
  }
4118
- yield this.performAction(uiAction, uiActionRequest, options);
4075
+ return actionDescriptor;
4119
4076
  });
4120
4077
  }
4121
- handleInputType(inputType, uiAction, uiActionRequest, inputTypeName) {
4078
+ translateUiActionDescriptor(uiActionDescriptor) {
4122
4079
  return __awaiter(this, void 0, void 0, function* () {
4123
- switch (inputType) {
4124
- case UiActionInputType.None:
4125
- return uiActionRequest;
4126
- case UiActionInputType.Textarea:
4127
- case UiActionInputType.Textfield:
4128
- return yield this.handleInputTypeTextField(inputTypeName, uiAction, uiActionRequest);
4129
- case UiActionInputType.UserSelect:
4130
- return yield this.handleInputTypeUserSelect(inputTypeName, uiAction, uiActionRequest);
4131
- case UiActionInputType.File:
4132
- return yield this.handleInputTypeUpload(inputTypeName, uiAction, uiActionRequest, false);
4133
- case UiActionInputType.MultipleFiles:
4134
- return yield this.handleInputTypeUpload(inputTypeName, uiAction, uiActionRequest, true);
4135
- default:
4136
- return uiActionRequest;
4137
- }
4080
+ uiActionDescriptor = yield this.deepTranslate(uiActionDescriptor);
4081
+ return uiActionDescriptor;
4138
4082
  });
4139
4083
  }
4140
- handleInputTypeTextField(inputTypeName, uiAction, uiActionRequest) {
4084
+ deepTranslate(_model) {
4141
4085
  return __awaiter(this, void 0, void 0, function* () {
4142
- let additionalParams = this.uiActionModel.serviceToUse.getAdditionalParams(uiAction);
4143
- let inputType = inputTypeName === 'inputDialog' ? 'inputType' : 'input2Type';
4144
- if (uiAction[inputType] === UiActionInputType.Textfield) {
4145
- this.textFieldDialogService.nodeName = additionalParams.forTextField;
4146
- }
4147
- else if (uiAction[inputType] === UiActionInputType.Textarea) {
4148
- this.textFieldDialogService.nodeName = additionalParams.forTextArea;
4149
- }
4150
- this.textFieldDialogService.inputTypeName = inputTypeName;
4151
- this.textFieldDialogService.action = uiAction;
4152
- this.textFieldDialogService.openDialog();
4153
- yield this.textFieldDialogService.onAction.toPromise();
4154
- let params = this.textFieldDialogService.params;
4155
- if (!params) {
4156
- console.error('There was no response from InputDialog');
4157
- return;
4158
- }
4159
- uiActionRequest.params = Object.assign(Object.assign({}, uiActionRequest.params), params);
4160
- return uiActionRequest;
4086
+ let model = Object.assign({}, _model);
4087
+ yield Promise.all(Object.keys(model).map((key) => __awaiter(this, void 0, void 0, function* () {
4088
+ if (model[key] !== undefined &&
4089
+ typeof model[key] === 'string' &&
4090
+ model[key].length &&
4091
+ this.keysToTranslate.includes(key)) {
4092
+ model[key] = yield this.viewContext.translateService.get(model[key]).toPromise();
4093
+ }
4094
+ else if (model[key] !== undefined && typeof model[key] === 'object') {
4095
+ model[key] = yield this.deepTranslate(model[key]);
4096
+ }
4097
+ return model;
4098
+ })));
4099
+ return model;
4161
4100
  });
4162
4101
  }
4163
- handleInputTypeUpload(inputTypeName, uiAction, uiActionRequest, isMultiple) {
4164
- return __awaiter(this, void 0, void 0, function* () {
4165
- this.fileUploadDialogService.inputTypeName = inputTypeName;
4166
- this.fileUploadDialogService.action = uiAction;
4167
- this.fileUploadDialogService.isMultiple = isMultiple;
4168
- this.fileUploadDialogService.openDialog();
4169
- yield this.fileUploadDialogService.onAction.toPromise();
4170
- let files = this.fileUploadDialogService.files;
4171
- if (!files || !files.length) {
4172
- console.error('There was no response from InputDialog');
4173
- return;
4174
- }
4175
- uiActionRequest.params = Object.assign(Object.assign({}, uiActionRequest.params), { _files: files, isMultiple, param: uiAction.inputType === 'file' || uiAction.inputType === 'multiple_files'
4176
- ? 'INPUT'
4177
- : 'INPUT2' });
4178
- return uiActionRequest;
4179
- });
4102
+ setUpUnkownDialogDescriptor(code, uiActionDescriptor, dialogType) {
4103
+ let unkownDescriptor = this.basicActionDescriptors.get('UNKOWN');
4104
+ uiActionDescriptor[dialogType] = unkownDescriptor.dialog;
4105
+ uiActionDescriptor[dialogType].title = code;
4106
+ uiActionDescriptor[dialogType].actionButton.caption = code;
4107
+ return uiActionDescriptor;
4180
4108
  }
4181
- handleInputTypeUserSelect(inputTypeName, uiAction, uiActionRequest) {
4182
- return __awaiter(this, void 0, void 0, function* () {
4183
- let response = yield this.uiActionModel.serviceToUse.handleSpecificDemandsAsynchronously(uiAction, uiActionRequest);
4184
- if (!response.shouldPerformAction || !response.uiActionRequest) {
4185
- return;
4109
+ }
4110
+ UiActionDescriptorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionDescriptorService, deps: [{ token: SmartViewContextService }], target: i0.ɵɵFactoryTarget.Injectable });
4111
+ UiActionDescriptorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionDescriptorService, providedIn: 'root' });
4112
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionDescriptorService, decorators: [{
4113
+ type: Injectable,
4114
+ args: [{
4115
+ providedIn: 'root',
4116
+ }]
4117
+ }], ctorParameters: function () { return [{ type: SmartViewContextService }]; } });
4118
+
4119
+ class SuccessSnackBarComponent {
4120
+ constructor(data, viewContext, manager) {
4121
+ this.data = data;
4122
+ this.viewContext = viewContext;
4123
+ this.manager = manager;
4124
+ this.manager.getActionDescriptor(data).then((descriptor) => {
4125
+ var _a;
4126
+ if (descriptor.feedbackText) {
4127
+ this.text = descriptor.feedbackText;
4128
+ }
4129
+ else {
4130
+ this.text = (_a = this.viewContext.commonFeedbackText) !== null && _a !== void 0 ? _a : "A mentés sikeres volt!";
4186
4131
  }
4187
- uiActionRequest = response.uiActionRequest;
4188
- return uiActionRequest;
4189
4132
  });
4190
4133
  }
4191
- performAction(uiAction, uiActionRequest, options) {
4192
- var _a;
4134
+ }
4135
+ SuccessSnackBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SuccessSnackBarComponent, deps: [{ token: MAT_SNACK_BAR_DATA }, { token: SmartViewContextService }, { token: UiActionDescriptorService }], target: i0.ɵɵFactoryTarget.Component });
4136
+ SuccessSnackBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: SuccessSnackBarComponent, selector: "app-success-snack-bar", ngImport: i0, template: "<span class=\"successSnakBarContainer\" matSnackBarLabel> {{ text }} </span>\n", styles: ["::ng-deep .mat-snack-bar-container{text-align:center;border-radius:2rem}.successSnakBarContainer{color:#fff}\n"] });
4137
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SuccessSnackBarComponent, decorators: [{
4138
+ type: Component,
4139
+ args: [{ selector: "app-success-snack-bar", template: "<span class=\"successSnakBarContainer\" matSnackBarLabel> {{ text }} </span>\n", styles: ["::ng-deep .mat-snack-bar-container{text-align:center;border-radius:2rem}.successSnakBarContainer{color:#fff}\n"] }]
4140
+ }], ctorParameters: function () {
4141
+ return [{ type: undefined, decorators: [{
4142
+ type: Inject,
4143
+ args: [MAT_SNACK_BAR_DATA]
4144
+ }] }, { type: SmartViewContextService }, { type: UiActionDescriptorService }];
4145
+ } });
4146
+
4147
+ class UiActionConfirmDialogComponent {
4148
+ constructor(service, manager) {
4149
+ this.service = service;
4150
+ this.manager = manager;
4151
+ this.code = this.service.action.code;
4152
+ this.setUp();
4153
+ }
4154
+ setUp() {
4193
4155
  return __awaiter(this, void 0, void 0, function* () {
4194
- if (!uiActionRequest.params ||
4195
- (uiActionRequest.params && !Object.keys(uiActionRequest.params).length)) {
4196
- uiActionRequest.params = {
4197
- model: this.uiActionModel.serviceToUse.getModel(),
4198
- };
4199
- }
4200
- else if (uiAction.submit) {
4201
- uiActionRequest.params['model'] = this.uiActionModel.serviceToUse.getModel();
4202
- }
4203
- try {
4204
- yield this.uiActionModel.serviceToUse.performUiActionRequest(uiActionRequest, options === null || options === void 0 ? void 0 : options.widgetId, options === null || options === void 0 ? void 0 : options.nodeId);
4205
- if (((_a = this.uiActionModel.descriptor) === null || _a === void 0 ? void 0 : _a.feedbackType) === UiActionFeedbackType.Snackbar) {
4206
- this.showSavedSnackbar(uiAction);
4207
- }
4208
- }
4209
- catch (error) {
4210
- console.error(error);
4211
- }
4156
+ this.descriptor = yield this.manager.getActionDescriptor(this.service.action);
4157
+ this.dialogType = this.descriptor.confirmDialog ? "confirmDialog" : "dialog";
4212
4158
  });
4213
4159
  }
4214
- showSavedSnackbar(uiAction) {
4215
- this._snackBar.openFromComponent(SuccessSnackBarComponent, {
4216
- duration: 5 * 1000,
4217
- panelClass: ['backgroundColor-accent'],
4218
- data: uiAction,
4219
- });
4160
+ ngOnDestroy() {
4161
+ this.service._destroy$.next();
4162
+ this.cancel();
4163
+ }
4164
+ getTitle() {
4165
+ return this.descriptor[this.dialogType].title;
4166
+ }
4167
+ getText() {
4168
+ var _a;
4169
+ return (_a = this.descriptor[this.dialogType].text) !== null && _a !== void 0 ? _a : "";
4170
+ }
4171
+ getActionButtonLabel() {
4172
+ return this.descriptor[this.dialogType].actionButton.caption;
4173
+ }
4174
+ getActionButtonColor() {
4175
+ return this.descriptor[this.dialogType].actionButton.color;
4176
+ }
4177
+ getCancelButtonLabel() {
4178
+ return this.descriptor[this.dialogType].cancelButton.caption;
4179
+ }
4180
+ getCancelButtonColor() {
4181
+ return this.descriptor[this.dialogType].cancelButton.color;
4182
+ }
4183
+ doAction() {
4184
+ this.service.doAction();
4185
+ }
4186
+ cancel() {
4187
+ this.service.cancel();
4220
4188
  }
4221
4189
  }
4222
- UiActionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionService, deps: [{ token: UiActionConfirmDialogService }, { token: UiActionInputDialogService }, { token: UiActionFileUploadDialogService }, { token: i4$4.MatSnackBar }], target: i0.ɵɵFactoryTarget.Injectable });
4223
- UiActionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionService, providedIn: 'root' });
4224
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionService, decorators: [{
4190
+ UiActionConfirmDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionConfirmDialogComponent, deps: [{ token: UiActionConfirmDialogService }, { token: UiActionDescriptorService }], target: i0.ɵɵFactoryTarget.Component });
4191
+ UiActionConfirmDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: UiActionConfirmDialogComponent, selector: "app-ui-action-confirm-dialog", 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<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)=\"doAction()\">\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$2.SmartIconComponent, selector: "smart-icon", inputs: ["icon", "color"] }] });
4192
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionConfirmDialogComponent, decorators: [{
4193
+ type: Component,
4194
+ args: [{ selector: "app-ui-action-confirm-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<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)=\"doAction()\">\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"] }]
4195
+ }], ctorParameters: function () { return [{ type: UiActionConfirmDialogService }, { type: UiActionDescriptorService }]; } });
4196
+
4197
+ class UiActionConfirmDialogService extends SmartdialogService {
4198
+ constructor(dialog, router) {
4199
+ super(dialog, router);
4200
+ this._destroy$ = new Subject();
4201
+ this.onAction = new SmartSubject(this._destroy$);
4202
+ this.shouldDoAction = false;
4203
+ }
4204
+ openDialog() {
4205
+ this.shouldDoAction = false;
4206
+ this.onAction = new SmartSubject(this._destroy$);
4207
+ const dialogData = {
4208
+ content: {
4209
+ title: '',
4210
+ },
4211
+ size: {},
4212
+ customComponent: UiActionConfirmDialogComponent,
4213
+ };
4214
+ this.createDialog(dialogData, UiActionConfirmDialogComponent);
4215
+ }
4216
+ doAction() {
4217
+ this.shouldDoAction = true;
4218
+ this.onAction.complete();
4219
+ this.closeDialog();
4220
+ this.onAction = new SmartSubject(this._destroy$);
4221
+ }
4222
+ cancel() {
4223
+ this.onAction.complete();
4224
+ this.closeDialog();
4225
+ this.onAction = new SmartSubject(this._destroy$);
4226
+ }
4227
+ }
4228
+ UiActionConfirmDialogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionConfirmDialogService, deps: [{ token: i1$1.MatDialog }, { token: i2$1.Router }], target: i0.ɵɵFactoryTarget.Injectable });
4229
+ UiActionConfirmDialogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionConfirmDialogService, providedIn: 'root' });
4230
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionConfirmDialogService, decorators: [{
4225
4231
  type: Injectable,
4226
4232
  args: [{
4227
4233
  providedIn: 'root',
4228
4234
  }]
4229
- }], ctorParameters: function () { return [{ type: UiActionConfirmDialogService }, { type: UiActionInputDialogService }, { type: UiActionFileUploadDialogService }, { type: i4$4.MatSnackBar }]; } });
4235
+ }], ctorParameters: function () { return [{ type: i1$1.MatDialog }, { type: i2$1.Router }]; } });
4230
4236
 
4231
- class UiActionToolbarComponent {
4232
- constructor(service, inject) {
4237
+ class UiActionInputDialogComponent {
4238
+ constructor(service, manager) {
4233
4239
  this.service = service;
4234
- this.inject = inject;
4235
- this._destroy$ = new Subject();
4236
- this.pressedButtonActive = true;
4237
- // Injects the basic UiActionDescriptorService provided by the AppModule
4238
- this.manager = inject.get(UiActionDescriptorService);
4239
- this.subscribeToLanguageChange();
4240
- }
4241
- ngOnInit() {
4242
- // Overrides the basic UiActionDescriptorService with a custom one if there is one
4243
- if (this.uiActionDescriptorService) {
4244
- this.manager = this.uiActionDescriptorService;
4245
- this.subscribeToLanguageChange();
4246
- }
4240
+ this.manager = manager;
4241
+ this.code = this.service.action.code;
4247
4242
  this.setUp();
4248
4243
  }
4249
- ngOnChanges(changes) {
4250
- let uiActionModels = changes['uiActionModels'].currentValue;
4251
- if (uiActionModels) {
4252
- this.uiActionModels = uiActionModels;
4253
- this.setUp();
4254
- }
4255
- }
4256
4244
  ngOnDestroy() {
4257
- this._destroy$.next();
4258
- }
4259
- subscribeToLanguageChange() {
4260
- var _a;
4261
- (_a = this.languageChangedSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
4262
- this.languageChangedSubscription = this.manager.languageChanged
4263
- .pipe(takeUntil(this._destroy$))
4264
- .subscribe(() => {
4265
- this.setUp();
4266
- });
4245
+ this.service._destroy$.next();
4246
+ this.cancel();
4267
4247
  }
4268
4248
  setUp() {
4269
4249
  return __awaiter(this, void 0, void 0, function* () {
4270
- this.uiActionModelsWithDescriptions = yield Promise.all(this.uiActionModels.map((uiActionModel) => __awaiter(this, void 0, void 0, function* () {
4271
- uiActionModel.descriptor = yield this.manager.getActionDescriptor(uiActionModel.uiAction);
4272
- return uiActionModel;
4273
- })));
4274
- });
4275
- }
4276
- onActionClicked(event, uiActionModel) {
4277
- return __awaiter(this, void 0, void 0, function* () {
4278
- event.stopPropagation();
4279
- if (this.pressedButtonActive) {
4280
- this.pressedButtonActive = false;
4281
- this.service.uiActionModel = uiActionModel;
4282
- let options = {
4283
- nodeId: uiActionModel.nodeId,
4284
- widgetId: uiActionModel.widgetId,
4285
- };
4286
- yield this.service.execute(uiActionModel.uiAction, options);
4287
- this.pressedButtonActive = true;
4250
+ this.descriptor = yield this.manager.getActionDescriptor(this.service.action);
4251
+ if (this.descriptor[this.service.inputTypeName]) {
4252
+ this.dialogType = this.service.inputTypeName;
4288
4253
  }
4254
+ else {
4255
+ this.dialogType = this.descriptor.inputDialog ? 'inputDialog' : 'dialog';
4256
+ }
4257
+ this.constructForm();
4289
4258
  });
4290
4259
  }
4291
- onActionDoubleClicked(event, uiActionModel) {
4292
- event.stopPropagation();
4293
- // We do not handle double clicks
4260
+ getTitle() {
4261
+ return this.descriptor[this.dialogType].title;
4294
4262
  }
4295
- getType(uiActionModel) {
4296
- var _a, _b;
4297
- switch ((_a = uiActionModel.descriptor) === null || _a === void 0 ? void 0 : _a.type) {
4298
- case UiActionButtonType.Normal:
4299
- return 'mat-button';
4300
- case UiActionButtonType.Flat:
4301
- return 'mat-flat-button';
4302
- case UiActionButtonType.Raised:
4303
- return 'mat-raised-button';
4304
- case UiActionButtonType.Stroked:
4305
- return 'mat-stroked-button';
4306
- case UiActionButtonType.Icon:
4307
- return 'mat-icon-button';
4308
- case UiActionButtonType.MiniFab:
4309
- return 'mat-mini-fab';
4310
- case UiActionButtonType.Fab:
4311
- return 'mat-fab';
4312
- default:
4313
- console.log(`Unhandled action button type case: ${(_b = uiActionModel.descriptor) === null || _b === void 0 ? void 0 : _b.type}`);
4314
- return `mat-button`;
4315
- }
4263
+ getText() {
4264
+ var _a;
4265
+ return (_a = this.descriptor[this.dialogType].text) !== null && _a !== void 0 ? _a : '';
4316
4266
  }
4317
- iconPosition() {
4318
- return UiActionButtonIconPos;
4267
+ getActionButtonLabel() {
4268
+ return this.descriptor[this.dialogType].actionButton.caption;
4319
4269
  }
4320
- isOnlyIcon(uiActionModel) {
4321
- var _a, _b, _c;
4322
- return (((_a = uiActionModel.descriptor) === null || _a === void 0 ? void 0 : _a.type) === UiActionButtonType.Icon ||
4323
- ((_b = uiActionModel.descriptor) === null || _b === void 0 ? void 0 : _b.type) === UiActionButtonType.MiniFab ||
4324
- ((_c = uiActionModel.descriptor) === null || _c === void 0 ? void 0 : _c.type) === UiActionButtonType.Fab);
4270
+ getActionButtonColor() {
4271
+ return this.descriptor[this.dialogType].actionButton.color;
4272
+ }
4273
+ getCancelButtonLabel() {
4274
+ return this.descriptor[this.dialogType].cancelButton.caption;
4275
+ }
4276
+ getCancelButtonColor() {
4277
+ return this.descriptor[this.dialogType].cancelButton.color;
4278
+ }
4279
+ constructForm() {
4280
+ var _a, _b, _c;
4281
+ let model = {};
4282
+ let inputName;
4283
+ if (this.service.inputTypeName === 'inputDialog') {
4284
+ inputName = 'input';
4285
+ }
4286
+ else {
4287
+ inputName = 'input2';
4288
+ }
4289
+ if (this.service.nodeName) {
4290
+ model[inputName] = this.service.nodeName;
4291
+ }
4292
+ else {
4293
+ model[inputName] = '';
4294
+ }
4295
+ let type;
4296
+ let inputType = `${inputName}Type`;
4297
+ if (this.service.action[inputType] === UiActionInputType.Textfield) {
4298
+ type = SmartFormWidgetType.TEXT_FIELD;
4299
+ }
4300
+ else {
4301
+ type = SmartFormWidgetType.TEXT_BOX;
4302
+ }
4303
+ let widgets = [
4304
+ {
4305
+ key: inputName,
4306
+ label: '',
4307
+ type,
4308
+ value: '',
4309
+ validators: [
4310
+ {
4311
+ validator: Validators.required,
4312
+ name: SmartValidatorName.required,
4313
+ errorMessage: 'Ez a mező kötelező',
4314
+ },
4315
+ ],
4316
+ placeholder: (_a = this.descriptor[this.dialogType].placeholder) !== null && _a !== void 0 ? _a : '',
4317
+ showLabel: true,
4318
+ },
4319
+ ];
4320
+ if (widgets[0].type === SmartFormWidgetType.TEXT_FIELD && ((_b = this.descriptor[this.dialogType]) === null || _b === void 0 ? void 0 : _b.mask)) {
4321
+ widgets[0].mask = (_c = this.descriptor[this.dialogType]) === null || _c === void 0 ? void 0 : _c.mask;
4322
+ }
4323
+ this.folderForm = {
4324
+ direction: SmartFormWidgetDirection.COL,
4325
+ model,
4326
+ widgets,
4327
+ };
4328
+ }
4329
+ save() {
4330
+ let form = this.folderFormChild.submitForm();
4331
+ if (form.invalidFields) {
4332
+ throw new Error('The form is invalid!');
4333
+ }
4334
+ this.service.onSave(form.model);
4335
+ }
4336
+ cancel() {
4337
+ this.service.cancel();
4325
4338
  }
4326
4339
  }
4327
- UiActionToolbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionToolbarComponent, deps: [{ token: UiActionService }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
4328
- UiActionToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: UiActionToolbarComponent, selector: "smart-ui-action-toolbar", inputs: { uiActionModels: "uiActionModels", uiActionDescriptorService: "uiActionDescriptorService" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"uiActionButtonsContainer\">\n <button\n *ngFor=\"let uiActionModel of uiActionModelsWithDescriptions\"\n mat-button\n [ngClass]=\"getType(uiActionModel)\"\n class=\"{{ uiActionModel.cssClass }}\"\n [color]=\"uiActionModel.descriptor?.color\"\n (click)=\"onActionClicked($event, uiActionModel)\"\n (dblclick)=\"onActionDoubleClicked($event, uiActionModel)\"\n >\n <div *ngIf=\"isOnlyIcon(uiActionModel); then iconOnly; else text\"></div>\n <ng-template #iconOnly>\n <smart-icon\n *ngIf=\"uiActionModel.descriptor?.icon\"\n [icon]=\"uiActionModel.descriptor!.icon!\"\n [color]=\"uiActionModel.descriptor?.iconColor ?? uiActionModel.descriptor?.color\"\n ></smart-icon>\n </ng-template>\n <ng-template #text>\n <smart-icon\n *ngIf=\"\n uiActionModel.descriptor?.icon &&\n uiActionModel.descriptor?.iconPosition === iconPosition().Pre\n \"\n [icon]=\"uiActionModel.descriptor!.icon!\"\n [color]=\"uiActionModel.descriptor?.iconColor ?? uiActionModel.descriptor?.color\"\n ></smart-icon>\n {{ uiActionModel.descriptor?.title }}\n <smart-icon\n *ngIf=\"\n uiActionModel.descriptor?.icon &&\n uiActionModel.descriptor?.iconPosition === iconPosition().Post\n \"\n [icon]=\"uiActionModel.descriptor!.icon!\"\n [color]=\"uiActionModel.descriptor?.iconColor ?? uiActionModel.descriptor?.color\"\n ></smart-icon>\n </ng-template>\n </button>\n</div>\n", styles: [".uiActionButtonsContainer{display:flex;flex-direction:row;gap:1rem;flex-wrap:wrap;min-height:2.25rem}\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$2.SmartIconComponent, selector: "smart-icon", inputs: ["icon", "color"] }], directives: [{ type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
4329
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionToolbarComponent, decorators: [{
4340
+ 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 });
4341
+ 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$2.SmartIconComponent, selector: "smart-icon", inputs: ["icon", "color"] }, { type: i1$2.SmartformComponent, selector: "smartform", inputs: ["smartForm"] }] });
4342
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionInputDialogComponent, decorators: [{
4330
4343
  type: Component,
4331
- args: [{ selector: 'smart-ui-action-toolbar', template: "<div class=\"uiActionButtonsContainer\">\n <button\n *ngFor=\"let uiActionModel of uiActionModelsWithDescriptions\"\n mat-button\n [ngClass]=\"getType(uiActionModel)\"\n class=\"{{ uiActionModel.cssClass }}\"\n [color]=\"uiActionModel.descriptor?.color\"\n (click)=\"onActionClicked($event, uiActionModel)\"\n (dblclick)=\"onActionDoubleClicked($event, uiActionModel)\"\n >\n <div *ngIf=\"isOnlyIcon(uiActionModel); then iconOnly; else text\"></div>\n <ng-template #iconOnly>\n <smart-icon\n *ngIf=\"uiActionModel.descriptor?.icon\"\n [icon]=\"uiActionModel.descriptor!.icon!\"\n [color]=\"uiActionModel.descriptor?.iconColor ?? uiActionModel.descriptor?.color\"\n ></smart-icon>\n </ng-template>\n <ng-template #text>\n <smart-icon\n *ngIf=\"\n uiActionModel.descriptor?.icon &&\n uiActionModel.descriptor?.iconPosition === iconPosition().Pre\n \"\n [icon]=\"uiActionModel.descriptor!.icon!\"\n [color]=\"uiActionModel.descriptor?.iconColor ?? uiActionModel.descriptor?.color\"\n ></smart-icon>\n {{ uiActionModel.descriptor?.title }}\n <smart-icon\n *ngIf=\"\n uiActionModel.descriptor?.icon &&\n uiActionModel.descriptor?.iconPosition === iconPosition().Post\n \"\n [icon]=\"uiActionModel.descriptor!.icon!\"\n [color]=\"uiActionModel.descriptor?.iconColor ?? uiActionModel.descriptor?.color\"\n ></smart-icon>\n </ng-template>\n </button>\n</div>\n", styles: [".uiActionButtonsContainer{display:flex;flex-direction:row;gap:1rem;flex-wrap:wrap;min-height:2.25rem}\n"] }]
4332
- }], ctorParameters: function () { return [{ type: UiActionService }, { type: i0.Injector }]; }, propDecorators: { uiActionModels: [{
4333
- type: Input
4334
- }], uiActionDescriptorService: [{
4335
- type: Input
4344
+ 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"] }]
4345
+ }], ctorParameters: function () { return [{ type: UiActionInputDialogService }, { type: UiActionDescriptorService }]; }, propDecorators: { folderFormChild: [{
4346
+ type: ViewChild,
4347
+ args: ['form']
4336
4348
  }] } });
4337
4349
 
4338
- class SmartViewContextModule {
4350
+ class UiActionInputDialogService extends SmartdialogService {
4351
+ constructor(dialog, router) {
4352
+ super(dialog, router);
4353
+ this._destroy$ = new Subject();
4354
+ this.onAction = new SmartSubject(this._destroy$);
4355
+ }
4356
+ setDataAndOpenDialog(action, nodeName) {
4357
+ this.action = action;
4358
+ this.nodeName = nodeName;
4359
+ this.openDialog();
4360
+ }
4361
+ openDialog() {
4362
+ this.params = undefined;
4363
+ this.onAction = new SmartSubject(this._destroy$);
4364
+ const dialogData = {
4365
+ content: {
4366
+ title: '',
4367
+ },
4368
+ size: {},
4369
+ customComponent: UiActionInputDialogComponent,
4370
+ };
4371
+ this.createDialog(dialogData, UiActionInputDialogComponent);
4372
+ }
4373
+ onSave(params) {
4374
+ return __awaiter(this, void 0, void 0, function* () {
4375
+ this.params = params;
4376
+ this.onAction.complete();
4377
+ this.closeDialog();
4378
+ this.onAction = new SmartSubject(this._destroy$);
4379
+ });
4380
+ }
4381
+ cancel() {
4382
+ this.onAction.complete();
4383
+ this.closeDialog();
4384
+ this.onAction = new SmartSubject(this._destroy$);
4385
+ }
4339
4386
  }
4340
- SmartViewContextModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartViewContextModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4341
- SmartViewContextModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartViewContextModule, declarations: [MessageDialogComponent,
4342
- SmartViewContextErrorDialogComponent,
4343
- SmartViewRedirect,
4344
- UiActionToolbarComponent,
4345
- UiActionInputDialogComponent,
4346
- UiActionConfirmDialogComponent,
4347
- UiActionFileUploadDialogComponent], imports: [CommonModule,
4348
- HttpClientModule,
4349
- MatCommonModule,
4350
- MatButtonModule,
4351
- MatIconModule,
4352
- MatSnackBarModule,
4353
- SmartIconModule,
4354
- SmartformModule], exports: [UiActionToolbarComponent, UiActionInputDialogComponent] });
4355
- SmartViewContextModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartViewContextModule, providers: [
4356
- SmartViewContextService,
4357
- {
4358
- provide: HTTP_INTERCEPTORS,
4359
- useClass: SmartViewContextInterceptor,
4360
- multi: true,
4361
- },
4362
- ], imports: [[
4363
- CommonModule,
4364
- HttpClientModule,
4365
- MatCommonModule,
4366
- MatButtonModule,
4367
- MatIconModule,
4368
- MatSnackBarModule,
4369
- SmartIconModule,
4370
- SmartformModule,
4371
- ]] });
4372
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartViewContextModule, decorators: [{
4373
- type: NgModule,
4387
+ UiActionInputDialogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionInputDialogService, deps: [{ token: i1$1.MatDialog }, { token: i2$1.Router }], target: i0.ɵɵFactoryTarget.Injectable });
4388
+ UiActionInputDialogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionInputDialogService, providedIn: 'root' });
4389
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionInputDialogService, decorators: [{
4390
+ type: Injectable,
4374
4391
  args: [{
4375
- declarations: [
4376
- MessageDialogComponent,
4377
- SmartViewContextErrorDialogComponent,
4378
- SmartViewRedirect,
4379
- UiActionToolbarComponent,
4380
- UiActionInputDialogComponent,
4381
- UiActionConfirmDialogComponent,
4382
- UiActionFileUploadDialogComponent,
4383
- ],
4384
- imports: [
4385
- CommonModule,
4386
- HttpClientModule,
4387
- MatCommonModule,
4388
- MatButtonModule,
4389
- MatIconModule,
4390
- MatSnackBarModule,
4391
- SmartIconModule,
4392
- SmartformModule,
4393
- ],
4394
- exports: [UiActionToolbarComponent, UiActionInputDialogComponent],
4395
- providers: [
4396
- SmartViewContextService,
4397
- {
4398
- provide: HTTP_INTERCEPTORS,
4399
- useClass: SmartViewContextInterceptor,
4400
- multi: true,
4401
- },
4402
- ],
4392
+ providedIn: 'root',
4403
4393
  }]
4404
- }] });
4405
-
4406
- var UiActionDialogType;
4407
- (function (UiActionDialogType) {
4408
- UiActionDialogType["inputDialog"] = "inputDialog";
4409
- UiActionDialogType["confirmDialog"] = "confirmDialog";
4410
- UiActionDialogType["dialog"] = "dialog";
4411
- })(UiActionDialogType || (UiActionDialogType = {}));
4412
-
4413
- /*
4414
- * Public API Surface of smart-view-context
4415
- */
4394
+ }], ctorParameters: function () { return [{ type: i1$1.MatDialog }, { type: i2$1.Router }]; } });
4416
4395
 
4417
- class SmartFileUploaderComponent {
4418
- constructor(uiActionService, uiActionDescriptorService) {
4419
- this.uiActionService = uiActionService;
4420
- this.uiActionDescriptorService = uiActionDescriptorService;
4396
+ class UiActionFileUploadDialogComponent {
4397
+ constructor(service, manager) {
4398
+ this.service = service;
4399
+ this.manager = manager;
4400
+ this.code = this.service.action.code;
4401
+ this.setUp();
4421
4402
  }
4422
- ngOnChanges(changes) {
4423
- this.config = changes['config'].currentValue;
4424
- if (this.config) {
4425
- this.setUp();
4426
- }
4403
+ ngOnDestroy() {
4404
+ this.service._destroy$.next();
4405
+ this.cancel();
4427
4406
  }
4428
4407
  setUp() {
4429
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
4408
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
4430
4409
  return __awaiter(this, void 0, void 0, function* () {
4431
- this.uiActionModel = (_a = this.config) === null || _a === void 0 ? void 0 : _a.smartComponent.uiActionModels.find((uiActionModel) => { var _a; return uiActionModel.uiAction.code === ((_a = this.config) === null || _a === void 0 ? void 0 : _a.uiActionCode); });
4432
- if (!this.uiActionModel) {
4433
- throw new Error(`UiAction with code ${(_b = this.config) === null || _b === void 0 ? void 0 : _b.uiActionCode} could not found`);
4434
- }
4435
- const descriptor = yield this.uiActionDescriptorService.getActionDescriptor(this.uiActionModel.uiAction);
4410
+ this.descriptor = yield this.manager.getActionDescriptor(this.service.action);
4411
+ this.isMultiple = this.service.isMultiple;
4436
4412
  this.i18n = {
4437
- addFile: (_d = (_c = descriptor.upload) === null || _c === void 0 ? void 0 : _c.title) !== null && _d !== void 0 ? _d : 'dokumentum hozzáadása',
4438
- browseOrDrag: (_f = (_e = descriptor.upload) === null || _e === void 0 ? void 0 : _e.description) !== null && _f !== void 0 ? _f : 'tallózás vagy behúzás',
4439
- formats: (_h = (_g = descriptor.upload) === null || _g === void 0 ? void 0 : _g.formats) !== null && _h !== void 0 ? _h : '',
4440
- maxSize: (_k = (_j = descriptor.upload) === null || _j === void 0 ? void 0 : _j.maxSize) !== null && _k !== void 0 ? _k : '',
4441
- upload: (_l = descriptor.upload) === null || _l === void 0 ? void 0 : _l.uploadButtonTitle,
4413
+ addFile: (_b = (_a = this.descriptor.upload) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b : 'dokumentum hozzáadása',
4414
+ browseOrDrag: (_d = (_c = this.descriptor.upload) === null || _c === void 0 ? void 0 : _c.description) !== null && _d !== void 0 ? _d : 'tallózás vagy behúzás',
4415
+ formats: (_f = (_e = this.descriptor.upload) === null || _e === void 0 ? void 0 : _e.formats) !== null && _f !== void 0 ? _f : '',
4416
+ maxSize: (_h = (_g = this.descriptor.upload) === null || _g === void 0 ? void 0 : _g.maxSize) !== null && _h !== void 0 ? _h : '',
4417
+ upload: (_j = this.descriptor.upload) === null || _j === void 0 ? void 0 : _j.uploadButtonTitle,
4442
4418
  };
4419
+ // TODO set max size and file formats by UiAction.params
4420
+ if (this.descriptor[this.service.inputTypeName]) {
4421
+ this.dialogType = this.service.inputTypeName;
4422
+ }
4423
+ else {
4424
+ this.dialogType = this.descriptor.inputDialog ? 'inputDialog' : 'dialog';
4425
+ }
4443
4426
  });
4444
4427
  }
4445
- executeUpload(files) {
4428
+ getTitle() {
4429
+ return this.descriptor[this.dialogType].title;
4430
+ }
4431
+ getText() {
4446
4432
  var _a;
4447
- this.uiActionModel.uiAction.params = Object.assign(Object.assign({}, this.uiActionModel.uiAction.params), { _files: files, isMultiple: (_a = this.config) === null || _a === void 0 ? void 0 : _a.isMultiple, param: 'INPUT' });
4448
- this.uiActionService.uiActionModel = this.uiActionModel;
4449
- this.uiActionService.execute(this.uiActionModel.uiAction);
4433
+ return (_a = this.descriptor[this.dialogType].text) !== null && _a !== void 0 ? _a : '';
4450
4434
  }
4451
- }
4452
- SmartFileUploaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartFileUploaderComponent, deps: [{ token: UiActionService }, { token: UiActionDescriptorService }], target: i0.ɵɵFactoryTarget.Component });
4453
- SmartFileUploaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: SmartFileUploaderComponent, selector: "smart-file-uploader4sc", inputs: { config: "config" }, usesOnChanges: true, ngImport: i0, template: "<smartfileuploader\n *ngIf=\"i18n\"\n [i18n]=\"i18n\"\n [fileFormats]=\"config?.fileFormats\"\n [isMultiple]=\"config?.isMultiple\"\n [maxSizeMb]=\"config?.maxSizeMb\"\n [uploadCallback]=\"executeUpload.bind(this)\"\n></smartfileuploader>\n", styles: [""], components: [{ type: i1$2.SmartfileuploaderComponent, selector: "smartfileuploader", inputs: ["uploadCallback", "fileFormats", "maxSizeMb", "i18n", "useIconButton", "isMultiple"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
4454
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartFileUploaderComponent, decorators: [{
4455
- type: Component,
4456
- args: [{ selector: 'smart-file-uploader4sc', template: "<smartfileuploader\n *ngIf=\"i18n\"\n [i18n]=\"i18n\"\n [fileFormats]=\"config?.fileFormats\"\n [isMultiple]=\"config?.isMultiple\"\n [maxSizeMb]=\"config?.maxSizeMb\"\n [uploadCallback]=\"executeUpload.bind(this)\"\n></smartfileuploader>\n", styles: [""] }]
4457
- }], ctorParameters: function () { return [{ type: UiActionService }, { type: UiActionDescriptorService }]; }, propDecorators: { config: [{
4458
- type: Input
4459
- }] } });
4460
-
4461
- /**
4462
- * Custom HttpParameterCodec
4463
- * Workaround for https://github.com/angular/angular/issues/18261
4464
- */
4465
- class CustomHttpParameterCodec {
4466
- encodeKey(k) {
4467
- return encodeURIComponent(k);
4435
+ getActionButtonLabel() {
4436
+ return this.descriptor[this.dialogType].actionButton.caption;
4468
4437
  }
4469
- encodeValue(v) {
4470
- return encodeURIComponent(v);
4438
+ getActionButtonColor() {
4439
+ return this.descriptor[this.dialogType].actionButton.color;
4471
4440
  }
4472
- decodeKey(k) {
4473
- return decodeURIComponent(k);
4441
+ getCancelButtonLabel() {
4442
+ return this.descriptor[this.dialogType].cancelButton.caption;
4474
4443
  }
4475
- decodeValue(v) {
4476
- return decodeURIComponent(v);
4444
+ getCancelButtonColor() {
4445
+ return this.descriptor[this.dialogType].cancelButton.color;
4446
+ }
4447
+ upload(files) {
4448
+ this.service.onSave(files);
4449
+ }
4450
+ cancel() {
4451
+ this.service.cancel();
4477
4452
  }
4478
4453
  }
4454
+ UiActionFileUploadDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionFileUploadDialogComponent, deps: [{ token: UiActionFileUploadDialogService }, { token: UiActionDescriptorService }], target: i0.ɵɵFactoryTarget.Component });
4455
+ UiActionFileUploadDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: UiActionFileUploadDialogComponent, selector: "lib-ui-action-file-upload-dialog", ngImport: i0, template: "<div class=\"folderNameDialogContainer\">\n <div class=\"headerContainer\">\n <h3 class=\"color-accent-700\">\n {{ getTitle() }}\n </h3>\n <button mat-icon-button title=\"close\" (click)=\"cancel()\">\n <smart-icon [color]=\"'primary'\" [icon]=\"'X'\"></smart-icon>\n </button>\n </div>\n <p>\n {{ getText() }}\n </p>\n <smartfileuploader\n [i18n]=\"i18n\"\n [fileFormats]=\"fileFormats\"\n [maxSizeMb]=\"maxSizeMb\"\n [uploadCallback]=\"upload.bind(this)\"\n [isMultiple]=\"isMultiple\"\n ></smartfileuploader>\n <div class=\"folderNameDialogButtonsContainer\">\n <button mat-button color=\"accent\" [color]=\"getCancelButtonColor()\" (click)=\"cancel()\">\n {{ getCancelButtonLabel() }}\n </button>\n <!-- <button mat-raised-button [color]=\"getActionButtonColor()\" (click)=\"upload()\">\n {{ getActionButtonLabel() }}\n </button> -->\n </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$2.SmartIconComponent, selector: "smart-icon", inputs: ["icon", "color"] }, { type: i1$2.SmartfileuploaderComponent, selector: "smartfileuploader", inputs: ["uploadCallback", "fileFormats", "maxSizeMb", "i18n", "useIconButton", "isMultiple"] }] });
4456
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionFileUploadDialogComponent, decorators: [{
4457
+ type: Component,
4458
+ args: [{ selector: 'lib-ui-action-file-upload-dialog', template: "<div class=\"folderNameDialogContainer\">\n <div class=\"headerContainer\">\n <h3 class=\"color-accent-700\">\n {{ getTitle() }}\n </h3>\n <button mat-icon-button title=\"close\" (click)=\"cancel()\">\n <smart-icon [color]=\"'primary'\" [icon]=\"'X'\"></smart-icon>\n </button>\n </div>\n <p>\n {{ getText() }}\n </p>\n <smartfileuploader\n [i18n]=\"i18n\"\n [fileFormats]=\"fileFormats\"\n [maxSizeMb]=\"maxSizeMb\"\n [uploadCallback]=\"upload.bind(this)\"\n [isMultiple]=\"isMultiple\"\n ></smartfileuploader>\n <div class=\"folderNameDialogButtonsContainer\">\n <button mat-button color=\"accent\" [color]=\"getCancelButtonColor()\" (click)=\"cancel()\">\n {{ getCancelButtonLabel() }}\n </button>\n <!-- <button mat-raised-button [color]=\"getActionButtonColor()\" (click)=\"upload()\">\n {{ getActionButtonLabel() }}\n </button> -->\n </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"] }]
4459
+ }], ctorParameters: function () { return [{ type: UiActionFileUploadDialogService }, { type: UiActionDescriptorService }]; } });
4479
4460
 
4480
- const BASE_PATH = new InjectionToken('basePath');
4481
- const COLLECTION_FORMATS = {
4482
- 'csv': ',',
4483
- 'tsv': ' ',
4484
- 'ssv': ' ',
4485
- 'pipes': '|'
4486
- };
4487
-
4488
- class Configuration {
4489
- constructor(configurationParameters = {}) {
4490
- this.apiKeys = configurationParameters.apiKeys;
4491
- this.username = configurationParameters.username;
4492
- this.password = configurationParameters.password;
4493
- this.accessToken = configurationParameters.accessToken;
4494
- this.basePath = configurationParameters.basePath;
4495
- this.withCredentials = configurationParameters.withCredentials;
4496
- this.encoder = configurationParameters.encoder;
4497
- if (configurationParameters.encodeParam) {
4498
- this.encodeParam = configurationParameters.encodeParam;
4499
- }
4500
- else {
4501
- this.encodeParam = param => this.defaultEncodeParam(param);
4502
- }
4503
- if (configurationParameters.credentials) {
4504
- this.credentials = configurationParameters.credentials;
4505
- }
4506
- else {
4507
- this.credentials = {};
4508
- }
4509
- }
4510
- /**
4511
- * Select the correct content-type to use for a request.
4512
- * Uses {@link Configuration#isJsonMime} to determine the correct content-type.
4513
- * If no content type is found return the first found type if the contentTypes is not empty
4514
- * @param contentTypes - the array of content types that are available for selection
4515
- * @returns the selected content-type or <code>undefined</code> if no selection could be made.
4516
- */
4517
- selectHeaderContentType(contentTypes) {
4518
- if (contentTypes.length === 0) {
4519
- return undefined;
4520
- }
4521
- const type = contentTypes.find((x) => this.isJsonMime(x));
4522
- if (type === undefined) {
4523
- return contentTypes[0];
4524
- }
4525
- return type;
4461
+ class UiActionFileUploadDialogService extends SmartdialogService {
4462
+ constructor(dialog, router) {
4463
+ super(dialog, router);
4464
+ this._destroy$ = new Subject();
4465
+ this.onAction = new SmartSubject(this._destroy$);
4466
+ this.isMultiple = false;
4526
4467
  }
4527
- /**
4528
- * Select the correct accept content-type to use for a request.
4529
- * Uses {@link Configuration#isJsonMime} to determine the correct accept content-type.
4530
- * If no content type is found return the first found type if the contentTypes is not empty
4531
- * @param accepts - the array of content types that are available for selection.
4532
- * @returns the selected content-type or <code>undefined</code> if no selection could be made.
4533
- */
4534
- selectHeaderAccept(accepts) {
4535
- if (accepts.length === 0) {
4536
- return undefined;
4537
- }
4538
- const type = accepts.find((x) => this.isJsonMime(x));
4539
- if (type === undefined) {
4540
- return accepts[0];
4541
- }
4542
- return type;
4468
+ setDataAndOpenDialog(action, nodeName) {
4469
+ this.action = action;
4470
+ this.nodeName = nodeName;
4471
+ this.openDialog();
4543
4472
  }
4544
- /**
4545
- * Check if the given MIME is a JSON MIME.
4546
- * JSON MIME examples:
4547
- * application/json
4548
- * application/json; charset=UTF8
4549
- * APPLICATION/JSON
4550
- * application/vnd.company+json
4551
- * @param mime - MIME (Multipurpose Internet Mail Extensions)
4552
- * @return True if the given MIME is JSON, false otherwise.
4553
- */
4554
- isJsonMime(mime) {
4555
- const jsonMime = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
4556
- return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
4473
+ openDialog() {
4474
+ this.files = undefined;
4475
+ this.onAction = new SmartSubject(this._destroy$);
4476
+ const dialogData = {
4477
+ content: {
4478
+ title: '',
4479
+ },
4480
+ size: {},
4481
+ customComponent: UiActionFileUploadDialogComponent,
4482
+ };
4483
+ this.createDialog(dialogData, UiActionFileUploadDialogComponent);
4557
4484
  }
4558
- lookupCredential(key) {
4559
- const value = this.credentials[key];
4560
- return typeof value === 'function'
4561
- ? value()
4562
- : value;
4485
+ onSave(files) {
4486
+ return __awaiter(this, void 0, void 0, function* () {
4487
+ this.files = files;
4488
+ this.onAction.complete();
4489
+ this.closeDialog();
4490
+ this.onAction = new SmartSubject(this._destroy$);
4491
+ });
4563
4492
  }
4564
- defaultEncodeParam(param) {
4565
- // This implementation exists as fallback for missing configuration
4566
- // and for backwards compatibility to older typescript-angular generator versions.
4567
- // It only works for the 'simple' parameter style.
4568
- // Date-handling only works for the 'date-time' format.
4569
- // All other styles and Date-formats are probably handled incorrectly.
4570
- //
4571
- // But: if that's all you need (i.e.: the most common use-case): no need for customization!
4572
- const value = param.dataFormat === 'date-time' && param.value instanceof Date
4573
- ? param.value.toISOString()
4574
- : param.value;
4575
- return encodeURIComponent(String(value));
4493
+ cancel() {
4494
+ this.onAction.complete();
4495
+ this.closeDialog();
4496
+ this.onAction = new SmartSubject(this._destroy$);
4576
4497
  }
4577
4498
  }
4499
+ UiActionFileUploadDialogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionFileUploadDialogService, deps: [{ token: i1$1.MatDialog }, { token: i2$1.Router }], target: i0.ɵɵFactoryTarget.Injectable });
4500
+ UiActionFileUploadDialogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionFileUploadDialogService, providedIn: 'root' });
4501
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionFileUploadDialogService, decorators: [{
4502
+ type: Injectable,
4503
+ args: [{
4504
+ providedIn: 'root',
4505
+ }]
4506
+ }], ctorParameters: function () { return [{ type: i1$1.MatDialog }, { type: i2$1.Router }]; } });
4578
4507
 
4579
- /**
4580
- * Form layout definition
4581
- * Contains form layout definition objects.
4582
- *
4583
- * The version of the OpenAPI document: 1.0.0
4584
- * Contact: info@it4all.hu
4585
- *
4586
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
4587
- * https://openapi-generator.tech
4588
- * Do not edit the class manually.
4589
- */
4590
- class DefaultService {
4591
- constructor(httpClient, basePath, configuration) {
4592
- this.httpClient = httpClient;
4593
- this.basePath = 'http://localhost';
4594
- this.defaultHeaders = new HttpHeaders();
4595
- this.configuration = new Configuration();
4596
- if (configuration) {
4597
- this.configuration = configuration;
4598
- }
4599
- if (typeof this.configuration.basePath !== 'string') {
4600
- if (Array.isArray(basePath) && basePath.length > 0) {
4601
- basePath = basePath[0];
4602
- }
4603
- if (typeof basePath !== 'string') {
4604
- basePath = this.basePath;
4605
- }
4606
- this.configuration.basePath = basePath;
4607
- }
4608
- this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
4508
+ class UiActionService {
4509
+ constructor(confirmDialogService, textFieldDialogService, fileUploadDialogService, _snackBar) {
4510
+ this.confirmDialogService = confirmDialogService;
4511
+ this.textFieldDialogService = textFieldDialogService;
4512
+ this.fileUploadDialogService = fileUploadDialogService;
4513
+ this._snackBar = _snackBar;
4514
+ this._destroy$ = new Subject();
4609
4515
  }
4610
- // @ts-ignore
4611
- addToHttpParams(httpParams, value, key) {
4612
- if (typeof value === "object" && value instanceof Date === false) {
4613
- httpParams = this.addToHttpParamsRecursive(httpParams, value);
4614
- }
4615
- else {
4616
- httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
4617
- }
4618
- return httpParams;
4516
+ ngOnDestroy() {
4517
+ this._destroy$.next();
4518
+ this._destroy$.complete();
4619
4519
  }
4620
- addToHttpParamsRecursive(httpParams, value, key) {
4621
- if (value == null) {
4622
- return httpParams;
4623
- }
4624
- if (typeof value === "object") {
4625
- if (Array.isArray(value)) {
4626
- value.forEach(elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
4627
- }
4628
- else if (value instanceof Date) {
4629
- if (key != null) {
4630
- httpParams = httpParams.append(key, value.toISOString().substr(0, 10));
4520
+ execute(uiAction, options) {
4521
+ var _a;
4522
+ return __awaiter(this, void 0, void 0, function* () {
4523
+ let uiActionRequest;
4524
+ uiActionRequest = {
4525
+ code: uiAction.code,
4526
+ identifier: uiAction.identifier,
4527
+ params: (_a = uiAction.params) !== null && _a !== void 0 ? _a : {},
4528
+ };
4529
+ if (uiAction.submit) {
4530
+ this.uiActionModel.serviceToUse.submit.next();
4531
+ try {
4532
+ yield this.uiActionModel.serviceToUse.submit.toPromise();
4533
+ this.uiActionModel.serviceToUse.submit = new SmartSubject(this._destroy$);
4534
+ this.uiActionModel.serviceToUse.reSubscribeToChange.next();
4631
4535
  }
4632
- else {
4633
- throw Error("key may not be null if value is Date");
4536
+ catch (error) {
4537
+ console.error(error);
4538
+ this.uiActionModel.serviceToUse.submit = new SmartSubject(this._destroy$);
4539
+ this.uiActionModel.serviceToUse.reSubscribeToChange.next();
4540
+ return;
4634
4541
  }
4635
4542
  }
4636
- else {
4637
- Object.keys(value).forEach(k => httpParams = this.addToHttpParamsRecursive(httpParams, value[k], key != null ? `${key}.${k}` : k));
4543
+ if (uiAction.confirm) {
4544
+ this.confirmDialogService.action = uiAction;
4545
+ this.confirmDialogService.openDialog();
4546
+ yield this.confirmDialogService.onAction.toPromise();
4547
+ if (!this.confirmDialogService.shouldDoAction) {
4548
+ return;
4549
+ }
4638
4550
  }
4639
- }
4640
- else if (key != null) {
4641
- httpParams = httpParams.append(key, value);
4642
- }
4643
- else {
4644
- throw Error("key may not be null if value is not object or array");
4645
- }
4646
- return httpParams;
4551
+ // InputType
4552
+ if (uiAction.inputType) {
4553
+ uiActionRequest = yield this.handleInputType(uiAction.inputType, uiAction, uiActionRequest, 'inputDialog');
4554
+ if (!uiActionRequest) {
4555
+ return;
4556
+ }
4557
+ yield new Promise((resolve) => setTimeout(resolve, 250));
4558
+ }
4559
+ // Input2Type
4560
+ if (uiAction.input2Type) {
4561
+ uiActionRequest = yield this.handleInputType(uiAction.input2Type, uiAction, uiActionRequest, 'input2Dialog');
4562
+ if (!uiActionRequest) {
4563
+ return;
4564
+ }
4565
+ }
4566
+ if (this.uiActionModel.exception) {
4567
+ let response = yield this.uiActionModel.serviceToUse.handleSpecificDemandsAsynchronously(uiAction, uiActionRequest);
4568
+ if (!response.shouldPerformAction || !response.uiActionRequest) {
4569
+ return;
4570
+ }
4571
+ uiActionRequest = response.uiActionRequest;
4572
+ }
4573
+ yield this.performAction(uiAction, uiActionRequest, options);
4574
+ });
4647
4575
  }
4648
- nopePost(observe = 'body', reportProgress = false, options) {
4649
- let localVarHeaders = this.defaultHeaders;
4650
- let localVarHttpHeaderAcceptSelected = options && options.httpHeaderAccept;
4651
- if (localVarHttpHeaderAcceptSelected === undefined) {
4652
- // to determine the Accept header
4653
- const httpHeaderAccepts = [];
4654
- localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
4655
- }
4656
- if (localVarHttpHeaderAcceptSelected !== undefined) {
4657
- localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
4658
- }
4659
- let localVarHttpContext = options && options.context;
4660
- if (localVarHttpContext === undefined) {
4661
- localVarHttpContext = new HttpContext();
4662
- }
4663
- let responseType_ = 'json';
4664
- if (localVarHttpHeaderAcceptSelected) {
4665
- if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
4666
- responseType_ = 'text';
4576
+ handleInputType(inputType, uiAction, uiActionRequest, inputTypeName) {
4577
+ return __awaiter(this, void 0, void 0, function* () {
4578
+ switch (inputType) {
4579
+ case UiActionInputType.None:
4580
+ return uiActionRequest;
4581
+ case UiActionInputType.Textarea:
4582
+ case UiActionInputType.Textfield:
4583
+ return yield this.handleInputTypeTextField(inputTypeName, uiAction, uiActionRequest);
4584
+ case UiActionInputType.UserSelect:
4585
+ return yield this.handleInputTypeUserSelect(inputTypeName, uiAction, uiActionRequest);
4586
+ case UiActionInputType.File:
4587
+ return yield this.handleInputTypeUpload(inputTypeName, uiAction, uiActionRequest, false);
4588
+ case UiActionInputType.MultipleFiles:
4589
+ return yield this.handleInputTypeUpload(inputTypeName, uiAction, uiActionRequest, true);
4590
+ default:
4591
+ return uiActionRequest;
4667
4592
  }
4668
- else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
4669
- responseType_ = 'json';
4593
+ });
4594
+ }
4595
+ handleInputTypeTextField(inputTypeName, uiAction, uiActionRequest) {
4596
+ return __awaiter(this, void 0, void 0, function* () {
4597
+ let additionalParams = this.uiActionModel.serviceToUse.getAdditionalParams(uiAction);
4598
+ let inputType = inputTypeName === 'inputDialog' ? 'inputType' : 'input2Type';
4599
+ if (uiAction[inputType] === UiActionInputType.Textfield) {
4600
+ this.textFieldDialogService.nodeName = additionalParams.forTextField;
4670
4601
  }
4671
- else {
4672
- responseType_ = 'blob';
4602
+ else if (uiAction[inputType] === UiActionInputType.Textarea) {
4603
+ this.textFieldDialogService.nodeName = additionalParams.forTextArea;
4604
+ }
4605
+ this.textFieldDialogService.inputTypeName = inputTypeName;
4606
+ this.textFieldDialogService.action = uiAction;
4607
+ this.textFieldDialogService.openDialog();
4608
+ yield this.textFieldDialogService.onAction.toPromise();
4609
+ let params = this.textFieldDialogService.params;
4610
+ if (!params) {
4611
+ console.error('There was no response from InputDialog');
4612
+ return;
4613
+ }
4614
+ uiActionRequest.params = Object.assign(Object.assign({}, uiActionRequest.params), params);
4615
+ return uiActionRequest;
4616
+ });
4617
+ }
4618
+ handleInputTypeUpload(inputTypeName, uiAction, uiActionRequest, isMultiple) {
4619
+ return __awaiter(this, void 0, void 0, function* () {
4620
+ this.fileUploadDialogService.inputTypeName = inputTypeName;
4621
+ this.fileUploadDialogService.action = uiAction;
4622
+ this.fileUploadDialogService.isMultiple = isMultiple;
4623
+ this.fileUploadDialogService.openDialog();
4624
+ yield this.fileUploadDialogService.onAction.toPromise();
4625
+ let files = this.fileUploadDialogService.files;
4626
+ if (!files || !files.length) {
4627
+ console.error('There was no response from InputDialog');
4628
+ return;
4629
+ }
4630
+ uiActionRequest.params = Object.assign(Object.assign({}, uiActionRequest.params), { _files: files, isMultiple, param: uiAction.inputType === 'file' || uiAction.inputType === 'multiple_files'
4631
+ ? 'INPUT'
4632
+ : 'INPUT2' });
4633
+ return uiActionRequest;
4634
+ });
4635
+ }
4636
+ handleInputTypeUserSelect(inputTypeName, uiAction, uiActionRequest) {
4637
+ return __awaiter(this, void 0, void 0, function* () {
4638
+ let response = yield this.uiActionModel.serviceToUse.handleSpecificDemandsAsynchronously(uiAction, uiActionRequest);
4639
+ if (!response.shouldPerformAction || !response.uiActionRequest) {
4640
+ return;
4641
+ }
4642
+ uiActionRequest = response.uiActionRequest;
4643
+ return uiActionRequest;
4644
+ });
4645
+ }
4646
+ performAction(uiAction, uiActionRequest, options) {
4647
+ var _a;
4648
+ return __awaiter(this, void 0, void 0, function* () {
4649
+ if (!uiActionRequest.params ||
4650
+ (uiActionRequest.params && !Object.keys(uiActionRequest.params).length)) {
4651
+ uiActionRequest.params = {
4652
+ model: this.uiActionModel.serviceToUse.getModel(),
4653
+ };
4654
+ }
4655
+ else if (uiAction.submit) {
4656
+ uiActionRequest.params['model'] = this.uiActionModel.serviceToUse.getModel();
4657
+ }
4658
+ try {
4659
+ yield this.uiActionModel.serviceToUse.performUiActionRequest(uiActionRequest, options === null || options === void 0 ? void 0 : options.widgetId, options === null || options === void 0 ? void 0 : options.nodeId);
4660
+ if (((_a = this.uiActionModel.descriptor) === null || _a === void 0 ? void 0 : _a.feedbackType) === UiActionFeedbackType.Snackbar) {
4661
+ this.showSavedSnackbar(uiAction);
4662
+ }
4663
+ }
4664
+ catch (error) {
4665
+ console.error(error);
4673
4666
  }
4674
- }
4675
- let localVarPath = `/nope`;
4676
- return this.httpClient.request('post', `${this.configuration.basePath}${localVarPath}`, {
4677
- context: localVarHttpContext,
4678
- responseType: responseType_,
4679
- withCredentials: this.configuration.withCredentials,
4680
- headers: localVarHeaders,
4681
- observe: observe,
4682
- reportProgress: reportProgress
4667
+ });
4668
+ }
4669
+ showSavedSnackbar(uiAction) {
4670
+ this._snackBar.openFromComponent(SuccessSnackBarComponent, {
4671
+ duration: 5 * 1000,
4672
+ panelClass: ['backgroundColor-accent'],
4673
+ data: uiAction,
4683
4674
  });
4684
4675
  }
4685
4676
  }
4686
- DefaultService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: DefaultService, deps: [{ token: i1.HttpClient }, { token: BASE_PATH, optional: true }, { token: Configuration, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
4687
- DefaultService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: DefaultService, providedIn: 'root' });
4688
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: DefaultService, decorators: [{
4677
+ UiActionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionService, deps: [{ token: UiActionConfirmDialogService }, { token: UiActionInputDialogService }, { token: UiActionFileUploadDialogService }, { token: i4$5.MatSnackBar }], target: i0.ɵɵFactoryTarget.Injectable });
4678
+ UiActionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionService, providedIn: 'root' });
4679
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionService, decorators: [{
4689
4680
  type: Injectable,
4690
4681
  args: [{
4691
- providedIn: 'root'
4682
+ providedIn: 'root',
4692
4683
  }]
4693
- }], ctorParameters: function () {
4694
- return [{ type: i1.HttpClient }, { type: undefined, decorators: [{
4695
- type: Optional
4696
- }, {
4697
- type: Inject,
4698
- args: [BASE_PATH]
4699
- }] }, { type: Configuration, decorators: [{
4700
- type: Optional
4701
- }] }];
4702
- } });
4703
-
4704
- const APIS = [DefaultService];
4705
-
4706
- /**
4707
- * Form layout definition
4708
- * Contains form layout definition objects.
4709
- *
4710
- * The version of the OpenAPI document: 1.0.0
4711
- * Contact: info@it4all.hu
4712
- *
4713
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
4714
- * https://openapi-generator.tech
4715
- * Do not edit the class manually.
4716
- */
4717
- const ComponentType = {
4718
- Container: 'container',
4719
- Form: 'form',
4720
- Widget: 'widget'
4721
- };
4722
-
4723
- /**
4724
- * Form layout definition
4725
- * Contains form layout definition objects.
4726
- *
4727
- * The version of the OpenAPI document: 1.0.0
4728
- * Contact: info@it4all.hu
4729
- *
4730
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
4731
- * https://openapi-generator.tech
4732
- * Do not edit the class manually.
4733
- */
4734
- const ComponentWidgetType = {
4735
- Grid: 'grid'
4736
- };
4684
+ }], ctorParameters: function () { return [{ type: UiActionConfirmDialogService }, { type: UiActionInputDialogService }, { type: UiActionFileUploadDialogService }, { type: i4$5.MatSnackBar }]; } });
4737
4685
 
4738
- /**
4739
- * Form layout definition
4740
- * Contains form layout definition objects.
4741
- *
4742
- * The version of the OpenAPI document: 1.0.0
4743
- * Contact: info@it4all.hu
4744
- *
4745
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
4746
- * https://openapi-generator.tech
4747
- * Do not edit the class manually.
4748
- */
4749
- const LayoutDirection = {
4750
- Horizontal: 'horizontal',
4751
- Vertical: 'vertical'
4752
- };
4753
-
4754
- class ApiModule {
4755
- constructor(parentModule, http) {
4756
- if (parentModule) {
4757
- throw new Error('ApiModule is already loaded. Import in your base AppModule only.');
4686
+ class UiActionToolbarComponent {
4687
+ constructor(service, inject) {
4688
+ this.service = service;
4689
+ this.inject = inject;
4690
+ this._destroy$ = new Subject();
4691
+ this.pressedButtonActive = true;
4692
+ // Injects the basic UiActionDescriptorService provided by the AppModule
4693
+ this.manager = inject.get(UiActionDescriptorService);
4694
+ this.subscribeToLanguageChange();
4695
+ }
4696
+ ngOnInit() {
4697
+ // Overrides the basic UiActionDescriptorService with a custom one if there is one
4698
+ if (this.uiActionDescriptorService) {
4699
+ this.manager = this.uiActionDescriptorService;
4700
+ this.subscribeToLanguageChange();
4758
4701
  }
4759
- if (!http) {
4760
- throw new Error('You need to import the HttpClientModule in your AppModule! \n' +
4761
- 'See also https://github.com/angular/angular/issues/20575');
4702
+ this.setUp();
4703
+ }
4704
+ ngOnChanges(changes) {
4705
+ let uiActionModels = changes['uiActionModels'].currentValue;
4706
+ if (uiActionModels) {
4707
+ this.uiActionModels = uiActionModels;
4708
+ this.setUp();
4709
+ }
4710
+ }
4711
+ ngOnDestroy() {
4712
+ this._destroy$.next();
4713
+ }
4714
+ subscribeToLanguageChange() {
4715
+ var _a;
4716
+ (_a = this.languageChangedSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
4717
+ this.languageChangedSubscription = this.manager.languageChanged
4718
+ .pipe(takeUntil(this._destroy$))
4719
+ .subscribe(() => {
4720
+ this.setUp();
4721
+ });
4722
+ }
4723
+ setUp() {
4724
+ return __awaiter(this, void 0, void 0, function* () {
4725
+ this.uiActionModelsWithDescriptions = yield Promise.all(this.uiActionModels.map((uiActionModel) => __awaiter(this, void 0, void 0, function* () {
4726
+ uiActionModel.descriptor = yield this.manager.getActionDescriptor(uiActionModel.uiAction);
4727
+ return uiActionModel;
4728
+ })));
4729
+ });
4730
+ }
4731
+ onActionClicked(event, uiActionModel) {
4732
+ return __awaiter(this, void 0, void 0, function* () {
4733
+ event.stopPropagation();
4734
+ if (this.pressedButtonActive) {
4735
+ this.pressedButtonActive = false;
4736
+ this.service.uiActionModel = uiActionModel;
4737
+ let options = {
4738
+ nodeId: uiActionModel.nodeId,
4739
+ widgetId: uiActionModel.widgetId,
4740
+ };
4741
+ yield this.service.execute(uiActionModel.uiAction, options);
4742
+ this.pressedButtonActive = true;
4743
+ }
4744
+ });
4745
+ }
4746
+ onActionDoubleClicked(event, uiActionModel) {
4747
+ event.stopPropagation();
4748
+ // We do not handle double clicks
4749
+ }
4750
+ getType(uiActionModel) {
4751
+ var _a, _b;
4752
+ switch ((_a = uiActionModel.descriptor) === null || _a === void 0 ? void 0 : _a.type) {
4753
+ case UiActionButtonType.Normal:
4754
+ return 'mat-button';
4755
+ case UiActionButtonType.Flat:
4756
+ return 'mat-flat-button';
4757
+ case UiActionButtonType.Raised:
4758
+ return 'mat-raised-button';
4759
+ case UiActionButtonType.Stroked:
4760
+ return 'mat-stroked-button';
4761
+ case UiActionButtonType.Icon:
4762
+ return 'mat-icon-button';
4763
+ case UiActionButtonType.MiniFab:
4764
+ return 'mat-mini-fab';
4765
+ case UiActionButtonType.Fab:
4766
+ return 'mat-fab';
4767
+ default:
4768
+ console.log(`Unhandled action button type case: ${(_b = uiActionModel.descriptor) === null || _b === void 0 ? void 0 : _b.type}`);
4769
+ return `mat-button`;
4762
4770
  }
4763
4771
  }
4764
- static forRoot(configurationFactory) {
4765
- return {
4766
- ngModule: ApiModule,
4767
- providers: [{ provide: Configuration, useFactory: configurationFactory }]
4768
- };
4772
+ iconPosition() {
4773
+ return UiActionButtonIconPos;
4774
+ }
4775
+ isOnlyIcon(uiActionModel) {
4776
+ var _a, _b, _c;
4777
+ return (((_a = uiActionModel.descriptor) === null || _a === void 0 ? void 0 : _a.type) === UiActionButtonType.Icon ||
4778
+ ((_b = uiActionModel.descriptor) === null || _b === void 0 ? void 0 : _b.type) === UiActionButtonType.MiniFab ||
4779
+ ((_c = uiActionModel.descriptor) === null || _c === void 0 ? void 0 : _c.type) === UiActionButtonType.Fab);
4769
4780
  }
4770
4781
  }
4771
- ApiModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ApiModule, deps: [{ token: ApiModule, optional: true, skipSelf: true }, { token: i1.HttpClient, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
4772
- ApiModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ApiModule });
4773
- ApiModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ApiModule, providers: [], imports: [[]] });
4774
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ApiModule, decorators: [{
4782
+ UiActionToolbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionToolbarComponent, deps: [{ token: UiActionService }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
4783
+ UiActionToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: UiActionToolbarComponent, selector: "smart-ui-action-toolbar", inputs: { uiActionModels: "uiActionModels", uiActionDescriptorService: "uiActionDescriptorService" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"uiActionButtonsContainer\">\n <button\n *ngFor=\"let uiActionModel of uiActionModelsWithDescriptions\"\n mat-button\n [ngClass]=\"getType(uiActionModel)\"\n class=\"{{ uiActionModel.cssClass }}\"\n [color]=\"uiActionModel.descriptor?.color\"\n (click)=\"onActionClicked($event, uiActionModel)\"\n (dblclick)=\"onActionDoubleClicked($event, uiActionModel)\"\n >\n <div *ngIf=\"isOnlyIcon(uiActionModel); then iconOnly; else text\"></div>\n <ng-template #iconOnly>\n <smart-icon\n *ngIf=\"uiActionModel.descriptor?.icon\"\n [icon]=\"uiActionModel.descriptor!.icon!\"\n [color]=\"uiActionModel.descriptor?.iconColor ?? uiActionModel.descriptor?.color\"\n ></smart-icon>\n </ng-template>\n <ng-template #text>\n <smart-icon\n *ngIf=\"\n uiActionModel.descriptor?.icon &&\n uiActionModel.descriptor?.iconPosition === iconPosition().Pre\n \"\n [icon]=\"uiActionModel.descriptor!.icon!\"\n [color]=\"uiActionModel.descriptor?.iconColor ?? uiActionModel.descriptor?.color\"\n ></smart-icon>\n {{ uiActionModel.descriptor?.title }}\n <smart-icon\n *ngIf=\"\n uiActionModel.descriptor?.icon &&\n uiActionModel.descriptor?.iconPosition === iconPosition().Post\n \"\n [icon]=\"uiActionModel.descriptor!.icon!\"\n [color]=\"uiActionModel.descriptor?.iconColor ?? uiActionModel.descriptor?.color\"\n ></smart-icon>\n </ng-template>\n </button>\n</div>\n", styles: [".uiActionButtonsContainer{display:flex;flex-direction:row;gap:1rem;flex-wrap:wrap;min-height:2.25rem}\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$2.SmartIconComponent, selector: "smart-icon", inputs: ["icon", "color"] }], directives: [{ type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
4784
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: UiActionToolbarComponent, decorators: [{
4785
+ type: Component,
4786
+ args: [{ selector: 'smart-ui-action-toolbar', template: "<div class=\"uiActionButtonsContainer\">\n <button\n *ngFor=\"let uiActionModel of uiActionModelsWithDescriptions\"\n mat-button\n [ngClass]=\"getType(uiActionModel)\"\n class=\"{{ uiActionModel.cssClass }}\"\n [color]=\"uiActionModel.descriptor?.color\"\n (click)=\"onActionClicked($event, uiActionModel)\"\n (dblclick)=\"onActionDoubleClicked($event, uiActionModel)\"\n >\n <div *ngIf=\"isOnlyIcon(uiActionModel); then iconOnly; else text\"></div>\n <ng-template #iconOnly>\n <smart-icon\n *ngIf=\"uiActionModel.descriptor?.icon\"\n [icon]=\"uiActionModel.descriptor!.icon!\"\n [color]=\"uiActionModel.descriptor?.iconColor ?? uiActionModel.descriptor?.color\"\n ></smart-icon>\n </ng-template>\n <ng-template #text>\n <smart-icon\n *ngIf=\"\n uiActionModel.descriptor?.icon &&\n uiActionModel.descriptor?.iconPosition === iconPosition().Pre\n \"\n [icon]=\"uiActionModel.descriptor!.icon!\"\n [color]=\"uiActionModel.descriptor?.iconColor ?? uiActionModel.descriptor?.color\"\n ></smart-icon>\n {{ uiActionModel.descriptor?.title }}\n <smart-icon\n *ngIf=\"\n uiActionModel.descriptor?.icon &&\n uiActionModel.descriptor?.iconPosition === iconPosition().Post\n \"\n [icon]=\"uiActionModel.descriptor!.icon!\"\n [color]=\"uiActionModel.descriptor?.iconColor ?? uiActionModel.descriptor?.color\"\n ></smart-icon>\n </ng-template>\n </button>\n</div>\n", styles: [".uiActionButtonsContainer{display:flex;flex-direction:row;gap:1rem;flex-wrap:wrap;min-height:2.25rem}\n"] }]
4787
+ }], ctorParameters: function () { return [{ type: UiActionService }, { type: i0.Injector }]; }, propDecorators: { uiActionModels: [{
4788
+ type: Input
4789
+ }], uiActionDescriptorService: [{
4790
+ type: Input
4791
+ }] } });
4792
+
4793
+ class SmartViewContextModule {
4794
+ }
4795
+ SmartViewContextModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartViewContextModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4796
+ SmartViewContextModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartViewContextModule, declarations: [MessageDialogComponent,
4797
+ SmartViewContextErrorDialogComponent,
4798
+ SmartViewRedirect,
4799
+ UiActionToolbarComponent,
4800
+ UiActionInputDialogComponent,
4801
+ UiActionConfirmDialogComponent,
4802
+ UiActionFileUploadDialogComponent], imports: [CommonModule,
4803
+ HttpClientModule,
4804
+ MatCommonModule,
4805
+ MatButtonModule,
4806
+ MatIconModule,
4807
+ MatSnackBarModule,
4808
+ SmartIconModule,
4809
+ SmartformModule], exports: [UiActionToolbarComponent, UiActionInputDialogComponent] });
4810
+ SmartViewContextModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartViewContextModule, providers: [
4811
+ SmartViewContextService,
4812
+ {
4813
+ provide: HTTP_INTERCEPTORS,
4814
+ useClass: SmartViewContextInterceptor,
4815
+ multi: true,
4816
+ },
4817
+ ], imports: [[
4818
+ CommonModule,
4819
+ HttpClientModule,
4820
+ MatCommonModule,
4821
+ MatButtonModule,
4822
+ MatIconModule,
4823
+ MatSnackBarModule,
4824
+ SmartIconModule,
4825
+ SmartformModule,
4826
+ ]] });
4827
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartViewContextModule, decorators: [{
4775
4828
  type: NgModule,
4776
4829
  args: [{
4777
- imports: [],
4778
- declarations: [],
4779
- exports: [],
4780
- providers: []
4830
+ declarations: [
4831
+ MessageDialogComponent,
4832
+ SmartViewContextErrorDialogComponent,
4833
+ SmartViewRedirect,
4834
+ UiActionToolbarComponent,
4835
+ UiActionInputDialogComponent,
4836
+ UiActionConfirmDialogComponent,
4837
+ UiActionFileUploadDialogComponent,
4838
+ ],
4839
+ imports: [
4840
+ CommonModule,
4841
+ HttpClientModule,
4842
+ MatCommonModule,
4843
+ MatButtonModule,
4844
+ MatIconModule,
4845
+ MatSnackBarModule,
4846
+ SmartIconModule,
4847
+ SmartformModule,
4848
+ ],
4849
+ exports: [UiActionToolbarComponent, UiActionInputDialogComponent],
4850
+ providers: [
4851
+ SmartViewContextService,
4852
+ {
4853
+ provide: HTTP_INTERCEPTORS,
4854
+ useClass: SmartViewContextInterceptor,
4855
+ multi: true,
4856
+ },
4857
+ ],
4781
4858
  }]
4782
- }], ctorParameters: function () {
4783
- return [{ type: ApiModule, decorators: [{
4784
- type: Optional
4785
- }, {
4786
- type: SkipSelf
4787
- }] }, { type: i1.HttpClient, decorators: [{
4788
- type: Optional
4789
- }] }];
4790
- } });
4859
+ }] });
4791
4860
 
4792
- class SmartComponentLayoutComponent {
4793
- constructor(layoutService) {
4794
- this.layoutService = layoutService;
4795
- }
4796
- ngOnInit() {
4797
- if (this.smartComponentLayout) {
4798
- this.setUp();
4799
- }
4861
+ var UiActionDialogType;
4862
+ (function (UiActionDialogType) {
4863
+ UiActionDialogType["inputDialog"] = "inputDialog";
4864
+ UiActionDialogType["confirmDialog"] = "confirmDialog";
4865
+ UiActionDialogType["dialog"] = "dialog";
4866
+ })(UiActionDialogType || (UiActionDialogType = {}));
4867
+
4868
+ /*
4869
+ * Public API Surface of smart-view-context
4870
+ */
4871
+
4872
+ class SmartFileUploaderComponent {
4873
+ constructor(uiActionService, uiActionDescriptorService) {
4874
+ this.uiActionService = uiActionService;
4875
+ this.uiActionDescriptorService = uiActionDescriptorService;
4800
4876
  }
4801
4877
  ngOnChanges(changes) {
4802
- this.smartComponentLayout = changes['smartComponentLayout'].currentValue;
4803
- if (this.smartComponentLayout) {
4878
+ this.config = changes['config'].currentValue;
4879
+ if (this.config) {
4804
4880
  this.setUp();
4805
4881
  }
4806
4882
  }
4807
4883
  setUp() {
4808
- var _a, _b, _c, _d, _e;
4809
- this.uuid = (_a = this.smartComponentLayout) === null || _a === void 0 ? void 0 : _a.parentComponent.uuid;
4810
- if ((_b = this.smartComponentLayout) === null || _b === void 0 ? void 0 : _b.expandable) {
4811
- this.constructExpandableSection();
4812
- }
4813
- else if (((_c = this.smartComponentLayout) === null || _c === void 0 ? void 0 : _c.type) === ComponentType.Form) {
4814
- this.constructForm();
4815
- }
4816
- else if (((_d = this.smartComponentLayout) === null || _d === void 0 ? void 0 : _d.type) === ComponentType.Widget) {
4817
- if (((_e = this.smartComponentLayout.widget) === null || _e === void 0 ? void 0 : _e.type) === ComponentWidgetType.Grid) {
4818
- this.constructGrid();
4884
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
4885
+ return __awaiter(this, void 0, void 0, function* () {
4886
+ this.uiActionModel = (_a = this.config) === null || _a === void 0 ? void 0 : _a.smartComponent.uiActionModels.find((uiActionModel) => { var _a; return uiActionModel.uiAction.code === ((_a = this.config) === null || _a === void 0 ? void 0 : _a.uiActionCode); });
4887
+ if (!this.uiActionModel) {
4888
+ throw new Error(`UiAction with code ${(_b = this.config) === null || _b === void 0 ? void 0 : _b.uiActionCode} could not found`);
4819
4889
  }
4820
- }
4821
- }
4822
- type() {
4823
- return ComponentType;
4824
- }
4825
- constructExpandableSection() {
4826
- var _a, _b;
4827
- let data = Object.assign({}, this.smartComponentLayout);
4828
- data.expandable = false;
4829
- this.expandableSection = {
4830
- title: (_b = (_a = this.smartComponentLayout) === null || _a === void 0 ? void 0 : _a.expandableSectionLabel) !== null && _b !== void 0 ? _b : '',
4831
- data,
4832
- inputName: 'smartComponentLayout',
4833
- customComponent: SmartComponentLayoutComponent,
4834
- };
4835
- }
4836
- constructForm() {
4837
- var _a, _b, _c, _d, _e;
4838
- const widgets = this.layoutService.render({
4839
- layoutDefinitions: (_a = this.smartComponentLayout) === null || _a === void 0 ? void 0 : _a.form,
4890
+ const descriptor = yield this.uiActionDescriptorService.getActionDescriptor(this.uiActionModel.uiAction);
4891
+ this.i18n = {
4892
+ addFile: (_d = (_c = descriptor.upload) === null || _c === void 0 ? void 0 : _c.title) !== null && _d !== void 0 ? _d : 'dokumentum hozzáadása',
4893
+ browseOrDrag: (_f = (_e = descriptor.upload) === null || _e === void 0 ? void 0 : _e.description) !== null && _f !== void 0 ? _f : 'tallózás vagy behúzás',
4894
+ formats: (_h = (_g = descriptor.upload) === null || _g === void 0 ? void 0 : _g.formats) !== null && _h !== void 0 ? _h : '',
4895
+ maxSize: (_k = (_j = descriptor.upload) === null || _j === void 0 ? void 0 : _j.maxSize) !== null && _k !== void 0 ? _k : '',
4896
+ upload: (_l = descriptor.upload) === null || _l === void 0 ? void 0 : _l.uploadButtonTitle,
4897
+ };
4840
4898
  });
4841
- this.smartForm = {
4842
- direction: SmartFormWidgetDirection.COL,
4843
- model: (_b = this.smartComponentLayout) === null || _b === void 0 ? void 0 : _b.parentComponent.model,
4844
- constraints: (_d = (_c = this.smartComponentLayout) === null || _c === void 0 ? void 0 : _c.parentComponent.model) === null || _d === void 0 ? void 0 : _d.constraints,
4845
- widgets,
4846
- };
4847
- (_e = this.smartComponentLayout) === null || _e === void 0 ? void 0 : _e.parentComponent.addForm(
4848
- // unique identifier for the form
4849
- `form_${this.makeid(5)}`, this.smartForm, this.formChild);
4850
- }
4851
- makeid(length) {
4852
- let result = '';
4853
- const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
4854
- const charactersLength = characters.length;
4855
- let counter = 0;
4856
- while (counter < length) {
4857
- result += characters.charAt(Math.floor(Math.random() * charactersLength));
4858
- counter += 1;
4859
- }
4860
- return result;
4861
4899
  }
4862
- constructGrid() {
4863
- var _a, _b, _c;
4864
- this.smartGrid = {
4865
- gridIdentifier: (_b = (_a = this.smartComponentLayout) === null || _a === void 0 ? void 0 : _a.widget) === null || _b === void 0 ? void 0 : _b.gridIdentifier,
4866
- gridModel: {
4867
- page: {},
4868
- },
4869
- layoutDef: SmartLayoutDef.TABLE,
4870
- };
4871
- this.smartGrid = (_c = this.smartComponentLayout) === null || _c === void 0 ? void 0 : _c.parentComponent.addGrid(this.smartGrid, {
4872
- rowUiActionType: GridUiActionType.POPUP_MENU,
4873
- }, false, this.gridChild);
4900
+ executeUpload(files) {
4901
+ var _a;
4902
+ this.uiActionModel.uiAction.params = Object.assign(Object.assign({}, this.uiActionModel.uiAction.params), { _files: files, isMultiple: (_a = this.config) === null || _a === void 0 ? void 0 : _a.isMultiple, param: 'INPUT' });
4903
+ this.uiActionService.uiActionModel = this.uiActionModel;
4904
+ this.uiActionService.execute(this.uiActionModel.uiAction);
4874
4905
  }
4875
4906
  }
4876
- SmartComponentLayoutComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartComponentLayoutComponent, deps: [{ token: i1$2.SmartformLayoutDefinitionService }], target: i0.ɵɵFactoryTarget.Component });
4877
- SmartComponentLayoutComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: SmartComponentLayoutComponent, selector: "smart-component-layout", inputs: { smartComponentLayout: "smartComponentLayout" }, viewQueries: [{ propertyName: "formChild", first: true, predicate: ["form"], descendants: true }, { propertyName: "gridChild", first: true, predicate: ["grid"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div *ngIf=\"smartComponentLayout?.expandable; then expandable; else normal\"> </div>\n\n<ng-template #expandable>\n <smart-expandable-section\n *ngIf=\"expandableSection\"\n [data]=\"expandableSection\"\n ></smart-expandable-section>\n</ng-template>\n\n<ng-template #normal>\n <div\n *ngIf=\"smartComponentLayout?.type === type().Container\"\n [ngClass]=\"smartComponentLayout?.direction ?? 'vertical'\"\n >\n <smart-component-layout\n [smartComponentLayout]=\"layout\"\n *ngFor=\"let layout of smartComponentLayout?.components\"\n ></smart-component-layout>\n </div>\n <smartform #form [smartForm]=\"smartForm\"></smartform>\n <smart-grid #grid [smartGrid]=\"smartGrid\" [uuid]=\"uuid!\"></smart-grid>\n</ng-template>\n", styles: [".horizontal{display:flex;flex-direction:row}.vertical{display:flex;flex-direction:column}\n"], components: [{ type: i2$2.ExpandableSectionComponent, selector: "smart-expandable-section", inputs: ["data", "index"] }, { type: SmartComponentLayoutComponent, selector: "smart-component-layout", inputs: ["smartComponentLayout"] }, { type: i1$2.SmartformComponent, selector: "smartform", inputs: ["smartForm"] }, { type: i3$2.SmartGridComponent, selector: "smart-grid", inputs: ["smartGrid", "uuid", "dev"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
4878
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartComponentLayoutComponent, decorators: [{
4907
+ SmartFileUploaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartFileUploaderComponent, deps: [{ token: UiActionService }, { token: UiActionDescriptorService }], target: i0.ɵɵFactoryTarget.Component });
4908
+ SmartFileUploaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: SmartFileUploaderComponent, selector: "smart-file-uploader4sc", inputs: { config: "config" }, usesOnChanges: true, ngImport: i0, template: "<smartfileuploader\n *ngIf=\"i18n\"\n [i18n]=\"i18n\"\n [fileFormats]=\"config?.fileFormats\"\n [isMultiple]=\"config?.isMultiple\"\n [maxSizeMb]=\"config?.maxSizeMb\"\n [uploadCallback]=\"executeUpload.bind(this)\"\n></smartfileuploader>\n", styles: [""], components: [{ type: i1$2.SmartfileuploaderComponent, selector: "smartfileuploader", inputs: ["uploadCallback", "fileFormats", "maxSizeMb", "i18n", "useIconButton", "isMultiple"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
4909
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartFileUploaderComponent, decorators: [{
4879
4910
  type: Component,
4880
- args: [{ selector: 'smart-component-layout', template: "<div *ngIf=\"smartComponentLayout?.expandable; then expandable; else normal\"> </div>\n\n<ng-template #expandable>\n <smart-expandable-section\n *ngIf=\"expandableSection\"\n [data]=\"expandableSection\"\n ></smart-expandable-section>\n</ng-template>\n\n<ng-template #normal>\n <div\n *ngIf=\"smartComponentLayout?.type === type().Container\"\n [ngClass]=\"smartComponentLayout?.direction ?? 'vertical'\"\n >\n <smart-component-layout\n [smartComponentLayout]=\"layout\"\n *ngFor=\"let layout of smartComponentLayout?.components\"\n ></smart-component-layout>\n </div>\n <smartform #form [smartForm]=\"smartForm\"></smartform>\n <smart-grid #grid [smartGrid]=\"smartGrid\" [uuid]=\"uuid!\"></smart-grid>\n</ng-template>\n", styles: [".horizontal{display:flex;flex-direction:row}.vertical{display:flex;flex-direction:column}\n"] }]
4881
- }], ctorParameters: function () { return [{ type: i1$2.SmartformLayoutDefinitionService }]; }, propDecorators: { smartComponentLayout: [{
4911
+ args: [{ selector: 'smart-file-uploader4sc', template: "<smartfileuploader\n *ngIf=\"i18n\"\n [i18n]=\"i18n\"\n [fileFormats]=\"config?.fileFormats\"\n [isMultiple]=\"config?.isMultiple\"\n [maxSizeMb]=\"config?.maxSizeMb\"\n [uploadCallback]=\"executeUpload.bind(this)\"\n></smartfileuploader>\n", styles: [""] }]
4912
+ }], ctorParameters: function () { return [{ type: UiActionService }, { type: UiActionDescriptorService }]; }, propDecorators: { config: [{
4882
4913
  type: Input
4883
- }], formChild: [{
4884
- type: ViewChild,
4885
- args: ['form']
4886
- }], gridChild: [{
4887
- type: ViewChild,
4888
- args: ['grid']
4889
4914
  }] } });
4890
4915
 
4891
4916
  class SmartNgClientModule {
@@ -4897,7 +4922,8 @@ SmartNgClientModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", ver
4897
4922
  SmartViewContextModule,
4898
4923
  SmartformModule,
4899
4924
  SmartGridModule,
4900
- SmartExpandableSectionModule], exports: [SmartSessionModule,
4925
+ SmartExpandableSectionModule,
4926
+ SmarttreeModule], exports: [SmartSessionModule,
4901
4927
  SmartViewContextModule,
4902
4928
  SmartFileUploaderComponent,
4903
4929
  SmartComponentLayoutComponent] });
@@ -4909,6 +4935,7 @@ SmartNgClientModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", ver
4909
4935
  SmartformModule,
4910
4936
  SmartGridModule,
4911
4937
  SmartExpandableSectionModule,
4938
+ SmarttreeModule,
4912
4939
  ], SmartSessionModule,
4913
4940
  SmartViewContextModule] });
4914
4941
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: SmartNgClientModule, decorators: [{
@@ -4923,6 +4950,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
4923
4950
  SmartformModule,
4924
4951
  SmartGridModule,
4925
4952
  SmartExpandableSectionModule,
4953
+ SmarttreeModule,
4926
4954
  ],
4927
4955
  exports: [
4928
4956
  SmartSessionModule,
@@ -4951,6 +4979,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
4951
4979
  type: Injectable
4952
4980
  }] });
4953
4981
 
4982
+ // import {
4983
+ // FilterExpressionFieldList,
4984
+ // SmartFilter,
4985
+ // SmartFilterComponent,
4986
+ // SmartFilterType,
4987
+ // } from '@smartbit4all/filter';
4954
4988
  let SmartComponentApiClient = class SmartComponentApiClient {
4955
4989
  constructor(inject, auth, pageName) {
4956
4990
  this.inject = inject;
@@ -5186,6 +5220,25 @@ let SmartComponentApiClient = class SmartComponentApiClient {
5186
5220
  maxSizeMb,
5187
5221
  };
5188
5222
  }
5223
+ // public addFilter(
5224
+ // smartFilterId: string,
5225
+ // filter: FilterExpressionFieldList,
5226
+ // type: SmartFilterType,
5227
+ // smartFilterComponent: SmartFilterComponent,
5228
+ // isDefault?: boolean
5229
+ // ): SmartFilter {
5230
+ // const smartFilter: SmartFilter = {
5231
+ // data: filter.filters,
5232
+ // type,
5233
+ // translateService: this.translate,
5234
+ // };
5235
+ // this.widgets.addWidget(smartFilterId, smartFilterComponent);
5236
+ // if (isDefault) {
5237
+ // this.smartFilter = smartFilter;
5238
+ // return this.smartFilter!;
5239
+ // }
5240
+ // return smartFilter;
5241
+ // }
5189
5242
  // #region handle changes
5190
5243
  handleValueChanges(valueChange) {
5191
5244
  let dataChange;