mirror of https://github.com/hashicorp/consul
Update css-prop modifier to new structure
parent
b7295ee1a7
commit
73089ed9ea
|
@ -4,9 +4,7 @@
|
|||
}}
|
||||
|
||||
<@disclosure.Details as |details|>
|
||||
<PagedCollection
|
||||
@items={{or @items (array)}}
|
||||
as |pager|>
|
||||
<PagedCollection @items={{or @items (array)}} as |pager|>
|
||||
<div
|
||||
{{on-outside 'click' @disclosure.close}}
|
||||
{{did-insert pager.viewport}}
|
||||
|
@ -14,17 +12,13 @@
|
|||
{{css-prop '--paged-row-height' returns=pager.rowHeight}}
|
||||
{{css-prop 'max-height' returns=pager.maxHeight}}
|
||||
class={{class-map
|
||||
(array 'paged-collection-scroll' (includes pager.type (array 'virtual-scroll' 'native-scroll')))
|
||||
(array
|
||||
'paged-collection-scroll' (includes pager.type (array 'virtual-scroll' 'native-scroll'))
|
||||
)
|
||||
}}
|
||||
...attributes
|
||||
>
|
||||
{{yield (hash
|
||||
Menu=(component 'menu'
|
||||
disclosure=@disclosure
|
||||
pager=pager
|
||||
)
|
||||
)}}
|
||||
{{yield (hash Menu=(component 'menu' disclosure=@disclosure pager=pager))}}
|
||||
</div>
|
||||
</PagedCollection>
|
||||
</@disclosure.Details>
|
||||
|
||||
</@disclosure.Details>
|
|
@ -4,21 +4,22 @@
|
|||
}}
|
||||
|
||||
<ul
|
||||
role="menu"
|
||||
role='menu'
|
||||
style={{{style-map
|
||||
(array 'height' (if (and @pager (not-eq @pager.type 'native-scroll')) @pager.totalHeight) 'px')
|
||||
(array '--paged-start' (if (and @pager (not-eq @pager.type 'native-scroll')) @pager.startHeight) 'px')
|
||||
(array
|
||||
'--paged-start' (if (and @pager (not-eq @pager.type 'native-scroll')) @pager.startHeight) 'px'
|
||||
)
|
||||
}}}
|
||||
{{did-insert (optional @pager.pane)}}
|
||||
{{aria-menu
|
||||
onclose=(or @onclose @disclosure.close)
|
||||
openEvent=(or @event @disclosure.event)
|
||||
}}
|
||||
{{aria-menu onclose=(or @onclose @disclosure.close) openEvent=(or @event @disclosure.event)}}
|
||||
>
|
||||
{{yield (hash
|
||||
Action=(component 'menu/action' disclosure=@disclosure)
|
||||
Item=(component 'menu/item')
|
||||
Separator=(component 'menu/separator')
|
||||
items=@pager.items
|
||||
)}}
|
||||
{{yield
|
||||
(hash
|
||||
Action=(component 'menu/action' disclosure=@disclosure)
|
||||
Item=(component 'menu/item')
|
||||
Separator=(component 'menu/separator')
|
||||
items=@pager.items
|
||||
)
|
||||
}}
|
||||
</ul>
|
|
@ -8,10 +8,9 @@ import { inject as service } from '@ember/service';
|
|||
|
||||
export default class CSSPropModifier extends Modifier {
|
||||
@service('-document') doc;
|
||||
didReceiveArguments() {
|
||||
const params = this.args.positional;
|
||||
const options = this.args.named;
|
||||
const returns = params[1] || options.returns;
|
||||
returns(this.doc.defaultView.getComputedStyle(this.element).getPropertyValue(params[0]));
|
||||
|
||||
modify(element, positional, named) {
|
||||
const returns = positional[1] || named?.returns;
|
||||
returns(this.doc.defaultView.getComputedStyle(element).getPropertyValue(positional[0]));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue