Skip to content

Commit 7ebc8dc

Browse files
Michael StramelMichael Stramel
authored andcommitted
Merge branch 'development' of github.com:Textalk/angular-schema-form into development
Conflicts: src/directives/decorators/bootstrap/default.html src/directives/decorators/bootstrap/textarea.html
2 parents ca58cce + e60dca0 commit 7ebc8dc

31 files changed

+286
-106
lines changed

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
**/.*

CHANGELOG

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
v0.7.8
2+
------
3+
* Thanks to @burdiuz for finding a memory leak issue and finding a solution. And thanks to @davidlgj for implementing that solution.
4+
* Post render event, thanks @mrijken
5+
* Events documentation, thanks @Dervisevic
6+
* startEmpty documentation, thanks @davidlj
7+
* npm and bower updates, thanks @Dervisevic
8+
* x-schema-form attribute, thanks @davidlgj
9+
* htmlClass and fieldHtmlClass form options, thanks @davidlgj
10+
11+
v0.7.7
12+
------
13+
* Array ref changes in model updates form, thanks @Sandreu
14+
* Tabarray & array fixes, thanks @Sandreu, @davidlgj
15+
* Use objectpath more generically to fix requirejs issues, thanks @mike-marcacci
16+
* README and documentation updates, thanks @davidlgj, @engelfrost, @Dervisevic, @stramel, @Sandreu
17+
* Expanded documentation on custom validation messages, thanks @Dervisevic
18+
* Deep structure tests, thanks @Sandreu
19+
* SF-insert-field documentation, thanks @davidlgj
20+
* Array model watch & array defaults, thanks @Sandreu
21+
122
v0.7.6
223
------
324
* Fixed broken bower specification.

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Angular Schema Form
44
[![Build Status](https://travis-ci.org/Textalk/angular-schema-form.svg?branch=master)](https://travis-ci.org/Textalk/angular-schema-form)
55
[![Coverage Status](https://coveralls.io/repos/Textalk/angular-schema-form/badge.png?branch=master)](https://coveralls.io/r/Textalk/angular-schema-form?branch=development)
66
[![Bower version](https://badge.fury.io/bo/angular-schema-form.svg)](http://badge.fury.io/bo/angular-schema-form)
7+
[![npm version](https://badge.fury.io/js/angular-schema-form.svg)](http://badge.fury.io/js/angular-schema-form)
78

89
Generate forms from JSON schemas using AngularJS!
910

@@ -145,12 +146,13 @@ angular.module('myModule', ['schemaForm']);
145146

146147
Add-ons
147148
------
148-
There is currently three add-ons, a date picker, a colorpicker and the wysiwyg html editor tinymce.
149+
There are a couple of add-ons, a date picker, a colorpicker and two wysiwyg editors.
149150
They have their own repos and you can find them here with usage instructions:
150151

151152
* [https://github.com/Textalk/angular-schema-form-datepicker](https://github.com/Textalk/angular-schema-form-datepicker)
152153
* [https://github.com/Textalk/angular-schema-form-colorpicker](https://github.com/Textalk/angular-schema-form-colorpicker)
153154
* [https://github.com/Textalk/angular-schema-form-tinymce](https://github.com/Textalk/angular-schema-form-tinymce)
155+
* [https://github.com/webcanvas/angular-schema-form-ckeditor](https://github.com/webcanvas/angular-schema-form-ckeditor)
154156

155157
Your can also [create your own add-ons!](docs/extending.md)
156158

bower.json

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@
44
"dist/schema-form.min.js",
55
"dist/bootstrap-decorator.min.js"
66
],
7-
"version": "0.7.6",
7+
"version": "0.7.8",
88
"authors": [
99
"Textalk",
10-
"David Jensen <david.lgj@gmail.com>"
10+
"David Jensen <david.lgj@gmail.com>",
11+
"Cameron Edwards",
12+
"Mike Marcacci",
13+
"Denis Dervisevic <denis@dervisevic.se>"
1114
],
1215
"moduleType": [
1316
"globals"
@@ -23,10 +26,17 @@
2326
"license": "MIT",
2427
"ignore": [
2528
"**/.*",
29+
"*.js",
30+
"*.json",
2631
"node_modules",
2732
"bower_components",
2833
"test",
29-
"coverage"
34+
"coverage",
35+
"docs",
36+
"examples",
37+
"gulp",
38+
"CHANGELOG",
39+
"LICENSE"
3040
],
3141
"dependencies": {
3242
"angular": ">= 1.2",

dist/bootstrap-decorator.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/schema-form.js

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -481,8 +481,15 @@ angular.module('schemaForm').provider('schemaForm',
481481
var def;
482482
for (var i = 0; i < rules.length; i++) {
483483
def = rules[i](name, schema, options);
484+
484485
//first handler in list that actually returns something is our handler!
485486
if (def) {
487+
488+
// Do we have form defaults in the schema under the x-schema-form-attribute?
489+
if (def.schema['x-schema-form'] && angular.isObject(def.schema['x-schema-form'])) {
490+
def = angular.extend(def, def.schema['x-schema-form']);
491+
}
492+
486493
return def;
487494
}
488495
}
@@ -508,14 +515,16 @@ angular.module('schemaForm').provider('schemaForm',
508515
if (schema.minimum) { f.minimum = schema.minimum + (schema.exclusiveMinimum ? 1 : 0); }
509516
if (schema.maximum) { f.maximum = schema.maximum - (schema.exclusiveMaximum ? 1 : 0); }
510517

511-
//Non standard attributes
518+
// Non standard attributes (DONT USE DEPRECATED)
519+
// If you must set stuff like this in the schema use the x-schema-form attribute
512520
if (schema.validationMessage) { f.validationMessage = schema.validationMessage; }
513521
if (schema.enumNames) { f.titleMap = canonicalTitleMap(schema.enumNames, schema['enum']); }
514522
f.schema = schema;
515523

516524
// Ng model options doesn't play nice with undefined, might be defined
517525
// globally though
518526
f.ngModelOptions = f.ngModelOptions || {};
527+
519528
return f;
520529
};
521530

@@ -1279,7 +1288,7 @@ angular.module('schemaForm')
12791288
//Since we are dependant on up to three
12801289
//attributes we'll do a common watch
12811290
var lastDigest = {};
1282-
1291+
var childScope;
12831292
scope.$watch(function() {
12841293

12851294
var schema = scope.schema;
@@ -1295,8 +1304,17 @@ angular.module('schemaForm')
12951304
var merged = schemaForm.merge(schema, form, ignore, scope.options);
12961305
var frag = document.createDocumentFragment();
12971306

1307+
// Create a new form and destroy the old one.
1308+
// Not doing keeps old form elements hanging around after
1309+
// they have been removed from the DOM
1310+
// https://github.com/Textalk/angular-schema-form/issues/200
1311+
if (childScope) {
1312+
childScope.$destroy();
1313+
}
1314+
childScope = scope.$new();
1315+
12981316
//make the form available to decorators
1299-
scope.schemaForm = {form: merged, schema: schema};
1317+
childScope.schemaForm = {form: merged, schema: schema};
13001318

13011319
//clean all but pre existing html.
13021320
element.children(':not(.schema-form-ignore)').remove();
@@ -1335,7 +1353,7 @@ angular.module('schemaForm')
13351353
element[0].appendChild(frag);
13361354

13371355
//compile only children
1338-
$compile(element.children())(scope);
1356+
$compile(element.children())(childScope);
13391357

13401358
//ok, now that that is done let's set any defaults
13411359
schemaForm.traverseSchema(schema, function(prop, path) {
@@ -1346,7 +1364,8 @@ angular.module('schemaForm')
13461364
}
13471365
}
13481366
});
1349-
}
1367+
};
1368+
scope.$emit('sf-render-finished', element);
13501369
});
13511370
}
13521371
};

0 commit comments

Comments
 (0)