Initial v3.3.6
This commit is contained in:
175
docs/mixitup.Config.md
Normal file
175
docs/mixitup.Config.md
Normal file
@@ -0,0 +1,175 @@
|
||||
# mixitup.Config
|
||||
|
||||
## Overview
|
||||
|
||||
The MixItUp configuration object is extended with properties relating to
|
||||
the MultiFilter extension.
|
||||
|
||||
For the full list of configuration options, please refer to the MixItUp
|
||||
core documentation.
|
||||
|
||||
### Contents
|
||||
|
||||
- [callbacks](#callbacks)
|
||||
- [multifilter](#multifilter)
|
||||
|
||||
|
||||
<h2 id="callbacks">callbacks</h2>
|
||||
|
||||
A group of optional callback functions to be invoked at various
|
||||
points within the lifecycle of a mixer operation.
|
||||
|
||||
### onParseFilterGroups
|
||||
|
||||
|
||||
|
||||
|
||||
A callback function invoked whenever MultiFilter filter groups
|
||||
are parsed. This occurs whenever the user interacts with filter
|
||||
group UI, or when the `parseFilterGroups()` API method is called,
|
||||
but before the resulting filter operation has been triggered.
|
||||
|
||||
By default, this generates the appropriate compound selector and
|
||||
filters the mixer using a `multimix()` API call internally. This
|
||||
callback can be used to transform the multimix command object sent
|
||||
to this API call.
|
||||
|
||||
This is particularly useful when additional behavior such as sorting
|
||||
or pagination must be taken into account when using the MultiFilter API.
|
||||
|
||||
The callback receives the generated multimix command object, and must
|
||||
also return a valid multimix command object.
|
||||
|
||||
|
||||
|Type | Default
|
||||
|--- | ---
|
||||
|`function`| `null`
|
||||
|
||||
###### Example: Overriding the default filtering behavior with `onParseFilterGroups`
|
||||
|
||||
```js
|
||||
var mixer = mixitup(containerEl, {
|
||||
callbacks: {
|
||||
onParseFilterGroups: function(command) {
|
||||
command.paginate = 3;
|
||||
command.sort = 'default:desc';
|
||||
|
||||
return command;
|
||||
}
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
<h2 id="multifilter">multifilter</h2>
|
||||
|
||||
A group of properties defining the behavior of your multifilter UI.
|
||||
|
||||
### enable
|
||||
|
||||
|
||||
|
||||
|
||||
A boolean dictating whether or not to enable multifilter functionality.
|
||||
|
||||
If `true`, MixItUp will query the DOM for any elements with a
|
||||
`data-filter-group` attribute present on instantiation.
|
||||
|
||||
|
||||
|Type | Default
|
||||
|--- | ---
|
||||
|`boolean`| `false`
|
||||
|
||||
### logicWithinGroup
|
||||
|
||||
|
||||
|
||||
|
||||
A string dictating the logic to use when concatenating selectors within
|
||||
individual filter groups.
|
||||
|
||||
If set to `'or'` (default), targets will be shown if they match any
|
||||
active filter in the group.
|
||||
|
||||
If set to `'and'`, targets will be shown only if they match
|
||||
all active filters in the group.
|
||||
|
||||
|
||||
|Type | Default
|
||||
|--- | ---
|
||||
|`string`| `'or'`
|
||||
|
||||
### logicBetweenGroups
|
||||
|
||||
|
||||
|
||||
|
||||
A string dictating the logic to use when concatenating each group's
|
||||
selectors into one single selector.
|
||||
|
||||
If set to `'and'` (default), targets will be shown only if they match
|
||||
the combined active selectors of all groups.
|
||||
|
||||
If set to `'or'`, targets will be shown if they match the active selectors
|
||||
of any individual group.
|
||||
|
||||
|
||||
|Type | Default
|
||||
|--- | ---
|
||||
|`string`| `'and'`
|
||||
|
||||
### minSearchLength
|
||||
|
||||
|
||||
|
||||
|
||||
An integer dictating the minimum number of characters at which the value
|
||||
of a text input will be included as a multifilter. This prevents short or
|
||||
incomplete words with many potential matches from triggering
|
||||
filter operations.
|
||||
|
||||
|
||||
|Type | Default
|
||||
|--- | ---
|
||||
|`number`| `3`
|
||||
|
||||
### parseOn
|
||||
|
||||
|
||||
|
||||
|
||||
A string dictating when the parsing of filter groups should occur.
|
||||
|
||||
If set to `'change'` (default), the mixer will be filtered whenever the
|
||||
filtering UI is interacted with. The mode provides real-time filtering with
|
||||
instant feedback.
|
||||
|
||||
If set to `'submit'`, the mixer will only be filtered when a submit button is
|
||||
clicked (if using a `<form>` element as a parent). This enables the user to firstly
|
||||
make their selection, and then trigger filtering once they have
|
||||
finished making their selection.
|
||||
|
||||
Alternatively, the `mixer.parseFilterGroups()` method can be called via the API at any
|
||||
time to trigger the parsing of filter groups and filter the mixer.
|
||||
|
||||
|
||||
|Type | Default
|
||||
|--- | ---
|
||||
|`string`| `'change'`
|
||||
|
||||
### keyupThrottleDuration
|
||||
|
||||
|
||||
|
||||
|
||||
An integer dictating the duration in ms that must elapse between keyup
|
||||
events in order to trigger a change.
|
||||
|
||||
Setting a comfortable delay of ~350ms prevents the mixer from being
|
||||
thrashed while typing occurs.
|
||||
|
||||
|
||||
|Type | Default
|
||||
|--- | ---
|
||||
|`number`| `350`
|
||||
|
||||
|
||||
112
docs/mixitup.Mixer.md
Normal file
112
docs/mixitup.Mixer.md
Normal file
@@ -0,0 +1,112 @@
|
||||
# mixitup.Mixer
|
||||
|
||||
## Overview
|
||||
|
||||
The `mixitup.Mixer` class is extended with API methods relating to
|
||||
the MultiFilter extension.
|
||||
|
||||
For the full list of API methods, please refer to the MixItUp
|
||||
core documentation.
|
||||
|
||||
### Contents
|
||||
|
||||
- [parseFilterGroups()](#parseFilterGroups)
|
||||
- [setFilterGroupSelectors()](#setFilterGroupSelectors)
|
||||
- [getFilterGroupSelectors()](#getFilterGroupSelectors)
|
||||
|
||||
|
||||
<h3 id="parseFilterGroups">parseFilterGroups()</h3>
|
||||
|
||||
*Version added: 3.0.0*
|
||||
|
||||
`.parseFilterGroups([animate] [, callback])`
|
||||
|
||||
Traverses the currently active filters in all groups, building up a
|
||||
compound selector string as per the defined logic. A filter operation
|
||||
is then called on the mixer using the resulting selector.
|
||||
|
||||
This method can be used to programmatically trigger the parsing of
|
||||
filter groups after manipulations to a group's active selector(s) by
|
||||
the `.setFilterGroupSelectors()` API method.
|
||||
|
||||
| |Type | Name | Description
|
||||
|---|--- | --- | ---
|
||||
|Param |`boolean` | `[animate]` | An optional boolean dictating whether the operation should animate, or occur syncronously with no animation. `true` by default.
|
||||
|Param |`function` | `[callback]` | An optional callback function to be invoked after the operation has completed.
|
||||
|Returns |`Promise.<mixitup.State>` | A promise resolving with the current state object.
|
||||
|
||||
|
||||
###### Example: Triggering parsing after programmatically changing the values of a filter group
|
||||
|
||||
```js
|
||||
|
||||
mixer.setFilterGroupSelectors('color', ['.green', '.blue']);
|
||||
|
||||
mixer.parseFilterGroups();
|
||||
```
|
||||
|
||||
<h3 id="setFilterGroupSelectors">setFilterGroupSelectors()</h3>
|
||||
|
||||
*Version added: 3.2.0*
|
||||
|
||||
`.setFilterGroupSelectors(groupName, selectors)`
|
||||
|
||||
Programmatically sets one or more active selectors for a specific filter
|
||||
group and updates the group's UI.
|
||||
|
||||
Because MixItUp has no way of knowing how to break down a provided
|
||||
compound selector into its component groups, we can not use the
|
||||
standard `.filter()` or `toggleOn()/toggleOff()` API methods when using
|
||||
the MultiFilter extension. Instead, this method allows us to perform
|
||||
multi-dimensional filtering via the API by setting the active selectors of
|
||||
individual groups and then triggering the `.parseFilterGroups()` method.
|
||||
|
||||
If setting multiple active selectors, do not pass a compound selector.
|
||||
Instead, pass an array with each item containing a single selector
|
||||
string as in example 2.
|
||||
|
||||
| |Type | Name | Description
|
||||
|---|--- | --- | ---
|
||||
|Param |`string` | `groupName` | The name of the filter group as defined in the markup via the `data-filter-group` attribute.
|
||||
|Param |`string, Array.<string>` | `selectors` | A single selector string, or multiple selector strings as an array.
|
||||
|Returns |`void` |
|
||||
|
||||
|
||||
###### Example 1: Setting a single active selector for a "color" group
|
||||
|
||||
```js
|
||||
|
||||
mixer.setFilterGroupSelectors('color', '.green');
|
||||
|
||||
mixer.parseFilterGroups();
|
||||
```
|
||||
###### Example 2: Setting multiple active selectors for a "size" group
|
||||
|
||||
```js
|
||||
|
||||
mixer.setFilterGroupSelectors('size', ['.small', '.large']);
|
||||
|
||||
mixer.parseFilterGroups();
|
||||
```
|
||||
|
||||
<h3 id="getFilterGroupSelectors">getFilterGroupSelectors()</h3>
|
||||
|
||||
*Version added: 3.2.0*
|
||||
|
||||
`.getFilterGroupSelectors(groupName)`
|
||||
|
||||
Returns an array of active selectors for a specific filter group.
|
||||
|
||||
| |Type | Name | Description
|
||||
|---|--- | --- | ---
|
||||
|Param |`string` | `groupName` | The name of the filter group as defined in the markup via the `data-filter-group` attribute.
|
||||
|Returns |`void` |
|
||||
|
||||
|
||||
###### Example: Retrieving the active selectors for a "size" group
|
||||
|
||||
```js
|
||||
|
||||
mixer.getFilterGroupSelectors('size'); // ['.small', '.large']
|
||||
```
|
||||
|
||||
11
docs/mixitup.md
Normal file
11
docs/mixitup.md
Normal file
@@ -0,0 +1,11 @@
|
||||
#()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
| |Type | Name | Description
|
||||
|---|--- | --- | ---
|
||||
|Returns |
|
||||
|
||||
Reference in New Issue
Block a user