Skip to content

Commit 7fecdc0

Browse files
committed
ALL tests passing again :-D
1 parent 90f6c6f commit 7fecdc0

File tree

7 files changed

+127
-175
lines changed

7 files changed

+127
-175
lines changed

dist/angular-schema-form.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/*!
22
* angular-schema-form
3-
* @version 1.0.0-alpha.3
4-
* @date Fri, 30 Dec 2016 13:50:21 GMT
3+
* @version 1.0.0-alpha.4
4+
* @date Sun, 01 Jan 2017 11:54:39 GMT
55
* @link https://github.com/json-schema-form/angular-schema-form
66
* @license MIT
7-
* Copyright (c) 2014-2016 JSON Schema Form
7+
* Copyright (c) 2014-2017 JSON Schema Form
88
*/
99
/******/ (function(modules) { // webpackBootstrap
1010
/******/ // The module cache
@@ -1518,7 +1518,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
15181518
});
15191519

15201520
// Fetch our form.
1521-
scope.initialForm = sfSchema.lookup['f' + attrs.sfField];
1521+
scope.initialForm = Object.assign({}, sfSchema.lookup['f' + attrs.sfField]);
15221522
scope.form = sfSchema.lookup['f' + attrs.sfField];
15231523
},
15241524
post: function post(scope, element, attrs, ctrl) {
@@ -1538,7 +1538,8 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
15381538

15391539
if (scope.form.key && scope.form.key.length) {
15401540
if (typeof key[key.length - 1] === 'number' && scope.form.key.length >= 1) {
1541-
scope.completeKey = key.concat(scope.form.key.slice(-1));
1541+
var trim = scope.form.key.length - key.length;
1542+
scope.completeKey = key.concat(scope.form.key.slice(-trim));
15421543
} else {
15431544
scope.completeKey = scope.form.key.slice();
15441545
};
@@ -1818,17 +1819,16 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
18181819
return {
18191820
scope: true,
18201821
require: ['?^^sfNewArray'],
1821-
controller: ['$scope', function SFKeyController($scope) {
1822-
this.key = $scope.form && $scope.form.key ? $scope.form.key.splice(0, -2) : [];
1823-
}],
18241822
link: {
18251823
pre: function pre(scope, element, attrs, ctrl) {
1824+
scope.parentKey = scope.parentKey || [];
1825+
18261826
var currentKey = sfPath.parse(attrs.sfParentKey);
1827-
if (currentKey.length > 1) currentKey = currentKey.splice(-1);
1827+
var trim = currentKey.length - scope.parentKey.length;
18281828

1829-
scope.parentKey = scope.parentKey || [];
1830-
scope.parentKey = scope.parentKey.concat(currentKey, Number(attrs.sfIndex));
1829+
if (currentKey.length > 1) currentKey = currentKey.splice(-trim);
18311830

1831+
scope.parentKey = scope.parentKey.concat(currentKey, Number(attrs.sfIndex));
18321832
scope.arrayIndex = Number(attrs.sfIndex);
18331833
scope.arrayIndices = scope.arrayIndices || [];
18341834
scope.arrayIndices = scope.arrayIndices.concat(scope.arrayIndex);

dist/angular-schema-form.min.js

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

karma.conf.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ module.exports = function(config) {
2626
'dist/angular-schema-form.js',
2727
include,
2828
'src/**/*.spec.js'
29-
//'src/**/sf-schema.directive.spec.js'
3029
],
3130

3231
// list of files to exclude

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-schema-form",
3-
"version": "1.0.0-alpha.3",
3+
"version": "1.0.0-alpha.4",
44
"description": "Create complex forms from a JSON schema with angular.",
55
"repository": "json-schema-form/angular-schema-form",
66
"main": "dist/angular-schema-form.js",

src/directives/sf-field.directive.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ sfPath, sfSelect) {
1717
require: ['^sfSchema', '?^form', '?^^sfKeyController'],
1818
link: {
1919
pre: function(scope, element, attrs, ctrl) {
20-
var sfSchema = ctrl[0];
21-
var formCtrl = ctrl[1];
22-
var keyCtrl = ctrl[2];
20+
let sfSchema = ctrl[0];
21+
let formCtrl = ctrl[1];
22+
let keyCtrl = ctrl[2];
2323

2424
//The ngModelController is used in some templates and
2525
//is needed for error messages,
@@ -30,7 +30,7 @@ sfPath, sfSelect) {
3030
});
3131

3232
// Fetch our form.
33-
scope.initialForm = sfSchema.lookup['f' + attrs.sfField];
33+
scope.initialForm = Object.assign({}, sfSchema.lookup['f' + attrs.sfField]);
3434
scope.form = sfSchema.lookup['f' + attrs.sfField];
3535
},
3636
post: function(scope, element, attrs, ctrl) {
@@ -50,7 +50,8 @@ sfPath, sfSelect) {
5050

5151
if(scope.form.key && scope.form.key.length) {
5252
if(typeof key[key.length-1] === 'number' && scope.form.key.length >= 1) {
53-
scope.completeKey = key.concat(scope.form.key.slice(-1));
53+
let trim = scope.form.key.length - key.length;
54+
scope.completeKey = key.concat(scope.form.key.slice(-trim));
5455
}
5556
else {
5657
scope.completeKey = scope.form.key.slice();

src/directives/sf-key.directive.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,16 @@ export default function(schemaForm, sfPath) {
55
return {
66
scope: true,
77
require: ['?^^sfNewArray'],
8-
controller: ['$scope', function SFKeyController($scope) {
9-
this.key = ($scope.form && $scope.form.key) ? $scope.form.key.splice(0, -2) : [];
10-
}],
118
link: {
129
pre: function(scope, element, attrs, ctrl) {
13-
var currentKey = sfPath.parse(attrs.sfParentKey);
14-
if(currentKey.length > 1) currentKey = currentKey.splice(-1);
15-
1610
scope.parentKey = scope.parentKey || [];
17-
scope.parentKey = scope.parentKey.concat(currentKey, Number(attrs.sfIndex));
1811

12+
let currentKey = sfPath.parse(attrs.sfParentKey);
13+
let trim = currentKey.length - scope.parentKey.length;
14+
15+
if(currentKey.length > 1) currentKey = currentKey.splice(-trim);
16+
17+
scope.parentKey = scope.parentKey.concat(currentKey, Number(attrs.sfIndex));
1918
scope.arrayIndex = Number(attrs.sfIndex);
2019
scope.arrayIndices = scope.arrayIndices || [];
2120
scope.arrayIndices = scope.arrayIndices.concat(scope.arrayIndex);

0 commit comments

Comments
 (0)