npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react_reusable_aggrid_v1

v0.1.118

Published

React customizable aggrid.

Downloads

7

Readme

react_reusable_aggrid

React AGGrid component, to which we can pass dynamic props. I've encapsulated most of the initial typescript config from https://www.ag-grid.com/react-data-grid/getting-started/ here you can also find more docs about how AGGrid works.

You can uses ColDef | ColGroupDef from aggrid comunity if you need the type: https://www.npmjs.com/package/ag-grid-community

---------------------------------------------------------------------------------------------------

Main props:

@param items: any[]

data to be displayed in the grid

@param rowStyle?: React.CSSProperties

style for the row

----------------------------------------------------------------------------------------------------

@param getColumnDefs: (ColDef | ColGroupDef)[]

==column definitions for the grid==


{

 @param headerName:string Name to be shown as header.
 @param field=string Property to show in the column.
 @param width?=number
 @param height?=number
 @param minWidth?: =number
 @param minHeight?=number
 @param maxWidth?=number
 @param maxHeight?=number
 @param sortable?=boolean
 @param enableRowGroup?=boolean
 @param tootltipField?=string
 @param type?=['dateColumn', 'numberColumn', 'textColumn', 'nonEditableColumn']
 @param editable?=boolean
 @param filter?='agTextColumnFilter', 'agNumberColumnFilter', 'agDateColumnFilter'
 @param cellStyle?=(params: any) => React.CSSProperties
 @param cellRenderer?=(params: any) => React.ReactNode
 @param cellEditor?=(params: any) => React.ReactNode
 @param valueFormatter?=(params: any) => React.ReactNode
 @param valueGetter?=(params: any) => React.ReactNode
 @param valueSetter?=(params: any) => React.ReactNode
 @param onCellValueChanged?=(params: any) => React.ReactNode
 @param onCellEditingStarted?=(params: any) => React.ReactNode
 @param onCellEditingStopped?=(params: any) => React.ReactNode
 @param onCellFocused?=(params: any) => React.ReactNode
 @param onCellClicked?=(params: any) => React.ReactNode
 @param onCellDoubleClicked?=(params: any) => React.ReactNode
 @param onCellContextMenu?=(params: any) => React.ReactNode
 @param rowHeight?=number
 @param rowGroup?=boolean
 @param rowDrag?=boolean
 @param sort?=string, 'asc', 'desc'
 @param pinned?=string, 'left', 'right'
 @param lockPosition?=boolean
 @param cellClass?=(params: any) => string | string[]
 @param children?=(ColDef | ColGroupDef)[]
 @param headerClass?=(params: any) => string | string[]

 }
 

-----------------------------------------------------------------------------------------------------

@param onFilterChanged?=(event: FilterChangedEvent) => void

method with param event for filter change contains property data of the row

@param onCellEditingStarted?=(event: CellEditingStartedEvent) => void

method with param event for cell editing start contains property data of the row

@param onCellEditingStopped?=(event: CellEditingStoppedEvent) => void

method with param event for cell editing end contains property data of the row

@param rowKey: string rowId

(unique key - property name)

@param onRowSelected?: () => any

callback for row selection

@param showPagination?: boolean

@param defaultRowsPerPage?: number

@param loadingMessage?: string

@param gridStyle?: React.CSSProperties

style for the grid

@param containerStyle?: React.CSSProperties

style for the container of the grid

------------------------------------------------------------------------------------------------------

EXAMPLE USSAGE

--------------------------------------------------------------------------------------------------------


{

import { ColDef, ColGroupDef } from 'ag-grid-community';
import React, { useMemo } from 'react';

import CustomAgGrid from './components/grid/Grid';

function App() {
  const getUserColumnDefs: (ColDef | ColGroupDef)[] = useMemo(() => {
    return [
      {
        headerName: 'UserId',
        field: 'userId',
        minWidth: 30,
        sortable: true,
        tooltipField: 'userId',
      },
      {
        headerName: 'User Name',
        field: 'userName',
        minWidth: 30,
        sortable: true,
        tooltipField: 'userName',
      },
      {
        headerName: 'Email',
        field: 'email',
        minWidth: 30,
        sortable: true,
        tooltipField: 'email',
      }
    ];
  }, []);

  return (
    <div className="App">
      <CustomAgGrid
        items={[{ userId: 1, userName: 'test', email: 'test@test' },
        { userId: 2, userName: 'testa', email: 'test@test' },
        { userId: 3, userName: 'atests', email: 'test@test' },
        { userId: 4, userName: 'atestd', email: 'test@test' },
        { userId: 5, userName: 'dteste', email: 'test@test' },
        { userId: 6, userName: 'dtestf', email: 'test@test' },
        { userId: 7, userName: 'testa', email: 'test@test' },
        { userId: 8, userName: 'test', email: 'test@test' },
        { userId: 9, userName: 'test', email: 'test@test' },
        { userId: 10, userName: 'dtest', email: 'test@test' },
        { userId: 11, userName: 'dtest', email: 'test@test' },
        { userId: 12, userName: 'ctest', email: 'test@test' },
        { userId: 13, userName: 'test', email: 'test@test' },
        { userId: 14, userName: '77test', email: 'test@test' },
        { userId: 15, userName: '6uktest', email: 'test@test' },
        { userId: 17, userName: '5test', email: 'test@test' },
        { userId: 18, userName: 'yytest', email: 'test@test' },
        { userId: 19, userName: 'atest', email: 'test@test' },
        { userId: 20, userName: 'zfdtest', email: 'test@test' },
        { userId: 21, userName: 'xtest', email: 'test@test' },
        { userId: 22, userName: 'stest', email: 'test@test' },
        { userId: 23, userName: 'atest', email: 'test@test' },
        { userId: 24, userName: '3test', email: 'test@test' }
        ]}
        rowHeight={30}
        showPagination={true}
        defaultRowsPerPage={20}
        showHeaderFilterIcon={true}
        getColumnDefs={getUserColumnDefs}
        rowKey={'userId'} />
    </div>
  );
}

export default App;

}