(react) add DataGrid, SimpleDataGrid components

The DataGrid component can be considered as the core one, which provides
a full controlled component, but more complicated than SimpleDataGrid
which is based on DataGrid. SimpleDataGrid is intended to give a simple
ready-to-use data grid for client side data for example.
This commit is contained in:
Nathan Vasse
2023-03-07 17:06:50 +01:00
committed by NathanVss
parent 8e078c87c2
commit 994d42578e
39 changed files with 3105 additions and 7 deletions

View File

@@ -0,0 +1,7 @@
import createFetchMock from "vitest-fetch-mock";
import { vi } from "vitest";
const fetchMocker = createFetchMock(vi);
// sets globalThis.fetch and globalThis.fetchMock to our mocked version
fetchMocker.enableMocks();

View File

@@ -0,0 +1,24 @@
/*
* Test helper: use a deferred object to control promise resolution without mocking
* deep inside our code.
*/
export class Deferred<T> {
promise: Promise<T>;
reject!: (reason?: any) => void;
resolve!: (value: T | PromiseLike<T>) => void;
constructor() {
this.promise = this._init();
}
reset() {
this.promise = this._init();
}
private _init(): Promise<any> {
return new Promise((resolve, reject) => {
this.reject = reject;
this.resolve = resolve;
});
}
}