Skip to content

Commit 0db28a5

Browse files
committed
Merge branch 'master' of https://github.com/dsl400/jsonforms
2 parents 3f5b96f + 22c2af3 commit 0db28a5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+6440
-13027
lines changed

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@
2525
"editor.codeActionsOnSave": {
2626
"source.fixAll.eslint": "explicit"
2727
}
28-
}
28+
},
29+
"angular.enable-strict-mode-prompt": false
2930
}

packages/angular-builder/.eslintrc.js

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/* eslint-env node */
2+
/** @type {import('eslint').Linter.Config} */
3+
module.exports = {
4+
root: true,
5+
parser: '@typescript-eslint/parser',
6+
parserOptions: {
7+
/* Reset project because @angular-eslint/recommended sets this to an incompatible value */
8+
project: null,
9+
},
10+
// There is no file include in ESLint. Thus, ignore all and include files via negative ignore (!)
11+
ignorePatterns: ['/*', '!/src', '!/test', '!/example', '/example/dist'],
12+
extends: [
13+
'eslint:recommended',
14+
'plugin:@typescript-eslint/recommended',
15+
'plugin:import/recommended',
16+
'plugin:import/typescript',
17+
'plugin:@angular-eslint/recommended',
18+
'plugin:@angular-eslint/template/process-inline-templates',
19+
'plugin:prettier/recommended',
20+
],
21+
rules: {
22+
'@angular-eslint/component-class-suffix': 'off',
23+
'@angular-eslint/directive-class-suffix': 'off',
24+
'@angular-eslint/no-conflicting-lifecycle': 'warn',
25+
'@typescript-eslint/no-explicit-any': 'off',
26+
// Base rule must be disabled to avoid incorrect errors
27+
'no-unused-vars': 'off',
28+
'@typescript-eslint/no-unused-vars': [
29+
'warn', // or "error"
30+
{
31+
argsIgnorePattern: '^_',
32+
varsIgnorePattern: '^_',
33+
caughtErrorsIgnorePattern: '^_',
34+
},
35+
],
36+
// workaround for
37+
// https://github.com/import-js/eslint-plugin-import/issues/1810:
38+
"import/no-unresolved": [
39+
"error",
40+
{
41+
ignore: [
42+
"@angular/cdk/.*",
43+
"@angular/core/.*",
44+
"@angular/material/.*",
45+
"@angular/platform-browser/.*",
46+
"@angular/platform-browser-dynamic/.*",
47+
"core-js/es7/.*",
48+
"zone.js/.*",
49+
]
50+
}
51+
],
52+
'import/resolver': {
53+
typescript: {
54+
project: [
55+
'../../tsconfig.base.json',
56+
]
57+
}
58+
},
59+
};
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
$schema: 'http://json.schemastore.org/prettierrc',
3+
singleQuote: true,
4+
jsxSingleQuote: true,
5+
endOfLine: 'auto',
6+
};

packages/angular-builder/LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
The MIT License
2+
3+
Copyright (c) 2019 EclipseSource Munich
4+
https://github.com/eclipsesource/jsonforms
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in
14+
all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
THE SOFTWARE.

packages/angular-builder/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# JSON Forms - More Forms. Less Code
2+
3+
_Complex forms in the blink of an eye_
4+
5+
JSON Forms eliminates the tedious task of writing fully-featured forms by hand by leveraging the capabilities of JSON, JSON Schema and Javascript.
6+
7+
## Angular Builder Package
8+
9+
This package provides a JSON Forms Builder that can be used in Angular applications.

packages/angular-builder/angular.json

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
{
2+
"$schema": "../../node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": ".",
5+
"projects": {
6+
"example": {
7+
"projectType": "application",
8+
"schematics": {
9+
"@schematics/angular:component": {
10+
"style": "scss"
11+
}
12+
},
13+
"root": "example",
14+
"sourceRoot": "example",
15+
"prefix": "app",
16+
"architect": {
17+
"build": {
18+
"builder": "@angular-devkit/build-angular:browser",
19+
"options": {
20+
"outputPath": "example/dist/",
21+
"index": "example/index.html",
22+
"main": "example/main.ts",
23+
"polyfills": [
24+
"zone.js"
25+
],
26+
"tsConfig": "tsconfig.example.json",
27+
"inlineStyleLanguage": "scss",
28+
"assets": [],
29+
"styles": [
30+
"./node_modules/@angular/material/prebuilt-themes/indigo-pink.css"
31+
],
32+
"scripts": [],
33+
"allowedCommonJsDependencies": [
34+
"lodash",
35+
"hammerjs"
36+
],
37+
"optimization": false,
38+
"buildOptimizer": false
39+
}
40+
},
41+
"serve": {
42+
"builder": "@angular-devkit/build-angular:dev-server",
43+
"options": {
44+
"buildTarget": "example:build"
45+
}
46+
}
47+
}
48+
},
49+
"angular-builder": {
50+
"projectType": "library",
51+
"root": ".",
52+
"sourceRoot": ".",
53+
"prefix": "lib",
54+
"architect": {
55+
"build": {
56+
"builder": "@angular-devkit/build-angular:ng-packagr",
57+
"options": {
58+
"project": "ng-package.json"
59+
},
60+
"configurations": {
61+
"production": {
62+
"tsConfig": "tsconfig.json"
63+
},
64+
"development": {
65+
"tsConfig": "tsconfig.json"
66+
}
67+
},
68+
"defaultConfiguration": "production"
69+
},
70+
"test": {
71+
"builder": "@angular-devkit/build-angular:karma",
72+
"options": {
73+
"karmaConfig": "karma.conf.js",
74+
"tsConfig": "tsconfig.spec.json",
75+
"polyfills": [
76+
"zone.js",
77+
"zone.js/testing"
78+
]
79+
}
80+
}
81+
}
82+
}
83+
}
84+
}
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/*
2+
The MIT License
3+
4+
Copyright (c) 2017-2020 EclipseSource Munich
5+
https://github.com/eclipsesource/jsonforms
6+
7+
Permission is hereby granted, free of charge, to any person obtaining a copy
8+
of this software and associated documentation files (the "Software"), to deal
9+
in the Software without restriction, including without limitation the rights
10+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
copies of the Software, and to permit persons to whom the Software is
12+
furnished to do so, subject to the following conditions:
13+
14+
The above copyright notice and this permission notice shall be included in
15+
all copies or substantial portions of the Software.
16+
17+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
THE SOFTWARE.
24+
*/
25+
import { Component } from '@angular/core';
26+
import { ExampleDescription, getExamples } from '@jsonforms/examples';
27+
import { JsonFormsI18nState } from '@jsonforms/core';
28+
import { angularMaterialRenderers } from '@jsonforms/angular-material';
29+
30+
const defaultI18n: JsonFormsI18nState = {
31+
locale: 'en-US',
32+
};
33+
34+
@Component({
35+
selector: 'app-root',
36+
template: `
37+
<h1>Angular Builder Examples</h1>
38+
39+
<div>
40+
<button (click)="changeLocale('de-DE')">Change locale to de-DE</button>
41+
<button (click)="changeLocale('en-US')">Change locale to en-US</button>
42+
Current locale: {{ i18n.locale }}
43+
<button (click)="toggleReadonly()">
44+
{{ readonly ? 'Unset' : 'Set' }} Readonly
45+
</button>
46+
</div>
47+
<jsonforms-builder></jsonforms-builder>
48+
`,
49+
standalone: false,
50+
})
51+
export class AppComponent {
52+
readonly renderers = angularMaterialRenderers;
53+
readonly examples = getExamples();
54+
selectedExample: ExampleDescription | undefined;
55+
i18n: JsonFormsI18nState;
56+
readonly = false;
57+
data: any;
58+
59+
constructor() {
60+
this.selectedExample = this.examples[19];
61+
this.i18n = this.selectedExample.i18n ?? defaultI18n;
62+
}
63+
64+
onChange(ev: any) {
65+
this.selectedExample = this.examples.find(
66+
(e) => e.name === ev.target.value
67+
);
68+
this.i18n = this.selectedExample?.i18n ?? defaultI18n;
69+
}
70+
71+
changeLocale(locale: string) {
72+
this.i18n = { ...this.i18n, locale };
73+
}
74+
75+
toggleReadonly() {
76+
this.readonly = !this.readonly;
77+
}
78+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
The MIT License
3+
4+
Copyright (c) 2017-2020 EclipseSource Munich
5+
https://github.com/eclipsesource/jsonforms
6+
7+
Permission is hereby granted, free of charge, to any person obtaining a copy
8+
of this software and associated documentation files (the "Software"), to deal
9+
in the Software without restriction, including without limitation the rights
10+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
copies of the Software, and to permit persons to whom the Software is
12+
furnished to do so, subject to the following conditions:
13+
14+
The above copyright notice and this permission notice shall be included in
15+
all copies or substantial portions of the Software.
16+
17+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
THE SOFTWARE.
24+
*/
25+
import { BrowserModule } from '@angular/platform-browser';
26+
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
27+
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
28+
import { AppComponent } from './app.component';
29+
import { JsonFormsAngularBuilderModule } from '../../src/library/formbuilder.module';
30+
31+
@NgModule({
32+
declarations: [AppComponent],
33+
imports: [
34+
BrowserModule,
35+
BrowserAnimationsModule,
36+
JsonFormsAngularBuilderModule,
37+
],
38+
bootstrap: [AppComponent],
39+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
40+
})
41+
export class AppModule {}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>JSON Forms Angular Builder</title>
6+
7+
<meta name="viewport" content="width=device-width, initial-scale=1" />
8+
<link rel="icon" type="image/x-icon" href="favicon.ico" />
9+
<link
10+
href="https://fonts.googleapis.com/icon?family=Material+Icons"
11+
rel="stylesheet"
12+
/>
13+
<link
14+
href="http://fonts.googleapis.com/css?family=Roboto:400,900,700,500,300,100"
15+
rel="stylesheet"
16+
type="text/css"
17+
/>
18+
</head>
19+
<body>
20+
<app-root></app-root>
21+
</body>
22+
</html>
23+
24+
<!--
25+
Copyright 2017-2018 Google Inc. All Rights Reserved.
26+
Use of this source code is governed by an MIT-style license that
27+
can be found in the LICENSE file at http://angular.io/license
28+
-->
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
The MIT License
3+
4+
Copyright (c) 2017-2019 EclipseSource Munich
5+
https://github.com/eclipsesource/jsonforms
6+
7+
Permission is hereby granted, free of charge, to any person obtaining a copy
8+
of this software and associated documentation files (the "Software"), to deal
9+
in the Software without restriction, including without limitation the rights
10+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
copies of the Software, and to permit persons to whom the Software is
12+
furnished to do so, subject to the following conditions:
13+
14+
The above copyright notice and this permission notice shall be included in
15+
all copies or substantial portions of the Software.
16+
17+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
THE SOFTWARE.
24+
*/
25+
import 'zone.js';
26+
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
27+
28+
import { AppModule } from './app/app.module';
29+
30+
platformBrowserDynamic().bootstrapModule(AppModule);
31+
32+
/*
33+
Copyright 2017-2018 Google Inc. All Rights Reserved.
34+
Use of this source code is governed by an MIT-style license that
35+
can be found in the LICENSE file at http://angular.io/license
36+
*/

0 commit comments

Comments
 (0)