This commit is contained in:
Weixing Zhang
2015-07-15 15:24:58 +08:00
parent c891985634
commit 3cac1b5490
4 changed files with 27 additions and 43 deletions
+1 -1
View File
@@ -1 +1 @@
{"version":3,"sources":["webpack:///webpack/bootstrap 3d72d185faaf8c8fb199"],"names":[],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAQ,oBAAoB;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,wEAAgE,aAAa;AAC7E;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA","file":"common.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tvar parentJsonpFunction = window[\"webpackJsonp\"];\n \twindow[\"webpackJsonp\"] = function webpackJsonpCallback(chunkIds, moreModules) {\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, callbacks = [];\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(installedChunks[chunkId])\n \t\t\t\tcallbacks.push.apply(callbacks, installedChunks[chunkId]);\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules);\n \t\twhile(callbacks.length)\n \t\t\tcallbacks.shift().call(null, __webpack_require__);\n \t\tif(moreModules[0]) {\n \t\t\tinstalledModules[0] = 0;\n \t\t\treturn __webpack_require__(0);\n \t\t}\n \t};\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// object to store loaded and loading chunks\n \t// \"0\" means \"already loaded\"\n \t// Array means \"loading\", array contains callbacks\n \tvar installedChunks = {\n \t\t1:0\n \t};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n \t// This file contains only the entry chunk.\n \t// The chunk loading function for additional chunks\n \t__webpack_require__.e = function requireEnsure(chunkId, callback) {\n \t\t// \"0\" is the signal for \"already loaded\"\n \t\tif(installedChunks[chunkId] === 0)\n \t\t\treturn callback.call(null, __webpack_require__);\n\n \t\t// an array means \"currently loading\".\n \t\tif(installedChunks[chunkId] !== undefined) {\n \t\t\tinstalledChunks[chunkId].push(callback);\n \t\t} else {\n \t\t\t// start chunk loading\n \t\t\tinstalledChunks[chunkId] = [callback];\n \t\t\tvar head = document.getElementsByTagName('head')[0];\n \t\t\tvar script = document.createElement('script');\n \t\t\tscript.type = 'text/javascript';\n \t\t\tscript.charset = 'utf-8';\n \t\t\tscript.async = true;\n\n \t\t\tscript.src = __webpack_require__.p + \"\" + chunkId + \".\" + ({\"0\":\"simple\"}[chunkId]||chunkId) + \".js\";\n \t\t\thead.appendChild(script);\n \t\t}\n \t};\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 3d72d185faaf8c8fb199\n **/"],"sourceRoot":""}
{"version":3,"sources":["webpack:///webpack/bootstrap d163ddfef92be120e2df"],"names":[],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAQ,oBAAoB;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAI;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,wEAAgE,aAAa;AAC7E;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA","file":"common.js","sourcesContent":[" \t// install a JSONP callback for chunk loading\n \tvar parentJsonpFunction = window[\"webpackJsonp\"];\n \twindow[\"webpackJsonp\"] = function webpackJsonpCallback(chunkIds, moreModules) {\n \t\t// add \"moreModules\" to the modules object,\n \t\t// then flag all \"chunkIds\" as loaded and fire callback\n \t\tvar moduleId, chunkId, i = 0, callbacks = [];\n \t\tfor(;i < chunkIds.length; i++) {\n \t\t\tchunkId = chunkIds[i];\n \t\t\tif(installedChunks[chunkId])\n \t\t\t\tcallbacks.push.apply(callbacks, installedChunks[chunkId]);\n \t\t\tinstalledChunks[chunkId] = 0;\n \t\t}\n \t\tfor(moduleId in moreModules) {\n \t\t\tmodules[moduleId] = moreModules[moduleId];\n \t\t}\n \t\tif(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules);\n \t\twhile(callbacks.length)\n \t\t\tcallbacks.shift().call(null, __webpack_require__);\n \t\tif(moreModules[0]) {\n \t\t\tinstalledModules[0] = 0;\n \t\t\treturn __webpack_require__(0);\n \t\t}\n \t};\n\n \t// The module cache\n \tvar installedModules = {};\n\n \t// object to store loaded and loading chunks\n \t// \"0\" means \"already loaded\"\n \t// Array means \"loading\", array contains callbacks\n \tvar installedChunks = {\n \t\t1:0\n \t};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n \t// This file contains only the entry chunk.\n \t// The chunk loading function for additional chunks\n \t__webpack_require__.e = function requireEnsure(chunkId, callback) {\n \t\t// \"0\" is the signal for \"already loaded\"\n \t\tif(installedChunks[chunkId] === 0)\n \t\t\treturn callback.call(null, __webpack_require__);\n\n \t\t// an array means \"currently loading\".\n \t\tif(installedChunks[chunkId] !== undefined) {\n \t\t\tinstalledChunks[chunkId].push(callback);\n \t\t} else {\n \t\t\t// start chunk loading\n \t\t\tinstalledChunks[chunkId] = [callback];\n \t\t\tvar head = document.getElementsByTagName('head')[0];\n \t\t\tvar script = document.createElement('script');\n \t\t\tscript.type = 'text/javascript';\n \t\t\tscript.charset = 'utf-8';\n \t\t\tscript.async = true;\n\n \t\t\tscript.src = __webpack_require__.p + \"\" + chunkId + \".\" + ({\"0\":\"simple\"}[chunkId]||chunkId) + \".js\";\n \t\t\thead.appendChild(script);\n \t\t}\n \t};\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap d163ddfef92be120e2df\n **/"],"sourceRoot":""}
+1 -1
View File
@@ -180,7 +180,7 @@
<script src="//cdnjs.cloudflare.com/ajax/libs/react/0.13.3/react.js"></script>
</head>
<body>
<h1>rc-slider@1.2.8</h1>
<h1>rc-slider@1.2.9</h1>
<div id="__react-content"></div>
<script src="common.js?nowrap"></script>
<script src="simple.js?nowrap"></script>
+24 -40
View File
@@ -342,8 +342,6 @@ webpackJsonp([0,1],[
}
return {
upperBound: 0,
sliderLength: 0,
value: value,
active: props.disabled ? '' : value > props.min || props.index > 0 ? 'active' : ''
};
@@ -354,29 +352,20 @@ webpackJsonp([0,1],[
this.state.value = this._trimAlignValue(value, newProps);
},
componentDidMount: function componentDidMount() {
this._onHandleResizeListener = DomUtils.addEventListener(window, 'resize', this.handleResize);
setTimeout(this.handleResize, 0);
},
componentWillUnmount: function componentWillUnmount() {
if (this._onHandleResizeListener) {
this._onHandleResizeListener.remove();
}
},
getValue: function getValue() {
return this.state.value;
},
getIndex: function getIndex() {
var props = this.props;
if (props.marks.length === 0) {
return 0;
}
var value = this.state.value;
var unit = ((props.max - props.min) / (props.marks.length - 1)).toFixed(5);
return Math.floor(value / unit);
if (props.marks.length === 0) {
return Math.floor((value - props.min) / props.step);
} else {
var unit = ((props.max - props.min) / (props.marks.length - 1)).toFixed(5);
return Math.ceil(value / unit);
}
},
_trimAlignValue: function _trimAlignValue(val, props) {
@@ -403,18 +392,17 @@ webpackJsonp([0,1],[
_calcOffset: function _calcOffset(value) {
var ratio = (value - this.props.min) / (this.props.max - this.props.min);
return ratio * this.state.upperBound;
return ratio * 100 + '%';
},
_calcValue: function _calcValue(offset) {
var ratio = offset / this.state.upperBound;
var ratio = offset / this.getSliderLength();
return ratio * (this.props.max - this.props.min) + this.props.min;
},
_calValueByPos: function _calValueByPos(position, callback) {
var pixelOffset = position - this.getSliderStart();
// pixelOffset -= (this.state.handleSize / 2);
var nextValue = this._trimAlignValue(this._calcValue(pixelOffset));
this.setState({ value: nextValue, active: 'active' }, callback);
@@ -514,7 +502,7 @@ webpackJsonp([0,1],[
var diffPosition = position - state.startPosition;
var diffValue = diffPosition / state.sliderLength * (props.max - props.min);
var diffValue = diffPosition / this.getSliderLength() * (props.max - props.min);
var newValue = this._trimAlignValue(state.startValue + diffValue);
value = newValue;
@@ -524,17 +512,13 @@ webpackJsonp([0,1],[
}
},
handleResize: function handleResize() {
var slider = this.refs.slider.getDOMNode();
var rect = slider.getBoundingClientRect();
getSliderLength: function getSliderLength() {
var slider = this.refs.slider;
if (!slider) {
return 0;
}
var sliderMin = rect.left;
var sliderMax = rect.right;
this.setState({
upperBound: slider.clientWidth,
sliderLength: Math.abs(sliderMax - sliderMin)
});
return slider.getDOMNode().clientWidth;
},
getSliderStart: function getSliderStart() {
@@ -590,20 +574,20 @@ webpackJsonp([0,1],[
var props = this.props;
var marksLen = props.marks.length;
var stepNum = marksLen > 0 ? marksLen : Math.floor((props.max - props.min) / props.step) + 1;
var unit = this.state.sliderLength / (stepNum - 1);
var unit = 100 / (stepNum - 1);
var prefixCls = props.className;
var stepClassName = prefixClsFn(prefixCls, 'step');
var elements = [];
for (var i = 0; i < stepNum; i++) {
var offset = unit * i;
var offset = unit * i + '%';
var style = {
left: offset.toFixed(5)
left: offset
};
var className = prefixClsFn(prefixCls, 'dot');
if (props.isIncluded) {
if (i <= this.getIndex() || this._calcValue(offset) <= this.getValue()) {
if (i <= this.getIndex()) {
className = prefixClsFn(prefixCls, 'dot', 'dot-active');
}
} else {
@@ -619,17 +603,17 @@ webpackJsonp([0,1],[
renderMark: function renderMark(i) {
var marks = this.props.marks;
var marksLen = marks.length;
var unit = this.state.sliderLength / (marksLen - 1);
var unit = 100 / (marksLen - 1);
var offset = unit * i;
var style = {
width: (unit / 2).toFixed(5)
width: unit / 2 + '%'
};
if (i === marksLen - 1) {
style.right = -(style.width / 2).toFixed(5);
style.right = -unit / 4 + '%';
} else {
style.left = i > 0 ? (offset - unit / 4).toFixed(5) : -(style.width / 2).toFixed(5);
style.left = i > 0 ? offset - unit / 4 + '%' : -unit / 4 + '%';
}
var prefixCls = this.props.className;
File diff suppressed because one or more lines are too long