package bonsai
A library for building dynamic webapps, using Js_of_ocaml
Install
Dune Dependency
Authors
Maintainers
Sources
v0.15.1.tar.gz
sha256=0c4a714146073f421f1a6179561f836b45d8dc012c743207d3481ea63bef74bf
doc/src/bonsai.web_ui_multi_select/single_factor_intf.ml.html
Source file single_factor_intf.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
open! Core open! Import open Bonsai_web module type Item = sig type t [@@deriving equal, sexp] include Comparable.S with type t := t val to_string : t -> string end module type S = sig module Item : 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 *) module View_config : sig type t = { 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 : string option (** 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 *) } val create : ?extra_row_attrs:(is_focused:bool -> Vdom.Attr.t) -> ?autofocus_search_box:bool -> ?id:string -> header:Vdom.Node.t -> unit -> t end module Selection_status : sig type t = | Selected | Unselected [@@deriving compare, sexp_of] end module Action : sig type t = | Update_search_string of string | Set_item_selected of { item : Item.t ; status : Selection_status.t } | Set_all_selection_statuses of Selection_status.t Item.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_focus of Item.t option | Move_focus of [ `Next | `Prev ] | Select_all | Select_none [@@deriving sexp_of] end module Result : sig type t = { view : Vdom.Node.t ; view_for_testing : string Lazy.t ; key_handler : Vdom_keyboard.Keyboard_event_handler.t ; inject : Action.t -> unit Vdom.Effect.t ; selected_items : Item.Set.t } end module Initial_model_settings : sig type t val create : ?search_string:string -> ?selection_status:Selection_status.t Item.Map.t -> ?focused_item:Item.t -> unit -> t end val bonsai : ?initial_model_settings:Initial_model_settings.t -> ?default_selection_status:Selection_status.t Value.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.t Value.t -> Item.Set.t Value.t -> Result.t Computation.t end module type Single_factor = sig module type Item = Item module type S = S module Make (Item : Item) : S with module Item := Item end
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>