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

@nys-hcr-its/ngx-data-driven-forms

v15.4.1-beta

Published

A framework for quickly generating web forms from just a simple JSON object.

Downloads

9

Readme

ngx-data-driven-forms

A framework for quickly generating web forms from just a simple JSON object.

Installation

Installation is simple and can be done through Node Package Manager. The library is divided into two major sectors:

  • Core Module (DDFormsCoreModule)
  • Defaults Module (DDFormsDefaultsModule) [has further subdivisions]

To install just run

npm install @nys-hcr-its/ngx-data-driven-forms

This will install the library and its only non-angular dependency (ngx-markdown, used for some text rendering in the Defaults Module).


Basic Setup

The basic framework of this library is provided entirely by the Core Module. This provides the structure and render functions for the library.

All you have to do is import the Core Module in your Base App Module.

Note: Only importing the Core Module will require you to define default renderers.

@NgModule({
  declarations: [
  ],
  imports: [
    BrowserModule,
    ReactiveFormsModule,
    DDFormsCoreModule,
  ],
  providers: [],
  bootstrap: []
})
export class AppModule { }

Including Defaults

In order to get stuff to appear on the page, renderers need to be registered with the libray.

The libary provides an opt-in Module that automatically registers some basic functionality and views. In order to use this library, you will also have import ngx-markdown which is used for text rendering.

Again just import these two modules into your Base App Module.

@NgModule({
  declarations: [
  ],
  imports: [
    BrowserModule,
    ReactiveFormsModule,
    DDFormsCoreModule,
    DDFormsDefaultsModule,
    MarkdownModule.forRoot(),
  ],
  providers: [],
  bootstrap: []
})
export class AppModule { }

This will cause all default renderers to be registered with the library, and allow text to be rendered.

However, in order to fully take advantage of ngx-markdown you will also have to add node_modules/marked/marked.min.js to your app scripts in the angular.json file.

Further plugins, functionality and configuration can be added by following the info at https://www.npmjs.com/package/ngx-markdown#installation

It is recommended that you import these modules in either the module that is using the ddforms library or in a shared library. Importing and using it in a different location can cause race conditions.


Basic Usage

To use data driven forms you have to either start the render engine yourself or use one of our provided entry points.

The entry points are normal Angular components that handle entering the render engine NOTE: They do not manage state! You must handle state yourself.

For the purpose of this documentation we will be using the application entrypoint, which is likely the most common entrypoint you will use.

<ddforms-application-container
  [application]={an application object}
  [control]={a form control in an expected layout}
  [currentPageIndex]={the target page to be shown (you keep track of this)}
>
</ddforms-application-container>

The entrypoint expects three(3) inputs; application, control, and currentPageIndex. These three inputs will be used to render the application using the render engine.

application is an instance of our Application class, which holds your form config and some methods for utility.

  application = new Application({...<your form config here>})

control is an Angular ReactiveForms Form that handles all of our databinding and validation for us. The render engine expects a specific structure which is generated by our handy FormGenerationService

  control = this.formGenerator.buildApplicationControl(<initial value or null>, <an application object>);

currentPageIndex is a number that represents the current page of the application. This is used to determine which page to render. You will have to keep track of this value yourself and update it when the user navigates to a new page.


Styling

Our library is designed to be as unopinionated as possible. This means that by default, it will not provide any styling for you. However, we do provide some basic scss files that you can use to get started. In addition to this, we also provide a few classes that you can use to style your forms. These classes also follow bootstrap conventions, which will allow you to use bootstrap styling if you wish.

To use or basic styles, you can include the following in your angular.json file.

"styles": [
  "node_modules/@nys-hcr-its/ngx-data-driven-forms/styles/default-styles.scss"
],

Further documentation will be available soon. For now, please refer to the demo application for examples of how to use the library.