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

ngx-timeline-albe

v1.7.0

Published

Component for rendering timelines from the your data.

Downloads

103

Readme

  • Content HTML highly manipulable.
  • Styles for the template are easily customizable.
  • Simplifies the aspects of internationalization, displaying dates and alternatives texts in a local format.

Version history: | Library | Angular | | ------- | ------- | | Lastet | 18.0.1 | | 1.6.0 | 17.3.0 | | 1.5.0 | 16.0.0 | | 1.4.1 | 15.2.6 | | 1.3.0 | 14.2.0 | | 1.2.11 | 11.2.4 | | 1.2.0 | 10.1.2 | | 1.1.0 | 8.0.0 |

Use license

The component is open source and released for free commercial use at no cost. Donations are welcome.

Installation

$ npm install ngx-timeline-albe

How to use

Import the module

import { NgxTimelineAlbeModule } from 'ngx-timeline-albe';

@NgModule({
    imports: [ NgxTimelineAlbeModule ],
    ...
})
export class AppModule {}

Template

<ngx-timeline [itens]="data"></ngx-timeline>
  • Instance with options:
<ngx-timeline [itens]="data" 
    [formatDate]="'dd MMMM'" 
    [sortDesc]="true"
    [showMenu]="true" 
    [showGroup]="true" 
    [theme]="'basic'">
</ngx-timeline>

Component

import { TimelineItem } from 'ngx-timeline-albe';
  //The Json object is also accepted in string format.
  data: Array<TimelineItem> | String;
ngOnInit() {

    //Object type
    this.data = [
      {
        datetime: new Date('2020-03-29 23:59:59'),
        header: 'Sample of header',
        body: [
          {
            tag: 'h1',
            content: "Lorem ipsum"
          },
          {
            tag: 'p',
            content: 'Lorem ipsum dolor sit amet, nisl lorem, wisi egestas orci tempus class massa.'
          }],
        footer: 'Sample of footer. See <a href=\"https://github.com/Albejr/ngx-timeline\" target=\"_blank\">more details</a>'
      }
    ];

    //OR Json format
    this.data = `[{
      "datetime": "2020-03-29 23:59:59",
      "header": "Sample of header",
      "body": [{
          "tag": "h1",
          "content": "Lorem ipsum"
        },
        {
          "tag": "p",
          "content": "Lorem ipsum dolor sit amet, nisl lorem, wisi egestas orci tempus class massa."
        }
      ],
      "footer": "Sample of footer. See <a href='https://github.com/Albejr/jquery-albe-timeline' target='_blank'>more details</a>"
    }]`;
  }

Options

| Name | | Type | Default | Description | | -------------- | -------- | ---------------------------------- | --------- | ------------------------------------------------------------------------------------------------- | | [itens] | required | Array<TimelineItem> or String Json | [ ] | List of itens to be displayed. | | [showGroup] | optional | Boolean | true | Sets the visibility of the annual grouper. | | [showMenu] | optional | Boolean | true | Sets the anchor menu visibility for annual groupings (depends on 'showGroup'). | | [sortDesc] | optional | Boolean | true | Defines ordering of items, true: Descendente, false: Ascendente. | | [formatDate] | optional | String | 'dd MMMM' | Sets the date display format: 'dd MMMM''dd/MM/yyyy HH:mm:ss''MM/dd/yyyy''yyyy/MM/dd' | | [language] | optional | String | 'pt-BR' | Specifies manually the display language of texts (i18n), if the token LocaleID is not configured. | | [theme] | optional | String | 'basic' | Defines the style: 'basic''horizontal''minimalist''mobile''vertical' |

TimelineItem Type

| Name | | Type | Description | | -------- | -------- | ----------------- | -------------------------- | | datetime | required | Date | | | icon | optional | string | | | header | optional | string | | | body | required | Array<ItemBody> | | | footer | optional | string | |

ItemBody Type

| Name | | Type | Description | | ------- | -------- | -------------- | -------------------------- | | tag | required | string | | | content | required | string | | | attr | optional | TagAttribute | |

TagAttribute Type

| Name | | Type | Description | | -------- | -------- | ------ | -------------------------- | | href | optional | string | | | target | optional | string | | | title | optional | string | | | src | optional | string | | | width | optional | string | | | cssclass | optional | string | |

Html Structure

We'll have a similar result:

<ngx-timeline>
    <div id="timeline-albe" class="clasic">
        <section>
            <header class="group">2020</header>
            <div class="item">
                <div class="badge">
                    <span>29/03</span>
                </div>
                <article>
                    <header>Sample of header</header>
                    <div class="body">
                        <span>2017-03-29 23:59:59</span>
                        <h1>Lorem ipsum</h1>
                        <p>Lorem ipsum dolor sit amet, nisl lorem, wisi egestas orci tempus class massa.</p>
                    </div>
                    <footer>Sample of footer.</footer>
                </article>
                <div class="badge last">
                </div>
            </div>
        </section>
    </div>
<ngx-timeline>

Styling guide

There are several classes that help you to create your custom styles app.component.css

:host ::ng-deep #timeline-albe.minimalist {
  color: inherit;
  font-size: inherit;
  width: inherit;
  margin: 10px;
}

Notes

  • The datetime element must meet the ISO 8601 standard in year-month-day format "yyyy-MM-dd" or "yyyy-MM-dd HH:mm:ss"

Demo App

Follow these instructions to run the demo:

  1. Clone the repository to your local machine
  2. From the project folder, run npm i to install all required dependencies
  3. Run ng b ngx-timeline-albe to build in dist folder.
  4. Run ng s to serve the project from a live-updating server.
  5. Go to localhost:4200 to see the demo site

To do

  • [x] If 'json' (string) is passed, convert to 'object'.
  • [x] Displays default message.
  • [ ] Insert animation.
  • [x] Sort items by date.
  • [x] Multiple languages.
  • [x] Multiple styles.
  • [ ] Document CSS customization.
  • [x] Document 'json' or 'object'.

Inspired on the plug-in: https://github.com/Albejr/jquery-albe-timeline