"
11 | ],
12 | "main": "dist/angular-formly-templates-ionic.js",
13 | "description": "Angular-Formly plugin for Ionic Framework.",
14 | "keywords": [
15 | "AngularJs",
16 | "form",
17 | "formly",
18 | "json",
19 | "ionic",
20 | "html"
21 | ],
22 | "license": "MIT",
23 | "ignore": [
24 | "**/.*",
25 | "node_modules",
26 | "bower_components",
27 | "test",
28 | "tests",
29 | "examples"
30 | ],
31 | "dependencies": {
32 | "angular": ">=1.2.x",
33 | "angular-formly": ">=3.0.0",
34 | "ionic": ">=1.0.0"
35 | },
36 | "devDependencies": {
37 | "chai": "~1.9.1",
38 | "mocha": "~1.21.4"
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/dist/angular-formly-templates-ionic.js:
--------------------------------------------------------------------------------
1 | angular.module('formlyIonic', ['formly'], ["formlyConfigProvider", function configFormlyIonic(formlyConfigProvider) {
2 | 'use strict';
3 |
4 |
5 | angular.forEach(['checkbox', 'input', 'radio', 'range', 'textarea', 'toggle', 'select', 'floating-input', 'stacked-input', 'inline-input'], function (fieldName) {
6 | formlyConfigProvider.setType({
7 | name: fieldName,
8 | templateUrl: getFieldTemplateUrl(fieldName)
9 | });
10 | });
11 |
12 | formlyConfigProvider.templateManipulators.preWrapper.push(function ariaDescribedBy(template, options, scope) {
13 | if (options.templateOptions && angular.isDefined(options.templateOptions.description) &&
14 | options.type !== 'radio' && options.type !== 'checkbox') {
15 | var el = angular.element('');
16 | el.append(template);
17 | var modelEls = angular.element(el[0].querySelectorAll('[ng-model]'));
18 | if (modelEls) {
19 | el.append(
20 | '' +
23 | '{{options.templateOptions.description}}' +
24 | '
'
25 | );
26 | modelEls.attr('aria-describedby', scope.id + '_description');
27 | return el.html();
28 | } else {
29 | return template;
30 | }
31 | } else {
32 | return template;
33 | }
34 | });
35 |
36 | function getFieldTemplateUrl(name) {
37 | return 'fields/ion-' + name + '.html';
38 | }
39 |
40 | }]);
41 |
42 | angular.module("formlyIonic").run(["$templateCache", function($templateCache) {$templateCache.put("fields/ion-checkbox.html","{{options.templateOptions.label}}");
43 | $templateCache.put("fields/ion-floating-input.html","");
44 | $templateCache.put("fields/ion-inline-input.html","");
45 | $templateCache.put("fields/ion-input.html","");
46 | $templateCache.put("fields/ion-radio.html","{{ item.text }}");
47 | $templateCache.put("fields/ion-range.html","{{options.templateOptions.label}}
");
48 | $templateCache.put("fields/ion-select.html","");
49 | $templateCache.put("fields/ion-stacked-input.html","");
50 | $templateCache.put("fields/ion-textarea.html","");
51 | $templateCache.put("fields/ion-toggle.html","{{options.templateOptions.label}}");}]);
--------------------------------------------------------------------------------
/dist/angular-formly-templates-ionic.min.js:
--------------------------------------------------------------------------------
1 | angular.module("formlyIonic",["formly"],["formlyConfigProvider",function(t){"use strict";function e(t){return"fields/ion-"+t+".html"}angular.forEach(["checkbox","input","radio","range","textarea","toggle","select","floating-input","stacked-input","inline-input"],function(o){t.setType({name:o,templateUrl:e(o)})}),t.templateManipulators.preWrapper.push(function(t,e,o){if(e.templateOptions&&angular.isDefined(e.templateOptions.description)&&"radio"!==e.type&&"checkbox"!==e.type){var i=angular.element("");i.append(t);var n=angular.element(i[0].querySelectorAll("[ng-model]"));return n?(i.append('{{options.templateOptions.description}}
'),n.attr("aria-describedby",o.id+"_description"),i.html()):t}return t})}]),angular.module("formlyIonic").run(["$templateCache",function(t){t.put("fields/ion-checkbox.html",'{{options.templateOptions.label}}'),t.put("fields/ion-floating-input.html",''),t.put("fields/ion-inline-input.html",''),t.put("fields/ion-input.html",''),t.put("fields/ion-radio.html",'{{ item.text }}'),t.put("fields/ion-range.html",'{{options.templateOptions.label}}
'),t.put("fields/ion-select.html",''),t.put("fields/ion-stacked-input.html",''),t.put("fields/ion-textarea.html",''),t.put("fields/ion-toggle.html",'{{options.templateOptions.label}}')}]);
--------------------------------------------------------------------------------
/gulpfile.js:
--------------------------------------------------------------------------------
1 | var gulp = require('gulp');
2 | var concat = require('gulp-concat');
3 | var template = require('gulp-ng-templates');
4 | var rename = require('gulp-rename');
5 | var ngAnnotate = require('gulp-ng-annotate');
6 | var uglify = require('gulp-uglify');
7 | var gulp = require('gulp');
8 | var git = require('gulp-git');
9 | var bump = require('gulp-bump');
10 | var filter = require('gulp-filter');
11 | var tag_version = require('gulp-tag-version');
12 | var minifyHtml = require("gulp-minify-html");
13 |
14 | //Build Vars
15 | var ionicTemplates = 'templates-ionic';
16 | var prebuildDir = '.tmp';
17 | var finalName = 'angular-formly-templates-ionic';
18 |
19 |
20 | gulp.task('default', ['build']);
21 |
22 |
23 | gulp.task('template', function() {
24 | return gulp.src('src/fields/*html')
25 | //.pipe(htmlmin({collapseWhitespace: true}))
26 | .pipe(minifyHtml({
27 | empty: false,
28 | spare: true,
29 | quotes: true
30 | }))
31 | .pipe(template({
32 | filename: ionicTemplates + ".js",
33 | module: 'formlyIonic',
34 | path: function(path, base) {
35 | return path.replace(base, 'fields/');
36 | },
37 | header: 'angular.module("<%= module %>").run(["$templateCache", function($templateCache) {'
38 |
39 | }))
40 | .pipe(gulp.dest('.tmp'));
41 | });
42 |
43 | // Then save the main provider in the same tmp dir
44 | gulp.task('mkSrc', function() {
45 | return gulp.src('./src/modules/*.js')
46 | // .pipe(concat('all.js'))
47 | .pipe(gulp.dest('./.tmp/'));
48 | });
49 |
50 | gulp.task('build', ['template', 'mkSrc'], function() {
51 | return gulp.src('./.tmp/*.js')
52 | .pipe(ngAnnotate())
53 | .pipe(concat(finalName + ".js"))
54 | .pipe(gulp.dest('./dist'))
55 | .pipe(uglify())
56 | .pipe(rename({
57 | extname: '.min.js'
58 | }))
59 | .pipe(gulp.dest('./dist'));
60 | });
61 |
62 | function inc(importance) {
63 | // get all the files to bump version in
64 | return gulp.src(['./package.json', './bower.json'])
65 | // bump the version number in those files
66 | .pipe(bump({
67 | type: importance
68 | }))
69 | // save it back to filesystem
70 | .pipe(gulp.dest('./'))
71 | // commit the changed version number
72 | .pipe(git.commit('bumps package version'))
73 |
74 | // read only one file to get the version number
75 | .pipe(filter('package.json'))
76 | // **tag it in the repository**
77 | .pipe(tag_version());
78 | }
79 |
80 | gulp.task('patch', ['build'], function() {
81 | return inc('patch');
82 | });
83 | gulp.task('minor', ['build'], function() {
84 | return inc('minor');
85 | });
86 | gulp.task('major', ['build'], function() {
87 | return inc('major');
88 | });
89 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "angular-formly-templates-ionic",
3 | "version": "1.2.2",
4 | "author": "Astrism ",
5 | "contributors": [
6 | "Astrism ",
7 | "Kent C. Dodds ",
8 | "Mike Hartington "
9 | ],
10 | "homepage": "http://formly-js.github.io/angular-formly-templates-ionic/",
11 | "repository": {
12 | "type": "git",
13 | "url": "git://github.com/formly-js/angular-formly-templates-ionic.git"
14 | },
15 | "main": "dist/angular-formly-templates-ionic.min.js",
16 | "licenses": [
17 | {
18 | "type": "MIT",
19 | "url": "https://raw.githubusercontent.com/formly-js/angular-formly-templates-ionic/master/LICENSE"
20 | }
21 | ],
22 | "scripts": {
23 | "build": "./node_modules/.bin/grunt build"
24 | },
25 | "description": "Angular-Formly plugin which outputs plain html form fields.",
26 | "peerDependencies": {
27 | "angular": "^1.x",
28 | "angular-formly": ">=3.0.0",
29 | "api-check": ">=7.5.0",
30 | "ionic-sdk": "^1.0.0"
31 | },
32 | "dependencies": {
33 | "angular": "^1.x",
34 | "angular-formly": ">=3.0.0",
35 | "api-check": ">=7.5.0",
36 | "ionic-sdk": "^1.0.0"
37 | },
38 | "devDependencies": {
39 | "bower": "^1.3.3",
40 | "gulp": "^3.5.6",
41 | "gulp-bump": "^0.3.0",
42 | "gulp-concat": "^2.2.0",
43 | "gulp-filter": "^2.0.2",
44 | "gulp-git": "^1.1.0",
45 | "gulp-minify-html": "^1.0.2",
46 | "gulp-ng-annotate": "^0.5.2",
47 | "gulp-ng-templates": "0.0.5",
48 | "gulp-rename": "^1.2.0",
49 | "gulp-tag-version": "^1.2.1",
50 | "gulp-uglify": "^1.1.0"
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/fields/ion-checkbox.html:
--------------------------------------------------------------------------------
1 |
2 | {{options.templateOptions.label}}
3 |
4 |
--------------------------------------------------------------------------------
/src/fields/ion-floating-input.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/fields/ion-inline-input.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/fields/ion-input.html:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/src/fields/ion-radio.html:
--------------------------------------------------------------------------------
1 |
2 | {{ item.text }}
3 |
4 |
--------------------------------------------------------------------------------
/src/fields/ion-range.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{options.templateOptions.label}}
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/src/fields/ion-select.html:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/src/fields/ion-stacked-input.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/fields/ion-textarea.html:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/src/fields/ion-toggle.html:
--------------------------------------------------------------------------------
1 |
2 | {{options.templateOptions.label}}
3 |
4 |
--------------------------------------------------------------------------------
/src/modules/angular-formly-templates-ionic.js:
--------------------------------------------------------------------------------
1 | angular.module('formlyIonic', ['formly'], function configFormlyIonic(formlyConfigProvider) {
2 | 'use strict';
3 |
4 |
5 | angular.forEach(['checkbox', 'input', 'radio', 'range', 'textarea', 'toggle', 'select', 'floating-input', 'stacked-input', 'inline-input'], function (fieldName) {
6 | formlyConfigProvider.setType({
7 | name: fieldName,
8 | templateUrl: getFieldTemplateUrl(fieldName)
9 | });
10 | });
11 |
12 | formlyConfigProvider.templateManipulators.preWrapper.push(function ariaDescribedBy(template, options, scope) {
13 | if (options.templateOptions && angular.isDefined(options.templateOptions.description) &&
14 | options.type !== 'radio' && options.type !== 'checkbox') {
15 | var el = angular.element('');
16 | el.append(template);
17 | var modelEls = angular.element(el[0].querySelectorAll('[ng-model]'));
18 | if (modelEls) {
19 | el.append(
20 | '' +
23 | '{{options.templateOptions.description}}' +
24 | '
'
25 | );
26 | modelEls.attr('aria-describedby', scope.id + '_description');
27 | return el.html();
28 | } else {
29 | return template;
30 | }
31 | } else {
32 | return template;
33 | }
34 | });
35 |
36 | function getFieldTemplateUrl(name) {
37 | return 'fields/ion-' + name + '.html';
38 | }
39 |
40 | });
41 |
--------------------------------------------------------------------------------