Skip to content

Commit 0291d21

Browse files

File tree

4 files changed

+80
-1
lines changed

4 files changed

+80
-1
lines changed

CONTRIBUTING.md

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ git clone https://github.com/json-schema-form/angular-schema-form.git
1414
git clone https://github.com/json-schema-form/angular-schema-form-bootstrap.git
1515
git clone https://github.com/json-schema-form/angular-schema-form-material.git
1616
```
17+
Install [Node.js](https://nodejs.org) for your development environment. Currently working in Node v8.1.2 at least.
18+
1719
Install dev/global dependencies and bower references to use demo site
1820
```bash
1921
npm install

docs/extending.md

+6
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ Extending Schema Form
3131

3232
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
3333

34+
35+
Migration Guide
36+
===============
37+
If you use the library factories in an app or an add-on or plan to upgrade versions, please read the
38+
[migration guide](migration.md) for any items that may need consideration.
39+
3440
Overview
3541
--------
3642

docs/index.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
IMPORTANT
32
=========
43

@@ -8,6 +7,10 @@ all the HTML has been moved to [github.com/json-schema-form/angular-schema-form-
87
The documentation below, especially form options is therefore somewhat bootstrap decorator
98
specific. The docs is undergoing updating.
109

10+
Migration Guide
11+
===============
12+
If you use the library factories in an app or an add-on or plan to upgrade versions, please read the
13+
[migration guide](migration.md) for any items that may need consideration.
1114

1215
Documentation
1316
=============

docs/migration.md

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
Migration Notes
2+
===============
3+
4+
This document attempts to provide a guide for changes you may require between versions of Angular Schema Form.
5+
6+
0.8.13 -> 1.0.0
7+
---------------
8+
The path to version 1.0.0 is aiming to stabilise as much as possible the API that Angular Schema Form uses to interact
9+
with the JSON Schema Form Core. As items are moved out of the library there are many cases where more or less
10+
information is required by the function calls within the framework.
11+
12+
### Merge
13+
The signature of the merge function has added `typeDefaults` as the defaults generated are required independantly by the
14+
function now. There are now defaults for all parameters so a schema is all that is required.
15+
```js
16+
schemaForm.merge(
17+
schema,
18+
form = [ '*' ],
19+
typeDefaults = service.typeDefault,
20+
ignore,
21+
options = {},
22+
readonly = false,
23+
asyncTemplates
24+
)
25+
```
26+
27+
### sfValidator
28+
If you were using the validation API directly or in an add-on this is now no longer wrapped in an object to keep it in
29+
alignment with other functions imported from the core.
30+
31+
The factories are now loaded with:
32+
```js
33+
.factory('sfSelect', () => JSONSchemaFormCore.select)
34+
.factory('sfValidator', () => JSONSchemaFormCore.validate)
35+
```
36+
So when using the factories you now use:
37+
`sfValidator(form, viewValue)` instead of `sfValidator.validate(form, viewValue)`
38+
39+
**Warning: this will change substantially again as we move away from relying on the no longer maintained tv4 library**
40+
41+
### Input Field Names
42+
To make arrays work and fields with the same names on different paths no longer clash `id` and `name` attributes are now
43+
handled with a one-time function call generating a path.
44+
45+
```json
46+
{
47+
"comments": [
48+
{ "comment": "other comment" },
49+
{ "comment": "my comment" }
50+
]
51+
}
52+
```
53+
In the above example "my comment" would generate from a field with the `id` and `name` attribute
54+
`ngform-comments-1-comment`. The previous name and id would have been `comment`, by adding the form name and array
55+
indexes there is no longer issues with conflicts caused by this.
56+
57+
#### CSS Classes
58+
In addition to the `id` and `name` attibutes, there are additional classes available in the field container to take
59+
advantage of. For the above example the following classes are added:
60+
`comments-1-comment` for referencing a specific array position.
61+
`comments-comment` for all attibutes the same regardless of position.
62+
`required` for all attibutes the same regardless of position.
63+
64+
### Object.assign polyfill for Internet Explorer
65+
If you must support legacy browsers then an `Object.assign` polyfill must be used to provide that function to
66+
non-compliant browsers. There is a polyfil provided by Mozilla [here](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign#Polyfill) or you can use
67+
Babel with the appropriate plugin module `babel-plugin-transform-object-assign`.
68+

0 commit comments

Comments
 (0)