diff --git a/Gruntfile.js b/Gruntfile.js
index 35a38b0d..b5c66473 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -56,55 +56,6 @@ module.exports = function (grunt) {
]
});
- var moduleGenerator = require('./grunt/module-generator.js');
- var configBridge = grunt.file.readJSON('./grunt/configBridge.json', {encoding: 'utf8'});
-
- // dynamically create js file list (we do this for several different directories)
- function coreFileArray(path) {
- var result = []
- configBridge.core.files.forEach(
- function (element, index, array) {
- result[index] = (path + element)
- }
- );
- return result;
- }
-
- function fileMap(result, fileArray, destPath, sourcPath) {
- fileArray.forEach(
- function (element, index, array) {
- result[destPath + element] = (sourcPath + element)
- }
- );
- }
-
- function coreFileMap(destPath, sourcePath) {
- var result = {}
- fileMap(result, configBridge.core.files, destPath, sourcePath)
- return result;
- }
-
- function docsFileMap() {
- var result = {}
-
- var sourcePath = 'docs/assets/js/src/'
- var destPath = 'docs/assets/js/dist/'
- fileMap(result, configBridge.docs.files, destPath, sourcePath)
-
- // generate core so we have local debugging
- var sourcePath = 'js/src/'
- var destPath = 'docs/dist/js/demoduled/'
- fileMap(result, configBridge.core.files, destPath, sourcePath)
-
- return result;
- }
-
- //Object.keys(configBridge.paths).forEach(function (key) {
- // configBridge.paths[key].forEach(function (val, i, arr) {
- // arr[i] = path.join('./docs/assets', val);
- // });
- //});
-
// Project configuration.
grunt.initConfig({
@@ -124,31 +75,6 @@ module.exports = function (grunt) {
docs: 'docs/dist'
},
- //babel: {
- // options: {
- // sourceMap: true,
- // presets: ['es2015'] // the following is the es2015 preset minus the commonjs requirement
- // },
- // core: {
- // files: coreFileMap('dist/js/demoduled/', 'js/src/')
- // },
- // docs: {
- // files: docsFileMap()
- // },
- // systemjs: {
- // options: {
- // plugins: ['transform-es2015-modules-systemjs']
- // },
- // files: coreFileMap('dist/js/systemjs/', 'js/src/')
- // },
- // umd: {
- // options: {
- // plugins: ['transform-es2015-modules-umd']
- // },
- // files: coreFileMap('dist/js/umd/', 'js/src/')
- // }
- //},
-
eslint: {
options: {
configFile: 'js/.eslintrc'
@@ -193,15 +119,7 @@ module.exports = function (grunt) {
// stripBanners: false,
// sourceMap: true
// },
- // systemjs: {
- // src: coreFileArray('dist/js/systemjs/'),
- // dest: 'dist/js/system-all.js'
- // },
- // commonjs: {
- // src: coreFileArray('dist/js/umd/'),
- // dest: 'dist/js/common-all.js'
- // }
- //},
+
uglify: {
options: {
compress: {
@@ -223,7 +141,6 @@ module.exports = function (grunt) {
options: {
compress: false
},
- //src: configBridge.paths.docsJs,
src: 'docs/assets/js/vendor/*.js',
//dest: 'docs/assets/js/docs.min.js'
dest: 'docs/dist/js/docs-vendor.min.js'
@@ -632,14 +549,6 @@ module.exports = function (grunt) {
// Default task.
grunt.registerTask('default', ['clean:dist', 'test']);
- grunt.registerTask('commonjs', 'Generate npm-js/commonjs entrypoint module.', function () {
- moduleGenerator.commonJs(grunt, coreFileArray('./umd/'), 'dist/js/common.js');
- });
-
- grunt.registerTask('systemjs', 'Generate systemjs entrypoint module.', function () {
- moduleGenerator.systemJs(grunt, coreFileArray('./systemjs/'), 'dist/js/system.js');
- });
-
//------
// Docs tasks
@@ -682,6 +591,6 @@ module.exports = function (grunt) {
});
//grunt.registerTask('debug', function () {
- // console.log(coreFileArray('dist/js/demoduled/'));
+ // console.log('');
//});
};
diff --git a/docs/_plugins/bridge.rb b/docs/_plugins/bridge.rb
deleted file mode 100644
index 69a13fbb..00000000
--- a/docs/_plugins/bridge.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-require 'yaml'
-
-module Bridge
- class Generator < Jekyll::Generator
- def generate(site)
- path = File.join(site.source, "../grunt/configBridge.json")
- site.data["configBridge"] = YAML.load_file(path)
- end
- end
-end
diff --git a/docs/assets/js/src/index.js b/docs/assets/js/src/index.js
index acb5e708..28f80cd4 100644
--- a/docs/assets/js/src/index.js
+++ b/docs/assets/js/src/index.js
@@ -2,7 +2,9 @@
import Style from './style'
import Clipboard from 'clipboard'
import anchors from 'anchor'
-//import mdb from '../../../../js/src/index' // eslint-disable-line no-unused-vars
+
+// import all the mdb code
+import mdb from '../../../../js/src/index' // eslint-disable-line no-unused-vars
class Application {
diff --git a/grunt/configBridge.json b/grunt/configBridge.json
deleted file mode 100644
index d903dcf3..00000000
--- a/grunt/configBridge.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "core": {
- "files": [
- "baseInput.js",
- "baseSelection.js",
- "util.js",
- "ripples.js",
- "autofill.js",
- "text.js",
- "textarea.js",
- "select.js",
- "checkbox.js",
- "checkboxInline.js",
- "switch.js",
- "radio.js",
- "radioInline.js",
- "file.js",
- "bootstrapMaterialDesign.js",
- "index.js"
- ]
- }
-}
diff --git a/grunt/module-generator.js b/grunt/module-generator.js
deleted file mode 100644
index 97a28679..00000000
--- a/grunt/module-generator.js
+++ /dev/null
@@ -1,45 +0,0 @@
-module.exports = (function () {
- 'use strict';
-
- var fs = require('fs');
- var path = require('path');
-
- var COMMONJS_BANNER = '// This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment.\n';
-
- var commonJs = function (grunt, srcFiles, destFilepath) {
- function moduleRequireStatement(srcFilepath) {
- return 'require(\'' + srcFilepath.replace(/\\/g, '/') + '\')';
- }
-
- var moduleOutputJs = COMMONJS_BANNER + srcFiles.map(moduleRequireStatement).join('\n');
- try {
- fs.writeFileSync(destFilepath, moduleOutputJs);
- } catch (err) {
- grunt.fail.warn(err);
- }
- grunt.log.writeln('File ' + destFilepath.cyan + ' created.');
- }
-
-
- var SYSTEMJS_BANNER = '// This file is autogenerated via the `systemjs` Grunt task. You can import this file in a SystemJS environment.\n';
-
- var systemJs = function (grunt, srcFiles, destFilepath) {
- function moduleRequireStatement(srcFilepath) {
- return 'System.import(\'' + srcFilepath.replace(/\\/g, '/') + '\')';
- }
-
- var moduleOutputJs = SYSTEMJS_BANNER + srcFiles.map(moduleRequireStatement).join('\n');
- try {
- fs.writeFileSync(destFilepath, moduleOutputJs);
- } catch (err) {
- grunt.fail.warn(err);
- }
- grunt.log.writeln('File ' + destFilepath.cyan + ' created.');
- }
-
- return {
- commonJs: commonJs,
- systemJs: systemJs
- }
-}())
-
diff --git a/js/src/baseFormControl.js b/js/src/baseFormControl.js
new file mode 100644
index 00000000..2b5dfbcf
--- /dev/null
+++ b/js/src/baseFormControl.js
@@ -0,0 +1,42 @@
+import BaseInput from './baseInput'
+
+const BaseFormControl = (($) => {
+
+ /**
+ * ------------------------------------------------------------------------
+ * Constants
+ * ------------------------------------------------------------------------
+ */
+ const Default = {
+ decorator: {
+ template: ``
+ },
+ requiredClasses: ['form-control']
+ }
+
+ /**
+ * ------------------------------------------------------------------------
+ * Class Definition
+ * ------------------------------------------------------------------------
+ */
+ class BaseFormControl extends BaseInput {
+
+ constructor($element, config) {
+ super($element, $.extend(true, Default, config))
+
+ // Initially mark as empty
+ if (this.isEmpty()) {
+ this.removeIsFilled()
+ }
+
+ // Add marker div the end of the form-group
+ this.$element.after(this.config.decorator.template)
+ }
+ }
+
+
+ return BaseFormControl
+
+})(jQuery)
+
+export default BaseFormControl
diff --git a/js/src/index.js b/js/src/index.js
index 0279b84a..6cbbba82 100644
--- a/js/src/index.js
+++ b/js/src/index.js
@@ -9,6 +9,7 @@
/* eslint-disable no-unused-vars */
import BaseInput from './baseInput'
+import BaseFormControl from './baseFormControl'
import BaseSelection from './baseSelection'
import Util from './util'
import Ripples from './ripples'
diff --git a/js/src/select.js b/js/src/select.js
index e8bdd7d1..6bc60b66 100644
--- a/js/src/select.js
+++ b/js/src/select.js
@@ -1,3 +1,4 @@
+import BaseFormControl from './baseFormControl'
import Checkbox from './checkbox'
import File from './file'
import Radio from './radio'
@@ -27,7 +28,7 @@ const Select = (($) => {
* Class Definition
* ------------------------------------------------------------------------
*/
- class Select extends Text {
+ class Select extends BaseFormControl {
constructor($element, config) {
super($element, $.extend(true, {invalidComponentMatches: [Checkbox, File, Radio, Switch, Text, Textarea]}, Default, config))
diff --git a/js/src/text.js b/js/src/text.js
index 8754b930..38f55c74 100644
--- a/js/src/text.js
+++ b/js/src/text.js
@@ -1,4 +1,4 @@
-import BaseInput from './baseInput'
+import BaseFormControl from './baseFormControl'
import Checkbox from './checkbox'
import File from './file'
import Radio from './radio'
@@ -19,30 +19,17 @@ const Text = (($) => {
const JQUERY_NAME = `mdb${NAME.charAt(0).toUpperCase() + NAME.slice(1)}`
const JQUERY_NO_CONFLICT = $.fn[JQUERY_NAME]
- const Default = {
- decorator: {
- template: ``
- },
- requiredClasses: ['form-control']
- }
+ const Default = {}
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
- class Text extends BaseInput {
+ class Text extends BaseFormControl {
constructor($element, config) {
- super($element, $.extend(true, {invalidComponentMatches: [Checkbox, File, Radio, Select, Switch, Textarea]}, Default, config))
-
- // Initially mark as empty
- if (this.isEmpty()) {
- this.removeIsFilled()
- }
-
- // Add marker div the end of the form-group
- this.$element.after(this.config.decorator.template)
+ super($element, $.extend(true, {invalidComponentMatches: [Checkbox, File, Radio, Switch, Select, Textarea]}, Default, config))
}
dispose(dataKey = DATA_KEY) {
diff --git a/js/src/textarea.js b/js/src/textarea.js
index 7e377747..9093df6b 100644
--- a/js/src/textarea.js
+++ b/js/src/textarea.js
@@ -1,3 +1,4 @@
+import BaseFormControl from './baseFormControl'
import Checkbox from './checkbox'
import File from './file'
import Radio from './radio'
@@ -25,7 +26,7 @@ const Textarea = (($) => {
* Class Definition
* ------------------------------------------------------------------------
*/
- class Textarea extends Text {
+ class Textarea extends BaseFormControl {
constructor($element, config) {
super($element, $.extend(true, {invalidComponentMatches: [Checkbox, File, Radio, Text, Select, Switch]}, Default, config))