16.0.6 • Published 6 months ago

@ngx-dynamic-components/core v16.0.6

Weekly downloads
84
License
MIT
Repository
github
Last release
6 months ago

@ngx-dynamic-components/core

NGX Dynamic Components is a configuration based dynamic components library for Angular. That allows you to rapidly create dynamic forms or any other mobile-friendly web layouts.

Any web content can be dynamically rendered from JSON or XML based configuration with a full support of lifecycle hook methods.

@ngx-dynamic-components/core - a core dynamic rendering engine with no dependencies to any external library. It contains all basic HTML components.

Getting started

1. Create Angular project with Angular CLI

2. Add @ngx-dynamic-components/core

npm install @ngx-dynamic-components/core --save

3. Import module

import { DynamicComponentsCoreModule } from '@ngx-dynamic-components/core';
// ...
@NgModule({
  // ...
  imports: [
    // ...
    DynamicComponentsCoreModule
  ],
  ...
})
export class AppModule { }

4. Create a simple component. Same as Contact Form here ...

import { Component } from '@angular/core';
import { ComponentEvent } from '@ngx-dynamic-components/core';

@Component({
  selector: 'app-root',
  template: `
  <ngx-dynamic-component
    [xmlUIModel]='xmlUIModel'
    [dataModel]='dataModel'
    (eventHandlers)="eventHandlers($event)">
  </ngx-dynamic-component>
  `,
  styles: [`
  input[type=text], select, textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    margin-top: 6px;
    margin-bottom: 16px;
    resize: vertical
  }`,
    `input[type=submit] {
    background-color: #4CAF50;
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
  }`,
    `input[type=submit]:hover {
    background-color: #45a049;
  }`,
    `.container {
    border-radius: 5px;
    background-color: #f2f2f2;
    padding: 20px;
    max-width: 960px;
    margin: auto;
  }
  `],
  encapsulation: ViewEncapsulation.None
  })
export class AppComponent {
  xmlUIModel = `
  <div class="container">
    <form onSubmit="save(data)">
      <label>First Name</label>
      <input type="text" id="fname" binding="$.fname" placeholder="Your name.."/>

      <label>Last Name</label>
      <input type="text" id="lname" placeholder="Your last name.."/>

      <label>Country</label>
      <select id="country">
        <option value="australia">Australia</option>
        <option value="canada">Canada</option>
        <option value="usa">USA</option>
      </select>

      <label>Subject</label>
      <textarea id="subject" placeholder="Write something.." style="height:200px"></textarea>

      <input type="submit" value="Submit"/>
    </form>
  </div>
  `;

  dataModel = {};

  eventHandlers(ev: ComponentEvent) {
    if (ev.eventName === 'save') {
      console.log('save event', ev, this.dataModel);
    }
  }
}

From the example above you see that have four main properties:

  • uiModel - is you XML based configuration or JS Object
  • dataModel - data object what you can bind to
  • eventHandlers - event handlers function where you can subscribe to any events

Why would you use it.

Composing and maintaining web forms and responsive web layouts can be tedious job. You will always have similar components with similar design patterns and requirements are usually changing frequently. While ngx-dynamic-components will allow you to:

  • define your forms layout and logic at run-time
  • load your web pages from the server
  • support full web page lifecycle events

How this library is different from other dynamic content library

There are quite a few other dynamic components library for Angular. e.g. Formly (https://formly.dev), But with our library you can build anything from a very simple contact form to much more complex workflow-driven business web page. Core advantages:

  • XML based configuration as well as JSON. When a form gets bigger maintaining JSON configuration becomes very difficult (from our experience). While XML is much more readable human readable and looks very similar to HTML5
  • Custom CSS and styling and responsive design very easy to achieve. Just the same as you would do it in HTML. For instance, if you know Bootstrap or any other CSS framework, you can easily leverage this for dynamic rendering.
  • a true dynamic nature. You can change UI dynamically with a code-behind scripting logic
  • full event life cycle

Why?

ngx-dynamic-components was build to power a Worksheet Systems - a low code data management platform. As none of the existing dynamic library served the purpose

Resources

License

A permissive MIT (c) - FalconSoft Ltd

16.0.2

8 months ago

16.0.1

8 months ago

16.0.0

9 months ago

16.0.6

6 months ago

16.0.5

7 months ago

16.0.4

7 months ago

16.0.3

8 months ago

15.0.2

1 year ago

15.0.1

1 year ago

15.1.1

1 year ago

15.1.2

1 year ago

15.1.0

1 year ago

13.1.10

2 years ago

13.1.9

2 years ago

13.1.7

2 years ago

13.1.8

2 years ago

13.1.6

2 years ago

13.1.5

2 years ago

13.1.3

2 years ago

13.1.4

2 years ago

13.1.1

2 years ago

13.1.2

2 years ago

13.1.0

2 years ago

13.0.2

2 years ago

13.0.1

2 years ago

12.1.3

3 years ago

12.1.2

3 years ago

0.2.14

3 years ago

0.2.13

3 years ago

0.2.12

3 years ago

0.2.11

3 years ago

0.2.9

3 years ago

0.2.8

3 years ago

0.2.7

3 years ago

0.2.6

4 years ago

0.2.5

4 years ago

0.2.4

4 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.20

4 years ago

0.1.19

4 years ago

0.1.18

4 years ago

0.1.17

4 years ago

0.1.16

4 years ago

0.1.15

4 years ago

0.1.14

4 years ago

0.1.13

4 years ago

0.1.12

4 years ago

0.1.11

4 years ago

0.1.10

4 years ago

0.1.9

4 years ago

0.1.8

4 years ago

0.1.7

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago

0.0.45

4 years ago

0.0.44

4 years ago

0.0.43

4 years ago

0.0.42

4 years ago

0.0.41

4 years ago

0.0.40

4 years ago

0.0.39

4 years ago

0.0.38

4 years ago

0.0.37

4 years ago

0.0.36

4 years ago

0.0.35

4 years ago

0.0.34

4 years ago

0.0.33

4 years ago

0.0.32

4 years ago

0.0.30

4 years ago

0.0.29

5 years ago

0.0.28

5 years ago

0.0.27

5 years ago

0.0.26

5 years ago

0.0.25

5 years ago

0.0.24

5 years ago

0.0.23

5 years ago

0.0.22

5 years ago

0.0.21

5 years ago

0.0.20

5 years ago

0.0.19

5 years ago

0.0.18

5 years ago

0.0.17

5 years ago

0.0.16

5 years ago

0.0.15

5 years ago

0.0.14

5 years ago

0.0.13

5 years ago

0.0.12

5 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago