add column properties (#17574)

This commit is contained in:
Alan Ren
2021-11-02 18:50:44 -07:00
committed by GitHub
parent 312b410fff
commit a3a91fbdfc
4 changed files with 43 additions and 11 deletions

View File

@@ -1098,7 +1098,9 @@ declare module 'azdata' {
Length = 'length', Length = 'length',
Name = 'name', Name = 'name',
Type = 'type', Type = 'type',
IsPrimaryKey = 'isPrimaryKey' IsPrimaryKey = 'isPrimaryKey',
Precision = 'precision',
Scale = 'scale'
} }
/** /**
@@ -1117,6 +1119,10 @@ declare module 'azdata' {
* Additional tabs. * Additional tabs.
*/ */
additionalTabs?: DesignerTab[]; additionalTabs?: DesignerTab[];
/**
* The properties to be displayed in the columns table. Default values are: Name, Type, Length, Precision, Scale, IsPrimaryKey, AllowNulls, DefaultValue.
*/
columnsTableProperties?: string[];
} }
/** /**
@@ -1148,6 +1154,11 @@ declare module 'azdata' {
* The property name * The property name
*/ */
propertyName: string; propertyName: string;
/**
* The description of the property
*/
description?: string;
/** /**
* The component type * The component type
*/ */

View File

@@ -110,6 +110,7 @@ export interface DesignerViewModel {
export interface DesignerDataPropertyInfo { export interface DesignerDataPropertyInfo {
propertyName: string; propertyName: string;
description?: string;
componentType: DesignerComponentTypeName; componentType: DesignerComponentTypeName;
group?: string; group?: string;
componentProperties?: InputBoxProperties | CheckBoxProperties | DropDownProperties | DesignerTableProperties; componentProperties?: InputBoxProperties | CheckBoxProperties | DropDownProperties | DesignerTableProperties;

View File

@@ -922,7 +922,9 @@ export namespace designers {
AllowNulls = 'allowNulls', AllowNulls = 'allowNulls',
DefaultValue = 'defaultValue', DefaultValue = 'defaultValue',
Length = 'length', Length = 'length',
IsPrimaryKey = 'isPrimaryKey' IsPrimaryKey = 'isPrimaryKey',
Precision = 'precision',
Scale = 'scale'
} }
export enum DesignerEditType { export enum DesignerEditType {

View File

@@ -190,7 +190,7 @@ export class TableDesignerComponentInput implements DesignerComponentInput {
propertyName: designers.TableColumnProperty.Length, propertyName: designers.TableColumnProperty.Length,
componentProperties: { componentProperties: {
title: localize('tableDesigner.columnLengthTitle', "Length"), title: localize('tableDesigner.columnLengthTitle', "Length"),
width: 75 width: 60
} }
}, { }, {
componentType: 'input', componentType: 'input',
@@ -211,6 +211,20 @@ export class TableDesignerComponentInput implements DesignerComponentInput {
componentProperties: { componentProperties: {
title: localize('tableDesigner.columnIsPrimaryKeyTitle', "Primary Key"), title: localize('tableDesigner.columnIsPrimaryKeyTitle', "Primary Key"),
} }
}, {
componentType: 'input',
propertyName: designers.TableColumnProperty.Precision,
componentProperties: {
title: localize('tableDesigner.columnPrecisionTitle', "Precision"),
width: 60
}
}, {
componentType: 'input',
propertyName: designers.TableColumnProperty.Scale,
componentProperties: {
title: localize('tableDesigner.columnScaleTitle', "Scale"),
width: 60
}
} }
]; ];
@@ -218,6 +232,17 @@ export class TableDesignerComponentInput implements DesignerComponentInput {
columnProperties.push(...designerInfo.view.additionalTableColumnProperties); columnProperties.push(...designerInfo.view.additionalTableColumnProperties);
} }
const columnsTableProperties = designerInfo.view.columnsTableProperties || [
designers.TableColumnProperty.Name,
designers.TableColumnProperty.Type,
designers.TableColumnProperty.Length,
designers.TableColumnProperty.Precision,
designers.TableColumnProperty.Scale,
designers.TableColumnProperty.IsPrimaryKey,
designers.TableColumnProperty.AllowNulls,
designers.TableColumnProperty.DefaultValue,
];
const columnsTab = <DesignerTab>{ const columnsTab = <DesignerTab>{
title: localize('tableDesigner.columnsTabTitle', "Columns"), title: localize('tableDesigner.columnsTabTitle', "Columns"),
components: [ components: [
@@ -226,14 +251,7 @@ export class TableDesignerComponentInput implements DesignerComponentInput {
propertyName: designers.TableProperty.Columns, propertyName: designers.TableProperty.Columns,
componentProperties: <DesignerTableProperties>{ componentProperties: <DesignerTableProperties>{
ariaLabel: localize('tableDesigner.columnsTabTitle', "Columns"), ariaLabel: localize('tableDesigner.columnsTabTitle', "Columns"),
columns: [ columns: columnsTableProperties,
designers.TableColumnProperty.Name,
designers.TableColumnProperty.Type,
designers.TableColumnProperty.Length,
designers.TableColumnProperty.DefaultValue,
designers.TableColumnProperty.AllowNulls,
designers.TableColumnProperty.IsPrimaryKey
],
itemProperties: columnProperties, itemProperties: columnProperties,
objectTypeDisplayName: localize('tableDesigner.columnTypeName', "Column") objectTypeDisplayName: localize('tableDesigner.columnTypeName', "Column")
} }