Fixed hidden columns #1.1.0.rc4

This commit is contained in:
Sven Heidemann 2023-08-17 21:26:18 +02:00
parent f3b5cef253
commit 2956dcb9c2
10 changed files with 41 additions and 10 deletions

View File

@ -1 +1,26 @@
# -*- coding: utf-8 -*-
"""
bot Keksdose bot
~~~~~~~~~~~~~~~~~~~
Discord bot for the Keksdose discord Server
:copyright: (c) 2022 - 2023 sh-edraft.de
:license: MIT, see LICENSE for more details.
"""
__title__ = "bot_graphql.model"
__author__ = "Sven Heidemann"
__license__ = "MIT"
__copyright__ = "Copyright (c) 2022 - 2023 sh-edraft.de"
__version__ = "1.1.0rc4"
from collections import namedtuple
# imports # imports
VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="1", minor="1", micro="0.rc4")

View File

@ -15,7 +15,7 @@ export class ComponentWithTable {
return this._hiddenColumns; return this._hiddenColumns;
} }
private name: string = ""; public name: string = "";
public columns: Column[] = []; public columns: Column[] = [];
constructor( constructor(

View File

@ -16,7 +16,7 @@
</ng-container> </ng-container>
{{'admin.auth_users.users' | translate}} {{'admin.auth_users.users' | translate}}
</div> </div>
<app-multi-select-columns [columns]="columns" [(hiddenColumns)]="hiddenColumns"></app-multi-select-columns> <app-multi-select-columns [table]="name" [columns]="columns" [(hiddenColumns)]="hiddenColumns"></app-multi-select-columns>
</div> </div>
<div class="table-caption-btn-wrapper btn-wrapper"> <div class="table-caption-btn-wrapper btn-wrapper">

View File

@ -1,13 +1,13 @@
<div class="table-caption-column-select"> <div class="table-caption-column-select">
<p-multiSelect display="chip" [options]="columns" [(ngModel)]="hiddenColumns" optionLabel="name" placeholder="{{'common.hidden_columns' | translate}}" [filter]=false> <p-multiSelect display="chip" [options]="columns" [(ngModel)]="hiddenColumns" optionLabel="name" placeholder="{{'common.hidden_columns' | translate}}" [filter]=false>
<ng-template let-value pTemplate="selectedItems"> <ng-template pTemplate="selectedItems">
<div *ngFor="let item of hiddenColumns; let i = index;"> <div *ngFor="let item of visibleHiddenColumns; let i = index;">
<div *ngIf="item.name"> <div *ngIf="item.name">
{{'common.' + item.name | translate}}<span *ngIf="i < columns.length-1">,</span> {{'common.' + item.name | translate}}<span *ngIf="i < columns.length-1">,</span>
</div> </div>
<div *ngIf="!item.name">{{'common.hidden_columns' | translate}}</div> <div *ngIf="!item.name">{{'common.hidden_columns' | translate}}</div>
</div> </div>
<div *ngIf="!hiddenColumns || hiddenColumns.length === 0">{{'common.hidden_columns' | translate}}</div> <div *ngIf="!visibleHiddenColumns || visibleHiddenColumns.length === 0">{{'common.hidden_columns' | translate}}</div>
</ng-template> </ng-template>
<ng-template let-item pTemplate="item"> <ng-template let-item pTemplate="item">

View File

@ -10,6 +10,8 @@ export class MultiSelectColumnsComponent {
@Input() columns: Column[] = []; @Input() columns: Column[] = [];
private _hiddenColumns: Column[] = []; private _hiddenColumns: Column[] = [];
@Input() table: String = "";
@Input() @Input()
set hiddenColumns(columns: Column[]) { set hiddenColumns(columns: Column[]) {
this._hiddenColumns = columns; this._hiddenColumns = columns;
@ -20,5 +22,9 @@ export class MultiSelectColumnsComponent {
return this._hiddenColumns; return this._hiddenColumns;
} }
get visibleHiddenColumns(): Column[] {
return this._hiddenColumns.filter(x => x.key.startsWith(`${this.table}_`));
}
@Output() hiddenColumnsChange: EventEmitter<Column[]> = new EventEmitter<Column[]>(); @Output() hiddenColumnsChange: EventEmitter<Column[]> = new EventEmitter<Column[]>();
} }

View File

@ -17,7 +17,7 @@
{{'view.server.achievements.achievements' | translate}} {{'view.server.achievements.achievements' | translate}}
</div> </div>
<app-multi-select-columns [columns]="columns" [(hiddenColumns)]="hiddenColumns"></app-multi-select-columns> <app-multi-select-columns [table]="name" [columns]="columns" [(hiddenColumns)]="hiddenColumns"></app-multi-select-columns>
</div> </div>
<div class="table-caption-btn-wrapper btn-wrapper"> <div class="table-caption-btn-wrapper btn-wrapper">

View File

@ -16,7 +16,7 @@
</ng-container> </ng-container>
{{'view.server.auto_roles.rules.auto_roles' | translate}} {{'view.server.auto_roles.rules.auto_roles' | translate}}
</div> </div>
<app-multi-select-columns [columns]="columns" [(hiddenColumns)]="hiddenColumns"></app-multi-select-columns> <app-multi-select-columns [table]="name" [columns]="columns" [(hiddenColumns)]="hiddenColumns"></app-multi-select-columns>
</div> </div>
<div class="table-caption-btn-wrapper btn-wrapper"> <div class="table-caption-btn-wrapper btn-wrapper">

View File

@ -17,7 +17,7 @@
{{'view.server.auto_roles.auto_roles' | translate}} {{'view.server.auto_roles.auto_roles' | translate}}
</div> </div>
<app-multi-select-columns [columns]="columns" [(hiddenColumns)]="hiddenColumns"></app-multi-select-columns> <app-multi-select-columns [table]="name" [columns]="columns" [(hiddenColumns)]="hiddenColumns"></app-multi-select-columns>
</div> </div>
<div class="table-caption-btn-wrapper btn-wrapper"> <div class="table-caption-btn-wrapper btn-wrapper">

View File

@ -17,7 +17,7 @@
{{'view.server.levels.levels' | translate}} {{'view.server.levels.levels' | translate}}
</div> </div>
<app-multi-select-columns [columns]="columns" [(hiddenColumns)]="hiddenColumns"></app-multi-select-columns> <app-multi-select-columns [table]="name" [columns]="columns" [(hiddenColumns)]="hiddenColumns"></app-multi-select-columns>
</div> </div>
<div class="table-caption-btn-wrapper btn-wrapper"> <div class="table-caption-btn-wrapper btn-wrapper">

View File

@ -17,7 +17,7 @@
{{'view.server.members.members' | translate}} {{'view.server.members.members' | translate}}
</div> </div>
<app-multi-select-columns [columns]="columns" [(hiddenColumns)]="hiddenColumns"></app-multi-select-columns> <app-multi-select-columns [table]="name" [columns]="columns" [(hiddenColumns)]="hiddenColumns"></app-multi-select-columns>
</div> </div>
<div class="table-caption-btn-wrapper btn-wrapper"> <div class="table-caption-btn-wrapper btn-wrapper">