From dca68b5030302ed1943ee6dcd6b0968dc570e650 Mon Sep 17 00:00:00 2001 From: yiminghe Date: Fri, 27 Nov 2015 16:16:05 +0800 Subject: Updates --- examples/pick-time.js | 7812 ++++++++++++++++++++++--------------------------- 1 file changed, 3539 insertions(+), 4273 deletions(-) (limited to 'examples/pick-time.js') diff --git a/examples/pick-time.js b/examples/pick-time.js index c96690f..caf4aae 100644 --- a/examples/pick-time.js +++ b/examples/pick-time.js @@ -39,11 +39,14 @@ webpackJsonp([0,1],[ var _rcTimePicker2 = _interopRequireDefault(_rcTimePicker); - var _rcTimePickerSrcLocaleZh_CN = __webpack_require__(245); + var _rcTimePickerSrcLocaleZh_CN = __webpack_require__(227); var _rcTimePickerSrcLocaleZh_CN2 = _interopRequireDefault(_rcTimePickerSrcLocaleZh_CN); - var formatter = new _gregorianCalendarFormat2['default']('HH:mm:ss'); + var showSecond = true; + var str = showSecond ? 'HH:mm:ss' : 'HH:mm'; + + var formatter = new _gregorianCalendarFormat2['default'](str); var now = new _gregorianCalendar2['default'](_gregorianCalendarLibLocaleZh_CN2['default']); now.setTime(Date.now()); @@ -52,7 +55,12 @@ webpackJsonp([0,1],[ console.log(value && formatter.format(value)); } - _reactDom2['default'].render(_react2['default'].createElement(_rcTimePicker2['default'], { formatter: formatter, locale: _rcTimePickerSrcLocaleZh_CN2['default'], defaultValue: now, onChange: onChange }), document.getElementById('__react-content')); + _reactDom2['default'].render(_react2['default'].createElement(_rcTimePicker2['default'], { formatter: formatter, locale: _rcTimePickerSrcLocaleZh_CN2['default'], + showSecond: showSecond, + defaultValue: now, + onChange: onChange }), document.getElementById('__react-content')); + + console.log(_gregorianCalendarLibLocaleZh_CN2['default']); /***/ }, /* 2 */ @@ -110,6 +118,7 @@ webpackJsonp([0,1],[ }); React.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOM; + React.__SECRET_DOM_SERVER_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOMServer; module.exports = React; @@ -10460,6 +10469,7 @@ webpackJsonp([0,1],[ multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, name: null, + nonce: MUST_USE_ATTRIBUTE, noValidate: HAS_BOOLEAN_VALUE, open: HAS_BOOLEAN_VALUE, optimum: null, @@ -10471,6 +10481,7 @@ webpackJsonp([0,1],[ readOnly: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE, rel: null, required: HAS_BOOLEAN_VALUE, + reversed: HAS_BOOLEAN_VALUE, role: MUST_USE_ATTRIBUTE, rows: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE, rowSpan: null, @@ -18673,7 +18684,7 @@ webpackJsonp([0,1],[ 'use strict'; - module.exports = '0.14.2'; + module.exports = '0.14.3'; /***/ }, /* 149 */ @@ -22247,28 +22258,28 @@ webpackJsonp([0,1],[ var _react2 = _interopRequireDefault(_react); - var _reactDom = __webpack_require__(160); - - var _reactDom2 = _interopRequireDefault(_reactDom); - var _rcTrigger = __webpack_require__(172); var _rcTrigger2 = _interopRequireDefault(_rcTrigger); - var _rcUtil = __webpack_require__(225); - - var _modulePanel = __webpack_require__(237); + var _modulePanel = __webpack_require__(219); var _modulePanel2 = _interopRequireDefault(_modulePanel); - var _utilPlacements = __webpack_require__(244); + var _utilPlacements = __webpack_require__(225); var _utilPlacements2 = _interopRequireDefault(_utilPlacements); - var _mixinCommonMixin = __webpack_require__(238); + var _mixinCommonMixin = __webpack_require__(220); var _mixinCommonMixin2 = _interopRequireDefault(_mixinCommonMixin); + var _utilIndex = __webpack_require__(226); + + var _gregorianCalendarLibLocaleEn_US = __webpack_require__(164); + + var _gregorianCalendarLibLocaleEn_US2 = _interopRequireDefault(_gregorianCalendarLibLocaleEn_US); + function noop() {} function refFn(field, component) { @@ -22280,18 +22291,23 @@ webpackJsonp([0,1],[ propTypes: { prefixCls: _react.PropTypes.string, - inputClassName: _react.PropTypes.string, locale: _react.PropTypes.object, value: _react.PropTypes.object, - children: _react.PropTypes.func, disabled: _react.PropTypes.bool, + allowEmpty: _react.PropTypes.bool, defaultValue: _react.PropTypes.object, open: _react.PropTypes.bool, + defaultOpen: _react.PropTypes.bool, align: _react.PropTypes.object, placement: _react.PropTypes.any, transitionName: _react.PropTypes.string, + getPopupContainer: _react.PropTypes.func, + gregorianCalendarLocale: _react.PropTypes.object, placeholder: _react.PropTypes.string, - formatter: _react.PropTypes.object, + formatter: _react.PropTypes.any, + showHour: _react.PropTypes.bool, + style: _react.PropTypes.object, + showSecond: _react.PropTypes.bool, hourOptions: _react.PropTypes.array, minuteOptions: _react.PropTypes.array, secondOptions: _react.PropTypes.array, @@ -22304,8 +22320,13 @@ webpackJsonp([0,1],[ getDefaultProps: function getDefaultProps() { return { - open: false, + defaultOpen: false, + style: {}, + gregorianCalendarLocale: _gregorianCalendarLibLocaleEn_US2['default'], align: {}, + allowEmpty: true, + showHour: true, + showSecond: true, placement: 'bottomLeft', onChange: noop, onOpen: noop, @@ -22316,13 +22337,16 @@ webpackJsonp([0,1],[ getInitialState: function getInitialState() { this.savePanelRef = refFn.bind(this, 'panelInstance'); var _props = this.props; - var open = _props.open; + var defaultOpen = _props.defaultOpen; var defaultValue = _props.defaultValue; - var value = _props.value; + var _props$open = _props.open; + var open = _props$open === undefined ? defaultOpen : _props$open; + var _props$value = _props.value; + var value = _props$value === undefined ? defaultValue : _props$value; return { open: open, - value: value || defaultValue + value: value }; }, @@ -22350,14 +22374,18 @@ webpackJsonp([0,1],[ }, onVisibleChange: function onVisibleChange(open) { - var _this = this; + this.setOpen(open); + }, - this.setOpen(open, function () { - if (open) { - _reactDom2['default'].findDOMNode(_this.refs.picker).blur(); - _reactDom2['default'].findDOMNode(_this.panelInstance).focus(); - } - }); + onEsc: function onEsc() { + this.setOpen(false); + this.refs.picker.focus(); + }, + + onKeyDown: function onKeyDown(e) { + if (e.keyCode === 40) { + this.setOpen(true); + } }, setValue: function setValue(value) { @@ -22369,22 +22397,72 @@ webpackJsonp([0,1],[ this.props.onChange(value); }, - getPanel: function getPanel() { + getFormatter: function getFormatter() { + var formatter = this.props.formatter; + var locale = this.props.locale; + if (formatter) { + if (formatter === this.lastFormatter) { + return this.normalFormatter; + } + this.normalFormatter = (0, _utilIndex.getFormatter)(formatter, locale); + this.lastFormatter = formatter; + return this.normalFormatter; + } + if (!this.props.showSecond) { + if (!this.notShowSecondFormatter) { + this.notShowSecondFormatter = (0, _utilIndex.getFormatter)('HH:mm', locale); + } + return this.notShowSecondFormatter; + } + if (!this.props.showHour) { + if (!this.notShowHourFormatter) { + this.notShowHourFormatter = (0, _utilIndex.getFormatter)('mm:ss', locale); + } + return this.notShowHourFormatter; + } + if (!this.normalFormatter) { + this.normalFormatter = (0, _utilIndex.getFormatter)('HH:mm:ss', locale); + } + return this.normalFormatter; + }, + + getPanelElement: function getPanelElement() { var _props2 = this.props; var prefixCls = _props2.prefixCls; var defaultValue = _props2.defaultValue; var locale = _props2.locale; - var formatter = _props2.formatter; var placeholder = _props2.placeholder; var hourOptions = _props2.hourOptions; var minuteOptions = _props2.minuteOptions; var secondOptions = _props2.secondOptions; + var allowEmpty = _props2.allowEmpty; + var showHour = _props2.showHour; + var showSecond = _props2.showSecond; + var gregorianCalendarLocale = _props2.gregorianCalendarLocale; + var value = _props2.value; + var calendarLocale = undefined; + if (value) { + calendarLocale = value.locale; + } else if (defaultValue) { + calendarLocale = defaultValue.locale; + } else { + calendarLocale = gregorianCalendarLocale; + } return _react2['default'].createElement(_modulePanel2['default'], { - prefixCls: prefixCls, + prefixCls: prefixCls + '-panel', + ref: this.savePanelRef, + value: this.state.value, + onChange: this.onPanelChange, + gregorianCalendarLocale: calendarLocale, + onClear: this.onPanelClear, defaultValue: defaultValue, + showHour: showHour, + onEsc: this.onEsc, + showSecond: showSecond, locale: locale, - formatter: formatter, + allowEmpty: allowEmpty, + formatter: this.getFormatter(), placeholder: placeholder, hourOptions: hourOptions, minuteOptions: minuteOptions, @@ -22392,18 +22470,6 @@ webpackJsonp([0,1],[ }); }, - getPanelElement: function getPanelElement() { - var panel = this.getPanel(); - var extraProps = { - ref: this.savePanelRef, - value: this.state.value, - onChange: (0, _rcUtil.createChainedFunction)(panel.props.onChange, this.onPanelChange), - onClear: (0, _rcUtil.createChainedFunction)(panel.props.onClear, this.onPanelClear) - }; - - return _react2['default'].cloneElement(panel, extraProps); - }, - setOpen: function setOpen(open, callback) { var _props3 = this.props; var onOpen = _props3.onOpen; @@ -22432,31 +22498,42 @@ webpackJsonp([0,1],[ var align = _props4.align; var disabled = _props4.disabled; var transitionName = _props4.transitionName; - var formatter = _props4.formatter; - var inputClassName = _props4.inputClassName; + var style = _props4.style; + var showHour = _props4.showHour; + var showSecond = _props4.showSecond; + var getPopupContainer = _props4.getPopupContainer; var _state = this.state; var open = _state.open; var value = _state.value; + var popupClassName = undefined; + if (!showHour || !showSecond) { + popupClassName = prefixCls + '-panel-narrow}'; + } return _react2['default'].createElement( _rcTrigger2['default'], { prefixCls: prefixCls + '-panel', + popupClassName: popupClassName, popup: this.getPanelElement(), popupAlign: align, builtinPlacements: _utilPlacements2['default'], popupPlacement: placement, action: disabled ? [] : ['click'], destroyPopupOnHide: true, + getPopupContainer: getPopupContainer, popupTransitionName: transitionName, popupVisible: open, onPopupVisibleChange: this.onVisibleChange }, _react2['default'].createElement( 'span', - { className: '' + prefixCls }, - _react2['default'].createElement('input', { className: inputClassName, ref: 'picker', type: 'text', placeholder: placeholder, readOnly: true, - disabled: disabled, value: value && formatter.format(value) }), + { className: '' + prefixCls, style: style }, + _react2['default'].createElement('input', { className: prefixCls + '-input', + ref: 'picker', type: 'text', placeholder: placeholder, + readOnly: true, + onKeyDown: this.onKeyDown, + disabled: disabled, value: value && this.getFormatter().format(value) }), _react2['default'].createElement('span', { className: prefixCls + '-icon' }) ) ); @@ -22498,11 +22575,11 @@ webpackJsonp([0,1],[ var _rcUtil = __webpack_require__(174); - var _Popup = __webpack_require__(191); + var _Popup = __webpack_require__(197); var _Popup2 = _interopRequireDefault(_Popup); - var _utils = __webpack_require__(224); + var _utils = __webpack_require__(218); function noop() {} @@ -22835,18 +22912,18 @@ webpackJsonp([0,1],[ module.exports = { guid: __webpack_require__(175), classSet: __webpack_require__(176), - joinClasses: __webpack_require__(178), - KeyCode: __webpack_require__(179), - PureRenderMixin: __webpack_require__(180), - shallowEqual: __webpack_require__(181), - createChainedFunction: __webpack_require__(182), + joinClasses: __webpack_require__(179), + KeyCode: __webpack_require__(180), + PureRenderMixin: __webpack_require__(181), + shallowEqual: __webpack_require__(182), + createChainedFunction: __webpack_require__(188), Dom: { - addEventListener: __webpack_require__(183), - contains: __webpack_require__(188) + addEventListener: __webpack_require__(189), + contains: __webpack_require__(194) }, Children: { - toArray: __webpack_require__(189), - mapSelf: __webpack_require__(190) + toArray: __webpack_require__(195), + mapSelf: __webpack_require__(196) } }; @@ -22867,13 +22944,90 @@ webpackJsonp([0,1],[ 'use strict'; - module.exports = __webpack_require__(177); + var deprecate = __webpack_require__(177); + var classNames = __webpack_require__(178); + + module.exports = deprecate(classNames, '`rcUtil.classSet()` is deprecated, use `classNames()` by `require(\'classnames\')` instead'); /***/ }, /* 177 */ +/***/ function(module, exports) { + + /* WEBPACK VAR INJECTION */(function(global) { + /** + * Module exports. + */ + + module.exports = deprecate; + + /** + * Mark that a method should not be used. + * Returns a modified function which warns once by default. + * + * If `localStorage.noDeprecation = true` is set, then it is a no-op. + * + * If `localStorage.throwDeprecation = true` is set, then deprecated functions + * will throw an Error when invoked. + * + * If `localStorage.traceDeprecation = true` is set, then deprecated functions + * will invoke `console.trace()` instead of `console.error()`. + * + * @param {Function} fn - the function to deprecate + * @param {String} msg - the string to print to the console when `fn` is invoked + * @returns {Function} a new "deprecated" version of `fn` + * @api public + */ + + function deprecate (fn, msg) { + if (config('noDeprecation')) { + return fn; + } + + var warned = false; + function deprecated() { + if (!warned) { + if (config('throwDeprecation')) { + throw new Error(msg); + } else if (config('traceDeprecation')) { + console.trace(msg); + } else { + console.warn(msg); + } + warned = true; + } + return fn.apply(this, arguments); + } + + return deprecated; + } + + /** + * Checks `localStorage` for boolean values for the given `name`. + * + * @param {String} name + * @returns {Boolean} + * @api private + */ + + function config (name) { + // accessing global.localStorage can trigger a DOMException in sandboxed iframes + try { + if (!global.localStorage) return false; + } catch (_) { + return false; + } + var val = global.localStorage[name]; + if (null == val) return false; + return String(val).toLowerCase() === 'true'; + } + + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) + +/***/ }, +/* 178 */ /***/ function(module, exports, __webpack_require__) { - var __WEBPACK_AMD_DEFINE_RESULT__;/*! + var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! Copyright (c) 2015 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames @@ -22914,9 +23068,9 @@ webpackJsonp([0,1],[ module.exports = classNames; } else if (true) { // register as 'classnames', consistent with npm package name - !(__WEBPACK_AMD_DEFINE_RESULT__ = function () { + !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () { return classNames; - }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else { window.classNames = classNames; } @@ -22924,41 +23078,18 @@ webpackJsonp([0,1],[ /***/ }, -/* 178 */ -/***/ function(module, exports) { +/* 179 */ +/***/ function(module, exports, __webpack_require__) { - /** - * Combines multiple className strings into one. - * http://jsperf.com/joinclasses-args-vs-array - * - * @param {...?string} classes - * @return {string} - */ - 'use strict'; - function joinClasses(cn) { - var className = cn; - if (!className) { - className = ''; - } - var nextClass = undefined; - var argLength = arguments.length; - if (argLength > 1) { - for (var ii = 1; ii < argLength; ii++) { - nextClass = arguments[ii]; - if (nextClass) { - className = (className ? className + ' ' : '') + nextClass; - } - } - } - return className; - } + var deprecate = __webpack_require__(177); + var classNames = __webpack_require__(178); - module.exports = joinClasses; + module.exports = deprecate(classNames, '`rcUtil.joinClasses()` is deprecated, use `classNames()` by `require(\'classnames\')` instead'); /***/ }, -/* 179 */ +/* 180 */ /***/ function(module, exports) { /** @@ -23483,12 +23614,12 @@ webpackJsonp([0,1],[ module.exports = KeyCode; /***/ }, -/* 180 */ +/* 181 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; - var shallowEqual = __webpack_require__(181); + var shallowEqual = __webpack_require__(182); /** * If your React component's render function is "pure", e.g. it will render the @@ -23522,60 +23653,15 @@ webpackJsonp([0,1],[ module.exports = ReactComponentWithPureRenderMixin; -/***/ }, -/* 181 */ -/***/ function(module, exports) { - - "use strict"; - - function shallowEqual(objA, objB) { - if (objA === objB) { - return true; - } - var key = undefined; - // Test for A's keys different from B. - for (key in objA) { - if (objA.hasOwnProperty(key) && (!objB.hasOwnProperty(key) || objA[key] !== objB[key])) { - return false; - } - } - // Test for B's keys missing from A. - for (key in objB) { - if (objB.hasOwnProperty(key) && !objA.hasOwnProperty(key)) { - return false; - } - } - return true; - } - - module.exports = shallowEqual; - /***/ }, /* 182 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - /** - * Safe chained function - * - * Will only create a new function if needed, - * otherwise will pass back existing functions or null. - * - * @returns {function|null} - */ - "use strict"; + 'use strict'; - function createChainedFunction() { - var args = arguments; - return function chainedFunction() { - for (var i = 0; i < args.length; i++) { - if (args[i] && args[i].apply) { - args[i].apply(this, arguments); - } - } - }; - } + var shallowEqual = __webpack_require__(183); - module.exports = createChainedFunction; + module.exports = shallowEqual; /***/ }, /* 183 */ @@ -23583,486 +23669,762 @@ webpackJsonp([0,1],[ 'use strict'; - Object.defineProperty(exports, '__esModule', { - value: true - }); - exports['default'] = addEventListenerWrap; - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - - var _addDomEventListener = __webpack_require__(184); - - var _addDomEventListener2 = _interopRequireDefault(_addDomEventListener); + var fetchKeys = __webpack_require__(184); - var _reactDom = __webpack_require__(160); + module.exports = function shallowEqual(objA, objB, compare, compareContext) { - var _reactDom2 = _interopRequireDefault(_reactDom); + var ret = compare ? compare.call(compareContext, objA, objB) : void 0; - function addEventListenerWrap(target, eventType, cb) { - /* eslint camelcase: 2 */ - var callback = _reactDom2['default'].unstable_batchedUpdates ? function run(e) { - _reactDom2['default'].unstable_batchedUpdates(cb, e); - } : cb; - return (0, _addDomEventListener2['default'])(target, eventType, callback); - } + if (ret !== void 0) { + return !!ret; + } - module.exports = exports['default']; - -/***/ }, -/* 184 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; + if (objA === objB) { + return true; + } - Object.defineProperty(exports, '__esModule', { - value: true - }); - exports['default'] = addEventListener; + if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) { + return false; + } - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + var keysA = fetchKeys(objA); + var keysB = fetchKeys(objB); - var _EventObject = __webpack_require__(185); + var len = keysA.length; + if (len !== keysB.length) { + return false; + } - var _EventObject2 = _interopRequireDefault(_EventObject); + compareContext = compareContext || null; - function addEventListener(target, eventType, callback) { - function wrapCallback(e) { - var ne = new _EventObject2['default'](e); - callback.call(target, ne); - } + // Test for A's keys different from B. + var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB); + for (var i = 0; i < len; i++) { + var key = keysA[i]; + if (!bHasOwnProperty(key)) { + return false; + } + var valueA = objA[key]; + var valueB = objB[key]; - if (target.addEventListener) { - target.addEventListener(eventType, wrapCallback, false); - return { - remove: function remove() { - target.removeEventListener(eventType, wrapCallback, false); - } - }; - } else if (target.attachEvent) { - target.attachEvent('on' + eventType, wrapCallback); - return { - remove: function remove() { - target.detachEvent('on' + eventType, wrapCallback); - } - }; - } - } + var _ret = compare ? compare.call(compareContext, valueA, valueB, key) : void 0; + if (_ret === false || _ret === void 0 && valueA !== valueB) { + return false; + } + } - module.exports = exports['default']; + return true; + }; /***/ }, -/* 185 */ +/* 184 */ /***/ function(module, exports, __webpack_require__) { /** - * @ignore - * event object for dom - * @author yiminghe@gmail.com + * lodash 3.1.2 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license */ + var getNative = __webpack_require__(185), + isArguments = __webpack_require__(186), + isArray = __webpack_require__(187); - 'use strict'; + /** Used to detect unsigned integer values. */ + var reIsUint = /^\d+$/; - Object.defineProperty(exports, '__esModule', { - value: true - }); + /** Used for native method references. */ + var objectProto = Object.prototype; - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + /** Used to check objects for own properties. */ + var hasOwnProperty = objectProto.hasOwnProperty; - var _EventBaseObject = __webpack_require__(186); + /* Native method references for those with the same name as other `lodash` methods. */ + var nativeKeys = getNative(Object, 'keys'); - var _EventBaseObject2 = _interopRequireDefault(_EventBaseObject); + /** + * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) + * of an array-like value. + */ + var MAX_SAFE_INTEGER = 9007199254740991; - var _objectAssign = __webpack_require__(187); + /** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new function. + */ + function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; + }; + } - var _objectAssign2 = _interopRequireDefault(_objectAssign); - - var TRUE = true; - var FALSE = false; - var commonProps = ['altKey', 'bubbles', 'cancelable', 'ctrlKey', 'currentTarget', 'eventPhase', 'metaKey', 'shiftKey', 'target', 'timeStamp', 'view', 'type']; + /** + * Gets the "length" property value of `object`. + * + * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) + * that affects Safari on at least iOS 8.1-8.3 ARM64. + * + * @private + * @param {Object} object The object to query. + * @returns {*} Returns the "length" value. + */ + var getLength = baseProperty('length'); - function isNullOrUndefined(w) { - return w === null || w === undefined; + /** + * Checks if `value` is array-like. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + */ + function isArrayLike(value) { + return value != null && isLength(getLength(value)); } - var eventNormalizers = [{ - reg: /^key/, - props: ['char', 'charCode', 'key', 'keyCode', 'which'], - fix: function fix(event, nativeEvent) { - if (isNullOrUndefined(event.which)) { - event.which = !isNullOrUndefined(nativeEvent.charCode) ? nativeEvent.charCode : nativeEvent.keyCode; - } - - // add metaKey to non-Mac browsers (use ctrl for PC 's and Meta for Macs) - if (event.metaKey === undefined) { - event.metaKey = event.ctrlKey; - } - } - }, { - reg: /^touch/, - props: ['touches', 'changedTouches', 'targetTouches'] - }, { - reg: /^hashchange$/, - props: ['newURL', 'oldURL'] - }, { - reg: /^gesturechange$/i, - props: ['rotation', 'scale'] - }, { - reg: /^(mousewheel|DOMMouseScroll)$/, - props: [], - fix: function fix(event, nativeEvent) { - var deltaX = undefined; - var deltaY = undefined; - var delta = undefined; - var wheelDelta = nativeEvent.wheelDelta; - var axis = nativeEvent.axis; - var wheelDeltaY = nativeEvent.wheelDeltaY; - var wheelDeltaX = nativeEvent.wheelDeltaX; - var detail = nativeEvent.detail; - - // ie/webkit - if (wheelDelta) { - delta = wheelDelta / 120; - } + /** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ + function isIndex(value, length) { + value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1; + length = length == null ? MAX_SAFE_INTEGER : length; + return value > -1 && value % 1 == 0 && value < length; + } - // gecko - if (detail) { - // press control e.detail == 1 else e.detail == 3 - delta = 0 - (detail % 3 === 0 ? detail / 3 : detail); - } + /** + * Checks if `value` is a valid array-like length. + * + * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + */ + function isLength(value) { + return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + } - // Gecko - if (axis !== undefined) { - if (axis === event.HORIZONTAL_AXIS) { - deltaY = 0; - deltaX = 0 - delta; - } else if (axis === event.VERTICAL_AXIS) { - deltaX = 0; - deltaY = delta; - } - } + /** + * A fallback implementation of `Object.keys` which creates an array of the + * own enumerable property names of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ + function shimKeys(object) { + var props = keysIn(object), + propsLength = props.length, + length = propsLength && object.length; - // Webkit - if (wheelDeltaY !== undefined) { - deltaY = wheelDeltaY / 120; - } - if (wheelDeltaX !== undefined) { - deltaX = -1 * wheelDeltaX / 120; - } + var allowIndexes = !!length && isLength(length) && + (isArray(object) || isArguments(object)); - // 默认 deltaY (ie) - if (!deltaX && !deltaY) { - deltaY = delta; - } + var index = -1, + result = []; - if (deltaX !== undefined) { - /** - * deltaX of mousewheel event - * @property deltaX - * @member Event.DomEvent.Object - */ - event.deltaX = deltaX; + while (++index < propsLength) { + var key = props[index]; + if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) { + result.push(key); } + } + return result; + } - if (deltaY !== undefined) { - /** - * deltaY of mousewheel event - * @property deltaY - * @member Event.DomEvent.Object - */ - event.deltaY = deltaY; - } + /** + * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. + * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(1); + * // => false + */ + function isObject(value) { + // Avoid a V8 JIT bug in Chrome 19-20. + // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); + } - if (delta !== undefined) { - /** - * delta of mousewheel event - * @property delta - * @member Event.DomEvent.Object - */ - event.delta = delta; - } + /** + * Creates an array of the own enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. See the + * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys) + * for more details. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keys(new Foo); + * // => ['a', 'b'] (iteration order is not guaranteed) + * + * _.keys('hi'); + * // => ['0', '1'] + */ + var keys = !nativeKeys ? shimKeys : function(object) { + var Ctor = object == null ? undefined : object.constructor; + if ((typeof Ctor == 'function' && Ctor.prototype === object) || + (typeof object != 'function' && isArrayLike(object))) { + return shimKeys(object); } - }, { - reg: /^mouse|contextmenu|click|mspointer|(^DOMMouseScroll$)/i, - props: ['buttons', 'clientX', 'clientY', 'button', 'offsetX', 'relatedTarget', 'which', 'fromElement', 'toElement', 'offsetY', 'pageX', 'pageY', 'screenX', 'screenY'], - fix: function fix(event, nativeEvent) { - var eventDoc = undefined; - var doc = undefined; - var body = undefined; - var target = event.target; - var button = nativeEvent.button; + return isObject(object) ? nativeKeys(object) : []; + }; - // Calculate pageX/Y if missing and clientX/Y available - if (target && isNullOrUndefined(event.pageX) && !isNullOrUndefined(nativeEvent.clientX)) { - eventDoc = target.ownerDocument || document; - doc = eventDoc.documentElement; - body = eventDoc.body; - event.pageX = nativeEvent.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0); - event.pageY = nativeEvent.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0); - } + /** + * Creates an array of the own and inherited enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keysIn(new Foo); + * // => ['a', 'b', 'c'] (iteration order is not guaranteed) + */ + function keysIn(object) { + if (object == null) { + return []; + } + if (!isObject(object)) { + object = Object(object); + } + var length = object.length; + length = (length && isLength(length) && + (isArray(object) || isArguments(object)) && length) || 0; - // which for click: 1 === left; 2 === middle; 3 === right - // do not use button - if (!event.which && button !== undefined) { - if (button & 1) { - event.which = 1; - } else if (button & 2) { - event.which = 3; - } else if (button & 4) { - event.which = 2; - } else { - event.which = 0; - } - } + var Ctor = object.constructor, + index = -1, + isProto = typeof Ctor == 'function' && Ctor.prototype === object, + result = Array(length), + skipIndexes = length > 0; - // add relatedTarget, if necessary - if (!event.relatedTarget && event.fromElement) { - event.relatedTarget = event.fromElement === target ? event.toElement : event.fromElement; + while (++index < length) { + result[index] = (index + ''); + } + for (var key in object) { + if (!(skipIndexes && isIndex(key, length)) && + !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { + result.push(key); } - - return event; } - }]; - - function retTrue() { - return TRUE; - } - - function retFalse() { - return FALSE; + return result; } - function DomEventObject(nativeEvent) { - var type = nativeEvent.type; + module.exports = keys; + + +/***/ }, +/* 185 */ +/***/ function(module, exports) { + + /** + * lodash 3.9.1 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ - var isNative = typeof nativeEvent.stopPropagation === 'function' || typeof nativeEvent.cancelBubble === 'boolean'; + /** `Object#toString` result references. */ + var funcTag = '[object Function]'; - _EventBaseObject2['default'].call(this); + /** Used to detect host constructors (Safari > 5). */ + var reIsHostCtor = /^\[object .+?Constructor\]$/; - this.nativeEvent = nativeEvent; + /** + * Checks if `value` is object-like. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + */ + function isObjectLike(value) { + return !!value && typeof value == 'object'; + } - // in case dom event has been mark as default prevented by lower dom node - var isDefaultPrevented = retFalse; - if ('defaultPrevented' in nativeEvent) { - isDefaultPrevented = nativeEvent.defaultPrevented ? retTrue : retFalse; - } else if ('getPreventDefault' in nativeEvent) { - // https://bugzilla.mozilla.org/show_bug.cgi?id=691151 - isDefaultPrevented = nativeEvent.getPreventDefault() ? retTrue : retFalse; - } else if ('returnValue' in nativeEvent) { - isDefaultPrevented = nativeEvent.returnValue === FALSE ? retTrue : retFalse; - } + /** Used for native method references. */ + var objectProto = Object.prototype; - this.isDefaultPrevented = isDefaultPrevented; + /** Used to resolve the decompiled source of functions. */ + var fnToString = Function.prototype.toString; - var fixFns = []; - var fixFn = undefined; - var l = undefined; - var prop = undefined; - var props = commonProps.concat(); + /** Used to check objects for own properties. */ + var hasOwnProperty = objectProto.hasOwnProperty; - eventNormalizers.forEach(function (normalizer) { - if (type.match(normalizer.reg)) { - props = props.concat(normalizer.props); - if (normalizer.fix) { - fixFns.push(normalizer.fix); - } - } - }); + /** + * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ + var objToString = objectProto.toString; - l = props.length; + /** Used to detect if a method is native. */ + var reIsNative = RegExp('^' + + fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' + ); - // clone properties of the original event object - while (l) { - prop = props[--l]; - this[prop] = nativeEvent[prop]; - } + /** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ + function getNative(object, key) { + var value = object == null ? undefined : object[key]; + return isNative(value) ? value : undefined; + } - // fix target property, if necessary - if (!this.target && isNative) { - this.target = nativeEvent.srcElement || document; // srcElement might not be defined either - } + /** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ + function isFunction(value) { + // The use of `Object#toString` avoids issues with the `typeof` operator + // in older versions of Chrome and Safari which return 'function' for regexes + // and Safari 8 equivalents which return 'object' for typed array constructors. + return isObject(value) && objToString.call(value) == funcTag; + } - // check if target is a text node (safari) - if (this.target && this.target.nodeType === 3) { - this.target = this.target.parentNode; - } - - l = fixFns.length; + /** + * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. + * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(1); + * // => false + */ + function isObject(value) { + // Avoid a V8 JIT bug in Chrome 19-20. + // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); + } - while (l) { - fixFn = fixFns[--l]; - fixFn(this, nativeEvent); + /** + * Checks if `value` is a native function. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, else `false`. + * @example + * + * _.isNative(Array.prototype.push); + * // => true + * + * _.isNative(_); + * // => false + */ + function isNative(value) { + if (value == null) { + return false; } + if (isFunction(value)) { + return reIsNative.test(fnToString.call(value)); + } + return isObjectLike(value) && reIsHostCtor.test(value); + } - this.timeStamp = nativeEvent.timeStamp || Date.now(); + module.exports = getNative; + + +/***/ }, +/* 186 */ +/***/ function(module, exports) { + + /** + * lodash 3.0.4 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + + /** + * Checks if `value` is object-like. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + */ + function isObjectLike(value) { + return !!value && typeof value == 'object'; } - var EventBaseObjectProto = _EventBaseObject2['default'].prototype; + /** Used for native method references. */ + var objectProto = Object.prototype; - (0, _objectAssign2['default'])(DomEventObject.prototype, EventBaseObjectProto, { - constructor: DomEventObject, + /** Used to check objects for own properties. */ + var hasOwnProperty = objectProto.hasOwnProperty; - preventDefault: function preventDefault() { - var e = this.nativeEvent; + /** Native method references. */ + var propertyIsEnumerable = objectProto.propertyIsEnumerable; - // if preventDefault exists run it on the original event - if (e.preventDefault) { - e.preventDefault(); - } else { - // otherwise set the returnValue property of the original event to FALSE (IE) - e.returnValue = FALSE; - } + /** + * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) + * of an array-like value. + */ + var MAX_SAFE_INTEGER = 9007199254740991; - EventBaseObjectProto.preventDefault.call(this); - }, + /** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new function. + */ + function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; + }; + } - stopPropagation: function stopPropagation() { - var e = this.nativeEvent; + /** + * Gets the "length" property value of `object`. + * + * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) + * that affects Safari on at least iOS 8.1-8.3 ARM64. + * + * @private + * @param {Object} object The object to query. + * @returns {*} Returns the "length" value. + */ + var getLength = baseProperty('length'); - // if stopPropagation exists run it on the original event - if (e.stopPropagation) { - e.stopPropagation(); - } else { - // otherwise set the cancelBubble property of the original event to TRUE (IE) - e.cancelBubble = TRUE; - } + /** + * Checks if `value` is array-like. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + */ + function isArrayLike(value) { + return value != null && isLength(getLength(value)); + } - EventBaseObjectProto.stopPropagation.call(this); - } - }); + /** + * Checks if `value` is a valid array-like length. + * + * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + */ + function isLength(value) { + return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + } - exports['default'] = DomEventObject; - module.exports = exports['default']; + /** + * Checks if `value` is classified as an `arguments` object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isArguments(function() { return arguments; }()); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */ + function isArguments(value) { + return isObjectLike(value) && isArrayLike(value) && + hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee'); + } + + module.exports = isArguments; + /***/ }, -/* 186 */ +/* 187 */ /***/ function(module, exports) { /** - * @ignore - * base event object for custom and dom event. - * @author yiminghe@gmail.com + * lodash 3.0.4 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license */ - "use strict"; + /** `Object#toString` result references. */ + var arrayTag = '[object Array]', + funcTag = '[object Function]'; - Object.defineProperty(exports, "__esModule", { - value: true - }); - function returnFalse() { - return false; - } + /** Used to detect host constructors (Safari > 5). */ + var reIsHostCtor = /^\[object .+?Constructor\]$/; - function returnTrue() { - return true; + /** + * Checks if `value` is object-like. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + */ + function isObjectLike(value) { + return !!value && typeof value == 'object'; } - function EventBaseObject() { - this.timeStamp = Date.now(); - this.target = undefined; - this.currentTarget = undefined; - } + /** Used for native method references. */ + var objectProto = Object.prototype; - EventBaseObject.prototype = { - isEventObject: 1, + /** Used to resolve the decompiled source of functions. */ + var fnToString = Function.prototype.toString; - constructor: EventBaseObject, + /** Used to check objects for own properties. */ + var hasOwnProperty = objectProto.hasOwnProperty; - isDefaultPrevented: returnFalse, + /** + * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ + var objToString = objectProto.toString; - isPropagationStopped: returnFalse, + /** Used to detect if a method is native. */ + var reIsNative = RegExp('^' + + fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' + ); - isImmediatePropagationStopped: returnFalse, + /* Native method references for those with the same name as other `lodash` methods. */ + var nativeIsArray = getNative(Array, 'isArray'); - preventDefault: function preventDefault() { - this.isDefaultPrevented = returnTrue; - }, + /** + * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) + * of an array-like value. + */ + var MAX_SAFE_INTEGER = 9007199254740991; - stopPropagation: function stopPropagation() { - this.isPropagationStopped = returnTrue; - }, + /** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ + function getNative(object, key) { + var value = object == null ? undefined : object[key]; + return isNative(value) ? value : undefined; + } - stopImmediatePropagation: function stopImmediatePropagation() { - this.isImmediatePropagationStopped = returnTrue; - // fixed 1.2 - // call stopPropagation implicitly - this.stopPropagation(); - }, + /** + * Checks if `value` is a valid array-like length. + * + * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + */ + function isLength(value) { + return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + } - halt: function halt(immediate) { - if (immediate) { - this.stopImmediatePropagation(); - } else { - this.stopPropagation(); - } - this.preventDefault(); - } + /** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(function() { return arguments; }()); + * // => false + */ + var isArray = nativeIsArray || function(value) { + return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag; }; - exports["default"] = EventBaseObject; - module.exports = exports["default"]; - -/***/ }, -/* 187 */ -/***/ function(module, exports) { - - /* eslint-disable no-unused-vars */ - 'use strict'; - var hasOwnProperty = Object.prototype.hasOwnProperty; - var propIsEnumerable = Object.prototype.propertyIsEnumerable; - - function toObject(val) { - if (val === null || val === undefined) { - throw new TypeError('Object.assign cannot be called with null or undefined'); - } - - return Object(val); + /** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ + function isFunction(value) { + // The use of `Object#toString` avoids issues with the `typeof` operator + // in older versions of Chrome and Safari which return 'function' for regexes + // and Safari 8 equivalents which return 'object' for typed array constructors. + return isObject(value) && objToString.call(value) == funcTag; } - module.exports = Object.assign || function (target, source) { - var from; - var to = toObject(target); - var symbols; - - for (var s = 1; s < arguments.length; s++) { - from = Object(arguments[s]); - - for (var key in from) { - if (hasOwnProperty.call(from, key)) { - to[key] = from[key]; - } - } + /** + * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. + * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(1); + * // => false + */ + function isObject(value) { + // Avoid a V8 JIT bug in Chrome 19-20. + // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); + } - if (Object.getOwnPropertySymbols) { - symbols = Object.getOwnPropertySymbols(from); - for (var i = 0; i < symbols.length; i++) { - if (propIsEnumerable.call(from, symbols[i])) { - to[symbols[i]] = from[symbols[i]]; - } - } - } - } + /** + * Checks if `value` is a native function. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, else `false`. + * @example + * + * _.isNative(Array.prototype.push); + * // => true + * + * _.isNative(_); + * // => false + */ + function isNative(value) { + if (value == null) { + return false; + } + if (isFunction(value)) { + return reIsNative.test(fnToString.call(value)); + } + return isObjectLike(value) && reIsHostCtor.test(value); + } - return to; - }; + module.exports = isArray; /***/ }, /* 188 */ /***/ function(module, exports) { + /** + * Safe chained function + * + * Will only create a new function if needed, + * otherwise will pass back existing functions or null. + * + * @returns {function|null} + */ "use strict"; - module.exports = function contains(root, n) { - var node = n; - while (node) { - if (node === root) { - return true; + function createChainedFunction() { + var args = arguments; + return function chainedFunction() { + for (var i = 0; i < args.length; i++) { + if (args[i] && args[i].apply) { + args[i].apply(this, arguments); + } } - node = node.parentNode; - } + }; + } - return false; - }; + module.exports = createChainedFunction; /***/ }, /* 189 */ @@ -24070,217 +24432,83 @@ webpackJsonp([0,1],[ 'use strict'; - var React = __webpack_require__(3); - - module.exports = function toArray(children) { - var ret = []; - React.Children.forEach(children, function each(c) { - ret.push(c); - }); - return ret; - }; - -/***/ }, -/* 190 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var React = __webpack_require__(3); - - function mirror(o) { - return o; - } - - module.exports = function mapSelf(children) { - // return ReactFragment - return React.Children.map(children, mirror); - }; - -/***/ }, -/* 191 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - Object.defineProperty(exports, '__esModule', { value: true }); + exports['default'] = addEventListenerWrap; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - var _react = __webpack_require__(3); + var _addDomEventListener = __webpack_require__(190); - var _react2 = _interopRequireDefault(_react); + var _addDomEventListener2 = _interopRequireDefault(_addDomEventListener); var _reactDom = __webpack_require__(160); var _reactDom2 = _interopRequireDefault(_reactDom); - var _rcAlign = __webpack_require__(192); - - var _rcAlign2 = _interopRequireDefault(_rcAlign); - - var _rcAnimate = __webpack_require__(215); - - var _rcAnimate2 = _interopRequireDefault(_rcAnimate); - - var _PopupInner = __webpack_require__(223); - - var _PopupInner2 = _interopRequireDefault(_PopupInner); - - var Popup = _react2['default'].createClass({ - displayName: 'Popup', - - propTypes: { - visible: _react.PropTypes.bool, - wrap: _react.PropTypes.object, - style: _react.PropTypes.object, - getClassNameFromAlign: _react.PropTypes.func, - onMouseEnter: _react.PropTypes.func, - className: _react.PropTypes.string, - onMouseLeave: _react.PropTypes.func - }, - - componentDidMount: function componentDidMount() { - this.rootNode = this.getPopupDomNode(); - }, - - onAlign: function onAlign(popupDomNode, align) { - var props = this.props; - var alignClassName = props.getClassNameFromAlign(props.align); - var currentAlignClassName = props.getClassNameFromAlign(align); - if (alignClassName !== currentAlignClassName) { - this.currentAlignClassName = currentAlignClassName; - popupDomNode.className = this.getClassName(currentAlignClassName); - } - }, - - getPopupDomNode: function getPopupDomNode() { - return _reactDom2['default'].findDOMNode(this); - }, - - getTarget: function getTarget() { - return _reactDom2['default'].findDOMNode(this.props.wrap); - }, - - getTransitionName: function getTransitionName() { - var props = this.props; - var transitionName = props.transitionName; - if (!transitionName && props.animation) { - transitionName = props.prefixCls + '-' + props.animation; - } - return transitionName; - }, - - getClassName: function getClassName(currentAlignClassName) { - var props = this.props; - var prefixCls = props.prefixCls; - - var className = prefixCls + ' ' + props.className + ' '; - className += currentAlignClassName; - return className; - }, - - render: function render() { - var props = this.props; - var align = props.align; - var style = props.style; - var visible = props.visible; - var prefixCls = props.prefixCls; - var destroyPopupOnHide = props.destroyPopupOnHide; - - var className = this.getClassName(this.currentAlignClassName || props.getClassNameFromAlign(align)); - var hiddenClassName = prefixCls + '-hidden'; - if (!visible) { - this.currentAlignClassName = null; - } - if (destroyPopupOnHide) { - return _react2['default'].createElement( - _rcAnimate2['default'], - { component: '', - exclusive: true, - transitionAppear: true, - transitionName: this.getTransitionName() }, - visible ? _react2['default'].createElement( - _rcAlign2['default'], - { target: this.getTarget, - key: 'popup', - monitorWindowResize: true, - align: align, - onAlign: this.onAlign }, - _react2['default'].createElement( - _PopupInner2['default'], - { className: className, - visible: true, - onMouseEnter: props.onMouseEnter, - onMouseLeave: props.onMouseLeave, - style: style }, - props.children - ) - ) : null - ); - } - return _react2['default'].createElement( - _rcAnimate2['default'], - { component: '', - exclusive: true, - transitionAppear: true, - transitionName: this.getTransitionName(), - showProp: 'xVisible' }, - _react2['default'].createElement( - _rcAlign2['default'], - { target: this.getTarget, - key: 'popup', - monitorWindowResize: true, - xVisible: visible, - childrenProps: { - visible: 'xVisible' - }, - disabled: !visible, - align: align, - onAlign: this.onAlign }, - _react2['default'].createElement( - _PopupInner2['default'], - { className: className, - hiddenClassName: hiddenClassName, - onMouseEnter: props.onMouseEnter, - onMouseLeave: props.onMouseLeave, - style: style }, - props.children - ) - ) - ); - } - }); + function addEventListenerWrap(target, eventType, cb) { + /* eslint camelcase: 2 */ + var callback = _reactDom2['default'].unstable_batchedUpdates ? function run(e) { + _reactDom2['default'].unstable_batchedUpdates(cb, e); + } : cb; + return (0, _addDomEventListener2['default'])(target, eventType, callback); + } - exports['default'] = Popup; module.exports = exports['default']; /***/ }, -/* 192 */ +/* 190 */ /***/ function(module, exports, __webpack_require__) { - // export this package's api 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); + exports['default'] = addEventListener; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - var _Align = __webpack_require__(193); + var _EventObject = __webpack_require__(191); - var _Align2 = _interopRequireDefault(_Align); + var _EventObject2 = _interopRequireDefault(_EventObject); + + function addEventListener(target, eventType, callback) { + function wrapCallback(e) { + var ne = new _EventObject2['default'](e); + callback.call(target, ne); + } + + if (target.addEventListener) { + target.addEventListener(eventType, wrapCallback, false); + return { + remove: function remove() { + target.removeEventListener(eventType, wrapCallback, false); + } + }; + } else if (target.attachEvent) { + target.attachEvent('on' + eventType, wrapCallback); + return { + remove: function remove() { + target.detachEvent('on' + eventType, wrapCallback); + } + }; + } + } - exports['default'] = _Align2['default']; module.exports = exports['default']; /***/ }, -/* 193 */ +/* 191 */ /***/ function(module, exports, __webpack_require__) { + /** + * @ignore + * event object for dom + * @author yiminghe@gmail.com + */ + 'use strict'; Object.defineProperty(exports, '__esModule', { @@ -24289,856 +24517,600 @@ webpackJsonp([0,1],[ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - var _react = __webpack_require__(3); - - var _react2 = _interopRequireDefault(_react); - - var _reactDom = __webpack_require__(160); - - var _reactDom2 = _interopRequireDefault(_reactDom); - - var _domAlign = __webpack_require__(194); + var _EventBaseObject = __webpack_require__(192); - var _domAlign2 = _interopRequireDefault(_domAlign); + var _EventBaseObject2 = _interopRequireDefault(_EventBaseObject); - var _rcUtil = __webpack_require__(202); + var _objectAssign = __webpack_require__(193); - var _isWindow = __webpack_require__(214); + var _objectAssign2 = _interopRequireDefault(_objectAssign); - var _isWindow2 = _interopRequireDefault(_isWindow); + var TRUE = true; + var FALSE = false; + var commonProps = ['altKey', 'bubbles', 'cancelable', 'ctrlKey', 'currentTarget', 'eventPhase', 'metaKey', 'shiftKey', 'target', 'timeStamp', 'view', 'type']; - function buffer(fn, ms) { - var timer = undefined; - return function bufferFn() { - if (timer) { - clearTimeout(timer); - } - timer = setTimeout(fn, ms); - }; + function isNullOrUndefined(w) { + return w === null || w === undefined; } - var Align = _react2['default'].createClass({ - displayName: 'Align', + var eventNormalizers = [{ + reg: /^key/, + props: ['char', 'charCode', 'key', 'keyCode', 'which'], + fix: function fix(event, nativeEvent) { + if (isNullOrUndefined(event.which)) { + event.which = !isNullOrUndefined(nativeEvent.charCode) ? nativeEvent.charCode : nativeEvent.keyCode; + } - propTypes: { - childrenProps: _react.PropTypes.object, - align: _react.PropTypes.object.isRequired, - target: _react.PropTypes.func, - onAlign: _react.PropTypes.func, - monitorBufferTime: _react.PropTypes.number, - monitorWindowResize: _react.PropTypes.bool, - disabled: _react.PropTypes.bool, - children: _react.PropTypes.any - }, - - getDefaultProps: function getDefaultProps() { - return { - target: function target() { - return window; - }, - onAlign: function onAlign() {}, - monitorBufferTime: 50, - monitorWindowResize: false, - disabled: false - }; - }, + // add metaKey to non-Mac browsers (use ctrl for PC 's and Meta for Macs) + if (event.metaKey === undefined) { + event.metaKey = event.ctrlKey; + } + } + }, { + reg: /^touch/, + props: ['touches', 'changedTouches', 'targetTouches'] + }, { + reg: /^hashchange$/, + props: ['newURL', 'oldURL'] + }, { + reg: /^gesturechange$/i, + props: ['rotation', 'scale'] + }, { + reg: /^(mousewheel|DOMMouseScroll)$/, + props: [], + fix: function fix(event, nativeEvent) { + var deltaX = undefined; + var deltaY = undefined; + var delta = undefined; + var wheelDelta = nativeEvent.wheelDelta; + var axis = nativeEvent.axis; + var wheelDeltaY = nativeEvent.wheelDeltaY; + var wheelDeltaX = nativeEvent.wheelDeltaX; + var detail = nativeEvent.detail; - componentDidMount: function componentDidMount() { - var props = this.props; - // if parent ref not attached .... use document.getElementById - if (!props.disabled) { - var source = _reactDom2['default'].findDOMNode(this); - props.onAlign(source, (0, _domAlign2['default'])(source, props.target(), props.align)); - if (props.monitorWindowResize) { - this.startMonitorWindowResize(); - } + // ie/webkit + if (wheelDelta) { + delta = wheelDelta / 120; } - }, - componentDidUpdate: function componentDidUpdate(prevProps) { - var reAlign = false; - var props = this.props; - var currentTarget = undefined; + // gecko + if (detail) { + // press control e.detail == 1 else e.detail == 3 + delta = 0 - (detail % 3 === 0 ? detail / 3 : detail); + } - if (!props.disabled) { - if (prevProps.disabled || prevProps.align !== props.align) { - reAlign = true; - currentTarget = props.target(); - } else { - var lastTarget = prevProps.target(); - currentTarget = props.target(); - if ((0, _isWindow2['default'])(lastTarget) && (0, _isWindow2['default'])(currentTarget)) { - reAlign = false; - } else if (lastTarget !== currentTarget) { - reAlign = true; - } + // Gecko + if (axis !== undefined) { + if (axis === event.HORIZONTAL_AXIS) { + deltaY = 0; + deltaX = 0 - delta; + } else if (axis === event.VERTICAL_AXIS) { + deltaX = 0; + deltaY = delta; } } - if (reAlign) { - var source = _reactDom2['default'].findDOMNode(this); - props.onAlign(source, (0, _domAlign2['default'])(source, currentTarget, props.align)); + // Webkit + if (wheelDeltaY !== undefined) { + deltaY = wheelDeltaY / 120; } - - if (props.monitorWindowResize && !props.disabled) { - this.startMonitorWindowResize(); - } else { - this.stopMonitorWindowResize(); + if (wheelDeltaX !== undefined) { + deltaX = -1 * wheelDeltaX / 120; } - }, - componentWillUnmount: function componentWillUnmount() { - this.stopMonitorWindowResize(); - }, + // 默认 deltaY (ie) + if (!deltaX && !deltaY) { + deltaY = delta; + } - onWindowResize: function onWindowResize() { - var props = this.props; - if (!props.disabled) { - var source = _reactDom2['default'].findDOMNode(this); - props.onAlign(source, (0, _domAlign2['default'])(source, props.target(), props.align)); + if (deltaX !== undefined) { + /** + * deltaX of mousewheel event + * @property deltaX + * @member Event.DomEvent.Object + */ + event.deltaX = deltaX; } - }, - startMonitorWindowResize: function startMonitorWindowResize() { - if (!this.resizeHandler) { - this.resizeHandler = _rcUtil.Dom.addEventListener(window, 'resize', buffer(this.onWindowResize, this.props.monitorBufferTime)); + if (deltaY !== undefined) { + /** + * deltaY of mousewheel event + * @property deltaY + * @member Event.DomEvent.Object + */ + event.deltaY = deltaY; } - }, - stopMonitorWindowResize: function stopMonitorWindowResize() { - if (this.resizeHandler) { - this.resizeHandler.remove(); - this.resizeHandler = null; + if (delta !== undefined) { + /** + * delta of mousewheel event + * @property delta + * @member Event.DomEvent.Object + */ + event.delta = delta; } - }, + } + }, { + reg: /^mouse|contextmenu|click|mspointer|(^DOMMouseScroll$)/i, + props: ['buttons', 'clientX', 'clientY', 'button', 'offsetX', 'relatedTarget', 'which', 'fromElement', 'toElement', 'offsetY', 'pageX', 'pageY', 'screenX', 'screenY'], + fix: function fix(event, nativeEvent) { + var eventDoc = undefined; + var doc = undefined; + var body = undefined; + var target = event.target; + var button = nativeEvent.button; - render: function render() { - var _props = this.props; - var childrenProps = _props.childrenProps; - var children = _props.children; + // Calculate pageX/Y if missing and clientX/Y available + if (target && isNullOrUndefined(event.pageX) && !isNullOrUndefined(nativeEvent.clientX)) { + eventDoc = target.ownerDocument || document; + doc = eventDoc.documentElement; + body = eventDoc.body; + event.pageX = nativeEvent.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0); + event.pageY = nativeEvent.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0); + } - var child = _react2['default'].Children.only(children); - if (childrenProps) { - var newProps = {}; - for (var prop in childrenProps) { - if (childrenProps.hasOwnProperty(prop)) { - newProps[prop] = this.props[childrenProps[prop]]; - } + // which for click: 1 === left; 2 === middle; 3 === right + // do not use button + if (!event.which && button !== undefined) { + if (button & 1) { + event.which = 1; + } else if (button & 2) { + event.which = 3; + } else if (button & 4) { + event.which = 2; + } else { + event.which = 0; } - return _react2['default'].cloneElement(child, newProps); } - return child; - } - }); - - exports['default'] = Align; - module.exports = exports['default']; - -/***/ }, -/* 194 */ -/***/ function(module, exports, __webpack_require__) { - - /** - * align dom node flexibly - * @author yiminghe@gmail.com - */ - 'use strict'; + // add relatedTarget, if necessary + if (!event.relatedTarget && event.fromElement) { + event.relatedTarget = event.fromElement === target ? event.toElement : event.fromElement; + } - Object.defineProperty(exports, '__esModule', { - value: true - }); + return event; + } + }]; - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + function retTrue() { + return TRUE; + } - var _utils = __webpack_require__(195); + function retFalse() { + return FALSE; + } - var _utils2 = _interopRequireDefault(_utils); + function DomEventObject(nativeEvent) { + var type = nativeEvent.type; - var _getOffsetParent = __webpack_require__(196); + var isNative = typeof nativeEvent.stopPropagation === 'function' || typeof nativeEvent.cancelBubble === 'boolean'; - var _getOffsetParent2 = _interopRequireDefault(_getOffsetParent); + _EventBaseObject2['default'].call(this); - var _getVisibleRectForElement = __webpack_require__(197); + this.nativeEvent = nativeEvent; - var _getVisibleRectForElement2 = _interopRequireDefault(_getVisibleRectForElement); + // in case dom event has been mark as default prevented by lower dom node + var isDefaultPrevented = retFalse; + if ('defaultPrevented' in nativeEvent) { + isDefaultPrevented = nativeEvent.defaultPrevented ? retTrue : retFalse; + } else if ('getPreventDefault' in nativeEvent) { + // https://bugzilla.mozilla.org/show_bug.cgi?id=691151 + isDefaultPrevented = nativeEvent.getPreventDefault() ? retTrue : retFalse; + } else if ('returnValue' in nativeEvent) { + isDefaultPrevented = nativeEvent.returnValue === FALSE ? retTrue : retFalse; + } - var _adjustForViewport = __webpack_require__(198); + this.isDefaultPrevented = isDefaultPrevented; - var _adjustForViewport2 = _interopRequireDefault(_adjustForViewport); + var fixFns = []; + var fixFn = undefined; + var l = undefined; + var prop = undefined; + var props = commonProps.concat(); - var _getRegion = __webpack_require__(199); + eventNormalizers.forEach(function (normalizer) { + if (type.match(normalizer.reg)) { + props = props.concat(normalizer.props); + if (normalizer.fix) { + fixFns.push(normalizer.fix); + } + } + }); - var _getRegion2 = _interopRequireDefault(_getRegion); + l = props.length; - var _getElFuturePos = __webpack_require__(200); + // clone properties of the original event object + while (l) { + prop = props[--l]; + this[prop] = nativeEvent[prop]; + } - var _getElFuturePos2 = _interopRequireDefault(_getElFuturePos); - - // http://yiminghe.iteye.com/blog/1124720 - - function isFailX(elFuturePos, elRegion, visibleRect) { - return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right; - } - - function isFailY(elFuturePos, elRegion, visibleRect) { - return elFuturePos.top < visibleRect.top || elFuturePos.top + elRegion.height > visibleRect.bottom; - } + // fix target property, if necessary + if (!this.target && isNative) { + this.target = nativeEvent.srcElement || document; // srcElement might not be defined either + } - function flip(points, reg, map) { - var ret = []; - _utils2['default'].each(points, function (p) { - ret.push(p.replace(reg, function (m) { - return map[m]; - })); - }); - return ret; - } + // check if target is a text node (safari) + if (this.target && this.target.nodeType === 3) { + this.target = this.target.parentNode; + } - function flipOffset(offset, index) { - offset[index] = -offset[index]; - return offset; - } + l = fixFns.length; - function convertOffset(str, offsetLen) { - var n = undefined; - if (/%$/.test(str)) { - n = parseInt(str.substring(0, str.length - 1), 10) / 100 * offsetLen; - } else { - n = parseInt(str, 10); + while (l) { + fixFn = fixFns[--l]; + fixFn(this, nativeEvent); } - return n || 0; - } - function normalizeOffset(offset, el) { - offset[0] = convertOffset(offset[0], el.width); - offset[1] = convertOffset(offset[1], el.height); + this.timeStamp = nativeEvent.timeStamp || Date.now(); } - function domAlign(el, refNode, align) { - var points = align.points; - var offset = align.offset || [0, 0]; - var targetOffset = align.targetOffset || [0, 0]; - var overflow = align.overflow; - var target = align.target || refNode; - var source = align.source || el; - offset = [].concat(offset); - targetOffset = [].concat(targetOffset); - overflow = overflow || {}; - var newOverflowCfg = {}; - - var fail = 0; - // 当前节点可以被放置的显示区域 - var visibleRect = (0, _getVisibleRectForElement2['default'])(source); - // 当前节点所占的区域, left/top/width/height - var elRegion = (0, _getRegion2['default'])(source); - // 参照节点所占的区域, left/top/width/height - var refNodeRegion = (0, _getRegion2['default'])(target); - // 将 offset 转换成数值,支持百分比 - normalizeOffset(offset, elRegion); - normalizeOffset(targetOffset, refNodeRegion); - // 当前节点将要被放置的位置 - var elFuturePos = (0, _getElFuturePos2['default'])(elRegion, refNodeRegion, points, offset, targetOffset); - // 当前节点将要所处的区域 - var newElRegion = _utils2['default'].merge(elRegion, elFuturePos); + var EventBaseObjectProto = _EventBaseObject2['default'].prototype; - // 如果可视区域不能完全放置当前节点时允许调整 - if (visibleRect && (overflow.adjustX || overflow.adjustY)) { - if (overflow.adjustX) { - // 如果横向不能放下 - if (isFailX(elFuturePos, elRegion, visibleRect)) { - fail = 1; - // 对齐位置反下 - points = flip(points, /[lr]/ig, { - l: 'r', - r: 'l' - }); - // 偏移量也反下 - offset = flipOffset(offset, 0); - targetOffset = flipOffset(targetOffset, 0); - } - } + (0, _objectAssign2['default'])(DomEventObject.prototype, EventBaseObjectProto, { + constructor: DomEventObject, - if (overflow.adjustY) { - // 如果纵向不能放下 - if (isFailY(elFuturePos, elRegion, visibleRect)) { - fail = 1; - // 对齐位置反下 - points = flip(points, /[tb]/ig, { - t: 'b', - b: 't' - }); - // 偏移量也反下 - offset = flipOffset(offset, 1); - targetOffset = flipOffset(targetOffset, 1); - } - } + preventDefault: function preventDefault() { + var e = this.nativeEvent; - // 如果失败,重新计算当前节点将要被放置的位置 - if (fail) { - elFuturePos = (0, _getElFuturePos2['default'])(elRegion, refNodeRegion, points, offset, targetOffset); - _utils2['default'].mix(newElRegion, elFuturePos); + // if preventDefault exists run it on the original event + if (e.preventDefault) { + e.preventDefault(); + } else { + // otherwise set the returnValue property of the original event to FALSE (IE) + e.returnValue = FALSE; } - // 检查反下后的位置是否可以放下了 - // 如果仍然放不下只有指定了可以调整当前方向才调整 - newOverflowCfg.adjustX = overflow.adjustX && isFailX(elFuturePos, elRegion, visibleRect); + EventBaseObjectProto.preventDefault.call(this); + }, - newOverflowCfg.adjustY = overflow.adjustY && isFailY(elFuturePos, elRegion, visibleRect); + stopPropagation: function stopPropagation() { + var e = this.nativeEvent; - // 确实要调整,甚至可能会调整高度宽度 - if (newOverflowCfg.adjustX || newOverflowCfg.adjustY) { - newElRegion = (0, _adjustForViewport2['default'])(elFuturePos, elRegion, visibleRect, newOverflowCfg); + // if stopPropagation exists run it on the original event + if (e.stopPropagation) { + e.stopPropagation(); + } else { + // otherwise set the cancelBubble property of the original event to TRUE (IE) + e.cancelBubble = TRUE; } - } - - // need judge to in case set fixed with in css on height auto element - if (newElRegion.width !== elRegion.width) { - _utils2['default'].css(source, 'width', source.width() + newElRegion.width - elRegion.width); - } - if (newElRegion.height !== elRegion.height) { - _utils2['default'].css(source, 'height', source.height() + newElRegion.height - elRegion.height); + EventBaseObjectProto.stopPropagation.call(this); } + }); - // https://github.com/kissyteam/kissy/issues/190 - // http://localhost:8888/kissy/src/overlay/demo/other/relative_align/align.html - // 相对于屏幕位置没变,而 left/top 变了 - // 例如
- _utils2['default'].offset(source, { - left: newElRegion.left, - top: newElRegion.top - }, { - useCssRight: align.useCssRight, - useCssBottom: align.useCssBottom - }); - - return { - points: points, - offset: offset, - targetOffset: targetOffset, - overflow: newOverflowCfg - }; - } - - domAlign.__getOffsetParent = _getOffsetParent2['default']; - - domAlign.__getVisibleRectForElement = _getVisibleRectForElement2['default']; - - exports['default'] = domAlign; - - /** - * 2012-04-26 yiminghe@gmail.com - * - 优化智能对齐算法 - * - 慎用 resizeXX - * - * 2011-07-13 yiminghe@gmail.com note: - * - 增加智能对齐,以及大小调整选项 - **/ + exports['default'] = DomEventObject; module.exports = exports['default']; /***/ }, -/* 195 */ +/* 192 */ /***/ function(module, exports) { - 'use strict'; + /** + * @ignore + * base event object for custom and dom event. + * @author yiminghe@gmail.com + */ - Object.defineProperty(exports, '__esModule', { + "use strict"; + + Object.defineProperty(exports, "__esModule", { value: true }); - var RE_NUM = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source; + function returnFalse() { + return false; + } - var getComputedStyleX = undefined; + function returnTrue() { + return true; + } - function css(el, name, v) { - var value = v; - if (typeof name === 'object') { - for (var i in name) { - if (name.hasOwnProperty(i)) { - css(el, i, name[i]); - } - } - return undefined; - } - if (typeof value !== 'undefined') { - if (typeof value === 'number') { - value = value + 'px'; - } - el.style[name] = value; - return undefined; - } - return getComputedStyleX(el, name); + function EventBaseObject() { + this.timeStamp = Date.now(); + this.target = undefined; + this.currentTarget = undefined; } - function getClientPosition(elem) { - var box = undefined; - var x = undefined; - var y = undefined; - var doc = elem.ownerDocument; - var body = doc.body; - var docElem = doc && doc.documentElement; - // 根据 GBS 最新数据,A-Grade Browsers 都已支持 getBoundingClientRect 方法,不用再考虑传统的实现方式 - box = elem.getBoundingClientRect(); + EventBaseObject.prototype = { + isEventObject: 1, - // 注:jQuery 还考虑减去 docElem.clientLeft/clientTop - // 但测试发现,这样反而会导致当 html 和 body 有边距/边框样式时,获取的值不正确 - // 此外,ie6 会忽略 html 的 margin 值,幸运地是没有谁会去设置 html 的 margin + constructor: EventBaseObject, - x = box.left; - y = box.top; + isDefaultPrevented: returnFalse, - // In IE, most of the time, 2 extra pixels are added to the top and left - // due to the implicit 2-pixel inset border. In IE6/7 quirks mode and - // IE6 standards mode, this border can be overridden by setting the - // document element's border to zero -- thus, we cannot rely on the - // offset always being 2 pixels. + isPropagationStopped: returnFalse, - // In quirks mode, the offset can be determined by querying the body's - // clientLeft/clientTop, but in standards mode, it is found by querying - // the document element's clientLeft/clientTop. Since we already called - // getClientBoundingRect we have already forced a reflow, so it is not - // too expensive just to query them all. + isImmediatePropagationStopped: returnFalse, - // ie 下应该减去窗口的边框吧,毕竟默认 absolute 都是相对窗口定位的 - // 窗口边框标准是设 documentElement ,quirks 时设置 body - // 最好禁止在 body 和 html 上边框 ,但 ie < 9 html 默认有 2px ,减去 - // 但是非 ie 不可能设置窗口边框,body html 也不是窗口 ,ie 可以通过 html,body 设置 - // 标准 ie 下 docElem.clientTop 就是 border-top - // ie7 html 即窗口边框改变不了。永远为 2 - // 但标准 firefox/chrome/ie9 下 docElem.clientTop 是窗口边框,即使设了 border-top 也为 0 + preventDefault: function preventDefault() { + this.isDefaultPrevented = returnTrue; + }, - x -= docElem.clientLeft || body.clientLeft || 0; - y -= docElem.clientTop || body.clientTop || 0; + stopPropagation: function stopPropagation() { + this.isPropagationStopped = returnTrue; + }, - return { left: x, top: y }; - } + stopImmediatePropagation: function stopImmediatePropagation() { + this.isImmediatePropagationStopped = returnTrue; + // fixed 1.2 + // call stopPropagation implicitly + this.stopPropagation(); + }, - function getScroll(w, top) { - var ret = w['page' + (top ? 'Y' : 'X') + 'Offset']; - var method = 'scroll' + (top ? 'Top' : 'Left'); - if (typeof ret !== 'number') { - var d = w.document; - // ie6,7,8 standard mode - ret = d.documentElement[method]; - if (typeof ret !== 'number') { - // quirks mode - ret = d.body[method]; + halt: function halt(immediate) { + if (immediate) { + this.stopImmediatePropagation(); + } else { + this.stopPropagation(); } + this.preventDefault(); } - return ret; - } + }; - function getScrollLeft(w) { - return getScroll(w); - } + exports["default"] = EventBaseObject; + module.exports = exports["default"]; + +/***/ }, +/* 193 */ +/***/ function(module, exports) { + + /* eslint-disable no-unused-vars */ + 'use strict'; + var hasOwnProperty = Object.prototype.hasOwnProperty; + var propIsEnumerable = Object.prototype.propertyIsEnumerable; - function getScrollTop(w) { - return getScroll(w, true); - } + function toObject(val) { + if (val === null || val === undefined) { + throw new TypeError('Object.assign cannot be called with null or undefined'); + } - function getOffset(el) { - var pos = getClientPosition(el); - var doc = el.ownerDocument; - var w = doc.defaultView || doc.parentWindow; - pos.left += getScrollLeft(w); - pos.top += getScrollTop(w); - return pos; + return Object(val); } - function _getComputedStyle(elem, name, cs) { - var computedStyle = cs; - var val = ''; - var d = elem.ownerDocument; - computedStyle = computedStyle || d.defaultView.getComputedStyle(elem, null); - // https://github.com/kissyteam/kissy/issues/61 - if (computedStyle) { - val = computedStyle.getPropertyValue(name) || computedStyle[name]; - } + module.exports = Object.assign || function (target, source) { + var from; + var to = toObject(target); + var symbols; - return val; - } + for (var s = 1; s < arguments.length; s++) { + from = Object(arguments[s]); - var _RE_NUM_NO_PX = new RegExp('^(' + RE_NUM + ')(?!px)[a-z%]+$', 'i'); - var RE_POS = /^(top|right|bottom|left)$/; - var CURRENT_STYLE = 'currentStyle'; - var RUNTIME_STYLE = 'runtimeStyle'; - var LEFT = 'left'; - var PX = 'px'; + for (var key in from) { + if (hasOwnProperty.call(from, key)) { + to[key] = from[key]; + } + } - function _getComputedStyleIE(elem, name) { - // currentStyle maybe null - // http://msdn.microsoft.com/en-us/library/ms535231.aspx - var ret = elem[CURRENT_STYLE] && elem[CURRENT_STYLE][name]; + if (Object.getOwnPropertySymbols) { + symbols = Object.getOwnPropertySymbols(from); + for (var i = 0; i < symbols.length; i++) { + if (propIsEnumerable.call(from, symbols[i])) { + to[symbols[i]] = from[symbols[i]]; + } + } + } + } - // 当 width/height 设置为百分比时,通过 pixelLeft 方式转换的 width/height 值 - // 一开始就处理了! CUSTOM_STYLE.height,CUSTOM_STYLE.width ,cssHook 解决@2011-08-19 - // 在 ie 下不对,需要直接用 offset 方式 - // borderWidth 等值也有问题,但考虑到 borderWidth 设为百分比的概率很小,这里就不考虑了 + return to; + }; + + +/***/ }, +/* 194 */ +/***/ function(module, exports) { + + "use strict"; - // From the awesome hack by Dean Edwards - // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 - // If we're not dealing with a regular pixel number - // but a number that has a weird ending, we need to convert it to pixels - // exclude left right for relativity - if (_RE_NUM_NO_PX.test(ret) && !RE_POS.test(name)) { - // Remember the original values - var style = elem.style; - var left = style[LEFT]; - var rsLeft = elem[RUNTIME_STYLE][LEFT]; + module.exports = function contains(root, n) { + var node = n; + while (node) { + if (node === root) { + return true; + } + node = node.parentNode; + } - // prevent flashing of content - elem[RUNTIME_STYLE][LEFT] = elem[CURRENT_STYLE][LEFT]; + return false; + }; + +/***/ }, +/* 195 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; - // Put in the new values to get a computed value out - style[LEFT] = name === 'fontSize' ? '1em' : ret || 0; - ret = style.pixelLeft + PX; + var React = __webpack_require__(3); - // Revert the changed values - style[LEFT] = left; + module.exports = function toArray(children) { + var ret = []; + React.Children.forEach(children, function each(c) { + ret.push(c); + }); + return ret; + }; + +/***/ }, +/* 196 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; - elem[RUNTIME_STYLE][LEFT] = rsLeft; - } - return ret === '' ? 'auto' : ret; - } + var React = __webpack_require__(3); - if (typeof window !== 'undefined') { - getComputedStyleX = window.getComputedStyle ? _getComputedStyle : _getComputedStyleIE; + function mirror(o) { + return o; } - function getOffsetDirection(dir, option) { - if (dir === 'left') { - return option.useCssRight ? 'right' : dir; - } - return option.useCssBottom ? 'bottom' : dir; - } + module.exports = function mapSelf(children) { + // return ReactFragment + return React.Children.map(children, mirror); + }; + +/***/ }, +/* 197 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; - function oppositeOffsetDirection(dir) { - if (dir === 'left') { - return 'right'; - } else if (dir === 'right') { - return 'left'; - } else if (dir === 'top') { - return 'bottom'; - } else if (dir === 'bottom') { - return 'top'; - } - } + Object.defineProperty(exports, '__esModule', { + value: true + }); - // 设置 elem 相对 elem.ownerDocument 的坐标 - function setOffset(elem, offset, option) { - // set position first, in-case top/left are set even on static elem - if (css(elem, 'position') === 'static') { - elem.style.position = 'relative'; - } - var presetH = -999; - var presetV = -999; - var horizontalProperty = getOffsetDirection('left', option); - var verticalProperty = getOffsetDirection('top', option); - var oppositeHorizontalProperty = oppositeOffsetDirection(horizontalProperty); - var oppositeVerticalProperty = oppositeOffsetDirection(verticalProperty); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - if (horizontalProperty !== 'left') { - presetH = 999; - } + var _react = __webpack_require__(3); - if (verticalProperty !== 'top') { - presetV = 999; - } + var _react2 = _interopRequireDefault(_react); - if ('left' in offset) { - elem.style[oppositeHorizontalProperty] = ''; - elem.style[horizontalProperty] = presetH + 'px'; - } - if ('top' in offset) { - elem.style[oppositeVerticalProperty] = ''; - elem.style[verticalProperty] = presetV + 'px'; - } - var old = getOffset(elem); - var ret = {}; - var key = undefined; - for (key in offset) { - if (offset.hasOwnProperty(key)) { - var dir = getOffsetDirection(key, option); - var preset = key === 'left' ? presetH : presetV; - if (dir === key) { - ret[dir] = preset + offset[key] - old[key]; - } else { - ret[dir] = preset + old[key] - offset[key]; - } - } - } - css(elem, ret); - } + var _reactDom = __webpack_require__(160); - function each(arr, fn) { - for (var i = 0; i < arr.length; i++) { - fn(arr[i]); - } - } - - function isBorderBoxFn(elem) { - return getComputedStyleX(elem, 'boxSizing') === 'border-box'; - } - - var BOX_MODELS = ['margin', 'border', 'padding']; - var CONTENT_INDEX = -1; - var PADDING_INDEX = 2; - var BORDER_INDEX = 1; - var MARGIN_INDEX = 0; + var _reactDom2 = _interopRequireDefault(_reactDom); - function swap(elem, options, callback) { - var old = {}; - var style = elem.style; - var name = undefined; + var _rcAlign = __webpack_require__(198); - // Remember the old values, and insert the new ones - for (name in options) { - if (options.hasOwnProperty(name)) { - old[name] = style[name]; - style[name] = options[name]; - } - } + var _rcAlign2 = _interopRequireDefault(_rcAlign); - callback.call(elem); + var _rcAnimate = __webpack_require__(209); - // Revert the old values - for (name in options) { - if (options.hasOwnProperty(name)) { - style[name] = old[name]; - } - } - } + var _rcAnimate2 = _interopRequireDefault(_rcAnimate); - function getPBMWidth(elem, props, which) { - var value = 0; - var prop = undefined; - var j = undefined; - var i = undefined; - for (j = 0; j < props.length; j++) { - prop = props[j]; - if (prop) { - for (i = 0; i < which.length; i++) { - var cssProp = undefined; - if (prop === 'border') { - cssProp = prop + which[i] + 'Width'; - } else { - cssProp = prop + which[i]; - } - value += parseFloat(getComputedStyleX(elem, cssProp)) || 0; - } - } - } - return value; - } + var _PopupInner = __webpack_require__(217); - /** - * A crude way of determining if an object is a window - * @member util - */ - function isWindow(obj) { - // must use == for ie8 - /* eslint eqeqeq:0 */ - return obj !== null && obj !== undefined && obj == obj.window; - } + var _PopupInner2 = _interopRequireDefault(_PopupInner); - var domUtils = {}; + var Popup = _react2['default'].createClass({ + displayName: 'Popup', - each(['Width', 'Height'], function (name) { - domUtils['doc' + name] = function (refWin) { - var d = refWin.document; - return Math.max( - // firefox chrome documentElement.scrollHeight< body.scrollHeight - // ie standard mode : documentElement.scrollHeight> body.scrollHeight - d.documentElement['scroll' + name], - // quirks : documentElement.scrollHeight 最大等于可视窗口多一点? - d.body['scroll' + name], domUtils['viewport' + name](d)); - }; + propTypes: { + visible: _react.PropTypes.bool, + wrap: _react.PropTypes.object, + style: _react.PropTypes.object, + getClassNameFromAlign: _react.PropTypes.func, + onMouseEnter: _react.PropTypes.func, + className: _react.PropTypes.string, + onMouseLeave: _react.PropTypes.func + }, - domUtils['viewport' + name] = function (win) { - // pc browser includes scrollbar in window.innerWidth - var prop = 'client' + name; - var doc = win.document; - var body = doc.body; - var documentElement = doc.documentElement; - var documentElementProp = documentElement[prop]; - // 标准模式取 documentElement - // backcompat 取 body - return doc.compatMode === 'CSS1Compat' && documentElementProp || body && body[prop] || documentElementProp; - }; - }); + componentDidMount: function componentDidMount() { + this.rootNode = this.getPopupDomNode(); + }, - /* - 得到元素的大小信息 - @param elem - @param name - @param {String} [extra] 'padding' : (css width) + padding - 'border' : (css width) + padding + border - 'margin' : (css width) + padding + border + margin - */ - function getWH(elem, name, ex) { - var extra = ex; - if (isWindow(elem)) { - return name === 'width' ? domUtils.viewportWidth(elem) : domUtils.viewportHeight(elem); - } else if (elem.nodeType === 9) { - return name === 'width' ? domUtils.docWidth(elem) : domUtils.docHeight(elem); - } - var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom']; - var borderBoxValue = name === 'width' ? elem.offsetWidth : elem.offsetHeight; - var computedStyle = getComputedStyleX(elem); - var isBorderBox = isBorderBoxFn(elem, computedStyle); - var cssBoxValue = 0; - if (borderBoxValue === null || borderBoxValue === undefined || borderBoxValue <= 0) { - borderBoxValue = undefined; - // Fall back to computed then un computed css if necessary - cssBoxValue = getComputedStyleX(elem, name); - if (cssBoxValue === null || cssBoxValue === undefined || Number(cssBoxValue) < 0) { - cssBoxValue = elem.style[name] || 0; - } - // Normalize '', auto, and prepare for extra - cssBoxValue = parseFloat(cssBoxValue) || 0; - } - if (extra === undefined) { - extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX; - } - var borderBoxValueOrIsBorderBox = borderBoxValue !== undefined || isBorderBox; - var val = borderBoxValue || cssBoxValue; - if (extra === CONTENT_INDEX) { - if (borderBoxValueOrIsBorderBox) { - return val - getPBMWidth(elem, ['border', 'padding'], which, computedStyle); - } - return cssBoxValue; - } else if (borderBoxValueOrIsBorderBox) { - if (extra === BORDER_INDEX) { - return val; + onAlign: function onAlign(popupDomNode, align) { + var props = this.props; + var alignClassName = props.getClassNameFromAlign(props.align); + var currentAlignClassName = props.getClassNameFromAlign(align); + if (alignClassName !== currentAlignClassName) { + this.currentAlignClassName = currentAlignClassName; + popupDomNode.className = this.getClassName(currentAlignClassName); } - return val + (extra === PADDING_INDEX ? -getPBMWidth(elem, ['border'], which, computedStyle) : getPBMWidth(elem, ['margin'], which, computedStyle)); - } - return cssBoxValue + getPBMWidth(elem, BOX_MODELS.slice(extra), which, computedStyle); - } - - var cssShow = { position: 'absolute', visibility: 'hidden', display: 'block' }; - - // fix #119 : https://github.com/kissyteam/kissy/issues/119 - function getWHIgnoreDisplay() { - for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } + }, - var val = undefined; - var elem = args[0]; - // in case elem is window - // elem.offsetWidth === undefined - if (elem.offsetWidth !== 0) { - val = getWH.apply(undefined, args); - } else { - swap(elem, cssShow, function () { - val = getWH.apply(undefined, args); - }); - } - return val; - } + getPopupDomNode: function getPopupDomNode() { + return _reactDom2['default'].findDOMNode(this); + }, - each(['width', 'height'], function (name) { - var first = name.charAt(0).toUpperCase() + name.slice(1); - domUtils['outer' + first] = function (el, includeMargin) { - return el && getWHIgnoreDisplay(el, name, includeMargin ? MARGIN_INDEX : BORDER_INDEX); - }; - var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom']; + getTarget: function getTarget() { + return _reactDom2['default'].findDOMNode(this.props.wrap); + }, - domUtils[name] = function (elem, v) { - var val = v; - if (val !== undefined) { - if (elem) { - var computedStyle = getComputedStyleX(elem); - var isBorderBox = isBorderBoxFn(elem); - if (isBorderBox) { - val += getPBMWidth(elem, ['padding', 'border'], which, computedStyle); - } - return css(elem, name, val); - } - return undefined; + getTransitionName: function getTransitionName() { + var props = this.props; + var transitionName = props.transitionName; + if (!transitionName && props.animation) { + transitionName = props.prefixCls + '-' + props.animation; } - return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX); - }; - }); + return transitionName; + }, - function mix(to, from) { - for (var i in from) { - if (from.hasOwnProperty(i)) { - to[i] = from[i]; - } - } - return to; - } + getClassName: function getClassName(currentAlignClassName) { + var props = this.props; + var prefixCls = props.prefixCls; - var utils = { - getWindow: function getWindow(node) { - if (node && node.document && node.setTimeout) { - return node; - } - var doc = node.ownerDocument || node; - return doc.defaultView || doc.parentWindow; + var className = prefixCls + ' ' + props.className + ' '; + className += currentAlignClassName; + return className; }, - offset: function offset(el, value, option) { - if (typeof value !== 'undefined') { - setOffset(el, value, option || {}); - } else { - return getOffset(el); + + render: function render() { + var props = this.props; + var align = props.align; + var style = props.style; + var visible = props.visible; + var prefixCls = props.prefixCls; + var destroyPopupOnHide = props.destroyPopupOnHide; + + var className = this.getClassName(this.currentAlignClassName || props.getClassNameFromAlign(align)); + var hiddenClassName = prefixCls + '-hidden'; + if (!visible) { + this.currentAlignClassName = null; } - }, - isWindow: isWindow, - each: each, - css: css, - clone: function clone(obj) { - var i = undefined; - var ret = {}; - for (i in obj) { - if (obj.hasOwnProperty(i)) { - ret[i] = obj[i]; - } - } - var overflow = obj.overflow; - if (overflow) { - for (i in obj) { - if (obj.hasOwnProperty(i)) { - ret.overflow[i] = obj.overflow[i]; - } - } - } - return ret; - }, - mix: mix, - getWindowScrollLeft: function getWindowScrollLeft(w) { - return getScrollLeft(w); - }, - getWindowScrollTop: function getWindowScrollTop(w) { - return getScrollTop(w); - }, - merge: function merge() { - var ret = {}; - - for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { - args[_key2] = arguments[_key2]; - } - - for (var i = 0; i < args.length; i++) { - utils.mix(ret, args[i]); + if (destroyPopupOnHide) { + return _react2['default'].createElement( + _rcAnimate2['default'], + { component: '', + exclusive: true, + transitionAppear: true, + transitionName: this.getTransitionName() }, + visible ? _react2['default'].createElement( + _rcAlign2['default'], + { target: this.getTarget, + key: 'popup', + monitorWindowResize: true, + align: align, + onAlign: this.onAlign }, + _react2['default'].createElement( + _PopupInner2['default'], + { className: className, + visible: true, + onMouseEnter: props.onMouseEnter, + onMouseLeave: props.onMouseLeave, + style: style }, + props.children + ) + ) : null + ); } - return ret; - }, - viewportWidth: 0, - viewportHeight: 0 - }; - - mix(utils, domUtils); + return _react2['default'].createElement( + _rcAnimate2['default'], + { component: '', + exclusive: true, + transitionAppear: true, + transitionName: this.getTransitionName(), + showProp: 'xVisible' }, + _react2['default'].createElement( + _rcAlign2['default'], + { target: this.getTarget, + key: 'popup', + monitorWindowResize: true, + xVisible: visible, + childrenProps: { + visible: 'xVisible' + }, + disabled: !visible, + align: align, + onAlign: this.onAlign }, + _react2['default'].createElement( + _PopupInner2['default'], + { className: className, + hiddenClassName: hiddenClassName, + onMouseEnter: props.onMouseEnter, + onMouseLeave: props.onMouseLeave, + style: style }, + props.children + ) + ) + ); + } + }); - exports['default'] = utils; + exports['default'] = Popup; module.exports = exports['default']; /***/ }, -/* 196 */ +/* 198 */ /***/ function(module, exports, __webpack_require__) { + // export this package's api 'use strict'; Object.defineProperty(exports, '__esModule', { @@ -25147,54 +25119,15 @@ webpackJsonp([0,1],[ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - var _utils = __webpack_require__(195); - - var _utils2 = _interopRequireDefault(_utils); - - /** - * 得到会导致元素显示不全的祖先元素 - */ - - function getOffsetParent(element) { - // ie 这个也不是完全可行 - /* -
-
- 元素 6 高 100px 宽 50px
-
-
- */ - // element.offsetParent does the right thing in ie7 and below. Return parent with layout! - // In other browsers it only includes elements with position absolute, relative or - // fixed, not elements with overflow set to auto or scroll. - // if (UA.ie && ieMode < 8) { - // return element.offsetParent; - // } - // 统一的 offsetParent 方法 - var doc = element.ownerDocument; - var body = doc.body; - var parent = undefined; - var positionStyle = _utils2['default'].css(element, 'position'); - var skipStatic = positionStyle === 'fixed' || positionStyle === 'absolute'; - - if (!skipStatic) { - return element.nodeName.toLowerCase() === 'html' ? null : element.parentNode; - } + var _Align = __webpack_require__(199); - for (parent = element.parentNode; parent && parent !== body; parent = parent.parentNode) { - positionStyle = _utils2['default'].css(parent, 'position'); - if (positionStyle !== 'static') { - return parent; - } - } - return null; - } + var _Align2 = _interopRequireDefault(_Align); - exports['default'] = getOffsetParent; + exports['default'] = _Align2['default']; module.exports = exports['default']; /***/ }, -/* 197 */ +/* 199 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -25205,180 +25138,160 @@ webpackJsonp([0,1],[ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - var _utils = __webpack_require__(195); - - var _utils2 = _interopRequireDefault(_utils); - - var _getOffsetParent = __webpack_require__(196); - - var _getOffsetParent2 = _interopRequireDefault(_getOffsetParent); + var _react = __webpack_require__(3); - /** - * 获得元素的显示部分的区域 - */ - function getVisibleRectForElement(element) { - var visibleRect = { - left: 0, - right: Infinity, - top: 0, - bottom: Infinity - }; - var el = (0, _getOffsetParent2['default'])(element); - var scrollX = undefined; - var scrollY = undefined; - var winSize = undefined; - var doc = element.ownerDocument; - var win = doc.defaultView || doc.parentWindow; - var body = doc.body; - var documentElement = doc.documentElement; + var _react2 = _interopRequireDefault(_react); - // Determine the size of the visible rect by climbing the dom accounting for - // all scrollable containers. - while (el) { - // clientWidth is zero for inline block elements in ie. - if ((navigator.userAgent.indexOf('MSIE') === -1 || el.clientWidth !== 0) && - // body may have overflow set on it, yet we still get the entire - // viewport. In some browsers, el.offsetParent may be - // document.documentElement, so check for that too. - el !== body && el !== documentElement && _utils2['default'].css(el, 'overflow') !== 'visible') { - var pos = _utils2['default'].offset(el); - // add border - pos.left += el.clientLeft; - pos.top += el.clientTop; - visibleRect.top = Math.max(visibleRect.top, pos.top); - visibleRect.right = Math.min(visibleRect.right, - // consider area without scrollBar - pos.left + el.clientWidth); - visibleRect.bottom = Math.min(visibleRect.bottom, pos.top + el.clientHeight); - visibleRect.left = Math.max(visibleRect.left, pos.left); - } else if (el === body || el === documentElement) { - break; - } - el = (0, _getOffsetParent2['default'])(el); - } + var _reactDom = __webpack_require__(160); - // Clip by window's viewport. - scrollX = _utils2['default'].getWindowScrollLeft(win); - scrollY = _utils2['default'].getWindowScrollTop(win); - visibleRect.left = Math.max(visibleRect.left, scrollX); - visibleRect.top = Math.max(visibleRect.top, scrollY); - winSize = { - width: _utils2['default'].viewportWidth(win), - height: _utils2['default'].viewportHeight(win) - }; - visibleRect.right = Math.min(visibleRect.right, scrollX + winSize.width); - visibleRect.bottom = Math.min(visibleRect.bottom, scrollY + winSize.height); - return visibleRect.top >= 0 && visibleRect.left >= 0 && visibleRect.bottom > visibleRect.top && visibleRect.right > visibleRect.left ? visibleRect : null; - } + var _reactDom2 = _interopRequireDefault(_reactDom); - exports['default'] = getVisibleRectForElement; - module.exports = exports['default']; - -/***/ }, -/* 198 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; + var _domAlign = __webpack_require__(200); - Object.defineProperty(exports, '__esModule', { - value: true - }); + var _domAlign2 = _interopRequireDefault(_domAlign); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + var _rcUtil = __webpack_require__(174); - var _utils = __webpack_require__(195); + var _isWindow = __webpack_require__(208); - var _utils2 = _interopRequireDefault(_utils); + var _isWindow2 = _interopRequireDefault(_isWindow); - function adjustForViewport(elFuturePos, elRegion, visibleRect, overflow) { - var pos = _utils2['default'].clone(elFuturePos); - var size = { - width: elRegion.width, - height: elRegion.height + function buffer(fn, ms) { + var timer = undefined; + return function bufferFn() { + if (timer) { + clearTimeout(timer); + } + timer = setTimeout(fn, ms); }; + } - if (overflow.adjustX && pos.left < visibleRect.left) { - pos.left = visibleRect.left; - } - - // Left edge inside and right edge outside viewport, try to resize it. - if (overflow.resizeWidth && pos.left >= visibleRect.left && pos.left + size.width > visibleRect.right) { - size.width -= pos.left + size.width - visibleRect.right; - } + var Align = _react2['default'].createClass({ + displayName: 'Align', - // Right edge outside viewport, try to move it. - if (overflow.adjustX && pos.left + size.width > visibleRect.right) { - // 保证左边界和可视区域左边界对齐 - pos.left = Math.max(visibleRect.right - size.width, visibleRect.left); - } + propTypes: { + childrenProps: _react.PropTypes.object, + align: _react.PropTypes.object.isRequired, + target: _react.PropTypes.func, + onAlign: _react.PropTypes.func, + monitorBufferTime: _react.PropTypes.number, + monitorWindowResize: _react.PropTypes.bool, + disabled: _react.PropTypes.bool, + children: _react.PropTypes.any + }, - // Top edge outside viewport, try to move it. - if (overflow.adjustY && pos.top < visibleRect.top) { - pos.top = visibleRect.top; - } + getDefaultProps: function getDefaultProps() { + return { + target: function target() { + return window; + }, + onAlign: function onAlign() {}, + monitorBufferTime: 50, + monitorWindowResize: false, + disabled: false + }; + }, - // Top edge inside and bottom edge outside viewport, try to resize it. - if (overflow.resizeHeight && pos.top >= visibleRect.top && pos.top + size.height > visibleRect.bottom) { - size.height -= pos.top + size.height - visibleRect.bottom; - } + componentDidMount: function componentDidMount() { + var props = this.props; + // if parent ref not attached .... use document.getElementById + if (!props.disabled) { + var source = _reactDom2['default'].findDOMNode(this); + props.onAlign(source, (0, _domAlign2['default'])(source, props.target(), props.align)); + if (props.monitorWindowResize) { + this.startMonitorWindowResize(); + } + } + }, - // Bottom edge outside viewport, try to move it. - if (overflow.adjustY && pos.top + size.height > visibleRect.bottom) { - // 保证上边界和可视区域上边界对齐 - pos.top = Math.max(visibleRect.bottom - size.height, visibleRect.top); - } + componentDidUpdate: function componentDidUpdate(prevProps) { + var reAlign = false; + var props = this.props; + var currentTarget = undefined; - return _utils2['default'].mix(pos, size); - } + if (!props.disabled) { + if (prevProps.disabled || prevProps.align !== props.align) { + reAlign = true; + currentTarget = props.target(); + } else { + var lastTarget = prevProps.target(); + currentTarget = props.target(); + if ((0, _isWindow2['default'])(lastTarget) && (0, _isWindow2['default'])(currentTarget)) { + reAlign = false; + } else if (lastTarget !== currentTarget) { + reAlign = true; + } + } + } - exports['default'] = adjustForViewport; - module.exports = exports['default']; - -/***/ }, -/* 199 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; + if (reAlign) { + var source = _reactDom2['default'].findDOMNode(this); + props.onAlign(source, (0, _domAlign2['default'])(source, currentTarget, props.align)); + } - Object.defineProperty(exports, '__esModule', { - value: true - }); + if (props.monitorWindowResize && !props.disabled) { + this.startMonitorWindowResize(); + } else { + this.stopMonitorWindowResize(); + } + }, - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + componentWillUnmount: function componentWillUnmount() { + this.stopMonitorWindowResize(); + }, + + onWindowResize: function onWindowResize() { + var props = this.props; + if (!props.disabled) { + var source = _reactDom2['default'].findDOMNode(this); + props.onAlign(source, (0, _domAlign2['default'])(source, props.target(), props.align)); + } + }, - var _utils = __webpack_require__(195); + startMonitorWindowResize: function startMonitorWindowResize() { + if (!this.resizeHandler) { + this.resizeHandler = _rcUtil.Dom.addEventListener(window, 'resize', buffer(this.onWindowResize, this.props.monitorBufferTime)); + } + }, - var _utils2 = _interopRequireDefault(_utils); + stopMonitorWindowResize: function stopMonitorWindowResize() { + if (this.resizeHandler) { + this.resizeHandler.remove(); + this.resizeHandler = null; + } + }, - function getRegion(node) { - var offset = undefined; - var w = undefined; - var h = undefined; - if (!_utils2['default'].isWindow(node) && node.nodeType !== 9) { - offset = _utils2['default'].offset(node); - w = _utils2['default'].outerWidth(node); - h = _utils2['default'].outerHeight(node); - } else { - var win = _utils2['default'].getWindow(node); - offset = { - left: _utils2['default'].getWindowScrollLeft(win), - top: _utils2['default'].getWindowScrollTop(win) - }; - w = _utils2['default'].viewportWidth(win); - h = _utils2['default'].viewportHeight(win); + render: function render() { + var _props = this.props; + var childrenProps = _props.childrenProps; + var children = _props.children; + + var child = _react2['default'].Children.only(children); + if (childrenProps) { + var newProps = {}; + for (var prop in childrenProps) { + if (childrenProps.hasOwnProperty(prop)) { + newProps[prop] = this.props[childrenProps[prop]]; + } + } + return _react2['default'].cloneElement(child, newProps); + } + return child; } - offset.width = w; - offset.height = h; - return offset; - } + }); - exports['default'] = getRegion; + exports['default'] = Align; module.exports = exports['default']; /***/ }, /* 200 */ /***/ function(module, exports, __webpack_require__) { + /** + * align dom node flexibly + * @author yiminghe@gmail.com + */ + 'use strict'; Object.defineProperty(exports, '__esModule', { @@ -25387,2623 +25300,1982 @@ webpackJsonp([0,1],[ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - var _getAlignOffset = __webpack_require__(201); + var _utils = __webpack_require__(201); - var _getAlignOffset2 = _interopRequireDefault(_getAlignOffset); + var _utils2 = _interopRequireDefault(_utils); - function getElFuturePos(elRegion, refNodeRegion, points, offset, targetOffset) { - var xy = undefined; - var diff = undefined; - var p1 = undefined; - var p2 = undefined; + var _getOffsetParent = __webpack_require__(202); - xy = { - left: elRegion.left, - top: elRegion.top - }; + var _getOffsetParent2 = _interopRequireDefault(_getOffsetParent); - p1 = (0, _getAlignOffset2['default'])(refNodeRegion, points[1]); - p2 = (0, _getAlignOffset2['default'])(elRegion, points[0]); + var _getVisibleRectForElement = __webpack_require__(203); - diff = [p2.left - p1.left, p2.top - p1.top]; + var _getVisibleRectForElement2 = _interopRequireDefault(_getVisibleRectForElement); - return { - left: xy.left - diff[0] + offset[0] - targetOffset[0], - top: xy.top - diff[1] + offset[1] - targetOffset[1] - }; - } + var _adjustForViewport = __webpack_require__(204); - exports['default'] = getElFuturePos; - module.exports = exports['default']; - -/***/ }, -/* 201 */ -/***/ function(module, exports) { - - /** - * 获取 node 上的 align 对齐点 相对于页面的坐标 - */ + var _adjustForViewport2 = _interopRequireDefault(_adjustForViewport); - 'use strict'; + var _getRegion = __webpack_require__(205); - Object.defineProperty(exports, '__esModule', { - value: true - }); - function getAlignOffset(region, align) { - var V = align.charAt(0); - var H = align.charAt(1); - var w = region.width; - var h = region.height; - var x = undefined; - var y = undefined; + var _getRegion2 = _interopRequireDefault(_getRegion); - x = region.left; - y = region.top; + var _getElFuturePos = __webpack_require__(206); - if (V === 'c') { - y += h / 2; - } else if (V === 'b') { - y += h; - } + var _getElFuturePos2 = _interopRequireDefault(_getElFuturePos); - if (H === 'c') { - x += w / 2; - } else if (H === 'r') { - x += w; - } + // http://yiminghe.iteye.com/blog/1124720 - return { - left: x, - top: y - }; + function isFailX(elFuturePos, elRegion, visibleRect) { + return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right; } - exports['default'] = getAlignOffset; - module.exports = exports['default']; - -/***/ }, -/* 202 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; + function isFailY(elFuturePos, elRegion, visibleRect) { + return elFuturePos.top < visibleRect.top || elFuturePos.top + elRegion.height > visibleRect.bottom; + } - module.exports = { - guid: __webpack_require__(203), - classSet: __webpack_require__(204), - joinClasses: __webpack_require__(205), - KeyCode: __webpack_require__(206), - PureRenderMixin: __webpack_require__(207), - shallowEqual: __webpack_require__(208), - createChainedFunction: __webpack_require__(209), - Dom: { - addEventListener: __webpack_require__(210), - contains: __webpack_require__(211) - }, - Children: { - toArray: __webpack_require__(212), - mapSelf: __webpack_require__(213) - } - }; - -/***/ }, -/* 203 */ -/***/ function(module, exports) { - - 'use strict'; + function flip(points, reg, map) { + var ret = []; + _utils2['default'].each(points, function (p) { + ret.push(p.replace(reg, function (m) { + return map[m]; + })); + }); + return ret; + } - var seed = 0; - module.exports = function guid() { - return Date.now() + '_' + seed++; - }; - -/***/ }, -/* 204 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; + function flipOffset(offset, index) { + offset[index] = -offset[index]; + return offset; + } - module.exports = __webpack_require__(177); - -/***/ }, -/* 205 */ -/***/ function(module, exports) { - - /** - * Combines multiple className strings into one. - * http://jsperf.com/joinclasses-args-vs-array - * - * @param {...?string} classes - * @return {string} - */ + function convertOffset(str, offsetLen) { + var n = undefined; + if (/%$/.test(str)) { + n = parseInt(str.substring(0, str.length - 1), 10) / 100 * offsetLen; + } else { + n = parseInt(str, 10); + } + return n || 0; + } - 'use strict'; + function normalizeOffset(offset, el) { + offset[0] = convertOffset(offset[0], el.width); + offset[1] = convertOffset(offset[1], el.height); + } - function joinClasses(cn) { - var className = cn; - if (!className) { - className = ''; - } - var nextClass = undefined; - var argLength = arguments.length; - if (argLength > 1) { - for (var ii = 1; ii < argLength; ii++) { - nextClass = arguments[ii]; - if (nextClass) { - className = (className ? className + ' ' : '') + nextClass; + function domAlign(el, refNode, align) { + var points = align.points; + var offset = align.offset || [0, 0]; + var targetOffset = align.targetOffset || [0, 0]; + var overflow = align.overflow; + var target = align.target || refNode; + var source = align.source || el; + offset = [].concat(offset); + targetOffset = [].concat(targetOffset); + overflow = overflow || {}; + var newOverflowCfg = {}; + + var fail = 0; + // 当前节点可以被放置的显示区域 + var visibleRect = (0, _getVisibleRectForElement2['default'])(source); + // 当前节点所占的区域, left/top/width/height + var elRegion = (0, _getRegion2['default'])(source); + // 参照节点所占的区域, left/top/width/height + var refNodeRegion = (0, _getRegion2['default'])(target); + // 将 offset 转换成数值,支持百分比 + normalizeOffset(offset, elRegion); + normalizeOffset(targetOffset, refNodeRegion); + // 当前节点将要被放置的位置 + var elFuturePos = (0, _getElFuturePos2['default'])(elRegion, refNodeRegion, points, offset, targetOffset); + // 当前节点将要所处的区域 + var newElRegion = _utils2['default'].merge(elRegion, elFuturePos); + + // 如果可视区域不能完全放置当前节点时允许调整 + if (visibleRect && (overflow.adjustX || overflow.adjustY)) { + if (overflow.adjustX) { + // 如果横向不能放下 + if (isFailX(elFuturePos, elRegion, visibleRect)) { + fail = 1; + // 对齐位置反下 + points = flip(points, /[lr]/ig, { + l: 'r', + r: 'l' + }); + // 偏移量也反下 + offset = flipOffset(offset, 0); + targetOffset = flipOffset(targetOffset, 0); + } + } + + if (overflow.adjustY) { + // 如果纵向不能放下 + if (isFailY(elFuturePos, elRegion, visibleRect)) { + fail = 1; + // 对齐位置反下 + points = flip(points, /[tb]/ig, { + t: 'b', + b: 't' + }); + // 偏移量也反下 + offset = flipOffset(offset, 1); + targetOffset = flipOffset(targetOffset, 1); } } + + // 如果失败,重新计算当前节点将要被放置的位置 + if (fail) { + elFuturePos = (0, _getElFuturePos2['default'])(elRegion, refNodeRegion, points, offset, targetOffset); + _utils2['default'].mix(newElRegion, elFuturePos); + } + + // 检查反下后的位置是否可以放下了 + // 如果仍然放不下只有指定了可以调整当前方向才调整 + newOverflowCfg.adjustX = overflow.adjustX && isFailX(elFuturePos, elRegion, visibleRect); + + newOverflowCfg.adjustY = overflow.adjustY && isFailY(elFuturePos, elRegion, visibleRect); + + // 确实要调整,甚至可能会调整高度宽度 + if (newOverflowCfg.adjustX || newOverflowCfg.adjustY) { + newElRegion = (0, _adjustForViewport2['default'])(elFuturePos, elRegion, visibleRect, newOverflowCfg); + } + } + + // need judge to in case set fixed with in css on height auto element + if (newElRegion.width !== elRegion.width) { + _utils2['default'].css(source, 'width', source.width() + newElRegion.width - elRegion.width); + } + + if (newElRegion.height !== elRegion.height) { + _utils2['default'].css(source, 'height', source.height() + newElRegion.height - elRegion.height); } - return className; + + // https://github.com/kissyteam/kissy/issues/190 + // http://localhost:8888/kissy/src/overlay/demo/other/relative_align/align.html + // 相对于屏幕位置没变,而 left/top 变了 + // 例如
+ _utils2['default'].offset(source, { + left: newElRegion.left, + top: newElRegion.top + }, { + useCssRight: align.useCssRight, + useCssBottom: align.useCssBottom + }); + + return { + points: points, + offset: offset, + targetOffset: targetOffset, + overflow: newOverflowCfg + }; } - module.exports = joinClasses; + domAlign.__getOffsetParent = _getOffsetParent2['default']; + + domAlign.__getVisibleRectForElement = _getVisibleRectForElement2['default']; + + exports['default'] = domAlign; + + /** + * 2012-04-26 yiminghe@gmail.com + * - 优化智能对齐算法 + * - 慎用 resizeXX + * + * 2011-07-13 yiminghe@gmail.com note: + * - 增加智能对齐,以及大小调整选项 + **/ + module.exports = exports['default']; /***/ }, -/* 206 */ +/* 201 */ /***/ function(module, exports) { - /** - * @ignore - * some key-codes definition and utils from closure-library - * @author yiminghe@gmail.com - */ - 'use strict'; - var KeyCode = { - /** - * MAC_ENTER - */ - MAC_ENTER: 3, - /** - * BACKSPACE - */ - BACKSPACE: 8, - /** - * TAB - */ - TAB: 9, - /** - * NUMLOCK on FF/Safari Mac - */ - NUM_CENTER: 12, // NUMLOCK on FF/Safari Mac - /** - * ENTER - */ - ENTER: 13, - /** - * SHIFT - */ - SHIFT: 16, - /** - * CTRL - */ - CTRL: 17, - /** - * ALT - */ - ALT: 18, - /** - * PAUSE - */ - PAUSE: 19, - /** - * CAPS_LOCK - */ - CAPS_LOCK: 20, - /** - * ESC - */ - ESC: 27, - /** - * SPACE - */ - SPACE: 32, - /** - * PAGE_UP - */ - PAGE_UP: 33, // also NUM_NORTH_EAST - /** - * PAGE_DOWN - */ - PAGE_DOWN: 34, // also NUM_SOUTH_EAST - /** - * END - */ - END: 35, // also NUM_SOUTH_WEST - /** - * HOME - */ - HOME: 36, // also NUM_NORTH_WEST - /** - * LEFT - */ - LEFT: 37, // also NUM_WEST - /** - * UP - */ - UP: 38, // also NUM_NORTH - /** - * RIGHT - */ - RIGHT: 39, // also NUM_EAST - /** - * DOWN - */ - DOWN: 40, // also NUM_SOUTH - /** - * PRINT_SCREEN - */ - PRINT_SCREEN: 44, - /** - * INSERT - */ - INSERT: 45, // also NUM_INSERT - /** - * DELETE - */ - DELETE: 46, // also NUM_DELETE - /** - * ZERO - */ - ZERO: 48, - /** - * ONE - */ - ONE: 49, - /** - * TWO - */ - TWO: 50, - /** - * THREE - */ - THREE: 51, - /** - * FOUR - */ - FOUR: 52, - /** - * FIVE - */ - FIVE: 53, - /** - * SIX - */ - SIX: 54, - /** - * SEVEN - */ - SEVEN: 55, - /** - * EIGHT - */ - EIGHT: 56, - /** - * NINE - */ - NINE: 57, - /** - * QUESTION_MARK - */ - QUESTION_MARK: 63, // needs localization - /** - * A - */ - A: 65, - /** - * B - */ - B: 66, - /** - * C - */ - C: 67, - /** - * D - */ - D: 68, - /** - * E - */ - E: 69, - /** - * F - */ - F: 70, - /** - * G - */ - G: 71, - /** - * H - */ - H: 72, - /** - * I - */ - I: 73, - /** - * J - */ - J: 74, - /** - * K - */ - K: 75, - /** - * L - */ - L: 76, - /** - * M - */ - M: 77, - /** - * N - */ - N: 78, - /** - * O - */ - O: 79, - /** - * P - */ - P: 80, - /** - * Q - */ - Q: 81, - /** - * R - */ - R: 82, - /** - * S - */ - S: 83, - /** - * T - */ - T: 84, - /** - * U - */ - U: 85, - /** - * V - */ - V: 86, - /** - * W - */ - W: 87, - /** - * X - */ - X: 88, - /** - * Y - */ - Y: 89, - /** - * Z - */ - Z: 90, - /** - * META - */ - META: 91, // WIN_KEY_LEFT - /** - * WIN_KEY_RIGHT - */ - WIN_KEY_RIGHT: 92, - /** - * CONTEXT_MENU - */ - CONTEXT_MENU: 93, - /** - * NUM_ZERO - */ - NUM_ZERO: 96, - /** - * NUM_ONE - */ - NUM_ONE: 97, - /** - * NUM_TWO - */ - NUM_TWO: 98, - /** - * NUM_THREE - */ - NUM_THREE: 99, - /** - * NUM_FOUR - */ - NUM_FOUR: 100, - /** - * NUM_FIVE - */ - NUM_FIVE: 101, - /** - * NUM_SIX - */ - NUM_SIX: 102, - /** - * NUM_SEVEN - */ - NUM_SEVEN: 103, - /** - * NUM_EIGHT - */ - NUM_EIGHT: 104, - /** - * NUM_NINE - */ - NUM_NINE: 105, - /** - * NUM_MULTIPLY - */ - NUM_MULTIPLY: 106, - /** - * NUM_PLUS - */ - NUM_PLUS: 107, - /** - * NUM_MINUS - */ - NUM_MINUS: 109, - /** - * NUM_PERIOD - */ - NUM_PERIOD: 110, - /** - * NUM_DIVISION - */ - NUM_DIVISION: 111, - /** - * F1 - */ - F1: 112, - /** - * F2 - */ - F2: 113, - /** - * F3 - */ - F3: 114, - /** - * F4 - */ - F4: 115, - /** - * F5 - */ - F5: 116, - /** - * F6 - */ - F6: 117, - /** - * F7 - */ - F7: 118, - /** - * F8 - */ - F8: 119, - /** - * F9 - */ - F9: 120, - /** - * F10 - */ - F10: 121, - /** - * F11 - */ - F11: 122, - /** - * F12 - */ - F12: 123, - /** - * NUMLOCK - */ - NUMLOCK: 144, - /** - * SEMICOLON - */ - SEMICOLON: 186, // needs localization - /** - * DASH - */ - DASH: 189, // needs localization - /** - * EQUALS - */ - EQUALS: 187, // needs localization - /** - * COMMA - */ - COMMA: 188, // needs localization - /** - * PERIOD - */ - PERIOD: 190, // needs localization - /** - * SLASH - */ - SLASH: 191, // needs localization - /** - * APOSTROPHE - */ - APOSTROPHE: 192, // needs localization - /** - * SINGLE_QUOTE - */ - SINGLE_QUOTE: 222, // needs localization - /** - * OPEN_SQUARE_BRACKET - */ - OPEN_SQUARE_BRACKET: 219, // needs localization - /** - * BACKSLASH - */ - BACKSLASH: 220, // needs localization - /** - * CLOSE_SQUARE_BRACKET - */ - CLOSE_SQUARE_BRACKET: 221, // needs localization - /** - * WIN_KEY - */ - WIN_KEY: 224, - /** - * MAC_FF_META - */ - MAC_FF_META: 224, // Firefox (Gecko) fires this for the meta key instead of 91 - /** - * WIN_IME - */ - WIN_IME: 229 - }; - - /* - whether text and modified key is entered at the same time. - */ - KeyCode.isTextModifyingKeyEvent = function isTextModifyingKeyEvent(e) { - var keyCode = e.keyCode; - if (e.altKey && !e.ctrlKey || e.metaKey || - // Function keys don't generate text - keyCode >= KeyCode.F1 && keyCode <= KeyCode.F12) { - return false; - } - - // The following keys are quite harmless, even in combination with - // CTRL, ALT or SHIFT. - switch (keyCode) { - case KeyCode.ALT: - case KeyCode.CAPS_LOCK: - case KeyCode.CONTEXT_MENU: - case KeyCode.CTRL: - case KeyCode.DOWN: - case KeyCode.END: - case KeyCode.ESC: - case KeyCode.HOME: - case KeyCode.INSERT: - case KeyCode.LEFT: - case KeyCode.MAC_FF_META: - case KeyCode.META: - case KeyCode.NUMLOCK: - case KeyCode.NUM_CENTER: - case KeyCode.PAGE_DOWN: - case KeyCode.PAGE_UP: - case KeyCode.PAUSE: - case KeyCode.PRINT_SCREEN: - case KeyCode.RIGHT: - case KeyCode.SHIFT: - case KeyCode.UP: - case KeyCode.WIN_KEY: - case KeyCode.WIN_KEY_RIGHT: - return false; - default: - return true; - } - }; - - /* - whether character is entered. - */ - KeyCode.isCharacterKey = function isCharacterKey(keyCode) { - if (keyCode >= KeyCode.ZERO && keyCode <= KeyCode.NINE) { - return true; - } - - if (keyCode >= KeyCode.NUM_ZERO && keyCode <= KeyCode.NUM_MULTIPLY) { - return true; - } - - if (keyCode >= KeyCode.A && keyCode <= KeyCode.Z) { - return true; - } - - // Safari sends zero key code for non-latin characters. - if (window.navigation.userAgent.indexOf('WebKit') !== -1 && keyCode === 0) { - return true; - } - - switch (keyCode) { - case KeyCode.SPACE: - case KeyCode.QUESTION_MARK: - case KeyCode.NUM_PLUS: - case KeyCode.NUM_MINUS: - case KeyCode.NUM_PERIOD: - case KeyCode.NUM_DIVISION: - case KeyCode.SEMICOLON: - case KeyCode.DASH: - case KeyCode.EQUALS: - case KeyCode.COMMA: - case KeyCode.PERIOD: - case KeyCode.SLASH: - case KeyCode.APOSTROPHE: - case KeyCode.SINGLE_QUOTE: - case KeyCode.OPEN_SQUARE_BRACKET: - case KeyCode.BACKSLASH: - case KeyCode.CLOSE_SQUARE_BRACKET: - return true; - default: - return false; - } - }; - - module.exports = KeyCode; - -/***/ }, -/* 207 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var shallowEqual = __webpack_require__(208); - - /** - * If your React component's render function is "pure", e.g. it will render the - * same result given the same props and state, provide this Mixin for a - * considerable performance boost. - * - * Most React components have pure render functions. - * - * Example: - * - * const ReactComponentWithPureRenderMixin = - * require('ReactComponentWithPureRenderMixin'); - * React.createClass({ - * mixins: [ReactComponentWithPureRenderMixin], - * - * render: function() { - * return
foo
; - * } - * }); - * - * Note: This only checks shallow equality for props and state. If these contain - * complex data structures this mixin may have false-negatives for deeper - * differences. Only mixin to components which have simple props and state, or - * use `forceUpdate()` when you know deep data structures have changed. - */ - var ReactComponentWithPureRenderMixin = { - shouldComponentUpdate: function shouldComponentUpdate(nextProps, nextState) { - return !shallowEqual(this.props, nextProps) || !shallowEqual(this.state, nextState); - } - }; - - module.exports = ReactComponentWithPureRenderMixin; - -/***/ }, -/* 208 */ -/***/ function(module, exports) { - - "use strict"; - - function shallowEqual(objA, objB) { - if (objA === objB) { - return true; - } - var key = undefined; - // Test for A's keys different from B. - for (key in objA) { - if (objA.hasOwnProperty(key) && (!objB.hasOwnProperty(key) || objA[key] !== objB[key])) { - return false; - } - } - // Test for B's keys missing from A. - for (key in objB) { - if (objB.hasOwnProperty(key) && !objA.hasOwnProperty(key)) { - return false; - } - } - return true; - } - - module.exports = shallowEqual; - -/***/ }, -/* 209 */ -/***/ function(module, exports) { - - /** - * Safe chained function - * - * Will only create a new function if needed, - * otherwise will pass back existing functions or null. - * - * @returns {function|null} - */ - "use strict"; - - function createChainedFunction() { - var args = arguments; - return function chainedFunction() { - for (var i = 0; i < args.length; i++) { - if (args[i] && args[i].apply) { - args[i].apply(this, arguments); - } - } - }; - } - - module.exports = createChainedFunction; - -/***/ }, -/* 210 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, '__esModule', { - value: true - }); - exports['default'] = addEventListenerWrap; - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - - var _addDomEventListener = __webpack_require__(184); - - var _addDomEventListener2 = _interopRequireDefault(_addDomEventListener); - - var _reactDom = __webpack_require__(160); - - var _reactDom2 = _interopRequireDefault(_reactDom); - - function addEventListenerWrap(target, eventType, cb) { - /* eslint camelcase: 2 */ - var callback = _reactDom2['default'].unstable_batchedUpdates ? function run(e) { - _reactDom2['default'].unstable_batchedUpdates(cb, e); - } : cb; - return (0, _addDomEventListener2['default'])(target, eventType, callback); - } - - module.exports = exports['default']; - -/***/ }, -/* 211 */ -/***/ function(module, exports) { - - "use strict"; - - module.exports = function contains(root, n) { - var node = n; - while (node) { - if (node === root) { - return true; - } - node = node.parentNode; - } - - return false; - }; - -/***/ }, -/* 212 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var React = __webpack_require__(3); - - module.exports = function toArray(children) { - var ret = []; - React.Children.forEach(children, function each(c) { - ret.push(c); - }); - return ret; - }; - -/***/ }, -/* 213 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var React = __webpack_require__(3); - - function mirror(o) { - return o; - } - - module.exports = function mapSelf(children) { - // return ReactFragment - return React.Children.map(children, mirror); - }; - -/***/ }, -/* 214 */ -/***/ function(module, exports) { - - "use strict"; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports["default"] = isWindow; - - function isWindow(obj) { - /* eslint no-eq-null: 0 */ - /* eslint eqeqeq: 0 */ - return obj != null && obj == obj.window; - } - - module.exports = exports["default"]; - -/***/ }, -/* 215 */ -/***/ function(module, exports, __webpack_require__) { - - // export this package's api - 'use strict'; - - module.exports = __webpack_require__(216); - -/***/ }, -/* 216 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, '__esModule', { - value: true - }); - - 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__(3); - - var _react2 = _interopRequireDefault(_react); - - var _ChildrenUtils = __webpack_require__(217); - - var _AnimateChild = __webpack_require__(218); - - var _AnimateChild2 = _interopRequireDefault(_AnimateChild); - - var _util = __webpack_require__(222); - - var _util2 = _interopRequireDefault(_util); - - var defaultKey = 'rc_animate_' + Date.now(); - - function getChildrenFromProps(props) { - var children = props.children; - if (_react2['default'].isValidElement(children)) { - if (!children.key) { - return _react2['default'].cloneElement(children, { - key: defaultKey - }); - } - } - return children; - } - - function noop() {} - - var Animate = _react2['default'].createClass({ - displayName: 'Animate', - - propTypes: { - component: _react2['default'].PropTypes.any, - animation: _react2['default'].PropTypes.object, - transitionName: _react2['default'].PropTypes.string, - transitionEnter: _react2['default'].PropTypes.bool, - transitionAppear: _react2['default'].PropTypes.bool, - exclusive: _react2['default'].PropTypes.bool, - transitionLeave: _react2['default'].PropTypes.bool, - onEnd: _react2['default'].PropTypes.func, - onEnter: _react2['default'].PropTypes.func, - onLeave: _react2['default'].PropTypes.func, - onAppear: _react2['default'].PropTypes.func, - showProp: _react2['default'].PropTypes.string - }, - - getDefaultProps: function getDefaultProps() { - return { - animation: {}, - component: 'span', - transitionEnter: true, - transitionLeave: true, - transitionAppear: false, - onEnd: noop, - onEnter: noop, - onLeave: noop, - onAppear: noop - }; - }, - - getInitialState: function getInitialState() { - this.currentlyAnimatingKeys = {}; - this.keysToEnter = []; - this.keysToLeave = []; - return { - children: (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(this.props)) - }; - }, - - componentDidMount: function componentDidMount() { - var _this = this; - - var showProp = this.props.showProp; - var children = this.state.children; - if (showProp) { - children = children.filter(function (child) { - return !!child.props[showProp]; - }); - } - children.forEach(function (child) { - _this.performAppear(child.key); - }); - }, - - componentWillReceiveProps: function componentWillReceiveProps(nextProps) { - var _this2 = this; - - var nextChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(nextProps)); - var props = this.props; - var showProp = props.showProp; - var currentlyAnimatingKeys = this.currentlyAnimatingKeys; - // last props children if exclusive - // exclusive needs immediate response - var currentChildren = this.state.children; - // in case destroy in showProp mode - var newChildren = []; - if (showProp) { - currentChildren.forEach(function (currentChild) { - var nextChild = (0, _ChildrenUtils.findChildInChildrenByKey)(nextChildren, currentChild.key); - var newChild = undefined; - if ((!nextChild || !nextChild.props[showProp]) && currentChild.props[showProp]) { - newChild = _react2['default'].cloneElement(nextChild || currentChild, _defineProperty({}, showProp, true)); - } else { - newChild = nextChild; - } - if (newChild) { - newChildren.push(newChild); - } - }); - nextChildren.forEach(function (nextChild) { - if (!(0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, nextChild.key)) { - newChildren.push(nextChild); - } - }); - } else { - newChildren = (0, _ChildrenUtils.mergeChildren)(currentChildren, nextChildren); - } - - // need render to avoid update - this.setState({ - children: newChildren - }); - - nextChildren.forEach(function (child) { - var key = child.key; - if (currentlyAnimatingKeys[key]) { - return; - } - var hasPrev = (0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, key); - if (showProp) { - var showInNext = child.props[showProp]; - if (hasPrev) { - var showInNow = (0, _ChildrenUtils.findShownChildInChildrenByKey)(currentChildren, key, showProp); - if (!showInNow && showInNext) { - _this2.keysToEnter.push(key); - } - } else if (showInNext) { - _this2.keysToEnter.push(key); - } - } else if (!hasPrev) { - _this2.keysToEnter.push(key); - } - }); - - currentChildren.forEach(function (child) { - var key = child.key; - if (currentlyAnimatingKeys[key]) { - return; - } - var hasNext = (0, _ChildrenUtils.findChildInChildrenByKey)(nextChildren, key); - if (showProp) { - var showInNow = child.props[showProp]; - if (hasNext) { - var showInNext = (0, _ChildrenUtils.findShownChildInChildrenByKey)(nextChildren, key, showProp); - if (!showInNext && showInNow) { - _this2.keysToLeave.push(key); - } - } else if (showInNow) { - _this2.keysToLeave.push(key); - } - } else if (!hasNext) { - _this2.keysToLeave.push(key); - } - }); - }, - - componentDidUpdate: function componentDidUpdate(prevProps) { - var _this3 = this; - - // exclusive needs immediate response - if (this.props.exclusive && this.props !== prevProps) { - Object.keys(this.currentlyAnimatingKeys).forEach(function (key) { - _this3.stop(key); - }); - } - if (this.isMounted()) { - var keysToEnter = this.keysToEnter; - this.keysToEnter = []; - keysToEnter.forEach(this.performEnter); - var keysToLeave = this.keysToLeave; - this.keysToLeave = []; - keysToLeave.forEach(this.performLeave); - } - }, - - performEnter: function performEnter(key) { - // may already remove by exclusive - if (this.refs[key]) { - this.currentlyAnimatingKeys[key] = true; - this.refs[key].componentWillEnter(this.handleDoneAdding.bind(this, key, 'enter')); - } - }, - - performAppear: function performAppear(key) { - if (this.refs[key]) { - this.currentlyAnimatingKeys[key] = true; - this.refs[key].componentWillAppear(this.handleDoneAdding.bind(this, key, 'appear')); - } - }, - - handleDoneAdding: function handleDoneAdding(key, type) { - var props = this.props; - delete this.currentlyAnimatingKeys[key]; - var currentChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props)); - if (!this.isValidChildByKey(currentChildren, key)) { - // exclusive will not need this - this.performLeave(key); - } else { - if (type === 'appear') { - if (_util2['default'].allowAppearCallback(props)) { - props.onAppear(key); - props.onEnd(key, true); - } - } else { - if (_util2['default'].allowEnterCallback(props)) { - props.onEnter(key); - props.onEnd(key, true); - } - } - } - }, - - performLeave: function performLeave(key) { - // may already remove by exclusive - if (this.refs[key]) { - this.currentlyAnimatingKeys[key] = true; - this.refs[key].componentWillLeave(this.handleDoneLeaving.bind(this, key)); - } - }, - - handleDoneLeaving: function handleDoneLeaving(key) { - var props = this.props; - delete this.currentlyAnimatingKeys[key]; - var currentChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props)); - // in case state change is too fast - if (this.isValidChildByKey(currentChildren, key)) { - this.performEnter(key); - } else { - if (_util2['default'].allowLeaveCallback(props)) { - props.onLeave(key); - props.onEnd(key, false); - } - if (this.isMounted() && !(0, _ChildrenUtils.isSameChildren)(this.state.children, currentChildren, props.showProp)) { - this.setState({ - children: currentChildren - }); - } - } - }, - - isValidChildByKey: function isValidChildByKey(currentChildren, key) { - var showProp = this.props.showProp; - if (showProp) { - return (0, _ChildrenUtils.findShownChildInChildrenByKey)(currentChildren, key, showProp); - } - return (0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, key); - }, - - stop: function stop(key) { - delete this.currentlyAnimatingKeys[key]; - var component = this.refs[key]; - if (component) { - component.stop(); - } - }, - - render: function render() { - var props = this.props; - var stateChildren = this.state.children; - var children = null; - if (stateChildren) { - children = stateChildren.map(function (child) { - if (!child.key) { - throw new Error('must set key for children'); - } - return _react2['default'].createElement( - _AnimateChild2['default'], - { - key: child.key, - ref: child.key, - animation: props.animation, - transitionName: props.transitionName, - transitionEnter: props.transitionEnter, - transitionAppear: props.transitionAppear, - transitionLeave: props.transitionLeave }, - child - ); - }); - } - var Component = props.component; - if (Component) { - return _react2['default'].createElement( - Component, - this.props, - children - ); - } - return children[0] || null; - } - }); - - exports['default'] = Animate; - module.exports = exports['default']; - -/***/ }, -/* 217 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, '__esModule', { - value: true - }); - exports.toArrayChildren = toArrayChildren; - exports.findChildInChildrenByKey = findChildInChildrenByKey; - exports.findShownChildInChildrenByKey = findShownChildInChildrenByKey; - exports.findHiddenChildInChildrenByKey = findHiddenChildInChildrenByKey; - exports.isSameChildren = isSameChildren; - exports.mergeChildren = mergeChildren; - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - - var _react = __webpack_require__(3); - - var _react2 = _interopRequireDefault(_react); - - function toArrayChildren(children) { - var ret = []; - _react2['default'].Children.forEach(children, function (child) { - ret.push(child); - }); - return ret; - } - - function findChildInChildrenByKey(children, key) { - var ret = null; - if (children) { - children.forEach(function (child) { - if (ret) { - return; - } - if (child.key === key) { - ret = child; - } - }); - } - return ret; - } - - function findShownChildInChildrenByKey(children, key, showProp) { - var ret = null; - if (children) { - children.forEach(function (child) { - if (child.key === key && child.props[showProp]) { - if (ret) { - throw new Error('two child with same key for children'); - } - ret = child; - } - }); - } - return ret; - } - - function findHiddenChildInChildrenByKey(children, key, showProp) { - var found = 0; - if (children) { - children.forEach(function (child) { - if (found) { - return; - } - found = child.key === key && !child.props[showProp]; - }); - } - return found; - } - - function isSameChildren(c1, c2, showProp) { - var same = c1.length === c2.length; - if (same) { - c1.forEach(function (child, index) { - var child2 = c2[index]; - if (child.key !== child2.key) { - same = false; - } else if (showProp && child.props[showProp] !== child2.props[showProp]) { - same = false; - } - }); - } - return same; - } - - function mergeChildren(prev, next) { - var ret = []; - - // For each key of `next`, the list of keys to insert before that key in - // the combined list - var nextChildrenPending = {}; - var pendingChildren = []; - prev.forEach(function (child) { - if (findChildInChildrenByKey(next, child.key)) { - if (pendingChildren.length) { - nextChildrenPending[child.key] = pendingChildren; - pendingChildren = []; - } - } else { - pendingChildren.push(child); - } - }); - - next.forEach(function (child) { - if (nextChildrenPending.hasOwnProperty(child.key)) { - ret = ret.concat(nextChildrenPending[child.key]); - } - ret.push(child); - }); - - ret = ret.concat(pendingChildren); - - return ret; - } - -/***/ }, -/* 218 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, '__esModule', { - value: true - }); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - - var _react = __webpack_require__(3); - - var _react2 = _interopRequireDefault(_react); - - var _reactDom = __webpack_require__(160); - - var _reactDom2 = _interopRequireDefault(_reactDom); - - var _cssAnimation = __webpack_require__(219); - - var _cssAnimation2 = _interopRequireDefault(_cssAnimation); - - var _util = __webpack_require__(222); - - var _util2 = _interopRequireDefault(_util); - - var transitionMap = { - enter: 'transitionEnter', - appear: 'transitionAppear', - leave: 'transitionLeave' - }; - - var AnimateChild = _react2['default'].createClass({ - displayName: 'AnimateChild', - - propTypes: { - children: _react2['default'].PropTypes.any - }, - - componentWillUnmount: function componentWillUnmount() { - this.stop(); - }, - - componentWillEnter: function componentWillEnter(done) { - if (_util2['default'].isEnterSupported(this.props)) { - this.transition('enter', done); - } else { - done(); - } - }, - - componentWillAppear: function componentWillAppear(done) { - if (_util2['default'].isAppearSupported(this.props)) { - this.transition('appear', done); - } else { - done(); - } - }, - - componentWillLeave: function componentWillLeave(done) { - if (_util2['default'].isLeaveSupported(this.props)) { - this.transition('leave', done); - } else { - done(); - } - }, - - transition: function transition(animationType, finishCallback) { - var _this = this; - - var node = _reactDom2['default'].findDOMNode(this); - var props = this.props; - var transitionName = props.transitionName; - this.stop(); - var end = function end() { - _this.stopper = null; - finishCallback(); - }; - if ((_cssAnimation.isCssAnimationSupported || !props.animation[animationType]) && transitionName && props[transitionMap[animationType]]) { - this.stopper = (0, _cssAnimation2['default'])(node, transitionName + '-' + animationType, end); - } else { - this.stopper = props.animation[animationType](node, end); - } - }, - - stop: function stop() { - var stopper = this.stopper; - if (stopper) { - this.stopper = null; - stopper.stop(); - } - }, - - render: function render() { - return this.props.children; - } - }); - - exports['default'] = AnimateChild; - module.exports = exports['default']; - -/***/ }, -/* 219 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - var Event = __webpack_require__(220); - var Css = __webpack_require__(221); - var isCssAnimationSupported = Event.endEvents.length !== 0; - - function getDuration(node, name) { - var style = window.getComputedStyle(node); - var prefixes = ['-webkit-', '-moz-', '-o-', 'ms-', '']; - var ret = ''; - for (var i = 0; i < prefixes.length; i++) { - ret = style.getPropertyValue(prefixes[i] + name); - if (ret) { - break; - } - } - return ret; - } - - function fixBrowserByTimeout(node) { - if (isCssAnimationSupported) { - var transitionDuration = parseFloat(getDuration(node, 'transition-duration')) || 0; - var animationDuration = parseFloat(getDuration(node, 'animation-duration')) || 0; - var time = Math.max(transitionDuration, animationDuration); - // sometimes, browser bug - node.rcEndAnimTimeout = setTimeout(function () { - node.rcEndAnimTimeout = null; - if (node.rcEndListener) { - node.rcEndListener(); - } - }, time * 1000 + 200); - } - } - - function clearBrowserBugTimeout(node) { - if (node.rcEndAnimTimeout) { - clearTimeout(node.rcEndAnimTimeout); - node.rcEndAnimTimeout = null; - } - } - - var cssAnimation = function cssAnimation(node, transitionName, callback) { - var className = transitionName; - var activeClassName = className + '-active'; - - if (node.rcEndListener) { - node.rcEndListener(); - } - - node.rcEndListener = function (e) { - if (e && e.target !== node) { - return; - } - - if (node.rcAnimTimeout) { - clearTimeout(node.rcAnimTimeout); - node.rcAnimTimeout = null; - } - - clearBrowserBugTimeout(node); - - Css.removeClass(node, className); - Css.removeClass(node, activeClassName); - - Event.removeEndEventListener(node, node.rcEndListener); - node.rcEndListener = null; - - // Usually this optional callback is used for informing an owner of - // a leave animation and telling it to remove the child. - if (callback) { - callback(); - } - }; - - Event.addEndEventListener(node, node.rcEndListener); - - Css.addClass(node, className); - - node.rcAnimTimeout = setTimeout(function () { - node.rcAnimTimeout = null; - Css.addClass(node, activeClassName); - fixBrowserByTimeout(node); - }, 0); - - return { - stop: function stop() { - if (node.rcEndListener) { - node.rcEndListener(); - } - } - }; - }; - - cssAnimation.style = function (node, style, callback) { - if (node.rcEndListener) { - node.rcEndListener(); - } - - node.rcEndListener = function (e) { - if (e && e.target !== node) { - return; - } - - if (node.rcAnimTimeout) { - clearTimeout(node.rcAnimTimeout); - node.rcAnimTimeout = null; - } - - clearBrowserBugTimeout(node); - - Event.removeEndEventListener(node, node.rcEndListener); - node.rcEndListener = null; - - // Usually this optional callback is used for informing an owner of - // a leave animation and telling it to remove the child. - if (callback) { - callback(); - } - }; - - Event.addEndEventListener(node, node.rcEndListener); - - node.rcAnimTimeout = setTimeout(function () { - for (var s in style) { - if (style.hasOwnProperty(s)) { - node.style[s] = style[s]; - } - } - node.rcAnimTimeout = null; - fixBrowserByTimeout(node); - }, 0); - }; - - cssAnimation.setTransition = function (node, p, value) { - var property = p; - var v = value; - if (value === undefined) { - v = property; - property = ''; - } - property = property || ''; - ['Webkit', 'Moz', 'O', - // ms is special .... ! - 'ms'].forEach(function (prefix) { - node.style[prefix + 'Transition' + property] = v; - }); - }; - - cssAnimation.addClass = Css.addClass; - cssAnimation.removeClass = Css.removeClass; - cssAnimation.isCssAnimationSupported = isCssAnimationSupported; - - module.exports = cssAnimation; - -/***/ }, -/* 220 */ -/***/ function(module, exports) { - - 'use strict'; - - var EVENT_NAME_MAP = { - transitionend: { - transition: 'transitionend', - WebkitTransition: 'webkitTransitionEnd', - MozTransition: 'mozTransitionEnd', - OTransition: 'oTransitionEnd', - msTransition: 'MSTransitionEnd' - }, - - animationend: { - animation: 'animationend', - WebkitAnimation: 'webkitAnimationEnd', - MozAnimation: 'mozAnimationEnd', - OAnimation: 'oAnimationEnd', - msAnimation: 'MSAnimationEnd' - } - }; - - var endEvents = []; - - function detectEvents() { - var testEl = document.createElement('div'); - var style = testEl.style; - - if (!('AnimationEvent' in window)) { - delete EVENT_NAME_MAP.animationend.animation; - } - - if (!('TransitionEvent' in window)) { - delete EVENT_NAME_MAP.transitionend.transition; - } - - for (var baseEventName in EVENT_NAME_MAP) { - if (EVENT_NAME_MAP.hasOwnProperty(baseEventName)) { - var baseEvents = EVENT_NAME_MAP[baseEventName]; - for (var styleName in baseEvents) { - if (styleName in style) { - endEvents.push(baseEvents[styleName]); - break; - } - } - } - } - } - - if (typeof window !== 'undefined') { - detectEvents(); - } - - function addEventListener(node, eventName, eventListener) { - node.addEventListener(eventName, eventListener, false); - } - - function removeEventListener(node, eventName, eventListener) { - node.removeEventListener(eventName, eventListener, false); - } - - var TransitionEvents = { - addEndEventListener: function addEndEventListener(node, eventListener) { - if (endEvents.length === 0) { - window.setTimeout(eventListener, 0); - return; - } - endEvents.forEach(function (endEvent) { - addEventListener(node, endEvent, eventListener); - }); - }, - - endEvents: endEvents, - - removeEndEventListener: function removeEndEventListener(node, eventListener) { - if (endEvents.length === 0) { - return; - } - endEvents.forEach(function (endEvent) { - removeEventListener(node, endEvent, eventListener); - }); - } - }; - - module.exports = TransitionEvents; - -/***/ }, -/* 221 */ -/***/ function(module, exports) { - - 'use strict'; - - var SPACE = ' '; - var RE_CLASS = /[\n\t\r]/g; - - function norm(elemClass) { - return (SPACE + elemClass + SPACE).replace(RE_CLASS, SPACE); - } - - module.exports = { - addClass: function addClass(elem, className) { - elem.className += ' ' + className; - }, - - removeClass: function removeClass(elem, n) { - var elemClass = elem.className.trim(); - var className = norm(elemClass); - var needle = n.trim(); - needle = SPACE + needle + SPACE; - // 一个 cls 有可能多次出现:'link link2 link link3 link' - while (className.indexOf(needle) >= 0) { - className = className.replace(needle, SPACE); - } - elem.className = className.trim(); - } - }; - -/***/ }, -/* 222 */ -/***/ function(module, exports) { - - "use strict"; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - var util = { - isAppearSupported: function isAppearSupported(props) { - return props.transitionName && props.transitionAppear || props.animation.appear; - }, - isEnterSupported: function isEnterSupported(props) { - return props.transitionName && props.transitionEnter || props.animation.enter; - }, - isLeaveSupported: function isLeaveSupported(props) { - return props.transitionName && props.transitionLeave || props.animation.leave; - }, - - allowAppearCallback: function allowAppearCallback(props) { - return props.transitionAppear || props.animation.appear; - }, - allowEnterCallback: function allowEnterCallback(props) { - return props.transitionEnter || props.animation.enter; - }, - allowLeaveCallback: function allowLeaveCallback(props) { - return props.transitionLeave || props.animation.leave; - } - }; - exports["default"] = util; - module.exports = exports["default"]; - -/***/ }, -/* 223 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, '__esModule', { - value: true - }); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - - var _react = __webpack_require__(3); - - var _react2 = _interopRequireDefault(_react); - - var PopupInner = _react2['default'].createClass({ - displayName: 'PopupInner', - - propTypes: { - hiddenClassName: _react.PropTypes.string, - className: _react.PropTypes.string, - onMouseEnter: _react.PropTypes.func, - onMouseLeave: _react.PropTypes.func, - children: _react.PropTypes.any - }, - render: function render() { - var props = this.props; - var className = props.className; - if (!props.visible) { - className += ' ' + props.hiddenClassName; - } - return _react2['default'].createElement( - 'div', - { className: className, - onMouseEnter: props.onMouseEnter, - onMouseLeave: props.onMouseLeave, - style: props.style }, - props.children - ); - } - }); - - exports['default'] = PopupInner; - module.exports = exports['default']; - -/***/ }, -/* 224 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, '__esModule', { - value: true - }); - exports.getAlignFromPlacement = getAlignFromPlacement; - exports.getPopupClassNameFromAlign = getPopupClassNameFromAlign; - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - - var _objectAssign = __webpack_require__(187); - - var _objectAssign2 = _interopRequireDefault(_objectAssign); - - function isPointsEq(a1, a2) { - return a1[0] === a2[0] && a1[1] === a2[1]; - } - - function getAlignFromPlacement(builtinPlacements, placementStr, align) { - var baseAlign = builtinPlacements[placementStr] || {}; - return (0, _objectAssign2['default'])({}, baseAlign, align); - } - - function getPopupClassNameFromAlign(builtinPlacements, prefixCls, align) { - var points = align.points; - for (var placement in builtinPlacements) { - if (builtinPlacements.hasOwnProperty(placement)) { - if (isPointsEq(builtinPlacements[placement].points, points)) { - return prefixCls + '-placement-' + placement; - } - } - } - return ''; - } - -/***/ }, -/* 225 */ -/***/ function(module, exports, __webpack_require__) { - - module.exports = { - guid: __webpack_require__(226), - classSet: __webpack_require__(227), - joinClasses: __webpack_require__(228), - KeyCode: __webpack_require__(229), - PureRenderMixin: __webpack_require__(230), - shallowEqual: __webpack_require__(231), - createChainedFunction: __webpack_require__(232), - Dom: { - addEventListener: __webpack_require__(233), - contains: __webpack_require__(234) - }, - Children: { - toArray: __webpack_require__(235), - mapSelf: __webpack_require__(236) - } - }; - - -/***/ }, -/* 226 */ -/***/ function(module, exports) { - - var seed = 0; - module.exports = function () { - return Date.now() + '_' + (seed++); - }; - - -/***/ }, -/* 227 */ -/***/ function(module, exports, __webpack_require__) { - - module.exports = __webpack_require__(177); - - -/***/ }, -/* 228 */ -/***/ function(module, exports) { - - /** - * Copyright 2013-2014, Facebook, Inc. - * All rights reserved. - * - * This file contains an unmodified version of: - * https://github.com/facebook/react/blob/v0.12.0/src/utils/joinClasses.js - * - * This source code is licensed under the BSD-style license found here: - * https://github.com/facebook/react/blob/v0.12.0/LICENSE - * An additional grant of patent rights can be found here: - * https://github.com/facebook/react/blob/v0.12.0/PATENTS - */ - - "use strict"; - - /** - * Combines multiple className strings into one. - * http://jsperf.com/joinclasses-args-vs-array - * - * @param {...?string} classes - * @return {string} - */ - - function joinClasses(className /*, ... */ ) { - if (!className) { - className = ''; - } - var nextClass; - var argLength = arguments.length; - if (argLength > 1) { - for (var ii = 1; ii < argLength; ii++) { - nextClass = arguments[ii]; - if (nextClass) { - className = (className ? className + ' ' : '') + nextClass; - } - } - } - return className; - } - - module.exports = joinClasses; - - -/***/ }, -/* 229 */ -/***/ function(module, exports) { - - /** - * @ignore - * some key-codes definition and utils from closure-library - * @author yiminghe@gmail.com - */ - - var KeyCode = { - /** - * MAC_ENTER - */ - MAC_ENTER: 3, - /** - * BACKSPACE - */ - BACKSPACE: 8, - /** - * TAB - */ - TAB: 9, - /** - * NUMLOCK on FF/Safari Mac - */ - NUM_CENTER: 12, // NUMLOCK on FF/Safari Mac - /** - * ENTER - */ - ENTER: 13, - /** - * SHIFT - */ - SHIFT: 16, - /** - * CTRL - */ - CTRL: 17, - /** - * ALT - */ - ALT: 18, - /** - * PAUSE - */ - PAUSE: 19, - /** - * CAPS_LOCK - */ - CAPS_LOCK: 20, - /** - * ESC - */ - ESC: 27, - /** - * SPACE - */ - SPACE: 32, - /** - * PAGE_UP - */ - PAGE_UP: 33, // also NUM_NORTH_EAST - /** - * PAGE_DOWN - */ - PAGE_DOWN: 34, // also NUM_SOUTH_EAST - /** - * END - */ - END: 35, // also NUM_SOUTH_WEST - /** - * HOME - */ - HOME: 36, // also NUM_NORTH_WEST - /** - * LEFT - */ - LEFT: 37, // also NUM_WEST - /** - * UP - */ - UP: 38, // also NUM_NORTH - /** - * RIGHT - */ - RIGHT: 39, // also NUM_EAST - /** - * DOWN - */ - DOWN: 40, // also NUM_SOUTH - /** - * PRINT_SCREEN - */ - PRINT_SCREEN: 44, - /** - * INSERT - */ - INSERT: 45, // also NUM_INSERT - /** - * DELETE - */ - DELETE: 46, // also NUM_DELETE - /** - * ZERO - */ - ZERO: 48, - /** - * ONE - */ - ONE: 49, - /** - * TWO - */ - TWO: 50, - /** - * THREE - */ - THREE: 51, - /** - * FOUR - */ - FOUR: 52, - /** - * FIVE - */ - FIVE: 53, - /** - * SIX - */ - SIX: 54, - /** - * SEVEN - */ - SEVEN: 55, - /** - * EIGHT - */ - EIGHT: 56, - /** - * NINE - */ - NINE: 57, - /** - * QUESTION_MARK - */ - QUESTION_MARK: 63, // needs localization - /** - * A - */ - A: 65, - /** - * B - */ - B: 66, - /** - * C - */ - C: 67, - /** - * D - */ - D: 68, - /** - * E - */ - E: 69, - /** - * F - */ - F: 70, - /** - * G - */ - G: 71, - /** - * H - */ - H: 72, - /** - * I - */ - I: 73, - /** - * J - */ - J: 74, - /** - * K - */ - K: 75, - /** - * L - */ - L: 76, - /** - * M - */ - M: 77, - /** - * N - */ - N: 78, - /** - * O - */ - O: 79, - /** - * P - */ - P: 80, - /** - * Q - */ - Q: 81, - /** - * R - */ - R: 82, - /** - * S - */ - S: 83, - /** - * T - */ - T: 84, - /** - * U - */ - U: 85, - /** - * V - */ - V: 86, - /** - * W - */ - W: 87, - /** - * X - */ - X: 88, - /** - * Y - */ - Y: 89, - /** - * Z - */ - Z: 90, - /** - * META - */ - META: 91, // WIN_KEY_LEFT - /** - * WIN_KEY_RIGHT - */ - WIN_KEY_RIGHT: 92, - /** - * CONTEXT_MENU - */ - CONTEXT_MENU: 93, - /** - * NUM_ZERO - */ - NUM_ZERO: 96, - /** - * NUM_ONE - */ - NUM_ONE: 97, - /** - * NUM_TWO - */ - NUM_TWO: 98, - /** - * NUM_THREE - */ - NUM_THREE: 99, - /** - * NUM_FOUR - */ - NUM_FOUR: 100, - /** - * NUM_FIVE - */ - NUM_FIVE: 101, - /** - * NUM_SIX - */ - NUM_SIX: 102, - /** - * NUM_SEVEN - */ - NUM_SEVEN: 103, - /** - * NUM_EIGHT - */ - NUM_EIGHT: 104, - /** - * NUM_NINE - */ - NUM_NINE: 105, - /** - * NUM_MULTIPLY - */ - NUM_MULTIPLY: 106, - /** - * NUM_PLUS - */ - NUM_PLUS: 107, - /** - * NUM_MINUS - */ - NUM_MINUS: 109, - /** - * NUM_PERIOD - */ - NUM_PERIOD: 110, - /** - * NUM_DIVISION - */ - NUM_DIVISION: 111, - /** - * F1 - */ - F1: 112, - /** - * F2 - */ - F2: 113, - /** - * F3 - */ - F3: 114, - /** - * F4 - */ - F4: 115, - /** - * F5 - */ - F5: 116, - /** - * F6 - */ - F6: 117, - /** - * F7 - */ - F7: 118, - /** - * F8 - */ - F8: 119, - /** - * F9 - */ - F9: 120, - /** - * F10 - */ - F10: 121, - /** - * F11 - */ - F11: 122, - /** - * F12 - */ - F12: 123, - /** - * NUMLOCK - */ - NUMLOCK: 144, - /** - * SEMICOLON - */ - SEMICOLON: 186, // needs localization - /** - * DASH - */ - DASH: 189, // needs localization - /** - * EQUALS - */ - EQUALS: 187, // needs localization - /** - * COMMA - */ - COMMA: 188, // needs localization - /** - * PERIOD - */ - PERIOD: 190, // needs localization - /** - * SLASH - */ - SLASH: 191, // needs localization - /** - * APOSTROPHE - */ - APOSTROPHE: 192, // needs localization - /** - * SINGLE_QUOTE - */ - SINGLE_QUOTE: 222, // needs localization - /** - * OPEN_SQUARE_BRACKET - */ - OPEN_SQUARE_BRACKET: 219, // needs localization - /** - * BACKSLASH - */ - BACKSLASH: 220, // needs localization - /** - * CLOSE_SQUARE_BRACKET - */ - CLOSE_SQUARE_BRACKET: 221, // needs localization - /** - * WIN_KEY - */ - WIN_KEY: 224, - /** - * MAC_FF_META - */ - MAC_FF_META: 224, // Firefox (Gecko) fires this for the meta key instead of 91 - /** - * WIN_IME + Object.defineProperty(exports, '__esModule', { + value: true + }); + var RE_NUM = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source; + + var getComputedStyleX = undefined; + + function css(el, name, v) { + var value = v; + if (typeof name === 'object') { + for (var i in name) { + if (name.hasOwnProperty(i)) { + css(el, i, name[i]); + } + } + return undefined; + } + if (typeof value !== 'undefined') { + if (typeof value === 'number') { + value = value + 'px'; + } + el.style[name] = value; + return undefined; + } + return getComputedStyleX(el, name); + } + + function getClientPosition(elem) { + var box = undefined; + var x = undefined; + var y = undefined; + var doc = elem.ownerDocument; + var body = doc.body; + var docElem = doc && doc.documentElement; + // 根据 GBS 最新数据,A-Grade Browsers 都已支持 getBoundingClientRect 方法,不用再考虑传统的实现方式 + box = elem.getBoundingClientRect(); + + // 注:jQuery 还考虑减去 docElem.clientLeft/clientTop + // 但测试发现,这样反而会导致当 html 和 body 有边距/边框样式时,获取的值不正确 + // 此外,ie6 会忽略 html 的 margin 值,幸运地是没有谁会去设置 html 的 margin + + x = box.left; + y = box.top; + + // In IE, most of the time, 2 extra pixels are added to the top and left + // due to the implicit 2-pixel inset border. In IE6/7 quirks mode and + // IE6 standards mode, this border can be overridden by setting the + // document element's border to zero -- thus, we cannot rely on the + // offset always being 2 pixels. + + // In quirks mode, the offset can be determined by querying the body's + // clientLeft/clientTop, but in standards mode, it is found by querying + // the document element's clientLeft/clientTop. Since we already called + // getClientBoundingRect we have already forced a reflow, so it is not + // too expensive just to query them all. + + // ie 下应该减去窗口的边框吧,毕竟默认 absolute 都是相对窗口定位的 + // 窗口边框标准是设 documentElement ,quirks 时设置 body + // 最好禁止在 body 和 html 上边框 ,但 ie < 9 html 默认有 2px ,减去 + // 但是非 ie 不可能设置窗口边框,body html 也不是窗口 ,ie 可以通过 html,body 设置 + // 标准 ie 下 docElem.clientTop 就是 border-top + // ie7 html 即窗口边框改变不了。永远为 2 + // 但标准 firefox/chrome/ie9 下 docElem.clientTop 是窗口边框,即使设了 border-top 也为 0 + + x -= docElem.clientLeft || body.clientLeft || 0; + y -= docElem.clientTop || body.clientTop || 0; + + return { left: x, top: y }; + } + + function getScroll(w, top) { + var ret = w['page' + (top ? 'Y' : 'X') + 'Offset']; + var method = 'scroll' + (top ? 'Top' : 'Left'); + if (typeof ret !== 'number') { + var d = w.document; + // ie6,7,8 standard mode + ret = d.documentElement[method]; + if (typeof ret !== 'number') { + // quirks mode + ret = d.body[method]; + } + } + return ret; + } + + function getScrollLeft(w) { + return getScroll(w); + } + + function getScrollTop(w) { + return getScroll(w, true); + } + + function getOffset(el) { + var pos = getClientPosition(el); + var doc = el.ownerDocument; + var w = doc.defaultView || doc.parentWindow; + pos.left += getScrollLeft(w); + pos.top += getScrollTop(w); + return pos; + } + function _getComputedStyle(elem, name, cs) { + var computedStyle = cs; + var val = ''; + var d = elem.ownerDocument; + computedStyle = computedStyle || d.defaultView.getComputedStyle(elem, null); + + // https://github.com/kissyteam/kissy/issues/61 + if (computedStyle) { + val = computedStyle.getPropertyValue(name) || computedStyle[name]; + } + + return val; + } + + var _RE_NUM_NO_PX = new RegExp('^(' + RE_NUM + ')(?!px)[a-z%]+$', 'i'); + var RE_POS = /^(top|right|bottom|left)$/; + var CURRENT_STYLE = 'currentStyle'; + var RUNTIME_STYLE = 'runtimeStyle'; + var LEFT = 'left'; + var PX = 'px'; + + function _getComputedStyleIE(elem, name) { + // currentStyle maybe null + // http://msdn.microsoft.com/en-us/library/ms535231.aspx + var ret = elem[CURRENT_STYLE] && elem[CURRENT_STYLE][name]; + + // 当 width/height 设置为百分比时,通过 pixelLeft 方式转换的 width/height 值 + // 一开始就处理了! CUSTOM_STYLE.height,CUSTOM_STYLE.width ,cssHook 解决@2011-08-19 + // 在 ie 下不对,需要直接用 offset 方式 + // borderWidth 等值也有问题,但考虑到 borderWidth 设为百分比的概率很小,这里就不考虑了 + + // From the awesome hack by Dean Edwards + // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 + // If we're not dealing with a regular pixel number + // but a number that has a weird ending, we need to convert it to pixels + // exclude left right for relativity + if (_RE_NUM_NO_PX.test(ret) && !RE_POS.test(name)) { + // Remember the original values + var style = elem.style; + var left = style[LEFT]; + var rsLeft = elem[RUNTIME_STYLE][LEFT]; + + // prevent flashing of content + elem[RUNTIME_STYLE][LEFT] = elem[CURRENT_STYLE][LEFT]; + + // Put in the new values to get a computed value out + style[LEFT] = name === 'fontSize' ? '1em' : ret || 0; + ret = style.pixelLeft + PX; + + // Revert the changed values + style[LEFT] = left; + + elem[RUNTIME_STYLE][LEFT] = rsLeft; + } + return ret === '' ? 'auto' : ret; + } + + if (typeof window !== 'undefined') { + getComputedStyleX = window.getComputedStyle ? _getComputedStyle : _getComputedStyleIE; + } + + function getOffsetDirection(dir, option) { + if (dir === 'left') { + return option.useCssRight ? 'right' : dir; + } + return option.useCssBottom ? 'bottom' : dir; + } + + function oppositeOffsetDirection(dir) { + if (dir === 'left') { + return 'right'; + } else if (dir === 'right') { + return 'left'; + } else if (dir === 'top') { + return 'bottom'; + } else if (dir === 'bottom') { + return 'top'; + } + } + + // 设置 elem 相对 elem.ownerDocument 的坐标 + function setOffset(elem, offset, option) { + // set position first, in-case top/left are set even on static elem + if (css(elem, 'position') === 'static') { + elem.style.position = 'relative'; + } + var presetH = -999; + var presetV = -999; + var horizontalProperty = getOffsetDirection('left', option); + var verticalProperty = getOffsetDirection('top', option); + var oppositeHorizontalProperty = oppositeOffsetDirection(horizontalProperty); + var oppositeVerticalProperty = oppositeOffsetDirection(verticalProperty); + + if (horizontalProperty !== 'left') { + presetH = 999; + } + + if (verticalProperty !== 'top') { + presetV = 999; + } + + if ('left' in offset) { + elem.style[oppositeHorizontalProperty] = ''; + elem.style[horizontalProperty] = presetH + 'px'; + } + if ('top' in offset) { + elem.style[oppositeVerticalProperty] = ''; + elem.style[verticalProperty] = presetV + 'px'; + } + var old = getOffset(elem); + var ret = {}; + var key = undefined; + for (key in offset) { + if (offset.hasOwnProperty(key)) { + var dir = getOffsetDirection(key, option); + var preset = key === 'left' ? presetH : presetV; + if (dir === key) { + ret[dir] = preset + offset[key] - old[key]; + } else { + ret[dir] = preset + old[key] - offset[key]; + } + } + } + css(elem, ret); + } + + function each(arr, fn) { + for (var i = 0; i < arr.length; i++) { + fn(arr[i]); + } + } + + function isBorderBoxFn(elem) { + return getComputedStyleX(elem, 'boxSizing') === 'border-box'; + } + + var BOX_MODELS = ['margin', 'border', 'padding']; + var CONTENT_INDEX = -1; + var PADDING_INDEX = 2; + var BORDER_INDEX = 1; + var MARGIN_INDEX = 0; + + function swap(elem, options, callback) { + var old = {}; + var style = elem.style; + var name = undefined; + + // Remember the old values, and insert the new ones + for (name in options) { + if (options.hasOwnProperty(name)) { + old[name] = style[name]; + style[name] = options[name]; + } + } + + callback.call(elem); + + // Revert the old values + for (name in options) { + if (options.hasOwnProperty(name)) { + style[name] = old[name]; + } + } + } + + function getPBMWidth(elem, props, which) { + var value = 0; + var prop = undefined; + var j = undefined; + var i = undefined; + for (j = 0; j < props.length; j++) { + prop = props[j]; + if (prop) { + for (i = 0; i < which.length; i++) { + var cssProp = undefined; + if (prop === 'border') { + cssProp = prop + which[i] + 'Width'; + } else { + cssProp = prop + which[i]; + } + value += parseFloat(getComputedStyleX(elem, cssProp)) || 0; + } + } + } + return value; + } + + /** + * A crude way of determining if an object is a window + * @member util + */ + function isWindow(obj) { + // must use == for ie8 + /* eslint eqeqeq:0 */ + return obj !== null && obj !== undefined && obj == obj.window; + } + + var domUtils = {}; + + each(['Width', 'Height'], function (name) { + domUtils['doc' + name] = function (refWin) { + var d = refWin.document; + return Math.max( + // firefox chrome documentElement.scrollHeight< body.scrollHeight + // ie standard mode : documentElement.scrollHeight> body.scrollHeight + d.documentElement['scroll' + name], + // quirks : documentElement.scrollHeight 最大等于可视窗口多一点? + d.body['scroll' + name], domUtils['viewport' + name](d)); + }; + + domUtils['viewport' + name] = function (win) { + // pc browser includes scrollbar in window.innerWidth + var prop = 'client' + name; + var doc = win.document; + var body = doc.body; + var documentElement = doc.documentElement; + var documentElementProp = documentElement[prop]; + // 标准模式取 documentElement + // backcompat 取 body + return doc.compatMode === 'CSS1Compat' && documentElementProp || body && body[prop] || documentElementProp; + }; + }); + + /* + 得到元素的大小信息 + @param elem + @param name + @param {String} [extra] 'padding' : (css width) + padding + 'border' : (css width) + padding + border + 'margin' : (css width) + padding + border + margin + */ + function getWH(elem, name, ex) { + var extra = ex; + if (isWindow(elem)) { + return name === 'width' ? domUtils.viewportWidth(elem) : domUtils.viewportHeight(elem); + } else if (elem.nodeType === 9) { + return name === 'width' ? domUtils.docWidth(elem) : domUtils.docHeight(elem); + } + var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom']; + var borderBoxValue = name === 'width' ? elem.offsetWidth : elem.offsetHeight; + var computedStyle = getComputedStyleX(elem); + var isBorderBox = isBorderBoxFn(elem, computedStyle); + var cssBoxValue = 0; + if (borderBoxValue === null || borderBoxValue === undefined || borderBoxValue <= 0) { + borderBoxValue = undefined; + // Fall back to computed then un computed css if necessary + cssBoxValue = getComputedStyleX(elem, name); + if (cssBoxValue === null || cssBoxValue === undefined || Number(cssBoxValue) < 0) { + cssBoxValue = elem.style[name] || 0; + } + // Normalize '', auto, and prepare for extra + cssBoxValue = parseFloat(cssBoxValue) || 0; + } + if (extra === undefined) { + extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX; + } + var borderBoxValueOrIsBorderBox = borderBoxValue !== undefined || isBorderBox; + var val = borderBoxValue || cssBoxValue; + if (extra === CONTENT_INDEX) { + if (borderBoxValueOrIsBorderBox) { + return val - getPBMWidth(elem, ['border', 'padding'], which, computedStyle); + } + return cssBoxValue; + } else if (borderBoxValueOrIsBorderBox) { + if (extra === BORDER_INDEX) { + return val; + } + return val + (extra === PADDING_INDEX ? -getPBMWidth(elem, ['border'], which, computedStyle) : getPBMWidth(elem, ['margin'], which, computedStyle)); + } + return cssBoxValue + getPBMWidth(elem, BOX_MODELS.slice(extra), which, computedStyle); + } + + var cssShow = { position: 'absolute', visibility: 'hidden', display: 'block' }; + + // fix #119 : https://github.com/kissyteam/kissy/issues/119 + function getWHIgnoreDisplay() { + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + var val = undefined; + var elem = args[0]; + // in case elem is window + // elem.offsetWidth === undefined + if (elem.offsetWidth !== 0) { + val = getWH.apply(undefined, args); + } else { + swap(elem, cssShow, function () { + val = getWH.apply(undefined, args); + }); + } + return val; + } + + each(['width', 'height'], function (name) { + var first = name.charAt(0).toUpperCase() + name.slice(1); + domUtils['outer' + first] = function (el, includeMargin) { + return el && getWHIgnoreDisplay(el, name, includeMargin ? MARGIN_INDEX : BORDER_INDEX); + }; + var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom']; + + domUtils[name] = function (elem, v) { + var val = v; + if (val !== undefined) { + if (elem) { + var computedStyle = getComputedStyleX(elem); + var isBorderBox = isBorderBoxFn(elem); + if (isBorderBox) { + val += getPBMWidth(elem, ['padding', 'border'], which, computedStyle); + } + return css(elem, name, val); + } + return undefined; + } + return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX); + }; + }); + + function mix(to, from) { + for (var i in from) { + if (from.hasOwnProperty(i)) { + to[i] = from[i]; + } + } + return to; + } + + var utils = { + getWindow: function getWindow(node) { + if (node && node.document && node.setTimeout) { + return node; + } + var doc = node.ownerDocument || node; + return doc.defaultView || doc.parentWindow; + }, + offset: function offset(el, value, option) { + if (typeof value !== 'undefined') { + setOffset(el, value, option || {}); + } else { + return getOffset(el); + } + }, + isWindow: isWindow, + each: each, + css: css, + clone: function clone(obj) { + var i = undefined; + var ret = {}; + for (i in obj) { + if (obj.hasOwnProperty(i)) { + ret[i] = obj[i]; + } + } + var overflow = obj.overflow; + if (overflow) { + for (i in obj) { + if (obj.hasOwnProperty(i)) { + ret.overflow[i] = obj.overflow[i]; + } + } + } + return ret; + }, + mix: mix, + getWindowScrollLeft: function getWindowScrollLeft(w) { + return getScrollLeft(w); + }, + getWindowScrollTop: function getWindowScrollTop(w) { + return getScrollTop(w); + }, + merge: function merge() { + var ret = {}; + + for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + args[_key2] = arguments[_key2]; + } + + for (var i = 0; i < args.length; i++) { + utils.mix(ret, args[i]); + } + return ret; + }, + viewportWidth: 0, + viewportHeight: 0 + }; + + mix(utils, domUtils); + + exports['default'] = utils; + module.exports = exports['default']; + +/***/ }, +/* 202 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, '__esModule', { + value: true + }); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + + var _utils = __webpack_require__(201); + + var _utils2 = _interopRequireDefault(_utils); + + /** + * 得到会导致元素显示不全的祖先元素 + */ + + function getOffsetParent(element) { + // ie 这个也不是完全可行 + /* +
+
+ 元素 6 高 100px 宽 50px
+
+
*/ - WIN_IME: 229 + // element.offsetParent does the right thing in ie7 and below. Return parent with layout! + // In other browsers it only includes elements with position absolute, relative or + // fixed, not elements with overflow set to auto or scroll. + // if (UA.ie && ieMode < 8) { + // return element.offsetParent; + // } + // 统一的 offsetParent 方法 + var doc = element.ownerDocument; + var body = doc.body; + var parent = undefined; + var positionStyle = _utils2['default'].css(element, 'position'); + var skipStatic = positionStyle === 'fixed' || positionStyle === 'absolute'; + + if (!skipStatic) { + return element.nodeName.toLowerCase() === 'html' ? null : element.parentNode; + } + + for (parent = element.parentNode; parent && parent !== body; parent = parent.parentNode) { + positionStyle = _utils2['default'].css(parent, 'position'); + if (positionStyle !== 'static') { + return parent; + } + } + return null; + } + + exports['default'] = getOffsetParent; + module.exports = exports['default']; + +/***/ }, +/* 203 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, '__esModule', { + value: true + }); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + + var _utils = __webpack_require__(201); + + var _utils2 = _interopRequireDefault(_utils); + + var _getOffsetParent = __webpack_require__(202); + + var _getOffsetParent2 = _interopRequireDefault(_getOffsetParent); + + /** + * 获得元素的显示部分的区域 + */ + function getVisibleRectForElement(element) { + var visibleRect = { + left: 0, + right: Infinity, + top: 0, + bottom: Infinity + }; + var el = (0, _getOffsetParent2['default'])(element); + var scrollX = undefined; + var scrollY = undefined; + var winSize = undefined; + var doc = element.ownerDocument; + var win = doc.defaultView || doc.parentWindow; + var body = doc.body; + var documentElement = doc.documentElement; + + // Determine the size of the visible rect by climbing the dom accounting for + // all scrollable containers. + while (el) { + // clientWidth is zero for inline block elements in ie. + if ((navigator.userAgent.indexOf('MSIE') === -1 || el.clientWidth !== 0) && + // body may have overflow set on it, yet we still get the entire + // viewport. In some browsers, el.offsetParent may be + // document.documentElement, so check for that too. + el !== body && el !== documentElement && _utils2['default'].css(el, 'overflow') !== 'visible') { + var pos = _utils2['default'].offset(el); + // add border + pos.left += el.clientLeft; + pos.top += el.clientTop; + visibleRect.top = Math.max(visibleRect.top, pos.top); + visibleRect.right = Math.min(visibleRect.right, + // consider area without scrollBar + pos.left + el.clientWidth); + visibleRect.bottom = Math.min(visibleRect.bottom, pos.top + el.clientHeight); + visibleRect.left = Math.max(visibleRect.left, pos.left); + } else if (el === body || el === documentElement) { + break; + } + el = (0, _getOffsetParent2['default'])(el); + } + + // Clip by window's viewport. + scrollX = _utils2['default'].getWindowScrollLeft(win); + scrollY = _utils2['default'].getWindowScrollTop(win); + visibleRect.left = Math.max(visibleRect.left, scrollX); + visibleRect.top = Math.max(visibleRect.top, scrollY); + winSize = { + width: _utils2['default'].viewportWidth(win), + height: _utils2['default'].viewportHeight(win) + }; + visibleRect.right = Math.min(visibleRect.right, scrollX + winSize.width); + visibleRect.bottom = Math.min(visibleRect.bottom, scrollY + winSize.height); + return visibleRect.top >= 0 && visibleRect.left >= 0 && visibleRect.bottom > visibleRect.top && visibleRect.right > visibleRect.left ? visibleRect : null; + } + + exports['default'] = getVisibleRectForElement; + module.exports = exports['default']; + +/***/ }, +/* 204 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, '__esModule', { + value: true + }); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + + var _utils = __webpack_require__(201); + + var _utils2 = _interopRequireDefault(_utils); + + function adjustForViewport(elFuturePos, elRegion, visibleRect, overflow) { + var pos = _utils2['default'].clone(elFuturePos); + var size = { + width: elRegion.width, + height: elRegion.height + }; + + if (overflow.adjustX && pos.left < visibleRect.left) { + pos.left = visibleRect.left; + } + + // Left edge inside and right edge outside viewport, try to resize it. + if (overflow.resizeWidth && pos.left >= visibleRect.left && pos.left + size.width > visibleRect.right) { + size.width -= pos.left + size.width - visibleRect.right; + } + + // Right edge outside viewport, try to move it. + if (overflow.adjustX && pos.left + size.width > visibleRect.right) { + // 保证左边界和可视区域左边界对齐 + pos.left = Math.max(visibleRect.right - size.width, visibleRect.left); + } + + // Top edge outside viewport, try to move it. + if (overflow.adjustY && pos.top < visibleRect.top) { + pos.top = visibleRect.top; + } + + // Top edge inside and bottom edge outside viewport, try to resize it. + if (overflow.resizeHeight && pos.top >= visibleRect.top && pos.top + size.height > visibleRect.bottom) { + size.height -= pos.top + size.height - visibleRect.bottom; + } + + // Bottom edge outside viewport, try to move it. + if (overflow.adjustY && pos.top + size.height > visibleRect.bottom) { + // 保证上边界和可视区域上边界对齐 + pos.top = Math.max(visibleRect.bottom - size.height, visibleRect.top); + } + + return _utils2['default'].mix(pos, size); + } + + exports['default'] = adjustForViewport; + module.exports = exports['default']; + +/***/ }, +/* 205 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, '__esModule', { + value: true + }); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + + var _utils = __webpack_require__(201); + + var _utils2 = _interopRequireDefault(_utils); + + function getRegion(node) { + var offset = undefined; + var w = undefined; + var h = undefined; + if (!_utils2['default'].isWindow(node) && node.nodeType !== 9) { + offset = _utils2['default'].offset(node); + w = _utils2['default'].outerWidth(node); + h = _utils2['default'].outerHeight(node); + } else { + var win = _utils2['default'].getWindow(node); + offset = { + left: _utils2['default'].getWindowScrollLeft(win), + top: _utils2['default'].getWindowScrollTop(win) + }; + w = _utils2['default'].viewportWidth(win); + h = _utils2['default'].viewportHeight(win); + } + offset.width = w; + offset.height = h; + return offset; + } + + exports['default'] = getRegion; + module.exports = exports['default']; + +/***/ }, +/* 206 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, '__esModule', { + value: true + }); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + + var _getAlignOffset = __webpack_require__(207); + + var _getAlignOffset2 = _interopRequireDefault(_getAlignOffset); + + function getElFuturePos(elRegion, refNodeRegion, points, offset, targetOffset) { + var xy = undefined; + var diff = undefined; + var p1 = undefined; + var p2 = undefined; + + xy = { + left: elRegion.left, + top: elRegion.top + }; + + p1 = (0, _getAlignOffset2['default'])(refNodeRegion, points[1]); + p2 = (0, _getAlignOffset2['default'])(elRegion, points[0]); + + diff = [p2.left - p1.left, p2.top - p1.top]; + + return { + left: xy.left - diff[0] + offset[0] - targetOffset[0], + top: xy.top - diff[1] + offset[1] - targetOffset[1] + }; + } + + exports['default'] = getElFuturePos; + module.exports = exports['default']; + +/***/ }, +/* 207 */ +/***/ function(module, exports) { + + /** + * 获取 node 上的 align 对齐点 相对于页面的坐标 + */ + + 'use strict'; + + Object.defineProperty(exports, '__esModule', { + value: true + }); + function getAlignOffset(region, align) { + var V = align.charAt(0); + var H = align.charAt(1); + var w = region.width; + var h = region.height; + var x = undefined; + var y = undefined; + + x = region.left; + y = region.top; + + if (V === 'c') { + y += h / 2; + } else if (V === 'b') { + y += h; + } + + if (H === 'c') { + x += w / 2; + } else if (H === 'r') { + x += w; + } + + return { + left: x, + top: y + }; + } + + exports['default'] = getAlignOffset; + module.exports = exports['default']; + +/***/ }, +/* 208 */ +/***/ function(module, exports) { + + "use strict"; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports["default"] = isWindow; + + function isWindow(obj) { + /* eslint no-eq-null: 0 */ + /* eslint eqeqeq: 0 */ + return obj != null && obj == obj.window; + } + + module.exports = exports["default"]; + +/***/ }, +/* 209 */ +/***/ function(module, exports, __webpack_require__) { + + // export this package's api + 'use strict'; + + module.exports = __webpack_require__(210); + +/***/ }, +/* 210 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, '__esModule', { + value: true + }); + + 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__(3); + + var _react2 = _interopRequireDefault(_react); + + var _ChildrenUtils = __webpack_require__(211); + + var _AnimateChild = __webpack_require__(212); + + var _AnimateChild2 = _interopRequireDefault(_AnimateChild); + + var _util = __webpack_require__(216); + + var _util2 = _interopRequireDefault(_util); + + var defaultKey = 'rc_animate_' + Date.now(); + + function getChildrenFromProps(props) { + var children = props.children; + if (_react2['default'].isValidElement(children)) { + if (!children.key) { + return _react2['default'].cloneElement(children, { + key: defaultKey + }); + } + } + return children; + } + + function noop() {} + + var Animate = _react2['default'].createClass({ + displayName: 'Animate', + + propTypes: { + component: _react2['default'].PropTypes.any, + animation: _react2['default'].PropTypes.object, + transitionName: _react2['default'].PropTypes.string, + transitionEnter: _react2['default'].PropTypes.bool, + transitionAppear: _react2['default'].PropTypes.bool, + exclusive: _react2['default'].PropTypes.bool, + transitionLeave: _react2['default'].PropTypes.bool, + onEnd: _react2['default'].PropTypes.func, + onEnter: _react2['default'].PropTypes.func, + onLeave: _react2['default'].PropTypes.func, + onAppear: _react2['default'].PropTypes.func, + showProp: _react2['default'].PropTypes.string + }, + + getDefaultProps: function getDefaultProps() { + return { + animation: {}, + component: 'span', + transitionEnter: true, + transitionLeave: true, + transitionAppear: false, + onEnd: noop, + onEnter: noop, + onLeave: noop, + onAppear: noop + }; + }, + + getInitialState: function getInitialState() { + this.currentlyAnimatingKeys = {}; + this.keysToEnter = []; + this.keysToLeave = []; + return { + children: (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(this.props)) + }; + }, + + componentDidMount: function componentDidMount() { + var _this = this; + + var showProp = this.props.showProp; + var children = this.state.children; + if (showProp) { + children = children.filter(function (child) { + return !!child.props[showProp]; + }); + } + children.forEach(function (child) { + _this.performAppear(child.key); + }); + }, + + componentWillReceiveProps: function componentWillReceiveProps(nextProps) { + var _this2 = this; + + var nextChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(nextProps)); + var props = this.props; + var showProp = props.showProp; + var currentlyAnimatingKeys = this.currentlyAnimatingKeys; + // last props children if exclusive + // exclusive needs immediate response + var currentChildren = this.state.children; + // in case destroy in showProp mode + var newChildren = []; + if (showProp) { + currentChildren.forEach(function (currentChild) { + var nextChild = (0, _ChildrenUtils.findChildInChildrenByKey)(nextChildren, currentChild.key); + var newChild = undefined; + if ((!nextChild || !nextChild.props[showProp]) && currentChild.props[showProp]) { + newChild = _react2['default'].cloneElement(nextChild || currentChild, _defineProperty({}, showProp, true)); + } else { + newChild = nextChild; + } + if (newChild) { + newChildren.push(newChild); + } + }); + nextChildren.forEach(function (nextChild) { + if (!(0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, nextChild.key)) { + newChildren.push(nextChild); + } + }); + } else { + newChildren = (0, _ChildrenUtils.mergeChildren)(currentChildren, nextChildren); + } + + // need render to avoid update + this.setState({ + children: newChildren + }); + + nextChildren.forEach(function (child) { + var key = child.key; + if (currentlyAnimatingKeys[key]) { + return; + } + var hasPrev = (0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, key); + if (showProp) { + var showInNext = child.props[showProp]; + if (hasPrev) { + var showInNow = (0, _ChildrenUtils.findShownChildInChildrenByKey)(currentChildren, key, showProp); + if (!showInNow && showInNext) { + _this2.keysToEnter.push(key); + } + } else if (showInNext) { + _this2.keysToEnter.push(key); + } + } else if (!hasPrev) { + _this2.keysToEnter.push(key); + } + }); + + currentChildren.forEach(function (child) { + var key = child.key; + if (currentlyAnimatingKeys[key]) { + return; + } + var hasNext = (0, _ChildrenUtils.findChildInChildrenByKey)(nextChildren, key); + if (showProp) { + var showInNow = child.props[showProp]; + if (hasNext) { + var showInNext = (0, _ChildrenUtils.findShownChildInChildrenByKey)(nextChildren, key, showProp); + if (!showInNext && showInNow) { + _this2.keysToLeave.push(key); + } + } else if (showInNow) { + _this2.keysToLeave.push(key); + } + } else if (!hasNext) { + _this2.keysToLeave.push(key); + } + }); + }, + + componentDidUpdate: function componentDidUpdate(prevProps) { + var _this3 = this; + + // exclusive needs immediate response + if (this.props.exclusive && this.props !== prevProps) { + Object.keys(this.currentlyAnimatingKeys).forEach(function (key) { + _this3.stop(key); + }); + } + if (this.isMounted()) { + var keysToEnter = this.keysToEnter; + this.keysToEnter = []; + keysToEnter.forEach(this.performEnter); + var keysToLeave = this.keysToLeave; + this.keysToLeave = []; + keysToLeave.forEach(this.performLeave); + } + }, + + performEnter: function performEnter(key) { + // may already remove by exclusive + if (this.refs[key]) { + this.currentlyAnimatingKeys[key] = true; + this.refs[key].componentWillEnter(this.handleDoneAdding.bind(this, key, 'enter')); + } + }, + + performAppear: function performAppear(key) { + if (this.refs[key]) { + this.currentlyAnimatingKeys[key] = true; + this.refs[key].componentWillAppear(this.handleDoneAdding.bind(this, key, 'appear')); + } + }, + + handleDoneAdding: function handleDoneAdding(key, type) { + var props = this.props; + delete this.currentlyAnimatingKeys[key]; + var currentChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props)); + if (!this.isValidChildByKey(currentChildren, key)) { + // exclusive will not need this + this.performLeave(key); + } else { + if (type === 'appear') { + if (_util2['default'].allowAppearCallback(props)) { + props.onAppear(key); + props.onEnd(key, true); + } + } else { + if (_util2['default'].allowEnterCallback(props)) { + props.onEnter(key); + props.onEnd(key, true); + } + } + } + }, + + performLeave: function performLeave(key) { + // may already remove by exclusive + if (this.refs[key]) { + this.currentlyAnimatingKeys[key] = true; + this.refs[key].componentWillLeave(this.handleDoneLeaving.bind(this, key)); + } + }, + + handleDoneLeaving: function handleDoneLeaving(key) { + var props = this.props; + delete this.currentlyAnimatingKeys[key]; + var currentChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props)); + // in case state change is too fast + if (this.isValidChildByKey(currentChildren, key)) { + this.performEnter(key); + } else { + if (_util2['default'].allowLeaveCallback(props)) { + props.onLeave(key); + props.onEnd(key, false); + } + if (this.isMounted() && !(0, _ChildrenUtils.isSameChildren)(this.state.children, currentChildren, props.showProp)) { + this.setState({ + children: currentChildren + }); + } + } + }, + + isValidChildByKey: function isValidChildByKey(currentChildren, key) { + var showProp = this.props.showProp; + if (showProp) { + return (0, _ChildrenUtils.findShownChildInChildrenByKey)(currentChildren, key, showProp); + } + return (0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, key); + }, + + stop: function stop(key) { + delete this.currentlyAnimatingKeys[key]; + var component = this.refs[key]; + if (component) { + component.stop(); + } + }, + + render: function render() { + var props = this.props; + var stateChildren = this.state.children; + var children = null; + if (stateChildren) { + children = stateChildren.map(function (child) { + if (!child.key) { + throw new Error('must set key for children'); + } + return _react2['default'].createElement( + _AnimateChild2['default'], + { + key: child.key, + ref: child.key, + animation: props.animation, + transitionName: props.transitionName, + transitionEnter: props.transitionEnter, + transitionAppear: props.transitionAppear, + transitionLeave: props.transitionLeave }, + child + ); + }); + } + var Component = props.component; + if (Component) { + return _react2['default'].createElement( + Component, + this.props, + children + ); + } + return children[0] || null; + } + }); + + exports['default'] = Animate; + module.exports = exports['default']; + +/***/ }, +/* 211 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, '__esModule', { + value: true + }); + exports.toArrayChildren = toArrayChildren; + exports.findChildInChildrenByKey = findChildInChildrenByKey; + exports.findShownChildInChildrenByKey = findShownChildInChildrenByKey; + exports.findHiddenChildInChildrenByKey = findHiddenChildInChildrenByKey; + exports.isSameChildren = isSameChildren; + exports.mergeChildren = mergeChildren; + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + + var _react = __webpack_require__(3); + + var _react2 = _interopRequireDefault(_react); + + function toArrayChildren(children) { + var ret = []; + _react2['default'].Children.forEach(children, function (child) { + ret.push(child); + }); + return ret; + } + + function findChildInChildrenByKey(children, key) { + var ret = null; + if (children) { + children.forEach(function (child) { + if (ret) { + return; + } + if (child.key === key) { + ret = child; + } + }); + } + return ret; + } + + function findShownChildInChildrenByKey(children, key, showProp) { + var ret = null; + if (children) { + children.forEach(function (child) { + if (child.key === key && child.props[showProp]) { + if (ret) { + throw new Error('two child with same key for children'); + } + ret = child; + } + }); + } + return ret; + } + + function findHiddenChildInChildrenByKey(children, key, showProp) { + var found = 0; + if (children) { + children.forEach(function (child) { + if (found) { + return; + } + found = child.key === key && !child.props[showProp]; + }); + } + return found; + } + + function isSameChildren(c1, c2, showProp) { + var same = c1.length === c2.length; + if (same) { + c1.forEach(function (child, index) { + var child2 = c2[index]; + if (child.key !== child2.key) { + same = false; + } else if (showProp && child.props[showProp] !== child2.props[showProp]) { + same = false; + } + }); + } + return same; + } + + function mergeChildren(prev, next) { + var ret = []; + + // For each key of `next`, the list of keys to insert before that key in + // the combined list + var nextChildrenPending = {}; + var pendingChildren = []; + prev.forEach(function (child) { + if (findChildInChildrenByKey(next, child.key)) { + if (pendingChildren.length) { + nextChildrenPending[child.key] = pendingChildren; + pendingChildren = []; + } + } else { + pendingChildren.push(child); + } + }); + + next.forEach(function (child) { + if (nextChildrenPending.hasOwnProperty(child.key)) { + ret = ret.concat(nextChildrenPending[child.key]); + } + ret.push(child); + }); + + ret = ret.concat(pendingChildren); + + return ret; + } + +/***/ }, +/* 212 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, '__esModule', { + value: true + }); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + + var _react = __webpack_require__(3); + + var _react2 = _interopRequireDefault(_react); + + var _reactDom = __webpack_require__(160); + + var _reactDom2 = _interopRequireDefault(_reactDom); + + var _cssAnimation = __webpack_require__(213); + + var _cssAnimation2 = _interopRequireDefault(_cssAnimation); + + var _util = __webpack_require__(216); + + var _util2 = _interopRequireDefault(_util); + + var transitionMap = { + enter: 'transitionEnter', + appear: 'transitionAppear', + leave: 'transitionLeave' }; - /* - whether text and modified key is entered at the same time. - */ - KeyCode.isTextModifyingKeyEvent = function (e) { - var keyCode = e.keyCode; - if (e.altKey && !e.ctrlKey || e.metaKey || - // Function keys don't generate text - keyCode >= KeyCode.F1 && keyCode <= KeyCode.F12) { - return false; + var AnimateChild = _react2['default'].createClass({ + displayName: 'AnimateChild', + + propTypes: { + children: _react2['default'].PropTypes.any + }, + + componentWillUnmount: function componentWillUnmount() { + this.stop(); + }, + + componentWillEnter: function componentWillEnter(done) { + if (_util2['default'].isEnterSupported(this.props)) { + this.transition('enter', done); + } else { + done(); + } + }, + + componentWillAppear: function componentWillAppear(done) { + if (_util2['default'].isAppearSupported(this.props)) { + this.transition('appear', done); + } else { + done(); + } + }, + + componentWillLeave: function componentWillLeave(done) { + if (_util2['default'].isLeaveSupported(this.props)) { + this.transition('leave', done); + } else { + done(); + } + }, + + transition: function transition(animationType, finishCallback) { + var _this = this; + + var node = _reactDom2['default'].findDOMNode(this); + var props = this.props; + var transitionName = props.transitionName; + this.stop(); + var end = function end() { + _this.stopper = null; + finishCallback(); + }; + if ((_cssAnimation.isCssAnimationSupported || !props.animation[animationType]) && transitionName && props[transitionMap[animationType]]) { + this.stopper = (0, _cssAnimation2['default'])(node, transitionName + '-' + animationType, end); + } else { + this.stopper = props.animation[animationType](node, end); + } + }, + + stop: function stop() { + var stopper = this.stopper; + if (stopper) { + this.stopper = null; + stopper.stop(); + } + }, + + render: function render() { + return this.props.children; } + }); - // The following keys are quite harmless, even in combination with - // CTRL, ALT or SHIFT. - switch (keyCode) { - case KeyCode.ALT: - case KeyCode.CAPS_LOCK: - case KeyCode.CONTEXT_MENU: - case KeyCode.CTRL: - case KeyCode.DOWN: - case KeyCode.END: - case KeyCode.ESC: - case KeyCode.HOME: - case KeyCode.INSERT: - case KeyCode.LEFT: - case KeyCode.MAC_FF_META: - case KeyCode.META: - case KeyCode.NUMLOCK: - case KeyCode.NUM_CENTER: - case KeyCode.PAGE_DOWN: - case KeyCode.PAGE_UP: - case KeyCode.PAUSE: - case KeyCode.PRINT_SCREEN: - case KeyCode.RIGHT: - case KeyCode.SHIFT: - case KeyCode.UP: - case KeyCode.WIN_KEY: - case KeyCode.WIN_KEY_RIGHT: - return false; - default: - return true; + exports['default'] = AnimateChild; + module.exports = exports['default']; + +/***/ }, +/* 213 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var Event = __webpack_require__(214); + var Css = __webpack_require__(215); + var isCssAnimationSupported = Event.endEvents.length !== 0; + + function getDuration(node, name) { + var style = window.getComputedStyle(node); + var prefixes = ['-webkit-', '-moz-', '-o-', 'ms-', '']; + var ret = ''; + for (var i = 0; i < prefixes.length; i++) { + ret = style.getPropertyValue(prefixes[i] + name); + if (ret) { + break; + } } - }; + return ret; + } - /* - whether character is entered. - */ - KeyCode.isCharacterKey = function (keyCode) { - if (keyCode >= KeyCode.ZERO && - keyCode <= KeyCode.NINE) { - return true; + function fixBrowserByTimeout(node) { + if (isCssAnimationSupported) { + var transitionDuration = parseFloat(getDuration(node, 'transition-duration')) || 0; + var animationDuration = parseFloat(getDuration(node, 'animation-duration')) || 0; + var time = Math.max(transitionDuration, animationDuration); + // sometimes, browser bug + node.rcEndAnimTimeout = setTimeout(function () { + node.rcEndAnimTimeout = null; + if (node.rcEndListener) { + node.rcEndListener(); + } + }, time * 1000 + 200); } + } - if (keyCode >= KeyCode.NUM_ZERO && - keyCode <= KeyCode.NUM_MULTIPLY) { - return true; + function clearBrowserBugTimeout(node) { + if (node.rcEndAnimTimeout) { + clearTimeout(node.rcEndAnimTimeout); + node.rcEndAnimTimeout = null; } + } - if (keyCode >= KeyCode.A && - keyCode <= KeyCode.Z) { - return true; + var cssAnimation = function cssAnimation(node, transitionName, callback) { + var className = transitionName; + var activeClassName = className + '-active'; + + if (node.rcEndListener) { + node.rcEndListener(); } - // Safari sends zero key code for non-latin characters. - if (window.navigation.userAgent.indexOf('WebKit') !== -1 && keyCode === 0) { - return true; + node.rcEndListener = function (e) { + if (e && e.target !== node) { + return; + } + + if (node.rcAnimTimeout) { + clearTimeout(node.rcAnimTimeout); + node.rcAnimTimeout = null; + } + + clearBrowserBugTimeout(node); + + Css.removeClass(node, className); + Css.removeClass(node, activeClassName); + + Event.removeEndEventListener(node, node.rcEndListener); + node.rcEndListener = null; + + // Usually this optional callback is used for informing an owner of + // a leave animation and telling it to remove the child. + if (callback) { + callback(); + } + }; + + Event.addEndEventListener(node, node.rcEndListener); + + Css.addClass(node, className); + + node.rcAnimTimeout = setTimeout(function () { + node.rcAnimTimeout = null; + Css.addClass(node, activeClassName); + fixBrowserByTimeout(node); + }, 0); + + return { + stop: function stop() { + if (node.rcEndListener) { + node.rcEndListener(); + } + } + }; + }; + + cssAnimation.style = function (node, style, callback) { + if (node.rcEndListener) { + node.rcEndListener(); } - switch (keyCode) { - case KeyCode.SPACE: - case KeyCode.QUESTION_MARK: - case KeyCode.NUM_PLUS: - case KeyCode.NUM_MINUS: - case KeyCode.NUM_PERIOD: - case KeyCode.NUM_DIVISION: - case KeyCode.SEMICOLON: - case KeyCode.DASH: - case KeyCode.EQUALS: - case KeyCode.COMMA: - case KeyCode.PERIOD: - case KeyCode.SLASH: - case KeyCode.APOSTROPHE: - case KeyCode.SINGLE_QUOTE: - case KeyCode.OPEN_SQUARE_BRACKET: - case KeyCode.BACKSLASH: - case KeyCode.CLOSE_SQUARE_BRACKET: - return true; - default: - return false; + node.rcEndListener = function (e) { + if (e && e.target !== node) { + return; + } + + if (node.rcAnimTimeout) { + clearTimeout(node.rcAnimTimeout); + node.rcAnimTimeout = null; + } + + clearBrowserBugTimeout(node); + + Event.removeEndEventListener(node, node.rcEndListener); + node.rcEndListener = null; + + // Usually this optional callback is used for informing an owner of + // a leave animation and telling it to remove the child. + if (callback) { + callback(); + } + }; + + Event.addEndEventListener(node, node.rcEndListener); + + node.rcAnimTimeout = setTimeout(function () { + for (var s in style) { + if (style.hasOwnProperty(s)) { + node.style[s] = style[s]; + } + } + node.rcAnimTimeout = null; + fixBrowserByTimeout(node); + }, 0); + }; + + cssAnimation.setTransition = function (node, p, value) { + var property = p; + var v = value; + if (value === undefined) { + v = property; + property = ''; } + property = property || ''; + ['Webkit', 'Moz', 'O', + // ms is special .... ! + 'ms'].forEach(function (prefix) { + node.style[prefix + 'Transition' + property] = v; + }); }; - module.exports = KeyCode; - + cssAnimation.addClass = Css.addClass; + cssAnimation.removeClass = Css.removeClass; + cssAnimation.isCssAnimationSupported = isCssAnimationSupported; + + module.exports = cssAnimation; /***/ }, -/* 230 */ -/***/ function(module, exports, __webpack_require__) { +/* 214 */ +/***/ function(module, exports) { - /** - * Copyright 2013-2014, 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 ReactComponentWithPureRenderMixin - */ - - "use strict"; + 'use strict'; - var shallowEqual = __webpack_require__(231); + var EVENT_NAME_MAP = { + transitionend: { + transition: 'transitionend', + WebkitTransition: 'webkitTransitionEnd', + MozTransition: 'mozTransitionEnd', + OTransition: 'oTransitionEnd', + msTransition: 'MSTransitionEnd' + }, - /** - * If your React component's render function is "pure", e.g. it will render the - * same result given the same props and state, provide this Mixin for a - * considerable performance boost. - * - * Most React components have pure render functions. - * - * Example: - * - * var ReactComponentWithPureRenderMixin = - * require('ReactComponentWithPureRenderMixin'); - * React.createClass({ - * mixins: [ReactComponentWithPureRenderMixin], - * - * render: function() { - * return
foo
; - * } - * }); - * - * Note: This only checks shallow equality for props and state. If these contain - * complex data structures this mixin may have false-negatives for deeper - * differences. Only mixin to components which have simple props and state, or - * use `forceUpdate()` when you know deep data structures have changed. - */ - var ReactComponentWithPureRenderMixin = { - shouldComponentUpdate: function(nextProps, nextState) { - return !shallowEqual(this.props, nextProps) || - !shallowEqual(this.state, nextState); + animationend: { + animation: 'animationend', + WebkitAnimation: 'webkitAnimationEnd', + MozAnimation: 'mozAnimationEnd', + OAnimation: 'oAnimationEnd', + msAnimation: 'MSAnimationEnd' } }; - module.exports = ReactComponentWithPureRenderMixin; - - -/***/ }, -/* 231 */ -/***/ function(module, exports) { - - /** - * Copyright 2013-2014, 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 shallowEqual - */ + var endEvents = []; - "use strict"; + function detectEvents() { + var testEl = document.createElement('div'); + var style = testEl.style; - /** - * Performs equality by iterating through keys on an object and returning - * false when any key has values which are not strictly equal between - * objA and objB. Returns true when the values of all keys are strictly equal. - * - * @return {boolean} - */ - function shallowEqual(objA, objB) { - if (objA === objB) { - return true; + if (!('AnimationEvent' in window)) { + delete EVENT_NAME_MAP.animationend.animation; } - var key; - // Test for A's keys different from B. - for (key in objA) { - if (objA.hasOwnProperty(key) && - (!objB.hasOwnProperty(key) || objA[key] !== objB[key])) { - return false; - } + + if (!('TransitionEvent' in window)) { + delete EVENT_NAME_MAP.transitionend.transition; } - // Test for B's keys missing from A. - for (key in objB) { - if (objB.hasOwnProperty(key) && !objA.hasOwnProperty(key)) { - return false; + + for (var baseEventName in EVENT_NAME_MAP) { + if (EVENT_NAME_MAP.hasOwnProperty(baseEventName)) { + var baseEvents = EVENT_NAME_MAP[baseEventName]; + for (var styleName in baseEvents) { + if (styleName in style) { + endEvents.push(baseEvents[styleName]); + break; + } + } } } - return true; } - module.exports = shallowEqual; - + if (typeof window !== 'undefined') { + detectEvents(); + } + + function addEventListener(node, eventName, eventListener) { + node.addEventListener(eventName, eventListener, false); + } + + function removeEventListener(node, eventName, eventListener) { + node.removeEventListener(eventName, eventListener, false); + } + + var TransitionEvents = { + addEndEventListener: function addEndEventListener(node, eventListener) { + if (endEvents.length === 0) { + window.setTimeout(eventListener, 0); + return; + } + endEvents.forEach(function (endEvent) { + addEventListener(node, endEvent, eventListener); + }); + }, + + endEvents: endEvents, + + removeEndEventListener: function removeEndEventListener(node, eventListener) { + if (endEvents.length === 0) { + return; + } + endEvents.forEach(function (endEvent) { + removeEventListener(node, endEvent, eventListener); + }); + } + }; + + module.exports = TransitionEvents; /***/ }, -/* 232 */ +/* 215 */ /***/ function(module, exports) { - /** - * Safe chained function - * - * Will only create a new function if needed, - * otherwise will pass back existing functions or null. - * - * @returns {function|null} - */ - function createChainedFunction() { - var args = arguments; + 'use strict'; - return function chainedFunction() { - for (var i = 0; i < args.length; i++) { - if (args[i] && args[i].apply) { - args[i].apply(this, arguments); - } - } - }; + var SPACE = ' '; + var RE_CLASS = /[\n\t\r]/g; + + function norm(elemClass) { + return (SPACE + elemClass + SPACE).replace(RE_CLASS, SPACE); } - module.exports = createChainedFunction; - - -/***/ }, -/* 233 */ -/***/ function(module, exports, __webpack_require__) { - - var addDOMEventListener = __webpack_require__(184); + module.exports = { + addClass: function addClass(elem, className) { + elem.className += ' ' + className; + }, - module.exports = addDOMEventListener['default'] || addDOMEventListener; - + removeClass: function removeClass(elem, n) { + var elemClass = elem.className.trim(); + var className = norm(elemClass); + var needle = n.trim(); + needle = SPACE + needle + SPACE; + // 一个 cls 有可能多次出现:'link link2 link link3 link' + while (className.indexOf(needle) >= 0) { + className = className.replace(needle, SPACE); + } + elem.className = className.trim(); + } + }; /***/ }, -/* 234 */ +/* 216 */ /***/ function(module, exports) { - module.exports = function (root, node) { - while (node) { - if (node === root) { - return true; - } - node = node.parentNode; + "use strict"; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + var util = { + isAppearSupported: function isAppearSupported(props) { + return props.transitionName && props.transitionAppear || props.animation.appear; + }, + isEnterSupported: function isEnterSupported(props) { + return props.transitionName && props.transitionEnter || props.animation.enter; + }, + isLeaveSupported: function isLeaveSupported(props) { + return props.transitionName && props.transitionLeave || props.animation.leave; + }, + + allowAppearCallback: function allowAppearCallback(props) { + return props.transitionAppear || props.animation.appear; + }, + allowEnterCallback: function allowEnterCallback(props) { + return props.transitionEnter || props.animation.enter; + }, + allowLeaveCallback: function allowLeaveCallback(props) { + return props.transitionLeave || props.animation.leave; } - - return false; }; - + exports["default"] = util; + module.exports = exports["default"]; /***/ }, -/* 235 */ +/* 217 */ /***/ function(module, exports, __webpack_require__) { - var React = __webpack_require__(3); + 'use strict'; - module.exports = function (children) { - var ret = []; - React.Children.forEach(children, function (c) { - ret.push(c); - }); - return ret; - }; - + Object.defineProperty(exports, '__esModule', { + value: true + }); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + + var _react = __webpack_require__(3); + + var _react2 = _interopRequireDefault(_react); + + var PopupInner = _react2['default'].createClass({ + displayName: 'PopupInner', + + propTypes: { + hiddenClassName: _react.PropTypes.string, + className: _react.PropTypes.string, + onMouseEnter: _react.PropTypes.func, + onMouseLeave: _react.PropTypes.func, + children: _react.PropTypes.any + }, + render: function render() { + var props = this.props; + var className = props.className; + if (!props.visible) { + className += ' ' + props.hiddenClassName; + } + return _react2['default'].createElement( + 'div', + { className: className, + onMouseEnter: props.onMouseEnter, + onMouseLeave: props.onMouseLeave, + style: props.style }, + props.children + ); + } + }); + + exports['default'] = PopupInner; + module.exports = exports['default']; /***/ }, -/* 236 */ +/* 218 */ /***/ function(module, exports, __webpack_require__) { - var React = __webpack_require__(3); + 'use strict'; - function mirror(o) { - return o; + Object.defineProperty(exports, '__esModule', { + value: true + }); + exports.getAlignFromPlacement = getAlignFromPlacement; + exports.getPopupClassNameFromAlign = getPopupClassNameFromAlign; + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + + var _objectAssign = __webpack_require__(193); + + var _objectAssign2 = _interopRequireDefault(_objectAssign); + + function isPointsEq(a1, a2) { + return a1[0] === a2[0] && a1[1] === a2[1]; } - module.exports = function (children) { - // return ReactFragment - return React.Children.map(children, mirror); - }; - + function getAlignFromPlacement(builtinPlacements, placementStr, align) { + var baseAlign = builtinPlacements[placementStr] || {}; + return (0, _objectAssign2['default'])({}, baseAlign, align); + } + + function getPopupClassNameFromAlign(builtinPlacements, prefixCls, align) { + var points = align.points; + for (var placement in builtinPlacements) { + if (builtinPlacements.hasOwnProperty(placement)) { + if (isPointsEq(builtinPlacements[placement].points, points)) { + return prefixCls + '-placement-' + placement; + } + } + } + return ''; + } /***/ }, -/* 237 */ +/* 219 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -28018,27 +27290,15 @@ webpackJsonp([0,1],[ var _react2 = _interopRequireDefault(_react); - var _classnames = __webpack_require__(177); - - var _classnames2 = _interopRequireDefault(_classnames); - - var _gregorianCalendar = __webpack_require__(161); - - var _gregorianCalendar2 = _interopRequireDefault(_gregorianCalendar); - - var _gregorianCalendarLibLocaleZh_CN = __webpack_require__(168); - - var _gregorianCalendarLibLocaleZh_CN2 = _interopRequireDefault(_gregorianCalendarLibLocaleZh_CN); - - var _mixinCommonMixin = __webpack_require__(238); + var _mixinCommonMixin = __webpack_require__(220); var _mixinCommonMixin2 = _interopRequireDefault(_mixinCommonMixin); - var _Header = __webpack_require__(241); + var _Header = __webpack_require__(222); var _Header2 = _interopRequireDefault(_Header); - var _Combobox = __webpack_require__(242); + var _Combobox = __webpack_require__(223); var _Combobox2 = _interopRequireDefault(_Combobox); @@ -28058,11 +27318,16 @@ webpackJsonp([0,1],[ value: _react.PropTypes.object, locale: _react.PropTypes.object, placeholder: _react.PropTypes.string, + gregorianCalendarLocale: _react.PropTypes.object, formatter: _react.PropTypes.object, hourOptions: _react.PropTypes.array, minuteOptions: _react.PropTypes.array, secondOptions: _react.PropTypes.array, onChange: _react.PropTypes.func, + onEsc: _react.PropTypes.func, + allowEmpty: _react.PropTypes.bool, + showHour: _react.PropTypes.bool, + showSecond: _react.PropTypes.bool, onClear: _react.PropTypes.func }, @@ -28079,26 +27344,11 @@ webpackJsonp([0,1],[ }, getInitialState: function getInitialState() { - var value = this.props.value; - if (!value) { - value = new _gregorianCalendar2['default'](_gregorianCalendarLibLocaleZh_CN2['default']); - value.setTime(Date.now()); - } return { - value: value + value: this.props.value }; }, - componentWillMount: function componentWillMount() { - var formatter = this.props.formatter; - var pattern = formatter.originalPattern; - if (pattern === 'HH:mm') { - this.showSecond = false; - } else if (pattern === 'mm:ss') { - this.showHour = false; - } - }, - componentWillReceiveProps: function componentWillReceiveProps(nextProps) { var value = nextProps.value; if (value) { @@ -28117,9 +27367,6 @@ webpackJsonp([0,1],[ this.props.onClear(); }, - showHour: true, - showSecond: true, - render: function render() { var _props = this.props; var locale = _props.locale; @@ -28128,34 +27375,39 @@ webpackJsonp([0,1],[ var hourOptions = _props.hourOptions; var minuteOptions = _props.minuteOptions; var secondOptions = _props.secondOptions; + var allowEmpty = _props.allowEmpty; + var showHour = _props.showHour; + var showSecond = _props.showSecond; + var formatter = _props.formatter; + var gregorianCalendarLocale = _props.gregorianCalendarLocale; var value = this.state.value; - var cls = (0, _classnames2['default'])({ 'narrow': !this.showHour || !this.showSecond }); - return _react2['default'].createElement( 'div', - { className: prefixCls + '-panel-inner ' + cls }, + { className: prefixCls + '-inner' }, _react2['default'].createElement(_Header2['default'], { prefixCls: prefixCls, - gregorianTimePickerLocale: value.locale, + gregorianCalendarLocale: gregorianCalendarLocale, locale: locale, value: value, - formatter: this.getFormatter(), + onEsc: this.props.onEsc, + formatter: formatter, placeholder: placeholder, hourOptions: hourOptions, minuteOptions: minuteOptions, secondOptions: secondOptions, onChange: this.onChange, onClear: this.onClear, - showClear: true + allowEmpty: allowEmpty }), _react2['default'].createElement(_Combobox2['default'], { prefixCls: prefixCls, value: value, - formatter: this.getFormatter(), + gregorianCalendarLocale: gregorianCalendarLocale, + formatter: formatter, onChange: this.onChange, - showHour: this.showHour, - showSecond: this.showSecond, + showHour: showHour, + showSecond: showSecond, hourOptions: hourOptions, minuteOptions: minuteOptions, secondOptions: secondOptions @@ -28168,7 +27420,7 @@ webpackJsonp([0,1],[ module.exports = exports['default']; /***/ }, -/* 238 */ +/* 220 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -28181,12 +27433,10 @@ webpackJsonp([0,1],[ var _react = __webpack_require__(3); - var _localeEn_US = __webpack_require__(239); + var _localeEn_US = __webpack_require__(221); var _localeEn_US2 = _interopRequireDefault(_localeEn_US); - var _utilIndex = __webpack_require__(240); - exports['default'] = { propTypes: { prefixCls: _react.PropTypes.string, @@ -28198,41 +27448,12 @@ webpackJsonp([0,1],[ prefixCls: 'rc-time-picker', locale: _localeEn_US2['default'] }; - }, - - getFormatter: function getFormatter() { - var formatter = this.props.formatter; - var locale = this.props.locale; - if (formatter) { - if (formatter === this.lastFormatter) { - return this.normalFormatter; - } - this.normalFormatter = (0, _utilIndex.getFormatter)(formatter, locale); - this.lastFormatter = formatter; - return this.normalFormatter; - } - if (!this.showSecond) { - if (!this.notShowSecondFormatter) { - this.notShowSecondFormatter = (0, _utilIndex.getFormatter)('HH:mm', locale); - } - return this.notShowSecondFormatter; - } - if (!this.showHour) { - if (!this.notShowHourFormatter) { - this.notShowHourFormatter = (0, _utilIndex.getFormatter)('mm:ss', locale); - } - return this.notShowHourFormatter; - } - if (!this.normalFormatter) { - this.normalFormatter = (0, _utilIndex.getFormatter)('HH:mm:ss', locale); - } - return this.normalFormatter; } }; module.exports = exports['default']; /***/ }, -/* 239 */ +/* 221 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -28254,31 +27475,7 @@ webpackJsonp([0,1],[ module.exports = exports['default']; /***/ }, -/* 240 */ -/***/ function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, '__esModule', { - value: true - }); - exports.getFormatter = getFormatter; - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - - var _gregorianCalendarFormat = __webpack_require__(165); - - var _gregorianCalendarFormat2 = _interopRequireDefault(_gregorianCalendarFormat); - - function getFormatter(format, locale) { - if (typeof format === 'string') { - return new _gregorianCalendarFormat2['default'](format, locale.format); - } - return format; - } - -/***/ }, -/* 241 */ +/* 222 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -28299,7 +27496,7 @@ webpackJsonp([0,1],[ propTypes: { formatter: _react.PropTypes.object, prefixCls: _react.PropTypes.string, - gregorianTimePickerLocale: _react.PropTypes.object, + gregorianCalendarLocale: _react.PropTypes.object, locale: _react.PropTypes.object, disabledDate: _react.PropTypes.func, placeholder: _react.PropTypes.string, @@ -28309,7 +27506,8 @@ webpackJsonp([0,1],[ secondOptions: _react.PropTypes.array, onChange: _react.PropTypes.func, onClear: _react.PropTypes.func, - showClear: _react.PropTypes.bool + onEsc: _react.PropTypes.func, + allowEmpty: _react.PropTypes.bool }, getInitialState: function getInitialState() { @@ -28320,6 +27518,14 @@ webpackJsonp([0,1],[ }; }, + componentDidMount: function componentDidMount() { + var _this = this; + + this.timer = setTimeout(function () { + _this.refs.input.focus(); + }, 0); + }, + componentWillReceiveProps: function componentWillReceiveProps(nextProps) { var value = nextProps.value; this.setState({ @@ -28328,6 +27534,10 @@ webpackJsonp([0,1],[ }); }, + componentWillUnmount: function componentWillUnmount() { + clearTimeout(this.timer); + }, + onInputChange: function onInputChange(event) { var str = event.target.value; this.setState({ @@ -28336,17 +27546,18 @@ webpackJsonp([0,1],[ var value = null; var _props = this.props; var formatter = _props.formatter; - var gregorianTimePickerLocale = _props.gregorianTimePickerLocale; + var gregorianCalendarLocale = _props.gregorianCalendarLocale; var hourOptions = _props.hourOptions; var minuteOptions = _props.minuteOptions; var secondOptions = _props.secondOptions; var onChange = _props.onChange; + var allowEmpty = _props.allowEmpty; if (str) { var originalValue = this.props.value; try { value = formatter.parse(str, { - locale: gregorianTimePickerLocale, + locale: gregorianCalendarLocale, obeyCount: true }); } catch (ex) { @@ -28377,8 +27588,13 @@ webpackJsonp([0,1],[ }); return; } - } else { + } else if (allowEmpty) { onChange(null); + } else { + this.setState({ + invalid: true + }); + return; } this.setState({ @@ -28386,6 +27602,12 @@ webpackJsonp([0,1],[ }); }, + onKeyDown: function onKeyDown(e) { + if (e.keyCode === 27) { + this.props.onEsc(); + } + }, + onClear: function onClear() { this.setState({ str: '' }); this.props.onClear(); @@ -28395,9 +27617,9 @@ webpackJsonp([0,1],[ var _props2 = this.props; var locale = _props2.locale; var prefixCls = _props2.prefixCls; - var showClear = _props2.showClear; + var allowEmpty = _props2.allowEmpty; - if (!showClear) { + if (!allowEmpty) { return null; } return _react2['default'].createElement('a', { className: prefixCls + '-clear-btn', role: 'button', title: locale.clear, onMouseDown: this.onClear }); @@ -28412,7 +27634,11 @@ webpackJsonp([0,1],[ var str = _state.str; var invalidClass = invalid ? prefixCls + '-input-invalid' : ''; - return _react2['default'].createElement('input', { className: prefixCls + '-input ' + invalidClass, value: str, placeholder: placeholder, onChange: this.onInputChange }); + return _react2['default'].createElement('input', { className: prefixCls + '-input ' + invalidClass, + ref: 'input', + onKeyDown: this.onKeyDown, + value: str, + placeholder: placeholder, onChange: this.onInputChange }); }, render: function render() { @@ -28431,7 +27657,7 @@ webpackJsonp([0,1],[ module.exports = exports['default']; /***/ }, -/* 242 */ +/* 223 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -28446,10 +27672,14 @@ webpackJsonp([0,1],[ var _react2 = _interopRequireDefault(_react); - var _Select = __webpack_require__(243); + var _Select = __webpack_require__(224); var _Select2 = _interopRequireDefault(_Select); + var _gregorianCalendar = __webpack_require__(161); + + var _gregorianCalendar2 = _interopRequireDefault(_gregorianCalendar); + var formatOption = function formatOption(option) { if (option < 10) { return '0' + option; @@ -28466,6 +27696,7 @@ webpackJsonp([0,1],[ value: _react.PropTypes.object, onChange: _react.PropTypes.func, showHour: _react.PropTypes.bool, + gregorianCalendarLocale: _react.PropTypes.object, showSecond: _react.PropTypes.bool, hourOptions: _react.PropTypes.array, minuteOptions: _react.PropTypes.array, @@ -28473,10 +27704,14 @@ webpackJsonp([0,1],[ }, onItemChange: function onItemChange(type, itemValue) { - var _props = this.props; - var value = _props.value; - var onChange = _props.onChange; + var onChange = this.props.onChange; + var value = this.props.value; + if (value) { + value = value.clone(); + } else { + value = this.getNow().clone(); + } if (type === 'hour') { value.setHourOfDay(itemValue); } else if (type === 'minute') { @@ -28488,10 +27723,10 @@ webpackJsonp([0,1],[ }, getHourSelect: function getHourSelect(hour) { - var _props2 = this.props; - var prefixCls = _props2.prefixCls; - var hourOptions = _props2.hourOptions; - var showHour = _props2.showHour; + var _props = this.props; + var prefixCls = _props.prefixCls; + var hourOptions = _props.hourOptions; + var showHour = _props.showHour; if (!showHour) { return null; @@ -28508,9 +27743,9 @@ webpackJsonp([0,1],[ }, getMinuteSelect: function getMinuteSelect(minute) { - var _props3 = this.props; - var prefixCls = _props3.prefixCls; - var minuteOptions = _props3.minuteOptions; + var _props2 = this.props; + var prefixCls = _props2.prefixCls; + var minuteOptions = _props2.minuteOptions; return _react2['default'].createElement(_Select2['default'], { prefixCls: prefixCls, @@ -28524,10 +27759,10 @@ webpackJsonp([0,1],[ }, getSectionSelect: function getSectionSelect(second) { - var _props4 = this.props; - var prefixCls = _props4.prefixCls; - var secondOptions = _props4.secondOptions; - var showSecond = _props4.showSecond; + var _props3 = this.props; + var prefixCls = _props3.prefixCls; + var secondOptions = _props3.secondOptions; + var showSecond = _props3.showSecond; if (!showSecond) { return null; @@ -28543,11 +27778,20 @@ webpackJsonp([0,1],[ }); }, + getNow: function getNow() { + if (this.showNow) { + return this.showNow; + } + var value = new _gregorianCalendar2['default'](this.props.gregorianCalendarLocale); + value.setTime(Date.now()); + this.showNow = value; + return value; + }, + render: function render() { - var _props5 = this.props; - var prefixCls = _props5.prefixCls; - var value = _props5.value; + var prefixCls = this.props.prefixCls; + var value = this.props.value || this.getNow(); return _react2['default'].createElement( 'div', { className: prefixCls + '-combobox' }, @@ -28562,7 +27806,7 @@ webpackJsonp([0,1],[ module.exports = exports['default']; /***/ }, -/* 243 */ +/* 224 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -28573,6 +27817,8 @@ webpackJsonp([0,1],[ 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__(3); var _react2 = _interopRequireDefault(_react); @@ -28581,9 +27827,9 @@ webpackJsonp([0,1],[ var _reactDom2 = _interopRequireDefault(_reactDom); - var _classnames = __webpack_require__(177); + var _classnames2 = __webpack_require__(178); - var _classnames2 = _interopRequireDefault(_classnames); + var _classnames3 = _interopRequireDefault(_classnames2); var scrollTo = function scrollTo(element, to, duration) { // jump to target if duration zero @@ -28607,6 +27853,7 @@ webpackJsonp([0,1],[ propTypes: { prefixCls: _react.PropTypes.string, options: _react.PropTypes.array, + gregorianCalendarLocale: _react.PropTypes.object, selectedIndex: _react.PropTypes.number, type: _react.PropTypes.string, onSelect: _react.PropTypes.func @@ -28622,17 +27869,11 @@ webpackJsonp([0,1],[ this.scrollToSelected(200); }, - onSelect: function onSelect(event) { - // do nothing when select selected option - if (event.target.getAttribute('class') === 'selected') { - return; - } - // change combobox selection + onSelect: function onSelect(value) { var _props = this.props; var onSelect = _props.onSelect; var type = _props.type; - var value = parseInt(event.target.innerHTML, 10); onSelect(type, value); }, @@ -28642,13 +27883,14 @@ webpackJsonp([0,1],[ var _props2 = this.props; var options = _props2.options; var selectedIndex = _props2.selectedIndex; + var prefixCls = _props2.prefixCls; return options.map(function (item, index) { - var cls = (0, _classnames2['default'])({ selected: selectedIndex === index }); - var ref = selectedIndex === index ? 'selected' : null; + var selected = selectedIndex === index; + var cls = (0, _classnames3['default'])(_defineProperty({}, prefixCls + '-select-option-selected', selected)); return _react2['default'].createElement( 'li', - { ref: ref, className: cls, key: index, onClick: _this.onSelect }, + { className: cls, key: index, onClick: _this.onSelect.bind(_this, +item) }, item ); }); @@ -28690,7 +27932,7 @@ webpackJsonp([0,1],[ module.exports = exports['default']; /***/ }, -/* 244 */ +/* 225 */ /***/ function(module, exports) { 'use strict'; @@ -28736,7 +27978,31 @@ webpackJsonp([0,1],[ module.exports = exports['default']; /***/ }, -/* 245 */ +/* 226 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, '__esModule', { + value: true + }); + exports.getFormatter = getFormatter; + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + + var _gregorianCalendarFormat = __webpack_require__(165); + + var _gregorianCalendarFormat2 = _interopRequireDefault(_gregorianCalendarFormat); + + function getFormatter(format, locale) { + if (typeof format === 'string') { + return new _gregorianCalendarFormat2['default'](format, locale.format); + } + return format; + } + +/***/ }, +/* 227 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; @@ -28747,7 +28013,7 @@ webpackJsonp([0,1],[ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } - var _gregorianCalendarFormatLibLocaleZh_CN = __webpack_require__(246); + var _gregorianCalendarFormatLibLocaleZh_CN = __webpack_require__(228); var _gregorianCalendarFormatLibLocaleZh_CN2 = _interopRequireDefault(_gregorianCalendarFormatLibLocaleZh_CN); @@ -28758,7 +28024,7 @@ webpackJsonp([0,1],[ module.exports = exports['default']; /***/ }, -/* 246 */ +/* 228 */ /***/ function(module, exports) { 'use strict'; -- cgit v1.2.3