react-observable-grid

0.0.61 • Public • Published

👀 🗞️ react-observable-grid

A grid component for React. Works with the intersection observer API. It requires React min 16.8.4 and currently works only with Material UI (min) 4.0.0.

NOTE: Until v1.0.0 the package is in a beta state. Please do not use productive

📚 Installation

npm i react-observable-grid

📷 Preview

'mainView' Fully controlled example

'mainView' Unsupervised example

Features

ZeroConfig mechanic

Sample usage

const headers = [
  {
    label: 'Name',
    tooltip: "Filter users by name",
    icon: <GitHubIcon />,
    property: 'name',
    width: 'minmax(200px, 1fr)',
    row: (row) => <NamesRow row={row} />,
    additionalHeaders: [
      {
        label: 'Surname',
        icon: <PersonPinCircleIcon />,
        property: 'surname'
      }
    ],
    secondaryHeaders: [
      {
        label: 'Name1',
        property: 'nickname',
        // noSort: true
      },
      {
        label: 'Name2',
        property: 'streetname'
      }
    ]
  },
  {
    label: 'Description',
    icon: <SubjectIcon />,
    property: 'description',
    row: (row) => <DescriptionRow row={row} />,
    width: '2fr',
  },
  {
    label: 'Tiles',
    icon: <DashboardIcon />,
    property: 'tilesHash',
    width: 'minmax(100px, 2fr)',
    row: (row) => <TilesRow row={row} />,
    secondaryHeaders: [
      {
        label: 'Tiles Count',
        property: 'tiles',
      },
    ]
  },
  {
    label: 'Price',
    icon: <MonetizationOnIcon />,
    property: 'price',
    align: 'flex-end',
    width: '110px',
    row: (row) => <CurrencyRow row={row} />,
    secondaryHeaders: [
      {
        label: 'Currency',
        property: 'currency',
      },
    ]
  },
  {
    icon: <MoreHorizIcon />,
    align: 'flex-end',
    tooltip: "Actions for entries",
    noSort: true,
    row: (row) => <ActionsRow row={row} />,
    width: '1fr',
  },
]

 <ObservableGrid
	isDebugging={isDebugging}
	headers={headers}
	uniqueId="fakeEntries"
	rowOptions={{
		padding: '10px 20px'
	}}
	rows={filteredRows}
	isEmpty={filteredRows.length === 0}
	emptyElement={<div>No data found ...</div>}
	rowRenderer={row => <SampleRow {...{ row }} />}
/>

TODO:

  • full row colors
  • transparent cells
  • cell based inView observer
  • row uuid generator function (default uuidv4)
  • column custom order
  • keyboard focus navigation
  • fix column
  • fix row

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.0.611latest

Version History

VersionDownloads (Last 7 Days)Published
0.0.611
0.0.601
0.0.591
0.0.581
0.0.571
0.0.561
0.0.551
0.0.541
0.0.511
0.0.501
0.0.491
0.0.481
0.0.471
0.0.461
0.0.453
0.0.441
0.0.431
0.0.421
0.0.411
0.0.401
0.0.391
0.0.381
0.0.371
0.0.361
0.0.351
0.0.341
0.0.331
0.0.322
0.0.311
0.0.301
0.0.291
0.0.281
0.0.271
0.0.261
0.0.251
0.0.241
0.0.231
0.0.221
0.0.211
0.0.201
0.0.191
0.0.181
0.0.171
0.0.161
0.0.151
0.0.141
0.0.131
0.0.111
0.0.101
0.0.90
0.0.80
0.0.70
0.0.60
0.0.50
0.0.40
0.0.31

Package Sidebar

Install

npm i react-observable-grid

Weekly Downloads

53

Version

0.0.61

License

MIT

Unpacked Size

140 kB

Total Files

18

Last publish

Collaborators

  • kadarka