diff --git a/examples/common.js.map b/examples/common.js.map
index b20922f..8226d40 100644
--- a/examples/common.js.map
+++ b/examples/common.js.map
@@ -1 +1 @@
-{"version":3,"sources":["webpack:///webpack/bootstrap 1bf0b957b271cd4f6944"],"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 1bf0b957b271cd4f6944\n **/"],"sourceRoot":""}
\ No newline at end of file
+{"version":3,"sources":["webpack:///webpack/bootstrap ba2a34981a04e199a899"],"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 ba2a34981a04e199a899\n **/"],"sourceRoot":""}
\ No newline at end of file
diff --git a/examples/simple.html b/examples/simple.html
index 91a00cc..183b42a 100644
--- a/examples/simple.html
+++ b/examples/simple.html
@@ -239,7 +239,7 @@ Monokai Sublime style. Derived from Monokai by noformnocontent http://nn.mit-lic
@@ -251,8 +251,8 @@ Monokai Sublime style. Derived from Monokai by noformnocontent http://nn.mit-lic
require('rc-slider/assets/index.css');
-var Slider = require('rc-slider');
var React = require('react');
+var Slider = require('rc-slider');
function onChange(v) {
console.log(v);
@@ -272,6 +272,14 @@ React.render(
<div style={{width:400,margin:100}}>
<Slider step={20}/>
</div>
+ <div style={{width:400,margin:100}}>
+ <p>包含关系</p>
+ <Slider marks={["状态1","状态2","状态3","状态4"]} defaultIndex={1} />
+ </div>
+ <div style={{width:400,margin:100}}>
+ <p>并列关系</p>
+ <Slider marks={["状态1","状态2","状态3","状态4"]} isIncluded={false} defaultIndex={1} />
+ </div>
</div>
, document.getElementById('__react-content'));
diff --git a/examples/simple.js b/examples/simple.js
index c77b522..ebba72c 100644
--- a/examples/simple.js
+++ b/examples/simple.js
@@ -13,8 +13,8 @@ webpackJsonp([0,1],[
__webpack_require__(2);
- var Slider = __webpack_require__(3);
- var React = __webpack_require__(6);
+ var React = __webpack_require__(3);
+ var Slider = __webpack_require__(159);
function onChange(v) {
console.log(v);
@@ -42,6 +42,26 @@ webpackJsonp([0,1],[
'div',
{ style: { width: 400, margin: 100 } },
React.createElement(Slider, { step: 20 })
+ ),
+ React.createElement(
+ 'div',
+ { style: { width: 400, margin: 100 } },
+ React.createElement(
+ 'p',
+ null,
+ '包含关系'
+ ),
+ React.createElement(Slider, { marks: ["状态1", "状态2", "状态3", "状态4"], defaultIndex: 1 })
+ ),
+ React.createElement(
+ 'div',
+ { style: { width: 400, margin: 100 } },
+ React.createElement(
+ 'p',
+ null,
+ '并列关系'
+ ),
+ React.createElement(Slider, { marks: ["状态1", "状态2", "状态3", "状态4"], isIncluded: false, defaultIndex: 1 })
)
), document.getElementById('__react-content'));
@@ -59,555 +79,12 @@ webpackJsonp([0,1],[
module.exports = __webpack_require__(4);
+
/***/ },
/* 4 */
/***/ function(module, exports, __webpack_require__) {
- 'use strict';
-
- module.exports = __webpack_require__(5);
-
-/***/ },
-/* 5 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
-
- var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
-
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
-
- var _react = __webpack_require__(6);
-
- var _react2 = _interopRequireDefault(_react);
-
- var _rcTooltip = __webpack_require__(162);
-
- var _rcTooltip2 = _interopRequireDefault(_rcTooltip);
-
- var _rcUtil = __webpack_require__(164);
-
- var _rcUtil2 = _interopRequireDefault(_rcUtil);
-
- function noop() {}
-
- function pauseEvent(e) {
- e.cancelBubble = true;
- e.returnValue = false;
- if (e.stopPropagation) {
- e.stopPropagation();
- }
- if (e.preventDefault) {
- e.preventDefault();
- }
- }
-
- function prefixClsFn(prefixCls) {
- for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- args[_key - 1] = arguments[_key];
- }
-
- return args.map(function (s) {
- return prefixCls + '-' + s;
- }).join(' ');
- }
-
- function getValueFromIndex(props) {
- var value = undefined;
- var marksLen = props.marks.length;
- var index = undefined;
- if ('index' in props) {
- index = props.index;
- } else {
- index = props.defaultIndex;
- }
- if (marksLen > 0) {
- value = (props.max - props.min) / (marksLen - 1) * index;
- value = value.toFixed(5) / 1;
- }
- return value;
- }
-
- var Slider = _react2['default'].createClass({
- displayName: 'Slider',
-
- propTypes: {
- min: _react2['default'].PropTypes.number,
- max: _react2['default'].PropTypes.number,
- step: _react2['default'].PropTypes.number,
- defaultValue: _react2['default'].PropTypes.number,
- defaultIndex: _react2['default'].PropTypes.number,
- value: _react2['default'].PropTypes.number,
- index: _react2['default'].PropTypes.number,
- marks: _react2['default'].PropTypes.array,
- isIncluded: _react2['default'].PropTypes.bool,
- className: _react2['default'].PropTypes.string,
- prefixCls: _react2['default'].PropTypes.string,
- disabled: _react2['default'].PropTypes.bool,
- children: _react2['default'].PropTypes.any,
- onBeforeChange: _react2['default'].PropTypes.func,
- onChange: _react2['default'].PropTypes.func,
- onAfterChange: _react2['default'].PropTypes.func,
- tipTransitionName: _react2['default'].PropTypes.string,
- withDots: _react2['default'].PropTypes.bool
- },
-
- getDefaultProps: function getDefaultProps() {
- return {
- min: 0,
- max: 100,
- step: 1,
- defaultValue: 0,
- marks: [],
- isIncluded: true,
- className: '',
- prefixCls: 'rc-slider',
- disabled: false,
- defaultIndex: 0,
- tipTransitionName: '',
- withDots: false
- };
- },
-
- getInitialState: function getInitialState() {
- var props = this.props;
- var value = props.defaultValue;
- if ('value' in props) {
- value = props.value;
- }
- value = this._trimAlignValue(value);
- var marksLen = props.marks.length;
- if (marksLen > 0) {
- value = getValueFromIndex(props);
- }
- return {
- dragging: false,
- showTooltip: false,
- value: value
- };
- },
-
- componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
- if ('value' in nextProps) {
- this.setState({
- value: nextProps.value
- });
- } else if ('index' in nextProps) {
- this.setState({
- value: getValueFromIndex(nextProps)
- });
- }
- },
-
- onMouseUp: function onMouseUp(e) {
- var m = e.target;
- var handleDom = _react2['default'].findDOMNode(this.refs.handle);
- var showToolTip = false;
- if (m === handleDom) {
- showToolTip = true;
- }
- this._end('mouse', showToolTip);
- },
-
- onTouchUp: function onTouchUp() {
- this._end('touch');
- },
-
- onMouseMove: function onMouseMove(e) {
- var position = e.pageX || e.clientX + document.documentElement.scrollLeft; // to compat ie8
- this.onMove(e, position);
- },
-
- onTouchMove: function onTouchMove(e) {
- if (e.touches.length > 1 || e.type === 'touchend' && e.touches.length > 0) {
- this._end('touch');
- return;
- }
-
- var position = this._getTouchPosition(e);
-
- this.onMove(e, position);
- },
-
- onMove: function onMove(e, position) {
- pauseEvent(e);
- var props = this.props;
- var state = this.state;
-
- var value = state.value;
- var oldValue = value;
-
- var diffPosition = position - this.startPosition;
-
- var diffValue = diffPosition / this.getSliderLength() * (props.max - props.min);
- value = this._trimAlignValue(this.startValue + diffValue);
-
- if (value !== oldValue && !('value' in props) && !('index' in props)) {
- this.setState({ value: value });
- }
- if (value !== oldValue) {
- this._triggerEvents('onChange', value);
- }
- },
-
- onTouchStart: function onTouchStart(e) {
- if (e.touches.length > 1 || e.type.toLowerCase() === 'touchend' && e.touches.length > 0) {
- return;
- }
-
- var position = this._getTouchPosition(e);
- var value = this._calValueByPos(position);
- this._triggerEvents('onChange', value);
- this._start(position, value);
- this._addDocumentEvents('touch');
- pauseEvent(e);
- },
-
- onSliderMouseDown: function onSliderMouseDown(e) {
- var position = e.pageX || e.clientX + document.documentElement.scrollLeft; // to compat ie8
- var value = this._calValueByPos(position);
- this._triggerEvents('onChange', value);
- this._start(position, value);
- this._addDocumentEvents('mouse');
- pauseEvent(e);
- },
-
- getIndex: function getIndex(v) {
- var props = this.props;
- var value = v === undefined ? this.state.value : v;
-
- if (props.marks.length === 0) {
- return Math.floor((value - props.min) / props.step);
- }
- var unit = ((props.max - props.min) / (props.marks.length - 1)).toFixed(5);
- return Math.round(value / unit);
- },
-
- getSliderLength: function getSliderLength() {
- var slider = this.refs.slider;
- if (!slider) {
- return 0;
- }
-
- return slider.getDOMNode().clientWidth;
- },
-
- getSliderStart: function getSliderStart() {
- var slider = this.refs.slider.getDOMNode();
- var rect = slider.getBoundingClientRect();
-
- return rect.left;
- },
-
- renderSteps: function renderSteps() {
- var props = this.props;
- var marksLen = props.marks.length;
- var withDots = props.withDots;
-
- if (marksLen || withDots) {
- var stepNum = marksLen ? marksLen : Math.floor((props.max - props.min) / props.step) + 1;
- var unit = 100 / (stepNum - 1);
-
- var prefixCls = props.prefixCls;
- var stepClassName = prefixClsFn(prefixCls, 'step');
-
- var elements = [];
- for (var i = 0; i < stepNum; i++) {
- var offset = unit * i + '%';
- var style = {
- left: offset
- };
- var className = prefixClsFn(prefixCls, 'dot');
- if (props.isIncluded) {
- if (i <= this.getIndex()) {
- className = prefixClsFn(prefixCls, 'dot', 'dot-active');
- }
- } else {
- className = i === this.getIndex() ? prefixClsFn(prefixCls, 'dot', 'dot-active') : className;
- }
-
- elements[i] = _react2['default'].createElement('span', { className: className, style: style, ref: 'step' + i, key: 'step' + i });
- }
-
- return _react2['default'].createElement(
- 'div',
- { className: stepClassName },
- elements
- );
- }
-
- return null;
- },
-
- renderMark: function renderMark(i) {
- var marks = this.props.marks;
- var marksLen = marks.length;
- var unit = 100 / (marksLen - 1);
- var offset = unit * i;
-
- var style = {
- width: unit / 2 + '%'
- };
-
- if (i === marksLen - 1) {
- style.right = -unit / 4 + '%';
- } else {
- style.left = i > 0 ? offset - unit / 4 + '%' : -unit / 4 + '%';
- }
-
- var prefixCls = this.props.prefixCls;
- var className = prefixClsFn(prefixCls, 'mark-text');
-
- if (this.props.isIncluded) {
- if (i <= this.getIndex()) {
- className = prefixClsFn(prefixCls, 'mark-text', 'mark-text-active');
- }
- } else {
- className = i === this.getIndex() ? prefixClsFn(prefixCls, 'mark-text', 'mark-text-active') : className;
- }
-
- return _react2['default'].createElement(
- 'span',
- { className: className, style: style, key: i },
- this.props.marks[i]
- );
- },
-
- renderMarks: function renderMarks() {
- var marks = this.props.marks;
- var marksLen = marks.length;
- var elements = [];
- for (var i = 0; i < marksLen; i++) {
- elements[i] = this.renderMark(i);
- }
-
- var prefixCls = this.props.prefixCls;
- var className = prefixClsFn(prefixCls, 'mark');
-
- return _react2['default'].createElement(
- 'div',
- { className: className },
- elements
- );
- },
-
- renderHandler: function renderHandler(offset) {
- var onStyle = {
- left: offset
- };
-
- var prefixCls = this.props.prefixCls;
- var className = prefixClsFn(prefixCls, 'handle');
-
- var events = {};
-
- var tooltipVisible = undefined;
-
- if (this.state.dragging) {
- tooltipVisible = true;
- } else {
- events = {
- onClick: this.showTooltip.bind(this, true),
- onMouseEnter: this.showTooltip.bind(this, true),
- onMouseLeave: this.showTooltip.bind(this, false)
- };
- tooltipVisible = this.state.showTooltip;
- }
-
- var handle = _react2['default'].createElement('div', _extends({ className: className
- }, events, {
- ref: 'handle',
- style: onStyle }));
-
- if (this.props.marks.length > 0) {
- return handle;
- }
- return _react2['default'].createElement(
- _rcTooltip2['default'],
- {
- placement: { points: ['bc', 'tc'] },
- visible: tooltipVisible,
- overlay: _react2['default'].createElement(
- 'span',
- null,
- this.state.value
- ),
- delay: 0,
- transitionName: this.props.tipTransitionName,
- prefixCls: prefixClsFn(prefixCls, 'tooltip') },
- handle
- );
- },
-
- renderTrack: function renderTrack(offset) {
- var style = {
- width: offset
- };
-
- var prefixCls = this.props.prefixCls;
- var trackClassName = prefixClsFn(prefixCls, 'track');
-
- return _react2['default'].createElement('div', { className: trackClassName, ref: 'track', style: style });
- },
-
- render: function render() {
- var _sliderClassName;
-
- var state = this.state;
- var props = this.props;
- var value = state.value;
- var offset = this._calcOffset(value);
- var track = this.props.isIncluded ? this.renderTrack(offset) : null;
- var ons = this.renderHandler(offset);
- var steps = props.step > 1 || props.marks.length > 0 ? this.renderSteps() : null;
- var sliderMarks = props.marks.length > 0 ? this.renderMarks() : null;
- var prefixCls = props.prefixCls;
- var disabled = props.disabled;
- var sliderClassName = (_sliderClassName = {}, _defineProperty(_sliderClassName, prefixCls, 1), _defineProperty(_sliderClassName, props.className, !!props.className), _defineProperty(_sliderClassName, prefixCls + '-disabled', disabled), _sliderClassName);
-
- return _react2['default'].createElement(
- 'div',
- { className: _rcUtil2['default'].classSet(sliderClassName), ref: 'slider',
- onTouchStart: disabled ? noop : this.onTouchStart,
- onMouseDown: disabled ? noop : this.onSliderMouseDown },
- track,
- ons,
- steps,
- sliderMarks,
- this.props.children
- );
- },
-
- showTooltip: function showTooltip(show) {
- this.setState({
- showTooltip: show
- });
- },
-
- _trimAlignValue: function _trimAlignValue(v, propsArg) {
- var val = v;
- var props = propsArg || this.props;
- var step = props.marks.length > 0 ? (props.max - props.min) / (props.marks.length - 1) : props.step;
-
- if (val <= props.min) {
- val = props.min;
- }
- if (val >= props.max) {
- val = props.max;
- }
-
- var valModStep = (val - props.min) % step;
- var alignValue = val - valModStep;
-
- if (Math.abs(valModStep) * 2 >= step) {
- alignValue += valModStep > 0 ? step : -step;
- }
-
- return parseFloat(alignValue.toFixed(5));
- },
-
- _calcOffset: function _calcOffset(value) {
- var ratio = (value - this.props.min) / (this.props.max - this.props.min);
- return ratio * 100 + '%';
- },
-
- _calcValue: function _calcValue(offset) {
- var ratio = offset / this.getSliderLength();
- return ratio * (this.props.max - this.props.min) + this.props.min;
- },
-
- _calValueByPos: function _calValueByPos(position) {
- var pixelOffset = position - this.getSliderStart();
- // pixelOffset -= (this.state.onSize / 2);
- var nextValue = this._trimAlignValue(this._calcValue(pixelOffset));
- this.setState({
- value: nextValue
- });
- return nextValue;
- },
-
- _getTouchPosition: function _getTouchPosition(e) {
- var touch = e.touches[0];
- return touch.pageX;
- },
-
- _triggerEvents: function _triggerEvents(event, v) {
- var props = this.props;
- var hasMarks = props.marks && props.marks.length > 0;
- if (props[event]) {
- var data = undefined;
- if (hasMarks) {
- data = this.getIndex(v);
- } else if (v === undefined) {
- data = this.state.value;
- } else {
- data = v;
- }
- props[event](data);
- }
- },
-
- _addDocumentEvents: function _addDocumentEvents(type) {
- if (type === 'touch') {
- // just work for chrome iOS Safari and Android Browser
- this.onTouchMoveListener = _rcUtil.Dom.addEventListener(document, 'touchmove', this.onTouchMove);
- this.onTouchUpListener = _rcUtil.Dom.addEventListener(document, 'touchend', this.onTouchUp);
- } else if (type === 'mouse') {
- this.onMouseMoveListener = _rcUtil.Dom.addEventListener(document, 'mousemove', this.onMouseMove);
- this.onMouseUpListener = _rcUtil.Dom.addEventListener(document, 'mouseup', this.onMouseUp);
- }
- },
-
- _removeEventons: function _removeEventons(type) {
- if (type === 'touch') {
- this.onTouchMoveListener.remove();
- this.onTouchUpListener.remove();
- } else if (type === 'mouse') {
- this.onMouseMoveListener.remove();
- this.onMouseUpListener.remove();
- }
- },
-
- _start: function _start(position, value) {
- this._triggerEvents('onBeforeChange');
- this.startValue = value;
- this.startPosition = position;
- this.setState({
- dragging: true
- });
- },
-
- _end: function _end(type, showToolTip) {
- this._removeEventons(type);
- this._triggerEvents('onAfterChange');
- this.setState({
- dragging: false,
- showTooltip: !!showToolTip
- });
- }
- });
-
- exports['default'] = Slider;
- module.exports = exports['default'];
-
-/***/ },
-/* 6 */
-/***/ function(module, exports, __webpack_require__) {
-
- module.exports = __webpack_require__(7);
-
-
-/***/ },
-/* 7 */
-/***/ function(module, exports, __webpack_require__) {
-
- /* WEBPACK VAR INJECTION */(function(process) {/**
+ /**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
@@ -618,86 +95,87 @@ webpackJsonp([0,1],[
* @providesModule React
*/
+ 'use strict';
+
+ var ReactDOM = __webpack_require__(5);
+ var ReactDOMServer = __webpack_require__(149);
+ var ReactIsomorphic = __webpack_require__(153);
+
+ var assign = __webpack_require__(41);
+ var deprecated = __webpack_require__(158);
+
+ // `version` will be added here by ReactIsomorphic.
+ var React = {};
+
+ assign(React, ReactIsomorphic);
+
+ assign(React, {
+ // ReactDOM
+ findDOMNode: deprecated('findDOMNode', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.findDOMNode),
+ render: deprecated('render', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.render),
+ unmountComponentAtNode: deprecated('unmountComponentAtNode', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.unmountComponentAtNode),
+
+ // ReactDOMServer
+ renderToString: deprecated('renderToString', 'ReactDOMServer', 'react-dom/server', ReactDOMServer, ReactDOMServer.renderToString),
+ renderToStaticMarkup: deprecated('renderToStaticMarkup', 'ReactDOMServer', 'react-dom/server', ReactDOMServer, ReactDOMServer.renderToStaticMarkup)
+ });
+
+ React.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOM;
+
+ module.exports = React;
+
+/***/ },
+/* 5 */
+/***/ function(module, exports, __webpack_require__) {
+
+ /* WEBPACK VAR INJECTION */(function(process) {/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ReactDOM
+ */
+
/* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/
'use strict';
- var EventPluginUtils = __webpack_require__(9);
- var ReactChildren = __webpack_require__(13);
- var ReactComponent = __webpack_require__(27);
- var ReactClass = __webpack_require__(42);
- var ReactContext = __webpack_require__(17);
- var ReactCurrentOwner = __webpack_require__(22);
- var ReactElement = __webpack_require__(16);
- var ReactElementValidator = __webpack_require__(37);
- var ReactDOM = __webpack_require__(45);
- var ReactDOMTextComponent = __webpack_require__(47);
- var ReactDefaultInjection = __webpack_require__(96);
- var ReactInstanceHandles = __webpack_require__(24);
- var ReactMount = __webpack_require__(72);
- var ReactPerf = __webpack_require__(33);
- var ReactPropTypes = __webpack_require__(127);
- var ReactReconciler = __webpack_require__(34);
- var ReactServerRendering = __webpack_require__(159);
+ var ReactCurrentOwner = __webpack_require__(7);
+ var ReactDOMTextComponent = __webpack_require__(8);
+ var ReactDefaultInjection = __webpack_require__(72);
+ var ReactInstanceHandles = __webpack_require__(46);
+ var ReactMount = __webpack_require__(30);
+ var ReactPerf = __webpack_require__(20);
+ var ReactReconciler = __webpack_require__(51);
+ var ReactUpdates = __webpack_require__(55);
+ var ReactVersion = __webpack_require__(147);
- var assign = __webpack_require__(18);
- var findDOMNode = __webpack_require__(116);
- var onlyChild = __webpack_require__(161);
+ var findDOMNode = __webpack_require__(92);
+ var renderSubtreeIntoContainer = __webpack_require__(148);
+ var warning = __webpack_require__(27);
ReactDefaultInjection.inject();
- var createElement = ReactElement.createElement;
- var createFactory = ReactElement.createFactory;
- var cloneElement = ReactElement.cloneElement;
-
- if ("production" !== process.env.NODE_ENV) {
- createElement = ReactElementValidator.createElement;
- createFactory = ReactElementValidator.createFactory;
- cloneElement = ReactElementValidator.cloneElement;
- }
-
var render = ReactPerf.measure('React', 'render', ReactMount.render);
var React = {
- Children: {
- map: ReactChildren.map,
- forEach: ReactChildren.forEach,
- count: ReactChildren.count,
- only: onlyChild
- },
- Component: ReactComponent,
- DOM: ReactDOM,
- PropTypes: ReactPropTypes,
- initializeTouchEvents: function(shouldUseTouch) {
- EventPluginUtils.useTouchEvents = shouldUseTouch;
- },
- createClass: ReactClass.createClass,
- createElement: createElement,
- cloneElement: cloneElement,
- createFactory: createFactory,
- createMixin: function(mixin) {
- // Currently a noop. Will be used to validate and trace mixins.
- return mixin;
- },
- constructAndRenderComponent: ReactMount.constructAndRenderComponent,
- constructAndRenderComponentByID: ReactMount.constructAndRenderComponentByID,
findDOMNode: findDOMNode,
render: render,
- renderToString: ReactServerRendering.renderToString,
- renderToStaticMarkup: ReactServerRendering.renderToStaticMarkup,
unmountComponentAtNode: ReactMount.unmountComponentAtNode,
- isValidElement: ReactElement.isValidElement,
- withContext: ReactContext.withContext,
+ version: ReactVersion,
- // Hook for JSX spread, don't use this for anything else.
- __spread: assign
+ /* eslint-disable camelcase */
+ unstable_batchedUpdates: ReactUpdates.batchedUpdates,
+ unstable_renderSubtreeIntoContainer: renderSubtreeIntoContainer
};
// Inject the runtime into a devtools global hook regardless of browser.
// Allows for debugging when the hook is injected on the page.
- if (
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') {
+ /* eslint-enable camelcase */
+ if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') {
__REACT_DEVTOOLS_GLOBAL_HOOK__.inject({
CurrentOwner: ReactCurrentOwner,
InstanceHandles: ReactInstanceHandles,
@@ -707,59 +185,45 @@ webpackJsonp([0,1],[
});
}
- if ("production" !== process.env.NODE_ENV) {
- var ExecutionEnvironment = __webpack_require__(56);
+ if (process.env.NODE_ENV !== 'production') {
+ var ExecutionEnvironment = __webpack_require__(11);
if (ExecutionEnvironment.canUseDOM && window.top === window.self) {
- // If we're in Chrome, look for the devtools marker and provide a download
- // link if not installed.
- if (navigator.userAgent.indexOf('Chrome') > -1) {
- if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
- console.debug(
- 'Download the React DevTools for a better development experience: ' +
- 'https://fb.me/react-devtools'
- );
+ // First check if devtools is not installed
+ if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
+ // If we're in Chrome or Firefox, provide a download link if not installed.
+ if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) {
+ console.debug('Download the React DevTools for a better development experience: ' + 'https://fb.me/react-devtools');
}
}
- var expectedFeatures = [
- // shims
- Array.isArray,
- Array.prototype.every,
- Array.prototype.forEach,
- Array.prototype.indexOf,
- Array.prototype.map,
- Date.now,
- Function.prototype.bind,
- Object.keys,
- String.prototype.split,
- String.prototype.trim,
+ // If we're in IE8, check to see if we are in compatibility mode and provide
+ // information on preventing compatibility mode
+ var ieCompatibilityMode = document.documentMode && document.documentMode < 8;
- // shams
- Object.create,
- Object.freeze
- ];
+ process.env.NODE_ENV !== 'production' ? warning(!ieCompatibilityMode, 'Internet Explorer is running in compatibility mode; please add the ' + 'following tag to your HTML to prevent this from happening: ' + '
') : undefined;
+
+ var expectedFeatures = [
+ // shims
+ Array.isArray, Array.prototype.every, Array.prototype.forEach, Array.prototype.indexOf, Array.prototype.map, Date.now, Function.prototype.bind, Object.keys, String.prototype.split, String.prototype.trim,
+
+ // shams
+ Object.create, Object.freeze];
for (var i = 0; i < expectedFeatures.length; i++) {
if (!expectedFeatures[i]) {
- console.error(
- 'One or more ES5 shim/shams expected by React are not available: ' +
- 'https://fb.me/react-warning-polyfills'
- );
+ console.error('One or more ES5 shim/shams expected by React are not available: ' + 'https://fb.me/react-warning-polyfills');
break;
}
}
}
}
- React.version = '0.13.3';
-
module.exports = React;
-
- /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(8)))
+ /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6)))
/***/ },
-/* 8 */
+/* 6 */
/***/ function(module, exports) {
// shim for using process in browser
@@ -855,8 +319,3820 @@ webpackJsonp([0,1],[
process.umask = function() { return 0; };
+/***/ },
+/* 7 */
+/***/ function(module, exports) {
+
+ /**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ReactCurrentOwner
+ */
+
+ 'use strict';
+
+ /**
+ * Keeps track of the current owner.
+ *
+ * The current owner is the component who should own any components that are
+ * currently being constructed.
+ */
+ var ReactCurrentOwner = {
+
+ /**
+ * @internal
+ * @type {ReactComponent}
+ */
+ current: null
+
+ };
+
+ module.exports = ReactCurrentOwner;
+
+/***/ },
+/* 8 */
+/***/ function(module, exports, __webpack_require__) {
+
+ /* WEBPACK VAR INJECTION */(function(process) {/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule ReactDOMTextComponent
+ * @typechecks static-only
+ */
+
+ 'use strict';
+
+ var DOMChildrenOperations = __webpack_require__(9);
+ var DOMPropertyOperations = __webpack_require__(24);
+ var ReactComponentBrowserEnvironment = __webpack_require__(28);
+ var ReactMount = __webpack_require__(30);
+
+ var assign = __webpack_require__(41);
+ var escapeTextContentForBrowser = __webpack_require__(23);
+ var setTextContent = __webpack_require__(22);
+ var validateDOMNesting = __webpack_require__(71);
+
+ /**
+ * Text nodes violate a couple assumptions that React makes about components:
+ *
+ * - When mounting text into the DOM, adjacent text nodes are merged.
+ * - Text nodes cannot be assigned a React root ID.
+ *
+ * This component is used to wrap strings in elements so that they can undergo
+ * the same reconciliation that is applied to elements.
+ *
+ * TODO: Investigate representing React components in the DOM with text nodes.
+ *
+ * @class ReactDOMTextComponent
+ * @extends ReactComponent
+ * @internal
+ */
+ var ReactDOMTextComponent = function (props) {
+ // This constructor and its argument is currently used by mocks.
+ };
+
+ assign(ReactDOMTextComponent.prototype, {
+
+ /**
+ * @param {ReactText} text
+ * @internal
+ */
+ construct: function (text) {
+ // TODO: This is really a ReactText (ReactNode), not a ReactElement
+ this._currentElement = text;
+ this._stringText = '' + text;
+
+ // Properties
+ this._rootNodeID = null;
+ this._mountIndex = 0;
+ },
+
+ /**
+ * Creates the markup for this text node. This node is not intended to have
+ * any features besides containing text content.
+ *
+ * @param {string} rootID DOM ID of the root node.
+ * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
+ * @return {string} Markup for this text node.
+ * @internal
+ */
+ mountComponent: function (rootID, transaction, context) {
+ if (process.env.NODE_ENV !== 'production') {
+ if (context[validateDOMNesting.ancestorInfoContextKey]) {
+ validateDOMNesting('span', null, context[validateDOMNesting.ancestorInfoContextKey]);
+ }
+ }
+
+ this._rootNodeID = rootID;
+ if (transaction.useCreateElement) {
+ var ownerDocument = context[ReactMount.ownerDocumentContextKey];
+ var el = ownerDocument.createElement('span');
+ DOMPropertyOperations.setAttributeForID(el, rootID);
+ // Populate node cache
+ ReactMount.getID(el);
+ setTextContent(el, this._stringText);
+ return el;
+ } else {
+ var escapedText = escapeTextContentForBrowser(this._stringText);
+
+ if (transaction.renderToStaticMarkup) {
+ // Normally we'd wrap this in a `span` for the reasons stated above, but
+ // since this is a situation where React won't take over (static pages),
+ // we can simply return the text as it is.
+ return escapedText;
+ }
+
+ return '
' + escapedText + '';
+ }
+ },
+
+ /**
+ * Updates this component by updating the text content.
+ *
+ * @param {ReactText} nextText The next text content
+ * @param {ReactReconcileTransaction} transaction
+ * @internal
+ */
+ receiveComponent: function (nextText, transaction) {
+ if (nextText !== this._currentElement) {
+ this._currentElement = nextText;
+ var nextStringText = '' + nextText;
+ if (nextStringText !== this._stringText) {
+ // TODO: Save this as pending props and use performUpdateIfNecessary
+ // and/or updateComponent to do the actual update for consistency with
+ // other component types?
+ this._stringText = nextStringText;
+ var node = ReactMount.getNode(this._rootNodeID);
+ DOMChildrenOperations.updateTextContent(node, nextStringText);
+ }
+ }
+ },
+
+ unmountComponent: function () {
+ ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
+ }
+
+ });
+
+ module.exports = ReactDOMTextComponent;
+ /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(6)))
+
/***/ },
/* 9 */
+/***/ function(module, exports, __webpack_require__) {
+
+ /* WEBPACK VAR INJECTION */(function(process) {/**
+ * Copyright 2013-2015, Facebook, Inc.
+ * All rights reserved.
+ *
+ * This source code is licensed under the BSD-style license found in the
+ * LICENSE file in the root directory of this source tree. An additional grant
+ * of patent rights can be found in the PATENTS file in the same directory.
+ *
+ * @providesModule DOMChildrenOperations
+ * @typechecks static-only
+ */
+
+ 'use strict';
+
+ var Danger = __webpack_require__(10);
+ var ReactMultiChildUpdateTypes = __webpack_require__(18);
+ var ReactPerf = __webpack_require__(20);
+
+ var setInnerHTML = __webpack_require__(21);
+ var setTextContent = __webpack_require__(22);
+ var invariant = __webpack_require__(15);
+
+ /**
+ * Inserts `childNode` as a child of `parentNode` at the `index`.
+ *
+ * @param {DOMElement} parentNode Parent node in which to insert.
+ * @param {DOMElement} childNode Child node to insert.
+ * @param {number} index Index at which to insert the child.
+ * @internal
+ */
+ function insertChildAt(parentNode, childNode, index) {
+ // By exploiting arrays returning `undefined` for an undefined index, we can
+ // rely exclusively on `insertBefore(node, null)` instead of also using
+ // `appendChild(node)`. However, using `undefined` is not allowed by all
+ // browsers so we must replace it with `null`.
+
+ // fix render order error in safari
+ // IE8 will throw error when index out of list size.
+ var beforeChild = index >= parentNode.childNodes.length ? null : parentNode.childNodes.item(index);
+
+ parentNode.insertBefore(childNode, beforeChild);
+ }
+
+ /**
+ * Operations for updating with DOM children.
+ */
+ var DOMChildrenOperations = {
+
+ dangerouslyReplaceNodeWithMarkup: Danger.dangerouslyReplaceNodeWithMarkup,
+
+ updateTextContent: setTextContent,
+
+ /**
+ * Updates a component's children by processing a series of updates. The
+ * update configurations are each expected to have a `parentNode` property.
+ *
+ * @param {array