diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2017-03-25 13:13:57 +0100 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2017-03-25 13:13:57 +0100 |
| commit | d25ff2bddd44b9dac1ceb248424109d1782dd211 (patch) | |
| tree | 34fcfd824a1a72e7b4d431b688adcea532b62180 /minionlivesmatter/templates/assets/bootstrap-material-design/js/baseSelection.js | |
| parent | a2cbdd1b88ac723e5e441c0a3c22636f0a8c4dfd (diff) | |
| download | meta-d25ff2bddd44b9dac1ceb248424109d1782dd211.tar.gz meta-d25ff2bddd44b9dac1ceb248424109d1782dd211.zip | |
add minionlivesmatter as submodule
Diffstat (limited to 'minionlivesmatter/templates/assets/bootstrap-material-design/js/baseSelection.js')
| -rw-r--r-- | minionlivesmatter/templates/assets/bootstrap-material-design/js/baseSelection.js | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/minionlivesmatter/templates/assets/bootstrap-material-design/js/baseSelection.js b/minionlivesmatter/templates/assets/bootstrap-material-design/js/baseSelection.js deleted file mode 100644 index 765d1c3..0000000 --- a/minionlivesmatter/templates/assets/bootstrap-material-design/js/baseSelection.js +++ /dev/null @@ -1,93 +0,0 @@ -import BaseInput from './baseInput' -import Util from './util' - -const BaseSelection = (($) => { - - /** - * ------------------------------------------------------------------------ - * Constants - * ------------------------------------------------------------------------ - */ - const Default = { - label: { - required: false - - // Prioritized find order for resolving the label to be used as an bmd-label if not specified in the markup - // - a function(thisComponent); or - // - a string selector used like $bmdFormGroup.find(selector) - // - // Note this only runs if $bmdFormGroup.find(Selector.BMD_LABEL_WILDCARD) fails to find a label (as authored in the markup) - // - //selectors: [ - // `.form-control-label`, // in the case of horizontal or inline forms, this will be marked - // `> label` // usual case for text inputs - //] - } - } - - const Selector = { - LABEL: 'label' - } - - /** - * ------------------------------------------------------------------------ - * Class Definition - * ------------------------------------------------------------------------ - */ - class BaseSelection extends BaseInput { - - 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}]' - - super($element, $.extend(true, {}, Default, config), properties) - this.decorateMarkup() - } - - // ------------------------------------------------------------------------ - // protected - - decorateMarkup() { - this.$element.after(this.config.template) - } - - // Demarcation element (e.g. first child of a form-group) - outerElement() { - // .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, !this.$element.parent().prop('tagName') === 'label', `${this.constructor.name}'s ${Util.describe(this.$element)} parent element should be <label>.`) - Util.assert(this.$element, !this.outerElement().hasClass(this.outerClass), `${this.constructor.name}'s ${Util.describe(this.$element)} outer element should have class ${this.outerClass}.`) - } - - addFocusListener() { - // checkboxes didn't appear to bubble to the document, so we'll bind these directly - this.$element.closest(Selector.LABEL).hover(() => { - this.addFormGroupFocus() - }, () => { - this.removeFormGroupFocus() - }) - } - - addChangeListener() { - this.$element.change(() => { - this.$element.blur() - }) - } - - // ------------------------------------------------------------------------ - // private - } - - return BaseSelection - -})(jQuery) - -export default BaseSelection |
