@@ -10,16 +10,7 @@ local fn = require("nui-components.utils.fn")
1010local Component = Popup :extend (" Component" )
1111
1212function Component :init (props , popup_options )
13- popup_options = fn .deep_merge ({
14- enter = false ,
15- focusable = true ,
16- win_options = {
17- winblend = 0 ,
18- },
19- zindex = 100 ,
20- }, fn .default_to (popup_options , {}))
21-
22- props = fn .merge ({
13+ props = fn .deep_merge ({
2314 hidden = false ,
2415 mappings = fn .always ({}),
2516 events = fn .always ({}),
@@ -30,8 +21,34 @@ function Component:init(props, popup_options)
3021 on_mount = fn .ignore ,
3122 on_unmount = fn .ignore ,
3223 id = tostring (math.random ()),
24+ window = {
25+ blend = 0 ,
26+ highlight = nil ,
27+ },
3328 }, props )
3429
30+ local winhighlight = props .window .highlight
31+
32+ if winhighlight and type (winhighlight ) == " table" then
33+ winhighlight = table.concat (
34+ fn .kreduce (winhighlight , function (acc , value , key )
35+ table.insert (acc , key .. " :" .. value )
36+ return acc
37+ end , {}),
38+ " ,"
39+ )
40+ end
41+
42+ popup_options = fn .deep_merge ({
43+ enter = false ,
44+ focusable = true ,
45+ win_options = {
46+ winblend = props .window .blend ,
47+ winhighlight = winhighlight ,
48+ },
49+ zindex = 100 ,
50+ }, popup_options )
51+
3552 if props .border_label and not props .border_style then
3653 props .border_style = " rounded"
3754 end
@@ -161,6 +178,7 @@ function Component:_default_prop_types()
161178 padding = { " table" , " number" , " nil" },
162179 autofocus = { " boolean" , " nil" },
163180 validate = { " function" , " nil" },
181+ window = " table" ,
164182 }
165183end
166184
0 commit comments