Logo

dev-resources.site

for different kinds of informations.

Mi primera Libreria en NPM

Published at
1/8/2025
Categories
webdev
npm
javascript
Author
yosmarcode
Categories
3 categories in total
webdev
open
npm
open
javascript
open
Author
10 person written this
yosmarcode
open
Mi primera Libreria en NPM

Tabla Componente basada de Material UI.

Es una idea que salió de muchas dificultades que se presentaron en diferentes implementaciones en diferente software

Esta tabla solo ha sido probada usando. React pero puede ser usada en diferentes herramientas

Documentación de Material Table

Material UI

npm i table-component-mui-lib

Enter fullscreen mode Exit fullscreen mode

Documentación NPM

Video implementación

Video demo instalación librería

Tabla Referencia

  • dataSource Datos visibles en la tabla
  • columns Columna visible en la tabla
  • isCheckbox Se habilita CheckBox para multiple selección en columnas
  • isRadioBox Se habilita RadioBox para solo seleccionar un elemento de la columna
  • selectedData Hooks Data Seleccionada (esto permite usar la data en el componente principal)
  • setSelectedData Hooks Data para seleccionar data
  • isPaginate true - false para generar una paginación de la tabla
  • search Se habilita un textBox para buscar dentro de la tabla
  • isDowmload Permite habilitar button para descargar archivo excel
  • _styleColumn Estilo personalizable a las columnas de la tabla
  • childreButton Botones personalizable en la tabla

Tipo de Datos Columnas

export interface HeadCell {
    disablePadding?: boolean;
    id?: keyof any;
    label?: string;
    numeric?: boolean;
    sort?: boolean;
    width?: number;
  }
Enter fullscreen mode Exit fullscreen mode

Creación de Columna personalizadas

const column: HeadCell[] = [
  {
    id: 'id',
    numeric: false,
    disablePadding: false,
    label: 'ID',
    sort: true
  },
  {
    id: 'name',
    numeric: false,
    disablePadding: false,
    label: 'Name',
    sort: true
  },
  {
    id: 'username',
    numeric: false,
    disablePadding: false,
    label: 'User Name',
    sort: true
  },
  {
    id: 'email',
    numeric: false,
    disablePadding: false,
    label: 'Correo Eléctronico',
    sort: true
  },

]
Enter fullscreen mode Exit fullscreen mode

Ejemplo Componente

`
import { TableComponents, HeadCell } from 'table-component-mui-lib'

     <TableComponents
            dataSource={dataSource ?? []}
            dataSourceExcel={dataTableFields.data ?? []}
            columns={columns ?? []}
            isCheckbox={false}
            isRadioBox={false}
            selectedData={data seleccionada de las columnas}
            setSelectedData={hooks de selección de datos}
            isPaginate
            search
            isDowmload
            initialSelectionNumber={5}
            _styleColumn={{ backgroundColor: `#cdcd`, color: '#000' }}
            childreButton={(row: any) => (
              <Box sx={{ display: 'flex', gap: 1, alignContent: 'center' }}>
                <RadioGroup
                  aria-labelledby='demo-controlled-radio-buttons-group'
                  name='controlled-radio-buttons-group'
                >
                  <FormControlLabel
                    sx={{ ml: 1 }}
                    control={<Radio
                      color='success'
                      checked={boolean}
                      onClick={() => { }}
                             />}
                    onClick={(e: React.ChangeEvent<HTMLInputElement> | any) => {  }} // Guarda los datos de la fila seleccionada}
                    label=''
                  />
                </RadioGroup>
                <IconButton size='medium' sx={{ mr: 1 }}>
                  <Edit
                    style={{ color: #000 }} onClick={() => { }}
                  />
                </IconButton>

              </Box>
            )}
          />
`
Enter fullscreen mode Exit fullscreen mode
npm Article's
30 articles in total
Favicon
NPM command confusion
Favicon
My First npm Package!
Favicon
Introducing date-formatter-i18n: Simplify i18n for Dates in JavaScript
Favicon
Themeify: A Simple Tool to Beautify Your React and Next.js Projects
Favicon
Mi primera Libreria en NPM
Favicon
node unsupported engine when updating npm
Favicon
Starting with semver `1.0.0`
Favicon
My Experience with Node.js Version Compatibility: Leveraging the engines Field in package.json for AutoScout
Favicon
NPM Commands Every Web Developer Must Know
Favicon
Exploring npm: The Node Package Manager
Favicon
When GitHub Actions Build Fails Due to pnpm-lockfile
Favicon
Private npm Repositories
Favicon
🚀 Introducing pingflow: Your Ultimate Internet Speed Testing Tool! 🌐
Favicon
npm error 'node' is not recognized as an internal or external command
Favicon
Optimer for your project security and performance issues
Favicon
Publishing NPM package with Github Actions that react-hook-use-cta used
Favicon
Building My First NPM Package: A CLI for Scaffolding Express Servers
Favicon
Resolving Peer Dependency Errors in React: A Comprehensive Guide ⚡
Favicon
Building Scalable Microservices with Node.js and Event-Driven Architecture
Favicon
NPM Dependency error
Favicon
🎄 A Christmas Gift for Developers: FileToMarkdown!
Favicon
npm
Favicon
Fastly CLI on npm: now at your JavaScript fingertips
Favicon
{ my learnings through Error message “error:0308010C:digital envelope routines::unsupported” }
Favicon
Installing your react.js local package registry to your project
Favicon
External libraries: The Hidden Weight of External Libraries
Favicon
Simplifying your code: replacing heavy packages with lightweight solutions
Favicon
Lazy Devs, Rejoice! Automate Updates with Dependabot (and My Secret Sauce) 🍹📱
Favicon
Counter - A React library for animating numeric transitions
Favicon
What I learned building vue3-search-select package

Featured ones: