@eurosat/buttons 9.0.0-alpha.1 → 12.0.0

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.
Files changed (40) hide show
  1. package/bundles/eurosat-buttons.umd.js +328 -646
  2. package/bundles/eurosat-buttons.umd.js.map +1 -1
  3. package/bundles/eurosat-buttons.umd.min.js +1 -1
  4. package/bundles/eurosat-buttons.umd.min.js.map +1 -1
  5. package/esm2015/eurosat-buttons.js +7 -12
  6. package/esm2015/lib/components/dialog-confirm/dialog-confirm.component.js +56 -98
  7. package/esm2015/lib/components/dialog-form/dialog-form.component.js +38 -68
  8. package/esm2015/lib/components/dialog-result.js +2 -16
  9. package/esm2015/lib/es-buttons.component.js +198 -327
  10. package/esm2015/lib/es-buttons.module.js +41 -46
  11. package/esm2015/lib/model/es-button-action.js +13 -42
  12. package/esm2015/lib/model/es-button-server-response.js +2 -16
  13. package/esm2015/lib/model/es-button.interface.js +2 -34
  14. package/esm2015/public_api.js +9 -14
  15. package/eurosat-buttons.d.ts +6 -6
  16. package/eurosat-buttons.metadata.json +1 -1
  17. package/fesm2015/eurosat-buttons.js +305 -594
  18. package/fesm2015/eurosat-buttons.js.map +1 -1
  19. package/lib/components/dialog-confirm/dialog-confirm.component.d.ts +15 -15
  20. package/lib/components/dialog-form/dialog-form.component.d.ts +15 -15
  21. package/lib/components/dialog-result.d.ts +4 -4
  22. package/lib/es-buttons.component.d.ts +39 -39
  23. package/lib/es-buttons.module.d.ts +2 -2
  24. package/lib/model/es-button-action.d.ts +12 -12
  25. package/lib/model/es-button-server-response.d.ts +5 -5
  26. package/lib/model/es-button.interface.d.ts +14 -14
  27. package/package.json +8 -10
  28. package/public_api.d.ts +5 -5
  29. package/esm5/eurosat-buttons.js +0 -12
  30. package/esm5/lib/components/dialog-confirm/dialog-confirm.component.js +0 -99
  31. package/esm5/lib/components/dialog-form/dialog-form.component.js +0 -73
  32. package/esm5/lib/components/dialog-result.js +0 -16
  33. package/esm5/lib/es-buttons.component.js +0 -374
  34. package/esm5/lib/es-buttons.module.js +0 -50
  35. package/esm5/lib/model/es-button-action.js +0 -46
  36. package/esm5/lib/model/es-button-server-response.js +0 -16
  37. package/esm5/lib/model/es-button.interface.js +0 -34
  38. package/esm5/public_api.js +0 -14
  39. package/fesm5/eurosat-buttons.js +0 -683
  40. package/fesm5/eurosat-buttons.js.map +0 -1
@@ -1,661 +1,343 @@
1
1
  (function (global, factory) {
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/router'), require('@angular/material/snack-bar'), require('@eurosat/snackbar'), require('@eurosat/http'), require('@eurosat/icon'), require('@angular/material/dialog'), require('@eurosat/dialog'), require('@eurosat/form'), require('rxjs/internal/operators'), require('@angular/common'), require('@angular/material/button'), require('@angular/material/menu'), require('@angular/material/tooltip'), require('@ngx-translate/core')) :
3
3
  typeof define === 'function' && define.amd ? define('@eurosat/buttons', ['exports', '@angular/core', '@angular/router', '@angular/material/snack-bar', '@eurosat/snackbar', '@eurosat/http', '@eurosat/icon', '@angular/material/dialog', '@eurosat/dialog', '@eurosat/form', 'rxjs/internal/operators', '@angular/common', '@angular/material/button', '@angular/material/menu', '@angular/material/tooltip', '@ngx-translate/core'], factory) :
4
- (global = global || self, factory((global.eurosat = global.eurosat || {}, global.eurosat.buttons = {}), global.ng.core, global.ng.router, global.ng.material.snackBar, global.snackbar, global.http, global.icon, global.ng.material.dialog, global.dialog$1, global.form, global.rxjs['internal/operators'], global.ng.common, global.ng.material.button, global.ng.material.menu, global.ng.material.tooltip, global.core$1));
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.eurosat = global.eurosat || {}, global.eurosat.buttons = {}), global.ng.core, global.ng.router, global.ng.material.snackBar, global.snackbar, global.http, global.icon, global.ng.material.dialog, global.dialog$1, global.form, global.rxjs['internal/operators'], global.ng.common, global.ng.material.button, global.ng.material.menu, global.ng.material.tooltip, global.core$1));
5
5
  }(this, (function (exports, core, router, snackBar, snackbar, http, icon, dialog, dialog$1, form, operators, common, button, menu, tooltip, core$1) { 'use strict';
6
6
 
7
- /**
8
- * @fileoverview added by tsickle
9
- * Generated from: lib/model/es-button-action.ts
10
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
11
- */
12
- var EsButtonAction = /** @class */ (function () {
13
- function EsButtonAction() {
14
- }
15
- EsButtonAction.ACTION_DIALOG_CONFIRM = 'dialog-confirm';
16
- EsButtonAction.ACTION_DIALOG_DELETE = 'dialog-delete';
17
- EsButtonAction.ACTION_DIALOG_FORM = 'dialog-form';
18
- EsButtonAction.ACTION_CARD_CONTENT_FORM = 'card-content-form';
19
- EsButtonAction.ACTION_CARD_CONTENT_WIZARD = 'card-content-wizard'; // todo asi zrusit
20
- // todo asi zrusit
21
- EsButtonAction.ACTION_CHANGE_CARD_CONTENT = 'change-card-content'; // mozna zrusit ? je kuli neemitu clicku na button
22
- // mozna zrusit ? je kuli neemitu clicku na button
23
- EsButtonAction.ACTION_DOWNLOAD = 'download';
24
- EsButtonAction.ACTION_REQUEST = 'request';
25
- EsButtonAction.ACTION_ROUTER_NAVIGATE = 'router-navigate';
26
- EsButtonAction.ACTION_WINDOW_LOCATION = 'open-link';
27
- return EsButtonAction;
28
- }());
29
- if (false) {
30
- /** @type {?} */
31
- EsButtonAction.ACTION_DIALOG_CONFIRM;
32
- /** @type {?} */
33
- EsButtonAction.ACTION_DIALOG_DELETE;
34
- /** @type {?} */
35
- EsButtonAction.ACTION_DIALOG_FORM;
36
- /** @type {?} */
37
- EsButtonAction.ACTION_CARD_CONTENT_FORM;
38
- /** @type {?} */
39
- EsButtonAction.ACTION_CARD_CONTENT_WIZARD;
40
- /** @type {?} */
41
- EsButtonAction.ACTION_CHANGE_CARD_CONTENT;
42
- /** @type {?} */
43
- EsButtonAction.ACTION_DOWNLOAD;
44
- /** @type {?} */
45
- EsButtonAction.ACTION_REQUEST;
46
- /** @type {?} */
47
- EsButtonAction.ACTION_ROUTER_NAVIGATE;
48
- /** @type {?} */
49
- EsButtonAction.ACTION_WINDOW_LOCATION;
50
- }
7
+ var EsButtonAction = /** @class */ (function () {
8
+ function EsButtonAction() {
9
+ }
10
+ return EsButtonAction;
11
+ }());
12
+ EsButtonAction.ACTION_DIALOG_CONFIRM = 'dialog-confirm';
13
+ EsButtonAction.ACTION_DIALOG_DELETE = 'dialog-delete';
14
+ EsButtonAction.ACTION_DIALOG_FORM = 'dialog-form';
15
+ EsButtonAction.ACTION_CARD_CONTENT_FORM = 'card-content-form';
16
+ EsButtonAction.ACTION_CARD_CONTENT_WIZARD = 'card-content-wizard'; // todo asi zrusit
17
+ EsButtonAction.ACTION_CHANGE_CARD_CONTENT = 'change-card-content'; // mozna zrusit ? je kuli neemitu clicku na button
18
+ EsButtonAction.ACTION_DOWNLOAD = 'download';
19
+ EsButtonAction.ACTION_REQUEST = 'request';
20
+ EsButtonAction.ACTION_ROUTER_NAVIGATE = 'router-navigate';
21
+ EsButtonAction.ACTION_WINDOW_LOCATION = 'open-link';
51
22
 
52
- /**
53
- * @fileoverview added by tsickle
54
- * Generated from: lib/components/dialog-confirm/dialog-confirm.component.ts
55
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
56
- */
57
- var DialogConfirmComponent = /** @class */ (function () {
58
- function DialogConfirmComponent(dialogRef, snackBar, ds) {
59
- this.dialogRef = dialogRef;
60
- this.snackBar = snackBar;
61
- this.ds = ds;
62
- this.submit = new core.EventEmitter();
63
- this.activeRequest = false;
64
- /** @type {?} */
65
- var data = this.ds.getData();
66
- this.message = data.message;
67
- this.url = data.url;
68
- }
69
- /**
70
- * @return {?}
71
- */
72
- DialogConfirmComponent.prototype.confirm = /**
73
- * @return {?}
74
- */
75
- function () {
76
- var _this = this;
77
- this.activeRequest = true;
78
- this.ds.httpPost(this.url, null).subscribe((/**
79
- * @param {?} response
80
- * @return {?}
81
- */
82
- function (response) {
83
- _this.activeRequest = false;
84
- /** @type {?} */
85
- var config = new snackBar.MatSnackBarConfig();
86
- config.duration = 2000;
87
- if (response.type === form.EsFormResponseMessageType.TYPE_OK) {
88
- config.panelClass = snackbar.EsSnackBarPanelClass.SUCCESS;
89
- _this.submit.emit();
90
- }
91
- else {
92
- config.panelClass = snackbar.EsSnackBarPanelClass.DANGER;
93
- }
94
- _this.snackBar.open(response.message, null, config);
95
- /** @type {?} */
96
- var result = {
97
- clickedYes: true,
98
- serverResponse: response
99
- };
100
- _this.dialogRef.close(result);
101
- }));
102
- };
103
- DialogConfirmComponent.decorators = [
104
- { type: core.Component, args: [{
105
- selector: 'dialog-confirm',
106
- template: "<p>{{message}}</p>\r\n<div class=\"button-container\">\r\n <mat-spinner *ngIf=\"activeRequest\" [diameter]=\"36\"></mat-spinner>\r\n <ng-container *ngIf=\"!activeRequest\">\r\n <button type=\"button\"\r\n color=\"accent\"\r\n mat-raised-button\r\n (click)=\"confirm()\"> {{'an.common.ano' | translate}}\r\n </button>\r\n <button type=\"button\"\r\n color=\"accent\"\r\n mat-raised-button\r\n (click)=\"dialogRef.close({clickedYes: false})\">{{'an.common.ne' | translate}}\r\n </button>\r\n </ng-container>\r\n</div>\r\n",
107
- styles: ["button:not(:last-child){margin-right:20px}.button-container{min-height:36px;min-width:196px;position:relative;text-align:center}.button-container mat-spinner{position:absolute!important;left:calc(50% - 18px);top:calc(50% - 18px)}"]
108
- }] }
109
- ];
110
- /** @nocollapse */
111
- DialogConfirmComponent.ctorParameters = function () { return [
112
- { type: dialog.MatDialogRef },
113
- { type: snackBar.MatSnackBar },
114
- { type: dialog$1.EsDialogService }
115
- ]; };
116
- DialogConfirmComponent.propDecorators = {
117
- submit: [{ type: core.Output }]
118
- };
119
- return DialogConfirmComponent;
120
- }());
121
- if (false) {
122
- /** @type {?} */
123
- DialogConfirmComponent.prototype.submit;
124
- /** @type {?} */
125
- DialogConfirmComponent.prototype.message;
126
- /** @type {?} */
127
- DialogConfirmComponent.prototype.url;
128
- /** @type {?} */
129
- DialogConfirmComponent.prototype.activeRequest;
130
- /** @type {?} */
131
- DialogConfirmComponent.prototype.dialogRef;
132
- /**
133
- * @type {?}
134
- * @private
135
- */
136
- DialogConfirmComponent.prototype.snackBar;
137
- /**
138
- * @type {?}
139
- * @private
140
- */
141
- DialogConfirmComponent.prototype.ds;
142
- }
23
+ var DialogConfirmComponent = /** @class */ (function () {
24
+ function DialogConfirmComponent(dialogRef, snackBar, ds) {
25
+ this.dialogRef = dialogRef;
26
+ this.snackBar = snackBar;
27
+ this.ds = ds;
28
+ this.submit = new core.EventEmitter();
29
+ this.activeRequest = false;
30
+ var data = this.ds.getData();
31
+ this.message = data.message;
32
+ this.url = data.url;
33
+ }
34
+ DialogConfirmComponent.prototype.confirm = function () {
35
+ var _this = this;
36
+ this.activeRequest = true;
37
+ this.ds.httpPost(this.url, null).subscribe(function (response) {
38
+ _this.activeRequest = false;
39
+ var config = new snackBar.MatSnackBarConfig();
40
+ config.duration = 2000;
41
+ if (response.type === form.EsFormResponseMessageType.TYPE_OK) {
42
+ config.panelClass = snackbar.EsSnackBarPanelClass.SUCCESS;
43
+ _this.submit.emit();
44
+ }
45
+ else {
46
+ config.panelClass = snackbar.EsSnackBarPanelClass.DANGER;
47
+ }
48
+ _this.snackBar.open(response.message, null, config);
49
+ var result = {
50
+ clickedYes: true,
51
+ serverResponse: response
52
+ };
53
+ _this.dialogRef.close(result);
54
+ });
55
+ };
56
+ return DialogConfirmComponent;
57
+ }());
58
+ DialogConfirmComponent.decorators = [
59
+ { type: core.Component, args: [{
60
+ selector: 'dialog-confirm',
61
+ template: "<p>{{message}}</p>\n<div class=\"button-container\">\n <mat-spinner *ngIf=\"activeRequest\" [diameter]=\"36\"></mat-spinner>\n <ng-container *ngIf=\"!activeRequest\">\n <button type=\"button\"\n color=\"accent\"\n mat-raised-button\n (click)=\"confirm()\"> {{'an.common.ano' | translate}}\n </button>\n <button type=\"button\"\n color=\"accent\"\n mat-raised-button\n (click)=\"dialogRef.close({clickedYes: false})\">{{'an.common.ne' | translate}}\n </button>\n </ng-container>\n</div>\n",
62
+ styles: ["button:not(:last-child){margin-right:20px}.button-container{min-height:36px;min-width:196px;position:relative;text-align:center}.button-container mat-spinner{position:absolute!important;left:calc(50% - 18px);top:calc(50% - 18px)}"]
63
+ },] }
64
+ ];
65
+ /** @nocollapse */
66
+ DialogConfirmComponent.ctorParameters = function () { return [
67
+ { type: dialog.MatDialogRef },
68
+ { type: snackBar.MatSnackBar },
69
+ { type: dialog$1.EsDialogService }
70
+ ]; };
71
+ DialogConfirmComponent.propDecorators = {
72
+ submit: [{ type: core.Output }]
73
+ };
143
74
 
144
- /**
145
- * @fileoverview added by tsickle
146
- * Generated from: lib/components/dialog-form/dialog-form.component.ts
147
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
148
- */
149
- var DialogFormComponent = /** @class */ (function () {
150
- function DialogFormComponent(dialogRef, ds) {
151
- this.dialogRef = dialogRef;
152
- this.cols = 1;
153
- this.maxFormHeight = window.innerHeight - 60;
154
- /** @type {?} */
155
- var data = ds.getData();
156
- this.formUrl = data.url;
157
- }
158
- /**
159
- * @param {?} value
160
- * @return {?}
161
- */
162
- DialogFormComponent.prototype.submit = /**
163
- * @param {?} value
164
- * @return {?}
165
- */
166
- function (value) {
167
- // sem se to dostane jen pri success ulozeni formu
168
- /** @type {?} */
169
- var result = {
170
- clickedYes: true
171
- };
172
- this.dialogRef.close(result);
173
- // pokud bysme chteli form.value
174
- // this.dialogRef.close(value);
175
- // console.log('form value v parent', value);
176
- };
177
- /**
178
- * @return {?}
179
- */
180
- DialogFormComponent.prototype.getWindowHeight = /**
181
- * @return {?}
182
- */
183
- function () {
184
- this.maxFormHeight = window.innerHeight - 60;
185
- };
186
- DialogFormComponent.decorators = [
187
- { type: core.Component, args: [{
188
- selector: 'dialog-form',
189
- template: "<div class=\"es-form-container\" [style.max-height]=\"(maxFormHeight - 106) + 'px'\">\r\n <es-form [formUrl]=\"formUrl\"\r\n [dynamicForm]=\"esForm\"\r\n [cols]=\"cols\"\r\n (submit)=\"submit($event)\">\r\n </es-form>\r\n</div>\r\n",
190
- styles: [".es-form-container{overflow:auto;margin-top:24px;position:relative}"]
191
- }] }
192
- ];
193
- /** @nocollapse */
194
- DialogFormComponent.ctorParameters = function () { return [
195
- { type: dialog.MatDialogRef },
196
- { type: dialog$1.EsDialogService }
197
- ]; };
198
- return DialogFormComponent;
199
- }());
200
- if (false) {
201
- /** @type {?} */
202
- DialogFormComponent.prototype.formUrl;
203
- /** @type {?} */
204
- DialogFormComponent.prototype.cols;
205
- /** @type {?} */
206
- DialogFormComponent.prototype.esForm;
207
- /** @type {?} */
208
- DialogFormComponent.prototype.maxFormHeight;
209
- /** @type {?} */
210
- DialogFormComponent.prototype.dialogRef;
211
- }
75
+ var DialogFormComponent = /** @class */ (function () {
76
+ function DialogFormComponent(dialogRef, ds) {
77
+ this.dialogRef = dialogRef;
78
+ this.cols = 1;
79
+ this.maxFormHeight = window.innerHeight - 60;
80
+ var data = ds.getData();
81
+ this.formUrl = data.url;
82
+ }
83
+ DialogFormComponent.prototype.submit = function (value) {
84
+ // sem se to dostane jen pri success ulozeni formu
85
+ var result = {
86
+ clickedYes: true
87
+ };
88
+ this.dialogRef.close(result);
89
+ // pokud bysme chteli form.value
90
+ // this.dialogRef.close(value);
91
+ // console.log('form value v parent', value);
92
+ };
93
+ DialogFormComponent.prototype.getWindowHeight = function () {
94
+ this.maxFormHeight = window.innerHeight - 60;
95
+ };
96
+ return DialogFormComponent;
97
+ }());
98
+ DialogFormComponent.decorators = [
99
+ { type: core.Component, args: [{
100
+ selector: 'dialog-form',
101
+ template: "<div class=\"es-form-container\" [style.max-height]=\"(maxFormHeight - 106) + 'px'\">\n <es-form [formUrl]=\"formUrl\"\n [dynamicForm]=\"esForm\"\n [cols]=\"cols\"\n (submit)=\"submit($event)\">\n </es-form>\n</div>\n",
102
+ styles: [".es-form-container{overflow:auto;margin-top:24px;position:relative}"]
103
+ },] }
104
+ ];
105
+ /** @nocollapse */
106
+ DialogFormComponent.ctorParameters = function () { return [
107
+ { type: dialog.MatDialogRef },
108
+ { type: dialog$1.EsDialogService }
109
+ ]; };
212
110
 
213
- /**
214
- * @fileoverview added by tsickle
215
- * Generated from: lib/es-buttons.component.ts
216
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
217
- */
218
- // todo translates
219
- var EsButtonsComponent = /** @class */ (function () {
220
- function EsButtonsComponent(router, dialog, snackBar, http) {
221
- this.router = router;
222
- this.dialog = dialog;
223
- this.snackBar = snackBar;
224
- this.http = http;
225
- this.parentWidth = 40; // default 40 = 1 button
226
- // default 40 = 1 button
227
- this.buttons = []; // normal input
228
- // normal input
229
- this.forceMenu = false; // pokud chci zobrazit ... menu i pro jeden buttonek, na realtimu pouzito
230
- // pokud chci zobrazit ... menu i pro jeden buttonek, na realtimu pouzito
231
- this.buttonClick = new core.EventEmitter();
232
- this.reload = new core.EventEmitter();
233
- this.dialogCreated = new core.EventEmitter();
234
- this.serverResponse = new core.EventEmitter();
235
- this.menuVisible = false;
236
- this.buttonWidth = 40; // todo ViewChild, sirka buttonu ?
237
- // todo ViewChild, sirka buttonu ?
238
- this.visibleButtons = [];
239
- this.hiddenButtons = [];
240
- this.esIcon = icon.EsIcon;
241
- this._width = 0;
242
- }
243
- /**
244
- * @return {?}
245
- */
246
- EsButtonsComponent.prototype.showMenu = /**
247
- * @return {?}
248
- */
249
- function () {
250
- return this.getHiddenButtons() && this.getHiddenButtons().length > 0 && this.getHiddenButtons().length !== 1;
251
- };
252
- /**
253
- * @return {?}
254
- */
255
- EsButtonsComponent.prototype.countVisible = /**
256
- * @return {?}
257
- */
258
- function () {
259
- return Math.floor((this._width) / this.buttonWidth) - 1;
260
- };
261
- /**
262
- * @return {?}
263
- */
264
- EsButtonsComponent.prototype.getVisibleButtons = /**
265
- * @return {?}
266
- */
267
- function () {
268
- var _this = this;
269
- if (this.buttons && this.buttons.length > 0) {
270
- return this.buttons.filter((/**
271
- * @param {?} button
272
- * @return {?}
273
- */
274
- function (button) {
275
- if (_this.buttons.indexOf(button) < _this.countVisible()
276
- || (_this.getHiddenButtons().length === 1 && !_this.forceMenu)) {
277
- return true;
278
- }
279
- }));
280
- }
281
- };
282
- /**
283
- * @return {?}
284
- */
285
- EsButtonsComponent.prototype.getHiddenButtons = /**
286
- * @return {?}
287
- */
288
- function () {
289
- var _this = this;
290
- if (this.buttons && this.buttons.length > 0) {
291
- return this.buttons.filter((/**
292
- * @param {?} button
293
- * @return {?}
294
- */
295
- function (button) {
296
- if (_this.buttons.indexOf(button) >= _this.countVisible()) {
297
- return true;
298
- }
299
- }));
300
- }
301
- };
302
- /**
303
- * @param {?} simpleChange
304
- * @return {?}
305
- */
306
- EsButtonsComponent.prototype.ngOnChanges = /**
307
- * @param {?} simpleChange
308
- * @return {?}
309
- */
310
- function (simpleChange) {
311
- if (simpleChange['parentWidth']) {
312
- if (this.parentWidth > 0) {
313
- this._width = this.parentWidth;
314
- this.recalculateButtons();
315
- }
316
- }
317
- if (simpleChange['buttons']) {
318
- if (typeof this.buttons === 'string') {
319
- this.buttons = JSON.parse(this.buttons);
320
- }
321
- this.recalculateButtons();
322
- }
323
- };
324
- /**
325
- * @return {?}
326
- */
327
- EsButtonsComponent.prototype.recalculateButtons = /**
328
- * @return {?}
329
- */
330
- function () {
331
- this.menuVisible = this.showMenu();
332
- this.visibleButtons = this.getVisibleButtons();
333
- this.hiddenButtons = this.getHiddenButtons();
334
- };
335
- /**
336
- * @param {?} button
337
- * @return {?}
338
- */
339
- EsButtonsComponent.prototype.handleAction = /**
340
- * @param {?} button
341
- * @return {?}
342
- */
343
- function (button) {
344
- var _this = this;
345
- if (button.action === EsButtonAction.ACTION_DIALOG_CONFIRM) {
346
- this.openConfirm(button);
347
- }
348
- if (button.action === EsButtonAction.ACTION_DIALOG_DELETE) {
349
- this.openDelete(button);
350
- }
351
- if (button.action === EsButtonAction.ACTION_DIALOG_FORM) {
352
- this.openForm(button);
353
- }
354
- if (button.action === EsButtonAction.ACTION_DOWNLOAD) {
355
- this.http.get(button.url, { responseType: 'blob', observe: 'response' }).subscribe((/**
356
- * @param {?} response
357
- * @return {?}
358
- */
359
- function (response) {
360
- /** @type {?} */
361
- var filename = response.headers.get('Content-Disposition').split('filename=')[1];
362
- if (window.navigator && window.navigator.msSaveOrOpenBlob) {
363
- window.navigator.msSaveBlob(response.body, filename);
364
- }
365
- else {
366
- /** @type {?} */
367
- var link = document.createElement('a');
368
- link.setAttribute('href', window.URL.createObjectURL(response.body));
369
- link.setAttribute('download', filename);
370
- link.style.visibility = 'hidden';
371
- document.body.appendChild(link);
372
- link.click();
373
- document.body.removeChild(link);
374
- }
375
- }));
376
- }
377
- if (button.action === EsButtonAction.ACTION_REQUEST) {
378
- this.http.get(button.url).subscribe((/**
379
- * @param {?} response
380
- * @return {?}
381
- */
382
- function (response) {
383
- /** @type {?} */
384
- var config = new snackBar.MatSnackBarConfig();
385
- config.duration = 2000;
386
- if (response.type === form.EsFormResponseMessageType.TYPE_OK) {
387
- config.panelClass = snackbar.EsSnackBarPanelClass.SUCCESS;
388
- }
389
- else {
390
- config.panelClass = snackbar.EsSnackBarPanelClass.DANGER;
391
- }
392
- _this.snackBar.open(response.message, null, config);
393
- _this.reload.emit(true);
394
- _this.serverResponse.emit({ button: button, response: response });
395
- }));
396
- }
397
- if (button.action === EsButtonAction.ACTION_ROUTER_NAVIGATE) {
398
- this.router.navigateByUrl(button.url);
399
- }
400
- if (button.action === EsButtonAction.ACTION_WINDOW_LOCATION) {
401
- window.location.href = button.url;
402
- }
403
- this.buttonClick.emit(button);
404
- };
405
- // handleSubMenuAction(button: EsButton) {
406
- // // todo asi predelat na md2 menu
407
- // // todo nevim jestli se zpropaguje click kdyz je to zanoreny pres es-card-header
408
- // this.buttonClick.emit(button);
409
- // }
410
- // handleSubMenuAction(button: EsButton) {
411
- // // todo asi predelat na md2 menu
412
- // // todo nevim jestli se zpropaguje click kdyz je to zanoreny pres es-card-header
413
- // this.buttonClick.emit(button);
414
- // }
415
- /**
416
- * @param {?} button
417
- * @return {?}
418
- */
419
- EsButtonsComponent.prototype.openForm =
420
- // handleSubMenuAction(button: EsButton) {
421
- // // todo asi predelat na md2 menu
422
- // // todo nevim jestli se zpropaguje click kdyz je to zanoreny pres es-card-header
423
- // this.buttonClick.emit(button);
424
- // }
425
- /**
426
- * @param {?} button
427
- * @return {?}
428
- */
429
- function (button) {
430
- var _this = this;
431
- /** @type {?} */
432
- var config = {
433
- title: button.title,
434
- data: {
435
- url: button.url
436
- }
437
- };
438
- /** @type {?} */
439
- var dialogRef = this.dialog.open(DialogFormComponent, config);
440
- this.dialogCreated.emit(dialogRef);
441
- dialogRef.afterClosed().pipe(operators.take(1)).subscribe((/**
442
- * @param {?} res
443
- * @return {?}
444
- */
445
- function (res) {
446
- if (res && res.clickedYes) {
447
- _this.reload.emit(true);
448
- if (res.serverResponse) {
449
- _this.serverResponse.emit({ button: button, response: res.serverResponse });
450
- }
451
- }
452
- }));
453
- };
454
- /**
455
- * @param {?} button
456
- * @return {?}
457
- */
458
- EsButtonsComponent.prototype.openDelete = /**
459
- * @param {?} button
460
- * @return {?}
461
- */
462
- function (button) {
463
- this.openConfirm(button);
464
- };
465
- /**
466
- * @param {?} button
467
- * @return {?}
468
- */
469
- EsButtonsComponent.prototype.openConfirm = /**
470
- * @param {?} button
471
- * @return {?}
472
- */
473
- function (button) {
474
- var _this = this;
475
- /** @type {?} */
476
- var config = {
477
- title: button.title,
478
- data: {
479
- message: button.message,
480
- url: button.url
481
- }
482
- };
483
- /** @type {?} */
484
- var dialogRef = this.dialog.open(DialogConfirmComponent, config);
485
- this.dialogCreated.emit(dialogRef);
486
- dialogRef.afterClosed().pipe(operators.take(1)).subscribe((/**
487
- * @param {?} res
488
- * @return {?}
489
- */
490
- function (res) {
491
- if (res && res.clickedYes) {
492
- _this.reload.emit(true);
493
- if (res.serverResponse) {
494
- _this.serverResponse.emit({ button: button, response: res.serverResponse });
495
- }
496
- }
497
- }));
498
- };
499
- EsButtonsComponent.decorators = [
500
- { type: core.Component, args: [{
501
- selector: 'es-buttons',
502
- template: "<ng-container *ngIf=\"visibleButtons && visibleButtons.length > 0\">\r\n <button *ngIf=\"visibleButtons.length > 0\"\r\n mat-icon-button\r\n [disabled]=\"visibleButtons[0].disabled === true\"\r\n [matTooltip]=\"visibleButtons[0].tooltip? visibleButtons[0].tooltip : visibleButtons[0].title\"\r\n (click)=\"handleAction(visibleButtons[0])\">\r\n <es-icon [color]=\"visibleButtons[0].color\"\r\n [themeColor]=\"visibleButtons[0].themeColor\"\r\n [icon]=\"visibleButtons[0].icon\"></es-icon>\r\n </button>\r\n <button *ngIf=\"visibleButtons.length > 1\"\r\n mat-icon-button\r\n [disabled]=\"visibleButtons[1].disabled === true\"\r\n [matTooltip]=\"visibleButtons[1].tooltip? visibleButtons[1].tooltip : visibleButtons[1].title\"\r\n (click)=\"handleAction(visibleButtons[1])\">\r\n <es-icon [color]=\"visibleButtons[1].color\"\r\n [themeColor]=\"visibleButtons[1].themeColor\"\r\n [icon]=\"visibleButtons[1].icon\"></es-icon>\r\n </button>\r\n <button *ngIf=\"visibleButtons.length > 2\"\r\n mat-icon-button\r\n [disabled]=\"visibleButtons[2].disabled === true\"\r\n [matTooltip]=\"visibleButtons[2].tooltip? visibleButtons[2].tooltip : visibleButtons[2].title\"\r\n (click)=\"handleAction(visibleButtons[2])\">\r\n <es-icon [color]=\"visibleButtons[2].color\"\r\n [themeColor]=\"visibleButtons[2].themeColor\"\r\n [icon]=\"visibleButtons[2].icon\"></es-icon>\r\n </button>\r\n <button *ngIf=\"visibleButtons.length > 3\"\r\n mat-icon-button\r\n [disabled]=\"visibleButtons[3].disabled === true\"\r\n [matTooltip]=\"visibleButtons[3].tooltip? visibleButtons[3].tooltip : visibleButtons[3].title\"\r\n (click)=\"handleAction(visibleButtons[3])\">\r\n <es-icon [color]=\"visibleButtons[3].color\"\r\n [themeColor]=\"visibleButtons[3].themeColor\"\r\n [icon]=\"visibleButtons[3].icon\"></es-icon>\r\n </button>\r\n <button *ngIf=\"visibleButtons.length > 4\"\r\n mat-icon-button\r\n [disabled]=\"visibleButtons[4].disabled === true\"\r\n [matTooltip]=\"visibleButtons[4].tooltip? visibleButtons[4].tooltip : visibleButtons[4].title\"\r\n (click)=\"handleAction(visibleButtons[4])\">\r\n <es-icon [color]=\"visibleButtons[4].color\"\r\n [themeColor]=\"visibleButtons[4].themeColor\"\r\n [icon]=\"visibleButtons[4].icon\"></es-icon>\r\n </button>\r\n <button *ngIf=\"visibleButtons.length > 5\"\r\n mat-icon-button\r\n [disabled]=\"visibleButtons[5].disabled === true\"\r\n [matTooltip]=\"visibleButtons[5].tooltip? visibleButtons[5].tooltip : visibleButtons[5].title\"\r\n (click)=\"handleAction(visibleButtons[5])\">\r\n <es-icon [color]=\"visibleButtons[5].color\"\r\n [themeColor]=\"visibleButtons[5].themeColor\"\r\n [icon]=\"visibleButtons[5].icon\"></es-icon>\r\n </button>\r\n <button *ngIf=\"visibleButtons.length > 6\"\r\n mat-icon-button\r\n [disabled]=\"visibleButtons[6].disabled === true\"\r\n [matTooltip]=\"visibleButtons[6].tooltip? visibleButtons[6].tooltip : visibleButtons[6].title\"\r\n (click)=\"handleAction(visibleButtons[6])\">\r\n <es-icon [color]=\"visibleButtons[6].color\"\r\n [themeColor]=\"visibleButtons[6].themeColor\"\r\n [icon]=\"visibleButtons[6].icon\"></es-icon>\r\n </button>\r\n <button *ngIf=\"visibleButtons.length > 7\"\r\n mat-icon-button\r\n [disabled]=\"visibleButtons[7].disabled === true\"\r\n [matTooltip]=\"visibleButtons[7].tooltip? visibleButtons[7].tooltip : visibleButtons[7].title\"\r\n (click)=\"handleAction(visibleButtons[7])\">\r\n <es-icon [color]=\"visibleButtons[7].color\"\r\n [themeColor]=\"visibleButtons[7].themeColor\"\r\n [icon]=\"visibleButtons[7].icon\"></es-icon>\r\n </button>\r\n <button *ngIf=\"visibleButtons.length > 8\"\r\n mat-icon-button\r\n [disabled]=\"visibleButtons[8].disabled === true\"\r\n [matTooltip]=\"visibleButtons[8].tooltip? visibleButtons[8].tooltip : visibleButtons[8].title\"\r\n (click)=\"handleAction(visibleButtons[8])\">\r\n <es-icon [color]=\"visibleButtons[8].color\"\r\n [themeColor]=\"visibleButtons[8].themeColor\"\r\n [icon]=\"visibleButtons[8].icon\"></es-icon>\r\n </button>\r\n <button *ngIf=\"visibleButtons.length > 9\"\r\n mat-icon-button\r\n [disabled]=\"visibleButtons[9].disabled === true\"\r\n [matTooltip]=\"visibleButtons[9].tooltip? visibleButtons[9].tooltip : visibleButtons[9].title\"\r\n (click)=\"handleAction(visibleButtons[9])\">\r\n <es-icon [color]=\"visibleButtons[9].color\"\r\n [themeColor]=\"visibleButtons[9].themeColor\"\r\n [icon]=\"visibleButtons[9].icon\"></es-icon>\r\n </button>\r\n</ng-container>\r\n\r\n\r\n<button *ngIf=\"menuVisible || forceMenu\"\r\n mat-icon-button\r\n [matMenuTriggerFor]=\"menu\"\r\n [matTooltip]=\"'an.more' | translate\">\r\n <es-icon [icon]=\"esIcon.MORE_VERT\"></es-icon>\r\n</button>\r\n\r\n\r\n<mat-menu #menu=\"matMenu\"\r\n [overlapTrigger]=\"false\"\r\n yPosition=\"below\"\r\n xPosition=\"before\">\r\n <ng-container *ngIf=\"hiddenButtons && hiddenButtons.length > 0\">\r\n <button *ngIf=\"hiddenButtons.length > 0\"\r\n mat-menu-item\r\n [disabled]=\"hiddenButtons[0].disabled === true\"\r\n (click)=\"handleAction(hiddenButtons[0])\">\r\n <es-icon [color]=\"hiddenButtons[0].color\"\r\n [themeColor]=\"hiddenButtons[0].themeColor\"\r\n [icon]=\"hiddenButtons[0].icon\"></es-icon>\r\n <span>{{hiddenButtons[0].title}}</span>\r\n </button>\r\n <button *ngIf=\"hiddenButtons.length > 1\"\r\n mat-menu-item\r\n [disabled]=\"hiddenButtons[1].disabled === true\"\r\n (click)=\"handleAction(hiddenButtons[1])\">\r\n <es-icon [color]=\"hiddenButtons[1].color\"\r\n [themeColor]=\"hiddenButtons[1].themeColor\"\r\n [icon]=\"hiddenButtons[1].icon\"></es-icon>\r\n <span>{{hiddenButtons[1].title}}</span>\r\n </button>\r\n <button *ngIf=\"hiddenButtons.length > 2\"\r\n mat-menu-item\r\n [disabled]=\"hiddenButtons[2].disabled === true\"\r\n (click)=\"handleAction(hiddenButtons[2])\">\r\n <es-icon [color]=\"hiddenButtons[2].color\"\r\n [themeColor]=\"hiddenButtons[2].themeColor\"\r\n [icon]=\"hiddenButtons[2].icon\"></es-icon>\r\n <span>{{hiddenButtons[2].title}}</span>\r\n </button>\r\n <button *ngIf=\"hiddenButtons.length > 3\"\r\n mat-menu-item\r\n [disabled]=\"hiddenButtons[3].disabled === true\"\r\n (click)=\"handleAction(hiddenButtons[3])\">\r\n <es-icon [color]=\"hiddenButtons[3].color\"\r\n [themeColor]=\"hiddenButtons[3].themeColor\"\r\n [icon]=\"hiddenButtons[3].icon\"></es-icon>\r\n <span>{{hiddenButtons[3].title}}</span>\r\n </button>\r\n <button *ngIf=\"hiddenButtons.length > 4\"\r\n mat-menu-item\r\n [disabled]=\"hiddenButtons[4].disabled === true\"\r\n (click)=\"handleAction(hiddenButtons[4])\">\r\n <es-icon [color]=\"hiddenButtons[4].color\"\r\n [themeColor]=\"hiddenButtons[4].themeColor\"\r\n [icon]=\"hiddenButtons[4].icon\"></es-icon>\r\n <span>{{hiddenButtons[4].title}}</span>\r\n </button>\r\n <button *ngIf=\"hiddenButtons.length > 5\"\r\n mat-menu-item\r\n [disabled]=\"hiddenButtons[5].disabled === true\"\r\n (click)=\"handleAction(hiddenButtons[5])\">\r\n <es-icon [color]=\"hiddenButtons[5].color\"\r\n [themeColor]=\"hiddenButtons[5].themeColor\"\r\n [icon]=\"hiddenButtons[5].icon\"></es-icon>\r\n <span>{{hiddenButtons[5].title}}</span>\r\n </button>\r\n <button *ngIf=\"hiddenButtons.length > 6\"\r\n mat-menu-item\r\n [disabled]=\"hiddenButtons[6].disabled === true\"\r\n (click)=\"handleAction(hiddenButtons[6])\">\r\n <es-icon [color]=\"hiddenButtons[6].color\"\r\n [themeColor]=\"hiddenButtons[6].themeColor\"\r\n [icon]=\"hiddenButtons[6].icon\"></es-icon>\r\n <span>{{hiddenButtons[6].title}}</span>\r\n </button>\r\n <button *ngIf=\"hiddenButtons.length > 7\"\r\n mat-menu-item\r\n [disabled]=\"hiddenButtons[7].disabled === true\"\r\n (click)=\"handleAction(hiddenButtons[7])\">\r\n <es-icon [color]=\"hiddenButtons[7].color\"\r\n [themeColor]=\"hiddenButtons[7].themeColor\"\r\n [icon]=\"hiddenButtons[7].icon\"></es-icon>\r\n <span>{{hiddenButtons[7].title}}</span>\r\n </button>\r\n <button *ngIf=\"hiddenButtons.length > 8\"\r\n mat-menu-item\r\n [disabled]=\"hiddenButtons[8].disabled === true\"\r\n (click)=\"handleAction(hiddenButtons[8])\">\r\n <es-icon [color]=\"hiddenButtons[8].color\"\r\n [themeColor]=\"hiddenButtons[8].themeColor\"\r\n [icon]=\"hiddenButtons[8].icon\"></es-icon>\r\n <span>{{hiddenButtons[8].title}}</span>\r\n </button>\r\n <button *ngIf=\"hiddenButtons.length > 9\"\r\n mat-menu-item\r\n [disabled]=\"hiddenButtons[9].disabled === true\"\r\n (click)=\"handleAction(hiddenButtons[9])\">\r\n <es-icon [color]=\"hiddenButtons[9].color\"\r\n [themeColor]=\"hiddenButtons[9].themeColor\"\r\n [icon]=\"hiddenButtons[9].icon\"></es-icon>\r\n <span>{{hiddenButtons[9].title}}</span>\r\n </button>\r\n </ng-container>\r\n</mat-menu>\r\n",
503
- changeDetection: core.ChangeDetectionStrategy.OnPush,
504
- styles: [":host{float:right}"]
505
- }] }
506
- ];
507
- /** @nocollapse */
508
- EsButtonsComponent.ctorParameters = function () { return [
509
- { type: router.Router },
510
- { type: dialog$1.EsDialogService },
511
- { type: snackBar.MatSnackBar },
512
- { type: http.HttpService }
513
- ]; };
514
- EsButtonsComponent.propDecorators = {
515
- parentWidth: [{ type: core.Input }],
516
- buttons: [{ type: core.Input }],
517
- forceMenu: [{ type: core.Input }],
518
- buttonClick: [{ type: core.Output }],
519
- reload: [{ type: core.Output }],
520
- dialogCreated: [{ type: core.Output }],
521
- serverResponse: [{ type: core.Output }]
522
- };
523
- return EsButtonsComponent;
524
- }());
525
- if (false) {
526
- /** @type {?} */
527
- EsButtonsComponent.prototype.parentWidth;
528
- /** @type {?} */
529
- EsButtonsComponent.prototype.buttons;
530
- /** @type {?} */
531
- EsButtonsComponent.prototype.forceMenu;
532
- /** @type {?} */
533
- EsButtonsComponent.prototype.buttonClick;
534
- /** @type {?} */
535
- EsButtonsComponent.prototype.reload;
536
- /** @type {?} */
537
- EsButtonsComponent.prototype.dialogCreated;
538
- /** @type {?} */
539
- EsButtonsComponent.prototype.serverResponse;
540
- /** @type {?} */
541
- EsButtonsComponent.prototype.menuVisible;
542
- /** @type {?} */
543
- EsButtonsComponent.prototype.buttonWidth;
544
- /** @type {?} */
545
- EsButtonsComponent.prototype.visibleButtons;
546
- /** @type {?} */
547
- EsButtonsComponent.prototype.hiddenButtons;
548
- /** @type {?} */
549
- EsButtonsComponent.prototype.esIcon;
550
- /** @type {?} */
551
- EsButtonsComponent.prototype._width;
552
- /**
553
- * @type {?}
554
- * @private
555
- */
556
- EsButtonsComponent.prototype.router;
557
- /**
558
- * @type {?}
559
- * @private
560
- */
561
- EsButtonsComponent.prototype.dialog;
562
- /**
563
- * @type {?}
564
- * @private
565
- */
566
- EsButtonsComponent.prototype.snackBar;
567
- /**
568
- * @type {?}
569
- * @private
570
- */
571
- EsButtonsComponent.prototype.http;
572
- }
111
+ // todo translates
112
+ var EsButtonsComponent = /** @class */ (function () {
113
+ function EsButtonsComponent(router, dialog, snackBar, http) {
114
+ this.router = router;
115
+ this.dialog = dialog;
116
+ this.snackBar = snackBar;
117
+ this.http = http;
118
+ this.parentWidth = 40; // default 40 = 1 button
119
+ this.buttons = []; // normal input
120
+ this.forceMenu = false; // pokud chci zobrazit ... menu i pro jeden buttonek, na realtimu pouzito
121
+ this.buttonClick = new core.EventEmitter();
122
+ this.reload = new core.EventEmitter();
123
+ this.dialogCreated = new core.EventEmitter();
124
+ this.serverResponse = new core.EventEmitter();
125
+ this.menuVisible = false;
126
+ this.buttonWidth = 40; // todo ViewChild, sirka buttonu ?
127
+ this.visibleButtons = [];
128
+ this.hiddenButtons = [];
129
+ this.esIcon = icon.EsIcon;
130
+ this._width = 0;
131
+ }
132
+ EsButtonsComponent.prototype.showMenu = function () {
133
+ return this.getHiddenButtons() && this.getHiddenButtons().length > 0 && this.getHiddenButtons().length !== 1;
134
+ };
135
+ EsButtonsComponent.prototype.countVisible = function () {
136
+ return Math.floor((this._width) / this.buttonWidth) - 1;
137
+ };
138
+ EsButtonsComponent.prototype.getVisibleButtons = function () {
139
+ var _this = this;
140
+ if (this.buttons && this.buttons.length > 0) {
141
+ return this.buttons.filter(function (button) {
142
+ if (_this.buttons.indexOf(button) < _this.countVisible()
143
+ || (_this.getHiddenButtons().length === 1 && !_this.forceMenu)) {
144
+ return true;
145
+ }
146
+ });
147
+ }
148
+ };
149
+ EsButtonsComponent.prototype.getHiddenButtons = function () {
150
+ var _this = this;
151
+ if (this.buttons && this.buttons.length > 0) {
152
+ return this.buttons.filter(function (button) {
153
+ if (_this.buttons.indexOf(button) >= _this.countVisible()) {
154
+ return true;
155
+ }
156
+ });
157
+ }
158
+ };
159
+ EsButtonsComponent.prototype.ngOnChanges = function (simpleChange) {
160
+ if (simpleChange['parentWidth']) {
161
+ if (this.parentWidth > 0) {
162
+ this._width = this.parentWidth;
163
+ this.recalculateButtons();
164
+ }
165
+ }
166
+ if (simpleChange['buttons']) {
167
+ if (typeof this.buttons === 'string') {
168
+ this.buttons = JSON.parse(this.buttons);
169
+ }
170
+ this.recalculateButtons();
171
+ }
172
+ };
173
+ EsButtonsComponent.prototype.recalculateButtons = function () {
174
+ this.menuVisible = this.showMenu();
175
+ this.visibleButtons = this.getVisibleButtons();
176
+ this.hiddenButtons = this.getHiddenButtons();
177
+ };
178
+ EsButtonsComponent.prototype.handleAction = function (button) {
179
+ var _this = this;
180
+ if (button.action === EsButtonAction.ACTION_DIALOG_CONFIRM) {
181
+ this.openConfirm(button);
182
+ }
183
+ if (button.action === EsButtonAction.ACTION_DIALOG_DELETE) {
184
+ this.openDelete(button);
185
+ }
186
+ if (button.action === EsButtonAction.ACTION_DIALOG_FORM) {
187
+ this.openForm(button);
188
+ }
189
+ if (button.action === EsButtonAction.ACTION_DOWNLOAD) {
190
+ this.http.get(button.url, { responseType: 'blob', observe: 'response' }).subscribe(function (response) {
191
+ var filename = response.headers.get('Content-Disposition').split('filename=')[1];
192
+ if (window.navigator && window.navigator.msSaveOrOpenBlob) {
193
+ window.navigator.msSaveBlob(response.body, filename);
194
+ }
195
+ else {
196
+ var link = document.createElement('a');
197
+ link.setAttribute('href', window.URL.createObjectURL(response.body));
198
+ link.setAttribute('download', filename);
199
+ link.style.visibility = 'hidden';
200
+ document.body.appendChild(link);
201
+ link.click();
202
+ document.body.removeChild(link);
203
+ }
204
+ });
205
+ }
206
+ if (button.action === EsButtonAction.ACTION_REQUEST) {
207
+ this.http.get(button.url).subscribe(function (response) {
208
+ var config = new snackBar.MatSnackBarConfig();
209
+ config.duration = 2000;
210
+ if (response.type === form.EsFormResponseMessageType.TYPE_OK) {
211
+ config.panelClass = snackbar.EsSnackBarPanelClass.SUCCESS;
212
+ }
213
+ else {
214
+ config.panelClass = snackbar.EsSnackBarPanelClass.DANGER;
215
+ }
216
+ _this.snackBar.open(response.message, null, config);
217
+ _this.reload.emit(true);
218
+ _this.serverResponse.emit({ button: button, response: response });
219
+ });
220
+ }
221
+ if (button.action === EsButtonAction.ACTION_ROUTER_NAVIGATE) {
222
+ this.router.navigateByUrl(button.url);
223
+ }
224
+ if (button.action === EsButtonAction.ACTION_WINDOW_LOCATION) {
225
+ window.location.href = button.url;
226
+ }
227
+ this.buttonClick.emit(button);
228
+ };
229
+ // handleSubMenuAction(button: EsButton) {
230
+ // // todo asi predelat na md2 menu
231
+ // // todo nevim jestli se zpropaguje click kdyz je to zanoreny pres es-card-header
232
+ // this.buttonClick.emit(button);
233
+ // }
234
+ EsButtonsComponent.prototype.openForm = function (button) {
235
+ var _this = this;
236
+ var config = {
237
+ title: button.title,
238
+ data: {
239
+ url: button.url
240
+ }
241
+ };
242
+ var dialogRef = this.dialog.open(DialogFormComponent, config);
243
+ this.dialogCreated.emit(dialogRef);
244
+ dialogRef.afterClosed().pipe(operators.take(1)).subscribe(function (res) {
245
+ if (res && res.clickedYes) {
246
+ _this.reload.emit(true);
247
+ if (res.serverResponse) {
248
+ _this.serverResponse.emit({ button: button, response: res.serverResponse });
249
+ }
250
+ }
251
+ });
252
+ };
253
+ EsButtonsComponent.prototype.openDelete = function (button) {
254
+ this.openConfirm(button);
255
+ };
256
+ EsButtonsComponent.prototype.openConfirm = function (button) {
257
+ var _this = this;
258
+ var config = {
259
+ title: button.title,
260
+ data: {
261
+ message: button.message,
262
+ url: button.url
263
+ }
264
+ };
265
+ var dialogRef = this.dialog.open(DialogConfirmComponent, config);
266
+ this.dialogCreated.emit(dialogRef);
267
+ dialogRef.afterClosed().pipe(operators.take(1)).subscribe(function (res) {
268
+ if (res && res.clickedYes) {
269
+ _this.reload.emit(true);
270
+ if (res.serverResponse) {
271
+ _this.serverResponse.emit({ button: button, response: res.serverResponse });
272
+ }
273
+ }
274
+ });
275
+ };
276
+ return EsButtonsComponent;
277
+ }());
278
+ EsButtonsComponent.decorators = [
279
+ { type: core.Component, args: [{
280
+ selector: 'es-buttons',
281
+ template: "<ng-container *ngIf=\"visibleButtons && visibleButtons.length > 0\">\n <button *ngIf=\"visibleButtons.length > 0\"\n mat-icon-button\n [disabled]=\"visibleButtons[0].disabled === true\"\n [matTooltip]=\"visibleButtons[0].tooltip? visibleButtons[0].tooltip : visibleButtons[0].title\"\n (click)=\"handleAction(visibleButtons[0])\">\n <es-icon [color]=\"visibleButtons[0].color\"\n [themeColor]=\"visibleButtons[0].themeColor\"\n [icon]=\"visibleButtons[0].icon\"></es-icon>\n </button>\n <button *ngIf=\"visibleButtons.length > 1\"\n mat-icon-button\n [disabled]=\"visibleButtons[1].disabled === true\"\n [matTooltip]=\"visibleButtons[1].tooltip? visibleButtons[1].tooltip : visibleButtons[1].title\"\n (click)=\"handleAction(visibleButtons[1])\">\n <es-icon [color]=\"visibleButtons[1].color\"\n [themeColor]=\"visibleButtons[1].themeColor\"\n [icon]=\"visibleButtons[1].icon\"></es-icon>\n </button>\n <button *ngIf=\"visibleButtons.length > 2\"\n mat-icon-button\n [disabled]=\"visibleButtons[2].disabled === true\"\n [matTooltip]=\"visibleButtons[2].tooltip? visibleButtons[2].tooltip : visibleButtons[2].title\"\n (click)=\"handleAction(visibleButtons[2])\">\n <es-icon [color]=\"visibleButtons[2].color\"\n [themeColor]=\"visibleButtons[2].themeColor\"\n [icon]=\"visibleButtons[2].icon\"></es-icon>\n </button>\n <button *ngIf=\"visibleButtons.length > 3\"\n mat-icon-button\n [disabled]=\"visibleButtons[3].disabled === true\"\n [matTooltip]=\"visibleButtons[3].tooltip? visibleButtons[3].tooltip : visibleButtons[3].title\"\n (click)=\"handleAction(visibleButtons[3])\">\n <es-icon [color]=\"visibleButtons[3].color\"\n [themeColor]=\"visibleButtons[3].themeColor\"\n [icon]=\"visibleButtons[3].icon\"></es-icon>\n </button>\n <button *ngIf=\"visibleButtons.length > 4\"\n mat-icon-button\n [disabled]=\"visibleButtons[4].disabled === true\"\n [matTooltip]=\"visibleButtons[4].tooltip? visibleButtons[4].tooltip : visibleButtons[4].title\"\n (click)=\"handleAction(visibleButtons[4])\">\n <es-icon [color]=\"visibleButtons[4].color\"\n [themeColor]=\"visibleButtons[4].themeColor\"\n [icon]=\"visibleButtons[4].icon\"></es-icon>\n </button>\n <button *ngIf=\"visibleButtons.length > 5\"\n mat-icon-button\n [disabled]=\"visibleButtons[5].disabled === true\"\n [matTooltip]=\"visibleButtons[5].tooltip? visibleButtons[5].tooltip : visibleButtons[5].title\"\n (click)=\"handleAction(visibleButtons[5])\">\n <es-icon [color]=\"visibleButtons[5].color\"\n [themeColor]=\"visibleButtons[5].themeColor\"\n [icon]=\"visibleButtons[5].icon\"></es-icon>\n </button>\n <button *ngIf=\"visibleButtons.length > 6\"\n mat-icon-button\n [disabled]=\"visibleButtons[6].disabled === true\"\n [matTooltip]=\"visibleButtons[6].tooltip? visibleButtons[6].tooltip : visibleButtons[6].title\"\n (click)=\"handleAction(visibleButtons[6])\">\n <es-icon [color]=\"visibleButtons[6].color\"\n [themeColor]=\"visibleButtons[6].themeColor\"\n [icon]=\"visibleButtons[6].icon\"></es-icon>\n </button>\n <button *ngIf=\"visibleButtons.length > 7\"\n mat-icon-button\n [disabled]=\"visibleButtons[7].disabled === true\"\n [matTooltip]=\"visibleButtons[7].tooltip? visibleButtons[7].tooltip : visibleButtons[7].title\"\n (click)=\"handleAction(visibleButtons[7])\">\n <es-icon [color]=\"visibleButtons[7].color\"\n [themeColor]=\"visibleButtons[7].themeColor\"\n [icon]=\"visibleButtons[7].icon\"></es-icon>\n </button>\n <button *ngIf=\"visibleButtons.length > 8\"\n mat-icon-button\n [disabled]=\"visibleButtons[8].disabled === true\"\n [matTooltip]=\"visibleButtons[8].tooltip? visibleButtons[8].tooltip : visibleButtons[8].title\"\n (click)=\"handleAction(visibleButtons[8])\">\n <es-icon [color]=\"visibleButtons[8].color\"\n [themeColor]=\"visibleButtons[8].themeColor\"\n [icon]=\"visibleButtons[8].icon\"></es-icon>\n </button>\n <button *ngIf=\"visibleButtons.length > 9\"\n mat-icon-button\n [disabled]=\"visibleButtons[9].disabled === true\"\n [matTooltip]=\"visibleButtons[9].tooltip? visibleButtons[9].tooltip : visibleButtons[9].title\"\n (click)=\"handleAction(visibleButtons[9])\">\n <es-icon [color]=\"visibleButtons[9].color\"\n [themeColor]=\"visibleButtons[9].themeColor\"\n [icon]=\"visibleButtons[9].icon\"></es-icon>\n </button>\n</ng-container>\n\n\n<button *ngIf=\"menuVisible || forceMenu\"\n mat-icon-button\n [matMenuTriggerFor]=\"menu\"\n [matTooltip]=\"'an.more' | translate\">\n <es-icon [icon]=\"esIcon.MORE_VERT\"></es-icon>\n</button>\n\n\n<mat-menu #menu=\"matMenu\"\n [overlapTrigger]=\"false\"\n yPosition=\"below\"\n xPosition=\"before\">\n <ng-container *ngIf=\"hiddenButtons && hiddenButtons.length > 0\">\n <button *ngIf=\"hiddenButtons.length > 0\"\n mat-menu-item\n [disabled]=\"hiddenButtons[0].disabled === true\"\n (click)=\"handleAction(hiddenButtons[0])\">\n <es-icon [color]=\"hiddenButtons[0].color\"\n [themeColor]=\"hiddenButtons[0].themeColor\"\n [icon]=\"hiddenButtons[0].icon\"></es-icon>\n <span>{{hiddenButtons[0].title}}</span>\n </button>\n <button *ngIf=\"hiddenButtons.length > 1\"\n mat-menu-item\n [disabled]=\"hiddenButtons[1].disabled === true\"\n (click)=\"handleAction(hiddenButtons[1])\">\n <es-icon [color]=\"hiddenButtons[1].color\"\n [themeColor]=\"hiddenButtons[1].themeColor\"\n [icon]=\"hiddenButtons[1].icon\"></es-icon>\n <span>{{hiddenButtons[1].title}}</span>\n </button>\n <button *ngIf=\"hiddenButtons.length > 2\"\n mat-menu-item\n [disabled]=\"hiddenButtons[2].disabled === true\"\n (click)=\"handleAction(hiddenButtons[2])\">\n <es-icon [color]=\"hiddenButtons[2].color\"\n [themeColor]=\"hiddenButtons[2].themeColor\"\n [icon]=\"hiddenButtons[2].icon\"></es-icon>\n <span>{{hiddenButtons[2].title}}</span>\n </button>\n <button *ngIf=\"hiddenButtons.length > 3\"\n mat-menu-item\n [disabled]=\"hiddenButtons[3].disabled === true\"\n (click)=\"handleAction(hiddenButtons[3])\">\n <es-icon [color]=\"hiddenButtons[3].color\"\n [themeColor]=\"hiddenButtons[3].themeColor\"\n [icon]=\"hiddenButtons[3].icon\"></es-icon>\n <span>{{hiddenButtons[3].title}}</span>\n </button>\n <button *ngIf=\"hiddenButtons.length > 4\"\n mat-menu-item\n [disabled]=\"hiddenButtons[4].disabled === true\"\n (click)=\"handleAction(hiddenButtons[4])\">\n <es-icon [color]=\"hiddenButtons[4].color\"\n [themeColor]=\"hiddenButtons[4].themeColor\"\n [icon]=\"hiddenButtons[4].icon\"></es-icon>\n <span>{{hiddenButtons[4].title}}</span>\n </button>\n <button *ngIf=\"hiddenButtons.length > 5\"\n mat-menu-item\n [disabled]=\"hiddenButtons[5].disabled === true\"\n (click)=\"handleAction(hiddenButtons[5])\">\n <es-icon [color]=\"hiddenButtons[5].color\"\n [themeColor]=\"hiddenButtons[5].themeColor\"\n [icon]=\"hiddenButtons[5].icon\"></es-icon>\n <span>{{hiddenButtons[5].title}}</span>\n </button>\n <button *ngIf=\"hiddenButtons.length > 6\"\n mat-menu-item\n [disabled]=\"hiddenButtons[6].disabled === true\"\n (click)=\"handleAction(hiddenButtons[6])\">\n <es-icon [color]=\"hiddenButtons[6].color\"\n [themeColor]=\"hiddenButtons[6].themeColor\"\n [icon]=\"hiddenButtons[6].icon\"></es-icon>\n <span>{{hiddenButtons[6].title}}</span>\n </button>\n <button *ngIf=\"hiddenButtons.length > 7\"\n mat-menu-item\n [disabled]=\"hiddenButtons[7].disabled === true\"\n (click)=\"handleAction(hiddenButtons[7])\">\n <es-icon [color]=\"hiddenButtons[7].color\"\n [themeColor]=\"hiddenButtons[7].themeColor\"\n [icon]=\"hiddenButtons[7].icon\"></es-icon>\n <span>{{hiddenButtons[7].title}}</span>\n </button>\n <button *ngIf=\"hiddenButtons.length > 8\"\n mat-menu-item\n [disabled]=\"hiddenButtons[8].disabled === true\"\n (click)=\"handleAction(hiddenButtons[8])\">\n <es-icon [color]=\"hiddenButtons[8].color\"\n [themeColor]=\"hiddenButtons[8].themeColor\"\n [icon]=\"hiddenButtons[8].icon\"></es-icon>\n <span>{{hiddenButtons[8].title}}</span>\n </button>\n <button *ngIf=\"hiddenButtons.length > 9\"\n mat-menu-item\n [disabled]=\"hiddenButtons[9].disabled === true\"\n (click)=\"handleAction(hiddenButtons[9])\">\n <es-icon [color]=\"hiddenButtons[9].color\"\n [themeColor]=\"hiddenButtons[9].themeColor\"\n [icon]=\"hiddenButtons[9].icon\"></es-icon>\n <span>{{hiddenButtons[9].title}}</span>\n </button>\n </ng-container>\n</mat-menu>\n",
282
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
283
+ styles: [":host{float:right}"]
284
+ },] }
285
+ ];
286
+ /** @nocollapse */
287
+ EsButtonsComponent.ctorParameters = function () { return [
288
+ { type: router.Router },
289
+ { type: dialog$1.EsDialogService },
290
+ { type: snackBar.MatSnackBar },
291
+ { type: http.HttpService }
292
+ ]; };
293
+ EsButtonsComponent.propDecorators = {
294
+ parentWidth: [{ type: core.Input }],
295
+ buttons: [{ type: core.Input }],
296
+ forceMenu: [{ type: core.Input }],
297
+ buttonClick: [{ type: core.Output }],
298
+ reload: [{ type: core.Output }],
299
+ dialogCreated: [{ type: core.Output }],
300
+ serverResponse: [{ type: core.Output }]
301
+ };
573
302
 
574
- /**
575
- * @fileoverview added by tsickle
576
- * Generated from: lib/es-buttons.module.ts
577
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
578
- */
579
- var EsButtonsModule = /** @class */ (function () {
580
- function EsButtonsModule() {
581
- }
582
- EsButtonsModule.decorators = [
583
- { type: core.NgModule, args: [{
584
- imports: [
585
- common.CommonModule,
586
- button.MatButtonModule,
587
- tooltip.MatTooltipModule,
588
- menu.MatMenuModule,
589
- snackBar.MatSnackBarModule,
590
- core$1.TranslateModule.forChild(),
591
- icon.EsIconModule,
592
- dialog$1.EsDialogModule,
593
- form.EsFormModule,
594
- ],
595
- declarations: [
596
- EsButtonsComponent,
597
- DialogConfirmComponent,
598
- DialogFormComponent,
599
- ],
600
- exports: [EsButtonsComponent],
601
- entryComponents: [
602
- DialogConfirmComponent,
603
- DialogFormComponent,
604
- ],
605
- },] }
606
- ];
607
- return EsButtonsModule;
303
+ var EsButtonsModule = /** @class */ (function () {
304
+ function EsButtonsModule() {
305
+ }
306
+ return EsButtonsModule;
608
307
  }());
308
+ EsButtonsModule.decorators = [
309
+ { type: core.NgModule, args: [{
310
+ imports: [
311
+ common.CommonModule,
312
+ button.MatButtonModule,
313
+ tooltip.MatTooltipModule,
314
+ menu.MatMenuModule,
315
+ snackBar.MatSnackBarModule,
316
+ core$1.TranslateModule.forChild(),
317
+ icon.EsIconModule,
318
+ dialog$1.EsDialogModule,
319
+ form.EsFormModule,
320
+ ],
321
+ declarations: [
322
+ EsButtonsComponent,
323
+ DialogConfirmComponent,
324
+ DialogFormComponent,
325
+ ],
326
+ exports: [EsButtonsComponent],
327
+ entryComponents: [
328
+ DialogConfirmComponent,
329
+ DialogFormComponent,
330
+ ],
331
+ },] }
332
+ ];
609
333
 
610
- /**
611
- * @fileoverview added by tsickle
612
- * Generated from: lib/model/es-button.interface.ts
613
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
614
- */
615
- /**
616
- * @record
617
- */
618
- function EsButton() { }
619
- if (false) {
620
- /** @type {?|undefined} */
621
- EsButton.prototype.key;
622
- /** @type {?} */
623
- EsButton.prototype.title;
624
- /** @type {?} */
625
- EsButton.prototype.icon;
626
- /** @type {?|undefined} */
627
- EsButton.prototype.url;
628
- /** @type {?|undefined} */
629
- EsButton.prototype.action;
630
- /** @type {?|undefined} */
631
- EsButton.prototype.message;
632
- /** @type {?|undefined} */
633
- EsButton.prototype.tooltip;
634
- /** @type {?|undefined} */
635
- EsButton.prototype.submenu;
636
- /** @type {?|undefined} */
637
- EsButton.prototype.color;
638
- /** @type {?|undefined} */
639
- EsButton.prototype.themeColor;
640
- /** @type {?|undefined} */
641
- EsButton.prototype.disabled;
642
- }
334
+ /*
335
+ * Public API Surface of es-buttons
336
+ */
643
337
 
644
- /**
645
- * @fileoverview added by tsickle
646
- * Generated from: lib/model/es-button-server-response.ts
647
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
648
- */
649
- /**
650
- * @record
651
- */
652
- function EsButtonServerResponse() { }
653
- if (false) {
654
- /** @type {?} */
655
- EsButtonServerResponse.prototype.button;
656
- /** @type {?} */
657
- EsButtonServerResponse.prototype.response;
658
- }
338
+ /**
339
+ * Generated bundle index. Do not edit.
340
+ */
659
341
 
660
342
  exports.EsButtonAction = EsButtonAction;
661
343
  exports.EsButtonsComponent = EsButtonsComponent;