Add styling and component column type to declarative table (#8476)

* Initial wip

* wip

* Working implementation

* Make widths a bit nicer and remove sqlops addition

* Add sqlops back in

* Fix timing issue with tables

* Undo change to sql.bat and remove loading component when done
This commit is contained in:
Charles Gagnon
2019-11-27 08:06:41 -08:00
committed by GitHub
parent 0e9797c394
commit 3135b8525b
12 changed files with 648 additions and 333 deletions

View File

@@ -1368,6 +1368,46 @@ class DeclarativeTableWrapper extends ComponentWrapper implements azdata.Declara
let emitter = this._emitterMap.get(ComponentEventType.onDidChange);
return emitter && emitter.event;
}
protected notifyPropertyChanged(): Thenable<void> {
return this._proxy.$setProperties(this._handle, this._id, this.getPropertiesForMainThread());
}
public toComponentShape(): IComponentShape {
// Overridden to ensure we send the correct properties mapping.
return <IComponentShape>{
id: this.id,
type: this.type,
layout: this.layout,
properties: this.getPropertiesForMainThread(),
itemConfigs: this.itemConfigs ? this.itemConfigs.map<IItemConfig>(item => item.toIItemConfig()) : undefined
};
}
/**
* Gets the properties map to send to the main thread.
*/
private getPropertiesForMainThread(): { [key: string]: string } {
// This is necessary because we can't send the actual ComponentWrapper objects
// and so map them into their IDs instead. We don't want to update the actual
// data property though since the caller would still expect that to contain
// the Component objects they created
const properties = assign({}, this.properties);
if (properties.data) {
properties.data = properties.data.map((row: any[]) => row.map(cell => {
if (cell instanceof ComponentWrapper) {
// First ensure that we register the component using addItem
// such that it gets added to the ModelStore. We don't want to
// make the table component an actual container since that exposes
// a lot of functionality we don't need.
this.addItem(cell);
return cell.id;
}
return cell;
}));
}
return properties;
}
}
class ListBoxWrapper extends ComponentWrapper implements azdata.ListBoxComponent {