Compare commits

...

3 Commits

Author SHA1 Message Date
Benjy Cui
51b74b7daa bump 1.11.3 2016-11-23 14:08:17 +08:00
Justin
635bc8cedc fix: getComputedStyle for IE8 (#3965) 2016-11-23 13:56:25 +08:00
Midqiu
ff59663898 docs: missing comma (#3172) 2016-09-27 16:38:47 +08:00
3 changed files with 26 additions and 11 deletions

View File

@@ -90,7 +90,7 @@ CustomizedForm = Form.create({})(CustomizedForm);
| 参数 | 说明 | 类型 | 默认值 |
|-----------|-----------------------------------------|-----|--------|
| options.id | 必填输入控件唯一标志 | string | |
| options.id | 必填输入控件唯一标志 | string | |
| options.valuePropName | 子节点的值的属性,如 Switch 的是 'checked' | string | 'value' |
| options.initialValue | 子节点的初始值,类型、可选值均由子节点决定 | | |
| options.trigger | 收集子节点的值的时机 | string | 'onChange' |

View File

@@ -37,6 +37,21 @@ const SIZING_STYLE = [
let computedStyleCache = {};
let hiddenTextarea;
function computedStyle(node) {
return window.getComputedStyle ? getComputedStyle(node) : node.currentStyle;
}
function getStylePropertyValue(style, prop) {
let value;
if (style) {
value = window.getComputedStyle ?
style.getPropertyValue(prop)
:
style[prop.replace(/-(\w)/gi, (word, letter) => letter.toUpperCase())];
}
return value;
}
function calculateNodeStyling(node, useCache = false) {
const nodeRef = (
node.getAttribute('id') ||
@@ -48,26 +63,26 @@ function calculateNodeStyling(node, useCache = false) {
return computedStyleCache[nodeRef];
}
const style = window.getComputedStyle(node);
const style = computedStyle(node);
const boxSizing = (
style.getPropertyValue('box-sizing') ||
style.getPropertyValue('-moz-box-sizing') ||
style.getPropertyValue('-webkit-box-sizing')
getStylePropertyValue(style, 'box-sizing') ||
getStylePropertyValue(style, '-moz-box-sizing') ||
getStylePropertyValue(style, '-webkit-box-sizing')
);
const paddingSize = (
parseFloat(style.getPropertyValue('padding-bottom')) +
parseFloat(style.getPropertyValue('padding-top'))
parseFloat(getStylePropertyValue(style, 'padding-bottom')) +
parseFloat(getStylePropertyValue(style, 'padding-top'))
);
const borderSize = (
parseFloat(style.getPropertyValue('border-bottom-width')) +
parseFloat(style.getPropertyValue('border-top-width'))
parseFloat(getStylePropertyValue(style, 'border-bottom-width')) +
parseFloat(getStylePropertyValue(style, 'border-top-width'))
);
const sizingStyle = SIZING_STYLE
.map(name => `${name}:${style.getPropertyValue(name)}`)
.map(name => `${name}:${getStylePropertyValue(style, name)}`)
.join(';');
const nodeInfo = {

View File

@@ -1,6 +1,6 @@
{
"name": "antd",
"version": "1.11.2",
"version": "1.11.3",
"title": "Ant Design",
"description": "An enterprise-class UI design language and React-based implementation",
"homepage": "http://ant.design/",