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

exploder-workspace

v0.0.0

Published

NG-Expoder is an angular library and based on - [primefaces](https://www.primefaces.org/primeng-v11-lts/#/)- controls and it help you to create forms and page elements like (tables - chips - contexture) using json object and you can create the following t

Downloads

3

Readme

NG-Exploder

The UI builder and controls logic

NG-Expoder is an angular library and based on - primefaces- controls and it help you to create forms and page elements like (tables - chips - contexture) using json object and you can create the following types:

  • textarea
  • textField
  • number
  • checkbox
  • switch
  • autocomplete
  • dropdown
  • multipleSelect
  • uploader
  • rating
  • radio
  • table
  • button
  • chips
  • map

Features

  • You did not need to wite html codes
  • You did not need to re-write css or scss once create global style it will be applied on all controls.
  • You can create a complexity forms easily
  • you can create and manage logic easily
  • it's support translations (arabic and english till now)
  • flexible to extend and editable

Installation

NG-Exploder requires Angular v11 to run.

Install the dependencies and devDependencies and start the server.

cd [your project]
npm install primeng-lts --save
npm install primeicons --save

Install ng-exploder.

npm i ng-exploder

Now you should import ( ExploderModule ) in AppModule

@NgModule({
  declarations: [
    ......
  ],
  imports: [
    BrowserModule,
    BrowserAnimationsModule,
    ReactiveFormsModule,
    ExploderModule
    .....
  ],
  providers: [],
  bootstrap: [AppComponent]
})

Optional:

  • you can create custom expolder.theme. (*css/scss*) for set customize controls

Plugins

NG-Exploder is currently extended with the following plugins. Instructions on how to use them in your own application are linked below.

| Plugin | README | | ------ | ------ | | Angular | [https://angular.io/][PlDb] | | Primefaces | [https://www.primefaces.org/primeng-v11-lts/#/setup][PlDb] | | Bootstrap| [https://getbootstrap.com/][PlGd] |

Development

Want to continue? Great!

Ng-Exploder uses primefaces for fast developing.

after run angualr project.

ng serve

Create new class and extends Exploder from 'ng-exploder' but it's optional to use inheritance and OOP concepts but you can create main component directly and strat implement forms also . Let's start to create Commen class and set it as base class

export class Common extends Exploder {
 .....
 
}

In the above class you can inject all services that will use it in component class and following example :

export class Common extends Exploder {
  public expService: ExploderService;
  public httpApiService: HttpApiService;
  public route: ActivatedRoute;
  ........
 constructor(public injector: Injector) {
    super();
    this.expService = this.injector.get(ExploderService);
    this.httpApiService = this.injector.get(HttpApiService);
    this.route = this.injector.get(ActivatedRoute);
    .....
    }
}

then you can implement all methods in abstract class and the important method is (getByType). it used for search about control [will use it next time and know how?].

Component Class

In our case, We will use AppComponent.ts as main component to bind and display our page design and that is main task so i will extends from Exploder.class.ts and impement setConfig to create json configuration in it [Schema].

Notes:

  • I create Form using Angular reactiveForms to push all controls on it and should it contain FormGroup at least one.
  • I create Config Variable as ConfigType to set a json config in it.
export class Common extends Exploder {
  public config: Config;
  public mainForm: FormGroup;
  ........
 constructor(public injector: Injector) {
    ....
    this.mainForm = new FormGroup({
      pageControls: new FormGroup({}),
    });
    .....
    }
}

And then open AppComponent.html and set the following code :

<div [formGroup]="mainForm">
......
   <exp-head [config]="config" FormGroupName="pageControls"
                  [Lang]=".." ></exp-head>
.....
</div>
  • You should pass root Form Group the FormGroupName as you created in the form as string and formGroup as parent Form. then config as json Object. -- and config should defined from Config Type
  • the lang Input is optional.

Config Type Properties | Name | Type | Default | Description | | ------ | ------ | ------ | ------ | | exp | ExpTypes | should select from this types [ 'builder' , 'resource'] | you should use ExpTypes enum to select type BUILDER or RESOURCE | | components | ExpComponent[] | [] | describe In the table below |

Let's now start build JSON Object or Schema that responsible display UI and logic.

the below example describe how you can create schema:

export class Common extends Exploder {
  public config: Config;
  public mainForm: FormGroup;
  ........
 constructor(public injector: Injector) {
    ....
    this.mainForm = new FormGroup({
      pageControls: new FormGroup({}),
    });
    this.setConfig();
    .....
    }
    setConfig(): any {
    this.config = {
      exp: ExpTypes.BUILDER,
      components: [
        new ExpComponent({
          key: 'campaignDetails',
          columns: [
            new ExpColumn({
              width: 12,
              type: 'radio',
              key: 'testRadioKey',
              label: 'Test',
              options: [
                {id: 1, nameEn: 'test', nameAr: 'اختبار'}
              ],
              properties: {
                labelEn: 'nameEn',
                labelAr: 'nameAr',
                optionValue: 'id',
                onChange: () => {
                ....
                },
                styleClass: 'p-radio-button-custom',
              },
              validate: {required: true}
            }),
            new ExpColumn({
              width: 6,
              type: 'textField',
              key: 'testTextFieldKey',
              label: 'Text Field Key',
              placeholder: 'Text Field Key',
              validate: {
                required: true,
              }
            }),
            new ExpColumn({
              width: 6,
              type: 'uploader',
              key: 'file',
           // hidden: true,
              label: 'file',
              properties: {
                previewWidth: 50,
                showCancelButton: true,
                showUploadButton: false,
                path: 'API for download file in view mode after upload it',
                accept: 'image/*,application/pdf,.pdf',
                maxFileSize: 5000000,
                mode: 'basic',
                onPush: true,
              }
            }),
            new ExpColumn({
              width: 6,
              type: 'dropdown',
              key: '...',
              label: ...,
              placeholder: ....,
              options: [
                {id: 1, nameEn: 'Regular', nameAr: 'منظمة'},
              ],
              properties: {
                labelEn: 'id',
                labelAr: 'id',
                optionValue: 'id',
                styleClass: 'p-dropdown-custom',
              },
              validate: {required: true}
            })
          ],
        }),
        new ExpComponent({
          key: 'locationDetails',
          columns: [
            new ExpColumn({
              width: 6,
              type: 'dropdown',
              key: 'zone',
              options: [
                {id: 1, nameEn: 'xxx', nameAr: 'xxx'},
              ],
              label:  'ZONE',
              placeholder: 'ZONE',
              properties: {
                labelEn: 'nameEn',
                labelAr: 'nameAr',
                styleClass: 'p-dropdown-custom',
              },
              validate: {required: true}
            })
          ]
        }),
        new ExpComponent({
          key: 'campaignTableDetails',
          columns: [
            new ExpColumn({
              width: 12,
              type: 'button',
              key: 'addItem',
              properties: {
                onClick: () => {
....
},
                btnLabel:  'ADD',
                class: 'p-d-inline-flex p-jc-end text-right'
              }
            }),
            new ExpColumn({
              width: 10,
              type: 'button',
              key: 'cancelItem',
              hidden: true,
              properties: {
                onClick: () => {
                  ....
                },
                btnLabel:  'CANCEL',
                class: 'p-d-inline-flex p-jc-end text-right'
              }
            }),
            new ExpColumn({
              width: 2,
              type: 'button',
              key: 'saveItem',
              hidden: true,
              properties: {
                onClick: () => {
                 ....
                },
                btnLabel:  'SAVE',
                class: 'p-d-inline-flex p-jc-end text-right'
              }
            }),
            new ExpColumn({
              width: 12,
              type: 'table',
              key: 'locationTable',
              value: [],
              options: [{
                zone: 'zone',
                region: 'region'
              }],
              validate: {required: true},
              properties: {
                cols: [
                  {
                    name: 'ZONE',
                    field: 'zone',
                    isObject: true,
                    labelEn: 'nameEn',
                    labelAr: 'nameAr',
                  }
                  {name: 'ACTIONS', actions: ['delete', 'edit']}
                ],
                transPath: this.messageTranslationPrefix,
                actions: {
                  onClick: (control, event) => {
                    ....
                  }
                }
              }
            }),
          ],
        })
      ]
    };
  }

}

As per the above code the configuration assume that we have more than onle component and every component have one or more controle.

  • every compoent should have unique key componentKey and you other optional properties :

| Name | Type | Default | Description | | ------ | ------ | ------ | ------ | | key | string | auto generated [if is empty] | you should add unique key and it will create fromGroup using this key in parent form and push all the controls in it. | | label | string | null | if you set it will displayed as section title | | width | number | 6 | it's grid system class using bootsrap system from 1 - 12 | | properties | any | null | any additional properties | | order | number | null | if you need to re-order compenetes based logic so you can set it as any number [0] | | components | ExpComponent[] | [] | if you need to to set child components. | | columns | ExpColumn[] | should have one control at least | you can check the below column properties table. | hidden | boolean | false | if you need to hide all component contols set it true

After know how to create component. let's know what is the mandatory properties and optional in column? and will explained in the following table:

| Name | Type | Default | Description | | ------ | ------ | ------ | ------ | | type | string | null | this field is required so you should select type from the following types textarea , textField , number , date , checkbox , switch , autocomplete , dropdown , multipleSelect , uploader , rating , radio , multiSelect , table , button , chips , map| | width | number | 6 | it's grid system class using bootsrap system from 1 - 12 | | label | string | null | if you set it will displayed as control title | | placeholder | string | null | if you set it will displayed as placeholder inside control | | key | string | auto generated [if is empty] | you should add unique key and it will create fromControl using this key in parent formGroup and push all the controls in it. | | disabled | boolean | false | if you need to diable control set it true | | hidden | boolean | false | if you need to hide all control set it true| | options | ExpLookup[] or any[] | false | for dropdown option list |

License

MIT