mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Adding aria-labels to checkbox cells in declarative table (#23204)
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
import { ColumnMetadata, ColumnMetadataArray } from '../api/models';
|
||||
import { ColumnMetadata } from '../api/models';
|
||||
import { ImportPage } from '../api/importPage';
|
||||
import * as constants from '../../common/constants';
|
||||
|
||||
@@ -83,8 +83,25 @@ export class ModifyColumnsPage extends ImportPage {
|
||||
this._form = form;
|
||||
}
|
||||
|
||||
private static convertMetadata(column: ColumnMetadata): any[] {
|
||||
return [column.columnName, column.dataType, false, column.nullable];
|
||||
private static convertMetadata(column: ColumnMetadata): azdata.DeclarativeTableCellValue[] {
|
||||
return [
|
||||
{
|
||||
value: column.columnName,
|
||||
},
|
||||
{
|
||||
value: column.dataType,
|
||||
},
|
||||
{
|
||||
value: false,
|
||||
ariaLabel: constants.primaryKeyText,
|
||||
enabled: true
|
||||
},
|
||||
{
|
||||
value: column.nullable,
|
||||
ariaLabel: constants.allowNullsText,
|
||||
enabled: true
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
async start(): Promise<boolean> {
|
||||
@@ -94,12 +111,12 @@ export class ModifyColumnsPage extends ImportPage {
|
||||
|
||||
this.table.onDataChanged((e) => {
|
||||
this.model.proseColumns = [];
|
||||
this.table.data.forEach((row) => {
|
||||
this.table.dataValues.forEach((row) => {
|
||||
this.model.proseColumns.push({
|
||||
columnName: row[0].value,
|
||||
dataType: row[1].value,
|
||||
primaryKey: row[2].value,
|
||||
nullable: row[3].value
|
||||
columnName: <string>row[0].value,
|
||||
dataType: <string>row[1].value,
|
||||
primaryKey: <boolean>row[2].value,
|
||||
nullable: <boolean>row[3].value
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -131,7 +148,7 @@ export class ModifyColumnsPage extends ImportPage {
|
||||
this.instance.changeNextButtonLabel(constants.importDataText);
|
||||
this.loading.loading = false;
|
||||
this.instance.registerNavigationValidator((info) => {
|
||||
return this.table.data && this.table.data.length > 0;
|
||||
return this.table.dataValues && this.table.dataValues.length > 0;
|
||||
});
|
||||
return true;
|
||||
}
|
||||
@@ -147,7 +164,7 @@ export class ModifyColumnsPage extends ImportPage {
|
||||
|
||||
private emptyTable() {
|
||||
this.table.updateProperties({
|
||||
data: [],
|
||||
dataValues: [],
|
||||
columns: []
|
||||
});
|
||||
}
|
||||
@@ -160,13 +177,13 @@ export class ModifyColumnsPage extends ImportPage {
|
||||
}
|
||||
|
||||
private async populateTable() {
|
||||
let data: ColumnMetadataArray[] = [];
|
||||
let data: azdata.DeclarativeTableCellValue[][] = [];
|
||||
|
||||
this.model.proseColumns.forEach((column) => {
|
||||
data.push(ModifyColumnsPage.convertMetadata(column));
|
||||
});
|
||||
|
||||
this.table.updateProperties({
|
||||
this.table.updateProperties(<azdata.DeclarativeTableProperties>{
|
||||
columns: [{
|
||||
displayName: constants.columnNameText,
|
||||
valueType: azdata.DeclarativeDataType.string,
|
||||
@@ -191,7 +208,7 @@ export class ModifyColumnsPage extends ImportPage {
|
||||
width: '100px',
|
||||
showCheckAll: true
|
||||
}],
|
||||
data: data
|
||||
dataValues: data
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user