add foreign keys and constraints (#17697)

* foreign keys and constraints

* refactoring

* fix issues
This commit is contained in:
Alan Ren
2021-11-17 19:15:24 -08:00
committed by GitHub
parent 6f03cbac97
commit 7c26e14605
8 changed files with 310 additions and 75 deletions

View File

@@ -98,7 +98,7 @@ export class Designer extends Disposable implements IThemable {
});
},
optionsGetter: (item, column): string[] => {
return item[column.field].options;
return item[column.field].values;
},
editorStyler: (component) => {
this.styleComponent(component);
@@ -503,6 +503,8 @@ export class Designer extends Disposable implements IThemable {
const groupNames = [];
const componentsToCreate = !isMainView ? components.filter(component => component.showInPropertiesView !== false) : components;
componentsToCreate.forEach(component => {
// Set the default group name if not set (undefined or null).
component.group = component.group || localize('designer.generalGroupName', "General");
if (groupNames.indexOf(component.group) === -1) {
groupNames.push(component.group);
}
@@ -518,7 +520,7 @@ export class Designer extends Disposable implements IThemable {
const groupHeader = container.appendChild(DOM.$('div.full-row.group-header'));
groupHeaders.push(groupHeader);
this.styleGroupHeader(groupHeader);
groupHeader.innerText = group ?? localize('designer.generalGroupName', "General");
groupHeader.innerText = group;
componentsToCreate.forEach(component => {
if (component.group === group) {
uiComponents.push(this.createComponent(container, component, parentPath, componentMap, setWidth, isMainView));
@@ -565,7 +567,7 @@ export class Designer extends Disposable implements IThemable {
container.appendChild(DOM.$('')).appendChild(DOM.$('span.component-label')).innerText = componentDefinition.componentProperties?.title ?? '';
const dropdownContainer = container.appendChild(DOM.$(''));
const dropdownProperties = componentDefinition.componentProperties as DropDownProperties;
const dropdown = new SelectBox(dropdownProperties.values as string[], undefined, this._contextViewProvider, undefined);
const dropdown = new SelectBox(dropdownProperties.values as string[] || [], undefined, this._contextViewProvider, undefined);
dropdown.render(dropdownContainer);
dropdown.selectElem.style.height = '25px';
dropdown.onDidSelect((e) => {
@@ -579,12 +581,10 @@ export class Designer extends Disposable implements IThemable {
component = dropdown;
break;
case 'checkbox':
container.appendChild(DOM.$('')); // label container place holder
container.appendChild(DOM.$('')).appendChild(DOM.$('span.component-label')).innerText = componentDefinition.componentProperties?.title ?? '';
const checkboxContainer = container.appendChild(DOM.$(''));
const checkboxProperties = componentDefinition.componentProperties as CheckBoxProperties;
const checkbox = new Checkbox(checkboxContainer, {
label: checkboxProperties.title
});
const checkbox = new Checkbox(checkboxContainer, { label: '', ariaLabel: checkboxProperties.title });
checkbox.onChange((newValue) => {
this.handleEdit({ type: DesignerEditType.Update, path: propertyPath, value: newValue });
});
@@ -600,7 +600,7 @@ export class Designer extends Disposable implements IThemable {
container.appendChild(DOM.$('.full-row')).appendChild(DOM.$('span.component-label')).innerText = componentDefinition.componentProperties?.title ?? '';
}
const tableProperties = componentDefinition.componentProperties as DesignerTableProperties;
if (tableProperties.canAddRows !== false) {
if (tableProperties.canAddRows) {
const buttonContainer = container.appendChild(DOM.$('.full-row')).appendChild(DOM.$('.add-row-button-container'));
const addNewText = localize('designer.newRowText', "Add New");
const addRowButton = new Button(buttonContainer, {
@@ -673,7 +673,7 @@ export class Designer extends Disposable implements IThemable {
};
}
});
if (tableProperties.canRemoveRows !== false) {
if (tableProperties.canRemoveRows) {
const deleteRowColumn = new ButtonColumn({
id: 'deleteRow',
iconCssClass: Codicon.trash.classNames,

View File

@@ -49,12 +49,11 @@ export class DesignerPropertiesPane {
}
public updateDescription(definition: DesignerDataPropertyInfo) {
const title: string = definition.componentProperties.title;
const description: string = definition.description;
if (title && description) {
this._descriptionTitleContainer.innerText = title;
this._descriptionTextContainer.innerText = description;
}
this._descriptionContainer.style.display = 'block';
const title: string = definition.componentProperties.title ?? '';
const description: string = definition.description ?? '';
this._descriptionTitleContainer.innerText = title;
this._descriptionTextContainer.innerText = description;
}
public clear(): void {
@@ -89,5 +88,6 @@ export class DesignerPropertiesPane {
this._componentMap.forEach((value) => {
this._setComponentValue(value.defintion, value.component, item.viewModel);
});
this._descriptionContainer.style.display = 'none';
}
}

View File

@@ -79,7 +79,6 @@
.designer-component .add-row-button-container {
display: flex;
flex-flow: row-reverse;
}
.designer-component .add-row-button-container .codicon.add-row-button {