@universis/ngx-tables 0.7.19 → 0.7.23
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 +438 -13
- 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/add-items/add-items.component.js +2 -2
- package/esm2015/lib/components/advanced-table/advanced-table.component.js +72 -3
- package/esm2015/lib/components/advanced-table/advanced-table.formatters.js +3 -3
- package/esm2015/lib/components/advanced-table/advanced-table.interfaces.js +1 -1
- package/esm2015/lib/components/column-selector/column-selector.component.js +190 -0
- package/esm2015/lib/components/column-selector/column-selector.service.js +47 -0
- package/esm2015/lib/directives/advance-table-state.directive.js +1 -1
- package/esm2015/lib/i18n/tables.el.js +14 -2
- package/esm2015/lib/i18n/tables.en.js +14 -2
- package/esm2015/lib/tables.module.js +10 -4
- package/esm2015/public_api.js +3 -1
- package/esm5/lib/components/add-items/add-items.component.js +2 -2
- package/esm5/lib/components/advanced-table/advanced-table.component.js +73 -3
- package/esm5/lib/components/advanced-table/advanced-table.formatters.js +2 -2
- package/esm5/lib/components/advanced-table/advanced-table.interfaces.js +1 -1
- package/esm5/lib/components/column-selector/column-selector.component.js +257 -0
- package/esm5/lib/components/column-selector/column-selector.service.js +50 -0
- package/esm5/lib/directives/advance-table-state.directive.js +1 -1
- package/esm5/lib/i18n/tables.el.js +14 -2
- package/esm5/lib/i18n/tables.en.js +14 -2
- package/esm5/lib/tables.module.js +10 -4
- package/esm5/public_api.js +3 -1
- package/fesm2015/universis-ngx-tables.js +335 -13
- package/fesm2015/universis-ngx-tables.js.map +1 -1
- package/fesm5/universis-ngx-tables.js +402 -12
- package/fesm5/universis-ngx-tables.js.map +1 -1
- package/lib/components/advanced-table/advanced-table.component.d.ts +6 -1
- package/lib/components/advanced-table/advanced-table.interfaces.d.ts +2 -0
- package/lib/components/column-selector/column-selector.component.d.ts +37 -0
- package/lib/components/column-selector/column-selector.service.d.ts +19 -0
- package/lib/i18n/tables.el.d.ts +12 -0
- package/lib/i18n/tables.en.d.ts +12 -0
- package/package.json +3 -2
- package/public_api.d.ts +2 -0
- package/universis-ngx-tables.metadata.json +1 -1
|
@@ -2,6 +2,7 @@ import { getNativeName } from 'iso-639-1/build';
|
|
|
2
2
|
import * as jQuery_ from 'jquery';
|
|
3
3
|
import 'datatables.net';
|
|
4
4
|
import 'datatables.net-scroller';
|
|
5
|
+
import 'datatables.net-colreorder';
|
|
5
6
|
import 'rxjs/add/observable/combineLatest';
|
|
6
7
|
import { HttpClient } from '@angular/common/http';
|
|
7
8
|
import { ClientDataQueryable, ResponseError, TextUtils } from '@themost/client';
|
|
@@ -10,8 +11,8 @@ import { AngularDataContext } from '@themost/angular';
|
|
|
10
11
|
import { __awaiter } from 'tslib';
|
|
11
12
|
import { DatePipe, CommonModule } from '@angular/common';
|
|
12
13
|
import { TranslateService, TranslatePipe, TranslateModule } from '@ngx-translate/core';
|
|
13
|
-
import { FormArray, FormBuilder,
|
|
14
|
-
import { TemplatePipe, LoadingService, ErrorService, DIALOG_BUTTONS,
|
|
14
|
+
import { FormControl, FormArray, FormBuilder, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
15
|
+
import { TemplatePipe, ModalService, LoadingService, ErrorService, DIALOG_BUTTONS, UserActivityService, ToastService, AppEventService, UserStorageService, ConfigurationService, SharedModule } from '@universis/common';
|
|
15
16
|
import { RouterModalOkCancel, RouterModalModule } from '@universis/common/routing';
|
|
16
17
|
import { ServiceUrlPreProcessor, TranslatePreProcessor, AdvancedFormsModule } from '@universis/forms';
|
|
17
18
|
import { FormioModule } from 'angular-formio';
|
|
@@ -88,7 +89,7 @@ class AdvancedColumnFormatter {
|
|
|
88
89
|
if (options.navigationExtras && typeof options.navigationExtras.skipLocationChange !== 'undefined') {
|
|
89
90
|
skipLocationChange = options.navigationExtras.skipLocationChange;
|
|
90
91
|
}
|
|
91
|
-
return router.createUrlTree(commands,
|
|
92
|
+
return router.createUrlTree(commands, {
|
|
92
93
|
relativeTo: activatedRoute,
|
|
93
94
|
queryParams,
|
|
94
95
|
replaceUrl,
|
|
@@ -135,7 +136,7 @@ class ButtonFormatter extends AdvancedColumnFormatter {
|
|
|
135
136
|
buttonTitle = this.injector.get(TranslateService).instant(formatOptions.buttonTitle);
|
|
136
137
|
}
|
|
137
138
|
if (Array.isArray(this.formatOptions.commands)) {
|
|
138
|
-
|
|
139
|
+
let routerLink = this.createUrlTree(row, this.formatOptions);
|
|
139
140
|
return `<a class="${formatOptions.buttonClass}" title="${buttonTitle}" href="#${routerLink}">${buttonText}</a>`;
|
|
140
141
|
}
|
|
141
142
|
// and return button
|
|
@@ -472,6 +473,232 @@ AdvancedFilterValueProvider.decorators = [
|
|
|
472
473
|
AdvancedFilterValueProvider.ctorParameters = () => [];
|
|
473
474
|
AdvancedFilterValueProvider.ngInjectableDef = defineInjectable({ factory: function AdvancedFilterValueProvider_Factory() { return new AdvancedFilterValueProvider(); }, token: AdvancedFilterValueProvider, providedIn: "root" });
|
|
474
475
|
|
|
476
|
+
class ColumnSelectorComponent extends RouterModalOkCancel {
|
|
477
|
+
constructor(router, activatedRoute, _modalRef, ref, _translateService) {
|
|
478
|
+
super(router, activatedRoute);
|
|
479
|
+
this._modalRef = _modalRef;
|
|
480
|
+
this.ref = ref;
|
|
481
|
+
this._translateService = _translateService;
|
|
482
|
+
this.dismiss = new EventEmitter();
|
|
483
|
+
this.availableColumnsControl = new FormControl();
|
|
484
|
+
this.selectedColumnsControl = new FormControl();
|
|
485
|
+
}
|
|
486
|
+
ok() {
|
|
487
|
+
this._modalRef.hide();
|
|
488
|
+
this.applyChanges();
|
|
489
|
+
this.dismiss.emit('ok');
|
|
490
|
+
return Promise.resolve('ok');
|
|
491
|
+
}
|
|
492
|
+
cancel() {
|
|
493
|
+
this._modalRef.hide();
|
|
494
|
+
this.dismiss.emit('cancel');
|
|
495
|
+
return Promise.resolve('cancel');
|
|
496
|
+
}
|
|
497
|
+
ngOnChanges(changes) {
|
|
498
|
+
//
|
|
499
|
+
}
|
|
500
|
+
ngOnDestroy() {
|
|
501
|
+
//
|
|
502
|
+
}
|
|
503
|
+
ngOnInit() {
|
|
504
|
+
if (Array.isArray(this.columns)) {
|
|
505
|
+
this.selectedColumns = this.columns.filter((item) => {
|
|
506
|
+
return item.visible;
|
|
507
|
+
}).sort((a, b) => {
|
|
508
|
+
if (a.index < b.index) {
|
|
509
|
+
return -1;
|
|
510
|
+
}
|
|
511
|
+
if (a.index > b.index) {
|
|
512
|
+
return 1;
|
|
513
|
+
}
|
|
514
|
+
return 0;
|
|
515
|
+
}).map((item) => {
|
|
516
|
+
return {
|
|
517
|
+
key: item.key,
|
|
518
|
+
title: item.title
|
|
519
|
+
};
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
applyChanges() {
|
|
524
|
+
let moveIndex = this.selectedColumns.length - 1;
|
|
525
|
+
for (const column of this.columns) {
|
|
526
|
+
const findIndex = this.selectedColumns.findIndex((item) => {
|
|
527
|
+
return item.key === column.key;
|
|
528
|
+
});
|
|
529
|
+
if (findIndex < 0) {
|
|
530
|
+
column.visible = false;
|
|
531
|
+
moveIndex += 1;
|
|
532
|
+
column.index = moveIndex;
|
|
533
|
+
}
|
|
534
|
+
else {
|
|
535
|
+
column.visible = true;
|
|
536
|
+
column.index = findIndex;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
removeColumns() {
|
|
541
|
+
const selected = this.selectedColumnsControl.value;
|
|
542
|
+
if (selected.length > 0) {
|
|
543
|
+
for (const value of selected) {
|
|
544
|
+
let findIndex = this.selectedColumns.findIndex((item) => {
|
|
545
|
+
return item.key === value;
|
|
546
|
+
});
|
|
547
|
+
if (findIndex >= 0) {
|
|
548
|
+
this.selectedColumns.splice(findIndex, 1);
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
// reset column
|
|
552
|
+
this.selectedColumnsControl.reset();
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
addColumns() {
|
|
556
|
+
const selected = this.availableColumnsControl.value;
|
|
557
|
+
if (selected.length > 0) {
|
|
558
|
+
for (const value of selected) {
|
|
559
|
+
let findColumn = this.columns.find((item) => {
|
|
560
|
+
return item.key === value;
|
|
561
|
+
});
|
|
562
|
+
if (findColumn) {
|
|
563
|
+
const findIndex = this.selectedColumns.findIndex((item) => {
|
|
564
|
+
return item.key === value;
|
|
565
|
+
});
|
|
566
|
+
if (findIndex < 0) {
|
|
567
|
+
this.selectedColumns.push({
|
|
568
|
+
key: findColumn.key,
|
|
569
|
+
title: findColumn.title
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
// find the last index of the selected items
|
|
575
|
+
const lastSelectedIndex = this.columns.findIndex((item) => {
|
|
576
|
+
return item.key === selected[selected.length - 1];
|
|
577
|
+
});
|
|
578
|
+
// reset control
|
|
579
|
+
this.availableColumnsControl.reset();
|
|
580
|
+
if (lastSelectedIndex > -1 && lastSelectedIndex < this.columns.length - 1) {
|
|
581
|
+
this.availableColumnsControl.patchValue([
|
|
582
|
+
this.columns[lastSelectedIndex + 1].key
|
|
583
|
+
]);
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
moveUp() {
|
|
588
|
+
this.moveUpButton.nativeElement.disabled = true;
|
|
589
|
+
const selected = this.selectedColumnsControl.value;
|
|
590
|
+
if (selected.length > 0) {
|
|
591
|
+
for (const value of selected) {
|
|
592
|
+
const findIndex = this.selectedColumns.findIndex((item) => {
|
|
593
|
+
return item.key === value;
|
|
594
|
+
});
|
|
595
|
+
if (findIndex > 0) {
|
|
596
|
+
const column = this.selectedColumns[findIndex];
|
|
597
|
+
this.selectedColumns.splice(findIndex, 1);
|
|
598
|
+
this.selectedColumns.splice(findIndex - 1, 0, column);
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
this.moveUpButton.nativeElement.disabled = false;
|
|
603
|
+
}
|
|
604
|
+
moveDown() {
|
|
605
|
+
this.moveDownButton.nativeElement.disabled = true;
|
|
606
|
+
const selected = this.selectedColumnsControl.value;
|
|
607
|
+
if (selected.length > 0) {
|
|
608
|
+
for (const value of selected) {
|
|
609
|
+
let findIndex = this.selectedColumns.findIndex((item) => {
|
|
610
|
+
return item.key === value;
|
|
611
|
+
});
|
|
612
|
+
const length = this.columns.length;
|
|
613
|
+
if (findIndex >= 0 && findIndex < length) {
|
|
614
|
+
const column = this.selectedColumns[findIndex];
|
|
615
|
+
this.selectedColumns.splice(findIndex, 1);
|
|
616
|
+
this.selectedColumns.splice(findIndex + 1, 0, column);
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
this.moveDownButton.nativeElement.disabled = false;
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
ColumnSelectorComponent.decorators = [
|
|
624
|
+
{ type: Component, args: [{
|
|
625
|
+
selector: 'app-column-selector',
|
|
626
|
+
template: "<div>\n <div class=\"modal-header\">\n <h5 class=\"modal-title\">{{'Tables.SelectColumns' | translate}}</h5>\n <button (click)=\"cancel()\"\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\">\n <div class=\"col-12\">\n <p [translate]=\"'Tables.SelectColumnHelp'\"></p>\n <p [translate]=\"'Tables.MoveColumnHelp'\"></p>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-4\">\n <select [formControl]=\"availableColumnsControl\" size=\"10\" class=\"form-select form-control\" multiple aria-label=\"multiple select example\">\n <ng-container *ngIf=\"columns\">\n <ng-container *ngFor=\"let column of columns | orderBy: ['title']\">\n <option [value]=\"column.key\">{{column.title}}</option>\n </ng-container>\n </ng-container>\n </select>\n </div>\n <div class=\"col-4 d-flex justify-content-center align-items-center\">\n <div class=\"col-9\">\n <div>\n <button [disabled]=\"!(availableColumnsControl.value && availableColumnsControl.value.length)\" (click)=\"addColumns()\" type=\"button\" class=\"btn btn-primary btn-block\">\n <i class=\"fas fa-plus mr-2\"></i><span [translate]=\"'Tables.AddColumn'\"></span>\n </button>\n </div>\n <div class=\"mt-3\">\n <button [disabled]=\"!(selectedColumnsControl.value && selectedColumnsControl.value.length)\" (click)=\"removeColumns()\" type=\"button\" class=\"btn btn-secondary btn-block\">\n <i class=\"fas fa-minus mr-2\"></i><span [translate]=\"'Tables.RemoveColumn'\"></span>\n </button>\n </div>\n </div>\n </div>\n <div class=\"col-4\">\n <select [formControl]=\"selectedColumnsControl\" size=\"10\" class=\"form-select form-control\" multiple aria-label=\"multiple select example\">\n <ng-container *ngIf=\"selectedColumns\">\n <ng-container *ngFor=\"let column of selectedColumns\">\n <option [value]=\"column.key\">{{column.title}}</option>\n </ng-container>\n </ng-container>\n </select>\n <div class=\"d-flex justify-content-center align-items-center\">\n <div class=\"btn-group mt-4\">\n <button #moveUpButton (click)=\"moveUp()\" type=\"button\" class=\"btn btn-primary\">\n <i class=\"fas fa-chevron-up mr-2\"></i><span [translate]=\"'Tables.MoveUp'\"></span>\n </button>\n <button #moveDownButton (click)=\"moveDown()\" type=\"button\" class=\"btn btn-primary ml-2\">\n <i class=\"fas fa-chevron-down mr-2\"></i><span [translate]=\"'Tables.MoveDown'\"></span>\n </button>\n </div>\n </div>\n </div>\n </div>\n \n </div>\n <div class=\"modal-footer justify-content-end\">\n <button [disabled]=\"okButtonDisabled\" (click)=\"ok()\"\n type=\"button\" class=\"btn btn-primary\">\n {{'OK' | translate}}\n </button>\n <button [disabled]=\"cancelButtonDisabled\"\n (click)=\"cancel()\" type=\"button\" [ngClass]=\"cancelButtonClass\" data-dismiss=\"modal\">\n {{'Cancel' | translate}}\n </button>\n </div>\n </div>\n ",
|
|
627
|
+
encapsulation: ViewEncapsulation.None,
|
|
628
|
+
styles: [`
|
|
629
|
+
.form-select {
|
|
630
|
+
-webkit-appearance: none;
|
|
631
|
+
-moz-appearance: none;
|
|
632
|
+
appearance: none;
|
|
633
|
+
padding: 5px;
|
|
634
|
+
}
|
|
635
|
+
.form-select * {
|
|
636
|
+
padding: 5px 5px;
|
|
637
|
+
}
|
|
638
|
+
.btn.disabled, .btn:disabled {
|
|
639
|
+
border-color: transparent !important;
|
|
640
|
+
}
|
|
641
|
+
`]
|
|
642
|
+
}] }
|
|
643
|
+
];
|
|
644
|
+
/** @nocollapse */
|
|
645
|
+
ColumnSelectorComponent.ctorParameters = () => [
|
|
646
|
+
{ type: Router },
|
|
647
|
+
{ type: ActivatedRoute },
|
|
648
|
+
{ type: BsModalRef },
|
|
649
|
+
{ type: ChangeDetectorRef },
|
|
650
|
+
{ type: TranslateService }
|
|
651
|
+
];
|
|
652
|
+
ColumnSelectorComponent.propDecorators = {
|
|
653
|
+
columns: [{ type: Input }],
|
|
654
|
+
selectedColumns: [{ type: Input }],
|
|
655
|
+
moveUpButton: [{ type: ViewChild, args: ['moveUpButton',] }],
|
|
656
|
+
moveDownButton: [{ type: ViewChild, args: ['moveDownButton',] }]
|
|
657
|
+
};
|
|
658
|
+
|
|
659
|
+
class ColumnSelectorService {
|
|
660
|
+
constructor(_modal) {
|
|
661
|
+
this._modal = _modal;
|
|
662
|
+
//
|
|
663
|
+
}
|
|
664
|
+
selectColumns(columns) {
|
|
665
|
+
return new Promise((resolve, reject) => {
|
|
666
|
+
try {
|
|
667
|
+
const modalRef = this._modal.openModalComponent(ColumnSelectorComponent, {
|
|
668
|
+
class: 'modal-lg modal-table',
|
|
669
|
+
ignoreBackdropClick: true,
|
|
670
|
+
animated: true,
|
|
671
|
+
initialState: {
|
|
672
|
+
columns: columns,
|
|
673
|
+
}
|
|
674
|
+
});
|
|
675
|
+
const componentRef = modalRef.content;
|
|
676
|
+
componentRef.dismiss.subscribe((result) => {
|
|
677
|
+
if (result === 'ok') {
|
|
678
|
+
return resolve({
|
|
679
|
+
result: result,
|
|
680
|
+
columns: componentRef.columns
|
|
681
|
+
});
|
|
682
|
+
}
|
|
683
|
+
return resolve({
|
|
684
|
+
result: result
|
|
685
|
+
});
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
catch (err) {
|
|
689
|
+
return reject(err);
|
|
690
|
+
}
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
ColumnSelectorService.decorators = [
|
|
695
|
+
{ type: Injectable }
|
|
696
|
+
];
|
|
697
|
+
/** @nocollapse */
|
|
698
|
+
ColumnSelectorService.ctorParameters = () => [
|
|
699
|
+
{ type: ModalService }
|
|
700
|
+
];
|
|
701
|
+
|
|
475
702
|
// restore jquery import to avoid Cannot call a namespace ('jquery') error
|
|
476
703
|
const jQuery = jQuery_;
|
|
477
704
|
const DataTablesApi = jQuery.fn.dataTable.Api;
|
|
@@ -517,7 +744,7 @@ function getRandomIdentifier() {
|
|
|
517
744
|
return (Number(String(Math.random()).slice(2))).toString(36);
|
|
518
745
|
}
|
|
519
746
|
class AdvancedTableComponent {
|
|
520
|
-
constructor(_context, _columnFormatters, _activatedRoute, _translateService, _injector, _advancedFilterValueProvider, _element, _template, _loading, _http) {
|
|
747
|
+
constructor(_context, _columnFormatters, _activatedRoute, _translateService, _injector, _advancedFilterValueProvider, _element, _template, _loading, _http, _columnSelector) {
|
|
521
748
|
this._context = _context;
|
|
522
749
|
this._columnFormatters = _columnFormatters;
|
|
523
750
|
this._activatedRoute = _activatedRoute;
|
|
@@ -528,6 +755,7 @@ class AdvancedTableComponent {
|
|
|
528
755
|
this._template = _template;
|
|
529
756
|
this._loading = _loading;
|
|
530
757
|
this._http = _http;
|
|
758
|
+
this._columnSelector = _columnSelector;
|
|
531
759
|
this._firstLoad = true;
|
|
532
760
|
this._showFooter = true;
|
|
533
761
|
this._showHeader = true;
|
|
@@ -552,6 +780,7 @@ class AdvancedTableComponent {
|
|
|
552
780
|
this.lengthMenu = [50, 100, 200, 500];
|
|
553
781
|
this.paging = true;
|
|
554
782
|
this.pageLength = 25;
|
|
783
|
+
this.columnOrdering = false;
|
|
555
784
|
this.stateSave = false;
|
|
556
785
|
this.scrollY = 800;
|
|
557
786
|
this.scrollX = true;
|
|
@@ -1164,6 +1393,7 @@ class AdvancedTableComponent {
|
|
|
1164
1393
|
serverSide: this.serverSide,
|
|
1165
1394
|
// enumerate table columns
|
|
1166
1395
|
columns: tableColumns,
|
|
1396
|
+
colReorder: this.columnOrdering,
|
|
1167
1397
|
order: [],
|
|
1168
1398
|
// set scroll x
|
|
1169
1399
|
scrollX: this.scrollX,
|
|
@@ -1591,6 +1821,68 @@ class AdvancedTableComponent {
|
|
|
1591
1821
|
this.autoLoad = !!load;
|
|
1592
1822
|
this.ngOnInit();
|
|
1593
1823
|
}
|
|
1824
|
+
selectColumns() {
|
|
1825
|
+
// get column order e.g. [0, 4, 1, 2, 3]
|
|
1826
|
+
const columnOrder = this.dataTable.colReorder.order();
|
|
1827
|
+
// get column definitions
|
|
1828
|
+
const columnDefs = this.dataTable.settings().init().columns;
|
|
1829
|
+
const columns = columnDefs.map((columnDef, i) => {
|
|
1830
|
+
let key = `column-${i}`;
|
|
1831
|
+
let title = columnDef.title;
|
|
1832
|
+
// get column index
|
|
1833
|
+
const index = columnOrder.indexOf(i);
|
|
1834
|
+
const visible = this.dataTable.column(index).visible();
|
|
1835
|
+
// set title for select column
|
|
1836
|
+
if (i == 0 && this.selectable) {
|
|
1837
|
+
title = '<' + this._translateService.instant('Tables.SelectColumn') + '>';
|
|
1838
|
+
}
|
|
1839
|
+
// get column title
|
|
1840
|
+
if (title != null && title.length === 0) {
|
|
1841
|
+
title = null;
|
|
1842
|
+
}
|
|
1843
|
+
if (title == null) {
|
|
1844
|
+
// try to find column placeholder
|
|
1845
|
+
let placeholder = null;
|
|
1846
|
+
if (this.selectable) {
|
|
1847
|
+
if (i > 0) {
|
|
1848
|
+
placeholder = this.config.columns[i - 1].placeholder;
|
|
1849
|
+
}
|
|
1850
|
+
}
|
|
1851
|
+
else {
|
|
1852
|
+
placeholder = this.config.columns[i].placeholder;
|
|
1853
|
+
}
|
|
1854
|
+
if (placeholder != null) {
|
|
1855
|
+
title = '<' + this._translateService.instant(placeholder) + '>';
|
|
1856
|
+
}
|
|
1857
|
+
}
|
|
1858
|
+
if (title == null) {
|
|
1859
|
+
title = '<' + this._translateService.instant('Tables.UnknownColumn') + '>';
|
|
1860
|
+
}
|
|
1861
|
+
return {
|
|
1862
|
+
key,
|
|
1863
|
+
title,
|
|
1864
|
+
visible,
|
|
1865
|
+
index
|
|
1866
|
+
};
|
|
1867
|
+
});
|
|
1868
|
+
this._columnSelector.selectColumns(columns).then((event) => {
|
|
1869
|
+
if (event.result === 'ok') {
|
|
1870
|
+
// get column order e.g. [3, 1, 2, 0, 4]
|
|
1871
|
+
let indexes = event.columns.map((item) => {
|
|
1872
|
+
return item.index;
|
|
1873
|
+
});
|
|
1874
|
+
// reset column visibilty
|
|
1875
|
+
for (let index = 0; index < event.columns.length; index++) {
|
|
1876
|
+
const element = event.columns[index];
|
|
1877
|
+
const colIndex = columnOrder.indexOf(index);
|
|
1878
|
+
// set visibilty with redraw (=true)
|
|
1879
|
+
this.dataTable.column(colIndex).visible(element.visible, true);
|
|
1880
|
+
}
|
|
1881
|
+
// finally apply column order
|
|
1882
|
+
this.dataTable.colReorder.order(indexes, true);
|
|
1883
|
+
}
|
|
1884
|
+
});
|
|
1885
|
+
}
|
|
1594
1886
|
}
|
|
1595
1887
|
AdvancedTableComponent.decorators = [
|
|
1596
1888
|
{ type: Component, args: [{
|
|
@@ -1626,7 +1918,8 @@ AdvancedTableComponent.ctorParameters = () => [
|
|
|
1626
1918
|
{ type: ElementRef },
|
|
1627
1919
|
{ type: TemplatePipe },
|
|
1628
1920
|
{ type: LoadingService },
|
|
1629
|
-
{ type: HttpClient }
|
|
1921
|
+
{ type: HttpClient },
|
|
1922
|
+
{ type: ColumnSelectorService }
|
|
1630
1923
|
];
|
|
1631
1924
|
AdvancedTableComponent.propDecorators = {
|
|
1632
1925
|
table: [{ type: ViewChild, args: ['table',] }],
|
|
@@ -1649,6 +1942,7 @@ AdvancedTableComponent.propDecorators = {
|
|
|
1649
1942
|
lengthMenu: [{ type: Input }],
|
|
1650
1943
|
paging: [{ type: Input }],
|
|
1651
1944
|
pageLength: [{ type: Input }],
|
|
1945
|
+
columnOrdering: [{ type: Input }],
|
|
1652
1946
|
stateSave: [{ type: Input }],
|
|
1653
1947
|
stateLoadCallback: [{ type: Input }],
|
|
1654
1948
|
stateSaveCallback: [{ type: Input }],
|
|
@@ -4135,7 +4429,7 @@ class AddItemsComponent extends RouterModalOkCancel {
|
|
|
4135
4429
|
AddItemsComponent.decorators = [
|
|
4136
4430
|
{ type: Component, args: [{
|
|
4137
4431
|
selector: 'app-add-items',
|
|
4138
|
-
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.
|
|
4432
|
+
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.SelectItems'\" ></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"
|
|
4139
4433
|
}] }
|
|
4140
4434
|
];
|
|
4141
4435
|
/** @nocollapse */
|
|
@@ -4306,7 +4600,16 @@ const TABLES_EL = {
|
|
|
4306
4600
|
"CompletedWithSuccess": {
|
|
4307
4601
|
"Title": "Η διαδικασία ολοκληρώθηκε με επιτυχία."
|
|
4308
4602
|
}
|
|
4309
|
-
}
|
|
4603
|
+
},
|
|
4604
|
+
"SelectColumns": "Επιλογή στηλών",
|
|
4605
|
+
"MoveUp": "Επάνω",
|
|
4606
|
+
"MoveDown": "Κάτω",
|
|
4607
|
+
"AddColumn": "Επιλογή",
|
|
4608
|
+
"RemoveColumn": "Αφαίρεση",
|
|
4609
|
+
"SelectColumnHelp": "Επιλέξτε μία ή περισσότερες από τις διαθέσιμες στήλες και πατήστε το πλήκτρο 'Επιλογή' για να τις εμφανίσετε. Χρησιμοποιήστε το πλήκτρο 'Αφαίρεση' για να αφαιρέσετε τις επιλεγμένες στήλες.",
|
|
4610
|
+
"MoveColumnHelp": "Χρησιμοποιήστε τα πλήκτρα 'Επάνω' και 'Κάτω' για να αλλάξετε την σειρά εμφάνισης των στηλών του πίνακα.",
|
|
4611
|
+
"UnknownColumn": "Άγνωστο",
|
|
4612
|
+
"SelectColumn": "Επιλογή"
|
|
4310
4613
|
},
|
|
4311
4614
|
"TrueFalse": {
|
|
4312
4615
|
"long": {
|
|
@@ -4341,6 +4644,9 @@ const TABLES_EL = {
|
|
|
4341
4644
|
"Decline": "Απόρριψη",
|
|
4342
4645
|
"Close": "Κλείσιμο"
|
|
4343
4646
|
}
|
|
4647
|
+
},
|
|
4648
|
+
"AddItems": {
|
|
4649
|
+
"SelectItems": "Επιλέξτε στοιχεία",
|
|
4344
4650
|
}
|
|
4345
4651
|
};
|
|
4346
4652
|
|
|
@@ -4412,7 +4718,16 @@ const TABLES_EN = {
|
|
|
4412
4718
|
"CompletedWithSuccess": {
|
|
4413
4719
|
"Title": "The operation was completed successfully."
|
|
4414
4720
|
}
|
|
4415
|
-
}
|
|
4721
|
+
},
|
|
4722
|
+
"SelectColumns": "Select columns",
|
|
4723
|
+
"MoveUp": "Move up",
|
|
4724
|
+
"MoveDown": "Move down",
|
|
4725
|
+
"AddColumn": "Add",
|
|
4726
|
+
"RemoveColumn": "Remove",
|
|
4727
|
+
"SelectColumnHelp": "Select one or more columns and press 'Add' button to include them in table. Use 'Remove' button to exclude one or more columns from view.",
|
|
4728
|
+
"MoveColumnHelp": "Use 'Move up' and 'Move down' buttons to change column order.",
|
|
4729
|
+
"UnknownColumn": "Unknown",
|
|
4730
|
+
"SelectColumn": "Select"
|
|
4416
4731
|
},
|
|
4417
4732
|
"TrueFalse": {
|
|
4418
4733
|
"long": {
|
|
@@ -4447,6 +4762,9 @@ const TABLES_EN = {
|
|
|
4447
4762
|
"Decline": "Decline",
|
|
4448
4763
|
"Close": "Close"
|
|
4449
4764
|
}
|
|
4765
|
+
},
|
|
4766
|
+
"AddItems": {
|
|
4767
|
+
"SelectItems": "Select items",
|
|
4450
4768
|
}
|
|
4451
4769
|
};
|
|
4452
4770
|
|
|
@@ -4749,6 +5067,7 @@ TablesModule.decorators = [
|
|
|
4749
5067
|
AdvancedSearchConfigurationResolver,
|
|
4750
5068
|
AdvancedSelectService,
|
|
4751
5069
|
AdvancedAggregatorService,
|
|
5070
|
+
ColumnSelectorService,
|
|
4752
5071
|
GroupByPipe
|
|
4753
5072
|
],
|
|
4754
5073
|
declarations: [
|
|
@@ -4772,7 +5091,8 @@ TablesModule.decorators = [
|
|
|
4772
5091
|
AddItemsComponent,
|
|
4773
5092
|
AdvancedSearchState,
|
|
4774
5093
|
AdvancedTableState,
|
|
4775
|
-
AdvancedSearchRouterState
|
|
5094
|
+
AdvancedSearchRouterState,
|
|
5095
|
+
ColumnSelectorComponent
|
|
4776
5096
|
],
|
|
4777
5097
|
exports: [
|
|
4778
5098
|
AdvancedTableComponent,
|
|
@@ -4791,14 +5111,16 @@ TablesModule.decorators = [
|
|
|
4791
5111
|
AddItemsComponent,
|
|
4792
5112
|
AdvancedSearchState,
|
|
4793
5113
|
AdvancedTableState,
|
|
4794
|
-
AdvancedSearchRouterState
|
|
5114
|
+
AdvancedSearchRouterState,
|
|
5115
|
+
ColumnSelectorComponent
|
|
4795
5116
|
],
|
|
4796
5117
|
entryComponents: [
|
|
4797
5118
|
AdvancedTableModalBaseComponent,
|
|
4798
5119
|
AdvancedTableSettingsComponent,
|
|
4799
5120
|
AdvancedRowActionComponent,
|
|
4800
5121
|
AdvancedSelectComponent,
|
|
4801
|
-
AddItemsComponent
|
|
5122
|
+
AddItemsComponent,
|
|
5123
|
+
ColumnSelectorComponent
|
|
4802
5124
|
],
|
|
4803
5125
|
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
|
4804
5126
|
},] }
|
|
@@ -4816,6 +5138,6 @@ TablesModule.ctorParameters = () => [
|
|
|
4816
5138
|
* Generated bundle index. Do not edit.
|
|
4817
5139
|
*/
|
|
4818
5140
|
|
|
4819
|
-
export { AdvancedSearchState as ɵa, AdvancedTableState as ɵc, AdvancedSearchRouterState as ɵd, AdvancedListComponent, AdvancedRowActionComponent, AdvancedSearchFormComponent, AdvancedSelectComponent, AdvancedSelectService, AdvancedTableConfigurationResolver, AdvancedSearchConfigurationResolver, AdvancedColumnFormatter, NestedPropertyFormatter, ButtonFormatter, LinkFormatter, ActionLinkFormatter, ActionButtonFormatter, ActionSplitButtonFormatter, SelectRowFormatter, TemplateFormatter, TrueFalseFormatter, TranslationFormatter, DateTimeFormatter, NgClassFormatter, LanguageFormatter, COLUMN_FORMATTERS, AdvancedTableConfiguration, AdvancedTableComponent, AdvancedTableSettingsComponent, AdvancedTableSearchBaseComponent, AdvancedTableSearchComponent, FORMATTERS, AdvancedFilterValueProvider, AdvancedTableModalBaseTemplate, AdvancedTableModalBaseComponent, SimpleHeaderToolsComponent, TableSimpleHeaderComponent, AdvancedTableNotNullError, AdvancedTableEditorDirective, BtnExpDirective, AdvancedAggregatorComponent, AdvancedAggregatorListComponent, AddItemsComponent, AdvancedAggregatorPipe, ParseTitlePipe, AdvancedAggregatorService, TablesModule, ɵ0, ActivatedTableService, initialState, tableInitialState, tableReducer, tableReducers, featureName, getTablesState, selectTable };
|
|
5141
|
+
export { AdvancedSearchState as ɵa, AdvancedTableState as ɵc, AdvancedSearchRouterState as ɵd, AdvancedListComponent, AdvancedRowActionComponent, AdvancedSearchFormComponent, AdvancedSelectComponent, AdvancedSelectService, AdvancedTableConfigurationResolver, AdvancedSearchConfigurationResolver, AdvancedColumnFormatter, NestedPropertyFormatter, ButtonFormatter, LinkFormatter, ActionLinkFormatter, ActionButtonFormatter, ActionSplitButtonFormatter, SelectRowFormatter, TemplateFormatter, TrueFalseFormatter, TranslationFormatter, DateTimeFormatter, NgClassFormatter, LanguageFormatter, COLUMN_FORMATTERS, AdvancedTableConfiguration, AdvancedTableComponent, AdvancedTableSettingsComponent, AdvancedTableSearchBaseComponent, AdvancedTableSearchComponent, FORMATTERS, AdvancedFilterValueProvider, AdvancedTableModalBaseTemplate, AdvancedTableModalBaseComponent, SimpleHeaderToolsComponent, TableSimpleHeaderComponent, AdvancedTableNotNullError, AdvancedTableEditorDirective, BtnExpDirective, AdvancedAggregatorComponent, AdvancedAggregatorListComponent, AddItemsComponent, AdvancedAggregatorPipe, ParseTitlePipe, AdvancedAggregatorService, TablesModule, ɵ0, ActivatedTableService, ColumnSelectorService, ColumnSelectorComponent, initialState, tableInitialState, tableReducer, tableReducers, featureName, getTablesState, selectTable };
|
|
4820
5142
|
|
|
4821
5143
|
//# sourceMappingURL=universis-ngx-tables.js.map
|