@universis/ngx-tables 0.6.14 → 0.6.19
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.
- package/bundles/universis-ngx-tables.umd.js +1077 -1044
- package/bundles/universis-ngx-tables.umd.js.map +1 -1
- package/bundles/universis-ngx-tables.umd.min.js +1 -1
- package/bundles/universis-ngx-tables.umd.min.js.map +1 -1
- package/esm2015/lib/components/advanced-list/advanced-list.component.js +2 -2
- package/esm2015/lib/components/advanced-search-form/advanced-search-form.component.js +5 -2
- package/esm2015/lib/components/advanced-table/advanced-table.component.js +50 -22
- package/esm2015/lib/i18n/tables.el.js +2 -1
- package/esm2015/lib/i18n/tables.en.js +2 -1
- package/esm2015/public_api.js +1 -4
- package/esm5/lib/components/advanced-list/advanced-list.component.js +2 -2
- package/esm5/lib/components/advanced-search-form/advanced-search-form.component.js +5 -2
- package/esm5/lib/components/advanced-table/advanced-table.component.js +50 -22
- package/esm5/lib/i18n/tables.el.js +2 -1
- package/esm5/lib/i18n/tables.en.js +2 -1
- package/esm5/public_api.js +1 -4
- package/fesm2015/universis-ngx-tables.js +1478 -1445
- package/fesm2015/universis-ngx-tables.js.map +1 -1
- package/fesm5/universis-ngx-tables.js +2335 -2302
- package/fesm5/universis-ngx-tables.js.map +1 -1
- package/lib/i18n/tables.el.d.ts +1 -0
- package/lib/i18n/tables.en.d.ts +1 -0
- package/package.json +16 -15
- package/public_api.d.ts +0 -3
- 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/
|
|
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/
|
|
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.
|
|
5
|
-
}(this, (function (exports,ISO6391,rxjs,jQuery_,datatables_net,lodash,datatables_netScroller,combineLatest,http,i1,
|
|
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\">×</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\"> </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\"> </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
|
}
|
|
@@ -1428,32 +927,55 @@
|
|
|
1428
927
|
AdvancedTableComponent.prototype.search = function (searchText) {
|
|
1429
928
|
var _this = this;
|
|
1430
929
|
this.query = this.query || this._context.model(this.config.model).asQueryable();
|
|
1431
|
-
if (
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
930
|
+
if (this.serverSide) {
|
|
931
|
+
if (searchText && this.config.searchExpression) {
|
|
932
|
+
// validate search text in double quotes
|
|
933
|
+
if (/^"(.*?)"$/.test(searchText)) {
|
|
934
|
+
this.query.setParam('$filter', this._template.transform(this.config.searchExpression, {
|
|
935
|
+
text: searchText.replace(/^"|"$/g, ''),
|
|
936
|
+
}));
|
|
937
|
+
}
|
|
938
|
+
else {
|
|
939
|
+
// try to split words
|
|
940
|
+
var words = searchText.split(' ');
|
|
941
|
+
// join words to a single filter
|
|
942
|
+
var filter = words.map(function (word) {
|
|
943
|
+
return _this._template.transform(_this.config.searchExpression, {
|
|
944
|
+
text: word,
|
|
945
|
+
});
|
|
946
|
+
}).join(' and ');
|
|
947
|
+
// set filter
|
|
948
|
+
this.query.setParam('$filter', filter);
|
|
949
|
+
}
|
|
1437
950
|
}
|
|
1438
951
|
else {
|
|
1439
|
-
//
|
|
1440
|
-
|
|
1441
|
-
// join words to a single filter
|
|
1442
|
-
var filter = words.map(function (word) {
|
|
1443
|
-
return _this._template.transform(_this.config.searchExpression, {
|
|
1444
|
-
text: word,
|
|
1445
|
-
});
|
|
1446
|
-
}).join(' and ');
|
|
1447
|
-
// set filter
|
|
1448
|
-
this.query.setParam('$filter', filter);
|
|
952
|
+
// clear filter
|
|
953
|
+
this.query.setParam('$filter', null);
|
|
1449
954
|
}
|
|
955
|
+
this._firstLoad = false;
|
|
956
|
+
this.dataTable.draw();
|
|
1450
957
|
}
|
|
1451
958
|
else {
|
|
1452
|
-
//
|
|
1453
|
-
this.
|
|
959
|
+
// ensure empty table layout
|
|
960
|
+
this.resetEmptyTable();
|
|
961
|
+
// search locally
|
|
962
|
+
this.dataTable.search(searchText.trim()).draw();
|
|
963
|
+
// get indexes of filtered rows
|
|
964
|
+
var indexes = Array.from(this.dataTable.context[0].aiDisplay);
|
|
965
|
+
// set recordsFiltered
|
|
966
|
+
var recordsFiltered = indexes.length;
|
|
967
|
+
// set recordsTotal
|
|
968
|
+
var recordsTotal = indexes.length;
|
|
969
|
+
// retrieve data from indexes
|
|
970
|
+
var rows_1 = Array.from(this.dataTable.rows().data());
|
|
971
|
+
var data = indexes.map(function (index) { return rows_1[index]; });
|
|
972
|
+
// emit results to load output
|
|
973
|
+
this.load.emit({
|
|
974
|
+
data: data,
|
|
975
|
+
recordsFiltered: recordsFiltered,
|
|
976
|
+
recordsTotal: recordsTotal
|
|
977
|
+
});
|
|
1454
978
|
}
|
|
1455
|
-
this._firstLoad = false;
|
|
1456
|
-
this.dataTable.draw();
|
|
1457
979
|
};
|
|
1458
980
|
AdvancedTableComponent.prototype.fetch = function (clearSelected) {
|
|
1459
981
|
// if data table is null
|
|
@@ -2123,6 +1645,10 @@
|
|
|
2123
1645
|
var query_1 = this._context.model(this.config.model).asQueryable();
|
|
2124
1646
|
// select attributes
|
|
2125
1647
|
query_1.setParam('$select', this.lastQueryParams.$select);
|
|
1648
|
+
if (this.lastQueryParams.$expand) {
|
|
1649
|
+
// apply expand attributes
|
|
1650
|
+
query_1.setParam('$expand', this.lastQueryParams.$expand);
|
|
1651
|
+
}
|
|
2126
1652
|
// apply filter for row
|
|
2127
1653
|
findKeys_1.forEach(function (key) {
|
|
2128
1654
|
var column = _this.config.columns.find(function (col) {
|
|
@@ -2209,7 +1735,8 @@
|
|
|
2209
1735
|
// due to ng data binding
|
|
2210
1736
|
// empty table template has no translated text during ngOnInit()
|
|
2211
1737
|
if (this.dataTable && this.dataTable.context[0]) {
|
|
2212
|
-
this.dataTable.context[0].oLanguage.sEmptyTable =
|
|
1738
|
+
this.dataTable.context[0].oLanguage.sEmptyTable =
|
|
1739
|
+
this.dataTable.context[0].oLanguage.sZeroRecords = this.emptyTable.nativeElement.innerHTML;
|
|
2213
1740
|
}
|
|
2214
1741
|
};
|
|
2215
1742
|
AdvancedTableComponent.prototype.clearEmptyTable = function () {
|
|
@@ -2463,7 +1990,7 @@
|
|
|
2463
1990
|
AdvancedListComponent.decorators = [
|
|
2464
1991
|
{ type: i0.Component, args: [{
|
|
2465
1992
|
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> </span><span [translate]=\"'Tables.Items'\"></span>\n </div>\n <div class=\"font-xl text-secondary\" *ngIf=\"recordsTotal === 1\">\n <span>{{recordsTotal}}</span><span> </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> </span><span [translate]=\"'Tables.RemoveItem'\"></span>\n </a>\n <a class=\"text-indigo text-decoration-none\" [routerLink]=\"['.', { outlets:{ modal:'add'} }]\">\n <span>+</span><span> </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 [
|
|
1993
|
+
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> </span><span [translate]=\"'Tables.Items'\"></span>\n </div>\n <div class=\"font-xl text-secondary\" *ngIf=\"recordsTotal === 1\">\n <span>{{recordsTotal}}</span><span> </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> </span><span [translate]=\"'Tables.RemoveItem'\"></span>\n </a>\n <a class=\"text-indigo text-decoration-none\" [routerLink]=\"['.', { outlets:{ modal:'add'} }]\">\n <span>+</span><span> </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
1994
|
}] }
|
|
2468
1995
|
];
|
|
2469
1996
|
/** @nocollapse */
|
|
@@ -2769,7 +2296,10 @@
|
|
|
2769
2296
|
var value = _this.formComponent.submission.data[key];
|
|
2770
2297
|
// the filter with type is a string and is not empty
|
|
2771
2298
|
var isEmptyString = typeof value === 'string' && value.length === 0;
|
|
2772
|
-
|
|
2299
|
+
// do not include empty objects in filter
|
|
2300
|
+
var isEmptyObject = typeof value === 'object' && Object.keys(value).length === 0;
|
|
2301
|
+
// make isEmptyString, isEmptyObject mutex
|
|
2302
|
+
if (!isEmptyString && !isEmptyObject) {
|
|
2773
2303
|
Object.defineProperty(_this.filter, key, {
|
|
2774
2304
|
configurable: true,
|
|
2775
2305
|
enumerable: true,
|
|
@@ -3878,604 +3408,1105 @@
|
|
|
3878
3408
|
queryParamsHandling: 'merge',
|
|
3879
3409
|
});
|
|
3880
3410
|
}
|
|
3881
|
-
else {
|
|
3882
|
-
// clear filter
|
|
3883
|
-
this.filter = {};
|
|
3884
|
-
// clear list
|
|
3885
|
-
this.selectedList = null;
|
|
3886
|
-
// raise filter change event
|
|
3887
|
-
this.filterChange.emit(this.filter);
|
|
3411
|
+
else {
|
|
3412
|
+
// clear filter
|
|
3413
|
+
this.filter = {};
|
|
3414
|
+
// clear list
|
|
3415
|
+
this.selectedList = null;
|
|
3416
|
+
// raise filter change event
|
|
3417
|
+
this.filterChange.emit(this.filter);
|
|
3418
|
+
}
|
|
3419
|
+
};
|
|
3420
|
+
Object.defineProperty(AdvancedTableSearchComponent.prototype, "viewState", {
|
|
3421
|
+
/**
|
|
3422
|
+
* Gets the view state of search control
|
|
3423
|
+
*/
|
|
3424
|
+
get: function () {
|
|
3425
|
+
return {
|
|
3426
|
+
advancedView: !this.collapsed,
|
|
3427
|
+
};
|
|
3428
|
+
},
|
|
3429
|
+
enumerable: true,
|
|
3430
|
+
configurable: true
|
|
3431
|
+
});
|
|
3432
|
+
/**
|
|
3433
|
+
* Switches view between simple and advanced search
|
|
3434
|
+
*/
|
|
3435
|
+
AdvancedTableSearchComponent.prototype.toggleView = function () {
|
|
3436
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3437
|
+
return __generator(this, function (_a) {
|
|
3438
|
+
this.collapsed = !this.collapsed;
|
|
3439
|
+
// emit event for view status change
|
|
3440
|
+
this.viewChange.emit(this.viewState);
|
|
3441
|
+
return [2 /*return*/];
|
|
3442
|
+
});
|
|
3443
|
+
});
|
|
3444
|
+
};
|
|
3445
|
+
AdvancedTableSearchComponent.decorators = [
|
|
3446
|
+
{ type: i0.Component, args: [{
|
|
3447
|
+
// tslint:disable-next-line: component-selector
|
|
3448
|
+
selector: 'app-advanced-table-search',
|
|
3449
|
+
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\">×</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",
|
|
3450
|
+
encapsulation: i0.ViewEncapsulation.None
|
|
3451
|
+
}] }
|
|
3452
|
+
];
|
|
3453
|
+
/** @nocollapse */
|
|
3454
|
+
AdvancedTableSearchComponent.ctorParameters = function () {
|
|
3455
|
+
return [
|
|
3456
|
+
{ type: i1.AngularDataContext },
|
|
3457
|
+
{ type: i1$1.ActivatedRoute },
|
|
3458
|
+
{ type: common.DatePipe },
|
|
3459
|
+
{ type: modal.BsModalService },
|
|
3460
|
+
{ type: i2.UserStorageService },
|
|
3461
|
+
{ type: core.TranslateService },
|
|
3462
|
+
{ type: AdvancedFilterValueProvider },
|
|
3463
|
+
{ type: i2.TemplatePipe },
|
|
3464
|
+
{ type: i1$1.Router },
|
|
3465
|
+
{ type: i2.ModalService }
|
|
3466
|
+
];
|
|
3467
|
+
};
|
|
3468
|
+
AdvancedTableSearchComponent.propDecorators = {
|
|
3469
|
+
table: [{ type: i0.Input }],
|
|
3470
|
+
collapsed: [{ type: i0.Input }],
|
|
3471
|
+
allowSave: [{ type: i0.Input }],
|
|
3472
|
+
showMore: [{ type: i0.Input }],
|
|
3473
|
+
mergeQueryParams: [{ type: i0.Input }],
|
|
3474
|
+
searchText: [{ type: i0.ViewChild, args: ['searchText',] }],
|
|
3475
|
+
viewChange: [{ type: i0.Output, args: ['viewChange',] }]
|
|
3476
|
+
};
|
|
3477
|
+
return AdvancedTableSearchComponent;
|
|
3478
|
+
}(AdvancedTableSearchBaseComponent));
|
|
3479
|
+
|
|
3480
|
+
var FORMATTERS = {
|
|
3481
|
+
ActionLinkFormatter: new ActionLinkFormatter(),
|
|
3482
|
+
ButtonFormatter: new ButtonFormatter(),
|
|
3483
|
+
DateTimeFormatter: new DateTimeFormatter(),
|
|
3484
|
+
LanguageFormatter: new LanguageFormatter(),
|
|
3485
|
+
LinkFormatter: new LinkFormatter(),
|
|
3486
|
+
NestedPropertyFormatter: new NestedPropertyFormatter(),
|
|
3487
|
+
NgClassFormatter: new NgClassFormatter(),
|
|
3488
|
+
SelectRowFormatter: new SelectRowFormatter(),
|
|
3489
|
+
TemplateFormatter: new TemplateFormatter(),
|
|
3490
|
+
TranslationFormatter: new TranslationFormatter(),
|
|
3491
|
+
TrueFalseFormatter: new TrueFalseFormatter(),
|
|
3492
|
+
ActionButtonFormatter: new ActionButtonFormatter(),
|
|
3493
|
+
ActionSplitButtonFormatter: new ActionSplitButtonFormatter(),
|
|
3494
|
+
};
|
|
3495
|
+
|
|
3496
|
+
var SimpleHeaderToolsComponent = /** @class */ (function () {
|
|
3497
|
+
function SimpleHeaderToolsComponent() {
|
|
3498
|
+
}
|
|
3499
|
+
SimpleHeaderToolsComponent.decorators = [
|
|
3500
|
+
{ type: i0.Component, args: [{
|
|
3501
|
+
selector: 'table-simple-header-tools',
|
|
3502
|
+
template: "\n <ng-content></ng-content>\n "
|
|
3503
|
+
}] }
|
|
3504
|
+
];
|
|
3505
|
+
return SimpleHeaderToolsComponent;
|
|
3506
|
+
}());
|
|
3507
|
+
var TableSimpleHeaderComponent = /** @class */ (function () {
|
|
3508
|
+
function TableSimpleHeaderComponent() {
|
|
3509
|
+
}
|
|
3510
|
+
TableSimpleHeaderComponent.prototype.ngOnChanges = function (changes) {
|
|
3511
|
+
var _this = this;
|
|
3512
|
+
if (changes.table) {
|
|
3513
|
+
if (changes.table.currentValue == null) {
|
|
3514
|
+
if (this.dataLoadSubscription) {
|
|
3515
|
+
this.dataLoadSubscription.unsubscribe();
|
|
3516
|
+
return;
|
|
3517
|
+
}
|
|
3518
|
+
}
|
|
3519
|
+
if (changes.table.currentValue != changes.table.previousValue) {
|
|
3520
|
+
this.dataLoadSubscription = changes.table.currentValue.load.subscribe(function (data) {
|
|
3521
|
+
_this.recordsTotal = data.recordsTotal;
|
|
3522
|
+
});
|
|
3523
|
+
}
|
|
3524
|
+
}
|
|
3525
|
+
};
|
|
3526
|
+
TableSimpleHeaderComponent.prototype.ngOnDestroy = function () {
|
|
3527
|
+
if (this.dataLoadSubscription) {
|
|
3528
|
+
this.dataLoadSubscription.unsubscribe();
|
|
3529
|
+
}
|
|
3530
|
+
};
|
|
3531
|
+
TableSimpleHeaderComponent.prototype.ngOnInit = function () {
|
|
3532
|
+
//
|
|
3533
|
+
};
|
|
3534
|
+
TableSimpleHeaderComponent.decorators = [
|
|
3535
|
+
{ type: i0.Component, args: [{
|
|
3536
|
+
selector: 'app-table-simple-header',
|
|
3537
|
+
template: "<div class=\"row\">\n <div class=\"col-auto mt-4\">\n <div class=\"font-xl text-secondary\" *ngIf=\"recordsTotal === 0\">\n <span> </span>\n </div>\n <div class=\"font-xl text-secondary\" *ngIf=\"recordsTotal > 1\">\n <span>{{recordsTotal}}</span><span> </span><span [translate]=\"'Tables.Items'\"></span>\n </div>\n <div class=\"font-xl text-secondary\" *ngIf=\"recordsTotal === 1\">\n <span>{{recordsTotal}}</span><span> </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"
|
|
3538
|
+
}] }
|
|
3539
|
+
];
|
|
3540
|
+
/** @nocollapse */
|
|
3541
|
+
TableSimpleHeaderComponent.ctorParameters = function () { return []; };
|
|
3542
|
+
TableSimpleHeaderComponent.propDecorators = {
|
|
3543
|
+
table: [{ type: i0.Input }]
|
|
3544
|
+
};
|
|
3545
|
+
return TableSimpleHeaderComponent;
|
|
3546
|
+
}());
|
|
3547
|
+
|
|
3548
|
+
var AdvancedTableNotNullError = /** @class */ (function (_super) {
|
|
3549
|
+
__extends(AdvancedTableNotNullError, _super);
|
|
3550
|
+
function AdvancedTableNotNullError() {
|
|
3551
|
+
return _super.call(this, 'Advanced table component cannot be empty at this context.') || this;
|
|
3552
|
+
}
|
|
3553
|
+
return AdvancedTableNotNullError;
|
|
3554
|
+
}(Error));
|
|
3555
|
+
var AdvancedTableEditorDirective = /** @class */ (function () {
|
|
3556
|
+
function AdvancedTableEditorDirective(table) {
|
|
3557
|
+
this.table = table;
|
|
3558
|
+
this.dirty = false;
|
|
3559
|
+
this.dirtyChange = new i0.EventEmitter(false);
|
|
3560
|
+
//
|
|
3561
|
+
}
|
|
3562
|
+
/**
|
|
3563
|
+
* Add rows to table and mark them as added rows
|
|
3564
|
+
*/
|
|
3565
|
+
AdvancedTableEditorDirective.prototype.add = function () {
|
|
3566
|
+
var addItems = [];
|
|
3567
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
3568
|
+
addItems[_i] = arguments[_i];
|
|
3569
|
+
}
|
|
3570
|
+
var e_1, _a;
|
|
3571
|
+
if (this.table == null) {
|
|
3572
|
+
throw new AdvancedTableNotNullError();
|
|
3573
|
+
}
|
|
3574
|
+
// decorate items
|
|
3575
|
+
var key = this.table.config.columns[0].property || this.table.config.columns[0].name;
|
|
3576
|
+
try {
|
|
3577
|
+
for (var addItems_1 = __values(addItems), addItems_1_1 = addItems_1.next(); !addItems_1_1.done; addItems_1_1 = addItems_1.next()) {
|
|
3578
|
+
var element = addItems_1_1.value;
|
|
3579
|
+
var tr = this.table.dataTable.rows(':has(input[data-id="' + element[key] + '"])').nodes().to$();
|
|
3580
|
+
if (tr.hasClass('removed')) {
|
|
3581
|
+
tr.toggleClass('removed text-gray-400 text-decoration-line-through');
|
|
3582
|
+
}
|
|
3583
|
+
else {
|
|
3584
|
+
this.table.dataTable.rows.add([element]);
|
|
3585
|
+
tr = this.table.dataTable.rows(':has(input[data-id="' + element[key] + '"])').nodes().to$();
|
|
3586
|
+
tr.toggleClass('added font-weight-bold text-success');
|
|
3587
|
+
}
|
|
3588
|
+
}
|
|
3589
|
+
}
|
|
3590
|
+
catch (e_1_1) {
|
|
3591
|
+
e_1 = { error: e_1_1 };
|
|
3592
|
+
}
|
|
3593
|
+
finally {
|
|
3594
|
+
try {
|
|
3595
|
+
if (addItems_1_1 && !addItems_1_1.done && (_a = addItems_1.return))
|
|
3596
|
+
_a.call(addItems_1);
|
|
3597
|
+
}
|
|
3598
|
+
finally {
|
|
3599
|
+
if (e_1)
|
|
3600
|
+
throw e_1.error;
|
|
3601
|
+
}
|
|
3602
|
+
}
|
|
3603
|
+
this.table.dataTable.draw();
|
|
3604
|
+
// find removed
|
|
3605
|
+
var removedLength = this.table.dataTable.rows('.removed')[0].length;
|
|
3606
|
+
// find added
|
|
3607
|
+
var addedLength = this.table.dataTable.rows('.added')[0].length;
|
|
3608
|
+
// and emit event
|
|
3609
|
+
var items = this.table.dataTable.rows().data();
|
|
3610
|
+
this.table.load.emit({
|
|
3611
|
+
data: items,
|
|
3612
|
+
recordsFiltered: items.length - removedLength,
|
|
3613
|
+
recordsTotal: items.length - removedLength,
|
|
3614
|
+
});
|
|
3615
|
+
this.dirty = (removedLength > 0 || addedLength > 0);
|
|
3616
|
+
this.dirtyChange.emit(this.dirty);
|
|
3617
|
+
};
|
|
3618
|
+
/**
|
|
3619
|
+
* Marks rows as removed rows
|
|
3620
|
+
*/
|
|
3621
|
+
AdvancedTableEditorDirective.prototype.remove = function () {
|
|
3622
|
+
var removeItems = [];
|
|
3623
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
3624
|
+
removeItems[_i] = arguments[_i];
|
|
3625
|
+
}
|
|
3626
|
+
var e_2, _a;
|
|
3627
|
+
if (this.table == null) {
|
|
3628
|
+
throw new AdvancedTableNotNullError();
|
|
3629
|
+
}
|
|
3630
|
+
// get key
|
|
3631
|
+
var key = this.table.config.columns[0].property || this.table.config.columns[0].name;
|
|
3632
|
+
var _loop_1 = function (element) {
|
|
3633
|
+
var tr = this_1.table.dataTable.rows(':has(input[data-id="' + element[key] + '"])').nodes().to$();
|
|
3634
|
+
// if row is marked as added
|
|
3635
|
+
if (tr.hasClass('added')) {
|
|
3636
|
+
// remove this dirty row
|
|
3637
|
+
this_1.table.dataTable.rows(tr).remove();
|
|
3638
|
+
}
|
|
3639
|
+
else {
|
|
3640
|
+
// otherwise unmarked row
|
|
3641
|
+
tr.toggleClass('removed text-gray-400 text-decoration-line-through');
|
|
3642
|
+
}
|
|
3643
|
+
// check if item is selected
|
|
3644
|
+
var selectedIndex = this_1.table.selected.findIndex(function (item) {
|
|
3645
|
+
return item[key] === element[key];
|
|
3646
|
+
});
|
|
3647
|
+
// and remove it from selected collection
|
|
3648
|
+
if (selectedIndex >= 0) {
|
|
3649
|
+
this_1.table.selected.splice(selectedIndex, 1);
|
|
3650
|
+
}
|
|
3651
|
+
};
|
|
3652
|
+
var this_1 = this;
|
|
3653
|
+
try {
|
|
3654
|
+
// loop items
|
|
3655
|
+
for (var removeItems_1 = __values(removeItems), removeItems_1_1 = removeItems_1.next(); !removeItems_1_1.done; removeItems_1_1 = removeItems_1.next()) {
|
|
3656
|
+
var element = removeItems_1_1.value;
|
|
3657
|
+
_loop_1(element);
|
|
3658
|
+
}
|
|
3659
|
+
}
|
|
3660
|
+
catch (e_2_1) {
|
|
3661
|
+
e_2 = { error: e_2_1 };
|
|
3662
|
+
}
|
|
3663
|
+
finally {
|
|
3664
|
+
try {
|
|
3665
|
+
if (removeItems_1_1 && !removeItems_1_1.done && (_a = removeItems_1.return))
|
|
3666
|
+
_a.call(removeItems_1);
|
|
3667
|
+
}
|
|
3668
|
+
finally {
|
|
3669
|
+
if (e_2)
|
|
3670
|
+
throw e_2.error;
|
|
3671
|
+
}
|
|
3672
|
+
}
|
|
3673
|
+
// re-draw table
|
|
3674
|
+
this.table.dataTable.draw();
|
|
3675
|
+
// get number of table items
|
|
3676
|
+
var items = this.table.dataTable.rows().data();
|
|
3677
|
+
// get number of removed items
|
|
3678
|
+
var removedLength = this.table.dataTable.rows('.removed')[0].length;
|
|
3679
|
+
// get number of added items
|
|
3680
|
+
var addedLength = this.table.dataTable.rows('.added')[0].length;
|
|
3681
|
+
// refresh
|
|
3682
|
+
this.table.load.emit({
|
|
3683
|
+
data: items,
|
|
3684
|
+
recordsFiltered: items.length - removedLength,
|
|
3685
|
+
recordsTotal: items.length - removedLength,
|
|
3686
|
+
});
|
|
3687
|
+
this.dirty = (removedLength > 0 || addedLength > 0);
|
|
3688
|
+
this.dirtyChange.emit(this.dirty);
|
|
3689
|
+
};
|
|
3690
|
+
AdvancedTableEditorDirective.prototype.set = function (items) {
|
|
3691
|
+
if (this.table == null) {
|
|
3692
|
+
throw new AdvancedTableNotNullError();
|
|
3888
3693
|
}
|
|
3694
|
+
// clear rows
|
|
3695
|
+
this.table.selected = [];
|
|
3696
|
+
this.table.dataTable.clear();
|
|
3697
|
+
// set items
|
|
3698
|
+
this.table.dataTable.rows.add(items).draw();
|
|
3699
|
+
this.table.load.emit({
|
|
3700
|
+
data: items,
|
|
3701
|
+
recordsFiltered: items.length,
|
|
3702
|
+
recordsTotal: items.length,
|
|
3703
|
+
});
|
|
3889
3704
|
};
|
|
3890
|
-
Object.defineProperty(AdvancedTableSearchComponent.prototype, "viewState", {
|
|
3891
|
-
/**
|
|
3892
|
-
* Gets the view state of search control
|
|
3893
|
-
*/
|
|
3894
|
-
get: function () {
|
|
3895
|
-
return {
|
|
3896
|
-
advancedView: !this.collapsed,
|
|
3897
|
-
};
|
|
3898
|
-
},
|
|
3899
|
-
enumerable: true,
|
|
3900
|
-
configurable: true
|
|
3901
|
-
});
|
|
3902
3705
|
/**
|
|
3903
|
-
*
|
|
3706
|
+
* Undo changes
|
|
3904
3707
|
*/
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3708
|
+
AdvancedTableEditorDirective.prototype.undo = function () {
|
|
3709
|
+
if (this.table == null) {
|
|
3710
|
+
throw new AdvancedTableNotNullError();
|
|
3711
|
+
}
|
|
3712
|
+
// reset removed rows
|
|
3713
|
+
this.table.dataTable.rows('.removed').nodes().to$().toggleClass('removed text-gray-400 text-decoration-line-through');
|
|
3714
|
+
// remove added rows
|
|
3715
|
+
this.table.dataTable.rows('.added').remove();
|
|
3716
|
+
// clear selected items
|
|
3717
|
+
this.table.selected = [];
|
|
3718
|
+
var items = this.table.dataTable.rows().data();
|
|
3719
|
+
this.table.dataTable.draw();
|
|
3720
|
+
this.table.load.emit({
|
|
3721
|
+
data: items,
|
|
3722
|
+
recordsFiltered: items.length,
|
|
3723
|
+
recordsTotal: items.length,
|
|
3913
3724
|
});
|
|
3725
|
+
this.dirty = false;
|
|
3726
|
+
this.dirtyChange.emit(this.dirty);
|
|
3914
3727
|
};
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3728
|
+
AdvancedTableEditorDirective.prototype.rows = function () {
|
|
3729
|
+
if (this.table == null) {
|
|
3730
|
+
throw new AdvancedTableNotNullError();
|
|
3731
|
+
}
|
|
3732
|
+
return Array.from(this.table.dataTable.rows(':not(.removed)').data());
|
|
3733
|
+
};
|
|
3734
|
+
AdvancedTableEditorDirective.decorators = [
|
|
3735
|
+
{ type: i0.Directive, args: [{
|
|
3736
|
+
// tslint:disable-next-line: directive-selector
|
|
3737
|
+
selector: '[tableEditor]',
|
|
3738
|
+
},] }
|
|
3922
3739
|
];
|
|
3923
3740
|
/** @nocollapse */
|
|
3924
|
-
|
|
3741
|
+
AdvancedTableEditorDirective.ctorParameters = function () {
|
|
3925
3742
|
return [
|
|
3926
|
-
{ type:
|
|
3927
|
-
{ type: i1$1.ActivatedRoute },
|
|
3928
|
-
{ type: common.DatePipe },
|
|
3929
|
-
{ type: modal.BsModalService },
|
|
3930
|
-
{ type: i2.UserStorageService },
|
|
3931
|
-
{ type: core.TranslateService },
|
|
3932
|
-
{ type: AdvancedFilterValueProvider },
|
|
3933
|
-
{ type: i2.TemplatePipe },
|
|
3934
|
-
{ type: i1$1.Router },
|
|
3935
|
-
{ type: i2.ModalService }
|
|
3743
|
+
{ type: AdvancedTableComponent }
|
|
3936
3744
|
];
|
|
3937
3745
|
};
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
collapsed: [{ type: i0.Input }],
|
|
3941
|
-
allowSave: [{ type: i0.Input }],
|
|
3942
|
-
showMore: [{ type: i0.Input }],
|
|
3943
|
-
mergeQueryParams: [{ type: i0.Input }],
|
|
3944
|
-
searchText: [{ type: i0.ViewChild, args: ['searchText',] }],
|
|
3945
|
-
viewChange: [{ type: i0.Output, args: ['viewChange',] }]
|
|
3746
|
+
AdvancedTableEditorDirective.propDecorators = {
|
|
3747
|
+
dirtyChange: [{ type: i0.Output }]
|
|
3946
3748
|
};
|
|
3947
|
-
return
|
|
3948
|
-
}(AdvancedTableSearchBaseComponent));
|
|
3949
|
-
|
|
3950
|
-
var FORMATTERS = {
|
|
3951
|
-
ActionLinkFormatter: new ActionLinkFormatter(),
|
|
3952
|
-
ButtonFormatter: new ButtonFormatter(),
|
|
3953
|
-
DateTimeFormatter: new DateTimeFormatter(),
|
|
3954
|
-
LanguageFormatter: new LanguageFormatter(),
|
|
3955
|
-
LinkFormatter: new LinkFormatter(),
|
|
3956
|
-
NestedPropertyFormatter: new NestedPropertyFormatter(),
|
|
3957
|
-
NgClassFormatter: new NgClassFormatter(),
|
|
3958
|
-
SelectRowFormatter: new SelectRowFormatter(),
|
|
3959
|
-
TemplateFormatter: new TemplateFormatter(),
|
|
3960
|
-
TranslationFormatter: new TranslationFormatter(),
|
|
3961
|
-
TrueFalseFormatter: new TrueFalseFormatter(),
|
|
3962
|
-
ActionButtonFormatter: new ActionButtonFormatter(),
|
|
3963
|
-
ActionSplitButtonFormatter: new ActionSplitButtonFormatter(),
|
|
3964
|
-
};
|
|
3965
|
-
|
|
3966
|
-
var SimpleHeaderToolsComponent = /** @class */ (function () {
|
|
3967
|
-
function SimpleHeaderToolsComponent() {
|
|
3968
|
-
}
|
|
3969
|
-
SimpleHeaderToolsComponent.decorators = [
|
|
3970
|
-
{ type: i0.Component, args: [{
|
|
3971
|
-
selector: 'table-simple-header-tools',
|
|
3972
|
-
template: "\n <ng-content></ng-content>\n "
|
|
3973
|
-
}] }
|
|
3974
|
-
];
|
|
3975
|
-
return SimpleHeaderToolsComponent;
|
|
3749
|
+
return AdvancedTableEditorDirective;
|
|
3976
3750
|
}());
|
|
3977
|
-
|
|
3978
|
-
|
|
3751
|
+
|
|
3752
|
+
var MAX_EXPORT_ITEMS = 500;
|
|
3753
|
+
var BtnExpDirective = /** @class */ (function () {
|
|
3754
|
+
function BtnExpDirective(_activatedTable, _context, _config, _translate, _loadingService, _errorService) {
|
|
3755
|
+
this._activatedTable = _activatedTable;
|
|
3756
|
+
this._context = _context;
|
|
3757
|
+
this._config = _config;
|
|
3758
|
+
this._translate = _translate;
|
|
3759
|
+
this._loadingService = _loadingService;
|
|
3760
|
+
this._errorService = _errorService;
|
|
3979
3761
|
}
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3762
|
+
BtnExpDirective.prototype.clickEvent = function (event) {
|
|
3763
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3764
|
+
var lastQuery, tableConfig, serviceHeaders, queryModel, query, queryParams, maxExportItems, url;
|
|
3765
|
+
return __generator(this, function (_a) {
|
|
3766
|
+
event.preventDefault();
|
|
3767
|
+
event.stopPropagation();
|
|
3768
|
+
if (this._activatedTable.activeTable) {
|
|
3769
|
+
lastQuery = this._activatedTable.activeTable.lastQuery;
|
|
3770
|
+
tableConfig = this._activatedTable.activeTable.config;
|
|
3771
|
+
serviceHeaders = this._context.getService().getHeaders();
|
|
3772
|
+
queryModel = lastQuery.getModel();
|
|
3773
|
+
query = this._context.model(queryModel).asQueryable();
|
|
3774
|
+
queryParams = lastQuery.getParams();
|
|
3775
|
+
query = this.constructQuery(query, queryParams, tableConfig, serviceHeaders);
|
|
3776
|
+
maxExportItems = 1000;
|
|
3777
|
+
if (maxExportItems && typeof maxExportItems === 'number' && maxExportItems > 0) {
|
|
3778
|
+
query.skip(0).take(maxExportItems);
|
|
3779
|
+
}
|
|
3780
|
+
else {
|
|
3781
|
+
query.skip(0).take(MAX_EXPORT_ITEMS);
|
|
3782
|
+
}
|
|
3783
|
+
url = this.constructURL(query);
|
|
3784
|
+
this.downloadFile(url, query.getService().getHeaders(), query.getModel());
|
|
3987
3785
|
}
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
_this.recordsTotal = data.recordsTotal;
|
|
3992
|
-
});
|
|
3993
|
-
}
|
|
3994
|
-
}
|
|
3786
|
+
return [2 /*return*/];
|
|
3787
|
+
});
|
|
3788
|
+
});
|
|
3995
3789
|
};
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3790
|
+
/**
|
|
3791
|
+
* Sets the parameters to the query based on
|
|
3792
|
+
* the active filters of the activated table
|
|
3793
|
+
* @param {ClientDataQueryable} query
|
|
3794
|
+
* @param params: The filters of the last query of the activated table
|
|
3795
|
+
* @return ClientDataQueryable
|
|
3796
|
+
*/
|
|
3797
|
+
BtnExpDirective.prototype.setParams = function (query, params) {
|
|
3798
|
+
if (params && typeof params === 'object') {
|
|
3799
|
+
Object.keys(params).forEach(function (key) {
|
|
3800
|
+
query.setParam(key, params[key]);
|
|
3801
|
+
});
|
|
3999
3802
|
}
|
|
3803
|
+
return query;
|
|
4000
3804
|
};
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
3805
|
+
/**
|
|
3806
|
+
* Sets the headers to the query based on
|
|
3807
|
+
* the default headers of the DataContext
|
|
3808
|
+
* and appending the accept header to get
|
|
3809
|
+
* an xlsx file from the API
|
|
3810
|
+
* @param {ClientDataQueryable} query
|
|
3811
|
+
* @param {Headers} headers: The headers to append to the query
|
|
3812
|
+
* @return ClientDataQueryable
|
|
3813
|
+
*/
|
|
3814
|
+
BtnExpDirective.prototype.setHeaders = function (query, headers) {
|
|
3815
|
+
Object.keys(headers).forEach(function (key) {
|
|
3816
|
+
if (headers.hasOwnProperty(key)) {
|
|
3817
|
+
query.getService().setHeader(key, headers[key]);
|
|
3818
|
+
}
|
|
3819
|
+
});
|
|
3820
|
+
// sets a header to accept xlsx files
|
|
3821
|
+
query.getService().setHeader('Accept', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
|
3822
|
+
return query;
|
|
4014
3823
|
};
|
|
4015
|
-
return TableSimpleHeaderComponent;
|
|
4016
|
-
}());
|
|
4017
|
-
|
|
4018
|
-
var AdvancedTableNotNullError = /** @class */ (function (_super) {
|
|
4019
|
-
__extends(AdvancedTableNotNullError, _super);
|
|
4020
|
-
function AdvancedTableNotNullError() {
|
|
4021
|
-
return _super.call(this, 'Advanced table component cannot be empty at this context.') || this;
|
|
4022
|
-
}
|
|
4023
|
-
return AdvancedTableNotNullError;
|
|
4024
|
-
}(Error));
|
|
4025
|
-
var AdvancedTableEditorDirective = /** @class */ (function () {
|
|
4026
|
-
function AdvancedTableEditorDirective(table) {
|
|
4027
|
-
this.table = table;
|
|
4028
|
-
this.dirty = false;
|
|
4029
|
-
this.dirtyChange = new i0.EventEmitter(false);
|
|
4030
|
-
//
|
|
4031
|
-
}
|
|
4032
3824
|
/**
|
|
4033
|
-
*
|
|
3825
|
+
* Constructs the select parameter of the
|
|
3826
|
+
* ClientDataQuery by replacing the target name
|
|
3827
|
+
* of the field based on the localized translation
|
|
3828
|
+
* of that property on the advanced tabled
|
|
3829
|
+
* @param {ClientDataQueryable} query
|
|
3830
|
+
* @param tableConfig: The configuration of the activated table
|
|
3831
|
+
* @return ClientDataQueryable
|
|
4034
3832
|
*/
|
|
4035
|
-
|
|
4036
|
-
var
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
3833
|
+
BtnExpDirective.prototype.constructQueryParam = function (query, tableConfig) {
|
|
3834
|
+
var _this = this;
|
|
3835
|
+
var selectQuery = query.getParams().$select;
|
|
3836
|
+
var selectQueryArray = selectQuery.split(',');
|
|
3837
|
+
selectQueryArray = selectQueryArray.map(function (select) {
|
|
3838
|
+
var e_1, _a, e_2, _b;
|
|
3839
|
+
var words = select.split(' ');
|
|
3840
|
+
if (words.length === 3) {
|
|
3841
|
+
if (tableConfig && tableConfig.columns) {
|
|
3842
|
+
try {
|
|
3843
|
+
for (var _c = __values(tableConfig.columns), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
3844
|
+
var column = _d.value;
|
|
3845
|
+
if (column.property === words[2] && column.title) {
|
|
3846
|
+
words[2] = "\"" + _this._translate.instant(column.title) + "\"";
|
|
3847
|
+
}
|
|
3848
|
+
else if (column.property === words[2]) {
|
|
3849
|
+
words[2] = "\"" + _this._translate.instant(words[2]) + "\"";
|
|
3850
|
+
}
|
|
3851
|
+
}
|
|
3852
|
+
}
|
|
3853
|
+
catch (e_1_1) {
|
|
3854
|
+
e_1 = { error: e_1_1 };
|
|
3855
|
+
}
|
|
3856
|
+
finally {
|
|
3857
|
+
try {
|
|
3858
|
+
if (_d && !_d.done && (_a = _c.return))
|
|
3859
|
+
_a.call(_c);
|
|
3860
|
+
}
|
|
3861
|
+
finally {
|
|
3862
|
+
if (e_1)
|
|
3863
|
+
throw e_1.error;
|
|
3864
|
+
}
|
|
3865
|
+
}
|
|
4057
3866
|
}
|
|
4058
3867
|
}
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
3868
|
+
if (words.length === 1) {
|
|
3869
|
+
if (tableConfig && tableConfig.columns) {
|
|
3870
|
+
try {
|
|
3871
|
+
for (var _e = __values(tableConfig.columns), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
3872
|
+
var column = _f.value;
|
|
3873
|
+
if (column.name === words[0] && column.title) {
|
|
3874
|
+
words[0] = words[0] + " as \"" + _this._translate.instant(column.title) + "\"";
|
|
3875
|
+
break;
|
|
3876
|
+
}
|
|
3877
|
+
else if (column.name === words[0] && column.property) {
|
|
3878
|
+
words[0] = words[0] + " as \"" + _this._translate.instant(column.property) + "\"";
|
|
3879
|
+
break;
|
|
3880
|
+
}
|
|
3881
|
+
else if (words[0] === column.name && words[0] === "id" && column.hidden) {
|
|
3882
|
+
break;
|
|
3883
|
+
}
|
|
3884
|
+
else if (words[0] == column.name || words[0] === column.property) {
|
|
3885
|
+
words[0] = words[0] + " as \"" + _this._translate.instant(words[0]) + "\"";
|
|
3886
|
+
}
|
|
3887
|
+
}
|
|
3888
|
+
}
|
|
3889
|
+
catch (e_2_1) {
|
|
3890
|
+
e_2 = { error: e_2_1 };
|
|
3891
|
+
}
|
|
3892
|
+
finally {
|
|
3893
|
+
try {
|
|
3894
|
+
if (_f && !_f.done && (_b = _e.return))
|
|
3895
|
+
_b.call(_e);
|
|
3896
|
+
}
|
|
3897
|
+
finally {
|
|
3898
|
+
if (e_2)
|
|
3899
|
+
throw e_2.error;
|
|
3900
|
+
}
|
|
3901
|
+
}
|
|
3902
|
+
}
|
|
3903
|
+
return words[0];
|
|
4071
3904
|
}
|
|
4072
|
-
|
|
4073
|
-
this.table.dataTable.draw();
|
|
4074
|
-
// find removed
|
|
4075
|
-
var removedLength = this.table.dataTable.rows('.removed')[0].length;
|
|
4076
|
-
// find added
|
|
4077
|
-
var addedLength = this.table.dataTable.rows('.added')[0].length;
|
|
4078
|
-
// and emit event
|
|
4079
|
-
var items = this.table.dataTable.rows().data();
|
|
4080
|
-
this.table.load.emit({
|
|
4081
|
-
data: items,
|
|
4082
|
-
recordsFiltered: items.length - removedLength,
|
|
4083
|
-
recordsTotal: items.length - removedLength,
|
|
3905
|
+
return words.join(' ');
|
|
4084
3906
|
});
|
|
4085
|
-
|
|
4086
|
-
|
|
3907
|
+
selectQuery = selectQueryArray.join(',');
|
|
3908
|
+
query.setParam('$select', selectQuery);
|
|
3909
|
+
return query;
|
|
4087
3910
|
};
|
|
4088
3911
|
/**
|
|
4089
|
-
*
|
|
3912
|
+
* Constructs the fetch URL based the query parameters
|
|
3913
|
+
* @param {ClientDataQueryable} query
|
|
3914
|
+
* @return String
|
|
4090
3915
|
*/
|
|
4091
|
-
|
|
4092
|
-
var
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
if (this.table == null) {
|
|
4098
|
-
throw new AdvancedTableNotNullError();
|
|
4099
|
-
}
|
|
4100
|
-
// get key
|
|
4101
|
-
var key = this.table.config.columns[0].property || this.table.config.columns[0].name;
|
|
4102
|
-
var _loop_1 = function (element) {
|
|
4103
|
-
var tr = this_1.table.dataTable.rows(':has(input[data-id="' + element[key] + '"])').nodes().to$();
|
|
4104
|
-
// if row is marked as added
|
|
4105
|
-
if (tr.hasClass('added')) {
|
|
4106
|
-
// remove this dirty row
|
|
4107
|
-
this_1.table.dataTable.rows(tr).remove();
|
|
3916
|
+
BtnExpDirective.prototype.constructURL = function (query) {
|
|
3917
|
+
var baseURL = query.getService().getBase();
|
|
3918
|
+
var url = baseURL.endsWith('/') ? (baseURL + query.getModel() + '?') : (baseURL + '/' + query.getModel() + '?');
|
|
3919
|
+
Object.keys(query.getParams()).forEach(function (key, index) {
|
|
3920
|
+
if (index === 0) {
|
|
3921
|
+
url += key + '=' + query.getParams()[key];
|
|
4108
3922
|
}
|
|
4109
3923
|
else {
|
|
4110
|
-
|
|
4111
|
-
tr.toggleClass('removed text-gray-400 text-decoration-line-through');
|
|
4112
|
-
}
|
|
4113
|
-
// check if item is selected
|
|
4114
|
-
var selectedIndex = this_1.table.selected.findIndex(function (item) {
|
|
4115
|
-
return item[key] === element[key];
|
|
4116
|
-
});
|
|
4117
|
-
// and remove it from selected collection
|
|
4118
|
-
if (selectedIndex >= 0) {
|
|
4119
|
-
this_1.table.selected.splice(selectedIndex, 1);
|
|
4120
|
-
}
|
|
4121
|
-
};
|
|
4122
|
-
var this_1 = this;
|
|
4123
|
-
try {
|
|
4124
|
-
// loop items
|
|
4125
|
-
for (var removeItems_1 = __values(removeItems), removeItems_1_1 = removeItems_1.next(); !removeItems_1_1.done; removeItems_1_1 = removeItems_1.next()) {
|
|
4126
|
-
var element = removeItems_1_1.value;
|
|
4127
|
-
_loop_1(element);
|
|
4128
|
-
}
|
|
4129
|
-
}
|
|
4130
|
-
catch (e_2_1) {
|
|
4131
|
-
e_2 = { error: e_2_1 };
|
|
4132
|
-
}
|
|
4133
|
-
finally {
|
|
4134
|
-
try {
|
|
4135
|
-
if (removeItems_1_1 && !removeItems_1_1.done && (_a = removeItems_1.return))
|
|
4136
|
-
_a.call(removeItems_1);
|
|
3924
|
+
url += '&' + key + '=' + query.getParams()[key];
|
|
4137
3925
|
}
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
3926
|
+
});
|
|
3927
|
+
return url;
|
|
3928
|
+
};
|
|
3929
|
+
/**
|
|
3930
|
+
* Constructs the query by setting the parameters of the
|
|
3931
|
+
* advanced table's active filters, sets the necessary headers
|
|
3932
|
+
* and build the select parameter of the query
|
|
3933
|
+
* @param {ClientDataQueryable} query
|
|
3934
|
+
* @param params: The filters of the last query of the activated table
|
|
3935
|
+
* @param tableConfig: The configuration of the activated table
|
|
3936
|
+
* @param {Headers} headers: The headers to append to the query
|
|
3937
|
+
* @return ClientDataQueryable
|
|
3938
|
+
*/
|
|
3939
|
+
BtnExpDirective.prototype.constructQuery = function (query, params, tableConfig, headers) {
|
|
3940
|
+
var _query = this.setParams(query, params);
|
|
3941
|
+
_query = this.setHeaders(_query, headers);
|
|
3942
|
+
_query = this.constructQueryParam(_query, tableConfig);
|
|
3943
|
+
return _query;
|
|
3944
|
+
};
|
|
3945
|
+
/**
|
|
3946
|
+
* Fetches and saves the xlsx file
|
|
3947
|
+
* @param {String} url
|
|
3948
|
+
* @param {Headers} serviceHeaders: The headers to append to the query
|
|
3949
|
+
* @param modelName: The model name of the advanced table
|
|
3950
|
+
*/
|
|
3951
|
+
BtnExpDirective.prototype.downloadFile = function (url, serviceHeaders, modelName) {
|
|
3952
|
+
var _this = this;
|
|
3953
|
+
this._loadingService.showLoading();
|
|
3954
|
+
fetch(encodeURI(url), {
|
|
3955
|
+
headers: serviceHeaders,
|
|
3956
|
+
credentials: 'include'
|
|
3957
|
+
}).then(function (response) {
|
|
3958
|
+
if (response && !response.ok) {
|
|
3959
|
+
throw new client.ResponseError(response.statusText, response.status);
|
|
4141
3960
|
}
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
3961
|
+
return response.blob();
|
|
3962
|
+
}).then(function (blob) {
|
|
3963
|
+
var objectUrl = window.URL.createObjectURL(blob);
|
|
3964
|
+
var a = document.createElement('a');
|
|
3965
|
+
document.body.appendChild(a);
|
|
3966
|
+
a.setAttribute('style', 'display: none');
|
|
3967
|
+
a.href = objectUrl;
|
|
3968
|
+
var downloadName = modelName + ".xlsx";
|
|
3969
|
+
a.download = downloadName;
|
|
3970
|
+
// this adds support for IE and MS Edge (up to version 44.19041)
|
|
3971
|
+
if (window.navigator && window.navigator.msSaveOrOpenBlob) {
|
|
3972
|
+
window.navigator.msSaveOrOpenBlob(blob, downloadName);
|
|
3973
|
+
}
|
|
3974
|
+
else {
|
|
3975
|
+
// for all other browsers
|
|
3976
|
+
a.click();
|
|
3977
|
+
}
|
|
3978
|
+
window.URL.revokeObjectURL(objectUrl);
|
|
3979
|
+
a.remove();
|
|
3980
|
+
_this._loadingService.hideLoading();
|
|
3981
|
+
}).catch(function (err) {
|
|
3982
|
+
_this._loadingService.hideLoading();
|
|
3983
|
+
_this._errorService.showError(err, {
|
|
3984
|
+
continueLink: '.'
|
|
3985
|
+
});
|
|
4156
3986
|
});
|
|
4157
|
-
this.dirty = (removedLength > 0 || addedLength > 0);
|
|
4158
|
-
this.dirtyChange.emit(this.dirty);
|
|
4159
3987
|
};
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
3988
|
+
BtnExpDirective.decorators = [
|
|
3989
|
+
{ type: i0.Directive, args: [{
|
|
3990
|
+
selector: '.universis-btn-export'
|
|
3991
|
+
},] }
|
|
3992
|
+
];
|
|
3993
|
+
/** @nocollapse */
|
|
3994
|
+
BtnExpDirective.ctorParameters = function () {
|
|
3995
|
+
return [
|
|
3996
|
+
{ type: ActivatedTableService },
|
|
3997
|
+
{ type: i1.AngularDataContext },
|
|
3998
|
+
{ type: i2.ConfigurationService },
|
|
3999
|
+
{ type: core.TranslateService },
|
|
4000
|
+
{ type: i2.LoadingService },
|
|
4001
|
+
{ type: i2.ErrorService }
|
|
4002
|
+
];
|
|
4174
4003
|
};
|
|
4004
|
+
BtnExpDirective.propDecorators = {
|
|
4005
|
+
clickEvent: [{ type: i0.HostListener, args: ['click', ['$event'],] }]
|
|
4006
|
+
};
|
|
4007
|
+
return BtnExpDirective;
|
|
4008
|
+
}());
|
|
4009
|
+
|
|
4010
|
+
var AdvancedAggregatorService = /** @class */ (function () {
|
|
4011
|
+
function AdvancedAggregatorService(_context, _template) {
|
|
4012
|
+
this._context = _context;
|
|
4013
|
+
this._template = _template;
|
|
4014
|
+
}
|
|
4175
4015
|
/**
|
|
4176
|
-
*
|
|
4016
|
+
*
|
|
4017
|
+
* Formats and executes the data query
|
|
4018
|
+
*
|
|
4019
|
+
* @param {string} model The target model
|
|
4020
|
+
* @param {object} fixedParams Pairs of parameters to always be applied
|
|
4021
|
+
* @param {string} queryStatement The default query to use for fetching the data (e.g. expands etc)
|
|
4022
|
+
* @param {Array<string>} filters A list of filter expressions to append at the query
|
|
4023
|
+
* @param {string} searchTemplate The template to use for searching expressions
|
|
4024
|
+
* @param {string} searchValue The value of the user search
|
|
4025
|
+
*
|
|
4026
|
+
* @returns {Promise<any>} The response of the query execution
|
|
4177
4027
|
*/
|
|
4178
|
-
|
|
4179
|
-
if (
|
|
4180
|
-
|
|
4028
|
+
AdvancedAggregatorService.prototype.fetchData = function (model, fixedParams, queryStatement, filters, searchTemplate, searchValue) {
|
|
4029
|
+
if (queryStatement === void 0) {
|
|
4030
|
+
queryStatement = '';
|
|
4181
4031
|
}
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4032
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4033
|
+
var e_1, _a, query, filterExpressions, _b, _c, param, evaluatedSearch, words;
|
|
4034
|
+
var _this = this;
|
|
4035
|
+
return __generator(this, function (_d) {
|
|
4036
|
+
query = this._context.model(model).asQueryable();
|
|
4037
|
+
if (!fixedParams || typeof fixedParams !== 'object') {
|
|
4038
|
+
fixedParams = {};
|
|
4039
|
+
}
|
|
4040
|
+
filterExpressions = [];
|
|
4041
|
+
if (fixedParams) {
|
|
4042
|
+
try {
|
|
4043
|
+
for (_b = __values(Object.keys(fixedParams)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
4044
|
+
param = _c.value;
|
|
4045
|
+
filterExpressions.push(param + " eq " + fixedParams[param]);
|
|
4046
|
+
}
|
|
4047
|
+
}
|
|
4048
|
+
catch (e_1_1) {
|
|
4049
|
+
e_1 = { error: e_1_1 };
|
|
4050
|
+
}
|
|
4051
|
+
finally {
|
|
4052
|
+
try {
|
|
4053
|
+
if (_c && !_c.done && (_a = _b.return))
|
|
4054
|
+
_a.call(_b);
|
|
4055
|
+
}
|
|
4056
|
+
finally {
|
|
4057
|
+
if (e_1)
|
|
4058
|
+
throw e_1.error;
|
|
4059
|
+
}
|
|
4060
|
+
}
|
|
4061
|
+
}
|
|
4062
|
+
if (filters && Array.isArray(filters)) {
|
|
4063
|
+
filterExpressions = __spread(filterExpressions, filters);
|
|
4064
|
+
}
|
|
4065
|
+
if (searchTemplate && searchValue) {
|
|
4066
|
+
evaluatedSearch = void 0;
|
|
4067
|
+
if (/^"(.*?)"$/.test(searchValue)) { // validate search text in double quotes
|
|
4068
|
+
evaluatedSearch = this._template.transform(searchTemplate, __assign({}, fixedParams, { text: searchValue.replace(/^"|"$/g, '') }));
|
|
4069
|
+
}
|
|
4070
|
+
else {
|
|
4071
|
+
words = searchValue.split(' ');
|
|
4072
|
+
// join words to a single filter
|
|
4073
|
+
evaluatedSearch = words.map(function (word) {
|
|
4074
|
+
return _this._template.transform(searchTemplate, __assign({}, fixedParams, { text: word }));
|
|
4075
|
+
}).join(' and ');
|
|
4076
|
+
}
|
|
4077
|
+
filterExpressions.push(evaluatedSearch);
|
|
4078
|
+
}
|
|
4079
|
+
query.setParam('$filter', filterExpressions.join('and'));
|
|
4080
|
+
return [2 /*return*/, query.expand(queryStatement).take(-1).getItems()];
|
|
4081
|
+
});
|
|
4194
4082
|
});
|
|
4195
|
-
this.dirty = false;
|
|
4196
|
-
this.dirtyChange.emit(this.dirty);
|
|
4197
4083
|
};
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4084
|
+
/**
|
|
4085
|
+
*
|
|
4086
|
+
* Formats the received data to use flat keys
|
|
4087
|
+
*
|
|
4088
|
+
* @param config The applied configuration
|
|
4089
|
+
* @param data The raw data
|
|
4090
|
+
*
|
|
4091
|
+
* @returns {Array<any>} The flat-key object list
|
|
4092
|
+
*
|
|
4093
|
+
*/
|
|
4094
|
+
AdvancedAggregatorService.prototype.formatData = function (config, data) {
|
|
4095
|
+
var _this = this;
|
|
4096
|
+
try {
|
|
4097
|
+
return data.map(function (entry) {
|
|
4098
|
+
if (entry.subitems && Array.isArray(entry.subitems)) {
|
|
4099
|
+
entry.subitems = _this.formatData(config, entry.subitems);
|
|
4100
|
+
}
|
|
4101
|
+
var entryObject = {};
|
|
4102
|
+
for (var i = 0; i < config.columns.length; i++) {
|
|
4103
|
+
var keys = config.columns[i].name.split('/');
|
|
4104
|
+
var helperObject = entry[keys[0]];
|
|
4105
|
+
if (helperObject && keys.length > 1) {
|
|
4106
|
+
for (var i_1 = 1; i_1 < keys.length; i_1++) {
|
|
4107
|
+
if (helperObject === undefined || helperObject === null) {
|
|
4108
|
+
break;
|
|
4109
|
+
}
|
|
4110
|
+
else {
|
|
4111
|
+
helperObject = helperObject[keys[i_1]] !== undefined && helperObject[keys[i_1]] !== null
|
|
4112
|
+
? helperObject[keys[i_1]]
|
|
4113
|
+
: undefined;
|
|
4114
|
+
}
|
|
4115
|
+
}
|
|
4116
|
+
}
|
|
4117
|
+
entryObject[config.columns[i].name] = helperObject;
|
|
4118
|
+
}
|
|
4119
|
+
if (entry.subitems) {
|
|
4120
|
+
entryObject.subitems = entry.subitems;
|
|
4121
|
+
}
|
|
4122
|
+
return entryObject;
|
|
4123
|
+
});
|
|
4124
|
+
}
|
|
4125
|
+
catch (err) {
|
|
4126
|
+
console.error(err);
|
|
4201
4127
|
}
|
|
4202
|
-
return Array.from(this.table.dataTable.rows(':not(.removed)').data());
|
|
4203
4128
|
};
|
|
4204
|
-
|
|
4205
|
-
{ type: i0.
|
|
4206
|
-
|
|
4207
|
-
selector: '[tableEditor]',
|
|
4129
|
+
AdvancedAggregatorService.decorators = [
|
|
4130
|
+
{ type: i0.Injectable, args: [{
|
|
4131
|
+
providedIn: 'root'
|
|
4208
4132
|
},] }
|
|
4209
4133
|
];
|
|
4210
4134
|
/** @nocollapse */
|
|
4211
|
-
|
|
4135
|
+
AdvancedAggregatorService.ctorParameters = function () {
|
|
4212
4136
|
return [
|
|
4213
|
-
{ type:
|
|
4137
|
+
{ type: i1.AngularDataContext },
|
|
4138
|
+
{ type: i2.TemplatePipe }
|
|
4214
4139
|
];
|
|
4215
4140
|
};
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
};
|
|
4219
|
-
return AdvancedTableEditorDirective;
|
|
4141
|
+
AdvancedAggregatorService.ngInjectableDef = i0.defineInjectable({ factory: function AdvancedAggregatorService_Factory() { return new AdvancedAggregatorService(i0.inject(i1.AngularDataContext), i0.inject(i2.TemplatePipe)); }, token: AdvancedAggregatorService, providedIn: "root" });
|
|
4142
|
+
return AdvancedAggregatorService;
|
|
4220
4143
|
}());
|
|
4221
4144
|
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4145
|
+
/**
|
|
4146
|
+
*
|
|
4147
|
+
* @class AdvancedAggregatorComponent
|
|
4148
|
+
* @classdesc An advanced list with the capability of aggregate data based on configurable filters
|
|
4149
|
+
*
|
|
4150
|
+
*/
|
|
4151
|
+
var AdvancedAggregatorComponent = /** @class */ (function () {
|
|
4152
|
+
function AdvancedAggregatorComponent(_changeDetector, _advancedAggregatorService, _loadingService) {
|
|
4153
|
+
this._changeDetector = _changeDetector;
|
|
4154
|
+
this._advancedAggregatorService = _advancedAggregatorService;
|
|
4229
4155
|
this._loadingService = _loadingService;
|
|
4230
|
-
this.
|
|
4156
|
+
this.groups = [];
|
|
4157
|
+
this.eventHandler = new i0.EventEmitter();
|
|
4231
4158
|
}
|
|
4232
|
-
|
|
4159
|
+
Object.defineProperty(AdvancedAggregatorComponent.prototype, "config", {
|
|
4160
|
+
get: function () {
|
|
4161
|
+
return this._config;
|
|
4162
|
+
},
|
|
4163
|
+
set: function (value) {
|
|
4164
|
+
this._config = value;
|
|
4165
|
+
},
|
|
4166
|
+
enumerable: true,
|
|
4167
|
+
configurable: true
|
|
4168
|
+
});
|
|
4169
|
+
Object.defineProperty(AdvancedAggregatorComponent.prototype, "aggregators", {
|
|
4170
|
+
get: function () {
|
|
4171
|
+
return this._aggregators;
|
|
4172
|
+
},
|
|
4173
|
+
set: function (value) {
|
|
4174
|
+
this._aggregators = value;
|
|
4175
|
+
},
|
|
4176
|
+
enumerable: true,
|
|
4177
|
+
configurable: true
|
|
4178
|
+
});
|
|
4179
|
+
Object.defineProperty(AdvancedAggregatorComponent.prototype, "postProcessors", {
|
|
4180
|
+
get: function () {
|
|
4181
|
+
return this._postProcessors;
|
|
4182
|
+
},
|
|
4183
|
+
set: function (value) {
|
|
4184
|
+
this._postProcessors = value;
|
|
4185
|
+
},
|
|
4186
|
+
enumerable: true,
|
|
4187
|
+
configurable: true
|
|
4188
|
+
});
|
|
4189
|
+
AdvancedAggregatorComponent.prototype.ngOnInit = function () {
|
|
4233
4190
|
return __awaiter(this, void 0, void 0, function () {
|
|
4234
|
-
var
|
|
4191
|
+
var _this = this;
|
|
4235
4192
|
return __generator(this, function (_a) {
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4193
|
+
this.selectedGroups$.subscribe(function (data) {
|
|
4194
|
+
_this.groups = data;
|
|
4195
|
+
_this._changeDetector.markForCheck();
|
|
4196
|
+
});
|
|
4197
|
+
this.filters$.subscribe(function (filters) {
|
|
4198
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
4199
|
+
var err_1;
|
|
4200
|
+
return __generator(this, function (_a) {
|
|
4201
|
+
switch (_a.label) {
|
|
4202
|
+
case 0:
|
|
4203
|
+
_a.trys.push([0, 2, , 3]);
|
|
4204
|
+
return [4 /*yield*/, this.fetch(filters)];
|
|
4205
|
+
case 1:
|
|
4206
|
+
_a.sent();
|
|
4207
|
+
return [3 /*break*/, 3];
|
|
4208
|
+
case 2:
|
|
4209
|
+
err_1 = _a.sent();
|
|
4210
|
+
console.error(err_1);
|
|
4211
|
+
return [3 /*break*/, 3];
|
|
4212
|
+
case 3: return [2 /*return*/];
|
|
4213
|
+
}
|
|
4214
|
+
});
|
|
4215
|
+
});
|
|
4216
|
+
});
|
|
4256
4217
|
return [2 /*return*/];
|
|
4257
4218
|
});
|
|
4258
4219
|
});
|
|
4259
4220
|
};
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
*/
|
|
4267
|
-
BtnExpDirective.prototype.setParams = function (query, params) {
|
|
4268
|
-
if (params && typeof params === 'object') {
|
|
4269
|
-
Object.keys(params).forEach(function (key) {
|
|
4270
|
-
query.setParam(key, params[key]);
|
|
4221
|
+
AdvancedAggregatorComponent.prototype.ngOnDestroy = function () {
|
|
4222
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4223
|
+
return __generator(this, function (_a) {
|
|
4224
|
+
this.selectedGroups$.unsubscribe();
|
|
4225
|
+
this.filters$.unsubscribe();
|
|
4226
|
+
return [2 /*return*/];
|
|
4271
4227
|
});
|
|
4272
|
-
}
|
|
4273
|
-
return query;
|
|
4228
|
+
});
|
|
4274
4229
|
};
|
|
4275
4230
|
/**
|
|
4276
|
-
*
|
|
4277
|
-
*
|
|
4278
|
-
*
|
|
4279
|
-
* an xlsx file from the API
|
|
4280
|
-
* @param {ClientDataQueryable} query
|
|
4281
|
-
* @param {Headers} headers: The headers to append to the query
|
|
4282
|
-
* @return ClientDataQueryable
|
|
4231
|
+
*
|
|
4232
|
+
* Retrieves the data
|
|
4233
|
+
*
|
|
4283
4234
|
*/
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4235
|
+
AdvancedAggregatorComponent.prototype.fetch = function (filters) {
|
|
4236
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
4237
|
+
var data, i, err_2;
|
|
4238
|
+
return __generator(this, function (_a) {
|
|
4239
|
+
switch (_a.label) {
|
|
4240
|
+
case 0:
|
|
4241
|
+
_a.trys.push([0, 6, 7, 8]);
|
|
4242
|
+
this._loadingService.showLoading();
|
|
4243
|
+
return [4 /*yield*/, this._advancedAggregatorService.fetchData(this.config.model, this.params, this.config.query, filters.filters, this.searchExpression, filters.text)];
|
|
4244
|
+
case 1:
|
|
4245
|
+
data = _a.sent();
|
|
4246
|
+
if (!(this.postProcessors && Object.keys(this.postProcessors).length > 0 && this.config.postProcessors && this.config.postProcessors.length > 0))
|
|
4247
|
+
return [3 /*break*/, 5];
|
|
4248
|
+
i = 0;
|
|
4249
|
+
_a.label = 2;
|
|
4250
|
+
case 2:
|
|
4251
|
+
if (!(i < this.config.postProcessors.length))
|
|
4252
|
+
return [3 /*break*/, 5];
|
|
4253
|
+
return [4 /*yield*/, this.postProcessors[this.config.postProcessors[i].name](data)];
|
|
4254
|
+
case 3:
|
|
4255
|
+
data = _a.sent();
|
|
4256
|
+
_a.label = 4;
|
|
4257
|
+
case 4:
|
|
4258
|
+
i++;
|
|
4259
|
+
return [3 /*break*/, 2];
|
|
4260
|
+
case 5:
|
|
4261
|
+
this.body = this._advancedAggregatorService.formatData(this.config, data);
|
|
4262
|
+
this._changeDetector.markForCheck();
|
|
4263
|
+
return [3 /*break*/, 8];
|
|
4264
|
+
case 6:
|
|
4265
|
+
err_2 = _a.sent();
|
|
4266
|
+
console.error(err_2);
|
|
4267
|
+
return [3 /*break*/, 8];
|
|
4268
|
+
case 7:
|
|
4269
|
+
this._loadingService.hideLoading();
|
|
4270
|
+
return [7 /*endfinally*/];
|
|
4271
|
+
case 8: return [2 /*return*/];
|
|
4272
|
+
}
|
|
4273
|
+
});
|
|
4289
4274
|
});
|
|
4290
|
-
// sets a header to accept xlsx files
|
|
4291
|
-
query.getService().setHeader('Accept', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
|
4292
|
-
return query;
|
|
4293
4275
|
};
|
|
4294
4276
|
/**
|
|
4295
|
-
*
|
|
4296
|
-
*
|
|
4297
|
-
*
|
|
4298
|
-
*
|
|
4299
|
-
*
|
|
4300
|
-
* @param tableConfig: The configuration of the activated table
|
|
4301
|
-
* @return ClientDataQueryable
|
|
4277
|
+
*
|
|
4278
|
+
* Triggers the event handler event
|
|
4279
|
+
*
|
|
4280
|
+
* @param {*} event The event data
|
|
4281
|
+
*
|
|
4302
4282
|
*/
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
break;
|
|
4353
|
-
}
|
|
4354
|
-
else if (words[0] == column.name || words[0] === column.property) {
|
|
4355
|
-
words[0] = words[0] + " as \"" + _this._translate.instant(words[0]) + "\"";
|
|
4356
|
-
}
|
|
4357
|
-
}
|
|
4358
|
-
}
|
|
4359
|
-
catch (e_2_1) {
|
|
4360
|
-
e_2 = { error: e_2_1 };
|
|
4361
|
-
}
|
|
4362
|
-
finally {
|
|
4363
|
-
try {
|
|
4364
|
-
if (_f && !_f.done && (_b = _e.return))
|
|
4365
|
-
_b.call(_e);
|
|
4366
|
-
}
|
|
4367
|
-
finally {
|
|
4368
|
-
if (e_2)
|
|
4369
|
-
throw e_2.error;
|
|
4370
|
-
}
|
|
4371
|
-
}
|
|
4372
|
-
}
|
|
4373
|
-
return words[0];
|
|
4374
|
-
}
|
|
4375
|
-
return words.join(' ');
|
|
4283
|
+
AdvancedAggregatorComponent.prototype.onActionEvent = function (event) {
|
|
4284
|
+
this.eventHandler.emit(event);
|
|
4285
|
+
};
|
|
4286
|
+
AdvancedAggregatorComponent.decorators = [
|
|
4287
|
+
{ type: i0.Component, args: [{
|
|
4288
|
+
selector: 'app-advanced-aggregator',
|
|
4289
|
+
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>",
|
|
4290
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
4291
|
+
}] }
|
|
4292
|
+
];
|
|
4293
|
+
/** @nocollapse */
|
|
4294
|
+
AdvancedAggregatorComponent.ctorParameters = function () {
|
|
4295
|
+
return [
|
|
4296
|
+
{ type: i0.ChangeDetectorRef },
|
|
4297
|
+
{ type: AdvancedAggregatorService },
|
|
4298
|
+
{ type: i2.LoadingService }
|
|
4299
|
+
];
|
|
4300
|
+
};
|
|
4301
|
+
AdvancedAggregatorComponent.propDecorators = {
|
|
4302
|
+
config: [{ type: i0.Input, args: ['config',] }],
|
|
4303
|
+
aggregators: [{ type: i0.Input, args: ['aggregators',] }],
|
|
4304
|
+
postProcessors: [{ type: i0.Input, args: ['postProcessors',] }],
|
|
4305
|
+
params: [{ type: i0.Input, args: ['params',] }],
|
|
4306
|
+
selectedGroups$: [{ type: i0.Input, args: ['selectedGroups',] }],
|
|
4307
|
+
filters$: [{ type: i0.Input, args: ['filters',] }],
|
|
4308
|
+
searchExpression: [{ type: i0.Input, args: ['searchExpression',] }],
|
|
4309
|
+
eventHandler: [{ type: i0.Output }]
|
|
4310
|
+
};
|
|
4311
|
+
return AdvancedAggregatorComponent;
|
|
4312
|
+
}());
|
|
4313
|
+
|
|
4314
|
+
var Lengths;
|
|
4315
|
+
(function (Lengths) {
|
|
4316
|
+
Lengths["XL"] = "xl";
|
|
4317
|
+
Lengths["LG"] = "lg";
|
|
4318
|
+
Lengths["MD"] = "md";
|
|
4319
|
+
Lengths["SM"] = "sm";
|
|
4320
|
+
Lengths["XS"] = "xs";
|
|
4321
|
+
})(Lengths || (Lengths = {}));
|
|
4322
|
+
var AdvancedAggregatorListComponent = /** @class */ (function () {
|
|
4323
|
+
function AdvancedAggregatorListComponent(_template) {
|
|
4324
|
+
this._template = _template;
|
|
4325
|
+
this.clickEvent = new i0.EventEmitter();
|
|
4326
|
+
}
|
|
4327
|
+
AdvancedAggregatorListComponent.prototype.ngOnInit = function () {
|
|
4328
|
+
var _this = this;
|
|
4329
|
+
this.config.columns.forEach(function (x) {
|
|
4330
|
+
x.length = Object.values(Lengths).includes(x.length) ? _this._template.transform("sis--list-group-item_" + x.length + "_column", x) :
|
|
4331
|
+
!x.length ? 'sis--list-group-item_sm_column' : x.length;
|
|
4376
4332
|
});
|
|
4377
|
-
selectQuery = selectQueryArray.join(',');
|
|
4378
|
-
query.setParam('$select', selectQuery);
|
|
4379
|
-
return query;
|
|
4380
4333
|
};
|
|
4381
4334
|
/**
|
|
4382
|
-
*
|
|
4383
|
-
*
|
|
4384
|
-
*
|
|
4335
|
+
*
|
|
4336
|
+
* Triggers the output event emitter
|
|
4337
|
+
*
|
|
4338
|
+
* @param type The type of the event as it's declared in the configuration
|
|
4339
|
+
* @param item The value of the current item
|
|
4340
|
+
* }
|
|
4385
4341
|
*/
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
if (index === 0) {
|
|
4391
|
-
url += key + '=' + query.getParams()[key];
|
|
4392
|
-
}
|
|
4393
|
-
else {
|
|
4394
|
-
url += '&' + key + '=' + query.getParams()[key];
|
|
4395
|
-
}
|
|
4342
|
+
AdvancedAggregatorListComponent.prototype.callCallback = function (type, data) {
|
|
4343
|
+
this.clickEvent.emit({
|
|
4344
|
+
type: type,
|
|
4345
|
+
data: data
|
|
4396
4346
|
});
|
|
4397
|
-
return url;
|
|
4398
4347
|
};
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
var _query = this.setParams(query, params);
|
|
4411
|
-
_query = this.setHeaders(_query, headers);
|
|
4412
|
-
_query = this.constructQueryParam(_query, tableConfig);
|
|
4413
|
-
return _query;
|
|
4348
|
+
AdvancedAggregatorListComponent.decorators = [
|
|
4349
|
+
{ type: i0.Component, args: [{
|
|
4350
|
+
selector: 'app-advanced-aggregator-list',
|
|
4351
|
+
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\"> </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\"> </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"
|
|
4352
|
+
}] }
|
|
4353
|
+
];
|
|
4354
|
+
/** @nocollapse */
|
|
4355
|
+
AdvancedAggregatorListComponent.ctorParameters = function () {
|
|
4356
|
+
return [
|
|
4357
|
+
{ type: i2.TemplatePipe }
|
|
4358
|
+
];
|
|
4414
4359
|
};
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4360
|
+
AdvancedAggregatorListComponent.propDecorators = {
|
|
4361
|
+
config: [{ type: i0.Input }],
|
|
4362
|
+
body: [{ type: i0.Input }],
|
|
4363
|
+
clickEvent: [{ type: i0.Output }]
|
|
4364
|
+
};
|
|
4365
|
+
return AdvancedAggregatorListComponent;
|
|
4366
|
+
}());
|
|
4367
|
+
|
|
4368
|
+
var AddItemsComponent = /** @class */ (function (_super) {
|
|
4369
|
+
__extends(AddItemsComponent, _super);
|
|
4370
|
+
function AddItemsComponent(router, activatedRoute, _errorService, _modalService, _appEvent, _toastService, _loadingService, _translateService, _context) {
|
|
4371
|
+
var _this = _super.call(this, router, activatedRoute) || this;
|
|
4372
|
+
_this._errorService = _errorService;
|
|
4373
|
+
_this._modalService = _modalService;
|
|
4374
|
+
_this._appEvent = _appEvent;
|
|
4375
|
+
_this._toastService = _toastService;
|
|
4376
|
+
_this._loadingService = _loadingService;
|
|
4377
|
+
_this._translateService = _translateService;
|
|
4378
|
+
_this._context = _context;
|
|
4379
|
+
_this.loading = false;
|
|
4380
|
+
_this.items = [];
|
|
4381
|
+
_this.messages = [];
|
|
4382
|
+
// set modal size
|
|
4383
|
+
_this.modalClass = 'modal-lg';
|
|
4384
|
+
_this.okButtonDisabled = true;
|
|
4385
|
+
return _this;
|
|
4386
|
+
}
|
|
4387
|
+
AddItemsComponent.prototype.ngOnInit = function () {
|
|
4422
4388
|
var _this = this;
|
|
4423
|
-
this.
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
credentials: 'include'
|
|
4427
|
-
}).then(function (response) {
|
|
4428
|
-
if (response && !response.ok) {
|
|
4429
|
-
throw new client.ResponseError(response.statusText, response.status);
|
|
4430
|
-
}
|
|
4431
|
-
return response.blob();
|
|
4432
|
-
}).then(function (blob) {
|
|
4433
|
-
var objectUrl = window.URL.createObjectURL(blob);
|
|
4434
|
-
var a = document.createElement('a');
|
|
4435
|
-
document.body.appendChild(a);
|
|
4436
|
-
a.setAttribute('style', 'display: none');
|
|
4437
|
-
a.href = objectUrl;
|
|
4438
|
-
var downloadName = modelName + ".xlsx";
|
|
4439
|
-
a.download = downloadName;
|
|
4440
|
-
// this adds support for IE and MS Edge (up to version 44.19041)
|
|
4441
|
-
if (window.navigator && window.navigator.msSaveOrOpenBlob) {
|
|
4442
|
-
window.navigator.msSaveOrOpenBlob(blob, downloadName);
|
|
4389
|
+
this.selectedSubscription = this.selectComponent.advancedTable.selectedItems.subscribe(function (items) {
|
|
4390
|
+
if (_this.formName == null) {
|
|
4391
|
+
_this.okButtonDisabled = items.length === 0;
|
|
4443
4392
|
}
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4393
|
+
});
|
|
4394
|
+
if (this.formName != null) {
|
|
4395
|
+
this.formChangeSubscription = this.formComponent.form.change.subscribe(function (event) {
|
|
4396
|
+
if (Object.prototype.hasOwnProperty.call(event, 'isValid')) {
|
|
4397
|
+
// enable or disable button based on form status
|
|
4398
|
+
_this.okButtonDisabled = (!event.isValid);
|
|
4399
|
+
}
|
|
4400
|
+
});
|
|
4401
|
+
}
|
|
4402
|
+
if (this.target) {
|
|
4403
|
+
var target = this.target;
|
|
4404
|
+
}
|
|
4405
|
+
};
|
|
4406
|
+
AddItemsComponent.prototype.cancel = function () {
|
|
4407
|
+
this.clearMessages();
|
|
4408
|
+
if (this.loading) {
|
|
4409
|
+
return;
|
|
4410
|
+
}
|
|
4411
|
+
// close
|
|
4412
|
+
if (this._modalService.modalRef) {
|
|
4413
|
+
return this._modalService.modalRef.hide();
|
|
4414
|
+
}
|
|
4415
|
+
};
|
|
4416
|
+
AddItemsComponent.prototype.ngOnDestroy = function () {
|
|
4417
|
+
if (this.formLoadSubscription) {
|
|
4418
|
+
this.formLoadSubscription.unsubscribe();
|
|
4419
|
+
}
|
|
4420
|
+
if (this.formChangeSubscription) {
|
|
4421
|
+
this.formChangeSubscription.unsubscribe();
|
|
4422
|
+
}
|
|
4423
|
+
if (this.selectedSubscription) {
|
|
4424
|
+
this.selectedSubscription.unsubscribe();
|
|
4425
|
+
}
|
|
4426
|
+
};
|
|
4427
|
+
Object.defineProperty(AddItemsComponent.prototype, "formData", {
|
|
4428
|
+
get: function () {
|
|
4429
|
+
if (this.formComponent === null) {
|
|
4430
|
+
return null;
|
|
4447
4431
|
}
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4432
|
+
return this.formComponent.form.formio.data;
|
|
4433
|
+
},
|
|
4434
|
+
enumerable: true,
|
|
4435
|
+
configurable: true
|
|
4436
|
+
});
|
|
4437
|
+
AddItemsComponent.prototype.ok = function () {
|
|
4438
|
+
var _this = this;
|
|
4439
|
+
try {
|
|
4440
|
+
this.clearMessages();
|
|
4441
|
+
return new Promise(function (resolve, reject) {
|
|
4442
|
+
_this.loading = false;
|
|
4443
|
+
_this.lastError = null;
|
|
4444
|
+
// set courses
|
|
4445
|
+
_this.items = _this.selectComponent.advancedTable.selected;
|
|
4446
|
+
// execute add
|
|
4447
|
+
_this.executeSubscription = _this.execute.subscribe(function (result) {
|
|
4448
|
+
_this.loading = false;
|
|
4449
|
+
if (_this.executeSubscription) {
|
|
4450
|
+
_this.executeSubscription.unsubscribe();
|
|
4451
|
+
}
|
|
4452
|
+
// close modal
|
|
4453
|
+
if (_this._modalService.modalRef) {
|
|
4454
|
+
_this._modalService.modalRef.hide();
|
|
4455
|
+
}
|
|
4456
|
+
return resolve();
|
|
4457
|
+
}, function (err) {
|
|
4458
|
+
_this.loading = false;
|
|
4459
|
+
// ensure that loading is hidden
|
|
4460
|
+
_this._loadingService.hideLoading();
|
|
4461
|
+
// set last error
|
|
4462
|
+
_this.lastError = err;
|
|
4463
|
+
return resolve();
|
|
4464
|
+
});
|
|
4455
4465
|
});
|
|
4456
|
-
}
|
|
4466
|
+
}
|
|
4467
|
+
catch (err) {
|
|
4468
|
+
this.loading = false;
|
|
4469
|
+
this._loadingService.hideLoading();
|
|
4470
|
+
this.lastError = err;
|
|
4471
|
+
}
|
|
4457
4472
|
};
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4473
|
+
AddItemsComponent.prototype.onChange = function ($event) { };
|
|
4474
|
+
AddItemsComponent.prototype.clearMessages = function () {
|
|
4475
|
+
this.messages = [];
|
|
4476
|
+
};
|
|
4477
|
+
AddItemsComponent.prototype.onFilterChange = function (event) { };
|
|
4478
|
+
AddItemsComponent.decorators = [
|
|
4479
|
+
{ type: i0.Component, args: [{
|
|
4480
|
+
selector: 'app-add-items',
|
|
4481
|
+
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\">×</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"
|
|
4482
|
+
}] }
|
|
4462
4483
|
];
|
|
4463
4484
|
/** @nocollapse */
|
|
4464
|
-
|
|
4485
|
+
AddItemsComponent.ctorParameters = function () {
|
|
4465
4486
|
return [
|
|
4466
|
-
{ type:
|
|
4467
|
-
{ type: i1.
|
|
4468
|
-
{ type: i2.
|
|
4469
|
-
{ type:
|
|
4487
|
+
{ type: i1$1.Router },
|
|
4488
|
+
{ type: i1$1.ActivatedRoute },
|
|
4489
|
+
{ type: i2.ErrorService },
|
|
4490
|
+
{ type: i2.ModalService },
|
|
4491
|
+
{ type: i2.AppEventService },
|
|
4492
|
+
{ type: i2.ToastService },
|
|
4470
4493
|
{ type: i2.LoadingService },
|
|
4471
|
-
{ type:
|
|
4494
|
+
{ type: core.TranslateService },
|
|
4495
|
+
{ type: i1.AngularDataContext }
|
|
4472
4496
|
];
|
|
4473
4497
|
};
|
|
4474
|
-
|
|
4475
|
-
|
|
4498
|
+
AddItemsComponent.propDecorators = {
|
|
4499
|
+
execute: [{ type: i0.Input }],
|
|
4500
|
+
items: [{ type: i0.Input }],
|
|
4501
|
+
target: [{ type: i0.Input }],
|
|
4502
|
+
tableConfiguration: [{ type: i0.Input }],
|
|
4503
|
+
formName: [{ type: i0.Input }],
|
|
4504
|
+
messages: [{ type: i0.Input }],
|
|
4505
|
+
formComponent: [{ type: i0.ViewChild, args: ['formComponent',] }],
|
|
4506
|
+
selectComponent: [{ type: i0.ViewChild, args: ['selectComponent',] }]
|
|
4476
4507
|
};
|
|
4477
|
-
return
|
|
4478
|
-
}());
|
|
4508
|
+
return AddItemsComponent;
|
|
4509
|
+
}(routing.RouterModalOkCancel));
|
|
4479
4510
|
|
|
4480
4511
|
/**
|
|
4481
4512
|
*
|
|
@@ -4567,6 +4598,7 @@
|
|
|
4567
4598
|
"Search": "Αναζήτηση",
|
|
4568
4599
|
"SearchPlaceholder": "Αναζήτηση...",
|
|
4569
4600
|
"GroupBy": "Ομαδοποίηση ανά",
|
|
4601
|
+
"NotDefined": "Μη προσδιορισμένο",
|
|
4570
4602
|
"DataTable": {
|
|
4571
4603
|
"paginate": {
|
|
4572
4604
|
"first": "Πρώτη σελίδα",
|
|
@@ -4670,6 +4702,7 @@
|
|
|
4670
4702
|
"Search": "Search",
|
|
4671
4703
|
"SearchPlaceholder": "Search...",
|
|
4672
4704
|
"GroupBy": "Group by",
|
|
4705
|
+
"NotDefined": "Not defined",
|
|
4673
4706
|
"DataTable": {
|
|
4674
4707
|
"paginate": {
|
|
4675
4708
|
"first": "First",
|
|
@@ -4873,9 +4906,6 @@
|
|
|
4873
4906
|
* Generated bundle index. Do not edit.
|
|
4874
4907
|
*/
|
|
4875
4908
|
|
|
4876
|
-
exports.AddItemsComponent = AddItemsComponent;
|
|
4877
|
-
exports.AdvancedAggregatorComponent = AdvancedAggregatorComponent;
|
|
4878
|
-
exports.AdvancedAggregatorListComponent = AdvancedAggregatorListComponent;
|
|
4879
4909
|
exports.AdvancedListComponent = AdvancedListComponent;
|
|
4880
4910
|
exports.AdvancedRowActionComponent = AdvancedRowActionComponent;
|
|
4881
4911
|
exports.AdvancedSearchFormComponent = AdvancedSearchFormComponent;
|
|
@@ -4912,6 +4942,9 @@
|
|
|
4912
4942
|
exports.AdvancedTableNotNullError = AdvancedTableNotNullError;
|
|
4913
4943
|
exports.AdvancedTableEditorDirective = AdvancedTableEditorDirective;
|
|
4914
4944
|
exports.BtnExpDirective = BtnExpDirective;
|
|
4945
|
+
exports.AdvancedAggregatorComponent = AdvancedAggregatorComponent;
|
|
4946
|
+
exports.AdvancedAggregatorListComponent = AdvancedAggregatorListComponent;
|
|
4947
|
+
exports.AddItemsComponent = AddItemsComponent;
|
|
4915
4948
|
exports.AdvancedAggregatorPipe = AdvancedAggregatorPipe;
|
|
4916
4949
|
exports.ParseTitlePipe = ParseTitlePipe;
|
|
4917
4950
|
exports.AdvancedAggregatorService = AdvancedAggregatorService;
|