@smartbit4all/ng-client 3.3.109 → 3.3.110

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.
@@ -7927,74 +7927,360 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
7927
7927
  args: [MAT_SNACK_BAR_DATA]
7928
7928
  }] }]; } });
7929
7929
 
7930
- class UiActionConfirmDialogComponent {
7931
- constructor(service, manager) {
7930
+ class UiActionService {
7931
+ constructor(confirmDialogService, textFieldDialogService, fileUploadDialogService, _snackBar) {
7932
+ this.confirmDialogService = confirmDialogService;
7933
+ this.textFieldDialogService = textFieldDialogService;
7934
+ this.fileUploadDialogService = fileUploadDialogService;
7935
+ this._snackBar = _snackBar;
7936
+ this._destroy$ = new Subject();
7937
+ }
7938
+ ngOnDestroy() {
7939
+ this._destroy$.next();
7940
+ this._destroy$.complete();
7941
+ }
7942
+ async execute(uiAction, options) {
7943
+ let uiActionRequest;
7944
+ uiActionRequest = {
7945
+ code: uiAction.code,
7946
+ identifier: uiAction.identifier,
7947
+ params: uiAction.params ?? {},
7948
+ };
7949
+ if (uiAction.submit || uiAction.model) {
7950
+ // submit: with validation, model: without validation. both can be undefined
7951
+ const validate = uiAction.submit || !uiAction.model;
7952
+ if ('reSubscribeToChange' in this.uiActionModel.serviceToUse) {
7953
+ if (!validate) {
7954
+ console.error(`Validate = false, but UseUiAction doesn't support it`);
7955
+ }
7956
+ this.uiActionModel.serviceToUse.submit.next();
7957
+ try {
7958
+ await this.uiActionModel.serviceToUse.submit.toPromise();
7959
+ this.uiActionModel.serviceToUse.submit = new SmartSubject(this._destroy$);
7960
+ this.uiActionModel.serviceToUse.reSubscribeToChange.next();
7961
+ }
7962
+ catch (error) {
7963
+ console.error(error);
7964
+ this.uiActionModel.serviceToUse.submit = new SmartSubject(this._destroy$);
7965
+ this.uiActionModel.serviceToUse.reSubscribeToChange.next();
7966
+ return;
7967
+ }
7968
+ }
7969
+ else {
7970
+ this.uiActionModel.serviceToUse.submitForm(validate);
7971
+ let invalidFields = this.uiActionModel.serviceToUse.getInvalidFields();
7972
+ if (validate && invalidFields.invalidFieldKeys.length) {
7973
+ this.showInvalidFieldsSnackbar(invalidFields);
7974
+ return;
7975
+ }
7976
+ }
7977
+ }
7978
+ if (uiAction.confirm) {
7979
+ this.confirmDialogService.action = uiAction;
7980
+ this.confirmDialogService.openDialog();
7981
+ await this.confirmDialogService.onAction.toPromise();
7982
+ if (!this.confirmDialogService.shouldDoAction) {
7983
+ return;
7984
+ }
7985
+ }
7986
+ // InputType
7987
+ if (uiAction.inputType && uiAction.inputType !== UiActionInputType.NONE) {
7988
+ uiActionRequest = await this.handleInputType(uiAction.inputType, uiAction, uiActionRequest, 'inputDialog');
7989
+ if (!uiActionRequest) {
7990
+ return;
7991
+ }
7992
+ await new Promise((resolve) => setTimeout(resolve, 250));
7993
+ }
7994
+ // Input2Type
7995
+ if (uiAction.input2Type && uiAction.input2Type !== UiActionInputType.NONE) {
7996
+ uiActionRequest = await this.handleInputType(uiAction.input2Type, uiAction, uiActionRequest, 'input2Dialog');
7997
+ if (!uiActionRequest) {
7998
+ return;
7999
+ }
8000
+ }
8001
+ if (this.uiActionModel.exception) {
8002
+ let response = await this.uiActionModel.serviceToUse.handleSpecificDemandsAsynchronously(uiAction, uiActionRequest);
8003
+ if (!response.shouldPerformAction || !response.uiActionRequest) {
8004
+ return;
8005
+ }
8006
+ uiActionRequest = response.uiActionRequest;
8007
+ }
8008
+ await this.performAction(uiAction, uiActionRequest, options);
8009
+ }
8010
+ async handleInputType(inputType, uiAction, uiActionRequest, inputTypeName) {
8011
+ switch (inputType) {
8012
+ case UiActionInputType.NONE:
8013
+ return uiActionRequest;
8014
+ case UiActionInputType.TEXTAREA:
8015
+ case UiActionInputType.TEXTFIELD:
8016
+ return await this.handleInputTypeTextField(inputTypeName, uiAction, uiActionRequest);
8017
+ case UiActionInputType.USER_SELECT:
8018
+ return await this.handleInputTypeUserSelect(inputTypeName, uiAction, uiActionRequest);
8019
+ case UiActionInputType.FILE:
8020
+ return await this.handleInputTypeUpload(inputTypeName, uiAction, uiActionRequest, false);
8021
+ case UiActionInputType.MULTIPLE_FILES:
8022
+ return await this.handleInputTypeUpload(inputTypeName, uiAction, uiActionRequest, true);
8023
+ default:
8024
+ return uiActionRequest;
8025
+ }
8026
+ }
8027
+ async handleInputTypeTextField(inputTypeName, uiAction, uiActionRequest) {
8028
+ let additionalParams = this.uiActionModel.serviceToUse.getAdditionalParams(uiAction);
8029
+ let inputType = inputTypeName === 'inputDialog' ? 'inputType' : 'input2Type';
8030
+ if (uiAction[inputType] === UiActionInputType.TEXTFIELD) {
8031
+ this.textFieldDialogService.nodeName = additionalParams.forTextField;
8032
+ }
8033
+ else if (uiAction[inputType] === UiActionInputType.TEXTAREA) {
8034
+ this.textFieldDialogService.nodeName = additionalParams.forTextArea;
8035
+ }
8036
+ this.textFieldDialogService.inputTypeName = inputTypeName;
8037
+ this.textFieldDialogService.action = uiAction;
8038
+ this.textFieldDialogService.openDialog();
8039
+ await this.textFieldDialogService.onAction.toPromise();
8040
+ let params = this.textFieldDialogService.params;
8041
+ if (!params) {
8042
+ console.error('There was no response from InputDialog');
8043
+ return;
8044
+ }
8045
+ uiActionRequest.params = {
8046
+ ...uiActionRequest.params,
8047
+ ...params,
8048
+ };
8049
+ return uiActionRequest;
8050
+ }
8051
+ async handleInputTypeUpload(inputTypeName, uiAction, uiActionRequest, isMultiple) {
8052
+ this.fileUploadDialogService.inputTypeName = inputTypeName;
8053
+ this.fileUploadDialogService.action = uiAction;
8054
+ this.fileUploadDialogService.isMultiple = isMultiple;
8055
+ this.fileUploadDialogService.openDialog();
8056
+ await this.fileUploadDialogService.onAction.toPromise();
8057
+ let files = this.fileUploadDialogService.files;
8058
+ if (!files || !files.length) {
8059
+ console.error('There was no response from InputDialog');
8060
+ return;
8061
+ }
8062
+ uiActionRequest.params = {
8063
+ ...uiActionRequest.params,
8064
+ _files: files,
8065
+ isMultiple,
8066
+ param: uiAction.inputType === 'file' || uiAction.inputType === 'multiple_files'
8067
+ ? 'input'
8068
+ : 'input2',
8069
+ };
8070
+ return uiActionRequest;
8071
+ }
8072
+ async handleInputTypeUserSelect(inputTypeName, uiAction, uiActionRequest) {
8073
+ let response = await this.uiActionModel.serviceToUse.handleSpecificDemandsAsynchronously(uiAction, uiActionRequest);
8074
+ if (!response.shouldPerformAction || !response.uiActionRequest) {
8075
+ return;
8076
+ }
8077
+ uiActionRequest = response.uiActionRequest;
8078
+ return uiActionRequest;
8079
+ }
8080
+ async performAction(uiAction, uiActionRequest, options) {
8081
+ if (!uiActionRequest.params ||
8082
+ (uiActionRequest.params && !Object.keys(uiActionRequest.params).length)) {
8083
+ uiActionRequest.params = {
8084
+ model: this.uiActionModel.serviceToUse.getModel(),
8085
+ };
8086
+ }
8087
+ else if (uiAction.submit || uiAction.model) {
8088
+ uiActionRequest.params['model'] = this.uiActionModel.serviceToUse.getModel();
8089
+ }
8090
+ try {
8091
+ await this.uiActionModel.serviceToUse.performUiActionRequest(uiActionRequest, options?.widgetId, options?.nodeId);
8092
+ if (this.uiActionModel.descriptor?.feedbackType === UiActionFeedbackType.SNACKBAR) {
8093
+ this.showSavedSnackbar(uiAction);
8094
+ }
8095
+ }
8096
+ catch (error) {
8097
+ console.error(error);
8098
+ }
8099
+ }
8100
+ showSavedSnackbar(uiAction) {
8101
+ this._snackBar.openFromComponent(SuccessSnackBarComponent, {
8102
+ duration: 5 * 1000,
8103
+ panelClass: ['backgroundColor-accent'],
8104
+ data: uiAction,
8105
+ });
8106
+ }
8107
+ showInvalidFieldsSnackbar(invalidFields) {
8108
+ this._snackBar.openFromComponent(InvalidFieldsSnackBarComponent, {
8109
+ duration: 5 * 1000,
8110
+ panelClass: ['backgroundColor-warn'],
8111
+ data: invalidFields,
8112
+ });
8113
+ }
8114
+ }
8115
+ UiActionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiActionService, deps: [{ token: 'confirmDialogService' }, { token: 'textFieldDialogService' }, { token: 'fileUploadDialogService' }, { token: i1$2.MatSnackBar }], target: i0.ɵɵFactoryTarget.Injectable });
8116
+ UiActionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiActionService, providedIn: 'root' });
8117
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiActionService, decorators: [{
8118
+ type: Injectable,
8119
+ args: [{
8120
+ providedIn: 'root',
8121
+ }]
8122
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
8123
+ type: Inject,
8124
+ args: ['confirmDialogService']
8125
+ }] }, { type: undefined, decorators: [{
8126
+ type: Inject,
8127
+ args: ['textFieldDialogService']
8128
+ }] }, { type: undefined, decorators: [{
8129
+ type: Inject,
8130
+ args: ['fileUploadDialogService']
8131
+ }] }, { type: i1$2.MatSnackBar }]; } });
8132
+
8133
+ class UiActionToolbarComponent {
8134
+ constructor(service, inject) {
7932
8135
  this.service = service;
7933
- this.manager = manager;
7934
- this.code = this.service.action.code;
8136
+ this.inject = inject;
8137
+ this._destroy$ = new Subject();
8138
+ this.pressedButtonActive = true;
8139
+ // Injects the basic UiActionDescriptorService provided by the AppModule
8140
+ this.manager = inject.get(UiActionDescriptorService);
8141
+ this.subscribeToLanguageChange();
8142
+ }
8143
+ ngOnInit() {
8144
+ // Overrides the basic UiActionDescriptorService with a custom one if there is one
8145
+ if (this.uiActionDescriptorService) {
8146
+ this.manager = this.uiActionDescriptorService;
8147
+ this.subscribeToLanguageChange();
8148
+ }
7935
8149
  this.setUp();
7936
8150
  }
7937
- async setUp() {
7938
- this.descriptor = await this.manager.getActionDescriptor(this.service.action);
7939
- this.dialogType = this.descriptor.confirmDialog ? "confirmDialog" : "dialog";
8151
+ ngOnChanges(changes) {
8152
+ if (changes['uiActionModels']) {
8153
+ let uiActionModels = changes['uiActionModels'].currentValue;
8154
+ if (uiActionModels) {
8155
+ this.uiActionModels = uiActionModels;
8156
+ this.setUp();
8157
+ }
8158
+ }
7940
8159
  }
7941
8160
  ngOnDestroy() {
7942
- this.service._destroy$.next();
7943
- this.cancel();
8161
+ this._destroy$.next();
7944
8162
  }
7945
- getTitle() {
7946
- return this.descriptor[this.dialogType].title;
8163
+ subscribeToLanguageChange() {
8164
+ this.languageChangedSubscription?.unsubscribe();
8165
+ this.languageChangedSubscription = this.manager.languageChanged
8166
+ .pipe(takeUntil(this._destroy$))
8167
+ .subscribe(() => {
8168
+ this.setUp();
8169
+ });
7947
8170
  }
7948
- getText() {
7949
- return this.descriptor[this.dialogType].text ?? "";
8171
+ async setUp() {
8172
+ if (this.uiActionModels) {
8173
+ this.uiActionModelsWithDescriptions = await Promise.all(this.uiActionModels.map(async (uiActionModel) => {
8174
+ uiActionModel.descriptor = await this.manager.getActionDescriptor(uiActionModel.uiAction);
8175
+ return uiActionModel;
8176
+ }));
8177
+ }
7950
8178
  }
7951
- getActionButtonLabel() {
7952
- return this.descriptor[this.dialogType].actionButton.caption;
8179
+ async onActionClicked(event, uiActionModel) {
8180
+ event.stopPropagation();
8181
+ if (uiActionModel.uiAction.disabled) {
8182
+ return;
8183
+ }
8184
+ if (this.pressedButtonActive) {
8185
+ this.pressedButtonActive = false;
8186
+ this.service.uiActionModel = uiActionModel;
8187
+ let options = {
8188
+ nodeId: uiActionModel.nodeId,
8189
+ widgetId: uiActionModel.widgetId,
8190
+ };
8191
+ await this.service.execute(uiActionModel.uiAction, options);
8192
+ this.pressedButtonActive = true;
8193
+ }
7953
8194
  }
7954
- getActionButtonColor() {
7955
- return this.descriptor[this.dialogType].actionButton.color;
8195
+ onActionDoubleClicked(event, uiActionModel) {
8196
+ event.stopPropagation();
8197
+ // We do not handle double clicks
7956
8198
  }
7957
- getCancelButtonLabel() {
7958
- return this.descriptor[this.dialogType].cancelButton.caption;
8199
+ getType(uiActionModel) {
8200
+ if (!uiActionModel.descriptor?.type) {
8201
+ console.log(`Action button type unset: ${uiActionModel?.uiAction?.code}`);
8202
+ }
8203
+ switch (uiActionModel.descriptor?.type) {
8204
+ case UiActionButtonType.NORMAL:
8205
+ return 'mat-button';
8206
+ case UiActionButtonType.FLAT:
8207
+ return 'mat-flat-button';
8208
+ case UiActionButtonType.RAISED:
8209
+ return 'mat-raised-button';
8210
+ case UiActionButtonType.STROKED:
8211
+ return 'mat-stroked-button';
8212
+ case UiActionButtonType.ICON:
8213
+ return 'mat-icon-button';
8214
+ case UiActionButtonType.MINI_FAB:
8215
+ return 'mat-mini-fab';
8216
+ case UiActionButtonType.FAB:
8217
+ return 'mat-fab';
8218
+ default:
8219
+ console.log(`Unhandled action button type case: ${uiActionModel.descriptor?.type}`);
8220
+ return `mat-button`;
8221
+ }
7959
8222
  }
7960
- getCancelButtonColor() {
7961
- return this.descriptor[this.dialogType].cancelButton.color;
8223
+ iconPosition() {
8224
+ return IconPosition;
7962
8225
  }
7963
- doAction() {
7964
- this.service.doAction();
8226
+ isOnlyIcon(uiActionModel) {
8227
+ return (uiActionModel.descriptor?.type === UiActionButtonType.ICON ||
8228
+ uiActionModel.descriptor?.type === UiActionButtonType.MINI_FAB ||
8229
+ uiActionModel.descriptor?.type === UiActionButtonType.FAB);
7965
8230
  }
7966
- cancel() {
7967
- this.service.cancel();
8231
+ getTooltipPos(pos) {
8232
+ if (pos) {
8233
+ return pos.toLowerCase();
8234
+ }
8235
+ else {
8236
+ return 'before';
8237
+ }
8238
+ }
8239
+ getTooltipDelay(delay) {
8240
+ return delay ? delay : 1000;
8241
+ }
8242
+ getTooltipHideDelay(delay) {
8243
+ return delay ? delay : 2000;
7968
8244
  }
7969
8245
  }
7970
- UiActionConfirmDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiActionConfirmDialogComponent, deps: [{ token: UiActionConfirmDialogService }, { token: UiActionDescriptorService }], target: i0.ɵɵFactoryTarget.Component });
7971
- UiActionConfirmDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: UiActionConfirmDialogComponent, selector: "app-ui-action-confirm-dialog", ngImport: i0, template: "<div class=\"folderNameDialogContainer\">\r\n\t<div class=\"headerContainer\">\r\n\t\t<h3 class=\"color-accent-700\">\r\n\t\t\t{{ getTitle() }}\r\n\t\t</h3>\r\n\t\t<button mat-icon-button title=\"close\" (click)=\"cancel()\">\r\n\t\t\t<smart-icon [color]=\"'primary'\" [icon]=\"'X'\"></smart-icon>\r\n\t\t</button>\r\n\t</div>\r\n\t<p>\r\n\t\t{{ getText() }}\r\n\t</p>\r\n\t<div class=\"folderNameDialogButtonsContainer\">\r\n\t\t<button mat-button color=\"accent\" [color]=\"getCancelButtonColor()\" (click)=\"cancel()\">\r\n\t\t\t{{ getCancelButtonLabel() }}\r\n\t\t</button>\r\n\t\t<button mat-raised-button [color]=\"getActionButtonColor()\" (click)=\"doAction()\">\r\n\t\t\t{{ getActionButtonLabel() }}\r\n\t\t</button>\r\n\t</div>\r\n</div>\r\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: i3.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: SmartIconComponent, selector: "smart-icon", inputs: ["icon", "color"] }] });
7972
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiActionConfirmDialogComponent, decorators: [{
8246
+ UiActionToolbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiActionToolbarComponent, deps: [{ token: UiActionService }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
8247
+ UiActionToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: UiActionToolbarComponent, selector: "smart-ui-action-toolbar", inputs: { uiActionModels: "uiActionModels", uiActionDescriptorService: "uiActionDescriptorService", id: "id" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"uiActionButtonsContainer\">\r\n <button\r\n *ngFor=\"let uiActionModel of uiActionModelsWithDescriptions\"\r\n mat-button\r\n [smartTooltip]=\"uiActionModel?.descriptor?.tooltip!\"\r\n [ngClass]=\"getType(uiActionModel)\"\r\n class=\"{{ uiActionModel.cssClass }}\"\r\n [color]=\"uiActionModel.descriptor?.color\"\r\n (click)=\"onActionClicked($event, uiActionModel)\"\r\n [disabled]=\"!!uiActionModel.uiAction.disabled\"\r\n (dblclick)=\"onActionDoubleClicked($event, uiActionModel)\"\r\n >\r\n <div *ngIf=\"isOnlyIcon(uiActionModel); then iconOnly; else text\"></div>\r\n <ng-template #iconOnly>\r\n <smart-icon\r\n *ngIf=\"uiActionModel.descriptor?.icon\"\r\n [icon]=\"uiActionModel.descriptor!.icon!\"\r\n [color]=\"uiActionModel.descriptor?.iconColor ?? uiActionModel.descriptor?.color\"\r\n ></smart-icon>\r\n </ng-template>\r\n <ng-template #text>\r\n <smart-icon\r\n *ngIf=\"\r\n uiActionModel.descriptor?.icon &&\r\n uiActionModel.descriptor?.iconPosition === iconPosition().PRE\r\n \"\r\n [icon]=\"uiActionModel.descriptor!.icon!\"\r\n [color]=\"uiActionModel.descriptor?.iconColor ?? uiActionModel.descriptor?.color\"\r\n ></smart-icon>\r\n {{ uiActionModel.descriptor?.title }}\r\n <smart-icon\r\n *ngIf=\"\r\n uiActionModel.descriptor?.icon &&\r\n uiActionModel.descriptor?.iconPosition === iconPosition().POST\r\n \"\r\n [icon]=\"uiActionModel.descriptor!.icon!\"\r\n [color]=\"uiActionModel.descriptor?.iconColor ?? uiActionModel.descriptor?.color\"\r\n ></smart-icon>\r\n </ng-template>\r\n </button>\r\n</div>\r\n", styles: [".uiActionButtonsContainer{display:flex;flex-direction:row;gap:1rem;flex-wrap:wrap}\n"], components: [{ type: i3.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: SmartIconComponent, selector: "smart-icon", inputs: ["icon", "color"] }], directives: [{ type: i3$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: SmartTooltipDirective, selector: "[smartTooltip]", inputs: ["smartTooltip"] }, { type: i3$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
8248
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiActionToolbarComponent, decorators: [{
7973
8249
  type: Component,
7974
- args: [{ selector: "app-ui-action-confirm-dialog", template: "<div class=\"folderNameDialogContainer\">\r\n\t<div class=\"headerContainer\">\r\n\t\t<h3 class=\"color-accent-700\">\r\n\t\t\t{{ getTitle() }}\r\n\t\t</h3>\r\n\t\t<button mat-icon-button title=\"close\" (click)=\"cancel()\">\r\n\t\t\t<smart-icon [color]=\"'primary'\" [icon]=\"'X'\"></smart-icon>\r\n\t\t</button>\r\n\t</div>\r\n\t<p>\r\n\t\t{{ getText() }}\r\n\t</p>\r\n\t<div class=\"folderNameDialogButtonsContainer\">\r\n\t\t<button mat-button color=\"accent\" [color]=\"getCancelButtonColor()\" (click)=\"cancel()\">\r\n\t\t\t{{ getCancelButtonLabel() }}\r\n\t\t</button>\r\n\t\t<button mat-raised-button [color]=\"getActionButtonColor()\" (click)=\"doAction()\">\r\n\t\t\t{{ getActionButtonLabel() }}\r\n\t\t</button>\r\n\t</div>\r\n</div>\r\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"] }]
7975
- }], ctorParameters: function () { return [{ type: UiActionConfirmDialogService }, { type: UiActionDescriptorService }]; } });
8250
+ args: [{ selector: 'smart-ui-action-toolbar', template: "<div class=\"uiActionButtonsContainer\">\r\n <button\r\n *ngFor=\"let uiActionModel of uiActionModelsWithDescriptions\"\r\n mat-button\r\n [smartTooltip]=\"uiActionModel?.descriptor?.tooltip!\"\r\n [ngClass]=\"getType(uiActionModel)\"\r\n class=\"{{ uiActionModel.cssClass }}\"\r\n [color]=\"uiActionModel.descriptor?.color\"\r\n (click)=\"onActionClicked($event, uiActionModel)\"\r\n [disabled]=\"!!uiActionModel.uiAction.disabled\"\r\n (dblclick)=\"onActionDoubleClicked($event, uiActionModel)\"\r\n >\r\n <div *ngIf=\"isOnlyIcon(uiActionModel); then iconOnly; else text\"></div>\r\n <ng-template #iconOnly>\r\n <smart-icon\r\n *ngIf=\"uiActionModel.descriptor?.icon\"\r\n [icon]=\"uiActionModel.descriptor!.icon!\"\r\n [color]=\"uiActionModel.descriptor?.iconColor ?? uiActionModel.descriptor?.color\"\r\n ></smart-icon>\r\n </ng-template>\r\n <ng-template #text>\r\n <smart-icon\r\n *ngIf=\"\r\n uiActionModel.descriptor?.icon &&\r\n uiActionModel.descriptor?.iconPosition === iconPosition().PRE\r\n \"\r\n [icon]=\"uiActionModel.descriptor!.icon!\"\r\n [color]=\"uiActionModel.descriptor?.iconColor ?? uiActionModel.descriptor?.color\"\r\n ></smart-icon>\r\n {{ uiActionModel.descriptor?.title }}\r\n <smart-icon\r\n *ngIf=\"\r\n uiActionModel.descriptor?.icon &&\r\n uiActionModel.descriptor?.iconPosition === iconPosition().POST\r\n \"\r\n [icon]=\"uiActionModel.descriptor!.icon!\"\r\n [color]=\"uiActionModel.descriptor?.iconColor ?? uiActionModel.descriptor?.color\"\r\n ></smart-icon>\r\n </ng-template>\r\n </button>\r\n</div>\r\n", styles: [".uiActionButtonsContainer{display:flex;flex-direction:row;gap:1rem;flex-wrap:wrap}\n"] }]
8251
+ }], ctorParameters: function () { return [{ type: UiActionService }, { type: i0.Injector }]; }, propDecorators: { uiActionModels: [{
8252
+ type: Input
8253
+ }], uiActionDescriptorService: [{
8254
+ type: Input
8255
+ }], id: [{
8256
+ type: Input
8257
+ }] } });
7976
8258
 
7977
- class UiActionConfirmDialogService extends SmartdialogService {
8259
+ class UiActionInputDialogService extends SmartdialogService {
7978
8260
  constructor(dialog, router) {
7979
8261
  super(dialog, router);
7980
8262
  this._destroy$ = new Subject();
7981
8263
  this.onAction = new SmartSubject(this._destroy$);
7982
- this.shouldDoAction = false;
8264
+ }
8265
+ setDataAndOpenDialog(action, nodeName) {
8266
+ this.action = action;
8267
+ this.nodeName = nodeName;
8268
+ this.openDialog();
7983
8269
  }
7984
8270
  openDialog() {
7985
- this.shouldDoAction = false;
8271
+ this.params = undefined;
7986
8272
  this.onAction = new SmartSubject(this._destroy$);
7987
8273
  const dialogData = {
7988
8274
  content: {
7989
8275
  title: '',
7990
8276
  },
7991
8277
  size: {},
7992
- customComponent: UiActionConfirmDialogComponent,
8278
+ customComponent: UiActionInputDialogComponent,
7993
8279
  };
7994
- this.createDialog(dialogData, UiActionConfirmDialogComponent);
8280
+ this.createDialog(dialogData, UiActionInputDialogComponent);
7995
8281
  }
7996
- doAction() {
7997
- this.shouldDoAction = true;
8282
+ async onSave(params) {
8283
+ this.params = params;
7998
8284
  this.onAction.complete();
7999
8285
  this.closeDialog();
8000
8286
  this.onAction = new SmartSubject(this._destroy$);
@@ -8005,9 +8291,9 @@ class UiActionConfirmDialogService extends SmartdialogService {
8005
8291
  this.onAction = new SmartSubject(this._destroy$);
8006
8292
  }
8007
8293
  }
8008
- UiActionConfirmDialogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiActionConfirmDialogService, deps: [{ token: i1$1.MatDialog }, { token: i2.Router }], target: i0.ɵɵFactoryTarget.Injectable });
8009
- UiActionConfirmDialogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiActionConfirmDialogService, providedIn: 'root' });
8010
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiActionConfirmDialogService, decorators: [{
8294
+ UiActionInputDialogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiActionInputDialogService, deps: [{ token: i1$1.MatDialog }, { token: i2.Router }], target: i0.ɵɵFactoryTarget.Injectable });
8295
+ UiActionInputDialogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiActionInputDialogService, providedIn: 'root' });
8296
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiActionInputDialogService, decorators: [{
8011
8297
  type: Injectable,
8012
8298
  args: [{
8013
8299
  providedIn: 'root',
@@ -8124,31 +8410,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
8124
8410
  args: ['form']
8125
8411
  }] } });
8126
8412
 
8127
- class UiActionInputDialogService extends SmartdialogService {
8413
+ class UiActionConfirmDialogService extends SmartdialogService {
8128
8414
  constructor(dialog, router) {
8129
8415
  super(dialog, router);
8130
8416
  this._destroy$ = new Subject();
8131
8417
  this.onAction = new SmartSubject(this._destroy$);
8132
- }
8133
- setDataAndOpenDialog(action, nodeName) {
8134
- this.action = action;
8135
- this.nodeName = nodeName;
8136
- this.openDialog();
8418
+ this.shouldDoAction = false;
8137
8419
  }
8138
8420
  openDialog() {
8139
- this.params = undefined;
8421
+ this.shouldDoAction = false;
8140
8422
  this.onAction = new SmartSubject(this._destroy$);
8141
8423
  const dialogData = {
8142
8424
  content: {
8143
8425
  title: '',
8144
8426
  },
8145
8427
  size: {},
8146
- customComponent: UiActionInputDialogComponent,
8428
+ customComponent: UiActionConfirmDialogComponent,
8147
8429
  };
8148
- this.createDialog(dialogData, UiActionInputDialogComponent);
8430
+ this.createDialog(dialogData, UiActionConfirmDialogComponent);
8149
8431
  }
8150
- async onSave(params) {
8151
- this.params = params;
8432
+ doAction() {
8433
+ this.shouldDoAction = true;
8152
8434
  this.onAction.complete();
8153
8435
  this.closeDialog();
8154
8436
  this.onAction = new SmartSubject(this._destroy$);
@@ -8159,50 +8441,35 @@ class UiActionInputDialogService extends SmartdialogService {
8159
8441
  this.onAction = new SmartSubject(this._destroy$);
8160
8442
  }
8161
8443
  }
8162
- UiActionInputDialogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiActionInputDialogService, deps: [{ token: i1$1.MatDialog }, { token: i2.Router }], target: i0.ɵɵFactoryTarget.Injectable });
8163
- UiActionInputDialogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiActionInputDialogService, providedIn: 'root' });
8164
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiActionInputDialogService, decorators: [{
8444
+ UiActionConfirmDialogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiActionConfirmDialogService, deps: [{ token: i1$1.MatDialog }, { token: i2.Router }], target: i0.ɵɵFactoryTarget.Injectable });
8445
+ UiActionConfirmDialogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiActionConfirmDialogService, providedIn: 'root' });
8446
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiActionConfirmDialogService, decorators: [{
8165
8447
  type: Injectable,
8166
8448
  args: [{
8167
8449
  providedIn: 'root',
8168
8450
  }]
8169
8451
  }], ctorParameters: function () { return [{ type: i1$1.MatDialog }, { type: i2.Router }]; } });
8170
8452
 
8171
- class UiActionFileUploadDialogComponent {
8453
+ class UiActionConfirmDialogComponent {
8172
8454
  constructor(service, manager) {
8173
8455
  this.service = service;
8174
8456
  this.manager = manager;
8175
- this.maxSizeMb = 25;
8176
8457
  this.code = this.service.action.code;
8177
8458
  this.setUp();
8178
8459
  }
8460
+ async setUp() {
8461
+ this.descriptor = await this.manager.getActionDescriptor(this.service.action);
8462
+ this.dialogType = this.descriptor.confirmDialog ? "confirmDialog" : "dialog";
8463
+ }
8179
8464
  ngOnDestroy() {
8180
8465
  this.service._destroy$.next();
8181
8466
  this.cancel();
8182
8467
  }
8183
- async setUp() {
8184
- this.descriptor = await this.manager.getActionDescriptor(this.service.action);
8185
- this.isMultiple = this.service.isMultiple;
8186
- this.i18n = {
8187
- addFile: this.descriptor.upload?.title ?? 'dokumentum hozzáadása',
8188
- browseOrDrag: this.descriptor.upload?.description ?? 'tallózás vagy behúzás',
8189
- formats: this.descriptor.upload?.formats ?? '',
8190
- maxSize: this.descriptor.upload?.maxSize ?? '',
8191
- upload: this.descriptor.upload?.uploadButtonTitle,
8192
- };
8193
- // TODO set max size and file formats by UiAction.params
8194
- if (this.descriptor[this.service.inputTypeName]) {
8195
- this.dialogType = this.service.inputTypeName;
8196
- }
8197
- else {
8198
- this.dialogType = this.descriptor.inputDialog ? 'inputDialog' : 'dialog';
8199
- }
8200
- }
8201
8468
  getTitle() {
8202
8469
  return this.descriptor[this.dialogType].title;
8203
8470
  }
8204
8471
  getText() {
8205
- return this.descriptor[this.dialogType].text ?? '';
8472
+ return this.descriptor[this.dialogType].text ?? "";
8206
8473
  }
8207
8474
  getActionButtonLabel() {
8208
8475
  return this.descriptor[this.dialogType].actionButton.caption;
@@ -8216,384 +8483,126 @@ class UiActionFileUploadDialogComponent {
8216
8483
  getCancelButtonColor() {
8217
8484
  return this.descriptor[this.dialogType].cancelButton.color;
8218
8485
  }
8219
- upload(files) {
8220
- this.service.onSave(files);
8221
- }
8222
- cancel() {
8223
- this.service.cancel();
8224
- }
8225
- }
8226
- UiActionFileUploadDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiActionFileUploadDialogComponent, deps: [{ token: UiActionFileUploadDialogService }, { token: UiActionDescriptorService }], target: i0.ɵɵFactoryTarget.Component });
8227
- UiActionFileUploadDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: UiActionFileUploadDialogComponent, selector: "lib-ui-action-file-upload-dialog", ngImport: i0, template: "<div class=\"folderNameDialogContainer\">\r\n <div class=\"headerContainer\">\r\n <h3 class=\"color-accent-700\">\r\n {{ getTitle() }}\r\n </h3>\r\n <button mat-icon-button title=\"close\" (click)=\"cancel()\">\r\n <smart-icon [color]=\"'primary'\" [icon]=\"'X'\"></smart-icon>\r\n </button>\r\n </div>\r\n <p>\r\n {{ getText() }}\r\n </p>\r\n <smartfileuploader\r\n [i18n]=\"i18n\"\r\n [fileFormats]=\"fileFormats\"\r\n [maxSizeMb]=\"maxSizeMb\"\r\n [uploadCallback]=\"upload.bind(this)\"\r\n [isMultiple]=\"isMultiple\"\r\n ></smartfileuploader>\r\n <div class=\"folderNameDialogButtonsContainer\">\r\n <button mat-button color=\"accent\" [color]=\"getCancelButtonColor()\" (click)=\"cancel()\">\r\n {{ getCancelButtonLabel() }}\r\n </button>\r\n <!-- <button mat-raised-button [color]=\"getActionButtonColor()\" (click)=\"upload()\">\r\n {{ getActionButtonLabel() }}\r\n </button> -->\r\n </div>\r\n</div>\r\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: i3.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: SmartIconComponent, selector: "smart-icon", inputs: ["icon", "color"] }, { type: SmartfileuploaderComponent, selector: "smartfileuploader", inputs: ["uploadCallback", "fileFormats", "maxSizeMb", "i18n", "useIconButton", "isMultiple"] }] });
8228
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiActionFileUploadDialogComponent, decorators: [{
8229
- type: Component,
8230
- args: [{ selector: 'lib-ui-action-file-upload-dialog', template: "<div class=\"folderNameDialogContainer\">\r\n <div class=\"headerContainer\">\r\n <h3 class=\"color-accent-700\">\r\n {{ getTitle() }}\r\n </h3>\r\n <button mat-icon-button title=\"close\" (click)=\"cancel()\">\r\n <smart-icon [color]=\"'primary'\" [icon]=\"'X'\"></smart-icon>\r\n </button>\r\n </div>\r\n <p>\r\n {{ getText() }}\r\n </p>\r\n <smartfileuploader\r\n [i18n]=\"i18n\"\r\n [fileFormats]=\"fileFormats\"\r\n [maxSizeMb]=\"maxSizeMb\"\r\n [uploadCallback]=\"upload.bind(this)\"\r\n [isMultiple]=\"isMultiple\"\r\n ></smartfileuploader>\r\n <div class=\"folderNameDialogButtonsContainer\">\r\n <button mat-button color=\"accent\" [color]=\"getCancelButtonColor()\" (click)=\"cancel()\">\r\n {{ getCancelButtonLabel() }}\r\n </button>\r\n <!-- <button mat-raised-button [color]=\"getActionButtonColor()\" (click)=\"upload()\">\r\n {{ getActionButtonLabel() }}\r\n </button> -->\r\n </div>\r\n</div>\r\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"] }]
8231
- }], ctorParameters: function () { return [{ type: UiActionFileUploadDialogService }, { type: UiActionDescriptorService }]; } });
8232
-
8233
- class UiActionFileUploadDialogService extends SmartdialogService {
8234
- constructor(dialog, router) {
8235
- super(dialog, router);
8236
- this._destroy$ = new Subject();
8237
- this.onAction = new SmartSubject(this._destroy$);
8238
- this.isMultiple = false;
8239
- }
8240
- setDataAndOpenDialog(action, nodeName) {
8241
- this.action = action;
8242
- this.nodeName = nodeName;
8243
- this.openDialog();
8244
- }
8245
- openDialog() {
8246
- this.files = undefined;
8247
- this.onAction = new SmartSubject(this._destroy$);
8248
- const dialogData = {
8249
- content: {
8250
- title: '',
8251
- },
8252
- size: {},
8253
- customComponent: UiActionFileUploadDialogComponent,
8254
- };
8255
- this.createDialog(dialogData, UiActionFileUploadDialogComponent);
8256
- }
8257
- async onSave(files) {
8258
- this.files = files;
8259
- this.onAction.complete();
8260
- this.closeDialog();
8261
- this.onAction = new SmartSubject(this._destroy$);
8262
- }
8263
- cancel() {
8264
- this.onAction.complete();
8265
- this.closeDialog();
8266
- this.onAction = new SmartSubject(this._destroy$);
8267
- }
8268
- }
8269
- UiActionFileUploadDialogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiActionFileUploadDialogService, deps: [{ token: i1$1.MatDialog }, { token: i2.Router }], target: i0.ɵɵFactoryTarget.Injectable });
8270
- UiActionFileUploadDialogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiActionFileUploadDialogService, providedIn: 'root' });
8271
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiActionFileUploadDialogService, decorators: [{
8272
- type: Injectable,
8273
- args: [{
8274
- providedIn: 'root',
8275
- }]
8276
- }], ctorParameters: function () { return [{ type: i1$1.MatDialog }, { type: i2.Router }]; } });
8277
-
8278
- class UiActionService {
8279
- constructor(confirmDialogService, textFieldDialogService, fileUploadDialogService, _snackBar) {
8280
- this.confirmDialogService = confirmDialogService;
8281
- this.textFieldDialogService = textFieldDialogService;
8282
- this.fileUploadDialogService = fileUploadDialogService;
8283
- this._snackBar = _snackBar;
8284
- this._destroy$ = new Subject();
8285
- }
8286
- ngOnDestroy() {
8287
- this._destroy$.next();
8288
- this._destroy$.complete();
8289
- }
8290
- async execute(uiAction, options) {
8291
- let uiActionRequest;
8292
- uiActionRequest = {
8293
- code: uiAction.code,
8294
- identifier: uiAction.identifier,
8295
- params: uiAction.params ?? {},
8296
- };
8297
- if (uiAction.submit || uiAction.model) {
8298
- // submit: with validation, model: without validation. both can be undefined
8299
- const validate = uiAction.submit || !uiAction.model;
8300
- if ('reSubscribeToChange' in this.uiActionModel.serviceToUse) {
8301
- if (!validate) {
8302
- console.error(`Validate = false, but UseUiAction doesn't support it`);
8303
- }
8304
- this.uiActionModel.serviceToUse.submit.next();
8305
- try {
8306
- await this.uiActionModel.serviceToUse.submit.toPromise();
8307
- this.uiActionModel.serviceToUse.submit = new SmartSubject(this._destroy$);
8308
- this.uiActionModel.serviceToUse.reSubscribeToChange.next();
8309
- }
8310
- catch (error) {
8311
- console.error(error);
8312
- this.uiActionModel.serviceToUse.submit = new SmartSubject(this._destroy$);
8313
- this.uiActionModel.serviceToUse.reSubscribeToChange.next();
8314
- return;
8315
- }
8316
- }
8317
- else {
8318
- this.uiActionModel.serviceToUse.submitForm(validate);
8319
- let invalidFields = this.uiActionModel.serviceToUse.getInvalidFields();
8320
- if (validate && invalidFields.invalidFieldKeys.length) {
8321
- this.showInvalidFieldsSnackbar(invalidFields);
8322
- return;
8323
- }
8324
- }
8325
- }
8326
- if (uiAction.confirm) {
8327
- this.confirmDialogService.action = uiAction;
8328
- this.confirmDialogService.openDialog();
8329
- await this.confirmDialogService.onAction.toPromise();
8330
- if (!this.confirmDialogService.shouldDoAction) {
8331
- return;
8332
- }
8333
- }
8334
- // InputType
8335
- if (uiAction.inputType && uiAction.inputType !== UiActionInputType.NONE) {
8336
- uiActionRequest = await this.handleInputType(uiAction.inputType, uiAction, uiActionRequest, 'inputDialog');
8337
- if (!uiActionRequest) {
8338
- return;
8339
- }
8340
- await new Promise((resolve) => setTimeout(resolve, 250));
8341
- }
8342
- // Input2Type
8343
- if (uiAction.input2Type && uiAction.input2Type !== UiActionInputType.NONE) {
8344
- uiActionRequest = await this.handleInputType(uiAction.input2Type, uiAction, uiActionRequest, 'input2Dialog');
8345
- if (!uiActionRequest) {
8346
- return;
8347
- }
8348
- }
8349
- if (this.uiActionModel.exception) {
8350
- let response = await this.uiActionModel.serviceToUse.handleSpecificDemandsAsynchronously(uiAction, uiActionRequest);
8351
- if (!response.shouldPerformAction || !response.uiActionRequest) {
8352
- return;
8353
- }
8354
- uiActionRequest = response.uiActionRequest;
8355
- }
8356
- await this.performAction(uiAction, uiActionRequest, options);
8357
- }
8358
- async handleInputType(inputType, uiAction, uiActionRequest, inputTypeName) {
8359
- switch (inputType) {
8360
- case UiActionInputType.NONE:
8361
- return uiActionRequest;
8362
- case UiActionInputType.TEXTAREA:
8363
- case UiActionInputType.TEXTFIELD:
8364
- return await this.handleInputTypeTextField(inputTypeName, uiAction, uiActionRequest);
8365
- case UiActionInputType.USER_SELECT:
8366
- return await this.handleInputTypeUserSelect(inputTypeName, uiAction, uiActionRequest);
8367
- case UiActionInputType.FILE:
8368
- return await this.handleInputTypeUpload(inputTypeName, uiAction, uiActionRequest, false);
8369
- case UiActionInputType.MULTIPLE_FILES:
8370
- return await this.handleInputTypeUpload(inputTypeName, uiAction, uiActionRequest, true);
8371
- default:
8372
- return uiActionRequest;
8373
- }
8374
- }
8375
- async handleInputTypeTextField(inputTypeName, uiAction, uiActionRequest) {
8376
- let additionalParams = this.uiActionModel.serviceToUse.getAdditionalParams(uiAction);
8377
- let inputType = inputTypeName === 'inputDialog' ? 'inputType' : 'input2Type';
8378
- if (uiAction[inputType] === UiActionInputType.TEXTFIELD) {
8379
- this.textFieldDialogService.nodeName = additionalParams.forTextField;
8380
- }
8381
- else if (uiAction[inputType] === UiActionInputType.TEXTAREA) {
8382
- this.textFieldDialogService.nodeName = additionalParams.forTextArea;
8383
- }
8384
- this.textFieldDialogService.inputTypeName = inputTypeName;
8385
- this.textFieldDialogService.action = uiAction;
8386
- this.textFieldDialogService.openDialog();
8387
- await this.textFieldDialogService.onAction.toPromise();
8388
- let params = this.textFieldDialogService.params;
8389
- if (!params) {
8390
- console.error('There was no response from InputDialog');
8391
- return;
8392
- }
8393
- uiActionRequest.params = {
8394
- ...uiActionRequest.params,
8395
- ...params,
8396
- };
8397
- return uiActionRequest;
8486
+ doAction() {
8487
+ this.service.doAction();
8398
8488
  }
8399
- async handleInputTypeUpload(inputTypeName, uiAction, uiActionRequest, isMultiple) {
8400
- this.fileUploadDialogService.inputTypeName = inputTypeName;
8401
- this.fileUploadDialogService.action = uiAction;
8402
- this.fileUploadDialogService.isMultiple = isMultiple;
8403
- this.fileUploadDialogService.openDialog();
8404
- await this.fileUploadDialogService.onAction.toPromise();
8405
- let files = this.fileUploadDialogService.files;
8406
- if (!files || !files.length) {
8407
- console.error('There was no response from InputDialog');
8408
- return;
8409
- }
8410
- uiActionRequest.params = {
8411
- ...uiActionRequest.params,
8412
- _files: files,
8413
- isMultiple,
8414
- param: uiAction.inputType === 'file' || uiAction.inputType === 'multiple_files'
8415
- ? 'input'
8416
- : 'input2',
8417
- };
8418
- return uiActionRequest;
8489
+ cancel() {
8490
+ this.service.cancel();
8419
8491
  }
8420
- async handleInputTypeUserSelect(inputTypeName, uiAction, uiActionRequest) {
8421
- let response = await this.uiActionModel.serviceToUse.handleSpecificDemandsAsynchronously(uiAction, uiActionRequest);
8422
- if (!response.shouldPerformAction || !response.uiActionRequest) {
8423
- return;
8424
- }
8425
- uiActionRequest = response.uiActionRequest;
8426
- return uiActionRequest;
8492
+ }
8493
+ UiActionConfirmDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiActionConfirmDialogComponent, deps: [{ token: UiActionConfirmDialogService }, { token: UiActionDescriptorService }], target: i0.ɵɵFactoryTarget.Component });
8494
+ UiActionConfirmDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: UiActionConfirmDialogComponent, selector: "app-ui-action-confirm-dialog", ngImport: i0, template: "<div class=\"folderNameDialogContainer\">\r\n\t<div class=\"headerContainer\">\r\n\t\t<h3 class=\"color-accent-700\">\r\n\t\t\t{{ getTitle() }}\r\n\t\t</h3>\r\n\t\t<button mat-icon-button title=\"close\" (click)=\"cancel()\">\r\n\t\t\t<smart-icon [color]=\"'primary'\" [icon]=\"'X'\"></smart-icon>\r\n\t\t</button>\r\n\t</div>\r\n\t<p>\r\n\t\t{{ getText() }}\r\n\t</p>\r\n\t<div class=\"folderNameDialogButtonsContainer\">\r\n\t\t<button mat-button color=\"accent\" [color]=\"getCancelButtonColor()\" (click)=\"cancel()\">\r\n\t\t\t{{ getCancelButtonLabel() }}\r\n\t\t</button>\r\n\t\t<button mat-raised-button [color]=\"getActionButtonColor()\" (click)=\"doAction()\">\r\n\t\t\t{{ getActionButtonLabel() }}\r\n\t\t</button>\r\n\t</div>\r\n</div>\r\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: i3.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: SmartIconComponent, selector: "smart-icon", inputs: ["icon", "color"] }] });
8495
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiActionConfirmDialogComponent, decorators: [{
8496
+ type: Component,
8497
+ args: [{ selector: "app-ui-action-confirm-dialog", template: "<div class=\"folderNameDialogContainer\">\r\n\t<div class=\"headerContainer\">\r\n\t\t<h3 class=\"color-accent-700\">\r\n\t\t\t{{ getTitle() }}\r\n\t\t</h3>\r\n\t\t<button mat-icon-button title=\"close\" (click)=\"cancel()\">\r\n\t\t\t<smart-icon [color]=\"'primary'\" [icon]=\"'X'\"></smart-icon>\r\n\t\t</button>\r\n\t</div>\r\n\t<p>\r\n\t\t{{ getText() }}\r\n\t</p>\r\n\t<div class=\"folderNameDialogButtonsContainer\">\r\n\t\t<button mat-button color=\"accent\" [color]=\"getCancelButtonColor()\" (click)=\"cancel()\">\r\n\t\t\t{{ getCancelButtonLabel() }}\r\n\t\t</button>\r\n\t\t<button mat-raised-button [color]=\"getActionButtonColor()\" (click)=\"doAction()\">\r\n\t\t\t{{ getActionButtonLabel() }}\r\n\t\t</button>\r\n\t</div>\r\n</div>\r\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"] }]
8498
+ }], ctorParameters: function () { return [{ type: UiActionConfirmDialogService }, { type: UiActionDescriptorService }]; } });
8499
+
8500
+ class UiActionFileUploadDialogService extends SmartdialogService {
8501
+ constructor(dialog, router) {
8502
+ super(dialog, router);
8503
+ this._destroy$ = new Subject();
8504
+ this.onAction = new SmartSubject(this._destroy$);
8505
+ this.isMultiple = false;
8427
8506
  }
8428
- async performAction(uiAction, uiActionRequest, options) {
8429
- if (!uiActionRequest.params ||
8430
- (uiActionRequest.params && !Object.keys(uiActionRequest.params).length)) {
8431
- uiActionRequest.params = {
8432
- model: this.uiActionModel.serviceToUse.getModel(),
8433
- };
8434
- }
8435
- else if (uiAction.submit || uiAction.model) {
8436
- uiActionRequest.params['model'] = this.uiActionModel.serviceToUse.getModel();
8437
- }
8438
- try {
8439
- await this.uiActionModel.serviceToUse.performUiActionRequest(uiActionRequest, options?.widgetId, options?.nodeId);
8440
- if (this.uiActionModel.descriptor?.feedbackType === UiActionFeedbackType.SNACKBAR) {
8441
- this.showSavedSnackbar(uiAction);
8442
- }
8443
- }
8444
- catch (error) {
8445
- console.error(error);
8446
- }
8507
+ setDataAndOpenDialog(action, nodeName) {
8508
+ this.action = action;
8509
+ this.nodeName = nodeName;
8510
+ this.openDialog();
8447
8511
  }
8448
- showSavedSnackbar(uiAction) {
8449
- this._snackBar.openFromComponent(SuccessSnackBarComponent, {
8450
- duration: 5 * 1000,
8451
- panelClass: ['backgroundColor-accent'],
8452
- data: uiAction,
8453
- });
8512
+ openDialog() {
8513
+ this.files = undefined;
8514
+ this.onAction = new SmartSubject(this._destroy$);
8515
+ const dialogData = {
8516
+ content: {
8517
+ title: '',
8518
+ },
8519
+ size: {},
8520
+ customComponent: UiActionFileUploadDialogComponent,
8521
+ };
8522
+ this.createDialog(dialogData, UiActionFileUploadDialogComponent);
8454
8523
  }
8455
- showInvalidFieldsSnackbar(invalidFields) {
8456
- this._snackBar.openFromComponent(InvalidFieldsSnackBarComponent, {
8457
- duration: 5 * 1000,
8458
- panelClass: ['backgroundColor-warn'],
8459
- data: invalidFields,
8460
- });
8524
+ async onSave(files) {
8525
+ this.files = files;
8526
+ this.onAction.complete();
8527
+ this.closeDialog();
8528
+ this.onAction = new SmartSubject(this._destroy$);
8529
+ }
8530
+ cancel() {
8531
+ this.onAction.complete();
8532
+ this.closeDialog();
8533
+ this.onAction = new SmartSubject(this._destroy$);
8461
8534
  }
8462
8535
  }
8463
- UiActionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiActionService, deps: [{ token: UiActionConfirmDialogService }, { token: UiActionInputDialogService }, { token: UiActionFileUploadDialogService }, { token: i1$2.MatSnackBar }], target: i0.ɵɵFactoryTarget.Injectable });
8464
- UiActionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiActionService, providedIn: 'root' });
8465
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiActionService, decorators: [{
8536
+ UiActionFileUploadDialogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiActionFileUploadDialogService, deps: [{ token: i1$1.MatDialog }, { token: i2.Router }], target: i0.ɵɵFactoryTarget.Injectable });
8537
+ UiActionFileUploadDialogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiActionFileUploadDialogService, providedIn: 'root' });
8538
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiActionFileUploadDialogService, decorators: [{
8466
8539
  type: Injectable,
8467
8540
  args: [{
8468
8541
  providedIn: 'root',
8469
8542
  }]
8470
- }], ctorParameters: function () { return [{ type: UiActionConfirmDialogService }, { type: UiActionInputDialogService }, { type: UiActionFileUploadDialogService }, { type: i1$2.MatSnackBar }]; } });
8543
+ }], ctorParameters: function () { return [{ type: i1$1.MatDialog }, { type: i2.Router }]; } });
8471
8544
 
8472
- class UiActionToolbarComponent {
8473
- constructor(service, inject) {
8545
+ class UiActionFileUploadDialogComponent {
8546
+ constructor(service, manager) {
8474
8547
  this.service = service;
8475
- this.inject = inject;
8476
- this._destroy$ = new Subject();
8477
- this.pressedButtonActive = true;
8478
- // Injects the basic UiActionDescriptorService provided by the AppModule
8479
- this.manager = inject.get(UiActionDescriptorService);
8480
- this.subscribeToLanguageChange();
8481
- }
8482
- ngOnInit() {
8483
- // Overrides the basic UiActionDescriptorService with a custom one if there is one
8484
- if (this.uiActionDescriptorService) {
8485
- this.manager = this.uiActionDescriptorService;
8486
- this.subscribeToLanguageChange();
8487
- }
8548
+ this.manager = manager;
8549
+ this.maxSizeMb = 25;
8550
+ this.code = this.service.action.code;
8488
8551
  this.setUp();
8489
8552
  }
8490
- ngOnChanges(changes) {
8491
- if (changes['uiActionModels']) {
8492
- let uiActionModels = changes['uiActionModels'].currentValue;
8493
- if (uiActionModels) {
8494
- this.uiActionModels = uiActionModels;
8495
- this.setUp();
8496
- }
8497
- }
8498
- }
8499
8553
  ngOnDestroy() {
8500
- this._destroy$.next();
8501
- }
8502
- subscribeToLanguageChange() {
8503
- this.languageChangedSubscription?.unsubscribe();
8504
- this.languageChangedSubscription = this.manager.languageChanged
8505
- .pipe(takeUntil(this._destroy$))
8506
- .subscribe(() => {
8507
- this.setUp();
8508
- });
8554
+ this.service._destroy$.next();
8555
+ this.cancel();
8509
8556
  }
8510
8557
  async setUp() {
8511
- if (this.uiActionModels) {
8512
- this.uiActionModelsWithDescriptions = await Promise.all(this.uiActionModels.map(async (uiActionModel) => {
8513
- uiActionModel.descriptor = await this.manager.getActionDescriptor(uiActionModel.uiAction);
8514
- return uiActionModel;
8515
- }));
8516
- }
8517
- }
8518
- async onActionClicked(event, uiActionModel) {
8519
- event.stopPropagation();
8520
- if (uiActionModel.uiAction.disabled) {
8521
- return;
8558
+ this.descriptor = await this.manager.getActionDescriptor(this.service.action);
8559
+ this.isMultiple = this.service.isMultiple;
8560
+ this.i18n = {
8561
+ addFile: this.descriptor.upload?.title ?? 'dokumentum hozzáadása',
8562
+ browseOrDrag: this.descriptor.upload?.description ?? 'tallózás vagy behúzás',
8563
+ formats: this.descriptor.upload?.formats ?? '',
8564
+ maxSize: this.descriptor.upload?.maxSize ?? '',
8565
+ upload: this.descriptor.upload?.uploadButtonTitle,
8566
+ };
8567
+ // TODO set max size and file formats by UiAction.params
8568
+ if (this.descriptor[this.service.inputTypeName]) {
8569
+ this.dialogType = this.service.inputTypeName;
8522
8570
  }
8523
- if (this.pressedButtonActive) {
8524
- this.pressedButtonActive = false;
8525
- this.service.uiActionModel = uiActionModel;
8526
- let options = {
8527
- nodeId: uiActionModel.nodeId,
8528
- widgetId: uiActionModel.widgetId,
8529
- };
8530
- await this.service.execute(uiActionModel.uiAction, options);
8531
- this.pressedButtonActive = true;
8571
+ else {
8572
+ this.dialogType = this.descriptor.inputDialog ? 'inputDialog' : 'dialog';
8532
8573
  }
8533
8574
  }
8534
- onActionDoubleClicked(event, uiActionModel) {
8535
- event.stopPropagation();
8536
- // We do not handle double clicks
8575
+ getTitle() {
8576
+ return this.descriptor[this.dialogType].title;
8537
8577
  }
8538
- getType(uiActionModel) {
8539
- if (!uiActionModel.descriptor?.type) {
8540
- console.log(`Action button type unset: ${uiActionModel?.uiAction?.code}`);
8541
- }
8542
- switch (uiActionModel.descriptor?.type) {
8543
- case UiActionButtonType.NORMAL:
8544
- return 'mat-button';
8545
- case UiActionButtonType.FLAT:
8546
- return 'mat-flat-button';
8547
- case UiActionButtonType.RAISED:
8548
- return 'mat-raised-button';
8549
- case UiActionButtonType.STROKED:
8550
- return 'mat-stroked-button';
8551
- case UiActionButtonType.ICON:
8552
- return 'mat-icon-button';
8553
- case UiActionButtonType.MINI_FAB:
8554
- return 'mat-mini-fab';
8555
- case UiActionButtonType.FAB:
8556
- return 'mat-fab';
8557
- default:
8558
- console.log(`Unhandled action button type case: ${uiActionModel.descriptor?.type}`);
8559
- return `mat-button`;
8560
- }
8578
+ getText() {
8579
+ return this.descriptor[this.dialogType].text ?? '';
8561
8580
  }
8562
- iconPosition() {
8563
- return IconPosition;
8581
+ getActionButtonLabel() {
8582
+ return this.descriptor[this.dialogType].actionButton.caption;
8564
8583
  }
8565
- isOnlyIcon(uiActionModel) {
8566
- return (uiActionModel.descriptor?.type === UiActionButtonType.ICON ||
8567
- uiActionModel.descriptor?.type === UiActionButtonType.MINI_FAB ||
8568
- uiActionModel.descriptor?.type === UiActionButtonType.FAB);
8584
+ getActionButtonColor() {
8585
+ return this.descriptor[this.dialogType].actionButton.color;
8569
8586
  }
8570
- getTooltipPos(pos) {
8571
- if (pos) {
8572
- return pos.toLowerCase();
8573
- }
8574
- else {
8575
- return 'before';
8576
- }
8587
+ getCancelButtonLabel() {
8588
+ return this.descriptor[this.dialogType].cancelButton.caption;
8577
8589
  }
8578
- getTooltipDelay(delay) {
8579
- return delay ? delay : 1000;
8590
+ getCancelButtonColor() {
8591
+ return this.descriptor[this.dialogType].cancelButton.color;
8580
8592
  }
8581
- getTooltipHideDelay(delay) {
8582
- return delay ? delay : 2000;
8593
+ upload(files) {
8594
+ this.service.onSave(files);
8595
+ }
8596
+ cancel() {
8597
+ this.service.cancel();
8583
8598
  }
8584
8599
  }
8585
- UiActionToolbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiActionToolbarComponent, deps: [{ token: UiActionService }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
8586
- UiActionToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: UiActionToolbarComponent, selector: "smart-ui-action-toolbar", inputs: { uiActionModels: "uiActionModels", uiActionDescriptorService: "uiActionDescriptorService", id: "id" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"uiActionButtonsContainer\">\r\n <button\r\n *ngFor=\"let uiActionModel of uiActionModelsWithDescriptions\"\r\n mat-button\r\n [smartTooltip]=\"uiActionModel?.descriptor?.tooltip!\"\r\n [ngClass]=\"getType(uiActionModel)\"\r\n class=\"{{ uiActionModel.cssClass }}\"\r\n [color]=\"uiActionModel.descriptor?.color\"\r\n (click)=\"onActionClicked($event, uiActionModel)\"\r\n [disabled]=\"!!uiActionModel.uiAction.disabled\"\r\n (dblclick)=\"onActionDoubleClicked($event, uiActionModel)\"\r\n >\r\n <div *ngIf=\"isOnlyIcon(uiActionModel); then iconOnly; else text\"></div>\r\n <ng-template #iconOnly>\r\n <smart-icon\r\n *ngIf=\"uiActionModel.descriptor?.icon\"\r\n [icon]=\"uiActionModel.descriptor!.icon!\"\r\n [color]=\"uiActionModel.descriptor?.iconColor ?? uiActionModel.descriptor?.color\"\r\n ></smart-icon>\r\n </ng-template>\r\n <ng-template #text>\r\n <smart-icon\r\n *ngIf=\"\r\n uiActionModel.descriptor?.icon &&\r\n uiActionModel.descriptor?.iconPosition === iconPosition().PRE\r\n \"\r\n [icon]=\"uiActionModel.descriptor!.icon!\"\r\n [color]=\"uiActionModel.descriptor?.iconColor ?? uiActionModel.descriptor?.color\"\r\n ></smart-icon>\r\n {{ uiActionModel.descriptor?.title }}\r\n <smart-icon\r\n *ngIf=\"\r\n uiActionModel.descriptor?.icon &&\r\n uiActionModel.descriptor?.iconPosition === iconPosition().POST\r\n \"\r\n [icon]=\"uiActionModel.descriptor!.icon!\"\r\n [color]=\"uiActionModel.descriptor?.iconColor ?? uiActionModel.descriptor?.color\"\r\n ></smart-icon>\r\n </ng-template>\r\n </button>\r\n</div>\r\n", styles: [".uiActionButtonsContainer{display:flex;flex-direction:row;gap:1rem;flex-wrap:wrap}\n"], components: [{ type: i3.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: SmartIconComponent, selector: "smart-icon", inputs: ["icon", "color"] }], directives: [{ type: i3$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: SmartTooltipDirective, selector: "[smartTooltip]", inputs: ["smartTooltip"] }, { type: i3$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
8587
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiActionToolbarComponent, decorators: [{
8600
+ UiActionFileUploadDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiActionFileUploadDialogComponent, deps: [{ token: UiActionFileUploadDialogService }, { token: UiActionDescriptorService }], target: i0.ɵɵFactoryTarget.Component });
8601
+ UiActionFileUploadDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: UiActionFileUploadDialogComponent, selector: "lib-ui-action-file-upload-dialog", ngImport: i0, template: "<div class=\"folderNameDialogContainer\">\r\n <div class=\"headerContainer\">\r\n <h3 class=\"color-accent-700\">\r\n {{ getTitle() }}\r\n </h3>\r\n <button mat-icon-button title=\"close\" (click)=\"cancel()\">\r\n <smart-icon [color]=\"'primary'\" [icon]=\"'X'\"></smart-icon>\r\n </button>\r\n </div>\r\n <p>\r\n {{ getText() }}\r\n </p>\r\n <smartfileuploader\r\n [i18n]=\"i18n\"\r\n [fileFormats]=\"fileFormats\"\r\n [maxSizeMb]=\"maxSizeMb\"\r\n [uploadCallback]=\"upload.bind(this)\"\r\n [isMultiple]=\"isMultiple\"\r\n ></smartfileuploader>\r\n <div class=\"folderNameDialogButtonsContainer\">\r\n <button mat-button color=\"accent\" [color]=\"getCancelButtonColor()\" (click)=\"cancel()\">\r\n {{ getCancelButtonLabel() }}\r\n </button>\r\n <!-- <button mat-raised-button [color]=\"getActionButtonColor()\" (click)=\"upload()\">\r\n {{ getActionButtonLabel() }}\r\n </button> -->\r\n </div>\r\n</div>\r\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: i3.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: SmartIconComponent, selector: "smart-icon", inputs: ["icon", "color"] }, { type: SmartfileuploaderComponent, selector: "smartfileuploader", inputs: ["uploadCallback", "fileFormats", "maxSizeMb", "i18n", "useIconButton", "isMultiple"] }] });
8602
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: UiActionFileUploadDialogComponent, decorators: [{
8588
8603
  type: Component,
8589
- args: [{ selector: 'smart-ui-action-toolbar', template: "<div class=\"uiActionButtonsContainer\">\r\n <button\r\n *ngFor=\"let uiActionModel of uiActionModelsWithDescriptions\"\r\n mat-button\r\n [smartTooltip]=\"uiActionModel?.descriptor?.tooltip!\"\r\n [ngClass]=\"getType(uiActionModel)\"\r\n class=\"{{ uiActionModel.cssClass }}\"\r\n [color]=\"uiActionModel.descriptor?.color\"\r\n (click)=\"onActionClicked($event, uiActionModel)\"\r\n [disabled]=\"!!uiActionModel.uiAction.disabled\"\r\n (dblclick)=\"onActionDoubleClicked($event, uiActionModel)\"\r\n >\r\n <div *ngIf=\"isOnlyIcon(uiActionModel); then iconOnly; else text\"></div>\r\n <ng-template #iconOnly>\r\n <smart-icon\r\n *ngIf=\"uiActionModel.descriptor?.icon\"\r\n [icon]=\"uiActionModel.descriptor!.icon!\"\r\n [color]=\"uiActionModel.descriptor?.iconColor ?? uiActionModel.descriptor?.color\"\r\n ></smart-icon>\r\n </ng-template>\r\n <ng-template #text>\r\n <smart-icon\r\n *ngIf=\"\r\n uiActionModel.descriptor?.icon &&\r\n uiActionModel.descriptor?.iconPosition === iconPosition().PRE\r\n \"\r\n [icon]=\"uiActionModel.descriptor!.icon!\"\r\n [color]=\"uiActionModel.descriptor?.iconColor ?? uiActionModel.descriptor?.color\"\r\n ></smart-icon>\r\n {{ uiActionModel.descriptor?.title }}\r\n <smart-icon\r\n *ngIf=\"\r\n uiActionModel.descriptor?.icon &&\r\n uiActionModel.descriptor?.iconPosition === iconPosition().POST\r\n \"\r\n [icon]=\"uiActionModel.descriptor!.icon!\"\r\n [color]=\"uiActionModel.descriptor?.iconColor ?? uiActionModel.descriptor?.color\"\r\n ></smart-icon>\r\n </ng-template>\r\n </button>\r\n</div>\r\n", styles: [".uiActionButtonsContainer{display:flex;flex-direction:row;gap:1rem;flex-wrap:wrap}\n"] }]
8590
- }], ctorParameters: function () { return [{ type: UiActionService }, { type: i0.Injector }]; }, propDecorators: { uiActionModels: [{
8591
- type: Input
8592
- }], uiActionDescriptorService: [{
8593
- type: Input
8594
- }], id: [{
8595
- type: Input
8596
- }] } });
8604
+ args: [{ selector: 'lib-ui-action-file-upload-dialog', template: "<div class=\"folderNameDialogContainer\">\r\n <div class=\"headerContainer\">\r\n <h3 class=\"color-accent-700\">\r\n {{ getTitle() }}\r\n </h3>\r\n <button mat-icon-button title=\"close\" (click)=\"cancel()\">\r\n <smart-icon [color]=\"'primary'\" [icon]=\"'X'\"></smart-icon>\r\n </button>\r\n </div>\r\n <p>\r\n {{ getText() }}\r\n </p>\r\n <smartfileuploader\r\n [i18n]=\"i18n\"\r\n [fileFormats]=\"fileFormats\"\r\n [maxSizeMb]=\"maxSizeMb\"\r\n [uploadCallback]=\"upload.bind(this)\"\r\n [isMultiple]=\"isMultiple\"\r\n ></smartfileuploader>\r\n <div class=\"folderNameDialogButtonsContainer\">\r\n <button mat-button color=\"accent\" [color]=\"getCancelButtonColor()\" (click)=\"cancel()\">\r\n {{ getCancelButtonLabel() }}\r\n </button>\r\n <!-- <button mat-raised-button [color]=\"getActionButtonColor()\" (click)=\"upload()\">\r\n {{ getActionButtonLabel() }}\r\n </button> -->\r\n </div>\r\n</div>\r\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"] }]
8605
+ }], ctorParameters: function () { return [{ type: UiActionFileUploadDialogService }, { type: UiActionDescriptorService }]; } });
8597
8606
 
8598
8607
  class SmartViewContextModule {
8599
8608
  }
@@ -8623,6 +8632,9 @@ SmartViewContextModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0",
8623
8632
  multi: true,
8624
8633
  },
8625
8634
  { provide: DIALOG_DISABLE_CLOSE, useValue: true },
8635
+ { provide: 'confirmDialogService', useClass: UiActionConfirmDialogService },
8636
+ { provide: 'textFieldDialogService', useClass: UiActionInputDialogService },
8637
+ { provide: 'fileUploadDialogService', useClass: UiActionFileUploadDialogService },
8626
8638
  ], imports: [[
8627
8639
  CommonModule,
8628
8640
  HttpClientModule,
@@ -8669,6 +8681,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
8669
8681
  multi: true,
8670
8682
  },
8671
8683
  { provide: DIALOG_DISABLE_CLOSE, useValue: true },
8684
+ { provide: 'confirmDialogService', useClass: UiActionConfirmDialogService },
8685
+ { provide: 'textFieldDialogService', useClass: UiActionInputDialogService },
8686
+ { provide: 'fileUploadDialogService', useClass: UiActionFileUploadDialogService },
8672
8687
  ],
8673
8688
  }]
8674
8689
  }] });