Skip to content

Commit

Permalink
Updating the form renderer to fix some rendering issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
travist committed Apr 20, 2016
1 parent aa60f4f commit e25ab9b
Show file tree
Hide file tree
Showing 16 changed files with 2,100 additions and 1,175 deletions.
19 changes: 19 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
The MIT License (MIT)
Copyright (c) 2015 Form.io

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in the
Software without restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8 changes: 4 additions & 4 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
"form"
],
"dependencies": {
"angular": "^1.5.3",
"angular": "^1.5.5",
"ng-file-upload": "^12.0.4",
"angular-sanitize": "^1.5.3",
"angular-bootstrap": "^1.3.1",
"angular-sanitize": "^1.5.5",
"angular-bootstrap": "^1.3.2",
"angular-moment": "1.0.0-beta.5",
"bootstrap": "^3.3.6",
"bootstrap-ui-datetime-picker": "^2.2.3",
"bootstrap-ui-datetime-picker": "^2.3.1",
"signature_pad": "^1.5.3",
"angular-ui-mask": "^1.8.3",
"angular-file-saver": "^1.1.1",
Expand Down
1,345 changes: 796 additions & 549 deletions dist/formio-complete.js

Large diffs are not rendered by default.

212 changes: 193 additions & 19 deletions dist/formio-complete.min.js

Large diffs are not rendered by default.

1,345 changes: 796 additions & 549 deletions dist/formio-full.js

Large diffs are not rendered by default.

239 changes: 217 additions & 22 deletions dist/formio-full.min.js

Large diffs are not rendered by default.

21 changes: 12 additions & 9 deletions dist/formio.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*! ng-formio v1.6.12 | https://npmcdn.com/[email protected]/LICENSE.txt */
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
(function (process){
// vim:ts=4:sts=4:sw=4:
Expand Down Expand Up @@ -6499,7 +6500,7 @@ module.exports = function() {
};

// Show the current page.
var showPage = function() {
var showPage = function(scroll) {
// If the page is past the components length, try to clear first.
if ($scope.currentPage >= $scope.form.components.length) {
$scope.clear();
Expand All @@ -6525,7 +6526,9 @@ module.exports = function() {
}))($scope));
$scope.wizardLoaded = true;
$scope.formioAlerts = [];
window.scrollTo(0, 0);
if (scroll) {
window.scrollTo(0, 0);
}
$scope.$emit('wizardPage', $scope.currentPage);
};

Expand Down Expand Up @@ -6591,7 +6594,7 @@ module.exports = function() {

$scope.cancel = function() {
$scope.clear();
showPage();
showPage(true);
};

// Move onto the next page.
Expand All @@ -6603,7 +6606,7 @@ module.exports = function() {
return;
}
$scope.currentPage++;
showPage();
showPage(true);
$scope.$emit('wizardNext', $scope.currentPage);
};

Expand All @@ -6613,7 +6616,7 @@ module.exports = function() {
return;
}
$scope.currentPage--;
showPage();
showPage(true);
$scope.$emit('wizardPrev', $scope.currentPage);
};

Expand All @@ -6625,7 +6628,7 @@ module.exports = function() {
return;
}
$scope.currentPage = page;
showPage();
showPage(true);
};

$scope.isValid = function() {
Expand Down Expand Up @@ -7163,7 +7166,7 @@ app.run([
function($templateCache) {
// The template for the formio forms.
$templateCache.put('formio.html',
"<div>\n <i style=\"font-size: 2em;\" ng-if=\"formLoading\" class=\"glyphicon glyphicon-refresh glyphicon-spin\"></i>\n <formio-wizard ng-if=\"form.display === 'wizard'\" src=\"src\" form=\"form\" submission=\"submission\" form-action=\"formAction\" read-only=\"readOnly\" hide-components=\"hideComponents\" formio-options=\"formioOptions\" storage=\"form.name\"></formio-wizard>\n <form ng-if=\"!form.display || (form.display === 'form')\" role=\"form\" name=\"formioForm\" ng-submit=\"onSubmit(formioForm)\" novalidate>\n <div ng-repeat=\"alert in formioAlerts track by $index\" class=\"alert alert-{{ alert.type }}\" role=\"alert\">\n {{ alert.message }}\n </div>\n <formio-component ng-repeat=\"component in form.components track by $index\" component=\"component\" data=\"submission.data\" form=\"formioForm\" formio=\"formio\" read-only=\"readOnly || component.disabled\"></formio-component>\n </form>\n</div>\n"
"<div>\n <i style=\"font-size: 2em;\" ng-if=\"formLoading\" class=\"glyphicon glyphicon-refresh glyphicon-spin\"></i>\n <formio-wizard ng-if=\"form.display === 'wizard'\" src=\"src\" form=\"form\" submission=\"submission\" form-action=\"formAction\" read-only=\"readOnly\" hide-components=\"hideComponents\" formio-options=\"formioOptions\" storage=\"form.name\"></formio-wizard>\n <ng-form ng-if=\"!form.display || (form.display === 'form')\" role=\"form\" name=\"formioForm\" ng-submit=\"onSubmit(formioForm)\" novalidate>\n <div ng-repeat=\"alert in formioAlerts track by $index\" class=\"alert alert-{{ alert.type }}\" role=\"alert\">\n {{ alert.message }}\n </div>\n <!-- DO NOT PUT \"track by $index\" HERE SINCE DYNAMICALLY ADDING/REMOVING COMPONENTS WILL BREAK -->\n <formio-component ng-repeat=\"component in form.components\" component=\"component\" data=\"submission.data\" form=\"formioForm\" formio=\"formio\" read-only=\"readOnly || component.disabled\"></formio-component>\n </ng-form>\n</div>\n"
);

$templateCache.put('formio-wizard.html',
Expand All @@ -7184,7 +7187,7 @@ app.run([

// A formio component template.
$templateCache.put('formio/component.html',
"<ng-form name=\"formioFieldForm\" class=\"formio-component-{{ component.key }}\" ng-hide=\"component.hidden\">\n <div class=\"form-group has-feedback form-field-type-{{ component.type }} {{component.customClass}}\" id=\"form-group-{{ component.key }}\" ng-class=\"{'has-error': formioFieldForm[component.key].$invalid && !formioFieldForm[component.key].$pristine }\" ng-style=\"component.style\">\n <formio-element></formio-element>\n </div>\n</ng-form>\n"
"<div name=\"formioFieldForm\" class=\"formio-component-{{ component.key }}\" ng-hide=\"component.hidden\">\n <div class=\"form-group has-feedback form-field-type-{{ component.type }} {{component.customClass}}\" id=\"form-group-{{ component.key }}\" ng-class=\"{'has-error': formioFieldForm[component.key].$invalid && !formioFieldForm[component.key].$pristine }\" ng-style=\"component.style\">\n <formio-element></formio-element>\n </div>\n</div>\n"
);

$templateCache.put('formio/errors.html',
Expand Down Expand Up @@ -7578,4 +7581,4 @@ module.exports = function() {
};
};

},{}]},{},[56]);
},{}]},{},[56]);
35 changes: 31 additions & 4 deletions dist/formio.min.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion gulp/scripts-basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ module.exports = function(gulp, plugins, bundle) {
return bundle
.bundle()
.pipe(plugins.source('formio.js'))
.pipe(plugins.wrap(plugins.template, {version: plugins.packageJson.version}, {variable: 'data'}))
.pipe(gulp.dest('dist/'))
.pipe(plugins.rename('formio.min.js'))
.pipe(plugins.streamify(plugins.uglify()))
.pipe(plugins.streamify(plugins.uglify({preserveComments: 'license'})))
.pipe(gulp.dest('dist/'))
.on('error', function(err){
console.log(err);
Expand Down
3 changes: 2 additions & 1 deletion gulp/scripts-complete.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ module.exports = function(gulp, plugins) {
})
.bundle()
.pipe(plugins.source('formio-complete.js'))
.pipe(plugins.wrap(plugins.template, {version: plugins.packageJson.version}, {variable: 'data'}))
.pipe(gulp.dest('dist/'))
.pipe(plugins.rename('formio-complete.min.js'))
.pipe(plugins.streamify(plugins.uglify()))
.pipe(plugins.streamify(plugins.uglify({preserveComments: 'license'})))
.pipe(gulp.dest('dist/'));
};
};
3 changes: 2 additions & 1 deletion gulp/scripts-full.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ module.exports = function(gulp, plugins) {
})
.bundle()
.pipe(plugins.source('formio-full.js'))
.pipe(plugins.wrap(plugins.template, {version: plugins.packageJson.version}, {variable: 'data'}))
.pipe(gulp.dest('dist/'))
.pipe(plugins.rename('formio-full.min.js'))
.pipe(plugins.streamify(plugins.uglify()))
.pipe(plugins.streamify(plugins.uglify({preserveComments: 'license'})))
.pipe(gulp.dest('dist/'));
};
};
6 changes: 6 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ plugins.watchify = require('watchify');
plugins.runSeq = require('run-sequence');
plugins.bowerFiles = require('main-bower-files');
plugins.addsrc = require('gulp-add-src');
plugins.packageJson = require('./package.json');

var template = '/*! ng-formio v<%= data.version %> | https://npmcdn.com/ng-formio@<%= data.version %>/LICENSE.txt */';
template += "\n";
template += '<%= data.contents %>';
plugins.template = template;

gulp.task('clean', require('del').bind(null, ['dist']));
gulp.task('eslint', require('./gulp/eslint')(gulp, plugins));
Expand Down
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,18 @@
"watchify": "^3.4.0"
},
"dependencies": {
"angular": "^1.5.3",
"angular": "^1.5.5",
"angular-file-saver": "^1.1.1",
"angular-moment": "^1.0.0-beta.5",
"angular-sanitize": "^1.5.3",
"angular-ui-bootstrap": "^1.3.1",
"angular-sanitize": "^1.5.5",
"angular-ui-bootstrap": "^1.3.2",
"angular-ui-mask": "^1.8.3",
"bootstrap": "^3.3.6",
"bootstrap-ui-datetime-picker": "^2.0.5",
"bootstrap-ui-datetime-picker": "^2.3.1",
"formio-utils": "^0.1.6",
"formiojs": "^0.2.0",
"jquery": "^2.2.2",
"gulp-wrap": "^0.11.0",
"jquery": "^2.2.3",
"ng-file-upload": "^12.0.4",
"signature_pad": "^1.5.3",
"ui-select": "^0.16.1"
Expand Down
14 changes: 8 additions & 6 deletions src/directives/formioWizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ module.exports = function() {
};

// Show the current page.
var showPage = function() {
var showPage = function(scroll) {
// If the page is past the components length, try to clear first.
if ($scope.currentPage >= $scope.form.components.length) {
$scope.clear();
Expand All @@ -90,7 +90,9 @@ module.exports = function() {
}))($scope));
$scope.wizardLoaded = true;
$scope.formioAlerts = [];
window.scrollTo(0, 0);
if (scroll) {
window.scrollTo(0, 0);
}
$scope.$emit('wizardPage', $scope.currentPage);
};

Expand Down Expand Up @@ -156,7 +158,7 @@ module.exports = function() {

$scope.cancel = function() {
$scope.clear();
showPage();
showPage(true);
};

// Move onto the next page.
Expand All @@ -168,7 +170,7 @@ module.exports = function() {
return;
}
$scope.currentPage++;
showPage();
showPage(true);
$scope.$emit('wizardNext', $scope.currentPage);
};

Expand All @@ -178,7 +180,7 @@ module.exports = function() {
return;
}
$scope.currentPage--;
showPage();
showPage(true);
$scope.$emit('wizardPrev', $scope.currentPage);
};

Expand All @@ -190,7 +192,7 @@ module.exports = function() {
return;
}
$scope.currentPage = page;
showPage();
showPage(true);
};

$scope.isValid = function() {
Expand Down
4 changes: 2 additions & 2 deletions src/templates/component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<ng-form name="formioFieldForm" class="formio-component-{{ component.key }}" ng-hide="component.hidden">
<div name="formioFieldForm" class="formio-component-{{ component.key }}" ng-hide="component.hidden">
<div class="form-group has-feedback form-field-type-{{ component.type }} {{component.customClass}}" id="form-group-{{ component.key }}" ng-class="{'has-error': formioFieldForm[component.key].$invalid && !formioFieldForm[component.key].$pristine }" ng-style="component.style">
<formio-element></formio-element>
</div>
</ng-form>
</div>
7 changes: 4 additions & 3 deletions src/templates/formio.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<div>
<i style="font-size: 2em;" ng-if="formLoading" class="glyphicon glyphicon-refresh glyphicon-spin"></i>
<formio-wizard ng-if="form.display === 'wizard'" src="src" form="form" submission="submission" form-action="formAction" read-only="readOnly" hide-components="hideComponents" formio-options="formioOptions" storage="form.name"></formio-wizard>
<form ng-if="!form.display || (form.display === 'form')" role="form" name="formioForm" ng-submit="onSubmit(formioForm)" novalidate>
<ng-form ng-if="!form.display || (form.display === 'form')" role="form" name="formioForm" ng-submit="onSubmit(formioForm)" novalidate>
<div ng-repeat="alert in formioAlerts track by $index" class="alert alert-{{ alert.type }}" role="alert">
{{ alert.message }}
</div>
<formio-component ng-repeat="component in form.components track by $index" component="component" data="submission.data" form="formioForm" formio="formio" read-only="readOnly || component.disabled"></formio-component>
</form>
<!-- DO NOT PUT "track by $index" HERE SINCE DYNAMICALLY ADDING/REMOVING COMPONENTS WILL BREAK -->
<formio-component ng-repeat="component in form.components" component="component" data="submission.data" form="formioForm" formio="formio" read-only="readOnly || component.disabled"></formio-component>
</ng-form>
</div>

0 comments on commit e25ab9b

Please sign in to comment.