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

ng-kux

v1.0.0-alpha.52

Published

Angular Component For ng4. select,scrollbar,datepicker,Infinite Scroll,Pagination

Downloads

63

Readme

NG-KuX UI Component For Angular4

Demo https://coolcross.github.io


Select

In NgModule

import { KuxSelectModule } from 'ng-kux';
@NgModule({
  imports: [
    KuxSelectModule
    ,...
  ],
  declarations: [...]
})
export class SomeModule { }

In Component Template

<kux-select [(ngModel)]="selected" [options]="options"></kux-select>

In Component

export class SomeComponent{

    public selected = -1;
    
    public options:any[]=[
        {
            name: "选择下面一项",
            value: -1
        }, {
            name: "第一项",
            value: 0
        }, {
            name: "第二项",
            value: 1
        }, {
            name: "第三项",
            value: 2
        }, {
            name: "第四项",
            value: 3
        }, {
            name: "第五项",
            value: 4
        }
    ]
}

Optional Parameters

Param | Type | Default | description ------------|---------|---------|------------------- width | string | 205px | select wdith optwdith | string | 205px | option width maxHeight | string | null | option max height placeholder | string | null | you know it disabled | boolean | false | you know it


ScrollBar

In NgModule

import { KuxScrollBarModule } from 'ng-kux';
@NgModule({
  imports: [
    KuxScrollBarModule
    ,...
  ],
  declarations: [...],
  ...
})
export class SomeModule { }

In Component Template

<kux-scrollbar [autoHide]="true">
    ...
</kux-scrollbar>

Optional Parameters

Param | Type | Default | description ---------|---------|---------|-------------------------- autoHide | boolean | true | auto hide x&y scroll bar

In Parant Component You Can...

import { KuxScrollbarComponent } from 'ng-kux';
@Component({...})
export class ParentComponent implements  AfterViewInit {
    @ViewChild(KuxScrollbarComponent) private scrollBox: KuxScrollbarComponent
    constructor() { }
    ngAfterViewInit() {

        this.scrollBox.scrollTop=100;           //set scrollTop 
        console.log(this.scrollBox.scrollTop);  //get scrollTop

        this.scrollBox.scrollLeft=100;          //set scrollLeft
        console.log(this.scrollBox.scrollLeft); //get scrollLeft

        this.scrollBox.isScrollToBottom();      //is scroll box scroll to the bottom
        this.scrollBox.isScrollToRight();       //is scroll box scroll to the right

        this.scrollBox.refresh();               //refresh scroll bar
    }
}

Datepicker

In NgModule

import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { KuxDatepickerModule } from 'ng-kux';
@NgModule({
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
  imports: [
    KuxDatepickerModule
    ,...
  ],
  declarations: [...],
  ...
})
export class SomeModule { }

In Component Template

<kux-datepicker [(ngModel)]="data" [panleFmt]="'yyyy年M月d日'" [fmt]="'yyyy-M-d'" [placement]="['bottom','left']" [min]="min" [max]="max" [step]="3"></kux-datepicker>

Optional Parameters

Param | Type | Default | description ---------|--------|------------|----------------------------- disabled| boolean| false|you know it panleFmt | string | MM/dd/yyyy | format Date on panle fmt | string | MM/dd/yyyy | format Date on form element placement|string | Array|['bottom','left'] | panle placement -bottom | top | left | right min|Date|null|Minimum allowed date for selection max|Date|null|Maximum allowed date for selection step|Number|3|3-pickday 2-pickmonth 1-pickyear


Scroll

infinite scroll component

In NgModule

import { KuxScrollModule } from 'ng-kux'
...

@NgModule({
  imports: [
    KuxScrollModule,
    ...
  ],
  ...
})
export class SomeModule { }

In Component

import { KuxScrollComponent } from 'ng-kux/scroll/scroll.component';
...

@Component({
  templateUrl: './some.html',
  ...
})
export class SomeComponent implements OnInit {
    @ViewChild(KuxScrollComponent) kuxScroll: KuxScrollComponent;
    private AllData:any[] //some big Array
    sync(){
        this.kuxScroll.sync().then(() => {  //synchronize the arr of kuxScroll from AllData
           ...
        })
    }
    ngOnInit() {
        let num = 0;
        this.kuxScroll.getData = (begin, length) => {
            let list = [];
            for (let i = begin; i < begin + length; i++) {
                let item = this.AllData[i];
                if (item !== undefined) {
                    list.push(item)
                }
            }
            return list
        }
    }
}

In Component Template

<kux-scroll>
    <ul>
    <li *ngFor="let item of kuxScroll.displayD" [kux-scroll-item]="item">{{item.name}}</li>
    </ul>
</kux-scroll>

Pagination

In NgModule

import { KuxPaginationModule } from 'ng-kux';
@NgModule({
  imports: [
    CommonModule,
    KuxPaginationModule,
    ....
  ],
  declarations: [...]
})
export class SomeModule { }

In Component Template

<kux-pagination [total]="total" [limit]=50 [page]=0 [max]=5 (onPage)="showEvent($event)"></kux-pagination>

Optional Parameters

Param | Type | Default | description| ---------|--------|------------|----------------------------- total | number | 0 | Total number of items limit | number | 0 | Limit number for pagination size page | number | 0 | Current page number (First Page :0) max | number | 7 | Ellipses