Skip to content

Commit

Permalink
constructor/targetting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mouse committed Dec 29, 2015
1 parent d701d52 commit 76cae6d
Show file tree
Hide file tree
Showing 17 changed files with 1,497 additions and 1,356 deletions.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Flounder.js 0.2.5
Flounder.js 0.2.6
=================

(for modern browsers and ie9+)
Expand Down Expand Up @@ -312,6 +312,16 @@ Change Log
==========


0.2.6
-----

+ split file structure
+ removed the checks for 0 length flounder creation objects. If there is nothing to render, flounder will just render nothing
+ onOpen and onClose will now not fire until flounder is set up
+ destroy now preserves the container it was buit in
+ better checks for target


0.2.5
-----

Expand Down
132 changes: 68 additions & 64 deletions demo/demoDist.js
Original file line number Diff line number Diff line change
Expand Up @@ -19312,12 +19312,21 @@ var api = {

if (originalTarget.tagName === 'INPUT' || originalTarget.tagName === 'SELECT') {
var target = originalTarget.nextElementSibling;
target.parentNode.removeChild(target);
originalTarget.tabIndex = 0;
this.removeClass(originalTarget, _classes2['default'].HIDDEN);
try {
target.parentNode.removeChild(target);
originalTarget.tabIndex = 0;
this.removeClass(originalTarget, _classes2['default'].HIDDEN);
} catch (e) {
throw ' : this flounder may have already been removed';
}
} else {
var target = this.target;
target.innerHTML = '';
try {
var wrapper = this.refs.wrapper;
var _parent = wrapper.parentNode;
_parent.removeChild(wrapper);
} catch (e) {
throw ' : this flounder may have already been removed';
}
}
},

Expand Down Expand Up @@ -20313,6 +20322,38 @@ var events = {
}
},

/**
* ## toggleClosed
*
* post toggleList, this runs it the list should be closed
*
* @param {Object} e event object
* @param {DOMElement} optionsList the options list
* @param {Object} refs contains the references of the elements in flounder
* @param {DOMElement} wrapper wrapper of flounder
*
* @return _Void_
*/
toggleClosed: function toggleClosed(e, optionsList, refs, wrapper) {
this.hideElement(optionsList);
this.removeSelectKeyListener();
this.removeClass(wrapper, 'open');

var qsHTML = document.querySelector('html');
qsHTML.removeEventListener('click', this.catchBodyClick);
qsHTML.removeEventListener('touchend', this.catchBodyClick);

if (this.props.search) {
this.fuzzySearchReset();
}

refs.flounder.focus();

if (this.ready) {
this.onClose(e, this.getSelectedValues());
}
},

/**
* ## toggleOpen
*
Expand Down Expand Up @@ -20351,37 +20392,9 @@ var events = {
refs.search.focus();
}

this.onOpen(e, this.getSelectedValues());
},

/**
* ## toggleClosed
*
* post toggleList, this runs it the list should be closed
*
* @param {Object} e event object
* @param {DOMElement} optionsList the options list
* @param {Object} refs contains the references of the elements in flounder
* @param {DOMElement} wrapper wrapper of flounder
*
* @return _Void_
*/
toggleClosed: function toggleClosed(e, optionsList, refs, wrapper) {
this.hideElement(optionsList);
this.removeSelectKeyListener();
this.removeClass(wrapper, 'open');

var qsHTML = document.querySelector('html');
qsHTML.removeEventListener('click', this.catchBodyClick);
qsHTML.removeEventListener('touchend', this.catchBodyClick);

if (this.props.search) {
this.fuzzySearchReset();
if (this.ready) {
this.onOpen(e, this.getSelectedValues());
}

refs.flounder.focus();

this.onClose(e, this.getSelectedValues());
}
};

Expand Down Expand Up @@ -20448,7 +20461,6 @@ var Flounder = (function () {
var _this = this;

targets = nativeSlice.call(targets);

return targets.map(function (el, i) {
return new _this.constructor(el, props);
});
Expand All @@ -20464,21 +20476,13 @@ var Flounder = (function () {
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
var props = this.props;
var refs = this.refs;

var events = props.events;
var div = refs.flounder;

for (var _event in events) {
div.removeEventListener(_event, events[_event]);
}

this.removeOptionsListeners();

refs.selected.removeEventListener('click', this.toggleList);

if (props.search) {
if (this.props.search) {
var search = refs.search;
search.removeEventListener('click', this.toggleList);
search.removeEventListener('keyup', this.fuzzySearch);
Expand All @@ -20502,25 +20506,24 @@ var Flounder = (function () {

if (!target && !props) {
return this.constructor;
}
} else if (target) {
if (target.length && typeof target !== 'string' && target.tagName !== 'SELECT') {
return this.arrayOfFlounders(target, props);
} else if (!target.length && target.length !== 0 || target.tagName === 'SELECT') {
this.props = props;
this.setTarget(target);
this.bindThis();
this.initialzeOptions();
this.onInit();
this.buildDom();
this.setPlatform();
this.onRender();
this.onComponentDidMount();
this.ready = true;

if (target.length && typeof target !== 'string' && target.tagName !== 'SELECT') {
return this.arrayOfFlounders(target, props);
} else if (target.length === 0) {
throw ': target length cannot equal 0. Flounder cannot continue';
return this.refs.flounder.flounder = this.originalTarget.flounder = this;
}
}

this.props = props;
this.setTarget(target);
this.bindThis();
this.initialzeOptions();
this.onInit();
this.buildDom();
this.setPlatform();
this.onRender();
this.onComponentDidMount();

return this.refs.flounder.flounder = this.originalTarget.flounder = this;
}

/**
Expand Down Expand Up @@ -21043,8 +21046,9 @@ var Flounder = (function () {
var offset = this.defaultTextIndent;

if (search) {
var _els = document.getElementsByClassName(_classes3['default'].MULTIPLE_SELECT_TAG);
_els.each(function (i, e) {
var els = document.getElementsByClassName(_classes3['default'].MULTIPLE_SELECT_TAG);

nativeSlice.call(els).forEach(function (e, i) {
offset += _this7.getElWidth(e);
});

Expand Down
Loading

0 comments on commit 76cae6d

Please sign in to comment.