Socket
Socket
Sign inDemoInstall

angular-formly-templates-vanilla

Package Overview
Dependencies
2
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.2 to 2.0.0

src/modules/formlyVanilla.js

13

bower.json
{
"name": "angular-formly-templates-vanilla",
"version": "0.0.2",
"version": "2.0.0",
"authors": [
"Astrism <astrisms@gmail.com>"
],
"main": [
"dist/angular-formly-templates-vanilla.min.js",
"dist/angular-formly-templates-vanilla.min.map"
"contributors": [
"Astrism <astrisms@gmail.com>",
"Kent C. Dodds <kent@doddsfamily.us>"
],
"main": "dist/angular-formly-templates-vanilla.js",
"description": "Angular-Formly plugin which outputs plain html form fields.",

@@ -33,6 +34,2 @@ "keywords": [

"devDependencies": {
"angular-ui-router": "~0.2.10",
"angular-highlightjs": "~0.3.0",
"highlightjs": "~8.0.0",
"bootstrap": "~3.2.0",
"chai": "~1.9.1",

@@ -39,0 +36,0 @@ "mocha": "~1.21.4"

@@ -1,6 +0,24 @@

angular.module('formly.render').run(['$templateCache', function($templateCache) {
// "formlyVanilla" version 2.0.0 built with ♥ by Astrism <astrisms@gmail.com>, Kent C. Dodds <kent@doddsfamily.us> (ó ì_í)=óò=(ì_í ò)
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['angular'], function (angular) {
return (root.returnExportsGlobal = factory(angular));
});
} else if (typeof exports === 'object') {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like enviroments that support module.exports,
// like Node.
module.exports = factory(require('angular'));
} else {
factory(root.angular);
}
}(this, function (angular) {
angular.module('formlyVanilla', ['formly']);
angular.module('formlyVanilla').run(['$templateCache', function($templateCache) {
'use strict';
$templateCache.put('fields/formly-field-checkbox.html',
"<div><label><input type=checkbox id={{id}} formly-dynamic-name=options.key formly-custom-validation=options.validators aria-describedby={{id}}_description ng-required=options.required ng-disabled=options.disabled ng-model=\"result[options.key || index]\"> {{options.label || 'Checkbox'}} {{options.required ? '*' : ''}}</label><p id={{id}}_description ng-if=options.description>{{options.description}}</p></div>"
"<div><label><input type=checkbox id={{id}} formly-dynamic-name=id formly-custom-validation=options.validators aria-describedby={{id}}_description ng-required=options.required ng-disabled=options.disabled ng-model=\"model[options.key || index]\"> {{options.label || 'Checkbox'}} {{options.required ? '*' : ''}}</label><p id={{id}}_description ng-if=options.description>{{options.description}}</p></div>"
);

@@ -10,3 +28,3 @@

$templateCache.put('fields/formly-field-email.html',
"<div><label for={{id}}>{{options.label || 'Email'}} {{options.required ? '*' : ''}}</label><input type=email id={{id}} formly-dynamic-name=options.key formly-custom-validation=options.validators placeholder={{options.placeholder}} aria-describedby={{id}}_description ng-required=options.required ng-disabled=options.disabled ng-model=\"result[options.key || index]\"><p id={{id}}_description ng-if=options.description>{{options.description}}</p></div>"
"<div><label for={{id}}>{{options.label || 'Email'}} {{options.required ? '*' : ''}}</label><input type=email id={{id}} formly-dynamic-name=id formly-custom-validation=options.validators placeholder={{options.placeholder}} aria-describedby={{id}}_description ng-required=options.required ng-disabled=options.disabled ng-model=\"model[options.key || index]\"><p id={{id}}_description ng-if=options.description>{{options.description}}</p></div>"
);

@@ -16,3 +34,3 @@

$templateCache.put('fields/formly-field-hidden.html',
"<input type=hidden ng-model=\"result[options.key || index]\">"
"<input type=hidden ng-model=\"model[options.key || index]\">"
);

@@ -22,3 +40,3 @@

$templateCache.put('fields/formly-field-number.html',
"<div><label for={{id}}>{{options.label || 'Number'}} {{options.required ? '*' : ''}}</label><input type=number id={{id}} formly-dynamic-name=options.key formly-custom-validation=options.validators placeholder={{options.placeholder}} aria-describedby={{id}}_description ng-required=options.required ng-disabled=options.disabled min={{options.min}} max={{options.max}} ng-minlength={{options.minlength}} ng-maxlength={{options.maxlength}} ng-model=\"result[options.key || index]\"><p id={{id}}_description ng-if=options.description>{{options.description}}</p></div>"
"<div><label for={{id}}>{{options.label || 'Number'}} {{options.required ? '*' : ''}}</label><input type=number id={{id}} formly-dynamic-name=id formly-custom-validation=options.validators placeholder={{options.placeholder}} aria-describedby={{id}}_description ng-required=options.required ng-disabled=options.disabled min={{options.min}} max={{options.max}} ng-minlength={{options.minlength}} ng-maxlength={{options.maxlength}} ng-model=\"model[options.key || index]\"><p id={{id}}_description ng-if=options.description>{{options.description}}</p></div>"
);

@@ -28,3 +46,3 @@

$templateCache.put('fields/formly-field-password.html',
"<div><label for={{id}}>{{options.label || 'Password'}} {{options.required ? '*' : ''}}</label><input type=password id={{id}} formly-dynamic-name=options.key formly-custom-validation=options.validators aria-describedby={{id}}_description ng-required=options.required ng-disabled=options.disabled ng-trim=\"{{options.trimWhitespace || false}}\" ng-model=\"result[options.key || index]\"><p id={{id}}_description ng-if=options.description>{{options.description}}</p></div>"
"<div><label for={{id}}>{{options.label || 'Password'}} {{options.required ? '*' : ''}}</label><input type=password id={{id}} formly-dynamic-name=id formly-custom-validation=options.validators aria-describedby={{id}}_description ng-required=options.required ng-disabled=options.disabled ng-trim=\"{{options.trimWhitespace || false}}\" ng-model=\"model[options.key || index]\"><p id={{id}}_description ng-if=options.description>{{options.description}}</p></div>"
);

@@ -34,3 +52,3 @@

$templateCache.put('fields/formly-field-radio.html',
"<div><label>{{options.label}} {{options.required ? '*' : ''}}</label><div ng-repeat=\"(key, option) in options.options\"><label><input type=radio formly-dynamic-name=options.key formly-custom-validation=options.validators id=\"{{id + '_'+ $index}}\" aria-describedby={{id}}_description ng-value=option.value ng-required=options.required ng-model=\"$parent.result[$parent.options.key || $parent.index]\"> {{option.name}}</label><p id={{id}}_description ng-if=option.description>{{option.description}}</p></div></div>"
"<div><label>{{options.label}} {{options.required ? '*' : ''}}</label><div ng-repeat=\"(key, option) in options.options\"><label><input type=radio formly-dynamic-name=id formly-custom-validation=options.validators id=\"{{id + '_'+ $index}}\" aria-describedby={{id}}_description ng-value=option.value ng-required=options.required ng-model=\"$parent.model[$parent.options.key || $parent.index]\"> {{option.name}}</label><p id={{id}}_description ng-if=option.description>{{option.description}}</p></div></div>"
);

@@ -40,3 +58,3 @@

$templateCache.put('fields/formly-field-select.html',
"<div><label for={{id}}>{{options.label || 'Select'}} {{options.required ? '*' : ''}}</label><select id={{id}} formly-dynamic-name=options.key formly-custom-validation=options.validators aria-describedby={{id}}_description ng-model=\"result[options.key || index]\" ng-required=options.required ng-disabled=options.disabled ng-options=\"option.value as option.name group by option.group for option in options.options\"></select><p id={{id}}_description ng-if=options.description>{{options.description}}</p></div>"
"<div><label for={{id}}>{{options.label || 'Select'}} {{options.required ? '*' : ''}}</label><select id={{id}} formly-dynamic-name=id formly-custom-validation=options.validators aria-describedby={{id}}_description ng-model=\"model[options.key || index]\" ng-required=options.required ng-disabled=options.disabled ng-options=\"option.value as option.name group by option.group for option in options.options\"></select><p id={{id}}_description ng-if=options.description>{{options.description}}</p></div>"
);

@@ -46,3 +64,3 @@

$templateCache.put('fields/formly-field-text.html',
"<div><label for={{id}}>{{options.label || 'Text'}} {{options.required ? '*' : ''}}</label><input type=text id={{id}} formly-dynamic-name=options.key formly-custom-validation=options.validators placeholder={{options.placeholder}} aria-describedby={{id}}_description ng-required=options.required ng-disabled=options.disabled ng-model=\"result[options.key || index]\"><p id={{id}}_description ng-if=options.description>{{options.description}}</p></div>"
"<div><label for={{id}}>{{options.label || 'Text'}} {{options.required ? '*' : ''}}</label><input type=text id={{id}} formly-dynamic-name=id formly-custom-validation=options.validators placeholder={{options.placeholder}} aria-describedby={{id}}_description ng-required=options.required ng-disabled=options.disabled ng-model=\"model[options.key || index]\"><p id={{id}}_description ng-if=options.description>{{options.description}}</p></div>"
);

@@ -52,3 +70,3 @@

$templateCache.put('fields/formly-field-textarea.html',
"<div><label for={{id}}>{{options.label || 'Text'}} {{options.required ? '*' : ''}}</label><textarea type=text id={{id}} formly-dynamic-name=options.key formly-custom-validation=options.validators rows={{options.lines}} placeholder={{options.placeholder}} aria-describedby={{id}}_description ng-required=options.required ng-disabled=options.disabled ng-model=\"result[options.key || index]\">\n" +
"<div><label for={{id}}>{{options.label || 'Text'}} {{options.required ? '*' : ''}}</label><textarea type=text id={{id}} formly-dynamic-name=id formly-custom-validation=options.validators rows={{options.lines}} placeholder={{options.placeholder}} aria-describedby={{id}}_description ng-required=options.required ng-disabled=options.disabled ng-model=\"model[options.key || index]\">\n" +
"\t</textarea><p id={{id}}_description ng-if=options.description>{{options.description}}</p></div>"

@@ -60,12 +78,14 @@ );

// This file adds the default templates to the formlyConfigProvider.
// It is excluded from the no-templates build.
angular.module('formly.render').config(["formlyConfigProvider", function(formlyConfigProvider) {
'use strict';
var fields = [
'textarea', 'radio', 'select', 'number', 'checkbox',
'password', 'hidden', 'email', 'text'
];
angular.forEach(fields, function(field) {
formlyConfigProvider.setTemplateUrl(field, 'fields/formly-field-' + field + '.html');
});
}]);
angular.module('formlyVanilla').config(["formlyConfigProvider", function(formlyConfigProvider) {
'use strict';
var fields = [
'textarea', 'radio', 'select', 'number', 'checkbox',
'password', 'hidden', 'email', 'text'
];
angular.forEach(fields, function(field) {
formlyConfigProvider.setTemplateUrl(field, 'fields/formly-field-' + field + '.html');
});
}]);
return "formlyVanilla";
}));

@@ -1,2 +0,2 @@

angular.module("formly.render").run(["$templateCache",function(a){"use strict";a.put("fields/formly-field-checkbox.html","<div><label><input type=checkbox id={{id}} formly-dynamic-name=options.key formly-custom-validation=options.validators aria-describedby={{id}}_description ng-required=options.required ng-disabled=options.disabled ng-model=\"result[options.key || index]\"> {{options.label || 'Checkbox'}} {{options.required ? '*' : ''}}</label><p id={{id}}_description ng-if=options.description>{{options.description}}</p></div>"),a.put("fields/formly-field-email.html","<div><label for={{id}}>{{options.label || 'Email'}} {{options.required ? '*' : ''}}</label><input type=email id={{id}} formly-dynamic-name=options.key formly-custom-validation=options.validators placeholder={{options.placeholder}} aria-describedby={{id}}_description ng-required=options.required ng-disabled=options.disabled ng-model=\"result[options.key || index]\"><p id={{id}}_description ng-if=options.description>{{options.description}}</p></div>"),a.put("fields/formly-field-hidden.html",'<input type=hidden ng-model="result[options.key || index]">'),a.put("fields/formly-field-number.html","<div><label for={{id}}>{{options.label || 'Number'}} {{options.required ? '*' : ''}}</label><input type=number id={{id}} formly-dynamic-name=options.key formly-custom-validation=options.validators placeholder={{options.placeholder}} aria-describedby={{id}}_description ng-required=options.required ng-disabled=options.disabled min={{options.min}} max={{options.max}} ng-minlength={{options.minlength}} ng-maxlength={{options.maxlength}} ng-model=\"result[options.key || index]\"><p id={{id}}_description ng-if=options.description>{{options.description}}</p></div>"),a.put("fields/formly-field-password.html","<div><label for={{id}}>{{options.label || 'Password'}} {{options.required ? '*' : ''}}</label><input type=password id={{id}} formly-dynamic-name=options.key formly-custom-validation=options.validators aria-describedby={{id}}_description ng-required=options.required ng-disabled=options.disabled ng-trim=\"{{options.trimWhitespace || false}}\" ng-model=\"result[options.key || index]\"><p id={{id}}_description ng-if=options.description>{{options.description}}</p></div>"),a.put("fields/formly-field-radio.html","<div><label>{{options.label}} {{options.required ? '*' : ''}}</label><div ng-repeat=\"(key, option) in options.options\"><label><input type=radio formly-dynamic-name=options.key formly-custom-validation=options.validators id=\"{{id + '_'+ $index}}\" aria-describedby={{id}}_description ng-value=option.value ng-required=options.required ng-model=\"$parent.result[$parent.options.key || $parent.index]\"> {{option.name}}</label><p id={{id}}_description ng-if=option.description>{{option.description}}</p></div></div>"),a.put("fields/formly-field-select.html","<div><label for={{id}}>{{options.label || 'Select'}} {{options.required ? '*' : ''}}</label><select id={{id}} formly-dynamic-name=options.key formly-custom-validation=options.validators aria-describedby={{id}}_description ng-model=\"result[options.key || index]\" ng-required=options.required ng-disabled=options.disabled ng-options=\"option.value as option.name group by option.group for option in options.options\"></select><p id={{id}}_description ng-if=options.description>{{options.description}}</p></div>"),a.put("fields/formly-field-text.html","<div><label for={{id}}>{{options.label || 'Text'}} {{options.required ? '*' : ''}}</label><input type=text id={{id}} formly-dynamic-name=options.key formly-custom-validation=options.validators placeholder={{options.placeholder}} aria-describedby={{id}}_description ng-required=options.required ng-disabled=options.disabled ng-model=\"result[options.key || index]\"><p id={{id}}_description ng-if=options.description>{{options.description}}</p></div>"),a.put("fields/formly-field-textarea.html","<div><label for={{id}}>{{options.label || 'Text'}} {{options.required ? '*' : ''}}</label><textarea type=text id={{id}} formly-dynamic-name=options.key formly-custom-validation=options.validators rows={{options.lines}} placeholder={{options.placeholder}} aria-describedby={{id}}_description ng-required=options.required ng-disabled=options.disabled ng-model=\"result[options.key || index]\">\n </textarea><p id={{id}}_description ng-if=options.description>{{options.description}}</p></div>")}]),angular.module("formly.render").config(["formlyConfigProvider",function(a){"use strict";var b=["textarea","radio","select","number","checkbox","password","hidden","email","text"];angular.forEach(b,function(b){a.setTemplateUrl(b,"fields/formly-field-"+b+".html")})}]);
!function(a,b){"function"==typeof define&&define.amd?define(["angular"],function(c){return a.returnExportsGlobal=b(c)}):"object"==typeof exports?module.exports=b(require("angular")):b(a.angular)}(this,function(a){return a.module("formlyVanilla",["formly"]),a.module("formlyVanilla").run(["$templateCache",function(a){"use strict";a.put("fields/formly-field-checkbox.html","<div><label><input type=checkbox id={{id}} formly-dynamic-name=id formly-custom-validation=options.validators aria-describedby={{id}}_description ng-required=options.required ng-disabled=options.disabled ng-model=\"model[options.key || index]\"> {{options.label || 'Checkbox'}} {{options.required ? '*' : ''}}</label><p id={{id}}_description ng-if=options.description>{{options.description}}</p></div>"),a.put("fields/formly-field-email.html","<div><label for={{id}}>{{options.label || 'Email'}} {{options.required ? '*' : ''}}</label><input type=email id={{id}} formly-dynamic-name=id formly-custom-validation=options.validators placeholder={{options.placeholder}} aria-describedby={{id}}_description ng-required=options.required ng-disabled=options.disabled ng-model=\"model[options.key || index]\"><p id={{id}}_description ng-if=options.description>{{options.description}}</p></div>"),a.put("fields/formly-field-hidden.html",'<input type=hidden ng-model="model[options.key || index]">'),a.put("fields/formly-field-number.html","<div><label for={{id}}>{{options.label || 'Number'}} {{options.required ? '*' : ''}}</label><input type=number id={{id}} formly-dynamic-name=id formly-custom-validation=options.validators placeholder={{options.placeholder}} aria-describedby={{id}}_description ng-required=options.required ng-disabled=options.disabled min={{options.min}} max={{options.max}} ng-minlength={{options.minlength}} ng-maxlength={{options.maxlength}} ng-model=\"model[options.key || index]\"><p id={{id}}_description ng-if=options.description>{{options.description}}</p></div>"),a.put("fields/formly-field-password.html","<div><label for={{id}}>{{options.label || 'Password'}} {{options.required ? '*' : ''}}</label><input type=password id={{id}} formly-dynamic-name=id formly-custom-validation=options.validators aria-describedby={{id}}_description ng-required=options.required ng-disabled=options.disabled ng-trim=\"{{options.trimWhitespace || false}}\" ng-model=\"model[options.key || index]\"><p id={{id}}_description ng-if=options.description>{{options.description}}</p></div>"),a.put("fields/formly-field-radio.html","<div><label>{{options.label}} {{options.required ? '*' : ''}}</label><div ng-repeat=\"(key, option) in options.options\"><label><input type=radio formly-dynamic-name=id formly-custom-validation=options.validators id=\"{{id + '_'+ $index}}\" aria-describedby={{id}}_description ng-value=option.value ng-required=options.required ng-model=\"$parent.model[$parent.options.key || $parent.index]\"> {{option.name}}</label><p id={{id}}_description ng-if=option.description>{{option.description}}</p></div></div>"),a.put("fields/formly-field-select.html","<div><label for={{id}}>{{options.label || 'Select'}} {{options.required ? '*' : ''}}</label><select id={{id}} formly-dynamic-name=id formly-custom-validation=options.validators aria-describedby={{id}}_description ng-model=\"model[options.key || index]\" ng-required=options.required ng-disabled=options.disabled ng-options=\"option.value as option.name group by option.group for option in options.options\"></select><p id={{id}}_description ng-if=options.description>{{options.description}}</p></div>"),a.put("fields/formly-field-text.html","<div><label for={{id}}>{{options.label || 'Text'}} {{options.required ? '*' : ''}}</label><input type=text id={{id}} formly-dynamic-name=id formly-custom-validation=options.validators placeholder={{options.placeholder}} aria-describedby={{id}}_description ng-required=options.required ng-disabled=options.disabled ng-model=\"model[options.key || index]\"><p id={{id}}_description ng-if=options.description>{{options.description}}</p></div>"),a.put("fields/formly-field-textarea.html","<div><label for={{id}}>{{options.label || 'Text'}} {{options.required ? '*' : ''}}</label><textarea type=text id={{id}} formly-dynamic-name=id formly-custom-validation=options.validators rows={{options.lines}} placeholder={{options.placeholder}} aria-describedby={{id}}_description ng-required=options.required ng-disabled=options.disabled ng-model=\"model[options.key || index]\">\n </textarea><p id={{id}}_description ng-if=options.description>{{options.description}}</p></div>")}]),a.module("formlyVanilla").config(["formlyConfigProvider",function(b){"use strict";var c=["textarea","radio","select","number","checkbox","password","hidden","email","text"];a.forEach(c,function(a){b.setTemplateUrl(a,"fields/formly-field-"+a+".html")})}]),"formlyVanilla"});
//# sourceMappingURL=angular-formly-templates-vanilla.min.map

@@ -5,163 +5,148 @@ 'use strict';

module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
require('time-grunt')(grunt);
require('load-grunt-tasks')(grunt);
require('time-grunt')(grunt);
var tmp = '.tmp/';
var preBuiltDest = tmp + 'build-prep';
var builtDest = tmp + 'built';
var templatesFile = preBuiltDest + '/formly-templates.js';
var targetFilename = 'angular-formly-templates-vanilla';
var concatFile = builtDest + '/' + targetFilename + '.js';
var uglifyFile = builtDest + '/' + targetFilename + '.min.js';
var tmp = '.tmp/';
var preBuiltDest = tmp + 'build-prep';
var builtDest = tmp + 'built';
var templatesFile = preBuiltDest + '/formly-templates.js';
var targetFilename = 'angular-formly-templates-vanilla';
var concatFile = builtDest + '/' + targetFilename + '.js';
var uglifyFile = builtDest + '/' + targetFilename + '.min.js';
var config = {
pkg: grunt.file.readJSON('package.json'),
formlyConfig: {
hostname: 'localhost', // change to 0.0.0.0 to listen on all connections
base: 'src',
demo: 'demo',
dist: 'dist',
port: 4000,
livereloadport: 35701
},
connect: {
dev: {
options: {
hostname: '<%= formlyConfig.hostname %>',
port: '<%= formlyConfig.port %>',
base: '<%= formlyConfig.demo %>',
livereload: '<%= formlyConfig.livereloadport %>'
}
}
},
'gh-pages': {
options: {
base: '<%= formlyConfig.demo %>'
},
src: ['**']
},
clean: {
tmp: '.tmp/**/*',
dist: 'dist/**/*'
},
jshint: {
src: ['src/**/*.js']
},
mocha: {
all: {
src: ['tests/testrunner.html']
},
options: {
run: true
}
},
watch: {
livereload: {
files: ['<%= formlyConfig.dist %>/**/*.{js,html}', '<%= formlyConfig.demo %>/**/*.{js,css,html}'],
options: {
livereload: '<%= formlyConfig.livereloadport %>'
}
},
build: {
files: ['<%= formlyConfig.base %>/**/*.{js,html}'],
tasks: ['build']
}
},
var config = {
pkg: grunt.file.readJSON('package.json'),
formlyConfig: {
base: 'src',
dist: 'dist'
},
clean: {
tmp: '.tmp/**/*',
dist: 'dist/**/*'
},
jshint: {
src: ['src/**/*.js']
},
mocha: {
all: {
src: ['tests/testrunner.html']
},
options: {
run: true
}
},
watch: {
build: {
files: ['<%= formlyConfig.base %>/**/*.{js,html}'],
tasks: ['build']
}
},
copy: {
build: {
files: [
{
expand: true,
cwd: '<%= formlyConfig.base %>/',
src: ['**/*.*', '!**/*Spec.js'],
dest: preBuiltDest
}
]
},
dist: {
expand: true,
cwd: '.tmp/',
src: '**/built/**/*.*',
dest: 'dist/',
flatten: true,
filter: 'isFile',
}
},
ngtemplates: {
default: {
options: {
module: 'formly.render',
append: true,
htmlmin: {
collapseBooleanAttributes: true,
collapseWhitespace: true,
removeAttributeQuotes: true,
removeComments: true,
removeEmptyAttributes: true,
removeRedundantAttributes: false,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true
}
},
files: [
{
cwd: preBuiltDest + '/',
src: [ 'fields/**/*.html' ],
dest: templatesFile
}
]
}
},
concat: {
default: {
src: [preBuiltDest + '/**/*.js'],
dest: concatFile
}
},
ngAnnotate: {
default: {
src: concatFile,
dest: concatFile
}
},
uglify: {
default: {
src: concatFile,
dest: uglifyFile,
options: {
mangle: true,
sourceMap: true
}
}
}
};
copy: {
build: {
files: [
{
expand: true,
cwd: '<%= formlyConfig.base %>/',
src: ['**/*.*', '!**/*Spec.js'],
dest: preBuiltDest
}
]
},
dist: {
expand: true,
cwd: '.tmp/',
src: '**/built/**/*.*',
dest: 'dist/',
flatten: true,
filter: 'isFile'
}
},
ngtemplates: {
default: {
options: {
module: 'formlyVanilla',
append: true,
htmlmin: {
collapseBooleanAttributes: true,
collapseWhitespace: true,
removeAttributeQuotes: true,
removeComments: true,
removeEmptyAttributes: true,
removeRedundantAttributes: false,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true
}
},
files: [
{
cwd: preBuiltDest + '/',
src: [ 'fields/**/*.html' ],
dest: templatesFile
}
]
}
},
concat: {
default: {
src: [
preBuiltDest + '/modules/*.js',
preBuiltDest + '/**/*.js'
],
dest: concatFile
}
},
ngAnnotate: {
default: {
src: concatFile,
dest: concatFile
}
},
uglify: {
default: {
src: concatFile,
dest: uglifyFile,
options: {
mangle: true,
sourceMap: true
}
}
},
umd: {
all: {
options: {
src: concatFile,
template: __dirname + '/umd.hbs',
objectToExport: '"formlyVanilla"',
version: '<%= pkg.version %>',
contributors: '<%= pkg.contributors.join(\', \') %>'
}
}
}
};
// Pass config to grunt
grunt.initConfig(config);
// Pass config to grunt
grunt.initConfig(config);
grunt.registerTask('publish', [
'gh-pages'
]);
grunt.registerTask('dev', [
'build',
'connect:dev',
'watch'
]);
grunt.registerTask('dev', [
'build',
'connect:dev',
'watch'
]);
grunt.registerTask('build', [
'jshint',
//'mocha',
'clean:tmp',
'copy:build',
'ngtemplates',
'concat',
'ngAnnotate',
'umd:all',
'uglify',
'clean:dist',
'copy:dist'
]);
grunt.registerTask('build', [
'jshint',
'mocha',
'clean:tmp',
'copy:build',
'ngtemplates',
'concat',
'ngAnnotate',
'uglify',
'clean:dist',
'copy:dist'
]);
grunt.registerTask('default', ['build']);
grunt.registerTask('default', ['build']);
};
{
"name": "angular-formly-templates-vanilla",
"version": "0.0.2",
"version": "2.0.0",
"author": "Astrism <astrisms@gmail.com>",
"contributors": [
"Astrism <astrisms@gmail.com>",
"Kent C. Dodds <kent@doddsfamily.us>"
],
"homepage": "http://formly-js.github.io/angular-formly-templates-vanilla/",

@@ -18,2 +22,6 @@ "repository": {

"description": "Angular-Formly plugin which outputs plain html form fields.",
"dependencies": {
"angular": "^1.2.22",
"angular-formly": "^2.0.0"
},
"devDependencies": {

@@ -37,2 +45,3 @@ "bower": "1.2.7",

"grunt-ngmin": "0.0.3",
"grunt-umd": "^2.2.1",
"load-grunt-tasks": "^0.6.0",

@@ -39,0 +48,0 @@ "lodash-node": "^2.4.1",

@@ -38,17 +38,289 @@ [![Build Status](https://travis-ci.org/formly-js/angular-formly.svg)](https://travis-ci.org/formly-js/angular-formly)

See `bower.json` and `index.html` in the `master` branch for a full list / more details
## Install in your project
- Install [Angular-Formly](https://github.com/formly-js/angular-formly)
- Install Angular-Formly: Vanilla Templates
`$ bower install angular-formly-templates-vanilla --save`
- Install Angular-Formly: Bootstrap Templates
`$ bower install angular-formly angular-formly-templates-vanilla --save`
or
`$ npm install angular-formly angular-formly-templates-vanilla --save`
- Include the javascript file in your index.html, Formly comes in the following flavors:
`<script src="bower_components/angular-formly/dist/formly.min.js"></script>`
`<script src="bower_components/angular-formly-templates-vanilla/dist/angular-formly-templates-vanilla.min.js"></script>`
and
`angular.module('yourModule', ['formly', 'formlyVanilla']);`
or
`angular.module('yourModule', [require('angular-formly'), require('angular-formly-templates-vanilla')]);`
## Documentation
See [Angular-Formly](https://github.com/formly-js/angular-formly).
See [Angular-Formly](https://github.com/formly-js/angular-formly) for formly core documentation.
### Common Properties
---
##### label (string)
>`label` is used to add an html label to each field.
###### Default
>A default is set for each field based on its type. ie `Text`, `Checkbox`, `Password`
---
##### required (boolean)
>`required` is used to add the required attribute to a form field.
###### Default
>`undefined`
---
##### hide (boolean)
>`hide` is used to conditionally show the input. When true, the input is hidden (meant to be used with a watch).
###### Default
>`undefined`
---
##### disabled (boolean)
>`disabled` is used to add the disabled attribute to a form field.
###### Default
>`undefined`
---
##### placeholder (string)
>`placeholder` is used to add placeholder text to some inputs.
###### Default
>`undefined`
---
##### description (string)
>`description` is used to add descriptive text to all inputs.
###### Default
>`undefined`
### Fields
### Form Fields
Below is a detailed description of each form fields and its custom properties.
#### Text form field
>The text field allows single line input with a input element set to `type='text'`. It doesn't have any custom properties.
##### default (string, optional)
_Example text field_
```json
{
"type": "text",
"key": "firstName",
"placeholder": "jane doe",
"label": "First name"
}
```
---
#### Textarea form field
>The textarea field creates multiline input with a textarea element.
##### default (string, optional)
##### lines (number, optional)
>`lines` sets the rows attribute for the textarea element. If unset, the default is 2 lines.
_Example textarea field_
```json
{
"type": "textarea",
"key": "about",
"placeholder": "I like puppies",
"label": "Tell me about yourself",
"lines": 4
}
```
---
#### Checkbox form field
>The checkbox field allows checkbox input with a input element set to `type='checkbox'`. It doesn't have any custom properties.
##### default (boolean, optional)
_Example checkbox field_
```json
{
"type": "checkbox",
"key": "checkThis",
"label": "Check this box",
"default": true
}
```
---
#### Radio form field
>The radio field allows multiple choice input with a series of linked inputs, with `type='radio'`.
##### options (array, required)
>`options` is an array of options for the radio form field to display. Each option should be an object with a `name`(string) and `value`(string or number).
_Example radio field_
```json
{
"key": "triedEmber",
"type": "radio",
"label": "Have you tried EmberJs yet?",
"default": "no",
"options": [
{
"name": "Yes, and I love it!",
"value": "yesyes"
},
{
"name": "Yes, but I'm not a fan...",
"value": "yesno"
},
{
"name": "Nope",
"value": "no"
}
]
}
```
---
#### Select form field
>The select field allows selection via dropdown using the select element.
##### default (number, optional)
>The default can be set to the index of one of the `options`.
##### options (array, required)
>`options` is an array of options for the select form field to display. Each option should be an object with a `name`(string). You may optionally add a `group` to some or all of your options.
_Example select field_
```json
{
"key": "transportation",
"type": "select",
"label": "How do you get around in the city",
"options": [
{
"name": "Car"
},
{
"name": "Helicopter"
},
{
"name": "Sport Utility Vehicle"
},
{
"name": "Bicycle",
"group": "low emissions"
},
{
"name": "Skateboard",
"group": "low emissions"
},
{
"name": "Walk",
"group": "low emissions"
},
{
"name": "Bus",
"group": "low emissions"
},
{
"name": "Scooter",
"group": "low emissions"
},
{
"name": "Train",
"group": "low emissions"
},
{
"name": "Hot Air Baloon",
"group": "low emissions"
}
]
}
```
---
#### Number form field
>The number field allows input that is restricted to numbers. Browsers also provide minimal ui to increase and decrease the current value.
##### default (number, optional)
##### min (number, optional)
>`min` sets minimum acceptable value for the input.
##### max (number, optional)
>`max` sets maximum acceptable value for the input.
##### minlength (number, optional)
>`minlength` sets minimum number of characters for the input. If a number less than this value it will not be submitted with the form. eg 1000 is 4 characters long and if `minlength` is set to 5, it would not be sent. Currently there is no error displayed to the user if they do not meet the requirement.
##### maxlength (number, optional)
>`maxlength` sets maximum number of characters for the input. If a number is greater than this value it will not be submitted with the form. eg 1000 is 4 characters long and if `maxlength` is set to 2, it would not be sent. Currently there is no error displayed to the user if they do not meet the requirement.
_Example number field_
```json
{
"key": "love",
"type": "number",
"label": "How much love?",
"default": 2,
"min": 0,
"max": 100,
"required": true
}
```
---
#### Password form field
>The password field allows password input, it uses an input with `type='password'`.
##### default (string, optional)
##### trimWhitespace (boolean, optional)
Unlike other formly fields, which use Angular's default setting to trim leading and trailing whitespace, the password field captures whitespace. You can override this by setting `trimWhitespace` to `true`.
_Example password field_
```json
{
"key": "password",
"type": "password",
"label": "Password"
}
```
---
#### Hidden form field
>The hidden field allows hidden input, it uses an input with `type='hidden'`.
##### default (number or string, required)
_Example password field_
```json
{
"key": "hiddenCode",
"type": "hidden"
}
```
---
#### Email form field
>The email field allows email input, it uses an input with `type='email'`. Browsers will provide basic email address validation by default.
##### default (string, optional)
_Example password field_
```json
{
"key": "email",
"type": "email",
"placeholder": "janedoe@gmail.com"
}
```
## Contributing

@@ -61,2 +333,2 @@

A special thanks to [Nimbly](http://gonimbly.com) for creating/sponsoring Angular-Formly's development.
Thanks to [Kent C. Dodds](https://github.com/kentcdodds) for his continued support on the project.
Thanks to [Kent C. Dodds](https://github.com/kentcdodds) for his continued support on the project.
// This file adds the default templates to the formlyConfigProvider.
// It is excluded from the no-templates build.
angular.module('formly.render').config(function(formlyConfigProvider) {
'use strict';
var fields = [
'textarea', 'radio', 'select', 'number', 'checkbox',
'password', 'hidden', 'email', 'text'
];
angular.forEach(fields, function(field) {
formlyConfigProvider.setTemplateUrl(field, 'fields/formly-field-' + field + '.html');
});
angular.module('formlyVanilla').config(function(formlyConfigProvider) {
'use strict';
var fields = [
'textarea', 'radio', 'select', 'number', 'checkbox',
'password', 'hidden', 'email', 'text'
];
angular.forEach(fields, function(field) {
formlyConfigProvider.setTemplateUrl(field, 'fields/formly-field-' + field + '.html');
});
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc