Skip to content

Commit 42f986a

Browse files
committed
Remove layoutPointer property from layoutNode to fix bug with layoutPointers in nested arrays.
1 parent 51a69cd commit 42f986a

15 files changed

+178
-262
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# compiled output
44
/compiled
55
/dist
6-
/docs
6+
/docs/api
77
/out-ngc
88
/tmp
99

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ All the source code is in the `/src` folder. Inside that folder, you will find t
4141
* `demo` - the demonstration playground example application
4242
* `demo/assets/example-schemas` - JSON Schema examples used in the playground
4343

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

4646
### To install from NPM and use in your own project
4747

@@ -155,7 +155,7 @@ Here is an example:
155155
[schema]="yourJsonSchema"
156156
[layout]="yourJsonFormLayout"
157157
[data]="yourData"
158-
[options]="yourGlobalSettingsettings"
158+
[options]="yourGlobalSettings"
159159
[widgets]="yourCustomWidgets"
160160
framework="bootstrap-3"
161161
loadExternalAssets="true"

package-lock.json

Lines changed: 30 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"start": "ng serve",
4343
"test": "ng test",
4444
"lint": "ng lint",
45-
"docs": "typedoc --options typedoc.json lib/src/json-schema-form.module.ts",
45+
"docs": "typedoc src/lib/src/",
4646
"clean": "rimraf out-ngc dist/*",
4747
"prebuild": "npm run clean",
4848
"build": "node build.js",
@@ -55,7 +55,7 @@
5555
"deploy": "firebase deploy"
5656
},
5757
"dependencies": {
58-
"ajv": "^5.2.4",
58+
"ajv": "^5.3.0",
5959
"lodash": "4.x"
6060
},
6161
"peerDependencies": {
@@ -84,11 +84,11 @@
8484
"@angular/platform-browser-dynamic": "^4.4.6",
8585
"@angular/router": "^4.4.6",
8686
"@types/ace": "^0.0.35",
87-
"@types/jasmine": "^2.6.0",
88-
"@types/node": "^8.0.46",
87+
"@types/jasmine": "^2.6.2",
88+
"@types/node": "^8.0.47",
8989
"brace": "^0.10.0",
9090
"camelcase": "^4.0.0",
91-
"codelyzer": "^3.2.1",
91+
"codelyzer": "^3.2.2",
9292
"concurrently": "^3.2.0",
9393
"core-js": "^2.4.1",
9494
"glob": "^7.1.1",
@@ -109,7 +109,7 @@
109109
"rollup-plugin-node-resolve-angular": "^2.0.3",
110110
"rollup-plugin-sourcemaps": "^0.4.1",
111111
"rollup-plugin-uglify": "^2.0.1",
112-
"rxjs": "^5.5.0",
112+
"rxjs": "^5.5.2",
113113
"ts-node": "^3.0.0",
114114
"tslint": "^5.8.0",
115115
"typedoc": "^0.9.0",

src/demo/assets/example-schemas/ng-jsf-flex-layout.json

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,30 +29,22 @@
2929
"items": {
3030
"type": "object",
3131
"properties": {
32-
"number": { "type": "string" },
33-
"type": {
34-
"type": "string",
35-
"enum": [ "cell", "home", "work" ]
36-
}
32+
"type": { "type": "string", "enum": [ "cell", "home", "work" ] },
33+
"number": { "type": "string" }
3734
},
38-
"required": [ "number", "type" ]
35+
"required": [ "type", "number" ]
3936
}
4037
}
4138
},
4239
"required": [ "last_name" ]
4340
},
4441
"layout": [
45-
{ "type": "flex",
46-
"flex-flow": "row wrap",
47-
"fxLayoutGap": "12px",
48-
"items": [ "first_name", "last_name" ]
49-
},
42+
{ "type": "flex", "flex-flow": "row wrap", "items": [ "first_name", "last_name" ] },
5043
{ "key": "address.street_1", "title": "Address", "placeholder": "Street" },
5144
{ "key": "address.street_2", "notitle": true },
5245
{ "type": "div",
5346
"display": "flex",
5447
"flex-direction": "row",
55-
"fxLayoutGap": "12px",
5648
"items": [
5749
{ "key": "address.city", "flex": "3 3 150px",
5850
"notitle": true, "placeholder": "City"
@@ -74,7 +66,6 @@
7466
"type": "div",
7567
"displayFlex": true,
7668
"flex-direction": "row",
77-
"fxLayoutGap": "12px",
7869
"items": [
7970
{ "key": "phone_numbers[].type", "flex": "1 1 50px",
8071
"notitle": true, "placeholder": "Type"
@@ -97,8 +88,8 @@
9788
},
9889
"birthday": "1999-09-09",
9990
"phone_numbers": [
100-
{ "number": "702-123-4567", "type": "cell" },
101-
{ "number": "702-987-6543", "type": "work" }
91+
{ "type": "cell", "number": "702-123-4567" },
92+
{ "type": "work", "number": "702-987-6543" }
10293
]
10394
}
10495
}

src/lib/angular2-json-schema-form.ts

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/lib/src/framework-library/bootstrap-3-framework/bootstrap-3-framework.component.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ import { addClasses, inArray, JsonPointer, toTitleCase } from '../../shared';
9292
export class Bootstrap3FrameworkComponent implements OnInit, OnChanges {
9393
controlInitialized: boolean = false;
9494
widgetOptions: any; // Options passed to child widget
95-
layoutPointer: string;
9695
widgetLayoutNode: any; // layoutNode passed to child widget
9796
options: any; // Options used in this framework
9897
formControl: any = null;
@@ -148,7 +147,6 @@ export class Bootstrap3FrameworkComponent implements OnInit, OnChanges {
148147
options: _.cloneDeep(this.layoutNode.options)
149148
};
150149
this.widgetOptions = this.widgetLayoutNode.options;
151-
this.layoutPointer = this.jsf.getLayoutPointer(this);
152150
this.formControl = this.jsf.getFormControl(this);
153151

154152
this.options.isInputWidget = inArray(this.layoutNode.type, [

src/lib/src/json-schema-form.component.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ import { WidgetLibraryService } from './widget-library/widget-library.service';
1212
import { JsonSchemaFormService } from './json-schema-form.service';
1313
import { convertSchemaToDraft6 } from './shared/convert-schema-to-draft6.function';
1414
import { resolveSchemaReferences } from './shared/json-schema.functions';
15-
import { hasValue, inArray, isArray, isEmpty, isObject } from './shared/validator.functions';
15+
import {
16+
hasValue, inArray, isArray, isEmpty, isNumber, isObject
17+
} from './shared/validator.functions';
1618
import { forEach, hasOwn } from './shared/utility.functions';
1719
import { JsonPointer } from './shared/jsonpointer.functions';
1820

@@ -309,6 +311,7 @@ export class JsonSchemaFormComponent implements OnChanges, OnInit {
309311

310312
// Add type = 'object' if missing
311313
if (isObject(this.jsf.schema.properties) ||
314+
isObject(this.jsf.schema.patternProperties) ||
312315
isObject(this.jsf.schema.additionalProperties)
313316
) {
314317
this.jsf.schema.type = 'object';

0 commit comments

Comments
 (0)