@universis/ngx-tables 0.6.13 → 0.6.18

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 (31) hide show
  1. package/bundles/universis-ngx-tables.umd.js +1037 -1026
  2. package/bundles/universis-ngx-tables.umd.js.map +1 -1
  3. package/bundles/universis-ngx-tables.umd.min.js +1 -1
  4. package/bundles/universis-ngx-tables.umd.min.js.map +1 -1
  5. package/esm2015/lib/components/advanced-list/advanced-list.component.js +2 -2
  6. package/esm2015/lib/components/advanced-row-action/advanced-row-action.component.js +12 -3
  7. package/esm2015/lib/components/advanced-select/advanced-select.component.js +2 -2
  8. package/esm2015/lib/components/advanced-table/advanced-table.component.js +2 -2
  9. package/esm2015/lib/components/advanced-table-modal/advanced-table-modal-base.component.js +2 -2
  10. package/esm2015/lib/i18n/tables.el.js +2 -1
  11. package/esm2015/lib/i18n/tables.en.js +2 -1
  12. package/esm2015/public_api.js +1 -4
  13. package/esm5/lib/components/advanced-list/advanced-list.component.js +2 -2
  14. package/esm5/lib/components/advanced-row-action/advanced-row-action.component.js +12 -3
  15. package/esm5/lib/components/advanced-select/advanced-select.component.js +2 -2
  16. package/esm5/lib/components/advanced-table/advanced-table.component.js +2 -2
  17. package/esm5/lib/components/advanced-table-modal/advanced-table-modal-base.component.js +2 -2
  18. package/esm5/lib/i18n/tables.el.js +2 -1
  19. package/esm5/lib/i18n/tables.en.js +2 -1
  20. package/esm5/public_api.js +1 -4
  21. package/fesm2015/universis-ngx-tables.js +1428 -1417
  22. package/fesm2015/universis-ngx-tables.js.map +1 -1
  23. package/fesm5/universis-ngx-tables.js +1546 -1535
  24. package/fesm5/universis-ngx-tables.js.map +1 -1
  25. package/lib/components/advanced-row-action/advanced-row-action.component.d.ts +4 -1
  26. package/lib/components/advanced-table-modal/advanced-table-modal-base.component.d.ts +1 -1
  27. package/lib/i18n/tables.el.d.ts +1 -0
  28. package/lib/i18n/tables.en.d.ts +1 -0
  29. package/package.json +16 -15
  30. package/public_api.d.ts +0 -3
  31. package/universis-ngx-tables.metadata.json +1 -1
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('iso-639-1/build'), require('rxjs'), require('jquery'), require('datatables.net'), require('lodash'), require('datatables.net-scroller'), require('rxjs/add/observable/combineLatest'), require('@angular/common/http'), require('@themost/angular'), require('@themost/client'), require('@angular/core'), require('@angular/common'), require('@ngx-translate/core'), require('@angular/forms'), require('@universis/common'), require('@universis/common/routing'), require('@universis/forms'), require('angular-formio'), require('@angular/router'), require('ngx-bootstrap/modal'), require('ngx-bootstrap/progressbar'), require('ngx-pipes')) :
3
- typeof define === 'function' && define.amd ? define('@universis/ngx-tables', ['exports', 'iso-639-1/build', 'rxjs', 'jquery', 'datatables.net', 'lodash', 'datatables.net-scroller', 'rxjs/add/observable/combineLatest', '@angular/common/http', '@themost/angular', '@themost/client', '@angular/core', '@angular/common', '@ngx-translate/core', '@angular/forms', '@universis/common', '@universis/common/routing', '@universis/forms', 'angular-formio', '@angular/router', 'ngx-bootstrap/modal', 'ngx-bootstrap/progressbar', 'ngx-pipes'], factory) :
4
- (factory((global.universis = global.universis || {}, global.universis['ngx-tables'] = {}),global.ISO6391,global.rxjs,global.jQuery_,null,global.lodash,null,global.rxjs['add/observable/combineLatest'],global.ng.common.http,global.i1,global.client,global.ng.core,global.ng.common,global.core,global.ng.forms,global.i2,global.routing,global.forms$1,global.angularFormio,global.ng.router,global.modal,global.progressbar,global.ngxPipes));
5
- }(this, (function (exports,ISO6391,rxjs,jQuery_,datatables_net,lodash,datatables_netScroller,combineLatest,http,i1,client,i0,common,core,forms,i2,routing,forms$1,angularFormio,i1$1,modal,progressbar,ngxPipes) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('iso-639-1/build'), require('rxjs'), require('jquery'), require('datatables.net'), require('lodash'), require('datatables.net-scroller'), require('rxjs/add/observable/combineLatest'), require('@angular/common/http'), require('@themost/client'), require('@themost/angular'), require('@angular/core'), require('@angular/common'), require('@ngx-translate/core'), require('@angular/forms'), require('@universis/common'), require('@universis/common/routing'), require('@universis/forms'), require('angular-formio'), require('@angular/router'), require('ngx-bootstrap/modal'), require('ngx-bootstrap/progressbar'), require('ngx-pipes')) :
3
+ typeof define === 'function' && define.amd ? define('@universis/ngx-tables', ['exports', 'iso-639-1/build', 'rxjs', 'jquery', 'datatables.net', 'lodash', 'datatables.net-scroller', 'rxjs/add/observable/combineLatest', '@angular/common/http', '@themost/client', '@themost/angular', '@angular/core', '@angular/common', '@ngx-translate/core', '@angular/forms', '@universis/common', '@universis/common/routing', '@universis/forms', 'angular-formio', '@angular/router', 'ngx-bootstrap/modal', 'ngx-bootstrap/progressbar', 'ngx-pipes'], factory) :
4
+ (factory((global.universis = global.universis || {}, global.universis['ngx-tables'] = {}),global.ISO6391,global.rxjs,global.jQuery_,null,global.lodash,null,global.rxjs['add/observable/combineLatest'],global.ng.common.http,global.client,global.i1,global.ng.core,global.ng.common,global.core,global.ng.forms,global.i2,global.routing,global.forms$1,global.angularFormio,global.ng.router,global.modal,global.progressbar,global.ngxPipes));
5
+ }(this, (function (exports,ISO6391,rxjs,jQuery_,datatables_net,lodash,datatables_netScroller,combineLatest,http,client,i1,i0,common,core,forms,i2,routing,forms$1,angularFormio,i1$1,modal,progressbar,ngxPipes) { 'use strict';
6
6
 
7
7
  /*! *****************************************************************************
8
8
  Copyright (c) Microsoft Corporation.
@@ -176,507 +176,6 @@
176
176
  return ar;
177
177
  }
178
178
 
179
- var AddItemsComponent = /** @class */ (function (_super) {
180
- __extends(AddItemsComponent, _super);
181
- function AddItemsComponent(router, activatedRoute, _errorService, _modalService, _appEvent, _toastService, _loadingService, _translateService, _context) {
182
- var _this = _super.call(this, router, activatedRoute) || this;
183
- _this._errorService = _errorService;
184
- _this._modalService = _modalService;
185
- _this._appEvent = _appEvent;
186
- _this._toastService = _toastService;
187
- _this._loadingService = _loadingService;
188
- _this._translateService = _translateService;
189
- _this._context = _context;
190
- _this.loading = false;
191
- _this.items = [];
192
- _this.messages = [];
193
- // set modal size
194
- _this.modalClass = 'modal-lg';
195
- _this.okButtonDisabled = true;
196
- return _this;
197
- }
198
- AddItemsComponent.prototype.ngOnInit = function () {
199
- var _this = this;
200
- this.selectedSubscription = this.selectComponent.advancedTable.selectedItems.subscribe(function (items) {
201
- if (_this.formName == null) {
202
- _this.okButtonDisabled = items.length === 0;
203
- }
204
- });
205
- if (this.formName != null) {
206
- this.formChangeSubscription = this.formComponent.form.change.subscribe(function (event) {
207
- if (Object.prototype.hasOwnProperty.call(event, 'isValid')) {
208
- // enable or disable button based on form status
209
- _this.okButtonDisabled = (!event.isValid);
210
- }
211
- });
212
- }
213
- if (this.target) {
214
- var target = this.target;
215
- }
216
- };
217
- AddItemsComponent.prototype.cancel = function () {
218
- this.clearMessages();
219
- if (this.loading) {
220
- return;
221
- }
222
- // close
223
- if (this._modalService.modalRef) {
224
- return this._modalService.modalRef.hide();
225
- }
226
- };
227
- AddItemsComponent.prototype.ngOnDestroy = function () {
228
- if (this.formLoadSubscription) {
229
- this.formLoadSubscription.unsubscribe();
230
- }
231
- if (this.formChangeSubscription) {
232
- this.formChangeSubscription.unsubscribe();
233
- }
234
- if (this.selectedSubscription) {
235
- this.selectedSubscription.unsubscribe();
236
- }
237
- };
238
- Object.defineProperty(AddItemsComponent.prototype, "formData", {
239
- get: function () {
240
- if (this.formComponent === null) {
241
- return null;
242
- }
243
- return this.formComponent.form.formio.data;
244
- },
245
- enumerable: true,
246
- configurable: true
247
- });
248
- AddItemsComponent.prototype.ok = function () {
249
- var _this = this;
250
- try {
251
- this.clearMessages();
252
- return new Promise(function (resolve, reject) {
253
- _this.loading = false;
254
- _this.lastError = null;
255
- // set courses
256
- _this.items = _this.selectComponent.advancedTable.selected;
257
- // execute add
258
- _this.executeSubscription = _this.execute.subscribe(function (result) {
259
- _this.loading = false;
260
- if (_this.executeSubscription) {
261
- _this.executeSubscription.unsubscribe();
262
- }
263
- // close modal
264
- if (_this._modalService.modalRef) {
265
- _this._modalService.modalRef.hide();
266
- }
267
- return resolve();
268
- }, function (err) {
269
- _this.loading = false;
270
- // ensure that loading is hidden
271
- _this._loadingService.hideLoading();
272
- // set last error
273
- _this.lastError = err;
274
- return resolve();
275
- });
276
- });
277
- }
278
- catch (err) {
279
- this.loading = false;
280
- this._loadingService.hideLoading();
281
- this.lastError = err;
282
- }
283
- };
284
- AddItemsComponent.prototype.onChange = function ($event) { };
285
- AddItemsComponent.prototype.clearMessages = function () {
286
- this.messages = [];
287
- };
288
- AddItemsComponent.prototype.onFilterChange = function (event) { };
289
- AddItemsComponent.decorators = [
290
- { type: i0.Component, args: [{
291
- selector: 'app-add-items',
292
- template: "<div>\n <div class=\"modal-header\" *ngIf=\"modalTitle\">\n <h5 class=\"modal-title\">{{modalTitle | translate}}</h5>\n <button (click)=\"cancel()\" [disabled]=\"loading\"\n type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Cancel\">\n <span aria-hidden=\"true\">&times;</span>\n </button>\n </div>\n <div class=\"modal-body pt-0\">\n <div class=\"row\" *ngIf=\"lastError\">\n <div class=\"alert alert-danger col-12\" role=\"alert\">\n <span [translate]=\"'E' + (lastError.statusCode || 500) + '.title'\"></span><br>\n <small *ngIf=\"lastError.statusCode >= 0\" [translate]=\"'E' + (lastError.statusCode || 500) + '.message'\"></small>\n <small *ngIf=\"lastError.statusCode == null\">{{lastError.message}}</small>\n </div>\n </div>\n <div class=\"row d-none\" *ngIf=\"items\">\n <div class=\"col-12\">\n <p [translate]=\"'StudyPrograms.AddCoursesHelp'\" [translateParams]=\"items\" ></p>\n </div>\n </div>\n <div class=\"row mt-3\">\n <div class=\"col-12\">\n <ng-container>\n <ul style=\"margin-left: -24px\" class=\"nav nav-tabs mb-1\" id=\"myTab\" role=\"tablist\">\n <li class=\"nav-item\" *ngIf=\"tableConfiguration\">\n <a class=\"nav-link active\" id=\"courses-tab\" data-toggle=\"tab\" href=\"#courses\" role=\"tab\" aria-controls=\"home\" aria-selected=\"true\" [translate]=\"'AddItems.SelectCourses'\" ></a>\n </li>\n <li class=\"nav-item\" *ngIf=\"formName\">\n <a class=\"nav-link\" [ngClass]=\"{ 'disabled': !(selectComponent.advancedTable.selected && selectComponent.advancedTable.selected.length) }\" id=\"attributes-tab\" data-toggle=\"tab\" href=\"#attributes\" role=\"tab\" aria-controls=\"profile\" aria-selected=\"false\" [translate]=\"'AddItems.EditAttributes'\"></a>\n </li>\n <li class=\"nav-item\" *ngIf=\"messages && messages.length > 0\">\n <a class=\"nav-link\" id=\"messages-tab\" data-toggle=\"tab\" href=\"#messages\" role=\"tab\" aria-controls=\"profile\" aria-selected=\"false\" [translate]=\"'AddItems.Messages'\"></a>\n </li>\n </ul>\n <div class=\"tab-content border-0\" id=\"myTabContent\">\n <div class=\"tab-pane fade show active\" id=\"courses\" role=\"tabpanel\" aria-labelledby=\"home-tab\">\n <app-advanced-table-modal #selectComponent (filter)=\"onFilterChange($event)\" [tableConfig]=\"tableConfiguration\"></app-advanced-table-modal>\n </div>\n <div class=\"tab-pane fade\" id=\"attributes\" role=\"tabpanel\" aria-labelledby=\"profile-tab\"\n [ngClass]=\"{'invisible':(formName == null)}\">\n<!-- <advanced-form-edit #formComponent [formName]=\"formName\" ></advanced-form-edit>-->\n </div>\n <div class=\"tab-pane fade\" id=\"messages\" role=\"tabpanel\" aria-labelledby=\"profile-tab\"\n [ngClass]=\"{'invisible':(messages == null)}\">\n <ul *ngIf=\"messages && messages.length>0\" class=\"sis--list-group sis--list-group-header\">\n <li class=\"sis--list-group-item\">\n <div class=\"d-flex justify-content-center align-items-center\">\n <div class=\"sis--list-group-item_lg_column\" [translate]=\"'AddItems.Messages'\"></div>\n </div>\n </li>\n </ul>\n <ul class=\"sis--list-group sis--list-group-body\">\n <li *ngFor=\"let message of messages\" class=\"sis--list-group-item\">\n <div class=\"d-flex justify-content-center align-items-center list-color\">\n <div class=\"sis--list-group-item_lg_column\">{{ message?.message }}</div>\n </div>\n </li>\n </ul>\n <div *ngIf=\"messages && messages.length>0\">\n <button [disabled]=\"loading\" (click)=\"clearMessages()\" type=\"button\" class=\"btn btn-indigo mt-3\">\n {{'Clear' | translate}}\n </button>\n </div>\n </div>\n </div>\n </ng-container>\n </div>\n </div>\n </div>\n <div class=\"modal-footer justify-content-end\">\n <button [disabled]=\"okButtonDisabled || loading || !(selectComponent.advancedTable.selected && selectComponent.advancedTable.selected.length) \" (click)=\"ok()\"\n type=\"button\" [ngClass]=\"okButtonClass\">\n {{'OK' | translate}}\n </button>\n <button [disabled]=\"cancelButtonDisabled || loading\"\n (click)=\"cancel()\" type=\"button\" [ngClass]=\"cancelButtonClass\" data-dismiss=\"modal\">\n {{'Cancel' | translate}}\n </button>\n </div>\n</div>\n"
293
- }] }
294
- ];
295
- /** @nocollapse */
296
- AddItemsComponent.ctorParameters = function () {
297
- return [
298
- { type: i1$1.Router },
299
- { type: i1$1.ActivatedRoute },
300
- { type: i2.ErrorService },
301
- { type: i2.ModalService },
302
- { type: i2.AppEventService },
303
- { type: i2.ToastService },
304
- { type: i2.LoadingService },
305
- { type: core.TranslateService },
306
- { type: i1.AngularDataContext }
307
- ];
308
- };
309
- AddItemsComponent.propDecorators = {
310
- execute: [{ type: i0.Input }],
311
- items: [{ type: i0.Input }],
312
- target: [{ type: i0.Input }],
313
- tableConfiguration: [{ type: i0.Input }],
314
- formName: [{ type: i0.Input }],
315
- messages: [{ type: i0.Input }],
316
- formComponent: [{ type: i0.ViewChild, args: ['formComponent',] }],
317
- selectComponent: [{ type: i0.ViewChild, args: ['selectComponent',] }]
318
- };
319
- return AddItemsComponent;
320
- }(routing.RouterModalOkCancel));
321
-
322
- var AdvancedAggregatorService = /** @class */ (function () {
323
- function AdvancedAggregatorService(_context, _template) {
324
- this._context = _context;
325
- this._template = _template;
326
- }
327
- /**
328
- *
329
- * Formats and executes the data query
330
- *
331
- * @param {string} model The target model
332
- * @param {object} fixedParams Pairs of parameters to always be applied
333
- * @param {string} queryStatement The default query to use for fetching the data (e.g. expands etc)
334
- * @param {Array<string>} filters A list of filter expressions to append at the query
335
- * @param {string} searchTemplate The template to use for searching expressions
336
- * @param {string} searchValue The value of the user search
337
- *
338
- * @returns {Promise<any>} The response of the query execution
339
- */
340
- AdvancedAggregatorService.prototype.fetchData = function (model, fixedParams, queryStatement, filters, searchTemplate, searchValue) {
341
- if (queryStatement === void 0) {
342
- queryStatement = '';
343
- }
344
- return __awaiter(this, void 0, void 0, function () {
345
- var e_1, _a, query, filterExpressions, _b, _c, param, evaluatedSearch, words;
346
- var _this = this;
347
- return __generator(this, function (_d) {
348
- query = this._context.model(model).asQueryable();
349
- if (!fixedParams || typeof fixedParams !== 'object') {
350
- fixedParams = {};
351
- }
352
- filterExpressions = [];
353
- if (fixedParams) {
354
- try {
355
- for (_b = __values(Object.keys(fixedParams)), _c = _b.next(); !_c.done; _c = _b.next()) {
356
- param = _c.value;
357
- filterExpressions.push(param + " eq " + fixedParams[param]);
358
- }
359
- }
360
- catch (e_1_1) {
361
- e_1 = { error: e_1_1 };
362
- }
363
- finally {
364
- try {
365
- if (_c && !_c.done && (_a = _b.return))
366
- _a.call(_b);
367
- }
368
- finally {
369
- if (e_1)
370
- throw e_1.error;
371
- }
372
- }
373
- }
374
- if (filters && Array.isArray(filters)) {
375
- filterExpressions = __spread(filterExpressions, filters);
376
- }
377
- if (searchTemplate && searchValue) {
378
- evaluatedSearch = void 0;
379
- if (/^"(.*?)"$/.test(searchValue)) { // validate search text in double quotes
380
- evaluatedSearch = this._template.transform(searchTemplate, __assign({}, fixedParams, { text: searchValue.replace(/^"|"$/g, '') }));
381
- }
382
- else {
383
- words = searchValue.split(' ');
384
- // join words to a single filter
385
- evaluatedSearch = words.map(function (word) {
386
- return _this._template.transform(searchTemplate, __assign({}, fixedParams, { text: word }));
387
- }).join(' and ');
388
- }
389
- filterExpressions.push(evaluatedSearch);
390
- }
391
- query.setParam('$filter', filterExpressions.join('and'));
392
- return [2 /*return*/, query.expand(queryStatement).take(-1).getItems()];
393
- });
394
- });
395
- };
396
- /**
397
- *
398
- * Formats the received data to use flat keys
399
- *
400
- * @param config The applied configuration
401
- * @param data The raw data
402
- *
403
- * @returns {Array<any>} The flat-key object list
404
- *
405
- */
406
- AdvancedAggregatorService.prototype.formatData = function (config, data) {
407
- var _this = this;
408
- try {
409
- return data.map(function (entry) {
410
- if (entry.subitems && Array.isArray(entry.subitems)) {
411
- entry.subitems = _this.formatData(config, entry.subitems);
412
- }
413
- var entryObject = {};
414
- for (var i = 0; i < config.columns.length; i++) {
415
- var keys = config.columns[i].name.split('/');
416
- var helperObject = entry[keys[0]];
417
- if (helperObject && keys.length > 1) {
418
- for (var i_1 = 1; i_1 < keys.length; i_1++) {
419
- if (helperObject === undefined || helperObject === null) {
420
- break;
421
- }
422
- else {
423
- helperObject = helperObject[keys[i_1]] !== undefined && helperObject[keys[i_1]] !== null
424
- ? helperObject[keys[i_1]]
425
- : undefined;
426
- }
427
- }
428
- }
429
- entryObject[config.columns[i].name] = helperObject;
430
- }
431
- if (entry.subitems) {
432
- entryObject.subitems = entry.subitems;
433
- }
434
- return entryObject;
435
- });
436
- }
437
- catch (err) {
438
- console.error(err);
439
- }
440
- };
441
- AdvancedAggregatorService.decorators = [
442
- { type: i0.Injectable, args: [{
443
- providedIn: 'root'
444
- },] }
445
- ];
446
- /** @nocollapse */
447
- AdvancedAggregatorService.ctorParameters = function () {
448
- return [
449
- { type: i1.AngularDataContext },
450
- { type: i2.TemplatePipe }
451
- ];
452
- };
453
- AdvancedAggregatorService.ngInjectableDef = i0.defineInjectable({ factory: function AdvancedAggregatorService_Factory() { return new AdvancedAggregatorService(i0.inject(i1.AngularDataContext), i0.inject(i2.TemplatePipe)); }, token: AdvancedAggregatorService, providedIn: "root" });
454
- return AdvancedAggregatorService;
455
- }());
456
-
457
- /**
458
- *
459
- * @class AdvancedAggregatorComponent
460
- * @classdesc An advanced list with the capability of aggregate data based on configurable filters
461
- *
462
- */
463
- var AdvancedAggregatorComponent = /** @class */ (function () {
464
- function AdvancedAggregatorComponent(_changeDetector, _advancedAggregatorService, _loadingService) {
465
- this._changeDetector = _changeDetector;
466
- this._advancedAggregatorService = _advancedAggregatorService;
467
- this._loadingService = _loadingService;
468
- this.groups = [];
469
- this.eventHandler = new i0.EventEmitter();
470
- }
471
- Object.defineProperty(AdvancedAggregatorComponent.prototype, "config", {
472
- get: function () {
473
- return this._config;
474
- },
475
- set: function (value) {
476
- this._config = value;
477
- },
478
- enumerable: true,
479
- configurable: true
480
- });
481
- Object.defineProperty(AdvancedAggregatorComponent.prototype, "aggregators", {
482
- get: function () {
483
- return this._aggregators;
484
- },
485
- set: function (value) {
486
- this._aggregators = value;
487
- },
488
- enumerable: true,
489
- configurable: true
490
- });
491
- Object.defineProperty(AdvancedAggregatorComponent.prototype, "postProcessors", {
492
- get: function () {
493
- return this._postProcessors;
494
- },
495
- set: function (value) {
496
- this._postProcessors = value;
497
- },
498
- enumerable: true,
499
- configurable: true
500
- });
501
- AdvancedAggregatorComponent.prototype.ngOnInit = function () {
502
- return __awaiter(this, void 0, void 0, function () {
503
- var _this = this;
504
- return __generator(this, function (_a) {
505
- this.selectedGroups$.subscribe(function (data) {
506
- _this.groups = data;
507
- _this._changeDetector.markForCheck();
508
- });
509
- this.filters$.subscribe(function (filters) {
510
- return __awaiter(_this, void 0, void 0, function () {
511
- var err_1;
512
- return __generator(this, function (_a) {
513
- switch (_a.label) {
514
- case 0:
515
- _a.trys.push([0, 2, , 3]);
516
- return [4 /*yield*/, this.fetch(filters)];
517
- case 1:
518
- _a.sent();
519
- return [3 /*break*/, 3];
520
- case 2:
521
- err_1 = _a.sent();
522
- console.error(err_1);
523
- return [3 /*break*/, 3];
524
- case 3: return [2 /*return*/];
525
- }
526
- });
527
- });
528
- });
529
- return [2 /*return*/];
530
- });
531
- });
532
- };
533
- AdvancedAggregatorComponent.prototype.ngOnDestroy = function () {
534
- return __awaiter(this, void 0, void 0, function () {
535
- return __generator(this, function (_a) {
536
- this.selectedGroups$.unsubscribe();
537
- this.filters$.unsubscribe();
538
- return [2 /*return*/];
539
- });
540
- });
541
- };
542
- /**
543
- *
544
- * Retrieves the data
545
- *
546
- */
547
- AdvancedAggregatorComponent.prototype.fetch = function (filters) {
548
- return __awaiter(this, void 0, void 0, function () {
549
- var data, i, err_2;
550
- return __generator(this, function (_a) {
551
- switch (_a.label) {
552
- case 0:
553
- _a.trys.push([0, 6, 7, 8]);
554
- this._loadingService.showLoading();
555
- return [4 /*yield*/, this._advancedAggregatorService.fetchData(this.config.model, this.params, this.config.query, filters.filters, this.searchExpression, filters.text)];
556
- case 1:
557
- data = _a.sent();
558
- if (!(this.postProcessors && Object.keys(this.postProcessors).length > 0 && this.config.postProcessors && this.config.postProcessors.length > 0))
559
- return [3 /*break*/, 5];
560
- i = 0;
561
- _a.label = 2;
562
- case 2:
563
- if (!(i < this.config.postProcessors.length))
564
- return [3 /*break*/, 5];
565
- return [4 /*yield*/, this.postProcessors[this.config.postProcessors[i].name](data)];
566
- case 3:
567
- data = _a.sent();
568
- _a.label = 4;
569
- case 4:
570
- i++;
571
- return [3 /*break*/, 2];
572
- case 5:
573
- this.body = this._advancedAggregatorService.formatData(this.config, data);
574
- this._changeDetector.markForCheck();
575
- return [3 /*break*/, 8];
576
- case 6:
577
- err_2 = _a.sent();
578
- console.error(err_2);
579
- return [3 /*break*/, 8];
580
- case 7:
581
- this._loadingService.hideLoading();
582
- return [7 /*endfinally*/];
583
- case 8: return [2 /*return*/];
584
- }
585
- });
586
- });
587
- };
588
- /**
589
- *
590
- * Triggers the event handler event
591
- *
592
- * @param {*} event The event data
593
- *
594
- */
595
- AdvancedAggregatorComponent.prototype.onActionEvent = function (event) {
596
- this.eventHandler.emit(event);
597
- };
598
- AdvancedAggregatorComponent.decorators = [
599
- { type: i0.Component, args: [{
600
- selector: 'app-advanced-aggregator',
601
- template: "<ng-container *ngIf=\"config && body\">\n <div class=\"w-100 text-center\" *ngIf=\"body && body.length === 0\">\n <div>\n <div class=\"mt-4\">\n <div class=\"icon-circle bg-gray-300 border-gray-100\"></div>\n </div>\n <div class=\"mt-4\">\n <h4 class=\"font-3xl text-dark\" [translate]=\"'Tables.EmptyTableTitle'\"></h4>\n <p class=\"font-lg text-dark\" [translate]=\"'Tables.EmptyTableMessage'\"></p>\n </div>\n </div>\n </div>\n <ng-container *ngIf=\"groups.length === 0\">\n <div class=\"row mt-4\">\n <app-advanced-aggregator-list [body]=\"body\" [config]=\"config\" (clickEvent)=\"onActionEvent($event)\" class=\"col-12\">\n </app-advanced-aggregator-list>\n <div *ngIf=\"config.aggregators && config.aggregators.length > 0\"\n class=\"footer-text text-dark font-weight-normal text-right font-sm mt-3 mr-2 w-100\">\n <div *ngFor=\"let aggregator of config.aggregators\">\n <span *ngIf=\"aggregator.label\"> {{ aggregator.label | translate }} </span>:\n <span class=\"font-weight-bold\"> {{ body | callAggregator: aggregators: aggregator.name }}\n </span>\n </div>\n </div>\n </div>\n </ng-container>\n <ng-container *ngIf=\"groups.length === 1\">\n <ng-container *ngFor=\"let group of body | groupBy: groups[0].name | keyvalue\">\n <div class=\"row mt-4\">\n <h4 class=\"col text-secondary\"> {{ groups[0].title | aggregatorListTitle: group.key }} </h4>\n <app-advanced-aggregator-list [body]=\"group.value\" [config]=\"config\" (clickEvent)=\"onActionEvent($event)\"\n class=\"col-12\">\n </app-advanced-aggregator-list>\n </div>\n\n <!-- Footer for the group -->\n <div *ngIf=\"config.aggregators && config.aggregators.length > 0\"\n class=\"footer-text text-dark font-weight-normal text-right font-sm mt-3 mr-2 w-100\">\n <div *ngFor=\"let aggregator of config.aggregators\">\n <span *ngIf=\"aggregator.label\"> {{ aggregator.label | translate }} </span>:\n <span class=\"font-weight-bold\"> {{ group.value | callAggregator: aggregators: aggregator.name }} </span>\n </div>\n </div>\n </ng-container>\n </ng-container>\n <ng-container *ngIf=\"groups.length > 1\">\n <ng-container *ngFor=\"let group of body | groupBy: groups[0].name | keyvalue\">\n <div class=\"row mt-4\">\n <h4 class=\"col text-secondary\"> {{ groups[0].title | aggregatorListTitle: group.key }} </h4>\n <div *ngFor=\"let subgroup of group.value | groupBy: groups[1].name | keyvalue\" class=\"col-12 ml-4 pl-4\">\n <div class=\"row mt-4\">\n <h6 class=\"col-12 text-secondary\"> {{ groups[1].title | aggregatorListTitle: subgroup.key }} </h6>\n <app-advanced-aggregator-list [body]=\"subgroup.value\" [config]=\"config\" (clickEvent)=\"onActionEvent($event)\"\n class=\"col-12\">\n </app-advanced-aggregator-list>\n </div>\n\n <!-- Footer for each subgroup -->\n <div *ngIf=\"config.aggregators && config.aggregators.length > 0\"\n class=\"footer-text text-dark font-weight-normal text-right font-sm mt-3 mr-2 w-100\">\n <div *ngFor=\"let aggregator of config.aggregators\">\n <span *ngIf=\"aggregator.label\"> {{ aggregator.label | translate }} </span>:\n <span class=\"font-weight-bold\"> {{ subgroup.value | callAggregator: aggregators: aggregator.name }}\n </span>\n </div>\n </div>\n </div>\n </div>\n </ng-container>\n </ng-container>\n</ng-container>",
602
- changeDetection: i0.ChangeDetectionStrategy.OnPush
603
- }] }
604
- ];
605
- /** @nocollapse */
606
- AdvancedAggregatorComponent.ctorParameters = function () {
607
- return [
608
- { type: i0.ChangeDetectorRef },
609
- { type: AdvancedAggregatorService },
610
- { type: i2.LoadingService }
611
- ];
612
- };
613
- AdvancedAggregatorComponent.propDecorators = {
614
- config: [{ type: i0.Input, args: ['config',] }],
615
- aggregators: [{ type: i0.Input, args: ['aggregators',] }],
616
- postProcessors: [{ type: i0.Input, args: ['postProcessors',] }],
617
- params: [{ type: i0.Input, args: ['params',] }],
618
- selectedGroups$: [{ type: i0.Input, args: ['selectedGroups',] }],
619
- filters$: [{ type: i0.Input, args: ['filters',] }],
620
- searchExpression: [{ type: i0.Input, args: ['searchExpression',] }],
621
- eventHandler: [{ type: i0.Output }]
622
- };
623
- return AdvancedAggregatorComponent;
624
- }());
625
-
626
- var Lengths;
627
- (function (Lengths) {
628
- Lengths["XL"] = "xl";
629
- Lengths["LG"] = "lg";
630
- Lengths["MD"] = "md";
631
- Lengths["SM"] = "sm";
632
- Lengths["XS"] = "xs";
633
- })(Lengths || (Lengths = {}));
634
- var AdvancedAggregatorListComponent = /** @class */ (function () {
635
- function AdvancedAggregatorListComponent(_template) {
636
- this._template = _template;
637
- this.clickEvent = new i0.EventEmitter();
638
- }
639
- AdvancedAggregatorListComponent.prototype.ngOnInit = function () {
640
- var _this = this;
641
- this.config.columns.forEach(function (x) {
642
- x.length = Object.values(Lengths).includes(x.length) ? _this._template.transform("sis--list-group-item_" + x.length + "_column", x) :
643
- !x.length ? 'sis--list-group-item_sm_column' : x.length;
644
- });
645
- };
646
- /**
647
- *
648
- * Triggers the output event emitter
649
- *
650
- * @param type The type of the event as it's declared in the configuration
651
- * @param item The value of the current item
652
- * }
653
- */
654
- AdvancedAggregatorListComponent.prototype.callCallback = function (type, data) {
655
- this.clickEvent.emit({
656
- type: type,
657
- data: data
658
- });
659
- };
660
- AdvancedAggregatorListComponent.decorators = [
661
- { type: i0.Component, args: [{
662
- selector: 'app-advanced-aggregator-list',
663
- template: "<div id=\"group-list\" class=\"flex-column\" *ngIf=\"config && config.columns\">\n <ul class=\"sis--list-group sis--list-group-header\">\n <li class=\"sis--list-group-item text-wrap\">\n <div class=\"d-flex justify-content-center align-items-center\" *ngIf=\"body && body.length > 0\">\n <div *ngIf=\"config.actions && config.actions.length > 0\" class=\"sis--list-group-item_sm_column\"></div>\n <div *ngFor=\"let column of config.columns; let i = index\" class=\"text-left\"\n [class]=\"config.columns[i].length\"\n [translate]=\"config.columns[i].type === 'action' ? '' : column.title\" [ngClass]=\"{\n 'd-none': config.columns[i].hidden\n }\"></div>\n </div>\n </li>\n </ul>\n\n <!-- The list of entries -->\n <ul class=\"sis--list-group sis--list-group-body\" *ngIf=\"body && body.length > 0\">\n <li class=\"sis--list-group-item text-wrap\" *ngFor=\"let entry of body | orderBy: config.orderBy\">\n <div class=\"d-flex justify-content-center align-items-center list-color\">\n <!-- The list of actions -->\n <div *ngIf=\"config.actions && config.actions.length > 0\" class=\"sis--list-group-item_sm_column text-left pr-0\">\n <button *ngFor=\"let action of config.actions\" (click)=\"callCallback(action.identifier, entry)\"\n [title]=\"(action.title ? action.title : '') | translate \" class=\"btn btn-default px-0\">\n <i *ngIf=\"action.type === 'edit'\" class=\"fas fa-edit text-indigo\"></i>\n </button>\n <span class=\"px-0\">\n <i class=\"fa fa-fw\">&nbsp;</i>\n </span>\n\n </div>\n <!-- The list of data -->\n <div *ngFor=\"let column of config.columns; let i=index\" [class]=\"config.columns[i].length\" class=\"text-left\"\n [ngClass]=\"{\n 'text-truncate': config.columns[i].hasOwnProperty('truncate') && config.columns[i].truncate,\n 'd-none': config.columns[i].hidden,\n 'd-md-block': !config.columns[i].hidden\n }\"\n [title]=\"config.columns[i].hasOwnProperty('truncate') && config.columns[i].truncate ? entry[column.name] : ''\">\n <span class=\"text-secondary\"\n *ngIf=\"!config.columns[i].hasOwnProperty('type') || (config.columns[i].hasOwnProperty('type') && config.columns[i].type === 'text')\"\n [ngClass]=\"{\n 'font-xs': config.columns[i].variant !== 'primary',\n 'text-body': config.columns[i].variant === 'primary',\n 'text-success': config.columns[i].variant === 'redGreen' && config.columns[i].hasOwnProperty('condition') && entry[config.columns[i].condition],\n 'text-danger': config.columns[i].variant === 'redGreen' && config.columns[i].hasOwnProperty('condition') && !entry[config.columns[i].condition],\n 'font-lg': config.columns[i].variant === 'redGreen' && entry[column.name] && entry[column.name].length > 3,\n 'font-2xl': config.columns[i].variant === 'redGreen' && entry[column.name] && entry[column.name].length <= 3\n }\">\n {{entry[column.name] || '-'}}\n </span>\n\n <button *ngIf=\"config.columns[i].type === 'action' && config.columns[i].variant === 'edit'\"\n (click)=\"callCallback(config.columns[i].identifier, entry)\"\n [title]=\"(config.columns[i].title ? config.columns[i].title : '') | translate \"\n class=\"btn btn-default px-0 mx-0\">\n <i class=\"fas fa-edit text-indigo\"></i>\n </button>\n\n <span *ngIf=\"config.columns[i].type === 'boolean'\">\n <i class=\"fa font-lg\" [ngClass]=\"{\n 'fa-check text-success': entry[column.name].toString() === config.columns[i].trueValue,\n 'fa-times text-danger': entry[column.name].toString() !== config.columns[i].trueValue && config.columns[i].variant !== 'checkOrDash'\n }\"></i>\n <span\n *ngIf=\"entry[column.name].toString() !== config.columns[i].trueValue && config.columns[i].variant === 'checkOrDash'\"\n class=\"text-secondary font-xs\">-</span>\n </span>\n </div>\n </div>\n <div *ngIf=\"entry && entry.subitems\">\n <div *ngFor=\"let subitem of entry.subitems\" class=\"d-flex justify-content-center align-items-center list-color\">\n <div *ngIf=\"config.actions && config.actions.length > 0\" class=\"sis--list-group-item_sm_column text-left pr-0\">\n <span class=\"px-0\">\n <i class=\"fa fa-fw\">&nbsp;</i>\n </span>\n <button *ngFor=\"let action of config.actions\" (click)=\"callCallback(action.identifier, subitem)\"\n [title]=\"(action.title ? action.title : '') | translate \" class=\"btn btn-default px-0\">\n <i *ngIf=\"action.type === 'edit'\" class=\"fas fa-edit text-indigo\"></i>\n </button>\n </div>\n <div class=\"text-left\"></div>\n <div *ngFor=\"let column of config.columns; let i=index\" [class]=\"config.columns[i].length\" class=\"text-left\"\n [ngClass]=\"{\n 'text-truncate': config.columns[i].hasOwnProperty('truncate') && config.columns[i].truncate,\n 'd-none': config.columns[i].hidden,\n 'd-md-block': !config.columns[i].hidden\n }\"\n [title]=\"config.columns[i].hasOwnProperty('truncate') && config.columns[i].truncate ? entry[column.name] : ''\">\n <span class=\"text-secondary\"\n *ngIf=\"!config.columns[i].hasOwnProperty('type') || (config.columns[i].hasOwnProperty('type') && config.columns[i].type === 'text')\"\n [ngClass]=\"{\n 'font-xs': config.columns[i].variant !== 'primary',\n 'text-body': config.columns[i].variant === 'primary',\n 'text-success': config.columns[i].variant === 'redGreen' && config.columns[i].hasOwnProperty('condition') && subitem[config.columns[i].condition],\n 'text-danger': config.columns[i].variant === 'redGreen' && config.columns[i].hasOwnProperty('condition') && !subitem[config.columns[i].condition],\n 'font-lg': config.columns[i].variant === 'redGreen' && subitem[column.name] && subitem[column.name].length > 3,\n 'font-2xl': config.columns[i].variant === 'redGreen' && subitem[column.name] && subitem[column.name].length <= 3\n }\">\n {{subitem[column.name] || '-'}}\n </span>\n <span *ngIf=\"config.columns[i].type === 'boolean'\">\n <i class=\"fa font-lg\" [ngClass]=\"{\n 'fa-check text-success': subitem[column.name].toString() === config.columns[i].trueValue,\n 'fa-times text-danger': subitem[column.name].toString() !== config.columns[i].trueValue && config.columns[i].variant !== 'checkOrDash'\n }\"></i>\n <span\n *ngIf=\"subitem[column.name].toString() !== config.columns[i].trueValue && config.columns[i].variant === 'checkOrDash'\"\n class=\"text-secondary font-xs\">-</span>\n </span>\n </div>\n </div>\n </div>\n </li>\n </ul>\n</div>\n"
664
- }] }
665
- ];
666
- /** @nocollapse */
667
- AdvancedAggregatorListComponent.ctorParameters = function () {
668
- return [
669
- { type: i2.TemplatePipe }
670
- ];
671
- };
672
- AdvancedAggregatorListComponent.propDecorators = {
673
- config: [{ type: i0.Input }],
674
- body: [{ type: i0.Input }],
675
- clickEvent: [{ type: i0.Output }]
676
- };
677
- return AdvancedAggregatorListComponent;
678
- }());
679
-
680
179
  var AdvancedColumnFormatter = /** @class */ (function () {
681
180
  function AdvancedColumnFormatter() {
682
181
  }
@@ -2263,7 +1762,7 @@
2263
1762
  { type: i0.Component, args: [{
2264
1763
  // tslint:disable-next-line: component-selector
2265
1764
  selector: 'app-advanced-table',
2266
- template: "\n <table #table class=\"dataTable nowrap mr-0\">\n </table>\n <div #emptyTable class=\"d-none\">\n <div>\n <div class=\"mt-4\">\n <div class=\"icon-circle bg-gray-300 border-gray-100\"></div>\n </div>\n <div class=\"mt-4\">\n <h4 class=\"font-3xl text-dark\" [translate]=\"'Tables.EmptyTableTitle'\"></h4>\n <p class=\"font-lg text-dark\" [translate]=\"'Tables.EmptyTableMessage'\"></p>\n </div>\n </div>\n </div>\n ",
1765
+ template: "\n <table #table class=\"dataTable\">\n </table>\n <div #emptyTable class=\"d-none\">\n <div>\n <div class=\"mt-4\">\n <div class=\"icon-circle bg-gray-300 border-gray-100\"></div>\n </div>\n <div class=\"mt-4\">\n <h4 class=\"font-3xl text-dark\" [translate]=\"'Tables.EmptyTableTitle'\"></h4>\n <p class=\"font-lg text-dark\" [translate]=\"'Tables.EmptyTableMessage'\"></p>\n </div>\n </div>\n </div>\n ",
2267
1766
  encapsulation: i0.ViewEncapsulation.None,
2268
1767
  styles: ["table.dataTable thead .sorting{background-image:none}table.dataTable thead .sorting_asc{background-position:95% 60%;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAACXBIWXMAAAsSAAALEgHS3X78AAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAEtJREFUKJFjYBgywAOKMQALFjE/BgaGTCibjYGBYRM+kz0ZGBh2MTAw8DAwMHAxMDBsY2BgCCBGMQzg1IRNMV5NuVAJXIALqmYwAgBBkAlPRCLcLwAAAABJRU5ErkJggg==)}table.dataTable thead .sorting_desc{background-position:95% 60%;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAACXBIWXMAAArzAAAK8wHvFRX1AAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAFNJREFUKJHVzTEKgDAQRNGHZfBg2sSTeDMLKwXPYuVJbBKQQEyrH6bZ+cPyWWaElz4kR5cOJ1b0FXnBVRYjjmIUsGGqvX6OmnImYk+JLTkzpPyBGwrtCvfBe56nAAAAAElFTkSuQmCC)}table.dataTable thead th{color:#73818e;font-size:.75rem;font-weight:600;padding-top:16px;padding-bottom:4px;border-bottom:none;padding-left:8px}table.dataTable tbody tr:first-child td:first-child{border-radius:6px 0}table.dataTable tbody tr:first-child td:last-child{border-radius:0 6px}table.dataTable tbody tr{border-radius:6px}table.dataTable tbody tr td:first-child{border-left:1px solid #c2cfd6}table.dataTable tbody tr td:last-child{border-right:1px solid #c2cfd6}table.dataTable tbody tr td{padding-top:8px;padding-bottom:8px;border-top:1px solid #c2cfd6}table.dataTable tbody tr:last-child td:first-child{border-radius:0 0 0 6px}table.dataTable tbody tr:last-child td:last-child{border-radius:0 0 6px}table.dataTable tbody tr:last-child td{border-bottom:1px solid #c2cfd6}table.dataTable td.dataTables_empty{border:none!important}table.dataTable.no-footer{border-bottom:none}.dataTables_paginate .btn.previous{margin-right:8px}.dataTables_paginate .btn.next{margin-left:8px}.dataTables_info,.dataTables_paginate{margin-top:1rem}.dataTables_paginate span .btn{border-radius:1.5rem}.dataTables_filter{display:none}.dataTables_wrapper.no-footer .dataTables_scrollBody{border-bottom:0;overflow:auto}.dataTables_paginate{display:none}.dataTable.processing{opacity:15%}.dataTables_wrapper .dataTables_processing{background:0 0;position:absolute;display:inline-block;top:25%;z-index:5;color:#73818e}.text-decoration-line-through{text-decoration:line-through!important}tr.removed .checkbox+label{visibility:hidden}"]
2269
1768
  }] }
@@ -2463,7 +1962,7 @@
2463
1962
  AdvancedListComponent.decorators = [
2464
1963
  { type: i0.Component, args: [{
2465
1964
  selector: 'app-advanced-list',
2466
- template: "<div>\n <div class=\"row\" *ngIf=\"description\">\n <div class=\"col-auto\">\n <h2>{{description}}</h2>\n <p *ngIf=\"longDescription\">{{longDescription}}</p>\n </div>\n </div>\n <div class=\"row\" *ngIf=\"searchConfiguration\">\n <div class=\"col-12\" [ngVar]=\"{}\" #filter=\"ngVar\">\n <app-advanced-table-search #advancedSearch [(filter)]=\"filter.value\" [collapsed]=\"true\" [table]=\"table\" [allowSave]=\"allowSaveOption\">\n <advanced-search>\n <app-advanced-search-form [form]=\"searchConfiguration\" (filterChange)=\"advancedSearch.asyncAdvancedSearch()\" #search [(filter)]=\"filter.value\"></app-advanced-search-form>\n </advanced-search>\n </app-advanced-table-search>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-auto mt-4\">\n <div class=\"font-xl text-secondary\" *ngIf=\"recordsTotal > 1\">\n <span>{{recordsTotal}}</span><span>&nbsp;</span><span [translate]=\"'Tables.Items'\"></span>\n </div>\n <div class=\"font-xl text-secondary\" *ngIf=\"recordsTotal === 1\">\n <span>{{recordsTotal}}</span><span>&nbsp;</span><span [translate]=\"'Tables.Item'\"></span>\n </div>\n </div>\n <div class=\"pull-right ml-auto mr-3 mt-3\">\n <div class=\"font-lg btn-toolbar mt-3\">\n <a *ngIf=\"table && table.selected && table.selected.length\"\n class=\"text-danger text-decoration-none mr-2\" href=\"javascript:void(0)\" (click)=\"remove()\">\n <span>-</span><span>&nbsp;</span><span [translate]=\"'Tables.RemoveItem'\"></span>\n </a>\n <a class=\"text-indigo text-decoration-none\" [routerLink]=\"['.', { outlets:{ modal:'add'} }]\">\n <span>+</span><span>&nbsp;</span><span [translate]=\"'Tables.AddItem'\"></span>\n </a>\n </div>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-12 mb-4\">\n <app-advanced-table [selectable]=\"true\" #table\n [autoLoad]=false\n [showFooter]=\"false\"\n (load)=\"onDataLoad($event)\" [height]=\"600\"></app-advanced-table>\n </div>\n </div>\n <router-modal></router-modal>\n</div>\n"
1965
+ template: "<div>\n <div class=\"row\" *ngIf=\"description\">\n <div class=\"col-auto\">\n <h2>{{description}}</h2>\n <p *ngIf=\"longDescription\">{{longDescription}}</p>\n </div>\n </div>\n <div class=\"row\" *ngIf=\"searchConfiguration\">\n <div class=\"col-12\" [ngVar]=\"{}\" #filter=\"ngVar\">\n <app-advanced-table-search #advancedSearch [(filter)]=\"filter.value\" [collapsed]=\"true\" [table]=\"table\" [allowSave]=\"allowSaveOption\">\n <advanced-search>\n <app-advanced-search-form [form]=\"searchConfiguration\" (filterChange)=\"advancedSearch.asyncAdvancedSearch()\" #search [(filter)]=\"filter.value\"></app-advanced-search-form>\n </advanced-search>\n </app-advanced-table-search>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-auto mt-4\">\n <div class=\"font-xl text-secondary\" *ngIf=\"recordsTotal > 1\">\n <span>{{recordsTotal}}</span><span>&nbsp;</span><span [translate]=\"'Tables.Items'\"></span>\n </div>\n <div class=\"font-xl text-secondary\" *ngIf=\"recordsTotal === 1\">\n <span>{{recordsTotal}}</span><span>&nbsp;</span><span [translate]=\"'Tables.Item'\"></span>\n </div>\n </div>\n <div class=\"pull-right ml-auto mr-3 mt-3\">\n <div class=\"font-lg btn-toolbar mt-3\">\n <a *ngIf=\"table && table.selected && table.selected.length\"\n class=\"text-danger text-decoration-none mr-2\" href=\"javascript:void(0)\" (click)=\"remove()\">\n <span>-</span><span>&nbsp;</span><span [translate]=\"'Tables.RemoveItem'\"></span>\n </a>\n <a class=\"text-indigo text-decoration-none\" [routerLink]=\"['.', { outlets:{ modal:'add'} }]\">\n <span>+</span><span>&nbsp;</span><span [translate]=\"'Tables.AddItem'\"></span>\n </a>\n </div>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-12 mb-4\">\n <app-advanced-table [selectable]=\"true\" #table\n [showFooter]=\"false\"\n (load)=\"onDataLoad($event)\" [height]=\"600\"></app-advanced-table>\n </div>\n </div>\n <router-modal></router-modal>\n</div>\n"
2467
1966
  }] }
2468
1967
  ];
2469
1968
  /** @nocollapse */
@@ -2537,6 +2036,7 @@
2537
2036
  progress = value.progress;
2538
2037
  }
2539
2038
  _this.progressComponent.value = progress;
2039
+ _this.showProgress();
2540
2040
  }
2541
2041
  });
2542
2042
  };
@@ -2600,6 +2100,7 @@
2600
2100
  _this.refresh.emit({
2601
2101
  progress: 1
2602
2102
  });
2103
+ _this.hideProgress();
2603
2104
  return;
2604
2105
  }
2605
2106
  if (_this._modalService.modalRef) {
@@ -2621,10 +2122,16 @@
2621
2122
  });
2622
2123
  });
2623
2124
  };
2125
+ AdvancedRowActionComponent.prototype.showProgress = function () {
2126
+ this.progressContainer.nativeElement.classList.replace('invisible', 'visible');
2127
+ };
2128
+ AdvancedRowActionComponent.prototype.hideProgress = function () {
2129
+ this.progressContainer.nativeElement.classList.replace('visible', 'invisible');
2130
+ };
2624
2131
  AdvancedRowActionComponent.decorators = [
2625
2132
  { type: i0.Component, args: [{
2626
2133
  selector: 'app-advanced-row-action',
2627
- template: "<div>\n <div class=\"modal-header\" *ngIf=\"modalTitle\">\n <h5 class=\"modal-title\">{{modalTitle | translate}}</h5>\n <button (click)=\"cancel()\" [disabled]=\"loading\"\n type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Cancel\">\n <span aria-hidden=\"true\">&times;</span>\n </button>\n </div>\n <div class=\"modal-body pt-0 mt-2 pb-0\">\n <div class=\"row\" *ngIf=\"lastError\">\n <div class=\"col-12\">\n <div class=\"alert alert-warning\" role=\"alert\">\n <span>{{ 'Tables.Actions.CompletedWithErrors.Title' | translate }}</span><br>\n <small *ngIf=\"lastError.status >= 0\" [translate]=\"'E' + lastError.status + '.message'\"></small>\n <small *ngIf=\"lastError.status == null\">{{lastError.message}}</small>\n </div>\n </div>\n </div>\n <div class=\"row\" *ngIf=\"description\">\n <div class=\"col-12 mb-3\">\n <div class=\"text-justify\">\n {{description | translate}}\n </div>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-12\">\n <div *ngIf=\"items && items.length > 1\" [translate]=\"'Tables.Actions.ActionMessage.Many'\" [translateParams]=\"items\"></div>\n <div *ngIf=\"items && items.length === 1\" [translate]=\"'Tables.Actions.ActionMessage.One'\"></div>\n <div class=\"font-weight-bold text-danger\" *ngIf=\"items && items.length <= 0\" [translate]=\"'Tables.Actions.ActionMessage.None'\"></div>\n <div class=\"pt-2 font-weight-bold text-danger\" *ngIf=\"additionalMessage && items && items.length <= 0\">{{additionalMessage}}</div>\n </div>\n </div>\n <div class=\"row pt-3\" *ngIf=\"formTemplate\">\n <div class=\"col-12 mb-3\">\n <div>\n <advanced-form-edit #formComponent [formName]=\"formTemplate\" [(data)]=\"data\"></advanced-form-edit>\n </div>\n </div>\n </div>\n\n <div class=\"row mt-3\">\n <div class=\"col-12\">\n <progressbar #progress [type]=\"progressType\" [max]=\"100\">\n </progressbar>\n </div>\n </div>\n </div>\n\n <div class=\"modal-footer justify-content-end\">\n <button [disabled]=\"okButtonDisabled || loading || (items && items.length === 0)\" (click)=\"ok()\"\n type=\"button\" [ngClass]=\"okButtonClass\">\n {{okButtonText | translate}}\n </button>\n <button [disabled]=\"cancelButtonDisabled || loading\"\n (click)=\"cancel()\" type=\"button\" [ngClass]=\"cancelButtonClass\" data-dismiss=\"modal\">\n {{cancelButtonText | translate}}\n </button>\n </div>\n</div>\n",
2134
+ template: "<div>\n <div class=\"modal-header\" *ngIf=\"modalTitle\">\n <h5 class=\"modal-title\">{{modalTitle | translate}}</h5>\n <button (click)=\"cancel()\" [disabled]=\"loading\"\n type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Cancel\">\n <span aria-hidden=\"true\">&times;</span>\n </button>\n </div>\n <div class=\"modal-body pt-0 mt-2 pb-0\">\n <div class=\"row\" *ngIf=\"lastError\">\n <div class=\"col-12\">\n <div class=\"alert alert-warning\" role=\"alert\">\n <span>{{ 'Tables.Actions.CompletedWithErrors.Title' | translate }}</span><br>\n <small *ngIf=\"lastError.status >= 0\" [translate]=\"'E' + lastError.status + '.message'\"></small>\n <small *ngIf=\"lastError.status == null\">{{lastError.message}}</small>\n </div>\n </div>\n </div>\n <div class=\"row\" *ngIf=\"description\">\n <div class=\"col-12 mb-3\">\n <div class=\"text-justify\">\n {{description | translate}}\n </div>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-12\">\n <div *ngIf=\"items && items.length > 1\" [translate]=\"'Tables.Actions.ActionMessage.Many'\" [translateParams]=\"items\"></div>\n <div *ngIf=\"items && items.length === 1\" [translate]=\"'Tables.Actions.ActionMessage.One'\"></div>\n <div class=\"font-weight-bold text-danger\" *ngIf=\"items && items.length <= 0\" [translate]=\"'Tables.Actions.ActionMessage.None'\"></div>\n <div class=\"pt-2 font-weight-bold text-danger\" *ngIf=\"additionalMessage && items && items.length <= 0\">{{additionalMessage}}</div>\n </div>\n </div>\n <div class=\"row pt-3\" *ngIf=\"formTemplate\">\n <div class=\"col-12 mb-3\">\n <div>\n <advanced-form-edit #formComponent [formName]=\"formTemplate\" [(data)]=\"data\"></advanced-form-edit>\n </div>\n </div>\n </div>\n\n <div class=\"row mt-3\">\n <div class=\"col-12 invisible\" #progressContainer>\n <progressbar #progress [type]=\"progressType\" [max]=\"100\">\n </progressbar>\n </div>\n </div>\n </div>\n\n <div class=\"modal-footer justify-content-end\">\n <button [disabled]=\"okButtonDisabled || loading || (items && items.length === 0)\" (click)=\"ok()\"\n type=\"button\" [ngClass]=\"okButtonClass\">\n {{okButtonText | translate}}\n </button>\n <button [disabled]=\"cancelButtonDisabled || loading\"\n (click)=\"cancel()\" type=\"button\" [ngClass]=\"cancelButtonClass\" data-dismiss=\"modal\">\n {{cancelButtonText | translate}}\n </button>\n </div>\n</div>\n",
2628
2135
  encapsulation: i0.ViewEncapsulation.None,
2629
2136
  styles: ["\n .fa-1_5x {\n font-size: 1.5rem;\n }\n .form-control:disabled, .form-control[readonly] {\n background-color: inherit;\n }\n .form-check.checkbox {\n position: relative\n }\n "]
2630
2137
  }] }
@@ -2651,6 +2158,7 @@
2651
2158
  additionalMessage: [{ type: i0.Input }],
2652
2159
  errorMessage: [{ type: i0.Input }],
2653
2160
  progressComponent: [{ type: i0.ViewChild, args: ['progress',] }],
2161
+ progressContainer: [{ type: i0.ViewChild, args: ['progressContainer',] }],
2654
2162
  formComponent: [{ type: i0.ViewChild, args: ['formComponent',] }],
2655
2163
  refresh: [{ type: i0.Input }],
2656
2164
  execute: [{ type: i0.Input }]
@@ -2814,7 +2322,7 @@
2814
2322
 
2815
2323
  // important: export this const due to AOT compilation errors
2816
2324
  // see more https://angular.io/guide/aot-metadata-errors#only-initialized-variables
2817
- var AdvancedTableModalBaseTemplate = "\n<div>\n <!-- search -->\n <div class=\"row mt-3\">\n <div class=\"col-12 col-lg-3\">\n <div class=\"input-group mb-3\">\n <input spellcheck=\"false\" type=\"text\"\n (keyup)=\"onKeyUp($event)\" [(ngModel)]=\"searchText\"\n class=\"form-control bg-gray-100 border-0\"\n placeholder=\"{{'Tables.SearchPlaceholder' | translate}}\" aria-label=\"Search\" aria-describedby=\"basic-addon2\">\n <div class=\"input-group-append\">\n <button class=\"btn btn-default bg-gray-100 border-0\" type=\"button\">\n <i class=\"fa fa-search text-secondary\"></i>\n </button>\n </div>\n </div>\n </div>\n <div #emptyTable class=\"d-none\">\n <div>\n <div class=\"mt-4\">\n <div class=\"icon-circle bg-gray-300 border-gray-100\"></div>\n </div>\n <div class=\"mt-4\">\n <h4 class=\"font-3xl text-dark\" [translate]=\"'Tables.EmptyTableTitle'\"></h4>\n <p class=\"font-lg text-dark\" [translate]=\"'Tables.EmptyTableMessage'\"></p>\n </div>\n\n </div>\n </div>\n <div class=\"col-12 col-lg-5\">\n <div class=\"btn-toolbar\">\n <button class=\"btn btn-gray-100\">\n <i class=\"fa fa-sliders-h pr-2 text-secondary\" aria-hidden=\"true\"></i>{{'Tables.Filters' | translate}}\n </button>\n <div #dropdownFilter class=\"dropdown ml-3\">\n <button class=\"btn btn-gray-100 dropdown-toggle\"\n type=\"button\" id=\"dropdownDefaultFilters\"\n data-toggle=\"dropdown\" dropdownToggle>\n {{ this.defaultFilter.name | translate }}\n </button>\n <div class=\"dropdown-menu\" aria-labelledby=\"dropdownDefaultFilters\">\n <button type=\"button\" class=\"dropdown-item\" *ngFor=\"let filter of defaultFilters\" (click)=\"onFilterSelect(filter)\">\n {{ filter.name | translate }}\n </button>\n </div>\n </div>\n </div>\n </div>\n <div class=\"col text-lg-right mt-3 mt-lg-0\">\n <button [disabled]=\"true\" class=\"btn rounded-pill btn-outline-theme\">\n <span class=\"pr-2 font-lg\">+</span><span [translate]=\"'Tables.AddItem'\"></span>\n </button>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-12\" [ngClass]=\"{ 'component-loading': loading}\">\n <app-advanced-table #advancedTable (init)=\"onTableInit($event)\"\n (load)=\"onDataLoad($event)\"\n [selectable]=\"true\"\n [multipleSelect]=\"true\"\n [scrollX]=\"false\" [scrollY]=\"320\"\n [pageLength]=\"pageLength\"\n [scrollable]=\"false\" [showFooter]=\"false\"\n [showActions]=\"false\" [lengthMenu]=\"lengthMenu\"\n [config]=\"tableConfig\" [configSrc]=\"tableConfigSrc\"></app-advanced-table>\n </div>\n </div>\n <div class=\"row mt-3 table-custom-pager\">\n <div class=\"col-12 d-flex\" *ngIf=\"recordsTotal\">\n <div class=\"mt-2 ml-auto mr-3 text-secondary\" [translate]=\"'Tables.RecordsPerPage'\"></div>\n <div #dropdownLength class=\"dropdown mr-3\">\n <button class=\"btn btn-gray-100 dropdown-toggle\"\n type=\"button\" id=\"dropdownPageSize\" data-toggle=\"dropdown\"\n dropdownToggle>\n {{pageLength}}\n </button>\n <div class=\"dropdown-menu\" aria-labelledby=\"dropdownPageSize\">\n <button (click)=\"setLength(item)\"\n class=\"dropdown-item dropdown-item-theme\"\n type=\"button\" *ngFor=\"let item of lengthMenu\">{{item}}</button>\n </div>\n </div>\n <div class=\"mt-2 mr-2\" [translate]=\"'Tables.PageInfo'\" [translateParams]=\"pageInfo\"></div>\n <button [disabled]=\"pageInfo && pageInfo.page === 0\" class=\"btn text-nowrap\" (click)=\"firstPage()\">\n <i class=\"fa fa-chevron-left text-color-theme\"></i>\n <i class=\"fa fa-chevron-left text-color-theme\"></i>\n </button>\n <button [disabled]=\"pageInfo && pageInfo.page===0\" class=\"btn\" (click)=\"previousPage()\">\n <i class=\"fa fa-chevron-left text-color-theme\"></i>\n </button>\n <button [disabled]=\"pageInfo && pageInfo.page===pageInfo.pages-1\" class=\"btn\" (click)=\"nextPage()\">\n <i class=\"fa fa-chevron-right text-color-theme\"></i>\n </button>\n <button [disabled]=\"pageInfo && pageInfo.page===pageInfo.pages-1\" class=\"btn text-nowrap\" (click)=\"lastPage()\">\n <i class=\"fa fa-chevron-right text-color-theme\"></i>\n <i class=\"fa fa-chevron-right text-color-theme\"></i>\n </button>\n </div>\n </div>\n </div>\n";
2325
+ var AdvancedTableModalBaseTemplate = "\n<div>\n <!-- search -->\n <div class=\"row mt-3\">\n <div class=\"col-12 col-lg-3\">\n <div class=\"input-group mb-3\">\n <input spellcheck=\"false\" type=\"text\"\n (keyup)=\"onKeyUp($event)\" [(ngModel)]=\"searchText\"\n class=\"form-control bg-gray-100 border-0\"\n placeholder=\"{{'Tables.SearchPlaceholder' | translate}}\" aria-label=\"Search\" aria-describedby=\"basic-addon2\">\n <div class=\"input-group-append\">\n <button class=\"btn btn-default bg-gray-100 border-0\" type=\"button\">\n <i class=\"fa fa-search text-secondary\"></i>\n </button>\n </div>\n </div>\n </div>\n <div #emptyTable class=\"d-none\">\n <div>\n <div class=\"mt-4\">\n <div class=\"icon-circle bg-gray-300 border-gray-100\"></div>\n </div>\n <div class=\"mt-4\">\n <h4 class=\"font-3xl text-dark\" [translate]=\"'Tables.EmptyTableTitle'\"></h4>\n <p class=\"font-lg text-dark\" [translate]=\"'Tables.EmptyTableMessage'\"></p>\n </div>\n\n </div>\n </div>\n <div class=\"col-12 col-lg-5\">\n <div class=\"btn-toolbar\">\n <button class=\"btn btn-gray-100\">\n <i class=\"fa fa-sliders-h pr-2 text-secondary\" aria-hidden=\"true\"></i>{{'Tables.Filters' | translate}}\n </button>\n <div #dropdownFilter class=\"dropdown ml-3\">\n <button class=\"btn btn-gray-100 dropdown-toggle\"\n type=\"button\" id=\"dropdownDefaultFilters\"\n data-toggle=\"dropdown\" dropdownToggle>\n {{ this.defaultFilter.name | translate }}\n </button>\n <div class=\"dropdown-menu\" aria-labelledby=\"dropdownDefaultFilters\">\n <button type=\"button\" class=\"dropdown-item\" *ngFor=\"let filter of defaultFilters\" (click)=\"onFilterSelect(filter)\">\n {{ filter.name | translate }}\n </button>\n </div>\n </div>\n </div>\n </div>\n <div class=\"col text-lg-right mt-3 mt-lg-0 d-none\">\n <button [disabled]=\"true\" class=\"btn rounded-pill btn-outline-theme\">\n <span class=\"pr-2 font-lg\">+</span><span [translate]=\"'Tables.AddItem'\"></span>\n </button>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-12\" [ngClass]=\"{ 'component-loading': loading}\">\n <app-advanced-table #advancedTable (init)=\"onTableInit($event)\"\n (load)=\"onDataLoad($event)\"\n [selectable]=\"true\"\n [multipleSelect]=\"true\"\n [scrollX]=\"false\" [scrollY]=\"320\"\n [pageLength]=\"pageLength\"\n [scrollable]=\"false\" [showFooter]=\"false\"\n [showActions]=\"false\" [lengthMenu]=\"lengthMenu\"\n [config]=\"tableConfig\" [configSrc]=\"tableConfigSrc\"></app-advanced-table>\n </div>\n </div>\n <div class=\"row mt-3 table-custom-pager\">\n <div class=\"col-12 d-flex\" *ngIf=\"recordsTotal\">\n <div class=\"mt-2 ml-auto mr-3 text-secondary\" [translate]=\"'Tables.RecordsPerPage'\"></div>\n <div #dropdownLength class=\"dropdown mr-3\">\n <button class=\"btn btn-gray-100 dropdown-toggle\"\n type=\"button\" id=\"dropdownPageSize\" data-toggle=\"dropdown\"\n dropdownToggle>\n {{pageLength}}\n </button>\n <div class=\"dropdown-menu\" aria-labelledby=\"dropdownPageSize\">\n <button (click)=\"setLength(item)\"\n class=\"dropdown-item dropdown-item-theme\"\n type=\"button\" *ngFor=\"let item of lengthMenu\">{{item}}</button>\n </div>\n </div>\n <div class=\"mt-2 mr-2\" [translate]=\"'Tables.PageInfo'\" [translateParams]=\"pageInfo\"></div>\n <button [disabled]=\"pageInfo && pageInfo.page === 0\" class=\"btn text-nowrap\" (click)=\"firstPage()\">\n <i class=\"fa fa-chevron-left text-color-theme\"></i>\n <i class=\"fa fa-chevron-left text-color-theme\"></i>\n </button>\n <button [disabled]=\"pageInfo && pageInfo.page===0\" class=\"btn\" (click)=\"previousPage()\">\n <i class=\"fa fa-chevron-left text-color-theme\"></i>\n </button>\n <button [disabled]=\"pageInfo && pageInfo.page===pageInfo.pages-1\" class=\"btn\" (click)=\"nextPage()\">\n <i class=\"fa fa-chevron-right text-color-theme\"></i>\n </button>\n <button [disabled]=\"pageInfo && pageInfo.page===pageInfo.pages-1\" class=\"btn text-nowrap\" (click)=\"lastPage()\">\n <i class=\"fa fa-chevron-right text-color-theme\"></i>\n <i class=\"fa fa-chevron-right text-color-theme\"></i>\n </button>\n </div>\n </div>\n </div>\n";
2818
2326
  var AdvancedTableModalBaseComponent = /** @class */ (function (_super) {
2819
2327
  __extends(AdvancedTableModalBaseComponent, _super);
2820
2328
  function AdvancedTableModalBaseComponent(_router, _activatedRoute, _context, advancedFilterValueProvider, datePipe) {
@@ -3136,7 +2644,7 @@
3136
2644
  { type: i0.Component, args: [{
3137
2645
  // tslint:disable-next-line: component-selector
3138
2646
  selector: 'app-advanced-select',
3139
- template: "<div class=\"modal-header\" *ngIf=\"modalTitle\">\n <h5 class=\"modal-title\">{{modalTitle | translate}}</h5>\n <button [disabled]=\"cancelButtonDisabled\" (click)=\"cancel()\" type=\"button\" class=\"close\" data-dismiss=\"modal\"\n aria-label=\"Cancel\">\n <span aria-hidden=\"true\">&times;</span>\n </button>\n</div>\n<div class=\"modal-body\">\n <div>\n <!-- search -->\n <div class=\"row mt-3\">\n <div class=\"col-12 col-lg-3\">\n <div class=\"input-group mb-3\">\n <input spellcheck=\"false\" type=\"text\" (keyup)=\"onKeyUp($event)\" [(ngModel)]=\"searchText\"\n class=\"form-control bg-gray-100 border-0\" placeholder=\"{{'Tables.SearchPlaceholder' | translate}}\"\n aria-label=\"Search\" aria-describedby=\"basic-addon2\">\n <div class=\"input-group-append\">\n <button class=\"btn btn-default bg-gray-100 border-0\" type=\"button\">\n <i class=\"fa fa-search text-secondary\"></i>\n </button>\n </div>\n </div>\n </div>\n <div #emptyTable class=\"d-none\">\n <div>\n <div class=\"mt-4\">\n <div class=\"icon-circle bg-gray-300 border-gray-100\"></div>\n </div>\n <div class=\"mt-4\">\n <h4 class=\"font-3xl text-dark\" [translate]=\"'Tables.EmptyTableTitle'\"></h4>\n <p class=\"font-lg text-dark\" [translate]=\"'Tables.EmptyTableMessage'\"></p>\n </div>\n\n </div>\n </div>\n <div class=\"col-12 col-lg-5\">\n <div class=\"btn-toolbar\">\n <button class=\"btn btn-gray-100\">\n <i class=\"fa fa-sliders-h pr-2 text-secondary\" aria-hidden=\"true\"></i>{{'Tables.Filters' | translate}}\n </button>\n <div class=\"dropdown ml-3\">\n <button dropdownToggle class=\"btn btn-gray-100 dropdown-toggle\" type=\"button\" id=\"dropdownDefaultFilters\"\n data-toggle=\"dropdown\">\n {{ this.defaultFilter.name | translate }}\n </button>\n <div class=\"dropdown-menu\" aria-labelledby=\"dropdownDefaultFilters\">\n <a class=\"dropdown-item\" *ngFor=\"let filter of defaultFilters\"\n (click)=\"advancedSearch(filter.filter ? filter : '')\">\n {{ filter.name | translate }}\n </a>\n </div>\n </div>\n </div>\n </div>\n <div class=\"col text-lg-right mt-3 mt-lg-0\">\n <button [disabled]=\"true\" class=\"btn rounded-pill btn-outline-theme\">\n <span class=\"pr-2 font-lg\">+</span><span [translate]=\"'Tables.AddItem'\"></span>\n </button>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-12\" [ngClass]=\"{ 'component-loading': loading}\">\n <app-advanced-table #advancedTable (init)=\"onTableInit($event)\" (load)=\"onDataLoad($event)\"\n [autoLoad]=\"true\"\n [selectable]=\"true\" [multipleSelect]=\"true\" [scrollX]=\"false\" [scrollY]=\"320\" [pageLength]=\"pageLength\"\n [scrollable]=\"false\" [showFooter]=\"false\" [showActions]=\"false\" [lengthMenu]=\"lengthMenu\"\n [config]=\"tableConfig\" [configSrc]=\"tableConfigSrc\"></app-advanced-table>\n </div>\n </div>\n <div class=\"row mt-3 table-custom-pager\">\n <div class=\"col-12 d-flex\" *ngIf=\"recordsTotal\">\n <div class=\"mt-2 ml-auto mr-3 text-secondary\" [translate]=\"'Tables.RecordsPerPage'\"></div>\n <div class=\"dropdown mr-3\">\n <button dropdownToggle class=\"btn btn-gray-100 dropdown-toggle\" type=\"button\" id=\"dropdownPageSize\"\n data-toggle=\"dropdown\">\n {{pageLength}}\n </button>\n <div class=\"dropdown-menu\" aria-labelledby=\"dropdownPageSize\">\n <button (click)=\"setLength(item)\" class=\"dropdown-item dropdown-item-theme\" type=\"button\"\n *ngFor=\"let item of lengthMenu\">{{item}}</button>\n </div>\n </div>\n <div class=\"mt-2 mr-2\" [translate]=\"'Tables.PageInfo'\" [translateParams]=\"pageInfo\"></div>\n <button [disabled]=\"pageInfo && pageInfo.page === 0\" class=\"btn text-nowrap\" (click)=\"firstPage()\">\n <i class=\"fa fa-chevron-left text-color-theme\"></i>\n <i class=\"fa fa-chevron-left text-color-theme\"></i>\n </button>\n <button [disabled]=\"pageInfo && pageInfo.page===0\" class=\"btn\" (click)=\"previousPage()\">\n <i class=\"fa fa-chevron-left text-color-theme\"></i>\n </button>\n <button [disabled]=\"pageInfo && pageInfo.page===pageInfo.pages-1\" class=\"btn\" (click)=\"nextPage()\">\n <i class=\"fa fa-chevron-right text-color-theme\"></i>\n </button>\n <button [disabled]=\"pageInfo && pageInfo.page===pageInfo.pages-1\" class=\"btn text-nowrap\"\n (click)=\"lastPage()\">\n <i class=\"fa fa-chevron-right text-color-theme\"></i>\n <i class=\"fa fa-chevron-right text-color-theme\"></i>\n </button>\n </div>\n </div>\n </div>\n</div>\n<div class=\"modal-footer justify-content-end\">\n <button [disabled]=\"okButtonDisabled\" (click)=\"ok()\" type=\"button\" [ngClass]=\"okButtonClass\">\n {{okButtonText | translate}}\n </button>\n <button [disabled]=\"cancelButtonDisabled\" (click)=\"cancel()\" type=\"button\" [ngClass]=\"cancelButtonClass\"\n data-dismiss=\"modal\">\n {{ cancelButtonText | translate}}\n </button>\n</div>\n",
2647
+ template: "<div class=\"modal-header\" *ngIf=\"modalTitle\">\n <h5 class=\"modal-title\">{{modalTitle | translate}}</h5>\n <button [disabled]=\"cancelButtonDisabled\" (click)=\"cancel()\" type=\"button\" class=\"close\" data-dismiss=\"modal\"\n aria-label=\"Cancel\">\n <span aria-hidden=\"true\">&times;</span>\n </button>\n</div>\n<div class=\"modal-body\">\n <div>\n <!-- search -->\n <div class=\"row mt-3\">\n <div class=\"col-12 col-lg-3\">\n <div class=\"input-group mb-3\">\n <input spellcheck=\"false\" type=\"text\" (keyup)=\"onKeyUp($event)\" [(ngModel)]=\"searchText\"\n class=\"form-control bg-gray-100 border-0\" placeholder=\"{{'Tables.SearchPlaceholder' | translate}}\"\n aria-label=\"Search\" aria-describedby=\"basic-addon2\">\n <div class=\"input-group-append\">\n <button class=\"btn btn-default bg-gray-100 border-0\" type=\"button\">\n <i class=\"fa fa-search text-secondary\"></i>\n </button>\n </div>\n </div>\n </div>\n <div #emptyTable class=\"d-none\">\n <div>\n <div class=\"mt-4\">\n <div class=\"icon-circle bg-gray-300 border-gray-100\"></div>\n </div>\n <div class=\"mt-4\">\n <h4 class=\"font-3xl text-dark\" [translate]=\"'Tables.EmptyTableTitle'\"></h4>\n <p class=\"font-lg text-dark\" [translate]=\"'Tables.EmptyTableMessage'\"></p>\n </div>\n\n </div>\n </div>\n <div class=\"col-12 col-lg-5\">\n <div class=\"btn-toolbar\">\n <button class=\"btn btn-gray-100\">\n <i class=\"fa fa-sliders-h pr-2 text-secondary\" aria-hidden=\"true\"></i>{{'Tables.Filters' | translate}}\n </button>\n <div class=\"dropdown ml-3\">\n <button dropdownToggle class=\"btn btn-gray-100 dropdown-toggle\" type=\"button\" id=\"dropdownDefaultFilters\"\n data-toggle=\"dropdown\">\n {{ this.defaultFilter.name | translate }}\n </button>\n <div class=\"dropdown-menu\" aria-labelledby=\"dropdownDefaultFilters\">\n <a class=\"dropdown-item\" *ngFor=\"let filter of defaultFilters\"\n (click)=\"advancedSearch(filter.filter ? filter : '')\">\n {{ filter.name | translate }}\n </a>\n </div>\n </div>\n </div>\n </div>\n <div class=\"col text-lg-right mt-3 mt-lg-0 d-none\">\n <button [disabled]=\"true\" class=\"btn rounded-pill btn-outline-theme\">\n <span class=\"pr-2 font-lg\">+</span><span [translate]=\"'Tables.AddItem'\"></span>\n </button>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-12\" [ngClass]=\"{ 'component-loading': loading}\">\n <app-advanced-table #advancedTable (init)=\"onTableInit($event)\" (load)=\"onDataLoad($event)\"\n [autoLoad]=\"true\"\n [selectable]=\"true\" [multipleSelect]=\"true\" [scrollX]=\"false\" [scrollY]=\"320\" [pageLength]=\"pageLength\"\n [scrollable]=\"false\" [showFooter]=\"false\" [showActions]=\"false\" [lengthMenu]=\"lengthMenu\"\n [config]=\"tableConfig\" [configSrc]=\"tableConfigSrc\"></app-advanced-table>\n </div>\n </div>\n <div class=\"row mt-3 table-custom-pager\">\n <div class=\"col-12 d-flex\" *ngIf=\"recordsTotal\">\n <div class=\"mt-2 ml-auto mr-3 text-secondary\" [translate]=\"'Tables.RecordsPerPage'\"></div>\n <div class=\"dropdown mr-3\">\n <button dropdownToggle class=\"btn btn-gray-100 dropdown-toggle\" type=\"button\" id=\"dropdownPageSize\"\n data-toggle=\"dropdown\">\n {{pageLength}}\n </button>\n <div class=\"dropdown-menu\" aria-labelledby=\"dropdownPageSize\">\n <button (click)=\"setLength(item)\" class=\"dropdown-item dropdown-item-theme\" type=\"button\"\n *ngFor=\"let item of lengthMenu\">{{item}}</button>\n </div>\n </div>\n <div class=\"mt-2 mr-2\" [translate]=\"'Tables.PageInfo'\" [translateParams]=\"pageInfo\"></div>\n <button [disabled]=\"pageInfo && pageInfo.page === 0\" class=\"btn text-nowrap\" (click)=\"firstPage()\">\n <i class=\"fa fa-chevron-left text-color-theme\"></i>\n <i class=\"fa fa-chevron-left text-color-theme\"></i>\n </button>\n <button [disabled]=\"pageInfo && pageInfo.page===0\" class=\"btn\" (click)=\"previousPage()\">\n <i class=\"fa fa-chevron-left text-color-theme\"></i>\n </button>\n <button [disabled]=\"pageInfo && pageInfo.page===pageInfo.pages-1\" class=\"btn\" (click)=\"nextPage()\">\n <i class=\"fa fa-chevron-right text-color-theme\"></i>\n </button>\n <button [disabled]=\"pageInfo && pageInfo.page===pageInfo.pages-1\" class=\"btn text-nowrap\"\n (click)=\"lastPage()\">\n <i class=\"fa fa-chevron-right text-color-theme\"></i>\n <i class=\"fa fa-chevron-right text-color-theme\"></i>\n </button>\n </div>\n </div>\n </div>\n</div>\n<div class=\"modal-footer justify-content-end\">\n <button [disabled]=\"okButtonDisabled\" (click)=\"ok()\" type=\"button\" [ngClass]=\"okButtonClass\">\n {{okButtonText | translate}}\n </button>\n <button [disabled]=\"cancelButtonDisabled\" (click)=\"cancel()\" type=\"button\" [ngClass]=\"cancelButtonClass\"\n data-dismiss=\"modal\">\n {{ cancelButtonText | translate}}\n </button>\n</div>\n",
3140
2648
  encapsulation: i0.ViewEncapsulation.None,
3141
2649
  styles: ["\n .modal-table .dataTables_wrapper {\n height: 50vh;\n overflow-y: auto;\n }\n "]
3142
2650
  }] }
@@ -3869,604 +3377,1105 @@
3869
3377
  queryParamsHandling: 'merge',
3870
3378
  });
3871
3379
  }
3872
- else {
3873
- // clear filter
3874
- this.filter = {};
3875
- // clear list
3876
- this.selectedList = null;
3877
- // raise filter change event
3878
- this.filterChange.emit(this.filter);
3380
+ else {
3381
+ // clear filter
3382
+ this.filter = {};
3383
+ // clear list
3384
+ this.selectedList = null;
3385
+ // raise filter change event
3386
+ this.filterChange.emit(this.filter);
3387
+ }
3388
+ };
3389
+ Object.defineProperty(AdvancedTableSearchComponent.prototype, "viewState", {
3390
+ /**
3391
+ * Gets the view state of search control
3392
+ */
3393
+ get: function () {
3394
+ return {
3395
+ advancedView: !this.collapsed,
3396
+ };
3397
+ },
3398
+ enumerable: true,
3399
+ configurable: true
3400
+ });
3401
+ /**
3402
+ * Switches view between simple and advanced search
3403
+ */
3404
+ AdvancedTableSearchComponent.prototype.toggleView = function () {
3405
+ return __awaiter(this, void 0, void 0, function () {
3406
+ return __generator(this, function (_a) {
3407
+ this.collapsed = !this.collapsed;
3408
+ // emit event for view status change
3409
+ this.viewChange.emit(this.viewState);
3410
+ return [2 /*return*/];
3411
+ });
3412
+ });
3413
+ };
3414
+ AdvancedTableSearchComponent.decorators = [
3415
+ { type: i0.Component, args: [{
3416
+ // tslint:disable-next-line: component-selector
3417
+ selector: 'app-advanced-table-search',
3418
+ template: "<div class=\"s--list-navbar d-none d-sm-block\">\n\n <div id=\"collapse-header\" [ngClass]=\"{'show':collapsed}\" class=\"collapse multi-collapse\">\n <form class=\"form-inline p-3 col\">\n <div class=\"form-group col-7\" [ngClass]= \"{ 'col-12': !showMore }\">\n <label class=\"pr-3\" for=\"searchText\" [translate]=\"'Tables.Search'\"></label>\n <input (keydown)=\"onSearchKeyDown($event)\" spellcheck=\"false\" type=\"text\" id=\"searchText\" name=\"searchText\"\n class=\"form-control col text-left\" placeholder=\"{{ 'Tables.SearchPlaceholder' | translate }}\" #searchText>\n </div>\n <div *ngIf=\"showMore\" class=\"col-5 text-right text-secondary\" id=\"heading3\">\n <button class=\"d-inline-block btn btn-link collapsed float-right text-secondary text-decoration-none\"\n type=\"button\" (click)=\"toggleView();\">\n <span class=\"d-none d-sm-inline\" [translate]=\"'AdvancedSearch.More'\"></span>\n <i class=\"ml-2 pt-1 fa fa-chevron-down\"></i>\n </button>\n </div>\n </form>\n </div>\n\n <div id=\"collapse3\" [ngClass]=\"{'show':!collapsed}\" class=\"collapse multi-collapse\" aria-labelledby=\"heading3\">\n <div class=\"row\">\n <div class=\"col-sm-12\">\n <div id=\"advanced-form\">\n <ng-content select=\"advanced-search\"></ng-content>\n <hr class=\"mt-0 mb-0\" width=\"97%\">\n <div class=\"row\">\n <div class=\"col-sm-12\">\n <div class=\"form-inline pb-3 pt-3 pr-1 pl-1 col\">\n\n <div class=\"form-group col-4\">\n <div class=\"d-flex flex-row w-100\" *ngIf=\"allowSave\">\n <label class=\"pr-3 d-none\" [translate]=\"'AdvancedSearch.SavedSearches'\"></label>\n <select *ngIf=\"userSearchList\" class=\"custom-select text-secondary flex col-12\" (change)=\"onSelectUserSearch($event)\" [(ngModel)]=\"selectedList\">\n <option [ngValue]=\"null\" [translate]=\"'AdvancedSearch.Choose'\"></option>\n <option *ngFor=\"let item of userSearchList\" [ngValue]=\"item\">{{ item.name }}</option>\n </select>\n <select *ngIf=\"!userSearchList\" class=\"custom-select flex col-6\">\n <option [value]=\"null\" [translate]=\"'AdvancedSearch.Choose'\"></option>\n </select>\n </div>\n </div>\n\n <div class=\"col-3 d-flex flex-row w-100\">\n <div class=\"btn-group\" *ngIf=\"allowSave\">\n <button type=\"button\" class=\"btn btn-sm btn-primary\" (click)=\"saveSearch(templateToUse, ( (selectedList && selectedList.readOnly) ? true : false ) )\" [translate]=\"'AdvancedSearch.SaveCurrentSearch'\"></button>\n <button type=\"button\" dropdownToggle class=\"btn btn-sm btn-primary dropdown-toggle dropdown-toggle-split\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\">\n <span class=\"sr-only\" [translate]=\"'AdvancedSearch.ToggleDropdown'\"></span>\n </button>\n\n <div class=\"dropdown-menu\">\n <a [ngClass]=\"{'disabled': selectedList && selectedList.readOnly}\" class=\"dropdown-item\" (click)=\"saveSearch(templateToUse, false)\" [translate]=\"'AdvancedSearch.Save'\" href=\"javascript:void(0)\"></a>\n <a class=\"dropdown-item\" (click)=\"saveSearch(templateToUse)\" [translate]=\"'AdvancedSearch.SaveAs'\" href=\"javascript:void(0)\"></a>\n <div class=\"dropdown-divider\"></div>\n <a [ngClass]=\"{'disabled': selectedList && selectedList.readOnly}\" class=\"dropdown-item\" (click)=\"deleteItemFromSavedSearchListByObject(selectedList)\" [translate]=\"'AdvancedSearch.Delete'\" href=\"javascript:void(0)\"></a>\n </div>\n </div>\n </div>\n\n <div class=\"col-5 text-right text-secondary\">\n <button type=\"button\" class=\"btn btn-light text-secondary pl-2 pr-2 mr-2\" (click)=\"clear()\">\n <i class=\"fa fa-eraser\"></i>\n </button>\n <button type=\"button\" class=\"btn btn-success pl-4 pr-4 mr-2\" (click)=\"advancedSearch($event);\"\n [translate]=\"'Tables.Search'\"></button>\n <button class=\"d-inline-block btn btn-link collapsed float-right text-secondary text-decoration-none\"\n type=\"button\" (click)=\"toggleView();\">\n <span class=\"d-none d-sm-inline\" [translate]=\"'AdvancedSearch.Less'\"></span>\n <i class=\"ml-2 pt-1 fa fa-chevron-up\"></i>\n </button>\n </div>\n\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <ng-template #templateToUse>\n <div class=\"modal-header\">\n <h4 class=\"modal-title pull-left\" [translate]=\"'AdvancedSearch.Modal.Title'\"></h4>\n <button type=\"button\" class=\"close pull-right\" aria-label=\"Close\" (click)=\"modalRef.hide()\">\n <span aria-hidden=\"true\">&times;</span>\n </button>\n </div>\n <div class=\"modal-body mt-0 mb-0 text-center\">\n <div>\n <p class=\"text-secondary text-left\" [translate]=\"'AdvancedSearch.Modal.Help'\"></p>\n </div>\n <form class=\"p-3 text-center\" #newListForm=\"ngForm\" >\n <div [ngVar]=\"{ name: ( selectedList?.name ? ( selectedList?.name + ' (1)' ) : null ) }\" #model=\"ngVar\">\n <input [(ngModel)]=\"model.value.name\" [required]=\"true\" id=\"newListName\" name=\"newListName\" type=\"text\" class=\"form-control\" placeholder=\"{{ 'AdvancedSearch.Modal.SaveNamePlaceholder' | translate }}\"/>\n <div class=\"btn-group mt-4\">\n <button [disabled]=\"newListForm.invalid\" type=\"button\" class=\"btn btn-primary\" (click)=\"confirmModal(model.value.name)\" [translate]=\"'AdvancedSearch.Modal.Accept'\"></button>\n <button type=\"button\" class=\"btn btn-gray-300 text-white\" (click)=\"closeModal()\" [translate]=\"'AdvancedSearch.Modal.Close'\"></button>\n </div>\n </div>\n </form>\n </div>\n </ng-template>\n\n</div>\n",
3419
+ encapsulation: i0.ViewEncapsulation.None
3420
+ }] }
3421
+ ];
3422
+ /** @nocollapse */
3423
+ AdvancedTableSearchComponent.ctorParameters = function () {
3424
+ return [
3425
+ { type: i1.AngularDataContext },
3426
+ { type: i1$1.ActivatedRoute },
3427
+ { type: common.DatePipe },
3428
+ { type: modal.BsModalService },
3429
+ { type: i2.UserStorageService },
3430
+ { type: core.TranslateService },
3431
+ { type: AdvancedFilterValueProvider },
3432
+ { type: i2.TemplatePipe },
3433
+ { type: i1$1.Router },
3434
+ { type: i2.ModalService }
3435
+ ];
3436
+ };
3437
+ AdvancedTableSearchComponent.propDecorators = {
3438
+ table: [{ type: i0.Input }],
3439
+ collapsed: [{ type: i0.Input }],
3440
+ allowSave: [{ type: i0.Input }],
3441
+ showMore: [{ type: i0.Input }],
3442
+ mergeQueryParams: [{ type: i0.Input }],
3443
+ searchText: [{ type: i0.ViewChild, args: ['searchText',] }],
3444
+ viewChange: [{ type: i0.Output, args: ['viewChange',] }]
3445
+ };
3446
+ return AdvancedTableSearchComponent;
3447
+ }(AdvancedTableSearchBaseComponent));
3448
+
3449
+ var FORMATTERS = {
3450
+ ActionLinkFormatter: new ActionLinkFormatter(),
3451
+ ButtonFormatter: new ButtonFormatter(),
3452
+ DateTimeFormatter: new DateTimeFormatter(),
3453
+ LanguageFormatter: new LanguageFormatter(),
3454
+ LinkFormatter: new LinkFormatter(),
3455
+ NestedPropertyFormatter: new NestedPropertyFormatter(),
3456
+ NgClassFormatter: new NgClassFormatter(),
3457
+ SelectRowFormatter: new SelectRowFormatter(),
3458
+ TemplateFormatter: new TemplateFormatter(),
3459
+ TranslationFormatter: new TranslationFormatter(),
3460
+ TrueFalseFormatter: new TrueFalseFormatter(),
3461
+ ActionButtonFormatter: new ActionButtonFormatter(),
3462
+ ActionSplitButtonFormatter: new ActionSplitButtonFormatter(),
3463
+ };
3464
+
3465
+ var SimpleHeaderToolsComponent = /** @class */ (function () {
3466
+ function SimpleHeaderToolsComponent() {
3467
+ }
3468
+ SimpleHeaderToolsComponent.decorators = [
3469
+ { type: i0.Component, args: [{
3470
+ selector: 'table-simple-header-tools',
3471
+ template: "\n <ng-content></ng-content>\n "
3472
+ }] }
3473
+ ];
3474
+ return SimpleHeaderToolsComponent;
3475
+ }());
3476
+ var TableSimpleHeaderComponent = /** @class */ (function () {
3477
+ function TableSimpleHeaderComponent() {
3478
+ }
3479
+ TableSimpleHeaderComponent.prototype.ngOnChanges = function (changes) {
3480
+ var _this = this;
3481
+ if (changes.table) {
3482
+ if (changes.table.currentValue == null) {
3483
+ if (this.dataLoadSubscription) {
3484
+ this.dataLoadSubscription.unsubscribe();
3485
+ return;
3486
+ }
3487
+ }
3488
+ if (changes.table.currentValue != changes.table.previousValue) {
3489
+ this.dataLoadSubscription = changes.table.currentValue.load.subscribe(function (data) {
3490
+ _this.recordsTotal = data.recordsTotal;
3491
+ });
3492
+ }
3493
+ }
3494
+ };
3495
+ TableSimpleHeaderComponent.prototype.ngOnDestroy = function () {
3496
+ if (this.dataLoadSubscription) {
3497
+ this.dataLoadSubscription.unsubscribe();
3498
+ }
3499
+ };
3500
+ TableSimpleHeaderComponent.prototype.ngOnInit = function () {
3501
+ //
3502
+ };
3503
+ TableSimpleHeaderComponent.decorators = [
3504
+ { type: i0.Component, args: [{
3505
+ selector: 'app-table-simple-header',
3506
+ template: "<div class=\"row\">\n <div class=\"col-auto mt-4\">\n <div class=\"font-xl text-secondary\" *ngIf=\"recordsTotal === 0\">\n <span>&nbsp;</span>\n </div>\n <div class=\"font-xl text-secondary\" *ngIf=\"recordsTotal > 1\">\n <span>{{recordsTotal}}</span><span>&nbsp;</span><span [translate]=\"'Tables.Items'\"></span>\n </div>\n <div class=\"font-xl text-secondary\" *ngIf=\"recordsTotal === 1\">\n <span>{{recordsTotal}}</span><span>&nbsp;</span><span [translate]=\"'Tables.Item'\"></span>\n </div>\n </div>\n <div class=\"pull-right ml-auto mr-3 mt-3\">\n <div class=\"font-lg btn-toolbar mt-2\">\n <ng-content select=\"table-simple-header-tools\"></ng-content>\n </div>\n </div>\n</div>\n\n"
3507
+ }] }
3508
+ ];
3509
+ /** @nocollapse */
3510
+ TableSimpleHeaderComponent.ctorParameters = function () { return []; };
3511
+ TableSimpleHeaderComponent.propDecorators = {
3512
+ table: [{ type: i0.Input }]
3513
+ };
3514
+ return TableSimpleHeaderComponent;
3515
+ }());
3516
+
3517
+ var AdvancedTableNotNullError = /** @class */ (function (_super) {
3518
+ __extends(AdvancedTableNotNullError, _super);
3519
+ function AdvancedTableNotNullError() {
3520
+ return _super.call(this, 'Advanced table component cannot be empty at this context.') || this;
3521
+ }
3522
+ return AdvancedTableNotNullError;
3523
+ }(Error));
3524
+ var AdvancedTableEditorDirective = /** @class */ (function () {
3525
+ function AdvancedTableEditorDirective(table) {
3526
+ this.table = table;
3527
+ this.dirty = false;
3528
+ this.dirtyChange = new i0.EventEmitter(false);
3529
+ //
3530
+ }
3531
+ /**
3532
+ * Add rows to table and mark them as added rows
3533
+ */
3534
+ AdvancedTableEditorDirective.prototype.add = function () {
3535
+ var addItems = [];
3536
+ for (var _i = 0; _i < arguments.length; _i++) {
3537
+ addItems[_i] = arguments[_i];
3538
+ }
3539
+ var e_1, _a;
3540
+ if (this.table == null) {
3541
+ throw new AdvancedTableNotNullError();
3542
+ }
3543
+ // decorate items
3544
+ var key = this.table.config.columns[0].property || this.table.config.columns[0].name;
3545
+ try {
3546
+ for (var addItems_1 = __values(addItems), addItems_1_1 = addItems_1.next(); !addItems_1_1.done; addItems_1_1 = addItems_1.next()) {
3547
+ var element = addItems_1_1.value;
3548
+ var tr = this.table.dataTable.rows(':has(input[data-id="' + element[key] + '"])').nodes().to$();
3549
+ if (tr.hasClass('removed')) {
3550
+ tr.toggleClass('removed text-gray-400 text-decoration-line-through');
3551
+ }
3552
+ else {
3553
+ this.table.dataTable.rows.add([element]);
3554
+ tr = this.table.dataTable.rows(':has(input[data-id="' + element[key] + '"])').nodes().to$();
3555
+ tr.toggleClass('added font-weight-bold text-success');
3556
+ }
3557
+ }
3558
+ }
3559
+ catch (e_1_1) {
3560
+ e_1 = { error: e_1_1 };
3561
+ }
3562
+ finally {
3563
+ try {
3564
+ if (addItems_1_1 && !addItems_1_1.done && (_a = addItems_1.return))
3565
+ _a.call(addItems_1);
3566
+ }
3567
+ finally {
3568
+ if (e_1)
3569
+ throw e_1.error;
3570
+ }
3571
+ }
3572
+ this.table.dataTable.draw();
3573
+ // find removed
3574
+ var removedLength = this.table.dataTable.rows('.removed')[0].length;
3575
+ // find added
3576
+ var addedLength = this.table.dataTable.rows('.added')[0].length;
3577
+ // and emit event
3578
+ var items = this.table.dataTable.rows().data();
3579
+ this.table.load.emit({
3580
+ data: items,
3581
+ recordsFiltered: items.length - removedLength,
3582
+ recordsTotal: items.length - removedLength,
3583
+ });
3584
+ this.dirty = (removedLength > 0 || addedLength > 0);
3585
+ this.dirtyChange.emit(this.dirty);
3586
+ };
3587
+ /**
3588
+ * Marks rows as removed rows
3589
+ */
3590
+ AdvancedTableEditorDirective.prototype.remove = function () {
3591
+ var removeItems = [];
3592
+ for (var _i = 0; _i < arguments.length; _i++) {
3593
+ removeItems[_i] = arguments[_i];
3594
+ }
3595
+ var e_2, _a;
3596
+ if (this.table == null) {
3597
+ throw new AdvancedTableNotNullError();
3598
+ }
3599
+ // get key
3600
+ var key = this.table.config.columns[0].property || this.table.config.columns[0].name;
3601
+ var _loop_1 = function (element) {
3602
+ var tr = this_1.table.dataTable.rows(':has(input[data-id="' + element[key] + '"])').nodes().to$();
3603
+ // if row is marked as added
3604
+ if (tr.hasClass('added')) {
3605
+ // remove this dirty row
3606
+ this_1.table.dataTable.rows(tr).remove();
3607
+ }
3608
+ else {
3609
+ // otherwise unmarked row
3610
+ tr.toggleClass('removed text-gray-400 text-decoration-line-through');
3611
+ }
3612
+ // check if item is selected
3613
+ var selectedIndex = this_1.table.selected.findIndex(function (item) {
3614
+ return item[key] === element[key];
3615
+ });
3616
+ // and remove it from selected collection
3617
+ if (selectedIndex >= 0) {
3618
+ this_1.table.selected.splice(selectedIndex, 1);
3619
+ }
3620
+ };
3621
+ var this_1 = this;
3622
+ try {
3623
+ // loop items
3624
+ for (var removeItems_1 = __values(removeItems), removeItems_1_1 = removeItems_1.next(); !removeItems_1_1.done; removeItems_1_1 = removeItems_1.next()) {
3625
+ var element = removeItems_1_1.value;
3626
+ _loop_1(element);
3627
+ }
3628
+ }
3629
+ catch (e_2_1) {
3630
+ e_2 = { error: e_2_1 };
3631
+ }
3632
+ finally {
3633
+ try {
3634
+ if (removeItems_1_1 && !removeItems_1_1.done && (_a = removeItems_1.return))
3635
+ _a.call(removeItems_1);
3636
+ }
3637
+ finally {
3638
+ if (e_2)
3639
+ throw e_2.error;
3640
+ }
3641
+ }
3642
+ // re-draw table
3643
+ this.table.dataTable.draw();
3644
+ // get number of table items
3645
+ var items = this.table.dataTable.rows().data();
3646
+ // get number of removed items
3647
+ var removedLength = this.table.dataTable.rows('.removed')[0].length;
3648
+ // get number of added items
3649
+ var addedLength = this.table.dataTable.rows('.added')[0].length;
3650
+ // refresh
3651
+ this.table.load.emit({
3652
+ data: items,
3653
+ recordsFiltered: items.length - removedLength,
3654
+ recordsTotal: items.length - removedLength,
3655
+ });
3656
+ this.dirty = (removedLength > 0 || addedLength > 0);
3657
+ this.dirtyChange.emit(this.dirty);
3658
+ };
3659
+ AdvancedTableEditorDirective.prototype.set = function (items) {
3660
+ if (this.table == null) {
3661
+ throw new AdvancedTableNotNullError();
3879
3662
  }
3663
+ // clear rows
3664
+ this.table.selected = [];
3665
+ this.table.dataTable.clear();
3666
+ // set items
3667
+ this.table.dataTable.rows.add(items).draw();
3668
+ this.table.load.emit({
3669
+ data: items,
3670
+ recordsFiltered: items.length,
3671
+ recordsTotal: items.length,
3672
+ });
3880
3673
  };
3881
- Object.defineProperty(AdvancedTableSearchComponent.prototype, "viewState", {
3882
- /**
3883
- * Gets the view state of search control
3884
- */
3885
- get: function () {
3886
- return {
3887
- advancedView: !this.collapsed,
3888
- };
3889
- },
3890
- enumerable: true,
3891
- configurable: true
3892
- });
3893
3674
  /**
3894
- * Switches view between simple and advanced search
3675
+ * Undo changes
3895
3676
  */
3896
- AdvancedTableSearchComponent.prototype.toggleView = function () {
3897
- return __awaiter(this, void 0, void 0, function () {
3898
- return __generator(this, function (_a) {
3899
- this.collapsed = !this.collapsed;
3900
- // emit event for view status change
3901
- this.viewChange.emit(this.viewState);
3902
- return [2 /*return*/];
3903
- });
3677
+ AdvancedTableEditorDirective.prototype.undo = function () {
3678
+ if (this.table == null) {
3679
+ throw new AdvancedTableNotNullError();
3680
+ }
3681
+ // reset removed rows
3682
+ this.table.dataTable.rows('.removed').nodes().to$().toggleClass('removed text-gray-400 text-decoration-line-through');
3683
+ // remove added rows
3684
+ this.table.dataTable.rows('.added').remove();
3685
+ // clear selected items
3686
+ this.table.selected = [];
3687
+ var items = this.table.dataTable.rows().data();
3688
+ this.table.dataTable.draw();
3689
+ this.table.load.emit({
3690
+ data: items,
3691
+ recordsFiltered: items.length,
3692
+ recordsTotal: items.length,
3904
3693
  });
3694
+ this.dirty = false;
3695
+ this.dirtyChange.emit(this.dirty);
3905
3696
  };
3906
- AdvancedTableSearchComponent.decorators = [
3907
- { type: i0.Component, args: [{
3908
- // tslint:disable-next-line: component-selector
3909
- selector: 'app-advanced-table-search',
3910
- template: "<div class=\"s--list-navbar d-none d-sm-block\">\n\n <div id=\"collapse-header\" [ngClass]=\"{'show':collapsed}\" class=\"collapse multi-collapse\">\n <form class=\"form-inline p-3 col\">\n <div class=\"form-group col-7\" [ngClass]= \"{ 'col-12': !showMore }\">\n <label class=\"pr-3\" for=\"searchText\" [translate]=\"'Tables.Search'\"></label>\n <input (keydown)=\"onSearchKeyDown($event)\" spellcheck=\"false\" type=\"text\" id=\"searchText\" name=\"searchText\"\n class=\"form-control col text-left\" placeholder=\"{{ 'Tables.SearchPlaceholder' | translate }}\" #searchText>\n </div>\n <div *ngIf=\"showMore\" class=\"col-5 text-right text-secondary\" id=\"heading3\">\n <button class=\"d-inline-block btn btn-link collapsed float-right text-secondary text-decoration-none\"\n type=\"button\" (click)=\"toggleView();\">\n <span class=\"d-none d-sm-inline\" [translate]=\"'AdvancedSearch.More'\"></span>\n <i class=\"ml-2 pt-1 fa fa-chevron-down\"></i>\n </button>\n </div>\n </form>\n </div>\n\n <div id=\"collapse3\" [ngClass]=\"{'show':!collapsed}\" class=\"collapse multi-collapse\" aria-labelledby=\"heading3\">\n <div class=\"row\">\n <div class=\"col-sm-12\">\n <div id=\"advanced-form\">\n <ng-content select=\"advanced-search\"></ng-content>\n <hr class=\"mt-0 mb-0\" width=\"97%\">\n <div class=\"row\">\n <div class=\"col-sm-12\">\n <div class=\"form-inline pb-3 pt-3 pr-1 pl-1 col\">\n\n <div class=\"form-group col-4\">\n <div class=\"d-flex flex-row w-100\" *ngIf=\"allowSave\">\n <label class=\"pr-3 d-none\" [translate]=\"'AdvancedSearch.SavedSearches'\"></label>\n <select *ngIf=\"userSearchList\" class=\"custom-select text-secondary flex col-12\" (change)=\"onSelectUserSearch($event)\" [(ngModel)]=\"selectedList\">\n <option [ngValue]=\"null\" [translate]=\"'AdvancedSearch.Choose'\"></option>\n <option *ngFor=\"let item of userSearchList\" [ngValue]=\"item\">{{ item.name }}</option>\n </select>\n <select *ngIf=\"!userSearchList\" class=\"custom-select flex col-6\">\n <option [value]=\"null\" [translate]=\"'AdvancedSearch.Choose'\"></option>\n </select>\n </div>\n </div>\n\n <div class=\"col-3 d-flex flex-row w-100\">\n <div class=\"btn-group\" *ngIf=\"allowSave\">\n <button type=\"button\" class=\"btn btn-sm btn-primary\" (click)=\"saveSearch(templateToUse, ( (selectedList && selectedList.readOnly) ? true : false ) )\" [translate]=\"'AdvancedSearch.SaveCurrentSearch'\"></button>\n <button type=\"button\" dropdownToggle class=\"btn btn-sm btn-primary dropdown-toggle dropdown-toggle-split\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\">\n <span class=\"sr-only\" [translate]=\"'AdvancedSearch.ToggleDropdown'\"></span>\n </button>\n\n <div class=\"dropdown-menu\">\n <a [ngClass]=\"{'disabled': selectedList && selectedList.readOnly}\" class=\"dropdown-item\" (click)=\"saveSearch(templateToUse, false)\" [translate]=\"'AdvancedSearch.Save'\" href=\"javascript:void(0)\"></a>\n <a class=\"dropdown-item\" (click)=\"saveSearch(templateToUse)\" [translate]=\"'AdvancedSearch.SaveAs'\" href=\"javascript:void(0)\"></a>\n <div class=\"dropdown-divider\"></div>\n <a [ngClass]=\"{'disabled': selectedList && selectedList.readOnly}\" class=\"dropdown-item\" (click)=\"deleteItemFromSavedSearchListByObject(selectedList)\" [translate]=\"'AdvancedSearch.Delete'\" href=\"javascript:void(0)\"></a>\n </div>\n </div>\n </div>\n\n <div class=\"col-5 text-right text-secondary\">\n <button type=\"button\" class=\"btn btn-light text-secondary pl-2 pr-2 mr-2\" (click)=\"clear()\">\n <i class=\"fa fa-eraser\"></i>\n </button>\n <button type=\"button\" class=\"btn btn-success pl-4 pr-4 mr-2\" (click)=\"advancedSearch($event);\"\n [translate]=\"'Tables.Search'\"></button>\n <button class=\"d-inline-block btn btn-link collapsed float-right text-secondary text-decoration-none\"\n type=\"button\" (click)=\"toggleView();\">\n <span class=\"d-none d-sm-inline\" [translate]=\"'AdvancedSearch.Less'\"></span>\n <i class=\"ml-2 pt-1 fa fa-chevron-up\"></i>\n </button>\n </div>\n\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n <ng-template #templateToUse>\n <div class=\"modal-header\">\n <h4 class=\"modal-title pull-left\" [translate]=\"'AdvancedSearch.Modal.Title'\"></h4>\n <button type=\"button\" class=\"close pull-right\" aria-label=\"Close\" (click)=\"modalRef.hide()\">\n <span aria-hidden=\"true\">&times;</span>\n </button>\n </div>\n <div class=\"modal-body mt-0 mb-0 text-center\">\n <div>\n <p class=\"text-secondary text-left\" [translate]=\"'AdvancedSearch.Modal.Help'\"></p>\n </div>\n <form class=\"p-3 text-center\" #newListForm=\"ngForm\" >\n <div [ngVar]=\"{ name: ( selectedList?.name ? ( selectedList?.name + ' (1)' ) : null ) }\" #model=\"ngVar\">\n <input [(ngModel)]=\"model.value.name\" [required]=\"true\" id=\"newListName\" name=\"newListName\" type=\"text\" class=\"form-control\" placeholder=\"{{ 'AdvancedSearch.Modal.SaveNamePlaceholder' | translate }}\"/>\n <div class=\"btn-group mt-4\">\n <button [disabled]=\"newListForm.invalid\" type=\"button\" class=\"btn btn-primary\" (click)=\"confirmModal(model.value.name)\" [translate]=\"'AdvancedSearch.Modal.Accept'\"></button>\n <button type=\"button\" class=\"btn btn-gray-300 text-white\" (click)=\"closeModal()\" [translate]=\"'AdvancedSearch.Modal.Close'\"></button>\n </div>\n </div>\n </form>\n </div>\n </ng-template>\n\n</div>\n",
3911
- encapsulation: i0.ViewEncapsulation.None
3912
- }] }
3697
+ AdvancedTableEditorDirective.prototype.rows = function () {
3698
+ if (this.table == null) {
3699
+ throw new AdvancedTableNotNullError();
3700
+ }
3701
+ return Array.from(this.table.dataTable.rows(':not(.removed)').data());
3702
+ };
3703
+ AdvancedTableEditorDirective.decorators = [
3704
+ { type: i0.Directive, args: [{
3705
+ // tslint:disable-next-line: directive-selector
3706
+ selector: '[tableEditor]',
3707
+ },] }
3913
3708
  ];
3914
3709
  /** @nocollapse */
3915
- AdvancedTableSearchComponent.ctorParameters = function () {
3710
+ AdvancedTableEditorDirective.ctorParameters = function () {
3916
3711
  return [
3917
- { type: i1.AngularDataContext },
3918
- { type: i1$1.ActivatedRoute },
3919
- { type: common.DatePipe },
3920
- { type: modal.BsModalService },
3921
- { type: i2.UserStorageService },
3922
- { type: core.TranslateService },
3923
- { type: AdvancedFilterValueProvider },
3924
- { type: i2.TemplatePipe },
3925
- { type: i1$1.Router },
3926
- { type: i2.ModalService }
3712
+ { type: AdvancedTableComponent }
3927
3713
  ];
3928
3714
  };
3929
- AdvancedTableSearchComponent.propDecorators = {
3930
- table: [{ type: i0.Input }],
3931
- collapsed: [{ type: i0.Input }],
3932
- allowSave: [{ type: i0.Input }],
3933
- showMore: [{ type: i0.Input }],
3934
- mergeQueryParams: [{ type: i0.Input }],
3935
- searchText: [{ type: i0.ViewChild, args: ['searchText',] }],
3936
- viewChange: [{ type: i0.Output, args: ['viewChange',] }]
3715
+ AdvancedTableEditorDirective.propDecorators = {
3716
+ dirtyChange: [{ type: i0.Output }]
3937
3717
  };
3938
- return AdvancedTableSearchComponent;
3939
- }(AdvancedTableSearchBaseComponent));
3940
-
3941
- var FORMATTERS = {
3942
- ActionLinkFormatter: new ActionLinkFormatter(),
3943
- ButtonFormatter: new ButtonFormatter(),
3944
- DateTimeFormatter: new DateTimeFormatter(),
3945
- LanguageFormatter: new LanguageFormatter(),
3946
- LinkFormatter: new LinkFormatter(),
3947
- NestedPropertyFormatter: new NestedPropertyFormatter(),
3948
- NgClassFormatter: new NgClassFormatter(),
3949
- SelectRowFormatter: new SelectRowFormatter(),
3950
- TemplateFormatter: new TemplateFormatter(),
3951
- TranslationFormatter: new TranslationFormatter(),
3952
- TrueFalseFormatter: new TrueFalseFormatter(),
3953
- ActionButtonFormatter: new ActionButtonFormatter(),
3954
- ActionSplitButtonFormatter: new ActionSplitButtonFormatter(),
3955
- };
3956
-
3957
- var SimpleHeaderToolsComponent = /** @class */ (function () {
3958
- function SimpleHeaderToolsComponent() {
3959
- }
3960
- SimpleHeaderToolsComponent.decorators = [
3961
- { type: i0.Component, args: [{
3962
- selector: 'table-simple-header-tools',
3963
- template: "\n <ng-content></ng-content>\n "
3964
- }] }
3965
- ];
3966
- return SimpleHeaderToolsComponent;
3718
+ return AdvancedTableEditorDirective;
3967
3719
  }());
3968
- var TableSimpleHeaderComponent = /** @class */ (function () {
3969
- function TableSimpleHeaderComponent() {
3720
+
3721
+ var MAX_EXPORT_ITEMS = 500;
3722
+ var BtnExpDirective = /** @class */ (function () {
3723
+ function BtnExpDirective(_activatedTable, _context, _config, _translate, _loadingService, _errorService) {
3724
+ this._activatedTable = _activatedTable;
3725
+ this._context = _context;
3726
+ this._config = _config;
3727
+ this._translate = _translate;
3728
+ this._loadingService = _loadingService;
3729
+ this._errorService = _errorService;
3970
3730
  }
3971
- TableSimpleHeaderComponent.prototype.ngOnChanges = function (changes) {
3972
- var _this = this;
3973
- if (changes.table) {
3974
- if (changes.table.currentValue == null) {
3975
- if (this.dataLoadSubscription) {
3976
- this.dataLoadSubscription.unsubscribe();
3977
- return;
3731
+ BtnExpDirective.prototype.clickEvent = function (event) {
3732
+ return __awaiter(this, void 0, void 0, function () {
3733
+ var lastQuery, tableConfig, serviceHeaders, queryModel, query, queryParams, maxExportItems, url;
3734
+ return __generator(this, function (_a) {
3735
+ event.preventDefault();
3736
+ event.stopPropagation();
3737
+ if (this._activatedTable.activeTable) {
3738
+ lastQuery = this._activatedTable.activeTable.lastQuery;
3739
+ tableConfig = this._activatedTable.activeTable.config;
3740
+ serviceHeaders = this._context.getService().getHeaders();
3741
+ queryModel = lastQuery.getModel();
3742
+ query = this._context.model(queryModel).asQueryable();
3743
+ queryParams = lastQuery.getParams();
3744
+ query = this.constructQuery(query, queryParams, tableConfig, serviceHeaders);
3745
+ maxExportItems = 1000;
3746
+ if (maxExportItems && typeof maxExportItems === 'number' && maxExportItems > 0) {
3747
+ query.skip(0).take(maxExportItems);
3748
+ }
3749
+ else {
3750
+ query.skip(0).take(MAX_EXPORT_ITEMS);
3751
+ }
3752
+ url = this.constructURL(query);
3753
+ this.downloadFile(url, query.getService().getHeaders(), query.getModel());
3978
3754
  }
3979
- }
3980
- if (changes.table.currentValue != changes.table.previousValue) {
3981
- this.dataLoadSubscription = changes.table.currentValue.load.subscribe(function (data) {
3982
- _this.recordsTotal = data.recordsTotal;
3983
- });
3984
- }
3985
- }
3755
+ return [2 /*return*/];
3756
+ });
3757
+ });
3986
3758
  };
3987
- TableSimpleHeaderComponent.prototype.ngOnDestroy = function () {
3988
- if (this.dataLoadSubscription) {
3989
- this.dataLoadSubscription.unsubscribe();
3759
+ /**
3760
+ * Sets the parameters to the query based on
3761
+ * the active filters of the activated table
3762
+ * @param {ClientDataQueryable} query
3763
+ * @param params: The filters of the last query of the activated table
3764
+ * @return ClientDataQueryable
3765
+ */
3766
+ BtnExpDirective.prototype.setParams = function (query, params) {
3767
+ if (params && typeof params === 'object') {
3768
+ Object.keys(params).forEach(function (key) {
3769
+ query.setParam(key, params[key]);
3770
+ });
3990
3771
  }
3772
+ return query;
3991
3773
  };
3992
- TableSimpleHeaderComponent.prototype.ngOnInit = function () {
3993
- //
3994
- };
3995
- TableSimpleHeaderComponent.decorators = [
3996
- { type: i0.Component, args: [{
3997
- selector: 'app-table-simple-header',
3998
- template: "<div class=\"row\">\n <div class=\"col-auto mt-4\">\n <div class=\"font-xl text-secondary\" *ngIf=\"recordsTotal === 0\">\n <span>&nbsp;</span>\n </div>\n <div class=\"font-xl text-secondary\" *ngIf=\"recordsTotal > 1\">\n <span>{{recordsTotal}}</span><span>&nbsp;</span><span [translate]=\"'Tables.Items'\"></span>\n </div>\n <div class=\"font-xl text-secondary\" *ngIf=\"recordsTotal === 1\">\n <span>{{recordsTotal}}</span><span>&nbsp;</span><span [translate]=\"'Tables.Item'\"></span>\n </div>\n </div>\n <div class=\"pull-right ml-auto mr-3 mt-3\">\n <div class=\"font-lg btn-toolbar mt-2\">\n <ng-content select=\"table-simple-header-tools\"></ng-content>\n </div>\n </div>\n</div>\n\n"
3999
- }] }
4000
- ];
4001
- /** @nocollapse */
4002
- TableSimpleHeaderComponent.ctorParameters = function () { return []; };
4003
- TableSimpleHeaderComponent.propDecorators = {
4004
- table: [{ type: i0.Input }]
3774
+ /**
3775
+ * Sets the headers to the query based on
3776
+ * the default headers of the DataContext
3777
+ * and appending the accept header to get
3778
+ * an xlsx file from the API
3779
+ * @param {ClientDataQueryable} query
3780
+ * @param {Headers} headers: The headers to append to the query
3781
+ * @return ClientDataQueryable
3782
+ */
3783
+ BtnExpDirective.prototype.setHeaders = function (query, headers) {
3784
+ Object.keys(headers).forEach(function (key) {
3785
+ if (headers.hasOwnProperty(key)) {
3786
+ query.getService().setHeader(key, headers[key]);
3787
+ }
3788
+ });
3789
+ // sets a header to accept xlsx files
3790
+ query.getService().setHeader('Accept', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
3791
+ return query;
4005
3792
  };
4006
- return TableSimpleHeaderComponent;
4007
- }());
4008
-
4009
- var AdvancedTableNotNullError = /** @class */ (function (_super) {
4010
- __extends(AdvancedTableNotNullError, _super);
4011
- function AdvancedTableNotNullError() {
4012
- return _super.call(this, 'Advanced table component cannot be empty at this context.') || this;
4013
- }
4014
- return AdvancedTableNotNullError;
4015
- }(Error));
4016
- var AdvancedTableEditorDirective = /** @class */ (function () {
4017
- function AdvancedTableEditorDirective(table) {
4018
- this.table = table;
4019
- this.dirty = false;
4020
- this.dirtyChange = new i0.EventEmitter(false);
4021
- //
4022
- }
4023
3793
  /**
4024
- * Add rows to table and mark them as added rows
3794
+ * Constructs the select parameter of the
3795
+ * ClientDataQuery by replacing the target name
3796
+ * of the field based on the localized translation
3797
+ * of that property on the advanced tabled
3798
+ * @param {ClientDataQueryable} query
3799
+ * @param tableConfig: The configuration of the activated table
3800
+ * @return ClientDataQueryable
4025
3801
  */
4026
- AdvancedTableEditorDirective.prototype.add = function () {
4027
- var addItems = [];
4028
- for (var _i = 0; _i < arguments.length; _i++) {
4029
- addItems[_i] = arguments[_i];
4030
- }
4031
- var e_1, _a;
4032
- if (this.table == null) {
4033
- throw new AdvancedTableNotNullError();
4034
- }
4035
- // decorate items
4036
- var key = this.table.config.columns[0].property || this.table.config.columns[0].name;
4037
- try {
4038
- for (var addItems_1 = __values(addItems), addItems_1_1 = addItems_1.next(); !addItems_1_1.done; addItems_1_1 = addItems_1.next()) {
4039
- var element = addItems_1_1.value;
4040
- var tr = this.table.dataTable.rows(':has(input[data-id="' + element[key] + '"])').nodes().to$();
4041
- if (tr.hasClass('removed')) {
4042
- tr.toggleClass('removed text-gray-400 text-decoration-line-through');
4043
- }
4044
- else {
4045
- this.table.dataTable.rows.add([element]);
4046
- tr = this.table.dataTable.rows(':has(input[data-id="' + element[key] + '"])').nodes().to$();
4047
- tr.toggleClass('added font-weight-bold text-success');
3802
+ BtnExpDirective.prototype.constructQueryParam = function (query, tableConfig) {
3803
+ var _this = this;
3804
+ var selectQuery = query.getParams().$select;
3805
+ var selectQueryArray = selectQuery.split(',');
3806
+ selectQueryArray = selectQueryArray.map(function (select) {
3807
+ var e_1, _a, e_2, _b;
3808
+ var words = select.split(' ');
3809
+ if (words.length === 3) {
3810
+ if (tableConfig && tableConfig.columns) {
3811
+ try {
3812
+ for (var _c = __values(tableConfig.columns), _d = _c.next(); !_d.done; _d = _c.next()) {
3813
+ var column = _d.value;
3814
+ if (column.property === words[2] && column.title) {
3815
+ words[2] = "\"" + _this._translate.instant(column.title) + "\"";
3816
+ }
3817
+ else if (column.property === words[2]) {
3818
+ words[2] = "\"" + _this._translate.instant(words[2]) + "\"";
3819
+ }
3820
+ }
3821
+ }
3822
+ catch (e_1_1) {
3823
+ e_1 = { error: e_1_1 };
3824
+ }
3825
+ finally {
3826
+ try {
3827
+ if (_d && !_d.done && (_a = _c.return))
3828
+ _a.call(_c);
3829
+ }
3830
+ finally {
3831
+ if (e_1)
3832
+ throw e_1.error;
3833
+ }
3834
+ }
4048
3835
  }
4049
3836
  }
4050
- }
4051
- catch (e_1_1) {
4052
- e_1 = { error: e_1_1 };
4053
- }
4054
- finally {
4055
- try {
4056
- if (addItems_1_1 && !addItems_1_1.done && (_a = addItems_1.return))
4057
- _a.call(addItems_1);
4058
- }
4059
- finally {
4060
- if (e_1)
4061
- throw e_1.error;
3837
+ if (words.length === 1) {
3838
+ if (tableConfig && tableConfig.columns) {
3839
+ try {
3840
+ for (var _e = __values(tableConfig.columns), _f = _e.next(); !_f.done; _f = _e.next()) {
3841
+ var column = _f.value;
3842
+ if (column.name === words[0] && column.title) {
3843
+ words[0] = words[0] + " as \"" + _this._translate.instant(column.title) + "\"";
3844
+ break;
3845
+ }
3846
+ else if (column.name === words[0] && column.property) {
3847
+ words[0] = words[0] + " as \"" + _this._translate.instant(column.property) + "\"";
3848
+ break;
3849
+ }
3850
+ else if (words[0] === column.name && words[0] === "id" && column.hidden) {
3851
+ break;
3852
+ }
3853
+ else if (words[0] == column.name || words[0] === column.property) {
3854
+ words[0] = words[0] + " as \"" + _this._translate.instant(words[0]) + "\"";
3855
+ }
3856
+ }
3857
+ }
3858
+ catch (e_2_1) {
3859
+ e_2 = { error: e_2_1 };
3860
+ }
3861
+ finally {
3862
+ try {
3863
+ if (_f && !_f.done && (_b = _e.return))
3864
+ _b.call(_e);
3865
+ }
3866
+ finally {
3867
+ if (e_2)
3868
+ throw e_2.error;
3869
+ }
3870
+ }
3871
+ }
3872
+ return words[0];
4062
3873
  }
4063
- }
4064
- this.table.dataTable.draw();
4065
- // find removed
4066
- var removedLength = this.table.dataTable.rows('.removed')[0].length;
4067
- // find added
4068
- var addedLength = this.table.dataTable.rows('.added')[0].length;
4069
- // and emit event
4070
- var items = this.table.dataTable.rows().data();
4071
- this.table.load.emit({
4072
- data: items,
4073
- recordsFiltered: items.length - removedLength,
4074
- recordsTotal: items.length - removedLength,
3874
+ return words.join(' ');
4075
3875
  });
4076
- this.dirty = (removedLength > 0 || addedLength > 0);
4077
- this.dirtyChange.emit(this.dirty);
3876
+ selectQuery = selectQueryArray.join(',');
3877
+ query.setParam('$select', selectQuery);
3878
+ return query;
4078
3879
  };
4079
3880
  /**
4080
- * Marks rows as removed rows
3881
+ * Constructs the fetch URL based the query parameters
3882
+ * @param {ClientDataQueryable} query
3883
+ * @return String
4081
3884
  */
4082
- AdvancedTableEditorDirective.prototype.remove = function () {
4083
- var removeItems = [];
4084
- for (var _i = 0; _i < arguments.length; _i++) {
4085
- removeItems[_i] = arguments[_i];
4086
- }
4087
- var e_2, _a;
4088
- if (this.table == null) {
4089
- throw new AdvancedTableNotNullError();
4090
- }
4091
- // get key
4092
- var key = this.table.config.columns[0].property || this.table.config.columns[0].name;
4093
- var _loop_1 = function (element) {
4094
- var tr = this_1.table.dataTable.rows(':has(input[data-id="' + element[key] + '"])').nodes().to$();
4095
- // if row is marked as added
4096
- if (tr.hasClass('added')) {
4097
- // remove this dirty row
4098
- this_1.table.dataTable.rows(tr).remove();
3885
+ BtnExpDirective.prototype.constructURL = function (query) {
3886
+ var baseURL = query.getService().getBase();
3887
+ var url = baseURL.endsWith('/') ? (baseURL + query.getModel() + '?') : (baseURL + '/' + query.getModel() + '?');
3888
+ Object.keys(query.getParams()).forEach(function (key, index) {
3889
+ if (index === 0) {
3890
+ url += key + '=' + query.getParams()[key];
4099
3891
  }
4100
3892
  else {
4101
- // otherwise unmarked row
4102
- tr.toggleClass('removed text-gray-400 text-decoration-line-through');
4103
- }
4104
- // check if item is selected
4105
- var selectedIndex = this_1.table.selected.findIndex(function (item) {
4106
- return item[key] === element[key];
4107
- });
4108
- // and remove it from selected collection
4109
- if (selectedIndex >= 0) {
4110
- this_1.table.selected.splice(selectedIndex, 1);
4111
- }
4112
- };
4113
- var this_1 = this;
4114
- try {
4115
- // loop items
4116
- for (var removeItems_1 = __values(removeItems), removeItems_1_1 = removeItems_1.next(); !removeItems_1_1.done; removeItems_1_1 = removeItems_1.next()) {
4117
- var element = removeItems_1_1.value;
4118
- _loop_1(element);
4119
- }
4120
- }
4121
- catch (e_2_1) {
4122
- e_2 = { error: e_2_1 };
4123
- }
4124
- finally {
4125
- try {
4126
- if (removeItems_1_1 && !removeItems_1_1.done && (_a = removeItems_1.return))
4127
- _a.call(removeItems_1);
3893
+ url += '&' + key + '=' + query.getParams()[key];
4128
3894
  }
4129
- finally {
4130
- if (e_2)
4131
- throw e_2.error;
3895
+ });
3896
+ return url;
3897
+ };
3898
+ /**
3899
+ * Constructs the query by setting the parameters of the
3900
+ * advanced table's active filters, sets the necessary headers
3901
+ * and build the select parameter of the query
3902
+ * @param {ClientDataQueryable} query
3903
+ * @param params: The filters of the last query of the activated table
3904
+ * @param tableConfig: The configuration of the activated table
3905
+ * @param {Headers} headers: The headers to append to the query
3906
+ * @return ClientDataQueryable
3907
+ */
3908
+ BtnExpDirective.prototype.constructQuery = function (query, params, tableConfig, headers) {
3909
+ var _query = this.setParams(query, params);
3910
+ _query = this.setHeaders(_query, headers);
3911
+ _query = this.constructQueryParam(_query, tableConfig);
3912
+ return _query;
3913
+ };
3914
+ /**
3915
+ * Fetches and saves the xlsx file
3916
+ * @param {String} url
3917
+ * @param {Headers} serviceHeaders: The headers to append to the query
3918
+ * @param modelName: The model name of the advanced table
3919
+ */
3920
+ BtnExpDirective.prototype.downloadFile = function (url, serviceHeaders, modelName) {
3921
+ var _this = this;
3922
+ this._loadingService.showLoading();
3923
+ fetch(encodeURI(url), {
3924
+ headers: serviceHeaders,
3925
+ credentials: 'include'
3926
+ }).then(function (response) {
3927
+ if (response && !response.ok) {
3928
+ throw new client.ResponseError(response.statusText, response.status);
4132
3929
  }
4133
- }
4134
- // re-draw table
4135
- this.table.dataTable.draw();
4136
- // get number of table items
4137
- var items = this.table.dataTable.rows().data();
4138
- // get number of removed items
4139
- var removedLength = this.table.dataTable.rows('.removed')[0].length;
4140
- // get number of added items
4141
- var addedLength = this.table.dataTable.rows('.added')[0].length;
4142
- // refresh
4143
- this.table.load.emit({
4144
- data: items,
4145
- recordsFiltered: items.length - removedLength,
4146
- recordsTotal: items.length - removedLength,
3930
+ return response.blob();
3931
+ }).then(function (blob) {
3932
+ var objectUrl = window.URL.createObjectURL(blob);
3933
+ var a = document.createElement('a');
3934
+ document.body.appendChild(a);
3935
+ a.setAttribute('style', 'display: none');
3936
+ a.href = objectUrl;
3937
+ var downloadName = modelName + ".xlsx";
3938
+ a.download = downloadName;
3939
+ // this adds support for IE and MS Edge (up to version 44.19041)
3940
+ if (window.navigator && window.navigator.msSaveOrOpenBlob) {
3941
+ window.navigator.msSaveOrOpenBlob(blob, downloadName);
3942
+ }
3943
+ else {
3944
+ // for all other browsers
3945
+ a.click();
3946
+ }
3947
+ window.URL.revokeObjectURL(objectUrl);
3948
+ a.remove();
3949
+ _this._loadingService.hideLoading();
3950
+ }).catch(function (err) {
3951
+ _this._loadingService.hideLoading();
3952
+ _this._errorService.showError(err, {
3953
+ continueLink: '.'
3954
+ });
4147
3955
  });
4148
- this.dirty = (removedLength > 0 || addedLength > 0);
4149
- this.dirtyChange.emit(this.dirty);
4150
3956
  };
4151
- AdvancedTableEditorDirective.prototype.set = function (items) {
4152
- if (this.table == null) {
4153
- throw new AdvancedTableNotNullError();
4154
- }
4155
- // clear rows
4156
- this.table.selected = [];
4157
- this.table.dataTable.clear();
4158
- // set items
4159
- this.table.dataTable.rows.add(items).draw();
4160
- this.table.load.emit({
4161
- data: items,
4162
- recordsFiltered: items.length,
4163
- recordsTotal: items.length,
4164
- });
3957
+ BtnExpDirective.decorators = [
3958
+ { type: i0.Directive, args: [{
3959
+ selector: '.universis-btn-export'
3960
+ },] }
3961
+ ];
3962
+ /** @nocollapse */
3963
+ BtnExpDirective.ctorParameters = function () {
3964
+ return [
3965
+ { type: ActivatedTableService },
3966
+ { type: i1.AngularDataContext },
3967
+ { type: i2.ConfigurationService },
3968
+ { type: core.TranslateService },
3969
+ { type: i2.LoadingService },
3970
+ { type: i2.ErrorService }
3971
+ ];
4165
3972
  };
3973
+ BtnExpDirective.propDecorators = {
3974
+ clickEvent: [{ type: i0.HostListener, args: ['click', ['$event'],] }]
3975
+ };
3976
+ return BtnExpDirective;
3977
+ }());
3978
+
3979
+ var AdvancedAggregatorService = /** @class */ (function () {
3980
+ function AdvancedAggregatorService(_context, _template) {
3981
+ this._context = _context;
3982
+ this._template = _template;
3983
+ }
4166
3984
  /**
4167
- * Undo changes
3985
+ *
3986
+ * Formats and executes the data query
3987
+ *
3988
+ * @param {string} model The target model
3989
+ * @param {object} fixedParams Pairs of parameters to always be applied
3990
+ * @param {string} queryStatement The default query to use for fetching the data (e.g. expands etc)
3991
+ * @param {Array<string>} filters A list of filter expressions to append at the query
3992
+ * @param {string} searchTemplate The template to use for searching expressions
3993
+ * @param {string} searchValue The value of the user search
3994
+ *
3995
+ * @returns {Promise<any>} The response of the query execution
4168
3996
  */
4169
- AdvancedTableEditorDirective.prototype.undo = function () {
4170
- if (this.table == null) {
4171
- throw new AdvancedTableNotNullError();
3997
+ AdvancedAggregatorService.prototype.fetchData = function (model, fixedParams, queryStatement, filters, searchTemplate, searchValue) {
3998
+ if (queryStatement === void 0) {
3999
+ queryStatement = '';
4172
4000
  }
4173
- // reset removed rows
4174
- this.table.dataTable.rows('.removed').nodes().to$().toggleClass('removed text-gray-400 text-decoration-line-through');
4175
- // remove added rows
4176
- this.table.dataTable.rows('.added').remove();
4177
- // clear selected items
4178
- this.table.selected = [];
4179
- var items = this.table.dataTable.rows().data();
4180
- this.table.dataTable.draw();
4181
- this.table.load.emit({
4182
- data: items,
4183
- recordsFiltered: items.length,
4184
- recordsTotal: items.length,
4001
+ return __awaiter(this, void 0, void 0, function () {
4002
+ var e_1, _a, query, filterExpressions, _b, _c, param, evaluatedSearch, words;
4003
+ var _this = this;
4004
+ return __generator(this, function (_d) {
4005
+ query = this._context.model(model).asQueryable();
4006
+ if (!fixedParams || typeof fixedParams !== 'object') {
4007
+ fixedParams = {};
4008
+ }
4009
+ filterExpressions = [];
4010
+ if (fixedParams) {
4011
+ try {
4012
+ for (_b = __values(Object.keys(fixedParams)), _c = _b.next(); !_c.done; _c = _b.next()) {
4013
+ param = _c.value;
4014
+ filterExpressions.push(param + " eq " + fixedParams[param]);
4015
+ }
4016
+ }
4017
+ catch (e_1_1) {
4018
+ e_1 = { error: e_1_1 };
4019
+ }
4020
+ finally {
4021
+ try {
4022
+ if (_c && !_c.done && (_a = _b.return))
4023
+ _a.call(_b);
4024
+ }
4025
+ finally {
4026
+ if (e_1)
4027
+ throw e_1.error;
4028
+ }
4029
+ }
4030
+ }
4031
+ if (filters && Array.isArray(filters)) {
4032
+ filterExpressions = __spread(filterExpressions, filters);
4033
+ }
4034
+ if (searchTemplate && searchValue) {
4035
+ evaluatedSearch = void 0;
4036
+ if (/^"(.*?)"$/.test(searchValue)) { // validate search text in double quotes
4037
+ evaluatedSearch = this._template.transform(searchTemplate, __assign({}, fixedParams, { text: searchValue.replace(/^"|"$/g, '') }));
4038
+ }
4039
+ else {
4040
+ words = searchValue.split(' ');
4041
+ // join words to a single filter
4042
+ evaluatedSearch = words.map(function (word) {
4043
+ return _this._template.transform(searchTemplate, __assign({}, fixedParams, { text: word }));
4044
+ }).join(' and ');
4045
+ }
4046
+ filterExpressions.push(evaluatedSearch);
4047
+ }
4048
+ query.setParam('$filter', filterExpressions.join('and'));
4049
+ return [2 /*return*/, query.expand(queryStatement).take(-1).getItems()];
4050
+ });
4185
4051
  });
4186
- this.dirty = false;
4187
- this.dirtyChange.emit(this.dirty);
4188
4052
  };
4189
- AdvancedTableEditorDirective.prototype.rows = function () {
4190
- if (this.table == null) {
4191
- throw new AdvancedTableNotNullError();
4053
+ /**
4054
+ *
4055
+ * Formats the received data to use flat keys
4056
+ *
4057
+ * @param config The applied configuration
4058
+ * @param data The raw data
4059
+ *
4060
+ * @returns {Array<any>} The flat-key object list
4061
+ *
4062
+ */
4063
+ AdvancedAggregatorService.prototype.formatData = function (config, data) {
4064
+ var _this = this;
4065
+ try {
4066
+ return data.map(function (entry) {
4067
+ if (entry.subitems && Array.isArray(entry.subitems)) {
4068
+ entry.subitems = _this.formatData(config, entry.subitems);
4069
+ }
4070
+ var entryObject = {};
4071
+ for (var i = 0; i < config.columns.length; i++) {
4072
+ var keys = config.columns[i].name.split('/');
4073
+ var helperObject = entry[keys[0]];
4074
+ if (helperObject && keys.length > 1) {
4075
+ for (var i_1 = 1; i_1 < keys.length; i_1++) {
4076
+ if (helperObject === undefined || helperObject === null) {
4077
+ break;
4078
+ }
4079
+ else {
4080
+ helperObject = helperObject[keys[i_1]] !== undefined && helperObject[keys[i_1]] !== null
4081
+ ? helperObject[keys[i_1]]
4082
+ : undefined;
4083
+ }
4084
+ }
4085
+ }
4086
+ entryObject[config.columns[i].name] = helperObject;
4087
+ }
4088
+ if (entry.subitems) {
4089
+ entryObject.subitems = entry.subitems;
4090
+ }
4091
+ return entryObject;
4092
+ });
4093
+ }
4094
+ catch (err) {
4095
+ console.error(err);
4192
4096
  }
4193
- return Array.from(this.table.dataTable.rows(':not(.removed)').data());
4194
4097
  };
4195
- AdvancedTableEditorDirective.decorators = [
4196
- { type: i0.Directive, args: [{
4197
- // tslint:disable-next-line: directive-selector
4198
- selector: '[tableEditor]',
4098
+ AdvancedAggregatorService.decorators = [
4099
+ { type: i0.Injectable, args: [{
4100
+ providedIn: 'root'
4199
4101
  },] }
4200
4102
  ];
4201
4103
  /** @nocollapse */
4202
- AdvancedTableEditorDirective.ctorParameters = function () {
4104
+ AdvancedAggregatorService.ctorParameters = function () {
4203
4105
  return [
4204
- { type: AdvancedTableComponent }
4106
+ { type: i1.AngularDataContext },
4107
+ { type: i2.TemplatePipe }
4205
4108
  ];
4206
4109
  };
4207
- AdvancedTableEditorDirective.propDecorators = {
4208
- dirtyChange: [{ type: i0.Output }]
4209
- };
4210
- return AdvancedTableEditorDirective;
4110
+ AdvancedAggregatorService.ngInjectableDef = i0.defineInjectable({ factory: function AdvancedAggregatorService_Factory() { return new AdvancedAggregatorService(i0.inject(i1.AngularDataContext), i0.inject(i2.TemplatePipe)); }, token: AdvancedAggregatorService, providedIn: "root" });
4111
+ return AdvancedAggregatorService;
4211
4112
  }());
4212
4113
 
4213
- var MAX_EXPORT_ITEMS = 500;
4214
- var BtnExpDirective = /** @class */ (function () {
4215
- function BtnExpDirective(_activatedTable, _context, _config, _translate, _loadingService, _errorService) {
4216
- this._activatedTable = _activatedTable;
4217
- this._context = _context;
4218
- this._config = _config;
4219
- this._translate = _translate;
4114
+ /**
4115
+ *
4116
+ * @class AdvancedAggregatorComponent
4117
+ * @classdesc An advanced list with the capability of aggregate data based on configurable filters
4118
+ *
4119
+ */
4120
+ var AdvancedAggregatorComponent = /** @class */ (function () {
4121
+ function AdvancedAggregatorComponent(_changeDetector, _advancedAggregatorService, _loadingService) {
4122
+ this._changeDetector = _changeDetector;
4123
+ this._advancedAggregatorService = _advancedAggregatorService;
4220
4124
  this._loadingService = _loadingService;
4221
- this._errorService = _errorService;
4125
+ this.groups = [];
4126
+ this.eventHandler = new i0.EventEmitter();
4222
4127
  }
4223
- BtnExpDirective.prototype.clickEvent = function (event) {
4128
+ Object.defineProperty(AdvancedAggregatorComponent.prototype, "config", {
4129
+ get: function () {
4130
+ return this._config;
4131
+ },
4132
+ set: function (value) {
4133
+ this._config = value;
4134
+ },
4135
+ enumerable: true,
4136
+ configurable: true
4137
+ });
4138
+ Object.defineProperty(AdvancedAggregatorComponent.prototype, "aggregators", {
4139
+ get: function () {
4140
+ return this._aggregators;
4141
+ },
4142
+ set: function (value) {
4143
+ this._aggregators = value;
4144
+ },
4145
+ enumerable: true,
4146
+ configurable: true
4147
+ });
4148
+ Object.defineProperty(AdvancedAggregatorComponent.prototype, "postProcessors", {
4149
+ get: function () {
4150
+ return this._postProcessors;
4151
+ },
4152
+ set: function (value) {
4153
+ this._postProcessors = value;
4154
+ },
4155
+ enumerable: true,
4156
+ configurable: true
4157
+ });
4158
+ AdvancedAggregatorComponent.prototype.ngOnInit = function () {
4224
4159
  return __awaiter(this, void 0, void 0, function () {
4225
- var lastQuery, tableConfig, serviceHeaders, queryModel, query, queryParams, maxExportItems, url;
4160
+ var _this = this;
4226
4161
  return __generator(this, function (_a) {
4227
- event.preventDefault();
4228
- event.stopPropagation();
4229
- if (this._activatedTable.activeTable) {
4230
- lastQuery = this._activatedTable.activeTable.lastQuery;
4231
- tableConfig = this._activatedTable.activeTable.config;
4232
- serviceHeaders = this._context.getService().getHeaders();
4233
- queryModel = lastQuery.getModel();
4234
- query = this._context.model(queryModel).asQueryable();
4235
- queryParams = lastQuery.getParams();
4236
- query = this.constructQuery(query, queryParams, tableConfig, serviceHeaders);
4237
- maxExportItems = 1000;
4238
- if (maxExportItems && typeof maxExportItems === 'number' && maxExportItems > 0) {
4239
- query.skip(0).take(maxExportItems);
4240
- }
4241
- else {
4242
- query.skip(0).take(MAX_EXPORT_ITEMS);
4243
- }
4244
- url = this.constructURL(query);
4245
- this.downloadFile(url, query.getService().getHeaders(), query.getModel());
4246
- }
4162
+ this.selectedGroups$.subscribe(function (data) {
4163
+ _this.groups = data;
4164
+ _this._changeDetector.markForCheck();
4165
+ });
4166
+ this.filters$.subscribe(function (filters) {
4167
+ return __awaiter(_this, void 0, void 0, function () {
4168
+ var err_1;
4169
+ return __generator(this, function (_a) {
4170
+ switch (_a.label) {
4171
+ case 0:
4172
+ _a.trys.push([0, 2, , 3]);
4173
+ return [4 /*yield*/, this.fetch(filters)];
4174
+ case 1:
4175
+ _a.sent();
4176
+ return [3 /*break*/, 3];
4177
+ case 2:
4178
+ err_1 = _a.sent();
4179
+ console.error(err_1);
4180
+ return [3 /*break*/, 3];
4181
+ case 3: return [2 /*return*/];
4182
+ }
4183
+ });
4184
+ });
4185
+ });
4247
4186
  return [2 /*return*/];
4248
4187
  });
4249
4188
  });
4250
4189
  };
4251
- /**
4252
- * Sets the parameters to the query based on
4253
- * the active filters of the activated table
4254
- * @param {ClientDataQueryable} query
4255
- * @param params: The filters of the last query of the activated table
4256
- * @return ClientDataQueryable
4257
- */
4258
- BtnExpDirective.prototype.setParams = function (query, params) {
4259
- if (params && typeof params === 'object') {
4260
- Object.keys(params).forEach(function (key) {
4261
- query.setParam(key, params[key]);
4190
+ AdvancedAggregatorComponent.prototype.ngOnDestroy = function () {
4191
+ return __awaiter(this, void 0, void 0, function () {
4192
+ return __generator(this, function (_a) {
4193
+ this.selectedGroups$.unsubscribe();
4194
+ this.filters$.unsubscribe();
4195
+ return [2 /*return*/];
4262
4196
  });
4263
- }
4264
- return query;
4197
+ });
4265
4198
  };
4266
4199
  /**
4267
- * Sets the headers to the query based on
4268
- * the default headers of the DataContext
4269
- * and appending the accept header to get
4270
- * an xlsx file from the API
4271
- * @param {ClientDataQueryable} query
4272
- * @param {Headers} headers: The headers to append to the query
4273
- * @return ClientDataQueryable
4200
+ *
4201
+ * Retrieves the data
4202
+ *
4274
4203
  */
4275
- BtnExpDirective.prototype.setHeaders = function (query, headers) {
4276
- Object.keys(headers).forEach(function (key) {
4277
- if (headers.hasOwnProperty(key)) {
4278
- query.getService().setHeader(key, headers[key]);
4279
- }
4204
+ AdvancedAggregatorComponent.prototype.fetch = function (filters) {
4205
+ return __awaiter(this, void 0, void 0, function () {
4206
+ var data, i, err_2;
4207
+ return __generator(this, function (_a) {
4208
+ switch (_a.label) {
4209
+ case 0:
4210
+ _a.trys.push([0, 6, 7, 8]);
4211
+ this._loadingService.showLoading();
4212
+ return [4 /*yield*/, this._advancedAggregatorService.fetchData(this.config.model, this.params, this.config.query, filters.filters, this.searchExpression, filters.text)];
4213
+ case 1:
4214
+ data = _a.sent();
4215
+ if (!(this.postProcessors && Object.keys(this.postProcessors).length > 0 && this.config.postProcessors && this.config.postProcessors.length > 0))
4216
+ return [3 /*break*/, 5];
4217
+ i = 0;
4218
+ _a.label = 2;
4219
+ case 2:
4220
+ if (!(i < this.config.postProcessors.length))
4221
+ return [3 /*break*/, 5];
4222
+ return [4 /*yield*/, this.postProcessors[this.config.postProcessors[i].name](data)];
4223
+ case 3:
4224
+ data = _a.sent();
4225
+ _a.label = 4;
4226
+ case 4:
4227
+ i++;
4228
+ return [3 /*break*/, 2];
4229
+ case 5:
4230
+ this.body = this._advancedAggregatorService.formatData(this.config, data);
4231
+ this._changeDetector.markForCheck();
4232
+ return [3 /*break*/, 8];
4233
+ case 6:
4234
+ err_2 = _a.sent();
4235
+ console.error(err_2);
4236
+ return [3 /*break*/, 8];
4237
+ case 7:
4238
+ this._loadingService.hideLoading();
4239
+ return [7 /*endfinally*/];
4240
+ case 8: return [2 /*return*/];
4241
+ }
4242
+ });
4280
4243
  });
4281
- // sets a header to accept xlsx files
4282
- query.getService().setHeader('Accept', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
4283
- return query;
4284
4244
  };
4285
4245
  /**
4286
- * Constructs the select parameter of the
4287
- * ClientDataQuery by replacing the target name
4288
- * of the field based on the localized translation
4289
- * of that property on the advanced tabled
4290
- * @param {ClientDataQueryable} query
4291
- * @param tableConfig: The configuration of the activated table
4292
- * @return ClientDataQueryable
4246
+ *
4247
+ * Triggers the event handler event
4248
+ *
4249
+ * @param {*} event The event data
4250
+ *
4293
4251
  */
4294
- BtnExpDirective.prototype.constructQueryParam = function (query, tableConfig) {
4295
- var _this = this;
4296
- var selectQuery = query.getParams().$select;
4297
- var selectQueryArray = selectQuery.split(',');
4298
- selectQueryArray = selectQueryArray.map(function (select) {
4299
- var e_1, _a, e_2, _b;
4300
- var words = select.split(' ');
4301
- if (words.length === 3) {
4302
- if (tableConfig && tableConfig.columns) {
4303
- try {
4304
- for (var _c = __values(tableConfig.columns), _d = _c.next(); !_d.done; _d = _c.next()) {
4305
- var column = _d.value;
4306
- if (column.property === words[2] && column.title) {
4307
- words[2] = "\"" + _this._translate.instant(column.title) + "\"";
4308
- }
4309
- else if (column.property === words[2]) {
4310
- words[2] = "\"" + _this._translate.instant(words[2]) + "\"";
4311
- }
4312
- }
4313
- }
4314
- catch (e_1_1) {
4315
- e_1 = { error: e_1_1 };
4316
- }
4317
- finally {
4318
- try {
4319
- if (_d && !_d.done && (_a = _c.return))
4320
- _a.call(_c);
4321
- }
4322
- finally {
4323
- if (e_1)
4324
- throw e_1.error;
4325
- }
4326
- }
4327
- }
4328
- }
4329
- if (words.length === 1) {
4330
- if (tableConfig && tableConfig.columns) {
4331
- try {
4332
- for (var _e = __values(tableConfig.columns), _f = _e.next(); !_f.done; _f = _e.next()) {
4333
- var column = _f.value;
4334
- if (column.name === words[0] && column.title) {
4335
- words[0] = words[0] + " as \"" + _this._translate.instant(column.title) + "\"";
4336
- break;
4337
- }
4338
- else if (column.name === words[0] && column.property) {
4339
- words[0] = words[0] + " as \"" + _this._translate.instant(column.property) + "\"";
4340
- break;
4341
- }
4342
- else if (words[0] === column.name && words[0] === "id" && column.hidden) {
4343
- break;
4344
- }
4345
- else if (words[0] == column.name || words[0] === column.property) {
4346
- words[0] = words[0] + " as \"" + _this._translate.instant(words[0]) + "\"";
4347
- }
4348
- }
4349
- }
4350
- catch (e_2_1) {
4351
- e_2 = { error: e_2_1 };
4352
- }
4353
- finally {
4354
- try {
4355
- if (_f && !_f.done && (_b = _e.return))
4356
- _b.call(_e);
4357
- }
4358
- finally {
4359
- if (e_2)
4360
- throw e_2.error;
4361
- }
4362
- }
4363
- }
4364
- return words[0];
4365
- }
4366
- return words.join(' ');
4252
+ AdvancedAggregatorComponent.prototype.onActionEvent = function (event) {
4253
+ this.eventHandler.emit(event);
4254
+ };
4255
+ AdvancedAggregatorComponent.decorators = [
4256
+ { type: i0.Component, args: [{
4257
+ selector: 'app-advanced-aggregator',
4258
+ template: "<ng-container *ngIf=\"config && body\">\n <div class=\"w-100 text-center\" *ngIf=\"body && body.length === 0\">\n <div>\n <div class=\"mt-4\">\n <div class=\"icon-circle bg-gray-300 border-gray-100\"></div>\n </div>\n <div class=\"mt-4\">\n <h4 class=\"font-3xl text-dark\" [translate]=\"'Tables.EmptyTableTitle'\"></h4>\n <p class=\"font-lg text-dark\" [translate]=\"'Tables.EmptyTableMessage'\"></p>\n </div>\n </div>\n </div>\n <ng-container *ngIf=\"groups.length === 0\">\n <div class=\"row mt-4\">\n <app-advanced-aggregator-list [body]=\"body\" [config]=\"config\" (clickEvent)=\"onActionEvent($event)\" class=\"col-12\">\n </app-advanced-aggregator-list>\n <div *ngIf=\"config.aggregators && config.aggregators.length > 0\"\n class=\"footer-text text-dark font-weight-normal text-right font-sm mt-3 mr-2 w-100\">\n <div *ngFor=\"let aggregator of config.aggregators\">\n <span *ngIf=\"aggregator.label\"> {{ aggregator.label | translate }} </span>:\n <span class=\"font-weight-bold\"> {{ body | callAggregator: aggregators: aggregator.name }}\n </span>\n </div>\n </div>\n </div>\n </ng-container>\n <ng-container *ngIf=\"groups.length === 1\">\n <ng-container *ngFor=\"let group of body | groupBy: groups[0].name | keyvalue\">\n <div class=\"row mt-4\">\n <h4 class=\"col text-secondary\"> {{ groups[0].title | aggregatorListTitle: group.key }} </h4>\n <app-advanced-aggregator-list [body]=\"group.value\" [config]=\"config\" (clickEvent)=\"onActionEvent($event)\"\n class=\"col-12\">\n </app-advanced-aggregator-list>\n </div>\n\n <!-- Footer for the group -->\n <div *ngIf=\"config.aggregators && config.aggregators.length > 0\"\n class=\"footer-text text-dark font-weight-normal text-right font-sm mt-3 mr-2 w-100\">\n <div *ngFor=\"let aggregator of config.aggregators\">\n <span *ngIf=\"aggregator.label\"> {{ aggregator.label | translate }} </span>:\n <span class=\"font-weight-bold\"> {{ group.value | callAggregator: aggregators: aggregator.name }} </span>\n </div>\n </div>\n </ng-container>\n </ng-container>\n <ng-container *ngIf=\"groups.length > 1\">\n <ng-container *ngFor=\"let group of body | groupBy: groups[0].name | keyvalue\">\n <div class=\"row mt-4\">\n <h4 class=\"col text-secondary\"> {{ groups[0].title | aggregatorListTitle: group.key }} </h4>\n <div *ngFor=\"let subgroup of group.value | groupBy: groups[1].name | keyvalue\" class=\"col-12 ml-4 pl-4\">\n <div class=\"row mt-4\">\n <h6 class=\"col-12 text-secondary\"> {{ groups[1].title | aggregatorListTitle: subgroup.key }} </h6>\n <app-advanced-aggregator-list [body]=\"subgroup.value\" [config]=\"config\" (clickEvent)=\"onActionEvent($event)\"\n class=\"col-12\">\n </app-advanced-aggregator-list>\n </div>\n\n <!-- Footer for each subgroup -->\n <div *ngIf=\"config.aggregators && config.aggregators.length > 0\"\n class=\"footer-text text-dark font-weight-normal text-right font-sm mt-3 mr-2 w-100\">\n <div *ngFor=\"let aggregator of config.aggregators\">\n <span *ngIf=\"aggregator.label\"> {{ aggregator.label | translate }} </span>:\n <span class=\"font-weight-bold\"> {{ subgroup.value | callAggregator: aggregators: aggregator.name }}\n </span>\n </div>\n </div>\n </div>\n </div>\n </ng-container>\n </ng-container>\n</ng-container>",
4259
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
4260
+ }] }
4261
+ ];
4262
+ /** @nocollapse */
4263
+ AdvancedAggregatorComponent.ctorParameters = function () {
4264
+ return [
4265
+ { type: i0.ChangeDetectorRef },
4266
+ { type: AdvancedAggregatorService },
4267
+ { type: i2.LoadingService }
4268
+ ];
4269
+ };
4270
+ AdvancedAggregatorComponent.propDecorators = {
4271
+ config: [{ type: i0.Input, args: ['config',] }],
4272
+ aggregators: [{ type: i0.Input, args: ['aggregators',] }],
4273
+ postProcessors: [{ type: i0.Input, args: ['postProcessors',] }],
4274
+ params: [{ type: i0.Input, args: ['params',] }],
4275
+ selectedGroups$: [{ type: i0.Input, args: ['selectedGroups',] }],
4276
+ filters$: [{ type: i0.Input, args: ['filters',] }],
4277
+ searchExpression: [{ type: i0.Input, args: ['searchExpression',] }],
4278
+ eventHandler: [{ type: i0.Output }]
4279
+ };
4280
+ return AdvancedAggregatorComponent;
4281
+ }());
4282
+
4283
+ var Lengths;
4284
+ (function (Lengths) {
4285
+ Lengths["XL"] = "xl";
4286
+ Lengths["LG"] = "lg";
4287
+ Lengths["MD"] = "md";
4288
+ Lengths["SM"] = "sm";
4289
+ Lengths["XS"] = "xs";
4290
+ })(Lengths || (Lengths = {}));
4291
+ var AdvancedAggregatorListComponent = /** @class */ (function () {
4292
+ function AdvancedAggregatorListComponent(_template) {
4293
+ this._template = _template;
4294
+ this.clickEvent = new i0.EventEmitter();
4295
+ }
4296
+ AdvancedAggregatorListComponent.prototype.ngOnInit = function () {
4297
+ var _this = this;
4298
+ this.config.columns.forEach(function (x) {
4299
+ x.length = Object.values(Lengths).includes(x.length) ? _this._template.transform("sis--list-group-item_" + x.length + "_column", x) :
4300
+ !x.length ? 'sis--list-group-item_sm_column' : x.length;
4367
4301
  });
4368
- selectQuery = selectQueryArray.join(',');
4369
- query.setParam('$select', selectQuery);
4370
- return query;
4371
4302
  };
4372
4303
  /**
4373
- * Constructs the fetch URL based the query parameters
4374
- * @param {ClientDataQueryable} query
4375
- * @return String
4304
+ *
4305
+ * Triggers the output event emitter
4306
+ *
4307
+ * @param type The type of the event as it's declared in the configuration
4308
+ * @param item The value of the current item
4309
+ * }
4376
4310
  */
4377
- BtnExpDirective.prototype.constructURL = function (query) {
4378
- var baseURL = query.getService().getBase();
4379
- var url = baseURL.endsWith('/') ? (baseURL + query.getModel() + '?') : (baseURL + '/' + query.getModel() + '?');
4380
- Object.keys(query.getParams()).forEach(function (key, index) {
4381
- if (index === 0) {
4382
- url += key + '=' + query.getParams()[key];
4383
- }
4384
- else {
4385
- url += '&' + key + '=' + query.getParams()[key];
4386
- }
4311
+ AdvancedAggregatorListComponent.prototype.callCallback = function (type, data) {
4312
+ this.clickEvent.emit({
4313
+ type: type,
4314
+ data: data
4387
4315
  });
4388
- return url;
4389
4316
  };
4390
- /**
4391
- * Constructs the query by setting the parameters of the
4392
- * advanced table's active filters, sets the necessary headers
4393
- * and build the select parameter of the query
4394
- * @param {ClientDataQueryable} query
4395
- * @param params: The filters of the last query of the activated table
4396
- * @param tableConfig: The configuration of the activated table
4397
- * @param {Headers} headers: The headers to append to the query
4398
- * @return ClientDataQueryable
4399
- */
4400
- BtnExpDirective.prototype.constructQuery = function (query, params, tableConfig, headers) {
4401
- var _query = this.setParams(query, params);
4402
- _query = this.setHeaders(_query, headers);
4403
- _query = this.constructQueryParam(_query, tableConfig);
4404
- return _query;
4317
+ AdvancedAggregatorListComponent.decorators = [
4318
+ { type: i0.Component, args: [{
4319
+ selector: 'app-advanced-aggregator-list',
4320
+ template: "<div id=\"group-list\" class=\"flex-column\" *ngIf=\"config && config.columns\">\n <ul class=\"sis--list-group sis--list-group-header\">\n <li class=\"sis--list-group-item text-wrap\">\n <div class=\"d-flex justify-content-center align-items-center\" *ngIf=\"body && body.length > 0\">\n <div *ngIf=\"config.actions && config.actions.length > 0\" class=\"sis--list-group-item_sm_column\"></div>\n <div *ngFor=\"let column of config.columns; let i = index\" class=\"text-left\"\n [class]=\"config.columns[i].length\"\n [translate]=\"config.columns[i].type === 'action' ? '' : column.title\" [ngClass]=\"{\n 'd-none': config.columns[i].hidden\n }\"></div>\n </div>\n </li>\n </ul>\n\n <!-- The list of entries -->\n <ul class=\"sis--list-group sis--list-group-body\" *ngIf=\"body && body.length > 0\">\n <li class=\"sis--list-group-item text-wrap\" *ngFor=\"let entry of body | orderBy: config.orderBy\">\n <div class=\"d-flex justify-content-center align-items-center list-color\">\n <!-- The list of actions -->\n <div *ngIf=\"config.actions && config.actions.length > 0\" class=\"sis--list-group-item_sm_column text-left pr-0\">\n <button *ngFor=\"let action of config.actions\" (click)=\"callCallback(action.identifier, entry)\"\n [title]=\"(action.title ? action.title : '') | translate \" class=\"btn btn-default px-0\">\n <i *ngIf=\"action.type === 'edit'\" class=\"fas fa-edit text-indigo\"></i>\n </button>\n <span class=\"px-0\">\n <i class=\"fa fa-fw\">&nbsp;</i>\n </span>\n\n </div>\n <!-- The list of data -->\n <div *ngFor=\"let column of config.columns; let i=index\" [class]=\"config.columns[i].length\" class=\"text-left\"\n [ngClass]=\"{\n 'text-truncate': config.columns[i].hasOwnProperty('truncate') && config.columns[i].truncate,\n 'd-none': config.columns[i].hidden,\n 'd-md-block': !config.columns[i].hidden\n }\"\n [title]=\"config.columns[i].hasOwnProperty('truncate') && config.columns[i].truncate ? entry[column.name] : ''\">\n <span class=\"text-secondary\"\n *ngIf=\"!config.columns[i].hasOwnProperty('type') || (config.columns[i].hasOwnProperty('type') && config.columns[i].type === 'text')\"\n [ngClass]=\"{\n 'font-xs': config.columns[i].variant !== 'primary',\n 'text-body': config.columns[i].variant === 'primary',\n 'text-success': config.columns[i].variant === 'redGreen' && config.columns[i].hasOwnProperty('condition') && entry[config.columns[i].condition],\n 'text-danger': config.columns[i].variant === 'redGreen' && config.columns[i].hasOwnProperty('condition') && !entry[config.columns[i].condition],\n 'font-lg': config.columns[i].variant === 'redGreen' && entry[column.name] && entry[column.name].length > 3,\n 'font-2xl': config.columns[i].variant === 'redGreen' && entry[column.name] && entry[column.name].length <= 3\n }\">\n {{entry[column.name] || '-'}}\n </span>\n\n <button *ngIf=\"config.columns[i].type === 'action' && config.columns[i].variant === 'edit'\"\n (click)=\"callCallback(config.columns[i].identifier, entry)\"\n [title]=\"(config.columns[i].title ? config.columns[i].title : '') | translate \"\n class=\"btn btn-default px-0 mx-0\">\n <i class=\"fas fa-edit text-indigo\"></i>\n </button>\n\n <span *ngIf=\"config.columns[i].type === 'boolean'\">\n <i class=\"fa font-lg\" [ngClass]=\"{\n 'fa-check text-success': entry[column.name].toString() === config.columns[i].trueValue,\n 'fa-times text-danger': entry[column.name].toString() !== config.columns[i].trueValue && config.columns[i].variant !== 'checkOrDash'\n }\"></i>\n <span\n *ngIf=\"entry[column.name].toString() !== config.columns[i].trueValue && config.columns[i].variant === 'checkOrDash'\"\n class=\"text-secondary font-xs\">-</span>\n </span>\n </div>\n </div>\n <div *ngIf=\"entry && entry.subitems\">\n <div *ngFor=\"let subitem of entry.subitems\" class=\"d-flex justify-content-center align-items-center list-color\">\n <div *ngIf=\"config.actions && config.actions.length > 0\" class=\"sis--list-group-item_sm_column text-left pr-0\">\n <span class=\"px-0\">\n <i class=\"fa fa-fw\">&nbsp;</i>\n </span>\n <button *ngFor=\"let action of config.actions\" (click)=\"callCallback(action.identifier, subitem)\"\n [title]=\"(action.title ? action.title : '') | translate \" class=\"btn btn-default px-0\">\n <i *ngIf=\"action.type === 'edit'\" class=\"fas fa-edit text-indigo\"></i>\n </button>\n </div>\n <div class=\"text-left\"></div>\n <div *ngFor=\"let column of config.columns; let i=index\" [class]=\"config.columns[i].length\" class=\"text-left\"\n [ngClass]=\"{\n 'text-truncate': config.columns[i].hasOwnProperty('truncate') && config.columns[i].truncate,\n 'd-none': config.columns[i].hidden,\n 'd-md-block': !config.columns[i].hidden\n }\"\n [title]=\"config.columns[i].hasOwnProperty('truncate') && config.columns[i].truncate ? entry[column.name] : ''\">\n <span class=\"text-secondary\"\n *ngIf=\"!config.columns[i].hasOwnProperty('type') || (config.columns[i].hasOwnProperty('type') && config.columns[i].type === 'text')\"\n [ngClass]=\"{\n 'font-xs': config.columns[i].variant !== 'primary',\n 'text-body': config.columns[i].variant === 'primary',\n 'text-success': config.columns[i].variant === 'redGreen' && config.columns[i].hasOwnProperty('condition') && subitem[config.columns[i].condition],\n 'text-danger': config.columns[i].variant === 'redGreen' && config.columns[i].hasOwnProperty('condition') && !subitem[config.columns[i].condition],\n 'font-lg': config.columns[i].variant === 'redGreen' && subitem[column.name] && subitem[column.name].length > 3,\n 'font-2xl': config.columns[i].variant === 'redGreen' && subitem[column.name] && subitem[column.name].length <= 3\n }\">\n {{subitem[column.name] || '-'}}\n </span>\n <span *ngIf=\"config.columns[i].type === 'boolean'\">\n <i class=\"fa font-lg\" [ngClass]=\"{\n 'fa-check text-success': subitem[column.name].toString() === config.columns[i].trueValue,\n 'fa-times text-danger': subitem[column.name].toString() !== config.columns[i].trueValue && config.columns[i].variant !== 'checkOrDash'\n }\"></i>\n <span\n *ngIf=\"subitem[column.name].toString() !== config.columns[i].trueValue && config.columns[i].variant === 'checkOrDash'\"\n class=\"text-secondary font-xs\">-</span>\n </span>\n </div>\n </div>\n </div>\n </li>\n </ul>\n</div>\n"
4321
+ }] }
4322
+ ];
4323
+ /** @nocollapse */
4324
+ AdvancedAggregatorListComponent.ctorParameters = function () {
4325
+ return [
4326
+ { type: i2.TemplatePipe }
4327
+ ];
4405
4328
  };
4406
- /**
4407
- * Fetches and saves the xlsx file
4408
- * @param {String} url
4409
- * @param {Headers} serviceHeaders: The headers to append to the query
4410
- * @param modelName: The model name of the advanced table
4411
- */
4412
- BtnExpDirective.prototype.downloadFile = function (url, serviceHeaders, modelName) {
4329
+ AdvancedAggregatorListComponent.propDecorators = {
4330
+ config: [{ type: i0.Input }],
4331
+ body: [{ type: i0.Input }],
4332
+ clickEvent: [{ type: i0.Output }]
4333
+ };
4334
+ return AdvancedAggregatorListComponent;
4335
+ }());
4336
+
4337
+ var AddItemsComponent = /** @class */ (function (_super) {
4338
+ __extends(AddItemsComponent, _super);
4339
+ function AddItemsComponent(router, activatedRoute, _errorService, _modalService, _appEvent, _toastService, _loadingService, _translateService, _context) {
4340
+ var _this = _super.call(this, router, activatedRoute) || this;
4341
+ _this._errorService = _errorService;
4342
+ _this._modalService = _modalService;
4343
+ _this._appEvent = _appEvent;
4344
+ _this._toastService = _toastService;
4345
+ _this._loadingService = _loadingService;
4346
+ _this._translateService = _translateService;
4347
+ _this._context = _context;
4348
+ _this.loading = false;
4349
+ _this.items = [];
4350
+ _this.messages = [];
4351
+ // set modal size
4352
+ _this.modalClass = 'modal-lg';
4353
+ _this.okButtonDisabled = true;
4354
+ return _this;
4355
+ }
4356
+ AddItemsComponent.prototype.ngOnInit = function () {
4413
4357
  var _this = this;
4414
- this._loadingService.showLoading();
4415
- fetch(encodeURI(url), {
4416
- headers: serviceHeaders,
4417
- credentials: 'include'
4418
- }).then(function (response) {
4419
- if (response && !response.ok) {
4420
- throw new client.ResponseError(response.statusText, response.status);
4421
- }
4422
- return response.blob();
4423
- }).then(function (blob) {
4424
- var objectUrl = window.URL.createObjectURL(blob);
4425
- var a = document.createElement('a');
4426
- document.body.appendChild(a);
4427
- a.setAttribute('style', 'display: none');
4428
- a.href = objectUrl;
4429
- var downloadName = modelName + ".xlsx";
4430
- a.download = downloadName;
4431
- // this adds support for IE and MS Edge (up to version 44.19041)
4432
- if (window.navigator && window.navigator.msSaveOrOpenBlob) {
4433
- window.navigator.msSaveOrOpenBlob(blob, downloadName);
4358
+ this.selectedSubscription = this.selectComponent.advancedTable.selectedItems.subscribe(function (items) {
4359
+ if (_this.formName == null) {
4360
+ _this.okButtonDisabled = items.length === 0;
4434
4361
  }
4435
- else {
4436
- // for all other browsers
4437
- a.click();
4362
+ });
4363
+ if (this.formName != null) {
4364
+ this.formChangeSubscription = this.formComponent.form.change.subscribe(function (event) {
4365
+ if (Object.prototype.hasOwnProperty.call(event, 'isValid')) {
4366
+ // enable or disable button based on form status
4367
+ _this.okButtonDisabled = (!event.isValid);
4368
+ }
4369
+ });
4370
+ }
4371
+ if (this.target) {
4372
+ var target = this.target;
4373
+ }
4374
+ };
4375
+ AddItemsComponent.prototype.cancel = function () {
4376
+ this.clearMessages();
4377
+ if (this.loading) {
4378
+ return;
4379
+ }
4380
+ // close
4381
+ if (this._modalService.modalRef) {
4382
+ return this._modalService.modalRef.hide();
4383
+ }
4384
+ };
4385
+ AddItemsComponent.prototype.ngOnDestroy = function () {
4386
+ if (this.formLoadSubscription) {
4387
+ this.formLoadSubscription.unsubscribe();
4388
+ }
4389
+ if (this.formChangeSubscription) {
4390
+ this.formChangeSubscription.unsubscribe();
4391
+ }
4392
+ if (this.selectedSubscription) {
4393
+ this.selectedSubscription.unsubscribe();
4394
+ }
4395
+ };
4396
+ Object.defineProperty(AddItemsComponent.prototype, "formData", {
4397
+ get: function () {
4398
+ if (this.formComponent === null) {
4399
+ return null;
4438
4400
  }
4439
- window.URL.revokeObjectURL(objectUrl);
4440
- a.remove();
4441
- _this._loadingService.hideLoading();
4442
- }).catch(function (err) {
4443
- _this._loadingService.hideLoading();
4444
- _this._errorService.showError(err, {
4445
- continueLink: '.'
4401
+ return this.formComponent.form.formio.data;
4402
+ },
4403
+ enumerable: true,
4404
+ configurable: true
4405
+ });
4406
+ AddItemsComponent.prototype.ok = function () {
4407
+ var _this = this;
4408
+ try {
4409
+ this.clearMessages();
4410
+ return new Promise(function (resolve, reject) {
4411
+ _this.loading = false;
4412
+ _this.lastError = null;
4413
+ // set courses
4414
+ _this.items = _this.selectComponent.advancedTable.selected;
4415
+ // execute add
4416
+ _this.executeSubscription = _this.execute.subscribe(function (result) {
4417
+ _this.loading = false;
4418
+ if (_this.executeSubscription) {
4419
+ _this.executeSubscription.unsubscribe();
4420
+ }
4421
+ // close modal
4422
+ if (_this._modalService.modalRef) {
4423
+ _this._modalService.modalRef.hide();
4424
+ }
4425
+ return resolve();
4426
+ }, function (err) {
4427
+ _this.loading = false;
4428
+ // ensure that loading is hidden
4429
+ _this._loadingService.hideLoading();
4430
+ // set last error
4431
+ _this.lastError = err;
4432
+ return resolve();
4433
+ });
4446
4434
  });
4447
- });
4435
+ }
4436
+ catch (err) {
4437
+ this.loading = false;
4438
+ this._loadingService.hideLoading();
4439
+ this.lastError = err;
4440
+ }
4448
4441
  };
4449
- BtnExpDirective.decorators = [
4450
- { type: i0.Directive, args: [{
4451
- selector: '.universis-btn-export'
4452
- },] }
4442
+ AddItemsComponent.prototype.onChange = function ($event) { };
4443
+ AddItemsComponent.prototype.clearMessages = function () {
4444
+ this.messages = [];
4445
+ };
4446
+ AddItemsComponent.prototype.onFilterChange = function (event) { };
4447
+ AddItemsComponent.decorators = [
4448
+ { type: i0.Component, args: [{
4449
+ selector: 'app-add-items',
4450
+ template: "<div>\n <div class=\"modal-header\" *ngIf=\"modalTitle\">\n <h5 class=\"modal-title\">{{modalTitle | translate}}</h5>\n <button (click)=\"cancel()\" [disabled]=\"loading\"\n type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Cancel\">\n <span aria-hidden=\"true\">&times;</span>\n </button>\n </div>\n <div class=\"modal-body pt-0\">\n <div class=\"row\" *ngIf=\"lastError\">\n <div class=\"alert alert-danger col-12\" role=\"alert\">\n <span [translate]=\"'E' + (lastError.statusCode || 500) + '.title'\"></span><br>\n <small *ngIf=\"lastError.statusCode >= 0\" [translate]=\"'E' + (lastError.statusCode || 500) + '.message'\"></small>\n <small *ngIf=\"lastError.statusCode == null\">{{lastError.message}}</small>\n </div>\n </div>\n <div class=\"row d-none\" *ngIf=\"items\">\n <div class=\"col-12\">\n <p [translate]=\"'StudyPrograms.AddCoursesHelp'\" [translateParams]=\"items\" ></p>\n </div>\n </div>\n <div class=\"row mt-3\">\n <div class=\"col-12\">\n <ng-container>\n <ul style=\"margin-left: -24px\" class=\"nav nav-tabs mb-1\" id=\"myTab\" role=\"tablist\">\n <li class=\"nav-item\" *ngIf=\"tableConfiguration\">\n <a class=\"nav-link active\" id=\"courses-tab\" data-toggle=\"tab\" href=\"#courses\" role=\"tab\" aria-controls=\"home\" aria-selected=\"true\" [translate]=\"'AddItems.SelectCourses'\" ></a>\n </li>\n <li class=\"nav-item\" *ngIf=\"formName\">\n <a class=\"nav-link\" [ngClass]=\"{ 'disabled': !(selectComponent.advancedTable.selected && selectComponent.advancedTable.selected.length) }\" id=\"attributes-tab\" data-toggle=\"tab\" href=\"#attributes\" role=\"tab\" aria-controls=\"profile\" aria-selected=\"false\" [translate]=\"'AddItems.EditAttributes'\"></a>\n </li>\n <li class=\"nav-item\" *ngIf=\"messages && messages.length > 0\">\n <a class=\"nav-link\" id=\"messages-tab\" data-toggle=\"tab\" href=\"#messages\" role=\"tab\" aria-controls=\"profile\" aria-selected=\"false\" [translate]=\"'AddItems.Messages'\"></a>\n </li>\n </ul>\n <div class=\"tab-content border-0\" id=\"myTabContent\">\n <div class=\"tab-pane fade show active\" id=\"courses\" role=\"tabpanel\" aria-labelledby=\"home-tab\">\n <app-advanced-table-modal #selectComponent (filter)=\"onFilterChange($event)\" [tableConfig]=\"tableConfiguration\"></app-advanced-table-modal>\n </div>\n <div class=\"tab-pane fade\" id=\"attributes\" role=\"tabpanel\" aria-labelledby=\"profile-tab\"\n [ngClass]=\"{'invisible':(formName == null)}\">\n<!-- <advanced-form-edit #formComponent [formName]=\"formName\" ></advanced-form-edit>-->\n </div>\n <div class=\"tab-pane fade\" id=\"messages\" role=\"tabpanel\" aria-labelledby=\"profile-tab\"\n [ngClass]=\"{'invisible':(messages == null)}\">\n <ul *ngIf=\"messages && messages.length>0\" class=\"sis--list-group sis--list-group-header\">\n <li class=\"sis--list-group-item\">\n <div class=\"d-flex justify-content-center align-items-center\">\n <div class=\"sis--list-group-item_lg_column\" [translate]=\"'AddItems.Messages'\"></div>\n </div>\n </li>\n </ul>\n <ul class=\"sis--list-group sis--list-group-body\">\n <li *ngFor=\"let message of messages\" class=\"sis--list-group-item\">\n <div class=\"d-flex justify-content-center align-items-center list-color\">\n <div class=\"sis--list-group-item_lg_column\">{{ message?.message }}</div>\n </div>\n </li>\n </ul>\n <div *ngIf=\"messages && messages.length>0\">\n <button [disabled]=\"loading\" (click)=\"clearMessages()\" type=\"button\" class=\"btn btn-indigo mt-3\">\n {{'Clear' | translate}}\n </button>\n </div>\n </div>\n </div>\n </ng-container>\n </div>\n </div>\n </div>\n <div class=\"modal-footer justify-content-end\">\n <button [disabled]=\"okButtonDisabled || loading || !(selectComponent.advancedTable.selected && selectComponent.advancedTable.selected.length) \" (click)=\"ok()\"\n type=\"button\" [ngClass]=\"okButtonClass\">\n {{'OK' | translate}}\n </button>\n <button [disabled]=\"cancelButtonDisabled || loading\"\n (click)=\"cancel()\" type=\"button\" [ngClass]=\"cancelButtonClass\" data-dismiss=\"modal\">\n {{'Cancel' | translate}}\n </button>\n </div>\n</div>\n"
4451
+ }] }
4453
4452
  ];
4454
4453
  /** @nocollapse */
4455
- BtnExpDirective.ctorParameters = function () {
4454
+ AddItemsComponent.ctorParameters = function () {
4456
4455
  return [
4457
- { type: ActivatedTableService },
4458
- { type: i1.AngularDataContext },
4459
- { type: i2.ConfigurationService },
4460
- { type: core.TranslateService },
4456
+ { type: i1$1.Router },
4457
+ { type: i1$1.ActivatedRoute },
4458
+ { type: i2.ErrorService },
4459
+ { type: i2.ModalService },
4460
+ { type: i2.AppEventService },
4461
+ { type: i2.ToastService },
4461
4462
  { type: i2.LoadingService },
4462
- { type: i2.ErrorService }
4463
+ { type: core.TranslateService },
4464
+ { type: i1.AngularDataContext }
4463
4465
  ];
4464
4466
  };
4465
- BtnExpDirective.propDecorators = {
4466
- clickEvent: [{ type: i0.HostListener, args: ['click', ['$event'],] }]
4467
+ AddItemsComponent.propDecorators = {
4468
+ execute: [{ type: i0.Input }],
4469
+ items: [{ type: i0.Input }],
4470
+ target: [{ type: i0.Input }],
4471
+ tableConfiguration: [{ type: i0.Input }],
4472
+ formName: [{ type: i0.Input }],
4473
+ messages: [{ type: i0.Input }],
4474
+ formComponent: [{ type: i0.ViewChild, args: ['formComponent',] }],
4475
+ selectComponent: [{ type: i0.ViewChild, args: ['selectComponent',] }]
4467
4476
  };
4468
- return BtnExpDirective;
4469
- }());
4477
+ return AddItemsComponent;
4478
+ }(routing.RouterModalOkCancel));
4470
4479
 
4471
4480
  /**
4472
4481
  *
@@ -4558,6 +4567,7 @@
4558
4567
  "Search": "Αναζήτηση",
4559
4568
  "SearchPlaceholder": "Αναζήτηση...",
4560
4569
  "GroupBy": "Ομαδοποίηση ανά",
4570
+ "NotDefined": "Μη προσδιορισμένο",
4561
4571
  "DataTable": {
4562
4572
  "paginate": {
4563
4573
  "first": "Πρώτη σελίδα",
@@ -4661,6 +4671,7 @@
4661
4671
  "Search": "Search",
4662
4672
  "SearchPlaceholder": "Search...",
4663
4673
  "GroupBy": "Group by",
4674
+ "NotDefined": "Not defined",
4664
4675
  "DataTable": {
4665
4676
  "paginate": {
4666
4677
  "first": "First",
@@ -4864,9 +4875,6 @@
4864
4875
  * Generated bundle index. Do not edit.
4865
4876
  */
4866
4877
 
4867
- exports.AddItemsComponent = AddItemsComponent;
4868
- exports.AdvancedAggregatorComponent = AdvancedAggregatorComponent;
4869
- exports.AdvancedAggregatorListComponent = AdvancedAggregatorListComponent;
4870
4878
  exports.AdvancedListComponent = AdvancedListComponent;
4871
4879
  exports.AdvancedRowActionComponent = AdvancedRowActionComponent;
4872
4880
  exports.AdvancedSearchFormComponent = AdvancedSearchFormComponent;
@@ -4903,6 +4911,9 @@
4903
4911
  exports.AdvancedTableNotNullError = AdvancedTableNotNullError;
4904
4912
  exports.AdvancedTableEditorDirective = AdvancedTableEditorDirective;
4905
4913
  exports.BtnExpDirective = BtnExpDirective;
4914
+ exports.AdvancedAggregatorComponent = AdvancedAggregatorComponent;
4915
+ exports.AdvancedAggregatorListComponent = AdvancedAggregatorListComponent;
4916
+ exports.AddItemsComponent = AddItemsComponent;
4906
4917
  exports.AdvancedAggregatorPipe = AdvancedAggregatorPipe;
4907
4918
  exports.ParseTitlePipe = ParseTitlePipe;
4908
4919
  exports.AdvancedAggregatorService = AdvancedAggregatorService;