diff --git a/Gruntfile.js b/Gruntfile.js
index e709d284..9660bff0 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -109,8 +109,10 @@ module.exports = function (grunt) {
'dist/js/babel/textarea.js': 'js/src/textarea.js',
'dist/js/babel/select.js': 'js/src/select.js',
'dist/js/babel/checkbox.js': 'js/src/checkbox.js',
+ 'dist/js/babel/checkboxInline.js': 'js/src/checkboxInline.js',
'dist/js/babel/switch.js': 'js/src/switch.js',
'dist/js/babel/radio.js': 'js/src/radio.js',
+ 'dist/js/babel/radioInline.js': 'js/src/radioInline.js',
'dist/js/babel/fileInput.js': 'js/src/file.js',
'dist/js/babel/bootstrapMaterialDesign.js': 'js/src/bootstrapMaterialDesign.js',
}
@@ -134,8 +136,10 @@ module.exports = function (grunt) {
'docs/dist/js/babel/textarea.js': 'js/src/textarea.js',
'docs/dist/js/babel/select.js': 'js/src/select.js',
'docs/dist/js/babel/checkbox.js': 'js/src/checkbox.js',
+ 'docs/dist/js/babel/checkboxInline.js': 'js/src/checkboxInline.js',
'docs/dist/js/babel/switch.js': 'js/src/switch.js',
'docs/dist/js/babel/radio.js': 'js/src/radio.js',
+ 'docs/dist/js/babel/radioInline.js': 'js/src/radioInline.js',
'docs/dist/js/babel/fileInput.js': 'js/src/file.js',
'docs/dist/js/babel/bootstrapMaterialDesign.js': 'js/src/bootstrapMaterialDesign.js',
}
@@ -162,8 +166,10 @@ module.exports = function (grunt) {
'dist/js/umd/textarea.js': 'js/src/textarea.js',
'dist/js/umd/select.js': 'js/src/select.js',
'dist/js/umd/checkbox.js': 'js/src/checkbox.js',
+ 'dist/js/umd/checkboxInline.js': 'js/src/checkboxInline.js',
'dist/js/umd/switch.js': 'js/src/switch.js',
'dist/js/umd/radio.js': 'js/src/radio.js',
+ 'dist/js/umd/radioInline.js': 'js/src/radioInline.js',
'dist/js/umd/fileInput.js': 'js/src/file.js',
'dist/js/umd/bootstrapMaterialDesign.js': 'js/src/bootstrapMaterialDesign.js',
}
@@ -226,8 +232,10 @@ module.exports = function (grunt) {
'dist/js/babel/textarea.js',
'dist/js/babel/select.js',
'dist/js/babel/checkbox.js',
+ 'dist/js/babel/checkboxInline.js',
'dist/js/babel/switch.js',
'dist/js/babel/radio.js',
+ 'dist/js/babel/radioInline.js',
'dist/js/babel/file.js',
'dist/js/babel/bootstrapMaterialDesign.js',
],
diff --git a/docs/assets/js/src/application.js b/docs/assets/js/src/application.js
index 0bbe10dc..2b88f802 100644
--- a/docs/assets/js/src/application.js
+++ b/docs/assets/js/src/application.js
@@ -107,23 +107,15 @@ class Application {
.tooltip('_fixTitle')
})
}
-
- fixMissingFormGroups() {
- //let selectors = [
- // '#search-input',
- // `input.form-control[placeholder='Readonly input hereā¦']`
- //]
- //for( let selector of selectors){
- // $(selector).parent().wrapInner(`
`)
- //}
- }
}
$(() => {
let app = new Application()
app.displayTypographyProperties()
app.initializeClipboard()
- app.fixMissingFormGroups()
- // $.bootstrapMaterialDesign()
+
+ // FIXME: file inputs seems to be in flux, delete the offending one for now.
+ $('#exampleInputFile').closest('.form-group').detach()
+
$('body').bootstrapMaterialDesign()
})
diff --git a/grunt/configBridge.json b/grunt/configBridge.json
index 91fe6c2a..4572db99 100644
--- a/grunt/configBridge.json
+++ b/grunt/configBridge.json
@@ -14,11 +14,13 @@
"../dist/js/babel/autofill.js",
"../dist/js/babel/bootstrapMaterialDesign.js",
"../dist/js/babel/checkbox.js",
+ "../dist/js/babel/checkboxInline.js",
"../dist/js/babel/fileInput.js",
"../dist/js/babel/text.js",
"../dist/js/babel/textarea.js",
"../dist/js/babel/select.js",
"../dist/js/babel/radio.js",
+ "../dist/js/babel/radioInline.js",
"../dist/js/babel/ripples.js",
"../dist/js/babel/switch.js",
"../dist/js/babel/util.js"
diff --git a/js/src/baseInput.js b/js/src/baseInput.js
index 93a3beb0..87c64d1a 100644
--- a/js/src/baseInput.js
+++ b/js/src/baseInput.js
@@ -4,12 +4,12 @@ const BaseInput = (($) => {
const Default = {
formGroup: {
- required: true
+ required: false
},
mdbFormGroup: {
- template: ``,
- required: true,
- autoCreate: true
+ template: ``,
+ required: true, // strongly recommended not to override
+ autoCreate: true // strongly recommended not to override
},
requiredClasses: [],
invalidComponentMatches: [],
@@ -41,10 +41,21 @@ const BaseInput = (($) => {
*/
class BaseInput {
- constructor(element, config) {
+ /**
+ *
+ * @param element
+ * @param config
+ * @param properties - anything that needs to be set as this[key] = value. Works around the need to call `super` before using `this`
+ */
+ constructor(element, config, properties = {}) {
this.$element = $(element)
this.config = $.extend({}, Default, config)
+ // set properties for use in the constructor initialization
+ for (let key in properties) {
+ this[key] = properties[key]
+ }
+
// Enforce no overlap between components to prevent side effects
this._rejectInvalidComponentMatches()
diff --git a/js/src/baseToggle.js b/js/src/baseToggle.js
index 597b73b6..fc8b5bed 100644
--- a/js/src/baseToggle.js
+++ b/js/src/baseToggle.js
@@ -8,11 +8,7 @@ const BaseToggle = (($) => {
* Constants
* ------------------------------------------------------------------------
*/
- const Default = {
- formGroup: {
- required: false
- }
- }
+ const Default = {}
const Selector = {
LABEL: 'label'
@@ -25,13 +21,13 @@ const BaseToggle = (($) => {
*/
class BaseToggle extends BaseInput {
- constructor(element, config, inputType, outerClass) {
- super(element, $.extend({}, Default, config))
- this.$element.after(this.config.template)
+ constructor(element, config, properties) {
+ // properties = {inputType: checkbox, outerClass: checkbox-inline}
// '.checkbox|switch|radio > label > input[type=checkbox|radio]'
// '.${this.outerClass} > label > input[type=${this.inputType}]'
- this.inputType = inputType
- this.outerClass = outerClass
+
+ super(element, $.extend({}, Default, config), properties)
+ this.$element.after(this.config.template)
}
// ------------------------------------------------------------------------
@@ -39,16 +35,17 @@ const BaseToggle = (($) => {
// Demarcation element (e.g. first child of a form-group)
outerElement() {
- // '.checkbox|switch|radio > label > input[type=checkbox|radio]'
- // '.${this.outerClass} > label > input[type=${this.inputType}]'
- return this.$element.parent().parent()
+ // .checkbox|switch|radio > label > input[type=checkbox|radio]
+ // label.checkbox-inline > input[type=checkbox|radio]
+ // .${this.outerClass} > label > input[type=${this.inputType}]
+ return this.$element.parent().closest(`.${this.outerClass}`)
}
rejectWithoutRequiredStructure() {
// '.checkbox|switch|radio > label > input[type=checkbox|radio]'
// '.${this.outerClass} > label > input[type=${this.inputType}]'
- Util.assert(this.$element.parent().prop('tagName') === 'label', `${this.constructor.name}'s ${this.$element} parent element should be