@@ -185,9 +185,12 @@ let select_action ?(size = 1) selector action =
185185 dom_select##.size := size;
186186 Lwt. return_unit))
187187
188- let rec build_calendar ?prehilight
189- ~button_labels :{b_prev_year; b_prev_month; b_next_month; b_next_year} ~intl
190- ~period day
188+ let rec build_calendar
189+ ?prehilight
190+ ~button_labels :{b_prev_year; b_prev_month; b_next_month; b_next_year}
191+ ~intl
192+ ~period
193+ day
191194 =
192195 let today = CalendarLib.Date. today () in
193196 let fst_dow = fst_dow ~intl day
@@ -297,43 +300,54 @@ let get_options selector =
297300let update_classes cal zero d =
298301 let rows = (To_dom. of_table cal)##.rows in
299302 let f i =
300- rows ## (item (i + 2 )) >> ! fun r ->
303+ rows## (item (i + 2 )) >> ! fun r ->
301304 let cells = r##.cells in
302305 let f j =
303- cells ## (item j) >> ! fun c ->
306+ cells## (item j) >> ! fun c ->
304307 let d' =
305308 CalendarLib.Calendar.Date. (j + (7 * i) |> Period. day |> add zero)
306309 in
307310 if d = d'
308- then c ##. classList ## (add (Js. string " ot-c-current" ))
309- else c ##. classList ## (remove (Js. string " ot-c-current" ))
311+ then c##.classList## (add (Js. string " ot-c-current" ))
312+ else c##.classList## (remove (Js. string " ot-c-current" ))
310313 in
311314 iter_interval 0 6 f
312315 in
313316 iter_interval 0 5 f
314317
315- let in_period ?(begin_p = default_period.begin_p)
316- ?(end_p = default_period.end_p) curr_date
318+ let in_period
319+ ?(begin_p = default_period.begin_p)
320+ ?(end_p = default_period.end_p)
321+ curr_date
317322 =
318323 curr_date > = begin_p && curr_date < = end_p
319324
320- let in_period_coerced ?(begin_p = default_period.begin_p)
321- ?(end_p = default_period.end_p) curr_date
325+ let in_period_coerced
326+ ?(begin_p = default_period.begin_p)
327+ ?(end_p = default_period.end_p)
328+ curr_date
322329 =
323330 curr_date > = (begin_p :> [`Month | `Year] CalendarLib.Date.date )
324331 && curr_date < = (end_p :> [`Month | `Year] CalendarLib.Date.date )
325332
326- let attach_events ?action ?(click_non_highlighted = false ) ?update ~intl ~period
327- d cal highlight
333+ let attach_events
334+ ?action
335+ ?(click_non_highlighted = false )
336+ ?update
337+ ~intl
338+ ~period
339+ d
340+ cal
341+ highlight
328342 =
329343 let rows = (To_dom. of_table cal)##.rows in
330344 let fst_dow = fst_dow ~intl d and zero = zeroth_displayed_day ~intl d in
331345 let mnth = CalendarLib.Date. month fst_dow in
332346 iter_interval 0 5 @@ fun i ->
333- rows ## (item (i + 2 )) >> ! fun r ->
347+ rows## (item (i + 2 )) >> ! fun r ->
334348 let cells = r##.cells in
335349 iter_interval 0 6 @@ fun j ->
336- cells ## (item j) >> ! fun c ->
350+ cells## (item j) >> ! fun c ->
337351 let d = CalendarLib.Calendar.Date. (j + (7 * i) |> Period. day |> add zero) in
338352 if mnth = CalendarLib.Date. month d
339353 then
@@ -358,14 +372,20 @@ let attach_events ?action ?(click_non_highlighted = false) ?update ~intl ~period
358372 in
359373 if List. exists (( = ) dom) highlight
360374 then (
361- c ##. classList ## (add (Js. string " ot-c-highlight" ));
375+ c##.classList## (add (Js. string " ot-c-highlight" ));
362376 set_onclick () )
363377 else if click_non_highlighted
364378 then set_onclick ()
365379 else ()
366380
367- let attach_events_lwt ?action ?click_non_highlighted ~intl ~period d cal
368- highlight
381+ let attach_events_lwt
382+ ?action
383+ ?click_non_highlighted
384+ ~intl
385+ ~period
386+ d
387+ cal
388+ highlight
369389 =
370390 let f () =
371391 let m = CalendarLib.Date. (month d |> int_of_month)
@@ -376,9 +396,13 @@ let attach_events_lwt ?action ?click_non_highlighted ~intl ~period d cal
376396 in
377397 Lwt. async f
378398
379- let make_span_handler selector
380- ((get_sig , set_sig ) : int React. signal * (?step :React.step -> int -> unit ))
381- apply condi fun_handler
399+ let make_span_handler
400+ selector
401+ ((get_sig , set_sig ) :
402+ int React. signal * (?step :React.step -> int -> unit ))
403+ apply
404+ condi
405+ fun_handler
382406 =
383407 Dom_html. handler (fun _ ->
384408 if condi ()
@@ -389,9 +413,13 @@ let make_span_handler selector
389413 Js. _false)
390414 else Js. _false)
391415
392- let set_selected_index selector selector_value options
393- ((get_sig , set_sig ) : int React. signal * (?step :React.step -> int -> unit ))
394- ()
416+ let set_selected_index
417+ selector
418+ selector_value
419+ options
420+ ((get_sig , set_sig ) :
421+ int React. signal * (?step :React.step -> int -> unit ))
422+ ()
395423 =
396424 let value = selector_value () in
397425 try
@@ -404,8 +432,15 @@ let make_selector_handler change_index condi fun_handler =
404432 Dom_html. handler (fun _ ->
405433 if condi () then (fun_handler () ; change_index () ; Js. _false) else Js. _false)
406434
407- let attach_behavior ?highlight ?click_non_highlighted ?action ~intl ~period d
408- (cal , prev , next , select_month , select_year , prev_year , next_year ) f_d
435+ let attach_behavior
436+ ?highlight
437+ ?click_non_highlighted
438+ ?action
439+ ~intl
440+ ~period
441+ d
442+ (cal , prev , next , select_month , select_year , prev_year , next_year )
443+ f_d
409444 =
410445 (match highlight with
411446 | Some highlight ->
@@ -467,18 +502,18 @@ let attach_behavior ?highlight ?click_non_highlighted ?action ~intl ~period d
467502 (fun () -> f_d (CalendarLib.Date. next d `Year ))
468503
469504let make :
470- ?init :int * int * int
471- -> ?highlight :(int -> int -> int list Lwt. t )
472- -> ?click_non_highlighted :bool
473- -> ?update :(int * int * int ) React.E. t
474- -> ?action :(int -> int -> int -> unit Lwt. t )
475- -> ?period :
476- CalendarLib.Date. field CalendarLib.Date. date
477- * CalendarLib.Date. field CalendarLib.Date. date
478- -> ?button_labels :button_labels
479- -> ?intl :intl
480- -> unit
481- -> [> `Div] elt
505+ ?init :int * int * int
506+ -> ?highlight :(int -> int -> int list Lwt. t )
507+ -> ?click_non_highlighted :bool
508+ -> ?update :(int * int * int ) React.E. t
509+ -> ?action :(int -> int -> int -> unit Lwt. t )
510+ -> ?period :
511+ CalendarLib.Date. field CalendarLib.Date. date
512+ * CalendarLib.Date. field CalendarLib.Date. date
513+ -> ?button_labels :button_labels
514+ -> ?intl :intl
515+ -> unit
516+ -> [> `Div] elt
482517 =
483518 fun ?init
484519 ?highlight
@@ -525,18 +560,18 @@ let make :
525560 elt
526561
527562let % server make :
528- ?init:int * int * int
529- -> ?highlight:(int -> int -> int list Lwt. t) Eliom_client_value. t
530- -> ?click_non_highlighted:bool
531- -> ?update:(int * int * int ) React.E. t Eliom_client_value. t
532- -> ?action:(int -> int -> int -> unit Lwt. t) Eliom_client_value. t
533- -> ?period:
534- CalendarLib.Date. field CalendarLib.Date. date
535- * CalendarLib.Date. field CalendarLib.Date. date
536- -> ?button_labels:button_labels
537- -> ?intl:intl
538- -> unit
539- -> [> `Div ] elt
563+ ?init:int * int * int
564+ -> ?highlight:(int -> int -> int list Lwt. t) Eliom_client_value. t
565+ -> ?click_non_highlighted:bool
566+ -> ?update:(int * int * int ) React.E. t Eliom_client_value. t
567+ -> ?action:(int -> int -> int -> unit Lwt. t) Eliom_client_value. t
568+ -> ?period:
569+ CalendarLib.Date. field CalendarLib.Date. date
570+ * CalendarLib.Date. field CalendarLib.Date. date
571+ -> ?button_labels:button_labels
572+ -> ?intl:intl
573+ -> unit
574+ -> [> `Div ] elt
540575 =
541576 fun ?init
542577 ?highlight
0 commit comments