Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add data grid as a new web component #17390

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "add data grid as a new web component",
"packageName": "@fluentui/web-components",
"email": "chhol@microsoft.com",
"dependentChangeType": "patch"
}
24 changes: 24 additions & 0 deletions packages/web-components/docs/api-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ import { Checkbox } from '@microsoft/fast-foundation';
import { ColorRGBA64 } from '@microsoft/fast-colors';
import { Combobox } from '@microsoft/fast-foundation';
import { CSSCustomPropertyBehavior } from '@microsoft/fast-foundation';
import { DataGrid } from '@microsoft/fast-foundation';
import { DataGridCell } from '@microsoft/fast-foundation';
import { DataGridRow } from '@microsoft/fast-foundation';
import { DesignSystemProvider } from '@microsoft/fast-foundation';
import { Dialog } from '@microsoft/fast-foundation';
import { Direction } from '@microsoft/fast-web-utilities';
Expand Down Expand Up @@ -261,6 +264,15 @@ export const ComboboxStyles: import("@microsoft/fast-element").ElementStyles;
// @public
export function createColorPalette(baseColor: any): string[];

// @public
export const DataGridCellStyles: import("@microsoft/fast-element").ElementStyles;

// @public
export const DataGridRowStyles: import("@microsoft/fast-element").ElementStyles;

// @public
export const DataGridStyles: import("@microsoft/fast-element").ElementStyles;

// @public
export interface DesignSystem {
accentBaseColor: string;
Expand Down Expand Up @@ -473,6 +485,18 @@ export class FluentCombobox extends Combobox {
connectedCallback(): void;
}

// @public
export class FluentDataGrid extends DataGrid {
}

// @public
export class FluentDataGridCell extends DataGridCell {
}

// @public
export class FluentDataGridRow extends DataGridRow {
}

// @public
export type FluentDesignSystem = Omit<DesignSystem, 'contrast' | 'fontWeight' | 'neutralForegroundDarkIndex' | 'neutralForegroundLightIndex'>;

Expand Down
50 changes: 50 additions & 0 deletions packages/web-components/src/data-grid/data-grid-cell.styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { css } from '@microsoft/fast-element';
import { SystemColors } from '@microsoft/fast-web-utilities';
import { focusVisible, forcedColorsStylesheetBehavior } from '@microsoft/fast-foundation';
import { neutralFocusBehavior, neutralForegroundActiveBehavior, neutralForegroundRestBehavior } from '../styles';

export const DataGridCellStyles = css`
:host {
padding: calc(var(--design-unit) * 1px) calc(var(--design-unit) * 3px);
color: ${neutralForegroundRestBehavior.var};
box-sizing: border-box;
font-family: var(--body-font);
font-size: var(--type-ramp-base-font-size);
line-height: var(--type-ramp-base-line-height);
font-weight: 400;
border: transparent calc(var(--outline-width) * 1px) solid;
overflow: hidden;
white-space: nowrap;
border-radius: calc(var(--corner-radius) * 1px);
}

:host(.column-header) {
font-weight: 600;
}

:host(:${focusVisible}) {
border: ${neutralFocusBehavior.var} calc(var(--outline-width) * 1px) solid;
color: ${neutralForegroundActiveBehavior.var};
}

`.withBehaviors(
neutralFocusBehavior,
neutralForegroundActiveBehavior,
neutralForegroundRestBehavior,
forcedColorsStylesheetBehavior(
css`
:host {
forced-color-adjust: none;
border-color: transparent;
background: ${SystemColors.Field};
color: ${SystemColors.FieldText};
}

:host(:${focusVisible}) {
border-color: ${SystemColors.FieldText};
box-shadow: 0 0 0 2px inset ${SystemColors.Field};
color: ${SystemColors.FieldText};
}
`,
),
);
31 changes: 31 additions & 0 deletions packages/web-components/src/data-grid/data-grid-row.styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { css } from '@microsoft/fast-element';
import { forcedColorsStylesheetBehavior } from '@microsoft/fast-foundation';
import { neutralDividerRestBehavior, neutralFillRestBehavior } from '../styles';

export const DataGridRowStyles = css`
:host {
display: grid;
padding: 1px 0;
box-sizing: border-box;
width: 100%;
border-bottom: calc(var(--outline-width) * 1px) solid var(--neutral-divider-rest);
}
:host(.header) {
}
:host(.sticky-header) {
background: ${neutralFillRestBehavior.var};
position: sticky;
top: 0;
}
`.withBehaviors(
neutralDividerRestBehavior,
neutralFillRestBehavior,
forcedColorsStylesheetBehavior(
css`
:host {
}
`,
),
);
Loading