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

gm.calendar2

v1.0.0-rc.0

Published

Set of Angular components to display day, week, and month calendars with events.

Downloads

3

Readme

gm.calendar2

Set of Angular components to display day, week, and month calendars with events.

npm version

Components

gm-month-view

Displays a month view calendar.

<gm-month-view [date]="date" [items]="items"></gm-month-view>

Inputs

date: Date

Sets the month displayed by the component based on the month and year.

items: { title: string, date: Date }[]

Sets the items displayed on the calendar.

Styles

.gm-different-month

Used to distinguish between dates in a different month than the one displayed. Set this in the global styles of your application.

/* Give dates in a different month a slightly gray background */
.gm-different-month {
  background-color: #eee;
}

gm-day-view-container

Displays the times of day and their demarcation lines. Place your gm-day-view components in one of these.

<gm-day-view-container [scrollToHour]="firstHourToShow"></gm-day-view-container>

Inputs

scrollToHour: number

The hour of the day to scroll to, from 0-23. Only works if the parent element of gm-day-view-container has a height smaller than gm-day-view-container and has its overflow style set to something other than visible.

gm-all-day-view-container

A container element to hold gm-day-view components with events that last all day. Should be placed in an element with a specific height set.

<gm-all-day-view-container></gm-day-view-container>

Styles

.gm-day-view-spacer

This element pushes the gm-day-view components to make room for the time-of-day labels. You can set your own style rules to change the width.

gm-day-view

Shows a day view with events spanning their startTime and endTime properties.

<gm-day-view [isToday]="isToday"></gm-day-view>

Inputs

isToday: boolean

Determines if the component should render a line designating the current time.

gm-event-view

Placed inside gm-day-view elements to display the event details.

In order for these items to be positioned properly, they must implement the GmEventItem interface, and you must pass your array of events to eventItemsToDayViewItems, which is exported by the main module.

eventItemsToDayViewItems analyzes the event items to find overlaps in their start and end times so that they can be arranged adjacently.

...
import { GmDayViewItem,
         eventItemsToDayViewItems } from 'gm.calendar2'

@Component
...
  items: GmDayViewItem[] = eventItemsToDayViewItems([
    {
      title: 'My Event',
      startTime: {
        hours: 12,
        minutes: 00
      },
      endTime: {
        hours: 12,
        minutes: 30
      }
    }
  ]);
...
<gm-event-view *ngFor="let item of items" [item]="item">
  {{item.title}}
</gm-event-view>

These items have no style by default.

Inputs

item: GmDayViewItem

An item returned by eventItemsToDayViewItems.

Styles

.gm-cal-item

This element holds whatever you put inside <gm-event-view>. You should set style rules for this class in your application global stylesheet.

Development

Development server

Run ng serve to run the example app. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

Code scaffolding

Run ng generate component component-name to generate a new component. You can also use ng generate directive/pipe/service/class/module.

Build

Run npm run build to build the project. The build artifacts will be stored in the dist/ directory.

Running unit tests

Run ng test to execute the unit tests via Karma.

Running end-to-end tests

Run ng e2e to execute the end-to-end tests via Protractor. Before running the tests make sure you are serving the app via ng serve.

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI README.