Skip to content

Commit

Permalink
added reconfigure
Browse files Browse the repository at this point in the history
  • Loading branch information
mouse committed Jan 7, 2016
1 parent ae099ec commit c899666
Show file tree
Hide file tree
Showing 14 changed files with 175 additions and 51 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ this.getSelected()
this.getSelectedValues()
this.props
this.rebuild( data )
this.reconfigure( props )
this.refs
this.setIndex( index, multiple )
this.setValue( value, multiple )
Expand All @@ -227,7 +228,7 @@ this.setValue( value, multiple )
`clickValue( value, multiple )` sets the item with the passed value as selected. If multiple is true and it is a multi-select box, it is selected additionally. Otherwise it's selected instead. This accepts arrays as well. Without multiple equaling true it will only select the last option. This fires the onClick event


`deselectAll()` deselects all options
`deselectAll()` deselects all data

`destroy()` removes event listeners, then flounder

Expand All @@ -241,8 +242,10 @@ this.setValue( value, multiple )

`props` the props set in the initial constructor

`rebuild( options )` completely rebuilds the select boxes with new or altered options
`rebuild( data )` completely rebuilds the select boxes with new or altered data

`reconfigure( props )` rebuilds the flounder object with new options

`refs` contains references to all flounder elements

`setIndex( index, multiple )` sets the item with the passed index as selected. If multiple is true and it is a multi-select box, it is selected additionally. Otherwise it's selected instead. This accepts arrays as well. Without multiple equaling true it will only select the last option. This does not fire the onClick event
Expand Down Expand Up @@ -373,6 +376,7 @@ Change Log
+ [api] rebuildSelect is now rebuild
+ [api] added clickIndex and clickValue
+ [api] added props
+ [api] added reconfigure
+ [default] multipleTags is now false by default
+ [search] added Sole (a ROVer derivitive) for fuzzy search

Expand Down
9 changes: 4 additions & 5 deletions demo/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,15 @@ new Flounder( document.getElementById( 'vanilla--input' ), {
let _o = this.data.map( rand );

this.data = _o;
this.rebuildSelect( _o );
this.rebuild( _o );
}
} );


/**
* vanilla Flounder attached pre built select box
*/
new Flounder( document.getElementById( 'vanilla--select' ), {
let a = new Flounder( document.getElementById( 'vanilla--select' ), {
defaultValue : 2,

classes : {
Expand All @@ -134,7 +134,7 @@ new Flounder( document.getElementById( 'vanilla--select' ), {
wrapper : 'additional--class--to--give--the--wrapper'
}
} );

console.log( a );

/**
* react multi-Flounder with tags attached to an div
Expand Down Expand Up @@ -222,7 +222,7 @@ requirejs.config( {
*/
requirejs( [ 'flounder' ], function( Flounder )
{
let a = new Flounder( '#AMD--desc', {
new Flounder( '#AMD--desc', {
placeholder : 'placeholders!',

onInit : function()
Expand All @@ -240,7 +240,6 @@ requirejs( [ 'flounder' ], function( Flounder )
this.data = res;
}
} );
console.log( a );
} );


Expand Down
33 changes: 25 additions & 8 deletions demo/demoDist.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,14 @@ new _srcCoreFlounderJsx2['default'](document.getElementById('vanilla--input'), {
var _o = this.data.map(rand);

this.data = _o;
this.rebuildSelect(_o);
this.rebuild(_o);
}
});

/**
* vanilla Flounder attached pre built select box
*/
new _srcCoreFlounderJsx2['default'](document.getElementById('vanilla--select'), {
var a = new _srcCoreFlounderJsx2['default'](document.getElementById('vanilla--select'), {
defaultValue: 2,

classes: {
Expand All @@ -136,6 +136,7 @@ new _srcCoreFlounderJsx2['default'](document.getElementById('vanilla--select'),
wrapper: 'additional--class--to--give--the--wrapper'
}
});
console.log(a);

/**
* react multi-Flounder with tags attached to an div
Expand Down Expand Up @@ -210,7 +211,7 @@ requirejs.config({
* vanilla Flounder with descriptions attached to a div
*/
requirejs(['flounder'], function (Flounder) {
var a = new Flounder('#AMD--desc', {
new Flounder('#AMD--desc', {
placeholder: 'placeholders!',

onInit: function onInit() {
Expand All @@ -226,7 +227,6 @@ requirejs(['flounder'], function (Flounder) {
this.data = res;
}
});
console.log(a);
});

/**
Expand Down Expand Up @@ -19464,11 +19464,11 @@ var api = {
*
* after editing the data, this can be used to rebuild them
*
* @param {Array} _data array with optino information
* @param {Array} data array with optino information
*
* @return _Void_
* @return _Object_ rebuilt flounder object
*/
rebuild: function rebuild(_data) {
rebuild: function rebuild(data) {
var _this2 = this;

var refs = this.refs;
Expand All @@ -19485,7 +19485,7 @@ var api = {
var _select = refs.select;
refs.select = false;

var _buildData = this.buildData(this._default, _data, refs.optionsList, _select);
var _buildData = this.buildData(this._default, data, refs.optionsList, _select);

var _buildData2 = _slicedToArray(_buildData, 2);

Expand All @@ -19508,6 +19508,23 @@ var api = {
});

this.addOptionsListeners();

return this;
},

/**
* ## reconfigure
*
* after editing the data, this can be used to rebuild them
*
* @param {Object} props object containing config options
*
* @return _Object_ rebuilt flounder object
*/
reconfigure: function reconfigure(props) {
props.data = props.data || this.data;

return this.constructor(this.originalTarget, props);
},

/**
Expand Down
25 changes: 21 additions & 4 deletions dist/flounder.amd.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,11 @@ var api = {
*
* after editing the data, this can be used to rebuild them
*
* @param {Array} _data array with optino information
* @param {Array} data array with optino information
*
* @return _Void_
* @return _Object_ rebuilt flounder object
*/
rebuild: function rebuild(_data) {
rebuild: function rebuild(data) {
var _this2 = this;

var refs = this.refs;
Expand All @@ -214,7 +214,7 @@ var api = {
var _select = refs.select;
refs.select = false;

var _buildData = this.buildData(this._default, _data, refs.optionsList, _select);
var _buildData = this.buildData(this._default, data, refs.optionsList, _select);

var _buildData2 = _slicedToArray(_buildData, 2);

Expand All @@ -237,6 +237,23 @@ var api = {
});

this.addOptionsListeners();

return this;
},

/**
* ## reconfigure
*
* after editing the data, this can be used to rebuild them
*
* @param {Object} props object containing config options
*
* @return _Object_ rebuilt flounder object
*/
reconfigure: function reconfigure(props) {
props.data = props.data || this.data;

return this.constructor(this.originalTarget, props);
},

/**
Expand Down
2 changes: 1 addition & 1 deletion dist/flounder.amd.min.js

Large diffs are not rendered by default.

25 changes: 21 additions & 4 deletions dist/flounder.jquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,11 @@ var api = {
*
* after editing the data, this can be used to rebuild them
*
* @param {Array} _data array with optino information
* @param {Array} data array with optino information
*
* @return _Void_
* @return _Object_ rebuilt flounder object
*/
rebuild: function rebuild(_data) {
rebuild: function rebuild(data) {
var _this2 = this;

var refs = this.refs;
Expand All @@ -214,7 +214,7 @@ var api = {
var _select = refs.select;
refs.select = false;

var _buildData = this.buildData(this._default, _data, refs.optionsList, _select);
var _buildData = this.buildData(this._default, data, refs.optionsList, _select);

var _buildData2 = _slicedToArray(_buildData, 2);

Expand All @@ -237,6 +237,23 @@ var api = {
});

this.addOptionsListeners();

return this;
},

/**
* ## reconfigure
*
* after editing the data, this can be used to rebuild them
*
* @param {Object} props object containing config options
*
* @return _Object_ rebuilt flounder object
*/
reconfigure: function reconfigure(props) {
props.data = props.data || this.data;

return this.constructor(this.originalTarget, props);
},

/**
Expand Down
2 changes: 1 addition & 1 deletion dist/flounder.jquery.min.js

Large diffs are not rendered by default.

25 changes: 21 additions & 4 deletions dist/flounder.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,11 @@ var api = {
*
* after editing the data, this can be used to rebuild them
*
* @param {Array} _data array with optino information
* @param {Array} data array with optino information
*
* @return _Void_
* @return _Object_ rebuilt flounder object
*/
rebuild: function rebuild(_data) {
rebuild: function rebuild(data) {
var _this2 = this;

var refs = this.refs;
Expand All @@ -214,7 +214,7 @@ var api = {
var _select = refs.select;
refs.select = false;

var _buildData = this.buildData(this._default, _data, refs.optionsList, _select);
var _buildData = this.buildData(this._default, data, refs.optionsList, _select);

var _buildData2 = _slicedToArray(_buildData, 2);

Expand All @@ -237,6 +237,23 @@ var api = {
});

this.addOptionsListeners();

return this;
},

/**
* ## reconfigure
*
* after editing the data, this can be used to rebuild them
*
* @param {Object} props object containing config options
*
* @return _Object_ rebuilt flounder object
*/
reconfigure: function reconfigure(props) {
props.data = props.data || this.data;

return this.constructor(this.originalTarget, props);
},

/**
Expand Down
25 changes: 21 additions & 4 deletions dist/flounder.microbe.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,11 @@ var api = {
*
* after editing the data, this can be used to rebuild them
*
* @param {Array} _data array with optino information
* @param {Array} data array with optino information
*
* @return _Void_
* @return _Object_ rebuilt flounder object
*/
rebuild: function rebuild(_data) {
rebuild: function rebuild(data) {
var _this2 = this;

var refs = this.refs;
Expand All @@ -214,7 +214,7 @@ var api = {
var _select = refs.select;
refs.select = false;

var _buildData = this.buildData(this._default, _data, refs.optionsList, _select);
var _buildData = this.buildData(this._default, data, refs.optionsList, _select);

var _buildData2 = _slicedToArray(_buildData, 2);

Expand All @@ -237,6 +237,23 @@ var api = {
});

this.addOptionsListeners();

return this;
},

/**
* ## reconfigure
*
* after editing the data, this can be used to rebuild them
*
* @param {Object} props object containing config options
*
* @return _Object_ rebuilt flounder object
*/
reconfigure: function reconfigure(props) {
props.data = props.data || this.data;

return this.constructor(this.originalTarget, props);
},

/**
Expand Down
2 changes: 1 addition & 1 deletion dist/flounder.microbe.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/flounder.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit c899666

Please sign in to comment.