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

stencil-datatable-component

v1.0.2

Published

SkyboxCheckout Stencil Datatable Component

Downloads

2

Readme

Skybox Datatable Stencil Component

This is a component built using Stencil. Has a responsive design will automatically adjust the visibility of columns in the table so the the layout of information is nicely presented, regardless of screen size. The generated by Stencil is a standard web component, this can be used in any type of application, use JavaScript framework or not.

Getting Started

To start clone this repo to a new directory:

git clone [email protected]:skylogistics/skbx-datatable-component.git
cd my-component
git remote rm origin

and run:

npm install
npm start
npm start --es5

To build the component for production, run:

npm run build
npm run build --es5

Using this component

Script tag

You can:

  • Put a script tag similar to this <script src='https://www.npmjs.com/package/@skyboxcheckout/[email protected]/dist/stencil-datatable-component.js'></script> in the head of your index.html
  • Then you can use the element anywhere in your template, JSX, html etc

Node Modules

  • Run npm i @skyboxcheckout/stencil-datatable-component --save
  • Put a script tag similar to this <script src='node_modules/stencil-datatable-component/dist/stencil-datatable-component.js'></script> in the head of your index.html
  • Then you can use the element anywhere in your template, JSX, html etc

In a stencil app

  • Run npm install @skyboxcheckout/stencil-datatable-component --save
  • Add an import to the npm packages import stencil-datatable-component;
  • Then you can use the element anywhere in your template, JSX, html etc

Integration into a project without a framework

  • Download the stencil-datatable-component dependency as zip
  • Copy the dist folder in the path of the project that will use it
  • Import script similar to this <script src='./dist/stencil-datatable-component.js'></script> in the head of your index.html
  • Then you can use the element anywhere in your template
<html>
  <head> 
    <script src='./dist/stencil-datatable-component.js'></script>
  </head>
  <body>
    <div>
      <stencil-datatable-component />
    </div>

    <script>
      var myComponent = document.querySelector('stencil-datatable-component');

      myComponent.addEventListener("clickedCallback", function(a) {
        console.log(a.detail);
      });
    </script>
  </body>
</html>

Integration into a project with ReactJS

  • Run npm install @skyboxcheckout/stencil-datatable-component --save
  • Add an import to the npm packages import stencil-datatable-component;. To include the component library in the React project you must edit the index.js file of your React project to add the import and call to defineCustomElements (window). The file would look like this:
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
 
import { defineCustomElements } from 'stencil-datatable-component/dist/loader';
 
ReactDOM.render(<App />, document.getElementById('root'));
 
defineCustomElements(window);
  • Then you must modify the App.js file to use our stencil-datatable-component
import ReactDOM from 'react-dom';
import Greeting from './Greeting';
import Clock from './Clock';
 
class App extends Component {
  constructor(props) {
    super(props);
    this.state = {value: ''};
    this.clickedCallback = this.clickedCallback.bind(this);
  }
 
  clickedCallback(e) {
    this.setState({
      value: e.detail
    });
  }
 
  componentDidMount() {
    this.refs['stencildatatable'].addEventListener('clickedCallback', this.clickedCallback);
  }
 
  render() {
    return (
      <div className="App">
        <stencil-datatable-component ref="stencildatatable" />
      </div>
   );
  }
}
 
export default App;
  • Then you can use the element anywhere in your template, JSX, html etc

Integration into a project with Angular

  • Run npm install @skyboxcheckout/stencil-datatable-component --save
  • Add an import to the npm packages import stencil-datatable-component;
  • Now we edit the angular.json file to include our library in the assets section and it can be accessible from the index.html.
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
    "src/favicon.ico",
    "src/assets",
    { "glob": "**/*", "input": "./node_modules/stencil-datatable-component", "output": "/stencil-datatable-component/" }
],
"styles": [
     "src/styles.css"
],
  • Edit the index.html file to add the reference to our "head" library:
<script src="stencil-datatable-component/dist/stencil-datatable-component.js"></script>
  • In this way we can use our library both inside and outside the scope of Angular. But if we want to use it within the scope of Angular, we have to tell the framwork that we are using labels that he does not know and that, please, admit it and show no errors. To do this within the AppModule of the application we add the following schema:
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
 
@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule
  ],
  providers: [],
  bootstrap: [AppComponent],
  schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class AppModule { }
  • Now we can edit the app.component.html file to add our color-picker which can be treated as an Angular component more where the inputs are binded with [] and the events are handled with ().
  <stencil-datatable-component (clickedCallback)="handleClickedCallback($event)"></stencil-datatable-component>
  • It is essential that the information is passed with $ event and in the detail of that object travels what is emitted from the StencilJS component.

Properties

| Property | Attribute | Description | Type | Default | | ------------- | ------------- | ----------- | -------- | ----------- | | data | data | | any | undefined | | headers | headers | | any | undefined | | maxheight | maxheight | | string | undefined | | maxrowspage | maxrowspage | | any | undefined | | paging | paging | | any | undefined | | searching | searching | | any | undefined |

Events

| Event | Description | Type | | ----------------- | ----------- | ------------------ | | clickedCallback | | CustomEvent<any> |

Show more information about proeprties in https://bitbucket.org/skylogistics/skbx-datatable-component/src/master/CHANGELOG.md