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 = () => {
...
@@ -11,6 +11,7 @@ const getKnobs = () => {
return
{
return
{
min
:
number
(
'min'
,
0
),
min
:
number
(
'min'
,
0
),
max
:
number
(
'max'
,
100
),
max
:
number
(
'max'
,
100
),
step
:
boolean
(
'enable step'
,
false
),
orientation
:
select
(
'orientation'
,
[
'horizontal'
,
'vertical'
],
'horizontal'
),
orientation
:
select
(
'orientation'
,
[
'horizontal'
,
'vertical'
],
'horizontal'
),
reverse
:
boolean
(
'reverse'
,
true
),
reverse
:
boolean
(
'reverse'
,
true
),
singleValue
:
boolean
(
'single value'
,
false
),
singleValue
:
boolean
(
'single value'
,
false
),
...
@@ -18,10 +19,18 @@ const getKnobs = () => {
...
@@ -18,10 +19,18 @@ const getKnobs = () => {
};
};
const
SliderWrapper
=
()
=>
{
const
SliderWrapper
=
()
=>
{
const
{
min
,
max
,
orientation
,
reverse
,
singleValue
}
=
getKnobs
();
const
{
min
,
max
,
orientation
,
reverse
,
singleValue
,
step
}
=
getKnobs
();
const
stepValue
=
step
?
10
:
undefined
;
return
(
return
(
<
div
style=
{
{
width
:
'200px'
,
height
:
'200px'
}
}
>
<
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
>
</
div
>
);
);
};
};
...
...
packages/grafana-ui/src/components/Slider/Slider.tsx
View file @
248c195c
...
@@ -14,6 +14,7 @@ export interface Props {
...
@@ -14,6 +14,7 @@ export interface Props {
/** Set current positions of handle(s). If only 1 value supplied, only 1 handle displayed. */
/** Set current positions of handle(s). If only 1 value supplied, only 1 handle displayed. */
value
?:
number
[];
value
?:
number
[];
reverse
?:
boolean
;
reverse
?:
boolean
;
step
?:
number
;
tooltipAlwaysVisible
?:
boolean
;
tooltipAlwaysVisible
?:
boolean
;
formatTooltipResult
?:
(
value
:
number
)
=>
number
|
string
;
formatTooltipResult
?:
(
value
:
number
)
=>
number
|
string
;
onChange
?:
(
values
:
number
[])
=>
void
;
onChange
?:
(
values
:
number
[])
=>
void
;
...
@@ -104,6 +105,7 @@ export const Slider: FunctionComponent<Props> = ({
...
@@ -104,6 +105,7 @@ export const Slider: FunctionComponent<Props> = ({
onAfterChange
,
onAfterChange
,
orientation
=
'horizontal'
,
orientation
=
'horizontal'
,
reverse
,
reverse
,
step
,
formatTooltipResult
,
formatTooltipResult
,
value
,
value
,
tooltipAlwaysVisible
=
true
,
tooltipAlwaysVisible
=
true
,
...
@@ -123,6 +125,7 @@ export const Slider: FunctionComponent<Props> = ({
...
@@ -123,6 +125,7 @@ export const Slider: FunctionComponent<Props> = ({
}
}
}
}
min=
{
min
}
min=
{
min
}
max=
{
max
}
max=
{
max
}
step=
{
step
}
defaultValue=
{
value
||
[
min
,
max
]
}
defaultValue=
{
value
||
[
min
,
max
]
}
tipFormatter=
{
(
value
:
number
)
=>
(
formatTooltipResult
?
formatTooltipResult
(
value
)
:
value
)
}
tipFormatter=
{
(
value
:
number
)
=>
(
formatTooltipResult
?
formatTooltipResult
(
value
)
:
value
)
}
onChange=
{
onChange
}
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