Skip to content

Commit 356677f

Browse files
committed
Merge branch 'release/0.8.4'
2 parents e6c4fb6 + 3b35f51 commit 356677f

File tree

12 files changed

+18
-103
lines changed

12 files changed

+18
-103
lines changed

CHANGELOG

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
v0.8.4
2+
------
3+
* Reverted `trackBy`. Fixes #458, #462, #471
4+
5+
16
v0.8.3
27
------
38
* "destroyStrategy" support, thanks @jbsaff! This means that `condition` can now remove values

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"dist/schema-form.js",
55
"dist/bootstrap-decorator.js"
66
],
7-
"version": "0.8.3",
7+
"version": "0.8.4",
88
"authors": [
99
"Textalk",
1010
"David Jensen <[email protected]>",

dist/bootstrap-decorator.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/bootstrap-decorator.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/schema-form.js

+3-8
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ var schemaForm = angular.module('schemaForm', deps);
3434
angular.module('schemaForm').provider('sfPath',
3535
[function() {
3636

37-
// When building with browserify it's objectpath,
38-
// otherwise it's just objectpath.
37+
// When building with browserify ObjectPath is available as `objectpath` but othwerwise
38+
// it's called `ObjectPath`.
3939
var ObjectPath = window.ObjectPath || objectpath;
4040

4141
var sfPath = {parse: ObjectPath.parse};
@@ -968,7 +968,7 @@ angular.module('schemaForm').provider('schemaForm',
968968
return type[0];
969969
}
970970
return type;
971-
};
971+
}
972972

973973
//Creates an default titleMap list from an enum, i.e. a list of strings.
974974
var enumToTitleMap = function(enm) {
@@ -1101,7 +1101,6 @@ angular.module('schemaForm').provider('schemaForm',
11011101
if (!f.titleMap) {
11021102
f.titleMap = enumToTitleMap(schema['enum']);
11031103
}
1104-
f.trackBy = 'value';
11051104
options.lookup[sfPathProvider.stringify(options.path)] = f;
11061105
return f;
11071106
}
@@ -1295,10 +1294,6 @@ angular.module('schemaForm').provider('schemaForm',
12951294
obj.titleMap = canonicalTitleMap(obj.titleMap);
12961295
}
12971296

1298-
if(obj.type === 'select') {
1299-
obj.trackBy = obj.trackBy || 'value';
1300-
}
1301-
13021297
//
13031298
if (obj.itemForm) {
13041299
obj.items = [];

dist/schema-form.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-schema-form",
3-
"version": "0.8.3",
3+
"version": "0.8.4",
44
"description": "Create complex forms from a JSON schema with angular.",
55
"repository": "Textalk/angular-schema-form",
66
"main": "dist/schema-form.min.js",

src/directives/decorators/bootstrap/select.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
sf-changed="form"
1010
class="form-control {{form.fieldHtmlClass}}"
1111
schema-validate="form"
12-
ng-options="item.value as item.name group by item.group for item in form.titleMap track by item[form.trackBy]"
12+
ng-options="item.value as item.name group by item.group for item in form.titleMap"
1313
name="{{form.key.slice(-1)[0]}}">
1414
</select>
1515
<div class="help-block" sf-message="form.description"></div>

src/services/schema-form.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ angular.module('schemaForm').provider('schemaForm',
1313
return type[0];
1414
}
1515
return type;
16-
};
16+
}
1717

1818
//Creates an default titleMap list from an enum, i.e. a list of strings.
1919
var enumToTitleMap = function(enm) {
@@ -146,7 +146,6 @@ angular.module('schemaForm').provider('schemaForm',
146146
if (!f.titleMap) {
147147
f.titleMap = enumToTitleMap(schema['enum']);
148148
}
149-
f.trackBy = 'value';
150149
options.lookup[sfPathProvider.stringify(options.path)] = f;
151150
return f;
152151
}
@@ -340,10 +339,6 @@ angular.module('schemaForm').provider('schemaForm',
340339
obj.titleMap = canonicalTitleMap(obj.titleMap);
341340
}
342341

343-
if(obj.type === 'select') {
344-
obj.trackBy = obj.trackBy || 'value';
345-
}
346-
347342
//
348343
if (obj.itemForm) {
349344
obj.items = [];

src/sfPath.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
angular.module('schemaForm').provider('sfPath',
22
[function() {
33

4-
// When building with browserify it's objectpath,
5-
// otherwise it's just objectpath.
4+
// When building with browserify ObjectPath is available as `objectpath` but othwerwise
5+
// it's called `ObjectPath`.
66
var ObjectPath = window.ObjectPath || objectpath;
77

88
var sfPath = {parse: ObjectPath.parse};

test/directives/schema-form-test.js

-79
Original file line numberDiff line numberDiff line change
@@ -1649,85 +1649,6 @@ describe('directive',function(){
16491649
});
16501650

16511651

1652-
it('should show the correct option selected', function() {
1653-
inject(function($compile,$rootScope){
1654-
var scope = $rootScope.$new();
1655-
scope.thing = { id: 2, a: 1};
1656-
1657-
scope.schema = {
1658-
"type": "object",
1659-
"properties": {
1660-
"thing": {
1661-
"title": "Thing"
1662-
}
1663-
}
1664-
};
1665-
1666-
scope.form = [{
1667-
key: "thing",
1668-
type: 'select',
1669-
titleMap: [{
1670-
name: 'abc', value: { id: 1, a: 2 }
1671-
},{
1672-
name: 'def', value: { id: 2, a: 1 }
1673-
},{
1674-
name: 'ghi', value: { id: 3, a: 3 }
1675-
}]
1676-
}];
1677-
1678-
var tmpl = angular.element('<form sf-schema="schema" sf-form="form" sf-model="thing"></form>');
1679-
1680-
$compile(tmpl)(scope);
1681-
$rootScope.$apply();
1682-
1683-
setTimeout(function() {
1684-
tmpl.children().eq(0).find('select').eq(0).val().should.be.eq(2);
1685-
}, 0);
1686-
1687-
});
1688-
});
1689-
1690-
1691-
it('should show the correct option selected with `track by`', function() {
1692-
inject(function($compile,$rootScope){
1693-
var scope = $rootScope.$new();
1694-
scope.thing = { id: 2, a: 1, b: 2 };
1695-
1696-
scope.schema = {
1697-
"type": "object",
1698-
"properties": {
1699-
"thing": {
1700-
"title": "Thing"
1701-
}
1702-
}
1703-
};
1704-
1705-
scope.form = [{
1706-
key: "thing",
1707-
type: 'select',
1708-
titleMap: [{
1709-
id: 1, name: 'abc', value: { id: 1 }
1710-
},{
1711-
id: 2, name: 'def', value: { id: 2 }
1712-
},{
1713-
id: 3, name: 'ghi', value: { id: 3 }
1714-
}],
1715-
trackBy: 'id'
1716-
}];
1717-
1718-
var tmpl = angular.element('<form sf-schema="schema" sf-form="form" sf-model="thing"></form>');
1719-
1720-
$compile(tmpl)(scope);
1721-
$rootScope.$apply();
1722-
1723-
setTimeout(function() {
1724-
tmpl.children().eq(0).find('select').eq(0).val().should.be.eq(2);
1725-
}, 0);
1726-
1727-
});
1728-
});
1729-
1730-
17311652
it('should update array form on model array ref change',function(){
17321653

17331654
inject(function($compile,$rootScope){

test/services/schema-form-test.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,7 @@ describe('schemaForm', function() {
9191
"name": "NaN",
9292
"value": "NaN"
9393
}
94-
],
95-
"trackBy": "value"
94+
]
9695
},
9796
{
9897
"title": "Are you over 18 years old?",

0 commit comments

Comments
 (0)