123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101open!Coreopen!ImportopenBonsai_webmoduletypeItem=sigtypet[@@derivingequal,sexp]includeComparable.Swithtypet:=tvalto_string:t->stringendmoduletypeS=sigmoduleItem:Item(** A widget for selecting multiple items from a list. A fairly rich interface is
provided, including:
- Using the arrow keys and Enter to select / deselect items;
- The ability to filter the set of items displayed by searching;
- "Select all" and "Select none" buttons
*)moduleView_config:sigtypet={header:Vdom.Node.t(** The header will be displayed above the rest of the node. *);autofocus_search_box:bool(** If true, appends the autofocus attribute. This can cause the browser to
automatically focus the search box when the page loads. (That probably isn't
useful if there is more than one of these components on a given page.) *);search_box_id:stringoption(** The HTML ID to give the search box input *);extra_row_attrs:(is_focused:bool->Vdom.Attr.t)option(** This attribute will be added to the selected row *)}valcreate:?extra_row_attrs:(is_focused:bool->Vdom.Attr.t)->?autofocus_search_box:bool->?id:string->header:Vdom.Node.t->unit->tendmoduleAction:sigtypet=|Update_search_stringofstring|Set_item_selectedof{item:Item.t;status:Selection_status.t}|Set_all_selection_statusesofSelection_status.tItem.Map.t(** [Set_all_selection_statuses] sets the status for every item in the map, and any
item not in the map gets [input.default_selection_status]. *)|Toggle_focused_item_selected|Set_focusofItem.toption|Move_focusof[`Next|`Prev]|Select_all|Select_none[@@derivingsexp_of]endmoduleResult:sigtypet={view:Vdom.Node.t;view_for_testing:stringLazy.t;key_handler:Vdom_keyboard.Keyboard_event_handler.t;inject:Action.t->unitVdom.Effect.t;selected_items:Item.Set.t}endmoduleInitial_model_settings:sigtypetvalcreate:?search_string:string->?selection_status:Selection_status.tItem.Map.t->?focused_item:Item.t->unit->tendvalbonsai:?initial_model_settings:Initial_model_settings.t->?default_selection_status:Selection_status.tValue.t(** [default_selection_status] controls whether items that have not been
explicitly toggled by the user should be considered selected or not.
For example, setting this to [Selected] has the effect of causing all
items to show initially selected. *)->view_config:View_config.tValue.t->Item.Set.tValue.t->Result.tComputation.tendmoduletypeSingle_factor=sigmoduletypeItem=ItemmoduletypeS=SmoduleMake(Item:Item):SwithmoduleItem:=Itemend