{"version":3,"sources":["../../js/src/ToolsJs.js","../../js/src/ToolsDom.js","../../js/src/ToolsStyling.js","../../js/src/FilterManagerAspect.js","../../js/src/Wraps.js","../../js/src/MultiSelectInlineLayout.js","../../js/src/BsMultiSelect.js","../../js/src/NavigateAspect.js","../../js/src/ComponentPropertiesAspect.js","../../js/src/OptionsAspect.js","../../js/src/CreateWrapAspect.js","../../js/src/StaticDomFactory.js","../../js/src/ChoicesDomFactory.js","../../js/src/CountableChoicesListInsertAspect.js","../../js/src/ChoicesEnumerableAspect.js","../../js/src/PluginManager.js","../../js/src/ChoicesVisibilityAspect.js","../../js/src/PickButtonAspect.js","../../js/src/FilterDom.js","../../js/src/SpecialPicksEventsAspect.js","../../js/src/ResetFilterListAspect.js","../../js/src/PicksDom.js","../../js/src/PickDomFactory.js","../../js/src/BuildPickAspect.js","../../js/src/InputAspect.js","../../js/src/ChoiceDomFactory.js","../../js/src/BuildChoiceAspect.js","../../js/src/AppearanceAspect.js","../../js/src/FillChoicesAspect.js","../../js/src/UpdateDataAspect.js","../../js/src/BsMultiSelectDepricatedParameters.js","../../js/src/MultiSelectBuilder.js","../../js/src/CreateForJQuery.js","../../js/src/AddToJQueryPrototype.js","../../js/src/plugins/LabelPlugin.js","../../js/src/plugins/RtlPlugin.js","../../js/src/ValidityApi.js","../../js/src/plugins/ValidationApiPlugin.js","../../js/src/plugins/BsAppearancePlugin.js","../../js/src/plugins/HiddenOptionPlugin.js","../../js/src/plugins/CssPatchPlugin.js","../../js/src/plugins/PlaceholderPlugin.js","../../js/src/plugins/JQueryMethodsPlugin.js","../../js/src/plugins/OptionsApiPlugin.js","../../js/src/plugins/SelectElementPlugin.js","../../js/src/plugins/SelectedOptionPlugin.js","../../js/src/plugins/DisabledOptionPlugin.js","../../js/src/plugins/PicksApiPlugin.js","../../js/src/plugins/PicksPlugin.js","../../js/src/plugins/CreatePopperPlugin.js","../../js/src/plugins/FloatingLabelPlugin.js","../../js/src/plugins/ChoicesDynamicStylingPlugin.js","../../js/src/plugins/WarningPlugin.js","../../js/src/plugins/HighlightPlugin.js","../../js/src/plugins/CustomChoiceStylingsPlugin.js","../../js/src/plugins/CustomPickStylingsPlugin.js","../../js/src/PluginSet.js","../../js/src/plugins/FormResetPlugin.js","../../js/src/plugins/FormRestoreOnBackwardPlugin.js","../../js/src/plugins/Bs5Plugin.js","../../js/src/ToolSet.js","../../js/src/BsMultiSelect.jquery.js"],"names":["isBoolean","value","isString","String","extendIfUndefined","destination","source","property","undefined","shallowClearClone","v","_len","arguments","length","sources","Array","_key","forEach","s","hasOwnProperty","forEachRecursion","f","e","prev","indexRecursion","index","List","tail","count","add","next","node","remove","getTail","getCount","isEmpty","reset","DoublyLinkedList","getPrev","setPrev","getNext","setNext","head","getHead","composeSync","_len2","functions","_key2","defCall","_len3","_key3","_i","_functions","Function","tmp","ObservableLambda","func","list","getValue","call","attach","detachAll","findDirectChildByTagName","element","tagName","i","children","closestByTagName","closest","closestByClassName","className","classList","contains","containsAndSelf","otherNode","getDataGuardedWithPrefix","prefix","name","tmp1","getAttribute","tmp2","predicate","Element","parentNode","getIsRtl","isRtl","attributeName","attribute","closestByAttribute","EventBinder","bind","eventName","handler","addEventListener","push","unbind","removeEventListener","addStyling","styling","backupStyling","classes","styles","slice","style","toggleStyling","isOn","removeStyling","extendClasses","out","param","actionStr","actionArr","isRemoveEmptyClasses","c","split","extend","actionObj","Object","Styling","a","o","freeze","createStyling","isReplace","params","extendInt","p","concat","createCss","stylings1","stylings2","param1","param2","NavigateManager","navigate","down","wrap","Wraps","wrapsCollection","listFacade_reset","listFacade_remove","listFacade_add","insert","key","clear","dispose","forLoop","MultiSelectInlineLayout","aspects","environment","filterDom","picksDom","choicesDom","choicesVisibilityAspect","hoveredChoiceAspect","navigateAspect","filterManagerAspect","focusInAspect","optionToggleAspect","createPickHandlersAspect","picksList","inputAspect","specialPicksEventsAspect","buildChoiceAspect","setDisabledComponentAspect","resetLayoutAspect","placeholderStopInputAspect","warningAspect","configuration","createPopperAspect","rtlAspect","staticManager","picksElement","choicesElement","filterInputElement","pop","create","appendToContainer","init","origBackSpace","backSpace","pick","update","origUpdateRtl","updateRtl","setRtl","updatePopupLocation","pop2","warningElement","origUpdateRtl2","origWarningAspectShow","show","msg","window","document","eventLoopFlag","flag","get","set","setTimeout","EventLoopFlag","skipFocusout","resetSkipFocusout","skipoutMousedown","documentMouseup","event","target","setFocus","resetLayout","setFocusIn","showChoices","isChoicesVisible","setChoicesVisible","hideChoices","resetMouseCandidateChoice","resetHoveredChoice","preventDefaultClickEvent","componentDisabledEventBinder","skipoutAndResetMousedown","clickToShowChoices","setFocusIfNotTarget","getNavigateManager","handleOnRemoveButton","setSelectedFalse","uncheckOption","processUncheck","mouseCandidateEventBinder","mouseOverToHoveredAndReset","choice","isHoverIn","hoverIn","keyDownArrow","hoveredToSelected","hoveredWrap","getHoveredChoice","toggle","onFocusIn","onFocusOut","onInput","_inputAspect$processI","processInput","filterInputValue","processEmptyInput","setWidth","visibleCount","hide","panelIsVisble","getFilter","noResultsWarning","afterInput","onKeyDown","keyCode","which","empty","indexOf","preventDefault","stopPropagation","onKeyUp","origSetDisabledComponent","setDisabledComponent","isComponentDisabled","origCreatePickHandlers","createPickHandlers","pickHandlers","removeOnButton","origBuildChoice","buildChoice","removeAndDispose","unbindChoiceElement","choiceElement","overAndLeaveEventBinder","adoptChoiceElement","BsMultiSelect","plugins","onInit","_extendIfUndefined","isIE11","MSInputMethodContext","documentMode","hoveredChoice","containerClass","css","getDisabled","options","getText","disposeAspect","triggerAspect","trigger","TriggerAspect","onChangeAspect","onChange","OnChangeAspect","componentPropertiesAspect","ComponentPropertiesAspect","optionsAspect","getOptions","OptionsAspect","optionPropertiesAspect","option","text","OptionPropertiesAspect","isChoiceSelectableAspect","isSelectable","createWrapAspect","createWrap","createChoiceBaseAspect","createChoiceBase","filteredPrev","filteredNext","searchText","toLowerCase","trim","isFilteredIn","setVisible","setHoverIn","isChoiceElementAttached","choiceDom","choiceElementAttach","itemPrev","itemNext","CreateChoiceBaseAspect","addPickAspect","addPick","producePick","removePickAspect","removePick","createElementAspect","createElement","choicesDomFactory","choicesListElement","appendChild","display","choices","choicesList","createChoiceElement","isVisible","beforeElement","insertBefore","detach","removeChild","ChoicesDomFactory","staticDomFactory","createStaticDom","showError","message","backgroundColor","color","Error","containerElement","removableContainerClass","disposablePicksElement","staticDom","initialElement","StaticDomFactory","splice","start","countableChoicesList","warp","countableChoicesListInsertAspect","countableChoicesListInsert","choiceNext","CountableChoicesListInsertAspect","choicesEnumerableAspect","ChoicesEnumerableAspect","filteredChoicesList","filterPredicateAspect","filterPredicate","emptyNavigateManager","filteredNavigateManager","showEmptyFilter","filterText","setFilter","FilterManagerAspect","setHoveredChoice","NavigateAspect","wraps","w","constructors","_constructors$i$plugS","_constructors$i3","plugStaticDom","buttonHTML","_staticDomFactory$cre","_createStaticDom","filterInput","setAttribute","eventBinder","setEmpty","focus","width","onFilterInputInput","onfilterInputKeyDown","onFilterInputKeyUp","FilterDom","visible","resetFilterListAspect","forceResetFilter","ResetFilterListAspect","resetFilterAspect","resetFilter","ResetFilterAspect","pickFilterElement","picks","pickFilter","disableToggleStyling","picks_disabled","focusToggleStyling","picks_focus","isFocusIn","createPickElement","pickElement","disable","toggleFocusStyling","getIsFocusIn","setIsFocusIn","newIsFocusIn","PicksDom","FocusInAspect","pickDomFactory","pickButtonAspect","getButtonHTML","innerHTML","pickContentElement","querySelector","pickButtonElement","pickContent","pickButton","disableToggle","pickContent_disabled","pickDom","pickDomManagerHandlers","updateData","textContent","updateDisabled","isOptionDisabled","updateComponentDisabled","disabled","PickDomFactory","pickButtonHTML","buildPickAspect","buildPick","_picksDom$createPickE","_pickDomFactory$creat","pickElementAttach","BuildPickAspect","producePickAspect","fixSelectedFalse","removeFromPicksList","ProducePickAspect","CreatePickHandlersAspect","OptionToggleAspect","fullMatchAspect","fullMatch","FullMatchAspect","fullMatchWrap","InputAspect","choiceClickAspect","choiceClick","ChoiceClickAspect","choiceDomFactory","highlightAspect","updateHighlightedInternal","highlighter","getHighlighter","updateDataInternal","choiceDomManagerHandlers","choiceHoverToggle","choice_hover","updateHoverIn","choiceContentElement","choiceCheckBoxElement","choiceLabelElement","choiceContent","choiceCheckBox","choiceLabel","choiceSelectedToggle","choice_selected","choiceDisabledToggle","choice_disabled","choiceCheckBoxDisabledToggle","choiceCheckBox_disabled","choiceLabelDisabledToggle","choiceLabel_disabled","choiceCursorDisabledToggle","cursor","updateHighlighted","isCheckBoxDisabled","isOptionSelected","updateSelected","checked","ChoiceDomFactory","_choicesDom$createCho","_choiceDomFactory$cre","BuildChoiceAspect","buildAndAttachChoiceAspect","buildAndAttachChoice","getNextElement","BuildAndAttachChoiceAspect","SetDisabledComponentAspect","updateDisabledComponentAspect","updateDisabledComponent","newIsComponentDisabled","UpdateDisabledComponentAspect","appearanceAspect","updateAppearance","AppearanceAspect","fillChoicesAspect","fillChoices","fillChoicesImpl","readyState","domContentLoadedHandler","FillChoicesAspect","loadAspect","load","LoadAspect","updateDataAspect","UpdateDataAspect","pluginManager","pluginData","instances","instance","disposes","buildApi","api","_instances$_i$buildAp","_instances$_i","_instances$_i3$dispos","_instances$_i2","PluginManager","multiSelectInlineLayout","component","transformStyles","old","opt","transformClasses","MultiSelectBuilder","defaults","_constructors$i$plugD","_constructors$i","plugDefaultConfig","_options2","console","log","buildConfiguration","_options","settings","cssPatch","selectedPanelFocusBorderColor","selectedPanelFocusBoxShadow","boxShadow","borderColor","inputColor","useCss","pick_disabled","useCssPatch","getIsValid","getIsInValid","adjustLegacySettings","_constructors$i$plugM","_constructors$i2","plugMergeSettings","defaultSettings","createForJQuery","$","createPopper","pluginsSet","stylePlugin","isJQyery","body","hasAttribute","Event","dispatchEvent","createEvent","initCustomEvent","composeEventTrigger","_MultiSelectBuilder","object","arr","ObjectValues","createForUmd","Default","pluginName","createPlugin","firstChar","charAt","firstCharLower","prototypableName","noConflictPrototypable","fn","noConflictPrototypableForInstance","dataKey","createInstance","$e","removeData","data","prototypable","output","this","each","isMethodName","test","methodName","lMethodName","result","prototypableForInstance","noConflict","addToJQueryPrototype","removeInstanceData","multiSelect","LabelPlugin","label","labelPluginData","getLabelElementAspect","createInputId","selectElement","id","labelElement","backupedForAttribute","newId","RtlPlugin","forceRtlOnContainer","attributeBackup","currentAtribute","restore","removeAttribute","dirAttributeValue","ValidityApi","visibleElement","isValueMissingObservable","valueMissingMessage","onValid","customValidationMessage","validationMessage","validity","setMessage","valueMissing","customError","valid","createValidity","setCustomValidity","checkValidity","willValidate","reportValidity","ValidationApiPlugin","selectElementPluginData","getIsValueMissing","required","optionsArray","selected","validationApiObservable","setValue","newValue","validationApiPluginData","validationApi","isValid","BsAppearancePlugin","updateSize","floatingLabelAspect","getValidity","getSize","composeGetSize","getDefaultLabel","isFloatingLabel","origGetLabelElementAspect","composeGetValidity","picks_lg","picks_sm","picks_def","picks_floating_def","picksLgStyling","picksSmStyling","picksDefStyling","size","updateSizeClasses","updateSizeJsPicks","updateSizeJs","updateSizeJsForAdapter","updateSizeForAdapter","origToggleFocusStyling","validationObservable","picks_focus_invalid","picks_focus_valid","wasUpdatedObservable","getManualValidationObservable","_getMessagesElements","siblings","l","siblingsAsArray","invalidMessages","filter","validMessages","getMessagesElements","map","updateValidity","updateWasValidated","buildHiddenChoice","updateChoiceHidden","getNextNonHidden","getIsOptionHidden","newIsOptionHidden","isOptionHidden","nextChoice","CssPatchPlugin","PlaceholderPlugin","resetableFlag","placeholder","setPlaceholder","ignoreNextInputResetableFlag","setPlaceholderOrig","setEmptyInputWidth","emptyToggleStyling","filterInput_empty","showPlacehodler","updatePlacehodlerVisibility","updateEmptyInputWidth","origDisable","setDisabled","origAdd","returnValue","JQueryMethodsPlugin","getContainer","getChoices","getChoicesList","getFilterInput","getPicks","picksCount","jQueryMethodsPluginData","OptionsApiPlugin","updateOptionAdded","_nextChoice","updateOptionRemoved","SelectElementPlugin","updateChoiceSelected","getIsOptionSelected","newIsSelected","updateChoiceDisabled","getIsOptionDisabled","newIsDisabled","PicksApiPlugin","forEachPeak","getTailPeak","_picksList$getTail","countPeaks","isEmptyPeaks","updateHidden","PicksPlugin","addOptionPicked","CreatePopperPlugin","Popper","anchorElement","preventOverflow","popperConfiguration","placement","modifiers","enabled","flip","popper","prototype","constructor","destroy","FloatingLabelPlugin","updateLiftedLabel","liftToggleStyling1","liftToggleStyling2","liftedLabel","label_floating_lifted","picks_floating_lifted","ChoicesDynamicStylingPlugin","useChoicesDynamicStyling","origSetChoicesVisible","choicesDynamicStyling","minimalChoicesDynamicStylingMaxHeight","g","getElementsByTagName","documentElement","new_y","innerHeight","clientHeight","getBoundingClientRect","top","msHeight","Math","max","round","setProperty","WarningPlugin","isNoResultsWarningEnabled","origAppendToContainer","nextSibling","warning","WarningAspect","HighlightPlugin","origProcessEmptyInput","origSetFilter","origSetVisible","CustomChoiceStylingsPlugin","apsects","customChoiceStylings","customChoiceStylingsAspect","customize","handlers","customChoiceStylingsClosure","custom","origChoiceDomFactoryCreate","CustomPickStylingsPlugin","customPickStylingsAspect","customPickStylings","customPickStylingsClosure","CustomPickStylingsAspect","origPickDomFactoryCreate","configurationPluginData","extendCss","origCreate","_origCreate","origCreateStaticDom","disposableContainerElement","backupDisplay","backupedRequired","fieldsetElement","origReset","_origAdd","useHighlighting","guarded","replace","regex","RegExp","defaultPlugins","HiddenOptionPlugin","origBuildAndAttachChoice","origIsSelectable","hidden","origCreateWrap","updateOptionsHidden","updateOptionHidden","FormResetPlugin","eventBuilder","form","SelectedOptionPlugin","getSelected","setIsOptionSelected","setSelected","origFilterPredicate","composeUpdateSelected","booleanValue","trySetWrapSelected","success","origAddPick","selectAll","deselectAll","setOptionSelected","updateOptionsSelected","updateOptionSelected","FormRestoreOnBackwardPlugin","origLoad","DisabledOptionPlugin","origToggle","origBuildPick","choiceUpdateDisabledBackup","updateOptionsDisabled","updateOptionDisabled","picksPlugins","allPlugins","Bs5Plugin","inputGroupElement","query","p1","parentElement","setDefaults","listStyleType","paddingLeft","paddingRight","marginBottom","flexWrap","height","border","padding","margin","outline","backgroundImage","minHeight","paddingInlineStart","paddingInlineEnd","fontSize","float","verticalAlign","opacity","justifyContent","transform","paddingTop","paddingBottom","zIndex","utilities","jQuery","BsPicks","MultiSelectTools"],"mappings":";;;;;sXAAO,SAASA,EAAUC,GACtB,OAAiB,IAAVA,IAA4B,IAAVA,EAGtB,SAASC,EAASD,GACrB,OAAOA,aAAiBE,QAA4B,iBAAXF,EAGtC,SAASG,EAAkBC,EAAaC,GAC3C,IAAK,IAAIC,KAAYD,OACaE,IAA1BH,EAAYE,KACZF,EAAYE,GAAYD,EAAOC,IAGpC,SAASE,EAAkBH,GAC9B,IAAID,EAAc,GAClB,IAAK,IAAIE,KAAYD,EAAO,CACxB,IAAII,EAAIJ,EAAOC,GACX,MAAEG,IACFL,EAAYE,GAAYG,GALkB,IAAA,IAAAC,EAAAC,UAAAC,OAATC,EAAS,IAAAC,MAAAJ,EAAA,EAAAA,EAAA,EAAA,GAAAK,EAAA,EAAAA,EAAAL,EAAAK,IAATF,EAASE,EAAA,GAAAJ,UAAAI,GAqBlD,OAdGF,GACCA,EAAQG,SACJ,SAAAC,GACI,IAAI,IAAIX,KAAYW,EAAE,CAClB,IAAIR,EAAIQ,EAAEX,GACN,MAAEG,EACFL,EAAYE,GAAYG,EAEpBL,EAAYc,eAAeZ,WACpBF,EAAYE,OAKpCF,EAGX,SAASe,EAAiBC,EAAGC,GACpBA,KAGQ,IADFD,EAAEC,EAAErB,QAEXmB,EAAiBC,EAAGC,EAAEC,OAG9B,SAASC,EAAeC,EAAOH,GAC3B,IAAKA,EAAEC,KACH,OAAOE,EACXD,IAAiBC,EAAOH,EAAEC,MAGvB,SAASG,IACZ,IAAIC,EAAO,KACPC,EAAQ,EACZ,MAAO,CACHC,IADG,SACCP,GACIK,GACAA,EAAKG,KAAO,CAAC7B,MAAMqB,EAAGC,KAAKI,EAAMG,KAAK,MACtCH,EAAOA,EAAKG,MAEZH,EAAO,CAAC1B,MAAMqB,E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EAAQ2rB,EAAQxU,EAAc,gBAAiBsQ,GAAgBoC,IAD3F,CAGF7pB,OAAQA,OAAO2rB,OAAQhJ,EAAAA,SAUMiJ,QAN3B,SAAC5rB,EAAQ2rB,EAAQxU,GACZ,OAAOF,EAAgBjX,EAAQ2rB,EAAQxU,EAAc,UAAWwS,GAAcE,IADnF,CAGF7pB,OAAQA,OAAO2rB,OAAQhJ,EAAAA,SAGgBkJ,iBAAkB,CAACvW,mBAAAA,EAAoBtQ,QAASxQ,EAAkB,CAACq1B,UAAAA,IAAYD,IAAa8B,UAAAA","sourcesContent":["export function isBoolean(value){\r\n return value === true || value === false;\r\n}\r\n\r\nexport function isString(value){\r\n return value instanceof String || typeof(value) === 'string';\r\n}\r\n\r\nexport function extendIfUndefined(destination, source) {\r\n for (let property in source)\r\n if (destination[property] === undefined)\r\n destination[property] = source[property];\r\n}\r\n\r\nexport function shallowClearClone(source, ...sources) { // override previous, no null and undefined\r\n var destination = {};\r\n for (let property in source){ // TODO: Object.assign (need polyfill for IE11)\r\n let v = source[property];\r\n if (!(v === null || v===undefined))\r\n destination[property] = v;\r\n }\r\n if(sources)\r\n sources.forEach(\r\n s=>{\r\n for(let property in s){\r\n let v = s[property];\r\n if (!(v === null || v===undefined))\r\n destination[property] = v;\r\n else\r\n if (destination.hasOwnProperty(property)){\r\n delete destination[property];\r\n }\r\n }\r\n }\r\n )\r\n return destination;\r\n}\r\n\r\nfunction forEachRecursion(f, e){\r\n if (!e)\r\n return;\r\n let goOn = f(e.value); \r\n if (!(goOn===false))\r\n forEachRecursion(f, e.prev);\r\n}\r\n\r\nfunction indexRecursion(index, e){\r\n if (!e.prev)\r\n return index;\r\n indexRecursion(++index, e.prev);\r\n}\r\n\r\nexport function List(){\r\n var tail = null;\r\n var count = 0;\r\n return {\r\n add(e){\r\n if (tail){\r\n tail.next = {value:e, prev:tail, next:null};\r\n tail = tail.next;\r\n } else \r\n tail = {value:e, prev:null, next:null}\r\n count++;\r\n let node = tail;\r\n function remove(){\r\n if (node.prev){\r\n (node.prev).next = node.next;\r\n }\r\n if (node.next){\r\n (node.next).prev = node.prev;\r\n }\r\n if (tail == node){\r\n tail = node.prev;\r\n }\r\n count--;\r\n }\r\n function index(){\r\n return indexRecursion(0, node);\r\n }\r\n return {remove, index};\r\n },\r\n forEach(f){\r\n forEachRecursion(f, tail);\r\n },\r\n getTail(){ return (tail)?tail.value:null },\r\n getCount(){ return count },\r\n isEmpty(){ return count==0 },\r\n reset(){ tail=null; count = 0 }\r\n }\r\n}\r\n\r\nexport function DoublyLinkedList(getPrev, setPrev, getNext, setNext){\r\n var head = null, tail = null;\r\n var count = 0;\r\n return {\r\n add(e, next){\r\n if (!tail){\r\n head = tail = e;\r\n setPrev(e, null);\r\n setNext(e, null);\r\n }\r\n else {\r\n if (!next){\r\n setPrev(e, tail);\r\n setNext(e, null);\r\n setNext(tail, e);\r\n tail = e;\r\n } \r\n else{\r\n if (next===head)\r\n head=e;\r\n let prev = getPrev(next);\r\n setNext(e, next);\r\n setPrev(next, e);\r\n if (prev){\r\n setPrev(e, prev);\r\n setNext(prev, e);\r\n } else {\r\n setPrev(e, null);\r\n }\r\n } \r\n }\r\n count++;\r\n },\r\n remove(e){\r\n let next = getNext(e);\r\n let prev = getPrev(e);\r\n if (prev) {\r\n setNext(prev, next)\r\n }\r\n if (next) {\r\n setPrev(next, prev)\r\n }\r\n if (tail == e) {\r\n tail = prev;\r\n }\r\n if (head == e) {\r\n head = next; \r\n }\r\n count--;\r\n }, \r\n getHead(){ return head },\r\n getTail(){ return tail },\r\n getCount(){ return count },\r\n isEmpty(){ return count==0 },\r\n reset(){ \r\n tail=head=null; \r\n count = 0; }\r\n }\r\n}\r\n\r\nexport function DoublyLinkedCollection(getPrev, setPrev, getNext, setNext){\r\n var list = [];\r\n var head = null, tail = null;\r\n return {\r\n push(e){\r\n list.push(e);\r\n if (!tail){\r\n head = tail = e;\r\n setPrev(e, null);\r\n setNext(e, null);\r\n }\r\n else {\r\n setPrev(e, tail);\r\n setNext(e, null);\r\n setNext(tail, e);\r\n tail = e;\r\n }\r\n },\r\n add(e, key){\r\n list.splice(key, 0, e);\r\n if (!tail){\r\n head = tail = e;\r\n setPrev(e, null);\r\n setNext(e, null);\r\n }\r\n else {\r\n let next = list[key];\r\n if (!next) {\r\n setPrev(e, tail);\r\n setNext(e, null);\r\n setNext(tail, e);\r\n tail = e;\r\n } \r\n else {\r\n if (next===head)\r\n head=e;\r\n let prev = getPrev(next);\r\n setNext(e, next);\r\n setPrev(next, e);\r\n if (prev){\r\n setPrev(e, prev);\r\n setNext(prev, e);\r\n } else {\r\n setPrev(e, null);\r\n }\r\n } \r\n }\r\n },\r\n get: (key) => list[key],\r\n remove(key){\r\n var e = list[key];\r\n list.splice(key, 1);\r\n let next = getNext(e);\r\n let prev = getPrev(e);\r\n if (prev) {\r\n setNext(prev, next)\r\n }\r\n if (next) {\r\n setPrev(next, prev)\r\n }\r\n if (tail == e) {\r\n tail = prev;\r\n }\r\n if (head == e) {\r\n head = next; \r\n }\r\n return e;\r\n }, \r\n forLoop(f){\r\n for(let i=0; i list[key],\r\n getNext: (key, predicate) => {\r\n let count = list.length;\r\n let start = key+1;\r\n if (key functions.forEach(\r\n (f) => {\r\n if (f)\r\n f();\r\n }\r\n )\r\n}\r\n\r\nexport function defCall(...functions){\r\n for (let f of functions) \r\n if (f) {\r\n if (f instanceof Function){\r\n let tmp = f();\r\n if (tmp)\r\n return tmp;\r\n }\r\n else\r\n return f \r\n }\r\n}\r\n\r\nexport function ObservableValue(value){\r\n var list = List();\r\n return {\r\n getValue(){\r\n return value;\r\n },\r\n setValue(newValue){\r\n value = newValue;\r\n list.forEach(f=>f(newValue));\r\n },\r\n attach(f){\r\n return list.add(f)\r\n },\r\n detachAll(){\r\n list.reset();\r\n }\r\n }\r\n}\r\n\r\nexport function ObservableLambda(func){\r\n var list = List();\r\n var value = func();\r\n return {\r\n getValue(){\r\n return value;\r\n },\r\n call(){\r\n value = func();\r\n list.forEach(f=>f(value));\r\n },\r\n attach(f){\r\n return list.add(f)\r\n },\r\n detachAll(){\r\n list.reset();\r\n }\r\n }\r\n}\r\n\r\nexport function ObjectValues(object){ // Object.values(plugins) - problem for IE11; full impementation of polifill is mor complex, but for our purpose this is enough\r\n var arr = [];\r\n\tfor (var key in object) {\r\n arr.push(object[key]);\r\n\t}\r\n\treturn arr;\r\n}","export function findDirectChildByTagName(element, tagName){\r\n let value = null;\r\n for (let i = 0; i{ \r\n var event = new window.Event(eventName);\r\n e.dispatchEvent(event);\r\n }\r\n }\r\n else\r\n trigger = (e, eventName) => { // IE 11 polyfill\r\n let event = window.document.createEvent(\"CustomEvent\");\r\n event.initCustomEvent(eventName, false, false, undefined);\r\n e.dispatchEvent(event);\r\n }\r\n return trigger;\r\n}\r\n\r\nexport function closestByTagName(element, tagName){\r\n return closest(element, e => e.tagName === tagName) // TODO support xhtml? e.tagName.toUpperCase() ?\r\n}\r\n\r\nexport function closestByClassName(element, className){\r\n return closest(element, e => e.classList.contains(className))\r\n}\r\n\r\nexport function closestByAttribute(element, attributeName, attribute){\r\n return closest(element, e => e.getAttribute(attributeName)===attribute )\r\n}\r\n\r\nexport function containsAndSelf(node, otherNode ){\r\n return node === otherNode || node.contains(otherNode); \r\n}\r\n\r\nexport function getDataGuardedWithPrefix(element, prefix, name){\r\n var tmp1 = element.getAttribute('data-' + prefix + '-' + name);\r\n if (tmp1) {\r\n return tmp1;\r\n } else {\r\n var tmp2 = element.getAttribute('data-' + name);\r\n if (tmp2)\r\n return tmp2;\r\n }\r\n return null;\r\n}\r\n\r\nfunction closest(element, predicate){\r\n if (!element || !(element instanceof Element)) return null; // should be element, not document (TODO: check iframe)\r\n \r\n if (predicate(element)) return element;\r\n return closest(element.parentNode, predicate);\r\n}\r\n\r\nexport function siblingsAsArray(element){\r\n var value = []\r\n if (element.parentNode){\r\n var children = element.parentNode.children;\r\n var l = element.parentNode.children.length;\r\n if (children.length>1){\r\n for (var i=0; i < l; ++i){\r\n var e = children[i];\r\n if (e!=element)\r\n value.push(e);\r\n \r\n }\r\n }\r\n }\r\n return value;\r\n}\r\n\r\nexport function getIsRtl(element){\r\n var isRtl = false;\r\n var e = closestByAttribute(element,\"dir\",\"rtl\");\r\n if (e)\r\n isRtl = true;\r\n return isRtl;\r\n}\r\n\r\nexport function EventBinder(){\r\n var list = [];\r\n return {\r\n bind(element, eventName, handler) {\r\n element.addEventListener(eventName, handler)\r\n list.push( {element, eventName, handler} )\r\n },\r\n unbind() {\r\n list.forEach( e=> {\r\n let {element, eventName, handler}=e;\r\n element.removeEventListener(eventName, handler)\r\n })\r\n }\r\n }\r\n}\r\n\r\nexport function AttributeBackup(){\r\n var list = [];\r\n return {\r\n set(element, attributeName, attribute){\r\n var currentAtribute = element.getAttribute(attributeName); \r\n list.push( {element, currentAtribute, attribute} )\r\n element.setAttribute(attributeName, attribute)\r\n },\r\n restore(){\r\n list.forEach(e=>{\r\n let {element, attributeName, attribute} = e;\r\n if (attributeName)\r\n element.setAttribute(attributeName, attribute)\r\n else\r\n element.removeAttribute(attributeName)\r\n })\r\n }\r\n }\r\n}\r\n\r\nexport function EventLoopFlag(window) {\r\n var flag = false;\r\n return {\r\n get(){\r\n return flag;\r\n },\r\n set(){\r\n flag = true;\r\n window.setTimeout( \r\n () => { \r\n flag = false;\r\n }, 0)\r\n }\r\n }\r\n}\r\n\r\nexport function ResetableFlag() {\r\n var flag = false;\r\n return {\r\n get(){\r\n return flag;\r\n },\r\n set(){\r\n flag = true;\r\n },\r\n reset(){\r\n flag = false;\r\n }\r\n }\r\n}","import {shallowClearClone, isString} from './ToolsJs';\r\n\r\nexport function addStyling(element, styling){\r\n var backupStyling = {classes:[], styles:{}}\r\n if (styling) {\r\n var {classes, styles} = styling;\r\n classes.forEach(e => element.classList.add(e)) // todo use add(classes)\r\n backupStyling.classes = classes.slice();\r\n for (let property in styles){\r\n backupStyling.styles[property] = element.style[property];\r\n element.style[property] = styles[property]; // todo use Object.assign (need polyfill for IE11)\r\n }\r\n }\r\n return backupStyling;\r\n}\r\n\r\nfunction removeStyling(element, styling){\r\n if (styling) {\r\n var {classes, styles} = styling;\r\n classes.forEach(e=>element.classList.remove(e)) // todo use remove(classes)\r\n for (let property in styles)\r\n element.style[property] = styles[property]; // todo use Object.assign (need polyfill for IE11)\r\n }\r\n}\r\n\r\nexport function toggleStyling(element, styling){\r\n var backupStyling = {classes:[], styles:{}};\r\n var isOn=false;\r\n return (value)=>{\r\n if (value) {\r\n if (isOn===false){\r\n backupStyling = addStyling(element, styling)\r\n isOn=true;\r\n }\r\n } else {\r\n if (isOn===true){\r\n removeStyling(element, backupStyling);\r\n isOn=false;\r\n }\r\n }\r\n }\r\n}\r\n\r\nfunction extendClasses(out, param, actionStr, actionArr, isRemoveEmptyClasses){\r\n if (isString(param)){\r\n if (param === \"\"){\r\n if (isRemoveEmptyClasses){\r\n out.classes = [];\r\n }\r\n } else {\r\n let c = param.split(' ');\r\n out.classes = actionStr(c);\r\n }\r\n return true;\r\n } else if (param instanceof Array){\r\n if (param.length==0){\r\n if (isRemoveEmptyClasses){\r\n out.classes = [];\r\n }\r\n }\r\n else{\r\n out.classes = actionArr(param);\r\n }\r\n return true;\r\n }\r\n return false;\r\n}\r\n\r\nfunction extend(value, param, actionStr, actionArr, actionObj, isRemoveEmptyClasses){\r\n var success = extendClasses(value, param, actionStr, actionArr, isRemoveEmptyClasses);\r\n if (success === false){\r\n if (param instanceof Object){\r\n var {classes, styles} = param;\r\n extendClasses(value, classes, actionStr, actionArr, isRemoveEmptyClasses);\r\n \r\n if (styles) {\r\n value.styles = actionObj(styles);\r\n } else if (!classes) {\r\n value.styles = actionObj(param)\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport function Styling(param){\r\n var value = {classes:[], styles:{}};\r\n if (param){\r\n extend(value, param, a=>a, a=>a.slice(), o=>shallowClearClone(o), true);\r\n }\r\n return Object.freeze(value);\r\n}\r\n\r\nfunction createStyling(isReplace, param, ...params){\r\n var value = {classes:[], styles:{}};\r\n if (param){\r\n extend(value, param, a=>a, a=>a.slice(), o=>shallowClearClone(o),true);\r\n if (params){\r\n var {classes, styles} = value;\r\n var extendInt = isReplace? (p)=>extend(value, p, s=>s, a=>a.slice(), o=> shallowClearClone(styles, o),true):\r\n (p)=>extend(value, p, a=>classes.concat(a), a=>classes.concat(a), o=>shallowClearClone(styles, o),false)\r\n params.forEach(p=> extendInt(p));\r\n }\r\n }\r\n return Styling(value);\r\n}\r\n\r\nexport function createCss(stylings1, stylings2){\r\n var destination = {};\r\n for (let property in stylings1) {\r\n let param1 = stylings1[property];\r\n\r\n let param2 = stylings2?stylings2[property]:undefined;\r\n if (param2===undefined)\r\n destination[property] = Styling(param1)\r\n else{\r\n destination[property] = createStyling(true, param1, param2); \r\n }\r\n }\r\n if (stylings2)\r\n for (let property in stylings2) {\r\n if (!stylings1[property])\r\n destination[property] = Styling(stylings2[property])\r\n }\r\n return destination;\r\n}\r\n\r\nexport function extendCss(stylings1, stylings2){\r\n for (let property in stylings2) {\r\n let param2 = stylings2[property];\r\n let param1 = stylings1[property];\r\n if (param1 === undefined)\r\n stylings1[property] = Styling(param2)\r\n else{\r\n stylings1[property] = createStyling(false, param1, param2); \r\n }\r\n }\r\n}","export function NavigateManager(\r\n list, getPrev, getNext\r\n){\r\n return {\r\n navigate(down, wrap /* hoveredChoice */){ \r\n if (down) {\r\n return wrap?getNext(wrap): list.getHead();\r\n } else {\r\n return wrap?getPrev(wrap): list.getTail();\r\n }\r\n },\r\n getCount(){\r\n return list.getCount()\r\n },\r\n getHead(){\r\n return list.getHead()\r\n }\r\n }\r\n}\r\n\r\nexport function FilterPredicateAspect(){\r\n return {\r\n filterPredicate: (wrap, text) => \r\n wrap.choice.searchText.indexOf(text) >= 0 \r\n }\r\n}\r\n\r\nexport function FilterManagerAspect(\r\n emptyNavigateManager,\r\n filteredNavigateManager,\r\n filteredChoicesList, \r\n choicesEnumerableAspect,\r\n filterPredicateAspect\r\n ) {\r\n let showEmptyFilter=true;\r\n let filterText = \"\";\r\n return {\r\n getNavigateManager(){\r\n return (showEmptyFilter)?emptyNavigateManager:filteredNavigateManager;\r\n },\r\n processEmptyInput(){ // redefined in PlaceholderPulgin, HighlightPlugin\r\n showEmptyFilter =true;\r\n filterText =\"\";\r\n choicesEnumerableAspect.forEach( (wrap)=>{\r\n wrap.choice.setVisible(true);\r\n });\r\n },\r\n getFilter(){\r\n return filterText;\r\n },\r\n setFilter(text){ // redefined in HighlightPlugin\r\n showEmptyFilter =false;\r\n filterText = text;\r\n filteredChoicesList.reset();\r\n choicesEnumerableAspect.forEach( (wrap)=>{\r\n wrap.choice.filteredPrev = wrap.choice.filteredNext = null;\r\n var v = filterPredicateAspect.filterPredicate(wrap, text)\r\n if (v)\r\n filteredChoicesList.add(wrap);\r\n wrap.choice.setVisible(v);\r\n });\r\n }\r\n }\r\n}\r\n\r\n\r\n","export function Wraps(wrapsCollection, \r\n listFacade_reset, listFacade_remove, listFacade_add) \r\n{\r\n return {\r\n push: (wrap) => push(wrap, wrapsCollection, listFacade_add),\r\n insert: (key, wrap) => insert(key, wrap, wrapsCollection, listFacade_add),\r\n remove: (key) => {\r\n var wrap = wrapsCollection.remove(key);\r\n listFacade_remove(wrap);\r\n return wrap;\r\n },\r\n clear: () => {\r\n wrapsCollection.reset();\r\n listFacade_reset();\r\n }, \r\n dispose: () => wrapsCollection.forLoop(wrap => wrap.dispose()) \r\n }\r\n}\r\n\r\nfunction push(wrap, wrapsCollection, listFacade_add){\r\n wrapsCollection.push(wrap);\r\n listFacade_add(wrap);\r\n}\r\n\r\nfunction insert(key, wrap, wrapsCollection, listFacade_add){\r\n if (key>=wrapsCollection.getCount()) {\r\n push(wrap, wrapsCollection, listFacade_add);\r\n }\r\n else {\r\n wrapsCollection.add(wrap, key);\r\n listFacade_add(wrap, key);\r\n }\r\n}","import {composeSync} from './ToolsJs';\r\nimport {EventBinder, EventLoopFlag, containsAndSelf} from './ToolsDom'\r\n\r\nexport function MultiSelectInlineLayout (\r\n aspects\r\n ) \r\n{\r\n let {environment,filterDom,picksDom,choicesDom, \r\n choicesVisibilityAspect, \r\n hoveredChoiceAspect, navigateAspect,filterManagerAspect,\r\n focusInAspect, optionToggleAspect,\r\n createPickHandlersAspect,\r\n picksList,\r\n inputAspect, specialPicksEventsAspect, buildChoiceAspect, \r\n setDisabledComponentAspect, resetLayoutAspect, placeholderStopInputAspect,\r\n warningAspect,\r\n configuration,\r\n createPopperAspect, rtlAspect, staticManager\r\n } = aspects;\r\n\r\n let picksElement = picksDom.picksElement;\r\n let choicesElement = choicesDom.choicesElement;\r\n\r\n // pop up layout, require createPopperPlugin\r\n let filterInputElement = filterDom.filterInputElement;\r\n let pop = createPopperAspect.create(choicesElement, filterInputElement, true);\r\n staticManager.appendToContainer = composeSync(staticManager.appendToContainer, pop.init);\r\n var origBackSpace = specialPicksEventsAspect.backSpace;\r\n specialPicksEventsAspect.backSpace = (pick) => { origBackSpace(pick); pop.update();};\r\n if (rtlAspect){\r\n let origUpdateRtl = rtlAspect.updateRtl;\r\n rtlAspect.updateRtl = (isRtl) => {\r\n origUpdateRtl(isRtl); \r\n pop.setRtl(isRtl);\r\n };\r\n }\r\n choicesVisibilityAspect.updatePopupLocation = composeSync(choicesVisibilityAspect.updatePopupLocation, \r\n function(){pop.update();}\r\n )\r\n\r\n if (warningAspect) {\r\n let pop2 = createPopperAspect.create(warningAspect.warningElement, filterInputElement, false);\r\n staticManager.appendToContainer = composeSync(staticManager.appendToContainer, pop2.init);\r\n if (rtlAspect){\r\n let origUpdateRtl2 = rtlAspect.updateRtl;\r\n rtlAspect.updateRtl = (isRtl) => {\r\n origUpdateRtl2(isRtl); \r\n pop2.setRtl(isRtl);\r\n };\r\n }\r\n var origWarningAspectShow =warningAspect.show;\r\n warningAspect.show = (msg) => {\r\n pop2.update();\r\n origWarningAspectShow(msg);\r\n }\r\n pop.dispose = composeSync(pop.dispose, pop2.dispose);\r\n }\r\n\r\n var window = environment.window;\r\n var document = window.document;\r\n var eventLoopFlag = EventLoopFlag(window); \r\n \r\n var skipFocusout = false;\r\n \r\n function getSkipFocusout() {\r\n return skipFocusout;\r\n };\r\n function resetSkipFocusout() {\r\n skipFocusout = false;\r\n };\r\n function setSkipFocusout() {\r\n skipFocusout = true;\r\n };\r\n\r\n // we want to escape the closing of the menu (because of focus out from) on a user's click inside the container\r\n var skipoutMousedown = function() {\r\n setSkipFocusout();\r\n }\r\n\r\n var documentMouseup = function(event) {\r\n // if we would left without focus then \"close the drop\" do not remove focus border\r\n if (choicesElement == event.target) \r\n filterDom.setFocus()\r\n\r\n // if click outside container - close dropdown\r\n else if ( !containsAndSelf(choicesElement, event.target) && !containsAndSelf(picksElement, event.target)) {\r\n resetLayoutAspect.resetLayout();\r\n focusInAspect.setFocusIn(false);\r\n }\r\n }\r\n\r\n function showChoices() {\r\n if ( !choicesVisibilityAspect.isChoicesVisible() )\r\n {\r\n choicesVisibilityAspect.updatePopupLocation();\r\n eventLoopFlag.set();\r\n choicesVisibilityAspect.setChoicesVisible(true);\r\n \r\n // add listeners that manages close dropdown on click outside container\r\n choicesElement.addEventListener(\"mousedown\", skipoutMousedown);\r\n document.addEventListener(\"mouseup\", documentMouseup);\r\n }\r\n }\r\n\r\n function hideChoices() {\r\n resetMouseCandidateChoice();\r\n hoveredChoiceAspect.resetHoveredChoice();\r\n if (choicesVisibilityAspect.isChoicesVisible())\r\n {\r\n // COOMENT OUT DEBUGGING popup layout\r\n choicesVisibilityAspect.setChoicesVisible(false);\r\n \r\n choicesElement.removeEventListener(\"mousedown\", skipoutMousedown);\r\n document.removeEventListener(\"mouseup\", documentMouseup);\r\n }\r\n }\r\n\r\n var preventDefaultClickEvent = null;\r\n\r\n var componentDisabledEventBinder = EventBinder();\r\n\r\n\r\n // TODO: remove setTimeout: set on start of mouse event reset on end\r\n function skipoutAndResetMousedown(){\r\n skipoutMousedown();\r\n window.setTimeout(()=>resetSkipFocusout());\r\n }\r\n picksElement.addEventListener(\"mousedown\", skipoutAndResetMousedown);\r\n\r\n function clickToShowChoices(event){\r\n filterDom.setFocusIfNotTarget(event.target);\r\n if (preventDefaultClickEvent != event) {\r\n if (choicesVisibilityAspect.isChoicesVisible()){\r\n hideChoices() \r\n } else {\r\n if (filterManagerAspect.getNavigateManager().getCount()>0)\r\n showChoices();\r\n }\r\n }\r\n preventDefaultClickEvent=null;\r\n }\r\n\r\n function processUncheck(uncheckOption, event){\r\n // we can't remove item on \"click\" in the same loop iteration - it is unfrendly for 3PP event handlers (they will get detached element)\r\n // never remove elements in the same event iteration\r\n window.setTimeout(()=>uncheckOption())\r\n preventDefaultClickEvent = event; // setPreventDefaultMultiSelectEvent\r\n }\r\n\r\n // function handleOnRemoveButton(onRemove, setSelectedFalse){\r\n // // processRemoveButtonClick removes the item\r\n // // what is a problem with calling 'remove' directly (not using setTimeout('remove', 0)):\r\n // // consider situation \"MultiSelect\" on DROPDOWN (that should be closed on the click outside dropdown)\r\n // // therefore we aslo have document's click's handler where we decide to close or leave the DROPDOWN open.\r\n // // because of the event's bubling process 'remove' runs first. \r\n // // that means the event's target element on which we click (the x button) will be removed from the DOM together with badge \r\n // // before we could analize is it belong to our dropdown or not.\r\n // // important 1: we can't just the stop propogation using stopPropogate because click outside dropdown on the similar \r\n // // component that use stopPropogation will not close dropdown (error, dropdown should be closed)\r\n // // important 2: we can't change the dropdown's event handler to leave dropdown open if event's target is null because of\r\n // // the situation described above: click outside dropdown on the same component.\r\n // // Alternatively it could be possible to use stopPropogate but together create custom click event setting new target \r\n // // that belomgs to DOM (e.g. panel)\r\n\r\n\r\n // onRemove(event => {\r\n // processUncheck(setSelectedFalse, event);\r\n // hideChoices();\r\n // resetFilterAspect.resetFilter(); \r\n // });\r\n // }\r\n \r\n function handleOnRemoveButton(setSelectedFalse){ return (event) => {\r\n processUncheck(setSelectedFalse, event);\r\n resetLayoutAspect.resetLayout(); \r\n }}\r\n \r\n let mouseCandidateEventBinder = EventBinder();\r\n var resetMouseCandidateChoice = () => {\r\n mouseCandidateEventBinder.unbind();\r\n };\r\n\r\n var mouseOverToHoveredAndReset = (wrap) => {\r\n if (!wrap.choice.isHoverIn)\r\n navigateAspect.hoverIn(wrap);\r\n resetMouseCandidateChoice();\r\n };\r\n \r\n function adoptChoiceElement(wrap){\r\n let choiceElement = wrap.choice.choiceElement;\r\n // in chrome it happens on \"become visible\" so we need to skip it, \r\n // for IE11 and edge it doesn't happens, but for IE11 and Edge it doesn't happens on small \r\n // mouse moves inside the item. \r\n // https://stackoverflow.com/questions/59022563/browser-events-mouseover-doesnt-happen-when-you-make-element-visible-and-mous\r\n \r\n var onChoiceElementMouseover = () => \r\n {\r\n if (eventLoopFlag.get())\r\n {\r\n resetMouseCandidateChoice();\r\n mouseCandidateEventBinder.bind(choiceElement, 'mousemove', ()=>mouseOverToHoveredAndReset(wrap));\r\n mouseCandidateEventBinder.bind(choiceElement, 'mousedown', ()=>mouseOverToHoveredAndReset(wrap));\r\n }\r\n else\r\n {\r\n if (!wrap.choice.isHoverIn)\r\n {\r\n // NOTE: mouseleave is not enough to guarantee remove hover styles in situations\r\n // when style was setuped without mouse (keyboard arrows)\r\n // therefore force reset manually (done inside hoverIn)\r\n navigateAspect.hoverIn(wrap);\r\n } \r\n }\r\n }\r\n \r\n // note 1: mouseleave preferred to mouseout - which fires on each descendant\r\n // note 2: since I want add aditional info panels to the dropdown put mouseleave on dropdwon would not work\r\n var onChoiceElementMouseleave = () => {\r\n if (!eventLoopFlag.get()) {\r\n hoveredChoiceAspect.resetHoveredChoice();\r\n }\r\n }\r\n var overAndLeaveEventBinder = EventBinder();\r\n overAndLeaveEventBinder.bind(choiceElement, 'mouseover', onChoiceElementMouseover);\r\n overAndLeaveEventBinder.bind(choiceElement, 'mouseleave', onChoiceElementMouseleave);\r\n\r\n return overAndLeaveEventBinder.unbind;\r\n }\r\n\r\n \r\n filterDom.onFocusIn(()=>focusInAspect.setFocusIn(true));\r\n filterDom.onFocusOut(() => { \r\n if (!getSkipFocusout()){ // skip initiated by mouse click (we manage it different way)\r\n resetLayoutAspect.resetLayout(); // if do not do this we will return to filtered list without text filter in input\r\n focusInAspect.setFocusIn(false);\r\n }\r\n resetSkipFocusout();\r\n }\r\n );\r\n\r\n // it can be initated by 3PP functionality\r\n // sample (1) BS functionality - input x button click - clears input\r\n // sample (2) BS functionality - esc keydown - clears input\r\n // and there could be difference in processing: (2) should hide the menu, then reset , when (1) should just reset without hiding.\r\n\r\n function afterInput(){\r\n let visibleCount = filterManagerAspect.getNavigateManager().getCount();\r\n\r\n if (visibleCount > 0){\r\n if (warningAspect){\r\n warningAspect.hide();\r\n }\r\n let panelIsVisble = choicesVisibilityAspect.isChoicesVisible();\r\n if (!panelIsVisble){\r\n showChoices(); \r\n }\r\n if (visibleCount == 1){\r\n navigateAspect.hoverIn(filterManagerAspect.getNavigateManager().getHead())\r\n }else{\r\n if (panelIsVisble)\r\n hoveredChoiceAspect.resetHoveredChoice();\r\n } \r\n }else{\r\n if (choicesVisibilityAspect.isChoicesVisible()){\r\n hideChoices();\r\n }\r\n if (warningAspect){\r\n if (filterManagerAspect.getFilter())\r\n warningAspect.show(configuration.noResultsWarning);\r\n else\r\n warningAspect.hide();\r\n } \r\n }\r\n }\r\n\r\n filterDom.onInput(() => {\r\n if (placeholderStopInputAspect && placeholderStopInputAspect.get()){\r\n placeholderStopInputAspect.reset();\r\n return; \r\n }\r\n let {filterInputValue, isEmpty} = inputAspect.processInput();\r\n if (isEmpty)\r\n filterManagerAspect.processEmptyInput();\r\n else\r\n filterDom.setWidth(filterInputValue); \r\n\r\n eventLoopFlag.set(); // means disable some mouse handlers; otherwise we will get \"Hover On MouseEnter\" when filter's changes should remove hover\r\n afterInput();\r\n });\r\n\r\n function keyDownArrow(down) {\r\n let wrap = navigateAspect.navigate(down); \r\n if (wrap)\r\n {\r\n navigateAspect.hoverIn(wrap); // !\r\n showChoices(); // !\r\n }\r\n }\r\n\r\n function hoveredToSelected(){\r\n let hoveredWrap = hoveredChoiceAspect.getHoveredChoice(); \r\n if (hoveredWrap){\r\n let wasToggled = optionToggleAspect.toggle(hoveredWrap); \r\n if (wasToggled) {\r\n resetLayoutAspect.resetLayout();\r\n }\r\n }\r\n }\r\n\r\n // TODO: bind it more declarative way? (compact code)\r\n var onKeyDown = (event) => {\r\n let keyCode = event.which;\r\n var empty = filterDom.isEmpty();\r\n if ([ 13,\r\n 27 // '27-esc' there is \"just in case\", I can imagine that there are user agents that do UNDO\r\n ].indexOf(keyCode)>=0 \r\n || (keyCode == 9 && !empty) // otherwice there are no keyup (true at least for '9-tab'),\r\n ) {\r\n event.preventDefault(); \r\n \r\n // '13-enter' - prevention against form's default button \r\n // but doesn't help with bootsrap modal ESC or ENTER (close behaviour);\r\n }\r\n if ([ 38, 40 ].indexOf(keyCode) >= 0 )\r\n event.preventDefault(); \r\n if (keyCode == 8 /*backspace*/) {\r\n // NOTE: this will process backspace only if there are no text in the input field\r\n // If user will find this inconvinient, we will need to calculate something like this\r\n // let isBackspaceAtStartPoint = (this.filterInput.selectionStart == 0 && this.filterInput.selectionEnd == 0);\r\n if (empty) {\r\n let pick = picksList.getTail();\r\n if (pick){ \r\n specialPicksEventsAspect.backSpace(pick);\r\n }\r\n }\r\n }\r\n // ---------------------------------------------------------------------------------\r\n // NOTE: no preventDefault called in case of empty for 9-tab\r\n else if (keyCode == 9 /*tab*/) { // NOTE: no keydown for this (without preventDefaul after TAB keyup event will be targeted another element) \r\n if (empty) { \r\n hideChoices(); // hideChoices inside (and no filter reset since it is empty) \r\n }\r\n }\r\n else if (keyCode == 27 /*esc*/ ) { // NOTE: forbid the ESC to close the modal (in case the nonempty or dropdown is open)\r\n if (!empty || choicesVisibilityAspect.isChoicesVisible())\r\n event.stopPropagation()\r\n }\r\n else if (keyCode == 38) {\r\n keyDownArrow(false); // up\r\n }\r\n else if (keyCode == 40) {\r\n keyDownArrow(true); // down\r\n }\r\n }\r\n var onKeyUp = (event) => {\r\n let keyCode = event.which;\r\n //var handler = keyUp[event.which/* key code */];\r\n //handler(); \r\n if (keyCode == 9) {\r\n if (choicesVisibilityAspect.isChoicesVisible()) {\r\n hoveredToSelected();\r\n } \r\n }\r\n else if (keyCode == 13 ) {\r\n if (choicesVisibilityAspect.isChoicesVisible()) {\r\n hoveredToSelected();\r\n } else {\r\n if (filterManagerAspect.getNavigateManager().getCount()>0){\r\n showChoices();\r\n }\r\n }\r\n }\r\n else if (keyCode == 27) { // escape\r\n // is it always empty (bs x can still it) \r\n resetLayoutAspect.resetLayout();\r\n }\r\n }\r\n\r\n filterDom.onKeyDown(onKeyDown); \r\n filterDom.onKeyUp(onKeyUp);\r\n\r\n let origSetDisabledComponent = setDisabledComponentAspect.setDisabledComponent; \r\n setDisabledComponentAspect.setDisabledComponent = (isComponentDisabled) => {\r\n origSetDisabledComponent(isComponentDisabled);\r\n if (isComponentDisabled)\r\n componentDisabledEventBinder.unbind();\r\n else\r\n componentDisabledEventBinder.bind(picksElement, \"click\", clickToShowChoices); \r\n }\r\n\r\n resetLayoutAspect.resetLayout = composeSync(\r\n hideChoices,\r\n ()=>{if (warningAspect)\r\n warningAspect.hide();},\r\n resetLayoutAspect.resetLayout // resetFilter by default\r\n );\r\n\r\n let origCreatePickHandlers = createPickHandlersAspect.createPickHandlers;\r\n createPickHandlersAspect.createPickHandlers = (wrap) => {\r\n let pickHandlers = origCreatePickHandlers(wrap);\r\n pickHandlers.removeOnButton = handleOnRemoveButton(pickHandlers.removeOnButton);\r\n return pickHandlers;\r\n } \r\n\r\n let origBuildChoice = buildChoiceAspect.buildChoice;\r\n buildChoiceAspect.buildChoice = (wrap) => {\r\n origBuildChoice(wrap);\r\n let pickHandlers = createPickHandlersAspect.createPickHandlers(wrap);\r\n\r\n wrap.choice.remove = composeSync(wrap.choice.remove, () => {\r\n if (pickHandlers.removeAndDispose) {\r\n pickHandlers.removeAndDispose();\r\n pickHandlers.removeAndDispose=null;\r\n }\r\n })\r\n \r\n let unbindChoiceElement = adoptChoiceElement(wrap);\r\n wrap.choice.dispose = composeSync(unbindChoiceElement, wrap.choice.dispose);\r\n }\r\n\r\n return {\r\n dispose(){\r\n resetMouseCandidateChoice();\r\n picksElement.removeEventListener(\"mousedown\", skipoutAndResetMousedown);\r\n componentDisabledEventBinder.unbind();\r\n pop.dispose(); \r\n }\r\n }\r\n}\r\n","import {PluginManager, plugStaticDom} from './PluginManager'\r\n\r\nimport {composeSync, List, extendIfUndefined} from './ToolsJs';\r\nimport {PickDomFactory} from './PickDomFactory';\r\nimport {ChoiceDomFactory} from './ChoiceDomFactory';\r\n\r\nimport {StaticDomFactory, CreateElementAspect} from './StaticDomFactory';\r\n\r\nimport {PicksDom} from './PicksDom';\r\nimport {FilterDom} from './FilterDom';\r\n\r\nimport {ChoicesDomFactory} from './ChoicesDomFactory';\r\nimport {ChoicesVisibilityAspect} from './ChoicesVisibilityAspect';\r\nimport {SpecialPicksEventsAspect} from './SpecialPicksEventsAspect';\r\n \r\nimport {ComponentPropertiesAspect, TriggerAspect, OnChangeAspect} from './ComponentPropertiesAspect';\r\nimport {OptionsAspect, OptionPropertiesAspect} from './OptionsAspect';\r\n\r\nimport {ChoicesEnumerableAspect } from './ChoicesEnumerableAspect'\r\nimport {FilterManagerAspect, NavigateManager, FilterPredicateAspect} from './FilterManagerAspect'\r\nimport {BuildAndAttachChoiceAspect, BuildChoiceAspect} from './BuildChoiceAspect'\r\nimport {FillChoicesAspect} from './FillChoicesAspect'\r\n\r\nimport {UpdateDataAspect } from './UpdateDataAspect'\r\nimport {CreateWrapAspect, CreateChoiceBaseAspect, OptionToggleAspect, CreatePickHandlersAspect, RemovePickAspect, \r\n AddPickAspect, FullMatchAspect, ChoiceClickAspect, IsChoiceSelectableAspect, ProducePickAspect} from './CreateWrapAspect.js'\r\nimport {NavigateAspect, HoveredChoiceAspect} from './NavigateAspect'\r\nimport {Wraps} from './Wraps'\r\n\r\n\r\nimport {PickButtonAspect} from './PickButtonAspect'\r\n\r\nimport {BuildPickAspect} from './BuildPickAspect'\r\nimport {InputAspect} from './InputAspect'\r\nimport {ResetFilterAspect, FocusInAspect, ResetFilterListAspect} from './ResetFilterListAspect'\r\n\r\nimport {MultiSelectInlineLayout} from './MultiSelectInlineLayout'\r\n\r\nimport {SetDisabledComponentAspect, UpdateDisabledComponentAspect, LoadAspect, AppearanceAspect, ResetLayoutAspect} from './AppearanceAspect'\r\nimport {DoublyLinkedList, ArrayFacade} from './ToolsJs'\r\nimport {CountableChoicesListInsertAspect} from './CountableChoicesListInsertAspect'\r\n\r\n/// environment - common for many; configuration for concreate\r\nexport function BsMultiSelect(element, environment, plugins, configuration, onInit){\r\n var {window} = environment;\r\n environment.isIE11 = !!window.MSInputMethodContext && !!document.documentMode;\r\n\r\n let { containerClass,\r\n css, \r\n getDisabled,\r\n options, \r\n getText\r\n } = configuration;\r\n \r\n let disposeAspect = {};\r\n let triggerAspect = TriggerAspect(element, environment.trigger);\r\n let onChangeAspect = OnChangeAspect(triggerAspect, 'dashboardcode.multiselect:change');\r\n let componentPropertiesAspect = ComponentPropertiesAspect(getDisabled??(() => false));\r\n let optionsAspect = OptionsAspect(options); \r\n let optionPropertiesAspect = OptionPropertiesAspect(getText);\r\n let isChoiceSelectableAspect = IsChoiceSelectableAspect();\r\n let createWrapAspect = CreateWrapAspect();\r\n let createChoiceBaseAspect = CreateChoiceBaseAspect(optionPropertiesAspect);\r\n //let rtlAspect = RtlAspect();\r\n //let setOptionSelectedAspect = SetOptionSelectedAspect(optionPropertiesAspect);\r\n \r\n let addPickAspect = AddPickAspect();\r\n let removePickAspect = RemovePickAspect();\r\n \r\n let createElementAspect = CreateElementAspect(name => window.document.createElement(name));\r\n \r\n let choicesDomFactory = ChoicesDomFactory(createElementAspect);\r\n let staticDomFactory = StaticDomFactory(choicesDomFactory, createElementAspect);\r\n \r\n let wrapsCollection = ArrayFacade();\r\n \r\n let countableChoicesList = DoublyLinkedList(\r\n (wrap)=>wrap.choice.itemPrev, \r\n (warp, v)=>warp.choice.itemPrev=v, \r\n (wrap)=>wrap.choice.itemNext, \r\n (wrap, v)=>wrap.choice.itemNext=v\r\n );\r\n \r\n let countableChoicesListInsertAspect = CountableChoicesListInsertAspect(countableChoicesList, wrapsCollection);\r\n\r\n let choicesEnumerableAspect = ChoicesEnumerableAspect(countableChoicesList, wrap=>wrap.choice.itemNext)\r\n \r\n let filteredChoicesList = DoublyLinkedList(\r\n (wrap)=>wrap.choice.filteredPrev, \r\n (wrap, v)=>wrap.choice.filteredPrev=v, \r\n (wrap)=>wrap.choice.filteredNext, \r\n (wrap, v)=>wrap.choice.filteredNext=v\r\n );\r\n \r\n let emptyNavigateManager = NavigateManager(\r\n countableChoicesList,\r\n (wrap)=>wrap.choice.itemPrev,\r\n (wrap)=>wrap.choice.itemNext \r\n \r\n ); \r\n let filteredNavigateManager = NavigateManager(\r\n filteredChoicesList, \r\n (wrap)=>wrap.choice.filteredPrev,\r\n (wrap)=>wrap.choice.filteredNext ); \r\n\r\n let filterPredicateAspect = FilterPredicateAspect()\r\n\r\n let filterManagerAspect = FilterManagerAspect(\r\n emptyNavigateManager,\r\n filteredNavigateManager,\r\n \r\n filteredChoicesList, \r\n choicesEnumerableAspect,\r\n filterPredicateAspect\r\n );\r\n\r\n let hoveredChoiceAspect = HoveredChoiceAspect()\r\n let navigateAspect = NavigateAspect(hoveredChoiceAspect, \r\n (down, hoveredChoice)=>filterManagerAspect.getNavigateManager().navigate(down, hoveredChoice));\r\n let picksList = List();\r\n let wraps = Wraps(\r\n wrapsCollection,\r\n ()=>countableChoicesList.reset(), \r\n (w)=>countableChoicesList.remove(w),\r\n (w, key)=>countableChoicesListInsertAspect.countableChoicesListInsert(w, key));\r\n\r\n let aspects = {\r\n environment, configuration, triggerAspect, onChangeAspect, componentPropertiesAspect, disposeAspect, \r\n countableChoicesList, countableChoicesListInsertAspect,\r\n optionsAspect, optionPropertiesAspect, \r\n createWrapAspect, createChoiceBaseAspect, isChoiceSelectableAspect, \r\n createElementAspect,\r\n choicesDomFactory, staticDomFactory,\r\n filterPredicateAspect, wrapsCollection, choicesEnumerableAspect, \r\n filteredChoicesList, filterManagerAspect, hoveredChoiceAspect, navigateAspect, picksList, wraps,\r\n addPickAspect, removePickAspect\r\n }\r\n\r\n plugStaticDom(plugins, aspects); // apply cssPatch to css, apply selectElement support; \r\n\r\n let {choicesDom, createStaticDom} = staticDomFactory.create(css)\r\n\r\n let {staticDom, staticManager} = createStaticDom(element, containerClass)\r\n\r\n // after this we can use staticDom in construtctor, this simplifies parameters passing a lot \r\n\r\n let filterDom = FilterDom(staticDom.disposablePicksElement, createElementAspect, css);\r\n let specialPicksEventsAspect = SpecialPicksEventsAspect();\r\n\r\n let choicesVisibilityAspect = ChoicesVisibilityAspect(choicesDom.choicesElement);\r\n let resetFilterListAspect = ResetFilterListAspect(filterDom, filterManagerAspect)\r\n let resetFilterAspect = ResetFilterAspect(filterDom, resetFilterListAspect)\r\n \r\n\r\n // TODO get picksDom from staticDomFactory\r\n let picksDom = PicksDom(staticDom.picksElement, staticDom.disposablePicksElement, createElementAspect, css);\r\n let focusInAspect = FocusInAspect(picksDom);\r\n \r\n let pickButtonAspect = PickButtonAspect(configuration.pickButtonHTML);\r\n \r\n let pickDomFactory = PickDomFactory(css, componentPropertiesAspect, optionPropertiesAspect, pickButtonAspect);\r\n let buildPickAspect = BuildPickAspect(picksDom, pickDomFactory);\r\n let producePickAspect = ProducePickAspect(picksList, removePickAspect, buildPickAspect)\r\n let createPickHandlersAspect = CreatePickHandlersAspect(producePickAspect);\r\n \r\n \r\n let optionToggleAspect = OptionToggleAspect(createPickHandlersAspect, addPickAspect);\r\n let fullMatchAspect = FullMatchAspect(createPickHandlersAspect, addPickAspect);\r\n let inputAspect = InputAspect(filterDom, filterManagerAspect, fullMatchAspect); \r\n\r\n let choiceClickAspect = ChoiceClickAspect(optionToggleAspect, filterDom);\r\n\r\n let choiceDomFactory = ChoiceDomFactory(css, optionPropertiesAspect, aspects.highlightAspect); // optional highlightAspect added by highlightPlugin\r\n \r\n let buildChoiceAspect = BuildChoiceAspect( choicesDom, choiceDomFactory, choiceClickAspect);\r\n let buildAndAttachChoiceAspect = BuildAndAttachChoiceAspect(buildChoiceAspect);\r\n let resetLayoutAspect = ResetLayoutAspect(() => resetFilterAspect.resetFilter());\r\n\r\n let setDisabledComponentAspect = SetDisabledComponentAspect(picksList, picksDom);\r\n let updateDisabledComponentAspect = UpdateDisabledComponentAspect(componentPropertiesAspect,setDisabledComponentAspect );\r\n let appearanceAspect = AppearanceAspect(updateDisabledComponentAspect);\r\n \r\n let fillChoicesAspect = FillChoicesAspect(\r\n window.document, createWrapAspect, createChoiceBaseAspect, optionsAspect, wraps, buildAndAttachChoiceAspect );\r\n let loadAspect = LoadAspect(fillChoicesAspect, appearanceAspect);\r\n let updateDataAspect = UpdateDataAspect(choicesDom, wraps, picksList, fillChoicesAspect, resetLayoutAspect);\r\n\r\n extendIfUndefined(aspects, {\r\n staticDom, picksDom, choicesDom,filterDom, resetLayoutAspect, pickDomFactory, choiceDomFactory,\r\n choicesVisibilityAspect, staticManager, buildChoiceAspect, optionToggleAspect, choiceClickAspect, \r\n buildAndAttachChoiceAspect , fillChoicesAspect, \r\n buildPickAspect, producePickAspect, createPickHandlersAspect, inputAspect, resetFilterListAspect, resetFilterAspect, \r\n specialPicksEventsAspect,\r\n resetLayoutAspect, focusInAspect, \r\n updateDisabledComponentAspect, setDisabledComponentAspect, appearanceAspect, loadAspect,\r\n updateDataAspect , fullMatchAspect} )\r\n \r\n let pluginManager = PluginManager(plugins, aspects);\r\n \r\n let multiSelectInlineLayout = MultiSelectInlineLayout(aspects);\r\n\r\n let api = {component: \"BsMultiSelect.api\"} // key used in memory leak analyzes\r\n \r\n pluginManager.buildApi(api);\r\n // after this we can pass aspects methods call without wrapping - there should be no more overridings. TODO freeze aspects?\r\n api.dispose = composeSync(\r\n resetLayoutAspect.resetLayout,\r\n disposeAspect.dispose,\r\n pluginManager.dispose, \r\n ()=>{picksList.forEach(pick=>pick.dispose());},\r\n multiSelectInlineLayout.dispose, // TODO move to layout\r\n wraps.dispose,\r\n staticManager.dispose, picksDom.dispose, filterDom.dispose );\r\n \r\n api.updateAppearance = appearanceAspect.updateAppearance;\r\n api.updateData = updateDataAspect.updateData;\r\n api.update = () => {\r\n updateDataAspect.updateData();\r\n appearanceAspect.updateAppearance();\r\n }\r\n\r\n api.updateDisabled = updateDisabledComponentAspect.updateDisabledComponent;\r\n // TODO api.updateOption = (key) => {/* all updates: selected, disabled, hidden, text */}\r\n\r\n onInit?.(api, aspects);\r\n picksDom.pickFilterElement.appendChild(filterDom.filterInputElement);\r\n picksDom.picksElement.appendChild(picksDom.pickFilterElement); \r\n staticManager.appendToContainer();\r\n// popupAspect.init();\r\n loadAspect.load();\r\n \r\n return api;\r\n}\r\n","export function HoveredChoiceAspect(){\r\n let hoveredChoice=null;\r\n return {\r\n getHoveredChoice: () => hoveredChoice,\r\n setHoveredChoice: (wrap) => {hoveredChoice = wrap},\r\n resetHoveredChoice() {\r\n if (hoveredChoice) {\r\n hoveredChoice.choice.setHoverIn(false)\r\n hoveredChoice = null;\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport function NavigateAspect(hoveredChoiceAspect, navigate){\r\n return {\r\n hoverIn(wrap){\r\n hoveredChoiceAspect.resetHoveredChoice(); \r\n hoveredChoiceAspect.setHoveredChoice(wrap);\r\n wrap.choice.setHoverIn(true);\r\n },\r\n navigate: (down) => navigate(down, hoveredChoiceAspect.getHoveredChoice()), \r\n }\r\n}","export function TriggerAspect(element, trigger) {\r\n return {\r\n trigger: (eventName) => {\r\n trigger(element, eventName)\r\n }\r\n }\r\n}\r\n\r\nexport function OnChangeAspect(triggerAspect, name) {\r\n return {\r\n onChange(){\r\n triggerAspect.trigger(name)\r\n }\r\n }\r\n}\r\n\r\nexport function ComponentPropertiesAspect(getDisabled) {\r\n return {\r\n getDisabled\r\n }\r\n}\r\n\r\n","export function OptionsAspect(options){\r\n return {\r\n getOptions : () => options\r\n }\r\n}\r\n\r\nexport function OptionPropertiesAspect(getText){\r\n if (!getText){\r\n getText = (option) => option.text;\r\n }\r\n return {\r\n getText\r\n }\r\n}\r\n","import {composeSync} from './ToolsJs';\r\n\r\nexport function IsChoiceSelectableAspect(){ // TODO rename to IsSelectableByUserAspect ?\r\n return {\r\n isSelectable: (wrap)=>true \r\n }\r\n}\r\n\r\n// todo: remove?\r\nexport function ChoiceClickAspect(optionToggleAspect, filterDom){\r\n return {\r\n choiceClick: (wrap) => {\r\n optionToggleAspect.toggle(wrap);\r\n filterDom.setFocus();\r\n }\r\n }\r\n}\r\n\r\n// // fullMatchAspect trySetWrapSelected(fullMatchWrap.option, composeUpdateSelected(fullMatchWrap, true), true);\r\n\r\nexport function OptionToggleAspect(createPickHandlersAspect, addPickAspect /*, setOptionSelectedAspect*/){\r\n return {\r\n toggle: (wrap) => {\r\n let pickHandlers = createPickHandlersAspect.createPickHandlers(wrap);\r\n addPickAspect.addPick(wrap, pickHandlers);\r\n return true; // TODO: process setOptionSelectedAspect\r\n }\r\n }\r\n}\r\n\r\nexport function AddPickAspect(){\r\n return {\r\n addPick(wrap, pickHandlers){\r\n return pickHandlers.producePick();\r\n }\r\n }\r\n}\r\n\r\nexport function FullMatchAspect(createPickHandlersAspect, addPickAspect){\r\n return {\r\n fullMatch(wrap){\r\n let pickHandlers = createPickHandlersAspect.createPickHandlers(wrap);\r\n addPickAspect.addPick(wrap, pickHandlers);\r\n return true; // TODO: process setOptionSelectedAspect\r\n }\r\n }\r\n}\r\n\r\nexport function RemovePickAspect(){\r\n return {\r\n removePick(wrap, pick){\r\n pick.dispose(); // overrided in SelectedOptionPlugin with trySetWrapSelected(wrap, false);\r\n }\r\n }\r\n}\r\n\r\nexport function ProducePickAspect(picksList, removePickAspect, buildPickAspect){\r\n return {\r\n producePick(wrap, pickHandlers){\r\n let pick = buildPickAspect.buildPick(wrap, (event)=>pickHandlers.removeOnButton(event));\r\n \r\n let fixSelectedFalse = () => removePickAspect.removePick(wrap, pick)\r\n\r\n pickHandlers.removeOnButton = fixSelectedFalse;\r\n \r\n pick.pickElementAttach();\r\n let {remove: removeFromPicksList} = picksList.add(pick);\r\n pick.setSelectedFalse = fixSelectedFalse;\r\n pick.wrap = wrap; \r\n pick.dispose = composeSync(\r\n removeFromPicksList,\r\n ()=>{\r\n pick.setSelectedFalse=null;\r\n pick.wrap = null;\r\n }, \r\n pick.dispose);\r\n pickHandlers.removeAndDispose = () => pick.dispose();\r\n return pick;\r\n }\r\n }\r\n}\r\n\r\n// redefined in MultiSelectInlineLayout to redefine handlers removeOnButton\r\n// redefined in SelectedOptionPlugin to compose wrap.updateSelected\r\nexport function CreatePickHandlersAspect(producePickAspect){\r\n return{\r\n createPickHandlers(wrap){\r\n let pickHandlers = { \r\n producePick: null, // not redefined directly, but redefined in addPickAspect\r\n removeAndDispose: null, // not redefined, \r\n removeOnButton: null // redefined in MultiSelectInlineLayout\r\n }\r\n \r\n pickHandlers.producePick = () => producePickAspect.producePick(wrap, pickHandlers);\r\n return pickHandlers;\r\n }\r\n }\r\n}\r\n\r\nexport function CreateChoiceBaseAspect(optionPropertiesAspect){\r\n return {\r\n createChoiceBase(option){\r\n return {\r\n \r\n //updateDisabled:null, \r\n //updateHidden:null,\r\n \r\n // navigation and filter support\r\n filteredPrev: null, \r\n filteredNext: null, \r\n searchText: optionPropertiesAspect.getText(option).toLowerCase().trim(), // TODO make an index abstraction\r\n \r\n // internal state handlers, so they do not have \"update semantics\"\r\n isHoverIn: false,\r\n isFilteredIn: false,\r\n \r\n setVisible: null,\r\n setHoverIn: null,\r\n \r\n // TODO: is it a really sense to have them there?\r\n isChoiceElementAttached: false,\r\n choiceElement: null,\r\n choiceDom:null,\r\n choiceElementAttach: null,\r\n \r\n itemPrev: null,\r\n itemNext: null,\r\n \r\n remove: null,\r\n \r\n dispose: null\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport function CreateWrapAspect(){\r\n return {\r\n createWrap(option){\r\n return {\r\n option: option\r\n }\r\n }\r\n }\r\n}","import {findDirectChildByTagName, closestByClassName} from './ToolsDom';\r\n\r\nexport function CreateElementAspect(createElement){\r\n return {\r\n createElement\r\n }\r\n}\r\n\r\nexport function StaticDomFactory(choicesDomFactory, createElementAspect){\r\n return {\r\n create(css){\r\n let choicesDom = choicesDomFactory.create(css);\r\n return {\r\n choicesDom,\r\n createStaticDom(element, containerClass){\r\n function showError(message){\r\n element.style.backgroundColor = 'red';\r\n element.style.color = 'white';\r\n throw new Error(message);\r\n }\r\n \r\n let containerElement, picksElement;\r\n let removableContainerClass= false;\r\n if (element.tagName == 'DIV') {\r\n containerElement = element;\r\n if (!containerElement.classList.contains(containerClass)){\r\n containerElement.classList.add(containerClass);\r\n removableContainerClass = true;\r\n }\r\n picksElement = findDirectChildByTagName(containerElement, 'UL');\r\n }\r\n else if (element.tagName == 'UL') {\r\n picksElement = element;\r\n containerElement = closestByClassName(element, containerClass);\r\n if (!containerElement){\r\n showError('BsMultiSelect: defined on UL but precedentant DIV for container not found; class='+containerClass);\r\n }\r\n } \r\n else if (element.tagName==\"INPUT\"){\r\n showError('BsMultiSelect: INPUT element is not supported');\r\n }\r\n let disposablePicksElement=false;\r\n if (!picksElement) {\r\n picksElement = createElementAspect.createElement('UL');\r\n disposablePicksElement = true; \r\n }\r\n \r\n return {\r\n choicesDom,\r\n staticDom: {\r\n initialElement:element,\r\n containerElement,\r\n picksElement,\r\n disposablePicksElement\r\n },\r\n staticManager: {\r\n appendToContainer(){ \r\n containerElement.appendChild(choicesDom.choicesElement); \r\n if (disposablePicksElement)\r\n containerElement.appendChild(picksElement)\r\n },\r\n dispose(){ \r\n containerElement.removeChild(choicesDom.choicesElement); \r\n if (removableContainerClass)\r\n containerElement.classList.remove(containerClass);\r\n if (disposablePicksElement)\r\n containerElement.removeChild(picksElement)\r\n }\r\n }\r\n };\r\n }\r\n }\r\n }\r\n }\r\n}\r\n","import {addStyling} from './ToolsStyling';\r\n\r\nexport function ChoicesDomFactory(createElementAspect) {\r\n return {\r\n create(css){\r\n var choicesElement = createElementAspect.createElement('DIV');\r\n var choicesListElement = createElementAspect.createElement('UL');\r\n \r\n choicesElement.appendChild(choicesListElement);\r\n choicesElement.style.display = 'none';\r\n\r\n addStyling(choicesElement, css.choices);\r\n addStyling(choicesListElement, css.choicesList);\r\n return {\r\n choicesElement,\r\n choicesListElement,\r\n createChoiceElement(){\r\n var choiceElement = createElementAspect.createElement('LI');\r\n addStyling(choiceElement, css.choice);\r\n return {\r\n choiceElement,\r\n setVisible: (isVisible) => choiceElement.style.display = isVisible ? 'block': 'none',\r\n attach: (beforeElement) => choicesListElement.insertBefore(choiceElement, beforeElement),\r\n detach: () => choicesListElement.removeChild(choiceElement)\r\n };\r\n }\r\n }\r\n }\r\n }\r\n}\r\n","export function CountableChoicesListInsertAspect(countableChoicesList, wrapsCollection){\r\n return {\r\n countableChoicesListInsert(wrap, key){\r\n let choiceNext = wrapsCollection.getNext(key);\r\n countableChoicesList.add(wrap, choiceNext)\r\n }\r\n }\r\n}","export function ChoicesEnumerableAspect(countableChoicesList, getNext){\r\n return {\r\n forEach(f){\r\n let wrap = countableChoicesList.getHead(); \r\n while(wrap){\r\n f(wrap);\r\n wrap = getNext(wrap);\r\n }\r\n }\r\n }\r\n}","export function PluginManager(plugins, pluginData){\r\n let instances = [];\r\n if (plugins){\r\n for(let i = 0; i buttonHTML\r\n }\r\n}","import {addStyling} from './ToolsStyling';\r\nimport {EventBinder} from './ToolsDom';\r\n\r\nexport function FilterDom(disposablePicksElement, createElementAspect, css){\r\n var filterInputElement = createElementAspect.createElement('INPUT');\r\n addStyling(filterInputElement, css.filterInput);\r\n\r\n filterInputElement.setAttribute(\"type\",\"search\");\r\n filterInputElement.setAttribute(\"autocomplete\",\"off\");\r\n var eventBinder = EventBinder();\r\n return {\r\n filterInputElement,\r\n isEmpty(){return filterInputElement.value ? false : true},\r\n setEmpty(){\r\n filterInputElement.value ='';\r\n },\r\n getValue(){\r\n return filterInputElement.value;\r\n },\r\n setFocus(){\r\n filterInputElement.focus();\r\n },\r\n setWidth(text){\r\n filterInputElement.style.width = text.length * 1.3 + 2 + \"ch\"\r\n },\r\n // TODO: check why I need this comparision? \r\n setFocusIfNotTarget(target){\r\n if (target != filterInputElement)\r\n filterInputElement.focus();\r\n },\r\n onInput(onFilterInputInput){\r\n eventBinder.bind(filterInputElement,'input', onFilterInputInput);\r\n },\r\n onFocusIn(onFocusIn){\r\n eventBinder.bind(filterInputElement,'focusin', onFocusIn);\r\n },\r\n onFocusOut(onFocusOut){\r\n eventBinder.bind(filterInputElement,'focusout', onFocusOut);\r\n },\r\n onKeyDown(onfilterInputKeyDown){\r\n eventBinder.bind(filterInputElement,'keydown', onfilterInputKeyDown); \r\n },\r\n onKeyUp(onFilterInputKeyUp){\r\n eventBinder.bind(filterInputElement,'keyup', onFilterInputKeyUp);\r\n },\r\n dispose(){\r\n eventBinder.unbind();\r\n if (!disposablePicksElement){\r\n if (filterInputElement.parentNode)\r\n filterInputElement.parentNode.removeChild(filterInputElement)\r\n }\r\n }\r\n }\r\n}\r\n","export function SpecialPicksEventsAspect(){\r\n return {\r\n backSpace(pick){ \r\n pick.setSelectedFalse(); \r\n }\r\n }\r\n}","export function ResetFilterListAspect(filterDom, filterManagerAspect){\r\n return {\r\n forceResetFilter(){ // over in PlaceholderPlugin\r\n filterDom.setEmpty();\r\n filterManagerAspect.processEmptyInput(); // over in PlaceholderPlugin\r\n }\r\n }\r\n}\r\n\r\nexport function ResetFilterAspect(filterDom, resetFilterListAspect){\r\n return {\r\n resetFilter(){ // call in OptionsApiPlugin\r\n if (!filterDom.isEmpty()) // call in Placeholder\r\n resetFilterListAspect.forceResetFilter(); // over in Placeholder\r\n }\r\n }\r\n}\r\n\r\nexport function FocusInAspect(picksDom){\r\n return {\r\n setFocusIn(focus){ // call in OptionsApiPlugin\r\n picksDom.setIsFocusIn(focus) // unique call, call BsAppearancePlugin\r\n picksDom.toggleFocusStyling() // over BsAppearancePlugin\r\n }\r\n }\r\n}\r\n\r\n","import {addStyling, toggleStyling} from './ToolsStyling';\r\n\r\nexport function PicksDom(picksElement, disposablePicksElement, createElementAspect, css){\r\n var pickFilterElement = createElementAspect.createElement('LI');\r\n \r\n addStyling(picksElement, css.picks);\r\n addStyling(pickFilterElement, css.pickFilter);\r\n\r\n let disableToggleStyling = toggleStyling(picksElement, css.picks_disabled);\r\n let focusToggleStyling = toggleStyling(picksElement, css.picks_focus);\r\n let isFocusIn = false;\r\n\r\n return {\r\n picksElement,\r\n pickFilterElement,\r\n\r\n createPickElement(){\r\n var pickElement = createElementAspect.createElement('LI');\r\n addStyling(pickElement, css.pick);\r\n return {\r\n pickElement, \r\n attach: (beforeElement) => picksElement.insertBefore(pickElement, beforeElement??pickFilterElement),\r\n detach: () => picksElement.removeChild(pickElement)\r\n };\r\n },\r\n disable(isComponentDisabled){\r\n disableToggleStyling(isComponentDisabled)\r\n },\r\n toggleFocusStyling(){\r\n focusToggleStyling(isFocusIn)\r\n },\r\n getIsFocusIn(){\r\n return isFocusIn;\r\n },\r\n setIsFocusIn(newIsFocusIn){\r\n isFocusIn = newIsFocusIn\r\n }, \r\n dispose(){\r\n if (!disposablePicksElement){\r\n disableToggleStyling(false)\r\n focusToggleStyling(false)\r\n \r\n if (pickFilterElement.parentNode)\r\n pickFilterElement.parentNode.removeChild(pickFilterElement)\r\n }\r\n }\r\n }\r\n}\r\n","import {EventBinder} from './ToolsDom';\r\nimport {addStyling, toggleStyling} from './ToolsStyling';\r\n\r\nexport function PickDomFactory(css, componentPropertiesAspect, optionPropertiesAspect, pickButtonAspect){\r\n return { \r\n create(pickElement, wrap, remove){\r\n let eventBinder = EventBinder();\r\n let buttonHTML = pickButtonAspect.getButtonHTML();\r\n pickElement.innerHTML = ''+buttonHTML;\r\n let pickContentElement = pickElement.querySelector('SPAN');\r\n let pickButtonElement = pickElement.querySelector('BUTTON');\r\n eventBinder.bind(pickButtonElement, \"click\", remove);\r\n \r\n addStyling(pickContentElement, css.pickContent);\r\n addStyling(pickButtonElement, css.pickButton);\r\n let disableToggle = toggleStyling(pickContentElement, css.pickContent_disabled);\r\n\r\n function updateData(){\r\n pickContentElement.textContent = optionPropertiesAspect.getText(wrap.option); \r\n }\r\n function updateDisabled(){\r\n disableToggle(wrap.isOptionDisabled)\r\n }\r\n function updateComponentDisabled(){\r\n pickButtonElement.disabled = componentPropertiesAspect.getDisabled();\r\n }\r\n \r\n\r\n return {\r\n pickDom:{\r\n pickContentElement,\r\n pickButtonElement,\r\n },\r\n pickDomManagerHandlers:{\r\n updateData,\r\n updateDisabled,\r\n updateComponentDisabled,\r\n },\r\n dispose(){\r\n eventBinder.unbind();\r\n }\r\n }\r\n }\r\n }\r\n}\r\n","export function BuildPickAspect(\r\n picksDom, \r\n pickDomFactory\r\n){\r\n return {\r\n buildPick(wrap, removeOnButton){\r\n let {pickElement, attach, detach} = picksDom.createPickElement(); \r\n let {dispose, pickDom, pickDomManagerHandlers} = pickDomFactory.create(pickElement, wrap, removeOnButton); \r\n \r\n pickDomManagerHandlers.updateData();\r\n if (pickDomManagerHandlers.updateDisabled)\r\n pickDomManagerHandlers.updateDisabled();\r\n if (pickDomManagerHandlers.updateComponentDisabled)\r\n pickDomManagerHandlers.updateComponentDisabled();\r\n let pick = {\r\n pickDom,\r\n pickDomManagerHandlers,\r\n pickElementAttach: attach,\r\n dispose: () => { \r\n detach(); \r\n dispose(); \r\n pick.pickDomManagerHandlers = null;\r\n pick.pickDom = pickDom;\r\n pick.pickElementAttach = null;\r\n pick.dispose = null;\r\n }\r\n }\r\n return pick;\r\n }\r\n }\r\n}","export function InputAspect(\r\n filterDom,\r\n filterManagerAspect,\r\n fullMatchAspect\r\n ){\r\n\r\n return {\r\n // overrided in SelectedOptionPlugin\r\n processInput(){ \r\n let filterInputValue = filterDom.getValue();\r\n let text = filterInputValue.trim();\r\n var isEmpty=false;\r\n if (text == '')\r\n isEmpty=true;\r\n else\r\n {\r\n filterManagerAspect.setFilter(text.toLowerCase());\r\n }\r\n \r\n if (!isEmpty)\r\n {\r\n if ( filterManagerAspect.getNavigateManager().getCount() == 1)\r\n {\r\n // todo: move exact match to filterManager\r\n let fullMatchWrap = filterManagerAspect.getNavigateManager().getHead();\r\n let text = filterManagerAspect.getFilter();\r\n if (fullMatchWrap.choice.searchText == text)\r\n {\r\n let success = fullMatchAspect.fullMatch(fullMatchWrap); \r\n if (success) {\r\n filterDom.setEmpty();\r\n isEmpty = true;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return {filterInputValue, isEmpty};\r\n }\r\n }\r\n}","import {EventBinder} from './ToolsDom';\r\nimport {addStyling, toggleStyling} from './ToolsStyling';\r\n\r\nexport function ChoiceDomFactory(css, optionPropertiesAspect, highlightAspect){\r\n \r\n var updateHighlightedInternal = function(wrap, choiceDom, element) {\r\n var text = optionPropertiesAspect.getText(wrap.option);\r\n var highlighter = highlightAspect.getHighlighter();\r\n if (highlighter)\r\n highlighter(element, choiceDom, text); \r\n else\r\n element.textContent = text;\r\n }\r\n var updateDataInternal = function(wrap, element){\r\n element.textContent = optionPropertiesAspect.getText(wrap.option);;\r\n }\r\n //TODO move check which aspects availbale like wrap.hasOwnProperty(\"isOptionSelected\") to there\r\n return {\r\n create(choiceElement, wrap, toggle){\r\n let choiceDom = null;\r\n let choiceDomManagerHandlers = null;\r\n let eventBinder = EventBinder();\r\n eventBinder.bind(choiceElement, \"click\", toggle);\r\n let choiceHoverToggle = toggleStyling(choiceElement, css.choice_hover);\r\n let updateHoverIn = function(){\r\n choiceHoverToggle(wrap.choice.isHoverIn);\r\n }\r\n \r\n if (wrap.hasOwnProperty(\"isOptionSelected\")){\r\n choiceElement.innerHTML = '
';\r\n \r\n let choiceContentElement = choiceElement.querySelector('DIV');\r\n let choiceCheckBoxElement = choiceContentElement.querySelector('INPUT');\r\n let choiceLabelElement = choiceContentElement.querySelector('LABEL');\r\n \r\n addStyling(choiceContentElement, css.choiceContent); \r\n addStyling(choiceCheckBoxElement, css.choiceCheckBox); \r\n addStyling(choiceLabelElement, css.choiceLabel); \r\n\r\n choiceDom = {\r\n choiceElement,\r\n choiceContentElement,\r\n choiceCheckBoxElement,\r\n choiceLabelElement\r\n };\r\n \r\n let choiceSelectedToggle = toggleStyling(choiceElement, css.choice_selected);\r\n let updateSelected = function(){ \r\n choiceSelectedToggle(wrap.isOptionSelected);\r\n choiceCheckBoxElement.checked = wrap.isOptionSelected;\r\n }\r\n\r\n let choiceDisabledToggle = toggleStyling(choiceElement, css.choice_disabled);\r\n let choiceCheckBoxDisabledToggle = toggleStyling(choiceCheckBoxElement, css.choiceCheckBox_disabled);\r\n let choiceLabelDisabledToggle = toggleStyling(choiceLabelElement, css.choiceLabel_disabled);\r\n let choiceCursorDisabledToggle = toggleStyling(choiceElement, {classes:[], styles:{cursor:\"default\"}}); \r\n let updateDisabled = function(){\r\n choiceDisabledToggle(wrap.isOptionDisabled);\r\n choiceCheckBoxDisabledToggle(wrap.isOptionDisabled);\r\n choiceLabelDisabledToggle(wrap.isOptionDisabled);\r\n \r\n // do not desable checkBox if option is selected! there should be possibility to unselect \"disabled\"\r\n let isCheckBoxDisabled = wrap.isOptionDisabled && !wrap.isOptionSelected;\r\n choiceCheckBoxElement.disabled = isCheckBoxDisabled;\r\n choiceCursorDisabledToggle(isCheckBoxDisabled);\r\n \r\n }\r\n\r\n choiceDomManagerHandlers = {\r\n updateData: ()=>updateDataInternal(wrap, choiceLabelElement),\r\n updateHighlighted: ()=>updateHighlightedInternal(wrap, choiceDom, choiceLabelElement), \r\n updateHoverIn,\r\n updateDisabled,\r\n updateSelected, \r\n }\r\n\r\n \r\n }else{\r\n choiceElement.innerHTML = '';\r\n let choiceContentElement = choiceElement.querySelector('SPAN');\r\n choiceDom = {\r\n \r\n choiceElement,\r\n choiceContentElement,\r\n };\r\n choiceDomManagerHandlers = {\r\n updateData: ()=>updateDataInternal(wrap, choiceContentElement),\r\n updateHighlighted: ()=>updateHighlightedInternal(wrap, choiceDom, choiceElement), \r\n updateHoverIn\r\n }\r\n }\r\n \r\n return {\r\n choiceDom,\r\n choiceDomManagerHandlers, \r\n dispose(){\r\n eventBinder.unbind();\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\n\r\n","export function BuildAndAttachChoiceAspect(\r\n buildChoiceAspect,\r\n ){\r\n return {\r\n buildAndAttachChoice(\r\n wrap,\r\n getNextElement \r\n ){\r\n buildChoiceAspect.buildChoice(wrap);\r\n wrap.choice.choiceElementAttach(getNextElement?.());\r\n }\r\n }\r\n}\r\n\r\nexport function BuildChoiceAspect(\r\n choicesDom,\r\n choiceDomFactory,\r\n choiceClickAspect\r\n ) {\r\n return {\r\n buildChoice(wrap) {\r\n var {choiceElement, setVisible, attach, detach} = choicesDom.createChoiceElement();\r\n wrap.choice.choiceElement = choiceElement;\r\n wrap.choice.choiceElementAttach = attach;\r\n wrap.choice.isChoiceElementAttached = true;\r\n \r\n let {dispose, choiceDom, choiceDomManagerHandlers} = choiceDomFactory.create(choiceElement, wrap, () => choiceClickAspect.choiceClick(wrap));\r\n wrap.choice.choiceDom=choiceDom;\r\n choiceDomManagerHandlers.updateData();\r\n if (choiceDomManagerHandlers.updateSelected) \r\n choiceDomManagerHandlers.updateSelected();\r\n if (choiceDomManagerHandlers.updateDisabled) \r\n choiceDomManagerHandlers.updateDisabled();\r\n \r\n\r\n wrap.choice.choiceDomManagerHandlers = choiceDomManagerHandlers;\r\n \r\n wrap.choice.remove = () => {\r\n detach();\r\n };\r\n \r\n wrap.choice.isFilteredIn = true;\r\n \r\n wrap.choice.setHoverIn = (v) => {\r\n wrap.choice.isHoverIn =v ;\r\n choiceDomManagerHandlers.updateHoverIn();\r\n }\r\n \r\n wrap.choice.setVisible = (v) => {\r\n wrap.choice.isFilteredIn = v;\r\n setVisible(wrap.choice.isFilteredIn)\r\n }\r\n \r\n wrap.choice.dispose = () => {\r\n wrap.choice.choiceDomManagerHandlers = null;\r\n dispose();\r\n \r\n wrap.choice.choiceElement = null;\r\n wrap.choice.choiceDom = null;\r\n wrap.choice.choiceElementAttach = null;\r\n wrap.choice.isChoiceElementAttached = false;\r\n wrap.choice.remove = null; \r\n \r\n // not real data manipulation but internal state\r\n wrap.choice.setVisible = null; // TODO: refactor it there should be 3 types of not visibility: for hidden, for filtered out, for optgroup, for message item\r\n wrap.choice.setHoverIn = null;\r\n \r\n wrap.choice.dispose = null;\r\n }\r\n\r\n wrap.dispose = () => {\r\n wrap.choice.dispose();\r\n wrap.dispose = null;\r\n }\r\n }\r\n }\r\n}","\r\nexport function SetDisabledComponentAspect(picksList, picksDom){\r\n return {\r\n setDisabledComponent(isComponentDisabled){\r\n picksList.forEach(pick=>pick.pickDomManagerHandlers.updateComponentDisabled())\r\n picksDom.disable(isComponentDisabled);\r\n }\r\n }\r\n}\r\n\r\nexport function UpdateDisabledComponentAspect(componentPropertiesAspect, setDisabledComponentAspect\r\n ){\r\n let isComponentDisabled;\r\n return {\r\n updateDisabledComponent(){\r\n let newIsComponentDisabled = componentPropertiesAspect.getDisabled();\r\n if (isComponentDisabled!==newIsComponentDisabled){\r\n isComponentDisabled=newIsComponentDisabled;\r\n setDisabledComponentAspect.setDisabledComponent(newIsComponentDisabled);\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport function ResetLayoutAspect(resetLayout){\r\n return {\r\n resetLayout\r\n }\r\n}\r\n\r\nexport function AppearanceAspect(updateDisabledComponentAspect){\r\n return {\r\n updateAppearance(){\r\n updateDisabledComponentAspect.updateDisabledComponent();\r\n }\r\n }\r\n}\r\n\r\nexport function LoadAspect(fillChoicesAspect, appearanceAspect){\r\n return {\r\n load(){\r\n fillChoicesAspect.fillChoices();\r\n appearanceAspect.updateAppearance(); \r\n }\r\n }\r\n}","\r\nexport function FillChoicesAspect(\r\n document, createWrapAspect, createChoiceBaseAspect, optionsAspect, wraps, buildAndAttachChoiceAspect\r\n ) { \r\n return {\r\n fillChoices(){\r\n var fillChoicesImpl = () => {\r\n let options = optionsAspect.getOptions();\r\n for(let i = 0; ipick.dispose());\r\n picksList.reset();\r\n fillChoicesAspect.fillChoices();\r\n }\r\n }\r\n}\r\n","const transformStyles = [\r\n {old:'selectedPanelDisabledBackgroundColor', opt:'picks_disabled', style:\"backgroundColor\"},\r\n {old:'selectedPanelFocusValidBoxShadow', opt:'picks_focus_valid', style:\"boxShadow\"},\r\n {old:'selectedPanelFocusInvalidBoxShadow', opt:'picks_focus_invalid', style:\"boxShadow\"},\r\n {old:'selectedPanelDefMinHeight', opt:'picks_def', style:\"minHeight\"},\r\n {old:'selectedPanelLgMinHeight', opt:'picks_lg', style:\"minHeight\"},\r\n {old:'selectedPanelSmMinHeight', opt:'picks_sm', style:\"minHeight\"},\r\n {old:'selectedItemContentDisabledOpacity', opt:'choiceLabel_disabled', style:\"opacity\"}\r\n]\r\n\r\nconst transformClasses = [\r\n {old:'dropDownMenuClass', opt:'choices'},\r\n {old:'dropDownItemClass', opt:'choice'},\r\n {old:'dropDownItemHoverClass', opt:'choice_hover'},\r\n {old:'selectedPanelClass', opt:'picks'},\r\n {old:'selectedItemClass', opt:'pick'},\r\n {old:'removeSelectedItemButtonClass', opt:'pickButton'},\r\n {old:'filterInputItemClass', opt:'pickFilter'},\r\n {old:'filterInputClass', opt:'filterInput'},\r\n {old:'selectedPanelFocusClass', opt:'picks_focus'},\r\n {old:'selectedPanelDisabledClass', opt:'picks_disabled'},\r\n {old:'selectedItemContentDisabledClass', opt:'pick_disabled'}\r\n]\r\n\r\nexport function adjustLegacySettings(settings){\r\n if (!settings.css)\r\n settings.css={}\r\n var css =settings.css;\r\n\r\n if (!settings.cssPatch)\r\n settings.cssPatch={}\r\n var cssPatch =settings.cssPatch;\r\n\r\n if (settings.selectedPanelFocusBorderColor || settings.selectedPanelFocusBoxShadow){\r\n console.log(\"DashboarCode.BsMultiSelect: selectedPanelFocusBorderColor and selectedPanelFocusBoxShadow are depricated, use - cssPatch:{picks_focus:{borderColor:'myValue', boxShadow:'myValue'}}\");\r\n if(!cssPatch.picks_focus){\r\n cssPatch.picks_focus = {boxShadow: settings.selectedPanelFocusBoxShadow, borderColor: settings.selectedPanelFocusBorderColor}\r\n }\r\n delete settings.selectedPanelFocusBorderColor;\r\n delete settings.selectedPanelFocusBoxShadow;\r\n }\r\n\r\n transformStyles.forEach(\r\n (i)=>{\r\n if (settings[i.old]){\r\n console.log(`DashboarCode.BsMultiSelect: ${i.old} is depricated, use - cssPatch:{${i.opt}:{${i.style}:'myValue'}}`);\r\n if(!settings[i.opt]){\r\n let opt = {}\r\n opt[i.style] = settings[i.old]\r\n settings.cssPatch[i.opt]=opt;\r\n }\r\n delete settings[i.old];\r\n }\r\n }\r\n )\r\n \r\n transformClasses.forEach( (i) => {\r\n if (settings[i.old]){\r\n console.log(`DashboarCode.BsMultiSelect: ${i.old} is depricated, use - css:{${i.opt}:'myValue'}`);\r\n if(!css[i.opt]){\r\n css[i.opt]= settings[i.old]\r\n }\r\n delete settings[i.old];\r\n }\r\n })\r\n \r\n if (settings.inputColor){\r\n console.log(\"DashboarCode.BsMultiSelect: inputColor is depricated, remove parameter\");\r\n delete settings.inputColor;\r\n }\r\n\r\n if (settings.useCss){\r\n console.log(\"DashboarCode.BsMultiSelect: useCss(=true) is depricated, use - 'useCssPatch: false'\");\r\n if(!css.pick_disabled){\r\n settings.useCssPatch = !settings.useCss\r\n }\r\n delete settings.useCss;\r\n } \r\n\r\n if (settings.getIsValid || settings.getIsInValid){\r\n throw \"DashboarCode.BsMultiSelect: parameters getIsValid and getIsInValid are depricated and removed, use - getValidity that should return (true|false|null) \"\r\n } \r\n}","import {BsMultiSelect} from './BsMultiSelect'\r\nimport {plugMergeSettings, plugDefaultConfig} from './PluginManager'\r\n\r\nimport {adjustLegacySettings} from './BsMultiSelectDepricatedParameters'\r\n\r\nimport {createCss} from './ToolsStyling'\r\nimport {extendIfUndefined} from './ToolsJs'\r\n\r\n// TODO: remove environment - replace it with plugins\r\nexport function MultiSelectBuilder(environment, plugins) \r\n{\r\n const defaults = {containerClass: \"dashboardcode-bsmultiselect\"}\r\n\r\n let create = (element, options) => { \r\n if (options && options.plugins)\r\n console.log(\"DashboarCode.BsMultiSelect: 'options.plugins' is depricated, use - MultiSelectBuilder(environment, plugins) instead\");\r\n let configuration = {};\r\n let buildConfiguration;\r\n if (options instanceof Function) {\r\n buildConfiguration = options;\r\n options = null;\r\n } else {\r\n buildConfiguration = options?.buildConfiguration;\r\n }\r\n if (options){\r\n adjustLegacySettings(options);\r\n }\r\n configuration.css = createCss(defaults.css, options?.css);\r\n plugMergeSettings(plugins, configuration, defaults, options); // merge settings.cssPatch and defaults.cssPatch\r\n extendIfUndefined(configuration, options);\r\n extendIfUndefined(configuration, defaults);\r\n let onInit = buildConfiguration?.(element, configuration);\r\n let multiSelect = BsMultiSelect(element, environment, plugins, configuration, onInit); // onInit(api, aspects) - before load data\r\n return multiSelect;\r\n }\r\n plugDefaultConfig(plugins, defaults);\r\n return {create, defaultSettings: defaults}\r\n}\r\n","import {addToJQueryPrototype} from './AddToJQueryPrototype'\r\n\r\nimport {composeSync, shallowClearClone, ObjectValues, isString} from './ToolsJs'\r\nimport {composeEventTrigger} from './ToolsDom'\r\n\r\nimport {MultiSelectBuilder} from './MultiSelectBuilder'\r\n\r\nexport function createForJQuery(window, $, createPopper, name, pluginsSet, stylePlugin){\r\n let trigger = null;\r\n let isJQyery = $ && !window.document.body.hasAttribute('data-bs-no-jquery');\r\n if (isJQyery) {\r\n trigger = (e, eventName) => $(e).trigger(eventName);\r\n } else {\r\n trigger = composeEventTrigger(window);\r\n }\r\n let plugins = shallowClearClone({stylePlugin}, pluginsSet);\r\n\r\n let environment = {trigger, window, createPopper}\r\n let pluginsArray = ObjectValues(plugins)\r\n let {create, defaultSettings} = MultiSelectBuilder(environment, pluginsArray);\r\n let createForUmd = (element, settings) => {\r\n if (isString(element))\r\n element = window.document.querySelector(element);\r\n return create(element, settings);\r\n }\r\n createForUmd.Default = defaultSettings;\r\n\r\n if (isJQyery) {\r\n let constructorForJquery = (element, settings, removeInstanceData) => {let multiSelect = create(element, settings); multiSelect.dispose = composeSync(multiSelect.dispose, removeInstanceData); return multiSelect;} \r\n let prototypable = addToJQueryPrototype(name, constructorForJquery, $);\r\n \r\n prototypable.defaults = defaultSettings;\r\n }\r\n return createForUmd; \r\n}\r\n","export function addToJQueryPrototype(pluginName, createPlugin, $){\r\n const firstChar = pluginName.charAt(0);\r\n const firstCharLower = firstChar.toLowerCase();\r\n if (firstCharLower == firstChar) {\r\n throw new Error(`Plugin name '${pluginName}' should be started from upper case char`)\r\n }\r\n const prototypableName = firstCharLower + pluginName.slice(1)\r\n const noConflictPrototypable = $.fn[prototypableName];\r\n const noConflictPrototypableForInstance = $.fn[pluginName];\r\n const dataKey = `DashboardCode.${pluginName}`;\r\n\r\n function createInstance(options, e, $e){\r\n const optionsRef = (typeof options === 'object') || options instanceof Function ? options:null;\r\n let instance = createPlugin(e, optionsRef,\r\n () => {\r\n $e.removeData(dataKey)\r\n });\r\n $e.data(dataKey, instance);\r\n return instance;\r\n }\r\n\r\n function prototypable(options){\r\n let output=[];\r\n this.each( function (i, e) {\r\n let $e = $(e);\r\n let instance = $e.data(dataKey)\r\n let isMethodName = typeof options === 'string';\r\n if (!instance) {\r\n if (isMethodName && /Dispose/.test(options)) \r\n return;\r\n instance = createInstance(options, e, $e);\r\n }\r\n if (isMethodName) {\r\n let methodName = options;\r\n if (typeof instance[methodName] === 'undefined') {\r\n let lMethodName = methodName.charAt(0).toLowerCase() + methodName.slice(1)\r\n if ( typeof instance[lMethodName] === 'undefined') {\r\n throw new Error(`No method named '${methodName}'`)\r\n } else {\r\n methodName = lMethodName;\r\n }\r\n }\r\n let result = instance[methodName]();\r\n if (result !== undefined){\r\n output.push(result);\r\n }\r\n }\r\n })\r\n if (output.length==0)\r\n return this;\r\n else if (output.length==1)\r\n return output[0];\r\n else\r\n return output;\r\n }\r\n\r\n function prototypableForInstance(options){\r\n let instance = this.data(dataKey);\r\n if (instance)\r\n return instance;\r\n else if (this.length === 1){\r\n return createInstance(options, this.get(0), this);\r\n } else if (this.length > 1){\r\n let output=[];\r\n this.each(function(i, e){\r\n output.push(createInstance(options, e, $(e)));\r\n })\r\n return output;\r\n }\r\n }\r\n \r\n $.fn[prototypableName] = prototypable;\r\n $.fn[prototypableName].noConflict = function () {\r\n $.fn[prototypableName] = noConflictPrototypable\r\n return prototypable;\r\n }\r\n\r\n $.fn[pluginName] = prototypableForInstance;\r\n $.fn[pluginName].noConflict = function () {\r\n $.fn[pluginName] = noConflictPrototypableForInstance\r\n return prototypableForInstance;\r\n }\r\n\r\n return prototypable;\r\n}","import {defCall} from '../ToolsJs';\r\n\r\nexport function LabelPlugin(pluginData){\r\n let {configuration, staticDom, filterDom} = pluginData;\r\n let {containerClass, label} = configuration\r\n let getLabelElementAspect = () => defCall(label); \r\n let labelPluginData = {getLabelElementAspect}; // overrided by BS Appearance Plugin\r\n pluginData.labelPluginData=labelPluginData;\r\n let createInputId = null;\r\n let {selectElement, containerElement} = staticDom;\r\n let {filterInputElement} = filterDom;\r\n if(selectElement)\r\n createInputId = () => `${containerClass}-generated-input-${((selectElement.id)?selectElement.id:selectElement.name).toLowerCase()}-id`;\r\n else\r\n createInputId = () => `${containerClass}-generated-filter-${containerElement.id}`;\r\n\r\n return {\r\n buildApi(){\r\n let labelElement = labelPluginData.getLabelElementAspect();\r\n let backupedForAttribute = null; // state saved between init and dispose\r\n if (labelElement) {\r\n backupedForAttribute = labelElement.getAttribute('for');\r\n var newId = createInputId();\r\n filterInputElement.setAttribute('id', newId);\r\n labelElement.setAttribute('for',newId);\r\n }\r\n if (backupedForAttribute)\r\n return () => labelElement.setAttribute('for',backupedForAttribute);\r\n }\r\n }\r\n}","import {getIsRtl, AttributeBackup} from '../ToolsDom';\r\nimport {isBoolean} from '../ToolsJs';\r\n\r\nexport function RtlPlugin(pluginData){\r\n \r\n let {configuration, rtlAspect, staticDom} = pluginData;\r\n let {isRtl} = configuration;\r\n let forceRtlOnContainer = false; \r\n if (isBoolean(isRtl))\r\n forceRtlOnContainer = true;\r\n else\r\n isRtl = getIsRtl(staticDom.initialElement);\r\n \r\n var attributeBackup = AttributeBackup();\r\n if (forceRtlOnContainer){\r\n attributeBackup.set(staticDom.containerElement, \"dir\", \"rtl\");\r\n }\r\n else if (staticDom.selectElement){\r\n var dirAttributeValue = staticDom.selectElement.getAttribute(\"dir\");\r\n if (dirAttributeValue){\r\n attributeBackup.set(staticDom.containerElement, \"dir\", dirAttributeValue);\r\n }\r\n } \r\n \r\n return {\r\n buildApi(api){\r\n // TODO there is something wrong with this. may be should moved to specific plugin\r\n // sample of correct plugin - aspect pair is WarningPlugin: aspect is added on plugin constrictor\r\n if (rtlAspect.updateRtl)\r\n rtlAspect.updateRtl(isRtl);\r\n },\r\n dispose(){\r\n attributeBackup.restore;\r\n }\r\n }\r\n}\r\n\r\nRtlPlugin.plugStaticDom = (aspects) => {\r\n aspects.rtlAspect = RtlAspect();\r\n}\r\n\r\nfunction RtlAspect() {\r\n return {\r\n updateRtl(){},\r\n }\r\n}","function createValidity(valueMissing, customError){\r\n return Object.freeze({\r\n valueMissing,\r\n customError,\r\n valid: !(valueMissing || customError),\r\n });\r\n}\r\n\r\nexport function ValidityApi(visibleElement, isValueMissingObservable, valueMissingMessage, onValid, trigger){\r\n var customValidationMessage = \"\";\r\n var validationMessage = \"\";\r\n var validity = null;\r\n var willValidate = true;\r\n \r\n function setMessage(valueMissing, customError){\r\n validity = createValidity(valueMissing, customError);\r\n validationMessage = customError?customValidationMessage:(valueMissing?valueMissingMessage:\"\")\r\n visibleElement.setCustomValidity(validationMessage);\r\n onValid(validity.valid);\r\n }\r\n\r\n setMessage(isValueMissingObservable.getValue(), false);\r\n\r\n isValueMissingObservable.attach(\r\n (value) => {\r\n setMessage(value, validity.customError);\r\n }\r\n );\r\n var checkValidity = () => {\r\n if (!validity.valid)\r\n trigger('dashboardcode.multiselect:invalid')\r\n return validity.valid;\r\n }\r\n return {\r\n validationMessage,\r\n willValidate,\r\n validity,\r\n setCustomValidity(message){\r\n customValidationMessage = message;\r\n setMessage(validity.valueMissing, customValidationMessage?true:false);\r\n },\r\n checkValidity,\r\n reportValidity(){\r\n visibleElement.reportValidity();\r\n return checkValidity();\r\n }\r\n }\r\n}","import {ValidityApi} from '../ValidityApi'\r\nimport {ObservableValue, ObservableLambda, defCall, isBoolean, composeSync} from '../ToolsJs';\r\nimport {getDataGuardedWithPrefix} from '../ToolsDom';\r\n\r\nconst defValueMissingMessage = 'Please select an item in the list'\r\n\r\nexport function ValidationApiPlugin(pluginData){\r\n var {configuration, triggerAspect, onChangeAspect, optionsAspect, \r\n selectElementPluginData, staticDom, filterDom, updateDataAspect} = pluginData;\r\n // TODO: required could be a function\r\n let {getIsValueMissing, valueMissingMessage, required} = configuration;\r\n if (!isBoolean(required))\r\n required = selectElementPluginData?.required; \r\n else if (!isBoolean(required))\r\n required = false;\r\n valueMissingMessage = defCall(valueMissingMessage,\r\n ()=> getDataGuardedWithPrefix(staticDom.initialElement,\"bsmultiselect\",\"value-missing-message\"),\r\n defValueMissingMessage)\r\n\r\n if (!getIsValueMissing) {\r\n getIsValueMissing = () => {\r\n let count = 0;\r\n let optionsArray = optionsAspect.getOptions();\r\n for (var i=0; i < optionsArray.length; i++) {\r\n if (optionsArray[i].selected) \r\n count++;\r\n }\r\n return count===0;\r\n }\r\n }\r\n \r\n var isValueMissingObservable = ObservableLambda(()=>required && getIsValueMissing());\r\n var validationApiObservable = ObservableValue(!isValueMissingObservable.getValue());\r\n\r\n onChangeAspect.onChange = composeSync(isValueMissingObservable.call, onChangeAspect.onChange);\r\n updateDataAspect.updateData = composeSync(isValueMissingObservable.call, updateDataAspect.updateData);\r\n pluginData.validationApiPluginData = {validationApiObservable};\r\n\r\n var validationApi = ValidityApi(\r\n filterDom.filterInputElement, \r\n isValueMissingObservable, \r\n valueMissingMessage,\r\n (isValid)=>validationApiObservable.setValue(isValid),\r\n triggerAspect.trigger\r\n );\r\n\r\n return {\r\n buildApi(api){\r\n api.validationApi = validationApi;\r\n },\r\n dispose(){\r\n isValueMissingObservable.detachAll(); \r\n validationApiObservable.detachAll();\r\n }\r\n }\r\n}\r\n\r\nValidationApiPlugin.plugDefaultConfig = (defaults)=>{\r\n defaults.valueMissingMessage = '';\r\n}","import {closestByClassName, siblingsAsArray} from '../ToolsDom';\r\nimport {addStyling} from '../ToolsStyling'\r\nimport {ObservableLambda, composeSync} from '../ToolsJs';\r\n\r\nexport function BsAppearancePlugin(pluginData){\r\n let {configuration, validationApiPluginData, \r\n picksDom, staticDom, labelPluginData, appearanceAspect, componentPropertiesAspect, floatingLabelAspect} = pluginData;\r\n let {getValidity, getSize, useCssPatch, css, composeGetSize, getDefaultLabel} = configuration;\r\n let selectElement = staticDom.selectElement;\r\n \r\n let initialElement = staticDom.initialElement;\r\n\r\n let isFloatingLabel = false;\r\n if (floatingLabelAspect){\r\n isFloatingLabel = closestByClassName(initialElement, 'form-floating');\r\n floatingLabelAspect.isFloatingLabel = () => isFloatingLabel\r\n }\r\n\r\n if (labelPluginData){\r\n let origGetLabelElementAspect = labelPluginData.getLabelElementAspect;\r\n labelPluginData.getLabelElementAspect = () => {\r\n var e = origGetLabelElementAspect();\r\n if (e)\r\n return e;\r\n else{\r\n if (selectElement){\r\n let labelElement = getDefaultLabel(selectElement);\r\n return labelElement;\r\n }\r\n }\r\n }\r\n }\r\n \r\n if (staticDom.selectElement) {\r\n if(!getValidity)\r\n getValidity = composeGetValidity(selectElement)\r\n if(!getSize) \r\n getSize = composeGetSize(selectElement)\r\n } else {\r\n if (!getValidity)\r\n getValidity = () => null\r\n if (!getSize)\r\n getSize = () => null\r\n }\r\n\r\n componentPropertiesAspect.getSize=getSize;\r\n componentPropertiesAspect.getValidity=getValidity;\r\n\r\n var updateSize;\r\n if (!useCssPatch){\r\n updateSize= () => updateSizeForAdapter(picksDom.picksElement, getSize)\r\n }\r\n else{\r\n let {picks_lg, picks_sm, picks_def, picks_floating_def} = css;\r\n if (isFloatingLabel)\r\n picks_lg = picks_sm = picks_def = picks_floating_def;\r\n updateSize = () => updateSizeJsForAdapter(picksDom.picksElement, picks_lg, picks_sm, picks_def, getSize);\r\n }\r\n\r\n if (useCssPatch){\r\n var origToggleFocusStyling = picksDom.toggleFocusStyling;\r\n picksDom.toggleFocusStyling = () => {\r\n var validity = validationObservable.getValue();\r\n var isFocusIn = picksDom.getIsFocusIn();\r\n origToggleFocusStyling(isFocusIn)\r\n if (isFocusIn){\r\n if (validity===false) { \r\n // but not toggle events (I know it will be done in future)\r\n picksDom.setIsFocusIn(isFocusIn);\r\n \r\n addStyling(picksDom.picksElement, css.picks_focus_invalid)\r\n } else if (validity===true) {\r\n // but not toggle events (I know it will be done in future)\r\n picksDom.setIsFocusIn(isFocusIn);\r\n \r\n addStyling(picksDom.picksElement, css.picks_focus_valid) \r\n } \r\n }\r\n }\r\n }\r\n\r\n var getWasValidated = () => {\r\n var wasValidatedElement = closestByClassName(staticDom.initialElement, 'was-validated');\r\n return wasValidatedElement?true:false;\r\n }\r\n var wasUpdatedObservable = ObservableLambda(()=>getWasValidated());\r\n var getManualValidationObservable = ObservableLambda(()=>getValidity());\r\n let validationApiObservable = validationApiPluginData?.validationApiObservable;\r\n \r\n var validationObservable = ObservableLambda(\r\n () => wasUpdatedObservable.getValue()?validationApiObservable.getValue():getManualValidationObservable.getValue()\r\n )\r\n \r\n validationObservable.attach(\r\n (value)=>{\r\n var {validMessages, invalidMessages} = getMessagesElements(staticDom.containerElement);\r\n updateValidity( picksDom.picksElement, validMessages, invalidMessages, value);\r\n picksDom.toggleFocusStyling();\r\n }\r\n )\r\n wasUpdatedObservable.attach(\r\n ()=>validationObservable.call()\r\n )\r\n if (validationApiObservable)\r\n validationApiObservable.attach(\r\n ()=>validationObservable.call()\r\n )\r\n getManualValidationObservable.attach(\r\n ()=>validationObservable.call()\r\n )\r\n\r\n appearanceAspect.updateAppearance = composeSync(\r\n appearanceAspect.updateAppearance, \r\n updateSize, \r\n validationObservable.call, getManualValidationObservable.call);\r\n\r\n return {\r\n buildApi(api){\r\n api.updateSize = updateSize;\r\n api.updateValidity = ()=> getManualValidationObservable.call();\r\n api.updateWasValidated = ()=>wasUpdatedObservable.call();\r\n },\r\n dispose(){\r\n wasUpdatedObservable.detachAll();\r\n validationObservable.detachAll();\r\n getManualValidationObservable.detachAll();\r\n }\r\n }\r\n}\r\n\r\nfunction updateValidity(picksElement, validMessages, invalidMessages, validity){\r\n if (validity===false){\r\n picksElement.classList.add('is-invalid');\r\n picksElement.classList.remove('is-valid');\r\n invalidMessages.map(e=>e.style.display='block'); \r\n validMessages.map(e=>e.style.display='none'); \r\n }\r\n else if (validity===true){\r\n picksElement.classList.remove('is-invalid');\r\n picksElement.classList.add('is-valid');\r\n invalidMessages.map(e=>e.style.display='none'); \r\n validMessages.map(e=>e.style.display='block'); \r\n }else {\r\n picksElement.classList.remove('is-invalid');\r\n picksElement.classList.remove('is-valid');\r\n invalidMessages.map(e=>e.style.display=''); \r\n validMessages.map(e=>e.style.display=''); \r\n }\r\n}\r\n\r\nfunction updateSizeClasses(picksElement, size){\r\n if (size==\"lg\"){\r\n picksElement.classList.add('form-control-lg');\r\n picksElement.classList.remove('form-control-sm');\r\n }\r\n else if (size==\"sm\"){\r\n picksElement.classList.remove('form-control-lg');\r\n picksElement.classList.add('form-control-sm');\r\n }\r\n else{\r\n picksElement.classList.remove('form-control-lg');\r\n picksElement.classList.remove('form-control-sm');\r\n }\r\n}\r\n\r\nfunction updateSizeJsPicks(picksElement, picksLgStyling, picksSmStyling, picksDefStyling, size){\r\n if (size==\"lg\"){\r\n addStyling(picksElement, picksLgStyling);\r\n } else if (size==\"sm\"){\r\n addStyling(picksElement, picksSmStyling);\r\n } else {\r\n addStyling(picksElement, picksDefStyling);\r\n }\r\n}\r\n\r\nfunction updateSizeJs(picksElement, picksLgStyling, picksSmStyling, picksDefStyling, size){\r\n updateSizeClasses(picksElement, size);\r\n updateSizeJsPicks(picksElement, picksLgStyling, picksSmStyling, picksDefStyling, size)\r\n}\r\n\r\nfunction updateSizeForAdapter(picksElement, getSize){\r\n updateSizeClasses(picksElement, getSize())\r\n}\r\n\r\nfunction updateSizeJsForAdapter(picksElement, picksLgStyling, picksSmStyling, picksDefStyling, getSize){\r\n updateSizeJs(picksElement, picksLgStyling, picksSmStyling, picksDefStyling, getSize())\r\n}\r\n\r\nfunction getMessagesElements(containerElement){\r\n var siblings = siblingsAsArray(containerElement);\r\n var invalidMessages = siblings.filter(e=>e.classList.contains('invalid-feedback') || \r\n e.classList.contains('invalid-tooltip'));\r\n var validMessages = siblings.filter(e=>e.classList.contains('valid-feedback') || \r\n e.classList.contains('valid-tooltip'));\r\n return {validMessages, invalidMessages} \r\n} \r\n\r\nfunction composeGetValidity(selectElement){\r\n var getValidity = () => \r\n selectElement.classList.contains('is-invalid')?false:\r\n (selectElement.classList.contains('is-valid')?true:null);\r\n return getValidity;\r\n}\r\n\r\n\r\n\r\n","export function HiddenOptionPlugin(aspects){\r\n let {configuration, createWrapAspect, isChoiceSelectableAspect,\r\n wrapsCollection, buildChoiceAspect, buildAndAttachChoiceAspect,\r\n countableChoicesListInsertAspect, countableChoicesList} = aspects;\r\n\r\n countableChoicesListInsertAspect.countableChoicesListInsert = (wrap, key) => {\r\n if ( !wrap.isOptionHidden ){\r\n let choiceNext = wrapsCollection.getNext(key, c=>!c.isOptionHidden );\r\n countableChoicesList.add(wrap, choiceNext)\r\n }\r\n }\r\n\r\n let origBuildAndAttachChoice = buildAndAttachChoiceAspect.buildAndAttachChoice;\r\n buildAndAttachChoiceAspect.buildAndAttachChoice=(wrap, getNextElement)=>{\r\n if (wrap.isOptionHidden){ \r\n buildHiddenChoice(wrap);\r\n }\r\n else{ \r\n origBuildAndAttachChoice(wrap, getNextElement);\r\n }\r\n }\r\n\r\n var origIsSelectable = isChoiceSelectableAspect.isSelectable;\r\n isChoiceSelectableAspect.isSelectable = (wrap) => origIsSelectable(wrap) && !wrap.isOptionHidden;\r\n\r\n let {getIsOptionHidden, options} = configuration;\r\n if (options) {\r\n if (!getIsOptionHidden)\r\n getIsOptionHidden = (option) => (option.hidden===undefined)?false:option.hidden; \r\n } else {\r\n if (!getIsOptionHidden)\r\n getIsOptionHidden = (option) => {\r\n return option.hidden; \r\n } \r\n }\r\n \r\n var origCreateWrap = createWrapAspect.createWrap;\r\n createWrapAspect.createWrap = (option) => {\r\n let wrap = origCreateWrap(option);\r\n wrap.isOptionHidden = getIsOptionHidden(option);\r\n return wrap;\r\n };\r\n\r\n return {\r\n buildApi(api){ \r\n let getNextNonHidden = (key) => wrapsCollection.getNext(key, c => !c.isOptionHidden );\r\n\r\n api.updateOptionsHidden = () => \r\n wrapsCollection.forLoop( (wrap, key) => \r\n updateChoiceHidden(wrap, key, getNextNonHidden, countableChoicesList, getIsOptionHidden, buildChoiceAspect)\r\n );\r\n\r\n api.updateOptionHidden = (key) => \r\n updateChoiceHidden(wrapsCollection.get(key), key, getNextNonHidden, countableChoicesList, getIsOptionHidden, buildChoiceAspect);\r\n // TODO create updateHidden ? \r\n // it is too complex since we need to find the next non hidden, when this depends on key \r\n // there should be the backreference \"wrap -> index\" invited before\r\n // api.updateOptionHidden = (key) => wrapsCollection.get(key).updateHidden();\r\n }\r\n }\r\n}\r\n\r\nfunction buildHiddenChoice(wrap){\r\n wrap.updateSelected = () => void 0;\r\n \r\n wrap.choice.isChoiceElementAttached = false;\r\n wrap.choice.choiceElement = null;\r\n wrap.choice.choiceElementAttach = null;\r\n wrap.choice.setVisible = null; \r\n wrap.choice.setHoverIn = null;\r\n wrap.choice.remove = null; \r\n \r\n wrap.choice.dispose = () => { \r\n wrap.choice.dispose = null;\r\n };\r\n\r\n wrap.dispose = () => { \r\n wrap.choice.dispose();\r\n wrap.dispose = null;\r\n };\r\n}\r\n\r\nfunction updateChoiceHidden(wrap, key, getNextNonHidden, countableChoicesList, getIsOptionHidden, buildChoiceAspect){\r\n let newIsOptionHidden = getIsOptionHidden(wrap.option);\r\n if (newIsOptionHidden != wrap.isOptionHidden)\r\n {\r\n wrap.isOptionHidden= newIsOptionHidden;\r\n if (wrap.isOptionHidden) {\r\n\r\n countableChoicesList.remove(wrap);\r\n wrap.choice.remove(); \r\n buildHiddenChoice(wrap);\r\n } else {\r\n let nextChoice = getNextNonHidden(key);\r\n countableChoicesList.add(wrap, nextChoice);\r\n buildChoiceAspect.buildChoice(wrap);\r\n wrap.choice.choiceElementAttach(nextChoice?.choice.choiceElement);\r\n }\r\n }\r\n}\r\n","import {createCss, extendCss} from '../ToolsStyling';\r\nimport {isBoolean} from '../ToolsJs';\r\n\r\nexport function CssPatchPlugin(){\r\n}\r\n\r\nCssPatchPlugin.plugMergeSettings = (configuration, defaults, settings) => {\r\n let cssPatch = settings?.cssPatch;\r\n if (isBoolean(cssPatch))\r\n throw new Error(\"BsMultiSelect: 'cssPatch' was used instead of 'useCssPatch'\") // often type of error\r\n configuration.cssPatch = createCss(defaults.cssPatch, cssPatch); // replace classes, merge styles\r\n}\r\n\r\nCssPatchPlugin.plugStaticDom = (configurationPluginData) => {\r\n let {configuration} = configurationPluginData;\r\n if (configuration.useCssPatch)\r\n extendCss(configuration.css, configuration.cssPatch); \r\n}","import {composeSync} from '../ToolsJs';\r\nimport {getDataGuardedWithPrefix} from '../ToolsDom';\r\nimport {toggleStyling} from '../ToolsStyling';\r\nimport {ResetableFlag} from '../ToolsDom'\r\n\r\nexport function PlaceholderPlugin(aspects){\r\n let {configuration, staticManager, picksList, picksDom, filterDom, staticDom, updateDataAspect,\r\n resetFilterListAspect, filterManagerAspect, environment} = aspects;\r\n let isIE11 = environment.isIE11;\r\n let {placeholder, css} = configuration;\r\n let {picksElement} = picksDom;\r\n let filterInputElement = filterDom.filterInputElement;\r\n\r\n function setPlaceholder(placeholder){\r\n filterInputElement.placeholder = placeholder;\r\n }\r\n if (isIE11){\r\n var ignoreNextInputResetableFlag = ResetableFlag(); \r\n let placeholderStopInputAspect = PlaceholderStopInputAspect(ignoreNextInputResetableFlag);\r\n var setPlaceholderOrig = setPlaceholder;\r\n setPlaceholder = function(placeholder){\r\n ignoreNextInputResetableFlag.set();\r\n setPlaceholderOrig(placeholder);\r\n }\r\n \r\n aspects.placeholderStopInputAspect=placeholderStopInputAspect;\r\n }\r\n\r\n if (!placeholder){\r\n placeholder = getDataGuardedWithPrefix(staticDom.initialElement,\"bsmultiselect\",\"placeholder\");\r\n }\r\n\r\n function setEmptyInputWidth(isVisible){\r\n if(isVisible)\r\n filterInputElement.style.width ='100%';\r\n else \r\n filterInputElement.style.width ='2ch';\r\n }\r\n var emptyToggleStyling = toggleStyling(filterInputElement, css.filterInput_empty);\r\n function showPlacehodler(isVisible){\r\n if (isVisible)\r\n {\r\n setPlaceholder(placeholder?placeholder:'');\r\n picksElement.style.display = 'block';\r\n }\r\n else\r\n {\r\n setPlaceholder('');\r\n picksElement.style.display = 'flex';\r\n }\r\n emptyToggleStyling(isVisible);\r\n setEmptyInputWidth(isVisible);\r\n }\r\n showPlacehodler(true);\r\n \r\n function setDisabled(isComponentDisabled){ \r\n filterInputElement.disabled = isComponentDisabled;\r\n };\r\n let isEmpty = () => picksList.isEmpty() && filterDom.isEmpty()\r\n\r\n function updatePlacehodlerVisibility(){\r\n showPlacehodler(isEmpty());\r\n };\r\n function updateEmptyInputWidth(){\r\n setEmptyInputWidth(isEmpty())\r\n };\r\n \r\n let origDisable = picksDom.disable;\r\n picksDom.disable = (isComponentDisabled)=>{\r\n setDisabled(isComponentDisabled);\r\n origDisable(isComponentDisabled);\r\n };\r\n\r\n staticManager.appendToContainer = composeSync(staticManager.appendToContainer, updateEmptyInputWidth);\r\n\r\n filterManagerAspect.processEmptyInput = composeSync(updateEmptyInputWidth, filterManagerAspect.processEmptyInput);\r\n resetFilterListAspect.forceResetFilter = composeSync(resetFilterListAspect.forceResetFilter, updatePlacehodlerVisibility);\r\n \r\n let origAdd = picksList.add;\r\n picksList.add = (pick) => { \r\n let returnValue = origAdd(pick);\r\n if (picksList.getCount()==1 ){ // make flex\r\n if (filterDom.isEmpty()){\r\n setPlaceholder('');\r\n picksElement.style.display = 'flex';\r\n emptyToggleStyling(false);\r\n filterInputElement.style.width ='2ch';\r\n } else {\r\n picksElement.style.display = 'flex';\r\n }\r\n }\r\n pick.dispose = composeSync(pick.dispose, function()\r\n { \r\n if (picksList.getCount()==0) \r\n updatePlacehodlerVisibility()\r\n });\r\n return returnValue;\r\n };\r\n\r\n updateDataAspect.updateData = composeSync(updateDataAspect.updateData, updatePlacehodlerVisibility);\r\n \r\n}\r\n\r\nfunction PlaceholderStopInputAspect(resetableFlag){\r\n return{\r\n get(){\r\n return resetableFlag.get();\r\n },\r\n reset(){\r\n return resetableFlag.reset();\r\n } \r\n }\r\n}","import {EventBinder} from '../ToolsDom';\r\nimport {addStyling, toggleStyling} from '../ToolsStyling';\r\n\r\nexport function JQueryMethodsPlugin(pluginData){\r\n let {staticDom, choicesDom, filterDom, picksList} = pluginData;\r\n return {\r\n buildApi(api){\r\n api.getContainer = () => staticDom.containerElement;\r\n api.getChoices = () => choicesDom.choicesElement;\r\n api.getChoicesList = () => choicesDom.choicesListElement;\r\n api.getFilterInput = () => filterDom.filterInputElement;\r\n api.getPicks = () => picksDom.picksElement;\r\n \r\n api.picksCount = () => picksList.getCount();\r\n\r\n pluginData.jQueryMethodsPluginData = {EventBinder, addStyling, toggleStyling}\r\n }\r\n }\r\n}","export function OptionsApiPlugin(pluginData){\r\n let {buildAndAttachChoiceAspect, wraps, wrapsCollection, createWrapAspect, createChoiceBaseAspect,\r\n optionsAspect, resetLayoutAspect} = pluginData;\r\n return {\r\n buildApi(api){\r\n\r\n api.updateOptionAdded = (key) => { // TODO: generalize index as key \r\n let options = optionsAspect.getOptions();\r\n let option = options[key];\r\n \r\n let wrap = createWrapAspect.createWrap(option);\r\n wrap.choice= createChoiceBaseAspect.createChoiceBase(option);\r\n wraps.insert(key, wrap);\r\n let nextChoice = ()=> wrapsCollection.getNext(key, c => c.choice.choiceElement);\r\n\r\n buildAndAttachChoiceAspect.buildAndAttachChoice(\r\n wrap,\r\n () => nextChoice()?.choice.choiceElement\r\n )\r\n }\r\n \r\n api.updateOptionRemoved = (key) => { // TODO: generalize index as key \r\n resetLayoutAspect.resetLayout(); // always hide 1st, then reset filter\r\n \r\n var wrap = wraps.remove(key);\r\n wrap.choice.remove?.();\r\n wrap.dispose?.();\r\n }\r\n }\r\n }\r\n}","import {closestByTagName, findDirectChildByTagName, closestByClassName} from '../ToolsDom';\r\nimport {composeSync} from '../ToolsJs';\r\n\r\nexport function SelectElementPlugin(){\r\n}\r\n\r\nSelectElementPlugin.plugStaticDom = (aspects)=>{\r\n let {configuration, staticDomFactory, createElementAspect,\r\n componentPropertiesAspect, onChangeAspect, triggerAspect, optionsAspect, disposeAspect} = aspects;\r\n let {create: origCreate} = staticDomFactory;\r\n staticDomFactory.create = (css) => {\r\n let {choicesDom, createStaticDom: origCreateStaticDom} = origCreate(css);\r\n let {choicesElement} = choicesDom;\r\n return { \r\n choicesDom,\r\n createStaticDom(element, containerClass){\r\n let selectElement = null;\r\n let containerElement = null;\r\n let picksElement = null;\r\n if (element.tagName == 'SELECT') {\r\n selectElement = element;\r\n if (containerClass){\r\n containerElement = closestByClassName(selectElement, containerClass)\r\n if (containerElement)\r\n picksElement = findDirectChildByTagName(containerElement, 'UL');\r\n }\r\n } else if (element.tagName == 'DIV') {\r\n selectElement = findDirectChildByTagName(element, 'SELECT');\r\n if (selectElement) {\r\n if (containerClass){\r\n containerElement = closestByClassName(element, containerClass);\r\n if (containerElement)\r\n picksElement = findDirectChildByTagName(containerElement, 'UL');\r\n }\r\n } else {\r\n return origCreateStaticDom(element, containerClass);\r\n } \r\n }\r\n\r\n let disposableContainerElement = false;\r\n if (!containerElement) {\r\n containerElement = createElementAspect.createElement('DIV');\r\n containerElement.classList.add(containerClass);\r\n disposableContainerElement= true;\r\n }\r\n \r\n let disposablePicksElement = false;\r\n if (!picksElement) {\r\n picksElement = createElementAspect.createElement('UL');\r\n disposablePicksElement = true; \r\n }\r\n \r\n if (selectElement){\r\n var backupDisplay = selectElement.style.display;\r\n selectElement.style.display = 'none';\r\n\r\n var backupedRequired = selectElement.required;\r\n aspects.selectElementPluginData = {required: backupedRequired};\r\n if(selectElement.required===true)\r\n selectElement.required = false;\r\n\r\n let {getDisabled} = configuration;\r\n\r\n if(!getDisabled) {\r\n var fieldsetElement = closestByTagName(selectElement, 'FIELDSET');\r\n if (fieldsetElement) {\r\n componentPropertiesAspect.getDisabled = () => selectElement.disabled || fieldsetElement.disabled;\r\n } else {\r\n componentPropertiesAspect.getDisabled = () => selectElement.disabled;\r\n }\r\n }\r\n onChangeAspect.onChange = composeSync(() => triggerAspect.trigger('change'), onChangeAspect.onChange) \r\n optionsAspect.getOptions = () => selectElement.options;\r\n \r\n // if (!setSelected){\r\n // setSelected = (option, value) => {option.selected = value};\r\n // // NOTE: adding this (setAttribute) break Chrome's html form reset functionality:\r\n // // if (value) option.setAttribute('selected','');\r\n // // else option.removeAttribute('selected');\r\n // }\r\n \r\n disposeAspect.dispose = composeSync(disposeAspect.dispose, () => {\r\n selectElement.required = backupedRequired;\r\n selectElement.style.display = backupDisplay;\r\n });\r\n }\r\n\r\n return {\r\n staticDom: {\r\n initialElement:element,\r\n containerElement,\r\n picksElement,\r\n disposablePicksElement,\r\n selectElement\r\n }, \r\n staticManager :{\r\n appendToContainer(){ \r\n if (disposableContainerElement){\r\n selectElement.parentNode.insertBefore(containerElement, selectElement.nextSibling) \r\n containerElement.appendChild(choicesElement)\r\n } else {\r\n selectElement.parentNode.insertBefore(choicesElement, selectElement.nextSibling)\r\n }\r\n if (disposablePicksElement)\r\n containerElement.appendChild(picksElement)\r\n },\r\n dispose(){ \r\n choicesElement.parentNode.removeChild(choicesElement);\r\n if (disposableContainerElement)\r\n selectElement.parentNode.removeChild(containerElement) \r\n if (disposablePicksElement)\r\n containerElement.removeChild(picksElement)\r\n }\r\n }};\r\n }\r\n }\r\n }\r\n}","import {composeSync} from '../ToolsJs';\r\n\r\n// TODO: there should be two new \"independent aspects\" AddPickAspect and RemovePickAspect \r\n// plugin should overdrive them : call setWrapSelected and etc\r\n// therefore there should new component API methods\r\n// addOptionPick(key) -> call addPick(pick) which returns removePick() \r\n// SetOptionSelectedAspect, OptionToggleAspect should be moved there \r\n// OptionToggleAspect overrided in DisabledOptionPlugin\r\n\r\n// wrap.isOptionSelected , wrap.updateSelected\r\nexport function SelectedOptionPlugin(aspects){\r\n let {configuration, wrapsCollection, \r\n createWrapAspect, buildChoiceAspect, removePickAspect,\r\n resetLayoutAspect, picksList, isChoiceSelectableAspect, optionToggleAspect,\r\n /*inputAspect, filterDom, filterManagerAspect,*/ createPickHandlersAspect, addPickAspect, fullMatchAspect, \r\n onChangeAspect, filterPredicateAspect\r\n } = aspects;\r\n let {getSelected : getIsOptionSelected, setSelected : setIsOptionSelected, options} = configuration;\r\n \r\n if (options) {\r\n if (!setIsOptionSelected){\r\n setIsOptionSelected = (option, value) => {option.selected = value};\r\n }\r\n if (!getIsOptionSelected)\r\n getIsOptionSelected = (option) => option.selected; \r\n } else { // selectElement\r\n if (!getIsOptionSelected){\r\n getIsOptionSelected = (option) => option.selected;\r\n }\r\n if (!setIsOptionSelected){\r\n setIsOptionSelected = (option, value) => {option.selected = value};\r\n // NOTE: adding this (setAttribute) break Chrome's html form reset functionality:\r\n // if (value) option.setAttribute('selected','');\r\n // else option.removeAttribute('selected');\r\n }\r\n }\r\n\r\n let origFilterPredicate = filterPredicateAspect.filterPredicate;\r\n filterPredicateAspect.filterPredicate = (wrap, text) =>\r\n !wrap.isOptionSelected && origFilterPredicate(wrap, text)\r\n\r\n\r\n let origBuildChoice = buildChoiceAspect.buildChoice;\r\n buildChoiceAspect.buildChoice= (wrap) => {\r\n origBuildChoice(wrap);\r\n wrap.updateSelected = () => {\r\n wrap.choice.choiceDomManagerHandlers.updateSelected();\r\n onChangeAspect.onChange();\r\n }\r\n wrap.dispose = composeSync( ()=>{wrap.updateSelected = null}, wrap.dispose)\r\n }\r\n\r\n // TODO: test this instead of wrap.updateSelected\r\n // function updateSelected(wrap){\r\n // if (wrap.pick){\r\n // if (wrap.isOptionSelected)\r\n // pickHandlers.producePick();\r\n // else {\r\n // pickHandlers.removeAndDispose();\r\n // pickHandlers.removeAndDispose=null;\r\n // }\r\n // }\r\n // wrap.choice.choiceDomManagerHandlers.updateSelected();\r\n // onChangeAspect.onChange();\r\n // }\r\n\r\n\r\n function composeUpdateSelected(wrap, booleanValue){\r\n return () => {\r\n wrap.isOptionSelected = booleanValue;\r\n wrap.updateSelected();\r\n }\r\n }\r\n\r\n function trySetWrapSelected(option, updateSelected, booleanValue){ // wrap.option\r\n let success = false;\r\n var confirmed = setIsOptionSelected(option, booleanValue); \r\n if (!(confirmed===false)) {\r\n updateSelected(); \r\n success = true;\r\n }\r\n return success;\r\n }\r\n\r\n let origCreateWrap = createWrapAspect.createWrap;\r\n createWrapAspect.createWrap = (option)=>{\r\n let wrap = origCreateWrap(option);\r\n wrap.isOptionSelected = getIsOptionSelected(option);\r\n wrap.updateSelected = null; // can it be combined ?\r\n return wrap;\r\n }\r\n \r\n\r\n let origToggle = optionToggleAspect.toggle; // TODO: improve design, no replace\r\n optionToggleAspect.toggle= (wrap) => {\r\n return trySetWrapSelected(wrap.option, composeUpdateSelected(wrap, !wrap.isOptionSelected), !wrap.isOptionSelected)\r\n }\r\n \r\n let origFullMatch = fullMatchAspect.fullMatch;\r\n fullMatchAspect.fullMatch = (wrap) => {\r\n return trySetWrapSelected(wrap.option, composeUpdateSelected(wrap, true), true);\r\n }\r\n\r\n let removePickOrig = removePickAspect.removePick; // TODO: improve design, no replace\r\n removePickAspect.removePick = (wrap, pick) => { // TODO: try remove pick\r\n return trySetWrapSelected(wrap.option, composeUpdateSelected(wrap, false), false);\r\n }\r\n\r\n \r\n let origCreatePickHandlers = createPickHandlersAspect.createPickHandlers;\r\n createPickHandlersAspect.createPickHandlers = (wrap)=>{\r\n let pickHandlers = origCreatePickHandlers(wrap);\r\n wrap.updateSelected = composeSync(\r\n ()=>{\r\n if (wrap.isOptionSelected){\r\n let pick = pickHandlers.producePick();\r\n wrap.pick = pick;\r\n pick.dispose = composeSync(pick.dispose, ()=>{wrap.pick=null;});\r\n }\r\n else {\r\n pickHandlers.removeAndDispose();\r\n pickHandlers.removeAndDispose=null;\r\n }\r\n },\r\n wrap.updateSelected\r\n )\r\n\r\n addPickAspect.addPick(wrap, pickHandlers); \r\n return pickHandlers;\r\n }\r\n\r\n let origAddPick = addPickAspect.addPick;\r\n addPickAspect.addPick = (wrap, pickHandlers) => {\r\n if (wrap.isOptionSelected){\r\n let pick = origAddPick(wrap, pickHandlers);\r\n wrap.pick = pick;\r\n pick.dispose = composeSync(pick.dispose, ()=>{wrap.pick=null;});\r\n return pick;\r\n }\r\n }\r\n\r\n return {\r\n buildApi(api){\r\n api.selectAll= ()=>{\r\n resetLayoutAspect.resetLayout(); // always hide 1st\r\n wrapsCollection.forLoop(\r\n wrap => {\r\n if (isChoiceSelectableAspect.isSelectable(wrap) && !wrap.isOptionSelected)\r\n trySetWrapSelected(wrap.option, composeUpdateSelected(wrap, true), true)\r\n }\r\n ); \r\n }\r\n \r\n api.deselectAll= ()=>{\r\n resetLayoutAspect.resetLayout(); // always hide 1st\r\n picksList.forEach(pick=>pick.setSelectedFalse())\r\n }\r\n\r\n api.setOptionSelected = (key, value) => {\r\n let wrap = wrapsCollection.get(key);\r\n return trySetWrapSelected(wrap.option, composeUpdateSelected(wrap, value), value);\r\n }\r\n\r\n // used in FormRestoreOnBackwardPlugin\r\n api.updateOptionsSelected = () => wrapsCollection.forLoop( wrap => updateChoiceSelected(wrap, getIsOptionSelected))\r\n api.updateOptionSelected = (key) => updateChoiceSelected(wrapsCollection.get(key), getIsOptionSelected)\r\n }\r\n }\r\n}\r\n\r\nfunction updateChoiceSelected(wrap, getIsOptionSelected){\r\n let newIsSelected = getIsOptionSelected(wrap.option);\r\n if (newIsSelected != wrap.isOptionSelected)\r\n {\r\n wrap.isOptionSelected = newIsSelected;\r\n wrap.updateSelected?.(); // some hidden oesn't have element (and need to be updated)\r\n }\r\n}","import {composeSync} from '../ToolsJs';\r\n\r\nexport function DisabledOptionPlugin(pluginData){\r\n let {configuration, isChoiceSelectableAspect, createWrapAspect, buildChoiceAspect,\r\n filterPredicateAspect, wrapsCollection, optionToggleAspect, buildPickAspect } = pluginData;\r\n \r\n let {getIsOptionDisabled, options} = configuration;\r\n if (options) {\r\n if (!getIsOptionDisabled)\r\n getIsOptionDisabled = (option) => (option.disabled===undefined) ? false : option.disabled; \r\n } else { // selectElement\r\n if (!getIsOptionDisabled)\r\n getIsOptionDisabled = (option) => option.disabled; \r\n }\r\n\r\n // TODO check this instead of wrap.updateDisabled\r\n // function updateDisabled(wrap){\r\n // wrap?.choice?.choiceDomManagerHandlers?.updateDisabled?.();\r\n // wrap?.pick?.pickDomManagerHandlers?.updateDisabled?.();\r\n // }\r\n\r\n let origCreateWrap = createWrapAspect.createWrap;\r\n createWrapAspect.createWrap = (option) => {\r\n let wrap = origCreateWrap(option);\r\n wrap.isOptionDisabled = getIsOptionDisabled(option); // TODO: remove usage wrap.isOptionDisabled\r\n wrap.updateDisabled = null; \r\n return wrap;\r\n };\r\n\r\n let origToggle = optionToggleAspect.toggle;\r\n optionToggleAspect.toggle = (wrap) => {\r\n let success = false;\r\n if (wrap.isOptionSelected!==undefined){\r\n if (wrap.isOptionSelected || !wrap.isOptionDisabled) // TODO: declare dependency on SelectedOptionPlugin\r\n success = origToggle(wrap);\r\n }\r\n else{\r\n if (!wrap.isOptionDisabled) {\r\n success = origToggle(wrap);\r\n }\r\n }\r\n return success;\r\n };\r\n\r\n let origIsSelectable = isChoiceSelectableAspect.isSelectable\r\n isChoiceSelectableAspect.isSelectable = (wrap) => {\r\n return origIsSelectable(wrap) && !wrap.isOptionDisabled ;\r\n };\r\n\r\n let origFilterPredicate = filterPredicateAspect.filterPredicate;\r\n filterPredicateAspect.filterPredicate = (wrap, text) => {\r\n return !wrap.isOptionDisabled && origFilterPredicate(wrap, text) ;\r\n };\r\n\r\n let origBuildChoice = buildChoiceAspect.buildChoice;\r\n buildChoiceAspect.buildChoice = (wrap) => {\r\n origBuildChoice(wrap);\r\n wrap.updateDisabled = wrap.choice.choiceDomManagerHandlers.updateDisabled\r\n wrap.choice.dispose = composeSync(()=>{wrap.updateDisabled=null;}, wrap.choice.dispose);\r\n }\r\n \r\n let origBuildPick = buildPickAspect.buildPick;\r\n buildPickAspect.buildPick = (wrap, removeOnButton) => {\r\n let pick = origBuildPick(wrap, removeOnButton);\r\n \r\n pick.updateDisabled = () => pick.pickDomManagerHandlers.updateDisabled();\r\n pick.dispose = composeSync(pick.dispose, ()=>{pick.updateDisabled=null});\r\n\r\n let choiceUpdateDisabledBackup = wrap.updateDisabled;\r\n wrap.updateDisabled = composeSync(choiceUpdateDisabledBackup, pick.updateDisabled); // add pickDisabled\r\n pick.dispose = composeSync(pick.dispose, \r\n ()=>{\r\n wrap.updateDisabled = choiceUpdateDisabledBackup; // remove pickDisabled\r\n wrap.updateDisabled(); // make \"true disabled\" without it checkbox only looks disabled\r\n }\r\n )\r\n return pick;\r\n }\r\n\r\n return {\r\n buildApi(api){\r\n api.updateOptionsDisabled = () => wrapsCollection.forLoop( wrap => updateChoiceDisabled(wrap, getIsOptionDisabled))\r\n api.updateOptionDisabled = (key) => updateChoiceDisabled(wrapsCollection.get(key), getIsOptionDisabled)\r\n }\r\n };\r\n}\r\n\r\nfunction updateChoiceDisabled(wrap, getIsOptionDisabled){\r\n let newIsDisabled = getIsOptionDisabled(wrap.option);\r\n if (newIsDisabled != wrap.isOptionDisabled)\r\n {\r\n wrap.isOptionDisabled= newIsDisabled;\r\n wrap.updateDisabled?.(); // some hidden oesn't have element (and need to be updated)\r\n }\r\n}","export function PicksApiPlugin(pluginData){\r\n let {picksList, createWrapAspect, createPickHandlersAspect, addPickAspect} = pluginData;\r\n return {\r\n buildApi(api){\r\n api.forEachPeak = (f) => \r\n picksList.forEach(wrap=>f(wrap.option));\r\n // TODO: getHeadPeak\r\n api.getTailPeak = () => picksList.getTail()?.option;\r\n api.countPeaks = () => picksList.getCount();\r\n api.isEmptyPeaks = () => picksList.isEmpty();\r\n \r\n api.addPick = (option) => {\r\n let wrap = createWrapAspect.createWrap(option);\r\n // TODO should be moved to specific plugins\r\n wrap.updateDisabled = ()=>{};\r\n wrap.updateHidden = ()=>{};\r\n let pickHandlers = createPickHandlersAspect.createPickHandlers(wrap);\r\n addPickAspect.addPick(wrap, pickHandlers);\r\n }\r\n }\r\n }\r\n}","import {composeSync} from '../ToolsJs';\r\n\r\nexport function PicksPlugin(aspects){\r\n let {configuration, inputAspect, filterDom, filterManagerAspect} = aspects;\r\n let {picks, addOptionPicked} = configuration;\r\n /*\r\n if (!addOptionPicked){\r\n addOptionPicked = (option, index, value) => {\r\n if (value)\r\n picks.push(option);\r\n else\r\n picks.splice(index, 1);\r\n return true;\r\n };\r\n }\r\n\r\n function trySetWrapSelected(option, updateSelected, booleanValue){\r\n let success = false;\r\n var confirmed = setIsOptionSelected(option, booleanValue);\r\n if (!(confirmed===false)) {\r\n updateSelected();\r\n success = true;\r\n }\r\n return success;\r\n }\r\n\r\n let origProcessInput = inputAspect.processInput;\r\n inputAspect.processInput = () => {\r\n let origResult = origProcessInput();\r\n if (!origResult.isEmpty)\r\n {\r\n if ( filterManagerAspect.getNavigateManager().getCount() == 1)\r\n {\r\n // todo: move exact match to filterManager\r\n let fullMatchWrap = filterManagerAspect.getNavigateManager().getHead();\r\n let text = filterManagerAspect.getFilter();\r\n if (fullMatchWrap.choice.searchText == text)\r\n {\r\n let success = trySetWrapSelected(fullMatchWrap, true);\r\n if (success) {\r\n filterDom.setEmpty();\r\n origResult.isEmpty = true;\r\n }\r\n }\r\n }\r\n }\r\n return origResult;\r\n }*/\r\n}\r\n\r\nPicksPlugin.plugStaticDom = (aspects) => {\r\n let {configuration, picksList} = aspects;\r\n let {picks} = configuration;\r\n if (picks) {\r\n let {add: origAdd, reset: origReset} = picksList;\r\n\r\n picksList.add = (e) => {\r\n let {remove, index} = origAdd(e);\r\n picks.push(e);\r\n return { remove: composeSync(remove, () => void picks.splice(index(), 1)), index};\r\n }\r\n\r\n picksList.reset = () => {\r\n origReset();\r\n picks.length = 0;\r\n }\r\n }\r\n}","export function CreatePopperPlugin(pluginData){\r\n let {environment} = pluginData;\r\n let {createPopper, Popper} = environment;\r\n\r\n if (typeof createPopper === 'undefined') {\r\n createPopper = Popper;\r\n if (typeof createPopper === 'undefined') {\r\n throw new Error(\"BsMultiSelect: Popper component (https://popper.js.org) is required\")\r\n }\r\n } else {\r\n if (createPopper.createPopper) {\r\n createPopper = createPopper.createPopper;\r\n }\r\n }\r\n\r\n pluginData.createPopperAspect = {\r\n create(element, anchorElement, preventOverflow){\r\n let popperConfiguration = {\r\n placement: 'bottom-start',\r\n modifiers: {\r\n preventOverflow: {enabled:preventOverflow},\r\n hide: {enabled:false},\r\n flip: {enabled:false}\r\n }\r\n };\r\n let popper = null;\r\n return {\r\n init(){\r\n if (!!createPopper.prototype && !!createPopper.prototype.constructor) { // it is a constructor\r\n popper = new createPopper(anchorElement, element, popperConfiguration); \r\n }else{\r\n popper = createPopper(anchorElement, element, popperConfiguration); \r\n }\r\n },\r\n update(){ \r\n popper.update(); // become async in poppoer 2; use forceUpdate if sync is needed? \r\n },\r\n setRtl(isRtl){\r\n if (isRtl) {\r\n popperConfiguration.placement = 'bottom-end';\r\n }\r\n },\r\n dispose(){\r\n popper.destroy();\r\n }\r\n }\r\n }\r\n };\r\n}\r\n\r\n","import {composeSync} from '../ToolsJs';\r\nimport {toggleStyling} from '../ToolsStyling';\r\n\r\nexport function FloatingLabelPlugin(pluginData){\r\n let {configuration, picksList, picksDom, filterDom, staticDom, updateDataAspect,\r\n resetFilterListAspect, floatingLabelAspect} = pluginData;\r\n let {css, getDefaultLabel} = configuration;\r\n \r\n let initialElement = staticDom.initialElement;\r\n if (floatingLabelAspect.isFloatingLabel() ){\r\n \r\n let labelElement = getDefaultLabel(initialElement);\r\n let picksElement = picksDom.picksElement;\r\n\r\n var liftToggleStyling1 = toggleStyling(labelElement, css.label_floating_lifted);\r\n var liftToggleStyling2 = toggleStyling(picksElement, css.picks_floating_lifted);\r\n\r\n function liftedLabel(isEmpty){\r\n liftToggleStyling1(isEmpty);\r\n liftToggleStyling2(isEmpty);\r\n }\r\n\r\n let isEmpty = () => picksList.isEmpty() && filterDom.isEmpty() && !picksDom.getIsFocusIn();;\r\n\r\n function updateLiftedLabel(){\r\n liftedLabel(!isEmpty());\r\n };\r\n\r\n updateLiftedLabel();\r\n\r\n resetFilterListAspect.forceResetFilter = composeSync(resetFilterListAspect.forceResetFilter, updateLiftedLabel);\r\n \r\n let origAdd = picksList.add;\r\n picksList.add = (pick) => { \r\n let returnValue = origAdd(pick);\r\n if (picksList.getCount()==1) \r\n updateLiftedLabel()\r\n pick.dispose = composeSync(pick.dispose, ()=>\r\n { \r\n if (picksList.getCount()==0) \r\n updateLiftedLabel()\r\n })\r\n return returnValue;\r\n };\r\n \r\n var origToggleFocusStyling = picksDom.toggleFocusStyling;\r\n picksDom.toggleFocusStyling = () => {\r\n var isFocusIn = picksDom.getIsFocusIn();\r\n origToggleFocusStyling(isFocusIn);\r\n updateLiftedLabel();\r\n }\r\n\r\n updateDataAspect.updateData = composeSync(updateDataAspect.updateData, updateLiftedLabel);\r\n }\r\n}\r\n\r\nFloatingLabelPlugin.plugStaticDom = (aspects) => {\r\n aspects.floatingLabelAspect = FloatingLabelAspect();\r\n}\r\n\r\nfunction FloatingLabelAspect() {\r\n return {\r\n isFloatingLabel(){},\r\n }\r\n}","export function ChoicesDynamicStylingPlugin(aspects){\r\n let {configuration} = aspects;\r\n if (configuration.useChoicesDynamicStyling) {\r\n let {choicesVisibilityAspect, specialPicksEventsAspect} = aspects;\r\n var origSetChoicesVisible = choicesVisibilityAspect.setChoicesVisible;\r\n aspects.choicesVisibilityAspect.setChoicesVisible = \r\n function(visible){\r\n if (visible)\r\n choicesDynamicStyling(aspects);\r\n origSetChoicesVisible(visible);\r\n };\r\n var origBackSpace = specialPicksEventsAspect.backSpace;\r\n specialPicksEventsAspect.backSpace = (pick) => { origBackSpace(pick); choicesDynamicStyling(aspects);};\r\n }\r\n}\r\n\r\nfunction choicesDynamicStyling(aspects){\r\n let {configuration, environment, choicesDom} = aspects;\r\n let window = environment.window;\r\n let choicesElement = choicesDom.choicesElement;\r\n let minimalChoicesDynamicStylingMaxHeight = configuration.minimalChoicesDynamicStylingMaxHeight;\r\n\r\n //find height of the browser window\r\n var g = window.document.getElementsByTagName('body')[0],\r\n e = window.document.documentElement,\r\n y = window.innerHeight || e.clientHeight || g.clientHeight;\r\n \r\n //find position of choicesElement, if it's at the bottom of the page make the choicesElement shorter\r\n var pos = choicesElement.parentNode.getBoundingClientRect();\r\n var new_y = y - pos.top;\r\n \r\n //calculate multi select max-height\r\n var msHeight = Math.max(minimalChoicesDynamicStylingMaxHeight, Math.round((new_y * 0.85))); // Michalek: 0.85 is empiric value, without it list was longer than footer height ; TODO: propose better way\r\n \r\n //add css height value\r\n choicesElement.style.setProperty(\"max-height\", msHeight+\"px\");\r\n choicesElement.style.setProperty(\"overflow-y\", \"auto\");\r\n}\r\n\r\nChoicesDynamicStylingPlugin.plugDefaultConfig = (defaults)=>{\r\n defaults.useChoicesDynamicStyling = false;\r\n defaults.choicesDynamicStyling = choicesDynamicStyling;\r\n defaults.minimalChoicesDynamicStylingMaxHeight = 20;\r\n}\r\n","import { addStyling } from \"../ToolsStyling\";\r\n\r\nexport function WarningPlugin(pluginData){\r\n\r\n let {configuration, choicesDom, createElementAspect, staticManager} = pluginData;\r\n let {css} = configuration;\r\n if (configuration.isNoResultsWarningEnabled)\r\n pluginData.warningAspect = WarningAspect(choicesDom, createElementAspect, staticManager, css)\r\n}\r\n\r\nWarningPlugin.plugDefaultConfig = (defaults)=>{\r\n defaults.noResultsWarning = \"No results found\";\r\n defaults.isNoResultsWarningEnabled = false;\r\n}\r\n\r\nfunction WarningAspect(choicesDom, createElementAspect, staticManager, css){\r\n let choicesElement = choicesDom.choicesElement;\r\n\r\n var warningElement = createElementAspect.createElement('div'); \r\n \r\n var origAppendToContainer = staticManager.appendToContainer;\r\n staticManager.appendToContainer = function(){\r\n origAppendToContainer();\r\n choicesElement.parentNode.insertBefore(warningElement, choicesElement.nextSibling); // insert after\r\n }\r\n \r\n warningElement.style.display = 'none';\r\n addStyling(warningElement, css.warning);\r\n\r\n return {\r\n warningElement,\r\n show(message){\r\n warningElement.style.display = 'block';\r\n warningElement.innerHTML = message;\r\n },\r\n hide(){\r\n warningElement.style.display = 'none';\r\n warningElement.innerHTML = \"\";\r\n }\r\n }\r\n}","export function HighlightPlugin(aspects){\r\n let {highlightAspect, filterManagerAspect, buildChoiceAspect} = aspects;\r\n if (highlightAspect) {\r\n let origProcessEmptyInput = filterManagerAspect.processEmptyInput;\r\n filterManagerAspect.processEmptyInput = function(){\r\n highlightAspect.reset();\r\n origProcessEmptyInput(); \r\n }\r\n let origSetFilter = filterManagerAspect.setFilter;\r\n filterManagerAspect.setFilter = function(text){\r\n highlightAspect.set(text);\r\n origSetFilter(text);\r\n }\r\n let origBuildChoice = buildChoiceAspect.buildChoice;\r\n buildChoiceAspect.buildChoice = function(wrap){\r\n origBuildChoice(wrap);\r\n let origSetVisible = wrap.choice.setVisible;\r\n wrap.choice.setVisible = function(v){\r\n origSetVisible(v);\r\n wrap.choice.choiceDomManagerHandlers.updateHighlighted();\r\n }\r\n }\r\n }\r\n}\r\n\r\nHighlightPlugin.plugStaticDom = (aspects) => {\r\n if (aspects.configuration.useHighlighting)\r\n aspects.highlightAspect = HighlightAspect();\r\n}\r\n\r\nHighlightPlugin.plugDefaultConfig = (defaults) => {\r\n defaults.useHighlighting = false;\r\n}\r\n\r\nfunction HighlightAspect(){\r\n let highlighter = null;\r\n return {\r\n getHighlighter(){\r\n return highlighter;\r\n },\r\n set(filter){\r\n var guarded = filter.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\r\n var regex = new RegExp(\"(\"+guarded+\")\",\"gi\");\r\n highlighter = function(e, choiceDom, text){\r\n // TODO replace with\r\n // var pos = text.indexOf(filter);\r\n e.innerHTML = text.replace(regex,\"$1\");\r\n // TODO to method\r\n // var nodes = e.querySelectorAll('u');\r\n // var array = Array.prototype.slice.call(nodes);\r\n // if (choiceDom.highlightedElements)\r\n // choiceDom.highlightedElements.concat(array);\r\n // else\r\n // choiceDom.highlightedElements = array;\r\n }\r\n },\r\n reset(){\r\n highlighter = null;\r\n }\r\n }\r\n}","import { composeSync } from \"../ToolsJs\";\r\n\r\nexport function CustomChoiceStylingsPlugin(apsects){\r\n let {configuration, choiceDomFactory} = apsects;\r\n let customChoiceStylingsAspect = CustomChoiceStylingsAspect(configuration.customChoiceStylings);\r\n let origChoiceDomFactoryCreate = choiceDomFactory.create;\r\n choiceDomFactory.create = function(choiceElement, wrap, toggle){\r\n var o = origChoiceDomFactoryCreate(choiceElement, wrap, toggle);\r\n customChoiceStylingsAspect.customize(wrap, o.choiceDom, o.choiceDomManagerHandlers);\r\n return o;\r\n }\r\n}\r\n\r\nCustomChoiceStylingsPlugin.plugDefaultConfig = (defaults)=>{\r\n defaults.customChoiceStylings = null;\r\n}\r\n\r\nexport function CustomChoiceStylingsAspect(customChoiceStylings){\r\n \r\n return {\r\n customize(wrap, choiceDom, choiceDomManagerHandlers){\r\n if (customChoiceStylings){\r\n var handlers = customChoiceStylings(choiceDom, wrap.option);\r\n\r\n if (handlers){\r\n function customChoiceStylingsClosure(custom){\r\n return function() {\r\n custom({\r\n isOptionSelected: wrap.isOptionSelected,\r\n isOptionDisabled: wrap.isOptionDisabled,\r\n isHoverIn: wrap.choice.isHoverIn,\r\n //isHighlighted: wrap.choice.isHighlighted // TODO isHighlighted should be developed\r\n });\r\n }\r\n }\r\n if (choiceDomManagerHandlers.updateHoverIn && handlers.updateHoverIn) \r\n choiceDomManagerHandlers.updateHoverIn \r\n = composeSync(choiceDomManagerHandlers.updateHoverIn, customChoiceStylingsClosure(handlers.updateHoverIn) );\r\n if (choiceDomManagerHandlers.updateSelected && handlers.updateSelected) \r\n choiceDomManagerHandlers.updateSelected \r\n = composeSync(choiceDomManagerHandlers.updateSelected, customChoiceStylingsClosure(handlers.updateSelected));\r\n if (choiceDomManagerHandlers.updateDisabled && handlers.updateDisabled) \r\n choiceDomManagerHandlers.updateDisabled\r\n = composeSync(choiceDomManagerHandlers.updateDisabled, customChoiceStylingsClosure(handlers.updateDisabled));\r\n if (choiceDomManagerHandlers.updateHighlighted && handlers.updateHighlighted) \r\n choiceDomManagerHandlers.updateHighlighted\r\n = composeSync(choiceDomManagerHandlers.updateHighlighted, customChoiceStylingsClosure(handlers.updateHighlighted));\r\n }\r\n }\r\n }\r\n }\r\n}","import { composeSync } from \"../ToolsJs\";\r\n\r\nexport function CustomPickStylingsPlugin(aspects){\r\n let {componentPropertiesAspect,configuration, pickDomFactory} = aspects;\r\n let customPickStylingsAspect = CustomPickStylingsAspect(componentPropertiesAspect, configuration.customPickStylings);\r\n let origPickDomFactoryCreate = pickDomFactory.create;\r\n pickDomFactory.create = function(pickElement, wrap, removeOnButton){\r\n var o = origPickDomFactoryCreate(pickElement, wrap, removeOnButton);\r\n customPickStylingsAspect.customize(wrap, o.pickDom, o.pickDomManagerHandlers);\r\n return o;\r\n }\r\n}\r\n\r\nCustomPickStylingsPlugin.plugDefaultConfig = (defaults)=>{\r\n defaults.customPickStylings = null;\r\n}\r\n\r\nfunction CustomPickStylingsAspect(componentPropertiesAspect, customPickStylings){\r\n \r\n return {\r\n customize(wrap, pickDom, pickDomManagerHandlers){\r\n if (customPickStylings){\r\n var handlers = customPickStylings(pickDom, wrap.option);\r\n\r\n if (handlers){\r\n function customPickStylingsClosure(custom){\r\n return function() {\r\n custom({\r\n isOptionDisabled: wrap.isOptionDisabled,\r\n isComponentDisabled: componentPropertiesAspect.getDisabled()\r\n });\r\n }\r\n }\r\n if (pickDomManagerHandlers.updateDisabled && handlers.updateDisabled) \r\n pickDomManagerHandlers.updateDisabled \r\n = composeSync(pickDomManagerHandlers.updateDisabled, customPickStylingsClosure(handlers.updateDisabled));\r\n if (pickDomManagerHandlers.updateComponentDisabled && handlers.updateComponentDisabled) \r\n pickDomManagerHandlers.updateComponentDisabled \r\n = composeSync(pickDomManagerHandlers.updateComponentDisabled, customPickStylingsClosure(handlers.updateComponentDisabled));\r\n }\r\n }\r\n }\r\n }\r\n}\r\n","import {LabelPlugin} from './plugins/LabelPlugin'\r\nimport {RtlPlugin} from './plugins/RtlPlugin'\r\nimport {FormResetPlugin} from './plugins/FormResetPlugin'\r\nimport {ValidationApiPlugin} from './plugins/ValidationApiPlugin'\r\nimport {BsAppearancePlugin} from './plugins/BsAppearancePlugin'\r\n\r\nimport {HiddenOptionPlugin} from './plugins/HiddenOptionPlugin'\r\n//import {HiddenOptionPlugin} from './plugins/HiddenOptionAltPlugin'\r\n\r\nimport {CssPatchPlugin} from './plugins/CssPatchPlugin'\r\nimport {PlaceholderPlugin} from './plugins/PlaceholderPlugin'\r\nimport {JQueryMethodsPlugin} from './plugins/JQueryMethodsPlugin'\r\nimport {OptionsApiPlugin} from './plugins/OptionsApiPlugin'\r\nimport {FormRestoreOnBackwardPlugin} from './plugins/FormRestoreOnBackwardPlugin'\r\nimport {SelectElementPlugin} from './plugins/SelectElementPlugin'\r\nimport {SelectedOptionPlugin} from './plugins/SelectedOptionPlugin'\r\nimport {DisabledOptionPlugin} from './plugins/DisabledOptionPlugin'\r\nimport {PicksApiPlugin} from './plugins/PicksApiPlugin'\r\nimport {PicksPlugin} from './plugins/PicksPlugin'\r\n\r\nimport {CreatePopperPlugin} from './plugins/CreatePopperPlugin'\r\n\r\nimport {FloatingLabelPlugin} from './plugins/FloatingLabelPlugin'\r\n\r\nimport {ChoicesDynamicStylingPlugin} from './plugins/ChoicesDynamicStylingPlugin'\r\n\r\nimport {shallowClearClone} from './ToolsJs'\r\n\r\nimport {WarningPlugin} from './plugins/WarningPlugin'\r\nimport {HighlightPlugin} from './plugins/HighlightPlugin'\r\n\r\nimport {CustomChoiceStylingsPlugin} from './plugins/CustomChoiceStylingsPlugin'\r\nimport {CustomPickStylingsPlugin} from './plugins/CustomPickStylingsPlugin'\r\n\r\n\r\nexport let defaultPlugins = {CssPatchPlugin, SelectElementPlugin, LabelPlugin, HiddenOptionPlugin, ValidationApiPlugin, \r\n BsAppearancePlugin, FormResetPlugin, CreatePopperPlugin, WarningPlugin, RtlPlugin, PlaceholderPlugin, FloatingLabelPlugin, OptionsApiPlugin, \r\n JQueryMethodsPlugin, SelectedOptionPlugin, FormRestoreOnBackwardPlugin, \r\n DisabledOptionPlugin, PicksApiPlugin, HighlightPlugin,\r\n ChoicesDynamicStylingPlugin, CustomPickStylingsPlugin, CustomChoiceStylingsPlugin};\r\n\r\nexport let picksPlugins = {CssPatchPlugin, PicksPlugin, LabelPlugin, ValidationApiPlugin, \r\n BsAppearancePlugin, CreatePopperPlugin, WarningPlugin, RtlPlugin, PlaceholderPlugin, FloatingLabelPlugin, OptionsApiPlugin, \r\n JQueryMethodsPlugin, PicksApiPlugin, HighlightPlugin,\r\n ChoicesDynamicStylingPlugin, CustomPickStylingsPlugin, CustomChoiceStylingsPlugin};\r\n\r\nexport let allPlugins = shallowClearClone(defaultPlugins, {PicksPlugin});\r\n\r\n","import {EventBinder, closestByTagName} from '../ToolsDom';\r\n\r\nexport function FormResetPlugin(pluginData){\r\n var {staticDom, environment} = pluginData;\r\n return {\r\n buildApi(api){\r\n var eventBuilder = EventBinder();\r\n if (staticDom.selectElement){\r\n var form = closestByTagName(staticDom.selectElement, 'FORM');\r\n if (form) {\r\n eventBuilder.bind(form, \r\n 'reset', \r\n () => environment.window.setTimeout( ()=>api.updateData() ) );\r\n }\r\n }\r\n return eventBuilder.unbind;\r\n }\r\n }\r\n}","export function FormRestoreOnBackwardPlugin(pluginData){\r\n let {staticDom, environment, loadAspect, configuration} = pluginData;\r\n let window = environment.window;\r\n return {\r\n buildApi(api){\r\n if (!api.updateOptionsSelected){\r\n if (options && configuration.setSelected)\r\n throw new Error(\"BsMultisilect: FormRestoreOnBackwardPlugin requires SelectedOptionPlugin defined first\");\r\n }\r\n else{\r\n let origLoad = loadAspect.load;\r\n loadAspect.load = ()=>{\r\n origLoad();\r\n // support browser's \"step backward\" and form's values restore\r\n if (staticDom.selectElement && window.document.readyState !=\"complete\"){\r\n window.setTimeout(function(){api.updateOptionsSelected()});\r\n }\r\n }\r\n }\r\n }\r\n }\r\n}","import {closestByClassName} from '../ToolsDom'\r\n\r\nexport function Bs5Plugin(){\r\n}\r\n\r\nBs5Plugin.plugDefaultConfig = (defaults) => {\r\n defaults.css = css;\r\n setDefaults(defaults);\r\n}\r\n\r\n\r\nfunction setDefaults(defaults){\r\n defaults.useCssPatch = true;\r\n defaults.cssPatch = cssPatch;\r\n defaults.pickButtonHTML = ''\r\n defaults.composeGetSize = composeGetSize;\r\n defaults.getDefaultLabel = getDefaultLabel;\r\n}\r\n\r\nfunction composeGetSize(selectElement){\r\n let inputGroupElement = closestByClassName(selectElement, 'input-group');\r\n let getSize = null;\r\n if (inputGroupElement){\r\n getSize = function(){\r\n var value = null;\r\n if (inputGroupElement.classList.contains('input-group-lg'))\r\n value = 'lg';\r\n else if (inputGroupElement.classList.contains('input-group-sm'))\r\n value = 'sm';\r\n return value;\r\n }\r\n }\r\n else{ \r\n getSize = function(){\r\n var value = null;\r\n if (selectElement.classList.contains('form-select-lg') || selectElement.classList.contains('form-control-lg')) // changed for BS\r\n value = 'lg';\r\n else if (selectElement.classList.contains('form-select-sm') || selectElement.classList.contains('form-control-sm'))\r\n value = 'sm'; \r\n return value;\r\n }\r\n }\r\n return getSize;\r\n}\r\n\r\nfunction getDefaultLabel(selectElement){\r\n let value = null;\r\n let query = `label[for=\"${selectElement.id}\"]`;\r\n let p1 = selectElement.parentElement;\r\n value = p1.querySelector(query); // label can be wrapped into col-auto\r\n if (!value){\r\n let p2 = p1.parentElement;\r\n value = p2.querySelector(query);\r\n }\r\n return value;\r\n}\r\n\r\nconst css = {\r\n choices: 'dropdown-menu', // bs, in bsmultiselect.scss as div.dropdown-menu\r\n choicesList: '', // bs, in bsmultiselect.scss as div.dropdown-menu>ul (first child)\r\n choice_hover: 'hover', // not bs, in scss as 'ul.dropdown-menu li.hover'\r\n choice_selected: '', \r\n choice_disabled: '', \r\n\r\n picks: 'form-control', // bs, in scss 'ul.form-control'\r\n picks_focus: 'focus', // not bs, in scss 'ul.form-control.focus'\r\n picks_disabled: 'disabled', // not bs, in scss 'ul.form-control.disabled'\r\n pick_disabled: '', \r\n \r\n pickFilter: '', \r\n filterInput: '',\r\n\r\n // used in pickContentGenerator\r\n pick: 'badge text-dark', // bs\r\n pickContent: '',\r\n pickContent_disabled: 'disabled', // not bs, in scss 'ul.form-control li span.disabled'\r\n pickButton: 'btn-close', // bs\r\n\r\n // used in choiceContentGenerator\r\n // choice: 'dropdown-item', // it seems like hover should be managed manually since there should be keyboard support\r\n choiceCheckBox_disabled: 'disabled', // not bs, in scss as 'ul.form-control li .custom-control-input.disabled ~ .custom-control-label'\r\n choiceContent: 'form-check', // bs d-flex required for rtl to align items\r\n choiceCheckBox: 'form-check-input', // bs\r\n choiceLabel: 'form-check-label',\r\n choiceLabel_disabled: '',\r\n\r\n label_floating_lifted: 'floating-lifted',\r\n picks_floating_lifted: 'floating-lifted',\r\n\r\n warning: 'alert-warning',\r\n}\r\n\r\nconst cssPatch = {\r\n choicesList: {listStyleType:'none', paddingLeft:'0', paddingRight:'0', marginBottom:'0'},\r\n picks: {listStyleType:'none', display:'flex', flexWrap:'wrap', height: 'auto', marginBottom: '0', cursor: 'text'},\r\n choice: {classes:'px-md-2 px-1', styles:{cursor:'pointer'}},\r\n choice_hover: 'text-primary bg-light', \r\n filterInput: {\r\n border:'0px', height: 'auto', boxShadow:'none', \r\n padding:'0', margin:'0', \r\n outline:'none', backgroundColor:'transparent',\r\n backgroundImage: 'none' // otherwise BS .was-validated set its image\r\n },\r\n filterInput_empty: 'form-control', // need for placeholder, TODO test form-control-plaintext\r\n\r\n // used in PicksDom\r\n picks_disabled: {backgroundColor: '#e9ecef'},\r\n\r\n picks_focus: {borderColor: '#80bdff', boxShadow: '0 0 0 0.2rem rgba(0, 123, 255, 0.25)'},\r\n picks_focus_valid: {borderColor: '', boxShadow: '0 0 0 0.2rem rgba(40, 167, 69, 0.25)'},\r\n picks_focus_invalid: {borderColor: '', boxShadow: '0 0 0 0.2rem rgba(220, 53, 69, 0.25)'},\r\n \r\n // used in BsAppearancePlugin\r\n picks_def: {minHeight: 'calc(2.25rem + 2px)'},\r\n picks_lg: {minHeight: 'calc(2.875rem + 2px)'},\r\n picks_sm: {minHeight: 'calc(1.8125rem + 2px)'},\r\n picks_floating_def: {minHeight: 'calc(3.5rem + 2px)'},\r\n \r\n // used in pickContentGenerator\r\n pick: {paddingLeft: '0', paddingRight: '.5rem', paddingInlineStart:'0', paddingInlineEnd:'0.5rem'},\r\n pickButton: {fontSize:'0.8em', float : \"none\", verticalAlign: \"text-top\"},\r\n pickContent_disabled: {opacity: '.65'}, \r\n \r\n // used in choiceContentGenerator\r\n choiceContent: {justifyContent: 'flex-start', cursor:'inherit'}, // BS problem: without this on inline form menu items justified center\r\n choiceLabel: {color: 'inherit', cursor:'inherit'}, // otherwise BS .was-validated set its color\r\n choiceCheckBox: {color: 'inherit', cursor:'inherit'},\r\n choiceLabel_disabled: {opacity: '.65'}, // more flexible than {color: '#6c757d'}; note: avoid opacity on pickElement's border; TODO write to BS \r\n\r\n // floating plugin\r\n label_floating_lifted: {opacity: '.65', transform : 'scale(.85) translateY(-.5rem) translateX(.15rem)'},\r\n picks_floating_lifted: {paddingTop: '1.625rem', paddingLeft:'0.8rem', paddingBottom : '0'},\r\n\r\n warning: {paddingLeft: '.25rem', paddingRight: '.25rem', zIndex: 4, fontSize:'small', backgroundColor: 'var(--bs-warning)'}, // zIndex=4 since the input-group zIndex=3\r\n}\r\n\r\n","import {composeSync} from './ToolsJs'\r\nimport {EventBinder} from './ToolsDom'\r\nimport {addStyling, toggleStyling} from './ToolsStyling'\r\n\r\nexport let utilities = {composeSync, EventBinder, addStyling, toggleStyling};\r\n","import Popper from '@popperjs/core'\r\n\r\nimport {createForJQuery} from './CreateForJQuery'\r\n\r\nimport {defaultPlugins, picksPlugins, allPlugins} from './PluginSet'\r\nimport {Bs5Plugin} from './plugins/Bs5Plugin'\r\n\r\nimport {MultiSelectBuilder} from './MultiSelectBuilder'\r\nimport {utilities} from './ToolSet'\r\n\r\nimport {shallowClearClone} from './ToolsJs'\r\n\r\nconst BsMultiSelect = (\r\n (window, jQuery, createPopper) => {\r\n return createForJQuery(window, jQuery, createPopper, 'BsMultiSelect', defaultPlugins, Bs5Plugin)\r\n }\r\n)(window, window.jQuery, Popper)\r\n\r\n\r\nconst BsPicks = (\r\n (window, jQuery, createPopper) => {\r\n return createForJQuery(window, jQuery, createPopper, 'BsPicks', picksPlugins, Bs5Plugin)\r\n }\r\n)(window, window.jQuery, Popper)\r\n\r\n\r\nexport default {BsMultiSelect, BsPicks , MultiSelectTools: {MultiSelectBuilder, plugins: shallowClearClone({Bs5Plugin}, allPlugins), utilities} }"]}