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
248c195c
Unverified
Commit
248c195c
authored
Sep 08, 2020
by
Russ
Committed by
GitHub
Sep 08, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Slider: add step functionality (#27399)
parent
32f99669
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
2 deletions
+14
-2
packages/grafana-ui/src/components/Slider/Slider.story.tsx
+11
-2
packages/grafana-ui/src/components/Slider/Slider.tsx
+3
-0
No files found.
packages/grafana-ui/src/components/Slider/Slider.story.tsx
View file @
248c195c
...
...
@@ -11,6 +11,7 @@ const getKnobs = () => {
return
{
min
:
number
(
'min'
,
0
),
max
:
number
(
'max'
,
100
),
step
:
boolean
(
'enable step'
,
false
),
orientation
:
select
(
'orientation'
,
[
'horizontal'
,
'vertical'
],
'horizontal'
),
reverse
:
boolean
(
'reverse'
,
true
),
singleValue
:
boolean
(
'single value'
,
false
),
...
...
@@ -18,10 +19,18 @@ const getKnobs = () => {
};
const
SliderWrapper
=
()
=>
{
const
{
min
,
max
,
orientation
,
reverse
,
singleValue
}
=
getKnobs
();
const
{
min
,
max
,
orientation
,
reverse
,
singleValue
,
step
}
=
getKnobs
();
const
stepValue
=
step
?
10
:
undefined
;
return
(
<
div
style=
{
{
width
:
'200px'
,
height
:
'200px'
}
}
>
<
Slider
min=
{
min
}
max=
{
max
}
orientation=
{
orientation
}
value=
{
singleValue
?
[
10
]
:
undefined
}
reverse=
{
reverse
}
/>
<
Slider
min=
{
min
}
max=
{
max
}
step=
{
stepValue
}
orientation=
{
orientation
}
value=
{
singleValue
?
[
10
]
:
undefined
}
reverse=
{
reverse
}
/>
</
div
>
);
};
...
...
packages/grafana-ui/src/components/Slider/Slider.tsx
View file @
248c195c
...
...
@@ -14,6 +14,7 @@ export interface Props {
/** Set current positions of handle(s). If only 1 value supplied, only 1 handle displayed. */
value
?:
number
[];
reverse
?:
boolean
;
step
?:
number
;
tooltipAlwaysVisible
?:
boolean
;
formatTooltipResult
?:
(
value
:
number
)
=>
number
|
string
;
onChange
?:
(
values
:
number
[])
=>
void
;
...
...
@@ -104,6 +105,7 @@ export const Slider: FunctionComponent<Props> = ({
onAfterChange
,
orientation
=
'horizontal'
,
reverse
,
step
,
formatTooltipResult
,
value
,
tooltipAlwaysVisible
=
true
,
...
...
@@ -123,6 +125,7 @@ export const Slider: FunctionComponent<Props> = ({
}
}
min=
{
min
}
max=
{
max
}
step=
{
step
}
defaultValue=
{
value
||
[
min
,
max
]
}
tipFormatter=
{
(
value
:
number
)
=>
(
formatTooltipResult
?
formatTooltipResult
(
value
)
:
value
)
}
onChange=
{
onChange
}
...
...
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