| 
									
										
										
										
											2022-11-02 14:44:06 +01:00
										 |  |  | import { UIElement } from "../UIElement" | 
					
						
							|  |  |  | import { InputElement } from "./InputElement" | 
					
						
							| 
									
										
										
										
											2022-07-10 03:58:07 +02:00
										 |  |  | import BaseUIElement from "../BaseUIElement" | 
					
						
							| 
									
										
										
										
											2022-11-02 14:44:06 +01:00
										 |  |  | import { Store, UIEventSource } from "../../Logic/UIEventSource" | 
					
						
							| 
									
										
										
										
											2022-07-10 03:58:07 +02:00
										 |  |  | import Translations from "../i18n/Translations" | 
					
						
							|  |  |  | import Locale from "../i18n/Locale" | 
					
						
							|  |  |  | import Combine from "../Base/Combine" | 
					
						
							| 
									
										
										
										
											2022-11-02 14:44:06 +01:00
										 |  |  | import { TextField } from "./TextField" | 
					
						
							| 
									
										
										
										
											2022-07-10 03:58:07 +02:00
										 |  |  | import Svg from "../../Svg" | 
					
						
							| 
									
										
										
										
											2022-11-02 14:44:06 +01:00
										 |  |  | import { VariableUiElement } from "../Base/VariableUIElement" | 
					
						
							| 
									
										
										
										
											2022-07-10 03:58:07 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * A single 'pill' which can hide itself if the search criteria is not met | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | class SelfHidingToggle extends UIElement implements InputElement<boolean> { | 
					
						
							|  |  |  |     public readonly _selected: UIEventSource<boolean> | 
					
						
							|  |  |  |     public readonly isShown: Store<boolean> = new UIEventSource<boolean>(true) | 
					
						
							| 
									
										
										
										
											2022-10-29 03:03:51 +02:00
										 |  |  |     public readonly matchesSearchCriteria: Store<boolean> | 
					
						
							| 
									
										
										
										
											2022-07-10 03:58:07 +02:00
										 |  |  |     public readonly forceSelected: UIEventSource<boolean> | 
					
						
							| 
									
										
										
										
											2022-10-29 03:03:51 +02:00
										 |  |  |     private readonly _shown: BaseUIElement | 
					
						
							| 
									
										
										
										
											2022-07-10 17:48:27 +02:00
										 |  |  |     private readonly _squared: boolean | 
					
						
							| 
									
										
										
										
											2022-10-29 03:03:51 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-10 03:58:07 +02:00
										 |  |  |     public constructor( | 
					
						
							|  |  |  |         shown: string | BaseUIElement, | 
					
						
							|  |  |  |         mainTerm: Record<string, string>, | 
					
						
							|  |  |  |         search: Store<string>, | 
					
						
							|  |  |  |         options?: { | 
					
						
							|  |  |  |             searchTerms?: Record<string, string[]> | 
					
						
							|  |  |  |             selected?: UIEventSource<boolean> | 
					
						
							| 
									
										
										
										
											2022-07-10 17:48:27 +02:00
										 |  |  |             forceSelected?: UIEventSource<boolean> | 
					
						
							| 
									
										
										
										
											2022-11-02 14:44:06 +01:00
										 |  |  |             squared?: boolean | 
					
						
							| 
									
										
										
										
											2022-10-29 03:03:51 +02:00
										 |  |  |             /* Hide, if not selected*/ | 
					
						
							|  |  |  |             hide?: Store<boolean> | 
					
						
							| 
									
										
										
										
											2022-07-10 03:58:07 +02:00
										 |  |  |         } | 
					
						
							|  |  |  |     ) { | 
					
						
							|  |  |  |         super() | 
					
						
							|  |  |  |         this._shown = Translations.W(shown) | 
					
						
							| 
									
										
										
										
											2022-07-10 17:48:27 +02:00
										 |  |  |         this._squared = options?.squared ?? false | 
					
						
							| 
									
										
										
										
											2022-07-10 03:58:07 +02:00
										 |  |  |         const searchTerms: Record<string, string[]> = {} | 
					
						
							|  |  |  |         for (const lng in options?.searchTerms ?? []) { | 
					
						
							|  |  |  |             if (lng === "_context") { | 
					
						
							|  |  |  |                 continue | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |             searchTerms[lng] = options?.searchTerms[lng]?.map(SelfHidingToggle.clean) | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         for (const lng in mainTerm) { | 
					
						
							|  |  |  |             if (lng === "_context") { | 
					
						
							|  |  |  |                 continue | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |             const main = SelfHidingToggle.clean(mainTerm[lng]) | 
					
						
							|  |  |  |             searchTerms[lng] = [main].concat(searchTerms[lng] ?? []) | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         const selected = (this._selected = options?.selected ?? new UIEventSource<boolean>(false)) | 
					
						
							|  |  |  |         const forceSelected = (this.forceSelected = | 
					
						
							|  |  |  |             options?.forceSelected ?? new UIEventSource<boolean>(false)) | 
					
						
							| 
									
										
										
										
											2022-11-02 14:44:06 +01:00
										 |  |  |         this.matchesSearchCriteria = search.map((s) => { | 
					
						
							| 
									
										
										
										
											2022-10-29 03:03:51 +02:00
										 |  |  |             if (s === undefined || s.length === 0) { | 
					
						
							|  |  |  |                 return true | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             s = s?.trim()?.toLowerCase() | 
					
						
							|  |  |  |             if (searchTerms[Locale.language.data]?.some((t) => t.indexOf(s) >= 0)) { | 
					
						
							|  |  |  |                 return true | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |             if (searchTerms["*"]?.some((t) => t.indexOf(s) >= 0)) { | 
					
						
							|  |  |  |                 return true | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |             return false | 
					
						
							|  |  |  |         }) | 
					
						
							|  |  |  |         this.isShown = this.matchesSearchCriteria.map( | 
					
						
							|  |  |  |             (matchesSearch) => { | 
					
						
							| 
									
										
										
										
											2022-07-10 03:58:07 +02:00
										 |  |  |                 if (selected.data && !forceSelected.data) { | 
					
						
							|  |  |  |                     return true | 
					
						
							|  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2022-10-29 03:03:51 +02:00
										 |  |  |                 if (options?.hide?.data) { | 
					
						
							|  |  |  |                     return false | 
					
						
							| 
									
										
										
										
											2022-07-15 01:10:10 +02:00
										 |  |  |                 } | 
					
						
							| 
									
										
										
										
											2022-10-29 03:03:51 +02:00
										 |  |  |                 return matchesSearch | 
					
						
							| 
									
										
										
										
											2022-07-10 03:58:07 +02:00
										 |  |  |             }, | 
					
						
							| 
									
										
										
										
											2022-10-29 03:03:51 +02:00
										 |  |  |             [selected, Locale.language, options?.hide] | 
					
						
							| 
									
										
										
										
											2022-07-10 03:58:07 +02:00
										 |  |  |         ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         const self = this | 
					
						
							|  |  |  |         this.isShown.addCallbackAndRun((shown) => { | 
					
						
							|  |  |  |             if (shown) { | 
					
						
							|  |  |  |                 self.RemoveClass("hidden") | 
					
						
							|  |  |  |             } else { | 
					
						
							|  |  |  |                 self.SetClass("hidden") | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         }) | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-10 03:58:07 +02:00
										 |  |  |     private static clean(s: string): string { | 
					
						
							|  |  |  |         return s?.trim()?.toLowerCase()?.replace(/[-]/, "") | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     GetValue(): UIEventSource<boolean> { | 
					
						
							|  |  |  |         return this._selected | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     IsValid(t: boolean): boolean { | 
					
						
							|  |  |  |         return true | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     protected InnerRender(): string | BaseUIElement { | 
					
						
							|  |  |  |         let el: BaseUIElement = this._shown | 
					
						
							|  |  |  |         const selected = this._selected | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         selected.addCallbackAndRun((selected) => { | 
					
						
							|  |  |  |             if (selected) { | 
					
						
							|  |  |  |                 el.SetClass("border-4") | 
					
						
							|  |  |  |                 el.RemoveClass("border") | 
					
						
							|  |  |  |                 el.SetStyle("margin: 0") | 
					
						
							|  |  |  |             } else { | 
					
						
							|  |  |  |                 el.SetStyle("margin: 3px") | 
					
						
							|  |  |  |                 el.SetClass("border") | 
					
						
							|  |  |  |                 el.RemoveClass("border-4") | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         }) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-10 17:48:27 +02:00
										 |  |  |         const forcedSelection = this.forceSelected | 
					
						
							|  |  |  |         el.onClick(() => { | 
					
						
							|  |  |  |             if (forcedSelection.data) { | 
					
						
							|  |  |  |                 selected.setData(true) | 
					
						
							|  |  |  |             } else { | 
					
						
							|  |  |  |                 selected.setData(!selected.data) | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         }) | 
					
						
							| 
									
										
										
										
											2022-07-10 03:58:07 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-10 17:48:27 +02:00
										 |  |  |         if (!this._squared) { | 
					
						
							|  |  |  |             el.SetClass("rounded-full") | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         return el.SetClass("border border-black p-1 px-4") | 
					
						
							| 
									
										
										
										
											2022-07-10 03:58:07 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * The searchable mappings selector is a selector which shows various pills from which one (or more) options can be chosen. | 
					
						
							|  |  |  |  * A searchfield can be used to filter the values | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | export class SearchablePillsSelector<T> extends Combine implements InputElement<T[]> { | 
					
						
							|  |  |  |     public readonly someMatchFound: Store<boolean> | 
					
						
							| 
									
										
										
										
											2022-10-29 03:03:51 +02:00
										 |  |  |     private readonly selectedElements: UIEventSource<T[]> | 
					
						
							| 
									
										
										
										
											2022-07-10 03:58:07 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-13 23:05:50 +02:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * | 
					
						
							| 
									
										
										
										
											2022-10-29 03:03:51 +02:00
										 |  |  |      * @param values: the values that can be selected | 
					
						
							| 
									
										
										
										
											2022-07-13 23:05:50 +02:00
										 |  |  |      * @param options | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2022-07-10 03:58:07 +02:00
										 |  |  |     constructor( | 
					
						
							|  |  |  |         values: { | 
					
						
							|  |  |  |             show: BaseUIElement | 
					
						
							|  |  |  |             value: T | 
					
						
							|  |  |  |             mainTerm: Record<string, string> | 
					
						
							| 
									
										
										
										
											2022-11-02 14:44:06 +01:00
										 |  |  |             searchTerms?: Record<string, string[]> | 
					
						
							| 
									
										
										
										
											2022-10-29 03:03:51 +02:00
										 |  |  |             /* If there are more then 200 elements, should this element still be shown? */ | 
					
						
							|  |  |  |             hasPriority?: Store<boolean> | 
					
						
							| 
									
										
										
										
											2022-07-10 03:58:07 +02:00
										 |  |  |         }[], | 
					
						
							|  |  |  |         options?: { | 
					
						
							| 
									
										
										
										
											2022-10-29 03:03:51 +02:00
										 |  |  |             /* | 
					
						
							| 
									
										
										
										
											2022-11-02 14:44:06 +01:00
										 |  |  |              * If one single value can be selected (like a radio button) or if many values can be selected (like checkboxes) | 
					
						
							| 
									
										
										
										
											2022-10-29 03:03:51 +02:00
										 |  |  |              */ | 
					
						
							| 
									
										
										
										
											2022-07-10 03:58:07 +02:00
										 |  |  |             mode?: "select-one" | "select-many" | 
					
						
							| 
									
										
										
										
											2022-10-29 03:03:51 +02:00
										 |  |  |             /** | 
					
						
							|  |  |  |              * The values of the selected elements. | 
					
						
							|  |  |  |              * Use this to tie input elements together | 
					
						
							|  |  |  |              */ | 
					
						
							| 
									
										
										
										
											2022-07-10 03:58:07 +02:00
										 |  |  |             selectedElements?: UIEventSource<T[]> | 
					
						
							| 
									
										
										
										
											2022-10-29 03:03:51 +02:00
										 |  |  |             /** | 
					
						
							|  |  |  |              * The search bar. Use this to seed the search value or to tie to another value | 
					
						
							|  |  |  |              */ | 
					
						
							| 
									
										
										
										
											2022-07-10 03:58:07 +02:00
										 |  |  |             searchValue?: UIEventSource<string> | 
					
						
							| 
									
										
										
										
											2022-10-29 03:03:51 +02:00
										 |  |  |             /** | 
					
						
							|  |  |  |              * What is shown if the search yielded no results. | 
					
						
							|  |  |  |              * By default: a translated "no search results" | 
					
						
							|  |  |  |              */ | 
					
						
							| 
									
										
										
										
											2022-07-10 03:58:07 +02:00
										 |  |  |             onNoMatches?: BaseUIElement | 
					
						
							| 
									
										
										
										
											2022-10-29 03:03:51 +02:00
										 |  |  |             /** | 
					
						
							|  |  |  |              * An element that is shown if no search is entered | 
					
						
							|  |  |  |              * Default behaviour is to show all options | 
					
						
							|  |  |  |              */ | 
					
						
							| 
									
										
										
										
											2022-07-10 03:58:07 +02:00
										 |  |  |             onNoSearchMade?: BaseUIElement | 
					
						
							| 
									
										
										
										
											2022-07-13 23:10:56 +02:00
										 |  |  |             /** | 
					
						
							| 
									
										
										
										
											2022-10-29 03:03:51 +02:00
										 |  |  |              * Extra element to show if there are many (>200) possible mappings and when non-priority mappings are hidden | 
					
						
							|  |  |  |              * | 
					
						
							| 
									
										
										
										
											2022-07-13 23:10:56 +02:00
										 |  |  |              */ | 
					
						
							|  |  |  |             onManyElements?: BaseUIElement | 
					
						
							| 
									
										
										
										
											2022-07-15 01:10:10 +02:00
										 |  |  |             searchAreaClass?: string | 
					
						
							|  |  |  |             hideSearchBar?: false | boolean | 
					
						
							| 
									
										
										
										
											2022-07-10 03:58:07 +02:00
										 |  |  |         } | 
					
						
							|  |  |  |     ) { | 
					
						
							| 
									
										
										
										
											2022-11-02 14:44:06 +01:00
										 |  |  |         const search = new TextField({ value: options?.searchValue }) | 
					
						
							| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-15 01:10:10 +02:00
										 |  |  |         const searchBar = options?.hideSearchBar | 
					
						
							|  |  |  |             ? undefined | 
					
						
							|  |  |  |             : new Combine([ | 
					
						
							| 
									
										
										
										
											2022-11-02 14:44:06 +01:00
										 |  |  |                   Svg.search_svg().SetClass("w-8 normal-background"), | 
					
						
							|  |  |  |                   search.SetClass("w-full"), | 
					
						
							|  |  |  |               ]).SetClass("flex items-center border-2 border-black m-2") | 
					
						
							| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-10 03:58:07 +02:00
										 |  |  |         const searchValue = search.GetValue().map((s) => s?.trim()?.toLowerCase()) | 
					
						
							|  |  |  |         const selectedElements = options?.selectedElements ?? new UIEventSource<T[]>([]) | 
					
						
							|  |  |  |         const mode = options?.mode ?? "select-one" | 
					
						
							|  |  |  |         const onEmpty = options?.onNoMatches ?? Translations.t.general.noMatchingMapping | 
					
						
							| 
									
										
										
										
											2022-10-29 03:03:51 +02:00
										 |  |  |         const forceHide = new UIEventSource(false) | 
					
						
							| 
									
										
										
										
											2022-07-10 03:58:07 +02:00
										 |  |  |         const mappedValues: { | 
					
						
							|  |  |  |             show: SelfHidingToggle | 
					
						
							|  |  |  |             mainTerm: Record<string, string> | 
					
						
							|  |  |  |             value: T | 
					
						
							|  |  |  |         }[] = values.map((v) => { | 
					
						
							|  |  |  |             const vIsSelected = new UIEventSource(false) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             selectedElements.addCallbackAndRunD((selectedElements) => { | 
					
						
							|  |  |  |                 vIsSelected.setData(selectedElements.some((t) => t === v.value)) | 
					
						
							|  |  |  |             }) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             vIsSelected.addCallback((selected) => { | 
					
						
							|  |  |  |                 if (selected) { | 
					
						
							|  |  |  |                     if (mode === "select-one") { | 
					
						
							|  |  |  |                         selectedElements.setData([v.value]) | 
					
						
							|  |  |  |                     } else if (!selectedElements.data.some((t) => t === v.value)) { | 
					
						
							|  |  |  |                         selectedElements.data.push(v.value) | 
					
						
							|  |  |  |                         selectedElements.ping() | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  |                 } else { | 
					
						
							|  |  |  |                     for (let i = 0; i < selectedElements.data.length; i++) { | 
					
						
							|  |  |  |                         const t = selectedElements.data[i] | 
					
						
							|  |  |  |                         if (t == v.value) { | 
					
						
							|  |  |  |                             selectedElements.data.splice(i, 1) | 
					
						
							|  |  |  |                             selectedElements.ping() | 
					
						
							|  |  |  |                             break | 
					
						
							|  |  |  |                         } | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             }) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             const toggle = new SelfHidingToggle(v.show, v.mainTerm, searchValue, { | 
					
						
							|  |  |  |                 searchTerms: v.searchTerms, | 
					
						
							| 
									
										
										
										
											2022-07-10 17:48:27 +02:00
										 |  |  |                 selected: vIsSelected, | 
					
						
							|  |  |  |                 squared: mode === "select-many", | 
					
						
							| 
									
										
										
										
											2022-11-02 14:44:06 +01:00
										 |  |  |                 hide: | 
					
						
							|  |  |  |                     v.hasPriority === undefined | 
					
						
							|  |  |  |                         ? forceHide | 
					
						
							|  |  |  |                         : forceHide.map((fh) => fh && !v.hasPriority?.data, [v.hasPriority]), | 
					
						
							| 
									
										
										
										
											2022-07-10 03:58:07 +02:00
										 |  |  |             }) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             return { | 
					
						
							|  |  |  |                 ...v, | 
					
						
							|  |  |  |                 show: toggle, | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         }) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-29 03:03:51 +02:00
										 |  |  |         // The total number of elements that would be displayed based on the search criteria alone
 | 
					
						
							| 
									
										
										
										
											2022-07-13 23:10:56 +02:00
										 |  |  |         let totalShown: Store<number> | 
					
						
							| 
									
										
										
										
											2022-11-02 14:44:06 +01:00
										 |  |  |         totalShown = searchValue.map( | 
					
						
							|  |  |  |             (_) => mappedValues.filter((mv) => mv.show.matchesSearchCriteria.data).length | 
					
						
							|  |  |  |         ) | 
					
						
							| 
									
										
										
										
											2022-10-29 03:03:51 +02:00
										 |  |  |         const tooMuchElementsCutoff = 40 | 
					
						
							| 
									
										
										
										
											2022-11-02 14:44:06 +01:00
										 |  |  |         totalShown.addCallbackAndRunD((shown) => forceHide.setData(tooMuchElementsCutoff < shown)) | 
					
						
							| 
									
										
										
										
											2022-07-10 03:58:07 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |         super([ | 
					
						
							|  |  |  |             searchBar, | 
					
						
							|  |  |  |             new VariableUiElement( | 
					
						
							|  |  |  |                 Locale.language.map( | 
					
						
							|  |  |  |                     (lng) => { | 
					
						
							|  |  |  |                         if ( | 
					
						
							|  |  |  |                             options?.onNoSearchMade !== undefined && | 
					
						
							|  |  |  |                             (searchValue.data === undefined || searchValue.data.length === 0) | 
					
						
							|  |  |  |                         ) { | 
					
						
							|  |  |  |                             return options?.onNoSearchMade | 
					
						
							|  |  |  |                         } | 
					
						
							| 
									
										
										
										
											2022-07-13 23:10:56 +02:00
										 |  |  |                         if (totalShown.data == 0) { | 
					
						
							| 
									
										
										
										
											2022-07-10 03:58:07 +02:00
										 |  |  |                             return onEmpty | 
					
						
							|  |  |  |                         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                         mappedValues.sort((a, b) => (a.mainTerm[lng] < b.mainTerm[lng] ? -1 : 1)) | 
					
						
							| 
									
										
										
										
											2022-10-29 03:03:51 +02:00
										 |  |  |                         let pills = new Combine(mappedValues.map((e) => e.show)) | 
					
						
							| 
									
										
										
										
											2022-07-10 17:48:27 +02:00
										 |  |  |                             .SetClass("flex flex-wrap w-full content-start") | 
					
						
							| 
									
										
										
										
											2022-07-10 03:58:07 +02:00
										 |  |  |                             .SetClass(options?.searchAreaClass ?? "") | 
					
						
							| 
									
										
										
										
											2022-10-29 03:03:51 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |                         if (totalShown.data >= tooMuchElementsCutoff) { | 
					
						
							| 
									
										
										
										
											2022-11-02 14:44:06 +01:00
										 |  |  |                             pills = new Combine([ | 
					
						
							|  |  |  |                                 options?.onManyElements ?? Translations.t.general.useSearch, | 
					
						
							|  |  |  |                                 pills, | 
					
						
							|  |  |  |                             ]) | 
					
						
							| 
									
										
										
										
											2022-10-29 03:03:51 +02:00
										 |  |  |                         } | 
					
						
							|  |  |  |                         return pills | 
					
						
							| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  |                     }, | 
					
						
							| 
									
										
										
										
											2022-07-13 23:10:56 +02:00
										 |  |  |                     [totalShown, searchValue] | 
					
						
							| 
									
										
										
										
											2022-09-08 21:40:48 +02:00
										 |  |  |                 ) | 
					
						
							|  |  |  |             ), | 
					
						
							| 
									
										
										
										
											2022-07-10 03:58:07 +02:00
										 |  |  |         ]) | 
					
						
							|  |  |  |         this.selectedElements = selectedElements | 
					
						
							| 
									
										
										
										
											2022-07-13 23:10:56 +02:00
										 |  |  |         this.someMatchFound = totalShown.map((t) => t > 0) | 
					
						
							| 
									
										
										
										
											2022-07-10 03:58:07 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     public GetValue(): UIEventSource<T[]> { | 
					
						
							|  |  |  |         return this.selectedElements | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     IsValid(t: T[]): boolean { | 
					
						
							|  |  |  |         return true | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } |