-
Notifications
You must be signed in to change notification settings - Fork 380
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(react-grid-bootstrap3): add fallback position sticky css property…
… for Safari
- Loading branch information
Andrey Churkin
committed
Apr 11, 2019
1 parent
87143b9
commit c135acc
Showing
6 changed files
with
113 additions
and
55 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
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
84 changes: 52 additions & 32 deletions
84
packages/dx-react-grid-bootstrap3/src/templates/table-no-data-cell.jsx
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
35 changes: 35 additions & 0 deletions
35
packages/dx-react-grid-bootstrap3/src/utils/css-fallback-properties.js
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,35 @@ | ||
/* globals document:true */ | ||
|
||
const cache = {}; | ||
let sandboxElement = null; | ||
|
||
const getBrowserStyles = () => { | ||
sandboxElement = sandboxElement || document.createElement('test'); | ||
|
||
return sandboxElement.style; | ||
}; | ||
|
||
const findOutValidPropertyValue = (property, value) => { | ||
const prop = `${property}:`; | ||
const style = getBrowserStyles(); | ||
|
||
style.cssText = `${prop + ['-webkit-', '-moz-', '-ms-', '-o-', ''].join(`${value};${prop}`) + value};`; | ||
|
||
return style[property]; | ||
}; | ||
|
||
const getValidPropertyValue = (property, value) => { | ||
const isServerRender = typeof document === 'undefined'; | ||
|
||
if (isServerRender) { | ||
return undefined; | ||
} | ||
|
||
if (!(value in cache)) { | ||
cache[value] = findOutValidPropertyValue(property, value); | ||
} | ||
|
||
return cache[value]; | ||
}; | ||
|
||
export const getStickyPosition = () => getValidPropertyValue('position', 'sticky'); |
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