Introduced sorting, column visibility and column resizing

Summary:
Add support for resizable columns, column sorting, and hiding / showing columns

Moved some utilities from Flipper to flipper-plugin, such as Interactive and LowPassFilter

Split DataTable into two components; DataSourceRenderer which takes care of purely rendering the virtualization, and DataTable that has the Chrome around that, such as column headers, search bar, etc.

Reviewed By: nikoant

Differential Revision: D26321105

fbshipit-source-id: 32b8fc03b4fb97b3af52b23e273c3e5b8cbc4498
This commit is contained in:
Michel Weststrate
2021-03-16 14:54:53 -07:00
committed by Facebook GitHub Bot
parent 86ad413669
commit 44bb5b1beb
18 changed files with 1020 additions and 324 deletions

View File

@@ -0,0 +1,46 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
import LowPassFilter from '../utils/LowPassFilter';
test('hasFullBuffer', () => {
const lpf = new LowPassFilter();
expect(lpf.hasFullBuffer()).toBeFalsy();
lpf.push(1);
lpf.push(2);
lpf.push(3);
lpf.push(4);
lpf.push(5);
expect(lpf.hasFullBuffer()).toBeTruthy();
});
test('push on full buffer returns shifted value', () => {
const lpf = new LowPassFilter();
expect(lpf.push(1)).toBe(0);
expect(lpf.push(2)).toBe(0);
expect(lpf.push(3)).toBe(0);
expect(lpf.push(4)).toBe(0);
expect(lpf.push(5)).toBe(0);
expect(lpf.push(6)).toBe(1);
expect(lpf.push(7)).toBe(2);
});
test('next returns smoothed value', () => {
const lpf = new LowPassFilter();
expect(lpf.next(1)).toBe(0.9);
expect(lpf.next(2)).toBe(1.881);
});
test('next returns smoothed value with custom smoothing', () => {
const lpf = new LowPassFilter(0.5);
expect(lpf.next(1)).toBe(0.5);
expect(lpf.next(2)).toBe(1.125);
});