Sing App Angular v4.4.1

  1. Charts
  2. Forms
  3. UI
  4. Grid
  5. Maps
  6. Tables

Angular 5 version based on the angular-cli. So if you want to add any lib in the bundle, just put PATH to this lib in angular-cli.json. JQuery should always be the first. Example:

scripts: [
    "../node_modules/jquery/dist/jquery.js", 
    ..., 
    "../node_modules/jquery-flot/jquery.flot.js", 
    ...
]

For the most components directives are used. Learn more about directives Available directives/components:

  • Dropzone - an open source library that provides drag’n’drop file uploads with image previews.
  • Flot - a pure JavaScript plotting library for jQuery.
  • Morris - the library that powers the graphs.
  • nvd3 - this project is an attempt to build re-usable charts and chart components for d3.js
  • Rickshaw - a toolkit for creating interactive real-time graphs.
  • Sparkline - this plugin generates sparklines (small inline charts) directly in the browser.
  • Wizard - this Twitter Bootstrap plugin builds a wizard using a formatted tabbable structure

Charts

Flot Charts

Built with Flot JS. Add this in angular-cli.json to add lib in a bundle. Required libs:

<
PATHS: "../node_modules/jquery-flot/jquery.flot.js",
       "../node_modules/jquery-flot/jquery.flot.time.js",
       "../node_modules/jquery.flot.animator/jquery.flot.animator.min.js"
<div id="flot-main" flot-chart-animator
    [data]="[{label: 'Traffic', data: data3, lines: {fill: .3, lineWidth: 0}, color: '#ccc'},
             {label: 'Traffic', data: data1, animator: {steps: 60, duration: 1000, start:0}},
             {lines: {lineWidth:2}, shadowSize:0, color: '#F7553F'}]"
>
</div>

Flot Bars

Same as Flot Charts built with Flot. A bit different dependencies:

PATHS: "../node_modules/jquery-flot/jquery.flot.js",
       "../node_modules/jquery-flot/jquery.flot.time.js",
       "../node_modules/jquery.flot.animator/jquery.flot.animator.min.js"

Interactive Sparklines

Built with jqeruy.sparkline.

PATH: "../node_modules/jquery-sparkline/jquery.sparkline.min.js"
<div class="sparkline" jq-sparkline 
    [data]="[9,12,14,15,10,14,20]" 
    [options] = "{type: 'bar', barColor: '#f0b518', height: '30px', barWidth: 6, barSpacing: 2}">
</div>

Sparkline Pie Charts

Same as interactive sparklines based on jqeruy.sparkline.

PATH: "../node_modules/jquery-sparkline/jquery.sparkline.min.js"

Rickshaw

Realtime chart is based on Rickshaw realtime example.

D3 charts

These charts are based on amazing D3.js library. Here is what D3 says about itself:

D3.js is a JavaScript library for manipulating documents based on data. D3 helps you bring data to life using HTML, SVG and CSS. D3’s emphasis on web standards gives you the full capabilities of modern browsers without tying yourself to a proprietary framework, combining powerful visualization components and a data-driven approach to DOM manipulation.

So it means that graphs are drawn with standard SVG and styled with CSS. You can customize all you like with techniques you already know.

There are two libraries used in Sing App which work on top of D3.js:

PATHS: "../node_modules/d3/d3.min.js",
       "../node_modules/nvd3/build/nv.d3.min.js"

Morris Charts

Built with Morris JS.

PATHS: "../node_modules/webpack-raphael/raphael-min.js",
       "../node_modules/morris.js/morris.js"

Easy Pie Charts

Built with Easy Pie Chart.

PATH: "../node_modules/easy-pie-chart/dist/jquery.easypiechart.js"

Form Elements

Ngx-bootstrap is used for all bootstrap components in Sing App.

Use the .form-inline class to display a series of labels, form controls, and buttons on a single horizontal row.

Code example:

<form class="form-inline">
    <div class="form-group">
        <label for="formGroupExampleInput">Example label</label>
        <input type="text" class="form-control" id="formGroupExampleInput" placeholder="Example input">
    </div>
    <div class="form-group">
        <label for="formGroupExampleInput2">Another label</label>
        <input type="text" class="form-control" id="formGroupExampleInput2" placeholder="Another input">
    </div>
</form>

Inputs

Bootstrap styles input by default, so there is no need to add any classes to inputs. Just use them. Don't forget to include input type.

Bootstrap has a great documentation about forms.

Input Sizing

Any input can be sized by adding .col-*-* class. For vertical sizing .form-control-lg and .form-control-sm are available.

Prepended and appended inputs

Again Bootstrap helps. It has everything we need to prepend and append inputs.

Textareas

Auto-growing textarea uses ng-autosize directive to increase area size dynamically. Imports:

import { Autosize } from 'ng-autosize';

Wysiwyg editor is based on Tinymce. Imports:

import { EditorModule } from '@tinymce/tinymce-angular';

Markdown editor. Code example:

<textarea class="form-control" id="markdown-editor" data-provide="markdown" rows="6">
    ### Hello there
</textarea>

Selects

Two different type of selects avaiables in Sing template:

Imports:

import { Select2Module } from 'ng2-select2';
PATH: "../node_modules/bootstrap-select/dist/js/bootstrap-select.js"

Checkboxes and Radio

To style default checkboxes and radio buttons Awesome Bootstrap Checkbox library is used. This lib was written specially for Sing, so in case you find some bugs or want some features - let us know.

Usage:

<div class="form-check abc-checkbox">
    <input class="form-check-input" id="checkbox1" type="checkbox">
    <label class="form-check-label" for="checkbox1">
        Default
    </label>
</div>

Button-like checkboxes

Bootstrap has a great api to handle button states - bootstrap buttons, so using it to imitate checkbox or radio buttons.

iOS-like switches

Usage example:

<div class="display-inline-block checkbox-ios">
    <label class="form-check-label" for="checkbox-ios1" class="switch">
        <input class="form-check-input" type="checkbox" class="ios" checked id="checkbox-ios1"><i></i>
    </label>
</div>

Pickers

Any field may have either ng2-datetime or Colorpicker attached. Required files:

import { NKDatetimeModule } from 'ng2-datetime/ng2-datetime';
PATHS: "../node_modules/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js",
       "../node_modules/bootstrap-timepicker/js/bootstrap-timepicker.min.js",
       "../node_modules/bootstrap-colorpicker/dist/js/bootstrap-colorpicker.min.js"

Masked Inputs

To make any input accept only formatted values there is a great package to use - angular2-text-mask. Imports:

import { TextMaskModule } from 'angular2-text-mask';

Sliders

Sing sliders are styled version of Bootstrap Slider plugin.

PATH: "../node_modules/bootstrap-slider/dist/bootstrap-slider.js"

Simple file uploads

Code example:

<div class="fileinput fileinput-new input-group" data-provides="fileinput">
    <div class="form-control" data-trigger="fileinput">
        <i class="glyphicon glyphicon-file fileinput-exists"></i>
        <span class="fileinput-filename"></span>
    </div>
    <span class="input-group-addon btn btn-default btn-file">
        <span class="fileinput-new">Select file</span>
        <span class="fileinput-exists">Change</span>
        <input name="..." type="file">
    </span>
    <a href="#" class="input-group-addon btn btn-default fileinput-exists" data-dismiss="fileinput">Remove</a>
</div>

Dropzone

Dead simple file upload plugin with image preview Dropzone.

PATH: "../node_modules/dropzone/dist/dropzone.js"

Validation

Sing App uses really great validation plugin - parsley.js. It's better to let it say itself:

Javascript forms validation. Powerful, UX aware & Dead simple. Never write a single javascript line anymore to validate your forms FrontEnd. Parsley will do that for you – and do it right –, thanks to its powerful DOM-API !

To activate it you need to add data-validate="parsley" to your form to make it work. That's it.

If you want to add step-by-step validation with wizard please check this guide.

PATH: "../node_modules/parsleyjs/dist/parsley.js"

Wizard

Twitter Bootstrap Wizard Plugin is used to build wizard-enabled widget.

This twitter bootstrap plugin builds a wizard out of a formatter tabbable structure. It allows to build a wizard functionality using buttons to go through the different wizard steps and using events allows to hook into each step individually.

To activate it you need to call bootstrap-wizard directive on your markup to create wizard.

If you want to add step-by-step wizard validation please check this guide.

<
PATH: "../node_modules/twitter-bootstrap-wizard/jquery.bootstrap.wizard.js"

Example Markup:

<div bootstrap-wizard data-height="444" class="form-wizard">
    <ul class="flex-md-row flex-column mb-sm nav nav-pills nav-fill">
        <li class="nav-item">
            <a class="nav-link" href="#tab1" data-toggle="tab">First</a>
        </li>
        <li class="nav-item">
            <a class="nav-link" href="#tab2" data-toggle="tab">Second</a>
        </li>
    </ul>
    <div class="bg-gray-lighter progress progress-xs">
        <div id="bar" class="progress-bar progress-xs progress-bar-gray-light" style="width: 50%;"></div>
    </div>
    <div class="tab-content">
        <div class="tab-pane bg-gray-lighter" id="tab1">
        <form action='' method="POST"
            data-parsley-priority-enabled="false"
            novalidate="novalidate">
            <fieldset>
                form fields
            </fieldset>
        </form>
        </div>
        <div class="tab-pane bg-gray-lighter" id="tab2">
            other inputs goes here
        </div>
    </div>
</div>

Application Wizard

Bootstrap Application Wizard is a ready to use wizard component with simple install process. You don't even need to have any special markup to instantiate it.

PATH: "../node_modules/bootstrap-application-wizard/src/bootstrap-wizard.js"

Components

This page contain Sing-y styled versions of Bootstrap Alerts, Labels, Tooltips, Popovers, Modals and Progress Bars. All styles are in bootstrap-override.scss.

For progress bars there is a small Sing extension which allows you to change progress bars sizes: .progress-sm, .progress-xs.

Notifications

Sing App uses HubSpot's Messenger library. It's a client-side growl-like notifications with actions and auto-retry.

Read more at Messenger website.

Font Awesome Icons

Font Awesome is iconic font originally designed for Bootstrap (Font Awesome works great with all frameworks). It contains 439 icons in pictographic font form.

Read more at Font Awesome website.

Glyphicons Icons

200 icons in pictographic font form provided by Glyphicons.

Buttons

To create button you can style any html element with .btn class. Sing App replaces default bootstrap colors with theme specific and adds two more: .btn-gray and .btn-inverse.

You can read more at ngx-bootstrap Buttons page.

Tabs

Tabs component may be placed both inside of .widget element or directly into main .content.

Originally Bootstrap has an option to put tabs on left and right. In Bootstrap 3 this feature was removed. We here think it was a pretty usable component, so Sing App keeps it:

<div>
    <tabset>
        <tab heading="Basic title" id="tab1">Basic content</tab>
        <tab heading="Basic Title 1">Basic content 1</tab>
        <tab heading="Basic Title 2>Basic content 2</tab>
    </tabset>
</div>

For more info check ngx-bootstrap Tabs.

Accordion

Same as Tabs Accordion may be placed both as a widget inside .content or inside of .widget. Sing's accordion is a styled version of ngx-bootstrap Collapse component.

Grouped Lists

Sing App grouped lists is a styled version of jQuery UI Sortable component.

List Groups

This nestable draggable lists are built with jQuery based lib - Nestable.

Grid System

Sing App inherits 12-column grid system from Bootstrap's great one.

Widget Controls

For one of our previous works we have developed a custom jquery plugin called Widgster which provides an easy way to handle basic widget functions like collapsing, closing, ajax-refreshing & fullsreening.

Plugin is open-sourced. Check out Widgster repository.

To apply all these features to your default widget you have to add appropriate links (or buttons) to it:

<section class="widget" widget>
<header>
    <h6>
        Alert <span class="fw-semi-bold">Messages</span>
    </h6>
    <div class="widget-controls">
        <a href="#"><i class="glyphicon glyphicon-cog"v</i></a>
        <a href="#"><i class="fa fa-refresh"></i></a>
        <a href="#" data-widgster="close"><i class="glyphicon glyphicon-remove"></i></a>
    </div>
</header>
<div class="widget-body clearfix">
    <h3>Small <span class="fw-semi-bold">Elements</span></h3>
    <p class="mb-lg">Some content</p>
</div>
</section>

In the example above links are put into a .widget-controls but you can put them anywhere inside of widget.

Then widgster needs to be initialized via widget directtive and code:

$('.widget').widgster();

As you could guess data-widgster attribute defines widget action to be performed when link is clicked.

Options

Widgster accepts an object with options:

$('.widget').widgster({
    collapsed: true
});

Actions

All actions may be called via js:

$('.widget').widgster('close');

Events

Each action fires both before and after event. Events have the same names as actions. Before event may be canceled.

For example, to make refresh button spin:

$('.widget').on("load.widgster", function(){
    $(this).find('[data-widgster="load"] > i').addClass('fa-spin')
}).on("loaded.widgster", function(){
    $(this).find('[data-widgster="load"] > i').removeClass('fa-spin')
});

Google maps

To embed Google Maps into Sing App great package is used - AGM.

Vector maps

Sometimes you need to use just simplified version of map. Jvectormap does a great job in such cases.

PATHS: "../node_modules/jvectormap/jquery-jvectormap.min.js",
       "../node_modules/jvectormap-world/jquery-jvectormap-world-mill-en.js"

Static Tables

Sing App tables are based on Bootstrap tables with additional styling.

Sing introduces two new table classes .table-sm and .table-lg for decreased and increased table paddings accordingly.

Also, don't forget about .table-responsive class which adds horizontal scrollbar to tables for small screens.

Overflow Table

Add any non-bordered .table within a widget for a seamless design. Awesome look for no cost. Just wrap the table with simple css class .widget-table-overflow inside of widget:

<table class="table table-sm">
<thead>
    <tr>
        <th>#</th>
        <th>First Name</th>
        <th>Username</th>
    </tr>
</thead>
<tbody>
    <tr>
        <th scope="row">1</th>
        <td>Mark<td>
        <td>@mdo</td>
    </tr>
    <tr>
        <th scope="row">2</th>
        <td>Jacob</td>
        <td>@fat</td>
    </tr>
    <tr>
        <th scope="row">3</th>
        <td>Larry</td>
        <td>@twitter</td>
    </tr>
</tbody>

Dynamic Tables

Dynamic tables built with angular2-datatables and ng2-table