Commit Graph

13 Commits

Author SHA1 Message Date
Michel Weststrate
7e4df00138 Implement context menu
Summary:
Re-introduced context menu to DataTable, due to popular demand.

Originally it wasn't there to better align with ant design principles, but in an app like Flipper it makes just too much sense to have it

See e.g. https://fb.workplace.com/groups/flippersupport/permalink/1138285579985432/

changelog: Restored context menu in data tables

Reviewed By: passy

Differential Revision: D28996137

fbshipit-source-id: 16ef4c90997c9313efa62da7576fd453a7853761
2021-06-10 12:57:47 -07:00
Michel Weststrate
23c0781127 Minor keyboard navigation around fix
Summary: Fixed minor keyboard navigation annoyance: pressing arrow down on the last entry would remove selection, then jump to first row. Pressing up on first row would deselect then select first again. After this change the first/last item is kept selected in those cases

Reviewed By: passy

Differential Revision: D28958705

fbshipit-source-id: 01dbce3971ed965eae3b74e6706fef96aa86df66
2021-06-08 06:44:51 -07:00
Michel Weststrate
e6495be902 Fix NPE in DataTable
Summary: Fixed linked NPE. Couldn't find a clear reproduction,

Reviewed By: passy

Differential Revision: D28958704

fbshipit-source-id: e09830fbad08bf035c54049451de7f52485cb9dc
2021-06-08 04:43:37 -07:00
Michel Weststrate
bc647972e1 Type improvements
Summary: some type simplifications, that makes it easier to reuse data sources and helps type inference

Reviewed By: passy

Differential Revision: D28413380

fbshipit-source-id: 261a8b981bf18a00edc3075926bd668322e1c37d
2021-06-07 08:09:53 -07:00
Michel Weststrate
44521315c4 Set up separate package build
Summary:
Added a microbundle based build setup to the data-source folder to be able to package just that folder.

For simplicity / iteration speed, this is only used to publish externally. Our own code still references the source files directly.

More strict separation can be done later if there is external adoption.

Reviewed By: nikoant

Differential Revision: D28056699

fbshipit-source-id: a011b615cfffeff8ecb879bd7281a71085cea965
2021-05-10 07:03:40 -07:00
Michel Weststrate
84e2646909 Reorganise for easier extraction
Summary:
To make the DataSource abstraction reusable for other teams and an upcoming talk, this diff moves all DataSource storage & virtualization logic in one folder.

Will set up a build process and demo project in later diffs.

Reviewed By: nikoant

Differential Revision: D28056700

fbshipit-source-id: 7cfe5b40bbbe387da711f765a604a45029d451c7
2021-05-10 07:03:39 -07:00
Michel Weststrate
d903a862d2 Use DataTable as list base
Summary:
Changelog: Standardized DataList component

This diff standardizes the DataList component, by reusing the DataList. This is done to be able to take full advantage of all its features like virtualisation, keyboard support, datasource support, etc.

Also cleaned up DataTable properties a bit, by prefixing all flags with `enableXXX` and setting clear defaults

Reviewed By: passy

Differential Revision: D28119721

fbshipit-source-id: b7b241ea18d788bfa035389cc8c6ae7ea95ecadb
2021-05-04 13:50:31 -07:00
Michel Weststrate
e26a8c5ad0 Provide standardised MasterDetail
Summary:
Noticed in reviews during the convertathon there is still quite some boilerplate in things that happen on the boundary of UI and plugin state, such as setting up menu entries and providing common functionality like clear, master/detail layout, etc.

This diff introduces the `MasterDetail` component, which takes a higher level approach by merely needing to provide the state atoms and desired features, and taking care of the wiring.

Applied it to createTablePlugin, to prove that going from `createTablePlugin` to `MasterDetail` will be a much smaller step now.

Verified on the funnel logger plugin

Reviewed By: passy

Differential Revision: D28090362

fbshipit-source-id: 146f8c315fea903901ad4e3e46711642f16cf0e6
2021-04-29 07:31:54 -07:00
Michel Weststrate
bbcb16d8fb Make DataTable / DataInspector unit tests predictable
Summary: Having time / async / non-blocking behavior in components in unit tests is really annoying, as it makes unit tests async without an easy way to determine 'done'. This diff makes sure that DataTable & DataInspector don't break down their work in smaller tasks, but do everything block if they are running in a unit test.

Reviewed By: nikoant

Differential Revision: D28054487

fbshipit-source-id: 72c3b519e092ad69ed71eb1731e1fed80022f91f
2021-04-28 06:33:04 -07:00
Michel Weststrate
d6c74c4e2f Support natural sizing
Summary:
Introduced the `scrollable={false}` option to DataTable, that gives the table its natural size, while still having all the other gimmicks of DataTable, like search, filter, etc etc.

To implement this, a non-virtualizing rendering is needed, which is handled by the `StaticDataSourceRenderer`

Also introduced the option to hide the searchbar.

Reviewed By: nikoant

Differential Revision: D28036469

fbshipit-source-id: 633c4f7f3fabfa99efa2839059aaa59b0a407ada
2021-04-28 05:48:20 -07:00
Michel Weststrate
00e4d2440d Support providing records directly to DataTable
Summary: This diff allows using a DataTable without setting up a full datasource, which is simpler in case the dataset is small and/or fixed. For an continuously growing dataset a DataSource should still be set up.

Reviewed By: jknoxville

Differential Revision: D28037897

fbshipit-source-id: 2e56b1970e19f967c3752a78737b8f7a3f934b87
2021-04-27 14:53:40 -07:00
Michel Weststrate
faf8588097 Minor improvements
Summary:
Some styling fixes and minor improvements in DataTable, used by network plugin:

- be able to customise the context menu
- be able to customise how entire rows are copied and presented on the clipboard to be able to deviate from the standard JSON
- deeplink handling was made async, this gives the plugin the opportunity to first handle initial setup and rendering before trying to jump somewhere which is a typical use case for deeplinking

Reviewed By: passy

Differential Revision: D27947186

fbshipit-source-id: a56f081d60520c4bc2ad3c547a8ca5b9357e71a1
2021-04-23 09:29:59 -07:00
Michel Weststrate
cd27e4c010 Folder rename datatable -> data-table
Summary: just a rename, as we will have `data-inspector` folder as well in next diffs.

Reviewed By: passy

Differential Revision: D27591891

fbshipit-source-id: b1fe92cbf4be1633e623e59b694efc3f687c3413
2021-04-07 07:55:12 -07:00