Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
<ng-container *ngIf="(formatColumns && formatColumns[columnName] && formatColumns[columnName].type == 'button'); then buttonBlock else contentBlock"></ng-container>
</ng-template>
<ng-template #linkBlock>
<a tabindex="0" role="link" href="javascript:void(0);"
<a tabindex="0" role="link" href="javascript:void(0);" [style]="styleColumns[columnName]?.style" class="{{styleColumns[columnName]?.class}}"
attr.aria-label="{{gridResource[columnName] + ' - ' + ((formatColumns && formatColumns[columnName]) ? (rowData[columnName] | formatter:formatColumns[columnName]) : rowData[columnName])}}"
(click)="rowClick(rowData)">
<ng-content *ngTemplateOutlet="contentBlock"></ng-content>
</a>
</ng-template>

<ng-template #buttonBlock>
<button mat-button [ngClass]="formatColumns[columnName].class" (click)="rowClick(rowData)">
<button mat-button [style]="styleColumns[columnName]?.style" class="{{styleColumns[columnName]?.class}}" (click)="rowClick(rowData)">
<ng-content *ngTemplateOutlet="contentBlock"></ng-content>
</button>
</ng-template>
Expand All @@ -38,12 +38,12 @@
close</mat-icon>
<span *ngSwitchDefault>
<div class="crud-col" *ngIf="formatColumns && formatColumns[columnName]">
<span [innerHtml]="rowData[columnName] | formatter:formatColumns[columnName]"></span>
<span [style]="styleColumns[columnName]?.style" class="{{styleColumns[columnName]?.class}}" [innerHtml]="rowData[columnName] | formatter:formatColumns[columnName]"></span>
<span
*ngIf="formatColumns[columnName].type == 'fixlength' && (rowData[columnName] != null || rowData[columnName] != '') && formatColumns[columnName].format != null && formatColumns[columnName].format['length'] > rowData[columnName].length"
[matTooltip]="rowData[columnName]">...</span>
</div>
<div class="crud-col" *ngIf="!(formatColumns && formatColumns[columnName])">
<div class="crud-col" [style]="styleColumns[columnName]?.style" class="{{styleColumns[columnName]?.class}}" *ngIf="!(formatColumns && formatColumns[columnName])">
{{rowData[columnName]}}
</div>
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,3 @@
.red-icon {
color: red;
}

.crudLinkBtn .crud-col span
{
text-decoration: underline;
line-height: 0px;
color: var(--icon_color);
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export class DxcCrudCellRenderComponent implements OnInit {
@Input() gridResource: { [key: string]: string };
@Input() columnName: string = '';
@Input() formatColumns: any;
@Input() styleColumns: any;
@Input() isFirst: boolean = false;
@Input() rowSelection: 'single' | 'multi' | 'none' = 'none';
@Output() onRowClick = new EventEmitter<any>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<td mat-cell *matCellDef="let element; index as j" class="cell-position cell-focus pr-3 px-2"
id="table-cell{{j}}">
<dxc-crud-cell-render [rowData]="element" class="d-flex" [columnName]="column" [gridResource]="resource"
[isFirst]="first" [rowSelection]="rowSelection" [resource]="globalResource" [formatColumns]="formatColumns"
[isFirst]="first" [rowSelection]="rowSelection" [resource]="globalResource" [styleColumns]="styleColumns" [formatColumns]="formatColumns"
(onRowClick)="onRowClick($event)" (onRowSelect)="rowChecked($event)"></dxc-crud-cell-render>
</td>
</ng-container>
Expand Down Expand Up @@ -122,8 +122,8 @@
[attr.aria-label]="globalResource.selectAllRowMessage?.description" (click)="selectAllRow()">
<span class="position-absolute font-size-25 left-0">check_box_outline_blank</span>
<span class="position-absolute font-size-25 left-0"
*ngIf="selectedRowCount > 0 && selectedRowCount != dataSource.data?.length">remove</span>
<span class="position-absolute font-size-25 left-0" *ngIf="selectedRowCount == dataSource.data?.length">done</span>
*ngIf="selectedRowCount > 0 && dataSource.data?.length > 0 && selectedRowCount != dataSource.data?.length">remove</span>
<span class="position-absolute font-size-25 left-0" *ngIf="selectedRowCount == dataSource.data?.length && dataSource.data?.length > 0">done</span>
</a>
<h6 class="text-center d-md-none d-sm-block">
<b>{{globalResource.selectAllRow?.description}}</b>
Expand Down Expand Up @@ -163,6 +163,6 @@ <h6 class="modal-title ml-2">
</form>
</dxc-dialog>

<div tabindex="0" *ngIf="loaded == true && (dataSource?.data == null || (dataSource?.data != null && dataSource.data.length <= 0))">
<div *ngIf="loaded == true && (dataSource?.data == null || (dataSource?.data != null && dataSource.data.length <= 0))">
<h6 class="no-record p-2 text-center">{{noRecord}}</h6>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { DateHelper } from '../helpers/date/date-helper';
import { Button } from './../models/startup/configuration.model';
import { delay, filter } from 'rxjs/operators';
import { TextEditorService } from '../dxc-text-editor/text-editor/text-editor.service';
import { I } from '@angular/cdk/keycodes';

@Component({
selector: 'dxc-crud-table',
Expand Down Expand Up @@ -53,6 +54,7 @@ export class DxcCrudTableComponent implements OnInit, ControlValueAccessor, OnCh
@Input() columns: any
@Input() editableColumns: any;
@Input() formatColumns: any;
@Input() styleColumns: any = {};
@Input() sourceRequest: IRequest;
@Input() uniqueIdentifier = '';
@Input() resource: { [key: string]: string };
Expand Down Expand Up @@ -310,8 +312,8 @@ export class DxcCrudTableComponent implements OnInit, ControlValueAccessor, OnCh
this.confirmationDialogService.confirm(options);
this.confirmationDialogService.confirmed().subscribe(confirmed => {
if (confirmed) {
selectedRows.forEach(row => {
this.deleteRow(row, deleteRequest);
selectedRows.forEach((row, index) => {
this.deleteRow(row, deleteRequest, (selectedRows.length - 1 == index));
});
}
});
Expand Down Expand Up @@ -358,7 +360,7 @@ export class DxcCrudTableComponent implements OnInit, ControlValueAccessor, OnCh
this.action.emit(row);
}

deleteRow = (row, deleteRequest) => {
deleteRow = (row, deleteRequest, showMessage) => {
if (deleteRequest) {
this.helper.deleteData(deleteRequest, this.uniqueIdentifier, row).subscribe((response) => {
if (response == true) {
Expand All @@ -368,9 +370,12 @@ export class DxcCrudTableComponent implements OnInit, ControlValueAccessor, OnCh
if (this.parentForm.dirty) {
this.formControlUpdater.emit({ action: EAction.DELETEANDSAVE, columns: this.editableFields, data: row });
} else {
if (showMessage == true) {
this.messageService.Success(this.resource.deleteSuccess);
this.formControlUpdater.emit({ action: EAction.DELETEANDSAVE, columns: this.editableFields, data: row });
}
}
this.selectedRowCount = this.dataSource.data.filter(row => { return row['isSelected'] == true }).length;
} else {
this.messageService.Error(response);
}
Expand Down