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

@outsiderninjadevs/tabular

v17.0.0

Published

Ond Tabular is an Angular library for creating customizable tabular data views with features like searching, and sorting with `Drag And Drop` feature. It simplifies the process of displaying tabular data in your Angular applications.

Downloads

7

Readme

Ond Tabular

Ond Tabular is an Angular library for creating customizable tabular data views with features like searching, and sorting with Drag And Drop feature. It simplifies the process of displaying tabular data in your Angular applications.

@outsiderninjadevs/tabular logo

Node.js CI

Features

  • Display tabular data with ease.
  • Search and filter data by keywords.
  • Customizable layout.
  • Drag and drop elements.

Installation

You can install Ond Tabular via npm:

npm install @outsiderninjadevs/ond-tabular

Usage

  1. We strongly recommend using Angular 17 standalone components, That's why we no more need OndTabularModule, All the components in this library are standalone

  2. Create the list of element and the mappers in your component's typescript file

    We recommend using our types for the mappings.

    What makes this way a good way is that you are sure you respect the types and the mapping logic.

    import {
        KeyMappings, 
        AlignmentMappings, 
        DragPreviewMapping, 
        OndTabularComponent, 
        DragPreviewCardDirective
    } from '@outsiderninjadevs/ond-tabular'
    
    // imports
    
    interface IUser {
        name: string;
        age: number;
        is_an_admin?: boolean;
    }
    
    @Component({
        // properties
        standalone: true,
        imports: [/*...*/, OndTabularComponent, DragPreviewCardDirective],
    })
    export class MyComponent {
        usersList: IUser[] = [
            {
                name: 'Achraf',
                age: 24
            },
            {
                name: 'Alae',
                age: 18
            }
            // ...
        ];
    
        keyMappings: KeyMappings<IUser> = {
            name: "Name",
            is_an_admin: "Is an admin"
        };
    
        alignmentMappings: AlignmentMappings<IUser> = {
            name: "l"
        };
    
        dragPreviewMapping: DragPreviewMapping<IUser> = {
            mainAttribute: "name",
            otherAttributes: ["is_an_admin"]
        }
    }
  3. Use the <ond-tabular> component in your template to display tabular data:

    <ond-tabular
    [elements]="usersList"
    [keysMapping]="keyMappings"
    [alignCellMapping]="alignmentMappings"
    [dragPreviewAttributes]="dragPreviewMapping"
    tableTitle="My Users Table"
    ></ond-tabular>

    This will create a table of the given list, well mapped, aligned as you like, and with a drag and drop preview showing just the attributes you want

Configuration

If needed, you can customize the appearance and behavior of the tabular component by providing additional options.

1. Customizing the preview card on drag

You can customize the drag preview card with the *ondDragPreviewCard structural directive.

<ond-tabular [elements]="usersList">
  <!-- this is a tabular with default drag preview -->
</ond-tabular>

<ond-tabular [elements]="usersList">
  <!-- this is a tabular with custom drag preview -->
  <div *ondDragPreviewCard="let user">
    <div>
      name: {{ user?.name }}
      <br />
      Age: {{ user?.age }}
      <br />
      Is an admin:
      {{ user?.is_an_admin ?? 'N/A' }}
    </div>
  </div>
</ond-tabular>

<ond-tabular [elements]="usersList">
  <!-- this is a tabular with custom drag preview but also an element index in the table -->
  <div *ondDragPreviewCard="let user; let i=index">
    <div>
      <h3>#{{ i + 1 }}</h3>
      name: {{ user?.name }}
      <br />
      Age: {{ user?.age }}
      <br />
      Is an admin:
      {{ user?.is_an_admin ?? 'N/A' }}
    </div>
  </div>
</ond-tabular>

Make sure to use the optional chaining user?.name because in the first loading of the tabular, the user instance is still null until you perform your drag action.

2. Public css classes

You can use a bench of css classes to customize the tabular styles

| CSS Selector | Uses | |----------------------------------------|-------------------------------------------------------------------------------------------------------------------------| | .ond-tabular-header-container-public | The container of the Header element in the tabular component, try to change it's background-color | | .ond-tabular-header-title-public | The title in the header in the tabular component, try to change it's color | | .ond-tabular-header-search-public | The search bar container in the tabular component, try to change it's background-color or maybe it's border color too |

License

This project is licensed under the MIT License - see the LICENSE file for details.