-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathModuleFactory.js
More file actions
57 lines (46 loc) · 2.41 KB
/
Copy pathModuleFactory.js
File metadata and controls
57 lines (46 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import {multiSelectPlugins, picksPlugins, allPlugins} from './PluginSet'
import {shallowClearClone, ObjectValuesEx} from './ToolsJs'
import {utilities} from './ToolSet'
import {MultiSelectBuilder} from './MultiSelectBuilder'
export function ModuleFactory(environment, customizationPlugins, defaultCss){
if (!environment.trigger)
environment.trigger = (e, name) => e.dispatchEvent(new environment.window.Event(name))
if (!environment.isIE11)
environment.isIE11 = !!environment.window.MSInputMethodContext && !!environment.window.document.documentMode;
let multiSelectPluginsObj = shallowClearClone(customizationPlugins, multiSelectPlugins);
let pluginsArray = ObjectValuesEx(multiSelectPluginsObj);
let {create: BsMultiSelect, BsMultiSelectDefault} = MultiSelectBuilder(environment, pluginsArray, defaultCss)
BsMultiSelect.Default = BsMultiSelectDefault;
let picksPluginsObj = shallowClearClone(customizationPlugins, picksPlugins);
let picksPluginsArray = ObjectValuesEx(picksPluginsObj);
let {create: BsPicks, BsPicksDefault} = MultiSelectBuilder(environment, picksPluginsArray, defaultCss)
BsPicks.Default = BsPicksDefault;
return {
BsMultiSelect,
BsPicks,
MultiSelectTools: {MultiSelectBuilder, plugins: shallowClearClone(customizationPlugins, allPlugins), defaultCss, utilities}
}
}
// TEST
// function areValidElements(...args) {
// const result = Object.values(obj);
// return !args.some(
// (element) =>
// !(element && typeof element.getBoundingClientRect === 'function')
// );
// }
// function ModuleFactory(environment) {
// if (!environment.trigger)
// environment.trigger = (e, name) => e.dispatchEvent(new environment.window.Event(name))
// let pluginsArray = ObjectValues(shallowClearClone({Bs5Plugin}, multiSelectPlugins));
// let {create: BsMultiSelect, BsMultiSelectDefault} = MultiSelectBuilder(environment, pluginsArray)
// BsMultiSelect.Default = BsMultiSelectDefault;
// let picksPluginsArray = ObjectValues(shallowClearClone({Bs5Plugin}, picksPlugins));
// let {create: BsPicks, BsPicksDefault} = MultiSelectBuilder(environment, picksPluginsArray)
// BsPicks.Default = BsPicksDefault;
// return {
// BsMultiSelect,
// BsPicks,
// MultiSelectTools: {MultiSelectBuilder, plugins: shallowClearClone({Bs5Plugin}, allPlugins), utilities}
// }
// }