Skip to content

Commit 2c8e4df

Browse files
feat(#2609): add data-grid component
1 parent 14a6673 commit 2c8e4df

File tree

55 files changed

+1028
-244
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1028
-244
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { CUSTOM_ELEMENTS_SCHEMA, Component } from "@angular/core";
2+
3+
@Component({
4+
standalone: true,
5+
selector: "goab-data-grid",
6+
template: `
7+
<goa-data-grid>
8+
<ng-content></ng-content>
9+
</goa-data-grid>
10+
`,
11+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
12+
})
13+
export class GoabDataGrid {}

libs/angular-components/src/lib/components/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export * from "./chip/chip";
1313
export * from "./circular-progress/circular-progress";
1414
export * from "./column-layout/column-layout";
1515
export * from "./container/container";
16+
export * from "./data-grid/data-grid";
1617
export * from "./date-picker/date-picker";
1718
export * from "./details/details";
1819
export * from "./divider/divider";

libs/react-components/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export * from "./lib/checkbox/checkbox";
1212
export * from "./lib/chip/chip";
1313
export * from "./lib/circular-progress/circular-progress";
1414
export * from "./lib/container/container";
15+
export * from "./lib/data-grid/data-grid";
1516
export * from "./lib/date-picker/date-picker";
1617
export * from "./lib/details/details";
1718
export * from "./lib/divider/divider";

libs/react-components/src/lib/accordion/accordion.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export interface GoabAccordionProps extends Margins {
3636
maxWidth?: string;
3737
testId?: string;
3838
iconPosition?: GoabAccordionIconPosition;
39+
[key: `data-grid${string}`]: string | boolean | undefined;
3940
onChange?: (open: boolean) => void;
4041
children?: ReactNode;
4142
}
@@ -55,9 +56,14 @@ export function GoabAccordion({
5556
mr,
5657
mb,
5758
ml,
59+
...rest
5860
}: GoabAccordionProps): JSX.Element {
5961
const ref = useRef<HTMLElement>(null);
6062

63+
const dataGridProps = Object.fromEntries(
64+
Object.entries(rest).filter(([key]) => key.startsWith('data-grid'))
65+
);
66+
6167
useEffect(() => {
6268
const element = ref.current;
6369
if (element && onChange) {
@@ -85,6 +91,7 @@ export function GoabAccordion({
8591
mr={mr}
8692
mb={mb}
8793
ml={ml}
94+
{...dataGridProps}
8895
>
8996
{headingContent && <div slot="headingcontent">{headingContent}</div>}
9097
{children}

libs/react-components/src/lib/app-header-menu/app-header-menu.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export interface GoabAppHeaderMenuProps {
1313
leadingIcon?: GoabIconType;
1414
testId?: string;
1515
children?: ReactNode;
16+
[key: `data-grid${string}`]: string | boolean | undefined;
1617
}
1718

1819
declare module "react" {
@@ -25,13 +26,18 @@ declare module "react" {
2526
}
2627

2728
export function GoabAppHeaderMenu(props: GoabAppHeaderMenuProps) {
29+
const { heading, leadingIcon, testId, children, ...rest } = props;
30+
const dataGridProps = Object.fromEntries(
31+
Object.entries(rest).filter(([key]) => key.startsWith('data-grid'))
32+
);
2833
return (
2934
<goa-app-header-menu
30-
heading={props.heading}
31-
leadingicon={props.leadingIcon}
32-
testid={props.testId}
35+
heading={heading}
36+
leadingicon={leadingIcon}
37+
testid={testId}
38+
{...dataGridProps}
3339
>
34-
{props.children}
40+
{children}
3541
</goa-app-header-menu>
3642
);
3743
}

libs/react-components/src/lib/app-header/app-header.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export interface GoabAppHeaderProps {
2727
children?: React.ReactNode;
2828
onMenuClick?: () => void;
2929
testId?: string;
30+
[key: `data-grid${string}`]: string | boolean | undefined;
3031
}
3132

3233
export function GoabAppHeader({
@@ -37,9 +38,14 @@ export function GoabAppHeader({
3738
testId,
3839
children,
3940
onMenuClick,
41+
...rest
4042
}: GoabAppHeaderProps): JSX.Element {
4143
const el = useRef<HTMLElement>(null);
4244

45+
const dataGridProps = Object.fromEntries(
46+
Object.entries(rest).filter(([key]) => key.startsWith('data-grid'))
47+
);
48+
4349
useEffect(() => {
4450
if (!el.current) {
4551
return;
@@ -66,6 +72,7 @@ export function GoabAppHeader({
6672
maxcontentwidth={maxContentWidth}
6773
testid={testId}
6874
hasmenuclickhandler={onMenuClick ? "true" : "false"}
75+
{...dataGridProps}
6976
>
7077
{children}
7178
</goa-app-header>

libs/react-components/src/lib/badge/badge.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export interface GoabBadgeProps extends Margins {
2424
content?: string;
2525
testId?: string;
2626
ariaLabel?: string;
27+
[key: `data-grid${string}`]: string | boolean | undefined;
2728
}
2829

2930
export function GoabBadge({
@@ -36,7 +37,12 @@ export function GoabBadge({
3637
mb,
3738
ml,
3839
ariaLabel,
40+
...rest
3941
}: GoabBadgeProps): JSX.Element {
42+
const dataGridProps = Object.fromEntries(
43+
Object.entries(rest).filter(([key]) => key.startsWith('data-grid'))
44+
);
45+
4046
return (
4147
<goa-badge
4248
type={type}
@@ -48,6 +54,7 @@ export function GoabBadge({
4854
mr={mr}
4955
mb={mb}
5056
ml={ml}
57+
{...dataGridProps}
5158
/>
5259
);
5360
}

libs/react-components/src/lib/block/block.tsx

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,29 @@ export interface GoabBlockProps extends Margins {
2929
alignment?: GoabBlockAlignment;
3030
testId?: string;
3131
children?: ReactNode;
32+
[key: `data-grid${string}`]: string | boolean | undefined;
3233
}
3334

3435
export function GoabBlock(props: GoabBlockProps) {
36+
const { gap, direction, alignment, mt, mr, mb, ml, testId, children, ...rest } = props;
37+
38+
const dataGridProps = Object.fromEntries(
39+
Object.entries(rest).filter(([key]) => key.startsWith('data-grid'))
40+
);
41+
3542
return (
3643
<goa-block
37-
gap={props.gap}
38-
direction={props.direction}
39-
alignment={props.alignment}
40-
mt={props.mt}
41-
mr={props.mr}
42-
mb={props.mb}
43-
ml={props.ml}
44-
testid={props.testId}
44+
gap={gap}
45+
direction={direction}
46+
alignment={alignment}
47+
mt={mt}
48+
mr={mr}
49+
mb={mb}
50+
ml={ml}
51+
testid={testId}
52+
{...dataGridProps}
4553
>
46-
{props.children}
54+
{children}
4755
</goa-block>
4856
);
4957
}

libs/react-components/src/lib/button-group/button-group.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export interface GoabButtonGroupProps extends Margins {
2626
gap?: GoabButtonGroupGap;
2727
testId?: string;
2828
children?: React.ReactNode;
29+
[key: `data-grid${string}`]: string | boolean | undefined;
2930
}
3031

3132
export function GoabButtonGroup({
@@ -37,7 +38,12 @@ export function GoabButtonGroup({
3738
mr,
3839
mb,
3940
ml,
41+
...rest
4042
}: GoabButtonGroupProps): JSX.Element {
43+
const dataGridProps = Object.fromEntries(
44+
Object.entries(rest).filter(([key]) => key.startsWith('data-grid'))
45+
);
46+
4147
return (
4248
<goa-button-group
4349
alignment={alignment}
@@ -47,6 +53,7 @@ export function GoabButtonGroup({
4753
mb={mb}
4854
ml={ml}
4955
testid={testId}
56+
{...dataGridProps}
5057
>
5158
{children}
5259
</goa-button-group>

libs/react-components/src/lib/button/button.tsx

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -45,28 +45,35 @@ export interface GoabButtonProps extends Margins {
4545
actionArgs?: Record<string, unknown>;
4646
actionArg?: string;
4747
children?: ReactNode;
48+
[key: `data-grid${string}`]: string | boolean | undefined;
4849
}
4950

50-
export function GoabButton({
51-
disabled,
52-
type,
53-
size,
54-
variant,
55-
leadingIcon,
56-
trailingIcon,
57-
width,
58-
testId,
59-
children,
60-
onClick,
61-
mt,
62-
mr,
63-
mb,
64-
ml,
65-
action,
66-
actionArgs,
67-
actionArg,
68-
}: GoabButtonProps): JSX.Element {
51+
export function GoabButton(props: GoabButtonProps): JSX.Element {
52+
const {
53+
disabled,
54+
type,
55+
size,
56+
variant,
57+
leadingIcon,
58+
trailingIcon,
59+
width,
60+
testId,
61+
children,
62+
onClick,
63+
mt,
64+
mr,
65+
mb,
66+
ml,
67+
action,
68+
actionArgs,
69+
actionArg,
70+
...rest
71+
} = props;
72+
6973
const el = useRef<HTMLElement>(null);
74+
const dataGridProps = Object.fromEntries(
75+
Object.entries(rest).filter(([key]) => key.startsWith('data-grid'))
76+
);
7077

7178
useEffect(() => {
7279
if (!el.current) {
@@ -104,6 +111,7 @@ export function GoabButton({
104111
mr={mr}
105112
mb={mb}
106113
ml={ml}
114+
{...dataGridProps}
107115
>
108116
{children}
109117
</goa-button>

0 commit comments

Comments
 (0)