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