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

[core] Initial DataGrid component #3558

Merged
merged 126 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
eaad9f3
Fix dedupe check
Janpot Mar 26, 2024
d36dad1
Merge remote-tracking branch 'upstream/master'
Janpot Mar 26, 2024
413c7bf
Merge remote-tracking branch 'upstream/master'
Janpot Mar 28, 2024
9268da2
Merge remote-tracking branch 'upstream/master'
Janpot Mar 28, 2024
a755a3d
Merge remote-tracking branch 'upstream/master'
Janpot Mar 28, 2024
efbc979
Merge remote-tracking branch 'upstream/master'
Janpot Apr 4, 2024
9676ffd
Merge remote-tracking branch 'upstream/master'
Janpot Apr 5, 2024
703d127
Merge remote-tracking branch 'upstream/master'
Janpot Apr 7, 2024
1dc5912
Merge remote-tracking branch 'upstream/master'
Janpot Apr 8, 2024
34cc01f
Merge remote-tracking branch 'upstream/master'
Janpot Apr 9, 2024
3c1e6e8
Merge remote-tracking branch 'upstream/master'
Janpot Apr 11, 2024
c86f22b
Merge remote-tracking branch 'upstream/master'
Janpot Apr 15, 2024
d3399a1
Merge remote-tracking branch 'upstream/master'
Janpot Apr 15, 2024
9c901cd
Merge remote-tracking branch 'upstream/master'
Janpot Apr 17, 2024
701b6a7
Merge remote-tracking branch 'upstream/master'
Janpot Apr 17, 2024
718ae37
Merge remote-tracking branch 'upstream/master'
Janpot Apr 18, 2024
52af240
Merge remote-tracking branch 'upstream/master'
Janpot Apr 21, 2024
0d4ed0c
Merge remote-tracking branch 'upstream/master'
Janpot Apr 24, 2024
24e57a7
Merge remote-tracking branch 'upstream/master'
Janpot Apr 26, 2024
169871c
Merge remote-tracking branch 'upstream/master'
Janpot Apr 30, 2024
5f05493
Merge remote-tracking branch 'upstream/master'
Janpot May 2, 2024
50c781a
Merge remote-tracking branch 'upstream/master'
Janpot May 2, 2024
2c067b0
Merge remote-tracking branch 'upstream/master'
Janpot May 3, 2024
d057f7e
Merge remote-tracking branch 'upstream/master'
Janpot May 6, 2024
f839a69
Merge remote-tracking branch 'upstream/master'
Janpot May 7, 2024
e425fae
Merge remote-tracking branch 'upstream/master'
Janpot May 9, 2024
0722ee1
Merge remote-tracking branch 'upstream/master'
Janpot May 13, 2024
7afd082
Merge remote-tracking branch 'upstream/master'
Janpot May 14, 2024
dfeb968
Merge remote-tracking branch 'upstream/master'
Janpot May 15, 2024
fd2f5a6
initial commit
Janpot May 15, 2024
d2b3373
wip docs start
Janpot May 16, 2024
0ff6776
dialogs
Janpot May 16, 2024
6dc1953
dfwerf
Janpot May 16, 2024
c803a60
Update collections.ts
Janpot May 16, 2024
da1c968
fix type checking
Janpot May 16, 2024
d4b1224
frete
Janpot May 16, 2024
e5aaedd
dwfwe
Janpot May 16, 2024
bc326f0
Update collections.ts
Janpot May 16, 2024
2496e10
Merge remote-tracking branch 'upstream/master' into datagrid
Janpot May 16, 2024
5a752ac
Delete coreTypeScriptProjects.js
Janpot May 16, 2024
8d6577c
dwefrf
Janpot May 16, 2024
40c558b
Merge remote-tracking branch 'upstream/master' into datagrid
Janpot May 16, 2024
55f33ed
dew
Janpot May 17, 2024
efa4459
def
Janpot May 17, 2024
b1eefb0
notifications
Janpot May 17, 2024
4a481bc
Update react.tsx
Janpot May 17, 2024
79925d0
Update react.tsx
Janpot May 17, 2024
9e6c669
dfwf
Janpot May 17, 2024
9608fa1
close notification
Janpot May 17, 2024
bf85007
Update DataGrid.tsx
Janpot May 17, 2024
6fc7887
preview
Janpot May 17, 2024
7fc764f
yep
Janpot May 17, 2024
0ca6403
demo
Janpot May 17, 2024
8e3fde5
keep original
Janpot May 17, 2024
c327f3f
better preview
Janpot May 17, 2024
17e982a
first grid demo
Janpot May 17, 2024
93c7cbb
Merge remote-tracking branch 'upstream/master'
Janpot May 21, 2024
e1e5af8
Merge remote-tracking branch 'upstream/master' into datagrid
Janpot May 21, 2024
44db041
Update README.md
Janpot May 21, 2024
a377864
fregre
Janpot May 21, 2024
9fa4004
dewf
Janpot May 21, 2024
18de559
Update _app.js
Janpot May 21, 2024
4ecf2ea
Update _app.js
Janpot May 21, 2024
98fb67c
Update _app.js
Janpot May 21, 2024
e51554a
Update _app.js
Janpot May 21, 2024
534bafb
Update _app.js
Janpot May 21, 2024
810ee96
Update _app.js
Janpot May 21, 2024
06e93a0
Update package.json
Janpot May 21, 2024
1d66662
Update package.json
Janpot May 21, 2024
9145b94
Update pnpm-lock.yaml
Janpot May 21, 2024
3d0ed32
dwef
Janpot May 21, 2024
b68008d
Update DataProvider.tsx
Janpot May 21, 2024
806d732
dewrw
Janpot May 21, 2024
08b7cd5
Merge branch 'master' into datagrid
Janpot May 22, 2024
457c844
Merge remote-tracking branch 'upstream/master' into datagrid
Janpot May 22, 2024
2974056
Update dashboard-layout.js
Janpot May 22, 2024
03fef90
Delete data-provider.js
Janpot May 22, 2024
342fe2c
Update coreTypescriptProjects.js
Janpot May 22, 2024
dd0ee0e
dwekj
Janpot May 22, 2024
86d5cef
Update InferrencingAlert.tsx
Janpot May 22, 2024
25634b9
Merge branch 'master' into datagrid
Janpot May 22, 2024
6540fe2
dew
Janpot May 22, 2024
664bfa4
dialogs
Janpot May 22, 2024
5c92557
notifs
Janpot May 22, 2024
5bdfa26
dewrfw
Janpot May 22, 2024
741de3c
freg
Janpot May 23, 2024
41a5c59
Merge remote-tracking branch 'upstream/master' into datagrid
Janpot May 23, 2024
5db5f22
API
Janpot May 23, 2024
7b25099
API pages
Janpot May 23, 2024
fdc61fd
Test outline
Janpot May 23, 2024
aec4072
dfwef
Janpot May 23, 2024
390138c
Update DataGrid.tsx
Janpot May 23, 2024
b98cad1
werfrw
Janpot May 23, 2024
0d211c8
dewr
Janpot May 23, 2024
bea8bde
Update DashboardLayout.tsx
Janpot May 23, 2024
0af2eb9
fwref
Janpot May 23, 2024
34b6da4
dfwefwref
Janpot May 23, 2024
e179a19
Update InferrencingAlert.tsx
Janpot May 23, 2024
57bcefb
sh
Janpot May 23, 2024
f6a9e85
CRUD
Janpot May 23, 2024
e08937c
go
Janpot May 23, 2024
79f3480
writing
Janpot May 23, 2024
6be4eba
remove dialog provider from demos
Janpot May 23, 2024
0d3a286
notifications
Janpot May 24, 2024
6a4492f
remove cache provider
Janpot May 24, 2024
7311155
add comment
Janpot May 24, 2024
2a7b050
Update DataProvider.tsx
Janpot May 24, 2024
9c81f9c
Delete data-provider.json
Janpot May 24, 2024
dee9a2c
Merge remote-tracking branch 'upstream/master' into datagrid
Janpot May 24, 2024
8b2d362
frwwt
Janpot May 24, 2024
5702952
remove dialog/notifications
Janpot May 24, 2024
86ca56f
Update AppProvider.tsx
Janpot May 24, 2024
c2cfd7a
Update index.ts
Janpot May 24, 2024
c429048
Update pnpm-lock.yaml
Janpot May 24, 2024
62076bc
Update InferrencingAlert.tsx
Janpot May 24, 2024
17a028d
Update pnpm-lock.yaml
Janpot May 24, 2024
a5894cc
apply comments
Janpot May 24, 2024
e54a6fe
types
Janpot May 24, 2024
61ea705
Update getCoreComponentInfo.ts
Janpot May 24, 2024
4b82b88
Update DataGrid.tsx
Janpot May 27, 2024
bceae1a
Merge remote-tracking branch 'upstream/master' into datagrid
Janpot May 27, 2024
51baa1e
Update pnpm-lock.yaml
Janpot May 27, 2024
e2b226e
Merge remote-tracking branch 'upstream/master' into datagrid
Janpot May 27, 2024
455435f
Update LoadingOverlay.tsx
Janpot May 27, 2024
0f2219e
rename
Janpot May 27, 2024
6f4f32f
Update DataProvider.tsx
Janpot May 28, 2024
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
29 changes: 29 additions & 0 deletions docs/data/toolpad/core/components/data-grid/BasicDataProvider.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import * as React from 'react';
import { createDataProvider } from '@toolpad/core/DataProvider';
import { DataGrid } from '@toolpad/core/DataGrid';
import Box from '@mui/material/Box';

const myData = createDataProvider({
Janpot marked this conversation as resolved.
Show resolved Hide resolved
// preview-start
async getMany() {
return {
rows: [
{ id: '1', name: 'John' },
{ id: '2', name: 'Jane' },
],
};
},
// preview-end
fields: {
id: { label: 'ID' },
name: { label: 'Name' },
},
});

export default function BasicDataProvider() {
return (
<Box sx={{ height: 250, width: '100%' }}>
<DataGrid dataProvider={myData} />
</Box>
);
}
29 changes: 29 additions & 0 deletions docs/data/toolpad/core/components/data-grid/BasicDataProvider.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import * as React from 'react';
import { createDataProvider } from '@toolpad/core/DataProvider';
import { DataGrid } from '@toolpad/core/DataGrid';
import Box from '@mui/material/Box';

const myData = createDataProvider({
// preview-start
async getMany() {
return {
rows: [
{ id: '1', name: 'John' },
{ id: '2', name: 'Jane' },
],
};
},
// preview-end
fields: {
id: { label: 'ID' },
name: { label: 'Name' },
},
});

export default function BasicDataProvider() {
return (
<Box sx={{ height: 250, width: '100%' }}>
<DataGrid dataProvider={myData} />
</Box>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
async getMany() {
return {
rows: [
{ id: '1', name: 'John' },
{ id: '2', name: 'Jane' },
],
};
},
43 changes: 43 additions & 0 deletions docs/data/toolpad/core/components/data-grid/CrudCreate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import * as React from 'react';
import { createDataProvider } from '@toolpad/core/DataProvider';
import { DataGrid } from '@toolpad/core/DataGrid';
import Box from '@mui/material/Box';

let nextId = 1;
const getNextId = () => {
const id = `id-${nextId}`;
nextId += 1;
return id;
};
let DATA = [
{ id: getNextId(), name: 'John' },
{ id: getNextId(), name: 'Jane' },
];

const myData = createDataProvider({
async getMany() {
return {
rows: DATA,
};
},
// preview-start
async createOne(values) {
const id = getNextId();
const newItem = { ...values, id };
DATA = [...DATA, newItem];
return newItem;
},
// preview-end
fields: {
id: { label: 'ID' },
name: { label: 'Name' },
},
});

export default function CrudCreate() {
return (
<Box sx={{ height: 250, width: '100%' }}>
<DataGrid dataProvider={myData} />
</Box>
);
}
43 changes: 43 additions & 0 deletions docs/data/toolpad/core/components/data-grid/CrudCreate.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import * as React from 'react';
import { createDataProvider } from '@toolpad/core/DataProvider';
import { DataGrid } from '@toolpad/core/DataGrid';
import Box from '@mui/material/Box';

let nextId = 1;
const getNextId = () => {
const id = `id-${nextId}`;
nextId += 1;
return id;
};
let DATA = [
{ id: getNextId(), name: 'John' },
{ id: getNextId(), name: 'Jane' },
];

const myData = createDataProvider({
async getMany() {
return {
rows: DATA,
};
},
// preview-start
async createOne(values) {
const id = getNextId();
const newItem = { ...values, id };
DATA = [...DATA, newItem];
return newItem;
},
// preview-end
fields: {
id: { label: 'ID' },
name: { label: 'Name' },
},
});

export default function CrudCreate() {
return (
<Box sx={{ height: 250, width: '100%' }}>
<DataGrid dataProvider={myData} />
</Box>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
async createOne(values) {
const id = getNextId();
const newItem = { ...values, id };
DATA = [...DATA, newItem];
return newItem;
},
40 changes: 40 additions & 0 deletions docs/data/toolpad/core/components/data-grid/CrudDelete.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import * as React from 'react';
import { createDataProvider } from '@toolpad/core/DataProvider';
import { DataGrid } from '@toolpad/core/DataGrid';
import Box from '@mui/material/Box';

let nextId = 1;
const getNextId = () => {
const id = `id-${nextId}`;
nextId += 1;
return id;
};
let DATA = [
{ id: getNextId(), name: 'John' },
{ id: getNextId(), name: 'Jane' },
];

const myData = createDataProvider({
async getMany() {
return {
rows: DATA,
};
},
// preview-start
async deleteOne(id) {
DATA = DATA.filter((item) => item.id !== id);
},
// preview-end
fields: {
id: { label: 'ID' },
name: { label: 'Name' },
},
});

export default function CrudDelete() {
return (
<Box sx={{ height: 250, width: '100%' }}>
<DataGrid dataProvider={myData} />
</Box>
);
}
40 changes: 40 additions & 0 deletions docs/data/toolpad/core/components/data-grid/CrudDelete.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import * as React from 'react';
import { createDataProvider } from '@toolpad/core/DataProvider';
import { DataGrid } from '@toolpad/core/DataGrid';
import Box from '@mui/material/Box';

let nextId = 1;
const getNextId = () => {
const id = `id-${nextId}`;
nextId += 1;
return id;
};
let DATA = [
{ id: getNextId(), name: 'John' },
{ id: getNextId(), name: 'Jane' },
];

const myData = createDataProvider({
async getMany() {
return {
rows: DATA,
};
},
// preview-start
async deleteOne(id) {
DATA = DATA.filter((item) => item.id !== id);
},
// preview-end
fields: {
id: { label: 'ID' },
name: { label: 'Name' },
},
});

export default function CrudDelete() {
return (
<Box sx={{ height: 250, width: '100%' }}>
<DataGrid dataProvider={myData} />
</Box>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
async deleteOne(id) {
DATA = DATA.filter((item) => item.id !== id);
},
47 changes: 47 additions & 0 deletions docs/data/toolpad/core/components/data-grid/CrudUpdate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import * as React from 'react';
import { createDataProvider } from '@toolpad/core/DataProvider';
import { DataGrid } from '@toolpad/core/DataGrid';
import Box from '@mui/material/Box';

let nextId = 1;
const getNextId = () => {
const id = `id-${nextId}`;
nextId += 1;
return id;
};
let DATA = [
{ id: getNextId(), name: 'John' },
{ id: getNextId(), name: 'Jane' },
];

const myData = createDataProvider({
async getMany() {
return {
rows: DATA,
};
},
// preview-start
async updateOne(id, values) {
console.log(id, values);
const existing = DATA.find((item) => item.id === id);
if (!existing) {
throw new Error(`Item with id ${id} not found`);
}
const updated = { ...existing, ...values };
DATA = DATA.map((item) => (item.id === updated.id ? updated : item));
return updated;
},
// preview-end
fields: {
id: { label: 'ID' },
name: { label: 'Name' },
},
});

export default function CrudUpdate() {
return (
<Box sx={{ height: 250, width: '100%' }}>
<DataGrid dataProvider={myData} />
</Box>
);
}
47 changes: 47 additions & 0 deletions docs/data/toolpad/core/components/data-grid/CrudUpdate.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import * as React from 'react';
import { createDataProvider } from '@toolpad/core/DataProvider';
import { DataGrid } from '@toolpad/core/DataGrid';
import Box from '@mui/material/Box';

let nextId = 1;
const getNextId = () => {
const id = `id-${nextId}`;
nextId += 1;
return id;
};
let DATA = [
{ id: getNextId(), name: 'John' },
{ id: getNextId(), name: 'Jane' },
];

const myData = createDataProvider({
async getMany() {
return {
rows: DATA,
};
},
// preview-start
async updateOne(id, values) {
console.log(id, values);
const existing = DATA.find((item) => item.id === id);
if (!existing) {
throw new Error(`Item with id ${id} not found`);
}
const updated = { ...existing, ...values };
DATA = DATA.map((item) => (item.id === updated.id ? updated : item));
return updated;
},
// preview-end
fields: {
id: { label: 'ID' },
name: { label: 'Name' },
},
});

export default function CrudUpdate() {
return (
<Box sx={{ height: 250, width: '100%' }}>
<DataGrid dataProvider={myData} />
</Box>
);
}
10 changes: 10 additions & 0 deletions docs/data/toolpad/core/components/data-grid/CrudUpdate.tsx.preview
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
async updateOne(id, values) {
console.log(id, values);
const existing = DATA.find((item) => item.id === id);
if (!existing) {
throw new Error(`Item with id ${id} not found`);
}
const updated = { ...existing, ...values };
DATA = DATA.map((item) => (item.id === updated.id ? updated : item));
return updated;
},
26 changes: 26 additions & 0 deletions docs/data/toolpad/core/components/data-grid/FieldInference.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import * as React from 'react';
import { createDataProvider } from '@toolpad/core/DataProvider';
import { DataGrid } from '@toolpad/core/DataGrid';
import Box from '@mui/material/Box';

// preview-start
const myData = createDataProvider({
async getMany() {
return {
rows: [
{ id: '1', name: 'John' },
{ id: '2', name: 'Jane' },
],
};
},
// paste fields here:
});
// preview-end

export default function FieldInference() {
return (
<Box sx={{ height: 300, width: '100%' }}>
<DataGrid dataProvider={myData} />
</Box>
);
}
Loading
Loading