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-dynamic-form

v1.0.12

Published

We noticed that for projects like a portal / dashboard developers need to create several forms again and again. So we thought of something that could make it much more easier and leaving our html code cleaner and we came up with this. This library takes i

Downloads

60

Readme

ngx-dynamic-form

We noticed that for projects like a portal / dashboard developers need to create several forms again and again. So we thought of something that could make it much more easier and leaving our html code cleaner and we came up with this. This library takes in a json file and gives you a form, so you dont need to create any forms in your projects anymore

Installation

To install this library, run:

$ npm install ngx-dynamic-form --save

You can use any css framework or your own css with this just put in the right divClass and class and you are good to go, but if you are using the datepicker or timepicker it would be advisable to use boostrap 4 but isn't compulsory.

This library presently supports

input (type can be changed in inputType field)
radio
select (from and array `option` and you can also pass in an enum - see example)
textarea
date
timepicker
button
file

if you think we missed something please buzz us on github.

Consuming this library

First you have to install

 npm install @ng-bootstrap/[email protected] --save

You can import this library in any Angular application from your Angular AppModule:

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';

// Import the library
import { DynamicFormModule } from 'ngx-dynamic-form';
import { CommonModule } from '@angular/common';
 

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
   CommonModule,
    BrowserModule,
    DynamicFormModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

Once your library is imported, you can use its components in your Angular application:

<!-- You can now use your library component in app.component.html -->
<h1>
  {{title}}
</h1>
 <dynamic-form #dynamicFormName='dynamicForm' [config]='dynamicFormConfig' (submit)='doSomethingCool($event)'></dynamic-form>

In your app.component.ts file you can now create your config please note that all the css for labelClass, divClass and class should be written in css that is called in the html of imported in style.css(.scss).

import { Component } from '@angular/core';
import { Validators } from '@angular/forms';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  foodList= ['Jollof Rice', 'Garri', 'Yam', 'Beans'];
  title = 'app';

  dynamicFormConfig = [
    {
      type: 'input',
      divClass: 'col-lg-6',
      label: 'Hello type ',
      labelClass: 'label label-danger',
      class: 'form-control',
      name: 'query',
      inputType: 'text',
      placeholder: 'Upload Anything',
      validation: [Validators.required]
    },
    {
      type: 'input',
      divClass: 'col-lg-6',
      label: 'Hello type ',
      labelClass: 'label label-danger',
      class: 'form-control',
      name: 'password',
      inputType: 'text',
      placeholder: 'Upload Anything',
      validation: [Validators.required]
    },
    {
      type: 'textarea',
      divClass: 'col-lg-6',
      label: 'Hello type ',
      labelClass: 'label label-danger',
      class: 'form-control',
      name: 'test',
      cols: 8,
      rows: 4,
      placeholder: 'Upload Anything',
      validation: [Validators.required]
    },
    {
      type: 'input',
      divClass: 'col-lg-6',
      label: 'Hello type End',
      labelClass: 'label label-danger',
      class: 'form-control',
      name: 'confirmPassword',
      inputType: 'text',
      placeholder: 'Upload Anything',
      validation: [Validators.required]
    },
    {
      type: 'date',
      divClass: 'col-lg-6',
      label: 'Select date',
      labelClass: 'label label-danger',
      class: 'form-control',
      name: 'date',
      validation: [Validators.required]
    },
    {
      type: 'date',
      divClass: 'col-lg-6',
      label: 'Select date(Min date to 17th Feb, 2019)',
      labelClass: 'label label-danger',
      class: 'form-control',
      minDate: '{year: 2019, month: 3, day:17}',
      name: 'datemin',
      validation: [Validators.required]
    },
    {
      type: 'timepicker',
      divClass: 'col-lg-6',
      label: 'Select Time',
      labelClass: 'label label-danger',
      class: 'form-control',
      name: 'time',
      validation: [Validators.required]
    },
    {
      type: 'timepicker',
      divClass: 'col-lg-6',
      label: 'Select Time',
      labelClass: 'label label-danger',
      class: 'form-control',
      meridian: true,
      name: 'time',
      validation: [Validators.required]
    },
    {
      type: 'date',
      divClass: 'col-lg-6',
      label: 'Select date',
      labelClass: 'label label-danger',
      class: 'form-control',
      name: 'date1',
      validation: [Validators.required]
    },
    {
      type: 'radio',
      divClass: 'col-lg-6',
      label: 'Choose Your Fav',
      options: this.foodList,
      class: 'form-control',
      name: 'food',
      inputType: 'text',
    },
    {
      type: 'select',
      divClass: 'col-lg-5',
      enum: Color,
      label: 'Favorite Color',
      class: 'form-control',
      name: 'mno',
      inputType: 'text',
      placeholder: 'Choose MNO '
    },
    {
      type: 'file',
      divClass: 'col-lg-5',
      label: 'Upload File',
      class: 'form-control',
      name: 'upload',
      placeholder: 'Upload Anything'
    },
    {
      type: 'button',
      divClass: 'col-lg-12',
      label: 'Clicking this means you agree agree with our terms and condition',
      labelClass: 'pad-20',
      text: 'Search',
      inputType: 'submit',
      class: 'btn btn-dcb-info',
      name: 'submit',
    }
  ];

  doSomethingCool(model: any) {
    console.log(model);
  }
}

export enum Color {
  'Blue','Pink','Red','Yellow'
};

Development

To generate all *.js, *.d.ts and *.metadata.json files:

$ npm run build

To lint all *.ts files:

$ npm run lint

License

© Terragon Tech