mirror of
https://github.com/Choices-js/Choices.git
synced 2024-05-21 06:56:34 +02:00
Allow chaining + private/public function differentation + set/clear value methods
This commit is contained in:
parent
4671d37a51
commit
278a693886
4
assets/scripts/dist/choices.min.js
vendored
4
assets/scripts/dist/choices.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -57,4 +57,10 @@ export const addGroup = (value, id, active, disabled) => {
|
||||||
active,
|
active,
|
||||||
disabled,
|
disabled,
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const clearAll = () => {
|
||||||
|
return {
|
||||||
|
type: 'CLEAR_ALL',
|
||||||
|
}
|
||||||
};
|
};
|
File diff suppressed because it is too large
Load diff
|
@ -3,10 +3,23 @@ import items from './items';
|
||||||
import groups from './groups';
|
import groups from './groups';
|
||||||
import options from './options';
|
import options from './options';
|
||||||
|
|
||||||
const rootReducer = combineReducers({
|
const appReducer = combineReducers({
|
||||||
items,
|
items,
|
||||||
groups,
|
groups,
|
||||||
options
|
options
|
||||||
})
|
});
|
||||||
|
|
||||||
|
const rootReducer = (state, action) => {
|
||||||
|
// If we are clearing all items, groups and options we reassign
|
||||||
|
// state and then pass that state to our proper reducer. This isn't
|
||||||
|
// mutating our actual state.
|
||||||
|
//
|
||||||
|
// See: http://stackoverflow.com/a/35641992
|
||||||
|
if (action.type === 'CLEAR_ALL') {
|
||||||
|
state = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
return appReducer(state, action);
|
||||||
|
};
|
||||||
|
|
||||||
export default rootReducer;
|
export default rootReducer;
|
|
@ -1,56 +0,0 @@
|
||||||
# Do not edit. File was generated by node-gyp's "configure" step
|
|
||||||
{
|
|
||||||
"target_defaults": {
|
|
||||||
"cflags": [],
|
|
||||||
"default_configuration": "Release",
|
|
||||||
"defines": [],
|
|
||||||
"include_dirs": [],
|
|
||||||
"libraries": []
|
|
||||||
},
|
|
||||||
"variables": {
|
|
||||||
"asan": 0,
|
|
||||||
"host_arch": "x64",
|
|
||||||
"icu_data_file": "icudt57l.dat",
|
|
||||||
"icu_data_in": "../../deps/icu-small/source/data/in/icudt57l.dat",
|
|
||||||
"icu_endianness": "l",
|
|
||||||
"icu_gyp_path": "tools/icu/icu-generic.gyp",
|
|
||||||
"icu_locales": "en,root",
|
|
||||||
"icu_path": "deps/icu-small",
|
|
||||||
"icu_small": "true",
|
|
||||||
"icu_ver_major": "57",
|
|
||||||
"llvm_version": 0,
|
|
||||||
"node_byteorder": "little",
|
|
||||||
"node_enable_v8_vtunejit": "false",
|
|
||||||
"node_install_npm": "true",
|
|
||||||
"node_no_browser_globals": "false",
|
|
||||||
"node_prefix": "/",
|
|
||||||
"node_release_urlbase": "https://nodejs.org/download/release/",
|
|
||||||
"node_shared_cares": "false",
|
|
||||||
"node_shared_http_parser": "false",
|
|
||||||
"node_shared_libuv": "false",
|
|
||||||
"node_shared_openssl": "false",
|
|
||||||
"node_shared_zlib": "false",
|
|
||||||
"node_tag": "",
|
|
||||||
"node_use_dtrace": "true",
|
|
||||||
"node_use_etw": "false",
|
|
||||||
"node_use_lttng": "false",
|
|
||||||
"node_use_openssl": "true",
|
|
||||||
"node_use_perfctr": "false",
|
|
||||||
"openssl_fips": "",
|
|
||||||
"openssl_no_asm": 0,
|
|
||||||
"target_arch": "x64",
|
|
||||||
"uv_parent_path": "/deps/uv/",
|
|
||||||
"uv_use_dtrace": "true",
|
|
||||||
"v8_enable_gdbjit": 0,
|
|
||||||
"v8_enable_i18n_support": 1,
|
|
||||||
"v8_no_strict_aliasing": 1,
|
|
||||||
"v8_optimized_debug": 0,
|
|
||||||
"v8_random_seed": 0,
|
|
||||||
"v8_use_snapshot": "true",
|
|
||||||
"want_separate_host_toolset": 0,
|
|
||||||
"xcode_version": "7.0",
|
|
||||||
"nodedir": "/Users/joshjohnson/.node-gyp/6.2.0",
|
|
||||||
"copy_dev_lib": "true",
|
|
||||||
"standalone_static_library": 1
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -167,7 +167,7 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
const choices7 = new Choices('#choices-7', { allowSearch: false }).setValue(['Set value 1', 'Set value 2']);
|
const choices7 = new Choices('#choices-7', { allowSearch: false }).setValue(['Set value 1', 'Set value 2']);
|
||||||
|
|
||||||
const choicesAjax = new Choices('#choices-12').ajax((callback) => {
|
const choicesAjax = new Choices('#choices-12').ajax((callback) => {
|
||||||
fetch('https://api.discogs.com/artists/391170/releases?token=QBRmstCkwXEvCjTclCpumbtNwvVkEzGAdELXyRyW')
|
fetch('https://api.discogs.com/artists/391170/releases?token=QBRmstCkwXEvCjTclCpumbtNwvVkEzGAdELXyRyW')
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
@ -178,7 +178,7 @@
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
callback();
|
callback();
|
||||||
});
|
});
|
||||||
});
|
})
|
||||||
|
|
||||||
const choicesMultiple = new Choices('[data-choice]', {
|
const choicesMultiple = new Choices('[data-choice]', {
|
||||||
placeholderValue: 'This is a placeholder set in the config',
|
placeholderValue: 'This is a placeholder set in the config',
|
||||||
|
|
Loading…
Reference in a new issue