Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
fc199a35
Commit
fc199a35
authored
Mar 12, 2019
by
Andrej Ocenas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add comments
parent
dfb2dd25
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
packages/grafana-ui/src/components/ColorPicker/ColorPicker.tsx
+11
-0
No files found.
packages/grafana-ui/src/components/ColorPicker/ColorPicker.tsx
View file @
fc199a35
...
...
@@ -9,7 +9,15 @@ import { SeriesColorPickerPopover } from './SeriesColorPickerPopover';
import
{
withTheme
}
from
'../../themes/ThemeContext'
;
import
{
ColorPickerTrigger
}
from
'./ColorPickerTrigger'
;
/**
* If you need custom trigger for the color picker you can do that with a render prop pattern and supply a function
* as a child. You will get show/hide function which you can map to desired interaction (like onClick or onMouseLeave)
* and a ref which needs to be passed to an HTMLElement for correct positioning. If you want to use class or functional
* component as a custom trigger you will need to forward the reference to first HTMLElement child.
*/
type
ColorPickerTriggerRenderer
=
(
props
:
{
// This should be a React.RefObject<HTMLElement> but due to how object refs are defined you cannot downcast from that
// to a specific type like React.RefObject<HTMLDivElement> even though it would be fine in runtime.
ref
:
React
.
RefObject
<
any
>
;
showColorPicker
:
()
=>
void
;
hideColorPicker
:
()
=>
void
;
...
...
@@ -53,6 +61,9 @@ export const colorPickerFactory = <T extends ColorPickerProps>(
)
}
{
children
?
(
// Children have a bit weird type due to intersection used in the definition so we need to cast here,
// but the definition is correct and should not allow to pass a children that does not conform to
// ColorPickerTriggerRenderer type.
(
children
as
ColorPickerTriggerRenderer
)({
ref
:
this
.
pickerTriggerRef
,
showColorPicker
:
showPopper
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment