├── .editorconfig ├── .gitignore ├── LICENSE ├── README.md ├── angular.json ├── e2e ├── protractor.conf.js ├── src │ ├── app.e2e-spec.ts │ └── app.po.ts └── tsconfig.e2e.json ├── package.json ├── src ├── .browserslistrc ├── app │ ├── Prism.service.ts │ ├── app.component.html │ ├── app.component.scss │ ├── app.component.spec.ts │ ├── app.component.ts │ ├── app.module.ts │ ├── auth │ │ ├── auth.module.spec.ts │ │ ├── auth.module.ts │ │ ├── auth │ │ │ ├── auth.component.html │ │ │ ├── auth.component.scss │ │ │ ├── auth.component.spec.ts │ │ │ └── auth.component.ts │ │ └── login │ │ │ ├── login.component.html │ │ │ ├── login.component.scss │ │ │ ├── login.component.spec.ts │ │ │ └── login.component.ts │ ├── components │ │ └── CheckMatrix.js │ ├── config.ts │ ├── data │ │ ├── data.component.html │ │ ├── data.component.scss │ │ ├── data.component.spec.ts │ │ ├── data.component.ts │ │ └── submission │ │ │ ├── SubmissionGridHeader.component.html │ │ │ ├── SubmissionGridHeader.component.ts │ │ │ └── index.ts │ ├── event │ │ ├── event.module.spec.ts │ │ ├── event.module.ts │ │ ├── participant │ │ │ ├── participant.module.spec.ts │ │ │ └── participant.module.ts │ │ ├── resource │ │ │ ├── resource.component.html │ │ │ ├── resource.component.scss │ │ │ ├── resource.component.spec.ts │ │ │ └── resource.component.ts │ │ └── view │ │ │ ├── view.component.html │ │ │ ├── view.component.scss │ │ │ ├── view.component.spec.ts │ │ │ └── view.component.ts │ ├── form │ │ ├── form.module.spec.ts │ │ ├── form.module.ts │ │ └── index │ │ │ ├── index.component.html │ │ │ ├── index.component.scss │ │ │ ├── index.component.spec.ts │ │ │ └── index.component.ts │ ├── forms │ │ ├── builder │ │ │ ├── builder.component.html │ │ │ ├── builder.component.scss │ │ │ ├── builder.component.spec.ts │ │ │ └── builder.component.ts │ │ ├── custom-builder │ │ │ ├── builder.component.html │ │ │ ├── builder.component.ts │ │ │ └── options.ts │ │ ├── forms.index.ts │ │ ├── forms.module.spec.ts │ │ ├── forms.module.ts │ │ ├── forms │ │ │ ├── forms.component.html │ │ │ ├── forms.component.scss │ │ │ ├── forms.component.spec.ts │ │ │ └── forms.component.ts │ │ ├── kitchen │ │ │ ├── form.ts │ │ │ ├── kitchen.component.html │ │ │ ├── kitchen.component.scss │ │ │ ├── kitchen.component.spec.ts │ │ │ └── kitchen.component.ts │ │ ├── language │ │ │ ├── language.component.html │ │ │ ├── language.component.scss │ │ │ ├── language.component.spec.ts │ │ │ └── language.component.ts │ │ ├── pdf │ │ │ ├── pdf.component.html │ │ │ ├── pdf.component.scss │ │ │ ├── pdf.component.spec.ts │ │ │ └── pdf.component.ts │ │ ├── renderer │ │ │ ├── renderer.component.html │ │ │ ├── renderer.component.scss │ │ │ ├── renderer.component.spec.ts │ │ │ └── renderer.component.ts │ │ ├── simple │ │ │ ├── simple.component.html │ │ │ ├── simple.component.scss │ │ │ ├── simple.component.spec.ts │ │ │ └── simple.component.ts │ │ └── wizard │ │ │ ├── wizard.component.html │ │ │ ├── wizard.component.scss │ │ │ ├── wizard.component.spec.ts │ │ │ └── wizard.component.ts │ └── home │ │ ├── home.component.html │ │ ├── home.component.scss │ │ ├── home.component.spec.ts │ │ └── home.component.ts ├── assets │ └── .gitkeep ├── environments │ ├── environment.prod.ts │ └── environment.ts ├── favicon.ico ├── index.html ├── karma.conf.js ├── main.ts ├── polyfills.ts ├── styles.scss ├── test.ts ├── tsconfig.app.json ├── tsconfig.spec.json └── tslint.json ├── tsconfig.json ├── tslint.json └── yarn.lock /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .angular 2 | .dccache 3 | # See http://help.github.com/ignore-files/ for more about ignoring files. 4 | 5 | # compiled output 6 | /dist 7 | /tmp 8 | /out-tsc 9 | 10 | # dependencies 11 | /node_modules 12 | 13 | # IDEs and editors 14 | /.idea 15 | .project 16 | .classpath 17 | .c9/ 18 | *.launch 19 | .settings/ 20 | *.sublime-workspace 21 | 22 | # IDE - VSCode 23 | .vscode/* 24 | !.vscode/settings.json 25 | !.vscode/tasks.json 26 | !.vscode/launch.json 27 | !.vscode/extensions.json 28 | 29 | # misc 30 | /.sass-cache 31 | /connect.lock 32 | /coverage 33 | /libpeerconnection.log 34 | npm-debug.log 35 | yarn-error.log 36 | testem.log 37 | /typings 38 | 39 | # System Files 40 | .DS_Store 41 | Thumbs.db 42 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Form.io 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Angular + Form.io Demo 2 | 3 | This project provides an Angular demonstration with Form.io platform. 4 | 5 | ## Angular Versions 6 | This application has support for multiple versions of Angular. 7 | 8 | ### Angular 17 9 | This is the "master" branch of this application, but is also tagged with v7.0.0+ version 10 | 11 | ### Angular 16 12 | This is pushed to the "6.0.x" branch of this application, but is also tagged with v6.0.0+ version. 13 | 14 | ### Running the demo 15 | Type the following to run the demo. 16 | 17 | ``` 18 | ng serve 19 | ``` 20 | 21 | ### Live Demonstration 22 | 23 | To see a live demonstration, go to [https://formio.github.io/angular-demo/](https://formio.github.io/angular-demo/) 24 | -------------------------------------------------------------------------------- /angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "demo": { 7 | "root": "", 8 | "sourceRoot": "src", 9 | "projectType": "application", 10 | "prefix": "app", 11 | "schematics": { 12 | "@schematics/angular:component": { 13 | "style": "scss" 14 | } 15 | }, 16 | "architect": { 17 | "build": { 18 | "builder": "@angular-devkit/build-angular:browser", 19 | "options": { 20 | "outputPath": "dist", 21 | "index": "src/index.html", 22 | "main": "src/main.ts", 23 | "preserveSymlinks": true, 24 | "polyfills": "src/polyfills.ts", 25 | "tsConfig": "src/tsconfig.app.json", 26 | "assets": [ 27 | "src/favicon.ico", 28 | "src/assets" 29 | ], 30 | "styles": [ 31 | "src/styles.scss", 32 | "./node_modules/prism-themes/themes/prism-vs.css" 33 | ], 34 | "scripts": [ 35 | "./node_modules/jquery/dist/jquery.min.js", 36 | "./node_modules/popper.js/dist/umd/popper.js", 37 | "./node_modules/bootstrap/dist/js/bootstrap.js", 38 | "./node_modules/prismjs/prism.js", 39 | "./node_modules/prismjs/components/prism-markup.min.js", 40 | "./node_modules/prismjs/components/prism-json.min.js", 41 | "./node_modules/prismjs/components/prism-javascript.min.js", 42 | "./node_modules/prismjs/components/prism-typescript.min.js" 43 | ] 44 | }, 45 | "configurations": { 46 | "production": { 47 | "fileReplacements": [ 48 | { 49 | "replace": "src/environments/environment.ts", 50 | "with": "src/environments/environment.prod.ts" 51 | } 52 | ], 53 | "optimization": true, 54 | "outputHashing": "all", 55 | "sourceMap": false, 56 | "namedChunks": false, 57 | "aot": true, 58 | "extractLicenses": true, 59 | "vendorChunk": false, 60 | "buildOptimizer": true 61 | }, 62 | "development": { 63 | "buildOptimizer": false, 64 | "optimization": false, 65 | "vendorChunk": true, 66 | "extractLicenses": false, 67 | "sourceMap": true, 68 | "namedChunks": true 69 | } 70 | } 71 | }, 72 | "serve": { 73 | "builder": "@angular-devkit/build-angular:dev-server", 74 | "options": { 75 | "browserTarget": "demo:build" 76 | }, 77 | "configurations": { 78 | "production": { 79 | "browserTarget": "demo:build:production" 80 | }, 81 | "development": { 82 | "browserTarget": "demo:build:development" 83 | } 84 | } 85 | }, 86 | "extract-i18n": { 87 | "builder": "@angular-devkit/build-angular:extract-i18n", 88 | "options": { 89 | "browserTarget": "demo:build" 90 | } 91 | }, 92 | "test": { 93 | "builder": "@angular-devkit/build-angular:karma", 94 | "options": { 95 | "main": "src/test.ts", 96 | "polyfills": "src/polyfills.ts", 97 | "tsConfig": "src/tsconfig.spec.json", 98 | "karmaConfig": "src/karma.conf.js", 99 | "styles": [ 100 | "src/styles.scss", 101 | "./node_modules/prism-themes/themes/prism-vs.css" 102 | ], 103 | "scripts": [ 104 | "./node_modules/jquery/dist/jquery.slim.js", 105 | "./node_modules/popper.js/dist/umd/popper.js", 106 | "./node_modules/bootstrap/dist/js/bootstrap.js", 107 | "./node_modules/prismjs/prism.js", 108 | "./node_modules/prismjs/components/prism-markup.min.js", 109 | "./node_modules/prismjs/components/prism-json.min.js", 110 | "./node_modules/prismjs/components/prism-javascript.min.js", 111 | "./node_modules/prismjs/components/prism-typescript.min.js" 112 | ], 113 | "assets": [ 114 | "src/favicon.ico", 115 | "src/assets" 116 | ] 117 | } 118 | }, 119 | "lint": { 120 | "builder": "@angular-devkit/build-angular:tslint", 121 | "options": { 122 | "tsConfig": [ 123 | "src/tsconfig.app.json", 124 | "src/tsconfig.spec.json" 125 | ], 126 | "exclude": [ 127 | "**/node_modules/**" 128 | ] 129 | } 130 | } 131 | } 132 | }, 133 | "demo-e2e": { 134 | "root": "e2e/", 135 | "projectType": "application", 136 | "architect": { 137 | "e2e": { 138 | "builder": "@angular-devkit/build-angular:protractor", 139 | "options": { 140 | "protractorConfig": "e2e/protractor.conf.js", 141 | "devServerTarget": "demo:serve" 142 | }, 143 | "configurations": { 144 | "production": { 145 | "devServerTarget": "demo:serve:production" 146 | } 147 | } 148 | }, 149 | "lint": { 150 | "builder": "@angular-devkit/build-angular:tslint", 151 | "options": { 152 | "tsConfig": "e2e/tsconfig.e2e.json", 153 | "exclude": [ 154 | "**/node_modules/**" 155 | ] 156 | } 157 | } 158 | } 159 | } 160 | }, 161 | "defaultProject": "demo", 162 | "cli": { 163 | "analytics": false 164 | } 165 | } -------------------------------------------------------------------------------- /e2e/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // Protractor configuration file, see link for more information 2 | // https://github.com/angular/protractor/blob/master/lib/config.ts 3 | 4 | const { SpecReporter } = require('jasmine-spec-reporter'); 5 | 6 | exports.config = { 7 | allScriptsTimeout: 11000, 8 | specs: [ 9 | './src/**/*.e2e-spec.ts' 10 | ], 11 | capabilities: { 12 | 'browserName': 'chrome' 13 | }, 14 | directConnect: true, 15 | baseUrl: 'http://localhost:4200/', 16 | framework: 'jasmine', 17 | jasmineNodeOpts: { 18 | showColors: true, 19 | defaultTimeoutInterval: 30000, 20 | print: function() {} 21 | }, 22 | onPrepare() { 23 | require('ts-node').register({ 24 | project: require('path').join(__dirname, './tsconfig.e2e.json') 25 | }); 26 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 27 | } 28 | }; -------------------------------------------------------------------------------- /e2e/src/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | 3 | describe('workspace-project App', () => { 4 | let page: AppPage; 5 | 6 | beforeEach(() => { 7 | page = new AppPage(); 8 | }); 9 | 10 | it('should display welcome message', () => { 11 | page.navigateTo(); 12 | expect(page.getParagraphText()).toEqual('Welcome to demo!'); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /e2e/src/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get('/'); 6 | } 7 | 8 | getParagraphText() { 9 | return element(by.css('app-root h1')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "module": "commonjs", 6 | "target": "es5", 7 | "types": [ 8 | "jasmine", 9 | "jasminewd2", 10 | "node" 11 | ] 12 | } 13 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@formio/formio-angular-demo", 3 | "version": "7.0.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng serve --configuration development", 7 | "build": "ng build", 8 | "test": "ng test", 9 | "lint": "ng lint", 10 | "e2e": "ng e2e", 11 | "buildprod": "ng build --configuration production", 12 | "builddemo": "ng build --configuration production --base-href /angular-demo/;", 13 | "deploy": "npm run builddemo; cd dist; git init; git remote add origin git@github.com:formio/angular-demo.git; git checkout -b gh-pages; git add -A; git commit -m 'Update demo application'; git push -f origin gh-pages;" 14 | }, 15 | "dependencies": { 16 | "@angular/animations": "^17.0.8", 17 | "@angular/common": "^17.0.8", 18 | "@angular/compiler": "^17.0.8", 19 | "@angular/core": "^17.0.8", 20 | "@angular/elements": "^17.0.8", 21 | "@angular/forms": "^17.0.8", 22 | "@angular/platform-browser": "^17.0.8", 23 | "@angular/platform-browser-dynamic": "^17.0.8", 24 | "@angular/router": "^17.0.8", 25 | "@formio/angular": "^7.0.0", 26 | "bootstrap": "4", 27 | "bootswatch": "^4.5.3", 28 | "core-js": "^3.8.1", 29 | "font-awesome": "^4.7.0", 30 | "formiojs": "^4.18.0", 31 | "jquery": "^3.7.1", 32 | "ngx-bootstrap": "^12.0.0", 33 | "popper.js": "^1.16.1", 34 | "prism-themes": "^1.5.0", 35 | "prismjs": "^1.22.0", 36 | "rxjs": "^7.8.0", 37 | "zone.js": "^0.14.2" 38 | }, 39 | "devDependencies": { 40 | "@angular-devkit/build-angular": "^17.0.9", 41 | "@angular/cli": "^17.0.9", 42 | "@angular/compiler-cli": "^17.0.8", 43 | "@angular/language-service": "^17.0.8", 44 | "@types/jasmine": "^5.1.4", 45 | "@types/jasminewd2": "^2.0.8", 46 | "@types/node": "^20.2.5", 47 | "codelyzer": "^6.0.1", 48 | "jasmine-core": "^5.0.0", 49 | "jasmine-spec-reporter": "^7.0.0", 50 | "karma": "^6.4.1", 51 | "karma-chrome-launcher": "~3.2.0", 52 | "karma-coverage-istanbul-reporter": "~3.0.2", 53 | "karma-jasmine": "~5.1.0", 54 | "karma-jasmine-html-reporter": "^2.1.0", 55 | "protractor": "~7.0.0", 56 | "ts-node": "^10.9.1", 57 | "tslint": "^6.1.3", 58 | "typescript": "~5.2.0" 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/.browserslistrc: -------------------------------------------------------------------------------- 1 | # This file is currently used by autoprefixer to adjust CSS to support the below specified browsers 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | # 5 | # For IE 9-11 support, please remove 'not' from the last line of the file and adjust as needed 6 | 7 | > 0.5% 8 | last 2 versions 9 | Firefox ESR 10 | not dead 11 | not IE 9-11 -------------------------------------------------------------------------------- /src/app/Prism.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | declare var Prism: any; 3 | 4 | @Injectable() 5 | export class PrismService { 6 | init() { 7 | Prism.highlightAll(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/app/app.component.html: -------------------------------------------------------------------------------- 1 | 40 |
41 | 42 |
43 | -------------------------------------------------------------------------------- /src/app/app.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/formio/angular-demo/df0c2ce2f1930211db57092757a0fdd8a9fed35c/src/app/app.component.scss -------------------------------------------------------------------------------- /src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, async } from '@angular/core/testing'; 2 | import { AppComponent } from './app.component'; 3 | describe('AppComponent', () => { 4 | beforeEach(async(() => { 5 | TestBed.configureTestingModule({ 6 | declarations: [ 7 | AppComponent 8 | ], 9 | }).compileComponents(); 10 | })); 11 | it('should create the app', async(() => { 12 | const fixture = TestBed.createComponent(AppComponent); 13 | const app = fixture.debugElement.componentInstance; 14 | expect(app).toBeTruthy(); 15 | })); 16 | it(`should have as title 'demo'`, async(() => { 17 | const fixture = TestBed.createComponent(AppComponent); 18 | const app = fixture.debugElement.componentInstance; 19 | expect(app.title).toEqual('demo'); 20 | })); 21 | it('should render title in a h1 tag', async(() => { 22 | const fixture = TestBed.createComponent(AppComponent); 23 | fixture.detectChanges(); 24 | const compiled = fixture.debugElement.nativeElement; 25 | expect(compiled.querySelector('h1').textContent).toContain('Welcome to demo!'); 26 | })); 27 | }); 28 | -------------------------------------------------------------------------------- /src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { FormioAuthService } from '@formio/angular/auth'; 3 | 4 | @Component({ 5 | selector: 'app-root', 6 | templateUrl: './app.component.html', 7 | styleUrls: ['./app.component.scss'] 8 | }) 9 | export class AppComponent { 10 | constructor(public auth: FormioAuthService) {} 11 | } 12 | -------------------------------------------------------------------------------- /src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { BrowserModule } from '@angular/platform-browser'; 2 | import { NgModule } from '@angular/core'; 3 | import { CommonModule } from '@angular/common'; 4 | import { RouterModule } from '@angular/router'; 5 | import { Formio, FormioModule, FormioAppConfig } from '@formio/angular'; 6 | // import premium from '@formio/premium'; 7 | // Formio.use(premium); 8 | import { FormioGrid } from '@formio/angular/grid'; 9 | import { FormioAuthService, FormioAuthConfig } from '@formio/angular/auth'; 10 | import { FormioResources } from '@formio/angular/resource'; 11 | import { PrismService } from './Prism.service'; 12 | 13 | import { AppConfig } from './config'; 14 | import { AppComponent } from './app.component'; 15 | import { HomeComponent } from './home/home.component'; 16 | import { DataComponent } from './data/data.component'; 17 | import { CustomSubmissionGridHeaderComponent } from './data/submission/SubmissionGridHeader.component'; 18 | 19 | // Make sure we use fontawesome everywhere in Form.io renderers. 20 | (Formio as any).icons = 'fontawesome'; 21 | 22 | /** 23 | * Import the Custom component CheckMatrix. 24 | */ 25 | // import './components/CheckMatrix'; 26 | 27 | @NgModule({ 28 | declarations: [ 29 | AppComponent, 30 | HomeComponent, 31 | DataComponent, 32 | CustomSubmissionGridHeaderComponent 33 | ], 34 | imports: [ 35 | BrowserModule, 36 | CommonModule, 37 | FormioModule, 38 | FormioGrid, 39 | RouterModule.forRoot([ 40 | { 41 | path: '', 42 | component: HomeComponent 43 | }, 44 | { 45 | path: 'data', 46 | component: DataComponent 47 | }, 48 | { 49 | path: 'forms', 50 | loadChildren: () => import('./forms/forms.module').then(m => m.FormsModule) 51 | }, 52 | { 53 | path: 'auth', 54 | loadChildren: () => import('./auth/auth.module').then(m => m.AuthModule) 55 | }, 56 | { 57 | path: 'event', 58 | loadChildren: () => import('./event/event.module').then(m => m.EventModule) 59 | }, 60 | { 61 | path: 'manager', 62 | loadChildren: () => import('./form/form.module').then(m => m.FormModule) 63 | } 64 | ], {useHash: true}) 65 | ], 66 | providers: [ 67 | PrismService, 68 | FormioAuthService, 69 | FormioResources, 70 | {provide: FormioAppConfig, useValue: AppConfig}, 71 | {provide: FormioAuthConfig, useValue: { 72 | login: { 73 | form: 'user/login' 74 | }, 75 | register: { 76 | form: 'user/register' 77 | } 78 | }} 79 | ], 80 | bootstrap: [AppComponent] 81 | }) 82 | export class AppModule { } 83 | -------------------------------------------------------------------------------- /src/app/auth/auth.module.spec.ts: -------------------------------------------------------------------------------- 1 | import { AuthModule } from './auth.module'; 2 | 3 | describe('AuthModule', () => { 4 | let authModule: AuthModule; 5 | 6 | beforeEach(() => { 7 | authModule = new AuthModule(); 8 | }); 9 | 10 | it('should create an instance', () => { 11 | expect(authModule).toBeTruthy(); 12 | }); 13 | }); 14 | -------------------------------------------------------------------------------- /src/app/auth/auth.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule } from '@angular/router'; 3 | import { CommonModule } from '@angular/common'; 4 | import { AuthComponent } from './auth/auth.component'; 5 | import { LoginComponent } from './login/login.component'; 6 | import { FormioModule } from '@formio/angular'; 7 | import { FormioAuth, FormioAuthRoutes } from '@formio/angular/auth'; 8 | 9 | export const authRoutes = FormioAuthRoutes({ 10 | auth: AuthComponent, 11 | login: LoginComponent 12 | }); 13 | 14 | @NgModule({ 15 | imports: [ 16 | CommonModule, 17 | FormioModule, 18 | FormioAuth, 19 | RouterModule.forChild(authRoutes) 20 | ], 21 | declarations: [AuthComponent, LoginComponent] 22 | }) 23 | export class AuthModule { } 24 | -------------------------------------------------------------------------------- /src/app/auth/auth/auth.component.html: -------------------------------------------------------------------------------- 1 |

Authentication

2 |

Authentication to your application is provided with the FormioAuthModule

3 | Authentication Documentation 4 |
5 |
6 |
7 |
You are logged in as {{ service.user.data.email }}
8 | 9 |
10 |
11 |
12 | 16 |
17 |
18 | 19 |
20 |
21 |
22 |
23 | -------------------------------------------------------------------------------- /src/app/auth/auth/auth.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/formio/angular-demo/df0c2ce2f1930211db57092757a0fdd8a9fed35c/src/app/auth/auth/auth.component.scss -------------------------------------------------------------------------------- /src/app/auth/auth/auth.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { AuthComponent } from './auth.component'; 4 | 5 | describe('AuthComponent', () => { 6 | let component: AuthComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ AuthComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(AuthComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/auth/auth/auth.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { FormioAuthComponent, FormioAuthService } from '@formio/angular/auth'; 3 | @Component({ 4 | selector: 'app-auth', 5 | templateUrl: './auth.component.html', 6 | styleUrls: ['./auth.component.scss'] 7 | }) 8 | export class AuthComponent extends FormioAuthComponent { 9 | constructor(public service: FormioAuthService) { 10 | super(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/app/auth/login/login.component.html: -------------------------------------------------------------------------------- 1 |
2 |

You can use the following to login.

3 | 7 |
8 | 9 | -------------------------------------------------------------------------------- /src/app/auth/login/login.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/formio/angular-demo/df0c2ce2f1930211db57092757a0fdd8a9fed35c/src/app/auth/login/login.component.scss -------------------------------------------------------------------------------- /src/app/auth/login/login.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { LoginComponent } from './login.component'; 4 | 5 | describe('LoginComponent', () => { 6 | let component: LoginComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ LoginComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(LoginComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/auth/login/login.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { FormioAuthLoginComponent, FormioAuthService } from '@formio/angular/auth'; 3 | @Component({ 4 | selector: 'app-login', 5 | templateUrl: './login.component.html', 6 | styleUrls: ['./login.component.scss'] 7 | }) 8 | export class LoginComponent extends FormioAuthLoginComponent { 9 | constructor(public service: FormioAuthService) { 10 | super(service); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/app/components/CheckMatrix.js: -------------------------------------------------------------------------------- 1 | /** 2 | * This file shows how to create a custom component and register that within an Angular application. 3 | * 4 | * Get the base component class by referencing Formio.Components.components map. 5 | */ 6 | import { Formio } from '@formio/angular'; 7 | const Base = (Formio as any).Components.components.component; 8 | const editForm = (Formio as any).Components.components.table.editForm; 9 | const Components = (Formio as any).Components; 10 | 11 | /** 12 | * Create a new CheckMatrixComponent "class" using ES5 class inheritance notation. 13 | * https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/Inheritance 14 | * 15 | * Here we will derive from the base component which all Form.io form components derive from. 16 | * 17 | * @param component 18 | * @param options 19 | * @param data 20 | * @constructor 21 | */ 22 | export default class CheckMatrix extends Base { 23 | constructor(component, options, data) { 24 | super(component, options, data); 25 | } 26 | 27 | static schema() { 28 | return Base.schema({ 29 | type: 'checkmatrix', 30 | numRows: 3, 31 | numCols: 3 32 | }); 33 | } 34 | 35 | static builderInfo = { 36 | title: 'Check Matrix', 37 | group: 'basic', 38 | icon: 'fa fa-table', 39 | weight: 70, 40 | documentation: 'http://help.form.io/userguide/#table', 41 | schema: CheckMatrix.schema() 42 | } 43 | 44 | static editForm = editForm 45 | 46 | /** 47 | * Render returns an html string of the fully rendered component. 48 | * 49 | * @param children - If this class is extendended, the sub string is passed as children. 50 | * @returns {string} 51 | */ 52 | render(children) { 53 | // To make this dynamic, we could call this.renderTemplate('templatename', {}). 54 | 55 | let tableClass = 'table '; 56 | ['striped', 'bordered', 'hover', 'condensed'].forEach((prop) => { 57 | if (this.component[prop]) { 58 | tableClass += `table-${prop} `; 59 | } 60 | }); 61 | 62 | let content = ''; 63 | 64 | for (let i = 0; i < this.component.numRows; i++) { 65 | let row = ''; 66 | for (let j = 0; j < this.component.numCols; j++) { 67 | let cell = ''; 68 | 69 | cell += this.renderTemplate('input', { 70 | input: { 71 | type: 'input', 72 | ref: `${this.component.key}-${i}`, 73 | attr: { 74 | id: `${this.component.key}-${i}-${j}`, 75 | class: 'form-control', 76 | type: 'checkbox', 77 | } 78 | } 79 | }); 80 | 81 | cell += ''; 82 | row += cell; 83 | } 84 | row += ''; 85 | content += row; 86 | } 87 | 88 | // Calling super.render will wrap it html as a component. 89 | return super.render(` 90 | 91 | 92 | ${content} 93 | 94 |
95 | `); 96 | } 97 | 98 | /** 99 | * After the html string has been mounted into the dom, the dom element is returned here. Use refs to find specific 100 | * elements to attach functionality to. 101 | * 102 | * @param element 103 | * @returns {Promise} 104 | */ 105 | attach(element) { 106 | const refs = {}; 107 | 108 | for (let i = 0; i < this.component.numRows; i++) { 109 | refs[`${this.component.key}-${i}`] = 'multiple'; 110 | } 111 | 112 | this.loadRefs(element, refs); 113 | 114 | this.checks = []; 115 | for (let i = 0; i < this.component.numRows; i++) { 116 | this.checks[i] = Array.prototype.slice.call(this.refs[`${this.component.key}-${i}`], 0); 117 | 118 | // Attach click events to each input in the row 119 | this.checks[i].forEach(input => { 120 | this.addEventListener(input, 'click', () => this.updateValue()) 121 | }); 122 | } 123 | 124 | // Allow basic component functionality to attach like field logic and tooltips. 125 | return super.attach(element); 126 | } 127 | 128 | /** 129 | * Get the value of the component from the dom elements. 130 | * 131 | * @returns {Array} 132 | */ 133 | getValue() { 134 | var value = []; 135 | for (var rowIndex in this.checks) { 136 | var row = this.checks[rowIndex]; 137 | value[rowIndex] = []; 138 | for (var colIndex in row) { 139 | var col = row[colIndex]; 140 | value[rowIndex][colIndex] = !!col.checked; 141 | } 142 | } 143 | return value; 144 | } 145 | 146 | /** 147 | * Set the value of the component into the dom elements. 148 | * 149 | * @param value 150 | * @returns {boolean} 151 | */ 152 | setValue(value) { 153 | if (!value) { 154 | return; 155 | } 156 | for (var rowIndex in this.checks) { 157 | var row = this.checks[rowIndex]; 158 | if (!value[rowIndex]) { 159 | break; 160 | } 161 | for (var colIndex in row) { 162 | var col = row[colIndex]; 163 | if (!value[rowIndex][colIndex]) { 164 | return false; 165 | } 166 | let checked = value[rowIndex][colIndex] ? 1 : 0; 167 | col.value = checked; 168 | col.checked = checked; 169 | } 170 | } 171 | } 172 | } 173 | 174 | // Use the table component edit form. 175 | CheckMatrix.editForm = editForm; 176 | 177 | // Register the component to the Formio.Components registry. 178 | Components.addComponent('checkmatrix', CheckMatrix); 179 | -------------------------------------------------------------------------------- /src/app/config.ts: -------------------------------------------------------------------------------- 1 | export const AppConfig = { 2 | appUrl: 'https://example.form.io', 3 | apiUrl: 'https://api.form.io' 4 | }; 5 | -------------------------------------------------------------------------------- /src/app/data/data.component.html: -------------------------------------------------------------------------------- 1 |

Data Tables

2 |

The data table is provided through the FormioGridModule, and provides you a way to easily embed a data table within your application with the following code.

3 |
<formio-grid src="https://examples.form.io/company"></formio-grid>
4 | Data Table Documentation 5 | 6 | -------------------------------------------------------------------------------- /src/app/data/data.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/formio/angular-demo/df0c2ce2f1930211db57092757a0fdd8a9fed35c/src/app/data/data.component.scss -------------------------------------------------------------------------------- /src/app/data/data.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { DataComponent } from './data.component'; 4 | 5 | describe('DataComponent', () => { 6 | let component: DataComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ DataComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(DataComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/data/data.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, AfterViewInit, ViewEncapsulation } from '@angular/core'; 2 | import { FormioAppConfig } from '@formio/angular'; 3 | import { FormioAuthService } from '@formio/angular/auth'; 4 | import SubmissionComponents from './submission/index'; 5 | import { PrismService } from '../Prism.service'; 6 | @Component({ 7 | selector: 'app-data', 8 | templateUrl: './data.component.html', 9 | styleUrls: ['./data.component.scss'], 10 | encapsulation: ViewEncapsulation.None 11 | }) 12 | export class DataComponent implements AfterViewInit { 13 | 14 | public components = SubmissionComponents; 15 | 16 | constructor( 17 | public auth: FormioAuthService, 18 | public config: FormioAppConfig, 19 | public prism: PrismService 20 | ) {} 21 | 22 | ngAfterViewInit() { 23 | this.prism.init(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/app/data/submission/SubmissionGridHeader.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Custom 6 | 7 | {{ header.label }}  8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/app/data/submission/SubmissionGridHeader.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from "@angular/core"; 2 | import { SubmissionGridHeaderComponent } from "@formio/angular/grid"; 3 | 4 | @Component({ 5 | templateUrl: './SubmissionGridHeader.component.html' 6 | }) 7 | export class CustomSubmissionGridHeaderComponent extends SubmissionGridHeaderComponent {} 8 | -------------------------------------------------------------------------------- /src/app/data/submission/index.ts: -------------------------------------------------------------------------------- 1 | import { SubmissionGridBodyComponent, SubmissionGridFooterComponent } from "@formio/angular/grid"; 2 | import { CustomSubmissionGridHeaderComponent } from "./SubmissionGridHeader.component"; 3 | 4 | export default { 5 | header: CustomSubmissionGridHeaderComponent, 6 | body: SubmissionGridBodyComponent, 7 | footer: SubmissionGridFooterComponent 8 | }; 9 | -------------------------------------------------------------------------------- /src/app/event/event.module.spec.ts: -------------------------------------------------------------------------------- 1 | import { EventModule } from './event.module'; 2 | 3 | describe('EventModule', () => { 4 | let eventModule: EventModule; 5 | 6 | beforeEach(() => { 7 | eventModule = new EventModule(); 8 | }); 9 | 10 | it('should create an instance', () => { 11 | expect(eventModule).toBeTruthy(); 12 | }); 13 | }); 14 | -------------------------------------------------------------------------------- /src/app/event/event.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { ResourceComponent } from './resource/resource.component'; 4 | import { ViewComponent } from './view/view.component'; 5 | import { RouterModule } from '@angular/router'; 6 | import { FormioModule } from '@formio/angular'; 7 | import { 8 | FormioResource, 9 | FormioResourceConfig, 10 | FormioResourceService, 11 | FormioResourceIndexComponent, 12 | FormioResourceCreateComponent, 13 | FormioResourceEditComponent, 14 | FormioResourceDeleteComponent 15 | } from '@formio/angular/resource'; 16 | 17 | @NgModule({ 18 | imports: [ 19 | CommonModule, 20 | FormioModule, 21 | FormioResource, 22 | RouterModule.forChild([ 23 | { 24 | path: '', 25 | component: FormioResourceIndexComponent 26 | }, 27 | { 28 | path: 'new', 29 | component: FormioResourceCreateComponent 30 | }, 31 | { 32 | path: ':id', 33 | component: ResourceComponent, 34 | children: [ 35 | { 36 | path: '', 37 | redirectTo: 'view', 38 | pathMatch: 'full' 39 | }, 40 | { 41 | path: 'view', 42 | component: ViewComponent 43 | }, 44 | { 45 | path: 'edit', 46 | component: FormioResourceEditComponent 47 | }, 48 | { 49 | path: 'delete', 50 | component: FormioResourceDeleteComponent 51 | }, 52 | { 53 | path: 'participant', 54 | loadChildren: () => import('./participant/participant.module').then(x => x.ParticipantModule) 55 | } 56 | ] 57 | } 58 | ]) 59 | ], 60 | declarations: [ResourceComponent, ViewComponent], 61 | providers: [ 62 | FormioResourceService, 63 | { 64 | provide: FormioResourceConfig, 65 | useValue: { 66 | name: 'event', 67 | form: 'event' 68 | } 69 | } 70 | ] 71 | }) 72 | export class EventModule { } 73 | -------------------------------------------------------------------------------- /src/app/event/participant/participant.module.spec.ts: -------------------------------------------------------------------------------- 1 | import { ParticipantModule } from './participant.module'; 2 | 3 | describe('ParticipantModule', () => { 4 | let participantModule: ParticipantModule; 5 | 6 | beforeEach(() => { 7 | participantModule = new ParticipantModule(); 8 | }); 9 | 10 | it('should create an instance', () => { 11 | expect(participantModule).toBeTruthy(); 12 | }); 13 | }); 14 | -------------------------------------------------------------------------------- /src/app/event/participant/participant.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { RouterModule } from '@angular/router'; 4 | import { FormioModule } from '@formio/angular'; 5 | import { 6 | FormioResource, 7 | FormioResourceRoutes, 8 | FormioResourceConfig, 9 | FormioResourceService 10 | } from '@formio/angular/resource'; 11 | 12 | @NgModule({ 13 | imports: [ 14 | CommonModule, 15 | FormioModule, 16 | FormioResource, 17 | RouterModule.forChild(FormioResourceRoutes()) 18 | ], 19 | declarations: [], 20 | providers: [ 21 | FormioResourceService, 22 | { 23 | provide: FormioResourceConfig, 24 | useValue: { 25 | name: 'participant', 26 | form: 'participant', 27 | parents: [ 28 | 'event', 29 | { 30 | field: 'user', 31 | resource: 'currentUser', 32 | filter: false 33 | } 34 | ] 35 | } 36 | } 37 | ] 38 | }) 39 | export class ParticipantModule { } 40 | -------------------------------------------------------------------------------- /src/app/event/resource/resource.component.html: -------------------------------------------------------------------------------- 1 | 8 | 9 | -------------------------------------------------------------------------------- /src/app/event/resource/resource.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/formio/angular-demo/df0c2ce2f1930211db57092757a0fdd8a9fed35c/src/app/event/resource/resource.component.scss -------------------------------------------------------------------------------- /src/app/event/resource/resource.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ResourceComponent } from './resource.component'; 4 | 5 | describe('ResourceComponent', () => { 6 | let component: ResourceComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ ResourceComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ResourceComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/event/resource/resource.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { FormioResourceComponent } from '@formio/angular/resource'; 3 | 4 | @Component({ 5 | selector: 'app-resource', 6 | templateUrl: './resource.component.html', 7 | styleUrls: ['./resource.component.scss'] 8 | }) 9 | export class ResourceComponent extends FormioResourceComponent {} 10 | -------------------------------------------------------------------------------- /src/app/event/view/view.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 | {{ service.resource?.data.start | date }} to {{ service.resource?.data.end | date }} 6 |
7 |
8 |

{{ service.resource?.data.title }}

9 |

10 |
11 |
12 |
13 |
14 |
15 |
16 |

Registration

17 |
18 |
19 | Register Now 20 |
21 |
22 |
23 |
24 | -------------------------------------------------------------------------------- /src/app/event/view/view.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/formio/angular-demo/df0c2ce2f1930211db57092757a0fdd8a9fed35c/src/app/event/view/view.component.scss -------------------------------------------------------------------------------- /src/app/event/view/view.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ViewComponent } from './view.component'; 4 | 5 | describe('ViewComponent', () => { 6 | let component: ViewComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ ViewComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ViewComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/event/view/view.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { FormioResourceViewComponent } from '@formio/angular/resource'; 3 | 4 | @Component({ 5 | selector: 'app-view', 6 | templateUrl: './view.component.html', 7 | styleUrls: ['./view.component.scss'] 8 | }) 9 | export class ViewComponent extends FormioResourceViewComponent {} 10 | -------------------------------------------------------------------------------- /src/app/form/form.module.spec.ts: -------------------------------------------------------------------------------- 1 | import { FormModule } from './form.module'; 2 | 3 | describe('FormModule', () => { 4 | let formModule: FormModule; 5 | 6 | beforeEach(() => { 7 | formModule = new FormModule(); 8 | }); 9 | 10 | it('should create an instance', () => { 11 | expect(formModule).toBeTruthy(); 12 | }); 13 | }); 14 | -------------------------------------------------------------------------------- /src/app/form/form.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { CommonModule } from '@angular/common'; 3 | import { RouterModule } from '@angular/router'; 4 | import { FormioGrid } from '@formio/angular/grid'; 5 | import { FormManagerModule, FormManagerRoutes, FormManagerService, FormManagerConfig } from '@formio/angular/manager'; 6 | import { IndexComponent } from './index/index.component'; 7 | 8 | @NgModule({ 9 | imports: [ 10 | CommonModule, 11 | FormioGrid, 12 | FormManagerModule, 13 | RouterModule.forChild(FormManagerRoutes({ 14 | formIndex: IndexComponent 15 | })) 16 | ], 17 | declarations: [ 18 | IndexComponent 19 | ], 20 | providers: [ 21 | FormManagerService, 22 | {provide: FormManagerConfig, useValue: { 23 | tag: 'common' 24 | }} 25 | ] 26 | }) 27 | export class FormModule { } 28 | -------------------------------------------------------------------------------- /src/app/form/index/index.component.html: -------------------------------------------------------------------------------- 1 |
You must to use the Form Manager.
2 | 12 | -------------------------------------------------------------------------------- /src/app/form/index/index.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/formio/angular-demo/df0c2ce2f1930211db57092757a0fdd8a9fed35c/src/app/form/index/index.component.scss -------------------------------------------------------------------------------- /src/app/form/index/index.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { IndexComponent } from './index.component'; 4 | 5 | describe('IndexComponent', () => { 6 | let component: IndexComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ IndexComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(IndexComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/form/index/index.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { Router, ActivatedRoute } from '@angular/router'; 3 | import { FormManagerIndexComponent, FormManagerService, FormManagerConfig } from '@formio/angular/manager'; 4 | import { FormioAuthService } from '@formio/angular/auth'; 5 | 6 | @Component({ 7 | selector: 'app-index', 8 | templateUrl: './index.component.html', 9 | styleUrls: ['./index.component.scss'] 10 | }) 11 | export class IndexComponent extends FormManagerIndexComponent { 12 | constructor( 13 | public auth: FormioAuthService, 14 | public service: FormManagerService, 15 | public route: ActivatedRoute, 16 | public router: Router, 17 | public config: FormManagerConfig 18 | ) { 19 | super(service, route, router, config); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/app/forms/builder/builder.component.html: -------------------------------------------------------------------------------- 1 |

Dynamic JSON Form Builder

2 |

The Form.io form builder interface allows you to embed a form builder within your application, which generates a JSON schema of the form created.

3 |

Builder Documentation

4 | builder.html 5 |
<form-builder [form]="form" (change)="onChange($event)"></form-builder>
6 | builder.ts 7 |
import { Component, ElementRef, ViewChild } from '@angular/core';
 8 | @Component({
 9 |   template: require('./builder.html')
10 | })
11 | export class BuilderComponent {
12 |   @ViewChild('json') jsonElement?: ElementRef;
13 |   public form: Object = {components: []};
14 |   onChange(event) {
15 |     console.log(event.form);
16 |   }
17 | }
18 | 19 |
20 |

As JSON Schema

21 |
22 |
23 |
24 |

As Rendered Form

25 |
26 | 27 |
28 | -------------------------------------------------------------------------------- /src/app/forms/builder/builder.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/formio/angular-demo/df0c2ce2f1930211db57092757a0fdd8a9fed35c/src/app/forms/builder/builder.component.scss -------------------------------------------------------------------------------- /src/app/forms/builder/builder.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { BuilderComponent } from './builder.component'; 4 | 5 | describe('BuilderComponent', () => { 6 | let component: BuilderComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ BuilderComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(BuilderComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/forms/builder/builder.component.ts: -------------------------------------------------------------------------------- 1 | import { FormioRefreshValue } from '@formio/angular'; 2 | import { Component, AfterViewInit, ViewChild, ElementRef, EventEmitter } from '@angular/core'; 3 | import { PrismService } from '../../Prism.service'; 4 | 5 | @Component({ 6 | selector: 'app-builder', 7 | templateUrl: './builder.component.html', 8 | styleUrls: ['./builder.component.scss'] 9 | }) 10 | export class BuilderComponent implements AfterViewInit { 11 | @ViewChild('json', {static: true}) jsonElement?: ElementRef; 12 | @ViewChild('code', {static: true}) codeElement?: ElementRef; 13 | public form: Object; 14 | public refreshForm: EventEmitter = new EventEmitter(); 15 | constructor(public prism: PrismService) { 16 | this.form = {components: []}; 17 | } 18 | 19 | onChange(event) { 20 | this.jsonElement.nativeElement.innerHTML = ''; 21 | this.jsonElement.nativeElement.appendChild(document.createTextNode(JSON.stringify(event.form, null, 4))); 22 | this.refreshForm.emit({ 23 | property: 'form', 24 | value: event.form 25 | }); 26 | } 27 | 28 | ngAfterViewInit() { 29 | this.prism.init(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/app/forms/custom-builder/builder.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |

The Form.io form builder interface allows you to embed a form builder within your application, which generates a JSON schema of the form created.

4 |

Builder Documentation

5 |

6 | One of the features of builder that user can change different options. 7 | For example language. Options can be provided via [options] property. 8 |

9 |
10 |
<form-builder [form]="form" [options]="options"></form-builder>
11 |
12 |

Options can be look like:

13 |
14 |
exprort const options = {
15 |   language: 'en',
16 |   i18n: {
17 |     jp: {
18 |       'Label': 'ラベル',
19 |       'Label Position': 'ラベルの位置',
20 |       'Placeholder': 'プレースホルダー',
21 |       'Description': '説明文'
22 |     }
23 |   }
24 | }
25 |       
26 |
27 |

Also builder can be updated with the new options via 28 | 29 | [rebuild] 30 | 31 |

32 |
33 |
<form-builder [form]="form" [options]="options" [rebuild]="rebuildEmitter.asObservable()"
34 |
35 |

36 | Rebuid emitter can be Observable and used to set the new options like this: 37 |

38 |
39 |
this.rebuildEmitter.next(this.options)
40 |
41 |
42 |
43 |
44 | 45 | 46 |
47 | 48 |
49 |

As JSON Schema

50 |
51 |
52 |
53 | -------------------------------------------------------------------------------- /src/app/forms/custom-builder/builder.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, AfterViewInit, ViewChild, ElementRef } from '@angular/core'; 2 | import { PrismService } from '../../Prism.service'; 3 | import { options } from './options'; 4 | import {Observable, Subject} from "rxjs"; 5 | 6 | @Component({ 7 | selector: 'app-builder', 8 | templateUrl: './builder.component.html', 9 | }) 10 | export class CustomBuilderComponent implements AfterViewInit { 11 | @ViewChild('json', {static: true}) jsonElement?: ElementRef; 12 | @ViewChild('code', {static: true}) codeElement?: ElementRef; 13 | public form: Object; 14 | public options: any; 15 | public language: string; 16 | public rebuildEmitter: Subject = new Subject(); 17 | 18 | constructor(public prism: PrismService) { 19 | this.options = options; 20 | this.form = {components: []}; 21 | } 22 | 23 | onChange(event) { 24 | this.jsonElement.nativeElement.innerHTML = ''; 25 | this.jsonElement.nativeElement.appendChild(document.createTextNode(JSON.stringify(event.form, null, 4))); 26 | } 27 | 28 | ngAfterViewInit() { 29 | this.prism.init(); 30 | } 31 | 32 | changeLanguage(language: string) { 33 | this.language = language; 34 | this.options.language = this.language; 35 | this.rebuildEmitter.next(this.options); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/app/forms/custom-builder/options.ts: -------------------------------------------------------------------------------- 1 | export const options = { 2 | builder: { 3 | basic: false, 4 | data: false, 5 | premium: false, 6 | customBasic: { 7 | title: 'Basic Components', 8 | default: true, 9 | weight: 0, 10 | components: { 11 | textfield: true, 12 | textarea: true, 13 | email: true 14 | } 15 | }, 16 | advanced: { 17 | components: { 18 | email: false, 19 | url: false, 20 | tags: false, 21 | address: false, 22 | survey: false, 23 | currency: false, 24 | signature: false, 25 | day: false, 26 | phoneNumber: false, 27 | datetime: false 28 | } 29 | }, 30 | layout: { 31 | title: 'Layout Components', 32 | weight: 0, 33 | components: { 34 | panel: true, 35 | table: false, 36 | tabs: false, 37 | well: false, 38 | columns: false, 39 | fieldset: false, 40 | content: false, 41 | htmlelement: false 42 | } 43 | } 44 | }, 45 | language: 'en', 46 | i18n: { 47 | jp: { 48 | 'Label': 'ラベル', 49 | 'Label Position': 'ラベルの位置', 50 | 'Placeholder': 'プレースホルダー', 51 | 'Description': '説明文', 52 | 'Tooltip': 'ツールチップ', 53 | 'Prefix': '接頭辞', 54 | 'Suffix': 'サフィックス', 55 | 'Widget': 'ウィジェット', 56 | 'Input Mask': '定型入力', 57 | 'Custom CSS Class': 'カスタムCSSクラス', 58 | 'Tab Index': 'タブインデックス', 59 | 'Hidden ': '隠された', 60 | 'Hide Label': 'ラベルを非表示', 61 | 'Show Word Counter': 'ワードカウンターを表示', 62 | 'Show Character Counter': 'キャラクターカウンターを表示', 63 | 'Hide Input': '入力を非表示', 64 | 'Excellent': 'Excelente', 65 | 'Initial Focus': '最初の焦点', 66 | 'Allow Spellcheck': 'スペルチェックを許可', 67 | 'Disabled': '無効', 68 | 'Table View': 'テーブルビュー', 69 | 'Modal Edit': 'モーダル編集', 70 | 'Multiple Values': '複数の値', 71 | 'Persistent': '持続的', 72 | 'Input Format': '入力フォーマット', 73 | 'Protected': '保護された', 74 | 'Database Index': 'データベースインデックス', 75 | 'Mixed (Allow upper and lower case)': '混合(大文字と小文字を許可)', 76 | 'Uppercase': '大文字', 77 | 'Lowercase': '小文字', 78 | 'Encrypted (Enterprise Only)': '暗号化(エンタープライズのみ)', 79 | 'Default Value': 'デフォルト値', 80 | 'Drag and Drop a form component': 'フォームコンポーネントをドラッグアンドドロップする', 81 | 'Text Field': 'テキストフィールド', 82 | 'Email': '電子メイル', 83 | 'Text Area': 'テキスト領域', 84 | 'Panel': 'パネル', 85 | 'Time': '時間', 86 | 'Submit': '参加する', 87 | 'Basic Components': '基本的なコンポーネント', 88 | 'Layout Components': 'レイアウトコンポーネント', 89 | 'Advanced': '高度な', 90 | 'Hidden': '隠された', 91 | 'Component': '成分', 92 | 'Display': '表示', 93 | 'Data': 'データ', 94 | 'Validation': '検証', 95 | 'API': 'アプリケーションプログラミングインターフェース', 96 | 'Conditional': '条件付き', 97 | 'Logic': '論理', 98 | 'Layout': 'レイアウト', 99 | 'Allow Multiple Masks': '複数のマスクを許可', 100 | 'Input Field': '入力フィールド', 101 | 'Top': '上', 102 | 'Input Type': '入力方式', 103 | 'Collapsible': '折りたたみ', 104 | 'Preview': 'プレビュー', 105 | 'Text Case': 'テキストケース', 106 | 'Redraw On': '再描画', 107 | 'Clear Value When Hidden': '非表示のときに値をクリア', 108 | 'Custom Default Value': 'カスタムデフォルト値', 109 | 'Calculated Value': '計算値', 110 | 'Calculate Value on server': 'サーバーで値を計算する', 111 | 'Allow Manual Override of Calculated Value': '計算値の手動オーバーライドを許可', 112 | 'Server': 'サーバ', 113 | 'Client': 'クライアント', 114 | 'None': '無し', 115 | 'Validate On': '検証', 116 | 'Required': '必須', 117 | 'Unique': 'ユニークな', 118 | 'Minimum Length': '最小の長さ', 119 | 'Maximum Length': '最大長', 120 | 'Minimum Word Length': '最小語長', 121 | 'Maximum Word Length': '最大語長', 122 | 'Regular Expression Pattern': '正規表現パターン', 123 | 'Error Label': 'エラーラベル', 124 | 'Custom Error Message': 'カスタムエラーメッセージ', 125 | 'Custom Validation': 'カスタム検証', 126 | 'JSONLogic Validation': 'JSONLogic検証', 127 | 'Property Name': 'プロパティ名', 128 | 'Field Tags': 'フィールドタグ', 129 | 'Custom Properties': 'カスタムプロパティ', 130 | 'Add Another': 'さらに追加', 131 | 'Save': 'セーブ', 132 | 'Cancel': 'キャンセル', 133 | 'Remove': '削除する', 134 | 'Rows': '行', 135 | 'Title': '題名', 136 | 'Theme': 'テーマ', 137 | 'Data Format': 'データフォーマット', 138 | 'Advanced Logic': '高度なロジック', 139 | 'Advanced Conditions': '高度な条件', 140 | 'Simple': 'シンプルな', 141 | 'HTML Attributes': 'HTML属性', 142 | 'PDF Overlay': 'PDFオーバーレイ' 143 | } 144 | } 145 | }; 146 | -------------------------------------------------------------------------------- /src/app/forms/forms.index.ts: -------------------------------------------------------------------------------- 1 | import { LanguageComponent } from './language/language.component'; 2 | import { BuilderComponent } from './builder/builder.component'; 3 | import { SimpleComponent } from './simple/simple.component'; 4 | import { RendererComponent } from './renderer/renderer.component'; 5 | import { WizardComponent } from './wizard/wizard.component'; 6 | import { PdfComponent } from './pdf/pdf.component'; 7 | import {CustomBuilderComponent} from "./custom-builder/builder.component"; 8 | export const FORMS: any = [ 9 | { 10 | path: '', 11 | redirectTo: 'renderer', 12 | pathMatch: 'full' 13 | }, 14 | { 15 | path: 'renderer', 16 | title: 'Form Renderer', 17 | component: RendererComponent 18 | }, 19 | { 20 | path: 'builder', 21 | title: 'Form Builder', 22 | component: BuilderComponent 23 | }, 24 | { 25 | path: 'custom-builder', 26 | title: 'Custom Builder', 27 | component: CustomBuilderComponent 28 | }, 29 | { 30 | path: 'simple', 31 | title: 'Simple Form', 32 | component: SimpleComponent 33 | }, 34 | { 35 | path: 'wizard', 36 | title: 'Wizard Form', 37 | component: WizardComponent 38 | }, 39 | { 40 | path: 'pdf', 41 | title: 'PDF Form', 42 | component: PdfComponent 43 | }, 44 | { 45 | path: 'language', 46 | title: 'Multi-Language', 47 | component: LanguageComponent 48 | } 49 | ]; 50 | -------------------------------------------------------------------------------- /src/app/forms/forms.module.spec.ts: -------------------------------------------------------------------------------- 1 | import { FormsModule } from './forms.module'; 2 | 3 | describe('FormsModule', () => { 4 | let formsModule: FormsModule; 5 | 6 | beforeEach(() => { 7 | formsModule = new FormsModule(); 8 | }); 9 | 10 | it('should create an instance', () => { 11 | expect(formsModule).toBeTruthy(); 12 | }); 13 | }); 14 | -------------------------------------------------------------------------------- /src/app/forms/forms.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule } from '@angular/router'; 3 | import { CommonModule } from '@angular/common'; 4 | import { FormioModule } from '@formio/angular'; 5 | import { BuilderComponent } from './builder/builder.component'; 6 | import {CustomBuilderComponent} from './custom-builder/builder.component'; 7 | import { KitchenComponent } from './kitchen/kitchen.component'; 8 | import { LanguageComponent } from './language/language.component'; 9 | import { PdfComponent } from './pdf/pdf.component'; 10 | import { RendererComponent } from './renderer/renderer.component'; 11 | import { SimpleComponent } from './simple/simple.component'; 12 | import { WizardComponent } from './wizard/wizard.component'; 13 | import { FormsComponent } from './forms/forms.component'; 14 | import { FORMS } from './forms.index'; 15 | 16 | @NgModule({ 17 | imports: [ 18 | CommonModule, 19 | FormioModule, 20 | RouterModule.forChild([{ 21 | path: '', 22 | component: FormsComponent, 23 | children: FORMS 24 | }]) 25 | ], 26 | declarations: [ 27 | CustomBuilderComponent, 28 | BuilderComponent, 29 | KitchenComponent, 30 | LanguageComponent, 31 | PdfComponent, 32 | RendererComponent, 33 | SimpleComponent, 34 | WizardComponent, 35 | FormsComponent 36 | ], 37 | bootstrap: [ 38 | FormsComponent 39 | ] 40 | }) 41 | export class FormsModule { } 42 | -------------------------------------------------------------------------------- /src/app/forms/forms/forms.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 8 |
9 |
10 | 11 |
12 |
13 | -------------------------------------------------------------------------------- /src/app/forms/forms/forms.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/formio/angular-demo/df0c2ce2f1930211db57092757a0fdd8a9fed35c/src/app/forms/forms/forms.component.scss -------------------------------------------------------------------------------- /src/app/forms/forms/forms.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { FormsComponent } from './forms.component'; 4 | 5 | describe('FormsComponent', () => { 6 | let component: FormsComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ FormsComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(FormsComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/forms/forms/forms.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { FORMS } from '../forms.index'; 3 | 4 | @Component({ 5 | selector: 'app-forms', 6 | templateUrl: './forms.component.html', 7 | styleUrls: ['./forms.component.scss'] 8 | }) 9 | export class FormsComponent implements OnInit { 10 | public forms: any[]; 11 | constructor() { 12 | this.forms = FORMS.filter((item: any) => { 13 | return !!item.path; 14 | }); 15 | } 16 | 17 | ngOnInit() { 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/app/forms/kitchen/form.ts: -------------------------------------------------------------------------------- 1 | export const FORM: any = { 2 | title: 'Registration Form', 3 | components: [ 4 | { 5 | input: true, 6 | tree: true, 7 | components: [ 8 | { 9 | input: false, 10 | columns: [ 11 | { 12 | components: [ 13 | { 14 | input: true, 15 | tableView: true, 16 | inputType: 'text', 17 | inputMask: '', 18 | label: 'First Name', 19 | key: 'firstName', 20 | placeholder: 'Enter your first name', 21 | prefix: '', 22 | suffix: '', 23 | multiple: false, 24 | defaultValue: '', 25 | protected: false, 26 | unique: false, 27 | persistent: true, 28 | validate: { 29 | required: false, 30 | minLength: 6, 31 | maxLength: 10, 32 | pattern: '', 33 | custom: '', 34 | customPrivate: false 35 | }, 36 | conditional: { 37 | show: '', 38 | when: null, 39 | eq: '' 40 | }, 41 | type: 'textfield' 42 | }, 43 | { 44 | type: 'email', 45 | persistent: true, 46 | unique: false, 47 | protected: false, 48 | defaultValue: '', 49 | suffix: '', 50 | prefix: '', 51 | placeholder: 'Enter your email address', 52 | key: 'email', 53 | label: 'Email', 54 | inputType: 'email', 55 | tableView: true, 56 | input: true 57 | }, 58 | { 59 | input: true, 60 | inputType: 'checkbox', 61 | tableView: true, 62 | hideLabel: true, 63 | label: 'Do you have a phone number?', 64 | key: 'havePhoneNumber', 65 | defaultValue: false, 66 | protected: false, 67 | persistent: true, 68 | validate: { 69 | required: false 70 | }, 71 | type: 'checkbox', 72 | conditional: { 73 | show: '', 74 | when: null, 75 | eq: '' 76 | }, 77 | lockKey: true 78 | }, 79 | { 80 | input: true, 81 | tableView: true, 82 | inputMask: '(999) 999-9999', 83 | label: 'Phone Number', 84 | key: 'phoneNumber', 85 | placeholder: '', 86 | prefix: '', 87 | suffix: '', 88 | multiple: false, 89 | protected: false, 90 | unique: false, 91 | persistent: true, 92 | defaultValue: '', 93 | validate: { 94 | required: false 95 | }, 96 | type: 'phoneNumber', 97 | conditional: { 98 | show: 'true', 99 | when: 'havePhoneNumber', 100 | eq: 'true' 101 | } 102 | } 103 | ] 104 | }, 105 | { 106 | components: [ 107 | { 108 | input: true, 109 | tableView: true, 110 | inputType: 'text', 111 | inputMask: '', 112 | label: 'Last Name', 113 | key: 'lastName', 114 | placeholder: 'Enter your last name', 115 | prefix: '', 116 | suffix: '', 117 | multiple: false, 118 | defaultValue: '', 119 | protected: false, 120 | unique: false, 121 | persistent: true, 122 | validate: { 123 | required: false, 124 | minLength: 2, 125 | maxLength: 10, 126 | pattern: '', 127 | custom: '', 128 | customPrivate: false 129 | }, 130 | conditional: { 131 | show: '', 132 | when: null, 133 | eq: '' 134 | }, 135 | type: 'textfield' 136 | }, 137 | { 138 | input: true, 139 | tableView: true, 140 | inputType: 'number', 141 | inputMask: '', 142 | label: 'Number', 143 | key: 'number', 144 | placeholder: 'Enter Number', 145 | prefix: '', 146 | suffix: '', 147 | multiple: false, 148 | defaultValue: 0, 149 | protected: false, 150 | unique: false, 151 | persistent: true, 152 | validate: { 153 | required: false, 154 | min: 10, 155 | max: 100, 156 | step: 5, 157 | custom: '', 158 | customPrivate: false 159 | }, 160 | conditional: { 161 | show: '', 162 | when: null, 163 | eq: '' 164 | }, 165 | type: 'number' 166 | }, 167 | { 168 | input: true, 169 | tableView: false, 170 | inputType: 'password', 171 | label: 'Password', 172 | key: 'password', 173 | placeholder: 'Enter Your Password', 174 | prefix: '$', 175 | suffix: '@', 176 | defaultValue: '', 177 | protected: true, 178 | persistent: true, 179 | type: 'password', 180 | conditional: { 181 | show: null, 182 | when: null, 183 | eq: '' 184 | }, 185 | validate: { 186 | required: false, 187 | minLength: 8, 188 | maxLength: 20, 189 | pattern: '', 190 | custom: '', 191 | customPrivate: false 192 | }, 193 | unique: true 194 | } 195 | ] 196 | } 197 | ], 198 | type: 'columns', 199 | key: 'columns', 200 | conditional: { 201 | show: '', 202 | when: null, 203 | eq: '' 204 | } 205 | }, 206 | { 207 | type: 'textfield', 208 | conditional: { 209 | eq: '', 210 | when: null, 211 | show: '' 212 | }, 213 | validate: { 214 | customPrivate: false, 215 | custom: '', 216 | pattern: '', 217 | maxLength: '', 218 | minLength: '', 219 | required: false 220 | }, 221 | persistent: true, 222 | unique: false, 223 | protected: false, 224 | defaultValue: '', 225 | multiple: true, 226 | suffix: '', 227 | prefix: '', 228 | placeholder: 'Enter your kids names', 229 | key: 'kids', 230 | label: 'Kids', 231 | inputMask: '', 232 | inputType: 'text', 233 | tableView: true, 234 | input: true 235 | } 236 | ], 237 | tableView: true, 238 | label: '', 239 | key: 'user', 240 | protected: false, 241 | persistent: true, 242 | type: 'container', 243 | conditional: { 244 | show: '', 245 | when: null, 246 | eq: '' 247 | }, 248 | lockKey: true 249 | }, 250 | { 251 | input: true, 252 | tableView: true, 253 | label: 'Day', 254 | key: 'day', 255 | fields: { 256 | day: { 257 | type: 'text', 258 | placeholder: 'Enter day', 259 | required: true 260 | }, 261 | month: { 262 | type: 'select', 263 | placeholder: 'Select month', 264 | required: true 265 | }, 266 | year: { 267 | type: 'text', 268 | placeholder: 'Enter year', 269 | required: true 270 | } 271 | }, 272 | dayFirst: true, 273 | protected: false, 274 | persistent: true, 275 | validate: { 276 | custom: '' 277 | }, 278 | type: 'day', 279 | tags: [], 280 | conditional: { 281 | show: '', 282 | when: null, 283 | eq: '' 284 | }, 285 | customClass: 'dayCustomClass', 286 | tabindex: '5' 287 | }, 288 | { 289 | input: true, 290 | tree: true, 291 | components: [{ 292 | input: true, 293 | tableView: true, 294 | inputType: 'text', 295 | inputMask: '', 296 | label: 'Make', 297 | key: 'make', 298 | placeholder: 'Chevy, Ford, etc.', 299 | prefix: '', 300 | suffix: '', 301 | multiple: false, 302 | defaultValue: '', 303 | protected: false, 304 | unique: false, 305 | persistent: true, 306 | validate: { 307 | required: false, 308 | minLength: '', 309 | maxLength: '', 310 | pattern: '', 311 | custom: '', 312 | customPrivate: false 313 | }, 314 | conditional: '{"show": "", "when": null, "eq": ""}', 315 | type: 'textfield', 316 | hideLabel: true 317 | }, { 318 | input: true, 319 | tableView: true, 320 | inputType: 'text', 321 | inputMask: '', 322 | label: 'Model', 323 | key: 'model', 324 | placeholder: 'Tahoe, F-150, etc.', 325 | prefix: '', 326 | suffix: '', 327 | multiple: false, 328 | defaultValue: '', 329 | protected: false, 330 | unique: false, 331 | persistent: true, 332 | validate: { 333 | required: false, 334 | minLength: '', 335 | maxLength: '', 336 | pattern: '', 337 | custom: '', 338 | customPrivate: false 339 | }, 340 | conditional: '{"show": "", "when": null, "eq": ""}', 341 | type: 'textfield', 342 | hideLabel: true 343 | }, { 344 | input: true, 345 | tableView: true, 346 | inputType: 'text', 347 | inputMask: '', 348 | label: 'Year', 349 | key: 'year', 350 | placeholder: '2014, 2015, etc', 351 | prefix: '', 352 | suffix: '', 353 | multiple: false, 354 | defaultValue: '', 355 | protected: false, 356 | unique: false, 357 | persistent: true, 358 | validate: { 359 | required: false, 360 | minLength: '', 361 | maxLength: '', 362 | pattern: '', 363 | custom: '', 364 | customPrivate: false 365 | }, 366 | conditional: '{"show": "", "when": null, "eq": ""}', 367 | type: 'textfield', 368 | hideLabel: true 369 | }], 370 | tableView: true, 371 | label: 'Cars', 372 | key: 'cars', 373 | protected: false, 374 | persistent: true, 375 | type: 'datagrid', 376 | conditional: '{"show": "", "when": null, "eq": ""}', 377 | striped: true, 378 | bordered: true 379 | }, 380 | { 381 | input: false, 382 | html: '

Good Morning Guys!!!
This is Content component.

', 383 | type: 'content', 384 | conditional: { 385 | show: null, 386 | when: null, 387 | eq: '' 388 | }, 389 | key: 'mycontent', 390 | lockKey: true 391 | }, 392 | { 393 | input: false, 394 | numRows: 2, 395 | numCols: 2, 396 | rows: [ 397 | [{ 398 | components: [{ 399 | input: true, 400 | tableView: true, 401 | inputType: 'text', 402 | inputMask: '', 403 | label: 'First Name', 404 | key: 'firstName', 405 | placeholder: 'Enter your first name', 406 | prefix: '', 407 | suffix: '', 408 | multiple: false, 409 | defaultValue: '', 410 | protected: false, 411 | unique: false, 412 | persistent: true, 413 | validate: { 414 | required: false, 415 | minLength: 6, 416 | maxLength: 10, 417 | pattern: '', 418 | custom: '', 419 | customPrivate: false 420 | }, 421 | conditional: { 422 | show: '', 423 | when: null, 424 | eq: '' 425 | }, 426 | type: 'textfield' 427 | }], 428 | }, { 429 | components: [{ 430 | input: true, 431 | tableView: true, 432 | inputType: 'text', 433 | inputMask: '', 434 | label: 'Last Name', 435 | key: 'lastName', 436 | placeholder: 'Enter your last name', 437 | prefix: '', 438 | suffix: '', 439 | multiple: false, 440 | defaultValue: '', 441 | protected: false, 442 | unique: false, 443 | persistent: true, 444 | validate: { 445 | required: false, 446 | minLength: 6, 447 | maxLength: 10, 448 | pattern: '', 449 | custom: '', 450 | customPrivate: false 451 | }, 452 | conditional: { 453 | show: '', 454 | when: null, 455 | eq: '' 456 | }, 457 | type: 'textfield' 458 | }], 459 | }], 460 | [{ 461 | components: [{ 462 | type: 'email', 463 | persistent: true, 464 | unique: false, 465 | protected: false, 466 | defaultValue: '', 467 | suffix: '', 468 | prefix: '', 469 | placeholder: 'Enter your email address', 470 | key: 'email', 471 | label: 'Email', 472 | inputType: 'email', 473 | tableView: true, 474 | input: true 475 | }], 476 | }, { 477 | components: [{ 478 | input: true, 479 | inputType: 'checkbox', 480 | tableView: false, 481 | hideLabel: true, 482 | label: 'Checkbox', 483 | key: 'checkbox', 484 | defaultValue: true, 485 | protected: false, 486 | persistent: true, 487 | validate: { 488 | required: false 489 | }, 490 | type: 'checkbox', 491 | conditional: { 492 | show: null, 493 | when: null, 494 | eq: '' 495 | } 496 | }], 497 | }] 498 | ], 499 | header: [], 500 | caption: '', 501 | striped: true, 502 | bordered: true, 503 | hover: true, 504 | condensed: false, 505 | type: 'table', 506 | conditional: { 507 | show: null, 508 | when: null, 509 | eq: '' 510 | } 511 | }, 512 | { 513 | input: true, 514 | tableView: true, 515 | label: 'Textarea', 516 | key: 'textarea', 517 | placeholder: 'Enter Your Text Here', 518 | prefix: '$', 519 | suffix: '@', 520 | rows: 3, 521 | multiple: false, 522 | defaultValue: '', 523 | protected: false, 524 | persistent: true, 525 | validate: { 526 | required: false, 527 | minLength: 5, 528 | maxLength: 100, 529 | pattern: '', 530 | custom: '' 531 | }, 532 | type: 'textarea', 533 | conditional: { 534 | show: null, 535 | when: null, 536 | eq: '' 537 | } 538 | }, 539 | { 540 | input: false, 541 | type: 'well', 542 | key: 'Well', 543 | lockKey: true, 544 | components: [{ 545 | input: true, 546 | tableView: true, 547 | inputType: 'text', 548 | inputMask: '', 549 | label: 'Textfield', 550 | key: 'text', 551 | placeholder: 'Enter your text', 552 | prefix: '', 553 | suffix: '', 554 | multiple: false, 555 | defaultValue: '', 556 | protected: false, 557 | unique: false, 558 | persistent: true, 559 | validate: { 560 | required: false, 561 | minLength: 6, 562 | maxLength: 10, 563 | pattern: '', 564 | custom: '', 565 | customPrivate: false 566 | }, 567 | conditional: { 568 | show: '', 569 | when: null, 570 | eq: '' 571 | }, 572 | type: 'textfield' 573 | }, { 574 | input: true, 575 | tableView: true, 576 | label: 'Textarea', 577 | key: 'textarea', 578 | placeholder: 'Enter Your Text Here', 579 | prefix: '', 580 | suffix: '', 581 | rows: 3, 582 | multiple: false, 583 | defaultValue: '', 584 | protected: false, 585 | persistent: true, 586 | validate: { 587 | required: false, 588 | minLength: 5, 589 | maxLength: 100, 590 | pattern: '', 591 | custom: '' 592 | }, 593 | type: 'textarea', 594 | conditional: { 595 | show: null, 596 | when: null, 597 | eq: '' 598 | } 599 | }], 600 | conditional: { 601 | show: null, 602 | when: null, 603 | eq: '' 604 | } 605 | }, 606 | { 607 | input: true, 608 | tableView: true, 609 | inputType: 'radio', 610 | label: 'Options', 611 | key: 'radio', 612 | values: [ 613 | { 614 | value: 'val1', 615 | label: 'option1' 616 | }, 617 | { 618 | value: 'val2', 619 | label: 'option2' 620 | }, 621 | { 622 | value: 'val3', 623 | label: 'option3' 624 | } 625 | ], 626 | defaultValue: true, 627 | protected: false, 628 | persistent: true, 629 | validate: { 630 | required: false, 631 | custom: '', 632 | customPrivate: false 633 | }, 634 | type: 'radio', 635 | inline: false, 636 | multiple: false, 637 | conditional: { 638 | show: null, 639 | when: null, 640 | eq: '' 641 | } 642 | }, 643 | { 644 | input: false, 645 | tableView: true, 646 | legend: 'User Information', 647 | type: 'fieldset', 648 | conditional: { 649 | show: null, 650 | when: null, 651 | eq: '' 652 | }, 653 | components: [{ 654 | input: true, 655 | tableView: true, 656 | inputType: 'text', 657 | inputMask: '', 658 | label: 'FirstName', 659 | key: 'firstName', 660 | placeholder: 'Enter FirstName', 661 | prefix: '', 662 | suffix: '', 663 | multiple: false, 664 | defaultValue: '', 665 | protected: false, 666 | unique: false, 667 | persistent: true, 668 | validate: { 669 | required: false, 670 | minLength: '', 671 | maxLength: '', 672 | pattern: '', 673 | custom: '', 674 | customPrivate: false 675 | }, 676 | conditional: { 677 | show: null, 678 | when: null, 679 | eq: '' 680 | }, 681 | type: 'textfield' 682 | }, 683 | { 684 | input: true, 685 | tableView: true, 686 | inputType: 'text', 687 | inputMask: '', 688 | label: 'LastName', 689 | key: 'lastName', 690 | placeholder: 'Enter LastName', 691 | prefix: '', 692 | suffix: '', 693 | multiple: false, 694 | defaultValue: '', 695 | protected: false, 696 | unique: false, 697 | persistent: true, 698 | validate: { 699 | required: false, 700 | minLength: '', 701 | maxLength: '', 702 | pattern: '', 703 | custom: '', 704 | customPrivate: false 705 | }, 706 | conditional: { 707 | show: null, 708 | when: null, 709 | eq: '' 710 | }, 711 | type: 'textfield' 712 | }] 713 | }, 714 | { 715 | input: true, 716 | tableView: true, 717 | inputType: 'text', 718 | inputMask: '', 719 | customClass: 'customClass', 720 | multiple: true, 721 | label: 'Currency', 722 | key: 'currency', 723 | placeholder: 'currency', 724 | prefix: '$', 725 | suffix: '@', 726 | defaultValue: '', 727 | protected: false, 728 | persistent: true, 729 | validate: { 730 | required: false, 731 | multiple: '', 732 | custom: '' 733 | }, 734 | conditional: { 735 | show: null, 736 | when: null, 737 | eq: '' 738 | }, 739 | type: 'currency', 740 | }, 741 | { 742 | input: true, 743 | inputType: 'checkbox', 744 | tableView: false, 745 | hideLabel: true, 746 | label: 'Checkbox 2', 747 | key: 'checkbox2', 748 | defaultValue: false, 749 | protected: false, 750 | persistent: true, 751 | validate: { 752 | required: false 753 | }, 754 | type: 'checkbox', 755 | conditional: { 756 | show: null, 757 | when: null, 758 | eq: '' 759 | } 760 | }, 761 | { 762 | input: true, 763 | tableView: true, 764 | label: 'Select box', 765 | key: 'selectbox', 766 | values: [ 767 | { 768 | value: 'coffee', 769 | label: 'Tea' 770 | }, 771 | { 772 | value: 'coffee', 773 | label: 'Coffee' 774 | }, 775 | { 776 | value: 'chocolate', 777 | label: 'Chocolate' 778 | }, 779 | { 780 | value: 'ice-cream', 781 | label: 'Ice-Cream' 782 | } 783 | ], 784 | inline: true, 785 | protected: false, 786 | persistent: true, 787 | validate: { 788 | required: false 789 | }, 790 | type: 'selectboxes', 791 | conditional: { 792 | show: null, 793 | when: null, 794 | eq: '' 795 | }, 796 | customClass: 'myselect' 797 | }, 798 | { 799 | input: false, 800 | title: 'Panel', 801 | theme: 'primary', 802 | components: [{ 803 | input: true, 804 | tableView: true, 805 | inputType: 'text', 806 | inputMask: '', 807 | label: 'Name', 808 | key: 'name', 809 | placeholder: 'Enter your Name', 810 | prefix: '', 811 | suffix: '', 812 | multiple: false, 813 | defaultValue: '', 814 | protected: false, 815 | unique: false, 816 | persistent: true, 817 | validate: { 818 | required: false, 819 | minLength: 6, 820 | maxLength: 10, 821 | pattern: '', 822 | custom: '', 823 | customPrivate: false 824 | }, 825 | conditional: { 826 | show: '', 827 | when: null, 828 | eq: '' 829 | }, 830 | type: 'textfield' 831 | }, { 832 | input: true, 833 | tableView: true, 834 | label: 'Textarea', 835 | key: 'textarea', 836 | placeholder: 'Enter Your Text Here', 837 | prefix: '', 838 | suffix: '', 839 | rows: 3, 840 | multiple: false, 841 | defaultValue: '', 842 | protected: false, 843 | persistent: true, 844 | validate: { 845 | required: false, 846 | minLength: 5, 847 | maxLength: 100, 848 | pattern: '', 849 | custom: '' 850 | }, 851 | type: 'textarea', 852 | conditional: { 853 | show: null, 854 | when: null, 855 | eq: '' 856 | } 857 | }], 858 | type: 'panel', 859 | conditional: { 860 | show: null, 861 | when: null, 862 | eq: '' 863 | } 864 | }, 865 | { 866 | input: true, 867 | tableView: true, 868 | label: 'Survey', 869 | key: 'survey', 870 | customClass: 'customClass', 871 | questions: [ 872 | { 873 | value: 'QueValue', 874 | label: 'QueLabel', 875 | }, 876 | { 877 | value: 'QueValue1', 878 | label: 'QueLabel1', 879 | }, 880 | { 881 | value: 'QueValue2', 882 | label: 'QueLabel2', 883 | } 884 | ], 885 | values: [ 886 | { 887 | value: 'AnsValue', 888 | label: 'AnsLabel', 889 | }, 890 | { 891 | value: 'AnsValue1', 892 | label: 'AnsLabel1', 893 | }, 894 | { 895 | value: 'AnsValue2', 896 | label: 'AnsLabel2', 897 | }, 898 | { 899 | value: 'AnsValue3', 900 | label: 'AnsLabel3', 901 | } 902 | ], 903 | defaultValue: '', 904 | protected: false, 905 | persistent: true, 906 | validate: { 907 | required: false, 908 | custom: '', 909 | customPrivate: false 910 | }, 911 | type: 'survey', 912 | conditional: { 913 | show: null, 914 | when: null, 915 | eq: '' 916 | } 917 | }, 918 | { 919 | input: true, 920 | tableView: true, 921 | label: 'DateTime', 922 | key: 'dateTime', 923 | placeholder: 'Select date and time', 924 | format: 'yyyy-MM-dd HH:mm', 925 | enableDate: true, 926 | enableTime: true, 927 | datepickerMode: 'day', 928 | datePicker: { 929 | showWeeks: true, 930 | startingDay: '0', 931 | initDate: '', 932 | minMode: 'day', 933 | maxMode: 'year', 934 | yearRange: '25', 935 | datepickerMode: 'day' 936 | }, 937 | timePicker: { 938 | hourStep: 1, 939 | minuteStep: 1, 940 | showMeridian: true, 941 | readonlyInput: true, 942 | mousewheel: true, 943 | arrowkeys: false 944 | }, 945 | protected: false, 946 | persistent: true, 947 | validate: { 948 | required: false, 949 | custom: '' 950 | }, 951 | type: 'datetime', 952 | conditional: { 953 | show: null, 954 | when: null, 955 | eq: '' 956 | }, 957 | minDate: '2016-07-01T18:30:00.000Z', 958 | maxDate: '2016-08-30T18:30:00.000Z' 959 | }, 960 | { 961 | input: false, 962 | tag: 'p', 963 | key: 'pname', 964 | lockKey: true, 965 | attrs: [ 966 | { 967 | attr: 'src', 968 | value: '/img' 969 | } 970 | ], 971 | className: 'customClass', 972 | content: 'Hello, Good Morning!!! This is Html Element.', 973 | type: 'htmlelement', 974 | tags: ['span'], 975 | conditional: { 976 | show: null, 977 | when: null, 978 | eq: '' 979 | } 980 | }, 981 | { 982 | input: true, 983 | tableView: true, 984 | label: 'Fruits', 985 | key: 'fruits', 986 | placeholder: 'Select favourite', 987 | data: { 988 | values: [ 989 | { 990 | value: 'opt1', 991 | label: 'mango' 992 | }, 993 | { 994 | value: 'opt2', 995 | label: 'apple' 996 | }, 997 | { 998 | value: 'opt3', 999 | label: 'pineapple' 1000 | }, 1001 | { 1002 | value: 'opt4', 1003 | label: 'grapes' 1004 | }], 1005 | json: [ 1006 | { 1007 | label: 'one', 1008 | test: 'opt1' 1009 | }, 1010 | { 1011 | label: 'two', 1012 | test: 'opt2' 1013 | }, 1014 | { 1015 | label: 'three', 1016 | test: 'opt3' 1017 | }], 1018 | url: 'https://api.github.com/users/hadley/orgs', 1019 | resource: 'manager' 1020 | }, 1021 | dataSrc: 'values', 1022 | valueProperty: '', 1023 | defaultValue: '', 1024 | refreshOn: '', 1025 | filter: '', 1026 | authenticate: false, 1027 | template: '{{ item.label }}', 1028 | multiple: false, 1029 | protected: false, 1030 | unique: false, 1031 | persistent: true, 1032 | validate: { 1033 | required: false 1034 | }, 1035 | type: 'select', 1036 | conditional: { 1037 | show: null, 1038 | when: null, 1039 | eq: '' 1040 | } 1041 | }, 1042 | { 1043 | input: true, 1044 | tableView: true, 1045 | label: 'Address', 1046 | key: 'address', 1047 | placeholder: 'Enter Address', 1048 | multiple: false, 1049 | protected: false, 1050 | unique: false, 1051 | persistent: true, 1052 | validate: { 1053 | required: true 1054 | }, 1055 | type: 'address', 1056 | conditional: { 1057 | show: null, 1058 | when: null, 1059 | eq: '' 1060 | }, 1061 | customClass: 'myclass' 1062 | }, 1063 | { 1064 | customClass: 'myclass', 1065 | conditional: { 1066 | eq: '', 1067 | when: null, 1068 | show: '' 1069 | }, 1070 | type: 'resource', 1071 | defaultPermission: '', 1072 | validate: '{"required": false}', 1073 | persistent: true, 1074 | protected: false, 1075 | multiple: false, 1076 | searchFields: ['data.fullName'], 1077 | selectFields: 'data.fullName, data.email', 1078 | template: '{{ item.data }}', 1079 | defaultValue: [], 1080 | resource: '5757ea1c6e37370100cb5bce', 1081 | project: '5757ea1c6e37370100cb5bc8', 1082 | placeholder: 'Select Resource', 1083 | key: 'resource', 1084 | label: 'Resource', 1085 | tableView: true, 1086 | input: true, 1087 | tags: [] 1088 | }, 1089 | { 1090 | input: true, 1091 | tableView: true, 1092 | label: 'Signature', 1093 | key: 'signature', 1094 | placeholder: 'Please Sign here...', 1095 | footer: 'Sign above', 1096 | width: '50%', 1097 | height: '200px', 1098 | penColor: 'green', 1099 | backgroundColor: 'rgb(245,245,235)', 1100 | minWidth: '0.5', 1101 | maxWidth: '2.5', 1102 | protected: false, 1103 | persistent: true, 1104 | validate: { 1105 | required: false 1106 | }, 1107 | type: 'signature', 1108 | hideLabel: false, 1109 | conditional: { 1110 | show: null, 1111 | when: null, 1112 | eq: '' 1113 | }, 1114 | customClass: 'myclass' 1115 | }, 1116 | { 1117 | input: true, 1118 | tableView: true, 1119 | key: 'nameHidden', 1120 | label: 'Name', 1121 | protected: false, 1122 | unique: true, 1123 | persistent: true, 1124 | type: 'hidden', 1125 | conditional: { 1126 | show: true, 1127 | when: '', 1128 | eq: '' 1129 | } 1130 | }, 1131 | { 1132 | input: true, 1133 | label: 'Submit', 1134 | tableView: false, 1135 | key: 'submit', 1136 | size: 'md', 1137 | leftIcon: '', 1138 | rightIcon: '', 1139 | block: false, 1140 | action: 'submit', 1141 | disableOnInvalid: false, 1142 | theme: 'primary', 1143 | type: 'button' 1144 | } 1145 | ] 1146 | }; 1147 | 1148 | export const FORM_WIZARD: any = { 1149 | components: [ 1150 | { 1151 | type: 'panel', 1152 | input: false, 1153 | title: 'Page 1', 1154 | theme: 'default', 1155 | components: [ 1156 | { 1157 | input: true, 1158 | tableView: true, 1159 | inputType: 'text', 1160 | inputMask: '', 1161 | label: 'First Name', 1162 | key: 'firstName', 1163 | placeholder: 'Enter your first name', 1164 | prefix: '', 1165 | suffix: '', 1166 | multiple: false, 1167 | defaultValue: '', 1168 | protected: false, 1169 | unique: false, 1170 | persistent: true, 1171 | validate: { 1172 | required: false, 1173 | minLength: '', 1174 | maxLength: '', 1175 | pattern: '', 1176 | custom: '', 1177 | customPrivate: false 1178 | }, 1179 | conditional: { 1180 | show: false, 1181 | when: null, 1182 | eq: '' 1183 | }, 1184 | type: 'textfield' 1185 | }, 1186 | { 1187 | input: true, 1188 | tableView: true, 1189 | inputType: 'text', 1190 | inputMask: '', 1191 | label: 'Last Name', 1192 | key: 'lastName', 1193 | placeholder: 'Enter your last name', 1194 | prefix: '', 1195 | suffix: '', 1196 | multiple: false, 1197 | defaultValue: '', 1198 | protected: false, 1199 | unique: false, 1200 | persistent: true, 1201 | validate: { 1202 | required: false, 1203 | minLength: '', 1204 | maxLength: '', 1205 | pattern: '', 1206 | custom: '', 1207 | customPrivate: false 1208 | }, 1209 | conditional: { 1210 | show: false, 1211 | when: null, 1212 | eq: '' 1213 | }, 1214 | type: 'textfield' 1215 | } 1216 | ], 1217 | }, 1218 | { 1219 | type: 'panel', 1220 | title: 'Page 2', 1221 | isNew: true, 1222 | components: [ 1223 | { 1224 | input: true, 1225 | tableView: true, 1226 | label: 'Write about you', 1227 | key: 'aboutu', 1228 | placeholder: 'Write about yourself here', 1229 | prefix: '', 1230 | suffix: '', 1231 | rows: 3, 1232 | multiple: false, 1233 | defaultValue: '', 1234 | protected: false, 1235 | persistent: true, 1236 | validate: { 1237 | required: false, 1238 | minLength: 6, 1239 | maxLength: 100, 1240 | pattern: '', 1241 | custom: '' 1242 | }, 1243 | type: 'textarea', 1244 | conditional: { 1245 | show: null, 1246 | when: null, 1247 | eq: '' 1248 | } 1249 | } 1250 | ], 1251 | input: false, 1252 | key: 'page2', 1253 | theme: 'default' 1254 | }, 1255 | { 1256 | type: 'panel', 1257 | title: 'Page 3', 1258 | isNew: true, 1259 | components: [ 1260 | { 1261 | input: true, 1262 | tableView: true, 1263 | label: 'Textarea', 1264 | key: 'textarea', 1265 | placeholder: 'Enter Your Text Here', 1266 | prefix: '', 1267 | suffix: '', 1268 | rows: 3, 1269 | multiple: false, 1270 | defaultValue: '', 1271 | protected: false, 1272 | persistent: true, 1273 | validate: { 1274 | required: false, 1275 | minLength: 6, 1276 | maxLength: 100, 1277 | pattern: '', 1278 | custom: '' 1279 | }, 1280 | type: 'textarea', 1281 | conditional: { 1282 | show: null, 1283 | when: null, 1284 | eq: '' 1285 | } 1286 | } 1287 | ], 1288 | input: false, 1289 | key: 'page3', 1290 | theme: 'default' 1291 | } 1292 | ], 1293 | display: 'wizard', 1294 | page: 0, 1295 | numPages: 2 1296 | }; 1297 | -------------------------------------------------------------------------------- /src/app/forms/kitchen/kitchen.component.html: -------------------------------------------------------------------------------- 1 |

Kitchen Sink Form

2 | 3 | -------------------------------------------------------------------------------- /src/app/forms/kitchen/kitchen.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/formio/angular-demo/df0c2ce2f1930211db57092757a0fdd8a9fed35c/src/app/forms/kitchen/kitchen.component.scss -------------------------------------------------------------------------------- /src/app/forms/kitchen/kitchen.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { KitchenComponent } from './kitchen.component'; 4 | 5 | describe('KitchenComponent', () => { 6 | let component: KitchenComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ KitchenComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(KitchenComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/forms/kitchen/kitchen.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { FORM } from './form'; 3 | @Component({ 4 | selector: 'app-kitchen', 5 | templateUrl: './kitchen.component.html', 6 | styleUrls: ['./kitchen.component.scss'] 7 | }) 8 | export class KitchenComponent { 9 | public form: any = FORM; 10 | public options: any = { 11 | hooks: { 12 | beforeSubmit: (submission: object, cb: any) => { 13 | console.log('Before Submit'); 14 | console.log(submission); 15 | setTimeout(() => cb(null, submission), 1000); 16 | } 17 | } 18 | }; 19 | /* tslint:disable:max-line-length */ 20 | public submission: any = { 21 | data: { 22 | user: { 23 | firstName: 'Joe', 24 | lastName: 'Smith', 25 | email: 'joe@example.com', 26 | kids: [ 27 | 'Susie', 28 | 'Jack' 29 | ] 30 | }, 31 | cars: [ 32 | { 33 | make: 'Jeep', 34 | model: 'Wrangler', 35 | year: '2010' 36 | }, 37 | { 38 | make: 'Ford', 39 | model: 'Mustang', 40 | year: '2014' 41 | } 42 | ], 43 | signature: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABHAAAACWCAYAAAC2JH9WAAAVGUlEQVR4Xu3dX2xW5R0H8B8kY7HqKskwLkaIyRZjFBanyWK1zjgvBGm27EJQmpHMCImgF4uwSbfdaJtQvGJqhsviSDB2dzoaIJo4LToS/2yRqrvTAYuJxW0Ux6ZMZXle01daWkax79vzvM/nJCSUvu85v9/n93DzzTnPmXPs2OET4SBAgAABAgQIECBAgAABAgQIEKiswBwBTmVnozACBAgQIECAAAECBAgQIECAQE1AgGMhECBAgAABAgQIECBAgAABAgQqLiDAqfiAlEeAAAECBAgQIECAAAECBAgQEOBYAwQIECBAgAABAgQIECBAgACBigsIcCo+IOURIECAAAECBAgQIECAAAECBAQ41gABAgQIECBAgAABAgQIECBAoOICApyKD0h5BAgQIECAAAECBAgQIECAAAEBjjVAgAABAgQIECBAgAABAgQIEKi4gACn4gNSHgECBAgQIECAAAECBAgQIEBAgGMNECBAgAABAgQIECBAgAABAgQqLiDAqfiAlEeAAAECBAgQIECAAAECBAgQEOBYAwQIECBAgAABAgQIECBAgACBigsIcCo+IOURIECAAAECBAgQIECAAAECBAQ41gABAgQIECBAgAABAgQIECBAoOICApyKD0h5BAgQIECAAAECBAgQIECAAAEBjjVAgAABAgQIECBAgAABAgQIEKi4gACn4gNSHgECBAgQIECAAAECBAgQIEBAgGMNECBAgAABAgQIECBAgAABAgQqLiDAqfiAlEeAAAECBAgQIECAAAECBAgQEOBYAwQIECBAgAABAgQIECBAgACBigsIcCo+IOURIECAAAECBAgQIECAAAECBAQ41gABAgQIECBAgAABAgQIECBAoOICApyKD0h5BAgQIECAAAECBAgQIECAAAEBjjVAgAABAgQIECBAgAABAgQIEKi4gACn4gNSHgECBAgQIECAAAECBAgQIEBAgGMNECBAgAABAgQIECBAgAABAgQqLiDAqfiAlEeAAAECBAgQIECAAAECBAgQEOBYAwQIECBAgAABAgQIECBAgACBigsIcCo+IOURIECAAAECBAgQIECAAAECBAQ41gABAgQIECBAgAABAgQIECBAoOICApyKD0h5BAgQIECAAAECBAgQIECAAAEBjjVAgAABAgQIECBAgAABAgQIEKi4gACn4gNSHgECBAgQIECAAAECBAgQIEBAgGMNECBAgAABAgQIECBAgAABAgQqLiDAqfiAlEeAAAECBAgQIECAAAECBAgQEOBYAwQIECBAgAABAgQIECBAgACBigsIcCo+oBzKGx5+Mw4cOBj7979RK7e9vT0+/vi/0dbWFm1t59R+Hh0drf3uo4+Ox4UXLqj/PNZf+szIyOH67w4cOFQ739j3Lrroorj66qti/fq1OZCokQABAgQIECBAgAABAgQIzKiAAGdGOcs4WQprBgf3xI4dT9ZDm2Z1fsEF7dHdvTLuv39DpL87CBAgQIAAAQIECBAgQIBACQICnBKmPEM9puCmr++hWnBThWNgYHt0dS2rQilqIECAAAECBAgQIECAAAECDRUQ4DSUtzVOvnPnrnj00V/H0NCLTW9o4cJL4rzzzou33vrLpNfu6dkYmzZtaHpdLkiAAAECBAgQIECAAAECBJopIMBppnZm10p33Kxcufq0j0ktXnxlfPvbV8f113fEZZd9o9bhkSNH4733RuKjjz6s/Zz2t0lH2s/m+PHjsWDBgrpE+rex3x8+fLj2u7Gfb7jhuvrnjhwZjR07BqKvrz9GR4+Ok9y8+UF742S2tpRLgAABAgQIECBAgAABAtMTEOBMz6uYTw8NvRRLl35/yn5XrVoZ69eviSVLFjfdZMWKH8bg4O5x173zztWxdetDTa/FBQkQIECAAAECBAgQIECAQDMEBDjNUM7oGulOl7vuujt27XrmlKrPP/+8+M53OqO//8FYtGjhrHbV29sffX1bxtWQ7tj51a+2znptswrj4gQIECBAgAABAgQIECDQkgICnJYc69k1lcKbjo6baq8En3h0dnbEtm2/rFQ48vDD2+InP/nZKbX29/fGunVrzg7BtwgQIECAAAECBAgQIECAQAUFBDgVHMpslTTZo0mplm3btkZ39+2zVdZprzs8/GZ897u3xrFjx8Z9bsmSKyO9pWq27xSqJJqiCBAgQIAAAQIECBAgQCA7AQFOdiNrTMHpTVNpw+KTj/b2r8SePU/Nyj430+1yzZp74oknBk75WpXDp+n26PMECBAgQIAAAQIECBAgUK6AAKfc2Y/r/NJLr4iRkZH6v6XXd+/b94e44ILP3iCVw5FCqLVr7znlLVU2OM5hemokQIAAAQIECBAgQIAAgdMJCHCsj0h731x88dfHSbz11mtZPn6U9u9JIc7evX8c10/a4PjJJ7dnFUhZmgQIECBAgAABAgQIECBAYExAgGMtxMRXht922w/i8ce3ZS0z2QbH6W6iFOKkMMdBgAABAgQIECBAgAABAgRyEhDg5DStBtW6Y8eTsXbtvfWzt8q+MZNtcJxCnPSq8a6uZQ3SdFoCBAgQIECAAAECBAgQIDDzAgKcmTfN7oz33ntf/OY32+t17979VEvdpXLLLd875ZGqVusxu0WnYAIECBAgQIAAAQIECBCYloAAZ1pcrfnhiQHOM8/8Pq677tqWanayV6S3yp1GLTUozRAgQIAAAQIECBAgQIDApAICHAsjNm7siUceeawusW/fc1m8Ony6o5v4qvH0ONUdd6yILVt6p3sqnydAgAABAgQIECBAgAABAk0VEOA0lbuaF+vt7Y++vi314lr18aL0tq2+vv5xYVVq2huqqrkuVUWAAAECBAgQIECAAAECnwsIcKyGmPjGpla9A2ds1BM3bU7/bnNj/xEIECBAgAABAgQIECBAoMoCApwqT6dJtbX6JsaTMR44cDBuvHFpjIyMjPv1+vVr4/77N9QCHQcBAgQIECBAgAABAgQIEKiKgACnKpOYxTomBjgDA9uLec32xH1x0hgWLVoYAwO/bcl9gGZxmbk0AQIECBAgQIAAAQIECHwBAQHOF8Brla9O3MS4tLcz7dy5K1auXH3KOHt6NsamTRtaZcz6IECAAAECBAgQIECAAIGMBQQ4GQ9vpkqfeBdKCi1SeFHSkR6pWrFidQwPvzGu7XQ3zubNDxRzR1JJM9crAQIECBAgQIAAAQIEchIQ4OQ0rQbVKsD5HDa9keuRR7bF6OjRcdpdXcti06b7PFbVoDXotAQIECBAgAABAgQIECBwegEBjhUSEwOczZsfjLSZb6lHuhtn48afxeDg7nEE8+Z9Kdas+VHcffea2j45DgIECBAgQIAAAQIECBAg0CwBAU6zpCt8nZtvvjX27Xu5XuGdd66OrVsfqnDFzSlt//7h6O3dckqQk95QtW7d2li1aoUgpzmjcBUCBAgQIECAAAECBAgULyDAKX4JRHR03BSvvz4swJliLaQg56c//UW88MKL4z6Rgpzly5fFunV3ebTK/yMCBAgQIECAAAECBAgQaKiAAKehvHmcfOIdOCVuYnwmk5rqjpz03SVLrqw9dnbrrUsjBTsOAgQIECBAgAABAgQIECAwkwICnJnUzPRcN954S7zyymv16n/843vjgQd+nmk3jS/7dEFOunra8Lira6kwp/GjcAUCBAgQIECAAAECBAgUIyDAKWbUUzd66aVXxMjISP0DN998Uzz99O/I/B+BtNlxemPVjh0Dp7y1auyr3d2318Kc5cuX8iRAgAABAgQIECBAgAABAmctIMA5a7rW+eL8+RfH8ePH6w1dfvll8eqr4/d7aZ1uG9PJzp27YufO3fHEEwOTXiA9VtXdvbK28fGSJYsbU4SzEiBAgAABAgQIECBAgEDLCghwWna0Z97YuecuGPfhzs6O2LPn6TM/gU/WBY4cGY3BwV3x2GOPx2uv/XlSmfQK8vQWq87Oa4U51g4BAgQIECBAgAABAgQInJGAAOeMmFr7QwKcxsw3PWKV7spJj1gND78xZZjT2Xld3HBDR1x/fYfXkjdmFM5KgAABAgQIECBAgACB7AUEONmP8Is3sGLFD2NwcHf9ROvWrYn+/t4vfmJnqAukjY9TkJMCnYMHD00p87WvXRTXXPOtSKFOerPV4sVXeKuVdUSAAAECBAgQIECAAAECIcCxCGJo6KXaZrx7974Uy5cvi56eDe4EaeC6GAtzhob+OOWdOSdfPj1ytWjRJbVAp729vfbns7+fHwsXLhTwNHBWTk2AAAECBAgQIECAAIGqCAhwqjIJdRQrkAK0/fvfiGeffS5efvmVOHr0g2lZfPnL82LevHlx1VXfrIU7Kew5OehJJ2t22JP2Ajr5OHjwYMyZMzfSv584cSLmzJkTb7/9Trzwwt54//2/R1tbW+1tXatWrZxW7z5MgAABAgQIECBAgACBUgQEOKVMWp/ZCKS9c9LdUCnUGfszOnp0RutPd/V8+OGHMX/+/Ljwwq9Oee6xICZdv739K3Ho0N/ik08+qX0vHanW9IatkwObuXPnxKefnjiregcGtkdX17Kz+q4vESBAgAABAgQIECBAoJUFBDitPF29tYxACkhSmDM6Olr7c+DAodqfdLz66p/i3XffjQ8++Ff2/W7atCF6ejZm34cGCBAgQIAAAQIECBAgMNMCApyZFnU+ArMokO6IScFOCnlS4JOOk/9+cmnvvTcSc+fOjX//+z/1z012p0+682bskazP7sD5uH4HTjr3Z9f4/A6h9HhUekzqbA534JyNmu8QIECAAAECBAgQIFCCgACnhCnrkUCTBabaA+ef/zxSr+Sdd/4azz8/FO+//49oazuntgdOd/ftTa7U5QgQIECAAAECBAgQIJCHgAAnjzmpkgABAgQIECBAgAABAgQIEChYQIBT8PC1ToAAAQIECBAgQIAAAQIECOQhIMDJY06qJECAAAECBAgQIECAAAECBAoWEOAUPHytEyBAgAABAgQIECBAgAABAnkICHDymJMqCRAgQIAAAQIECBAgQIAAgYIFBDgFD1/rBAgQIECAAAECBAgQIECAQB4CApw85qRKAgQIECBAgAABAgQIECBAoGABAU7Bw9c6AQIECBAgQIAAAQIECBAgkIeAACePOamSAAECBAgQIECAAAECBAgQKFhAgFPw8LVOgAABAgQIECBAgAABAgQI5CEgwMljTqokQIAAAQIECBAgQIAAAQIEChYQ4BQ8fK0TIECAAAECBAgQIECAAAECeQgIcPKYkyoJECBAgAABAgQIECBAgACBggUEOAUPX+sECBAgQIAAAQIECBAgQIBAHgICnDzmpEoCBAgQIECAAAECBAgQIECgYAEBTsHD1zoBAgQIECBAgAABAgQIECCQh4AAJ485qZIAAQIECBAgQIAAAQIECBAoWECAU/DwtU6AAAECBAgQIECAAAECBAjkISDAyWNOqiRAgAABAgQIECBAgAABAgQKFhDgFDx8rRMgQIAAAQIECBAgQIAAAQJ5CAhw8piTKgkQIECAAAECBAgQIECAAIGCBQQ4BQ9f6wQIECBAgAABAgQIECBAgEAeAgKcPOakSgIECBAgQIAAAQIECBAgQKBgAQFOwcPXOgECBAgQIECAAAECBAgQIJCHgAAnjzmpkgABAgQIECBAgAABAgQIEChYQIBT8PC1ToAAAQIECBAgQIAAAQIECOQhIMDJY06qJECAAAECBAgQIECAAAECBAoWEOAUPHytEyBAgAABAgQIECBAgAABAnkICHDymJMqCRAgQIAAAQIECBAgQIAAgYIFBDgFD1/rBAgQIECAAAECBAgQIECAQB4CApw85qRKAgQIECBAgAABAgQIECBAoGABAU7Bw9c6AQIECBAgQIAAAQIECBAgkIeAACePOamSAAECBAgQIECAAAECBAgQKFhAgFPw8LVOgAABAgQIECBAgAABAgQI5CEgwMljTqokQIAAAQIECBAgQIAAAQIEChYQ4BQ8fK0TIECAAAECBAgQIECAAAECeQgIcPKYkyoJECBAgAABAgQIECBAgACBggUEOAUPX+sECBAgQIAAAQIECBAgQIBAHgICnDzmpEoCBAgQIECAAAECBAgQIECgYAEBTsHD1zoBAgQIECBAgAABAgQIECCQh4AAJ485qZIAAQIECBAgQIAAAQIECBAoWECAU/DwtU6AAAECBAgQIECAAAECBAjkISDAyWNOqiRAgAABAgQIECBAgAABAgQKFhDgFDx8rRMgQIAAAQIECBAgQIAAAQJ5CAhw8piTKgkQIECAAAECBAgQIECAAIGCBQQ4BQ9f6wQIECBAgAABAgQIECBAgEAeAgKcPOakSgIECBAgQIAAAQIECBAgQKBgAQFOwcPXOgECBAgQIECAAAECBAgQIJCHgAAnjzmpkgABAgQIECBAgAABAgQIEChYQIBT8PC1ToAAAQIECBAgQIAAAQIECOQhIMDJY06qJECAAAECBAgQIECAAAECBAoWEOAUPHytEyBAgAABAgQIECBAgAABAnkICHDymJMqCRAgQIAAAQIECBAgQIAAgYIFBDgFD1/rBAgQIECAAAECBAgQIECAQB4CApw85qRKAgQIECBAgAABAgQIECBAoGABAU7Bw9c6AQIECBAgQIAAAQIECBAgkIeAACePOamSAAECBAgQIECAAAECBAgQKFhAgFPw8LVOgAABAgQIECBAgAABAgQI5CEgwMljTqokQIAAAQIECBAgQIAAAQIEChYQ4BQ8fK0TIECAAAECBAgQIECAAAECeQgIcPKYkyoJECBAgAABAgQIECBAgACBggUEOAUPX+sECBAgQIAAAQIECBAgQIBAHgICnDzmpEoCBAgQIECAAAECBAgQIECgYAEBTsHD1zoBAgQIECBAgAABAgQIECCQh4AAJ485qZIAAQIECBAgQIAAAQIECBAoWECAU/DwtU6AAAECBAgQIECAAAECBAjkISDAyWNOqiRAgAABAgQIECBAgAABAgQKFhDgFDx8rRMgQIAAAQIECBAgQIAAAQJ5CAhw8piTKgkQIECAAAECBAgQIECAAIGCBQQ4BQ9f6wQIECBAgAABAgQIECBAgEAeAgKcPOakSgIECBAgQIAAAQIECBAgQKBgAQFOwcPXOgECBAgQIECAAAECBAgQIJCHgAAnjzmpkgABAgQIECBAgAABAgQIEChY4H/QCQkasfUe1AAAAABJRU5ErkJggg==' 44 | } 45 | }; 46 | /* tslint:enable:max-line-length */ 47 | 48 | onRender() { 49 | console.log('onRender'); 50 | } 51 | onSubmit(value: any) { 52 | console.log('onSubmit'); 53 | console.log(value); 54 | } 55 | onChange(value: any) { 56 | console.log('onChange'); 57 | console.log(value); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/app/forms/language/language.component.html: -------------------------------------------------------------------------------- 1 |

Multiple Languages

2 |

Read Documentation

3 |
4 | 5 | 6 | 7 |
8 | 9 | -------------------------------------------------------------------------------- /src/app/forms/language/language.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/formio/angular-demo/df0c2ce2f1930211db57092757a0fdd8a9fed35c/src/app/forms/language/language.component.scss -------------------------------------------------------------------------------- /src/app/forms/language/language.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { LanguageComponent } from './language.component'; 4 | 5 | describe('LanguageComponent', () => { 6 | let component: LanguageComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ LanguageComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(LanguageComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/forms/language/language.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, EventEmitter } from '@angular/core'; 2 | import { FormioOptions, FormioAppConfig } from '@formio/angular'; 3 | 4 | @Component({ 5 | selector: 'app-language', 6 | templateUrl: './language.component.html', 7 | styleUrls: ['./language.component.scss'] 8 | }) 9 | export class LanguageComponent { 10 | public language: EventEmitter; 11 | public options: FormioOptions; 12 | 13 | /* tslint:disable:max-line-length */ 14 | constructor(public config: FormioAppConfig) { 15 | this.language = new EventEmitter(); 16 | this.options = { 17 | i18n: { 18 | sp: { 19 | 'First Name': 'Nombre de pila', 20 | 'Last Name': 'Apellido', 21 | 'Enter your first name': 'Ponga su primer nombre', 22 | 'Enter your last name': 'Introduce tu apellido', 23 | Email: 'Email', 24 | 'Enter your email address': 25 | 'Ingrese su dirección de correo electrónico', 26 | 'Phone Number': 'Número de teléfono', 27 | 'Enter your phone number': 'Ingrese su número telefónico', 28 | Submit: 'Enviar', 29 | 'This is a dynamically rendered JSON form built with Form.io. Using a simple drag-and-drop form builder, you can create any form that includes e-signatures, wysiwyg editors, date fields, layout components, data grids, surveys, etc.': 30 | 'Se trata de un formulario JSON dinámicamente generado con Form.io. Utilizando un simple constructor de formularios de arrastrar y soltar, puede crear cualquier formulario que incluya firmas electrónicas, editores wysiwyg, campos de fecha, componentes de diseño, cuadrículas de datos, encuestas, etc.', 31 | 'Form.io Example Form': 'Ejemplo Form.io', 32 | Survey: 'Encuesta', 33 | 'How would you rate the Form.io platform?': 34 | '¿Cómo calificaría la plataforma Form.io?', 35 | 'How was Customer Support?': 36 | '¿Cómo fue el servicio de atención al cliente?', 37 | 'Overall Experience?': '¿Experiencia general?', 38 | Excellent: 'Excelente', 39 | Great: 'Estupendo', 40 | Good: 'Bueno', 41 | Average: 'Promedio', 42 | Poor: 'Pobre', 43 | 'Sign above': 'Signo de arriba' 44 | }, 45 | ch: { 46 | 'First Name': '名字', 47 | 'Last Name': '姓', 48 | 'Enter your first name': '输入你的名字', 49 | 'Enter your last name': '输入你的姓氏', 50 | Email: '电子邮件', 51 | 'Enter your email address': '输入你的电子邮箱地址', 52 | 'Phone Number': '电话号码', 53 | 'Enter your phone number': '输入你的电话号码', 54 | Submit: '提交', 55 | 'This is a dynamically rendered JSON form built with Form.io. Using a simple drag-and-drop form builder, you can create any form that includes e-signatures, wysiwyg editors, date fields, layout components, data grids, surveys, etc.': 56 | '这是一个使用Form.io构建的动态呈现的JSON表单。使用简单的拖放表单构建器,您可以创建包括电子签名,wysiwyg编辑器,日期字段,布局组件,数据网格,调查等的任何表单。', 57 | 'Form.io Example Form': 'Form.io示例表单', 58 | Survey: '调查', 59 | 'How would you rate the Form.io platform?': '你如何评价Form.io平台?', 60 | 'How was Customer Support?': '客户支持如何?', 61 | 'Overall Experience?': '总体体验?', 62 | Excellent: '优秀', 63 | Great: '大', 64 | Good: '好', 65 | Average: '平均', 66 | Poor: '错', 67 | 'Sign above': '上面标注' 68 | } 69 | } 70 | }; 71 | } 72 | /* tslint:enable:max-line-length */ 73 | 74 | changeLanguage(lang: string) { 75 | console.log(lang); 76 | this.language.emit(lang); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/app/forms/pdf/pdf.component.html: -------------------------------------------------------------------------------- 1 |

PDF Form

2 | 3 | -------------------------------------------------------------------------------- /src/app/forms/pdf/pdf.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/formio/angular-demo/df0c2ce2f1930211db57092757a0fdd8a9fed35c/src/app/forms/pdf/pdf.component.scss -------------------------------------------------------------------------------- /src/app/forms/pdf/pdf.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { PdfComponent } from './pdf.component'; 4 | 5 | describe('PdfComponent', () => { 6 | let component: PdfComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ PdfComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(PdfComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/forms/pdf/pdf.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { FormioAppConfig } from '@formio/angular'; 3 | @Component({ 4 | selector: 'app-pdf', 5 | templateUrl: './pdf.component.html', 6 | styleUrls: ['./pdf.component.scss'] 7 | }) 8 | export class PdfComponent implements OnInit { 9 | constructor(public config: FormioAppConfig) {} 10 | ngOnInit() {} 11 | } 12 | -------------------------------------------------------------------------------- /src/app/forms/renderer/renderer.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |

The Angular JSON form renderer is a wrapper around the Form.io Core Renderer. This provides the ability to render any Form within the Form.io platform, using the following syntax.

4 |
5 |
<formio src="https://examples.com/example"></formio>
6 |
7 |

You can also provide a variable as the source as follows.

8 |
9 |
<formio [src]="formSrc"></formio>
10 |
11 |

And even listen for Change and Submit events as follows.

12 |
13 |
<formio
 14 |   [src]="formSrc"
 15 |   (change)="onChange($event)"
 16 |   (submit)="onSubmit($event)"
 17 | ></formio>
18 |
19 |

Or pass JSON directly

20 |
21 |
<formio [form]="{components: [
 22 |   {
 23 |     type: 'textfield',
 24 |     label: 'FirstName',
 25 |     key: 'firstName',
 26 |     input: true
 27 |   },
 28 |   {
 29 |     type: 'textfield',
 30 |     label: 'LastName',
 31 |     key: 'lastName',
 32 |     input: true
 33 |   },
 34 |   {
 35 |     type: 'email',
 36 |     label: 'Email',
 37 |     key: 'email',
 38 |     input: true
 39 |   },
 40 |   {
 41 |     type: 'button',
 42 |     action: 'Submit',
 43 |     label: 'Submit',
 44 |     theme: 'primary'
 45 |   }
 46 | ]}"></formio>
47 |
48 |

and populate with data

49 |
50 |
<formio [form]="{components: [
 51 |   {
 52 |     type: 'textfield',
 53 |     label: 'FirstName',
 54 |     key: 'firstName',
 55 |     input: true
 56 |   },
 57 |   {
 58 |     type: 'textfield',
 59 |     label: 'LastName',
 60 |     key: 'lastName',
 61 |     input: true
 62 |   },
 63 |   {
 64 |     type: 'email',
 65 |     label: 'Email',
 66 |     key: 'email',
 67 |     input: true
 68 |   },
 69 |   {
 70 |     type: 'button',
 71 |     action: 'submit',
 72 |     label: 'Submit',
 73 |     theme: 'primary'
 74 |   }
 75 | ]}" [submission]="{
 76 |   data: {
 77 |     firstName: 'Joe',
 78 |     lastName: 'Smith',
 79 |     email: 'joe@example.com'
 80 |   }
 81 | }"></formio>
82 |
83 |
84 |
85 |

Renderer Documentation

86 |
87 |
88 |
Result
89 |
90 | 122 |
123 |
124 |
125 |
126 |
127 | -------------------------------------------------------------------------------- /src/app/forms/renderer/renderer.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/formio/angular-demo/df0c2ce2f1930211db57092757a0fdd8a9fed35c/src/app/forms/renderer/renderer.component.scss -------------------------------------------------------------------------------- /src/app/forms/renderer/renderer.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { RendererComponent } from './renderer.component'; 4 | 5 | describe('RendererComponent', () => { 6 | let component: RendererComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ RendererComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(RendererComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/forms/renderer/renderer.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, AfterViewInit } from '@angular/core'; 2 | import { PrismService } from '../../Prism.service'; 3 | 4 | @Component({ 5 | selector: 'app-renderer', 6 | templateUrl: './renderer.component.html', 7 | styleUrls: ['./renderer.component.scss'] 8 | }) 9 | export class RendererComponent implements AfterViewInit { 10 | 11 | constructor(public prism: PrismService) { } 12 | ngAfterViewInit() { 13 | this.prism.init(); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/app/forms/simple/simple.component.html: -------------------------------------------------------------------------------- 1 |

JSON Powered Forms

2 |

Form.io is a platform for JSON powered forms within Angular. Forms can be embedded as easy as the following code.

3 |

4 |
<formio src="https://examples.form.io/example"></formio>
5 |

Read Documentation

6 | 7 | -------------------------------------------------------------------------------- /src/app/forms/simple/simple.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/formio/angular-demo/df0c2ce2f1930211db57092757a0fdd8a9fed35c/src/app/forms/simple/simple.component.scss -------------------------------------------------------------------------------- /src/app/forms/simple/simple.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { SimpleComponent } from './simple.component'; 4 | 5 | describe('SimpleComponent', () => { 6 | let component: SimpleComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ SimpleComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(SimpleComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/forms/simple/simple.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, AfterViewInit } from '@angular/core'; 2 | import { FormioAppConfig } from '@formio/angular'; 3 | import { PrismService } from '../../Prism.service'; 4 | 5 | @Component({ 6 | selector: 'app-simple', 7 | templateUrl: './simple.component.html', 8 | styleUrls: ['./simple.component.scss'] 9 | }) 10 | export class SimpleComponent implements AfterViewInit { 11 | constructor( 12 | public config: FormioAppConfig, 13 | public prism: PrismService 14 | ) {} 15 | ngAfterViewInit() { 16 | this.prism.init(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/app/forms/wizard/wizard.component.html: -------------------------------------------------------------------------------- 1 |

Wizard Forms

2 |

Form.io provides a way to build multi-page forms and easily embed them within your application using the following code.

3 |
<formio src="{{ config.appUrl }}/wizard"></formio>
4 | 5 | -------------------------------------------------------------------------------- /src/app/forms/wizard/wizard.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/formio/angular-demo/df0c2ce2f1930211db57092757a0fdd8a9fed35c/src/app/forms/wizard/wizard.component.scss -------------------------------------------------------------------------------- /src/app/forms/wizard/wizard.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { WizardComponent } from './wizard.component'; 4 | 5 | describe('WizardComponent', () => { 6 | let component: WizardComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ WizardComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(WizardComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/forms/wizard/wizard.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, AfterViewInit } from '@angular/core'; 2 | import { FormioAppConfig } from '@formio/angular'; 3 | import { PrismService } from '../../Prism.service'; 4 | 5 | @Component({ 6 | selector: 'app-wizard', 7 | templateUrl: './wizard.component.html', 8 | styleUrls: ['./wizard.component.scss'] 9 | }) 10 | export class WizardComponent implements AfterViewInit { 11 | constructor( 12 | public config: FormioAppConfig, 13 | public prism: PrismService 14 | ) {} 15 | 16 | ngAfterViewInit() { 17 | this.prism.init(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/app/home/home.component.html: -------------------------------------------------------------------------------- 1 |
2 |

JavaScript Powered Forms for by Form.io

3 |

This library provides JavaScript powered forms for Angular. This allows you to render the JSON schema forms produced by Form.io and render those within your application using Angular 5, as well as provides an interface SDK to communicate to the Form.io API's. The benefits of this library include.

4 |
    5 |
  • Renders a JSON schema as a webform and hooks up that form to the Form.io API's
  • 6 |
  • Nested components, layouts, Date/Time, Select, Input Masks, and many more included features
  • 7 |
  • Full JavaScript API SDK library on top of Form.io
  • 8 |
9 |
10 |
11 |
12 |
Example
13 |
14 |
<formio src="{{ config.appUrl }}/example"></formio>
15 |
16 |
17 |
18 |
19 |
20 |
Result
21 |
22 | 23 |
24 |
25 |
26 | -------------------------------------------------------------------------------- /src/app/home/home.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/formio/angular-demo/df0c2ce2f1930211db57092757a0fdd8a9fed35c/src/app/home/home.component.scss -------------------------------------------------------------------------------- /src/app/home/home.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { HomeComponent } from './home.component'; 4 | 5 | describe('HomeComponent', () => { 6 | let component: HomeComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ HomeComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(HomeComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/app/home/home.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, AfterViewInit } from '@angular/core'; 2 | import { FormioAppConfig } from '@formio/angular'; 3 | import { PrismService } from '../Prism.service'; 4 | @Component({ 5 | selector: 'app-home', 6 | templateUrl: './home.component.html', 7 | styleUrls: ['./home.component.scss'] 8 | }) 9 | export class HomeComponent implements AfterViewInit { 10 | constructor( 11 | public config: FormioAppConfig, 12 | public prism: PrismService 13 | ) {} 14 | 15 | ngAfterViewInit() { 16 | this.prism.init(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/formio/angular-demo/df0c2ce2f1930211db57092757a0fdd8a9fed35c/src/assets/.gitkeep -------------------------------------------------------------------------------- /src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // This file can be replaced during build by using the `fileReplacements` array. 2 | // `ng build ---prod` replaces `environment.ts` with `environment.prod.ts`. 3 | // The list of file replacements can be found in `angular.json`. 4 | 5 | export const environment = { 6 | production: false 7 | }; 8 | 9 | /* 10 | * In development mode, for easier debugging, you can ignore zone related error 11 | * stack frames such as `zone.run`/`zoneDelegate.invokeTask` by importing the 12 | * below file. Don't forget to comment it out in production mode 13 | * because it will have a performance impact when errors are thrown 14 | */ 15 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI. 16 | -------------------------------------------------------------------------------- /src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/formio/angular-demo/df0c2ce2f1930211db57092757a0fdd8a9fed35c/src/favicon.ico -------------------------------------------------------------------------------- /src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Form.io + Angular Demo 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | dir: require('path').join(__dirname, '../coverage'), 20 | reports: ['html', 'lcovonly'], 21 | fixWebpackSourcePaths: true 22 | }, 23 | reporters: ['progress', 'kjhtml'], 24 | port: 9876, 25 | colors: true, 26 | logLevel: config.LOG_INFO, 27 | autoWatch: true, 28 | browsers: ['Chrome'], 29 | singleRun: false 30 | }); 31 | }; -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.log(err)); 13 | -------------------------------------------------------------------------------- /src/polyfills.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file includes polyfills needed by Angular and is loaded before the app. 3 | * You can add your own extra polyfills to this file. 4 | * 5 | * This file is divided into 2 sections: 6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. 7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main 8 | * file. 9 | * 10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that 11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), 12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. 13 | * 14 | * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html 15 | */ 16 | 17 | /*************************************************************************************************** 18 | * BROWSER POLYFILLS 19 | */ 20 | 21 | /** IE9, IE10 and IE11 requires all of the following polyfills. **/ 22 | // import 'core-js/es6/symbol'; 23 | // import 'core-js/es6/object'; 24 | // import 'core-js/es6/function'; 25 | // import 'core-js/es6/parse-int'; 26 | // import 'core-js/es6/parse-float'; 27 | // import 'core-js/es6/number'; 28 | // import 'core-js/es6/math'; 29 | // import 'core-js/es6/string'; 30 | // import 'core-js/es6/date'; 31 | // import 'core-js/es6/array'; 32 | // import 'core-js/es6/regexp'; 33 | // import 'core-js/es6/map'; 34 | // import 'core-js/es6/weak-map'; 35 | // import 'core-js/es6/set'; 36 | 37 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */ 38 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 39 | 40 | /** IE10 and IE11 requires the following for the Reflect API. */ 41 | // import 'core-js/es6/reflect'; 42 | 43 | 44 | /** Evergreen browsers require these. **/ 45 | // Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove. 46 | // import 'core-js/es7/reflect'; 47 | 48 | 49 | /** 50 | * Web Animations `@angular/platform-browser/animations` 51 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. 52 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). 53 | **/ 54 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 55 | 56 | /** 57 | * By default, zone.js will patch all possible macroTask and DomEvents 58 | * user can disable parts of macroTask/DomEvents patch by setting following flags 59 | */ 60 | 61 | // (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 62 | // (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 63 | // (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 64 | 65 | /* 66 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 67 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 68 | */ 69 | // (window as any).__Zone_enable_cross_context_check = true; 70 | 71 | /*************************************************************************************************** 72 | * Zone JS is required by default for Angular itself. 73 | */ 74 | import 'zone.js';; // Included with Angular CLI. 75 | 76 | /*************************************************************************************************** 77 | * APPLICATION IMPORTS 78 | */ -------------------------------------------------------------------------------- /src/styles.scss: -------------------------------------------------------------------------------- 1 | @import "bootswatch/dist/cosmo/_variables.scss"; 2 | @import "bootstrap/scss/bootstrap.scss"; 3 | @import "bootswatch/dist/cosmo/_bootswatch.scss"; 4 | $fa-font-path: '~font-awesome/fonts'; 5 | @import 'font-awesome/scss/font-awesome'; 6 | -------------------------------------------------------------------------------- /src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/zone-testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | declare const require: any; 11 | 12 | // First, initialize the Angular testing environment. 13 | getTestBed().initTestEnvironment( 14 | BrowserDynamicTestingModule, 15 | platformBrowserDynamicTesting() 16 | ); 17 | // Then we find all the tests. 18 | const context = require.context('./', true, /\.spec\.ts$/); 19 | // And load the modules. 20 | context.keys().map(context); 21 | -------------------------------------------------------------------------------- /src/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "types": ["node"] 6 | }, 7 | "exclude": [ 8 | "test.ts", 9 | "**/*.spec.ts" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /src/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/spec", 5 | "types": [ 6 | "jasmine", 7 | "node" 8 | ] 9 | }, 10 | "files": [ 11 | "test.ts", 12 | "polyfills.ts" 13 | ], 14 | "include": [ 15 | "**/*.spec.ts", 16 | "**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /src/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tslint.json", 3 | "rules": { 4 | "directive-selector": [ 5 | true, 6 | "attribute", 7 | "app", 8 | "camelCase" 9 | ], 10 | "component-selector": [ 11 | true, 12 | "element", 13 | "app", 14 | "kebab-case" 15 | ] 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "outDir": "./dist/out-tsc", 6 | "sourceMap": true, 7 | "declaration": false, 8 | "module": "es2020", 9 | "moduleResolution": "node", 10 | "emitDecoratorMetadata": true, 11 | "experimentalDecorators": true, 12 | "target": "es6", 13 | "typeRoots": [ 14 | "node_modules/@types" 15 | ], 16 | "lib": [ 17 | "es2017", 18 | "dom" 19 | ] 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rulesDirectory": [ 3 | "node_modules/codelyzer" 4 | ], 5 | "rules": { 6 | "arrow-return-shorthand": true, 7 | "callable-types": true, 8 | "class-name": true, 9 | "comment-format": [ 10 | true, 11 | "check-space" 12 | ], 13 | "curly": true, 14 | "deprecation": { 15 | "severity": "warn" 16 | }, 17 | "eofline": true, 18 | "forin": true, 19 | "import-blacklist": [ 20 | true, 21 | "rxjs/Rx" 22 | ], 23 | "import-spacing": true, 24 | "indent": [ 25 | true, 26 | "spaces" 27 | ], 28 | "interface-over-type-literal": true, 29 | "label-position": true, 30 | "max-line-length": [ 31 | true, 32 | 140 33 | ], 34 | "member-access": false, 35 | "member-ordering": [ 36 | true, 37 | { 38 | "order": [ 39 | "static-field", 40 | "instance-field", 41 | "static-method", 42 | "instance-method" 43 | ] 44 | } 45 | ], 46 | "no-arg": true, 47 | "no-bitwise": true, 48 | "no-console": [ 49 | true, 50 | "debug", 51 | "info", 52 | "time", 53 | "timeEnd", 54 | "trace" 55 | ], 56 | "no-construct": true, 57 | "no-debugger": true, 58 | "no-duplicate-super": true, 59 | "no-empty": false, 60 | "no-empty-interface": true, 61 | "no-eval": true, 62 | "no-inferrable-types": [ 63 | true, 64 | "ignore-params" 65 | ], 66 | "no-misused-new": true, 67 | "no-non-null-assertion": true, 68 | "no-shadowed-variable": true, 69 | "no-string-literal": false, 70 | "no-string-throw": true, 71 | "no-switch-case-fall-through": true, 72 | "no-trailing-whitespace": true, 73 | "no-unnecessary-initializer": true, 74 | "no-unused-expression": true, 75 | "no-var-keyword": true, 76 | "object-literal-sort-keys": false, 77 | "one-line": [ 78 | true, 79 | "check-open-brace", 80 | "check-catch", 81 | "check-else", 82 | "check-whitespace" 83 | ], 84 | "prefer-const": true, 85 | "quotemark": [ 86 | true, 87 | "single" 88 | ], 89 | "radix": true, 90 | "semicolon": [ 91 | true, 92 | "always" 93 | ], 94 | "triple-equals": [ 95 | true, 96 | "allow-null-check" 97 | ], 98 | "typedef-whitespace": [ 99 | true, 100 | { 101 | "call-signature": "nospace", 102 | "index-signature": "nospace", 103 | "parameter": "nospace", 104 | "property-declaration": "nospace", 105 | "variable-declaration": "nospace" 106 | } 107 | ], 108 | "unified-signatures": true, 109 | "variable-name": false, 110 | "whitespace": [ 111 | true, 112 | "check-branch", 113 | "check-decl", 114 | "check-operator", 115 | "check-separator", 116 | "check-type" 117 | ], 118 | "no-output-on-prefix": true, 119 | "use-input-property-decorator": true, 120 | "use-output-property-decorator": true, 121 | "use-host-property-decorator": true, 122 | "no-input-rename": true, 123 | "no-output-rename": true, 124 | "use-life-cycle-interface": true, 125 | "use-pipe-transform-interface": true, 126 | "component-class-suffix": true, 127 | "directive-class-suffix": true 128 | } 129 | } 130 | --------------------------------------------------------------------------------