Skip to content

Commit

Permalink
Doc(Global): divide components
Browse files Browse the repository at this point in the history
  • Loading branch information
hamzahamidi committed Jan 11, 2020
1 parent 04293f5 commit 5ae091f
Show file tree
Hide file tree
Showing 4 changed files with 195 additions and 43 deletions.
55 changes: 33 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Angular6-json-schema-form
# AJSF (Angular JSON Schema Form)

[![Build Status](https://travis-ci.org/hamzahamidi/Angular6-json-schema-form.svg?branch=master)](https://travis-ci.org/hamzahamidi/Angular6-json-schema-form)
[![Maintainability](https://api.codeclimate.com/v1/badges/dfbee5b888425221bca6/maintainability)](https://codeclimate.com/github/hamzahamidi/Angular6-json-schema-form/maintainability)
[![GitHub release](https://img.shields.io/github/release/hamzahamidi/angular6-json-schema-form.svg)](https://github.com/hamzahamidi/angular6-json-schema-form/releases/latest)
[![npm downloads](https://img.shields.io/npm/dm/angular6-json-schema-form.svg?style=plastic)](https://www.npmjs.com/package/angular6-json-schema-form) [![GitHub MIT License](https://img.shields.io/github/license/hamzahamidi/angular6-json-schema-form.svg?style=social)](https://github.com/hamzahamidi/angular6-json-schema-form)
**N.B:** For Angular 6 JSON Schema Form old versions please check [this documentation](https://github.com/hamzahamidi/ajsf/tree/v8).

[![Build Status](https://travis-ci.org/hamzahamidi/ajsf.svg?branch=master)](https://travis-ci.org/hamzahamidi/ajsf)
[![Maintainability](https://api.codeclimate.com/v1/badges/daec00f786b6ab6066c2/maintainability)](https://codeclimate.com/github/hamzahamidi/ajsf/maintainability)
[![GitHub release](https://img.shields.io/github/release/hamzahamidi/angular6-json-schema-form.svg)](https://github.com/hamzahamidi/ajsf/releases/latest)
[![npm downloads](https://img.shields.io/npm/dm/angular6-json-schema-form.svg?style=plastic)](https://www.npmjs.com/package/angular6-json-schema-form) [![GitHub MIT License](https://img.shields.io/github/license/hamzahamidi/angular6-json-schema-form.svg?style=social)](https://github.com/hamzahamidi/ajsf)

Note: This project is a continuation to [dschnelldavis/Angular2-json-schema-form](https://github.com/dschnelldavis/angular2-json-schema-form) & is and is not affiliated with any organization.

Expand All @@ -23,41 +25,43 @@ This example playground features over 70 different JSON Schemas for you to try (

### To install from GitHub

To install [the library and the example playground from GitHub](https://github.com/hamzahamidi/angular6-json-schema-form), clone `https://github.com/hamzahamidi/angular6-json-schema-form.git` with your favorite git program. Or, assuming you have [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) and [Node/YARN](https://nodejs.org/en/download/) installed, enter the following in your terminal:
To install [the library and the example playground from GitHub](https://github.com/hamzahamidi/ajsf), clone `https://github.com/hamzahamidi/ajsf.git` with your favorite git program. Or, assuming you have [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) and [Node/YARN](https://nodejs.org/en/download/) installed, enter the following in your terminal:

```shell
git clone https://github.com/hamzahamidi/angular6-json-schema-form.git angular6-json-schema-form
cd angular6-json-schema-form
git clone https://github.com/hamzahamidi/ajsf.git ajsf
cd ajsf
yarn install
yarn buildlib
yarn start
```

This should start a server with the example playground, which you can view in your browser at `http://localhost:4200`

The source code is composed as the following:

* `projects/json-schema-form` - Angular JSON Schema Form main library
* `projects/json-schema-form/src/lib/framework-library` - framework library
* `projects/json-schema-form/src/lib/widget-library` - widget library
* `projects/json-schema-form/src/lib/shared` - various utilities and helper functions
* `src` - the demonstration playground example application
* `src/assets/example-schemas` - JSON Schema examples used in the playground
* `projects/ajsf-core` - Angular JSON Schema Form main library
* `projects/ajsf-bootstrap3` - Framework for Bootstrap 3
* `projects/ajsf-bootstrap4` - Framework for Bootstrap 4
* `projects/ajsf-material` - Framework for Angular Material
* `projects/ajsf-core/src/lib/framework-library` - framework library
* `projects/ajsf-core/src/lib/widget-library` - widget library
* `projects/ajsf-core/src/lib/shared` - various utilities and helper functions
* `demo` - the demonstration playground example application
* `demo/assets/example-schemas` - JSON Schema examples used in the playground

If you want detailed documentation describing the individual functions used in this library, run `npm run docs` to generate TypeDoc documentation, and then look in the generated `/docs/api` folder. (Angular JSON Schema Form is still a work in progress, so right now this documentation varies from highly detailed to completely missing.)

### To install from NPM/YARN and use in your own project

If, after playing with the examples, you decide this library is functional enough to use in your own project, you can [install it from NPM](https://www.npmjs.com/package/angular6-json-schema-form) using either [NPM](https://www.npmjs.com) or [Yarn](https://yarnpkg.com). To install with NPM, run the following from your terminal:
If, after playing with the examples, you decide this library is functional enough to use in your own project, you can for example [install @ajsf/material package from NPM](https://www.npmjs.com/package/angular6-json-schema-form) using either [NPM](https://www.npmjs.com) or [Yarn](https://yarnpkg.com). To install with NPM, run the following from your terminal:

```shell
npm install angular6-json-schema-form
npm install @asjf/material
```

With YARN, run the following:

```shell
yarn add angular6-json-schema-form
yarn add @asjf/material
```

Then import `MaterialDesignFrameworkModule` in your main application module if you want to use `material-angular` UI, like this:
Expand All @@ -66,7 +70,7 @@ Then import `MaterialDesignFrameworkModule` in your main application module if y
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { MaterialDesignFrameworkModule } from 'angular6-json-schema-form';
import { MaterialDesignFrameworkModule } from '@ajsf/material';

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

Expand All @@ -90,6 +94,13 @@ Four framework modules are currently included, the import is the same as above :

It is also possible to load multiple frameworks and switch between them at runtime, like the example playground on GitHub. But most typical sites will just load one framework.

### Packages

* [`@ajsf/core`](./README.md) [![npm version](https://badge.fury.io/js/%40ajsf%2Fcore.svg)](https://badge.fury.io/js/%40ajsf%2Fcore)
* [`@ajsf/bootstrap3`](./projects/ajsf-bootstrap3/README.md) [![npm version](https://badge.fury.io/js/%40ajsf%2Fbootstrap3.svg)](https://badge.fury.io/js/%40ajsf%2Fbootstrap3)
* [`@ajsf/bootstrap4`](./projects/ajsf-bootstrap4/README.md) [![npm version](https://badge.fury.io/js/%40ajsf%2Fbootstrap4.svg)](https://badge.fury.io/js/%40ajsf%2Fbootstrap4)
* [`@ajsf/material`](./projects/ajsf-material/README.md) [![npm version](https://badge.fury.io/js/%40ajsf%2Fmaterial.svg)](https://badge.fury.io/js/%40ajsf%2Fmaterial)

## Using Angular JSON Schema Form

### Basic use
Expand All @@ -105,7 +116,7 @@ For basic use, after loading JsonSchemaFormModule as described above, to display
</json-schema-form>
```

Where `schema` is a valid JSON schema object, and `onSubmit` calls a function to process the submitted JSON form data. If you don't already have your own schemas, you can find a bunch of samples to test with in the `src/demo/assets/example-schemas` folder, as described above.
Where `schema` is a valid JSON schema object, and `onSubmit` calls a function to process the submitted JSON form data. If you don't already have your own schemas, you can find a bunch of samples to test with in the `demo/assets/example-schemas` folder, as described above.

`framework` is for the template you want to use, the default value is `no-framwork`. The possible values are:

Expand Down Expand Up @@ -421,7 +432,7 @@ const yourNewWidgets = {
...or...

```javascript
import { WidgetLibraryService } from 'angular6-json-schema-form';
import { WidgetLibraryService } from '@ajsf/core';
...
constructor(private widgetLibrary: WidgetLibraryService) { }
...
Expand Down Expand Up @@ -461,7 +472,7 @@ const yourCustomFramework = {
...or...

```javascript
import { FrameworkLibraryService } from 'angular6-json-schema-form';
import { FrameworkLibraryService } from '@ajsf/core';
...
constructor(private frameworkLibrary: FrameworkLibraryService) { }
...
Expand Down
57 changes: 54 additions & 3 deletions projects/ajsf-bootstrap3/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,62 @@
# AjsfBootstrap3Framework
# @asjf/bootstrap3

This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.1.1.
## Getting started

```shell
npm install @asjf/bootstrap3
```

With YARN, run the following:

```shell
yarn add @asjf/bootstrap3
```

Then import `Bootstrap3FrameworkModule` in your main application module if you want to use `bootstrap3` UI, like this:

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

import { Bootstrap3FrameworkModule } from '@ajsf/bootstrap3';

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

@NgModule({
declarations: [ AppComponent ],
imports: [
Bootstrap3FrameworkModule
],
providers: [],
bootstrap: [ AppComponent ]
})
export class AppModule { }
```

For basic use, after loading JsonSchemaFormModule as described above, to display a form in your Angular component, simply add the following to your component's template:

```html
<json-schema-form
loadExternalAssets="true"
[schema]="yourJsonSchema"
framework="bootstrap-3"
(onSubmit)="yourOnSubmitFn($event)">
</json-schema-form>
```

Where `schema` is a valid JSON schema object, and `onSubmit` calls a function to process the submitted JSON form data. If you don't already have your own schemas, you can find a bunch of samples to test with in the `demo/assets/example-schemas` folder, as described above.

`framework` is for the template you want to use, the default value is `no-framwork`. The possible values are:

* `material-design` for Material Design.
* `bootstrap-3` for Bootstrap 3.
* `bootstrap-4` for 'Bootstrap 4.
* `no-framework` for (plain HTML).

## Code scaffolding

Run `ng generate component component-name --project @ajsf/bootstrap3` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project @ajsf/bootstrap3`.
> Note: Don't forget to add `--project @ajsf/bootstrap3` or else it will be added to the default project in your `angular.json` file.
> Note: Don't forget to add `--project @ajsf/bootstrap3` or else it will be added to the default project in your `angular.json` file.
## Build

Expand Down
61 changes: 54 additions & 7 deletions projects/ajsf-bootstrap4/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,62 @@
# FwBootstrap4
# @asjf/bootstrap4

This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.1.1.
## Getting started

```shell
npm install @asjf/bootstrap4
```

With YARN, run the following:

```shell
yarn add @asjf/bootstrap4
```

Then import `Bootstrap4FrameworkModule` in your main application module if you want to use `bootstrap4` UI, like this:

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

import { Bootstrap4FrameworkModule } from '@ajsf/bootstrap4';

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

@NgModule({
declarations: [ AppComponent ],
imports: [
Bootstrap4FrameworkModule
],
providers: [],
bootstrap: [ AppComponent ]
})
export class AppModule { }
```

For basic use, after loading JsonSchemaFormModule as described above, to display a form in your Angular component, simply add the following to your component's template:

```html
<json-schema-form
loadExternalAssets="true"
[schema]="yourJsonSchema"
framework="bootstrap-4"
(onSubmit)="yourOnSubmitFn($event)">
</json-schema-form>
```

Where `schema` is a valid JSON schema object, and `onSubmit` calls a function to process the submitted JSON form data. If you don't already have your own schemas, you can find a bunch of samples to test with in the `demo/assets/example-schemas` folder, as described above.

`framework` is for the template you want to use, the default value is `no-framwork`. The possible values are:

* `material-design` for Material Design.
* `bootstrap-3` for Bootstrap 3.
* `bootstrap-4` for 'Bootstrap 4.
* `no-framework` for (plain HTML).

## Code scaffolding

Run `ng generate component component-name --project @ajsf/bootstrap4` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project @ajsf/bootstrap4`.
> Note: Don't forget to add `--project @ajsf/bootstrap4` or else it will be added to the default project in your `angular.json` file.
> Note: Don't forget to add `--project @ajsf/bootstrap4` or else it will be added to the default project in your `angular.json` file.
## Build

Expand All @@ -18,7 +69,3 @@ After building your library with `ng build @ajsf/bootstrap4`, go to the dist fol
## Running unit tests

Run `ng test @ajsf/bootstrap4` to execute the unit tests via [Karma](https://karma-runner.github.io).

## Further help

To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
65 changes: 54 additions & 11 deletions projects/ajsf-material/README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,67 @@
# AjsfMaterialFramework
# @ajsf/material

This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.1.1.
## Getting started

```shell
npm install @asjf/material
```

With YARN, run the following:

```shell
yarn add @asjf/material
```

Then import `MaterialDesignFrameworkModule` in your main application module if you want to use `material-angular` UI, like this:

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

import { MaterialDesignFrameworkModule } from '@ajsf/material';

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

@NgModule({
declarations: [ AppComponent ],
imports: [
MaterialDesignFrameworkModule
],
providers: [],
bootstrap: [ AppComponent ]
})
export class AppModule { }
```

For basic use, after loading JsonSchemaFormModule as described above, to display a form in your Angular component, simply add the following to your component's template:

```html
<json-schema-form
loadExternalAssets="true"
[schema]="yourJsonSchema"
framework="material-design"
(onSubmit)="yourOnSubmitFn($event)">
</json-schema-form>
```

Where `schema` is a valid JSON schema object, and `onSubmit` calls a function to process the submitted JSON form data. If you don't already have your own schemas, you can find a bunch of samples to test with in the `demo/assets/example-schemas` folder, as described above.

`framework` is for the template you want to use, the default value is `no-framwork`. The possible values are:

* `material-design` for Material Design.
* `bootstrap-3` for Bootstrap 3.
* `bootstrap-4` for 'Bootstrap 4.
* `no-framework` for (plain HTML).

## Code scaffolding

Run `ng generate component component-name --project @ajsf/material` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project @ajsf/material`.
> Note: Don't forget to add `--project @ajsf/material` or else it will be added to the default project in your `angular.json` file.
> Note: Don't forget to add `--project @ajsf/material` or else it will be added to the default project in your `angular.json` file.
## Build

Run `ng build @ajsf/material` to build the project. The build artifacts will be stored in the `dist/` directory.

## Publishing

After building your library with `ng build @ajsf/material`, go to the dist folder `cd dist/@ajsf/material` and run `npm publish`.

## Running unit tests

Run `ng test @ajsf/material` to execute the unit tests via [Karma](https://karma-runner.github.io).

## Further help

To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).

0 comments on commit 5ae091f

Please sign in to comment.