Skip to content

Commit

Permalink
#627 wip
Browse files Browse the repository at this point in the history
  • Loading branch information
arawinters committed Apr 12, 2024
1 parent ad6b70f commit e2ca63f
Show file tree
Hide file tree
Showing 5 changed files with 176 additions and 31 deletions.
11 changes: 11 additions & 0 deletions src/lib/scss/data-table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,20 @@
sz-cross-source-statistics {
.report-header {
button {
width: 24px !important;
height: 24px !important;
padding: 0px !important;

cursor: pointer;
--mat-icon-button-state-layer-color: transparent;
--mat-mdc-button-persistent-ripple-color: transparent;
--mdc-icon-button-state-layer-size: 24px;
.mat-mdc-button-touch-target,
.mdc-icon-button__ripple,
.mat-mdc-focus-indicator,
.mat-mdc-button-ripple {
display: none !important;
}
}
mat-slide-toggle {
.mdc-switch__ripple {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
<td #cellRef *ngFor="let col of this.selectableColumns | SzOrderedMapEntries"
[attr.data-row-index]="getRowIndex()"
[attr.data-cell-order]="getCellOrder(col.key, getRowIndex())"
[style]="cellStyle(col.key, getRowIndex())"
[style]="cellStyle(col.key, getRowIndex(), col.key === 'entityId' ? {'entityId': getRowSpanForEntityIdCell(row.rows)}: undefined)"
[class]="'sz-dt-cell '+cellClass(col.key, 'sz-dt','cell')+' '+cellClass(col.key, 'sz-dt','column')"
[class.hidden]="isColumnHidden(col.key)"
[cdkContextMenuTriggerFor]="sz_dt_cell_context_menu"
Expand All @@ -134,7 +134,9 @@
class="row-record">
<td #cellRef [attr.data-record-index]="recordIndex+1" *ngFor="let col of this.selectableColumns | SzOrderedMapEntries"
[attr.data-cell-order]="getCellOrder(col.key, getRowIndex())"
[class.no-cell]="col.key === 'entityId'"
[style]="cellStyle(col.key, getRowIndex())"
[class]="'sz-dt-cell '+cellClass(col.key, 'sz-dt','cell')+' '+cellClass(col.key, 'sz-dt','column')"
>
<div class="cell-content" [innerHTML]="cellValue(rowQ[col.key], col.key)" [attr.cell-key]="col.key"></div>
</td>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
:host {

* {
box-sizing: border-box;
}
Expand Down Expand Up @@ -32,6 +33,7 @@
display: grid;
border-collapse: collapse;
min-width: 100%;
column-gap: 2px;

/*grid-template-columns: minmax(100px, auto);*/

Expand Down Expand Up @@ -71,6 +73,9 @@
&.hidden {
display: none;
}
&.no-cell {
display: none;
}
}

th {
Expand Down Expand Up @@ -199,15 +204,29 @@
.sz-dt-address-data-cell .cell-content {

}
.row-entity {
td {
border-top: 1px solid #636363;
border-bottom: 1px dotted #636363;
background-color: #ececec;
}
}
.row-record:nth-child(even) td {
background-color: #f2f2f2;
}
}

/* column picker */
.column-picker-button {
position: relative;
.right {
right: 0px;
position: relative;
}
button {
float: right;
position: absolute;
right: 0px;
top: -33px;
padding: 0 5px 0 5px;
min-width: 36px;
/* line-height: 40px; */
Expand Down
167 changes: 138 additions & 29 deletions src/lib/statistics/cross-source/sz-cross-source-results.data-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,7 @@ import { SzEntityData, SzMatchedRecord } from '@senzing/rest-api-client-ng';
styleUrls: ['./sz-cross-source-results.data-table.scss']
})
export class SzCrossSourceResultsDataTable extends SzDataTable implements OnInit, OnDestroy {
private _defaultColumns = [
'Entity ID',
'More',
'Match Key',
'Data Source',
'Name Data',
'Attribute Data',
'Address Data'
];
private _allColumns = [
'Entity ID',
'More',
'ER Code',
'Match Key',
'Related Entity ID',
'Data Source',
'Record ID',
'Entity Type',
'Name Data',
'Attribute Data',
'Address Data',
'Relationship Data'
];

override _colOrder: Map<string,number> = new Map([
/*override _colOrder: Map<string,number> = new Map([
['entityId',0],
['erCode',1],
['matchKey',2],
Expand All @@ -52,8 +28,27 @@ export class SzCrossSourceResultsDataTable extends SzDataTable implements OnInit
['attributeData',7],
['addressData',8],
['relationshipData',9]
])*/
override _colOrder: Map<string,number> = new Map([
['entityId', 0],
['resolutionRuleCode', 1],
['matchKey', 2],
['relatedEntityId', 3],
['dataSource', 4],
['recordId', 5],
['entityType', 6],
['nameData', 7],
['attributeData', 8],
['identifierData', 9],
['addressData', 10],
['phoneData', 11],
['relationshipData', 12],
['entityData', 13],
['otherData', 14]
])
override _cols: Map<string,string> = new Map([


/*override _cols: Map<string,string> = new Map([
['entityId','Entity Id'],
['erCode','ER Code'],
['matchKey','Match Key'],
Expand All @@ -64,20 +59,99 @@ export class SzCrossSourceResultsDataTable extends SzDataTable implements OnInit
['attributeData','Attribute Data'],
['addressData','Address Data'],
['relationshipData','Relationship Data']
])*/
override _cols: Map<string,string> = new Map([
['entityId', 'Entity ID'],
['resolutionRuleCode', 'ER Code'],
['matchKey', 'Match Key'],
['relatedEntityId', 'Related Entity'],
['dataSource', 'Data Source'],
['recordId', 'Record ID'],
['entityType', 'Entity Type'],
['nameData', 'Name Data'],
['attributeData', 'Attribute Data'],
['identifierData', 'Identifier Data'],
['addressData', 'Address Data'],
['phoneData', 'Phone Data'],
['relationshipData', 'Relationship Data'],
['entityData', 'Entity Data'],
['otherData', 'Other Data']
])

override _selectableColumns: string[] = [
'entityId',
'erCode',
'resolutionRuleCode',
'matchKey',
'relatedEntityId',
'dataSource',
'recordId',
'entityType',
'nameData',
'attributeData',
'identifierData',
'addressData',
'relationshipData'
'phoneData',
'relationshipData',
'entityData',
'otherData'
]

private _matchLevelToColumnsMap = new Map<number, string[]>([
[1,[
'entityId',
'resolutionRuleCode',
'matchKey',
'dataSource',
'recordId',
'entityType',
'nameData',
'attributeData',
'identifierData',
'addressData',
'phoneData',
'relationshipData',
'entityData',
'otherData'
]],
[2,[
'entityId',
'resolutionRuleCode',
'matchKey',
'relatedEntityId',
'dataSource',
'recordId',
'entityType',
'nameData',
'attributeData',
'identifierData',
'addressData',
'phoneData',
'relationshipData',
'entityData',
'otherData'
]],
[3,[
'entityId',
'resolutionRuleCode',
'matchKey',
'relatedEntityId',
'dataSource',
'recordId',
'entityType',
'nameData',
'attributeData',
'identifierData',
'addressData',
'phoneData',
'relationshipData',
'entityData',
'otherData'
]]
]);

private get matchLevel() {
return this.dataMartService.sampleMatchLevel;
}

override get cellFormatters() {
return {
Expand Down Expand Up @@ -121,6 +195,11 @@ export class SzCrossSourceResultsDataTable extends SzDataTable implements OnInit
}

override ngOnInit() {
// listen for match level change(changes visible columns)
this.dataMartService.onSampleMatchLevelChange.pipe(
takeUntil(this.unsubscribe$)
).subscribe(this.onSampleMatchLevelChange.bind(this));

// listen for new sampleset data
this.dataMartService.onSampleResultChange.pipe(
takeUntil(this.unsubscribe$)
Expand Down Expand Up @@ -153,12 +232,16 @@ export class SzCrossSourceResultsDataTable extends SzDataTable implements OnInit
return this.rowCount;
}

override cellStyle(fieldName: string, rowsPreceeding): string {
override cellStyle(fieldName: string, rowsPreceeding, cellRowSpan?: {[fieldName: string]: number}): string {
let retVal = '';
let rowOrderPrefix = 0;
let rowCellOrderOffset = this.numberOfColumns * rowsPreceeding;
if(this._colOrder && this._colOrder.has(fieldName)) {
retVal += 'order: '+ (rowCellOrderOffset+this._colOrder.get(fieldName))+';';
if(cellRowSpan && cellRowSpan[fieldName] && this._colOrder.get(fieldName) === 0) {
// apply row span to cell
retVal += 'grid-row: span '+ cellRowSpan[fieldName] +';'
}
}
return retVal;
}
Expand All @@ -168,6 +251,32 @@ export class SzCrossSourceResultsDataTable extends SzDataTable implements OnInit
this.cellIndex = 0;
}

private onSampleMatchLevelChange(matchLevel: number) {
if(this._matchLevelToColumnsMap.has(matchLevel)) {
this._selectableColumns = this._matchLevelToColumnsMap.get(matchLevel);
} else {
// we still need columns sooo...
console.warn(`NO column map for MATCH LEVEL ${matchLevel}`);
this._selectableColumns = this._matchLevelToColumnsMap.get(1);
}
}

public getRowCellOrder(fieldName: string) {
let retVal = 0;
if(this._colOrder && this._colOrder.has(fieldName)) {
retVal = this._colOrder.get(fieldName);
}
return retVal;
}

public getRowSpanForEntityIdCell(rows: SzStatSampleEntityTableRow[]) {
let retVal = 0;
if(rows) {
retVal = rows.length + 1;
}
return retVal;
}

private onSampleSetDataChange(data: SzEntityData[] | undefined) {
if(data === undefined) {
this.data = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@
display: flex;
flex-direction: row;
align-items: center;
margin: 33px 0 10px 0;

mat-slide-toggle.show-all-columns {
margin-left: 20px;
}
.title {
margin: 0;
}
}

.sz-css-heading {
Expand Down

0 comments on commit e2ca63f

Please sign in to comment.