-
-
Notifications
You must be signed in to change notification settings - Fork 274
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix custom components for id cells (#3459)
- Loading branch information
Showing
6 changed files
with
64 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
test/integration/data-grid/fixture-custom/toolpad/application.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
apiVersion: v1 | ||
kind: application | ||
spec: {} |
31 changes: 31 additions & 0 deletions
31
test/integration/data-grid/fixture-custom/toolpad/components/Debug.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { createComponent } from '@toolpad/studio/browser'; | ||
import * as React from 'react'; | ||
|
||
export interface Props { | ||
value: any; | ||
field: any; | ||
row: any; | ||
} | ||
|
||
function Test({ value, field }: Props) { | ||
return ( | ||
<div> | ||
[{field}:{value}] | ||
</div> | ||
); | ||
} | ||
|
||
export default createComponent(Test, { | ||
argTypes: { | ||
value: { | ||
type: 'object', | ||
}, | ||
row: { | ||
type: 'object', | ||
}, | ||
field: { | ||
type: 'string', | ||
defaultValue: 'Field name', | ||
}, | ||
}, | ||
}); |
37 changes: 21 additions & 16 deletions
37
test/integration/data-grid/fixture-custom/toolpad/pages/page/page.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,26 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/mui/mui-toolpad/v0.1.54/docs/schemas/v1/definitions.json#properties/Page | ||
|
||
apiVersion: v1 | ||
kind: page | ||
spec: | ||
id: g1b3uhe | ||
title: page | ||
content: | ||
- component: PageRow | ||
name: pageRow | ||
children: | ||
- component: DataGrid | ||
name: dataGrid | ||
props: | ||
rows: | ||
$$jsExpression: | | ||
[{ hiddenField: true, customField: { test: "value" } }] | ||
columns: | ||
- type: codeComponent | ||
field: customField | ||
codeComponent: Test | ||
width: 639 | ||
density: comfortable | ||
- component: DataGrid | ||
name: dataGrid | ||
layout: | ||
columnSize: 1 | ||
props: | ||
rows: | ||
$$jsExpression: | | ||
[{ hiddenField: true, customField: { test: "value" } }] | ||
columns: | ||
- type: codeComponent | ||
field: customField | ||
codeComponent: Test | ||
width: 639 | ||
- field: id | ||
type: codeComponent | ||
codeComponent: Debug | ||
density: comfortable | ||
alias: | ||
- g1b3uhe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters