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

tfg-common-schematics

v0.0.22

Published

A blank schematics

Downloads

6

Readme

Tfg-common-schematics

  1. Install the package into your angular-cli project
  2. Run any of the following:
    • schematics tfg-common-schematics:tfgdatatable --dry-run=false --path=output/accounts/accounts-list --name=AccountsList --columns=account_namen,account_type_namen,count*n
    • schematics tfg-common-schematics:tfgdialog

tfgpage

Provide the column names and create a data table.

Example

schematics tfg-common-schematics:tfgpage --dry-run=false --path=output/accounts/accounts-list 

Page Component

Creates a page which:

  • is automatically named componentname-page
  • extends the app-page base component from which all pages inherit
  • injects route, route, app-page etc. deps
  • set up the html for loading, error, content and page header
  • onPageLoad() function for init page data load

tfgdatatable

Provide the column names and create a data table.

Example

schematics tfg-common-schematics:tfgdatatable --dry-run=false --path=output/accounts/accounts-list --name=AccountsList --columns=account_name*n,account_type_name*n,count*n

Displayed Columns

Provide a list of column names, along with if you wish to enable sorting. By default this column will show the property of this name on the element.

--columns=account_name*y,account_type_name*y,count*y

This will create the cell below Account Name

<ng-container matColumnDef="account_name">
  <th mat-header-cell *matHeaderCellDef  mat-sort-header>Account Name</th>
  <td mat-cell *matCellDef="let element">
    <span class='tfg-table-td'>
      {{ element.account_name }} 
    </span>
  </td>
</ng-container>

Column sorting

When providing the column names like above, you can enable sorting by providing column_name*enable_sorting e.g. account_name*y

A sorting function (shown below) is provided:

sortAccountsListTableData(sort:any){
    this.accounts_list_sort_by = sort.active;
    this.accounts_list_sort_direction = sort.direction;
    this.loadAccountsListTableData();
}

This will use the column name e.g. matColumnDef="account_name" to sort the data by on the request e.g. ?sortBy=account_name. If you require a more specialist case then you must configure this manually.

Load Data

Data is loaded into the table using the function provided below. You can add this to your initPageLoad() to require the table data to have been loaded before displaying your page.

Best used when passing a query into a tfgLoadData() function, which will remove any null or undefined values, (e.g. sortBy, sortDirection when first load).

// Load table data using the function below, 
// List this in your initPageLoad() function to load data when the page first loads

loadAccountsListTableData(){

    this.dataService.loadDemo({
        sortBy: this.accounts_list_sort_by,
        sortDirection: this.accounts_list_sort_direction,
        limit: this.accounts_list_table_limit,
        page: this.accounts_list_table_current_page
    }).then(data=>{

      this.accounts_list_table_rows = data['data'];
      this.accounts_list_table_limit = data['limit'];
      this.accounts_list_table_count = data['count'];
      this.accounts_list_table_current_page = data['page'];

    })
    
})

Query parameter

When updating the filters on a table e.g. orderBy, we would ideally like to update the query parameters, as this allows for the page state to be saved/shared.

When a filter component is changed, this updates the query parameters.

Component state change => Query param update => Update 

Publish an update

  1. Update package version 0.0.4 -> 0.0.5
    • npm version patch
  2. Run the following to complie
    • npm run build
  3. Run the following to publish changes
    • npm publish