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

pm-calendar

v2.0.2

Published

A Calendar for angular

Downloads

2

Readme

PM-CALENDAR

This is a simple style customizable calendar for angular :

Installation

  • npm install pm-calendar
  • Import PmCalendarModule in app.module.ts :
import { PmCalendarModule } from 'pm-calendar';
//...
//...
@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    PmCalendarModule //Load module here
  ],
  providers: [],
  bootstrap: [AppComponent]
})

Usage

Template html

The component model is :

<pm-calendar [datestart]="datestart" [dateend]="dateend" ></pm-calendar>

Parameters :

  • datestart: Date - First month's date to display
  • dateend: Date - Last month's date to display
  • lang: string (Optionnal) - The calendar lang to display ( Default: "fr" )
Languages :

Language list is available and editable in ./class/CalendarLang.ts as the default lang ( DEFAULT_LANG )

Component ts

You can use the CalendarService to access calendar's events :

import { CalendarService } from './pm-calendar/services/calendar.service';
//...
//...
constructor( private calendarService: CalendarService ){ //...

Available event :

  • onDateSelected( method: Function ): void
  • onCalendarReady( method: Function ): void

Available method :

  • getDay( date: Date, disabled?: boolean ): DayCalendar
  • getDaysInInterval( datestart: Date, dateend: Date ): DayCalendar[]
import { CalendarService } from './pm-calendar/services/calendar.service';
import { DayCalendar } from './pm-calendar/class/DayCalendar';
//...
//...
constructor( private calendarService: CalendarService ){

	this.calendarService.onDateSelected( ( day: DayCalendar ) => {
	    console.log( day );
    });
    
    this.calendarService.onCalendarReady( () => {

        //get the day corresponding to the searchedDate and add class test to it
        let day: DayCalendar | false = this.calendarService.getDay( new Date(2017, 9, 30) );
        if( day ){
            ( day as DayCalendar ).addClass("test");
        }

         //get the days corresponding to the interval and add class test to them
         let start: Date = new Date(2017, 4, 30);
         let end: Date = new Date( 2017, 5, 2 );
         let searchs: DayCalendar[] = this.calendarService.getDaysInInterval( start, end );
         for( let search of searchs ){
                if( search.getWeekNumber() > -1 ){
                    search.addClass("test");
                }
         }
    } )
}

The returned class ( DayCalendar ) has the current method :

  • getClasses(): string[]
  • setClasses( classes: string[] ): void
  • addClass(): void
  • removeClass(): void
  • getObjDate(): Date
  • getWeekNumber(): number
day.addClass("test"); //Add the 'test' class to the day's div
day.removeClass("test"); //Remove the 'test' class to the day's div
day.getObjDate(); //Return corresponding Date object
day.getWeekNumber(); //Return day's week current index in the month
day.getClasses(); //Return the class'list of day's div
day.setClasses(["test", "disabled"]); //Set the class list through an array

Leave the component

Remove the linked events

export class AppComponent implements OnDestroy {
//...
//...
ngOnDestroy(){
	this.calendarService.clearEvents();
}

Styles

All styles are editables :

  • ./calendar/component.calendar.css
  • ./calendar/component.week.css
  • ./calendar/component.day.css // File for style the class managed via day.addClass / day.removeCass ...ect.

Care, much css styles are here for the calendar's table aspect :

/* calendar's "table" aspect */
.dhead {
    display: flex;
}
.dhcol {
    width: 100px;
}
.drow {
    display: flex;
}
.dcol {
    width: 100px;
}
/* jours désactivés */
.dcol.disabled {
    background-color: grey;
}