implement the style for dropdown, inputbox and table filter (#23502)

* dropdown, inputbox, headerfilter styles

* fix missing reference

* remove unused import
This commit is contained in:
Alan Ren
2023-06-27 19:36:31 -07:00
committed by GitHub
parent f0d496d9ab
commit 4abcc20781
44 changed files with 155 additions and 559 deletions

View File

@@ -4,10 +4,12 @@
*--------------------------------------------------------------------------------------------*/
import { ICheckboxStyles } from 'sql/base/browser/ui/checkbox/checkbox';
import { IDropdownStyles } from 'sql/base/browser/ui/dropdownList/dropdownList';
import { IEditableDropdownStyles } from 'sql/base/browser/ui/editableDropdown/browser/dropdown';
import { ITableFilterStyles } from 'sql/base/browser/ui/table/plugins/headerFilter.plugin';
import * as sqlcr from 'sql/platform/theme/common/colorRegistry';
import { disabledCheckboxForeground } from 'sql/platform/theme/common/colors';
import { IButtonStyles } from 'vs/base/browser/ui/button/button';
import { IStyleOverride, overrideStyles } from 'vs/platform/theme/browser/defaultStyles';
import { IStyleOverride, defaultButtonStyles, defaultCountBadgeStyles, defaultInputBoxStyles, defaultListStyles, overrideStyles } from 'vs/platform/theme/browser/defaultStyles';
import { asCssVariable, editorBackground, inputBorder, inputForeground } from 'vs/platform/theme/common/colorRegistry';
@@ -34,6 +36,20 @@ export const defaultInfoButtonStyles: IButtonStyles = {
buttonDisabledBorder: undefined
}
export const defaultEditableDropdownStyles: IEditableDropdownStyles = {
contextBackground: asCssVariable(editorBackground),
contextBorder: asCssVariable(inputBorder),
...defaultInputBoxStyles,
...defaultListStyles
}
export const defaultTableFilterStyles: ITableFilterStyles = {
...defaultInputBoxStyles,
...defaultButtonStyles,
...defaultCountBadgeStyles,
...defaultListStyles
}
export const defaultDropdownStyles: IDropdownStyles = {
foregroundColor: asCssVariable(inputForeground),
borderColor: asCssVariable(inputBorder),

View File

@@ -8,41 +8,9 @@ import * as colors from './colors';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import * as cr from 'vs/platform/theme/common/colorRegistry';
import * as sqlcr from 'sql/platform/theme/common/colorRegistry';
import { IThemable, attachStyler, computeStyles, defaultListStyles, IColorMapping, IStyleOverrides } from 'sql/platform/theme/common/vsstyler';
import { IThemable, attachStyler, computeStyles, IStyleOverrides } from 'sql/platform/theme/common/vsstyler';
import { IDisposable } from 'vs/base/common/lifecycle';
export interface IInputBoxStyleOverrides extends IStyleOverrides {
inputBackground?: cr.ColorIdentifier,
inputForeground?: cr.ColorIdentifier,
disabledInputBackground?: cr.ColorIdentifier,
disabledInputForeground?: cr.ColorIdentifier,
inputBorder?: cr.ColorIdentifier,
inputValidationInfoBorder?: cr.ColorIdentifier,
inputValidationInfoBackground?: cr.ColorIdentifier,
inputValidationWarningBorder?: cr.ColorIdentifier,
inputValidationWarningBackground?: cr.ColorIdentifier,
inputValidationErrorBorder?: cr.ColorIdentifier,
inputValidationErrorBackground?: cr.ColorIdentifier
}
export const defaultInputBoxStyles: IInputBoxStyleOverrides = {
inputBackground: cr.inputBackground,
inputForeground: cr.inputForeground,
disabledInputBackground: colors.disabledInputBackground,
disabledInputForeground: colors.disabledInputForeground,
inputBorder: cr.inputBorder,
inputValidationInfoBorder: cr.inputValidationInfoBorder,
inputValidationInfoBackground: cr.inputValidationInfoBackground,
inputValidationWarningBorder: cr.inputValidationWarningBorder,
inputValidationWarningBackground: cr.inputValidationWarningBackground,
inputValidationErrorBorder: cr.inputValidationErrorBorder,
inputValidationErrorBackground: cr.inputValidationErrorBackground
};
export function attachInputBoxStyler(widget: IThemable, themeService: IThemeService, style?: IInputBoxStyleOverrides): IDisposable {
return attachStyler(themeService, { ...defaultInputBoxStyles, ...(style || {}) }, widget);
}
export interface ISelectBoxStyleOverrides extends IStyleOverrides {
selectBackground?: cr.ColorIdentifier,
selectListBackground?: cr.ColorIdentifier,
@@ -161,120 +129,6 @@ export function attachTableStyler(widget: IThemable, themeService: IThemeService
return attachStyler(themeService, { ...defaultTableStyles, ...(style || {}) }, widget);
}
export interface IHighPerfTableStyleOverrides extends IStyleOverrides {
listFocusBackground?: cr.ColorIdentifier,
listFocusForeground?: cr.ColorIdentifier,
listActiveSelectionBackground?: cr.ColorIdentifier,
listActiveSelectionForeground?: cr.ColorIdentifier,
listFocusAndSelectionBackground?: cr.ColorIdentifier,
listFocusAndSelectionForeground?: cr.ColorIdentifier,
listInactiveFocusBackground?: cr.ColorIdentifier,
listInactiveSelectionBackground?: cr.ColorIdentifier,
listInactiveSelectionForeground?: cr.ColorIdentifier,
listHoverBackground?: cr.ColorIdentifier,
listHoverForeground?: cr.ColorIdentifier,
listDropBackground?: cr.ColorIdentifier,
listFocusOutline?: cr.ColorIdentifier,
listInactiveFocusOutline?: cr.ColorIdentifier,
listSelectionOutline?: cr.ColorIdentifier,
listHoverOutline?: cr.ColorIdentifier,
tableHeaderBackground?: cr.ColorIdentifier,
tableHeaderForeground?: cr.ColorIdentifier,
cellOutlineColor?: cr.ColorIdentifier,
tableHeaderAndRowCountColor?: cr.ColorIdentifier
}
export const defaultHighPerfTableStyles: IColorMapping = {
listFocusBackground: cr.listFocusBackground,
listFocusForeground: cr.listFocusForeground,
listActiveSelectionBackground: cr.listActiveSelectionBackground,
listActiveSelectionForeground: cr.listActiveSelectionForeground,
listFocusAndSelectionBackground: colors.listFocusAndSelectionBackground,
listFocusAndSelectionForeground: cr.listActiveSelectionForeground,
listInactiveFocusBackground: cr.listInactiveFocusBackground,
listInactiveSelectionBackground: cr.listInactiveSelectionBackground,
listInactiveSelectionForeground: cr.listInactiveSelectionForeground,
listHoverBackground: cr.listHoverBackground,
listHoverForeground: cr.listHoverForeground,
listDropBackground: cr.listDropBackground,
listFocusOutline: cr.activeContrastBorder,
listSelectionOutline: cr.activeContrastBorder,
listHoverOutline: cr.activeContrastBorder,
tableHeaderBackground: colors.tableHeaderBackground,
tableHeaderForeground: colors.tableHeaderForeground,
cellOutlineColor: colors.tableCellOutline,
tableHeaderAndRowCountColor: colors.tableCellOutline
};
export function attachHighPerfTableStyler(widget: IThemable, themeService: IThemeService, overrides?: IHighPerfTableStyleOverrides): IDisposable {
return attachStyler(themeService, { ...defaultHighPerfTableStyles, ...(overrides || {}) }, widget);
}
export interface IEditableDropdownStyleOverrides extends IStyleOverrides {
listFocusBackground?: cr.ColorIdentifier,
listFocusForeground?: cr.ColorIdentifier,
listActiveSelectionBackground?: cr.ColorIdentifier,
listActiveSelectionForeground?: cr.ColorIdentifier,
listFocusAndSelectionBackground?: cr.ColorIdentifier,
listFocusAndSelectionForeground?: cr.ColorIdentifier,
listInactiveFocusBackground?: cr.ColorIdentifier,
listInactiveSelectionBackground?: cr.ColorIdentifier,
listInactiveSelectionForeground?: cr.ColorIdentifier,
listHoverBackground?: cr.ColorIdentifier,
listHoverForeground?: cr.ColorIdentifier,
listDropBackground?: cr.ColorIdentifier,
listFocusOutline?: cr.ColorIdentifier,
listInactiveFocusOutline?: cr.ColorIdentifier,
listSelectionOutline?: cr.ColorIdentifier,
listHoverOutline?: cr.ColorIdentifier,
inputBackground?: cr.ColorIdentifier,
inputForeground?: cr.ColorIdentifier,
inputBorder?: cr.ColorIdentifier,
inputValidationInfoBorder?: cr.ColorIdentifier,
inputValidationInfoBackground?: cr.ColorIdentifier,
inputValidationWarningBorder?: cr.ColorIdentifier,
inputValidationWarningBackground?: cr.ColorIdentifier,
inputValidationErrorBorder?: cr.ColorIdentifier,
inputValidationErrorBackground?: cr.ColorIdentifier,
contextBackground?: cr.ColorIdentifier,
contextBorder?: cr.ColorIdentifier
}
export const defaultEditableDropdownStyle: IEditableDropdownStyleOverrides = {
listFocusBackground: cr.listFocusBackground,
listFocusForeground: cr.listFocusForeground,
listActiveSelectionBackground: cr.listActiveSelectionBackground,
listActiveSelectionForeground: cr.listActiveSelectionForeground,
listFocusAndSelectionBackground: cr.listActiveSelectionBackground,
listFocusAndSelectionForeground: cr.listActiveSelectionForeground,
listInactiveFocusBackground: cr.listInactiveFocusBackground,
listInactiveSelectionBackground: cr.listInactiveSelectionBackground,
listInactiveSelectionForeground: cr.listInactiveSelectionForeground,
listHoverBackground: cr.listHoverBackground,
listHoverForeground: cr.listHoverForeground,
listDropBackground: cr.listDropBackground,
listFocusOutline: cr.activeContrastBorder,
listSelectionOutline: cr.activeContrastBorder,
listHoverOutline: cr.activeContrastBorder,
listInactiveFocusOutline: cr.listInactiveFocusOutline,
inputBackground: cr.inputBackground,
inputForeground: cr.inputForeground,
inputBorder: cr.inputBorder,
inputValidationInfoBorder: cr.inputValidationInfoBorder,
inputValidationInfoBackground: cr.inputValidationInfoBackground,
inputValidationWarningBorder: cr.inputValidationWarningBorder,
inputValidationWarningBackground: cr.inputValidationWarningBackground,
inputValidationErrorBorder: cr.inputValidationErrorBorder,
inputValidationErrorBackground: cr.inputValidationErrorBackground,
contextBackground: cr.editorBackground,
contextBorder: cr.inputBorder
};
export function attachEditableDropdownStyler(widget: IThemable, themeService: IThemeService, style?: IEditableDropdownStyleOverrides): IDisposable {
return attachStyler(themeService, { ...defaultEditableDropdownStyle, ...(style || {}) }, widget);
}
export interface IInfoBoxStyleOverrides {
informationBackground: cr.ColorIdentifier,
warningBackground: cr.ColorIdentifier,
@@ -300,39 +154,14 @@ export interface IInfoButtonStyleOverrides {
buttonHoverBackground: cr.ColorIdentifier
}
export function attachTableFilterStyler(widget: IThemable, themeService: IThemeService): IDisposable {
return attachStyler(themeService, {
...defaultInputBoxStyles,
buttonForeground: cr.buttonForeground,
buttonBackground: cr.buttonBackground,
buttonHoverBackground: cr.buttonHoverBackground,
buttonSecondaryForeground: cr.buttonSecondaryForeground,
buttonSecondaryBackground: cr.buttonSecondaryBackground,
buttonSecondaryHoverBackground: cr.buttonSecondaryHoverBackground,
buttonBorder: cr.buttonBorder,
buttonSecondaryBorder: cr.buttonSecondaryBorder,
buttonDisabledBorder: cr.buttonDisabledBorder,
buttonDisabledBackground: cr.buttonDisabledBackground,
buttonDisabledForeground: cr.buttonDisabledForeground,
badgeBackground: cr.badgeBackground,
badgeForeground: cr.badgeForeground,
badgeBorder: cr.contrastBorder,
...defaultListStyles,
}, widget);
}
export function attachDesignerStyler(widget: any, themeService: IThemeService): IDisposable {
function applyStyles(): void {
const colorTheme = themeService.getColorTheme();
const inputStyles = computeStyles(colorTheme, defaultInputBoxStyles);
const selectBoxStyles = computeStyles(colorTheme, defaultSelectBoxStyles);
const tableStyles = computeStyles(colorTheme, defaultTableStyles);
const editableDropdownStyles = computeStyles(colorTheme, defaultEditableDropdownStyle);
widget.style({
inputBoxStyles: inputStyles,
selectBoxStyles: selectBoxStyles,
tableStyles: tableStyles,
dropdownStyles: editableDropdownStyles,
paneSeparator: cr.resolveColorValue(sqlcr.DesignerPaneSeparator, colorTheme),
groupHeaderBackground: cr.resolveColorValue(sqlcr.GroupHeaderBackground, colorTheme)
});

View File

@@ -5,7 +5,7 @@
import { Color } from 'vs/base/common/color';
import { IDisposable } from 'vs/base/common/lifecycle';
import { activeContrastBorder, badgeBackground, badgeForeground, breadcrumbsActiveSelectionForeground, breadcrumbsBackground, breadcrumbsFocusForeground, breadcrumbsForeground, buttonBackground, buttonBorder, buttonForeground, buttonHoverBackground, buttonSecondaryBackground, buttonSecondaryForeground, buttonSecondaryHoverBackground, ColorIdentifier, ColorTransform, ColorValue, contrastBorder, editorWidgetBackground, editorWidgetBorder, editorWidgetForeground, focusBorder, inputActiveOptionBackground, inputActiveOptionBorder, inputActiveOptionForeground, inputBackground, inputBorder, inputForeground, inputValidationErrorBackground, inputValidationErrorBorder, inputValidationErrorForeground, inputValidationInfoBackground, inputValidationInfoBorder, inputValidationInfoForeground, inputValidationWarningBackground, inputValidationWarningBorder, inputValidationWarningForeground, keybindingLabelBackground, keybindingLabelBorder, keybindingLabelBottomBorder, keybindingLabelForeground, listActiveSelectionBackground, listActiveSelectionForeground, listActiveSelectionIconForeground, listDropBackground, listFilterWidgetBackground, listFilterWidgetNoMatchesOutline, listFilterWidgetOutline, listFocusBackground, listFocusForeground, listFocusOutline, listHoverBackground, listHoverForeground, listInactiveFocusBackground, listInactiveFocusOutline, listInactiveSelectionBackground, listInactiveSelectionForeground, listInactiveSelectionIconForeground, menuBackground, menuBorder, menuForeground, menuSelectionBackground, menuSelectionBorder, menuSelectionForeground, menuSeparatorBackground, pickerGroupForeground, problemsErrorIconForeground, problemsInfoIconForeground, problemsWarningIconForeground, progressBarBackground, quickInputListFocusBackground, quickInputListFocusForeground, quickInputListFocusIconForeground, resolveColorValue, scrollbarShadow, scrollbarSliderActiveBackground, scrollbarSliderBackground, scrollbarSliderHoverBackground, selectBackground, selectBorder, selectForeground, selectListBackground, checkboxBackground, checkboxBorder, checkboxForeground, tableColumnsBorder, tableOddRowsBackgroundColor, textLinkForeground, treeIndentGuidesStroke, widgetShadow, listFocusAndSelectionOutline, listFilterWidgetShadow, buttonSeparator } from 'vs/platform/theme/common/colorRegistry'; // {{SQL CARBON EDIT}} Added buttonSecondaryBorder, buttonDisabledBorder, buttonDisabledBackground, buttonDisabledForeground to import list
import { activeContrastBorder, breadcrumbsActiveSelectionForeground, breadcrumbsBackground, breadcrumbsFocusForeground, breadcrumbsForeground, buttonBackground, buttonBorder, buttonForeground, buttonHoverBackground, buttonSecondaryBackground, buttonSecondaryForeground, buttonSecondaryHoverBackground, ColorIdentifier, ColorTransform, ColorValue, contrastBorder, editorWidgetBackground, editorWidgetBorder, editorWidgetForeground, focusBorder, inputActiveOptionBackground, inputActiveOptionBorder, inputActiveOptionForeground, inputBackground, inputBorder, inputForeground, inputValidationErrorBackground, inputValidationErrorBorder, inputValidationErrorForeground, inputValidationInfoBackground, inputValidationInfoBorder, inputValidationInfoForeground, inputValidationWarningBackground, inputValidationWarningBorder, inputValidationWarningForeground, keybindingLabelBackground, keybindingLabelBorder, keybindingLabelBottomBorder, keybindingLabelForeground, listActiveSelectionBackground, listActiveSelectionForeground, listActiveSelectionIconForeground, listDropBackground, listFilterWidgetBackground, listFilterWidgetNoMatchesOutline, listFilterWidgetOutline, listFocusBackground, listFocusForeground, listFocusOutline, listHoverBackground, listHoverForeground, listInactiveFocusBackground, listInactiveFocusOutline, listInactiveSelectionBackground, listInactiveSelectionForeground, listInactiveSelectionIconForeground, menuBackground, menuBorder, menuForeground, menuSelectionBackground, menuSelectionBorder, menuSelectionForeground, menuSeparatorBackground, pickerGroupForeground, problemsErrorIconForeground, problemsInfoIconForeground, problemsWarningIconForeground, progressBarBackground, quickInputListFocusBackground, quickInputListFocusForeground, quickInputListFocusIconForeground, resolveColorValue, scrollbarShadow, scrollbarSliderActiveBackground, scrollbarSliderBackground, scrollbarSliderHoverBackground, selectBackground, selectBorder, selectForeground, selectListBackground, checkboxBackground, checkboxBorder, checkboxForeground, tableColumnsBorder, tableOddRowsBackgroundColor, textLinkForeground, treeIndentGuidesStroke, widgetShadow, listFocusAndSelectionOutline, listFilterWidgetShadow, buttonSeparator } from 'vs/platform/theme/common/colorRegistry'; // {{SQL CARBON EDIT}} Added buttonSecondaryBorder, buttonDisabledBorder, buttonDisabledBackground, buttonDisabledForeground to import list
import { isHighContrast } from 'vs/platform/theme/common/theme';
import { IColorTheme, IThemeService } from 'vs/platform/theme/common/themeService';
@@ -60,54 +60,6 @@ export function attachStyler<T extends IColorMapping>(themeService: IThemeServic
return themeService.onDidColorThemeChange(applyStyles);
}
export interface IBadgeStyleOverrides extends IStyleOverrides {
badgeBackground?: ColorIdentifier;
badgeForeground?: ColorIdentifier;
}
export function attachBadgeStyler(widget: IThemable, themeService: IThemeService, style?: IBadgeStyleOverrides): IDisposable {
return attachStyler(themeService, {
badgeBackground: style?.badgeBackground || badgeBackground,
badgeForeground: style?.badgeForeground || badgeForeground,
badgeBorder: contrastBorder
} as IBadgeStyleOverrides, widget);
}
export interface IInputBoxStyleOverrides extends IStyleOverrides {
inputBackground?: ColorIdentifier;
inputForeground?: ColorIdentifier;
inputBorder?: ColorIdentifier;
inputActiveOptionBorder?: ColorIdentifier;
inputActiveOptionForeground?: ColorIdentifier;
inputActiveOptionBackground?: ColorIdentifier;
inputValidationInfoBorder?: ColorIdentifier;
inputValidationInfoBackground?: ColorIdentifier;
inputValidationInfoForeground?: ColorIdentifier;
inputValidationWarningBorder?: ColorIdentifier;
inputValidationWarningBackground?: ColorIdentifier;
inputValidationWarningForeground?: ColorIdentifier;
inputValidationErrorBorder?: ColorIdentifier;
inputValidationErrorBackground?: ColorIdentifier;
inputValidationErrorForeground?: ColorIdentifier;
}
export function attachInputBoxStyler(widget: IThemable, themeService: IThemeService, style?: IInputBoxStyleOverrides): IDisposable {
return attachStyler(themeService, {
inputBackground: style?.inputBackground || inputBackground,
inputForeground: style?.inputForeground || inputForeground,
inputBorder: style?.inputBorder || inputBorder,
inputValidationInfoBorder: style?.inputValidationInfoBorder || inputValidationInfoBorder,
inputValidationInfoBackground: style?.inputValidationInfoBackground || inputValidationInfoBackground,
inputValidationInfoForeground: style?.inputValidationInfoForeground || inputValidationInfoForeground,
inputValidationWarningBorder: style?.inputValidationWarningBorder || inputValidationWarningBorder,
inputValidationWarningBackground: style?.inputValidationWarningBackground || inputValidationWarningBackground,
inputValidationWarningForeground: style?.inputValidationWarningForeground || inputValidationWarningForeground,
inputValidationErrorBorder: style?.inputValidationErrorBorder || inputValidationErrorBorder,
inputValidationErrorBackground: style?.inputValidationErrorBackground || inputValidationErrorBackground,
inputValidationErrorForeground: style?.inputValidationErrorForeground || inputValidationErrorForeground
} as IInputBoxStyleOverrides, widget);
}
export interface ISelectBoxStyleOverrides extends IStyleOverrides, IListStyleOverrides {
selectBackground?: ColorIdentifier;
selectListBackground?: ColorIdentifier;
@@ -136,26 +88,6 @@ export function attachSelectBoxStyler(widget: IThemable, themeService: IThemeSer
} as ISelectBoxStyleOverrides, widget);
}
export function attachFindReplaceInputBoxStyler(widget: IThemable, themeService: IThemeService, style?: IInputBoxStyleOverrides): IDisposable {
return attachStyler(themeService, {
inputBackground: style?.inputBackground || inputBackground,
inputForeground: style?.inputForeground || inputForeground,
inputBorder: style?.inputBorder || inputBorder,
inputActiveOptionBorder: style?.inputActiveOptionBorder || inputActiveOptionBorder,
inputActiveOptionForeground: style?.inputActiveOptionForeground || inputActiveOptionForeground,
inputActiveOptionBackground: style?.inputActiveOptionBackground || inputActiveOptionBackground,
inputValidationInfoBorder: style?.inputValidationInfoBorder || inputValidationInfoBorder,
inputValidationInfoBackground: style?.inputValidationInfoBackground || inputValidationInfoBackground,
inputValidationInfoForeground: style?.inputValidationInfoForeground || inputValidationInfoForeground,
inputValidationWarningBorder: style?.inputValidationWarningBorder || inputValidationWarningBorder,
inputValidationWarningBackground: style?.inputValidationWarningBackground || inputValidationWarningBackground,
inputValidationWarningForeground: style?.inputValidationWarningForeground || inputValidationWarningForeground,
inputValidationErrorBorder: style?.inputValidationErrorBorder || inputValidationErrorBorder,
inputValidationErrorBackground: style?.inputValidationErrorBackground || inputValidationErrorBackground,
inputValidationErrorForeground: style?.inputValidationErrorForeground || inputValidationErrorForeground
} as IInputBoxStyleOverrides, widget);
}
export interface IListStyleOverrides extends IStyleOverrides {
listBackground?: ColorIdentifier;
listFocusBackground?: ColorIdentifier;