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

devextreme-dynamic-form

v1.1.1

Published

devextrem-dynamic-form is library build for angular applications that helps to build and generate forms using un simple class and some decorators

Downloads

37

Readme

devextrem-dynamic-form

devextrem-dynamic-form is library build for angular applications that helps to build and generate forms using un simple class and some decorators

generated dynamic form

Installation

The package can be installed via NPM : npm install --save devextreme-dynamic-form

Devextrem project

If you are already using devextreme in your angular project, you don't need to add anything, just install it and enjoy it

Devextreme don't configured yet

if you are not using devextreme in your angular project, you have to add those two dependencies : npm install --save devextreme devextreme-angular

then, in your angular.json (angular-cli.json), add the dx.common.cssand the theme you want to use, for example :

{ 
  ... 
  "apps": [ 
    { 
      ... 
      "styles": [ 
        ...
        "../node_modules/devextreme/dist/css/dx.common.css", 
        "../node_modules/devextreme/dist/css/dx.light.css", 
        "styles.css" 
      ], 
      ... 
      } 
    } 
  ], 
... 
} 

You will need to also to add this in your tsconfig.json

"compilerOptions": {
    ...
    "paths": {
        "jszip": [
            "node_modules/jszip/dist/jszip.min.js"
        ]
    }
}

Configuration

. In order to use this component, you need first to import DxDynamicFormrmModule in your app.module, or the module that will be holding this component :

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

. Create a class, for example Test and decorate all your attributes with annotations (decorators):

import {FormDeco,FormTypes,SectionForm} from "devextreme-dynamic-form";

export class Test {

    @SectionForm("Secion1")
    section;

    @FormDeco({
        label : "text Area",
        type : FormTypes.TEXTAREA,
        defaultValue : ""
    })
    firstField;

    @FormDeco({
        label : "select multiple choice",
        type : FormTypes.SELECT,
        datas : [{value : 0, text : "devextreme"},{value : 1, text : "devextreme-angular"},{value : 2, text : "devextreme-dynamic-form"}],
        required : true,
        multiple : true,
        defaultValue : [0,1]
    })
    secondField;

    @FormDeco({
        label : "select an email",
        type : FormTypes.INPUT,
        required : true,
        isEmail : true,
        isEmailErrorString : "please enter a valid email!",
        lengthString : true,
        max :10,
        lengthErrorString : "email too long !!"
    })
    theirdFild;

    @SectionForm("Seciont2")
    section1;

    @FormDeco({
        label : "Radio groupe",
        type : FormTypes.RADIO,
        datas : [{value : 0, text : "devextreme"},{value : 1, text : "devextreme-angular"},{value : 2, text : "devextreme-dynamic-form"}],
        defaultValue : 2
    })
    fourthField;

    @FormDeco({
        label : "Date selector",
        type : FormTypes.DATE,
        defaultValue: new Date(),
        required : true
    })
    fifthField;

    @FormDeco({
        label : "Number selector",
        type : FormTypes.CHEKBOX,
        min : 3, // if not given, no min is considered
        step : 0.1 //default 1
    })
    sixthField;
}

And create a ts file where you export all classes from witch you want to generate a form, lets call it handler.ts, in our case, it will contain only this line:

export {Test} from "./test";

handler.ts will be used to instantiate the forms'classes.

. In your app.component.ts, import DxDynamicFormComponent and handler.ts content :

import * as handler from "./handler";
import { DxDynamicFormComponent } from 'devextreme-dynamic-form';
...
@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  @ViewChild(DxDynamicFormComponent) dxDynamicForm : DxDynamicFormComponent;

  handlerInst = handler;
  ...

}

handlerInstwill be passed as an @Input() param to dx-dynamic-form

. In your app.component.html, just add the selector tag of the library with some input parameters :

<dx-dynamic-form 
    [handlerInstantition]="handlerInst" 
    colNumber="2" 
    width="1200" 
    nameCls="Test">
</dx-dynamic-form >

. Finally, if you wana retreive selected or introduced datas of the form, you have to call generateDataToSend method line this :

this.dxDynamicForm..generateDataToSend();

this method will first check if the form is valid, if it's not, it return an empty array, and display alerts in fields in which there a validation error.

Credits

this project is based on devextreme modules, an incredible cross-platform component containing everything you need to create responsive web apps.

Licence

DevExtreme licensing

EULA licence