-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(D3 plugin): add
splitTooltip
property (#539)
* refactor: add typed SplitPane * feat(D3 plugin): add splitTooltip property * chore: remove Gravity Charts stories from development mode * chore: remove temporary property from hc stories * fix: review fixes
- Loading branch information
Showing
25 changed files
with
1,071 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright 2015 tomkp | ||
// Copyright 2022 YANDEX LLC | ||
|
||
import React from 'react'; | ||
|
||
import type {SplitLayoutType} from './types'; | ||
|
||
type Props = { | ||
className?: string; | ||
children?: React.ReactNode; | ||
size?: number | string; | ||
split?: SplitLayoutType; | ||
style?: React.CSSProperties; | ||
eleRef?: (node: HTMLDivElement) => void; | ||
}; | ||
|
||
export class Pane extends React.PureComponent<Props> { | ||
render() { | ||
const {children, className, split, style: styleProps, size, eleRef} = this.props; | ||
const classes = ['Pane', split, className]; | ||
|
||
let style: React.CSSProperties = { | ||
flex: 1, | ||
position: 'relative', | ||
outline: 'none', | ||
}; | ||
|
||
if (size !== undefined) { | ||
if (split === 'vertical') { | ||
style.width = size; | ||
} else { | ||
style.height = size; | ||
style.display = 'flex'; | ||
} | ||
style.flex = 'none'; | ||
} | ||
|
||
style = Object.assign({}, style, styleProps || {}); | ||
|
||
return ( | ||
<div ref={eleRef} className={classes.join(' ')} style={style}> | ||
{children} | ||
</div> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// Copyright 2015 tomkp | ||
// Copyright 2022 YANDEX LLC | ||
|
||
import React from 'react'; | ||
|
||
import type {SplitLayoutType} from './types'; | ||
|
||
export const RESIZER_DEFAULT_CLASSNAME = 'Resizer'; | ||
|
||
type Props = { | ||
onMouseDown: React.MouseEventHandler; | ||
onTouchStart: React.TouchEventHandler; | ||
onTouchEnd: React.TouchEventHandler; | ||
className?: string; | ||
split?: SplitLayoutType; | ||
style?: React.CSSProperties; | ||
resizerClassName?: string; | ||
onClick?: React.MouseEventHandler; | ||
onDoubleClick?: React.MouseEventHandler; | ||
}; | ||
|
||
export class Resizer extends React.Component<Props> { | ||
render() { | ||
const { | ||
className, | ||
onClick, | ||
onDoubleClick, | ||
onMouseDown, | ||
onTouchEnd, | ||
onTouchStart, | ||
resizerClassName = RESIZER_DEFAULT_CLASSNAME, | ||
split, | ||
style, | ||
} = this.props; | ||
const classes = [resizerClassName, split, className]; | ||
|
||
return ( | ||
<span | ||
role="presentation" | ||
className={classes.join(' ')} | ||
style={style} | ||
onMouseDown={(event) => onMouseDown(event)} | ||
onTouchStart={(event) => { | ||
onTouchStart(event); | ||
}} | ||
onTouchEnd={(event) => { | ||
event.preventDefault(); | ||
onTouchEnd(event); | ||
}} | ||
onClick={(event) => { | ||
if (onClick) { | ||
event.preventDefault(); | ||
onClick(event); | ||
} | ||
}} | ||
onDoubleClick={(event) => { | ||
if (onDoubleClick) { | ||
event.preventDefault(); | ||
onDoubleClick(event); | ||
} | ||
}} | ||
/> | ||
); | ||
} | ||
} |
Oops, something went wrong.