Skip to content

Commit 9cab7b6

Browse files
committed
[dropdown] [tree-select] Add :body-header prop
For day8/rf8.day8.com.au#132
1 parent 7a55fbb commit 9cab7b6

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/re_com/dropdown.cljs

+11-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,11 @@
4444
{:name :body-wrapper
4545
:impl "[box]"
4646
:level 1
47-
:notes "Wraps the :body part. Provides intelligent positioning."}
47+
:notes "Wraps the :body and :body-header parts. Provides intelligent positioning."}
48+
{:name :body-header
49+
:impl "user-defined"
50+
:level 2
51+
:notes "Shown when the dropdown is open."}
4852
{:name :body
4953
:impl "user-defined"
5054
:level 2
@@ -104,6 +108,10 @@
104108
"Appears either above or below the :anchor, "
105109
"depending on available screen-space. When a function, "
106110
":body is passed the same keyword arguments as :anchor.")}
111+
{:name :body-header
112+
:type "part"
113+
:validate-fn part?
114+
:description (str "Appears at the top of the :body part.")}
107115
{:name :disabled?
108116
:required false
109117
:type "boolean | r/atom"}
@@ -280,7 +288,7 @@
280288
anchor-height anchor-width
281289
model
282290
label placeholder
283-
anchor backdrop body indicator
291+
anchor backdrop body body-header indicator
284292
parts theme main-theme theme-vars base-theme
285293
width]
286294
:or {placeholder "Select an item"
@@ -357,6 +365,7 @@
357365
:parts parts
358366
:state state
359367
:theme theme}
368+
[u/part body-header part-props nil]
360369
[u/part body part-props]])]})])))))
361370

362371
(defn- move-to-new-choice

src/re_com/tree_select.cljs

+2-2
Original file line numberDiff line numberDiff line change
@@ -534,8 +534,7 @@
534534
label-fn alt-text-fn group-label-fn model placeholder id-fn field-label-fn
535535
groups-first? initial-expanded-groups
536536
show-reset-button? on-reset
537-
label
538-
choice
537+
label body-header choice
539538
empty-means-full?
540539
parts theme main-theme theme-vars base-theme]
541540
:or {placeholder "Select an item..."
@@ -586,6 +585,7 @@
586585
(on-reset (deref-or-value model)
587586
(deref-or-value expanded-groups))))}])]})])
588587
:width width
588+
:body-header body-header
589589
:body [tree-select
590590
(themed ::dropdown-body
591591
{:choices choices

0 commit comments

Comments
 (0)