mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
* * reusable data table column moved * [ACA-4361] permission layout modified * * build fixed * fix build * * import fixed * * null safety operation * * fixed comments * * fix lint * * wait for reload list * * remove sleep * * add sleep * * fix comments * * fix comments * * floating promises fix * * remove wait
271 lines
17 KiB
HTML
271 lines
17 KiB
HTML
<div
|
|
role="grid"
|
|
*ngIf="data" class="adf-full-width"
|
|
[class.adf-datatable-card]="display === 'gallery'"
|
|
[class.adf-datatable-list]="display === 'list'"
|
|
[class.adf-sticky-header]="isStickyHeaderEnabled()"
|
|
[class.adf-datatable--empty]="(isEmpty() && !isHeaderVisible()) || loading"
|
|
[class.adf-datatable--empty--header-visible]="isEmpty() && isHeaderVisible()">
|
|
<div *ngIf="isHeaderVisible()" class="adf-datatable-header" role="rowgroup" [ngClass]="{ 'adf-sr-only': !isHeaderVisible() }">
|
|
<adf-datatable-row
|
|
data-automation-id="datatable-row-header"
|
|
[disabled]="!isHeaderVisible()"
|
|
class="adf-datatable-row"
|
|
*ngIf="display === 'list'"
|
|
role="row">
|
|
<!-- Actions (left) -->
|
|
<div *ngIf="actions && actionsPosition === 'left'" class="adf-actions-column adf-datatable-cell-header">
|
|
<span class="adf-sr-only">{{ 'ADF-DATATABLE.ACCESSIBILITY.ACTIONS' | translate }}</span>
|
|
</div>
|
|
<!-- Columns -->
|
|
<div *ngIf="multiselect" class="adf-datatable-cell-header adf-datatable-checkbox">
|
|
<mat-checkbox [indeterminate]="isSelectAllIndeterminate" [checked]="isSelectAllChecked" (change)="onSelectAllClick($event)" class="adf-checkbox-sr-only">{{ 'ADF-DATATABLE.ACCESSIBILITY.SELECT_ALL' | translate }}</mat-checkbox>
|
|
</div>
|
|
<div class="adf-datatable-cell--{{col.type || 'text'}} {{col.cssClass}} adf-datatable-cell-header"
|
|
*ngFor="let col of data.getColumns()"
|
|
[class.adf-sortable]="col.sortable"
|
|
[attr.data-automation-id]="'auto_id_' + col.key"
|
|
[class.adf-datatable__header--sorted-asc]="isColumnSorted(col, 'asc')"
|
|
[class.adf-datatable__header--sorted-desc]="isColumnSorted(col, 'desc')"
|
|
(click)="onColumnHeaderClick(col)"
|
|
(keyup.enter)="onColumnHeaderClick(col)"
|
|
role="columnheader"
|
|
[attr.tabindex]="isHeaderVisible() ? 0 : null"
|
|
[attr.aria-sort]="col.sortable ? (getAriaSort(col) | translate) : null"
|
|
adf-drop-zone dropTarget="header" [dropColumn]="col">
|
|
<ng-container *ngIf="!col.header">
|
|
<span *ngIf="col.title" class="adf-datatable-cell-value">{{ col.title | translate}}</span>
|
|
<span *ngIf="col.title && col.sortable" class="adf-sr-only" aria-live="polite">{{ getSortLiveAnnouncement(col) | translate: { string: col.title | translate } }}</span>
|
|
<ng-template *ngIf="allowFiltering" [ngTemplateOutlet]="headerFilterTemplate" [ngTemplateOutletContext]="{$implicit: col}"></ng-template>
|
|
</ng-container>
|
|
<ng-template *ngIf="col.header" [ngTemplateOutlet]="col.header" [ngTemplateOutletContext]="{$implicit: col}"></ng-template>
|
|
</div>
|
|
<!-- Actions (right) -->
|
|
<div *ngIf="actions && actionsPosition === 'right'" class="adf-actions-column adf-datatable-cell-header adf-datatable__actions-cell">
|
|
<span class="adf-sr-only">{{ 'ADF-DATATABLE.ACCESSIBILITY.ACTIONS' | translate }}</span>
|
|
</div>
|
|
</adf-datatable-row>
|
|
<mat-form-field *ngIf="display === 'gallery' && isHeaderVisible()">
|
|
<mat-select [value]="getSortingKey()" [attr.data-automation-id]="'grid-view-sorting'">
|
|
<mat-option *ngFor="let col of getSortableColumns()"
|
|
[value]="col.key"
|
|
[attr.data-automation-id]="'grid-view-sorting-'+col.title"
|
|
(click)="onColumnHeaderClick(col)"
|
|
(keyup.enter)="onColumnHeaderClick(col)">
|
|
{{ col.title | translate}}
|
|
</mat-option>
|
|
</mat-select>
|
|
</mat-form-field>
|
|
</div>
|
|
|
|
<div class="adf-datatable-body" role="rowgroup">
|
|
<ng-container *ngIf="!loading && !noPermission">
|
|
<adf-datatable-row *ngFor="let row of data.getRows(); let idx = index"
|
|
[row]="row"
|
|
(select)="onEnterKeyPressed(row, $event)"
|
|
(keyup)="onRowKeyUp(row, $event)"
|
|
(keydown)="onRowEnterKeyDown(row, $event)"
|
|
[adf-upload]="rowAllowsDrop(row)"
|
|
[adf-upload-data]="row"
|
|
[ngStyle]="rowStyle"
|
|
[ngClass]="getRowStyle(row)"
|
|
[attr.data-automation-id]="'datatable-row-' + idx">
|
|
<!-- Actions (left) -->
|
|
<div *ngIf="actions && actionsPosition === 'left'" role="gridcell" class="adf-datatable-cell">
|
|
<button mat-icon-button [matMenuTriggerFor]="menu"
|
|
[title]="'ADF-DATATABLE.CONTENT-ACTIONS.TOOLTIP' | translate"
|
|
[attr.id]="'action_menu_left_' + idx"
|
|
[attr.data-automation-id]="'action_menu_' + idx">
|
|
<mat-icon>more_vert</mat-icon>
|
|
</button>
|
|
<mat-menu #menu="matMenu">
|
|
<button mat-menu-item *ngFor="let action of getRowActions(row)"
|
|
[attr.data-automation-id]="action.title"
|
|
[disabled]="action.disabled"
|
|
(click)="onExecuteRowAction(row, action)">
|
|
<mat-icon *ngIf="action.icon">{{ action.icon }}</mat-icon>
|
|
<span>{{ action.title | translate }}</span>
|
|
</button>
|
|
</mat-menu>
|
|
</div>
|
|
|
|
<div *ngIf="multiselect" class="adf-datatable-cell adf-datatable-checkbox">
|
|
<mat-checkbox
|
|
[checked]="row.isSelected"
|
|
[attr.aria-checked]="row.isSelected"
|
|
role="checkbox"
|
|
(change)="onCheckboxChange(row, $event)"
|
|
class="adf-checkbox-sr-only">
|
|
{{ 'ADF-DATATABLE.ACCESSIBILITY.SELECT_FILE' | translate }}
|
|
</mat-checkbox>
|
|
</div>
|
|
<div *ngFor="let col of data.getColumns()"
|
|
role="gridcell"
|
|
class="adf-datatable-cell adf-datatable-cell--{{col.type || 'text'}} {{col.cssClass}}"
|
|
[attr.title]="col.title | translate"
|
|
[attr.data-automation-id]="getAutomationValue(row)"
|
|
[attr.aria-selected]="row.isSelected ? true : false"
|
|
[attr.aria-label]="col.title ? (col.title | translate) : null"
|
|
(click)="onRowClick(row, $event)"
|
|
(keydown.enter)="onEnterKeyPressed(row, $event)"
|
|
[adf-context-menu]="getContextMenuActions(row, col)"
|
|
[adf-context-menu-enabled]="contextMenu"
|
|
adf-drop-zone dropTarget="cell" [dropColumn]="col" [dropRow]="row">
|
|
<div *ngIf="!col.template" class="adf-datatable-cell-container">
|
|
<ng-container [ngSwitch]="col.type">
|
|
<div *ngSwitchCase="'image'" class="adf-cell-value">
|
|
<mat-icon *ngIf="isIconValue(row, col); else no_iconvalue">{{ asIconValue(row, col) }}
|
|
</mat-icon>
|
|
<ng-template #no_iconvalue>
|
|
<mat-icon class="adf-datatable-selected"
|
|
*ngIf="row.isSelected && !multiselect; else no_selected_row" svgIcon="selected">
|
|
</mat-icon>
|
|
<ng-template #no_selected_row>
|
|
<img class="adf-datatable-center-img-ie"
|
|
[attr.aria-label]=" (data.getValue(row, col) | fileType) === 'disable' ?
|
|
('ADF-DATATABLE.ACCESSIBILITY.ICON_DISABLED' | translate) :
|
|
'ADF-DATATABLE.ACCESSIBILITY.ICON_TEXT' | translate:{
|
|
type: 'ADF-DATATABLE.FILE_TYPE.' + (data.getValue(row, col) | fileType | uppercase) | translate
|
|
}"
|
|
[attr.alt]=" (data.getValue(row, col) | fileType) === 'disable' ?
|
|
('ADF-DATATABLE.ACCESSIBILITY.ICON_DISABLED' | translate) :
|
|
'ADF-DATATABLE.ACCESSIBILITY.ICON_TEXT' | translate:{
|
|
type: 'ADF-DATATABLE.FILE_TYPE.' + (data.getValue(row, col) | fileType | uppercase) | translate
|
|
}"
|
|
src="{{ data.getValue(row, col) }}"
|
|
(error)="onImageLoadingError($event, row)">
|
|
</ng-template>
|
|
</ng-template>
|
|
</div>
|
|
<div *ngSwitchCase="'icon'" class="adf-cell-value">
|
|
<mat-icon>{{ data.getValue(row, col) }}</mat-icon>
|
|
</div>
|
|
<div *ngSwitchCase="'date'" class="adf-cell-value" [attr.tabindex]="data.getValue(row, col, resolverFn)? 0 : -1"
|
|
[attr.data-automation-id]="'date_' + (data.getValue(row, col, resolverFn) | adfLocalizedDate: 'medium') ">
|
|
<adf-date-cell class="adf-datatable-center-date-column-ie"
|
|
[data]="data"
|
|
[column]="col"
|
|
[row]="row"
|
|
[resolverFn]="resolverFn"
|
|
[tooltip]="getCellTooltip(row, col)">
|
|
</adf-date-cell>
|
|
</div>
|
|
<div *ngSwitchCase="'location'" [attr.tabindex]="data.getValue(row, col, resolverFn)? 0 : -1" class="adf-cell-value"
|
|
[attr.data-automation-id]="'location' + data.getValue(row, col, resolverFn)">
|
|
<adf-location-cell
|
|
[data]="data"
|
|
[column]="col"
|
|
[row]="row"
|
|
[resolverFn]="resolverFn"
|
|
[tooltip]="getCellTooltip(row, col)">
|
|
</adf-location-cell>
|
|
</div>
|
|
<div *ngSwitchCase="'fileSize'" [attr.tabindex]="data.getValue(row, col, resolverFn)? 0 : -1" class="adf-cell-value"
|
|
[attr.data-automation-id]="'fileSize_' + data.getValue(row, col, resolverFn)">
|
|
<adf-filesize-cell class="adf-datatable-center-size-column-ie"
|
|
[data]="data"
|
|
[column]="col"
|
|
[row]="row"
|
|
[resolverFn]="resolverFn"
|
|
[tooltip]="getCellTooltip(row, col)">
|
|
</adf-filesize-cell>
|
|
</div>
|
|
<div *ngSwitchCase="'text'" [attr.tabindex]="data.getValue(row, col, resolverFn)? 0 : -1" class="adf-cell-value"
|
|
[attr.data-automation-id]="'text_' + data.getValue(row, col, resolverFn)">
|
|
<adf-datatable-cell
|
|
[copyContent]="col.copyContent"
|
|
[data]="data"
|
|
[column]="col"
|
|
[row]="row"
|
|
[resolverFn]="resolverFn"
|
|
[tooltip]="getCellTooltip(row, col)">
|
|
</adf-datatable-cell>
|
|
</div>
|
|
<div *ngSwitchCase="'json'" [attr.tabindex]="data.getValue(row, col, resolverFn)? 0 : -1" class="adf-cell-value">
|
|
<adf-json-cell
|
|
[editable]="col.editable"
|
|
[data]="data"
|
|
[column]="col"
|
|
[resolverFn]="resolverFn"
|
|
[row]="row">
|
|
</adf-json-cell>
|
|
</div>
|
|
<span *ngSwitchDefault class="adf-cell-value">
|
|
<!-- empty cell for unknown column type -->
|
|
</span>
|
|
</ng-container>
|
|
</div>
|
|
<div *ngIf="col.template" class="adf-datatable-cell-container">
|
|
<div class="adf-cell-value" [attr.tabindex]="col.focus ? 0 : null">
|
|
<ng-container
|
|
[ngTemplateOutlet]="col.template"
|
|
[ngTemplateOutletContext]="{ $implicit: { data: data, row: row, col: col }, value: data.getValue(row, col, resolverFn) }">
|
|
</ng-container>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Actions (right) -->
|
|
<div *ngIf="actions && actionsPosition === 'right'"
|
|
role="gridcell"
|
|
class="adf-datatable-cell adf-datatable__actions-cell adf-datatable-center-actions-column-ie">
|
|
<button mat-icon-button [matMenuTriggerFor]="menu"
|
|
[attr.aria-label]="'ADF-DATATABLE.ACCESSIBILITY.ROW_OPTION_BUTTON' | translate"
|
|
[title]="'ADF-DATATABLE.CONTENT-ACTIONS.TOOLTIP' | translate"
|
|
[attr.id]="'action_menu_right_' + idx"
|
|
[attr.data-automation-id]="'action_menu_' + idx">
|
|
<mat-icon>more_vert</mat-icon>
|
|
</button>
|
|
<mat-menu #menu="matMenu">
|
|
<button mat-menu-item *ngFor="let action of getRowActions(row)"
|
|
[attr.data-automation-id]="action.title"
|
|
[attr.aria-label]="action.title | translate"
|
|
[disabled]="action.disabled"
|
|
(click)="onExecuteRowAction(row, action)">
|
|
<mat-icon *ngIf="action.icon">{{ action.icon }}</mat-icon>
|
|
<span>{{ action.title | translate }}</span>
|
|
</button>
|
|
</mat-menu>
|
|
</div>
|
|
</adf-datatable-row>
|
|
<div *ngIf="isEmpty()"
|
|
role="row"
|
|
[class.adf-datatable-row]="display === 'list'"
|
|
[class.adf-datatable-card-empty]="display === 'gallery'">
|
|
<div class="adf-no-content-container adf-datatable-cell" role="gridcell">
|
|
<ng-template *ngIf="noContentTemplate"
|
|
ngFor [ngForOf]="[data]"
|
|
[ngForTemplate]="noContentTemplate">
|
|
</ng-template>
|
|
<ng-content select="adf-empty-list"></ng-content>
|
|
</div>
|
|
</div>
|
|
<div *ngFor="let row of fakeRows"
|
|
class="adf-datatable-row adf-datatable-row-empty-card">
|
|
</div>
|
|
</ng-container>
|
|
<div *ngIf="!loading && noPermission"
|
|
role="row"
|
|
[class.adf-datatable-row]="display === 'list'"
|
|
[class.adf-datatable-card-permissions]="display === 'gallery'"
|
|
class="adf-no-permission__row">
|
|
<div class="adf-no-permission__cell adf-no-content-container adf-datatable-cell">
|
|
<ng-template *ngIf="noPermissionTemplate"
|
|
ngFor [ngForOf]="[data]"
|
|
[ngForTemplate]="noPermissionTemplate">
|
|
</ng-template>
|
|
</div>
|
|
</div>
|
|
<div *ngIf="loading"
|
|
[class.adf-datatable-row]="display === 'list'"
|
|
[class.adf-datatable-card-loading]="display === 'gallery'">
|
|
<div class="adf-no-content-container adf-datatable-cell">
|
|
<ng-template *ngIf="loadingTemplate"
|
|
ngFor [ngForOf]="[data]"
|
|
[ngForTemplate]="loadingTemplate">
|
|
</ng-template>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|