projects
/
oweals
/
peertube.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
WIP plugins: update plugin
[oweals/peertube.git]
/
client
/
src
/
app
/
shared
/
buttons
/
action-dropdown.component.ts
diff --git
a/client/src/app/shared/buttons/action-dropdown.component.ts
b/client/src/app/shared/buttons/action-dropdown.component.ts
index 275e2b51ecfbabd82e4816b18c3414f8e9a60dd7..c9dbbfda243035c10b905903ae5ba594e6f0de9e 100644
(file)
--- a/
client/src/app/shared/buttons/action-dropdown.component.ts
+++ b/
client/src/app/shared/buttons/action-dropdown.component.ts
@@
-1,12
+1,18
@@
import { Component, Input } from '@angular/core'
import { Component, Input } from '@angular/core'
+import { GlobalIconName } from '@app/shared/images/global-icon.component'
export type DropdownAction<T> = {
label?: string
export type DropdownAction<T> = {
label?: string
+ iconName?: GlobalIconName
handler?: (a: T) => any
linkBuilder?: (a: T) => (string | number)[]
isDisplayed?: (a: T) => boolean
}
handler?: (a: T) => any
linkBuilder?: (a: T) => (string | number)[]
isDisplayed?: (a: T) => boolean
}
+export type DropdownButtonSize = 'normal' | 'small'
+export type DropdownTheme = 'orange' | 'grey'
+export type DropdownDirection = 'horizontal' | 'vertical'
+
@Component({
selector: 'my-action-dropdown',
styleUrls: [ './action-dropdown.component.scss' ],
@Component({
selector: 'my-action-dropdown',
styleUrls: [ './action-dropdown.component.scss' ],
@@
-16,14
+22,23
@@
export type DropdownAction<T> = {
export class ActionDropdownComponent<T> {
@Input() actions: DropdownAction<T>[] | DropdownAction<T>[][] = []
@Input() entry: T
export class ActionDropdownComponent<T> {
@Input() actions: DropdownAction<T>[] | DropdownAction<T>[][] = []
@Input() entry: T
+
@Input() placement = 'bottom-left'
@Input() placement = 'bottom-left'
- @Input() buttonSize: 'normal' | 'small' = 'normal'
+
+ @Input() buttonSize: DropdownButtonSize = 'normal'
+ @Input() buttonDirection: DropdownDirection = 'horizontal'
+ @Input() buttonStyled = true
+
@Input() label: string
@Input() label: string
- @Input() theme:
'orange' | 'grey'
= 'grey'
+ @Input() theme:
DropdownTheme
= 'grey'
getActions () {
if (this.actions.length !== 0 && Array.isArray(this.actions[0])) return this.actions
return [ this.actions ]
}
getActions () {
if (this.actions.length !== 0 && Array.isArray(this.actions[0])) return this.actions
return [ this.actions ]
}
+
+ areActionsDisplayed (actions: DropdownAction<T>[], entry: T) {
+ return actions.some(a => a.isDisplayed === undefined || a.isDisplayed(entry))
+ }
}
}