Some fixes, bulk actions WIP

This commit is contained in:
Adina Țeudan 2021-12-02 01:51:53 +02:00
parent 2d2cd9fcda
commit ea2d5fc69b
7 changed files with 17 additions and 6 deletions

View File

@ -131,6 +131,7 @@
.all-caps-label {
margin: 0 16px 0 8px;
opacity: 1;
min-width: fit-content;
}
}
}

View File

@ -21,11 +21,14 @@
&.mat-button-disabled {
cursor: not-allowed;
&:not(.primary):not(.warn):not(.dark-bg):hover {
background-color: var(--iqser-btn-bg);
}
}
&.primary.mat-button-disabled {
background-color: var(--iqser-btn-bg);
color: var(--iqser-white) !important;
color: #ffffff80;
}
&.warn:not([disabled]) {

View File

@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { BehaviorSubject, combineLatest, Observable } from 'rxjs';
import { map, mapTo, tap } from 'rxjs/operators';
import { map, tap } from 'rxjs/operators';
import { FilterService, getFilteredEntities } from '../../filtering';
import { SearchService } from '../../search';
import { IListable } from '../models';
@ -29,7 +29,10 @@ export class ListingService<E extends IListable> {
this.displayedLength$ = this.displayed$.pipe(getLength, shareDistinctLast());
this.selected$ = this._selected$.asObservable().pipe(shareDistinctLast());
this.selectedEntities$ = this._selected$.asObservable().pipe(mapTo(this.selected), shareLast());
this.selectedEntities$ = this._selected$.asObservable().pipe(
map(() => this.selected),
shareLast(),
);
this.selectedLength$ = this._selected$.pipe(getLength, shareDistinctLast());
this.areAllSelected$ = this._areAllSelected$;

View File

@ -25,6 +25,8 @@
class="all-caps-label"></span>
</div>
<ng-container [ngTemplateOutlet]="bulkActions"></ng-container>
<iqser-circle-button
(action)="disableSelection()"
[type]="circleButtonTypes.primary"

View File

@ -1,4 +1,4 @@
import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnInit, Output, TemplateRef } from '@angular/core';
import { combineLatest, Observable } from 'rxjs';
import { filter, map, tap } from 'rxjs/operators';
import { CircleButtonTypes } from '../../../buttons';
@ -18,6 +18,7 @@ export class ColumnHeaderComponent<T extends IListable, K extends string> extend
@Input() @Required() column!: WorkflowColumn<T, K>;
@Input() @Required() selectionColumn?: WorkflowColumn<T, K>;
@Input() bulkActions?: TemplateRef<unknown>;
@Output() @Required() readonly selectionColumnChange = new EventEmitter<WorkflowColumn<T, K> | undefined>();
allSelected$!: Observable<boolean>;

View File

@ -23,7 +23,7 @@
[class.list-source]="isSource(column)"
[style.--color]="column.color"
class="column">
<iqser-column-header [(selectionColumn)]="this.selectionColumn" [column]="column"></iqser-column-header>
<iqser-column-header [(selectionColumn)]="this.selectionColumn" [bulkActions]="bulkActions" [column]="column"></iqser-column-header>
<div
(cdkDropListDropped)="move($event)"
[cdkDropListData]="column.entities | async"

View File

@ -54,6 +54,7 @@ export class WorkflowComponent<T extends IListable, K extends string> extends Au
@Input() noDataButtonIcon?: string;
@Input() noDataButtonLabel?: string;
@Input() showNoDataButton = false;
@Input() bulkActions?: TemplateRef<unknown>;
@Output() readonly noDataAction = new EventEmitter<void>();
@Output() readonly addElement = new EventEmitter<void>();