mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-19 01:25:36 -05:00
Change tables to make them work for our scenario (#12193)
* Change tables to make them work for our scenario * Comments & deprecate API * Disable selections by default
This commit is contained in:
@@ -1,26 +1,45 @@
|
||||
<table role=grid #container *ngIf="columns" class="declarative-table" [style.height]="getHeight()" [style.width]="getWidth()" [attr.aria-label]="ariaLabel">
|
||||
<table role=grid #container *ngIf="columns" class="declarative-table" [style.height]="getHeight()"
|
||||
[style.width]="getWidth()" [attr.aria-label]="ariaLabel">
|
||||
<thead>
|
||||
<ng-container *ngFor="let column of columns; let c = index;">
|
||||
<th class="declarative-table-header" aria-sort="none" [style.width]="getColumnWidth(column)" [attr.aria-label]="column.ariaLabel" [ngStyle]="column.headerCssStyles" role="columnheader">
|
||||
{{column.displayName}}
|
||||
<checkbox *ngIf="isCheckBox(c)" [checked]="isHeaderChecked(c)" (onChange)="onHeaderCheckBoxChanged($event,c)" label="" ></checkbox>
|
||||
</th>
|
||||
<th class="declarative-table-header" aria-sort="none" [style.width]="getColumnWidth(column)"
|
||||
[attr.aria-label]="column.ariaLabel" [ngStyle]="column.headerCssStyles" role="columnheader">
|
||||
{{column.displayName}}
|
||||
<checkbox *ngIf="isCheckBox(c)" [checked]="isHeaderChecked(c)"
|
||||
(onChange)="onHeaderCheckBoxChanged($event,c)" label=""></checkbox>
|
||||
</th>
|
||||
</ng-container>
|
||||
</thead>
|
||||
<ng-container *ngIf="data">
|
||||
<ng-container *ngFor="let row of data;let r = index;">
|
||||
<tr class="declarative-table-row">
|
||||
<ng-container *ngFor="let cellData of row;let c = index;trackBy:trackByFnCols">
|
||||
<td class="declarative-table-cell" [style.width]="getColumnWidth(c)" [attr.aria-label]="getAriaLabel(r, c)" [ngStyle]="columns[c].rowCssStyles">
|
||||
<checkbox *ngIf="isCheckBox(c)" label="" (onChange)="onCheckBoxChanged($event,r,c)" [enabled]="isControlEnabled(c)" [checked]="isChecked(r,c)"></checkbox>
|
||||
<select-box *ngIf="isSelectBox(c)" [options]="getOptions(c)" (onDidSelect)="onSelectBoxChanged($event,r,c)" [selectedOption]="getSelectedOptionDisplayName(r,c)"></select-box>
|
||||
<editable-select-box *ngIf="isEditableSelectBox(c)" [options]="getOptions(c)" (onDidSelect)="onSelectBoxChanged($event,r,c)" [selectedOption]="getSelectedOptionDisplayName(r,c)"></editable-select-box>
|
||||
<input-box *ngIf="isInputBox(c)" [value]="cellData" (onDidChange)="onInputBoxChanged($event,r,c)"></input-box>
|
||||
<ng-container *ngIf="isLabel(c)" >{{cellData}}</ng-container>
|
||||
<model-component-wrapper *ngIf="isComponent(c) && getItemDescriptor(cellData)" [descriptor]="getItemDescriptor(cellData)" [modelStore]="modelStore"></model-component-wrapper>
|
||||
</td>
|
||||
</ng-container>
|
||||
</tr>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="data.length > 0">
|
||||
<ng-container *ngFor="let row of data;let r = index;">
|
||||
<tr class="declarative-table-row" [class.selected]="isRowSelected(r)">
|
||||
<ng-container *ngFor="let cellData of row;let c = index;trackBy:trackByFnCols">
|
||||
<td class="declarative-table-cell" [style.width]="getColumnWidth(c)"
|
||||
[attr.aria-label]="getAriaLabel(r, c)"
|
||||
[ngStyle]="mergeCss(columns[c].rowCssStyles, cellData.style)">
|
||||
<checkbox *ngIf="isCheckBox(c)" label="" (onChange)="onCheckBoxChanged($event,r,c)"
|
||||
[enabled]="isControlEnabled(c)" [checked]="isChecked(r,c)"
|
||||
[ngStyle]="mergeCss(columns[c].rowCssStyles, cellData.style)">
|
||||
</checkbox>
|
||||
<select-box *ngIf="isSelectBox(c)" [options]="getOptions(c)"
|
||||
(onDidSelect)="onSelectBoxChanged($event,r,c)"
|
||||
[selectedOption]="getSelectedOptionDisplayName(r,c)">
|
||||
</select-box>
|
||||
<editable-select-box *ngIf="isEditableSelectBox(c)" [options]="getOptions(c)"
|
||||
(onDidSelect)="onSelectBoxChanged($event,r,c)"
|
||||
[selectedOption]="getSelectedOptionDisplayName(r,c)">
|
||||
</editable-select-box>
|
||||
<input-box *ngIf="isInputBox(c)" [value]="cellData.value"
|
||||
(onDidChange)="onInputBoxChanged($event,r,c)"></input-box>
|
||||
<span *ngIf="isLabel(c)" (click)="onCellClick(r)">
|
||||
{{cellData.value}}
|
||||
</span>
|
||||
<model-component-wrapper *ngIf="isComponent(c) && getItemDescriptor(cellData)"
|
||||
[descriptor]="getItemDescriptor(cellData)" [modelStore]="modelStore">
|
||||
</model-component-wrapper>
|
||||
</td>
|
||||
</ng-container>
|
||||
</tr>
|
||||
</ng-container>
|
||||
</table>
|
||||
</ng-container>
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user