/*!
* antd-mobile v1.1.0
*
* Copyright 2015-present, Alipay, Inc.
* All rights reserved.
*/
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("react"), require("react-dom"));
else if(typeof define === 'function' && define.amd)
define(["react", "react-dom"], factory);
else if(typeof exports === 'object')
exports["antd-mobile"] = factory(require("react"), require("react-dom"));
else
root["antd-mobile"] = factory(root["React"], root["ReactDOM"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_1__, __WEBPACK_EXTERNAL_MODULE_10__) {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ((function(modules) {
// Check all modules for deduplicated modules
for(var i in modules) {
if(Object.prototype.hasOwnProperty.call(modules, i)) {
switch(typeof modules[i]) {
case "function": break;
case "object":
// Module can be created from a template
modules[i] = (function(_m) {
var args = _m.slice(1), fn = modules[_m[0]];
return function (a,b,c) {
fn.apply(this, [a,b,c].concat(args));
};
}(modules[i]));
break;
default:
// Module is a copy of another module
modules[i] = modules[modules[i]];
break;
}
}
}
return modules;
}([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(138);
/***/ },
/* 1 */
/***/ function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_1__;
/***/ },
/* 2 */
/***/ function(module, exports) {
"use strict";
exports.__esModule = true;
exports.default = function (instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
};
/***/ },
/* 3 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _setPrototypeOf = __webpack_require__(248);
var _setPrototypeOf2 = _interopRequireDefault(_setPrototypeOf);
var _create = __webpack_require__(246);
var _create2 = _interopRequireDefault(_create);
var _typeof2 = __webpack_require__(33);
var _typeof3 = _interopRequireDefault(_typeof2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = function (subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === "undefined" ? "undefined" : (0, _typeof3.default)(superClass)));
}
subClass.prototype = (0, _create2.default)(superClass && superClass.prototype, {
constructor: {
value: subClass,
enumerable: false,
writable: true,
configurable: true
}
});
if (superClass) _setPrototypeOf2.default ? (0, _setPrototypeOf2.default)(subClass, superClass) : subClass.__proto__ = superClass;
};
/***/ },
/* 4 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _typeof2 = __webpack_require__(33);
var _typeof3 = _interopRequireDefault(_typeof2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = function (self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return call && ((typeof call === "undefined" ? "undefined" : (0, _typeof3.default)(call)) === "object" || typeof call === "function") ? call : self;
};
/***/ },
/* 5 */
/***/ function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
Copyright (c) 2016 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
/* global define */
(function () {
'use strict';
var hasOwn = {}.hasOwnProperty;
function classNames () {
var classes = [];
for (var i = 0; i < arguments.length; i++) {
var arg = arguments[i];
if (!arg) continue;
var argType = typeof arg;
if (argType === 'string' || argType === 'number') {
classes.push(arg);
} else if (Array.isArray(arg)) {
classes.push(classNames.apply(null, arg));
} else if (argType === 'object') {
for (var key in arg) {
if (hasOwn.call(arg, key) && arg[key]) {
classes.push(key);
}
}
}
}
return classes.join(' ');
}
if (typeof module !== 'undefined' && module.exports) {
module.exports = classNames;
} else if (true) {
// register as 'classnames', consistent with npm package name
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function () {
return classNames;
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {
window.classNames = classNames;
}
}());
/***/ },
/* 6 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _defineProperty = __webpack_require__(247);
var _defineProperty2 = _interopRequireDefault(_defineProperty);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = function (obj, key, value) {
if (key in obj) {
(0, _defineProperty2.default)(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
};
/***/ },
/* 7 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _assign = __webpack_require__(245);
var _assign2 = _interopRequireDefault(_assign);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _assign2.default || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
/***/ },
/* 8 */
/***/ function(module, exports, __webpack_require__) {
'use strict';__webpack_require__(352);
__webpack_require__(341);
/***/ },
/* 9 */
/***/ function(module, exports, __webpack_require__) {
/**
* Copyright 2013-present, 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.
*/
if (true) {
var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&
Symbol.for &&
Symbol.for('react.element')) ||
0xeac7;
var isValidElement = function(object) {
return typeof object === 'object' &&
object !== null &&
object.$$typeof === REACT_ELEMENT_TYPE;
};
// By explicitly using `prop-types` you are opting into new development behavior.
// http://fb.me/prop-types-in-prod
var throwOnDirectAccess = true;
module.exports = __webpack_require__(373)(isValidElement, throwOnDirectAccess);
} else {
// By explicitly using `prop-types` you are opting into new production behavior.
// http://fb.me/prop-types-in-prod
module.exports = require('./factoryWithThrowingShims')();
}
/***/ },
/* 10 */
/***/ function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_10__;
/***/ },
/* 11 */
/***/ function(module, exports, __webpack_require__) {
var Sprite = __webpack_require__(487);
var globalSprite = new Sprite();
if (document.body) {
globalSprite.elem = globalSprite.render(document.body);
} else {
document.addEventListener('DOMContentLoaded', function () {
globalSprite.elem = globalSprite.render(document.body);
}, false);
}
module.exports = globalSprite;
/***/ },
/* 12 */
/***/ function(module, exports) {
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/
'use strict';
/* eslint-disable no-unused-vars */
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
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);
}
function shouldUseNative() {
try {
if (!Object.assign) {
return false;
}
// Detect buggy property enumeration order in older V8 versions.
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
test1[5] = 'de';
if (Object.getOwnPropertyNames(test1)[0] === '5') {
return false;
}
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
var test2 = {};
for (var i = 0; i < 10; i++) {
test2['_' + String.fromCharCode(i)] = i;
}
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
return test2[n];
});
if (order2.join('') !== '0123456789') {
return false;
}
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
var test3 = {};
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
test3[letter] = letter;
});
if (Object.keys(Object.assign({}, test3)).join('') !==
'abcdefghijklmnopqrst') {
return false;
}
return true;
} catch (err) {
// We don't expect any of the above to throw, but better to be safe.
return false;
}
}
module.exports = shouldUseNative() ? 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];
}
}
if (getOwnPropertySymbols) {
symbols = getOwnPropertySymbols(from);
for (var i = 0; i < symbols.length; i++) {
if (propIsEnumerable.call(from, symbols[i])) {
to[symbols[i]] = from[symbols[i]];
}
}
}
}
return to;
};
/***/ },
/* 13 */
/***/ function(module, exports) {
var core = module.exports = {version: '2.4.0'};
if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef
/***/ },
/* 14 */
/***/ function(module, exports, __webpack_require__) {
var store = __webpack_require__(66)('wks')
, uid = __webpack_require__(44)
, Symbol = __webpack_require__(19).Symbol
, USE_SYMBOL = typeof Symbol == 'function';
var $exports = module.exports = function(name){
return store[name] || (store[name] =
USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));
};
$exports.store = store;
/***/ },
/* 15 */
/***/ function(module, exports, __webpack_require__) {
'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.default=undefined;var _extends2=__webpack_require__(7);var _extends3=_interopRequireDefault(_extends2);var _defineProperty2=__webpack_require__(6);var _defineProperty3=_interopRequireDefault(_defineProperty2);var _classCallCheck2=__webpack_require__(2);var _classCallCheck3=_interopRequireDefault(_classCallCheck2);var _possibleConstructorReturn2=__webpack_require__(4);var _possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2);var _inherits2=__webpack_require__(3);var _inherits3=_interopRequireDefault(_inherits2);
var _react=__webpack_require__(1);var React=_interopRequireWildcard(_react);
var _classnames=__webpack_require__(5);var _classnames2=_interopRequireDefault(_classnames);function _interopRequireWildcard(obj){if(obj&&obj.__esModule){return obj;}else{var newObj={};if(obj!=null){for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))newObj[key]=obj[key];}}newObj.default=obj;return newObj;}}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}var __rest=undefined&&undefined.__rest||function(s,e){var t={};for(var p in s){if(Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0)t[p]=s[p];}if(s!=null&&typeof Object.getOwnPropertySymbols==="function")for(var i=0,p=Object.getOwnPropertySymbols(s);i
0;
var hasChangedTouches = changedTouches && changedTouches.length > 0;
return !hasTouches && hasChangedTouches ? changedTouches[0] : hasTouches ? touches[0] : nativeEvent;
}
/**
* Touchable states.
*/
var States = keyMirror({
NOT_RESPONDER: null,
RESPONDER_INACTIVE_PRESS_IN: null,
RESPONDER_INACTIVE_PRESS_OUT: null,
RESPONDER_ACTIVE_PRESS_IN: null,
RESPONDER_ACTIVE_PRESS_OUT: null,
RESPONDER_ACTIVE_LONG_PRESS_IN: null,
RESPONDER_ACTIVE_LONG_PRESS_OUT: null,
ERROR: null
});
/**
* Quick lookup map for states that are considered to be "active"
*/
var IsActive = {
RESPONDER_ACTIVE_PRESS_OUT: true,
RESPONDER_ACTIVE_PRESS_IN: true
};
/**
* Quick lookup for states that are considered to be "pressing" and are
* therefore eligible to result in a "selection" if the press stops.
*/
var IsPressingIn = {
RESPONDER_INACTIVE_PRESS_IN: true,
RESPONDER_ACTIVE_PRESS_IN: true,
RESPONDER_ACTIVE_LONG_PRESS_IN: true
};
var IsLongPressingIn = {
RESPONDER_ACTIVE_LONG_PRESS_IN: true
};
/**
* Inputs to the state machine.
*/
var Signals = keyMirror({
DELAY: null,
RESPONDER_GRANT: null,
RESPONDER_RELEASE: null,
RESPONDER_TERMINATED: null,
ENTER_PRESS_RECT: null,
LEAVE_PRESS_RECT: null,
LONG_PRESS_DETECTED: null
});
/**
* Mapping from States x Signals => States
*/
var Transitions = {
NOT_RESPONDER: {
DELAY: States.ERROR,
RESPONDER_GRANT: States.RESPONDER_INACTIVE_PRESS_IN,
RESPONDER_RELEASE: States.ERROR,
RESPONDER_TERMINATED: States.ERROR,
ENTER_PRESS_RECT: States.ERROR,
LEAVE_PRESS_RECT: States.ERROR,
LONG_PRESS_DETECTED: States.ERROR
},
RESPONDER_INACTIVE_PRESS_IN: {
DELAY: States.RESPONDER_ACTIVE_PRESS_IN,
RESPONDER_GRANT: States.ERROR,
RESPONDER_RELEASE: States.NOT_RESPONDER,
RESPONDER_TERMINATED: States.NOT_RESPONDER,
ENTER_PRESS_RECT: States.RESPONDER_INACTIVE_PRESS_IN,
LEAVE_PRESS_RECT: States.RESPONDER_INACTIVE_PRESS_OUT,
LONG_PRESS_DETECTED: States.ERROR
},
RESPONDER_INACTIVE_PRESS_OUT: {
DELAY: States.RESPONDER_ACTIVE_PRESS_OUT,
RESPONDER_GRANT: States.ERROR,
RESPONDER_RELEASE: States.NOT_RESPONDER,
RESPONDER_TERMINATED: States.NOT_RESPONDER,
ENTER_PRESS_RECT: States.RESPONDER_INACTIVE_PRESS_IN,
LEAVE_PRESS_RECT: States.RESPONDER_INACTIVE_PRESS_OUT,
LONG_PRESS_DETECTED: States.ERROR
},
RESPONDER_ACTIVE_PRESS_IN: {
DELAY: States.ERROR,
RESPONDER_GRANT: States.ERROR,
RESPONDER_RELEASE: States.NOT_RESPONDER,
RESPONDER_TERMINATED: States.NOT_RESPONDER,
ENTER_PRESS_RECT: States.RESPONDER_ACTIVE_PRESS_IN,
LEAVE_PRESS_RECT: States.RESPONDER_ACTIVE_PRESS_OUT,
LONG_PRESS_DETECTED: States.RESPONDER_ACTIVE_LONG_PRESS_IN
},
RESPONDER_ACTIVE_PRESS_OUT: {
DELAY: States.ERROR,
RESPONDER_GRANT: States.ERROR,
RESPONDER_RELEASE: States.NOT_RESPONDER,
RESPONDER_TERMINATED: States.NOT_RESPONDER,
ENTER_PRESS_RECT: States.RESPONDER_ACTIVE_PRESS_IN,
LEAVE_PRESS_RECT: States.RESPONDER_ACTIVE_PRESS_OUT,
LONG_PRESS_DETECTED: States.ERROR
},
RESPONDER_ACTIVE_LONG_PRESS_IN: {
DELAY: States.ERROR,
RESPONDER_GRANT: States.ERROR,
RESPONDER_RELEASE: States.NOT_RESPONDER,
RESPONDER_TERMINATED: States.NOT_RESPONDER,
ENTER_PRESS_RECT: States.RESPONDER_ACTIVE_LONG_PRESS_IN,
LEAVE_PRESS_RECT: States.RESPONDER_ACTIVE_LONG_PRESS_OUT,
LONG_PRESS_DETECTED: States.RESPONDER_ACTIVE_LONG_PRESS_IN
},
RESPONDER_ACTIVE_LONG_PRESS_OUT: {
DELAY: States.ERROR,
RESPONDER_GRANT: States.ERROR,
RESPONDER_RELEASE: States.NOT_RESPONDER,
RESPONDER_TERMINATED: States.NOT_RESPONDER,
ENTER_PRESS_RECT: States.RESPONDER_ACTIVE_LONG_PRESS_IN,
LEAVE_PRESS_RECT: States.RESPONDER_ACTIVE_LONG_PRESS_OUT,
LONG_PRESS_DETECTED: States.ERROR
},
error: {
DELAY: States.NOT_RESPONDER,
RESPONDER_GRANT: States.RESPONDER_INACTIVE_PRESS_IN,
RESPONDER_RELEASE: States.NOT_RESPONDER,
RESPONDER_TERMINATED: States.NOT_RESPONDER,
ENTER_PRESS_RECT: States.NOT_RESPONDER,
LEAVE_PRESS_RECT: States.NOT_RESPONDER,
LONG_PRESS_DETECTED: States.NOT_RESPONDER
}
};
// ==== Typical Constants for integrating into UI components ====
// const HIT_EXPAND_PX = 20;
// const HIT_VERT_OFFSET_PX = 10;
var HIGHLIGHT_DELAY_MS = 130;
var PRESS_EXPAND_PX = 20;
var LONG_PRESS_THRESHOLD = 500;
var LONG_PRESS_DELAY_MS = LONG_PRESS_THRESHOLD - HIGHLIGHT_DELAY_MS;
var LONG_PRESS_ALLOWED_MOVEMENT = 10;
var lastClickTime = 0;
var pressDelay = 200;
function isAllowPress() {
// avoid click penetration
return Date.now() - lastClickTime >= pressDelay;
}
var Touchable = _react2["default"].createClass({
displayName: 'Touchable',
getDefaultProps: function getDefaultProps() {
return {
disabled: false,
delayPressIn: HIGHLIGHT_DELAY_MS,
delayLongPress: LONG_PRESS_DELAY_MS,
delayPressOut: 100,
pressRetentionOffset: {
left: PRESS_EXPAND_PX,
right: PRESS_EXPAND_PX,
top: PRESS_EXPAND_PX,
bottom: PRESS_EXPAND_PX
},
hitSlop: undefined,
longPressCancelsPress: true
};
},
getInitialState: function getInitialState() {
return {
active: false
};
},
componentWillMount: function componentWillMount() {
this.touchable = { touchState: undefined };
},
componentDidMount: function componentDidMount() {
this.root = _reactDom2["default"].findDOMNode(this);
},
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
// disabled auto clear active state
if (nextProps.disabled && this.state.active) {
this.setState({
active: false
});
}
},
componentDidUpdate: function componentDidUpdate() {
this.root = _reactDom2["default"].findDOMNode(this);
},
componentWillUnmount: function componentWillUnmount() {
if (this.releaseLockTimer) {
clearTimeout(this.releaseLockTimer);
}
if (this.touchableDelayTimeout) {
clearTimeout(this.touchableDelayTimeout);
}
if (this.longPressDelayTimeout) {
clearTimeout(this.longPressDelayTimeout);
}
if (this.pressOutDelayTimeout) {
clearTimeout(this.pressOutDelayTimeout);
}
},
callChildEvent: function callChildEvent(event, e) {
var childHandle = this.props.children.props[event];
if (childHandle) {
childHandle(e);
}
},
onTouchStart: function onTouchStart(e) {
this.callChildEvent('onTouchStart', e);
this.lockMouse = true;
if (this.releaseLockTimer) {
clearTimeout(this.releaseLockTimer);
}
this.touchableHandleResponderGrant(e.nativeEvent);
},
onTouchMove: function onTouchMove(e) {
this.callChildEvent('onTouchMove', e);
this.touchableHandleResponderMove(e.nativeEvent);
},
onTouchEnd: function onTouchEnd(e) {
var _this = this;
this.callChildEvent('onTouchEnd', e);
this.releaseLockTimer = setTimeout(function () {
_this.lockMouse = false;
}, 300);
this.touchableHandleResponderRelease(e.nativeEvent);
},
onTouchCancel: function onTouchCancel(e) {
var _this2 = this;
this.callChildEvent('onTouchCancel', e);
this.releaseLockTimer = setTimeout(function () {
_this2.lockMouse = false;
}, 300);
this.touchableHandleResponderTerminate(e.nativeEvent);
},
onMouseDown: function onMouseDown(e) {
this.callChildEvent('onMouseDown', e);
if (this.lockMouse) {
return;
}
this.touchableHandleResponderGrant(e.nativeEvent);
document.addEventListener('mousemove', this.touchableHandleResponderMove, false);
document.addEventListener('mouseup', this.onMouseUp, false);
},
onMouseUp: function onMouseUp(e) {
document.removeEventListener('mousemove', this.touchableHandleResponderMove, false);
document.removeEventListener('mouseup', this.onMouseUp, false);
this.touchableHandleResponderRelease(e);
},
_remeasureMetricsOnInit: function _remeasureMetricsOnInit(e) {
var root = this.root;
var touch = extractSingleTouch(e);
var boundingRect = root.getBoundingClientRect();
this.touchable = {
touchState: this.touchable.touchState,
startMouse: {
pageX: touch.pageX,
pageY: touch.pageY
},
positionOnGrant: {
left: boundingRect.left + window.pageXOffset,
top: boundingRect.top + window.pageYOffset,
width: boundingRect.width,
height: boundingRect.height,
clientLeft: boundingRect.left,
clientTop: boundingRect.top
}
};
},
touchableHandleResponderGrant: function touchableHandleResponderGrant(e) {
var _this3 = this;
this.touchable.touchState = States.NOT_RESPONDER;
if (this.pressOutDelayTimeout) {
clearTimeout(this.pressOutDelayTimeout);
this.pressOutDelayTimeout = null;
}
if (this.props.fixClickPenetration && !isAllowPress()) {
return;
}
this._remeasureMetricsOnInit(e);
this._receiveSignal(Signals.RESPONDER_GRANT, e);
var delayMS = this.props.delayPressIn;
if (delayMS) {
this.touchableDelayTimeout = setTimeout(function () {
_this3._handleDelay(e);
}, delayMS);
} else {
this._handleDelay(e);
}
var longDelayMS = this.props.delayLongPress;
this.longPressDelayTimeout = setTimeout(function () {
_this3._handleLongDelay(e);
}, longDelayMS + delayMS);
},
checkScroll: function checkScroll(e) {
var positionOnGrant = this.touchable.positionOnGrant;
// container or window scroll
var boundingRect = this.root.getBoundingClientRect();
if (boundingRect.left !== positionOnGrant.clientLeft || boundingRect.top !== positionOnGrant.clientTop) {
this._receiveSignal(Signals.RESPONDER_TERMINATED, e);
return false;
}
},
touchableHandleResponderRelease: function touchableHandleResponderRelease(e) {
if (!this.touchable.startMouse) {
return;
}
var touch = extractSingleTouch(e);
if (Math.abs(touch.pageX - this.touchable.startMouse.pageX) > 30 || Math.abs(touch.pageY - this.touchable.startMouse.pageY) > 30) {
this._receiveSignal(Signals.RESPONDER_TERMINATED, e);
return;
}
if (this.checkScroll(e) === false) {
return;
}
this._receiveSignal(Signals.RESPONDER_RELEASE, e);
},
touchableHandleResponderTerminate: function touchableHandleResponderTerminate(e) {
if (!this.touchable.startMouse) {
return;
}
this._receiveSignal(Signals.RESPONDER_TERMINATED, e);
},
checkTouchWithinActive: function checkTouchWithinActive(e) {
var positionOnGrant = this.touchable.positionOnGrant;
var _props = this.props,
pressRetentionOffset = _props.pressRetentionOffset,
hitSlop = _props.hitSlop;
var pressExpandLeft = pressRetentionOffset.left;
var pressExpandTop = pressRetentionOffset.top;
var pressExpandRight = pressRetentionOffset.right;
var pressExpandBottom = pressRetentionOffset.bottom;
if (hitSlop) {
pressExpandLeft += hitSlop.left;
pressExpandTop += hitSlop.top;
pressExpandRight += hitSlop.right;
pressExpandBottom += hitSlop.bottom;
}
var touch = extractSingleTouch(e);
var pageX = touch && touch.pageX;
var pageY = touch && touch.pageY;
return pageX > positionOnGrant.left - pressExpandLeft && pageY > positionOnGrant.top - pressExpandTop && pageX < positionOnGrant.left + positionOnGrant.width + pressExpandRight && pageY < positionOnGrant.top + positionOnGrant.height + pressExpandBottom;
},
touchableHandleResponderMove: function touchableHandleResponderMove(e) {
if (!this.touchable.startMouse) {
return;
}
// Measurement may not have returned yet.
if (!this.touchable.dimensionsOnActivate || this.touchable.touchState === States.NOT_RESPONDER) {
return;
}
// Not enough time elapsed yet, wait for highlight -
// this is just a perf optimization.
if (this.touchable.touchState === States.RESPONDER_INACTIVE_PRESS_IN) {
return;
}
var touch = extractSingleTouch(e);
var pageX = touch && touch.pageX;
var pageY = touch && touch.pageY;
if (this.pressInLocation) {
var movedDistance = this._getDistanceBetweenPoints(pageX, pageY, this.pressInLocation.pageX, this.pressInLocation.pageY);
if (movedDistance > LONG_PRESS_ALLOWED_MOVEMENT) {
this._cancelLongPressDelayTimeout();
}
}
if (this.checkTouchWithinActive(e)) {
this._receiveSignal(Signals.ENTER_PRESS_RECT, e);
var curState = this.touchable.touchState;
if (curState === States.RESPONDER_INACTIVE_PRESS_IN) {
this._cancelLongPressDelayTimeout();
}
} else {
this._cancelLongPressDelayTimeout();
this._receiveSignal(Signals.LEAVE_PRESS_RECT, e);
}
},
callProp: function callProp(name, e) {
if (this.props[name] && !this.props.disabled) {
this.props[name](e);
}
},
touchableHandleActivePressIn: function touchableHandleActivePressIn(e) {
this.setActive(true);
this.callProp('onPressIn', e);
},
touchableHandleActivePressOut: function touchableHandleActivePressOut(e) {
this.setActive(false);
this.callProp('onPressOut', e);
},
touchableHandlePress: function touchableHandlePress(e) {
this.callProp('onPress', e);
lastClickTime = Date.now();
},
touchableHandleLongPress: function touchableHandleLongPress(e) {
this.callProp('onLongPress', e);
},
setActive: function setActive(active) {
if (this.props.activeClassName || this.props.activeStyle) {
this.setState({
active: active
});
}
},
_remeasureMetricsOnActivation: function _remeasureMetricsOnActivation() {
this.touchable.dimensionsOnActivate = this.touchable.positionOnGrant;
},
_handleDelay: function _handleDelay(e) {
this.touchableDelayTimeout = null;
this._receiveSignal(Signals.DELAY, e);
},
_handleLongDelay: function _handleLongDelay(e) {
this.longPressDelayTimeout = null;
var curState = this.touchable.touchState;
if (curState !== States.RESPONDER_ACTIVE_PRESS_IN && curState !== States.RESPONDER_ACTIVE_LONG_PRESS_IN) {
console.error('Attempted to transition from state `' + curState + '` to `' + States.RESPONDER_ACTIVE_LONG_PRESS_IN + '`, which is not supported. This is ' + 'most likely due to `Touchable.longPressDelayTimeout` not being cancelled.');
} else {
this._receiveSignal(Signals.LONG_PRESS_DETECTED, e);
}
},
_receiveSignal: function _receiveSignal(signal, e) {
var curState = this.touchable.touchState;
var nextState = Transitions[curState] && Transitions[curState][signal];
if (!nextState) {
return;
}
if (nextState === States.ERROR) {
return;
}
if (curState !== nextState) {
this._performSideEffectsForTransition(curState, nextState, signal, e);
this.touchable.touchState = nextState;
}
},
_cancelLongPressDelayTimeout: function _cancelLongPressDelayTimeout() {
if (this.longPressDelayTimeout) {
clearTimeout(this.longPressDelayTimeout);
this.longPressDelayTimeout = null;
}
},
_isHighlight: function _isHighlight(state) {
return state === States.RESPONDER_ACTIVE_PRESS_IN || state === States.RESPONDER_ACTIVE_LONG_PRESS_IN;
},
_savePressInLocation: function _savePressInLocation(e) {
var touch = extractSingleTouch(e);
var pageX = touch && touch.pageX;
var pageY = touch && touch.pageY;
this.pressInLocation = { pageX: pageX, pageY: pageY };
},
_getDistanceBetweenPoints: function _getDistanceBetweenPoints(aX, aY, bX, bY) {
var deltaX = aX - bX;
var deltaY = aY - bY;
return Math.sqrt(deltaX * deltaX + deltaY * deltaY);
},
_performSideEffectsForTransition: function _performSideEffectsForTransition(curState, nextState, signal, e) {
var curIsHighlight = this._isHighlight(curState);
var newIsHighlight = this._isHighlight(nextState);
var isFinalSignal = signal === Signals.RESPONDER_TERMINATED || signal === Signals.RESPONDER_RELEASE;
if (isFinalSignal) {
this._cancelLongPressDelayTimeout();
}
if (!IsActive[curState] && IsActive[nextState]) {
this._remeasureMetricsOnActivation();
}
if (IsPressingIn[curState] && signal === Signals.LONG_PRESS_DETECTED) {
this.touchableHandleLongPress(e);
}
if (newIsHighlight && !curIsHighlight) {
this._startHighlight(e);
} else if (!newIsHighlight && curIsHighlight) {
this._endHighlight(e);
}
if (IsPressingIn[curState] && signal === Signals.RESPONDER_RELEASE) {
var hasLongPressHandler = !!this.props.onLongPress;
var pressIsLongButStillCallOnPress = IsLongPressingIn[curState] && (!hasLongPressHandler || !this.props.longPressCancelsPress // or we're told to ignore it.
);
var shouldInvokePress = !IsLongPressingIn[curState] || pressIsLongButStillCallOnPress;
if (shouldInvokePress) {
if (!newIsHighlight && !curIsHighlight) {
// we never highlighted because of delay, but we should highlight now
this._startHighlight(e);
this._endHighlight(e);
}
this.touchableHandlePress(e);
}
}
if (this.touchableDelayTimeout) {
clearTimeout(this.touchableDelayTimeout);
this.touchableDelayTimeout = null;
}
},
_startHighlight: function _startHighlight(e) {
this._savePressInLocation(e);
this.touchableHandleActivePressIn(e);
},
_endHighlight: function _endHighlight(e) {
var _this4 = this;
if (this.props.delayPressOut) {
this.pressOutDelayTimeout = setTimeout(function () {
_this4.touchableHandleActivePressOut(e);
}, this.props.delayPressOut);
} else {
this.touchableHandleActivePressOut(e);
}
},
render: function render() {
var _props2 = this.props,
children = _props2.children,
disabled = _props2.disabled,
activeStyle = _props2.activeStyle,
activeClassName = _props2.activeClassName;
var events = disabled ? undefined : copy(this, ['onTouchStart', 'onTouchMove', 'onTouchEnd', 'onTouchCancel', 'onMouseDown']);
var child = _react2["default"].Children.only(children);
if (!disabled && this.state.active) {
var _child$props = child.props,
style = _child$props.style,
className = _child$props.className;
if (activeStyle) {
style = (0, _objectAssign2["default"])({}, style, activeStyle);
}
if (activeClassName) {
if (className) {
className += ' ' + activeClassName;
} else {
className = activeClassName;
}
}
return _react2["default"].cloneElement(child, (0, _objectAssign2["default"])({
className: className,
style: style
}, events));
}
return _react2["default"].cloneElement(child, events);
}
});
exports["default"] = Touchable;
module.exports = exports['default'];
/***/ },
/* 18 */
/***/ function(module, exports) {
"use strict";
exports.__esModule = true;
exports.default = function (obj, keys) {
var target = {};
for (var i in obj) {
if (keys.indexOf(i) >= 0) continue;
if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;
target[i] = obj[i];
}
return target;
};
/***/ },
/* 19 */
/***/ function(module, exports) {
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
var global = module.exports = typeof window != 'undefined' && window.Math == Math
? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();
if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef
/***/ },
/* 20 */
/***/ function(module, exports, __webpack_require__) {
var anObject = __webpack_require__(22)
, IE8_DOM_DEFINE = __webpack_require__(99)
, toPrimitive = __webpack_require__(69)
, dP = Object.defineProperty;
exports.f = __webpack_require__(23) ? Object.defineProperty : function defineProperty(O, P, Attributes){
anObject(O);
P = toPrimitive(P, true);
anObject(Attributes);
if(IE8_DOM_DEFINE)try {
return dP(O, P, Attributes);
} catch(e){ /* empty */ }
if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!');
if('value' in Attributes)O[P] = Attributes.value;
return O;
};
/***/ },
/* 21 */
[490, 320],
/* 22 */
/***/ function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(35);
module.exports = function(it){
if(!isObject(it))throw TypeError(it + ' is not an object!');
return it;
};
/***/ },
/* 23 */
/***/ function(module, exports, __webpack_require__) {
// Thank's IE8 for his funny defineProperty
module.exports = !__webpack_require__(34)(function(){
return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7;
});
/***/ },
/* 24 */
/***/ function(module, exports, __webpack_require__) {
var global = __webpack_require__(19)
, core = __webpack_require__(13)
, ctx = __webpack_require__(58)
, hide = __webpack_require__(29)
, PROTOTYPE = 'prototype';
var $export = function(type, name, source){
var IS_FORCED = type & $export.F
, IS_GLOBAL = type & $export.G
, IS_STATIC = type & $export.S
, IS_PROTO = type & $export.P
, IS_BIND = type & $export.B
, IS_WRAP = type & $export.W
, exports = IS_GLOBAL ? core : core[name] || (core[name] = {})
, expProto = exports[PROTOTYPE]
, target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE]
, key, own, out;
if(IS_GLOBAL)source = name;
for(key in source){
// contains in native
own = !IS_FORCED && target && target[key] !== undefined;
if(own && key in exports)continue;
// export native or passed
out = own ? target[key] : source[key];
// prevent global pollution for namespaces
exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
// bind timers to global for call from export context
: IS_BIND && own ? ctx(out, global)
// wrap global constructors for prevent change them in library
: IS_WRAP && target[key] == out ? (function(C){
var F = function(a, b, c){
if(this instanceof C){
switch(arguments.length){
case 0: return new C;
case 1: return new C(a);
case 2: return new C(a, b);
} return new C(a, b, c);
} return C.apply(this, arguments);
};
F[PROTOTYPE] = C[PROTOTYPE];
return F;
// make static versions for prototype methods
})(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
// export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
if(IS_PROTO){
(exports.virtual || (exports.virtual = {}))[key] = out;
// export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
if(type & $export.R && expProto && !expProto[key])hide(expProto, key, out);
}
}
};
// type bitmap
$export.F = 1; // forced
$export.G = 2; // global
$export.S = 4; // static
$export.P = 8; // proto
$export.B = 16; // bind
$export.W = 32; // wrap
$export.U = 64; // safe
$export.R = 128; // real proto method for `library`
module.exports = $export;
/***/ },
/* 25 */
/***/ function(module, exports) {
var hasOwnProperty = {}.hasOwnProperty;
module.exports = function(it, key){
return hasOwnProperty.call(it, key);
};
/***/ },
/* 26 */
/***/ function(module, exports, __webpack_require__) {
// to indexed object, toObject with fallback for non-array-like ES3 strings
var IObject = __webpack_require__(100)
, defined = __webpack_require__(59);
module.exports = function(it){
return IObject(defined(it));
};
/***/ },
/* 27 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var assign = __webpack_require__(12);
module.exports = function omit(obj, fields) {
var copy = assign({}, obj);
for (var i = 0; i < fields.length; i++) {
var key = fields[i];
delete copy[key];
}
return copy;
};
/***/ },
/* 28 */
/***/ function(module, exports, __webpack_require__) {
'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.default=undefined;var _defineProperty2=__webpack_require__(6);var _defineProperty3=_interopRequireDefault(_defineProperty2);var _classCallCheck2=__webpack_require__(2);var _classCallCheck3=_interopRequireDefault(_classCallCheck2);var _possibleConstructorReturn2=__webpack_require__(4);var _possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2);var _inherits2=__webpack_require__(3);var _inherits3=_interopRequireDefault(_inherits2);
var _react=__webpack_require__(1);var _react2=_interopRequireDefault(_react);
var _ListItem=__webpack_require__(173);var _ListItem2=_interopRequireDefault(_ListItem);
var _classnames=__webpack_require__(5);var _classnames2=_interopRequireDefault(_classnames);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}var
List=function(_React$Component){(0,_inherits3.default)(List,_React$Component);function List(){(0,_classCallCheck3.default)(this,List);return(0,_possibleConstructorReturn3.default)(this,_React$Component.apply(this,arguments));}List.prototype.
render=function render(){var _classNames;var _props=
this.props,prefixCls=_props.prefixCls,children=_props.children,className=_props.className,style=_props.style,renderHeader=_props.renderHeader,renderFooter=_props.renderFooter;
var wrapCls=(0,_classnames2.default)((_classNames={},(0,_defineProperty3.default)(_classNames,
prefixCls,true),(0,_defineProperty3.default)(_classNames,
className,className),_classNames));
return _react2.default.createElement('div',{className:wrapCls,style:style},
renderHeader?_react2.default.createElement('div',{className:prefixCls+'-header'},
typeof renderHeader==='function'?renderHeader():renderHeader):
null,
children?_react2.default.createElement('div',{className:prefixCls+'-body'},children):null,
renderFooter?_react2.default.createElement('div',{className:prefixCls+'-footer'},
typeof renderFooter==='function'?renderFooter():renderFooter):
null);
};return List;}(_react2.default.Component);exports.default=List;
List.Item=_ListItem2.default;
List.defaultProps={
prefixCls:'am-list'};module.exports=exports['default'];
/***/ },
/* 29 */
/***/ function(module, exports, __webpack_require__) {
var dP = __webpack_require__(20)
, createDesc = __webpack_require__(37);
module.exports = __webpack_require__(23) ? function(object, key, value){
return dP.f(object, key, createDesc(1, value));
} : function(object, key, value){
object[key] = value;
return object;
};
/***/ },
/* 30 */
/***/ function(module, exports) {
module.exports = {};
/***/ },
/* 31 */
/***/ function(module, exports, __webpack_require__) {
'use strict';Object.defineProperty(exports,"__esModule",{value:true});var _Flex=__webpack_require__(161);var _Flex2=_interopRequireDefault(_Flex);
var _FlexItem=__webpack_require__(162);var _FlexItem2=_interopRequireDefault(_FlexItem);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}
_Flex2.default.Item=_FlexItem2.default;exports.default=_Flex2.default;module.exports=exports['default'];
/***/ },
/* 32 */
[490, 314],
/* 33 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _iterator = __webpack_require__(250);
var _iterator2 = _interopRequireDefault(_iterator);
var _symbol = __webpack_require__(249);
var _symbol2 = _interopRequireDefault(_symbol);
var _typeof = typeof _symbol2.default === "function" && typeof _iterator2.default === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj; };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = typeof _symbol2.default === "function" && _typeof(_iterator2.default) === "symbol" ? function (obj) {
return typeof obj === "undefined" ? "undefined" : _typeof(obj);
} : function (obj) {
return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof(obj);
};
/***/ },
/* 34 */
/***/ function(module, exports) {
module.exports = function(exec){
try {
return !!exec();
} catch(e){
return true;
}
};
/***/ },
/* 35 */
/***/ function(module, exports) {
module.exports = function(it){
return typeof it === 'object' ? it !== null : typeof it === 'function';
};
/***/ },
/* 36 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.2.14 / 15.2.3.14 Object.keys(O)
var $keys = __webpack_require__(104)
, enumBugKeys = __webpack_require__(60);
module.exports = Object.keys || function keys(O){
return $keys(O, enumBugKeys);
};
/***/ },
/* 37 */
/***/ function(module, exports) {
module.exports = function(bitmap, value){
return {
enumerable : !(bitmap & 1),
configurable: !(bitmap & 2),
writable : !(bitmap & 4),
value : value
};
};
/***/ },
/* 38 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _propertyUtils = __webpack_require__(302);
var RE_NUM = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source;
var getComputedStyleX = void 0;
function force(x, y) {
return x + y;
}
function css(el, name, v) {
var value = v;
if ((typeof name === 'undefined' ? 'undefined' : _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 = void 0;
var x = void 0;
var y = void 0;
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 setLeftTop(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;
}
var originalTransition = '';
var originalOffset = getOffset(elem);
if ('left' in offset || 'top' in offset) {
originalTransition = (0, _propertyUtils.getTransitionProperty)(elem) || '';
(0, _propertyUtils.setTransitionProperty)(elem, 'none');
}
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 originalStyle = {};
for (var key in offset) {
if (offset.hasOwnProperty(key)) {
var dir = getOffsetDirection(key, option);
var preset = key === 'left' ? presetH : presetV;
var off = originalOffset[key] - old[key];
if (dir === key) {
originalStyle[dir] = preset + off;
} else {
originalStyle[dir] = preset - off;
}
}
}
css(elem, originalStyle);
// force relayout
force(elem.offsetTop, elem.offsetLeft);
if ('left' in offset || 'top' in offset) {
(0, _propertyUtils.setTransitionProperty)(elem, originalTransition);
}
var ret = {};
for (var _key in offset) {
if (offset.hasOwnProperty(_key)) {
var _dir = getOffsetDirection(_key, option);
var _off = offset[_key] - originalOffset[_key];
if (_key === _dir) {
ret[_dir] = originalStyle[_dir] + _off;
} else {
ret[_dir] = originalStyle[_dir] - _off;
}
}
}
css(elem, ret);
}
function setTransform(elem, offset) {
var originalOffset = getOffset(elem);
var originalXY = (0, _propertyUtils.getTransformXY)(elem);
var resultXY = { x: originalXY.x, y: originalXY.y };
if ('left' in offset) {
resultXY.x = originalXY.x + offset.left - originalOffset.left;
}
if ('top' in offset) {
resultXY.y = originalXY.y + offset.top - originalOffset.top;
}
(0, _propertyUtils.setTransformXY)(elem, resultXY);
}
function setOffset(elem, offset, option) {
if (option.useCssRight || option.useCssBottom) {
setLeftTop(elem, offset, option);
} else if (option.useCssTransform && (0, _propertyUtils.getTransformName)() in document.body.style) {
setTransform(elem, offset, option);
} else {
setLeftTop(elem, offset, option);
}
}
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 = void 0;
// 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 = void 0;
var j = void 0;
var i = void 0;
for (j = 0; j < props.length; j++) {
prop = props[j];
if (prop) {
for (i = 0; i < which.length; i++) {
var cssProp = void 0;
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), _key2 = 0; _key2 < _len; _key2++) {
args[_key2] = arguments[_key2];
}
var val = void 0;
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 = void 0;
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), _key3 = 0; _key3 < _len2; _key3++) {
args[_key3] = arguments[_key3];
}
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'];
/***/ },
/* 39 */
/***/ function(module, exports, __webpack_require__) {
/**
* Copyright (c) 2013-present, 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.
*
*/
'use strict';
/**
* Use invariant() to assert state which your program assumes to be true.
*
* Provide sprintf-style format (only %s is supported) and arguments
* to provide information about what broke and what you were
* expecting.
*
* The invariant message will be stripped in production, but the invariant
* will remain to ensure logic does not differ in production.
*/
var validateFormat = function validateFormat(format) {};
if (true) {
validateFormat = function validateFormat(format) {
if (format === undefined) {
throw new Error('invariant requires an error message argument');
}
};
}
function invariant(condition, format, a, b, c, d, e, f) {
validateFormat(format);
if (!condition) {
var error;
if (format === undefined) {
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
} else {
var args = [a, b, c, d, e, f];
var argIndex = 0;
error = new Error(format.replace(/%s/g, function () {
return args[argIndex++];
}));
error.name = 'Invariant Violation';
}
error.framesToPop = 1; // we don't care about invariant's own frame
throw error;
}
}
module.exports = invariant;
/***/ },
/* 40 */
/***/ function(module, exports, __webpack_require__) {
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
'use strict';
var emptyFunction = __webpack_require__(110);
/**
* Similar to invariant but only logs a warning if the condition is not met.
* This can be used to log issues in development environments in critical
* paths. Removing the logging code for production environments will keep the
* same logic and follow the same code paths.
*/
var warning = emptyFunction;
if (true) {
(function () {
var printWarning = function printWarning(format) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
var argIndex = 0;
var message = 'Warning: ' + format.replace(/%s/g, function () {
return args[argIndex++];
});
if (typeof console !== 'undefined') {
console.error(message);
}
try {
// --- Welcome to debugging React ---
// This error was thrown as a convenience so that you can use this stack
// to find the callsite that caused this warning to fire.
throw new Error(message);
} catch (x) {}
};
warning = function warning(condition, format) {
if (format === undefined) {
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
}
if (format.indexOf('Failed Composite propType: ') === 0) {
return; // Ignore CompositeComponent proptype check.
}
if (!condition) {
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
args[_key2 - 2] = arguments[_key2];
}
printWarning.apply(undefined, [format].concat(args));
}
};
})();
}
module.exports = warning;
/***/ },
/* 41 */
/***/ function(module, exports) {
'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.default=function(props){
return Object.keys(props).reduce(function(prev,key){
if(key.substr(0,5)==='aria-'||key.substr(0,5)==='data-'||key==='role'){
prev[key]=props[key];
}
return prev;
},{});
};module.exports=exports['default'];
/***/ },
/* 42 */
/***/ function(module, exports, __webpack_require__) {
'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.default=undefined;var _extends2=__webpack_require__(7);var _extends3=_interopRequireDefault(_extends2);var _defineProperty2=__webpack_require__(6);var _defineProperty3=_interopRequireDefault(_defineProperty2);var _classCallCheck2=__webpack_require__(2);var _classCallCheck3=_interopRequireDefault(_classCallCheck2);var _possibleConstructorReturn2=__webpack_require__(4);var _possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2);var _inherits2=__webpack_require__(3);var _inherits3=_interopRequireDefault(_inherits2);var _react=__webpack_require__(1);var _react2=_interopRequireDefault(_react);
var _rcDialog=__webpack_require__(48);var _rcDialog2=_interopRequireDefault(_rcDialog);
var _classnames=__webpack_require__(5);var _classnames2=_interopRequireDefault(_classnames);
var _objectAssign=__webpack_require__(12);var _objectAssign2=_interopRequireDefault(_objectAssign);
var _rcTouchable=__webpack_require__(17);var _rcTouchable2=_interopRequireDefault(_rcTouchable);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}var
Modal=function(_React$Component){(0,_inherits3.default)(Modal,_React$Component);function Modal(){(0,_classCallCheck3.default)(this,Modal);return(0,_possibleConstructorReturn3.default)(this,_React$Component.apply(this,arguments));}Modal.prototype.
isInModal=function isInModal(e){
if(!/\biPhone\b|\biPod\b/i.test(navigator.userAgent)){
return;
}
var prefixCls=this.props.prefixCls;
var pNode=function(node){
while(node.parentNode&&node.parentNode!==document.body){
if(node.classList.contains(prefixCls)){
return node;
}
node=node.parentNode;
}
}(e.target);
if(!pNode){
e.preventDefault();
}
return true;
};Modal.prototype.
renderFooterButton=function renderFooterButton(button,prefixCls,i){
var buttonStyle={};
if(button.style){
buttonStyle=button.style;
if(typeof buttonStyle==='string'){
var styleMap={
cancel:{fontWeight:'bold'},
default:{},
destructive:{color:'red'}};
buttonStyle=styleMap[buttonStyle]||{};
}
}
var onClickFn=function onClickFn(e){
e.preventDefault();
if(button.onPress){
button.onPress();
}
};
return _react2.default.createElement(_rcTouchable2.default,{activeClassName:prefixCls+'-button-active',key:i},
_react2.default.createElement('a',{className:prefixCls+'-button',style:buttonStyle,href:'#',onClick:onClickFn},
button.text||'Button'));
};Modal.prototype.
render=function render(){var _classNames,_this2=this;var _props=
this.props,prefixCls=_props.prefixCls,className=_props.className,transparent=_props.transparent,animated=_props.animated,transitionName=_props.transitionName,maskTransitionName=_props.maskTransitionName,style=_props.style,_props$footer=_props.footer,footer=_props$footer===undefined?[]:_props$footer,closable=_props.closable,operation=_props.operation,platform=_props.platform;
var isAndroid=platform==='android'||platform==='cross'&&!!navigator.userAgent.match(/Android/i);
var wrapCls=(0,_classnames2.default)((_classNames={},(0,_defineProperty3.default)(_classNames,
className,!!className),(0,_defineProperty3.default)(_classNames,
prefixCls+'-transparent',transparent),(0,_defineProperty3.default)(_classNames,
prefixCls+'-android',isAndroid),_classNames));
var anim=transitionName||(animated?transparent?'am-fade':'am-slide-up':null);
var maskAnim=maskTransitionName||(animated?transparent?'am-fade':'am-slide-up':null);
var btnGroupClass=prefixCls+'-button-group-'+(footer.length===2&&!operation?'h':'v');
var footerDom=footer.length?_react2.default.createElement('div',{className:btnGroupClass},
footer.map(function(button,i){return _this2.renderFooterButton(button,prefixCls,i);})):
null;
var rootStyle=transparent?(0,_objectAssign2.default)({
width:'5.4rem',
height:'auto'},
style):(0,_objectAssign2.default)({
width:'100%',
height:'100%'},
style);
var restProps=(0,_objectAssign2.default)({},this.props);
['prefixCls','className','transparent','animated','transitionName','maskTransitionName',
'style','footer','touchFeedback','wrapProps'].
forEach(function(prop){
if(restProps.hasOwnProperty(prop)){
delete restProps[prop];
}
});
var wrapProps={onTouchStart:function onTouchStart(e){return _this2.isInModal(e);}};
return _react2.default.createElement(_rcDialog2.default,(0,_extends3.default)({prefixCls:prefixCls,className:wrapCls,transitionName:anim,maskTransitionName:maskAnim,style:rootStyle,footer:footerDom,wrapProps:wrapProps,closable:closable},restProps));
};return Modal;}(_react2.default.Component);exports.default=Modal;
Modal.defaultProps={
prefixCls:'am-modal',
transparent:false,
animated:true,
style:{},
onShow:function onShow(){},
footer:[],
closable:false,
operation:false,
platform:'cross'};module.exports=exports['default'];
/***/ },
/* 43 */
/***/ function(module, exports) {
exports.f = {}.propertyIsEnumerable;
/***/ },
/* 44 */
/***/ function(module, exports) {
var id = 0
, px = Math.random();
module.exports = function(key){
return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
};
/***/ },
/* 45 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $at = __webpack_require__(280)(true);
// 21.1.3.27 String.prototype[@@iterator]()
__webpack_require__(101)(String, 'String', function(iterated){
this._t = String(iterated); // target
this._i = 0; // next index
// 21.1.5.2.1 %StringIteratorPrototype%.next()
}, function(){
var O = this._t
, index = this._i
, point;
if(index >= O.length)return {value: undefined, done: true};
point = $at(O, index);
this._i += point.length;
return {value: point, done: false};
});
/***/ },
/* 46 */
/***/ function(module, exports, __webpack_require__) {
/**
* Copyright 2013-present, 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.
*
*/
'use strict';
var React = __webpack_require__(1);
var factory = __webpack_require__(294);
// Hack to grab NoopUpdateQueue from isomorphic React
var ReactNoopUpdateQueue = new React.Component().updater;
module.exports = factory(
React.Component,
React.isValidElement,
ReactNoopUpdateQueue
);
/***/ },
/* 47 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
// export this package's api
module.exports = __webpack_require__(377);
/***/ },
/* 48 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _Dialog = __webpack_require__(386);
var _Dialog2 = _interopRequireDefault(_Dialog);
var _getContainerRenderMixin = __webpack_require__(125);
var _getContainerRenderMixin2 = _interopRequireDefault(_getContainerRenderMixin);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var __assign = undefined && undefined.__assign || Object.assign || function (t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) {
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
}
return t;
};
var DialogWrap = _react2["default"].createClass({
displayName: 'DialogWrap',
mixins: [(0, _getContainerRenderMixin2["default"])({
isVisible: function isVisible(instance) {
return instance.props.visible;
},
autoDestroy: false,
getComponent: function getComponent(instance, extra) {
return _react2["default"].createElement(_Dialog2["default"], __assign({}, instance.props, extra, { key: "dialog" }));
},
getContainer: function getContainer(instance) {
if (instance.props.getContainer) {
return instance.props.getContainer();
}
var container = document.createElement('div');
document.body.appendChild(container);
return container;
}
})],
getDefaultProps: function getDefaultProps() {
return {
visible: false
};
},
shouldComponentUpdate: function shouldComponentUpdate(_ref) {
var visible = _ref.visible;
return !!(this.props.visible || visible);
},
componentWillUnmount: function componentWillUnmount() {
if (this.props.visible) {
this.renderComponent({
afterClose: this.removeContainer,
onClose: function onClose() {},
visible: false
});
} else {
this.removeContainer();
}
},
getElement: function getElement(part) {
return this._component.getElement(part);
},
render: function render() {
return null;
}
});
exports["default"] = DialogWrap;
module.exports = exports['default'];
/***/ },
/* 49 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _defineProperty2 = __webpack_require__(6);
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
exports.toArray = toArray;
exports.getActiveIndex = getActiveIndex;
exports.getActiveKey = getActiveKey;
exports.setTransform = setTransform;
exports.isTransformSupported = isTransformSupported;
exports.setTransition = setTransition;
exports.getTransformPropValue = getTransformPropValue;
exports.isVertical = isVertical;
exports.getTransformByIndex = getTransformByIndex;
exports.getMarginStyle = getMarginStyle;
exports.getStyle = getStyle;
exports.setPxStyle = setPxStyle;
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function toArray(children) {
// allow [c,[a,b]]
var c = [];
_react2["default"].Children.forEach(children, function (child) {
if (child) {
c.push(child);
}
});
return c;
}
function getActiveIndex(children, activeKey) {
var c = toArray(children);
for (var i = 0; i < c.length; i++) {
if (c[i].key === activeKey) {
return i;
}
}
return -1;
}
function getActiveKey(children, index) {
var c = toArray(children);
return c[index].key;
}
function setTransform(style, v) {
style.transform = v;
style.webkitTransform = v;
style.mozTransform = v;
}
function isTransformSupported(style) {
return 'transform' in style || 'webkitTransform' in style || 'MozTransform' in style;
}
function setTransition(style, v) {
style.transition = v;
style.webkitTransition = v;
style.MozTransition = v;
}
function getTransformPropValue(v) {
return {
transform: v,
WebkitTransform: v,
MozTransform: v
};
}
function isVertical(tabBarPosition) {
return tabBarPosition === 'left' || tabBarPosition === 'right';
}
function getTransformByIndex(index, tabBarPosition) {
var translate = isVertical(tabBarPosition) ? 'translateY' : 'translateX';
return translate + '(' + -index * 100 + '%) translateZ(0)';
}
function getMarginStyle(index, tabBarPosition) {
var marginDirection = isVertical(tabBarPosition) ? 'marginTop' : 'marginLeft';
return (0, _defineProperty3["default"])({}, marginDirection, -index * 100 + '%');
}
function getStyle(el, property) {
return +getComputedStyle(el).getPropertyValue(property).replace('px', '');
}
function setPxStyle(el, property, value) {
el.style[property] = value + 'px';
}
/***/ },
/* 50 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = addEventListenerWrap;
var _addDomEventListener = __webpack_require__(136);
var _addDomEventListener2 = _interopRequireDefault(_addDomEventListener);
var _reactDom = __webpack_require__(10);
var _reactDom2 = _interopRequireDefault(_reactDom);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
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'];
/***/ },
/* 51 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = __webpack_require__(7);
var _extends3 = _interopRequireDefault(_extends2);
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var _Picker = __webpack_require__(456);
var _Picker2 = _interopRequireDefault(_Picker);
var _MultiPickerMixin = __webpack_require__(455);
var _MultiPickerMixin2 = _interopRequireDefault(_MultiPickerMixin);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var MultiPicker = _react2["default"].createClass({
displayName: 'MultiPicker',
mixins: [_MultiPickerMixin2["default"]],
render: function render() {
var _this = this;
var props = this.props;
var prefixCls = props.prefixCls,
pickerPrefixCls = props.pickerPrefixCls,
className = props.className,
rootNativeProps = props.rootNativeProps,
disabled = props.disabled,
pickerItemStyle = props.pickerItemStyle,
indicatorStyle = props.indicatorStyle,
pure = props.pure,
children = props.children;
var selectedValue = this.getValue();
var colElements = children.map(function (col, i) {
return _react2["default"].createElement(
'div',
{ key: col.key || i, className: prefixCls + '-item' },
_react2["default"].createElement(_Picker2["default"], (0, _extends3["default"])({ itemStyle: pickerItemStyle, disabled: disabled, pure: pure, indicatorStyle: indicatorStyle, prefixCls: pickerPrefixCls, selectedValue: selectedValue[i], onValueChange: _this.onValueChange.bind(_this, i) }, col.props))
);
});
return _react2["default"].createElement(
'div',
(0, _extends3["default"])({}, rootNativeProps, { className: (0, _classnames2["default"])(className, prefixCls) }),
colElements
);
}
});
exports["default"] = MultiPicker;
module.exports = exports['default'];
/***/ },
/* 52 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var fetchKeys = __webpack_require__(365);
module.exports = function shallowEqual(objA, objB, compare, compareContext) {
var ret = compare ? compare.call(compareContext, objA, objB) : void 0;
if (ret !== void 0) {
return !!ret;
}
if (objA === objB) {
return true;
}
if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
return false;
}
var keysA = fetchKeys(objA);
var keysB = fetchKeys(objB);
var len = keysA.length;
if (len !== keysB.length) {
return false;
}
compareContext = compareContext || null;
// 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];
var _ret = compare ? compare.call(compareContext, valueA, valueB, key) : void 0;
if (_ret === false || _ret === void 0 && valueA !== valueB) {
return false;
}
}
return true;
};
/***/ },
/* 53 */
/***/ function(module, exports, __webpack_require__) {
'use strict';Object.defineProperty(exports,"__esModule",{value:true});var _extends2=__webpack_require__(7);var _extends3=_interopRequireDefault(_extends2);var _defineProperty2=__webpack_require__(6);var _defineProperty3=_interopRequireDefault(_defineProperty2);var _classCallCheck2=__webpack_require__(2);var _classCallCheck3=_interopRequireDefault(_classCallCheck2);var _possibleConstructorReturn2=__webpack_require__(4);var _possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2);var _inherits2=__webpack_require__(3);var _inherits3=_interopRequireDefault(_inherits2);
var _react=__webpack_require__(1);var _react2=_interopRequireDefault(_react);
var _classnames=__webpack_require__(5);var _classnames2=_interopRequireDefault(_classnames);
var _index=__webpack_require__(15);var _index2=_interopRequireDefault(_index);
var _rcTouchable=__webpack_require__(17);var _rcTouchable2=_interopRequireDefault(_rcTouchable);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}var __rest=undefined&&undefined.__rest||function(s,e){var t={};for(var p in s){if(Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0)t[p]=s[p];}if(s!=null&&typeof Object.getOwnPropertySymbols==="function")for(var i=0,p=Object.getOwnPropertySymbols(s);i 0 ? floor : ceil)(it);
};
/***/ },
/* 68 */
/***/ function(module, exports, __webpack_require__) {
// 7.1.13 ToObject(argument)
var defined = __webpack_require__(59);
module.exports = function(it){
return Object(defined(it));
};
/***/ },
/* 69 */
/***/ function(module, exports, __webpack_require__) {
// 7.1.1 ToPrimitive(input [, PreferredType])
var isObject = __webpack_require__(35);
// instead of the ES6 spec version, we didn't implement @@toPrimitive case
// and the second argument - flag - preferred type is a string
module.exports = function(it, S){
if(!isObject(it))return it;
var fn, val;
if(S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;
if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val;
if(!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;
throw TypeError("Can't convert object to primitive value");
};
/***/ },
/* 70 */
/***/ function(module, exports, __webpack_require__) {
var global = __webpack_require__(19)
, core = __webpack_require__(13)
, LIBRARY = __webpack_require__(61)
, wksExt = __webpack_require__(71)
, defineProperty = __webpack_require__(20).f;
module.exports = function(name){
var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {});
if(name.charAt(0) != '_' && !(name in $Symbol))defineProperty($Symbol, name, {value: wksExt.f(name)});
};
/***/ },
/* 71 */
/***/ function(module, exports, __webpack_require__) {
exports.f = __webpack_require__(14);
/***/ },
/* 72 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(285);
var global = __webpack_require__(19)
, hide = __webpack_require__(29)
, Iterators = __webpack_require__(30)
, TO_STRING_TAG = __webpack_require__(14)('toStringTag');
for(var collections = ['NodeList', 'DOMTokenList', 'MediaList', 'StyleSheetList', 'CSSRuleList'], i = 0; i < 5; i++){
var NAME = collections[i]
, Collection = global[NAME]
, proto = Collection && Collection.prototype;
if(proto && !proto[TO_STRING_TAG])hide(proto, TO_STRING_TAG, NAME);
Iterators[NAME] = Iterators.Array;
}
/***/ },
/* 73 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _toConsumableArray2 = __webpack_require__(94);
var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);
exports.isEventFromHandle = isEventFromHandle;
exports.isValueOutOfRange = isValueOutOfRange;
exports.isNotTouchEvent = isNotTouchEvent;
exports.getClosestPoint = getClosestPoint;
exports.getPrecision = getPrecision;
exports.getMousePosition = getMousePosition;
exports.getTouchPosition = getTouchPosition;
exports.getHandleCenterPosition = getHandleCenterPosition;
exports.ensureValueInRange = ensureValueInRange;
exports.ensureValuePrecision = ensureValuePrecision;
exports.pauseEvent = pauseEvent;
var _reactDom = __webpack_require__(10);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function isEventFromHandle(e, handles) {
return Object.keys(handles).some(function (key) {
return e.target === (0, _reactDom.findDOMNode)(handles[key]);
});
}
function isValueOutOfRange(value, _ref) {
var min = _ref.min,
max = _ref.max;
return value < min || value > max;
}
function isNotTouchEvent(e) {
return e.touches.length > 1 || e.type.toLowerCase() === 'touchend' && e.touches.length > 0;
}
function getClosestPoint(val, _ref2) {
var marks = _ref2.marks,
step = _ref2.step,
min = _ref2.min;
var points = Object.keys(marks).map(parseFloat);
if (step !== null) {
var closestStep = Math.round((val - min) / step) * step + min;
points.push(closestStep);
}
var diffs = points.map(function (point) {
return Math.abs(val - point);
});
return points[diffs.indexOf(Math.min.apply(Math, (0, _toConsumableArray3["default"])(diffs)))];
}
function getPrecision(step) {
var stepString = step.toString();
var precision = 0;
if (stepString.indexOf('.') >= 0) {
precision = stepString.length - stepString.indexOf('.') - 1;
}
return precision;
}
function getMousePosition(vertical, e) {
return vertical ? e.clientY : e.pageX;
}
function getTouchPosition(vertical, e) {
return vertical ? e.touches[0].clientY : e.touches[0].pageX;
}
function getHandleCenterPosition(vertical, handle) {
var coords = handle.getBoundingClientRect();
return vertical ? coords.top + coords.height * 0.5 : coords.left + coords.width * 0.5;
}
function ensureValueInRange(val, _ref3) {
var max = _ref3.max,
min = _ref3.min;
if (val <= min) {
return min;
}
if (val >= max) {
return max;
}
return val;
}
function ensureValuePrecision(val, props) {
var step = props.step;
var closestPoint = getClosestPoint(val, props);
return step === null ? closestPoint : parseFloat(closestPoint.toFixed(getPrecision(step)));
}
function pauseEvent(e) {
e.stopPropagation();
e.preventDefault();
}
/***/ },
/* 74 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _defineProperty2 = __webpack_require__(6);
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _extends2 = __webpack_require__(7);
var _extends3 = _interopRequireDefault(_extends2);
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _classnames2 = __webpack_require__(5);
var _classnames3 = _interopRequireDefault(_classnames2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var tabBarExtraContentStyle = {
"float": 'right'
};
exports["default"] = {
getDefaultProps: function getDefaultProps() {
return {
styles: {}
};
},
onTabClick: function onTabClick(key) {
this.props.onTabClick(key);
},
getTabs: function getTabs() {
var _this = this;
var props = this.props;
var children = props.panels;
var activeKey = props.activeKey;
var rst = [];
var prefixCls = props.prefixCls;
_react2["default"].Children.forEach(children, function (child) {
if (!child) {
return;
}
var key = child.key;
var cls = activeKey === key ? prefixCls + '-tab-active' : '';
cls += ' ' + prefixCls + '-tab';
var events = {};
if (child.props.disabled) {
cls += ' ' + prefixCls + '-tab-disabled';
} else {
events = {
onClick: _this.onTabClick.bind(_this, key)
};
}
var ref = {};
if (activeKey === key) {
ref.ref = 'activeTab';
}
rst.push(_react2["default"].createElement(
'div',
(0, _extends3["default"])({
role: 'tab',
'aria-disabled': child.props.disabled ? 'true' : 'false',
'aria-selected': activeKey === key ? 'true' : 'false'
}, events, {
className: cls,
key: key
}, ref),
child.props.tab
));
});
return rst;
},
getRootNode: function getRootNode(contents) {
var _classnames;
var _props = this.props,
prefixCls = _props.prefixCls,
onKeyDown = _props.onKeyDown,
className = _props.className,
extraContent = _props.extraContent,
style = _props.style;
var cls = (0, _classnames3["default"])((_classnames = {}, (0, _defineProperty3["default"])(_classnames, prefixCls + '-bar', 1), (0, _defineProperty3["default"])(_classnames, className, !!className), _classnames));
return _react2["default"].createElement(
'div',
{
role: 'tablist',
className: cls,
tabIndex: '0',
ref: 'root',
onKeyDown: onKeyDown,
style: style
},
extraContent ? _react2["default"].createElement(
'div',
{
style: tabBarExtraContentStyle,
key: 'extra'
},
extraContent
) : null,
contents
);
}
};
module.exports = exports['default'];
/***/ },
/* 75 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = __webpack_require__(7);
var _extends3 = _interopRequireDefault(_extends2);
var _defineProperty2 = __webpack_require__(6);
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _classnames2 = __webpack_require__(5);
var _classnames3 = _interopRequireDefault(_classnames2);
var _utils = __webpack_require__(49);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var TabContent = _react2["default"].createClass({
displayName: 'TabContent',
propTypes: {
animated: _react.PropTypes.bool,
animatedWithMargin: _react.PropTypes.bool,
prefixCls: _react.PropTypes.string,
children: _react.PropTypes.any,
activeKey: _react.PropTypes.string,
style: _react.PropTypes.any,
tabBarPosition: _react.PropTypes.string
},
getDefaultProps: function getDefaultProps() {
return {
animated: true
};
},
getTabPanes: function getTabPanes() {
var props = this.props;
var activeKey = props.activeKey;
var children = props.children;
var newChildren = [];
_react2["default"].Children.forEach(children, function (child) {
if (!child) {
return;
}
var key = child.key;
var active = activeKey === key;
newChildren.push(_react2["default"].cloneElement(child, {
active: active,
destroyInactiveTabPane: props.destroyInactiveTabPane,
rootPrefixCls: props.prefixCls
}));
});
return newChildren;
},
render: function render() {
var _classnames;
var props = this.props;
var prefixCls = props.prefixCls,
children = props.children,
activeKey = props.activeKey,
tabBarPosition = props.tabBarPosition,
animated = props.animated,
animatedWithMargin = props.animatedWithMargin;
var style = props.style;
var classes = (0, _classnames3["default"])((_classnames = {}, (0, _defineProperty3["default"])(_classnames, prefixCls + '-content', true), (0, _defineProperty3["default"])(_classnames, animated ? prefixCls + '-content-animated' : prefixCls + '-content-no-animated', true), _classnames));
if (animated) {
var activeIndex = (0, _utils.getActiveIndex)(children, activeKey);
if (activeIndex !== -1) {
var animatedStyle = animatedWithMargin ? (0, _utils.getMarginStyle)(activeIndex, tabBarPosition) : (0, _utils.getTransformPropValue)((0, _utils.getTransformByIndex)(activeIndex, tabBarPosition));
style = (0, _extends3["default"])({}, style, animatedStyle);
} else {
style = (0, _extends3["default"])({}, style, {
display: 'none'
});
}
}
return _react2["default"].createElement(
'div',
{
className: classes,
style: style
},
this.getTabPanes()
);
}
});
exports["default"] = TabContent;
module.exports = exports['default'];
/***/ },
/* 76 */
/***/ function(module, exports, __webpack_require__) {
var React = __webpack_require__(1);
var ReactDOM = __webpack_require__(10);
// require('hammerjs') when in a browser. This is safe because Hammer is only
// invoked in componentDidMount, which is not executed on the server.
var Hammer = (typeof window !== 'undefined') ? __webpack_require__(357) : undefined;
var privateProps = {
children: true,
direction: true,
options: true,
recognizeWith: true,
vertical: true,
};
/**
* Hammer Component
* ================
*/
var handlerToEvent = {
action: 'tap press',
onDoubleTap: 'doubletap',
onPan: 'pan',
onPanCancel: 'pancancel',
onPanEnd: 'panend',
onPanStart: 'panstart',
onPinch: 'pinch',
onPinchCancel: 'pinchcancel',
onPinchEnd: 'pinchend',
onPinchIn: 'pinchin',
onPinchOut: 'pinchout',
onPinchStart: 'pinchstart',
onPress: 'press',
onPressUp: 'pressup',
onRotate: 'rotate',
onRotateCancel: 'rotatecancel',
onRotateEnd: 'rotateend',
onRotateMove: 'rotatemove',
onRotateStart: 'rotatestart',
onSwipe: 'swipe',
onTap: 'tap',
};
Object.keys(handlerToEvent).forEach(function (i) {
privateProps[i] = true;
});
function updateHammer (hammer, props) {
if (props.hasOwnProperty('vertical')) {
console.warn('vertical is deprecated, please use `direction` instead');
}
var directionProp = props.direction;
if (directionProp || props.hasOwnProperty('vertical')) {
direction = directionProp ? directionProp : (props.vertical ? 'DIRECTION_ALL' : 'DIRECTION_HORIZONTAL');
hammer.get('pan').set({ direction: Hammer[direction] });
hammer.get('swipe').set({ direction: Hammer[direction] });
}
if (props.options) {
Object.keys(props.options).forEach(function (option) {
if (option === 'recognizers') {
Object.keys(props.options.recognizers).forEach(function (gesture) {
var recognizer = hammer.get(gesture);
recognizer.set(props.options.recognizers[gesture]);
}, this);
} else {
var key = option;
var optionObj = {};
optionObj[key] = props.options[option];
hammer.set(optionObj);
}
}, this);
}
if (props.recognizeWith) {
Object.keys(props.recognizeWith).forEach(function (gesture) {
var recognizer = hammer.get(gesture);
recognizer.recognizeWith(props.recognizeWith[gesture]);
}, this);
}
Object.keys(props).forEach(function (p) {
var e = handlerToEvent[p];
if (e) {
hammer.off(e);
hammer.on(e, props[p]);
}
});
}
var HammerComponent = React.createClass({
displayName: 'Hammer',
propTypes: {
className: React.PropTypes.string,
},
componentDidMount: function () {
this.hammer = new Hammer(ReactDOM.findDOMNode(this));
updateHammer(this.hammer, this.props);
},
componentDidUpdate: function () {
if (this.hammer) {
updateHammer(this.hammer, this.props);
}
},
componentWillUnmount: function () {
if (this.hammer) {
this.hammer.stop();
this.hammer.destroy();
}
this.hammer = null;
},
render: function () {
var props = {};
Object.keys(this.props).forEach(function (i) {
if (!privateProps[i]) {
props[i] = this.props[i];
}
}, this);
// Reuse the child provided
// This makes it flexible to use whatever element is wanted (div, ul, etc)
return React.cloneElement(React.Children.only(this.props.children), props);
}
});
module.exports = HammerComponent;
/***/ },
/* 77 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _ListView = __webpack_require__(128);
var _ListView2 = _interopRequireDefault(_ListView);
var _Indexed = __webpack_require__(448);
var _Indexed2 = _interopRequireDefault(_Indexed);
var _RefreshControl = __webpack_require__(451);
var _RefreshControl2 = _interopRequireDefault(_RefreshControl);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
_ListView2["default"].IndexedList = _Indexed2["default"]; // export this package's api
_ListView2["default"].RefreshControl = _RefreshControl2["default"];
exports["default"] = _ListView2["default"];
module.exports = exports['default'];
/***/ },
/* 78 */
/***/ function(module, exports) {
function arrayTreeFilter(data, filterFn, options) {
options = options || {};
options.childrenKeyName = options.childrenKeyName || 'children';
var children = data || [];
var result = [];
var level = 0;
var foundItem;
do {
var foundItem = children.filter(function(item) {
return filterFn(item, level);
})[0];
if (!foundItem) {
break;
}
result.push(foundItem);
children = foundItem[options.childrenKeyName] || [];
level += 1;
} while(children.length > 0);
return result;
}
module.exports = arrayTreeFilter;
/***/ },
/* 79 */
/***/ function(module, exports, __webpack_require__) {
'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.
getComponentLocale=getComponentLocale;exports.
getLocaleCode=getLocaleCode;var _objectAssign=__webpack_require__(12);var _objectAssign2=_interopRequireDefault(_objectAssign);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}function getComponentLocale(props,context,componentName,getDefaultLocale){var locale=context&&context.antLocale&&context.antLocale[componentName]?context.antLocale[componentName]:getDefaultLocale();var result=(0,_objectAssign2.default)({},locale);if(props.locale){result=(0,_objectAssign2.default)(result,props.locale);if(props.locale.lang){result.lang=(0,_objectAssign2.default)({},locale.lang,props.locale.lang);}}return result;}function getLocaleCode(context){
var localeCode=context.antLocale&&context.antLocale.locale;
if(context.antLocale&&context.antLocale.exist&&!localeCode){
return'zh-cn';
}
return localeCode;
}
/***/ },
/* 80 */
/***/ function(module, exports, __webpack_require__) {
'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.default=undefined;var _extends2=__webpack_require__(7);var _extends3=_interopRequireDefault(_extends2);var _defineProperty2=__webpack_require__(6);var _defineProperty3=_interopRequireDefault(_defineProperty2);var _classCallCheck2=__webpack_require__(2);var _classCallCheck3=_interopRequireDefault(_classCallCheck2);var _possibleConstructorReturn2=__webpack_require__(4);var _possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2);var _inherits2=__webpack_require__(3);var _inherits3=_interopRequireDefault(_inherits2);
var _react=__webpack_require__(1);var _react2=_interopRequireDefault(_react);
var _classnames=__webpack_require__(5);var _classnames2=_interopRequireDefault(_classnames);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}var __rest=undefined&&undefined.__rest||function(s,e){var t={};for(var p in s){if(Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0)t[p]=s[p];}if(s!=null&&typeof Object.getOwnPropertySymbols==="function")for(var i=0,p=Object.getOwnPropertySymbols(s);ioverflowCount?overflowCount+'+':text;
if(dot){
text='';
}
var scrollNumberCls=(0,_classnames2.default)((_classNames={},(0,_defineProperty3.default)(_classNames,
prefixCls+'-dot',dot),(0,_defineProperty3.default)(_classNames,
prefixCls+'-dot-large',dot&&size==='large'),(0,_defineProperty3.default)(_classNames,
prefixCls+'-text',!dot&&!corner),(0,_defineProperty3.default)(_classNames,
prefixCls+'-corner',corner),(0,_defineProperty3.default)(_classNames,
prefixCls+'-corner-large',corner&&size==='large'),_classNames));
var badgeCls=(0,_classnames2.default)((_classNames2={},(0,_defineProperty3.default)(_classNames2,
className,!!className),(0,_defineProperty3.default)(_classNames2,
prefixCls,true),(0,_defineProperty3.default)(_classNames2,
prefixCls+'-not-a-wrapper',!children),(0,_defineProperty3.default)(_classNames2,
prefixCls+'-corner-wrapper',corner),(0,_defineProperty3.default)(_classNames2,
prefixCls+'-hot',!!hot),(0,_defineProperty3.default)(_classNames2,
prefixCls+'-corner-wrapper-large',corner&&size==='large'),_classNames2));
return _react2.default.createElement('span',{className:badgeCls},
children,
(text||dot)&&_react2.default.createElement('sup',(0,_extends3.default)({className:scrollNumberCls},restProps),text));
};return Badge;}(_react2.default.Component);exports.default=Badge;
Badge.defaultProps={
prefixCls:'am-badge',
size:'small',
overflowCount:99,
dot:false,
corner:false};module.exports=exports['default'];
/***/ },
/* 81 */
[490, 307],
/* 82 */
/***/ function(module, exports, __webpack_require__) {
'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.default=undefined;var _extends2=__webpack_require__(7);var _extends3=_interopRequireDefault(_extends2);var _defineProperty2=__webpack_require__(6);var _defineProperty3=_interopRequireDefault(_defineProperty2);var _classCallCheck2=__webpack_require__(2);var _classCallCheck3=_interopRequireDefault(_classCallCheck2);var _possibleConstructorReturn2=__webpack_require__(4);var _possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2);var _inherits2=__webpack_require__(3);var _inherits3=_interopRequireDefault(_inherits2);var _react=__webpack_require__(1);var _react2=_interopRequireDefault(_react);
var _createReactClass=__webpack_require__(46);var _createReactClass2=_interopRequireDefault(_createReactClass);
var _classnames=__webpack_require__(5);var _classnames2=_interopRequireDefault(_classnames);
var _nukaCarousel=__webpack_require__(367);var _nukaCarousel2=_interopRequireDefault(_nukaCarousel);
var _objectAssign=__webpack_require__(12);var _objectAssign2=_interopRequireDefault(_objectAssign);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}var
Carousel=function(_React$Component){(0,_inherits3.default)(Carousel,_React$Component);
function Carousel(props){(0,_classCallCheck3.default)(this,Carousel);var _this=(0,_possibleConstructorReturn3.default)(this,
_React$Component.call(this,props));
_this.onChange=function(index){
_this.setState({
selectedIndex:index},
function(){
if(_this.props.afterChange){
_this.props.afterChange(index);
}
});
};
_this.state={
selectedIndex:_this.props.selectedIndex};return _this;
}Carousel.prototype.
render=function render(){var _classNames2;var _props=
this.props,className=_props.className,prefixCls=_props.prefixCls;
var props=(0,_objectAssign2.default)({},this.props);
props=(0,_objectAssign2.default)(props,{
wrapAround:props.infinite,
slideIndex:props.selectedIndex,
beforeSlide:props.beforeChange});
var Decorators=[];
var current=this.state.selectedIndex;
if(props.dots){
Decorators=[{
component:(0,_createReactClass2.default)({
render:function render(){var _props2=
this.props,slideCount=_props2.slideCount,slidesToScroll=_props2.slidesToScroll;
var arr=[];
for(var i=0;i2&&arguments[2]!==undefined?arguments[2]:3;var _onClose=arguments[3];var mask=arguments.length>4&&arguments[4]!==undefined?arguments[4]:true;
var iconType={
info:'',
success:__webpack_require__(486),
fail:__webpack_require__(485),
offline:__webpack_require__(484),
loading:'loading'}[
type];
var instance=getMessageInstance(mask);
instance.notice({
duration:duration,
style:{},
content:!!iconType?_react2.default.createElement('div',{className:prefixCls+'-text '+prefixCls+'-text-icon'},
_react2.default.createElement(_icon2.default,{type:iconType,size:'lg'}),
_react2.default.createElement('div',{className:prefixCls+'-text-info'},content)):
_react2.default.createElement('div',{className:prefixCls+'-text'},
_react2.default.createElement('div',null,content)),
onClose:function onClose(){
if(_onClose){
_onClose();
}
instance.destroy();
instance=null;
messageInstance=null;
}});
}exports.default=
{
SHORT:3,
LONG:8,
show:function show(content,duration,mask){
return notice(content,'info',duration,function(){},mask);
},
info:function info(content,duration,onClose,mask){
return notice(content,'info',duration,onClose,mask);
},
success:function success(content,duration,onClose,mask){
return notice(content,'success',duration,onClose,mask);
},
fail:function fail(content,duration,onClose,mask){
return notice(content,'fail',duration,onClose,mask);
},
offline:function offline(content,duration,onClose,mask){
return notice(content,'offline',duration,onClose,mask);
},
loading:function loading(content,duration,onClose,mask){
return notice(content,'loading',duration,onClose,mask);
},
hide:function hide(){
if(messageInstance){
messageInstance.destroy();
messageInstance=null;
}
}};module.exports=exports['default'];
/***/ },
/* 90 */
[491, 349],
/* 91 */
/***/ function(module, exports, __webpack_require__) {
'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.default=undefined;var _classCallCheck2=__webpack_require__(2);var _classCallCheck3=_interopRequireDefault(_classCallCheck2);var _possibleConstructorReturn2=__webpack_require__(4);var _possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2);var _inherits2=__webpack_require__(3);var _inherits3=_interopRequireDefault(_inherits2);var _react=__webpack_require__(1);var _react2=_interopRequireDefault(_react);
var _objectAssign=__webpack_require__(12);var _objectAssign2=_interopRequireDefault(_objectAssign);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}var
View=function(_React$Component){(0,_inherits3.default)(View,_React$Component);function View(){(0,_classCallCheck3.default)(this,View);return(0,_possibleConstructorReturn3.default)(this,_React$Component.apply(this,arguments));}View.prototype.
render=function render(){
var props=(0,_objectAssign2.default)({},this.props);
if(Array.isArray(props.style)){
var style={};
props.style.forEach(function(s){
(0,_objectAssign2.default)(style,s);
});
props.style=style;
}var
Component=props.Component;
return _react2.default.createElement(Component,props);
};return View;}(_react2.default.Component);exports.default=View;
View.defaultProps={
Component:'div'};module.exports=exports['default'];
/***/ },
/* 92 */
/***/ function(module, exports, __webpack_require__) {
'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.default=undefined;var _defineProperty2=__webpack_require__(6);var _defineProperty3=_interopRequireDefault(_defineProperty2);var _classCallCheck2=__webpack_require__(2);var _classCallCheck3=_interopRequireDefault(_classCallCheck2);var _possibleConstructorReturn2=__webpack_require__(4);var _possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2);var _inherits2=__webpack_require__(3);var _inherits3=_interopRequireDefault(_inherits2);var _react=__webpack_require__(1);var _react2=_interopRequireDefault(_react);
var _classnames=__webpack_require__(5);var _classnames2=_interopRequireDefault(_classnames);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}var
WingBlank=function(_React$Component){(0,_inherits3.default)(WingBlank,_React$Component);function WingBlank(){(0,_classCallCheck3.default)(this,WingBlank);return(0,_possibleConstructorReturn3.default)(this,_React$Component.apply(this,arguments));}WingBlank.prototype.
render=function render(){var _classNames;var _props=
this.props,prefixCls=_props.prefixCls,size=_props.size,className=_props.className,children=_props.children,style=_props.style;
var wrapCls=(0,_classnames2.default)((_classNames={},(0,_defineProperty3.default)(_classNames,''+
prefixCls,true),(0,_defineProperty3.default)(_classNames,
prefixCls+'-'+size,true),(0,_defineProperty3.default)(_classNames,
className,!!className),_classNames));
return _react2.default.createElement('div',{className:wrapCls,style:style},
children);
};return WingBlank;}(_react2.default.Component);exports.default=WingBlank;
WingBlank.defaultProps={
prefixCls:'am-wingblank',
size:'lg'};module.exports=exports['default'];
/***/ },
/* 93 */
[490, 351],
/* 94 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _from = __webpack_require__(242);
var _from2 = _interopRequireDefault(_from);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = function (arr) {
if (Array.isArray(arr)) {
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) {
arr2[i] = arr[i];
}
return arr2;
} else {
return (0, _from2.default)(arr);
}
};
/***/ },
/* 95 */
/***/ function(module, exports, __webpack_require__) {
/**
* Module dependencies.
*/
try {
var index = __webpack_require__(96);
} catch (err) {
var index = __webpack_require__(96);
}
/**
* Whitespace regexp.
*/
var re = /\s+/;
/**
* toString reference.
*/
var toString = Object.prototype.toString;
/**
* Wrap `el` in a `ClassList`.
*
* @param {Element} el
* @return {ClassList}
* @api public
*/
module.exports = function(el){
return new ClassList(el);
};
/**
* Initialize a new ClassList for `el`.
*
* @param {Element} el
* @api private
*/
function ClassList(el) {
if (!el || !el.nodeType) {
throw new Error('A DOM element reference is required');
}
this.el = el;
this.list = el.classList;
}
/**
* Add class `name` if not already present.
*
* @param {String} name
* @return {ClassList}
* @api public
*/
ClassList.prototype.add = function(name){
// classList
if (this.list) {
this.list.add(name);
return this;
}
// fallback
var arr = this.array();
var i = index(arr, name);
if (!~i) arr.push(name);
this.el.className = arr.join(' ');
return this;
};
/**
* Remove class `name` when present, or
* pass a regular expression to remove
* any which match.
*
* @param {String|RegExp} name
* @return {ClassList}
* @api public
*/
ClassList.prototype.remove = function(name){
if ('[object RegExp]' == toString.call(name)) {
return this.removeMatching(name);
}
// classList
if (this.list) {
this.list.remove(name);
return this;
}
// fallback
var arr = this.array();
var i = index(arr, name);
if (~i) arr.splice(i, 1);
this.el.className = arr.join(' ');
return this;
};
/**
* Remove all classes matching `re`.
*
* @param {RegExp} re
* @return {ClassList}
* @api private
*/
ClassList.prototype.removeMatching = function(re){
var arr = this.array();
for (var i = 0; i < arr.length; i++) {
if (re.test(arr[i])) {
this.remove(arr[i]);
}
}
return this;
};
/**
* Toggle class `name`, can force state via `force`.
*
* For browsers that support classList, but do not support `force` yet,
* the mistake will be detected and corrected.
*
* @param {String} name
* @param {Boolean} force
* @return {ClassList}
* @api public
*/
ClassList.prototype.toggle = function(name, force){
// classList
if (this.list) {
if ("undefined" !== typeof force) {
if (force !== this.list.toggle(name, force)) {
this.list.toggle(name); // toggle again to correct
}
} else {
this.list.toggle(name);
}
return this;
}
// fallback
if ("undefined" !== typeof force) {
if (!force) {
this.remove(name);
} else {
this.add(name);
}
} else {
if (this.has(name)) {
this.remove(name);
} else {
this.add(name);
}
}
return this;
};
/**
* Return an array of classes.
*
* @return {Array}
* @api public
*/
ClassList.prototype.array = function(){
var className = this.el.getAttribute('class') || '';
var str = className.replace(/^\s+|\s+$/g, '');
var arr = str.split(re);
if ('' === arr[0]) arr.shift();
return arr;
};
/**
* Check if class `name` is present.
*
* @param {String} name
* @return {ClassList}
* @api public
*/
ClassList.prototype.has =
ClassList.prototype.contains = function(name){
return this.list
? this.list.contains(name)
: !! ~index(this.array(), name);
};
/***/ },
/* 96 */
/***/ function(module, exports) {
module.exports = function(arr, obj){
if (arr.indexOf) return arr.indexOf(obj);
for (var i = 0; i < arr.length; ++i) {
if (arr[i] === obj) return i;
}
return -1;
};
/***/ },
/* 97 */
/***/ function(module, exports, __webpack_require__) {
// getting tag from 19.1.3.6 Object.prototype.toString()
var cof = __webpack_require__(57)
, TAG = __webpack_require__(14)('toStringTag')
// ES3 wrong here
, ARG = cof(function(){ return arguments; }()) == 'Arguments';
// fallback for IE11 Script Access Denied error
var tryGet = function(it, key){
try {
return it[key];
} catch(e){ /* empty */ }
};
module.exports = function(it){
var O, T, B;
return it === undefined ? 'Undefined' : it === null ? 'Null'
// @@toStringTag case
: typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T
// builtinTag case
: ARG ? cof(O)
// ES3 arguments fallback
: (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
};
/***/ },
/* 98 */
/***/ function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(35)
, document = __webpack_require__(19).document
// in old IE typeof document.createElement is 'object'
, is = isObject(document) && isObject(document.createElement);
module.exports = function(it){
return is ? document.createElement(it) : {};
};
/***/ },
/* 99 */
/***/ function(module, exports, __webpack_require__) {
module.exports = !__webpack_require__(23) && !__webpack_require__(34)(function(){
return Object.defineProperty(__webpack_require__(98)('div'), 'a', {get: function(){ return 7; }}).a != 7;
});
/***/ },
/* 100 */
/***/ function(module, exports, __webpack_require__) {
// fallback for non-array-like ES3 and non-enumerable old V8 strings
var cof = __webpack_require__(57);
module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){
return cof(it) == 'String' ? it.split('') : Object(it);
};
/***/ },
/* 101 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var LIBRARY = __webpack_require__(61)
, $export = __webpack_require__(24)
, redefine = __webpack_require__(105)
, hide = __webpack_require__(29)
, has = __webpack_require__(25)
, Iterators = __webpack_require__(30)
, $iterCreate = __webpack_require__(270)
, setToStringTag = __webpack_require__(64)
, getPrototypeOf = __webpack_require__(278)
, ITERATOR = __webpack_require__(14)('iterator')
, BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next`
, FF_ITERATOR = '@@iterator'
, KEYS = 'keys'
, VALUES = 'values';
var returnThis = function(){ return this; };
module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){
$iterCreate(Constructor, NAME, next);
var getMethod = function(kind){
if(!BUGGY && kind in proto)return proto[kind];
switch(kind){
case KEYS: return function keys(){ return new Constructor(this, kind); };
case VALUES: return function values(){ return new Constructor(this, kind); };
} return function entries(){ return new Constructor(this, kind); };
};
var TAG = NAME + ' Iterator'
, DEF_VALUES = DEFAULT == VALUES
, VALUES_BUG = false
, proto = Base.prototype
, $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]
, $default = $native || getMethod(DEFAULT)
, $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined
, $anyNative = NAME == 'Array' ? proto.entries || $native : $native
, methods, key, IteratorPrototype;
// Fix native
if($anyNative){
IteratorPrototype = getPrototypeOf($anyNative.call(new Base));
if(IteratorPrototype !== Object.prototype){
// Set @@toStringTag to native iterators
setToStringTag(IteratorPrototype, TAG, true);
// fix for some old engines
if(!LIBRARY && !has(IteratorPrototype, ITERATOR))hide(IteratorPrototype, ITERATOR, returnThis);
}
}
// fix Array#{values, @@iterator}.name in V8 / FF
if(DEF_VALUES && $native && $native.name !== VALUES){
VALUES_BUG = true;
$default = function values(){ return $native.call(this); };
}
// Define iterator
if((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])){
hide(proto, ITERATOR, $default);
}
// Plug for library
Iterators[NAME] = $default;
Iterators[TAG] = returnThis;
if(DEFAULT){
methods = {
values: DEF_VALUES ? $default : getMethod(VALUES),
keys: IS_SET ? $default : getMethod(KEYS),
entries: $entries
};
if(FORCED)for(key in methods){
if(!(key in proto))redefine(proto, key, methods[key]);
} else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
}
return methods;
};
/***/ },
/* 102 */
/***/ function(module, exports, __webpack_require__) {
var pIE = __webpack_require__(43)
, createDesc = __webpack_require__(37)
, toIObject = __webpack_require__(26)
, toPrimitive = __webpack_require__(69)
, has = __webpack_require__(25)
, IE8_DOM_DEFINE = __webpack_require__(99)
, gOPD = Object.getOwnPropertyDescriptor;
exports.f = __webpack_require__(23) ? gOPD : function getOwnPropertyDescriptor(O, P){
O = toIObject(O);
P = toPrimitive(P, true);
if(IE8_DOM_DEFINE)try {
return gOPD(O, P);
} catch(e){ /* empty */ }
if(has(O, P))return createDesc(!pIE.f.call(O, P), O[P]);
};
/***/ },
/* 103 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
var $keys = __webpack_require__(104)
, hiddenKeys = __webpack_require__(60).concat('length', 'prototype');
exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O){
return $keys(O, hiddenKeys);
};
/***/ },
/* 104 */
/***/ function(module, exports, __webpack_require__) {
var has = __webpack_require__(25)
, toIObject = __webpack_require__(26)
, arrayIndexOf = __webpack_require__(263)(false)
, IE_PROTO = __webpack_require__(65)('IE_PROTO');
module.exports = function(object, names){
var O = toIObject(object)
, i = 0
, result = []
, key;
for(key in O)if(key != IE_PROTO)has(O, key) && result.push(key);
// Don't enum bug & hidden keys
while(names.length > i)if(has(O, key = names[i++])){
~arrayIndexOf(result, key) || result.push(key);
}
return result;
};
/***/ },
/* 105 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(29);
/***/ },
/* 106 */
/***/ function(module, exports, __webpack_require__) {
// 7.1.15 ToLength
var toInteger = __webpack_require__(67)
, min = Math.min;
module.exports = function(it){
return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
};
/***/ },
/* 107 */
/***/ function(module, exports, __webpack_require__) {
var classof = __webpack_require__(97)
, ITERATOR = __webpack_require__(14)('iterator')
, Iterators = __webpack_require__(30);
module.exports = __webpack_require__(13).getIteratorMethod = function(it){
if(it != undefined)return it[ITERATOR]
|| it['@@iterator']
|| Iterators[classof(it)];
};
/***/ },
/* 108 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _Event = __webpack_require__(295);
var _Event2 = _interopRequireDefault(_Event);
var _componentClasses = __webpack_require__(95);
var _componentClasses2 = _interopRequireDefault(_componentClasses);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var isCssAnimationSupported = _Event2["default"].endEvents.length !== 0;
var capitalPrefixes = ['Webkit', 'Moz', 'O',
// ms is special .... !
'ms'];
var prefixes = ['-webkit-', '-moz-', '-o-', 'ms-', ''];
function getStyleProperty(node, name) {
// old ff need null, https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle
var style = window.getComputedStyle(node, null);
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 transitionDelay = parseFloat(getStyleProperty(node, 'transition-delay')) || 0;
var transitionDuration = parseFloat(getStyleProperty(node, 'transition-duration')) || 0;
var animationDelay = parseFloat(getStyleProperty(node, 'animation-delay')) || 0;
var animationDuration = parseFloat(getStyleProperty(node, 'animation-duration')) || 0;
var time = Math.max(transitionDuration + transitionDelay, animationDuration + animationDelay);
// 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, endCallback) {
var nameIsObj = (typeof transitionName === 'undefined' ? 'undefined' : _typeof(transitionName)) === 'object';
var className = nameIsObj ? transitionName.name : transitionName;
var activeClassName = nameIsObj ? transitionName.active : transitionName + '-active';
var end = endCallback;
var start = void 0;
var active = void 0;
var nodeClasses = (0, _componentClasses2["default"])(node);
if (endCallback && Object.prototype.toString.call(endCallback) === '[object Object]') {
end = endCallback.end;
start = endCallback.start;
active = endCallback.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);
nodeClasses.remove(className);
nodeClasses.remove(activeClassName);
_Event2["default"].removeEndEventListener(node, node.rcEndListener);
node.rcEndListener = null;
// Usually this optional end is used for informing an owner of
// a leave animation and telling it to remove the child.
if (end) {
end();
}
};
_Event2["default"].addEndEventListener(node, node.rcEndListener);
if (start) {
start();
}
nodeClasses.add(className);
node.rcAnimTimeout = setTimeout(function () {
node.rcAnimTimeout = null;
nodeClasses.add(activeClassName);
if (active) {
setTimeout(active, 0);
}
fixBrowserByTimeout(node);
// 30ms for firefox
}, 30);
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);
_Event2["default"].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();
}
};
_Event2["default"].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 || '';
capitalPrefixes.forEach(function (prefix) {
node.style[prefix + 'Transition' + property] = v;
});
};
cssAnimation.isCssAnimationSupported = isCssAnimationSupported;
exports["default"] = cssAnimation;
module.exports = exports['default'];
/***/ },
/* 109 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _utils = __webpack_require__(38);
var _utils2 = _interopRequireDefault(_utils);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/**
* 得到会导致元素显示不全的祖先元素
*/
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 = void 0;
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'];
/***/ },
/* 110 */
/***/ function(module, exports) {
"use strict";
/**
* Copyright (c) 2013-present, 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.
*
*
*/
function makeEmptyFunction(arg) {
return function () {
return arg;
};
}
/**
* This function accepts and discards inputs; it has no side effects. This is
* primarily useful idiomatically for overridable function endpoints which
* always need to be callable, since JS lacks a null-call idiom ala Cocoa.
*/
var emptyFunction = function emptyFunction() {};
emptyFunction.thatReturns = makeEmptyFunction;
emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
emptyFunction.thatReturnsNull = makeEmptyFunction(null);
emptyFunction.thatReturnsThis = function () {
return this;
};
emptyFunction.thatReturnsArgument = function (arg) {
return arg;
};
module.exports = emptyFunction;
/***/ },
/* 111 */
/***/ function(module, exports) {
//! moment.js
//! version : 2.18.1
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
//! license : MIT
//! momentjs.com
;(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
global.moment = factory()
}(this, (function () { 'use strict';
var hookCallback;
function hooks () {
return hookCallback.apply(null, arguments);
}
// This is done to register the method called with moment()
// without creating circular dependencies.
function setHookCallback (callback) {
hookCallback = callback;
}
function isArray(input) {
return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]';
}
function isObject(input) {
// IE8 will treat undefined and null as object if it wasn't for
// input != null
return input != null && Object.prototype.toString.call(input) === '[object Object]';
}
function isObjectEmpty(obj) {
var k;
for (k in obj) {
// even if its not own property I'd still call it non-empty
return false;
}
return true;
}
function isUndefined(input) {
return input === void 0;
}
function isNumber(input) {
return typeof input === 'number' || Object.prototype.toString.call(input) === '[object Number]';
}
function isDate(input) {
return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]';
}
function map(arr, fn) {
var res = [], i;
for (i = 0; i < arr.length; ++i) {
res.push(fn(arr[i], i));
}
return res;
}
function hasOwnProp(a, b) {
return Object.prototype.hasOwnProperty.call(a, b);
}
function extend(a, b) {
for (var i in b) {
if (hasOwnProp(b, i)) {
a[i] = b[i];
}
}
if (hasOwnProp(b, 'toString')) {
a.toString = b.toString;
}
if (hasOwnProp(b, 'valueOf')) {
a.valueOf = b.valueOf;
}
return a;
}
function createUTC (input, format, locale, strict) {
return createLocalOrUTC(input, format, locale, strict, true).utc();
}
function defaultParsingFlags() {
// We need to deep clone this object.
return {
empty : false,
unusedTokens : [],
unusedInput : [],
overflow : -2,
charsLeftOver : 0,
nullInput : false,
invalidMonth : null,
invalidFormat : false,
userInvalidated : false,
iso : false,
parsedDateParts : [],
meridiem : null,
rfc2822 : false,
weekdayMismatch : false
};
}
function getParsingFlags(m) {
if (m._pf == null) {
m._pf = defaultParsingFlags();
}
return m._pf;
}
var some;
if (Array.prototype.some) {
some = Array.prototype.some;
} else {
some = function (fun) {
var t = Object(this);
var len = t.length >>> 0;
for (var i = 0; i < len; i++) {
if (i in t && fun.call(this, t[i], i, t)) {
return true;
}
}
return false;
};
}
var some$1 = some;
function isValid(m) {
if (m._isValid == null) {
var flags = getParsingFlags(m);
var parsedParts = some$1.call(flags.parsedDateParts, function (i) {
return i != null;
});
var isNowValid = !isNaN(m._d.getTime()) &&
flags.overflow < 0 &&
!flags.empty &&
!flags.invalidMonth &&
!flags.invalidWeekday &&
!flags.nullInput &&
!flags.invalidFormat &&
!flags.userInvalidated &&
(!flags.meridiem || (flags.meridiem && parsedParts));
if (m._strict) {
isNowValid = isNowValid &&
flags.charsLeftOver === 0 &&
flags.unusedTokens.length === 0 &&
flags.bigHour === undefined;
}
if (Object.isFrozen == null || !Object.isFrozen(m)) {
m._isValid = isNowValid;
}
else {
return isNowValid;
}
}
return m._isValid;
}
function createInvalid (flags) {
var m = createUTC(NaN);
if (flags != null) {
extend(getParsingFlags(m), flags);
}
else {
getParsingFlags(m).userInvalidated = true;
}
return m;
}
// Plugins that add properties should also add the key here (null value),
// so we can properly clone ourselves.
var momentProperties = hooks.momentProperties = [];
function copyConfig(to, from) {
var i, prop, val;
if (!isUndefined(from._isAMomentObject)) {
to._isAMomentObject = from._isAMomentObject;
}
if (!isUndefined(from._i)) {
to._i = from._i;
}
if (!isUndefined(from._f)) {
to._f = from._f;
}
if (!isUndefined(from._l)) {
to._l = from._l;
}
if (!isUndefined(from._strict)) {
to._strict = from._strict;
}
if (!isUndefined(from._tzm)) {
to._tzm = from._tzm;
}
if (!isUndefined(from._isUTC)) {
to._isUTC = from._isUTC;
}
if (!isUndefined(from._offset)) {
to._offset = from._offset;
}
if (!isUndefined(from._pf)) {
to._pf = getParsingFlags(from);
}
if (!isUndefined(from._locale)) {
to._locale = from._locale;
}
if (momentProperties.length > 0) {
for (i = 0; i < momentProperties.length; i++) {
prop = momentProperties[i];
val = from[prop];
if (!isUndefined(val)) {
to[prop] = val;
}
}
}
return to;
}
var updateInProgress = false;
// Moment prototype object
function Moment(config) {
copyConfig(this, config);
this._d = new Date(config._d != null ? config._d.getTime() : NaN);
if (!this.isValid()) {
this._d = new Date(NaN);
}
// Prevent infinite loop in case updateOffset creates new moment
// objects.
if (updateInProgress === false) {
updateInProgress = true;
hooks.updateOffset(this);
updateInProgress = false;
}
}
function isMoment (obj) {
return obj instanceof Moment || (obj != null && obj._isAMomentObject != null);
}
function absFloor (number) {
if (number < 0) {
// -0 -> 0
return Math.ceil(number) || 0;
} else {
return Math.floor(number);
}
}
function toInt(argumentForCoercion) {
var coercedNumber = +argumentForCoercion,
value = 0;
if (coercedNumber !== 0 && isFinite(coercedNumber)) {
value = absFloor(coercedNumber);
}
return value;
}
// compare two arrays, return the number of differences
function compareArrays(array1, array2, dontConvert) {
var len = Math.min(array1.length, array2.length),
lengthDiff = Math.abs(array1.length - array2.length),
diffs = 0,
i;
for (i = 0; i < len; i++) {
if ((dontConvert && array1[i] !== array2[i]) ||
(!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {
diffs++;
}
}
return diffs + lengthDiff;
}
function warn(msg) {
if (hooks.suppressDeprecationWarnings === false &&
(typeof console !== 'undefined') && console.warn) {
console.warn('Deprecation warning: ' + msg);
}
}
function deprecate(msg, fn) {
var firstTime = true;
return extend(function () {
if (hooks.deprecationHandler != null) {
hooks.deprecationHandler(null, msg);
}
if (firstTime) {
var args = [];
var arg;
for (var i = 0; i < arguments.length; i++) {
arg = '';
if (typeof arguments[i] === 'object') {
arg += '\n[' + i + '] ';
for (var key in arguments[0]) {
arg += key + ': ' + arguments[0][key] + ', ';
}
arg = arg.slice(0, -2); // Remove trailing comma and space
} else {
arg = arguments[i];
}
args.push(arg);
}
warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack);
firstTime = false;
}
return fn.apply(this, arguments);
}, fn);
}
var deprecations = {};
function deprecateSimple(name, msg) {
if (hooks.deprecationHandler != null) {
hooks.deprecationHandler(name, msg);
}
if (!deprecations[name]) {
warn(msg);
deprecations[name] = true;
}
}
hooks.suppressDeprecationWarnings = false;
hooks.deprecationHandler = null;
function isFunction(input) {
return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]';
}
function set (config) {
var prop, i;
for (i in config) {
prop = config[i];
if (isFunction(prop)) {
this[i] = prop;
} else {
this['_' + i] = prop;
}
}
this._config = config;
// Lenient ordinal parsing accepts just a number in addition to
// number + (possibly) stuff coming from _dayOfMonthOrdinalParse.
// TODO: Remove "ordinalParse" fallback in next major release.
this._dayOfMonthOrdinalParseLenient = new RegExp(
(this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) +
'|' + (/\d{1,2}/).source);
}
function mergeConfigs(parentConfig, childConfig) {
var res = extend({}, parentConfig), prop;
for (prop in childConfig) {
if (hasOwnProp(childConfig, prop)) {
if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {
res[prop] = {};
extend(res[prop], parentConfig[prop]);
extend(res[prop], childConfig[prop]);
} else if (childConfig[prop] != null) {
res[prop] = childConfig[prop];
} else {
delete res[prop];
}
}
}
for (prop in parentConfig) {
if (hasOwnProp(parentConfig, prop) &&
!hasOwnProp(childConfig, prop) &&
isObject(parentConfig[prop])) {
// make sure changes to properties don't modify parent config
res[prop] = extend({}, res[prop]);
}
}
return res;
}
function Locale(config) {
if (config != null) {
this.set(config);
}
}
var keys;
if (Object.keys) {
keys = Object.keys;
} else {
keys = function (obj) {
var i, res = [];
for (i in obj) {
if (hasOwnProp(obj, i)) {
res.push(i);
}
}
return res;
};
}
var keys$1 = keys;
var defaultCalendar = {
sameDay : '[Today at] LT',
nextDay : '[Tomorrow at] LT',
nextWeek : 'dddd [at] LT',
lastDay : '[Yesterday at] LT',
lastWeek : '[Last] dddd [at] LT',
sameElse : 'L'
};
function calendar (key, mom, now) {
var output = this._calendar[key] || this._calendar['sameElse'];
return isFunction(output) ? output.call(mom, now) : output;
}
var defaultLongDateFormat = {
LTS : 'h:mm:ss A',
LT : 'h:mm A',
L : 'MM/DD/YYYY',
LL : 'MMMM D, YYYY',
LLL : 'MMMM D, YYYY h:mm A',
LLLL : 'dddd, MMMM D, YYYY h:mm A'
};
function longDateFormat (key) {
var format = this._longDateFormat[key],
formatUpper = this._longDateFormat[key.toUpperCase()];
if (format || !formatUpper) {
return format;
}
this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) {
return val.slice(1);
});
return this._longDateFormat[key];
}
var defaultInvalidDate = 'Invalid date';
function invalidDate () {
return this._invalidDate;
}
var defaultOrdinal = '%d';
var defaultDayOfMonthOrdinalParse = /\d{1,2}/;
function ordinal (number) {
return this._ordinal.replace('%d', number);
}
var defaultRelativeTime = {
future : 'in %s',
past : '%s ago',
s : 'a few seconds',
ss : '%d seconds',
m : 'a minute',
mm : '%d minutes',
h : 'an hour',
hh : '%d hours',
d : 'a day',
dd : '%d days',
M : 'a month',
MM : '%d months',
y : 'a year',
yy : '%d years'
};
function relativeTime (number, withoutSuffix, string, isFuture) {
var output = this._relativeTime[string];
return (isFunction(output)) ?
output(number, withoutSuffix, string, isFuture) :
output.replace(/%d/i, number);
}
function pastFuture (diff, output) {
var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
return isFunction(format) ? format(output) : format.replace(/%s/i, output);
}
var aliases = {};
function addUnitAlias (unit, shorthand) {
var lowerCase = unit.toLowerCase();
aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit;
}
function normalizeUnits(units) {
return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined;
}
function normalizeObjectUnits(inputObject) {
var normalizedInput = {},
normalizedProp,
prop;
for (prop in inputObject) {
if (hasOwnProp(inputObject, prop)) {
normalizedProp = normalizeUnits(prop);
if (normalizedProp) {
normalizedInput[normalizedProp] = inputObject[prop];
}
}
}
return normalizedInput;
}
var priorities = {};
function addUnitPriority(unit, priority) {
priorities[unit] = priority;
}
function getPrioritizedUnits(unitsObj) {
var units = [];
for (var u in unitsObj) {
units.push({unit: u, priority: priorities[u]});
}
units.sort(function (a, b) {
return a.priority - b.priority;
});
return units;
}
function makeGetSet (unit, keepTime) {
return function (value) {
if (value != null) {
set$1(this, unit, value);
hooks.updateOffset(this, keepTime);
return this;
} else {
return get(this, unit);
}
};
}
function get (mom, unit) {
return mom.isValid() ?
mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN;
}
function set$1 (mom, unit, value) {
if (mom.isValid()) {
mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
}
}
// MOMENTS
function stringGet (units) {
units = normalizeUnits(units);
if (isFunction(this[units])) {
return this[units]();
}
return this;
}
function stringSet (units, value) {
if (typeof units === 'object') {
units = normalizeObjectUnits(units);
var prioritized = getPrioritizedUnits(units);
for (var i = 0; i < prioritized.length; i++) {
this[prioritized[i].unit](units[prioritized[i].unit]);
}
} else {
units = normalizeUnits(units);
if (isFunction(this[units])) {
return this[units](value);
}
}
return this;
}
function zeroFill(number, targetLength, forceSign) {
var absNumber = '' + Math.abs(number),
zerosToFill = targetLength - absNumber.length,
sign = number >= 0;
return (sign ? (forceSign ? '+' : '') : '-') +
Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber;
}
var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;
var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g;
var formatFunctions = {};
var formatTokenFunctions = {};
// token: 'M'
// padded: ['MM', 2]
// ordinal: 'Mo'
// callback: function () { this.month() + 1 }
function addFormatToken (token, padded, ordinal, callback) {
var func = callback;
if (typeof callback === 'string') {
func = function () {
return this[callback]();
};
}
if (token) {
formatTokenFunctions[token] = func;
}
if (padded) {
formatTokenFunctions[padded[0]] = function () {
return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
};
}
if (ordinal) {
formatTokenFunctions[ordinal] = function () {
return this.localeData().ordinal(func.apply(this, arguments), token);
};
}
}
function removeFormattingTokens(input) {
if (input.match(/\[[\s\S]/)) {
return input.replace(/^\[|\]$/g, '');
}
return input.replace(/\\/g, '');
}
function makeFormatFunction(format) {
var array = format.match(formattingTokens), i, length;
for (i = 0, length = array.length; i < length; i++) {
if (formatTokenFunctions[array[i]]) {
array[i] = formatTokenFunctions[array[i]];
} else {
array[i] = removeFormattingTokens(array[i]);
}
}
return function (mom) {
var output = '', i;
for (i = 0; i < length; i++) {
output += isFunction(array[i]) ? array[i].call(mom, format) : array[i];
}
return output;
};
}
// format date using native date object
function formatMoment(m, format) {
if (!m.isValid()) {
return m.localeData().invalidDate();
}
format = expandFormat(format, m.localeData());
formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);
return formatFunctions[format](m);
}
function expandFormat(format, locale) {
var i = 5;
function replaceLongDateFormatTokens(input) {
return locale.longDateFormat(input) || input;
}
localFormattingTokens.lastIndex = 0;
while (i >= 0 && localFormattingTokens.test(format)) {
format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);
localFormattingTokens.lastIndex = 0;
i -= 1;
}
return format;
}
var match1 = /\d/; // 0 - 9
var match2 = /\d\d/; // 00 - 99
var match3 = /\d{3}/; // 000 - 999
var match4 = /\d{4}/; // 0000 - 9999
var match6 = /[+-]?\d{6}/; // -999999 - 999999
var match1to2 = /\d\d?/; // 0 - 99
var match3to4 = /\d\d\d\d?/; // 999 - 9999
var match5to6 = /\d\d\d\d\d\d?/; // 99999 - 999999
var match1to3 = /\d{1,3}/; // 0 - 999
var match1to4 = /\d{1,4}/; // 0 - 9999
var match1to6 = /[+-]?\d{1,6}/; // -999999 - 999999
var matchUnsigned = /\d+/; // 0 - inf
var matchSigned = /[+-]?\d+/; // -inf - inf
var matchOffset = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z
var matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi; // +00 -00 +00:00 -00:00 +0000 -0000 or Z
var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123
// any word (or two) characters or numbers including two/three word month in arabic.
// includes scottish gaelic two word and hyphenated months
var matchWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i;
var regexes = {};
function addRegexToken (token, regex, strictRegex) {
regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) {
return (isStrict && strictRegex) ? strictRegex : regex;
};
}
function getParseRegexForToken (token, config) {
if (!hasOwnProp(regexes, token)) {
return new RegExp(unescapeFormat(token));
}
return regexes[token](config._strict, config._locale);
}
// Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
function unescapeFormat(s) {
return regexEscape(s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) {
return p1 || p2 || p3 || p4;
}));
}
function regexEscape(s) {
return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
}
var tokens = {};
function addParseToken (token, callback) {
var i, func = callback;
if (typeof token === 'string') {
token = [token];
}
if (isNumber(callback)) {
func = function (input, array) {
array[callback] = toInt(input);
};
}
for (i = 0; i < token.length; i++) {
tokens[token[i]] = func;
}
}
function addWeekParseToken (token, callback) {
addParseToken(token, function (input, array, config, token) {
config._w = config._w || {};
callback(input, config._w, config, token);
});
}
function addTimeToArrayFromToken(token, input, config) {
if (input != null && hasOwnProp(tokens, token)) {
tokens[token](input, config._a, config, token);
}
}
var YEAR = 0;
var MONTH = 1;
var DATE = 2;
var HOUR = 3;
var MINUTE = 4;
var SECOND = 5;
var MILLISECOND = 6;
var WEEK = 7;
var WEEKDAY = 8;
var indexOf;
if (Array.prototype.indexOf) {
indexOf = Array.prototype.indexOf;
} else {
indexOf = function (o) {
// I know
var i;
for (i = 0; i < this.length; ++i) {
if (this[i] === o) {
return i;
}
}
return -1;
};
}
var indexOf$1 = indexOf;
function daysInMonth(year, month) {
return new Date(Date.UTC(year, month + 1, 0)).getUTCDate();
}
// FORMATTING
addFormatToken('M', ['MM', 2], 'Mo', function () {
return this.month() + 1;
});
addFormatToken('MMM', 0, 0, function (format) {
return this.localeData().monthsShort(this, format);
});
addFormatToken('MMMM', 0, 0, function (format) {
return this.localeData().months(this, format);
});
// ALIASES
addUnitAlias('month', 'M');
// PRIORITY
addUnitPriority('month', 8);
// PARSING
addRegexToken('M', match1to2);
addRegexToken('MM', match1to2, match2);
addRegexToken('MMM', function (isStrict, locale) {
return locale.monthsShortRegex(isStrict);
});
addRegexToken('MMMM', function (isStrict, locale) {
return locale.monthsRegex(isStrict);
});
addParseToken(['M', 'MM'], function (input, array) {
array[MONTH] = toInt(input) - 1;
});
addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
var month = config._locale.monthsParse(input, token, config._strict);
// if we didn't find a month name, mark the date as invalid.
if (month != null) {
array[MONTH] = month;
} else {
getParsingFlags(config).invalidMonth = input;
}
});
// LOCALES
var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/;
var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_');
function localeMonths (m, format) {
if (!m) {
return isArray(this._months) ? this._months :
this._months['standalone'];
}
return isArray(this._months) ? this._months[m.month()] :
this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format) ? 'format' : 'standalone'][m.month()];
}
var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_');
function localeMonthsShort (m, format) {
if (!m) {
return isArray(this._monthsShort) ? this._monthsShort :
this._monthsShort['standalone'];
}
return isArray(this._monthsShort) ? this._monthsShort[m.month()] :
this._monthsShort[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()];
}
function handleStrictParse(monthName, format, strict) {
var i, ii, mom, llc = monthName.toLocaleLowerCase();
if (!this._monthsParse) {
// this is not used
this._monthsParse = [];
this._longMonthsParse = [];
this._shortMonthsParse = [];
for (i = 0; i < 12; ++i) {
mom = createUTC([2000, i]);
this._shortMonthsParse[i] = this.monthsShort(mom, '').toLocaleLowerCase();
this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase();
}
}
if (strict) {
if (format === 'MMM') {
ii = indexOf$1.call(this._shortMonthsParse, llc);
return ii !== -1 ? ii : null;
} else {
ii = indexOf$1.call(this._longMonthsParse, llc);
return ii !== -1 ? ii : null;
}
} else {
if (format === 'MMM') {
ii = indexOf$1.call(this._shortMonthsParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf$1.call(this._longMonthsParse, llc);
return ii !== -1 ? ii : null;
} else {
ii = indexOf$1.call(this._longMonthsParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf$1.call(this._shortMonthsParse, llc);
return ii !== -1 ? ii : null;
}
}
}
function localeMonthsParse (monthName, format, strict) {
var i, mom, regex;
if (this._monthsParseExact) {
return handleStrictParse.call(this, monthName, format, strict);
}
if (!this._monthsParse) {
this._monthsParse = [];
this._longMonthsParse = [];
this._shortMonthsParse = [];
}
// TODO: add sorting
// Sorting makes sure if one month (or abbr) is a prefix of another
// see sorting in computeMonthsParse
for (i = 0; i < 12; i++) {
// make the regex if we don't have it already
mom = createUTC([2000, i]);
if (strict && !this._longMonthsParse[i]) {
this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i');
this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i');
}
if (!strict && !this._monthsParse[i]) {
regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
}
// test the regex
if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) {
return i;
} else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) {
return i;
} else if (!strict && this._monthsParse[i].test(monthName)) {
return i;
}
}
}
// MOMENTS
function setMonth (mom, value) {
var dayOfMonth;
if (!mom.isValid()) {
// No op
return mom;
}
if (typeof value === 'string') {
if (/^\d+$/.test(value)) {
value = toInt(value);
} else {
value = mom.localeData().monthsParse(value);
// TODO: Another silent failure?
if (!isNumber(value)) {
return mom;
}
}
}
dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));
mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
return mom;
}
function getSetMonth (value) {
if (value != null) {
setMonth(this, value);
hooks.updateOffset(this, true);
return this;
} else {
return get(this, 'Month');
}
}
function getDaysInMonth () {
return daysInMonth(this.year(), this.month());
}
var defaultMonthsShortRegex = matchWord;
function monthsShortRegex (isStrict) {
if (this._monthsParseExact) {
if (!hasOwnProp(this, '_monthsRegex')) {
computeMonthsParse.call(this);
}
if (isStrict) {
return this._monthsShortStrictRegex;
} else {
return this._monthsShortRegex;
}
} else {
if (!hasOwnProp(this, '_monthsShortRegex')) {
this._monthsShortRegex = defaultMonthsShortRegex;
}
return this._monthsShortStrictRegex && isStrict ?
this._monthsShortStrictRegex : this._monthsShortRegex;
}
}
var defaultMonthsRegex = matchWord;
function monthsRegex (isStrict) {
if (this._monthsParseExact) {
if (!hasOwnProp(this, '_monthsRegex')) {
computeMonthsParse.call(this);
}
if (isStrict) {
return this._monthsStrictRegex;
} else {
return this._monthsRegex;
}
} else {
if (!hasOwnProp(this, '_monthsRegex')) {
this._monthsRegex = defaultMonthsRegex;
}
return this._monthsStrictRegex && isStrict ?
this._monthsStrictRegex : this._monthsRegex;
}
}
function computeMonthsParse () {
function cmpLenRev(a, b) {
return b.length - a.length;
}
var shortPieces = [], longPieces = [], mixedPieces = [],
i, mom;
for (i = 0; i < 12; i++) {
// make the regex if we don't have it already
mom = createUTC([2000, i]);
shortPieces.push(this.monthsShort(mom, ''));
longPieces.push(this.months(mom, ''));
mixedPieces.push(this.months(mom, ''));
mixedPieces.push(this.monthsShort(mom, ''));
}
// Sorting makes sure if one month (or abbr) is a prefix of another it
// will match the longer piece.
shortPieces.sort(cmpLenRev);
longPieces.sort(cmpLenRev);
mixedPieces.sort(cmpLenRev);
for (i = 0; i < 12; i++) {
shortPieces[i] = regexEscape(shortPieces[i]);
longPieces[i] = regexEscape(longPieces[i]);
}
for (i = 0; i < 24; i++) {
mixedPieces[i] = regexEscape(mixedPieces[i]);
}
this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
this._monthsShortRegex = this._monthsRegex;
this._monthsStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i');
this._monthsShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i');
}
// FORMATTING
addFormatToken('Y', 0, 0, function () {
var y = this.year();
return y <= 9999 ? '' + y : '+' + y;
});
addFormatToken(0, ['YY', 2], 0, function () {
return this.year() % 100;
});
addFormatToken(0, ['YYYY', 4], 0, 'year');
addFormatToken(0, ['YYYYY', 5], 0, 'year');
addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');
// ALIASES
addUnitAlias('year', 'y');
// PRIORITIES
addUnitPriority('year', 1);
// PARSING
addRegexToken('Y', matchSigned);
addRegexToken('YY', match1to2, match2);
addRegexToken('YYYY', match1to4, match4);
addRegexToken('YYYYY', match1to6, match6);
addRegexToken('YYYYYY', match1to6, match6);
addParseToken(['YYYYY', 'YYYYYY'], YEAR);
addParseToken('YYYY', function (input, array) {
array[YEAR] = input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input);
});
addParseToken('YY', function (input, array) {
array[YEAR] = hooks.parseTwoDigitYear(input);
});
addParseToken('Y', function (input, array) {
array[YEAR] = parseInt(input, 10);
});
// HELPERS
function daysInYear(year) {
return isLeapYear(year) ? 366 : 365;
}
function isLeapYear(year) {
return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
}
// HOOKS
hooks.parseTwoDigitYear = function (input) {
return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
};
// MOMENTS
var getSetYear = makeGetSet('FullYear', true);
function getIsLeapYear () {
return isLeapYear(this.year());
}
function createDate (y, m, d, h, M, s, ms) {
// can't just apply() to create a date:
// https://stackoverflow.com/q/181348
var date = new Date(y, m, d, h, M, s, ms);
// the date constructor remaps years 0-99 to 1900-1999
if (y < 100 && y >= 0 && isFinite(date.getFullYear())) {
date.setFullYear(y);
}
return date;
}
function createUTCDate (y) {
var date = new Date(Date.UTC.apply(null, arguments));
// the Date.UTC function remaps years 0-99 to 1900-1999
if (y < 100 && y >= 0 && isFinite(date.getUTCFullYear())) {
date.setUTCFullYear(y);
}
return date;
}
// start-of-first-week - start-of-year
function firstWeekOffset(year, dow, doy) {
var // first-week day -- which january is always in the first week (4 for iso, 1 for other)
fwd = 7 + dow - doy,
// first-week day local weekday -- which local weekday is fwd
fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
return -fwdlw + fwd - 1;
}
// https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
var localWeekday = (7 + weekday - dow) % 7,
weekOffset = firstWeekOffset(year, dow, doy),
dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset,
resYear, resDayOfYear;
if (dayOfYear <= 0) {
resYear = year - 1;
resDayOfYear = daysInYear(resYear) + dayOfYear;
} else if (dayOfYear > daysInYear(year)) {
resYear = year + 1;
resDayOfYear = dayOfYear - daysInYear(year);
} else {
resYear = year;
resDayOfYear = dayOfYear;
}
return {
year: resYear,
dayOfYear: resDayOfYear
};
}
function weekOfYear(mom, dow, doy) {
var weekOffset = firstWeekOffset(mom.year(), dow, doy),
week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1,
resWeek, resYear;
if (week < 1) {
resYear = mom.year() - 1;
resWeek = week + weeksInYear(resYear, dow, doy);
} else if (week > weeksInYear(mom.year(), dow, doy)) {
resWeek = week - weeksInYear(mom.year(), dow, doy);
resYear = mom.year() + 1;
} else {
resYear = mom.year();
resWeek = week;
}
return {
week: resWeek,
year: resYear
};
}
function weeksInYear(year, dow, doy) {
var weekOffset = firstWeekOffset(year, dow, doy),
weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
}
// FORMATTING
addFormatToken('w', ['ww', 2], 'wo', 'week');
addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');
// ALIASES
addUnitAlias('week', 'w');
addUnitAlias('isoWeek', 'W');
// PRIORITIES
addUnitPriority('week', 5);
addUnitPriority('isoWeek', 5);
// PARSING
addRegexToken('w', match1to2);
addRegexToken('ww', match1to2, match2);
addRegexToken('W', match1to2);
addRegexToken('WW', match1to2, match2);
addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) {
week[token.substr(0, 1)] = toInt(input);
});
// HELPERS
// LOCALES
function localeWeek (mom) {
return weekOfYear(mom, this._week.dow, this._week.doy).week;
}
var defaultLocaleWeek = {
dow : 0, // Sunday is the first day of the week.
doy : 6 // The week that contains Jan 1st is the first week of the year.
};
function localeFirstDayOfWeek () {
return this._week.dow;
}
function localeFirstDayOfYear () {
return this._week.doy;
}
// MOMENTS
function getSetWeek (input) {
var week = this.localeData().week(this);
return input == null ? week : this.add((input - week) * 7, 'd');
}
function getSetISOWeek (input) {
var week = weekOfYear(this, 1, 4).week;
return input == null ? week : this.add((input - week) * 7, 'd');
}
// FORMATTING
addFormatToken('d', 0, 'do', 'day');
addFormatToken('dd', 0, 0, function (format) {
return this.localeData().weekdaysMin(this, format);
});
addFormatToken('ddd', 0, 0, function (format) {
return this.localeData().weekdaysShort(this, format);
});
addFormatToken('dddd', 0, 0, function (format) {
return this.localeData().weekdays(this, format);
});
addFormatToken('e', 0, 0, 'weekday');
addFormatToken('E', 0, 0, 'isoWeekday');
// ALIASES
addUnitAlias('day', 'd');
addUnitAlias('weekday', 'e');
addUnitAlias('isoWeekday', 'E');
// PRIORITY
addUnitPriority('day', 11);
addUnitPriority('weekday', 11);
addUnitPriority('isoWeekday', 11);
// PARSING
addRegexToken('d', match1to2);
addRegexToken('e', match1to2);
addRegexToken('E', match1to2);
addRegexToken('dd', function (isStrict, locale) {
return locale.weekdaysMinRegex(isStrict);
});
addRegexToken('ddd', function (isStrict, locale) {
return locale.weekdaysShortRegex(isStrict);
});
addRegexToken('dddd', function (isStrict, locale) {
return locale.weekdaysRegex(isStrict);
});
addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) {
var weekday = config._locale.weekdaysParse(input, token, config._strict);
// if we didn't get a weekday name, mark the date as invalid
if (weekday != null) {
week.d = weekday;
} else {
getParsingFlags(config).invalidWeekday = input;
}
});
addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {
week[token] = toInt(input);
});
// HELPERS
function parseWeekday(input, locale) {
if (typeof input !== 'string') {
return input;
}
if (!isNaN(input)) {
return parseInt(input, 10);
}
input = locale.weekdaysParse(input);
if (typeof input === 'number') {
return input;
}
return null;
}
function parseIsoWeekday(input, locale) {
if (typeof input === 'string') {
return locale.weekdaysParse(input) % 7 || 7;
}
return isNaN(input) ? null : input;
}
// LOCALES
var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_');
function localeWeekdays (m, format) {
if (!m) {
return isArray(this._weekdays) ? this._weekdays :
this._weekdays['standalone'];
}
return isArray(this._weekdays) ? this._weekdays[m.day()] :
this._weekdays[this._weekdays.isFormat.test(format) ? 'format' : 'standalone'][m.day()];
}
var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_');
function localeWeekdaysShort (m) {
return (m) ? this._weekdaysShort[m.day()] : this._weekdaysShort;
}
var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_');
function localeWeekdaysMin (m) {
return (m) ? this._weekdaysMin[m.day()] : this._weekdaysMin;
}
function handleStrictParse$1(weekdayName, format, strict) {
var i, ii, mom, llc = weekdayName.toLocaleLowerCase();
if (!this._weekdaysParse) {
this._weekdaysParse = [];
this._shortWeekdaysParse = [];
this._minWeekdaysParse = [];
for (i = 0; i < 7; ++i) {
mom = createUTC([2000, 1]).day(i);
this._minWeekdaysParse[i] = this.weekdaysMin(mom, '').toLocaleLowerCase();
this._shortWeekdaysParse[i] = this.weekdaysShort(mom, '').toLocaleLowerCase();
this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase();
}
}
if (strict) {
if (format === 'dddd') {
ii = indexOf$1.call(this._weekdaysParse, llc);
return ii !== -1 ? ii : null;
} else if (format === 'ddd') {
ii = indexOf$1.call(this._shortWeekdaysParse, llc);
return ii !== -1 ? ii : null;
} else {
ii = indexOf$1.call(this._minWeekdaysParse, llc);
return ii !== -1 ? ii : null;
}
} else {
if (format === 'dddd') {
ii = indexOf$1.call(this._weekdaysParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf$1.call(this._shortWeekdaysParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf$1.call(this._minWeekdaysParse, llc);
return ii !== -1 ? ii : null;
} else if (format === 'ddd') {
ii = indexOf$1.call(this._shortWeekdaysParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf$1.call(this._weekdaysParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf$1.call(this._minWeekdaysParse, llc);
return ii !== -1 ? ii : null;
} else {
ii = indexOf$1.call(this._minWeekdaysParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf$1.call(this._weekdaysParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf$1.call(this._shortWeekdaysParse, llc);
return ii !== -1 ? ii : null;
}
}
}
function localeWeekdaysParse (weekdayName, format, strict) {
var i, mom, regex;
if (this._weekdaysParseExact) {
return handleStrictParse$1.call(this, weekdayName, format, strict);
}
if (!this._weekdaysParse) {
this._weekdaysParse = [];
this._minWeekdaysParse = [];
this._shortWeekdaysParse = [];
this._fullWeekdaysParse = [];
}
for (i = 0; i < 7; i++) {
// make the regex if we don't have it already
mom = createUTC([2000, 1]).day(i);
if (strict && !this._fullWeekdaysParse[i]) {
this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\.?') + '$', 'i');
this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\.?') + '$', 'i');
this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\.?') + '$', 'i');
}
if (!this._weekdaysParse[i]) {
regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');
this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
}
// test the regex
if (strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName)) {
return i;
} else if (strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName)) {
return i;
} else if (strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName)) {
return i;
} else if (!strict && this._weekdaysParse[i].test(weekdayName)) {
return i;
}
}
}
// MOMENTS
function getSetDayOfWeek (input) {
if (!this.isValid()) {
return input != null ? this : NaN;
}
var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
if (input != null) {
input = parseWeekday(input, this.localeData());
return this.add(input - day, 'd');
} else {
return day;
}
}
function getSetLocaleDayOfWeek (input) {
if (!this.isValid()) {
return input != null ? this : NaN;
}
var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
return input == null ? weekday : this.add(input - weekday, 'd');
}
function getSetISODayOfWeek (input) {
if (!this.isValid()) {
return input != null ? this : NaN;
}
// behaves the same as moment#day except
// as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
// as a setter, sunday should belong to the previous week.
if (input != null) {
var weekday = parseIsoWeekday(input, this.localeData());
return this.day(this.day() % 7 ? weekday : weekday - 7);
} else {
return this.day() || 7;
}
}
var defaultWeekdaysRegex = matchWord;
function weekdaysRegex (isStrict) {
if (this._weekdaysParseExact) {
if (!hasOwnProp(this, '_weekdaysRegex')) {
computeWeekdaysParse.call(this);
}
if (isStrict) {
return this._weekdaysStrictRegex;
} else {
return this._weekdaysRegex;
}
} else {
if (!hasOwnProp(this, '_weekdaysRegex')) {
this._weekdaysRegex = defaultWeekdaysRegex;
}
return this._weekdaysStrictRegex && isStrict ?
this._weekdaysStrictRegex : this._weekdaysRegex;
}
}
var defaultWeekdaysShortRegex = matchWord;
function weekdaysShortRegex (isStrict) {
if (this._weekdaysParseExact) {
if (!hasOwnProp(this, '_weekdaysRegex')) {
computeWeekdaysParse.call(this);
}
if (isStrict) {
return this._weekdaysShortStrictRegex;
} else {
return this._weekdaysShortRegex;
}
} else {
if (!hasOwnProp(this, '_weekdaysShortRegex')) {
this._weekdaysShortRegex = defaultWeekdaysShortRegex;
}
return this._weekdaysShortStrictRegex && isStrict ?
this._weekdaysShortStrictRegex : this._weekdaysShortRegex;
}
}
var defaultWeekdaysMinRegex = matchWord;
function weekdaysMinRegex (isStrict) {
if (this._weekdaysParseExact) {
if (!hasOwnProp(this, '_weekdaysRegex')) {
computeWeekdaysParse.call(this);
}
if (isStrict) {
return this._weekdaysMinStrictRegex;
} else {
return this._weekdaysMinRegex;
}
} else {
if (!hasOwnProp(this, '_weekdaysMinRegex')) {
this._weekdaysMinRegex = defaultWeekdaysMinRegex;
}
return this._weekdaysMinStrictRegex && isStrict ?
this._weekdaysMinStrictRegex : this._weekdaysMinRegex;
}
}
function computeWeekdaysParse () {
function cmpLenRev(a, b) {
return b.length - a.length;
}
var minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [],
i, mom, minp, shortp, longp;
for (i = 0; i < 7; i++) {
// make the regex if we don't have it already
mom = createUTC([2000, 1]).day(i);
minp = this.weekdaysMin(mom, '');
shortp = this.weekdaysShort(mom, '');
longp = this.weekdays(mom, '');
minPieces.push(minp);
shortPieces.push(shortp);
longPieces.push(longp);
mixedPieces.push(minp);
mixedPieces.push(shortp);
mixedPieces.push(longp);
}
// Sorting makes sure if one weekday (or abbr) is a prefix of another it
// will match the longer piece.
minPieces.sort(cmpLenRev);
shortPieces.sort(cmpLenRev);
longPieces.sort(cmpLenRev);
mixedPieces.sort(cmpLenRev);
for (i = 0; i < 7; i++) {
shortPieces[i] = regexEscape(shortPieces[i]);
longPieces[i] = regexEscape(longPieces[i]);
mixedPieces[i] = regexEscape(mixedPieces[i]);
}
this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
this._weekdaysShortRegex = this._weekdaysRegex;
this._weekdaysMinRegex = this._weekdaysRegex;
this._weekdaysStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i');
this._weekdaysShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i');
this._weekdaysMinStrictRegex = new RegExp('^(' + minPieces.join('|') + ')', 'i');
}
// FORMATTING
function hFormat() {
return this.hours() % 12 || 12;
}
function kFormat() {
return this.hours() || 24;
}
addFormatToken('H', ['HH', 2], 0, 'hour');
addFormatToken('h', ['hh', 2], 0, hFormat);
addFormatToken('k', ['kk', 2], 0, kFormat);
addFormatToken('hmm', 0, 0, function () {
return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2);
});
addFormatToken('hmmss', 0, 0, function () {
return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) +
zeroFill(this.seconds(), 2);
});
addFormatToken('Hmm', 0, 0, function () {
return '' + this.hours() + zeroFill(this.minutes(), 2);
});
addFormatToken('Hmmss', 0, 0, function () {
return '' + this.hours() + zeroFill(this.minutes(), 2) +
zeroFill(this.seconds(), 2);
});
function meridiem (token, lowercase) {
addFormatToken(token, 0, 0, function () {
return this.localeData().meridiem(this.hours(), this.minutes(), lowercase);
});
}
meridiem('a', true);
meridiem('A', false);
// ALIASES
addUnitAlias('hour', 'h');
// PRIORITY
addUnitPriority('hour', 13);
// PARSING
function matchMeridiem (isStrict, locale) {
return locale._meridiemParse;
}
addRegexToken('a', matchMeridiem);
addRegexToken('A', matchMeridiem);
addRegexToken('H', match1to2);
addRegexToken('h', match1to2);
addRegexToken('k', match1to2);
addRegexToken('HH', match1to2, match2);
addRegexToken('hh', match1to2, match2);
addRegexToken('kk', match1to2, match2);
addRegexToken('hmm', match3to4);
addRegexToken('hmmss', match5to6);
addRegexToken('Hmm', match3to4);
addRegexToken('Hmmss', match5to6);
addParseToken(['H', 'HH'], HOUR);
addParseToken(['k', 'kk'], function (input, array, config) {
var kInput = toInt(input);
array[HOUR] = kInput === 24 ? 0 : kInput;
});
addParseToken(['a', 'A'], function (input, array, config) {
config._isPm = config._locale.isPM(input);
config._meridiem = input;
});
addParseToken(['h', 'hh'], function (input, array, config) {
array[HOUR] = toInt(input);
getParsingFlags(config).bigHour = true;
});
addParseToken('hmm', function (input, array, config) {
var pos = input.length - 2;
array[HOUR] = toInt(input.substr(0, pos));
array[MINUTE] = toInt(input.substr(pos));
getParsingFlags(config).bigHour = true;
});
addParseToken('hmmss', function (input, array, config) {
var pos1 = input.length - 4;
var pos2 = input.length - 2;
array[HOUR] = toInt(input.substr(0, pos1));
array[MINUTE] = toInt(input.substr(pos1, 2));
array[SECOND] = toInt(input.substr(pos2));
getParsingFlags(config).bigHour = true;
});
addParseToken('Hmm', function (input, array, config) {
var pos = input.length - 2;
array[HOUR] = toInt(input.substr(0, pos));
array[MINUTE] = toInt(input.substr(pos));
});
addParseToken('Hmmss', function (input, array, config) {
var pos1 = input.length - 4;
var pos2 = input.length - 2;
array[HOUR] = toInt(input.substr(0, pos1));
array[MINUTE] = toInt(input.substr(pos1, 2));
array[SECOND] = toInt(input.substr(pos2));
});
// LOCALES
function localeIsPM (input) {
// IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
// Using charAt should be more compatible.
return ((input + '').toLowerCase().charAt(0) === 'p');
}
var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i;
function localeMeridiem (hours, minutes, isLower) {
if (hours > 11) {
return isLower ? 'pm' : 'PM';
} else {
return isLower ? 'am' : 'AM';
}
}
// MOMENTS
// Setting the hour should keep the time, because the user explicitly
// specified which hour he wants. So trying to maintain the same hour (in
// a new timezone) makes sense. Adding/subtracting hours does not follow
// this rule.
var getSetHour = makeGetSet('Hours', true);
// months
// week
// weekdays
// meridiem
var baseConfig = {
calendar: defaultCalendar,
longDateFormat: defaultLongDateFormat,
invalidDate: defaultInvalidDate,
ordinal: defaultOrdinal,
dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse,
relativeTime: defaultRelativeTime,
months: defaultLocaleMonths,
monthsShort: defaultLocaleMonthsShort,
week: defaultLocaleWeek,
weekdays: defaultLocaleWeekdays,
weekdaysMin: defaultLocaleWeekdaysMin,
weekdaysShort: defaultLocaleWeekdaysShort,
meridiemParse: defaultLocaleMeridiemParse
};
// internal storage for locale config files
var locales = {};
var localeFamilies = {};
var globalLocale;
function normalizeLocale(key) {
return key ? key.toLowerCase().replace('_', '-') : key;
}
// pick the locale from the array
// try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
// substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
function chooseLocale(names) {
var i = 0, j, next, locale, split;
while (i < names.length) {
split = normalizeLocale(names[i]).split('-');
j = split.length;
next = normalizeLocale(names[i + 1]);
next = next ? next.split('-') : null;
while (j > 0) {
locale = loadLocale(split.slice(0, j).join('-'));
if (locale) {
return locale;
}
if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {
//the next array item is better than a shallower substring of this one
break;
}
j--;
}
i++;
}
return null;
}
function loadLocale(name) {
var oldLocale = null;
// TODO: Find a better way to register and load all the locales in Node
if (!locales[name] && (typeof module !== 'undefined') &&
module && module.exports) {
try {
oldLocale = globalLocale._abbr;
require('./locale/' + name);
// because defineLocale currently also sets the global locale, we
// want to undo that for lazy loaded locales
getSetGlobalLocale(oldLocale);
} catch (e) { }
}
return locales[name];
}
// This function will load locale and then set the global locale. If
// no arguments are passed in, it will simply return the current global
// locale key.
function getSetGlobalLocale (key, values) {
var data;
if (key) {
if (isUndefined(values)) {
data = getLocale(key);
}
else {
data = defineLocale(key, values);
}
if (data) {
// moment.duration._locale = moment._locale = data;
globalLocale = data;
}
}
return globalLocale._abbr;
}
function defineLocale (name, config) {
if (config !== null) {
var parentConfig = baseConfig;
config.abbr = name;
if (locales[name] != null) {
deprecateSimple('defineLocaleOverride',
'use moment.updateLocale(localeName, config) to change ' +
'an existing locale. moment.defineLocale(localeName, ' +
'config) should only be used for creating a new locale ' +
'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.');
parentConfig = locales[name]._config;
} else if (config.parentLocale != null) {
if (locales[config.parentLocale] != null) {
parentConfig = locales[config.parentLocale]._config;
} else {
if (!localeFamilies[config.parentLocale]) {
localeFamilies[config.parentLocale] = [];
}
localeFamilies[config.parentLocale].push({
name: name,
config: config
});
return null;
}
}
locales[name] = new Locale(mergeConfigs(parentConfig, config));
if (localeFamilies[name]) {
localeFamilies[name].forEach(function (x) {
defineLocale(x.name, x.config);
});
}
// backwards compat for now: also set the locale
// make sure we set the locale AFTER all child locales have been
// created, so we won't end up with the child locale set.
getSetGlobalLocale(name);
return locales[name];
} else {
// useful for testing
delete locales[name];
return null;
}
}
function updateLocale(name, config) {
if (config != null) {
var locale, parentConfig = baseConfig;
// MERGE
if (locales[name] != null) {
parentConfig = locales[name]._config;
}
config = mergeConfigs(parentConfig, config);
locale = new Locale(config);
locale.parentLocale = locales[name];
locales[name] = locale;
// backwards compat for now: also set the locale
getSetGlobalLocale(name);
} else {
// pass null for config to unupdate, useful for tests
if (locales[name] != null) {
if (locales[name].parentLocale != null) {
locales[name] = locales[name].parentLocale;
} else if (locales[name] != null) {
delete locales[name];
}
}
}
return locales[name];
}
// returns locale data
function getLocale (key) {
var locale;
if (key && key._locale && key._locale._abbr) {
key = key._locale._abbr;
}
if (!key) {
return globalLocale;
}
if (!isArray(key)) {
//short-circuit everything else
locale = loadLocale(key);
if (locale) {
return locale;
}
key = [key];
}
return chooseLocale(key);
}
function listLocales() {
return keys$1(locales);
}
function checkOverflow (m) {
var overflow;
var a = m._a;
if (a && getParsingFlags(m).overflow === -2) {
overflow =
a[MONTH] < 0 || a[MONTH] > 11 ? MONTH :
a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE :
a[HOUR] < 0 || a[HOUR] > 24 || (a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0)) ? HOUR :
a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE :
a[SECOND] < 0 || a[SECOND] > 59 ? SECOND :
a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND :
-1;
if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) {
overflow = DATE;
}
if (getParsingFlags(m)._overflowWeeks && overflow === -1) {
overflow = WEEK;
}
if (getParsingFlags(m)._overflowWeekday && overflow === -1) {
overflow = WEEKDAY;
}
getParsingFlags(m).overflow = overflow;
}
return m;
}
// iso 8601 regex
// 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00)
var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
var basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/;
var isoDates = [
['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/],
['YYYY-MM-DD', /\d{4}-\d\d-\d\d/],
['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/],
['GGGG-[W]WW', /\d{4}-W\d\d/, false],
['YYYY-DDD', /\d{4}-\d{3}/],
['YYYY-MM', /\d{4}-\d\d/, false],
['YYYYYYMMDD', /[+-]\d{10}/],
['YYYYMMDD', /\d{8}/],
// YYYYMM is NOT allowed by the standard
['GGGG[W]WWE', /\d{4}W\d{3}/],
['GGGG[W]WW', /\d{4}W\d{2}/, false],
['YYYYDDD', /\d{7}/]
];
// iso time formats and regexes
var isoTimes = [
['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/],
['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/],
['HH:mm:ss', /\d\d:\d\d:\d\d/],
['HH:mm', /\d\d:\d\d/],
['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/],
['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/],
['HHmmss', /\d\d\d\d\d\d/],
['HHmm', /\d\d\d\d/],
['HH', /\d\d/]
];
var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i;
// date from iso format
function configFromISO(config) {
var i, l,
string = config._i,
match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),
allowTime, dateFormat, timeFormat, tzFormat;
if (match) {
getParsingFlags(config).iso = true;
for (i = 0, l = isoDates.length; i < l; i++) {
if (isoDates[i][1].exec(match[1])) {
dateFormat = isoDates[i][0];
allowTime = isoDates[i][2] !== false;
break;
}
}
if (dateFormat == null) {
config._isValid = false;
return;
}
if (match[3]) {
for (i = 0, l = isoTimes.length; i < l; i++) {
if (isoTimes[i][1].exec(match[3])) {
// match[2] should be 'T' or space
timeFormat = (match[2] || ' ') + isoTimes[i][0];
break;
}
}
if (timeFormat == null) {
config._isValid = false;
return;
}
}
if (!allowTime && timeFormat != null) {
config._isValid = false;
return;
}
if (match[4]) {
if (tzRegex.exec(match[4])) {
tzFormat = 'Z';
} else {
config._isValid = false;
return;
}
}
config._f = dateFormat + (timeFormat || '') + (tzFormat || '');
configFromStringAndFormat(config);
} else {
config._isValid = false;
}
}
// RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3
var basicRfcRegex = /^((?:Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d?\d\s(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(?:\d\d)?\d\d\s)(\d\d:\d\d)(\:\d\d)?(\s(?:UT|GMT|[ECMP][SD]T|[A-IK-Za-ik-z]|[+-]\d{4}))$/;
// date and time from ref 2822 format
function configFromRFC2822(config) {
var string, match, dayFormat,
dateFormat, timeFormat, tzFormat;
var timezones = {
' GMT': ' +0000',
' EDT': ' -0400',
' EST': ' -0500',
' CDT': ' -0500',
' CST': ' -0600',
' MDT': ' -0600',
' MST': ' -0700',
' PDT': ' -0700',
' PST': ' -0800'
};
var military = 'YXWVUTSRQPONZABCDEFGHIKLM';
var timezone, timezoneIndex;
string = config._i
.replace(/\([^\)]*\)|[\n\t]/g, ' ') // Remove comments and folding whitespace
.replace(/(\s\s+)/g, ' ') // Replace multiple-spaces with a single space
.replace(/^\s|\s$/g, ''); // Remove leading and trailing spaces
match = basicRfcRegex.exec(string);
if (match) {
dayFormat = match[1] ? 'ddd' + ((match[1].length === 5) ? ', ' : ' ') : '';
dateFormat = 'D MMM ' + ((match[2].length > 10) ? 'YYYY ' : 'YY ');
timeFormat = 'HH:mm' + (match[4] ? ':ss' : '');
// TODO: Replace the vanilla JS Date object with an indepentent day-of-week check.
if (match[1]) { // day of week given
var momentDate = new Date(match[2]);
var momentDay = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'][momentDate.getDay()];
if (match[1].substr(0,3) !== momentDay) {
getParsingFlags(config).weekdayMismatch = true;
config._isValid = false;
return;
}
}
switch (match[5].length) {
case 2: // military
if (timezoneIndex === 0) {
timezone = ' +0000';
} else {
timezoneIndex = military.indexOf(match[5][1].toUpperCase()) - 12;
timezone = ((timezoneIndex < 0) ? ' -' : ' +') +
(('' + timezoneIndex).replace(/^-?/, '0')).match(/..$/)[0] + '00';
}
break;
case 4: // Zone
timezone = timezones[match[5]];
break;
default: // UT or +/-9999
timezone = timezones[' GMT'];
}
match[5] = timezone;
config._i = match.splice(1).join('');
tzFormat = ' ZZ';
config._f = dayFormat + dateFormat + timeFormat + tzFormat;
configFromStringAndFormat(config);
getParsingFlags(config).rfc2822 = true;
} else {
config._isValid = false;
}
}
// date from iso format or fallback
function configFromString(config) {
var matched = aspNetJsonRegex.exec(config._i);
if (matched !== null) {
config._d = new Date(+matched[1]);
return;
}
configFromISO(config);
if (config._isValid === false) {
delete config._isValid;
} else {
return;
}
configFromRFC2822(config);
if (config._isValid === false) {
delete config._isValid;
} else {
return;
}
// Final attempt, use Input Fallback
hooks.createFromInputFallback(config);
}
hooks.createFromInputFallback = deprecate(
'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' +
'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' +
'discouraged and will be removed in an upcoming major release. Please refer to ' +
'http://momentjs.com/guides/#/warnings/js-date/ for more info.',
function (config) {
config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
}
);
// Pick the first defined of two or three arguments.
function defaults(a, b, c) {
if (a != null) {
return a;
}
if (b != null) {
return b;
}
return c;
}
function currentDateArray(config) {
// hooks is actually the exported moment object
var nowValue = new Date(hooks.now());
if (config._useUTC) {
return [nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate()];
}
return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];
}
// convert an array to a date.
// the array should mirror the parameters below
// note: all values past the year are optional and will default to the lowest possible value.
// [year, month, day , hour, minute, second, millisecond]
function configFromArray (config) {
var i, date, input = [], currentDate, yearToUse;
if (config._d) {
return;
}
currentDate = currentDateArray(config);
//compute day of the year from weeks and weekdays
if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
dayOfYearFromWeekInfo(config);
}
//if the day of the year is set, figure out what it is
if (config._dayOfYear != null) {
yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
if (config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0) {
getParsingFlags(config)._overflowDayOfYear = true;
}
date = createUTCDate(yearToUse, 0, config._dayOfYear);
config._a[MONTH] = date.getUTCMonth();
config._a[DATE] = date.getUTCDate();
}
// Default to current date.
// * if no year, month, day of month are given, default to today
// * if day of month is given, default month and year
// * if month is given, default only year
// * if year is given, don't default anything
for (i = 0; i < 3 && config._a[i] == null; ++i) {
config._a[i] = input[i] = currentDate[i];
}
// Zero out whatever was not defaulted, including time
for (; i < 7; i++) {
config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];
}
// Check for 24:00:00.000
if (config._a[HOUR] === 24 &&
config._a[MINUTE] === 0 &&
config._a[SECOND] === 0 &&
config._a[MILLISECOND] === 0) {
config._nextDay = true;
config._a[HOUR] = 0;
}
config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);
// Apply timezone offset from input. The actual utcOffset can be changed
// with parseZone.
if (config._tzm != null) {
config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
}
if (config._nextDay) {
config._a[HOUR] = 24;
}
}
function dayOfYearFromWeekInfo(config) {
var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow;
w = config._w;
if (w.GG != null || w.W != null || w.E != null) {
dow = 1;
doy = 4;
// TODO: We need to take the current isoWeekYear, but that depends on
// how we interpret now (local, utc, fixed offset). So create
// a now version of current config (take local/utc/offset flags, and
// create now).
weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(createLocal(), 1, 4).year);
week = defaults(w.W, 1);
weekday = defaults(w.E, 1);
if (weekday < 1 || weekday > 7) {
weekdayOverflow = true;
}
} else {
dow = config._locale._week.dow;
doy = config._locale._week.doy;
var curWeek = weekOfYear(createLocal(), dow, doy);
weekYear = defaults(w.gg, config._a[YEAR], curWeek.year);
// Default to current week.
week = defaults(w.w, curWeek.week);
if (w.d != null) {
// weekday -- low day numbers are considered next week
weekday = w.d;
if (weekday < 0 || weekday > 6) {
weekdayOverflow = true;
}
} else if (w.e != null) {
// local weekday -- counting starts from begining of week
weekday = w.e + dow;
if (w.e < 0 || w.e > 6) {
weekdayOverflow = true;
}
} else {
// default to begining of week
weekday = dow;
}
}
if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {
getParsingFlags(config)._overflowWeeks = true;
} else if (weekdayOverflow != null) {
getParsingFlags(config)._overflowWeekday = true;
} else {
temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);
config._a[YEAR] = temp.year;
config._dayOfYear = temp.dayOfYear;
}
}
// constant that refers to the ISO standard
hooks.ISO_8601 = function () {};
// constant that refers to the RFC 2822 form
hooks.RFC_2822 = function () {};
// date from string and format string
function configFromStringAndFormat(config) {
// TODO: Move this to another part of the creation flow to prevent circular deps
if (config._f === hooks.ISO_8601) {
configFromISO(config);
return;
}
if (config._f === hooks.RFC_2822) {
configFromRFC2822(config);
return;
}
config._a = [];
getParsingFlags(config).empty = true;
// This array is used to make a Date, either with `new Date` or `Date.UTC`
var string = '' + config._i,
i, parsedInput, tokens, token, skipped,
stringLength = string.length,
totalParsedInputLength = 0;
tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];
for (i = 0; i < tokens.length; i++) {
token = tokens[i];
parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];
// console.log('token', token, 'parsedInput', parsedInput,
// 'regex', getParseRegexForToken(token, config));
if (parsedInput) {
skipped = string.substr(0, string.indexOf(parsedInput));
if (skipped.length > 0) {
getParsingFlags(config).unusedInput.push(skipped);
}
string = string.slice(string.indexOf(parsedInput) + parsedInput.length);
totalParsedInputLength += parsedInput.length;
}
// don't parse if it's not a known token
if (formatTokenFunctions[token]) {
if (parsedInput) {
getParsingFlags(config).empty = false;
}
else {
getParsingFlags(config).unusedTokens.push(token);
}
addTimeToArrayFromToken(token, parsedInput, config);
}
else if (config._strict && !parsedInput) {
getParsingFlags(config).unusedTokens.push(token);
}
}
// add remaining unparsed input length to the string
getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength;
if (string.length > 0) {
getParsingFlags(config).unusedInput.push(string);
}
// clear _12h flag if hour is <= 12
if (config._a[HOUR] <= 12 &&
getParsingFlags(config).bigHour === true &&
config._a[HOUR] > 0) {
getParsingFlags(config).bigHour = undefined;
}
getParsingFlags(config).parsedDateParts = config._a.slice(0);
getParsingFlags(config).meridiem = config._meridiem;
// handle meridiem
config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem);
configFromArray(config);
checkOverflow(config);
}
function meridiemFixWrap (locale, hour, meridiem) {
var isPm;
if (meridiem == null) {
// nothing to do
return hour;
}
if (locale.meridiemHour != null) {
return locale.meridiemHour(hour, meridiem);
} else if (locale.isPM != null) {
// Fallback
isPm = locale.isPM(meridiem);
if (isPm && hour < 12) {
hour += 12;
}
if (!isPm && hour === 12) {
hour = 0;
}
return hour;
} else {
// this is not supposed to happen
return hour;
}
}
// date from string and array of format strings
function configFromStringAndArray(config) {
var tempConfig,
bestMoment,
scoreToBeat,
i,
currentScore;
if (config._f.length === 0) {
getParsingFlags(config).invalidFormat = true;
config._d = new Date(NaN);
return;
}
for (i = 0; i < config._f.length; i++) {
currentScore = 0;
tempConfig = copyConfig({}, config);
if (config._useUTC != null) {
tempConfig._useUTC = config._useUTC;
}
tempConfig._f = config._f[i];
configFromStringAndFormat(tempConfig);
if (!isValid(tempConfig)) {
continue;
}
// if there is any input that was not parsed add a penalty for that format
currentScore += getParsingFlags(tempConfig).charsLeftOver;
//or tokens
currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
getParsingFlags(tempConfig).score = currentScore;
if (scoreToBeat == null || currentScore < scoreToBeat) {
scoreToBeat = currentScore;
bestMoment = tempConfig;
}
}
extend(config, bestMoment || tempConfig);
}
function configFromObject(config) {
if (config._d) {
return;
}
var i = normalizeObjectUnits(config._i);
config._a = map([i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond], function (obj) {
return obj && parseInt(obj, 10);
});
configFromArray(config);
}
function createFromConfig (config) {
var res = new Moment(checkOverflow(prepareConfig(config)));
if (res._nextDay) {
// Adding is smart enough around DST
res.add(1, 'd');
res._nextDay = undefined;
}
return res;
}
function prepareConfig (config) {
var input = config._i,
format = config._f;
config._locale = config._locale || getLocale(config._l);
if (input === null || (format === undefined && input === '')) {
return createInvalid({nullInput: true});
}
if (typeof input === 'string') {
config._i = input = config._locale.preparse(input);
}
if (isMoment(input)) {
return new Moment(checkOverflow(input));
} else if (isDate(input)) {
config._d = input;
} else if (isArray(format)) {
configFromStringAndArray(config);
} else if (format) {
configFromStringAndFormat(config);
} else {
configFromInput(config);
}
if (!isValid(config)) {
config._d = null;
}
return config;
}
function configFromInput(config) {
var input = config._i;
if (isUndefined(input)) {
config._d = new Date(hooks.now());
} else if (isDate(input)) {
config._d = new Date(input.valueOf());
} else if (typeof input === 'string') {
configFromString(config);
} else if (isArray(input)) {
config._a = map(input.slice(0), function (obj) {
return parseInt(obj, 10);
});
configFromArray(config);
} else if (isObject(input)) {
configFromObject(config);
} else if (isNumber(input)) {
// from milliseconds
config._d = new Date(input);
} else {
hooks.createFromInputFallback(config);
}
}
function createLocalOrUTC (input, format, locale, strict, isUTC) {
var c = {};
if (locale === true || locale === false) {
strict = locale;
locale = undefined;
}
if ((isObject(input) && isObjectEmpty(input)) ||
(isArray(input) && input.length === 0)) {
input = undefined;
}
// object construction must be done this way.
// https://github.com/moment/moment/issues/1423
c._isAMomentObject = true;
c._useUTC = c._isUTC = isUTC;
c._l = locale;
c._i = input;
c._f = format;
c._strict = strict;
return createFromConfig(c);
}
function createLocal (input, format, locale, strict) {
return createLocalOrUTC(input, format, locale, strict, false);
}
var prototypeMin = deprecate(
'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/',
function () {
var other = createLocal.apply(null, arguments);
if (this.isValid() && other.isValid()) {
return other < this ? this : other;
} else {
return createInvalid();
}
}
);
var prototypeMax = deprecate(
'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/',
function () {
var other = createLocal.apply(null, arguments);
if (this.isValid() && other.isValid()) {
return other > this ? this : other;
} else {
return createInvalid();
}
}
);
// Pick a moment m from moments so that m[fn](other) is true for all
// other. This relies on the function fn to be transitive.
//
// moments should either be an array of moment objects or an array, whose
// first element is an array of moment objects.
function pickBy(fn, moments) {
var res, i;
if (moments.length === 1 && isArray(moments[0])) {
moments = moments[0];
}
if (!moments.length) {
return createLocal();
}
res = moments[0];
for (i = 1; i < moments.length; ++i) {
if (!moments[i].isValid() || moments[i][fn](res)) {
res = moments[i];
}
}
return res;
}
// TODO: Use [].sort instead?
function min () {
var args = [].slice.call(arguments, 0);
return pickBy('isBefore', args);
}
function max () {
var args = [].slice.call(arguments, 0);
return pickBy('isAfter', args);
}
var now = function () {
return Date.now ? Date.now() : +(new Date());
};
var ordering = ['year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', 'millisecond'];
function isDurationValid(m) {
for (var key in m) {
if (!(ordering.indexOf(key) !== -1 && (m[key] == null || !isNaN(m[key])))) {
return false;
}
}
var unitHasDecimal = false;
for (var i = 0; i < ordering.length; ++i) {
if (m[ordering[i]]) {
if (unitHasDecimal) {
return false; // only allow non-integers for smallest unit
}
if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) {
unitHasDecimal = true;
}
}
}
return true;
}
function isValid$1() {
return this._isValid;
}
function createInvalid$1() {
return createDuration(NaN);
}
function Duration (duration) {
var normalizedInput = normalizeObjectUnits(duration),
years = normalizedInput.year || 0,
quarters = normalizedInput.quarter || 0,
months = normalizedInput.month || 0,
weeks = normalizedInput.week || 0,
days = normalizedInput.day || 0,
hours = normalizedInput.hour || 0,
minutes = normalizedInput.minute || 0,
seconds = normalizedInput.second || 0,
milliseconds = normalizedInput.millisecond || 0;
this._isValid = isDurationValid(normalizedInput);
// representation for dateAddRemove
this._milliseconds = +milliseconds +
seconds * 1e3 + // 1000
minutes * 6e4 + // 1000 * 60
hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978
// Because of dateAddRemove treats 24 hours as different from a
// day when working around DST, we need to store them separately
this._days = +days +
weeks * 7;
// It is impossible translate months into days without knowing
// which months you are are talking about, so we have to store
// it separately.
this._months = +months +
quarters * 3 +
years * 12;
this._data = {};
this._locale = getLocale();
this._bubble();
}
function isDuration (obj) {
return obj instanceof Duration;
}
function absRound (number) {
if (number < 0) {
return Math.round(-1 * number) * -1;
} else {
return Math.round(number);
}
}
// FORMATTING
function offset (token, separator) {
addFormatToken(token, 0, 0, function () {
var offset = this.utcOffset();
var sign = '+';
if (offset < 0) {
offset = -offset;
sign = '-';
}
return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~(offset) % 60, 2);
});
}
offset('Z', ':');
offset('ZZ', '');
// PARSING
addRegexToken('Z', matchShortOffset);
addRegexToken('ZZ', matchShortOffset);
addParseToken(['Z', 'ZZ'], function (input, array, config) {
config._useUTC = true;
config._tzm = offsetFromString(matchShortOffset, input);
});
// HELPERS
// timezone chunker
// '+10:00' > ['10', '00']
// '-1530' > ['-15', '30']
var chunkOffset = /([\+\-]|\d\d)/gi;
function offsetFromString(matcher, string) {
var matches = (string || '').match(matcher);
if (matches === null) {
return null;
}
var chunk = matches[matches.length - 1] || [];
var parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];
var minutes = +(parts[1] * 60) + toInt(parts[2]);
return minutes === 0 ?
0 :
parts[0] === '+' ? minutes : -minutes;
}
// Return a moment from input, that is local/utc/zone equivalent to model.
function cloneWithOffset(input, model) {
var res, diff;
if (model._isUTC) {
res = model.clone();
diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();
// Use low-level api, because this fn is low-level api.
res._d.setTime(res._d.valueOf() + diff);
hooks.updateOffset(res, false);
return res;
} else {
return createLocal(input).local();
}
}
function getDateOffset (m) {
// On Firefox.24 Date#getTimezoneOffset returns a floating point.
// https://github.com/moment/moment/pull/1871
return -Math.round(m._d.getTimezoneOffset() / 15) * 15;
}
// HOOKS
// This function will be called whenever a moment is mutated.
// It is intended to keep the offset in sync with the timezone.
hooks.updateOffset = function () {};
// MOMENTS
// keepLocalTime = true means only change the timezone, without
// affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->
// 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset
// +0200, so we adjust the time as needed, to be valid.
//
// Keeping the time actually adds/subtracts (one hour)
// from the actual represented time. That is why we call updateOffset
// a second time. In case it wants us to change the offset again
// _changeInProgress == true case, then we have to adjust, because
// there is no such time in the given timezone.
function getSetOffset (input, keepLocalTime, keepMinutes) {
var offset = this._offset || 0,
localAdjust;
if (!this.isValid()) {
return input != null ? this : NaN;
}
if (input != null) {
if (typeof input === 'string') {
input = offsetFromString(matchShortOffset, input);
if (input === null) {
return this;
}
} else if (Math.abs(input) < 16 && !keepMinutes) {
input = input * 60;
}
if (!this._isUTC && keepLocalTime) {
localAdjust = getDateOffset(this);
}
this._offset = input;
this._isUTC = true;
if (localAdjust != null) {
this.add(localAdjust, 'm');
}
if (offset !== input) {
if (!keepLocalTime || this._changeInProgress) {
addSubtract(this, createDuration(input - offset, 'm'), 1, false);
} else if (!this._changeInProgress) {
this._changeInProgress = true;
hooks.updateOffset(this, true);
this._changeInProgress = null;
}
}
return this;
} else {
return this._isUTC ? offset : getDateOffset(this);
}
}
function getSetZone (input, keepLocalTime) {
if (input != null) {
if (typeof input !== 'string') {
input = -input;
}
this.utcOffset(input, keepLocalTime);
return this;
} else {
return -this.utcOffset();
}
}
function setOffsetToUTC (keepLocalTime) {
return this.utcOffset(0, keepLocalTime);
}
function setOffsetToLocal (keepLocalTime) {
if (this._isUTC) {
this.utcOffset(0, keepLocalTime);
this._isUTC = false;
if (keepLocalTime) {
this.subtract(getDateOffset(this), 'm');
}
}
return this;
}
function setOffsetToParsedOffset () {
if (this._tzm != null) {
this.utcOffset(this._tzm, false, true);
} else if (typeof this._i === 'string') {
var tZone = offsetFromString(matchOffset, this._i);
if (tZone != null) {
this.utcOffset(tZone);
}
else {
this.utcOffset(0, true);
}
}
return this;
}
function hasAlignedHourOffset (input) {
if (!this.isValid()) {
return false;
}
input = input ? createLocal(input).utcOffset() : 0;
return (this.utcOffset() - input) % 60 === 0;
}
function isDaylightSavingTime () {
return (
this.utcOffset() > this.clone().month(0).utcOffset() ||
this.utcOffset() > this.clone().month(5).utcOffset()
);
}
function isDaylightSavingTimeShifted () {
if (!isUndefined(this._isDSTShifted)) {
return this._isDSTShifted;
}
var c = {};
copyConfig(c, this);
c = prepareConfig(c);
if (c._a) {
var other = c._isUTC ? createUTC(c._a) : createLocal(c._a);
this._isDSTShifted = this.isValid() &&
compareArrays(c._a, other.toArray()) > 0;
} else {
this._isDSTShifted = false;
}
return this._isDSTShifted;
}
function isLocal () {
return this.isValid() ? !this._isUTC : false;
}
function isUtcOffset () {
return this.isValid() ? this._isUTC : false;
}
function isUtc () {
return this.isValid() ? this._isUTC && this._offset === 0 : false;
}
// ASP.NET json date format regex
var aspNetRegex = /^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/;
// from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
// somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
// and further modified to allow for strings containing both week and day
var isoRegex = /^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/;
function createDuration (input, key) {
var duration = input,
// matching against regexp is expensive, do it on demand
match = null,
sign,
ret,
diffRes;
if (isDuration(input)) {
duration = {
ms : input._milliseconds,
d : input._days,
M : input._months
};
} else if (isNumber(input)) {
duration = {};
if (key) {
duration[key] = input;
} else {
duration.milliseconds = input;
}
} else if (!!(match = aspNetRegex.exec(input))) {
sign = (match[1] === '-') ? -1 : 1;
duration = {
y : 0,
d : toInt(match[DATE]) * sign,
h : toInt(match[HOUR]) * sign,
m : toInt(match[MINUTE]) * sign,
s : toInt(match[SECOND]) * sign,
ms : toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match
};
} else if (!!(match = isoRegex.exec(input))) {
sign = (match[1] === '-') ? -1 : 1;
duration = {
y : parseIso(match[2], sign),
M : parseIso(match[3], sign),
w : parseIso(match[4], sign),
d : parseIso(match[5], sign),
h : parseIso(match[6], sign),
m : parseIso(match[7], sign),
s : parseIso(match[8], sign)
};
} else if (duration == null) {// checks for null or undefined
duration = {};
} else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) {
diffRes = momentsDifference(createLocal(duration.from), createLocal(duration.to));
duration = {};
duration.ms = diffRes.milliseconds;
duration.M = diffRes.months;
}
ret = new Duration(duration);
if (isDuration(input) && hasOwnProp(input, '_locale')) {
ret._locale = input._locale;
}
return ret;
}
createDuration.fn = Duration.prototype;
createDuration.invalid = createInvalid$1;
function parseIso (inp, sign) {
// We'd normally use ~~inp for this, but unfortunately it also
// converts floats to ints.
// inp may be undefined, so careful calling replace on it.
var res = inp && parseFloat(inp.replace(',', '.'));
// apply sign while we're at it
return (isNaN(res) ? 0 : res) * sign;
}
function positiveMomentsDifference(base, other) {
var res = {milliseconds: 0, months: 0};
res.months = other.month() - base.month() +
(other.year() - base.year()) * 12;
if (base.clone().add(res.months, 'M').isAfter(other)) {
--res.months;
}
res.milliseconds = +other - +(base.clone().add(res.months, 'M'));
return res;
}
function momentsDifference(base, other) {
var res;
if (!(base.isValid() && other.isValid())) {
return {milliseconds: 0, months: 0};
}
other = cloneWithOffset(other, base);
if (base.isBefore(other)) {
res = positiveMomentsDifference(base, other);
} else {
res = positiveMomentsDifference(other, base);
res.milliseconds = -res.milliseconds;
res.months = -res.months;
}
return res;
}
// TODO: remove 'name' arg after deprecation is removed
function createAdder(direction, name) {
return function (val, period) {
var dur, tmp;
//invert the arguments, but complain about it
if (period !== null && !isNaN(+period)) {
deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period). ' +
'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.');
tmp = val; val = period; period = tmp;
}
val = typeof val === 'string' ? +val : val;
dur = createDuration(val, period);
addSubtract(this, dur, direction);
return this;
};
}
function addSubtract (mom, duration, isAdding, updateOffset) {
var milliseconds = duration._milliseconds,
days = absRound(duration._days),
months = absRound(duration._months);
if (!mom.isValid()) {
// No op
return;
}
updateOffset = updateOffset == null ? true : updateOffset;
if (milliseconds) {
mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding);
}
if (days) {
set$1(mom, 'Date', get(mom, 'Date') + days * isAdding);
}
if (months) {
setMonth(mom, get(mom, 'Month') + months * isAdding);
}
if (updateOffset) {
hooks.updateOffset(mom, days || months);
}
}
var add = createAdder(1, 'add');
var subtract = createAdder(-1, 'subtract');
function getCalendarFormat(myMoment, now) {
var diff = myMoment.diff(now, 'days', true);
return diff < -6 ? 'sameElse' :
diff < -1 ? 'lastWeek' :
diff < 0 ? 'lastDay' :
diff < 1 ? 'sameDay' :
diff < 2 ? 'nextDay' :
diff < 7 ? 'nextWeek' : 'sameElse';
}
function calendar$1 (time, formats) {
// We want to compare the start of today, vs this.
// Getting start-of-today depends on whether we're local/utc/offset or not.
var now = time || createLocal(),
sod = cloneWithOffset(now, this).startOf('day'),
format = hooks.calendarFormat(this, sod) || 'sameElse';
var output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]);
return this.format(output || this.localeData().calendar(format, this, createLocal(now)));
}
function clone () {
return new Moment(this);
}
function isAfter (input, units) {
var localInput = isMoment(input) ? input : createLocal(input);
if (!(this.isValid() && localInput.isValid())) {
return false;
}
units = normalizeUnits(!isUndefined(units) ? units : 'millisecond');
if (units === 'millisecond') {
return this.valueOf() > localInput.valueOf();
} else {
return localInput.valueOf() < this.clone().startOf(units).valueOf();
}
}
function isBefore (input, units) {
var localInput = isMoment(input) ? input : createLocal(input);
if (!(this.isValid() && localInput.isValid())) {
return false;
}
units = normalizeUnits(!isUndefined(units) ? units : 'millisecond');
if (units === 'millisecond') {
return this.valueOf() < localInput.valueOf();
} else {
return this.clone().endOf(units).valueOf() < localInput.valueOf();
}
}
function isBetween (from, to, units, inclusivity) {
inclusivity = inclusivity || '()';
return (inclusivity[0] === '(' ? this.isAfter(from, units) : !this.isBefore(from, units)) &&
(inclusivity[1] === ')' ? this.isBefore(to, units) : !this.isAfter(to, units));
}
function isSame (input, units) {
var localInput = isMoment(input) ? input : createLocal(input),
inputMs;
if (!(this.isValid() && localInput.isValid())) {
return false;
}
units = normalizeUnits(units || 'millisecond');
if (units === 'millisecond') {
return this.valueOf() === localInput.valueOf();
} else {
inputMs = localInput.valueOf();
return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf();
}
}
function isSameOrAfter (input, units) {
return this.isSame(input, units) || this.isAfter(input,units);
}
function isSameOrBefore (input, units) {
return this.isSame(input, units) || this.isBefore(input,units);
}
function diff (input, units, asFloat) {
var that,
zoneDelta,
delta, output;
if (!this.isValid()) {
return NaN;
}
that = cloneWithOffset(input, this);
if (!that.isValid()) {
return NaN;
}
zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;
units = normalizeUnits(units);
if (units === 'year' || units === 'month' || units === 'quarter') {
output = monthDiff(this, that);
if (units === 'quarter') {
output = output / 3;
} else if (units === 'year') {
output = output / 12;
}
} else {
delta = this - that;
output = units === 'second' ? delta / 1e3 : // 1000
units === 'minute' ? delta / 6e4 : // 1000 * 60
units === 'hour' ? delta / 36e5 : // 1000 * 60 * 60
units === 'day' ? (delta - zoneDelta) / 864e5 : // 1000 * 60 * 60 * 24, negate dst
units === 'week' ? (delta - zoneDelta) / 6048e5 : // 1000 * 60 * 60 * 24 * 7, negate dst
delta;
}
return asFloat ? output : absFloor(output);
}
function monthDiff (a, b) {
// difference in months
var wholeMonthDiff = ((b.year() - a.year()) * 12) + (b.month() - a.month()),
// b is in (anchor - 1 month, anchor + 1 month)
anchor = a.clone().add(wholeMonthDiff, 'months'),
anchor2, adjust;
if (b - anchor < 0) {
anchor2 = a.clone().add(wholeMonthDiff - 1, 'months');
// linear across the month
adjust = (b - anchor) / (anchor - anchor2);
} else {
anchor2 = a.clone().add(wholeMonthDiff + 1, 'months');
// linear across the month
adjust = (b - anchor) / (anchor2 - anchor);
}
//check for negative zero, return zero if negative zero
return -(wholeMonthDiff + adjust) || 0;
}
hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';
hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]';
function toString () {
return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
}
function toISOString() {
if (!this.isValid()) {
return null;
}
var m = this.clone().utc();
if (m.year() < 0 || m.year() > 9999) {
return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
}
if (isFunction(Date.prototype.toISOString)) {
// native implementation is ~50x faster, use it when we can
return this.toDate().toISOString();
}
return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
}
/**
* Return a human readable representation of a moment that can
* also be evaluated to get a new moment which is the same
*
* @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects
*/
function inspect () {
if (!this.isValid()) {
return 'moment.invalid(/* ' + this._i + ' */)';
}
var func = 'moment';
var zone = '';
if (!this.isLocal()) {
func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';
zone = 'Z';
}
var prefix = '[' + func + '("]';
var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';
var datetime = '-MM-DD[T]HH:mm:ss.SSS';
var suffix = zone + '[")]';
return this.format(prefix + year + datetime + suffix);
}
function format (inputString) {
if (!inputString) {
inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat;
}
var output = formatMoment(this, inputString);
return this.localeData().postformat(output);
}
function from (time, withoutSuffix) {
if (this.isValid() &&
((isMoment(time) && time.isValid()) ||
createLocal(time).isValid())) {
return createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix);
} else {
return this.localeData().invalidDate();
}
}
function fromNow (withoutSuffix) {
return this.from(createLocal(), withoutSuffix);
}
function to (time, withoutSuffix) {
if (this.isValid() &&
((isMoment(time) && time.isValid()) ||
createLocal(time).isValid())) {
return createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix);
} else {
return this.localeData().invalidDate();
}
}
function toNow (withoutSuffix) {
return this.to(createLocal(), withoutSuffix);
}
// If passed a locale key, it will set the locale for this
// instance. Otherwise, it will return the locale configuration
// variables for this instance.
function locale (key) {
var newLocaleData;
if (key === undefined) {
return this._locale._abbr;
} else {
newLocaleData = getLocale(key);
if (newLocaleData != null) {
this._locale = newLocaleData;
}
return this;
}
}
var lang = deprecate(
'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',
function (key) {
if (key === undefined) {
return this.localeData();
} else {
return this.locale(key);
}
}
);
function localeData () {
return this._locale;
}
function startOf (units) {
units = normalizeUnits(units);
// the following switch intentionally omits break keywords
// to utilize falling through the cases.
switch (units) {
case 'year':
this.month(0);
/* falls through */
case 'quarter':
case 'month':
this.date(1);
/* falls through */
case 'week':
case 'isoWeek':
case 'day':
case 'date':
this.hours(0);
/* falls through */
case 'hour':
this.minutes(0);
/* falls through */
case 'minute':
this.seconds(0);
/* falls through */
case 'second':
this.milliseconds(0);
}
// weeks are a special case
if (units === 'week') {
this.weekday(0);
}
if (units === 'isoWeek') {
this.isoWeekday(1);
}
// quarters are also special
if (units === 'quarter') {
this.month(Math.floor(this.month() / 3) * 3);
}
return this;
}
function endOf (units) {
units = normalizeUnits(units);
if (units === undefined || units === 'millisecond') {
return this;
}
// 'date' is an alias for 'day', so it should be considered as such.
if (units === 'date') {
units = 'day';
}
return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms');
}
function valueOf () {
return this._d.valueOf() - ((this._offset || 0) * 60000);
}
function unix () {
return Math.floor(this.valueOf() / 1000);
}
function toDate () {
return new Date(this.valueOf());
}
function toArray () {
var m = this;
return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()];
}
function toObject () {
var m = this;
return {
years: m.year(),
months: m.month(),
date: m.date(),
hours: m.hours(),
minutes: m.minutes(),
seconds: m.seconds(),
milliseconds: m.milliseconds()
};
}
function toJSON () {
// new Date(NaN).toJSON() === null
return this.isValid() ? this.toISOString() : null;
}
function isValid$2 () {
return isValid(this);
}
function parsingFlags () {
return extend({}, getParsingFlags(this));
}
function invalidAt () {
return getParsingFlags(this).overflow;
}
function creationData() {
return {
input: this._i,
format: this._f,
locale: this._locale,
isUTC: this._isUTC,
strict: this._strict
};
}
// FORMATTING
addFormatToken(0, ['gg', 2], 0, function () {
return this.weekYear() % 100;
});
addFormatToken(0, ['GG', 2], 0, function () {
return this.isoWeekYear() % 100;
});
function addWeekYearFormatToken (token, getter) {
addFormatToken(0, [token, token.length], 0, getter);
}
addWeekYearFormatToken('gggg', 'weekYear');
addWeekYearFormatToken('ggggg', 'weekYear');
addWeekYearFormatToken('GGGG', 'isoWeekYear');
addWeekYearFormatToken('GGGGG', 'isoWeekYear');
// ALIASES
addUnitAlias('weekYear', 'gg');
addUnitAlias('isoWeekYear', 'GG');
// PRIORITY
addUnitPriority('weekYear', 1);
addUnitPriority('isoWeekYear', 1);
// PARSING
addRegexToken('G', matchSigned);
addRegexToken('g', matchSigned);
addRegexToken('GG', match1to2, match2);
addRegexToken('gg', match1to2, match2);
addRegexToken('GGGG', match1to4, match4);
addRegexToken('gggg', match1to4, match4);
addRegexToken('GGGGG', match1to6, match6);
addRegexToken('ggggg', match1to6, match6);
addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) {
week[token.substr(0, 2)] = toInt(input);
});
addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {
week[token] = hooks.parseTwoDigitYear(input);
});
// MOMENTS
function getSetWeekYear (input) {
return getSetWeekYearHelper.call(this,
input,
this.week(),
this.weekday(),
this.localeData()._week.dow,
this.localeData()._week.doy);
}
function getSetISOWeekYear (input) {
return getSetWeekYearHelper.call(this,
input, this.isoWeek(), this.isoWeekday(), 1, 4);
}
function getISOWeeksInYear () {
return weeksInYear(this.year(), 1, 4);
}
function getWeeksInYear () {
var weekInfo = this.localeData()._week;
return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
}
function getSetWeekYearHelper(input, week, weekday, dow, doy) {
var weeksTarget;
if (input == null) {
return weekOfYear(this, dow, doy).year;
} else {
weeksTarget = weeksInYear(input, dow, doy);
if (week > weeksTarget) {
week = weeksTarget;
}
return setWeekAll.call(this, input, week, weekday, dow, doy);
}
}
function setWeekAll(weekYear, week, weekday, dow, doy) {
var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy),
date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);
this.year(date.getUTCFullYear());
this.month(date.getUTCMonth());
this.date(date.getUTCDate());
return this;
}
// FORMATTING
addFormatToken('Q', 0, 'Qo', 'quarter');
// ALIASES
addUnitAlias('quarter', 'Q');
// PRIORITY
addUnitPriority('quarter', 7);
// PARSING
addRegexToken('Q', match1);
addParseToken('Q', function (input, array) {
array[MONTH] = (toInt(input) - 1) * 3;
});
// MOMENTS
function getSetQuarter (input) {
return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3);
}
// FORMATTING
addFormatToken('D', ['DD', 2], 'Do', 'date');
// ALIASES
addUnitAlias('date', 'D');
// PRIOROITY
addUnitPriority('date', 9);
// PARSING
addRegexToken('D', match1to2);
addRegexToken('DD', match1to2, match2);
addRegexToken('Do', function (isStrict, locale) {
// TODO: Remove "ordinalParse" fallback in next major release.
return isStrict ?
(locale._dayOfMonthOrdinalParse || locale._ordinalParse) :
locale._dayOfMonthOrdinalParseLenient;
});
addParseToken(['D', 'DD'], DATE);
addParseToken('Do', function (input, array) {
array[DATE] = toInt(input.match(match1to2)[0], 10);
});
// MOMENTS
var getSetDayOfMonth = makeGetSet('Date', true);
// FORMATTING
addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');
// ALIASES
addUnitAlias('dayOfYear', 'DDD');
// PRIORITY
addUnitPriority('dayOfYear', 4);
// PARSING
addRegexToken('DDD', match1to3);
addRegexToken('DDDD', match3);
addParseToken(['DDD', 'DDDD'], function (input, array, config) {
config._dayOfYear = toInt(input);
});
// HELPERS
// MOMENTS
function getSetDayOfYear (input) {
var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1;
return input == null ? dayOfYear : this.add((input - dayOfYear), 'd');
}
// FORMATTING
addFormatToken('m', ['mm', 2], 0, 'minute');
// ALIASES
addUnitAlias('minute', 'm');
// PRIORITY
addUnitPriority('minute', 14);
// PARSING
addRegexToken('m', match1to2);
addRegexToken('mm', match1to2, match2);
addParseToken(['m', 'mm'], MINUTE);
// MOMENTS
var getSetMinute = makeGetSet('Minutes', false);
// FORMATTING
addFormatToken('s', ['ss', 2], 0, 'second');
// ALIASES
addUnitAlias('second', 's');
// PRIORITY
addUnitPriority('second', 15);
// PARSING
addRegexToken('s', match1to2);
addRegexToken('ss', match1to2, match2);
addParseToken(['s', 'ss'], SECOND);
// MOMENTS
var getSetSecond = makeGetSet('Seconds', false);
// FORMATTING
addFormatToken('S', 0, 0, function () {
return ~~(this.millisecond() / 100);
});
addFormatToken(0, ['SS', 2], 0, function () {
return ~~(this.millisecond() / 10);
});
addFormatToken(0, ['SSS', 3], 0, 'millisecond');
addFormatToken(0, ['SSSS', 4], 0, function () {
return this.millisecond() * 10;
});
addFormatToken(0, ['SSSSS', 5], 0, function () {
return this.millisecond() * 100;
});
addFormatToken(0, ['SSSSSS', 6], 0, function () {
return this.millisecond() * 1000;
});
addFormatToken(0, ['SSSSSSS', 7], 0, function () {
return this.millisecond() * 10000;
});
addFormatToken(0, ['SSSSSSSS', 8], 0, function () {
return this.millisecond() * 100000;
});
addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {
return this.millisecond() * 1000000;
});
// ALIASES
addUnitAlias('millisecond', 'ms');
// PRIORITY
addUnitPriority('millisecond', 16);
// PARSING
addRegexToken('S', match1to3, match1);
addRegexToken('SS', match1to3, match2);
addRegexToken('SSS', match1to3, match3);
var token;
for (token = 'SSSS'; token.length <= 9; token += 'S') {
addRegexToken(token, matchUnsigned);
}
function parseMs(input, array) {
array[MILLISECOND] = toInt(('0.' + input) * 1000);
}
for (token = 'S'; token.length <= 9; token += 'S') {
addParseToken(token, parseMs);
}
// MOMENTS
var getSetMillisecond = makeGetSet('Milliseconds', false);
// FORMATTING
addFormatToken('z', 0, 0, 'zoneAbbr');
addFormatToken('zz', 0, 0, 'zoneName');
// MOMENTS
function getZoneAbbr () {
return this._isUTC ? 'UTC' : '';
}
function getZoneName () {
return this._isUTC ? 'Coordinated Universal Time' : '';
}
var proto = Moment.prototype;
proto.add = add;
proto.calendar = calendar$1;
proto.clone = clone;
proto.diff = diff;
proto.endOf = endOf;
proto.format = format;
proto.from = from;
proto.fromNow = fromNow;
proto.to = to;
proto.toNow = toNow;
proto.get = stringGet;
proto.invalidAt = invalidAt;
proto.isAfter = isAfter;
proto.isBefore = isBefore;
proto.isBetween = isBetween;
proto.isSame = isSame;
proto.isSameOrAfter = isSameOrAfter;
proto.isSameOrBefore = isSameOrBefore;
proto.isValid = isValid$2;
proto.lang = lang;
proto.locale = locale;
proto.localeData = localeData;
proto.max = prototypeMax;
proto.min = prototypeMin;
proto.parsingFlags = parsingFlags;
proto.set = stringSet;
proto.startOf = startOf;
proto.subtract = subtract;
proto.toArray = toArray;
proto.toObject = toObject;
proto.toDate = toDate;
proto.toISOString = toISOString;
proto.inspect = inspect;
proto.toJSON = toJSON;
proto.toString = toString;
proto.unix = unix;
proto.valueOf = valueOf;
proto.creationData = creationData;
// Year
proto.year = getSetYear;
proto.isLeapYear = getIsLeapYear;
// Week Year
proto.weekYear = getSetWeekYear;
proto.isoWeekYear = getSetISOWeekYear;
// Quarter
proto.quarter = proto.quarters = getSetQuarter;
// Month
proto.month = getSetMonth;
proto.daysInMonth = getDaysInMonth;
// Week
proto.week = proto.weeks = getSetWeek;
proto.isoWeek = proto.isoWeeks = getSetISOWeek;
proto.weeksInYear = getWeeksInYear;
proto.isoWeeksInYear = getISOWeeksInYear;
// Day
proto.date = getSetDayOfMonth;
proto.day = proto.days = getSetDayOfWeek;
proto.weekday = getSetLocaleDayOfWeek;
proto.isoWeekday = getSetISODayOfWeek;
proto.dayOfYear = getSetDayOfYear;
// Hour
proto.hour = proto.hours = getSetHour;
// Minute
proto.minute = proto.minutes = getSetMinute;
// Second
proto.second = proto.seconds = getSetSecond;
// Millisecond
proto.millisecond = proto.milliseconds = getSetMillisecond;
// Offset
proto.utcOffset = getSetOffset;
proto.utc = setOffsetToUTC;
proto.local = setOffsetToLocal;
proto.parseZone = setOffsetToParsedOffset;
proto.hasAlignedHourOffset = hasAlignedHourOffset;
proto.isDST = isDaylightSavingTime;
proto.isLocal = isLocal;
proto.isUtcOffset = isUtcOffset;
proto.isUtc = isUtc;
proto.isUTC = isUtc;
// Timezone
proto.zoneAbbr = getZoneAbbr;
proto.zoneName = getZoneName;
// Deprecations
proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth);
proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth);
proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear);
proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', getSetZone);
proto.isDSTShifted = deprecate('isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', isDaylightSavingTimeShifted);
function createUnix (input) {
return createLocal(input * 1000);
}
function createInZone () {
return createLocal.apply(null, arguments).parseZone();
}
function preParsePostFormat (string) {
return string;
}
var proto$1 = Locale.prototype;
proto$1.calendar = calendar;
proto$1.longDateFormat = longDateFormat;
proto$1.invalidDate = invalidDate;
proto$1.ordinal = ordinal;
proto$1.preparse = preParsePostFormat;
proto$1.postformat = preParsePostFormat;
proto$1.relativeTime = relativeTime;
proto$1.pastFuture = pastFuture;
proto$1.set = set;
// Month
proto$1.months = localeMonths;
proto$1.monthsShort = localeMonthsShort;
proto$1.monthsParse = localeMonthsParse;
proto$1.monthsRegex = monthsRegex;
proto$1.monthsShortRegex = monthsShortRegex;
// Week
proto$1.week = localeWeek;
proto$1.firstDayOfYear = localeFirstDayOfYear;
proto$1.firstDayOfWeek = localeFirstDayOfWeek;
// Day of Week
proto$1.weekdays = localeWeekdays;
proto$1.weekdaysMin = localeWeekdaysMin;
proto$1.weekdaysShort = localeWeekdaysShort;
proto$1.weekdaysParse = localeWeekdaysParse;
proto$1.weekdaysRegex = weekdaysRegex;
proto$1.weekdaysShortRegex = weekdaysShortRegex;
proto$1.weekdaysMinRegex = weekdaysMinRegex;
// Hours
proto$1.isPM = localeIsPM;
proto$1.meridiem = localeMeridiem;
function get$1 (format, index, field, setter) {
var locale = getLocale();
var utc = createUTC().set(setter, index);
return locale[field](utc, format);
}
function listMonthsImpl (format, index, field) {
if (isNumber(format)) {
index = format;
format = undefined;
}
format = format || '';
if (index != null) {
return get$1(format, index, field, 'month');
}
var i;
var out = [];
for (i = 0; i < 12; i++) {
out[i] = get$1(format, i, field, 'month');
}
return out;
}
// ()
// (5)
// (fmt, 5)
// (fmt)
// (true)
// (true, 5)
// (true, fmt, 5)
// (true, fmt)
function listWeekdaysImpl (localeSorted, format, index, field) {
if (typeof localeSorted === 'boolean') {
if (isNumber(format)) {
index = format;
format = undefined;
}
format = format || '';
} else {
format = localeSorted;
index = format;
localeSorted = false;
if (isNumber(format)) {
index = format;
format = undefined;
}
format = format || '';
}
var locale = getLocale(),
shift = localeSorted ? locale._week.dow : 0;
if (index != null) {
return get$1(format, (index + shift) % 7, field, 'day');
}
var i;
var out = [];
for (i = 0; i < 7; i++) {
out[i] = get$1(format, (i + shift) % 7, field, 'day');
}
return out;
}
function listMonths (format, index) {
return listMonthsImpl(format, index, 'months');
}
function listMonthsShort (format, index) {
return listMonthsImpl(format, index, 'monthsShort');
}
function listWeekdays (localeSorted, format, index) {
return listWeekdaysImpl(localeSorted, format, index, 'weekdays');
}
function listWeekdaysShort (localeSorted, format, index) {
return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort');
}
function listWeekdaysMin (localeSorted, format, index) {
return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin');
}
getSetGlobalLocale('en', {
dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
ordinal : function (number) {
var b = number % 10,
output = (toInt(number % 100 / 10) === 1) ? 'th' :
(b === 1) ? 'st' :
(b === 2) ? 'nd' :
(b === 3) ? 'rd' : 'th';
return number + output;
}
});
// Side effect imports
hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', getSetGlobalLocale);
hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', getLocale);
var mathAbs = Math.abs;
function abs () {
var data = this._data;
this._milliseconds = mathAbs(this._milliseconds);
this._days = mathAbs(this._days);
this._months = mathAbs(this._months);
data.milliseconds = mathAbs(data.milliseconds);
data.seconds = mathAbs(data.seconds);
data.minutes = mathAbs(data.minutes);
data.hours = mathAbs(data.hours);
data.months = mathAbs(data.months);
data.years = mathAbs(data.years);
return this;
}
function addSubtract$1 (duration, input, value, direction) {
var other = createDuration(input, value);
duration._milliseconds += direction * other._milliseconds;
duration._days += direction * other._days;
duration._months += direction * other._months;
return duration._bubble();
}
// supports only 2.0-style add(1, 's') or add(duration)
function add$1 (input, value) {
return addSubtract$1(this, input, value, 1);
}
// supports only 2.0-style subtract(1, 's') or subtract(duration)
function subtract$1 (input, value) {
return addSubtract$1(this, input, value, -1);
}
function absCeil (number) {
if (number < 0) {
return Math.floor(number);
} else {
return Math.ceil(number);
}
}
function bubble () {
var milliseconds = this._milliseconds;
var days = this._days;
var months = this._months;
var data = this._data;
var seconds, minutes, hours, years, monthsFromDays;
// if we have a mix of positive and negative values, bubble down first
// check: https://github.com/moment/moment/issues/2166
if (!((milliseconds >= 0 && days >= 0 && months >= 0) ||
(milliseconds <= 0 && days <= 0 && months <= 0))) {
milliseconds += absCeil(monthsToDays(months) + days) * 864e5;
days = 0;
months = 0;
}
// The following code bubbles up values, see the tests for
// examples of what that means.
data.milliseconds = milliseconds % 1000;
seconds = absFloor(milliseconds / 1000);
data.seconds = seconds % 60;
minutes = absFloor(seconds / 60);
data.minutes = minutes % 60;
hours = absFloor(minutes / 60);
data.hours = hours % 24;
days += absFloor(hours / 24);
// convert days to months
monthsFromDays = absFloor(daysToMonths(days));
months += monthsFromDays;
days -= absCeil(monthsToDays(monthsFromDays));
// 12 months -> 1 year
years = absFloor(months / 12);
months %= 12;
data.days = days;
data.months = months;
data.years = years;
return this;
}
function daysToMonths (days) {
// 400 years have 146097 days (taking into account leap year rules)
// 400 years have 12 months === 4800
return days * 4800 / 146097;
}
function monthsToDays (months) {
// the reverse of daysToMonths
return months * 146097 / 4800;
}
function as (units) {
if (!this.isValid()) {
return NaN;
}
var days;
var months;
var milliseconds = this._milliseconds;
units = normalizeUnits(units);
if (units === 'month' || units === 'year') {
days = this._days + milliseconds / 864e5;
months = this._months + daysToMonths(days);
return units === 'month' ? months : months / 12;
} else {
// handle milliseconds separately because of floating point math errors (issue #1867)
days = this._days + Math.round(monthsToDays(this._months));
switch (units) {
case 'week' : return days / 7 + milliseconds / 6048e5;
case 'day' : return days + milliseconds / 864e5;
case 'hour' : return days * 24 + milliseconds / 36e5;
case 'minute' : return days * 1440 + milliseconds / 6e4;
case 'second' : return days * 86400 + milliseconds / 1000;
// Math.floor prevents floating point math errors here
case 'millisecond': return Math.floor(days * 864e5) + milliseconds;
default: throw new Error('Unknown unit ' + units);
}
}
}
// TODO: Use this.as('ms')?
function valueOf$1 () {
if (!this.isValid()) {
return NaN;
}
return (
this._milliseconds +
this._days * 864e5 +
(this._months % 12) * 2592e6 +
toInt(this._months / 12) * 31536e6
);
}
function makeAs (alias) {
return function () {
return this.as(alias);
};
}
var asMilliseconds = makeAs('ms');
var asSeconds = makeAs('s');
var asMinutes = makeAs('m');
var asHours = makeAs('h');
var asDays = makeAs('d');
var asWeeks = makeAs('w');
var asMonths = makeAs('M');
var asYears = makeAs('y');
function get$2 (units) {
units = normalizeUnits(units);
return this.isValid() ? this[units + 's']() : NaN;
}
function makeGetter(name) {
return function () {
return this.isValid() ? this._data[name] : NaN;
};
}
var milliseconds = makeGetter('milliseconds');
var seconds = makeGetter('seconds');
var minutes = makeGetter('minutes');
var hours = makeGetter('hours');
var days = makeGetter('days');
var months = makeGetter('months');
var years = makeGetter('years');
function weeks () {
return absFloor(this.days() / 7);
}
var round = Math.round;
var thresholds = {
ss: 44, // a few seconds to seconds
s : 45, // seconds to minute
m : 45, // minutes to hour
h : 22, // hours to day
d : 26, // days to month
M : 11 // months to year
};
// helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
}
function relativeTime$1 (posNegDuration, withoutSuffix, locale) {
var duration = createDuration(posNegDuration).abs();
var seconds = round(duration.as('s'));
var minutes = round(duration.as('m'));
var hours = round(duration.as('h'));
var days = round(duration.as('d'));
var months = round(duration.as('M'));
var years = round(duration.as('y'));
var a = seconds <= thresholds.ss && ['s', seconds] ||
seconds < thresholds.s && ['ss', seconds] ||
minutes <= 1 && ['m'] ||
minutes < thresholds.m && ['mm', minutes] ||
hours <= 1 && ['h'] ||
hours < thresholds.h && ['hh', hours] ||
days <= 1 && ['d'] ||
days < thresholds.d && ['dd', days] ||
months <= 1 && ['M'] ||
months < thresholds.M && ['MM', months] ||
years <= 1 && ['y'] || ['yy', years];
a[2] = withoutSuffix;
a[3] = +posNegDuration > 0;
a[4] = locale;
return substituteTimeAgo.apply(null, a);
}
// This function allows you to set the rounding function for relative time strings
function getSetRelativeTimeRounding (roundingFunction) {
if (roundingFunction === undefined) {
return round;
}
if (typeof(roundingFunction) === 'function') {
round = roundingFunction;
return true;
}
return false;
}
// This function allows you to set a threshold for relative time strings
function getSetRelativeTimeThreshold (threshold, limit) {
if (thresholds[threshold] === undefined) {
return false;
}
if (limit === undefined) {
return thresholds[threshold];
}
thresholds[threshold] = limit;
if (threshold === 's') {
thresholds.ss = limit - 1;
}
return true;
}
function humanize (withSuffix) {
if (!this.isValid()) {
return this.localeData().invalidDate();
}
var locale = this.localeData();
var output = relativeTime$1(this, !withSuffix, locale);
if (withSuffix) {
output = locale.pastFuture(+this, output);
}
return locale.postformat(output);
}
var abs$1 = Math.abs;
function toISOString$1() {
// for ISO strings we do not use the normal bubbling rules:
// * milliseconds bubble up until they become hours
// * days do not bubble at all
// * months bubble up until they become years
// This is because there is no context-free conversion between hours and days
// (think of clock changes)
// and also not between days and months (28-31 days per month)
if (!this.isValid()) {
return this.localeData().invalidDate();
}
var seconds = abs$1(this._milliseconds) / 1000;
var days = abs$1(this._days);
var months = abs$1(this._months);
var minutes, hours, years;
// 3600 seconds -> 60 minutes -> 1 hour
minutes = absFloor(seconds / 60);
hours = absFloor(minutes / 60);
seconds %= 60;
minutes %= 60;
// 12 months -> 1 year
years = absFloor(months / 12);
months %= 12;
// inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
var Y = years;
var M = months;
var D = days;
var h = hours;
var m = minutes;
var s = seconds;
var total = this.asSeconds();
if (!total) {
// this is the same as C#'s (Noda) and python (isodate)...
// but not other JS (goog.date)
return 'P0D';
}
return (total < 0 ? '-' : '') +
'P' +
(Y ? Y + 'Y' : '') +
(M ? M + 'M' : '') +
(D ? D + 'D' : '') +
((h || m || s) ? 'T' : '') +
(h ? h + 'H' : '') +
(m ? m + 'M' : '') +
(s ? s + 'S' : '');
}
var proto$2 = Duration.prototype;
proto$2.isValid = isValid$1;
proto$2.abs = abs;
proto$2.add = add$1;
proto$2.subtract = subtract$1;
proto$2.as = as;
proto$2.asMilliseconds = asMilliseconds;
proto$2.asSeconds = asSeconds;
proto$2.asMinutes = asMinutes;
proto$2.asHours = asHours;
proto$2.asDays = asDays;
proto$2.asWeeks = asWeeks;
proto$2.asMonths = asMonths;
proto$2.asYears = asYears;
proto$2.valueOf = valueOf$1;
proto$2._bubble = bubble;
proto$2.get = get$2;
proto$2.milliseconds = milliseconds;
proto$2.seconds = seconds;
proto$2.minutes = minutes;
proto$2.hours = hours;
proto$2.days = days;
proto$2.weeks = weeks;
proto$2.months = months;
proto$2.years = years;
proto$2.humanize = humanize;
proto$2.toISOString = toISOString$1;
proto$2.toString = toISOString$1;
proto$2.toJSON = toISOString$1;
proto$2.locale = locale;
proto$2.localeData = localeData;
// Deprecations
proto$2.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', toISOString$1);
proto$2.lang = lang;
// Side effect imports
// FORMATTING
addFormatToken('X', 0, 0, 'unix');
addFormatToken('x', 0, 0, 'valueOf');
// PARSING
addRegexToken('x', matchSigned);
addRegexToken('X', matchTimestamp);
addParseToken('X', function (input, array, config) {
config._d = new Date(parseFloat(input, 10) * 1000);
});
addParseToken('x', function (input, array, config) {
config._d = new Date(toInt(input));
});
// Side effect imports
hooks.version = '2.18.1';
setHookCallback(createLocal);
hooks.fn = proto;
hooks.min = min;
hooks.max = max;
hooks.now = now;
hooks.utc = createUTC;
hooks.unix = createUnix;
hooks.months = listMonths;
hooks.isDate = isDate;
hooks.locale = getSetGlobalLocale;
hooks.invalid = createInvalid;
hooks.duration = createDuration;
hooks.isMoment = isMoment;
hooks.weekdays = listWeekdays;
hooks.parseZone = createInZone;
hooks.localeData = getLocale;
hooks.isDuration = isDuration;
hooks.monthsShort = listMonthsShort;
hooks.weekdaysMin = listWeekdaysMin;
hooks.defineLocale = defineLocale;
hooks.updateLocale = updateLocale;
hooks.locales = listLocales;
hooks.weekdaysShort = listWeekdaysShort;
hooks.normalizeUnits = normalizeUnits;
hooks.relativeTimeRounding = getSetRelativeTimeRounding;
hooks.relativeTimeThreshold = getSetRelativeTimeThreshold;
hooks.calendarFormat = getCalendarFormat;
hooks.prototype = proto;
return hooks;
})));
/***/ },
/* 112 */
/***/ function(module, exports) {
/**
* Copyright 2013-present, 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.
*/
'use strict';
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
module.exports = ReactPropTypesSecret;
/***/ },
/* 113 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(global) {var now = __webpack_require__(371)
, root = typeof window === 'undefined' ? global : window
, vendors = ['moz', 'webkit']
, suffix = 'AnimationFrame'
, raf = root['request' + suffix]
, caf = root['cancel' + suffix] || root['cancelRequest' + suffix]
for(var i = 0; !raf && i < vendors.length; i++) {
raf = root[vendors[i] + 'Request' + suffix]
caf = root[vendors[i] + 'Cancel' + suffix]
|| root[vendors[i] + 'CancelRequest' + suffix]
}
// Some versions of FF have rAF but not cAF
if(!raf || !caf) {
var last = 0
, id = 0
, queue = []
, frameDuration = 1000 / 60
raf = function(callback) {
if(queue.length === 0) {
var _now = now()
, next = Math.max(0, frameDuration - (_now - last))
last = next + _now
setTimeout(function() {
var cp = queue.slice(0)
// Clear queue here to prevent
// callbacks from appending listeners
// to the current frame's queue
queue.length = 0
for(var i = 0; i < cp.length; i++) {
if(!cp[i].cancelled) {
try{
cp[i].callback(last)
} catch(e) {
setTimeout(function() { throw e }, 0)
}
}
}
}, Math.round(next))
}
queue.push({
handle: ++id,
callback: callback,
cancelled: false
})
return id
}
caf = function(handle) {
for(var i = 0; i < queue.length; i++) {
if(queue[i].handle === handle) {
queue[i].cancelled = true
}
}
}
}
module.exports = function(fn) {
// Wrap in a new function to prevent
// `cancel` potentially being assigned
// to the native rAF function
return raf.call(root, fn)
}
module.exports.cancel = function() {
caf.apply(root, arguments)
}
module.exports.polyfill = function() {
root.requestAnimationFrame = raf
root.cancelAnimationFrame = caf
}
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
/***/ },
/* 114 */
/***/ 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'];
/***/ },
/* 115 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
module.exports = __webpack_require__(380);
/***/ },
/* 116 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = __webpack_require__(7);
var _extends3 = _interopRequireDefault(_extends2);
var _objectWithoutProperties2 = __webpack_require__(18);
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
var _classCallCheck2 = __webpack_require__(2);
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _possibleConstructorReturn2 = __webpack_require__(4);
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = __webpack_require__(3);
var _inherits3 = _interopRequireDefault(_inherits2);
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__(9);
var _propTypes2 = _interopRequireDefault(_propTypes);
var _objectAssign = __webpack_require__(12);
var _objectAssign2 = _interopRequireDefault(_objectAssign);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var Handle = function (_React$Component) {
(0, _inherits3["default"])(Handle, _React$Component);
function Handle() {
(0, _classCallCheck3["default"])(this, Handle);
return (0, _possibleConstructorReturn3["default"])(this, _React$Component.apply(this, arguments));
}
Handle.prototype.render = function render() {
var _props = this.props,
className = _props.className,
vertical = _props.vertical,
offset = _props.offset,
handleStyle = _props.handleStyle,
restProps = (0, _objectWithoutProperties3["default"])(_props, ['className', 'vertical', 'offset', 'handleStyle']);
var style = vertical ? { bottom: offset + '%' } : { left: offset + '%' };
return _react2["default"].createElement('div', (0, _extends3["default"])({}, restProps, { className: className, style: (0, _objectAssign2["default"])({}, style, handleStyle) }));
};
return Handle;
}(_react2["default"].Component);
exports["default"] = Handle;
Handle.propTypes = {
className: _propTypes2["default"].string,
vertical: _propTypes2["default"].bool,
offset: _propTypes2["default"].number,
handleStyle: _propTypes2["default"].object
};
module.exports = exports['default'];
/***/ },
/* 117 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _objectAssign = __webpack_require__(12);
var _objectAssign2 = _interopRequireDefault(_objectAssign);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var Track = function Track(_ref) {
var className = _ref.className,
included = _ref.included,
vertical = _ref.vertical,
offset = _ref.offset,
length = _ref.length,
minimumTrackStyle = _ref.minimumTrackStyle;
var style = {
visibility: included ? 'visible' : 'hidden'
};
if (vertical) {
style.bottom = offset + '%';
style.height = length + '%';
} else {
style.left = offset + '%';
style.width = length + '%';
}
return _react2["default"].createElement('div', { className: className, style: (0, _objectAssign2["default"])({}, style, minimumTrackStyle) });
};
exports["default"] = Track;
module.exports = exports['default'];
/***/ },
/* 118 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _objectWithoutProperties2 = __webpack_require__(18);
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
var _extends2 = __webpack_require__(7);
var _extends3 = _interopRequireDefault(_extends2);
var _defineProperty2 = __webpack_require__(6);
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _classCallCheck2 = __webpack_require__(2);
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _possibleConstructorReturn2 = __webpack_require__(4);
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = __webpack_require__(3);
var _inherits3 = _interopRequireDefault(_inherits2);
exports["default"] = createSlider;
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__(9);
var _propTypes2 = _interopRequireDefault(_propTypes);
var _addEventListener = __webpack_require__(50);
var _addEventListener2 = _interopRequireDefault(_addEventListener);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var _warning = __webpack_require__(119);
var _warning2 = _interopRequireDefault(_warning);
var _Steps = __webpack_require__(399);
var _Steps2 = _interopRequireDefault(_Steps);
var _Marks = __webpack_require__(398);
var _Marks2 = _interopRequireDefault(_Marks);
var _Handle = __webpack_require__(116);
var _Handle2 = _interopRequireDefault(_Handle);
var _utils = __webpack_require__(73);
var utils = _interopRequireWildcard(_utils);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function noop() {}
function createSlider(Component) {
var _class, _temp;
return _temp = _class = function (_Component) {
(0, _inherits3["default"])(ComponentEnhancer, _Component);
function ComponentEnhancer(props) {
(0, _classCallCheck3["default"])(this, ComponentEnhancer);
var _this = (0, _possibleConstructorReturn3["default"])(this, _Component.call(this, props));
_this.onMouseDown = function (e) {
if (e.button !== 0) {
return;
}
var isVertical = _this.props.vertical;
var position = utils.getMousePosition(isVertical, e);
if (!utils.isEventFromHandle(e, _this.handlesRefs)) {
_this.dragOffset = 0;
} else {
var handlePosition = utils.getHandleCenterPosition(isVertical, e.target);
_this.dragOffset = position - handlePosition;
position = handlePosition;
}
_this.onStart(position);
_this.addDocumentMouseEvents();
utils.pauseEvent(e);
};
_this.onTouchStart = function (e) {
if (utils.isNotTouchEvent(e)) return;
var isVertical = _this.props.vertical;
var position = utils.getTouchPosition(isVertical, e);
if (!utils.isEventFromHandle(e, _this.handlesRefs)) {
_this.dragOffset = 0;
} else {
var handlePosition = utils.getHandleCenterPosition(isVertical, e.target);
_this.dragOffset = position - handlePosition;
position = handlePosition;
}
_this.onStart(position);
_this.addDocumentTouchEvents();
utils.pauseEvent(e);
};
_this.onMouseMove = function (e) {
if (!_this.sliderRef) {
_this.onEnd();
return;
}
var position = utils.getMousePosition(_this.props.vertical, e);
_this.onMove(e, position - _this.dragOffset);
};
_this.onTouchMove = function (e) {
if (utils.isNotTouchEvent(e) || !_this.sliderRef) {
_this.onEnd();
return;
}
var position = utils.getTouchPosition(_this.props.vertical, e);
_this.onMove(e, position - _this.dragOffset);
};
_this.saveSlider = function (slider) {
_this.sliderRef = slider;
};
if (true) {
var step = props.step,
max = props.max,
min = props.min;
(0, _warning2["default"])(step && Math.floor(step) === step ? (max - min) % step === 0 : true, 'Slider[max] - Slider[min] (%s) should be a multiple of Slider[step] (%s)', max - min, step);
}
_this.handlesRefs = {};
return _this;
}
ComponentEnhancer.prototype.componentWillUnmount = function componentWillUnmount() {
if (_Component.prototype.componentWillUnmount) _Component.prototype.componentWillUnmount.call(this);
this.removeDocumentEvents();
};
ComponentEnhancer.prototype.addDocumentTouchEvents = function addDocumentTouchEvents() {
// just work for Chrome iOS Safari and Android Browser
this.onTouchMoveListener = (0, _addEventListener2["default"])(document, 'touchmove', this.onTouchMove);
this.onTouchUpListener = (0, _addEventListener2["default"])(document, 'touchend', this.onEnd);
};
ComponentEnhancer.prototype.addDocumentMouseEvents = function addDocumentMouseEvents() {
this.onMouseMoveListener = (0, _addEventListener2["default"])(document, 'mousemove', this.onMouseMove);
this.onMouseUpListener = (0, _addEventListener2["default"])(document, 'mouseup', this.onEnd);
};
ComponentEnhancer.prototype.removeDocumentEvents = function removeDocumentEvents() {
/* eslint-disable no-unused-expressions */
this.onTouchMoveListener && this.onTouchMoveListener.remove();
this.onTouchUpListener && this.onTouchUpListener.remove();
this.onMouseMoveListener && this.onMouseMoveListener.remove();
this.onMouseUpListener && this.onMouseUpListener.remove();
/* eslint-enable no-unused-expressions */
};
ComponentEnhancer.prototype.getSliderStart = function getSliderStart() {
var slider = this.sliderRef;
var rect = slider.getBoundingClientRect();
return this.props.vertical ? rect.top : rect.left;
};
ComponentEnhancer.prototype.getSliderLength = function getSliderLength() {
var slider = this.sliderRef;
if (!slider) {
return 0;
}
return this.props.vertical ? slider.clientHeight : slider.clientWidth;
};
ComponentEnhancer.prototype.calcValue = function calcValue(offset) {
var _props = this.props,
vertical = _props.vertical,
min = _props.min,
max = _props.max;
var ratio = Math.abs(Math.max(offset, 0) / this.getSliderLength());
var value = vertical ? (1 - ratio) * (max - min) + min : ratio * (max - min) + min;
return value;
};
ComponentEnhancer.prototype.calcValueByPos = function calcValueByPos(position) {
var pixelOffset = position - this.getSliderStart();
var nextValue = this.trimAlignValue(this.calcValue(pixelOffset));
return nextValue;
};
ComponentEnhancer.prototype.calcOffset = function calcOffset(value) {
var _props2 = this.props,
min = _props2.min,
max = _props2.max;
var ratio = (value - min) / (max - min);
return ratio * 100;
};
ComponentEnhancer.prototype.saveHandle = function saveHandle(index, handle) {
this.handlesRefs[index] = handle;
};
ComponentEnhancer.prototype.render = function render() {
var _classNames;
var _props3 = this.props,
prefixCls = _props3.prefixCls,
className = _props3.className,
marks = _props3.marks,
dots = _props3.dots,
step = _props3.step,
included = _props3.included,
disabled = _props3.disabled,
vertical = _props3.vertical,
min = _props3.min,
max = _props3.max,
children = _props3.children,
maximumTrackStyle = _props3.maximumTrackStyle,
style = _props3.style;
var _Component$prototype$ = _Component.prototype.render.call(this),
tracks = _Component$prototype$.tracks,
handles = _Component$prototype$.handles;
var sliderClassName = (0, _classnames2["default"])((_classNames = {}, (0, _defineProperty3["default"])(_classNames, prefixCls, true), (0, _defineProperty3["default"])(_classNames, prefixCls + '-with-marks', Object.keys(marks).length), (0, _defineProperty3["default"])(_classNames, prefixCls + '-disabled', disabled), (0, _defineProperty3["default"])(_classNames, prefixCls + '-vertical', vertical), (0, _defineProperty3["default"])(_classNames, className, className), _classNames));
return _react2["default"].createElement(
'div',
{
ref: this.saveSlider,
className: sliderClassName,
onTouchStart: disabled ? noop : this.onTouchStart,
onMouseDown: disabled ? noop : this.onMouseDown,
style: style
},
_react2["default"].createElement('div', { className: prefixCls + '-rail', style: maximumTrackStyle }),
tracks,
_react2["default"].createElement(_Steps2["default"], {
prefixCls: prefixCls,
vertical: vertical,
marks: marks,
dots: dots,
step: step,
included: included,
lowerBound: this.getLowerBound(),
upperBound: this.getUpperBound(),
max: max,
min: min
}),
handles,
_react2["default"].createElement(_Marks2["default"], {
className: prefixCls + '-mark',
vertical: vertical,
marks: marks,
included: included,
lowerBound: this.getLowerBound(),
upperBound: this.getUpperBound(),
max: max,
min: min
}),
children
);
};
return ComponentEnhancer;
}(Component), _class.displayName = 'ComponentEnhancer(' + Component.displayName + ')', _class.propTypes = (0, _extends3["default"])({}, Component.propTypes, {
min: _propTypes2["default"].number,
max: _propTypes2["default"].number,
step: _propTypes2["default"].number,
marks: _propTypes2["default"].object,
included: _propTypes2["default"].bool,
className: _propTypes2["default"].string,
prefixCls: _propTypes2["default"].string,
disabled: _propTypes2["default"].bool,
children: _propTypes2["default"].any,
onBeforeChange: _propTypes2["default"].func,
onChange: _propTypes2["default"].func,
onAfterChange: _propTypes2["default"].func,
handle: _propTypes2["default"].func,
dots: _propTypes2["default"].bool,
vertical: _propTypes2["default"].bool,
style: _propTypes2["default"].object,
minimumTrackStyle: _propTypes2["default"].object,
maximumTrackStyle: _propTypes2["default"].object,
handleStyle: _propTypes2["default"].object
}), _class.defaultProps = (0, _extends3["default"])({}, Component.defaultProps, {
prefixCls: 'rc-slider',
className: '',
min: 0,
max: 100,
step: 1,
marks: {},
handle: function handle(_ref) {
var index = _ref.index,
restProps = (0, _objectWithoutProperties3["default"])(_ref, ['index']);
delete restProps.dragging;
delete restProps.value;
return _react2["default"].createElement(_Handle2["default"], (0, _extends3["default"])({}, restProps, { key: index }));
},
onBeforeChange: noop,
onChange: noop,
onAfterChange: noop,
included: true,
disabled: false,
dots: false,
vertical: false,
minimumTrackStyle: {},
maximumTrackStyle: {},
handleStyle: {}
}), _temp;
}
module.exports = exports['default'];
/***/ },
/* 119 */
/***/ function(module, exports, __webpack_require__) {
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
'use strict';
/**
* Similar to invariant but only logs a warning if the condition is not met.
* This can be used to log issues in development environments in critical
* paths. Removing the logging code for production environments will keep the
* same logic and follow the same code paths.
*/
var warning = function() {};
if (true) {
warning = function(condition, format, args) {
var len = arguments.length;
args = new Array(len > 2 ? len - 2 : 0);
for (var key = 2; key < len; key++) {
args[key - 2] = arguments[key];
}
if (format === undefined) {
throw new Error(
'`warning(condition, format, ...args)` requires a warning ' +
'message argument'
);
}
if (format.length < 10 || (/^[s\W]*$/).test(format)) {
throw new Error(
'The warning format should be able to uniquely identify this ' +
'warning. Please, use a more descriptive format than: ' + format
);
}
if (!condition) {
var argIndex = 0;
var message = 'Warning: ' +
format.replace(/%s/g, function() {
return args[argIndex++];
});
if (typeof console !== 'undefined') {
console.error(message);
}
try {
// This error was thrown as a convenience so that you can use this stack
// to find the callsite that caused this warning to fire.
throw new Error(message);
} catch(x) {}
}
};
}
module.exports = warning;
/***/ },
/* 120 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _defineProperty2 = __webpack_require__(6);
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
exports.getScroll = getScroll;
var _utils = __webpack_require__(49);
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _classnames2 = __webpack_require__(5);
var _classnames3 = _interopRequireDefault(_classnames2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
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 offset(elem) {
var box = void 0;
var x = void 0;
var y = void 0;
var doc = elem.ownerDocument;
var body = doc.body;
var docElem = doc && doc.documentElement;
box = elem.getBoundingClientRect();
x = box.left;
y = box.top;
x -= docElem.clientLeft || body.clientLeft || 0;
y -= docElem.clientTop || body.clientTop || 0;
var w = doc.defaultView || doc.parentWindow;
x += getScroll(w);
y += getScroll(w, true);
return {
left: x, top: y
};
}
function _componentDidUpdate(component, init) {
var refs = component.refs;
var wrapNode = refs.nav || refs.root;
var containerOffset = offset(wrapNode);
var inkBarNode = refs.inkBar;
var activeTab = refs.activeTab;
var inkBarNodeStyle = inkBarNode.style;
var tabBarPosition = component.props.tabBarPosition;
if (init) {
// prevent mount animation
inkBarNodeStyle.display = 'none';
}
if (activeTab) {
var tabNode = activeTab;
var tabOffset = offset(tabNode);
var transformSupported = (0, _utils.isTransformSupported)(inkBarNodeStyle);
if (tabBarPosition === 'top' || tabBarPosition === 'bottom') {
var left = tabOffset.left - containerOffset.left;
// use 3d gpu to optimize render
if (transformSupported) {
(0, _utils.setTransform)(inkBarNodeStyle, 'translate3d(' + left + 'px,0,0)');
inkBarNodeStyle.width = tabNode.offsetWidth + 'px';
inkBarNodeStyle.height = '';
} else {
inkBarNodeStyle.left = left + 'px';
inkBarNodeStyle.top = '';
inkBarNodeStyle.bottom = '';
inkBarNodeStyle.right = wrapNode.offsetWidth - left - tabNode.offsetWidth + 'px';
}
} else {
var top = tabOffset.top - containerOffset.top;
if (transformSupported) {
(0, _utils.setTransform)(inkBarNodeStyle, 'translate3d(0,' + top + 'px,0)');
inkBarNodeStyle.height = tabNode.offsetHeight + 'px';
inkBarNodeStyle.width = '';
} else {
inkBarNodeStyle.left = '';
inkBarNodeStyle.right = '';
inkBarNodeStyle.top = top + 'px';
inkBarNodeStyle.bottom = wrapNode.offsetHeight - top - tabNode.offsetHeight + 'px';
}
}
}
inkBarNodeStyle.display = activeTab ? 'block' : 'none';
}
exports["default"] = {
getDefaultProps: function getDefaultProps() {
return {
inkBarAnimated: true
};
},
componentDidUpdate: function componentDidUpdate() {
_componentDidUpdate(this);
},
componentDidMount: function componentDidMount() {
_componentDidUpdate(this, true);
},
getInkBarNode: function getInkBarNode() {
var _classnames;
var _props = this.props,
prefixCls = _props.prefixCls,
styles = _props.styles,
inkBarAnimated = _props.inkBarAnimated;
var className = prefixCls + '-ink-bar';
var classes = (0, _classnames3["default"])((_classnames = {}, (0, _defineProperty3["default"])(_classnames, className, true), (0, _defineProperty3["default"])(_classnames, inkBarAnimated ? className + '-animated' : className + '-no-animated', true), _classnames));
return _react2["default"].createElement('div', {
style: styles.inkBar,
className: classes,
key: 'inkBar',
ref: 'inkBar'
});
}
};
/***/ },
/* 121 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _defineProperty2 = __webpack_require__(6);
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _classnames2 = __webpack_require__(5);
var _classnames3 = _interopRequireDefault(_classnames2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var TabPane = _react2["default"].createClass({
displayName: 'TabPane',
propTypes: {
className: _react.PropTypes.string,
active: _react.PropTypes.bool,
style: _react.PropTypes.any,
destroyInactiveTabPane: _react.PropTypes.bool,
forceRender: _react.PropTypes.bool,
placeholder: _react.PropTypes.node
},
getDefaultProps: function getDefaultProps() {
return { placeholder: null };
},
render: function render() {
var _classnames;
var props = this.props;
var className = props.className,
destroyInactiveTabPane = props.destroyInactiveTabPane,
active = props.active,
forceRender = props.forceRender;
this._isActived = this._isActived || active;
var prefixCls = props.rootPrefixCls + '-tabpane';
var cls = (0, _classnames3["default"])((_classnames = {}, (0, _defineProperty3["default"])(_classnames, prefixCls, 1), (0, _defineProperty3["default"])(_classnames, prefixCls + '-inactive', !active), (0, _defineProperty3["default"])(_classnames, prefixCls + '-active', active), (0, _defineProperty3["default"])(_classnames, className, className), _classnames));
var isRender = destroyInactiveTabPane ? active : this._isActived;
return _react2["default"].createElement(
'div',
{
style: props.style,
role: 'tabpanel',
'aria-hidden': props.active ? 'false' : 'true',
className: cls
},
isRender || forceRender ? props.children : props.placeholder
);
}
});
exports["default"] = TabPane;
module.exports = exports['default'];
/***/ },
/* 122 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.TabPane = exports["default"] = undefined;
var _Tabs = __webpack_require__(425);
var _Tabs2 = _interopRequireDefault(_Tabs);
var _TabPane2 = __webpack_require__(121);
var _TabPane3 = _interopRequireDefault(_TabPane2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
exports["default"] = _Tabs2["default"];
exports.TabPane = _TabPane3["default"];
/***/ },
/* 123 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
module.exports = __webpack_require__(426);
/***/ },
/* 124 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _objectWithoutProperties2 = __webpack_require__(18);
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
var _classCallCheck2 = __webpack_require__(2);
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _possibleConstructorReturn2 = __webpack_require__(4);
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = __webpack_require__(3);
var _inherits3 = _interopRequireDefault(_inherits2);
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__(9);
var _propTypes2 = _interopRequireDefault(_propTypes);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var LazyRenderBox = function (_Component) {
(0, _inherits3["default"])(LazyRenderBox, _Component);
function LazyRenderBox() {
(0, _classCallCheck3["default"])(this, LazyRenderBox);
return (0, _possibleConstructorReturn3["default"])(this, _Component.apply(this, arguments));
}
LazyRenderBox.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {
return nextProps.hiddenClassName || nextProps.visible;
};
LazyRenderBox.prototype.render = function render() {
var _props = this.props,
hiddenClassName = _props.hiddenClassName,
visible = _props.visible,
props = (0, _objectWithoutProperties3["default"])(_props, ['hiddenClassName', 'visible']);
if (hiddenClassName || _react2["default"].Children.count(props.children) > 1) {
if (!visible && hiddenClassName) {
props.className += ' ' + hiddenClassName;
}
return _react2["default"].createElement('div', props);
}
return _react2["default"].Children.only(props.children);
};
return LazyRenderBox;
}(_react.Component);
LazyRenderBox.propTypes = {
children: _propTypes2["default"].any,
className: _propTypes2["default"].string,
visible: _propTypes2["default"].bool,
hiddenClassName: _propTypes2["default"].string
};
exports["default"] = LazyRenderBox;
module.exports = exports['default'];
/***/ },
/* 125 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
exports["default"] = getContainerRenderMixin;
var _reactDom = __webpack_require__(10);
var _reactDom2 = _interopRequireDefault(_reactDom);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function defaultGetContainer() {
var container = document.createElement('div');
document.body.appendChild(container);
return container;
}
function getContainerRenderMixin(config) {
var _config$autoMount = config.autoMount,
autoMount = _config$autoMount === undefined ? true : _config$autoMount,
_config$autoDestroy = config.autoDestroy,
autoDestroy = _config$autoDestroy === undefined ? true : _config$autoDestroy,
isVisible = config.isVisible,
getComponent = config.getComponent,
_config$getContainer = config.getContainer,
getContainer = _config$getContainer === undefined ? defaultGetContainer : _config$getContainer;
var mixin = void 0;
function _renderComponent(instance, componentArg, ready) {
if (!isVisible || instance._component || isVisible(instance)) {
if (!instance._container) {
instance._container = getContainer(instance);
}
var component = void 0;
if (instance.getComponent) {
component = instance.getComponent(componentArg);
} else {
component = getComponent(instance, componentArg);
}
_reactDom2["default"].unstable_renderSubtreeIntoContainer(instance, component, instance._container, function callback() {
instance._component = this;
if (ready) {
ready.call(this);
}
});
}
}
if (autoMount) {
mixin = _extends({}, mixin, {
componentDidMount: function componentDidMount() {
_renderComponent(this);
},
componentDidUpdate: function componentDidUpdate() {
_renderComponent(this);
}
});
}
if (!autoMount || !autoDestroy) {
mixin = _extends({}, mixin, {
renderComponent: function renderComponent(componentArg, ready) {
_renderComponent(this, componentArg, ready);
}
});
}
function _removeContainer(instance) {
if (instance._container) {
var container = instance._container;
_reactDom2["default"].unmountComponentAtNode(container);
container.parentNode.removeChild(container);
instance._container = null;
}
}
if (autoDestroy) {
mixin = _extends({}, mixin, {
componentWillUnmount: function componentWillUnmount() {
_removeContainer(this);
}
});
} else {
mixin = _extends({}, mixin, {
removeContainer: function removeContainer() {
_removeContainer(this);
}
});
}
return mixin;
}
module.exports = exports['default'];
/***/ },
/* 126 */
/***/ function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var Channel = function Channel(data) {
_classCallCheck(this, Channel);
var listeners = [];
data = data || {};
this.subscribe = function (fn) {
listeners.push(fn);
};
this.unsubscribe = function (fn) {
var idx = listeners.indexOf(fn);
if (idx !== -1) listeners.splice(idx, 1);
};
this.update = function (fn) {
if (fn) fn(data);
listeners.forEach(function (l) {
return l(data);
});
};
};
exports.default = Channel;
module.exports = exports['default'];
/***/ },
/* 127 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _arrayTreeFilter = __webpack_require__(78);
var _arrayTreeFilter2 = _interopRequireDefault(_arrayTreeFilter);
var _MultiPicker = __webpack_require__(51);
var _MultiPicker2 = _interopRequireDefault(_MultiPicker);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var Cascader = _react2["default"].createClass({
displayName: 'Cascader',
getDefaultProps: function getDefaultProps() {
return {
cols: 3,
prefixCls: 'rmc-cascader',
pickerPrefixCls: 'rmc-picker',
data: [],
disabled: false
};
},
getInitialState: function getInitialState() {
return {
value: this.getValue(this.props.data, this.props.defaultValue || this.props.value)
};
},
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
if ('value' in nextProps) {
this.setState({
value: this.getValue(nextProps.data, nextProps.value)
});
}
},
onValueChange: function onValueChange(value, index) {
var children = (0, _arrayTreeFilter2["default"])(this.props.data, function (c, level) {
return level <= index && c.value === value[level];
});
var data = children[index];
var i = void 0;
for (i = index + 1; data && data.children && data.children.length && i < this.props.cols; i++) {
data = data.children[0];
value[i] = data.value;
}
value.length = i;
if (!('value' in this.props)) {
this.setState({
value: value
});
}
this.props.onChange(value);
},
getValue: function getValue(d, val) {
var data = d || this.props.data;
var value = val || this.props.value || this.props.defaultValue;
if (!value || !value.length) {
value = [];
for (var i = 0; i < this.props.cols; i++) {
if (data && data.length) {
value[i] = data[0].value;
data = data[0].children;
}
}
}
return value;
},
getCols: function getCols() {
var _props = this.props,
data = _props.data,
cols = _props.cols;
var value = this.state.value;
var childrenTree = (0, _arrayTreeFilter2["default"])(data, function (c, level) {
return c.value === value[level];
}).map(function (c) {
return c.children;
});
childrenTree.length = cols - 1;
childrenTree.unshift(data);
return childrenTree.map(function (children) {
return {
props: {
children: children || []
}
};
});
},
render: function render() {
var props = this.props;
var prefixCls = props.prefixCls,
pickerPrefixCls = props.pickerPrefixCls,
className = props.className,
rootNativeProps = props.rootNativeProps,
disabled = props.disabled,
pickerItemStyle = props.pickerItemStyle;
return _react2["default"].createElement(_MultiPicker2["default"], { prefixCls: prefixCls, pickerPrefixCls: pickerPrefixCls, disabled: disabled, className: className, selectedValue: this.state.value, rootNativeProps: rootNativeProps, pickerItemStyle: pickerItemStyle, onValueChange: this.onValueChange }, this.getCols());
}
});
exports["default"] = Cascader;
module.exports = exports['default'];
/***/ },
/* 128 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = __webpack_require__(7);
var _extends3 = _interopRequireDefault(_extends2);
var _objectWithoutProperties2 = __webpack_require__(18);
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
var _classCallCheck2 = __webpack_require__(2);
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _possibleConstructorReturn2 = __webpack_require__(4);
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = __webpack_require__(3);
var _inherits3 = _interopRequireDefault(_inherits2);
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _reactDom = __webpack_require__(10);
var _reactDom2 = _interopRequireDefault(_reactDom);
var _ListViewDataSource = __webpack_require__(449);
var _ListViewDataSource2 = _interopRequireDefault(_ListViewDataSource);
var _ScrollView = __webpack_require__(453);
var _ScrollView2 = _interopRequireDefault(_ScrollView);
var _ScrollResponder = __webpack_require__(452);
var _ScrollResponder2 = _interopRequireDefault(_ScrollResponder);
var _StaticRenderer = __webpack_require__(454);
var _StaticRenderer2 = _interopRequireDefault(_StaticRenderer);
var _reactTimerMixin = __webpack_require__(442);
var _reactTimerMixin2 = _interopRequireDefault(_reactTimerMixin);
var _reactMixin = __webpack_require__(438);
var _reactMixin2 = _interopRequireDefault(_reactMixin);
var _autobindDecorator = __webpack_require__(137);
var _autobindDecorator2 = _interopRequireDefault(_autobindDecorator);
var _reactSticky = __webpack_require__(440);
var _PullUpLoadMoreMixin = __webpack_require__(450);
var _PullUpLoadMoreMixin2 = _interopRequireDefault(_PullUpLoadMoreMixin);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var DEFAULT_PAGE_SIZE = 1;
var DEFAULT_INITIAL_ROWS = 10;
var DEFAULT_SCROLL_RENDER_AHEAD = 1000;
var DEFAULT_END_REACHED_THRESHOLD = 1000;
var DEFAULT_SCROLL_CALLBACK_THROTTLE = 50;
var SCROLLVIEW_REF = 'listviewscroll';
// https://github.com/facebook/react-native/blob/master/Libraries/CustomComponents/ListView/ListView.js
/* eslint react/prop-types: 0, react/sort-comp: 0, no-unused-expressions: 0 */
var ListView = function (_React$Component) {
(0, _inherits3["default"])(ListView, _React$Component);
function ListView() {
var _temp, _this, _ret;
(0, _classCallCheck3["default"])(this, ListView);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3["default"])(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.state = {
curRenderedRowsCount: _this.props.initialListSize,
highlightedRow: {}
}, _this.stickyRefs = {}, _temp), (0, _possibleConstructorReturn3["default"])(_this, _ret);
}
/**
* React life cycle hooks.
*/
/**
* Exports some data, e.g. for perf investigations or analytics.
*/
ListView.prototype.getMetrics = function getMetrics() {
return {
contentLength: this.scrollProperties.contentLength,
totalRows: this.props.dataSource.getRowCount(),
renderedRows: this.state.curRenderedRowsCount,
visibleRows: Object.keys(this._visibleRows).length
};
};
/**
* Provides a handle to the underlying scroll responder.
* Note that the view in `SCROLLVIEW_REF` may not be a `ScrollView`, so we
* need to check that it responds to `getScrollResponder` before calling it.
*/
ListView.prototype.getScrollResponder = function getScrollResponder() {
return this.refs[SCROLLVIEW_REF] && this.refs[SCROLLVIEW_REF].getScrollResponder && this.refs[SCROLLVIEW_REF].getScrollResponder();
};
ListView.prototype.scrollTo = function scrollTo() {
var _refs$SCROLLVIEW_REF;
this.refs[SCROLLVIEW_REF] && this.refs[SCROLLVIEW_REF].scrollTo && (_refs$SCROLLVIEW_REF = this.refs[SCROLLVIEW_REF]).scrollTo.apply(_refs$SCROLLVIEW_REF, arguments);
};
ListView.prototype.setNativeProps = function setNativeProps(props) {
this.refs[SCROLLVIEW_REF] && this.refs[SCROLLVIEW_REF].setNativeProps(props);
};
ListView.prototype.getInnerViewNode = function getInnerViewNode() {
return this.refs[SCROLLVIEW_REF].getInnerViewNode();
};
ListView.prototype.componentWillMount = function componentWillMount() {
// this data should never trigger a render pass, so don't put in state
this.scrollProperties = {
visibleLength: null,
contentLength: null,
offset: 0
};
this._childFrames = [];
this._visibleRows = {};
this._prevRenderedRowsCount = 0;
this._sentEndForContentLength = null;
};
ListView.prototype.componentDidMount = function componentDidMount() {
// do this in animation frame until componentDidMount actually runs after
// the component is laid out
// this.requestAnimationFrame(() => {
// this._measureAndUpdateScrollProps();
// });
};
ListView.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
var _this2 = this;
if (this.props.dataSource !== nextProps.dataSource || this.props.initialListSize !== nextProps.initialListSize) {
this.setState(function (state, props) {
_this2._prevRenderedRowsCount = 0;
return {
curRenderedRowsCount: Math.min(Math.max(state.curRenderedRowsCount, props.initialListSize), props.dataSource.getRowCount())
};
}, function () {
return _this2._renderMoreRowsIfNeeded();
});
}
};
ListView.prototype.onRowHighlighted = function onRowHighlighted(sectionID, rowID) {
this.setState({ highlightedRow: { sectionID: sectionID, rowID: rowID } });
};
ListView.prototype.render = function render() {
var _this3 = this;
var bodyComponents = [];
var dataSource = this.props.dataSource;
var allRowIDs = dataSource.rowIdentities;
var rowCount = 0;
var sectionHeaderIndices = [];
var header = this.props.renderHeader && this.props.renderHeader();
var footer = this.props.renderFooter && this.props.renderFooter();
var totalIndex = header ? 1 : 0;
var _loop = function _loop(sectionIdx) {
var sectionID = dataSource.sectionIdentities[sectionIdx];
var rowIDs = allRowIDs[sectionIdx];
if (rowIDs.length === 0) {
return 'continue';
}
if (_this3.props.renderSectionHeader) {
var shouldUpdateHeader = rowCount >= _this3._prevRenderedRowsCount && dataSource.sectionHeaderShouldUpdate(sectionIdx);
var renderSectionHeader = _react2["default"].createElement(_StaticRenderer2["default"], {
key: 's_' + sectionID,
shouldUpdate: !!shouldUpdateHeader,
render: _this3.props.renderSectionHeader.bind(null, dataSource.getSectionHeaderData(sectionIdx), sectionID)
});
if (_this3.props.stickyHeader) {
renderSectionHeader = _react2["default"].createElement(
_reactSticky.Sticky,
(0, _extends3["default"])({}, _this3.props.stickyProps, { key: 's_' + sectionID,
ref: function ref(c) {
_this3.stickyRefs[sectionID] = c;
}
}),
renderSectionHeader
);
}
bodyComponents.push(renderSectionHeader);
sectionHeaderIndices.push(totalIndex++);
}
var sectionBody = [];
for (var rowIdx = 0; rowIdx < rowIDs.length; rowIdx++) {
var rowID = rowIDs[rowIdx];
var comboID = sectionID + '_' + rowID;
var shouldUpdateRow = rowCount >= _this3._prevRenderedRowsCount && dataSource.rowShouldUpdate(sectionIdx, rowIdx);
var row = _react2["default"].createElement(_StaticRenderer2["default"], {
key: 'r_' + comboID,
shouldUpdate: !!shouldUpdateRow,
render: _this3.props.renderRow.bind(null, dataSource.getRowData(sectionIdx, rowIdx), sectionID, rowID, _this3.onRowHighlighted)
});
// bodyComponents.push(row);
sectionBody.push(row);
totalIndex++;
if (_this3.props.renderSeparator && (rowIdx !== rowIDs.length - 1 || sectionIdx === allRowIDs.length - 1)) {
var adjacentRowHighlighted = _this3.state.highlightedRow.sectionID === sectionID && (_this3.state.highlightedRow.rowID === rowID || _this3.state.highlightedRow.rowID === rowIDs[rowIdx + 1]);
var separator = _this3.props.renderSeparator(sectionID, rowID, adjacentRowHighlighted);
if (separator) {
// bodyComponents.push(separator);
sectionBody.push(separator);
totalIndex++;
}
}
if (++rowCount === _this3.state.curRenderedRowsCount) {
break;
}
}
bodyComponents.push(_react2["default"].cloneElement(_this3.props.renderSectionBodyWrapper(sectionID), {
className: _this3.props.sectionBodyClassName
}, sectionBody));
if (rowCount >= _this3.state.curRenderedRowsCount) {
return 'break';
}
};
_loop2: for (var sectionIdx = 0; sectionIdx < allRowIDs.length; sectionIdx++) {
var _ret2 = _loop(sectionIdx);
switch (_ret2) {
case 'continue':
continue;
case 'break':
break _loop2;}
}
var _props = this.props,
renderScrollComponent = _props.renderScrollComponent,
props = (0, _objectWithoutProperties3["default"])(_props, ['renderScrollComponent']);
bodyComponents = _react2["default"].cloneElement(props.renderBodyComponent(), {}, bodyComponents);
if (props.stickyHeader) {
bodyComponents = _react2["default"].createElement(
_reactSticky.StickyContainer,
props.stickyContainerProps,
bodyComponents
);
}
this._sc = _react2["default"].cloneElement(renderScrollComponent((0, _extends3["default"])({}, props, { onScroll: this._onScroll })), {
ref: SCROLLVIEW_REF,
onContentSizeChange: this._onContentSizeChange,
onLayout: this._onLayout
}, header, bodyComponents, footer, props.children);
return this._sc;
};
/**
* Private methods
*/
ListView.prototype._measureAndUpdateScrollProps = function _measureAndUpdateScrollProps() {
var scrollComponent = this.getScrollResponder();
if (!scrollComponent || !scrollComponent.getInnerViewNode) {
return;
}
// RCTScrollViewManager.calculateChildFrames is not available on
// every platform
// RCTScrollViewManager && RCTScrollViewManager.calculateChildFrames &&
// RCTScrollViewManager.calculateChildFrames(
// React.findNodeHandle(scrollComponent),
// this._updateVisibleRows,
// );
};
ListView.prototype._onContentSizeChange = function _onContentSizeChange(width, height) {
var contentLength = !this.props.horizontal ? height : width;
if (contentLength !== this.scrollProperties.contentLength) {
this.scrollProperties.contentLength = contentLength;
this._updateVisibleRows();
this._renderMoreRowsIfNeeded();
}
this.props.onContentSizeChange && this.props.onContentSizeChange(width, height);
};
ListView.prototype._onLayout = function _onLayout(event) {
var _event$nativeEvent$la = event.nativeEvent.layout,
width = _event$nativeEvent$la.width,
height = _event$nativeEvent$la.height;
var visibleLength = !this.props.horizontal ? height : width;
if (visibleLength !== this.scrollProperties.visibleLength) {
this.scrollProperties.visibleLength = visibleLength;
this._updateVisibleRows();
this._renderMoreRowsIfNeeded();
}
this.props.onLayout && this.props.onLayout(event);
};
ListView.prototype._maybeCallOnEndReached = function _maybeCallOnEndReached(event) {
// console.log(this.scrollProperties, this._getDistanceFromEnd(this.scrollProperties));
if (this.props.onEndReached &&
// this.scrollProperties.contentLength !== this._sentEndForContentLength &&
this._getDistanceFromEnd(this.scrollProperties) < this.props.onEndReachedThreshold && this.state.curRenderedRowsCount === this.props.dataSource.getRowCount()) {
this._sentEndForContentLength = this.scrollProperties.contentLength;
this.props.onEndReached(event);
return true;
}
return false;
};
ListView.prototype._renderMoreRowsIfNeeded = function _renderMoreRowsIfNeeded() {
if (this.scrollProperties.contentLength === null || this.scrollProperties.visibleLength === null || this.state.curRenderedRowsCount === this.props.dataSource.getRowCount()) {
this._maybeCallOnEndReached();
return;
}
var distanceFromEnd = this._getDistanceFromEnd(this.scrollProperties);
// console.log(distanceFromEnd, this.props.scrollRenderAheadDistance);
if (distanceFromEnd < this.props.scrollRenderAheadDistance) {
this._pageInNewRows();
}
};
ListView.prototype._pageInNewRows = function _pageInNewRows() {
var _this4 = this;
this.setState(function (state, props) {
var rowsToRender = Math.min(state.curRenderedRowsCount + props.pageSize, props.dataSource.getRowCount());
_this4._prevRenderedRowsCount = state.curRenderedRowsCount;
return {
curRenderedRowsCount: rowsToRender
};
}, function () {
_this4._measureAndUpdateScrollProps();
_this4._prevRenderedRowsCount = _this4.state.curRenderedRowsCount;
});
};
ListView.prototype._getDistanceFromEnd = function _getDistanceFromEnd(scrollProperties) {
return scrollProperties.contentLength - scrollProperties.visibleLength - scrollProperties.offset;
};
ListView.prototype._updateVisibleRows = function _updateVisibleRows() /* updatedFrames */{
// if (!this.props.onChangeVisibleRows) {
// return; // No need to compute visible rows if there is no callback
// }
// if (updatedFrames) {
// updatedFrames.forEach((newFrame) => {
// this._childFrames[newFrame.index] = merge(newFrame);
// });
// }
// let isVertical = !this.props.horizontal;
// let dataSource = this.props.dataSource;
// let visibleMin = this.scrollProperties.offset;
// let visibleMax = visibleMin + this.scrollProperties.visibleLength;
// let allRowIDs = dataSource.rowIdentities;
//
// let header = this.props.renderHeader && this.props.renderHeader();
// let totalIndex = header ? 1 : 0;
// let visibilityChanged = false;
// let changedRows = {};
// for (let sectionIdx = 0; sectionIdx < allRowIDs.length; sectionIdx++) {
// let rowIDs = allRowIDs[sectionIdx];
// if (rowIDs.length === 0) {
// continue;
// }
// let sectionID = dataSource.sectionIdentities[sectionIdx];
// if (this.props.renderSectionHeader) {
// totalIndex++;
// }
// let visibleSection = this._visibleRows[sectionID];
// if (!visibleSection) {
// visibleSection = {};
// }
// for (let rowIdx = 0; rowIdx < rowIDs.length; rowIdx++) {
// let rowID = rowIDs[rowIdx];
// let frame = this._childFrames[totalIndex];
// totalIndex++;
// if (!frame) {
// break;
// }
// let rowVisible = visibleSection[rowID];
// let min = isVertical ? frame.y : frame.x;
// let max = min + (isVertical ? frame.height : frame.width);
// if (min > visibleMax || max < visibleMin) {
// if (rowVisible) {
// visibilityChanged = true;
// delete visibleSection[rowID];
// if (!changedRows[sectionID]) {
// changedRows[sectionID] = {};
// }
// changedRows[sectionID][rowID] = false;
// }
// } else if (!rowVisible) {
// visibilityChanged = true;
// visibleSection[rowID] = true;
// if (!changedRows[sectionID]) {
// changedRows[sectionID] = {};
// }
// changedRows[sectionID][rowID] = true;
// }
// }
// if (!isEmpty(visibleSection)) {
// this._visibleRows[sectionID] = visibleSection;
// } else if (this._visibleRows[sectionID]) {
// delete this._visibleRows[sectionID];
// }
// }
// visibilityChanged && this.props.onChangeVisibleRows(this._visibleRows, changedRows);
};
ListView.prototype._onScroll = function _onScroll(e) {
var isVertical = !this.props.horizontal;
// this.scrollProperties.visibleLength = e.nativeEvent.layoutMeasurement[
// isVertical ? 'height' : 'width'
// ];
// this.scrollProperties.contentLength = e.nativeEvent.contentSize[
// isVertical ? 'height' : 'width'
// ];
// this.scrollProperties.offset = e.nativeEvent.contentOffset[
// isVertical ? 'y' : 'x'
// ];
var ev = e;
var target = _reactDom2["default"].findDOMNode(this.refs[SCROLLVIEW_REF]);
if (this.props.stickyHeader || this.props.useBodyScroll) {
this.scrollProperties.visibleLength = window[isVertical ? 'innerHeight' : 'innerWidth'];
this.scrollProperties.contentLength = target[isVertical ? 'scrollHeight' : 'scrollWidth'];
this.scrollProperties.offset = window.document.body[isVertical ? 'scrollTop' : 'scrollLeft'];
} else if (this.props.useZscroller) {
var domScroller = this.refs[SCROLLVIEW_REF].domScroller;
ev = domScroller;
this.scrollProperties.visibleLength = domScroller.container[isVertical ? 'clientHeight' : 'clientWidth'];
this.scrollProperties.contentLength = domScroller.content[isVertical ? 'offsetHeight' : 'offsetWidth'];
this.scrollProperties.offset = domScroller.scroller.getValues()[isVertical ? 'top' : 'left'];
// console.log(this.scrollProperties, domScroller.scroller.getScrollMax())
} else {
this.scrollProperties.visibleLength = target[isVertical ? 'offsetHeight' : 'offsetWidth'];
this.scrollProperties.contentLength = target[isVertical ? 'scrollHeight' : 'scrollWidth'];
this.scrollProperties.offset = target[isVertical ? 'scrollTop' : 'scrollLeft'];
}
// this._updateVisibleRows(e.nativeEvent.updatedChildFrames);
if (!this._maybeCallOnEndReached(ev)) {
this._renderMoreRowsIfNeeded();
}
if (this.props.onEndReached && this._getDistanceFromEnd(this.scrollProperties) > this.props.onEndReachedThreshold) {
// Scrolled out of the end zone, so it should be able to trigger again.
this._sentEndForContentLength = null;
}
this.props.onScroll && this.props.onScroll(ev);
};
return ListView;
}(_react2["default"].Component);
ListView.DataSource = _ListViewDataSource2["default"];
ListView.propTypes = (0, _extends3["default"])({}, _ScrollView2["default"].propTypes, {
dataSource: _react.PropTypes.instanceOf(_ListViewDataSource2["default"]).isRequired,
renderSeparator: _react.PropTypes.func,
renderRow: _react.PropTypes.func.isRequired,
initialListSize: _react.PropTypes.number,
onEndReached: _react.PropTypes.func,
onEndReachedThreshold: _react.PropTypes.number,
pageSize: _react.PropTypes.number,
renderFooter: _react.PropTypes.func,
renderHeader: _react.PropTypes.func,
renderSectionHeader: _react.PropTypes.func,
renderScrollComponent: _react2["default"].PropTypes.func,
scrollRenderAheadDistance: _react2["default"].PropTypes.number,
onChangeVisibleRows: _react2["default"].PropTypes.func,
scrollEventThrottle: _react2["default"].PropTypes.number,
// removeClippedSubviews: React.PropTypes.bool,
// stickyHeaderIndices: PropTypes.arrayOf(PropTypes.number),
// another added
renderBodyComponent: _react.PropTypes.func,
renderSectionBodyWrapper: _react.PropTypes.func,
sectionBodyClassName: _react.PropTypes.string,
useZscroller: _react.PropTypes.bool, // for web
useBodyScroll: _react.PropTypes.bool, // for web
stickyHeader: _react.PropTypes.bool, // for web
stickyProps: _react.PropTypes.object, // https://github.com/captivationsoftware/react-sticky/blob/master/README.md#sticky--props
stickyContainerProps: _react.PropTypes.object
});
ListView.defaultProps = {
initialListSize: DEFAULT_INITIAL_ROWS,
pageSize: DEFAULT_PAGE_SIZE,
renderScrollComponent: function renderScrollComponent(props) {
return _react2["default"].createElement(_ScrollView2["default"], props);
},
renderBodyComponent: function renderBodyComponent() {
return _react2["default"].createElement('div', null);
},
renderSectionBodyWrapper: function renderSectionBodyWrapper(sectionID) {
return _react2["default"].createElement('div', { key: sectionID });
},
sectionBodyClassName: 'list-view-section-body',
scrollRenderAheadDistance: DEFAULT_SCROLL_RENDER_AHEAD,
onEndReachedThreshold: DEFAULT_END_REACHED_THRESHOLD,
scrollEventThrottle: DEFAULT_SCROLL_CALLBACK_THROTTLE,
// stickyHeaderIndices: [],
stickyProps: {},
stickyContainerProps: {}
};
(0, _reactMixin2["default"])(ListView.prototype, _ScrollResponder2["default"].Mixin);
(0, _reactMixin2["default"])(ListView.prototype, _reactTimerMixin2["default"]);
(0, _reactMixin2["default"])(ListView.prototype, _PullUpLoadMoreMixin2["default"]);
(0, _autobindDecorator2["default"])(ListView);
ListView.isReactNativeComponent = true;
exports["default"] = ListView;
module.exports = exports['default'];
/***/ },
/* 129 */
/***/ function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getOffsetTop = getOffsetTop;
exports._event = _event;
exports.throttle = throttle;
function getOffsetTop(elem) {
var offsetTop = 0;
/* eslint no-cond-assign: 0 */
do {
if (!isNaN(elem.offsetTop)) {
offsetTop += elem.offsetTop;
}
} while (elem = elem.offsetParent);
return offsetTop;
}
function _event(e) {
if (e.touches && e.touches.length) {
return e.touches[0];
}
if (e.changedTouches && e.changedTouches.length) {
return e.changedTouches[0];
}
return e;
}
function throttle(fn, delay) {
var allowSample = true;
return function (e) {
if (allowSample) {
allowSample = false;
setTimeout(function () {
allowSample = true;
}, delay);
fn(e);
}
};
}
/***/ },
/* 130 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _rcDialog = __webpack_require__(48);
var _rcDialog2 = _interopRequireDefault(_rcDialog);
var _PopupMixin = __webpack_require__(458);
var _PopupMixin2 = _interopRequireDefault(_PopupMixin);
var _rcTouchable = __webpack_require__(17);
var _rcTouchable2 = _interopRequireDefault(_rcTouchable);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var PopupPicker = _react2["default"].createClass({
displayName: 'PopupPicker',
mixins: [_PopupMixin2["default"]],
getDefaultProps: function getDefaultProps() {
return {
prefixCls: 'rmc-picker-popup',
triggerType: 'onClick',
WrapComponent: 'span'
};
},
getModal: function getModal() {
var props = this.props;
if (!this.state.visible) {
return null;
}
var prefixCls = props.prefixCls;
return _react2["default"].createElement(
_rcDialog2["default"],
{ prefixCls: '' + prefixCls, className: props.className || '', visible: true, closable: false, transitionName: props.transitionName || props.popupTransitionName, maskTransitionName: props.maskTransitionName, onClose: this.hide, style: props.style },
_react2["default"].createElement(
'div',
null,
_react2["default"].createElement(
'div',
{ className: prefixCls + '-header' },
_react2["default"].createElement(
_rcTouchable2["default"],
{ activeClassName: prefixCls + '-item-active' },
_react2["default"].createElement(
'div',
{ className: prefixCls + '-item ' + prefixCls + '-header-left', onClick: this.onDismiss },
props.dismissText
)
),
_react2["default"].createElement(
'div',
{ className: prefixCls + '-item ' + prefixCls + '-title' },
props.title
),
_react2["default"].createElement(
_rcTouchable2["default"],
{ activeClassName: prefixCls + '-item-active' },
_react2["default"].createElement(
'div',
{ className: prefixCls + '-item ' + prefixCls + '-header-right', onClick: this.onOk },
props.okText
)
)
),
this.getContent()
)
);
},
render: function render() {
return this.getRender();
}
});
exports["default"] = PopupPicker;
module.exports = exports['default'];
/***/ },
/* 131 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
__webpack_require__(113); // vendor check
var Scroller = __webpack_require__(489);
var MIN_INDICATOR_SIZE = 8;
function setTransform(nodeStyle, value) {
nodeStyle.transform = value;
nodeStyle.webkitTransform = value;
nodeStyle.MozTransform = value;
}
function setTransformOrigin(nodeStyle, value) {
nodeStyle.transformOrigin = value;
nodeStyle.webkitTransformOrigin = value;
nodeStyle.MozTransformOrigin = value;
}
function DOMScroller(content) {
var _this = this;
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var scrollbars = void 0;
var indicators = void 0;
var indicatorsSize = void 0;
var scrollbarsSize = void 0;
var indicatorsPos = void 0;
var scrollbarsOpacity = void 0;
var contentSize = void 0;
var clientSize = void 0;
this.content = content;
this.container = content.parentNode;
this.options = _extends({}, options, {
scrollingComplete: function scrollingComplete() {
_this.clearScrollbarTimer();
_this.timer = setTimeout(function () {
if (_this._destroyed) {
return;
}
if (options.scrollingComplete) {
options.scrollingComplete();
}
if (scrollbars) {
['x', 'y'].forEach(function (k) {
if (scrollbars[k]) {
_this.setScrollbarOpacity(k, 0);
}
});
}
}, 0);
}
});
if (this.options.scrollbars) {
scrollbars = this.scrollbars = {};
indicators = this.indicators = {};
indicatorsSize = this.indicatorsSize = {};
scrollbarsSize = this.scrollbarsSize = {};
indicatorsPos = this.indicatorsPos = {};
scrollbarsOpacity = this.scrollbarsOpacity = {};
contentSize = this.contentSize = {};
clientSize = this.clientSize = {};
['x', 'y'].forEach(function (k) {
var optionName = k === 'x' ? 'scrollingX' : 'scrollingY';
if (_this.options[optionName] !== false) {
scrollbars[k] = document.createElement('div');
scrollbars[k].className = 'zscroller-scrollbar-' + k;
indicators[k] = document.createElement('div');
indicators[k].className = 'zscroller-indicator-' + k;
scrollbars[k].appendChild(indicators[k]);
indicatorsSize[k] = -1;
scrollbarsOpacity[k] = 0;
indicatorsPos[k] = 0;
_this.container.appendChild(scrollbars[k]);
}
});
}
var init = true;
var contentStyle = content.style;
// create Scroller instance
this.scroller = new Scroller(function (left, top, zoom) {
if (!init && options.onScroll) {
options.onScroll();
}
setTransform(contentStyle, 'translate3d(' + -left + 'px,' + -top + 'px,0) scale(' + zoom + ')');
if (scrollbars) {
['x', 'y'].forEach(function (k) {
if (scrollbars[k]) {
var pos = k === 'x' ? left : top;
if (clientSize[k] >= contentSize[k]) {
_this.setScrollbarOpacity(k, 0);
} else {
if (!init) {
_this.setScrollbarOpacity(k, 1);
}
var normalIndicatorSize = clientSize[k] / contentSize[k] * scrollbarsSize[k];
var size = normalIndicatorSize;
var indicatorPos = void 0;
if (pos < 0) {
size = Math.max(normalIndicatorSize + pos, MIN_INDICATOR_SIZE);
indicatorPos = 0;
} else if (pos > contentSize[k] - clientSize[k]) {
size = Math.max(normalIndicatorSize + contentSize[k] - clientSize[k] - pos, MIN_INDICATOR_SIZE);
indicatorPos = scrollbarsSize[k] - size;
} else {
indicatorPos = pos / contentSize[k] * scrollbarsSize[k];
}
_this.setIndicatorSize(k, size);
_this.setIndicatorPos(k, indicatorPos);
}
}
});
}
init = false;
}, this.options);
// bind events
this.bindEvents();
// the content element needs a correct transform origin for zooming
setTransformOrigin(content.style, 'left top');
// reflow for the first time
this.reflow();
}
DOMScroller.prototype.setDisabled = function setDisabled(disabled) {
this.disabled = disabled;
};
DOMScroller.prototype.clearScrollbarTimer = function clearScrollbarTimer() {
if (this.timer) {
clearTimeout(this.timer);
this.timer = null;
}
};
DOMScroller.prototype.setScrollbarOpacity = function setScrollbarOpacity(axis, opacity) {
if (this.scrollbarsOpacity[axis] !== opacity) {
this.scrollbars[axis].style.opacity = opacity;
this.scrollbarsOpacity[axis] = opacity;
}
};
DOMScroller.prototype.setIndicatorPos = function setIndicatorPos(axis, value) {
if (this.indicatorsPos[axis] !== value) {
if (axis === 'x') {
setTransform(this.indicators[axis].style, 'translate3d(' + value + 'px,0,0)');
} else {
setTransform(this.indicators[axis].style, 'translate3d(0, ' + value + 'px,0)');
}
this.indicatorsPos[axis] = value;
}
};
DOMScroller.prototype.setIndicatorSize = function setIndicatorSize(axis, value) {
if (this.indicatorsSize[axis] !== value) {
this.indicators[axis].style[axis === 'x' ? 'width' : 'height'] = value + 'px';
this.indicatorsSize[axis] = value;
}
};
DOMScroller.prototype.reflow = function reflow() {
if (this.scrollbars) {
this.contentSize.x = this.content.offsetWidth;
this.contentSize.y = this.content.offsetHeight;
this.clientSize.x = this.container.clientWidth;
this.clientSize.y = this.container.clientHeight;
if (this.scrollbars.x) {
this.scrollbarsSize.x = this.scrollbars.x.offsetWidth;
}
if (this.scrollbars.y) {
this.scrollbarsSize.y = this.scrollbars.y.offsetHeight;
}
}
// set the right scroller dimensions
this.scroller.setDimensions(this.container.clientWidth, this.container.clientHeight, this.content.offsetWidth, this.content.offsetHeight);
// refresh the position for zooming purposes
var rect = this.container.getBoundingClientRect();
this.scroller.setPosition(rect.x + this.container.clientLeft, rect.y + this.container.clientTop);
};
DOMScroller.prototype.destroy = function destroy() {
this._destroyed = true;
window.removeEventListener('resize', this.onResize, false);
this.container.removeEventListener('touchstart', this.onTouchStart, false);
this.container.removeEventListener('touchmove', this.onTouchMove, false);
this.container.removeEventListener('touchend', this.onTouchEnd, false);
this.container.removeEventListener('touchcancel', this.onTouchCancel, false);
this.container.removeEventListener('mousedown', this.onMouseDown, false);
document.removeEventListener('mousemove', this.onMouseMove, false);
document.removeEventListener('mouseup', this.onMouseUp, false);
this.container.removeEventListener('mousewheel', this.onMouseWheel, false);
};
DOMScroller.prototype.bindEvents = function bindEvents() {
var _this2 = this;
var that = this;
// reflow handling
window.addEventListener('resize', this.onResize = function () {
that.reflow();
}, false);
var lockMouse = false;
var releaseLockTimer = void 0;
this.container.addEventListener('touchstart', this.onTouchStart = function (e) {
lockMouse = true;
if (releaseLockTimer) {
clearTimeout(releaseLockTimer);
releaseLockTimer = null;
}
// Don't react if initial down happens on a form element
if (e.touches[0] && e.touches[0].target && e.touches[0].target.tagName.match(/input|textarea|select/i) || _this2.disabled) {
return;
}
_this2.clearScrollbarTimer();
// reflow since the container may have changed
that.reflow();
that.scroller.doTouchStart(e.touches, e.timeStamp);
}, false);
this.container.addEventListener('touchmove', this.onTouchMove = function (e) {
e.preventDefault();
that.scroller.doTouchMove(e.touches, e.timeStamp, e.scale);
}, false);
this.container.addEventListener('touchend', this.onTouchEnd = function (e) {
that.scroller.doTouchEnd(e.timeStamp);
releaseLockTimer = setTimeout(function () {
lockMouse = false;
}, 300);
}, false);
this.container.addEventListener('touchcancel', this.onTouchCancel = function (e) {
that.scroller.doTouchEnd(e.timeStamp);
releaseLockTimer = setTimeout(function () {
lockMouse = false;
}, 300);
}, false);
this.onMouseUp = function (e) {
that.scroller.doTouchEnd(e.timeStamp);
document.removeEventListener('mousemove', _this2.onMouseMove, false);
document.removeEventListener('mouseup', _this2.onMouseUp, false);
};
this.onMouseMove = function (e) {
that.scroller.doTouchMove([{
pageX: e.pageX,
pageY: e.pageY
}], e.timeStamp);
};
this.container.addEventListener('mousedown', this.onMouseDown = function (e) {
if (lockMouse || e.target.tagName.match(/input|textarea|select/i) || _this2.disabled) {
return;
}
_this2.clearScrollbarTimer();
that.scroller.doTouchStart([{
pageX: e.pageX,
pageY: e.pageY
}], e.timeStamp);
// reflow since the container may have changed
that.reflow();
e.preventDefault();
document.addEventListener('mousemove', _this2.onMouseMove, false);
document.addEventListener('mouseup', _this2.onMouseUp, false);
}, false);
this.container.addEventListener('mousewheel', this.onMouseWheel = function (e) {
if (that.options.zooming) {
that.scroller.doMouseZoom(e.wheelDelta, e.timeStamp, e.pageX, e.pageY);
e.preventDefault();
}
}, false);
};
module.exports = DOMScroller;
/***/ },
/* 132 */
/***/ function(module, exports, __webpack_require__) {
var map = {
"./accordion/style/index.web.tsx": 140,
"./action-sheet/style/index.web.tsx": 142,
"./activity-indicator/style/index.web.tsx": 144,
"./badge/style/index.web.tsx": 81,
"./button/style/index.web.tsx": 54,
"./card/style/index.web.tsx": 149,
"./carousel/style/index.web.tsx": 83,
"./checkbox/style/index.web.tsx": 84,
"./create-tooltip/style/index.web.tsx": 154,
"./date-picker/style/index.web.tsx": 157,
"./drawer/style/index.web.tsx": 160,
"./flex/style/index.web.tsx": 32,
"./grid/style/index.web.tsx": 164,
"./icon/style/index.web.tsx": 16,
"./image-picker/style/index.web.tsx": 166,
"./input-item/style/index.web.tsx": 169,
"./list-view/style/index.web.tsx": 172,
"./list/style/index.web.tsx": 21,
"./locale-provider/style/index.web.tsx": 175,
"./menu/style/index.web.tsx": 178,
"./modal/style/index.web.tsx": 183,
"./nav-bar/style/index.web.tsx": 185,
"./notice-bar/style/index.web.tsx": 188,
"./pagination/style/index.web.tsx": 191,
"./picker-view/style/index.web.tsx": 86,
"./picker/style/index.web.tsx": 87,
"./popover/style/index.web.tsx": 198,
"./popup/style/index.web.tsx": 200,
"./progress/style/index.web.tsx": 202,
"./radio/style/index.web.tsx": 88,
"./range/style/index.web.tsx": 206,
"./refresh-control/style/index.web.tsx": 208,
"./result/style/index.web.tsx": 210,
"./search-bar/style/index.web.tsx": 213,
"./segmented-control/style/index.web.tsx": 215,
"./slider/style/index.web.tsx": 217,
"./stepper/style/index.web.tsx": 219,
"./steps/style/index.web.tsx": 221,
"./swipe-action/style/index.web.tsx": 223,
"./switch/style/index.web.tsx": 225,
"./tab-bar/style/index.web.tsx": 228,
"./table/style/index.web.tsx": 230,
"./tabs/style/index.web.tsx": 232,
"./tag/style/index.web.tsx": 234,
"./text/style/index.web.tsx": 236,
"./textarea-item/style/index.web.tsx": 238,
"./toast/style/index.web.tsx": 90,
"./view/style/index.web.tsx": 239,
"./white-space/style/index.web.tsx": 241,
"./wing-blank/style/index.web.tsx": 93
};
function webpackContext(req) {
return __webpack_require__(webpackContextResolve(req));
};
function webpackContextResolve(req) {
return map[req] || (function() { throw new Error("Cannot find module '" + req + "'.") }());
};
webpackContext.keys = function webpackContextKeys() {
return Object.keys(map);
};
webpackContext.resolve = webpackContextResolve;
module.exports = webpackContext;
webpackContext.id = 132;
/***/ },
/* 133 */
/***/ function(module, exports, __webpack_require__) {
var map = {
"./check-circle-o.svg": 462,
"./check-circle.svg": 463,
"./check.svg": 464,
"./cross-circle-o.svg": 465,
"./cross-circle.svg": 466,
"./cross.svg": 467,
"./down.svg": 468,
"./ellipsis-circle.svg": 469,
"./ellipsis.svg": 470,
"./exclamation-circle.svg": 471,
"./info-circle.svg": 472,
"./koubei-o.svg": 473,
"./koubei.svg": 474,
"./left.svg": 475,
"./loading.svg": 476,
"./question-circle.svg": 477,
"./right.svg": 478,
"./search.svg": 479,
"./up.svg": 480
};
function webpackContext(req) {
return __webpack_require__(webpackContextResolve(req));
};
function webpackContextResolve(req) {
return map[req] || (function() { throw new Error("Cannot find module '" + req + "'.") }());
};
webpackContext.keys = function webpackContextKeys() {
return Object.keys(map);
};
webpackContext.resolve = webpackContextResolve;
module.exports = webpackContext;
webpackContext.id = 133;
/***/ },
/* 134 */
/***/ function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
/**
* @ignore
* base event object for custom and dom event.
* @author yiminghe@gmail.com
*/
function returnFalse() {
return false;
}
function returnTrue() {
return true;
}
function EventBaseObject() {
this.timeStamp = Date.now();
this.target = undefined;
this.currentTarget = undefined;
}
EventBaseObject.prototype = {
isEventObject: 1,
constructor: EventBaseObject,
isDefaultPrevented: returnFalse,
isPropagationStopped: returnFalse,
isImmediatePropagationStopped: returnFalse,
preventDefault: function preventDefault() {
this.isDefaultPrevented = returnTrue;
},
stopPropagation: function stopPropagation() {
this.isPropagationStopped = returnTrue;
},
stopImmediatePropagation: function stopImmediatePropagation() {
this.isImmediatePropagationStopped = returnTrue;
// fixed 1.2
// call stopPropagation implicitly
this.stopPropagation();
},
halt: function halt(immediate) {
if (immediate) {
this.stopImmediatePropagation();
} else {
this.stopPropagation();
}
this.preventDefault();
}
};
exports["default"] = EventBaseObject;
module.exports = exports['default'];
/***/ },
/* 135 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _EventBaseObject = __webpack_require__(134);
var _EventBaseObject2 = _interopRequireDefault(_EventBaseObject);
var _objectAssign = __webpack_require__(12);
var _objectAssign2 = _interopRequireDefault(_objectAssign);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/**
* @ignore
* event object for dom
* @author yiminghe@gmail.com
*/
var TRUE = true;
var FALSE = false;
var commonProps = ['altKey', 'bubbles', 'cancelable', 'ctrlKey', 'currentTarget', 'eventPhase', 'metaKey', 'shiftKey', 'target', 'timeStamp', 'view', 'type'];
function isNullOrUndefined(w) {
return w === null || w === undefined;
}
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 = void 0;
var deltaY = void 0;
var delta = void 0;
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;
}
// gecko
if (detail) {
// press control e.detail == 1 else e.detail == 3
delta = 0 - (detail % 3 === 0 ? detail / 3 : detail);
}
// Gecko
if (axis !== undefined) {
if (axis === event.HORIZONTAL_AXIS) {
deltaY = 0;
deltaX = 0 - delta;
} else if (axis === event.VERTICAL_AXIS) {
deltaX = 0;
deltaY = delta;
}
}
// Webkit
if (wheelDeltaY !== undefined) {
deltaY = wheelDeltaY / 120;
}
if (wheelDeltaX !== undefined) {
deltaX = -1 * wheelDeltaX / 120;
}
// 默认 deltaY (ie)
if (!deltaX && !deltaY) {
deltaY = delta;
}
if (deltaX !== undefined) {
/**
* deltaX of mousewheel event
* @property deltaX
* @member Event.DomEvent.Object
*/
event.deltaX = deltaX;
}
if (deltaY !== undefined) {
/**
* deltaY of mousewheel event
* @property deltaY
* @member Event.DomEvent.Object
*/
event.deltaY = deltaY;
}
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 = void 0;
var doc = void 0;
var body = void 0;
var target = event.target;
var button = nativeEvent.button;
// 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);
}
// 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;
}
}
// add relatedTarget, if necessary
if (!event.relatedTarget && event.fromElement) {
event.relatedTarget = event.fromElement === target ? event.toElement : event.fromElement;
}
return event;
}
}];
function retTrue() {
return TRUE;
}
function retFalse() {
return FALSE;
}
function DomEventObject(nativeEvent) {
var type = nativeEvent.type;
var isNative = typeof nativeEvent.stopPropagation === 'function' || typeof nativeEvent.cancelBubble === 'boolean';
_EventBaseObject2["default"].call(this);
this.nativeEvent = nativeEvent;
// 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;
}
this.isDefaultPrevented = isDefaultPrevented;
var fixFns = [];
var fixFn = void 0;
var l = void 0;
var prop = void 0;
var props = commonProps.concat();
eventNormalizers.forEach(function (normalizer) {
if (type.match(normalizer.reg)) {
props = props.concat(normalizer.props);
if (normalizer.fix) {
fixFns.push(normalizer.fix);
}
}
});
l = props.length;
// clone properties of the original event object
while (l) {
prop = props[--l];
this[prop] = nativeEvent[prop];
}
// fix target property, if necessary
if (!this.target && isNative) {
this.target = nativeEvent.srcElement || document; // srcElement might not be defined either
}
// check if target is a text node (safari)
if (this.target && this.target.nodeType === 3) {
this.target = this.target.parentNode;
}
l = fixFns.length;
while (l) {
fixFn = fixFns[--l];
fixFn(this, nativeEvent);
}
this.timeStamp = nativeEvent.timeStamp || Date.now();
}
var EventBaseObjectProto = _EventBaseObject2["default"].prototype;
(0, _objectAssign2["default"])(DomEventObject.prototype, EventBaseObjectProto, {
constructor: DomEventObject,
preventDefault: function preventDefault() {
var e = this.nativeEvent;
// 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;
}
EventBaseObjectProto.preventDefault.call(this);
},
stopPropagation: function stopPropagation() {
var e = this.nativeEvent;
// 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;
}
EventBaseObjectProto.stopPropagation.call(this);
}
});
exports["default"] = DomEventObject;
module.exports = exports['default'];
/***/ },
/* 136 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = addEventListener;
var _EventObject = __webpack_require__(135);
var _EventObject2 = _interopRequireDefault(_EventObject);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
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);
}
};
}
}
module.exports = exports['default'];
/***/ },
/* 137 */
/***/ function(module, exports) {
/**
* @copyright 2015, Andrey Popp <8mayday@gmail.com>
*
* The decorator may be used on classes or methods
* ```
* @autobind
* class FullBound {}
*
* class PartBound {
* @autobind
* method () {}
* }
* ```
*/
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports['default'] = autobind;
function autobind() {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
if (args.length === 1) {
return boundClass.apply(undefined, args);
} else {
return boundMethod.apply(undefined, args);
}
}
/**
* Use boundMethod to bind all methods on the target.prototype
*/
function boundClass(target) {
// (Using reflect to get all keys including symbols)
var keys = undefined;
// Use Reflect if exists
if (typeof Reflect !== 'undefined' && typeof Reflect.ownKeys === 'function') {
keys = Reflect.ownKeys(target.prototype);
} else {
keys = Object.getOwnPropertyNames(target.prototype);
// use symbols if support is provided
if (typeof Object.getOwnPropertySymbols === 'function') {
keys = keys.concat(Object.getOwnPropertySymbols(target.prototype));
}
}
keys.forEach(function (key) {
// Ignore special case target method
if (key === 'constructor') {
return;
}
var descriptor = Object.getOwnPropertyDescriptor(target.prototype, key);
// Only methods need binding
if (typeof descriptor.value === 'function') {
Object.defineProperty(target.prototype, key, boundMethod(target, key, descriptor));
}
});
return target;
}
/**
* Return a descriptor removing the value and returning a getter
* The getter will return a .bind version of the function
* and memoize the result against a symbol on the instance
*/
function boundMethod(target, key, descriptor) {
var fn = descriptor.value;
if (typeof fn !== 'function') {
throw new Error('@autobind decorator can only be applied to methods not: ' + typeof fn);
}
// In IE11 calling Object.defineProperty has a side-effect of evaluating the
// getter for the property which is being replaced. This causes infinite
// recursion and an "Out of stack space" error.
var definingProperty = false;
return {
configurable: true,
get: function get() {
if (definingProperty || this === target.prototype || this.hasOwnProperty(key)) {
return fn;
}
var boundFn = fn.bind(this);
definingProperty = true;
Object.defineProperty(this, key, {
value: boundFn,
configurable: true,
writable: true
});
definingProperty = false;
return boundFn;
}
};
}
module.exports = exports['default'];
/***/ },
/* 138 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var req=__webpack_require__(132);
req.keys().forEach(function(mod){
req(mod);
});
module.exports=__webpack_require__(167);
if(typeof console!=='undefined'&&console.warn){
console.warn('You are using prebuilt antd-mobile,\nplease use https://github.com/ant-design/babel-plugin-import to reduce app bundle size.');
}
/***/ },
/* 139 */
/***/ function(module, exports, __webpack_require__) {
'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.default=undefined;var _classCallCheck2=__webpack_require__(2);var _classCallCheck3=_interopRequireDefault(_classCallCheck2);var _possibleConstructorReturn2=__webpack_require__(4);var _possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2);var _inherits2=__webpack_require__(3);var _inherits3=_interopRequireDefault(_inherits2);var _react=__webpack_require__(1);var _react2=_interopRequireDefault(_react);
var _rcCollapse=__webpack_require__(384);var _rcCollapse2=_interopRequireDefault(_rcCollapse);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}var
Accordion=function(_React$Component){(0,_inherits3.default)(Accordion,_React$Component);function Accordion(){(0,_classCallCheck3.default)(this,Accordion);return(0,_possibleConstructorReturn3.default)(this,_React$Component.apply(this,arguments));}Accordion.prototype.
render=function render(){
return _react2.default.createElement(_rcCollapse2.default,this.props);
};return Accordion;}(_react2.default.Component);exports.default=Accordion;
Accordion.Panel=_rcCollapse.Panel;
Accordion.defaultProps={
prefixCls:'am-accordion'};module.exports=exports['default'];
/***/ },
/* 140 */
[490, 304],
/* 141 */
/***/ function(module, exports, __webpack_require__) {
'use strict';Object.defineProperty(exports,"__esModule",{value:true});var _defineProperty2=__webpack_require__(6);var _defineProperty3=_interopRequireDefault(_defineProperty2);
var _react=__webpack_require__(1);var _react2=_interopRequireDefault(_react);
var _reactDom=__webpack_require__(10);var _reactDom2=_interopRequireDefault(_reactDom);
var _rcDialog=__webpack_require__(48);var _rcDialog2=_interopRequireDefault(_rcDialog);
var _classnames=__webpack_require__(5);var _classnames2=_interopRequireDefault(_classnames);
var _index=__webpack_require__(15);var _index2=_interopRequireDefault(_index);
var _objectAssign=__webpack_require__(12);var _objectAssign2=_interopRequireDefault(_objectAssign);
var _getDataAttr=__webpack_require__(41);var _getDataAttr2=_interopRequireDefault(_getDataAttr);
var _rcTouchable=__webpack_require__(17);var _rcTouchable2=_interopRequireDefault(_rcTouchable);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}
var NORMAL='NORMAL';
var SHARE='SHARE';
function noop(){}
var queue=[];
function createActionSheet(flag,config,callback){var _classNames;
var props=(0,_objectAssign2.default)({},{
prefixCls:'am-action-sheet',
cancelButtonText:'取消'},
config);var
prefixCls=props.prefixCls,className=props.className,transitionName=props.transitionName,maskTransitionName=props.maskTransitionName,_props$maskClosable=props.maskClosable,maskClosable=_props$maskClosable===undefined?true:_props$maskClosable;
var div=document.createElement('div');
document.body.appendChild(div);
queue.push(close);
function close(){
if(div){
_reactDom2.default.unmountComponentAtNode(div);
div.parentNode.removeChild(div);
div=null;
var index=queue.indexOf(close);
if(index!==-1){
queue.splice(index,1);
}
}
}
function cb(index){var rowIndex=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;
var res=callback(index,rowIndex);
if(res&&res.then){
res.then(function(){
close();
});
}else
{
close();
}
}var
title=props.title,message=props.message,options=props.options,destructiveButtonIndex=props.destructiveButtonIndex,cancelButtonIndex=props.cancelButtonIndex,cancelButtonText=props.cancelButtonText;
var titleMsg=[
title?_react2.default.createElement('h3',{key:'0',className:prefixCls+'-title'},title):null,
message?_react2.default.createElement('div',{key:'1',className:prefixCls+'-message'},message):null];
var children=null;
var mode='normal';
switch(flag){
case NORMAL:
mode='normal';
children=_react2.default.createElement('div',(0,_getDataAttr2.default)(props),
titleMsg,
_react2.default.createElement('div',{className:prefixCls+'-button-list'},
options.map(function(item,index){var _cls;
var cls=(_cls={},(0,_defineProperty3.default)(_cls,
prefixCls+'-button-list-item',true),(0,_defineProperty3.default)(_cls,
prefixCls+'-destructive-button',destructiveButtonIndex===index),(0,_defineProperty3.default)(_cls,
prefixCls+'-cancel-button',cancelButtonIndex===index),_cls);
var itemProps={
className:(0,_classnames2.default)(cls),
onClick:function onClick(){return cb(index);}};
var bItem=_react2.default.createElement(_rcTouchable2.default,{key:index,activeClassName:prefixCls+'-button-list-item-active'},
_react2.default.createElement('div',itemProps,item));
if(cancelButtonIndex===index||destructiveButtonIndex===index){
bItem=_react2.default.createElement(_rcTouchable2.default,{key:index,activeClassName:prefixCls+'-button-list-item-active'},
_react2.default.createElement('div',itemProps,
item,
cancelButtonIndex===index?
_react2.default.createElement('span',{className:prefixCls+'-cancel-button-mask'}):null));
}
return bItem;
})));
break;
case SHARE:
mode='share';
var multipleLine=options.length&&Array.isArray(options[0])||false;
var createList=function createList(item,index){var rowIndex=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;return _react2.default.createElement('div',{className:prefixCls+'-share-list-item',key:index,onClick:function onClick(){return cb(index,rowIndex);}},
_react2.default.createElement('div',{className:prefixCls+'-share-list-item-icon'},
item.iconName?_react2.default.createElement(_index2.default,{type:item.iconName}):item.icon),
_react2.default.createElement('div',{className:prefixCls+'-share-list-item-title'},item.title));};
children=_react2.default.createElement('div',(0,_getDataAttr2.default)(props),
titleMsg,
_react2.default.createElement('div',{className:prefixCls+'-share'},
multipleLine?options.map(function(item,index){return _react2.default.createElement('div',{key:index,className:prefixCls+'-share-list'},
item.map(function(ii,ind){return createList(ii,ind,index);}));}):
_react2.default.createElement('div',{className:prefixCls+'-share-list'},
options.map(function(item,index){return createList(item,index);})),
_react2.default.createElement(_rcTouchable2.default,{activeClassName:prefixCls+'-share-cancel-button-active'},
_react2.default.createElement('div',{className:prefixCls+'-share-cancel-button',onClick:function onClick(){return cb(-1);}},
cancelButtonText))));
break;
default:
break;}
var rootCls=(0,_classnames2.default)((_classNames={},(0,_defineProperty3.default)(_classNames,
className,!!className),(0,_defineProperty3.default)(_classNames,
prefixCls+'-'+mode,true),_classNames));
_reactDom2.default.render(_react2.default.createElement(_rcDialog2.default,{visible:true,title:'',footer:'',prefixCls:prefixCls,className:rootCls,transitionName:transitionName||'am-slide-up',maskTransitionName:maskTransitionName||'am-fade',onClose:function onClose(){return cb(cancelButtonIndex||-1);},maskClosable:maskClosable,wrapProps:props.wrapProps||{}},
children),
div);
return{
close:close};
}exports.default=
{
showActionSheetWithOptions:function showActionSheetWithOptions(config){var callback=arguments.length>1&&arguments[1]!==undefined?arguments[1]:noop;
createActionSheet(NORMAL,config,callback);
},
showShareActionSheetWithOptions:function showShareActionSheetWithOptions(config){var callback=arguments.length>1&&arguments[1]!==undefined?arguments[1]:noop;
createActionSheet(SHARE,config,callback);
},
close:function close(){
queue.forEach(function(q){return q();});
}};module.exports=exports['default'];
/***/ },
/* 142 */
[491, 305],
/* 143 */
/***/ function(module, exports, __webpack_require__) {
'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.default=undefined;var _defineProperty2=__webpack_require__(6);var _defineProperty3=_interopRequireDefault(_defineProperty2);var _classCallCheck2=__webpack_require__(2);var _classCallCheck3=_interopRequireDefault(_classCallCheck2);var _possibleConstructorReturn2=__webpack_require__(4);var _possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2);var _inherits2=__webpack_require__(3);var _inherits3=_interopRequireDefault(_inherits2);var _react=__webpack_require__(1);var _react2=_interopRequireDefault(_react);
var _classnames=__webpack_require__(5);var _classnames2=_interopRequireDefault(_classnames);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}var
ActivityIndicator=function(_React$Component){(0,_inherits3.default)(ActivityIndicator,_React$Component);function ActivityIndicator(){(0,_classCallCheck3.default)(this,ActivityIndicator);return(0,_possibleConstructorReturn3.default)(this,_React$Component.apply(this,arguments));}ActivityIndicator.prototype.
render=function render(){var _classNames,_classNames2;var _props=
this.props,prefixCls=_props.prefixCls,className=_props.className,animating=_props.animating,toast=_props.toast,size=_props.size,color=_props.color,text=_props.text;
var wrapClass=(0,_classnames2.default)((_classNames={},(0,_defineProperty3.default)(_classNames,''+
prefixCls,true),(0,_defineProperty3.default)(_classNames,
prefixCls+'-lg',size==='large'),(0,_defineProperty3.default)(_classNames,
prefixCls+'-sm',size==='small'),(0,_defineProperty3.default)(_classNames,
className,!!className),(0,_defineProperty3.default)(_classNames,
prefixCls+'-toast',!!toast),_classNames));
var spinnerClass=(0,_classnames2.default)((_classNames2={},(0,_defineProperty3.default)(_classNames2,
prefixCls+'-spinner',true),(0,_defineProperty3.default)(_classNames2,
prefixCls+'-spinner-lg',!!toast||size==='large'),(0,_defineProperty3.default)(_classNames2,
prefixCls+'-spinner-white',!!toast||color==='white'),_classNames2));
if(animating){
if(toast){
return _react2.default.createElement('div',{className:wrapClass},
_react2.default.createElement('div',{className:prefixCls+'-content'},
_react2.default.createElement('span',{className:spinnerClass}),
text&&_react2.default.createElement('span',{className:prefixCls+'-toast'},text)));
}else
{
return _react2.default.createElement('div',{className:wrapClass},
_react2.default.createElement('span',{className:spinnerClass}),
text&&_react2.default.createElement('span',{className:prefixCls+'-tip'},text));
}
}else
{
return null;
}
};return ActivityIndicator;}(_react2.default.Component);exports.default=ActivityIndicator;
ActivityIndicator.defaultProps={
prefixCls:'am-activity-indicator',
animating:true,
size:'small',
color:'gray',
panelColor:'rgba(34,34,34,0.6)',
toast:false};module.exports=exports['default'];
/***/ },
/* 144 */
[490, 306],
/* 145 */
/***/ function(module, exports, __webpack_require__) {
'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.default=undefined;var _extends2=__webpack_require__(7);var _extends3=_interopRequireDefault(_extends2);var _defineProperty2=__webpack_require__(6);var _defineProperty3=_interopRequireDefault(_defineProperty2);var _classCallCheck2=__webpack_require__(2);var _classCallCheck3=_interopRequireDefault(_classCallCheck2);var _possibleConstructorReturn2=__webpack_require__(4);var _possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2);var _inherits2=__webpack_require__(3);var _inherits3=_interopRequireDefault(_inherits2);
var _react=__webpack_require__(1);var _react2=_interopRequireDefault(_react);
var _classnames=__webpack_require__(5);var _classnames2=_interopRequireDefault(_classnames);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}var __rest=undefined&&undefined.__rest||function(s,e){var t={};for(var p in s){if(Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0)t[p]=s[p];}if(s!=null&&typeof Object.getOwnPropertySymbols==="function")for(var i=0,p=Object.getOwnPropertySymbols(s);i1;
var renderEl=void 0;
if(isCarouselMode){
if(initialSlideWidth>0){
renderEl=_react2.default.createElement(_index2.default,(0,_extends3.default)({initialSlideWidth:initialSlideWidth},restPropsForCarousel),
this.renderCarousel(rowsArr,pageCount,rowCount));
}else
{
renderEl=null;
}
}else
{
renderEl=rowsArr;
}
return _react2.default.createElement('div',{className:(0,_classnames2.default)((_classNames={},(0,_defineProperty3.default)(_classNames,
prefixCls,true),(0,_defineProperty3.default)(_classNames,
prefixCls+'-line',hasLine),(0,_defineProperty3.default)(_classNames,
className,className),_classNames))},
renderEl);
};return Grid;}(_react2.default.Component);exports.default=Grid;
Grid.defaultProps={
data:[],
hasLine:true,
isCarousel:false,
columnNum:4,
carouselMaxRow:2,
prefixCls:'am-grid'};module.exports=exports['default'];
/***/ },
/* 164 */
/***/ function(module, exports, __webpack_require__) {
'use strict';__webpack_require__(8);
__webpack_require__(32);
__webpack_require__(83);
__webpack_require__(315);
/***/ },
/* 165 */
/***/ function(module, exports, __webpack_require__) {
'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.default=undefined;var _defineProperty2=__webpack_require__(6);var _defineProperty3=_interopRequireDefault(_defineProperty2);var _classCallCheck2=__webpack_require__(2);var _classCallCheck3=_interopRequireDefault(_classCallCheck2);var _possibleConstructorReturn2=__webpack_require__(4);var _possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2);var _inherits2=__webpack_require__(3);var _inherits3=_interopRequireDefault(_inherits2);
var _react=__webpack_require__(1);var _react2=_interopRequireDefault(_react);
var _classnames=__webpack_require__(5);var _classnames2=_interopRequireDefault(_classnames);
var _wingBlank=__webpack_require__(92);var _wingBlank2=_interopRequireDefault(_wingBlank);
var _flex=__webpack_require__(31);var _flex2=_interopRequireDefault(_flex);
var _toast=__webpack_require__(89);var _toast2=_interopRequireDefault(_toast);
var _rcTouchable=__webpack_require__(17);var _rcTouchable2=_interopRequireDefault(_rcTouchable);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}
var Item=_flex2.default.Item;
function noop(){}var
ImagePicker=function(_React$Component){(0,_inherits3.default)(ImagePicker,_React$Component);
function ImagePicker(){(0,_classCallCheck3.default)(this,ImagePicker);var _this=(0,_possibleConstructorReturn3.default)(this,
_React$Component.apply(this,arguments));
_this.getOrientation=function(file,callback){
var reader=new FileReader();
reader.onload=function(e){
var view=new DataView(e.target.result);
if(view.getUint16(0,false)!==0xFFD8){
return callback(-2);
}
var length=view.byteLength;
var offset=2;
while(offset0&&arguments[0]!==undefined?arguments[0]:1;
var imgRotation=0;
switch(orientation){
case 3:
imgRotation=180;
break;
case 6:
imgRotation=90;
break;
case 8:
imgRotation=270;
break;
default:}
return imgRotation;
};
_this.removeImage=function(index){
var newImages=[];var _this$props$files=
_this.props.files,files=_this$props$files===undefined?[]:_this$props$files;
files.forEach(function(image,idx){
if(index!==idx){
newImages.push(image);
}
});
if(_this.props.onChange){
_this.props.onChange(newImages,'remove',index);
}
};
_this.addImage=function(imgItem){var _this$props$files2=
_this.props.files,files=_this$props$files2===undefined?[]:_this$props$files2;
var newImages=files.concat(imgItem);
if(_this.props.onChange){
_this.props.onChange(newImages,'add');
}
};
_this.onImageClick=function(index){
if(_this.props.onImageClick){
_this.props.onImageClick(index,_this.props.files);
}
};
_this.onFileChange=function(){
var fileSelectorEl=_this.refs.fileSelectorInput;
if(fileSelectorEl.files&&fileSelectorEl.files.length){
var file=fileSelectorEl.files[0];
var reader=new FileReader();
reader.onload=function(e){
var dataURL=e.target.result;
if(!dataURL){
_toast2.default.fail('图片获取失败');
return;
}
var orientation=1;
_this.getOrientation(file,function(res){
if(res>0){
orientation=res;
}
_this.addImage({
url:dataURL,
orientation:orientation,
file:file});
fileSelectorEl.value='';
});
};
reader.readAsDataURL(file);
}
};return _this;
}ImagePicker.prototype.
render=function render(){var _classNames,_this2=this;var _props=
this.props,prefixCls=_props.prefixCls,style=_props.style,className=_props.className,_props$files=_props.files,files=_props$files===undefined?[]:_props$files,selectable=_props.selectable,onAddImageClick=_props.onAddImageClick;
var imgItemList=[];
var wrapCls=(0,_classnames2.default)((_classNames={},(0,_defineProperty3.default)(_classNames,''+
prefixCls,true),(0,_defineProperty3.default)(_classNames,
className,className),_classNames));
files.forEach(function(image,index){
var imgStyle={
backgroundImage:'url('+image.url+')',
transform:'rotate('+_this2.getRotation(image.orientation)+'deg)'};
imgItemList.push(_react2.default.createElement(Item,{key:'item-'+index},
_react2.default.createElement('div',{key:index,className:prefixCls+'-item'},
_react2.default.createElement('div',{className:prefixCls+'-item-remove',onClick:function onClick(){_this2.removeImage(index);}}),
_react2.default.createElement('div',{className:prefixCls+'-item-content',onClick:function onClick(){_this2.onImageClick(index);},style:imgStyle}))));
});
var selectEl=_react2.default.createElement(_rcTouchable2.default,{activeClassName:prefixCls+'-upload-btn-active',key:'select'},
_react2.default.createElement(Item,null,
_react2.default.createElement('div',{className:prefixCls+'-item '+prefixCls+'-upload-btn',onClick:onAddImageClick},
_react2.default.createElement('input',{ref:'fileSelectorInput',type:'file',accept:'image/jpg,image/jpeg,image/png,image/gif',onChange:function onChange(){_this2.onFileChange();}}))));
var allEl=selectable?imgItemList.concat([selectEl]):imgItemList;
var length=allEl.length;
if(length!==0&&length%4!==0){
var blankCount=4-length%4;
var fillBlankEl=[];
for(var i=0;i3&&valueLen<8){
value=value.substr(0,3)+' '+value.substr(3);
}else
if(valueLen>=8){
value=value.substr(0,3)+' '+value.substr(3,4)+' '+value.substr(7);
}
break;
case'number':
value=value.replace(/\D/g,'');
break;
case'password':
break;
default:
break;}
if(onChange){
onChange(value);
}
};
_this.onInputBlur=function(e){
_this.debounceTimeout=setTimeout(function(){
_this.setState({
focus:false});
},200);
if(!('focused'in _this.props)){
_this.setState({
focused:false});
}
var value=e.target.value;
if(_this.props.onBlur){
_this.props.onBlur(value);
}
};
_this.onInputFocus=function(e){
if(_this.debounceTimeout){
clearTimeout(_this.debounceTimeout);
_this.debounceTimeout=null;
}
if(!('focused'in _this.props)){
_this.setState({
focused:true});
}
_this.setState({
focus:true});
var value=e.target.value;
if(_this.props.onFocus){
_this.props.onFocus(value);
}
if(document.activeElement.tagName.toLowerCase()==='input'){
_this.scrollIntoViewTimeout=setTimeout(function(){
try{
document.activeElement.scrollIntoViewIfNeeded();
}
catch(e){}
},100);
}
};
_this.onExtraClick=function(e){
if(_this.props.onExtraClick){
_this.props.onExtraClick(e);
}
};
_this.onErrorClick=function(e){
if(_this.props.onErrorClick){
_this.props.onErrorClick(e);
}
};
_this.clearInput=function(){
if(_this.props.type!=='password'&&_this.props.updatePlaceholder){
_this.setState({
placeholder:_this.props.value});
}
if(_this.props.onChange){
_this.props.onChange('');
}
};
_this.state={
focused:props.focused||false,
placeholder:props.placeholder};return _this;
}InputItem.prototype.
componentWillReceiveProps=function componentWillReceiveProps(nextProps){
if('placeholder'in nextProps&&!nextProps.updatePlaceholder){
this.setState({
placeholder:nextProps.placeholder});
}
if('focused'in nextProps){
this.setState({
focused:nextProps.focused});
}
};InputItem.prototype.
componentWillUnmount=function componentWillUnmount(){
if(this.debounceTimeout){
clearTimeout(this.debounceTimeout);
this.debounceTimeout=null;
}
if(this.scrollIntoViewTimeout){
clearTimeout(this.scrollIntoViewTimeout);
this.scrollIntoViewTimeout=null;
}
};InputItem.prototype.
componentDidMount=function componentDidMount(){
if((this.props.autoFocus||this.state.focused)&&navigator.userAgent.indexOf('AlipayClient')>0){
this.refs.input.focus();
}
};InputItem.prototype.
componentDidUpdate=function componentDidUpdate(){
if(this.state.focused){
this.refs.input.focus();
}
};InputItem.prototype.
render=function render(){var _classNames,_classNames2;var _props=
this.props,prefixCls=_props.prefixCls,prefixListCls=_props.prefixListCls,type=_props.type,value=_props.value,defaultValue=_props.defaultValue,name=_props.name,editable=_props.editable,disabled=_props.disabled,style=_props.style,clear=_props.clear,children=_props.children,error=_props.error,className=_props.className,extra=_props.extra,labelNumber=_props.labelNumber,maxLength=_props.maxLength;
var otherProps=(0,_omit2.default)(this.props,['prefixCls','prefixListCls','editable','style','focused',
'clear','children','error','className','extra','labelNumber','onExtraClick','onErrorClick',
'updatePlaceholder','placeholderTextColor','autoFocus','type']);var _state=
this.state,placeholder=_state.placeholder,focus=_state.focus;
var wrapCls=(0,_classnames2.default)((_classNames={},(0,_defineProperty3.default)(_classNames,
prefixListCls+'-item',true),(0,_defineProperty3.default)(_classNames,
prefixCls+'-item',true),(0,_defineProperty3.default)(_classNames,
prefixCls+'-disabled',disabled),(0,_defineProperty3.default)(_classNames,
prefixCls+'-error',error),(0,_defineProperty3.default)(_classNames,
prefixCls+'-focus',focus),(0,_defineProperty3.default)(_classNames,
prefixCls+'-android',focus),(0,_defineProperty3.default)(_classNames,
className,className),_classNames));
var labelCls=(0,_classnames2.default)((_classNames2={},(0,_defineProperty3.default)(_classNames2,
prefixCls+'-label',true),(0,_defineProperty3.default)(_classNames2,
prefixCls+'-label-2',labelNumber===2),(0,_defineProperty3.default)(_classNames2,
prefixCls+'-label-3',labelNumber===3),(0,_defineProperty3.default)(_classNames2,
prefixCls+'-label-4',labelNumber===4),(0,_defineProperty3.default)(_classNames2,
prefixCls+'-label-5',labelNumber===5),(0,_defineProperty3.default)(_classNames2,
prefixCls+'-label-6',labelNumber===6),(0,_defineProperty3.default)(_classNames2,
prefixCls+'-label-7',labelNumber===7),_classNames2));
var controlCls=(0,_classnames2.default)((0,_defineProperty3.default)({},
prefixCls+'-control',true));
var inputType='text';
if(type==='bankCard'||type==='phone'){
inputType='tel';
}else
if(type==='password'){
inputType='password';
}else
if(type!=='text'&&type!=='number'){
inputType=type;
}
var valueProps=void 0;
if('value'in this.props){
valueProps={
value:fixControlledValue(value)};
}else
{
valueProps={
defaultValue:defaultValue};
}
var patternProps=void 0;
if(type==='number'){
patternProps={
pattern:'[0-9]*'};
}
return _react2.default.createElement('div',{className:wrapCls,style:style},
children?_react2.default.createElement('div',{className:labelCls},children):null,
_react2.default.createElement('div',{className:controlCls},
_react2.default.createElement('input',(0,_extends3.default)({ref:'input'},patternProps,otherProps,valueProps,{type:inputType,maxLength:maxLength,name:name,placeholder:placeholder,onChange:this.onInputChange,onBlur:this.onInputBlur,onFocus:this.onInputFocus,readOnly:!editable,disabled:disabled}))),
clear&&editable&&!disabled&&value&&value.length>0?
_react2.default.createElement('div',{className:prefixCls+'-clear',onClick:this.clearInput}):
null,
error?_react2.default.createElement('div',{className:prefixCls+'-error-extra',onClick:this.onErrorClick}):null,
extra!==''?_react2.default.createElement('div',{className:prefixCls+'-extra',onClick:this.onExtraClick},extra):null);
};return InputItem;}(_react2.default.Component);
InputItem.defaultProps={
prefixCls:'am-input',
prefixListCls:'am-list',
type:'text',
editable:true,
disabled:false,
placeholder:'',
clear:false,
onChange:noop,
onBlur:noop,
onFocus:noop,
extra:'',
onExtraClick:noop,
error:false,
onErrorClick:noop,
labelNumber:5,
updatePlaceholder:false};exports.default=
InputItem;module.exports=exports['default'];
/***/ },
/* 169 */
[492, 318],
/* 170 */
/***/ function(module, exports, __webpack_require__) {
'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.default=undefined;var _extends2=__webpack_require__(7);var _extends3=_interopRequireDefault(_extends2);var _classCallCheck2=__webpack_require__(2);var _classCallCheck3=_interopRequireDefault(_classCallCheck2);var _possibleConstructorReturn2=__webpack_require__(4);var _possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2);var _inherits2=__webpack_require__(3);var _inherits3=_interopRequireDefault(_inherits2);var _react=__webpack_require__(1);var _react2=_interopRequireDefault(_react);
var _rmcListView=__webpack_require__(77);var _rmcListView2=_interopRequireDefault(_rmcListView);
var _handleProps2=__webpack_require__(85);var _handleProps3=_interopRequireDefault(_handleProps2);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}
var IndexedList=_rmcListView2.default.IndexedList;var
MIndexedList=function(_React$Component){(0,_inherits3.default)(MIndexedList,_React$Component);function MIndexedList(){(0,_classCallCheck3.default)(this,MIndexedList);return(0,_possibleConstructorReturn3.default)(this,_React$Component.apply(this,arguments));}MIndexedList.prototype.
render=function render(){var _props=
this.props,prefixCls=_props.prefixCls,listPrefixCls=_props.listPrefixCls;var _handleProps=
(0,_handleProps3.default)(this.props,true),restProps=_handleProps.restProps,extraProps=_handleProps.extraProps;
return _react2.default.createElement(IndexedList,(0,_extends3.default)({ref:'indexedList',sectionHeaderClassName:prefixCls+'-section-header '+listPrefixCls+'-body',sectionBodyClassName:prefixCls+'-section-body '+listPrefixCls+'-body'},restProps,extraProps),
this.props.children);
};return MIndexedList;}(_react2.default.Component);exports.default=MIndexedList;
MIndexedList.defaultProps={
prefixCls:'am-indexed-list',
listPrefixCls:'am-list',
listViewPrefixCls:'am-list-view'};module.exports=exports['default'];
/***/ },
/* 171 */
/***/ function(module, exports, __webpack_require__) {
'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.default=undefined;var _extends2=__webpack_require__(7);var _extends3=_interopRequireDefault(_extends2);var _classCallCheck2=__webpack_require__(2);var _classCallCheck3=_interopRequireDefault(_classCallCheck2);var _possibleConstructorReturn2=__webpack_require__(4);var _possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2);var _inherits2=__webpack_require__(3);var _inherits3=_interopRequireDefault(_inherits2);var _react=__webpack_require__(1);var _react2=_interopRequireDefault(_react);
var _rmcListView=__webpack_require__(77);var _rmcListView2=_interopRequireDefault(_rmcListView);
var _handleProps2=__webpack_require__(85);var _handleProps3=_interopRequireDefault(_handleProps2);
var _Indexed=__webpack_require__(170);var _Indexed2=_interopRequireDefault(_Indexed);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}var
ListView=function(_React$Component){(0,_inherits3.default)(ListView,_React$Component);function ListView(){(0,_classCallCheck3.default)(this,ListView);return(0,_possibleConstructorReturn3.default)(this,_React$Component.apply(this,arguments));}ListView.prototype.
render=function render(){var _handleProps=
(0,_handleProps3.default)(this.props,false),restProps=_handleProps.restProps,extraProps=_handleProps.extraProps;var _props=
this.props,useZscroller=_props.useZscroller,refreshControl=_props.refreshControl;
if(refreshControl){
useZscroller=true;
}
return _react2.default.createElement(_rmcListView2.default,(0,_extends3.default)({ref:'listview'},restProps,extraProps,{useZscroller:useZscroller}));
};return ListView;}(_react2.default.Component);exports.default=ListView;
ListView.defaultProps={
prefixCls:'am-list-view',
listPrefixCls:'am-list'};
ListView.DataSource=_rmcListView2.default.DataSource;
ListView.IndexedList=_Indexed2.default;module.exports=exports['default'];
/***/ },
/* 172 */
[492, 319],
/* 173 */
/***/ function(module, exports, __webpack_require__) {
'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.Brief=undefined;var _extends2=__webpack_require__(7);var _extends3=_interopRequireDefault(_extends2);var _defineProperty2=__webpack_require__(6);var _defineProperty3=_interopRequireDefault(_defineProperty2);var _classCallCheck2=__webpack_require__(2);var _classCallCheck3=_interopRequireDefault(_classCallCheck2);var _possibleConstructorReturn2=__webpack_require__(4);var _possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2);var _inherits2=__webpack_require__(3);var _inherits3=_interopRequireDefault(_inherits2);
var _react=__webpack_require__(1);var _react2=_interopRequireDefault(_react);
var _classnames=__webpack_require__(5);var _classnames2=_interopRequireDefault(_classnames);
var _rcTouchable=__webpack_require__(17);var _rcTouchable2=_interopRequireDefault(_rcTouchable);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}var __rest=undefined&&undefined.__rest||function(s,e){var t={};for(var p in s){if(Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0)t[p]=s[p];}if(s!=null&&typeof Object.getOwnPropertySymbols==="function")for(var i=0,p=Object.getOwnPropertySymbols(s);i0&&selItem[0].value===dataItem.value;};
return _react2.default.createElement(_index2.default,{style:{paddingTop:0},className:subMenuPrefixCls},
subMenuData.map(function(dataItem,idx){var _classNames;return _react2.default.createElement(_index2.default.Item,{className:(0,_classnames2.default)((_classNames={},(0,_defineProperty3.default)(_classNames,
radioPrefixCls+'-item',true),(0,_defineProperty3.default)(_classNames,
subMenuPrefixCls+'-item-selected',selected(dataItem)),(0,_defineProperty3.default)(_classNames,
subMenuPrefixCls+'-item-disabled',dataItem.disabled),_classNames)),
key:idx,extra:_react2.default.createElement(_Radio2.default,{checked:selected(dataItem),disabled:dataItem.disabled,onChange:function onChange(){return _this2.onClick(dataItem);}})},
dataItem.label);}));
};return SubMenu;}(_react2.default.Component);exports.default=SubMenu;module.exports=exports['default'];
/***/ },
/* 177 */
/***/ function(module, exports, __webpack_require__) {
'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.default=undefined;var _defineProperty2=__webpack_require__(6);var _defineProperty3=_interopRequireDefault(_defineProperty2);var _classCallCheck2=__webpack_require__(2);var _classCallCheck3=_interopRequireDefault(_classCallCheck2);var _possibleConstructorReturn2=__webpack_require__(4);var _possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2);var _inherits2=__webpack_require__(3);var _inherits3=_interopRequireDefault(_inherits2);
var _react=__webpack_require__(1);var _react2=_interopRequireDefault(_react);
var _classnames=__webpack_require__(5);var _classnames2=_interopRequireDefault(_classnames);
var _objectAssign=__webpack_require__(12);var _objectAssign2=_interopRequireDefault(_objectAssign);
var _list=__webpack_require__(28);var _list2=_interopRequireDefault(_list);
var _flex=__webpack_require__(31);var _flex2=_interopRequireDefault(_flex);
var _SubMenu=__webpack_require__(176);var _SubMenu2=_interopRequireDefault(_SubMenu);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}var
Menu=function(_React$Component){(0,_inherits3.default)(Menu,_React$Component);
function Menu(props){(0,_classCallCheck3.default)(this,Menu);var _this=(0,_possibleConstructorReturn3.default)(this,
_React$Component.call(this,props));
_this.onClickFirstLevelItem=function(dataItem){
_this.setState({
firstLevelSelectValue:dataItem.value});
if(dataItem.isLeaf&&_this.props.onChange){
_this.props.onChange([dataItem.value]);
}
};
_this.onClickSubMenuItem=function(dataItem){var _this$props=
_this.props,level=_this$props.level,onChange=_this$props.onChange;
setTimeout(function(){
if(onChange){
onChange(level===2?[_this.state.firstLevelSelectValue,dataItem.value]:[dataItem.value]);
}
},300);
};
_this.state={
firstLevelSelectValue:_this.getNewFsv(props)};return _this;
}Menu.prototype.
componentWillReceiveProps=function componentWillReceiveProps(nextProps){
if(nextProps.value!==this.props.value){
this.setState({
firstLevelSelectValue:this.getNewFsv(nextProps)});
}
};Menu.prototype.
getNewFsv=function getNewFsv(props){var
value=props.value,data=props.data;
return value&&value.length?value[0]:!data[0].isLeaf?data[0].value:'';
};Menu.prototype.
render=function render(){var _classNames,_this2=this;var _props=
this.props,className=_props.className,style=_props.style,height=_props.height,_props$data=_props.data,data=_props$data===undefined?[]:_props$data,prefixCls=_props.prefixCls,value=_props.value,level=_props.level;var
firstLevelSelectValue=this.state.firstLevelSelectValue;
var subMenuData=data[0].children||[];
if(level!==2){
subMenuData=data;
}else
if(firstLevelSelectValue){
subMenuData=data.filter(function(dataItem){return dataItem.value===firstLevelSelectValue;})[0].children||[];
}
var subValue=value&&value.length&&value[value.length-1];
var subSelInitItem=subMenuData.filter(function(dataItem){return dataItem.value===subValue;});
var heightStyle={
height:Math.round(height||document.documentElement.clientHeight/2)+'px',
overflowY:'scroll'};
return _react2.default.createElement('div',{className:(0,_classnames2.default)((_classNames={},(0,_defineProperty3.default)(_classNames,
prefixCls,true),(0,_defineProperty3.default)(_classNames,
className,!!className),_classNames)),
style:(0,_objectAssign2.default)({},style,heightStyle)},
_react2.default.createElement(_flex2.default,{align:'top'},
level===2?_react2.default.createElement(_flex2.default.Item,{style:heightStyle},
_react2.default.createElement(_list2.default,null,
data.map(function(dataItem,index){return _react2.default.createElement(_list2.default.Item,{className:dataItem.value===firstLevelSelectValue?prefixCls+'-selected':'',onClick:function onClick(){return _this2.onClickFirstLevelItem(dataItem);},key:'listitem-1-'+index},
dataItem.label);}))):
null,
_react2.default.createElement(_flex2.default.Item,{style:heightStyle},
_react2.default.createElement(_SubMenu2.default,{subMenuPrefixCls:this.props.subMenuPrefixCls,radioPrefixCls:this.props.radioPrefixCls,subMenuData:subMenuData,selItem:subSelInitItem,onSel:this.onClickSubMenuItem}))));
};return Menu;}(_react2.default.Component);exports.default=Menu;
Menu.defaultProps={
prefixCls:'am-menu',
subMenuPrefixCls:'am-sub-menu',
radioPrefixCls:'am-radio',
data:[],
level:2,
onChange:function onChange(){}};module.exports=exports['default'];
/***/ },
/* 178 */
/***/ function(module, exports, __webpack_require__) {
'use strict';__webpack_require__(8);
__webpack_require__(84);
__webpack_require__(32);
__webpack_require__(21);
__webpack_require__(88);
__webpack_require__(322);
/***/ },
/* 179 */
/***/ function(module, exports, __webpack_require__) {
'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.default=
function(){
var title=arguments.length<=0?undefined:arguments[0];
var content=arguments.length<=1?undefined:arguments[1];
var actions=(arguments.length<=2?undefined:arguments[2])||[{text:'确定'}];
if(!title&&!content){
return{
close:function close(){}};
}
var prefixCls='am-modal';
var div=document.createElement('div');
document.body.appendChild(div);
function close(){
_reactDom2.default.unmountComponentAtNode(div);
div.parentNode.removeChild(div);
}
var footer=actions.map(function(button){
var orginPress=button.onPress||function(){};
button.onPress=function(){
var res=orginPress();
if(res&&res.then){
res.then(function(){
close();
});
}else
{
close();
}
};
return button;
});
_reactDom2.default.render(_react2.default.createElement(_Modal2.default,{visible:true,transparent:true,prefixCls:prefixCls,title:title,transitionName:'am-zoom',closable:false,maskClosable:false,footer:footer,maskTransitionName:'am-fade'},
_react2.default.createElement('div',{style:{zoom:1,overflow:'hidden'}},content)),
div);
return{
close:close};
};var _react=__webpack_require__(1);var _react2=_interopRequireDefault(_react);var _reactDom=__webpack_require__(10);var _reactDom2=_interopRequireDefault(_reactDom);var _Modal=__webpack_require__(42);var _Modal2=_interopRequireDefault(_Modal);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}module.exports=exports['default'];
/***/ },
/* 180 */
/***/ function(module, exports, __webpack_require__) {
'use strict';Object.defineProperty(exports,"__esModule",{value:true});var _Modal=__webpack_require__(42);var _Modal2=_interopRequireDefault(_Modal);
var _alert=__webpack_require__(179);var _alert2=_interopRequireDefault(_alert);
var _prompt=__webpack_require__(182);var _prompt2=_interopRequireDefault(_prompt);
var _operation=__webpack_require__(181);var _operation2=_interopRequireDefault(_operation);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}
_Modal2.default.alert=_alert2.default;
_Modal2.default.prompt=_prompt2.default;
_Modal2.default.operation=_operation2.default;exports.default=_Modal2.default;module.exports=exports['default'];
/***/ },
/* 181 */
/***/ function(module, exports, __webpack_require__) {
'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.default=
function(){
var actions=(arguments.length<=0?undefined:arguments[0])||[{text:'确定'}];
var prefixCls='am-modal';
var div=document.createElement('div');
document.body.appendChild(div);
function close(){
_reactDom2.default.unmountComponentAtNode(div);
div.parentNode.removeChild(div);
}
var footer=actions.map(function(button){
var orginPress=button.onPress||function(){};
button.onPress=function(){
var res=orginPress();
if(res&&res.then){
res.then(function(){
close();
});
}else
{
close();
}
};
return button;
});
_reactDom2.default.render(_react2.default.createElement(_Modal2.default,{visible:true,operation:true,transparent:true,prefixCls:prefixCls,transitionName:'am-zoom',closable:false,maskClosable:true,onClose:close,footer:footer,maskTransitionName:'am-fade',className:'am-modal-operation'}),div);
return{
close:close};
};var _react=__webpack_require__(1);var _react2=_interopRequireDefault(_react);var _reactDom=__webpack_require__(10);var _reactDom2=_interopRequireDefault(_reactDom);var _Modal=__webpack_require__(42);var _Modal2=_interopRequireDefault(_Modal);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}module.exports=exports['default'];
/***/ },
/* 182 */
/***/ function(module, exports, __webpack_require__) {
'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.default=
function(){for(var _len=arguments.length,args=Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}
if(!args||!args[2]){
return;
}
var prefixCls='am-modal';
var title=args[0];
var type=args[3]||'default';
var defaultValue=args[4]||'';
var data={};
function onChange(e){
var target=e.target;
var inputType=target.getAttribute('type');
data[inputType]=target.value;
}
var inputDom=void 0;
var focusFn=function focusFn(input){
setTimeout(function(){
if(input){
input.focus();
}
},500);
};
switch(type){
case'login-password':
inputDom=_react2.default.createElement('div',null,
_react2.default.createElement('div',{className:prefixCls+'-input'},
_react2.default.createElement('input',{type:'text',defaultValue:defaultValue,ref:function ref(input){return focusFn(input);},onChange:onChange})),
_react2.default.createElement('div',{className:prefixCls+'-input'},
_react2.default.createElement('input',{type:'password',defaultValue:'',onChange:onChange})));
break;
case'secure-text':
inputDom=_react2.default.createElement('div',null,
_react2.default.createElement('div',{className:prefixCls+'-input'},
_react2.default.createElement('input',{type:'password',defaultValue:'',ref:function ref(input){return focusFn(input);},onChange:onChange})));
break;
case'plain-text':
case'default':
default:
inputDom=_react2.default.createElement('div',null,
_react2.default.createElement('div',{className:prefixCls+'-input'},
_react2.default.createElement('input',{type:'text',defaultValue:defaultValue,ref:function ref(input){return focusFn(input);},onChange:onChange})));
break;}
var content=_react2.default.createElement('div',null,
args[1],
inputDom);
var div=document.createElement('div');
document.body.appendChild(div);
function close(){
_reactDom2.default.unmountComponentAtNode(div);
div.parentNode.removeChild(div);
}
function getArgs(func){
var text=data.text||'';
var password=data.password||'';
if(type==='login-password'){
return func(text,password);
}else
if(type==='secure-text'){
return func(password);
}
return func(text);
}
var actions=void 0;
if(typeof args[2]==='function'){
actions=[
{text:'取消'},
{text:'确定',onPress:function onPress(){getArgs(args[2]);}}];
}else
{
actions=args[2].map(function(item){
return{
text:item.text,
onPress:function onPress(){
if(item.onPress){
return getArgs(item.onPress);
}
}};
});
}
var footer=actions.map(function(button){
var orginPress=button.onPress||function(){};
button.onPress=function(){
var res=orginPress();
if(res&&res.then){
res.then(function(){
close();
});
}else
{
close();
}
};
return button;
});
_reactDom2.default.render(_react2.default.createElement(_Modal2.default,{visible:true,transparent:true,prefixCls:prefixCls,title:title,closable:false,maskClosable:false,transitionName:'am-zoom',footer:footer,maskTransitionName:'am-fade'},
_react2.default.createElement('div',{style:{zoom:1,overflow:'hidden'}},content)),
div);
return{
close:close};
};var _react=__webpack_require__(1);var _react2=_interopRequireDefault(_react);var _reactDom=__webpack_require__(10);var _reactDom2=_interopRequireDefault(_reactDom);var _Modal=__webpack_require__(42);var _Modal2=_interopRequireDefault(_Modal);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}module.exports=exports['default'];
/***/ },
/* 183 */
[490, 323],
/* 184 */
/***/ function(module, exports, __webpack_require__) {
'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.default=undefined;var _extends2=__webpack_require__(7);var _extends3=_interopRequireDefault(_extends2);var _defineProperty2=__webpack_require__(6);var _defineProperty3=_interopRequireDefault(_defineProperty2);var _classCallCheck2=__webpack_require__(2);var _classCallCheck3=_interopRequireDefault(_classCallCheck2);var _possibleConstructorReturn2=__webpack_require__(4);var _possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2);var _inherits2=__webpack_require__(3);var _inherits3=_interopRequireDefault(_inherits2);
var _react=__webpack_require__(1);var _react2=_interopRequireDefault(_react);
var _classnames=__webpack_require__(5);var _classnames2=_interopRequireDefault(_classnames);
var _icon=__webpack_require__(15);var _icon2=_interopRequireDefault(_icon);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}var __rest=undefined&&undefined.__rest||function(s,e){var t={};for(var p in s){if(Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0)t[p]=s[p];}if(s!=null&&typeof Object.getOwnPropertySymbols==="function")for(var i=0,p=Object.getOwnPropertySymbols(s);ioverflowWidth;
if(isRoundOver){
if(_this.props.loop){
animatedWidth=0;
}else
{
return;
}
}
if(isRoundOver&&_this.props.trailing){
_this._marqueeTimer=setTimeout(function(){
_this.setState({
animatedWidth:animatedWidth});
_this._marqueeTimer=setTimeout(animate,TIMEOUT);
},_this.props.trailing);
}else
{
_this.setState({
animatedWidth:animatedWidth});
_this._marqueeTimer=setTimeout(animate,TIMEOUT);
}
};
if(this.state.overflowWidth!==0){
this._marqueeTimer=setTimeout(animate,timeout);
}
},
_measureText:function _measureText(){
var container=_reactDom2.default.findDOMNode(this);
var node=_reactDom2.default.findDOMNode(this.refs.text);
if(container&&node){
var containerWidth=container.offsetWidth;
var textWidth=node.offsetWidth;
var overflowWidth=textWidth-containerWidth;
if(overflowWidth!==this.state.overflowWidth){
this.setState({
overflowWidth:overflowWidth});
}
}
}});exports.default=
Marquee;module.exports=exports['default'];
/***/ },
/* 187 */
/***/ function(module, exports, __webpack_require__) {
'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.default=undefined;var _extends2=__webpack_require__(7);var _extends3=_interopRequireDefault(_extends2);var _defineProperty2=__webpack_require__(6);var _defineProperty3=_interopRequireDefault(_defineProperty2);var _classCallCheck2=__webpack_require__(2);var _classCallCheck3=_interopRequireDefault(_classCallCheck2);var _possibleConstructorReturn2=__webpack_require__(4);var _possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2);var _inherits2=__webpack_require__(3);var _inherits3=_interopRequireDefault(_inherits2);
var _react=__webpack_require__(1);var _react2=_interopRequireDefault(_react);
var _objectAssign=__webpack_require__(12);var _objectAssign2=_interopRequireDefault(_objectAssign);
var _classnames=__webpack_require__(5);var _classnames2=_interopRequireDefault(_classnames);
var _icon=__webpack_require__(15);var _icon2=_interopRequireDefault(_icon);
var _Marquee=__webpack_require__(186);var _Marquee2=_interopRequireDefault(_Marquee);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}var __rest=undefined&&undefined.__rest||function(s,e){var t={};for(var p in s){if(Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0)t[p]=s[p];}if(s!=null&&typeof Object.getOwnPropertySymbols==="function")for(var i=0,p=Object.getOwnPropertySymbols(s);i=total-1,onClick:function onClick(){return _this2.onChange(_this2.state.current+1);}},
nextText)));
if(mode==='number'){
markup=_react2.default.createElement('div',{className:prefixCls+'-wrap'},
_react2.default.createElement('span',{className:'active'},current+1),'/',_react2.default.createElement('span',null,total));
}else
if(mode==='pointer'){
var arr=[];
for(var i=0;i1&&arguments[1]!==undefined?arguments[1]:function(ch,_i){return ch;};
return _react2.default.Children.map(children,function(child,index){
var newChild=cb(child,index);
if(newChild&&newChild.props&&newChild.props.children){
return _react2.default.cloneElement(newChild,{},recursiveCloneChildren(newChild.props.children,cb));
}
return newChild;
});
}var
Popover=function(_React$Component){(0,_inherits3.default)(Popover,_React$Component);function Popover(){(0,_classCallCheck3.default)(this,Popover);return(0,_possibleConstructorReturn3.default)(this,_React$Component.apply(this,arguments));}Popover.prototype.
render=function render(){var _props=
this.props,overlay=_props.overlay,_props$onSelect=_props.onSelect,onSelect=_props$onSelect===undefined?function(){}:_props$onSelect;
var overlayNode=recursiveCloneChildren(overlay,function(child,index){
var extraProps={firstItem:false};
if(child&&child.type&&child.type.myName==='PopoverItem'&&!child.props.disabled){
extraProps.onClick=function(){return onSelect(child,index);};
extraProps.firstItem=index===0;
return _react2.default.cloneElement(child,extraProps);
}
return child;
});
return _react2.default.createElement(_rcTooltip2.default,(0,_extends3.default)({},this.props,{overlay:overlayNode}));
};return Popover;}(_react2.default.Component);exports.default=Popover;
Popover.defaultProps={
prefixCls:'am-popover',
placement:'bottomRight',
popupAlign:{overflow:{adjustY:0,adjustX:0}},
trigger:['click']};
Popover.Item=_Item2.default;module.exports=exports['default'];
/***/ },
/* 198 */
[490, 329],
/* 199 */
/***/ function(module, exports, __webpack_require__) {
'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.default=undefined;var _classCallCheck2=__webpack_require__(2);var _classCallCheck3=_interopRequireDefault(_classCallCheck2);
var _react=__webpack_require__(1);var _react2=_interopRequireDefault(_react);
var _reactDom=__webpack_require__(10);var _reactDom2=_interopRequireDefault(_reactDom);
var _rcDialog=__webpack_require__(48);var _rcDialog2=_interopRequireDefault(_rcDialog);
var _objectAssign=__webpack_require__(12);var _objectAssign2=_interopRequireDefault(_objectAssign);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}
function create(instanceId,config,content){var afterClose=arguments.length>3&&arguments[3]!==undefined?arguments[3]:function(_x){};
var props=(0,_objectAssign2.default)({},{
prefixCls:'am-popup',
animationType:'slide-down'},
config);var
prefixCls=props.prefixCls,transitionName=props.transitionName,maskTransitionName=props.maskTransitionName,_props$maskClosable=props.maskClosable,maskClosable=_props$maskClosable===undefined?true:_props$maskClosable,animationType=props.animationType;
var div=document.createElement('div');
document.body.appendChild(div);
function close(){
if(div){
_reactDom2.default.unmountComponentAtNode(div);
div.parentNode.removeChild(div);
div=null;
}
afterClose(instanceId);
}
var transName='am-slide-down';
if(animationType==='slide-up'){
transName='am-slide-up';
}
var maskProps={
onClick:function onClick(e){
e.preventDefault();
if(maskClosable){
if(props.onMaskClose&&typeof props.onMaskClose==='function'){
var res=props.onMaskClose();
if(res&&res.then){
res.then(function(){
close();
});
}else
{
close();
}
}else
{
close();
}
}
}};
_reactDom2.default.render(_react2.default.createElement(_rcDialog2.default,{prefixCls:prefixCls,visible:true,title:'',footer:'',className:prefixCls+'-'+animationType,transitionName:transitionName||transName,maskTransitionName:maskTransitionName||'am-fade',maskClosable:maskClosable,wrapProps:props.wrapProps||{},maskProps:props.maskProps||maskProps},
content),
div);
return{
instanceId:instanceId,
close:close};
}
var ins={
defaultInstance:null,
instances:[]};
var instanceId=1;var
Popup=function Popup(){(0,_classCallCheck3.default)(this,Popup);};exports.default=Popup;
Popup.newInstance=function(){
var j=void 0;
return{
show:function show(content,config){
j=create(instanceId++,config,content,function(iId){
for(var i=0;i0){
this.refs.searchInput.focus();
}
this.componentDidUpdate();
};SearchBar.prototype.
componentDidUpdate=function componentDidUpdate(){
var realWidth=this.refs.syntheticPhContainer.getBoundingClientRect().width;
if(this.refs.searchInputContainer.className.indexOf(this.props.prefixCls+'-start')>-1){
this.refs.syntheticPh.style.width=Math.ceil(realWidth)+'px';
if(!this.props.showCancelButton){
this.refs.rightBtn.style.marginRight=0;
}
}else
{
this.refs.syntheticPh.style.width='100%';
if(!this.props.showCancelButton){
this.refs.rightBtn.style.marginRight='-'+(
this.refs.rightBtn.offsetWidth+parseInt(this.rightBtnInitMarginleft,10))+'px';
}
}
if(this.state.focused){
this.refs.searchInput.focus();
}
};SearchBar.prototype.
componentWillReceiveProps=function componentWillReceiveProps(nextProps){
if('value'in nextProps){
this.setState({
value:nextProps.value});
}
if('focused'in nextProps){
this.setState({
focused:nextProps.focused});
}
};SearchBar.prototype.
componentWillUnmount=function componentWillUnmount(){
if(this.scrollIntoViewTimeout){
clearTimeout(this.scrollIntoViewTimeout);
this.scrollIntoViewTimeout=null;
}
};SearchBar.prototype.
render=function render(){var _classNames,_classNames2,_classNames3;var _props=
this.props,prefixCls=_props.prefixCls,showCancelButton=_props.showCancelButton,disabled=_props.disabled,placeholder=_props.placeholder,cancelText=_props.cancelText,className=_props.className;var _state=
this.state,value=_state.value,focus=_state.focus;
var wrapCls=(0,_classnames2.default)((_classNames={},(0,_defineProperty3.default)(_classNames,''+
prefixCls,true),(0,_defineProperty3.default)(_classNames,
prefixCls+'-start',focus||value&&value.length>0),(0,_defineProperty3.default)(_classNames,
className,className),_classNames));
var clearCls=(0,_classnames2.default)((_classNames2={},(0,_defineProperty3.default)(_classNames2,
prefixCls+'-clear',true),(0,_defineProperty3.default)(_classNames2,
prefixCls+'-clear-show',focus&&value&&value.length>0),_classNames2));
var cancelCls=(0,_classnames2.default)((_classNames3={},(0,_defineProperty3.default)(_classNames3,
prefixCls+'-cancel',true),(0,_defineProperty3.default)(_classNames3,
prefixCls+'-cancel-show',showCancelButton||focus||value&&value.length>0),(0,_defineProperty3.default)(_classNames3,
prefixCls+'-cancel-anim',this.firstFocus),_classNames3));
return _react2.default.createElement('form',{onSubmit:this.onSubmit,className:wrapCls,ref:'searchInputContainer'},
_react2.default.createElement('div',{className:prefixCls+'-input'},
_react2.default.createElement('div',{className:prefixCls+'-synthetic-ph',ref:'syntheticPh'},
_react2.default.createElement('span',{className:prefixCls+'-synthetic-ph-container',ref:'syntheticPhContainer'},
_react2.default.createElement('i',{className:prefixCls+'-synthetic-ph-icon'}),
_react2.default.createElement('span',{className:prefixCls+'-synthetic-ph-placeholder',style:{visibility:placeholder&&!value?'visible':'hidden'}},
placeholder))),
_react2.default.createElement('input',{type:'search',className:prefixCls+'-value',value:value,disabled:disabled,placeholder:placeholder,onChange:this.onChange,onFocus:this.onFocus,onBlur:this.onBlur,ref:'searchInput'}),
_react2.default.createElement('a',{onClick:this.onClear,className:clearCls})),
_react2.default.createElement('div',{className:cancelCls,onClick:this.onCancel,ref:'rightBtn'},
cancelText));
};return SearchBar;}(_react2.default.Component);exports.default=SearchBar;
SearchBar.defaultProps=_PropsType.defaultProps;module.exports=exports['default'];
/***/ },
/* 213 */
[490, 336],
/* 214 */
/***/ function(module, exports, __webpack_require__) {
'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.default=undefined;var _defineProperty2=__webpack_require__(6);var _defineProperty3=_interopRequireDefault(_defineProperty2);var _classCallCheck2=__webpack_require__(2);var _classCallCheck3=_interopRequireDefault(_classCallCheck2);var _possibleConstructorReturn2=__webpack_require__(4);var _possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2);var _inherits2=__webpack_require__(3);var _inherits3=_interopRequireDefault(_inherits2);var _react=__webpack_require__(1);var _react2=_interopRequireDefault(_react);
var _classnames=__webpack_require__(5);var _classnames2=_interopRequireDefault(_classnames);
var _rcTouchable=__webpack_require__(17);var _rcTouchable2=_interopRequireDefault(_rcTouchable);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}var
SegmentedControl=function(_React$Component){(0,_inherits3.default)(SegmentedControl,_React$Component);
function SegmentedControl(props){(0,_classCallCheck3.default)(this,SegmentedControl);var _this=(0,_possibleConstructorReturn3.default)(this,
_React$Component.call(this,props));
_this.state={
selectedIndex:props.selectedIndex};return _this;
}SegmentedControl.prototype.
componentWillReceiveProps=function componentWillReceiveProps(nextProps){
if(nextProps.selectedIndex!==this.state.selectedIndex){
this.setState({
selectedIndex:nextProps.selectedIndex});
}
};SegmentedControl.prototype.
onClick=function onClick(e,index,value){var _props=
this.props,disabled=_props.disabled,onChange=_props.onChange,onValueChange=_props.onValueChange;
if(!disabled&&this.state.selectedIndex!==index){
e.nativeEvent=e.nativeEvent?e.nativeEvent:{};
e.nativeEvent.selectedSegmentIndex=index;
e.nativeEvent.value=value;
if(onChange){
onChange(e);
}
if(onValueChange){
onValueChange(value);
}
this.setState({
selectedIndex:index});
}
};SegmentedControl.prototype.
renderSegmentItem=function renderSegmentItem(idx,value,selected){var _classNames,_this2=this;var _props2=
this.props,prefixCls=_props2.prefixCls,disabled=_props2.disabled,tintColor=_props2.tintColor;
var itemCls=(0,_classnames2.default)((_classNames={},(0,_defineProperty3.default)(_classNames,
prefixCls+'-item',true),(0,_defineProperty3.default)(_classNames,
prefixCls+'-item-selected',selected),_classNames));
var itemStyle={
color:selected?'#fff':tintColor,
backgroundColor:selected?tintColor:'#fff',
borderColor:tintColor};
return _react2.default.createElement(_rcTouchable2.default,{key:idx,disabled:disabled,activeClassName:prefixCls+'-item-active'},
_react2.default.createElement('div',{className:itemCls,style:itemStyle,onClick:disabled?undefined:function(e){return _this2.onClick(e,idx,value);}},
_react2.default.createElement('div',{className:prefixCls+'-item-inner'}),
value));
};SegmentedControl.prototype.
render=function render(){var _classNames2,_this3=this;var _props3=
this.props,className=_props3.className,prefixCls=_props3.prefixCls,style=_props3.style,disabled=_props3.disabled,_props3$values=_props3.values,values=_props3$values===undefined?[]:_props3$values;
var wrapCls=(0,_classnames2.default)((_classNames2={},(0,_defineProperty3.default)(_classNames2,
className,!!className),(0,_defineProperty3.default)(_classNames2,''+
prefixCls,true),(0,_defineProperty3.default)(_classNames2,
prefixCls+'-disabled',disabled),_classNames2));
return _react2.default.createElement('div',{className:wrapCls,style:style},
values.map(function(value,idx){return _this3.renderSegmentItem(idx,value,idx===_this3.state.selectedIndex);}));
};return SegmentedControl;}(_react2.default.Component);exports.default=SegmentedControl;
SegmentedControl.defaultProps={
prefixCls:'am-segment',
selectedIndex:0,
disabled:false,
values:[],
onChange:function onChange(){},
onValueChange:function onValueChange(){},
style:{}};module.exports=exports['default'];
/***/ },
/* 215 */
[490, 337],
/* 216 */
/***/ function(module, exports, __webpack_require__) {
'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.default=undefined;var _classCallCheck2=__webpack_require__(2);var _classCallCheck3=_interopRequireDefault(_classCallCheck2);var _possibleConstructorReturn2=__webpack_require__(4);var _possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2);var _inherits2=__webpack_require__(3);var _inherits3=_interopRequireDefault(_inherits2);var _react=__webpack_require__(1);var _react2=_interopRequireDefault(_react);
var _Slider=__webpack_require__(397);var _Slider2=_interopRequireDefault(_Slider);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}var
Slider=function(_React$Component){(0,_inherits3.default)(Slider,_React$Component);function Slider(){(0,_classCallCheck3.default)(this,Slider);return(0,_possibleConstructorReturn3.default)(this,_React$Component.apply(this,arguments));}Slider.prototype.
render=function render(){
return _react2.default.createElement('div',{className:this.props.prefixCls+'-wrapper'},_react2.default.createElement(_Slider2.default,this.props));
};return Slider;}(_react2.default.Component);exports.default=Slider;
Slider.defaultProps={
prefixCls:'am-slider'};module.exports=exports['default'];
/***/ },
/* 217 */
[493, 338],
/* 218 */
/***/ function(module, exports, __webpack_require__) {
'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.default=undefined;var _extends2=__webpack_require__(7);var _extends3=_interopRequireDefault(_extends2);var _defineProperty2=__webpack_require__(6);var _defineProperty3=_interopRequireDefault(_defineProperty2);var _classCallCheck2=__webpack_require__(2);var _classCallCheck3=_interopRequireDefault(_classCallCheck2);var _possibleConstructorReturn2=__webpack_require__(4);var _possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2);var _inherits2=__webpack_require__(3);var _inherits3=_interopRequireDefault(_inherits2);
var _react=__webpack_require__(1);var _react2=_interopRequireDefault(_react);
var _classnames=__webpack_require__(5);var _classnames2=_interopRequireDefault(_classnames);
var _rcInputNumber=__webpack_require__(391);var _rcInputNumber2=_interopRequireDefault(_rcInputNumber);
var _icon=__webpack_require__(15);var _icon2=_interopRequireDefault(_icon);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}var __rest=undefined&&undefined.__rest||function(s,e){var t={};for(var p in s){if(Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0)t[p]=s[p];}if(s!=null&&typeof Object.getOwnPropertySymbols==="function")for(var i=0,p=Object.getOwnPropertySymbols(s);icurrent){
icon='ellipsis';
className=className?className+' ellipsis-item':'ellipsis-item';
}
if(status==='error'&&index===current||item.props.status==='error'){
icon='cross-circle-o';
}
}
icon=typeof icon==='string'?_react2.default.createElement(_index2.default,{type:icon}):icon;
return _react2.default.cloneElement(item,{icon:icon,className:className,ref:function ref(c){return _this2.stepRefs[index]=c;}});
});
return _react2.default.createElement(_rcSteps2.default,(0,_extends3.default)({ref:'rcSteps'},this.props),newChildren);
};return Steps;}(_react2.default.Component);exports.default=Steps;
Steps.Step=_rcSteps2.default.Step;
Steps.defaultProps={
prefixCls:'am-steps',
iconPrefix:'ant',
labelPlacement:'vertical',
direction:'vertical',
current:0};module.exports=exports['default'];
/***/ },
/* 221 */
[491, 340],
/* 222 */
/***/ function(module, exports, __webpack_require__) {
'use strict';Object.defineProperty(exports,"__esModule",{value:true});var _defineProperty2=__webpack_require__(6);var _defineProperty3=_interopRequireDefault(_defineProperty2);var _classCallCheck2=__webpack_require__(2);var _classCallCheck3=_interopRequireDefault(_classCallCheck2);var _possibleConstructorReturn2=__webpack_require__(4);var _possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2);var _inherits2=__webpack_require__(3);var _inherits3=_interopRequireDefault(_inherits2);var _react=__webpack_require__(1);var _react2=_interopRequireDefault(_react);
var _rcSwipeout=__webpack_require__(405);var _rcSwipeout2=_interopRequireDefault(_rcSwipeout);
var _classnames=__webpack_require__(5);var _classnames2=_interopRequireDefault(_classnames);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}var
SwipeAction=function(_React$Component){(0,_inherits3.default)(SwipeAction,_React$Component);function SwipeAction(){(0,_classCallCheck3.default)(this,SwipeAction);return(0,_possibleConstructorReturn3.default)(this,_React$Component.apply(this,arguments));}SwipeAction.prototype.
render=function render(){var _classNames;var _props=
this.props,className=_props.className,prefixCls=_props.prefixCls,_props$left=_props.left,left=_props$left===undefined?[]:_props$left,_props$right=_props.right,right=_props$right===undefined?[]:_props$right,autoClose=_props.autoClose,disabled=_props.disabled,onOpen=_props.onOpen,onClose=_props.onClose,children=_props.children;
var wrapClass=(0,_classnames2.default)((_classNames={},(0,_defineProperty3.default)(_classNames,''+
prefixCls,1),(0,_defineProperty3.default)(_classNames,
className,!!className),_classNames));
return left.length||right.length?_react2.default.createElement('div',{className:wrapClass},
_react2.default.createElement(_rcSwipeout2.default,{prefixCls:prefixCls,left:left,right:right,autoClose:autoClose,disabled:disabled,onOpen:onOpen,onClose:onClose},
children)):
_react2.default.createElement('div',{className:wrapClass},children);
};return SwipeAction;}(_react2.default.Component);
SwipeAction.defaultProps={
prefixCls:'am-swipe',
title:'请确认操作',
autoClose:false,
disabled:false,
left:[],
right:[],
onOpen:function onOpen(){},
onClose:function onClose(){}};exports.default=
SwipeAction;module.exports=exports['default'];
/***/ },
/* 223 */
[490, 342],
/* 224 */
/***/ function(module, exports, __webpack_require__) {
'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.default=undefined;var _extends2=__webpack_require__(7);var _extends3=_interopRequireDefault(_extends2);var _defineProperty2=__webpack_require__(6);var _defineProperty3=_interopRequireDefault(_defineProperty2);var _classCallCheck2=__webpack_require__(2);var _classCallCheck3=_interopRequireDefault(_classCallCheck2);var _possibleConstructorReturn2=__webpack_require__(4);var _possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2);var _inherits2=__webpack_require__(3);var _inherits3=_interopRequireDefault(_inherits2);var _react=__webpack_require__(1);var _react2=_interopRequireDefault(_react);
var _classnames=__webpack_require__(5);var _classnames2=_interopRequireDefault(_classnames);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}var
Switch=function(_React$Component){(0,_inherits3.default)(Switch,_React$Component);
function Switch(){(0,_classCallCheck3.default)(this,Switch);var _this=(0,_possibleConstructorReturn3.default)(this,
_React$Component.apply(this,arguments));
_this.onChange=function(e){
var checked=e.target.checked;
if(_this.props.onChange){
_this.props.onChange(checked);
}
};return _this;
}Switch.prototype.
render=function render(){var _classNames;var _props=
this.props,prefixCls=_props.prefixCls,style=_props.style,name=_props.name,checked=_props.checked,disabled=_props.disabled,className=_props.className,platform=_props.platform;
var isAndroid=platform==='android'||platform==='cross'&&!!navigator.userAgent.match(/Android/i);
var wrapCls=(0,_classnames2.default)((_classNames={},(0,_defineProperty3.default)(_classNames,''+
prefixCls,true),(0,_defineProperty3.default)(_classNames,
className,className),(0,_defineProperty3.default)(_classNames,
prefixCls+'-android',isAndroid),_classNames));
return _react2.default.createElement('label',{className:wrapCls,style:style},
_react2.default.createElement('input',(0,_extends3.default)({type:'checkbox',name:name,className:prefixCls+'-checkbox'},disabled?{disabled:'disabled'}:'',{checked:checked,onChange:this.onChange})),
_react2.default.createElement('div',{className:'checkbox'}));
};return Switch;}(_react2.default.Component);exports.default=Switch;
Switch.defaultProps={
prefixCls:'am-switch',
name:'',
checked:false,
disabled:false,
onChange:function onChange(){},
platform:'cross'};module.exports=exports['default'];
/***/ },
/* 225 */
[490, 343],
/* 226 */
/***/ function(module, exports, __webpack_require__) {
'use strict';Object.defineProperty(exports,"__esModule",{value:true});var _classCallCheck2=__webpack_require__(2);var _classCallCheck3=_interopRequireDefault(_classCallCheck2);var _possibleConstructorReturn2=__webpack_require__(4);var _possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2);var _inherits2=__webpack_require__(3);var _inherits3=_interopRequireDefault(_inherits2);var _react=__webpack_require__(1);var _react2=_interopRequireDefault(_react);
var _badge=__webpack_require__(80);var _badge2=_interopRequireDefault(_badge);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}var
Tab=function(_React$Component){(0,_inherits3.default)(Tab,_React$Component);
function Tab(){(0,_classCallCheck3.default)(this,Tab);var _this=(0,_possibleConstructorReturn3.default)(this,
_React$Component.apply(this,arguments));
_this.renderIcon=function(){var _this$props=
_this.props,dot=_this$props.dot,badge=_this$props.badge,selected=_this$props.selected,selectedIcon=_this$props.selectedIcon,icon=_this$props.icon,title=_this$props.title,prefixCls=_this$props.prefixCls;
var iconRes=selected?selectedIcon:icon;
var iconDom=_react2.default.isValidElement(iconRes)?iconRes:_react2.default.createElement('img',{className:prefixCls+'-image',src:iconRes.uri||iconRes,alt:title});
if(badge){
return _react2.default.createElement(_badge2.default,{text:badge,className:prefixCls+'-badge tab-badge'},' ',iconDom,' ');
}
if(dot){
return _react2.default.createElement(_badge2.default,{dot:true,className:prefixCls+'-badge tab-dot'},iconDom);
}
return iconDom;
};return _this;
}Tab.prototype.
render=function render(){var _props=
this.props,title=_props.title,prefixCls=_props.prefixCls,selected=_props.selected,unselectedTintColor=_props.unselectedTintColor,tintColor=_props.tintColor;
var iconColor=selected?tintColor:unselectedTintColor;
return _react2.default.createElement('div',this.props.dataAttrs,
_react2.default.createElement('div',{className:prefixCls+'-icon',style:{color:iconColor}},
this.renderIcon()),
_react2.default.createElement('p',{className:prefixCls+'-title',style:{color:selected?tintColor:unselectedTintColor}},
title));
};return Tab;}(_react2.default.Component);exports.default=
Tab;module.exports=exports['default'];
/***/ },
/* 227 */
/***/ function(module, exports, __webpack_require__) {
'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.Item=undefined;var _classCallCheck2=__webpack_require__(2);var _classCallCheck3=_interopRequireDefault(_classCallCheck2);var _possibleConstructorReturn2=__webpack_require__(4);var _possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2);var _inherits2=__webpack_require__(3);var _inherits3=_interopRequireDefault(_inherits2);var _react=__webpack_require__(1);var _react2=_interopRequireDefault(_react);
var _rcTabs=__webpack_require__(122);var _rcTabs2=_interopRequireDefault(_rcTabs);
var _Tab=__webpack_require__(226);var _Tab2=_interopRequireDefault(_Tab);
var _TabContent=__webpack_require__(75);var _TabContent2=_interopRequireDefault(_TabContent);
var _TabBar=__webpack_require__(424);var _TabBar2=_interopRequireDefault(_TabBar);
var _getDataAttr=__webpack_require__(41);var _getDataAttr2=_interopRequireDefault(_getDataAttr);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}var
Item=exports.Item=function(_React$Component){(0,_inherits3.default)(Item,_React$Component);function Item(){(0,_classCallCheck3.default)(this,Item);return(0,_possibleConstructorReturn3.default)(this,_React$Component.apply(this,arguments));}Item.prototype.
render=function render(){
return null;
};return Item;}(_react2.default.Component);var
AntTabBar=function(_React$Component2){(0,_inherits3.default)(AntTabBar,_React$Component2);
function AntTabBar(){(0,_classCallCheck3.default)(this,AntTabBar);var _this2=(0,_possibleConstructorReturn3.default)(this,
_React$Component2.apply(this,arguments));
_this2.onChange=function(key){
_react2.default.Children.forEach(_this2.props.children,function(c){
if(c.key===key&&c.props.onPress){
c.props.onPress();
}
});
};
_this2.renderTabBar=function(){var _this2$props=
_this2.props,barTintColor=_this2$props.barTintColor,hidden=_this2$props.hidden,prefixCls=_this2$props.prefixCls;
var barCls=hidden?prefixCls+'-bar-hidden':'';
return _react2.default.createElement(_TabBar2.default,{className:barCls,style:{backgroundColor:barTintColor}});
};
_this2.renderTabContent=function(){
return _react2.default.createElement(_TabContent2.default,{animated:false});
};return _this2;
}AntTabBar.prototype.
render=function render(){var _this3=this;
var activeKey=void 0;
var children=[];
_react2.default.Children.forEach(this.props.children,function(c){
if(c.props.selected){
activeKey=c.key;
}
children.push(c);
});var _props=
this.props,tintColor=_props.tintColor,unselectedTintColor=_props.unselectedTintColor;
var panels=children.map(function(c){
var cProps=c.props;
var tab=_react2.default.createElement(_Tab2.default,{prefixCls:_this3.props.prefixCls+'-tab',badge:cProps.badge,dot:cProps.dot,selected:cProps.selected,icon:cProps.icon,selectedIcon:cProps.selectedIcon,title:cProps.title,tintColor:tintColor,unselectedTintColor:unselectedTintColor,dataAttrs:(0,_getDataAttr2.default)(cProps)});
return _react2.default.createElement(_rcTabs.TabPane,{placeholder:_this3.props.placeholder,tab:tab,key:c.key},
cProps.children);
});
return _react2.default.createElement(_rcTabs2.default,{renderTabBar:this.renderTabBar,renderTabContent:this.renderTabContent,tabBarPosition:'bottom',prefixCls:this.props.prefixCls,activeKey:activeKey,onChange:this.onChange},
panels);
};return AntTabBar;}(_react2.default.Component);
AntTabBar.defaultProps={
prefixCls:'am-tab-bar',
barTintColor:'white',
tintColor:'#108ee9',
hidden:false,
unselectedTintColor:'#888',
placeholder:'正在加载'};
AntTabBar.Item=Item;exports.default=
AntTabBar;
/***/ },
/* 228 */
/***/ function(module, exports, __webpack_require__) {
'use strict';__webpack_require__(8);
__webpack_require__(344);
__webpack_require__(81);
/***/ },
/* 229 */
/***/ function(module, exports, __webpack_require__) {
'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.default=undefined;var _extends2=__webpack_require__(7);var _extends3=_interopRequireDefault(_extends2);var _classCallCheck2=__webpack_require__(2);var _classCallCheck3=_interopRequireDefault(_classCallCheck2);var _possibleConstructorReturn2=__webpack_require__(4);var _possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2);var _inherits2=__webpack_require__(3);var _inherits3=_interopRequireDefault(_inherits2);var _react=__webpack_require__(1);var _react2=_interopRequireDefault(_react);
var _objectAssign=__webpack_require__(12);var _objectAssign2=_interopRequireDefault(_objectAssign);
var _rcTable=__webpack_require__(416);var _rcTable2=_interopRequireDefault(_rcTable);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}var
Table=function(_React$Component){(0,_inherits3.default)(Table,_React$Component);function Table(){(0,_classCallCheck3.default)(this,Table);return(0,_possibleConstructorReturn3.default)(this,_React$Component.apply(this,arguments));}Table.prototype.
render=function render(){var _props=
this.props,prefixCls=_props.prefixCls,columns=_props.columns,dataSource=_props.dataSource,direction=_props.direction,scrollX=_props.scrollX,titleFixed=_props.titleFixed;
var newProps=(0,_objectAssign2.default)({},this.props,{data:dataSource});
var table=void 0;
if(!direction||direction==='vertical'){
if(titleFixed){
table=_react2.default.createElement(_rcTable2.default,(0,_extends3.default)({},newProps,{columns:columns,scroll:{x:true},showHeader:false}));
}else
{
table=_react2.default.createElement(_rcTable2.default,(0,_extends3.default)({},newProps,{columns:columns,scroll:{x:scrollX}}));
}
}else
if(direction==='horizon'){
columns[0].className=prefixCls+'-horizonTitle';
table=_react2.default.createElement(_rcTable2.default,(0,_extends3.default)({},newProps,{columns:columns,showHeader:false,scroll:{x:scrollX}}));
}else
if(direction==='mix'){
columns[0].className=prefixCls+'-horizonTitle';
table=_react2.default.createElement(_rcTable2.default,(0,_extends3.default)({},newProps,{columns:columns,scroll:{x:scrollX}}));
}
return table;
};return Table;}(_react2.default.Component);exports.default=Table;
Table.defaultProps={
dataSource:[],
prefixCls:'am-table'};module.exports=exports['default'];
/***/ },
/* 230 */
[490, 345],
/* 231 */
/***/ function(module, exports, __webpack_require__) {
'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.default=undefined;var _extends2=__webpack_require__(7);var _extends3=_interopRequireDefault(_extends2);var _classCallCheck2=__webpack_require__(2);var _classCallCheck3=_interopRequireDefault(_classCallCheck2);var _possibleConstructorReturn2=__webpack_require__(4);var _possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2);var _inherits2=__webpack_require__(3);var _inherits3=_interopRequireDefault(_inherits2);var _react=__webpack_require__(1);var _react2=_interopRequireDefault(_react);
var _rcTabs=__webpack_require__(122);var _rcTabs2=_interopRequireDefault(_rcTabs);
var _SwipeableTabContent=__webpack_require__(423);var _SwipeableTabContent2=_interopRequireDefault(_SwipeableTabContent);
var _TabContent=__webpack_require__(75);var _TabContent2=_interopRequireDefault(_TabContent);
var _InkTabBar=__webpack_require__(419);var _InkTabBar2=_interopRequireDefault(_InkTabBar);
var _SwipeableInkTabBar=__webpack_require__(421);var _SwipeableInkTabBar2=_interopRequireDefault(_SwipeableInkTabBar);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}var
Tabs=function(_React$Component){(0,_inherits3.default)(Tabs,_React$Component);
function Tabs(){(0,_classCallCheck3.default)(this,Tabs);var _this=(0,_possibleConstructorReturn3.default)(this,
_React$Component.apply(this,arguments));
_this.renderTabBar=function(){var _this$props=
_this.props,children=_this$props.children,animated=_this$props.animated,speed=_this$props.speed,pageSize=_this$props.pageSize,tabBarhammerOptions=_this$props.tabBarhammerOptions,onTabClick=_this$props.onTabClick;
if(children.length>pageSize){
return _react2.default.createElement(_SwipeableInkTabBar2.default,{onTabClick:onTabClick,speed:speed,pageSize:pageSize,hammerOptions:tabBarhammerOptions});
}
return _react2.default.createElement(_InkTabBar2.default,{inkBarAnimated:animated,onTabClick:onTabClick});
};
_this.renderTabContent=function(){var _this$props2=
_this.props,animated=_this$props2.animated,swipeable=_this$props2.swipeable,hammerOptions=_this$props2.hammerOptions;
return swipeable?_react2.default.createElement(_SwipeableTabContent2.default,{animated:animated,hammerOptions:hammerOptions}):_react2.default.createElement(_TabContent2.default,{animated:animated});
};return _this;
}Tabs.prototype.
render=function render(){
return _react2.default.createElement(_rcTabs2.default,(0,_extends3.default)({renderTabBar:this.renderTabBar,renderTabContent:this.renderTabContent},this.props));
};return Tabs;}(_react2.default.Component);exports.default=Tabs;
Tabs.TabPane=_rcTabs.TabPane;
Tabs.defaultProps={
prefixCls:'am-tabs',
animated:true,
swipeable:true,
tabBarPosition:'top',
hammerOptions:{},
tabBarhammerOptions:{},
pageSize:5,
speed:8,
onChange:function onChange(){},
onTabClick:function onTabClick(){}};module.exports=exports['default'];
/***/ },
/* 232 */
[490, 346],
/* 233 */
/***/ function(module, exports, __webpack_require__) {
'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.default=undefined;var _extends2=__webpack_require__(7);var _extends3=_interopRequireDefault(_extends2);var _defineProperty2=__webpack_require__(6);var _defineProperty3=_interopRequireDefault(_defineProperty2);var _classCallCheck2=__webpack_require__(2);var _classCallCheck3=_interopRequireDefault(_classCallCheck2);var _possibleConstructorReturn2=__webpack_require__(4);var _possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2);var _inherits2=__webpack_require__(3);var _inherits3=_interopRequireDefault(_inherits2);var _react=__webpack_require__(1);var _react2=_interopRequireDefault(_react);
var _classnames=__webpack_require__(5);var _classnames2=_interopRequireDefault(_classnames);
var _icon=__webpack_require__(15);var _icon2=_interopRequireDefault(_icon);
var _getDataAttr=__webpack_require__(41);var _getDataAttr2=_interopRequireDefault(_getDataAttr);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}var
Tag=function(_React$Component){(0,_inherits3.default)(Tag,_React$Component);
function Tag(props){(0,_classCallCheck3.default)(this,Tag);var _this=(0,_possibleConstructorReturn3.default)(this,
_React$Component.call(this,props));
_this.onClick=function(){var _this$props=
_this.props,disabled=_this$props.disabled,onChange=_this$props.onChange;
if(disabled){
return;
}
var isSelect=_this.state.selected;
_this.setState({
selected:!isSelect},
function(){
if(onChange){
onChange(!isSelect);
}
});
};
_this.onTagClose=function(){
if(_this.props.onClose){
_this.props.onClose();
}
_this.setState({
closed:true},
_this.props.afterClose);
};
_this.state={
selected:props.selected,
closed:false};return _this;
}Tag.prototype.
componentWillReceiveProps=function componentWillReceiveProps(nextProps){
if(this.props.selected!==nextProps.selected){
this.setState({
selected:nextProps.selected});
}
};Tag.prototype.
render=function render(){var _classNames;var _props=
this.props,children=_props.children,className=_props.className,prefixCls=_props.prefixCls,disabled=_props.disabled,closable=_props.closable,small=_props.small,style=_props.style;
var wrapCls=(0,_classnames2.default)((_classNames={},(0,_defineProperty3.default)(_classNames,
className,!!className),(0,_defineProperty3.default)(_classNames,''+
prefixCls,true),(0,_defineProperty3.default)(_classNames,
prefixCls+'-normal',!disabled&&(!this.state.selected||small||closable)),(0,_defineProperty3.default)(_classNames,
prefixCls+'-small',small),(0,_defineProperty3.default)(_classNames,
prefixCls+'-active',this.state.selected&&!disabled&&!small&&!closable),(0,_defineProperty3.default)(_classNames,
prefixCls+'-disabled',disabled),(0,_defineProperty3.default)(_classNames,
prefixCls+'-closable',closable),_classNames));
var closableDom=closable&&!disabled&&!small?_react2.default.createElement('div',{className:prefixCls+'-close',onClick:this.onTagClose},
_react2.default.createElement(_icon2.default,{type:'cross-circle',size:'xs'})):
null;
return!this.state.closed?_react2.default.createElement('div',(0,_extends3.default)({},(0,_getDataAttr2.default)(this.props),{className:wrapCls,onClick:this.onClick,style:style}),
_react2.default.createElement('div',{className:prefixCls+'-text'},children),
closableDom):
null;
};return Tag;}(_react2.default.Component);exports.default=Tag;
Tag.defaultProps={
prefixCls:'am-tag',
disabled:false,
selected:false,
closable:false,
small:false,
onChange:function onChange(){},
onClose:function onClose(){},
afterClose:function afterClose(){}};module.exports=exports['default'];
/***/ },
/* 234 */
[491, 347],
/* 235 */
/***/ function(module, exports, __webpack_require__) {
'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.default=undefined;var _classCallCheck2=__webpack_require__(2);var _classCallCheck3=_interopRequireDefault(_classCallCheck2);var _possibleConstructorReturn2=__webpack_require__(4);var _possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2);var _inherits2=__webpack_require__(3);var _inherits3=_interopRequireDefault(_inherits2);var _react=__webpack_require__(1);var _react2=_interopRequireDefault(_react);
var _view=__webpack_require__(91);var _view2=_interopRequireDefault(_view);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}var
Text=function(_React$Component){(0,_inherits3.default)(Text,_React$Component);function Text(){(0,_classCallCheck3.default)(this,Text);return(0,_possibleConstructorReturn3.default)(this,_React$Component.apply(this,arguments));}Text.prototype.
render=function render(){
return _react2.default.createElement(_view2.default,this.props);
};return Text;}(_react2.default.Component);exports.default=Text;
Text.defaultProps={
Component:'span'};module.exports=exports['default'];
/***/ },
/* 236 */
/***/ function(module, exports) {
"use strict";
/***/ },
/* 237 */
/***/ function(module, exports, __webpack_require__) {
'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.default=undefined;var _extends2=__webpack_require__(7);var _extends3=_interopRequireDefault(_extends2);var _defineProperty2=__webpack_require__(6);var _defineProperty3=_interopRequireDefault(_defineProperty2);var _classCallCheck2=__webpack_require__(2);var _classCallCheck3=_interopRequireDefault(_classCallCheck2);var _possibleConstructorReturn2=__webpack_require__(4);var _possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2);var _inherits2=__webpack_require__(3);var _inherits3=_interopRequireDefault(_inherits2);
var _react=__webpack_require__(1);var _react2=_interopRequireDefault(_react);
var _classnames=__webpack_require__(5);var _classnames2=_interopRequireDefault(_classnames);
var _omit=__webpack_require__(27);var _omit2=_interopRequireDefault(_omit);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}
function noop(){}
function fixControlledValue(value){
if(typeof value==='undefined'||value===null){
return'';
}
return value;
}
var regexAstralSymbols=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
function countSymbols(){var text=arguments.length>0&&arguments[0]!==undefined?arguments[0]:'';
return text.replace(regexAstralSymbols,'_').length;
}var
TextareaItem=function(_React$Component){(0,_inherits3.default)(TextareaItem,_React$Component);
function TextareaItem(props){(0,_classCallCheck3.default)(this,TextareaItem);var _this=(0,_possibleConstructorReturn3.default)(this,
_React$Component.call(this,props));
_this.onChange=function(e){
var value=e.target.value;var
onChange=_this.props.onChange;
if(onChange){
onChange(value);
}
_this.componentDidUpdate();
};
_this.onBlur=function(e){
_this.debounceTimeout=setTimeout(function(){
_this.setState({
focus:false});
},100);
if(!('focused'in _this.props)){
_this.setState({
focused:false});
}
var value=e.target.value;
if(_this.props.onBlur){
_this.props.onBlur(value);
}
};
_this.onFocus=function(e){
if(_this.debounceTimeout){
clearTimeout(_this.debounceTimeout);
_this.debounceTimeout=null;
}
if(!('focused'in _this.props)){
_this.setState({
focused:true});
}
_this.setState({
focus:true});
var value=e.target.value;
if(_this.props.onFocus){
_this.props.onFocus(value);
}
if(document.activeElement.tagName.toLowerCase()==='textarea'){
_this.scrollIntoViewTimeout=setTimeout(function(){
try{
document.activeElement.scrollIntoViewIfNeeded();
}
catch(e){}
},100);
}
};
_this.onErrorClick=function(){
if(_this.props.onErrorClick){
_this.props.onErrorClick();
}
};
_this.clearInput=function(){
if(_this.props.onChange){
_this.props.onChange('');
}
};
_this.state={
focus:false,
focused:props.focused||false};return _this;
}TextareaItem.prototype.
componentDidMount=function componentDidMount(){
this.componentDidUpdate();
if((this.props.autoFocus||this.state.focused)&&navigator.userAgent.indexOf('AlipayClient')>0){
this.refs.textarea.focus();
}
};TextareaItem.prototype.
componentDidUpdate=function componentDidUpdate(){
if(this.props.autoHeight){
var textareaDom=this.refs.textarea;
textareaDom.style.height='';
textareaDom.style.height=textareaDom.scrollHeight+'px';
}
if(this.state.focused){
this.refs.textarea.focus();
}
};TextareaItem.prototype.
componentWillReceiveProps=function componentWillReceiveProps(nextProps){
if('focused'in nextProps){
this.setState({
focused:nextProps.focused});
}
};TextareaItem.prototype.
componentWillUnmount=function componentWillUnmount(){
if(this.debounceTimeout){
clearTimeout(this.debounceTimeout);
this.debounceTimeout=null;
}
if(this.scrollIntoViewTimeout){
clearTimeout(this.scrollIntoViewTimeout);
this.scrollIntoViewTimeout=null;
}
};TextareaItem.prototype.
render=function render(){var _classNames,_classNames2;var _props=
this.props,prefixCls=_props.prefixCls,prefixListCls=_props.prefixListCls,style=_props.style,title=_props.title,value=_props.value,defaultValue=_props.defaultValue,clear=_props.clear,editable=_props.editable,disabled=_props.disabled,error=_props.error,className=_props.className,labelNumber=_props.labelNumber,autoHeight=_props.autoHeight;
var count=this.props.count;
var rows=this.props.rows;
var otherProps=(0,_omit2.default)(this.props,['prefixCls','prefixListCls','editable','style',
'clear','children','error','className','count','labelNumber','title','onErrorClick',
'autoHeight','autoFocus','focused','placeholderTextColor']);
var valueProps=void 0;
if('value'in this.props){
valueProps={
value:fixControlledValue(value)};
}else
{
valueProps={
defaultValue:defaultValue};
}var
focus=this.state.focus;
var wrapCls=(0,_classnames2.default)((_classNames={},(0,_defineProperty3.default)(_classNames,
prefixListCls+'-item',true),(0,_defineProperty3.default)(_classNames,
prefixCls+'-item',true),(0,_defineProperty3.default)(_classNames,
prefixCls+'-disabled',disabled),(0,_defineProperty3.default)(_classNames,
prefixCls+'-item-single-line',rows===1&&!autoHeight),(0,_defineProperty3.default)(_classNames,
prefixCls+'-error',error),(0,_defineProperty3.default)(_classNames,
prefixCls+'-focus',focus),(0,_defineProperty3.default)(_classNames,
className,className),_classNames));
var labelCls=(0,_classnames2.default)((_classNames2={},(0,_defineProperty3.default)(_classNames2,
prefixCls+'-label',true),(0,_defineProperty3.default)(_classNames2,
prefixCls+'-label-2',labelNumber===2),(0,_defineProperty3.default)(_classNames2,
prefixCls+'-label-3',labelNumber===3),(0,_defineProperty3.default)(_classNames2,
prefixCls+'-label-4',labelNumber===4),(0,_defineProperty3.default)(_classNames2,
prefixCls+'-label-5',labelNumber===5),(0,_defineProperty3.default)(_classNames2,
prefixCls+'-label-6',labelNumber===6),(0,_defineProperty3.default)(_classNames2,
prefixCls+'-label-7',labelNumber===7),_classNames2));
var characterLength=countSymbols(value);
return _react2.default.createElement('div',{className:wrapCls,style:style},
title&&_react2.default.createElement('div',{className:labelCls},title),
_react2.default.createElement('div',{className:prefixCls+'-control'},
_react2.default.createElement('textarea',(0,_extends3.default)({ref:'textarea',maxLength:count},otherProps,valueProps,{onChange:this.onChange,onBlur:this.onBlur,onFocus:this.onFocus,readOnly:!editable}))),
clear&&editable&&value&&characterLength>0&&
_react2.default.createElement('div',{className:prefixCls+'-clear',onClick:this.clearInput,onTouchStart:this.clearInput}),
error&&_react2.default.createElement('div',{className:prefixCls+'-error-extra',onClick:this.onErrorClick}),
count>0&&rows>1&&
_react2.default.createElement('span',{className:prefixCls+'-count'},_react2.default.createElement('span',null,value?characterLength:0),'/',count));
};return TextareaItem;}(_react2.default.Component);exports.default=TextareaItem;
TextareaItem.defaultProps={
prefixCls:'am-textarea',
prefixListCls:'am-list',
autoHeight:false,
editable:true,
disabled:false,
placeholder:'',
clear:false,
rows:1,
onChange:noop,
onBlur:noop,
onFocus:noop,
onErrorClick:noop,
error:false,
labelNumber:5};module.exports=exports['default'];
/***/ },
/* 238 */
[492, 348],
/* 239 */
236,
/* 240 */
/***/ function(module, exports, __webpack_require__) {
'use strict';Object.defineProperty(exports,"__esModule",{value:true});exports.default=undefined;var _defineProperty2=__webpack_require__(6);var _defineProperty3=_interopRequireDefault(_defineProperty2);var _classCallCheck2=__webpack_require__(2);var _classCallCheck3=_interopRequireDefault(_classCallCheck2);var _possibleConstructorReturn2=__webpack_require__(4);var _possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2);var _inherits2=__webpack_require__(3);var _inherits3=_interopRequireDefault(_inherits2);var _react=__webpack_require__(1);var _react2=_interopRequireDefault(_react);
var _classnames=__webpack_require__(5);var _classnames2=_interopRequireDefault(_classnames);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}var
WhiteSpace=function(_React$Component){(0,_inherits3.default)(WhiteSpace,_React$Component);function WhiteSpace(){(0,_classCallCheck3.default)(this,WhiteSpace);return(0,_possibleConstructorReturn3.default)(this,_React$Component.apply(this,arguments));}WhiteSpace.prototype.
render=function render(){var _classNames;var _props=
this.props,prefixCls=_props.prefixCls,size=_props.size,className=_props.className,style=_props.style,onClick=_props.onClick;
var wrapCls=(0,_classnames2.default)((_classNames={},(0,_defineProperty3.default)(_classNames,''+
prefixCls,true),(0,_defineProperty3.default)(_classNames,
prefixCls+'-'+size,true),(0,_defineProperty3.default)(_classNames,
className,!!className),_classNames));
return _react2.default.createElement('div',{className:wrapCls,style:style,onClick:onClick});
};return WhiteSpace;}(_react2.default.Component);exports.default=WhiteSpace;
WhiteSpace.defaultProps={
prefixCls:'am-whitespace',
size:'md'};module.exports=exports['default'];
/***/ },
/* 241 */
[490, 350],
/* 242 */
/***/ function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(252), __esModule: true };
/***/ },
/* 243 */
/***/ function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(253), __esModule: true };
/***/ },
/* 244 */
/***/ function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(254), __esModule: true };
/***/ },
/* 245 */
/***/ function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(255), __esModule: true };
/***/ },
/* 246 */
/***/ function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(256), __esModule: true };
/***/ },
/* 247 */
/***/ function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(257), __esModule: true };
/***/ },
/* 248 */
/***/ function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(258), __esModule: true };
/***/ },
/* 249 */
/***/ function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(259), __esModule: true };
/***/ },
/* 250 */
/***/ function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(260), __esModule: true };
/***/ },
/* 251 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _isIterable2 = __webpack_require__(244);
var _isIterable3 = _interopRequireDefault(_isIterable2);
var _getIterator2 = __webpack_require__(243);
var _getIterator3 = _interopRequireDefault(_getIterator2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = function () {
function sliceIterator(arr, i) {
var _arr = [];
var _n = true;
var _d = false;
var _e = undefined;
try {
for (var _i = (0, _getIterator3.default)(arr), _s; !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"]) _i["return"]();
} finally {
if (_d) throw _e;
}
}
return _arr;
}
return function (arr, i) {
if (Array.isArray(arr)) {
return arr;
} else if ((0, _isIterable3.default)(Object(arr))) {
return sliceIterator(arr, i);
} else {
throw new TypeError("Invalid attempt to destructure non-iterable instance");
}
};
}();
/***/ },
/* 252 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(45);
__webpack_require__(284);
module.exports = __webpack_require__(13).Array.from;
/***/ },
/* 253 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(72);
__webpack_require__(45);
module.exports = __webpack_require__(282);
/***/ },
/* 254 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(72);
__webpack_require__(45);
module.exports = __webpack_require__(283);
/***/ },
/* 255 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(286);
module.exports = __webpack_require__(13).Object.assign;
/***/ },
/* 256 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(287);
var $Object = __webpack_require__(13).Object;
module.exports = function create(P, D){
return $Object.create(P, D);
};
/***/ },
/* 257 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(288);
var $Object = __webpack_require__(13).Object;
module.exports = function defineProperty(it, key, desc){
return $Object.defineProperty(it, key, desc);
};
/***/ },
/* 258 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(289);
module.exports = __webpack_require__(13).Object.setPrototypeOf;
/***/ },
/* 259 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(291);
__webpack_require__(290);
__webpack_require__(292);
__webpack_require__(293);
module.exports = __webpack_require__(13).Symbol;
/***/ },
/* 260 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(45);
__webpack_require__(72);
module.exports = __webpack_require__(71).f('iterator');
/***/ },
/* 261 */
/***/ function(module, exports) {
module.exports = function(it){
if(typeof it != 'function')throw TypeError(it + ' is not a function!');
return it;
};
/***/ },
/* 262 */
/***/ function(module, exports) {
module.exports = function(){ /* empty */ };
/***/ },
/* 263 */
/***/ function(module, exports, __webpack_require__) {
// false -> Array#indexOf
// true -> Array#includes
var toIObject = __webpack_require__(26)
, toLength = __webpack_require__(106)
, toIndex = __webpack_require__(281);
module.exports = function(IS_INCLUDES){
return function($this, el, fromIndex){
var O = toIObject($this)
, length = toLength(O.length)
, index = toIndex(fromIndex, length)
, value;
// Array#includes uses SameValueZero equality algorithm
if(IS_INCLUDES && el != el)while(length > index){
value = O[index++];
if(value != value)return true;
// Array#toIndex ignores holes, Array#includes - not
} else for(;length > index; index++)if(IS_INCLUDES || index in O){
if(O[index] === el)return IS_INCLUDES || index || 0;
} return !IS_INCLUDES && -1;
};
};
/***/ },
/* 264 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $defineProperty = __webpack_require__(20)
, createDesc = __webpack_require__(37);
module.exports = function(object, index, value){
if(index in object)$defineProperty.f(object, index, createDesc(0, value));
else object[index] = value;
};
/***/ },
/* 265 */
/***/ function(module, exports, __webpack_require__) {
// all enumerable object keys, includes symbols
var getKeys = __webpack_require__(36)
, gOPS = __webpack_require__(63)
, pIE = __webpack_require__(43);
module.exports = function(it){
var result = getKeys(it)
, getSymbols = gOPS.f;
if(getSymbols){
var symbols = getSymbols(it)
, isEnum = pIE.f
, i = 0
, key;
while(symbols.length > i)if(isEnum.call(it, key = symbols[i++]))result.push(key);
} return result;
};
/***/ },
/* 266 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(19).document && document.documentElement;
/***/ },
/* 267 */
/***/ function(module, exports, __webpack_require__) {
// check on default Array iterator
var Iterators = __webpack_require__(30)
, ITERATOR = __webpack_require__(14)('iterator')
, ArrayProto = Array.prototype;
module.exports = function(it){
return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);
};
/***/ },
/* 268 */
/***/ function(module, exports, __webpack_require__) {
// 7.2.2 IsArray(argument)
var cof = __webpack_require__(57);
module.exports = Array.isArray || function isArray(arg){
return cof(arg) == 'Array';
};
/***/ },
/* 269 */
/***/ function(module, exports, __webpack_require__) {
// call something on iterator step with safe closing on error
var anObject = __webpack_require__(22);
module.exports = function(iterator, fn, value, entries){
try {
return entries ? fn(anObject(value)[0], value[1]) : fn(value);
// 7.4.6 IteratorClose(iterator, completion)
} catch(e){
var ret = iterator['return'];
if(ret !== undefined)anObject(ret.call(iterator));
throw e;
}
};
/***/ },
/* 270 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var create = __webpack_require__(62)
, descriptor = __webpack_require__(37)
, setToStringTag = __webpack_require__(64)
, IteratorPrototype = {};
// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
__webpack_require__(29)(IteratorPrototype, __webpack_require__(14)('iterator'), function(){ return this; });
module.exports = function(Constructor, NAME, next){
Constructor.prototype = create(IteratorPrototype, {next: descriptor(1, next)});
setToStringTag(Constructor, NAME + ' Iterator');
};
/***/ },
/* 271 */
/***/ function(module, exports, __webpack_require__) {
var ITERATOR = __webpack_require__(14)('iterator')
, SAFE_CLOSING = false;
try {
var riter = [7][ITERATOR]();
riter['return'] = function(){ SAFE_CLOSING = true; };
Array.from(riter, function(){ throw 2; });
} catch(e){ /* empty */ }
module.exports = function(exec, skipClosing){
if(!skipClosing && !SAFE_CLOSING)return false;
var safe = false;
try {
var arr = [7]
, iter = arr[ITERATOR]();
iter.next = function(){ return {done: safe = true}; };
arr[ITERATOR] = function(){ return iter; };
exec(arr);
} catch(e){ /* empty */ }
return safe;
};
/***/ },
/* 272 */
/***/ function(module, exports) {
module.exports = function(done, value){
return {value: value, done: !!done};
};
/***/ },
/* 273 */
/***/ function(module, exports, __webpack_require__) {
var getKeys = __webpack_require__(36)
, toIObject = __webpack_require__(26);
module.exports = function(object, el){
var O = toIObject(object)
, keys = getKeys(O)
, length = keys.length
, index = 0
, key;
while(length > index)if(O[key = keys[index++]] === el)return key;
};
/***/ },
/* 274 */
/***/ function(module, exports, __webpack_require__) {
var META = __webpack_require__(44)('meta')
, isObject = __webpack_require__(35)
, has = __webpack_require__(25)
, setDesc = __webpack_require__(20).f
, id = 0;
var isExtensible = Object.isExtensible || function(){
return true;
};
var FREEZE = !__webpack_require__(34)(function(){
return isExtensible(Object.preventExtensions({}));
});
var setMeta = function(it){
setDesc(it, META, {value: {
i: 'O' + ++id, // object ID
w: {} // weak collections IDs
}});
};
var fastKey = function(it, create){
// return primitive with prefix
if(!isObject(it))return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
if(!has(it, META)){
// can't set metadata to uncaught frozen object
if(!isExtensible(it))return 'F';
// not necessary to add metadata
if(!create)return 'E';
// add missing metadata
setMeta(it);
// return object ID
} return it[META].i;
};
var getWeak = function(it, create){
if(!has(it, META)){
// can't set metadata to uncaught frozen object
if(!isExtensible(it))return true;
// not necessary to add metadata
if(!create)return false;
// add missing metadata
setMeta(it);
// return hash weak collections IDs
} return it[META].w;
};
// add metadata on freeze-family methods calling
var onFreeze = function(it){
if(FREEZE && meta.NEED && isExtensible(it) && !has(it, META))setMeta(it);
return it;
};
var meta = module.exports = {
KEY: META,
NEED: false,
fastKey: fastKey,
getWeak: getWeak,
onFreeze: onFreeze
};
/***/ },
/* 275 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
// 19.1.2.1 Object.assign(target, source, ...)
var getKeys = __webpack_require__(36)
, gOPS = __webpack_require__(63)
, pIE = __webpack_require__(43)
, toObject = __webpack_require__(68)
, IObject = __webpack_require__(100)
, $assign = Object.assign;
// should work with symbols and should have deterministic property order (V8 bug)
module.exports = !$assign || __webpack_require__(34)(function(){
var A = {}
, B = {}
, S = Symbol()
, K = 'abcdefghijklmnopqrst';
A[S] = 7;
K.split('').forEach(function(k){ B[k] = k; });
return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
}) ? function assign(target, source){ // eslint-disable-line no-unused-vars
var T = toObject(target)
, aLen = arguments.length
, index = 1
, getSymbols = gOPS.f
, isEnum = pIE.f;
while(aLen > index){
var S = IObject(arguments[index++])
, keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S)
, length = keys.length
, j = 0
, key;
while(length > j)if(isEnum.call(S, key = keys[j++]))T[key] = S[key];
} return T;
} : $assign;
/***/ },
/* 276 */
/***/ function(module, exports, __webpack_require__) {
var dP = __webpack_require__(20)
, anObject = __webpack_require__(22)
, getKeys = __webpack_require__(36);
module.exports = __webpack_require__(23) ? Object.defineProperties : function defineProperties(O, Properties){
anObject(O);
var keys = getKeys(Properties)
, length = keys.length
, i = 0
, P;
while(length > i)dP.f(O, P = keys[i++], Properties[P]);
return O;
};
/***/ },
/* 277 */
/***/ function(module, exports, __webpack_require__) {
// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
var toIObject = __webpack_require__(26)
, gOPN = __webpack_require__(103).f
, toString = {}.toString;
var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
? Object.getOwnPropertyNames(window) : [];
var getWindowNames = function(it){
try {
return gOPN(it);
} catch(e){
return windowNames.slice();
}
};
module.exports.f = function getOwnPropertyNames(it){
return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it));
};
/***/ },
/* 278 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
var has = __webpack_require__(25)
, toObject = __webpack_require__(68)
, IE_PROTO = __webpack_require__(65)('IE_PROTO')
, ObjectProto = Object.prototype;
module.exports = Object.getPrototypeOf || function(O){
O = toObject(O);
if(has(O, IE_PROTO))return O[IE_PROTO];
if(typeof O.constructor == 'function' && O instanceof O.constructor){
return O.constructor.prototype;
} return O instanceof Object ? ObjectProto : null;
};
/***/ },
/* 279 */
/***/ function(module, exports, __webpack_require__) {
// Works with __proto__ only. Old v8 can't work with null proto objects.
/* eslint-disable no-proto */
var isObject = __webpack_require__(35)
, anObject = __webpack_require__(22);
var check = function(O, proto){
anObject(O);
if(!isObject(proto) && proto !== null)throw TypeError(proto + ": can't set as prototype!");
};
module.exports = {
set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line
function(test, buggy, set){
try {
set = __webpack_require__(58)(Function.call, __webpack_require__(102).f(Object.prototype, '__proto__').set, 2);
set(test, []);
buggy = !(test instanceof Array);
} catch(e){ buggy = true; }
return function setPrototypeOf(O, proto){
check(O, proto);
if(buggy)O.__proto__ = proto;
else set(O, proto);
return O;
};
}({}, false) : undefined),
check: check
};
/***/ },
/* 280 */
/***/ function(module, exports, __webpack_require__) {
var toInteger = __webpack_require__(67)
, defined = __webpack_require__(59);
// true -> String#at
// false -> String#codePointAt
module.exports = function(TO_STRING){
return function(that, pos){
var s = String(defined(that))
, i = toInteger(pos)
, l = s.length
, a, b;
if(i < 0 || i >= l)return TO_STRING ? '' : undefined;
a = s.charCodeAt(i);
return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
? TO_STRING ? s.charAt(i) : a
: TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
};
};
/***/ },
/* 281 */
/***/ function(module, exports, __webpack_require__) {
var toInteger = __webpack_require__(67)
, max = Math.max
, min = Math.min;
module.exports = function(index, length){
index = toInteger(index);
return index < 0 ? max(index + length, 0) : min(index, length);
};
/***/ },
/* 282 */
/***/ function(module, exports, __webpack_require__) {
var anObject = __webpack_require__(22)
, get = __webpack_require__(107);
module.exports = __webpack_require__(13).getIterator = function(it){
var iterFn = get(it);
if(typeof iterFn != 'function')throw TypeError(it + ' is not iterable!');
return anObject(iterFn.call(it));
};
/***/ },
/* 283 */
/***/ function(module, exports, __webpack_require__) {
var classof = __webpack_require__(97)
, ITERATOR = __webpack_require__(14)('iterator')
, Iterators = __webpack_require__(30);
module.exports = __webpack_require__(13).isIterable = function(it){
var O = Object(it);
return O[ITERATOR] !== undefined
|| '@@iterator' in O
|| Iterators.hasOwnProperty(classof(O));
};
/***/ },
/* 284 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var ctx = __webpack_require__(58)
, $export = __webpack_require__(24)
, toObject = __webpack_require__(68)
, call = __webpack_require__(269)
, isArrayIter = __webpack_require__(267)
, toLength = __webpack_require__(106)
, createProperty = __webpack_require__(264)
, getIterFn = __webpack_require__(107);
$export($export.S + $export.F * !__webpack_require__(271)(function(iter){ Array.from(iter); }), 'Array', {
// 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined)
from: function from(arrayLike/*, mapfn = undefined, thisArg = undefined*/){
var O = toObject(arrayLike)
, C = typeof this == 'function' ? this : Array
, aLen = arguments.length
, mapfn = aLen > 1 ? arguments[1] : undefined
, mapping = mapfn !== undefined
, index = 0
, iterFn = getIterFn(O)
, length, result, step, iterator;
if(mapping)mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2);
// if object isn't iterable or it's array with default iterator - use simple case
if(iterFn != undefined && !(C == Array && isArrayIter(iterFn))){
for(iterator = iterFn.call(O), result = new C; !(step = iterator.next()).done; index++){
createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value);
}
} else {
length = toLength(O.length);
for(result = new C(length); length > index; index++){
createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]);
}
}
result.length = index;
return result;
}
});
/***/ },
/* 285 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var addToUnscopables = __webpack_require__(262)
, step = __webpack_require__(272)
, Iterators = __webpack_require__(30)
, toIObject = __webpack_require__(26);
// 22.1.3.4 Array.prototype.entries()
// 22.1.3.13 Array.prototype.keys()
// 22.1.3.29 Array.prototype.values()
// 22.1.3.30 Array.prototype[@@iterator]()
module.exports = __webpack_require__(101)(Array, 'Array', function(iterated, kind){
this._t = toIObject(iterated); // target
this._i = 0; // next index
this._k = kind; // kind
// 22.1.5.2.1 %ArrayIteratorPrototype%.next()
}, function(){
var O = this._t
, kind = this._k
, index = this._i++;
if(!O || index >= O.length){
this._t = undefined;
return step(1);
}
if(kind == 'keys' )return step(0, index);
if(kind == 'values')return step(0, O[index]);
return step(0, [index, O[index]]);
}, 'values');
// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
Iterators.Arguments = Iterators.Array;
addToUnscopables('keys');
addToUnscopables('values');
addToUnscopables('entries');
/***/ },
/* 286 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.3.1 Object.assign(target, source)
var $export = __webpack_require__(24);
$export($export.S + $export.F, 'Object', {assign: __webpack_require__(275)});
/***/ },
/* 287 */
/***/ function(module, exports, __webpack_require__) {
var $export = __webpack_require__(24)
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
$export($export.S, 'Object', {create: __webpack_require__(62)});
/***/ },
/* 288 */
/***/ function(module, exports, __webpack_require__) {
var $export = __webpack_require__(24);
// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
$export($export.S + $export.F * !__webpack_require__(23), 'Object', {defineProperty: __webpack_require__(20).f});
/***/ },
/* 289 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.3.19 Object.setPrototypeOf(O, proto)
var $export = __webpack_require__(24);
$export($export.S, 'Object', {setPrototypeOf: __webpack_require__(279).set});
/***/ },
/* 290 */
/***/ function(module, exports) {
/***/ },
/* 291 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
// ECMAScript 6 symbols shim
var global = __webpack_require__(19)
, has = __webpack_require__(25)
, DESCRIPTORS = __webpack_require__(23)
, $export = __webpack_require__(24)
, redefine = __webpack_require__(105)
, META = __webpack_require__(274).KEY
, $fails = __webpack_require__(34)
, shared = __webpack_require__(66)
, setToStringTag = __webpack_require__(64)
, uid = __webpack_require__(44)
, wks = __webpack_require__(14)
, wksExt = __webpack_require__(71)
, wksDefine = __webpack_require__(70)
, keyOf = __webpack_require__(273)
, enumKeys = __webpack_require__(265)
, isArray = __webpack_require__(268)
, anObject = __webpack_require__(22)
, toIObject = __webpack_require__(26)
, toPrimitive = __webpack_require__(69)
, createDesc = __webpack_require__(37)
, _create = __webpack_require__(62)
, gOPNExt = __webpack_require__(277)
, $GOPD = __webpack_require__(102)
, $DP = __webpack_require__(20)
, $keys = __webpack_require__(36)
, gOPD = $GOPD.f
, dP = $DP.f
, gOPN = gOPNExt.f
, $Symbol = global.Symbol
, $JSON = global.JSON
, _stringify = $JSON && $JSON.stringify
, PROTOTYPE = 'prototype'
, HIDDEN = wks('_hidden')
, TO_PRIMITIVE = wks('toPrimitive')
, isEnum = {}.propertyIsEnumerable
, SymbolRegistry = shared('symbol-registry')
, AllSymbols = shared('symbols')
, OPSymbols = shared('op-symbols')
, ObjectProto = Object[PROTOTYPE]
, USE_NATIVE = typeof $Symbol == 'function'
, QObject = global.QObject;
// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
var setSymbolDesc = DESCRIPTORS && $fails(function(){
return _create(dP({}, 'a', {
get: function(){ return dP(this, 'a', {value: 7}).a; }
})).a != 7;
}) ? function(it, key, D){
var protoDesc = gOPD(ObjectProto, key);
if(protoDesc)delete ObjectProto[key];
dP(it, key, D);
if(protoDesc && it !== ObjectProto)dP(ObjectProto, key, protoDesc);
} : dP;
var wrap = function(tag){
var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]);
sym._k = tag;
return sym;
};
var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function(it){
return typeof it == 'symbol';
} : function(it){
return it instanceof $Symbol;
};
var $defineProperty = function defineProperty(it, key, D){
if(it === ObjectProto)$defineProperty(OPSymbols, key, D);
anObject(it);
key = toPrimitive(key, true);
anObject(D);
if(has(AllSymbols, key)){
if(!D.enumerable){
if(!has(it, HIDDEN))dP(it, HIDDEN, createDesc(1, {}));
it[HIDDEN][key] = true;
} else {
if(has(it, HIDDEN) && it[HIDDEN][key])it[HIDDEN][key] = false;
D = _create(D, {enumerable: createDesc(0, false)});
} return setSymbolDesc(it, key, D);
} return dP(it, key, D);
};
var $defineProperties = function defineProperties(it, P){
anObject(it);
var keys = enumKeys(P = toIObject(P))
, i = 0
, l = keys.length
, key;
while(l > i)$defineProperty(it, key = keys[i++], P[key]);
return it;
};
var $create = function create(it, P){
return P === undefined ? _create(it) : $defineProperties(_create(it), P);
};
var $propertyIsEnumerable = function propertyIsEnumerable(key){
var E = isEnum.call(this, key = toPrimitive(key, true));
if(this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key))return false;
return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true;
};
var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key){
it = toIObject(it);
key = toPrimitive(key, true);
if(it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key))return;
var D = gOPD(it, key);
if(D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key]))D.enumerable = true;
return D;
};
var $getOwnPropertyNames = function getOwnPropertyNames(it){
var names = gOPN(toIObject(it))
, result = []
, i = 0
, key;
while(names.length > i){
if(!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META)result.push(key);
} return result;
};
var $getOwnPropertySymbols = function getOwnPropertySymbols(it){
var IS_OP = it === ObjectProto
, names = gOPN(IS_OP ? OPSymbols : toIObject(it))
, result = []
, i = 0
, key;
while(names.length > i){
if(has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true))result.push(AllSymbols[key]);
} return result;
};
// 19.4.1.1 Symbol([description])
if(!USE_NATIVE){
$Symbol = function Symbol(){
if(this instanceof $Symbol)throw TypeError('Symbol is not a constructor!');
var tag = uid(arguments.length > 0 ? arguments[0] : undefined);
var $set = function(value){
if(this === ObjectProto)$set.call(OPSymbols, value);
if(has(this, HIDDEN) && has(this[HIDDEN], tag))this[HIDDEN][tag] = false;
setSymbolDesc(this, tag, createDesc(1, value));
};
if(DESCRIPTORS && setter)setSymbolDesc(ObjectProto, tag, {configurable: true, set: $set});
return wrap(tag);
};
redefine($Symbol[PROTOTYPE], 'toString', function toString(){
return this._k;
});
$GOPD.f = $getOwnPropertyDescriptor;
$DP.f = $defineProperty;
__webpack_require__(103).f = gOPNExt.f = $getOwnPropertyNames;
__webpack_require__(43).f = $propertyIsEnumerable;
__webpack_require__(63).f = $getOwnPropertySymbols;
if(DESCRIPTORS && !__webpack_require__(61)){
redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);
}
wksExt.f = function(name){
return wrap(wks(name));
}
}
$export($export.G + $export.W + $export.F * !USE_NATIVE, {Symbol: $Symbol});
for(var symbols = (
// 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14
'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'
).split(','), i = 0; symbols.length > i; )wks(symbols[i++]);
for(var symbols = $keys(wks.store), i = 0; symbols.length > i; )wksDefine(symbols[i++]);
$export($export.S + $export.F * !USE_NATIVE, 'Symbol', {
// 19.4.2.1 Symbol.for(key)
'for': function(key){
return has(SymbolRegistry, key += '')
? SymbolRegistry[key]
: SymbolRegistry[key] = $Symbol(key);
},
// 19.4.2.5 Symbol.keyFor(sym)
keyFor: function keyFor(key){
if(isSymbol(key))return keyOf(SymbolRegistry, key);
throw TypeError(key + ' is not a symbol!');
},
useSetter: function(){ setter = true; },
useSimple: function(){ setter = false; }
});
$export($export.S + $export.F * !USE_NATIVE, 'Object', {
// 19.1.2.2 Object.create(O [, Properties])
create: $create,
// 19.1.2.4 Object.defineProperty(O, P, Attributes)
defineProperty: $defineProperty,
// 19.1.2.3 Object.defineProperties(O, Properties)
defineProperties: $defineProperties,
// 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
// 19.1.2.7 Object.getOwnPropertyNames(O)
getOwnPropertyNames: $getOwnPropertyNames,
// 19.1.2.8 Object.getOwnPropertySymbols(O)
getOwnPropertySymbols: $getOwnPropertySymbols
});
// 24.3.2 JSON.stringify(value [, replacer [, space]])
$JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function(){
var S = $Symbol();
// MS Edge converts symbol values to JSON as {}
// WebKit converts symbol values to JSON as null
// V8 throws on boxed symbols
return _stringify([S]) != '[null]' || _stringify({a: S}) != '{}' || _stringify(Object(S)) != '{}';
})), 'JSON', {
stringify: function stringify(it){
if(it === undefined || isSymbol(it))return; // IE8 returns string on undefined
var args = [it]
, i = 1
, replacer, $replacer;
while(arguments.length > i)args.push(arguments[i++]);
replacer = args[1];
if(typeof replacer == 'function')$replacer = replacer;
if($replacer || !isArray(replacer))replacer = function(key, value){
if($replacer)value = $replacer.call(this, key, value);
if(!isSymbol(value))return value;
};
args[1] = replacer;
return _stringify.apply($JSON, args);
}
});
// 19.4.3.4 Symbol.prototype[@@toPrimitive](hint)
$Symbol[PROTOTYPE][TO_PRIMITIVE] || __webpack_require__(29)($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);
// 19.4.3.5 Symbol.prototype[@@toStringTag]
setToStringTag($Symbol, 'Symbol');
// 20.2.1.9 Math[@@toStringTag]
setToStringTag(Math, 'Math', true);
// 24.3.3 JSON[@@toStringTag]
setToStringTag(global.JSON, 'JSON', true);
/***/ },
/* 292 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(70)('asyncIterator');
/***/ },
/* 293 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(70)('observable');
/***/ },
/* 294 */
/***/ function(module, exports, __webpack_require__) {
/**
* Copyright 2013-present, 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.
*
*/
'use strict';
var _assign = __webpack_require__(12);
var emptyObject = __webpack_require__(353);
var _invariant = __webpack_require__(39);
if (true) {
var warning = __webpack_require__(40);
}
var MIXINS_KEY = 'mixins';
// Helper function to allow the creation of anonymous functions which do not
// have .name set to the name of the variable being assigned to.
function identity(fn) {
return fn;
}
var ReactPropTypeLocationNames;
if (true) {
ReactPropTypeLocationNames = {
prop: 'prop',
context: 'context',
childContext: 'child context',
};
} else {
ReactPropTypeLocationNames = {};
}
function factory(ReactComponent, isValidElement, ReactNoopUpdateQueue) {
/**
* Policies that describe methods in `ReactClassInterface`.
*/
var injectedMixins = [];
/**
* Composite components are higher-level components that compose other composite
* or host components.
*
* To create a new type of `ReactClass`, pass a specification of
* your new class to `React.createClass`. The only requirement of your class
* specification is that you implement a `render` method.
*
* var MyComponent = React.createClass({
* render: function() {
* return
Hello World
;
* }
* });
*
* The class specification supports a specific protocol of methods that have
* special meaning (e.g. `render`). See `ReactClassInterface` for
* more the comprehensive protocol. Any other properties and methods in the
* class specification will be available on the prototype.
*
* @interface ReactClassInterface
* @internal
*/
var ReactClassInterface = {
/**
* An array of Mixin objects to include when defining your component.
*
* @type {array}
* @optional
*/
mixins: 'DEFINE_MANY',
/**
* An object containing properties and methods that should be defined on
* the component's constructor instead of its prototype (static methods).
*
* @type {object}
* @optional
*/
statics: 'DEFINE_MANY',
/**
* Definition of prop types for this component.
*
* @type {object}
* @optional
*/
propTypes: 'DEFINE_MANY',
/**
* Definition of context types for this component.
*
* @type {object}
* @optional
*/
contextTypes: 'DEFINE_MANY',
/**
* Definition of context types this component sets for its children.
*
* @type {object}
* @optional
*/
childContextTypes: 'DEFINE_MANY',
// ==== Definition methods ====
/**
* Invoked when the component is mounted. Values in the mapping will be set on
* `this.props` if that prop is not specified (i.e. using an `in` check).
*
* This method is invoked before `getInitialState` and therefore cannot rely
* on `this.state` or use `this.setState`.
*
* @return {object}
* @optional
*/
getDefaultProps: 'DEFINE_MANY_MERGED',
/**
* Invoked once before the component is mounted. The return value will be used
* as the initial value of `this.state`.
*
* getInitialState: function() {
* return {
* isOn: false,
* fooBaz: new BazFoo()
* }
* }
*
* @return {object}
* @optional
*/
getInitialState: 'DEFINE_MANY_MERGED',
/**
* @return {object}
* @optional
*/
getChildContext: 'DEFINE_MANY_MERGED',
/**
* Uses props from `this.props` and state from `this.state` to render the
* structure of the component.
*
* No guarantees are made about when or how often this method is invoked, so
* it must not have side effects.
*
* render: function() {
* var name = this.props.name;
* return
Hello, {name}!
;
* }
*
* @return {ReactComponent}
* @nosideeffects
* @required
*/
render: 'DEFINE_ONCE',
// ==== Delegate methods ====
/**
* Invoked when the component is initially created and about to be mounted.
* This may have side effects, but any external subscriptions or data created
* by this method must be cleaned up in `componentWillUnmount`.
*
* @optional
*/
componentWillMount: 'DEFINE_MANY',
/**
* Invoked when the component has been mounted and has a DOM representation.
* However, there is no guarantee that the DOM node is in the document.
*
* Use this as an opportunity to operate on the DOM when the component has
* been mounted (initialized and rendered) for the first time.
*
* @param {DOMElement} rootNode DOM element representing the component.
* @optional
*/
componentDidMount: 'DEFINE_MANY',
/**
* Invoked before the component receives new props.
*
* Use this as an opportunity to react to a prop transition by updating the
* state using `this.setState`. Current props are accessed via `this.props`.
*
* componentWillReceiveProps: function(nextProps, nextContext) {
* this.setState({
* likesIncreasing: nextProps.likeCount > this.props.likeCount
* });
* }
*
* NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop
* transition may cause a state change, but the opposite is not true. If you
* need it, you are probably looking for `componentWillUpdate`.
*
* @param {object} nextProps
* @optional
*/
componentWillReceiveProps: 'DEFINE_MANY',
/**
* Invoked while deciding if the component should be updated as a result of
* receiving new props, state and/or context.
*
* Use this as an opportunity to `return false` when you're certain that the
* transition to the new props/state/context will not require a component
* update.
*
* shouldComponentUpdate: function(nextProps, nextState, nextContext) {
* return !equal(nextProps, this.props) ||
* !equal(nextState, this.state) ||
* !equal(nextContext, this.context);
* }
*
* @param {object} nextProps
* @param {?object} nextState
* @param {?object} nextContext
* @return {boolean} True if the component should update.
* @optional
*/
shouldComponentUpdate: 'DEFINE_ONCE',
/**
* Invoked when the component is about to update due to a transition from
* `this.props`, `this.state` and `this.context` to `nextProps`, `nextState`
* and `nextContext`.
*
* Use this as an opportunity to perform preparation before an update occurs.
*
* NOTE: You **cannot** use `this.setState()` in this method.
*
* @param {object} nextProps
* @param {?object} nextState
* @param {?object} nextContext
* @param {ReactReconcileTransaction} transaction
* @optional
*/
componentWillUpdate: 'DEFINE_MANY',
/**
* Invoked when the component's DOM representation has been updated.
*
* Use this as an opportunity to operate on the DOM when the component has
* been updated.
*
* @param {object} prevProps
* @param {?object} prevState
* @param {?object} prevContext
* @param {DOMElement} rootNode DOM element representing the component.
* @optional
*/
componentDidUpdate: 'DEFINE_MANY',
/**
* Invoked when the component is about to be removed from its parent and have
* its DOM representation destroyed.
*
* Use this as an opportunity to deallocate any external resources.
*
* NOTE: There is no `componentDidUnmount` since your component will have been
* destroyed by that point.
*
* @optional
*/
componentWillUnmount: 'DEFINE_MANY',
// ==== Advanced methods ====
/**
* Updates the component's currently mounted DOM representation.
*
* By default, this implements React's rendering and reconciliation algorithm.
* Sophisticated clients may wish to override this.
*
* @param {ReactReconcileTransaction} transaction
* @internal
* @overridable
*/
updateComponent: 'OVERRIDE_BASE'
};
/**
* Mapping from class specification keys to special processing functions.
*
* Although these are declared like instance properties in the specification
* when defining classes using `React.createClass`, they are actually static
* and are accessible on the constructor instead of the prototype. Despite
* being static, they must be defined outside of the "statics" key under
* which all other static methods are defined.
*/
var RESERVED_SPEC_KEYS = {
displayName: function (Constructor, displayName) {
Constructor.displayName = displayName;
},
mixins: function (Constructor, mixins) {
if (mixins) {
for (var i = 0; i < mixins.length; i++) {
mixSpecIntoComponent(Constructor, mixins[i]);
}
}
},
childContextTypes: function (Constructor, childContextTypes) {
if (true) {
validateTypeDef(Constructor, childContextTypes, 'childContext');
}
Constructor.childContextTypes = _assign({}, Constructor.childContextTypes, childContextTypes);
},
contextTypes: function (Constructor, contextTypes) {
if (true) {
validateTypeDef(Constructor, contextTypes, 'context');
}
Constructor.contextTypes = _assign({}, Constructor.contextTypes, contextTypes);
},
/**
* Special case getDefaultProps which should move into statics but requires
* automatic merging.
*/
getDefaultProps: function (Constructor, getDefaultProps) {
if (Constructor.getDefaultProps) {
Constructor.getDefaultProps = createMergedResultFunction(Constructor.getDefaultProps, getDefaultProps);
} else {
Constructor.getDefaultProps = getDefaultProps;
}
},
propTypes: function (Constructor, propTypes) {
if (true) {
validateTypeDef(Constructor, propTypes, 'prop');
}
Constructor.propTypes = _assign({}, Constructor.propTypes, propTypes);
},
statics: function (Constructor, statics) {
mixStaticSpecIntoComponent(Constructor, statics);
},
autobind: function () {} };
function validateTypeDef(Constructor, typeDef, location) {
for (var propName in typeDef) {
if (typeDef.hasOwnProperty(propName)) {
// use a warning instead of an _invariant so components
// don't show up in prod but only in __DEV__
true ? warning(typeof typeDef[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', Constructor.displayName || 'ReactClass', ReactPropTypeLocationNames[location], propName) : void 0;
}
}
}
function validateMethodOverride(isAlreadyDefined, name) {
var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null;
// Disallow overriding of base class methods unless explicitly allowed.
if (ReactClassMixin.hasOwnProperty(name)) {
_invariant(specPolicy === 'OVERRIDE_BASE', 'ReactClassInterface: You are attempting to override ' + '`%s` from your class specification. Ensure that your method names ' + 'do not overlap with React methods.', name);
}
// Disallow defining methods more than once unless explicitly allowed.
if (isAlreadyDefined) {
_invariant(specPolicy === 'DEFINE_MANY' || specPolicy === 'DEFINE_MANY_MERGED', 'ReactClassInterface: You are attempting to define ' + '`%s` on your component more than once. This conflict may be due ' + 'to a mixin.', name);
}
}
/**
* Mixin helper which handles policy validation and reserved
* specification keys when building React classes.
*/
function mixSpecIntoComponent(Constructor, spec) {
if (!spec) {
if (true) {
var typeofSpec = typeof spec;
var isMixinValid = typeofSpec === 'object' && spec !== null;
true ? warning(isMixinValid, '%s: You\'re attempting to include a mixin that is either null ' + 'or not an object. Check the mixins included by the component, ' + 'as well as any mixins they include themselves. ' + 'Expected object but got %s.', Constructor.displayName || 'ReactClass', spec === null ? null : typeofSpec) : void 0;
}
return;
}
_invariant(typeof spec !== 'function', 'ReactClass: You\'re attempting to ' + 'use a component class or function as a mixin. Instead, just use a ' + 'regular object.');
_invariant(!isValidElement(spec), 'ReactClass: You\'re attempting to ' + 'use a component as a mixin. Instead, just use a regular object.');
var proto = Constructor.prototype;
var autoBindPairs = proto.__reactAutoBindPairs;
// By handling mixins before any other properties, we ensure the same
// chaining order is applied to methods with DEFINE_MANY policy, whether
// mixins are listed before or after these methods in the spec.
if (spec.hasOwnProperty(MIXINS_KEY)) {
RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins);
}
for (var name in spec) {
if (!spec.hasOwnProperty(name)) {
continue;
}
if (name === MIXINS_KEY) {
// We have already handled mixins in a special case above.
continue;
}
var property = spec[name];
var isAlreadyDefined = proto.hasOwnProperty(name);
validateMethodOverride(isAlreadyDefined, name);
if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) {
RESERVED_SPEC_KEYS[name](Constructor, property);
} else {
// Setup methods on prototype:
// The following member methods should not be automatically bound:
// 1. Expected ReactClass methods (in the "interface").
// 2. Overridden methods (that were mixed in).
var isReactClassMethod = ReactClassInterface.hasOwnProperty(name);
var isFunction = typeof property === 'function';
var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false;
if (shouldAutoBind) {
autoBindPairs.push(name, property);
proto[name] = property;
} else {
if (isAlreadyDefined) {
var specPolicy = ReactClassInterface[name];
// These cases should already be caught by validateMethodOverride.
_invariant(isReactClassMethod && (specPolicy === 'DEFINE_MANY_MERGED' || specPolicy === 'DEFINE_MANY'), 'ReactClass: Unexpected spec policy %s for key %s ' + 'when mixing in component specs.', specPolicy, name);
// For methods which are defined more than once, call the existing
// methods before calling the new property, merging if appropriate.
if (specPolicy === 'DEFINE_MANY_MERGED') {
proto[name] = createMergedResultFunction(proto[name], property);
} else if (specPolicy === 'DEFINE_MANY') {
proto[name] = createChainedFunction(proto[name], property);
}
} else {
proto[name] = property;
if (true) {
// Add verbose displayName to the function, which helps when looking
// at profiling tools.
if (typeof property === 'function' && spec.displayName) {
proto[name].displayName = spec.displayName + '_' + name;
}
}
}
}
}
}
}
function mixStaticSpecIntoComponent(Constructor, statics) {
if (!statics) {
return;
}
for (var name in statics) {
var property = statics[name];
if (!statics.hasOwnProperty(name)) {
continue;
}
var isReserved = name in RESERVED_SPEC_KEYS;
_invariant(!isReserved, 'ReactClass: You are attempting to define a reserved ' + 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' + 'as an instance property instead; it will still be accessible on the ' + 'constructor.', name);
var isInherited = name in Constructor;
_invariant(!isInherited, 'ReactClass: You are attempting to define ' + '`%s` on your component more than once. This conflict may be ' + 'due to a mixin.', name);
Constructor[name] = property;
}
}
/**
* Merge two objects, but throw if both contain the same key.
*
* @param {object} one The first object, which is mutated.
* @param {object} two The second object
* @return {object} one after it has been mutated to contain everything in two.
*/
function mergeIntoWithNoDuplicateKeys(one, two) {
_invariant(one && two && typeof one === 'object' && typeof two === 'object', 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.');
for (var key in two) {
if (two.hasOwnProperty(key)) {
_invariant(one[key] === undefined, 'mergeIntoWithNoDuplicateKeys(): ' + 'Tried to merge two objects with the same key: `%s`. This conflict ' + 'may be due to a mixin; in particular, this may be caused by two ' + 'getInitialState() or getDefaultProps() methods returning objects ' + 'with clashing keys.', key);
one[key] = two[key];
}
}
return one;
}
/**
* Creates a function that invokes two functions and merges their return values.
*
* @param {function} one Function to invoke first.
* @param {function} two Function to invoke second.
* @return {function} Function that invokes the two argument functions.
* @private
*/
function createMergedResultFunction(one, two) {
return function mergedResult() {
var a = one.apply(this, arguments);
var b = two.apply(this, arguments);
if (a == null) {
return b;
} else if (b == null) {
return a;
}
var c = {};
mergeIntoWithNoDuplicateKeys(c, a);
mergeIntoWithNoDuplicateKeys(c, b);
return c;
};
}
/**
* Creates a function that invokes two functions and ignores their return vales.
*
* @param {function} one Function to invoke first.
* @param {function} two Function to invoke second.
* @return {function} Function that invokes the two argument functions.
* @private
*/
function createChainedFunction(one, two) {
return function chainedFunction() {
one.apply(this, arguments);
two.apply(this, arguments);
};
}
/**
* Binds a method to the component.
*
* @param {object} component Component whose method is going to be bound.
* @param {function} method Method to be bound.
* @return {function} The bound method.
*/
function bindAutoBindMethod(component, method) {
var boundMethod = method.bind(component);
if (true) {
boundMethod.__reactBoundContext = component;
boundMethod.__reactBoundMethod = method;
boundMethod.__reactBoundArguments = null;
var componentName = component.constructor.displayName;
var _bind = boundMethod.bind;
boundMethod.bind = function (newThis) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
// User is trying to bind() an autobound method; we effectively will
// ignore the value of "this" that the user is trying to use, so
// let's warn.
if (newThis !== component && newThis !== null) {
true ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : void 0;
} else if (!args.length) {
true ? warning(false, 'bind(): You are binding a component method to the component. ' + 'React does this for you automatically in a high-performance ' + 'way, so you can safely remove this call. See %s', componentName) : void 0;
return boundMethod;
}
var reboundMethod = _bind.apply(boundMethod, arguments);
reboundMethod.__reactBoundContext = component;
reboundMethod.__reactBoundMethod = method;
reboundMethod.__reactBoundArguments = args;
return reboundMethod;
};
}
return boundMethod;
}
/**
* Binds all auto-bound methods in a component.
*
* @param {object} component Component whose method is going to be bound.
*/
function bindAutoBindMethods(component) {
var pairs = component.__reactAutoBindPairs;
for (var i = 0; i < pairs.length; i += 2) {
var autoBindKey = pairs[i];
var method = pairs[i + 1];
component[autoBindKey] = bindAutoBindMethod(component, method);
}
}
var IsMountedMixin = {
componentDidMount: function () {
this.__isMounted = true;
},
componentWillUnmount: function () {
this.__isMounted = false;
}
};
/**
* Add more to the ReactClass base class. These are all legacy features and
* therefore not already part of the modern ReactComponent.
*/
var ReactClassMixin = {
/**
* TODO: This will be deprecated because state should always keep a consistent
* type signature and the only use case for this, is to avoid that.
*/
replaceState: function (newState, callback) {
this.updater.enqueueReplaceState(this, newState, callback);
},
/**
* Checks whether or not this composite component is mounted.
* @return {boolean} True if mounted, false otherwise.
* @protected
* @final
*/
isMounted: function () {
if (true) {
true ? warning(this.__didWarnIsMounted, '%s: isMounted is deprecated. Instead, make sure to clean up ' + 'subscriptions and pending requests in componentWillUnmount to ' + 'prevent memory leaks.', this.constructor && this.constructor.displayName || this.name || 'Component') : void 0;
this.__didWarnIsMounted = true;
}
return !!this.__isMounted;
}
};
var ReactClassComponent = function () {};
_assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin);
/**
* Creates a composite component class given a class specification.
* See https://facebook.github.io/react/docs/top-level-api.html#react.createclass
*
* @param {object} spec Class specification (which must define `render`).
* @return {function} Component constructor function.
* @public
*/
function createClass(spec) {
// To keep our warnings more understandable, we'll use a little hack here to
// ensure that Constructor.name !== 'Constructor'. This makes sure we don't
// unnecessarily identify a class without displayName as 'Constructor'.
var Constructor = identity(function (props, context, updater) {
// This constructor gets overridden by mocks. The argument is used
// by mocks to assert on what gets mounted.
if (true) {
true ? warning(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : void 0;
}
// Wire up auto-binding
if (this.__reactAutoBindPairs.length) {
bindAutoBindMethods(this);
}
this.props = props;
this.context = context;
this.refs = emptyObject;
this.updater = updater || ReactNoopUpdateQueue;
this.state = null;
// ReactClasses doesn't have constructors. Instead, they use the
// getInitialState and componentWillMount methods for initialization.
var initialState = this.getInitialState ? this.getInitialState() : null;
if (true) {
// We allow auto-mocks to proceed as if they're returning null.
if (initialState === undefined && this.getInitialState._isMockFunction) {
// This is probably bad practice. Consider warning here and
// deprecating this convenience.
initialState = null;
}
}
_invariant(typeof initialState === 'object' && !Array.isArray(initialState), '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent');
this.state = initialState;
});
Constructor.prototype = new ReactClassComponent();
Constructor.prototype.constructor = Constructor;
Constructor.prototype.__reactAutoBindPairs = [];
injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor));
mixSpecIntoComponent(Constructor, IsMountedMixin);
mixSpecIntoComponent(Constructor, spec);
// Initialize the defaultProps property after all mixins have been merged.
if (Constructor.getDefaultProps) {
Constructor.defaultProps = Constructor.getDefaultProps();
}
if (true) {
// This is a tag to indicate that the use of these method names is ok,
// since it's used with createClass. If it's not, then it's likely a
// mistake so we'll warn you to use the static property, property
// initializer or constructor respectively.
if (Constructor.getDefaultProps) {
Constructor.getDefaultProps.isReactClassApproved = {};
}
if (Constructor.prototype.getInitialState) {
Constructor.prototype.getInitialState.isReactClassApproved = {};
}
}
_invariant(Constructor.prototype.render, 'createClass(...): Class specification must implement a `render` method.');
if (true) {
true ? warning(!Constructor.prototype.componentShouldUpdate, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', spec.displayName || 'A component') : void 0;
true ? warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component') : void 0;
}
// Reduce time spent doing lookups by setting these on the prototype.
for (var methodName in ReactClassInterface) {
if (!Constructor.prototype[methodName]) {
Constructor.prototype[methodName] = null;
}
}
return Constructor;
}
return createClass;
}
module.exports = factory;
/***/ },
/* 295 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
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' && typeof document !== '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);
});
}
};
exports["default"] = TransitionEvents;
module.exports = exports['default'];
/***/ },
/* 296 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _utils = __webpack_require__(38);
var _utils2 = _interopRequireDefault(_utils);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
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'];
/***/ },
/* 297 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
/**
* 获取 node 上的 align 对齐点 相对于页面的坐标
*/
function getAlignOffset(region, align) {
var V = align.charAt(0);
var H = align.charAt(1);
var w = region.width;
var h = region.height;
var x = void 0;
var y = void 0;
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'];
/***/ },
/* 298 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _getAlignOffset = __webpack_require__(297);
var _getAlignOffset2 = _interopRequireDefault(_getAlignOffset);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function getElFuturePos(elRegion, refNodeRegion, points, offset, targetOffset) {
var xy = void 0;
var diff = void 0;
var p1 = void 0;
var p2 = void 0;
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'];
/***/ },
/* 299 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _utils = __webpack_require__(38);
var _utils2 = _interopRequireDefault(_utils);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function getRegion(node) {
var offset = void 0;
var w = void 0;
var h = void 0;
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'];
/***/ },
/* 300 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _utils = __webpack_require__(38);
var _utils2 = _interopRequireDefault(_utils);
var _getOffsetParent = __webpack_require__(109);
var _getOffsetParent2 = _interopRequireDefault(_getOffsetParent);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/**
* 获得元素的显示部分的区域
*/
function getVisibleRectForElement(element) {
var visibleRect = {
left: 0,
right: Infinity,
top: 0,
bottom: Infinity
};
var el = (0, _getOffsetParent2["default"])(element);
var scrollX = void 0;
var scrollY = void 0;
var winSize = void 0;
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'];
/***/ },
/* 301 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _utils = __webpack_require__(38);
var _utils2 = _interopRequireDefault(_utils);
var _getOffsetParent = __webpack_require__(109);
var _getOffsetParent2 = _interopRequireDefault(_getOffsetParent);
var _getVisibleRectForElement = __webpack_require__(300);
var _getVisibleRectForElement2 = _interopRequireDefault(_getVisibleRectForElement);
var _adjustForViewport = __webpack_require__(296);
var _adjustForViewport2 = _interopRequireDefault(_adjustForViewport);
var _getRegion = __webpack_require__(299);
var _getRegion2 = _interopRequireDefault(_getRegion);
var _getElFuturePos = __webpack_require__(298);
var _getElFuturePos2 = _interopRequireDefault(_getElFuturePos);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
// http://yiminghe.iteye.com/blog/1124720
/**
* align dom node flexibly
* @author yiminghe@gmail.com
*/
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;
}
function isCompleteFailX(elFuturePos, elRegion, visibleRect) {
return elFuturePos.left > visibleRect.right || elFuturePos.left + elRegion.width < visibleRect.left;
}
function isCompleteFailY(elFuturePos, elRegion, visibleRect) {
return elFuturePos.top > visibleRect.bottom || elFuturePos.top + elRegion.height < visibleRect.top;
}
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;
}
function flipOffset(offset, index) {
offset[index] = -offset[index];
return offset;
}
function convertOffset(str, offsetLen) {
var n = void 0;
if (/%$/.test(str)) {
n = parseInt(str.substring(0, str.length - 1), 10) / 100 * offsetLen;
} else {
n = parseInt(str, 10);
}
return n || 0;
}
function normalizeOffset(offset, el) {
offset[0] = convertOffset(offset[0], el.width);
offset[1] = convertOffset(offset[1], el.height);
}
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)) {
// 对齐位置反下
var newPoints = flip(points, /[lr]/ig, {
l: 'r',
r: 'l'
});
// 偏移量也反下
var newOffset = flipOffset(offset, 0);
var newTargetOffset = flipOffset(targetOffset, 0);
var newElFuturePos = (0, _getElFuturePos2["default"])(elRegion, refNodeRegion, newPoints, newOffset, newTargetOffset);
if (!isCompleteFailX(newElFuturePos, elRegion, visibleRect)) {
fail = 1;
points = newPoints;
offset = newOffset;
targetOffset = newTargetOffset;
}
}
}
if (overflow.adjustY) {
// 如果纵向不能放下
if (isFailY(elFuturePos, elRegion, visibleRect)) {
// 对齐位置反下
var _newPoints = flip(points, /[tb]/ig, {
t: 'b',
b: 't'
});
// 偏移量也反下
var _newOffset = flipOffset(offset, 1);
var _newTargetOffset = flipOffset(targetOffset, 1);
var _newElFuturePos = (0, _getElFuturePos2["default"])(elRegion, refNodeRegion, _newPoints, _newOffset, _newTargetOffset);
if (!isCompleteFailY(_newElFuturePos, elRegion, visibleRect)) {
fail = 1;
points = _newPoints;
offset = _newOffset;
targetOffset = _newTargetOffset;
}
}
}
// 如果失败,重新计算当前节点将要被放置的位置
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', _utils2["default"].width(source) + newElRegion.width - elRegion.width);
}
if (newElRegion.height !== elRegion.height) {
_utils2["default"].css(source, 'height', _utils2["default"].height(source) + newElRegion.height - elRegion.height);
}
// https://github.com/kissyteam/kissy/issues/190
// 相对于屏幕位置没变,而 left/top 变了
// 例如
_utils2["default"].offset(source, {
left: newElRegion.left,
top: newElRegion.top
}, {
useCssRight: align.useCssRight,
useCssBottom: align.useCssBottom,
useCssTransform: align.useCssTransform
});
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:
* - 增加智能对齐,以及大小调整选项
**/
module.exports = exports['default'];
/***/ },
/* 302 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getTransformName = getTransformName;
exports.setTransitionProperty = setTransitionProperty;
exports.getTransitionProperty = getTransitionProperty;
exports.getTransformXY = getTransformXY;
exports.setTransformXY = setTransformXY;
var vendorPrefix = void 0;
var jsCssMap = {
Webkit: '-webkit-',
Moz: '-moz-',
// IE did it wrong again ...
ms: '-ms-',
O: '-o-'
};
function getVendorPrefix() {
if (vendorPrefix !== undefined) {
return vendorPrefix;
}
vendorPrefix = '';
var style = document.createElement('p').style;
var testProp = 'Transform';
for (var key in jsCssMap) {
if (key + testProp in style) {
vendorPrefix = key;
}
}
return vendorPrefix;
}
function getTransitionName() {
return getVendorPrefix() ? getVendorPrefix() + 'TransitionProperty' : 'transitionProperty';
}
function getTransformName() {
return getVendorPrefix() ? getVendorPrefix() + 'Transform' : 'transform';
}
function setTransitionProperty(node, value) {
var name = getTransitionName();
if (name) {
node.style[name] = value;
if (name !== 'transitionProperty') {
node.style.transitionProperty = value;
}
}
}
function setTransform(node, value) {
var name = getTransformName();
if (name) {
node.style[name] = value;
if (name !== 'transform') {
node.style.transform = value;
}
}
}
function getTransitionProperty(node) {
return node.style.transitionProperty || node.style[getTransitionName()];
}
function getTransformXY(node) {
var style = window.getComputedStyle(node, null);
var transform = style.getPropertyValue('transform') || style.getPropertyValue(getTransformName());
if (transform && transform !== 'none') {
var matrix = transform.replace(/[^0-9\-.,]/g, '').split(',');
return { x: parseFloat(matrix[12] || matrix[4], 0), y: parseFloat(matrix[13] || matrix[5], 0) };
}
return {
x: 0,
y: 0
};
}
var matrix2d = /matrix\((.*)\)/;
var matrix3d = /matrix3d\((.*)\)/;
function setTransformXY(node, xy) {
var style = window.getComputedStyle(node, null);
var transform = style.getPropertyValue('transform') || style.getPropertyValue(getTransformName());
if (transform && transform !== 'none') {
var arr = void 0;
var match2d = transform.match(matrix2d);
if (match2d) {
match2d = match2d[1];
arr = match2d.split(',').map(function (item) {
return parseFloat(item, 10);
});
arr[4] = xy.x;
arr[5] = xy.y;
setTransform(node, 'matrix(' + arr.join(',') + ')');
} else {
var match3d = transform.match(matrix3d)[1];
arr = match3d.split(',').map(function (item) {
return parseFloat(item, 10);
});
arr[12] = xy.x;
arr[13] = xy.y;
setTransform(node, 'matrix3d(' + arr.join(',') + ')');
}
} else {
setTransform(node, 'translateX(' + xy.x + 'px) translateY(' + xy.y + 'px) translateZ(0)');
}
}
/***/ },
/* 303 */
/***/ function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;/*!
Copyright (c) 2015 Jed Watson.
Based on code that is Copyright 2013-2015, Facebook, Inc.
All rights reserved.
*/
/* global define */
(function () {
'use strict';
var canUseDOM = !!(
typeof window !== 'undefined' &&
window.document &&
window.document.createElement
);
var ExecutionEnvironment = {
canUseDOM: canUseDOM,
canUseWorkers: typeof Worker !== 'undefined',
canUseEventListeners:
canUseDOM && !!(window.addEventListener || window.attachEvent),
canUseViewport: canUseDOM && !!window.screen
};
if (true) {
!(__WEBPACK_AMD_DEFINE_RESULT__ = function () {
return ExecutionEnvironment;
}.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else if (typeof module !== 'undefined' && module.exports) {
module.exports = ExecutionEnvironment;
} else {
window.ExecutionEnvironment = ExecutionEnvironment;
}
}());
/***/ },
/* 304 */
/***/ function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ },
/* 305 */
304,
/* 306 */
304,
/* 307 */
304,
/* 308 */
304,
/* 309 */
304,
/* 310 */
304,
/* 311 */
304,
/* 312 */
304,
/* 313 */
304,
/* 314 */
304,
/* 315 */
304,
/* 316 */
304,
/* 317 */
304,
/* 318 */
304,
/* 319 */
304,
/* 320 */
304,
/* 321 */
304,
/* 322 */
304,
/* 323 */
304,
/* 324 */
304,
/* 325 */
304,
/* 326 */
304,
/* 327 */
304,
/* 328 */
304,
/* 329 */
304,
/* 330 */
304,
/* 331 */
304,
/* 332 */
304,
/* 333 */
304,
/* 334 */
304,
/* 335 */
304,
/* 336 */
304,
/* 337 */
304,
/* 338 */
304,
/* 339 */
304,
/* 340 */
304,
/* 341 */
304,
/* 342 */
304,
/* 343 */
304,
/* 344 */
304,
/* 345 */
304,
/* 346 */
304,
/* 347 */
304,
/* 348 */
304,
/* 349 */
304,
/* 350 */
304,
/* 351 */
304,
/* 352 */
304,
/* 353 */
/***/ function(module, exports, __webpack_require__) {
/**
* Copyright (c) 2013-present, 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.
*
*/
'use strict';
var emptyObject = {};
if (true) {
Object.freeze(emptyObject);
}
module.exports = emptyObject;
/***/ },
/* 354 */
/***/ function(module, exports, __webpack_require__) {
/**
* Copyright (c) 2013-present, 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.
*
*
*/
'use strict';
/* eslint-disable fb-www/typeof-undefined */
/* eslint-disable no-unused-vars */
var invariant = __webpack_require__(39);
/**
* Checks if a value is empty.
*/
function isEmpty(value) {
if (Array.isArray(value)) {
return value.length === 0;
} else if (typeof value === 'object') {
if (value) {
!(!isIterable(value) || value.size === undefined) ? true ? invariant(false, 'isEmpty() does not support iterable collections.') : invariant(false) : void 0;
for (var _ in value) {
return false;
}
}
return true;
} else {
return !value;
}
}
function isIterable(value) {
if (typeof Symbol === 'undefined') {
return false;
}
return value[Symbol.iterator];
}
module.exports = isEmpty;
/***/ },
/* 355 */
/***/ function(module, exports) {
/*!
* for-in
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/
'use strict';
module.exports = function forIn(obj, fn, thisArg) {
for (var key in obj) {
if (fn.call(thisArg, obj[key], key, obj) === false) {
break;
}
}
};
/***/ },
/* 356 */
/***/ function(module, exports, __webpack_require__) {
/*!
* for-own
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/
'use strict';
var forIn = __webpack_require__(355);
var hasOwn = Object.prototype.hasOwnProperty;
module.exports = function forOwn(obj, fn, thisArg) {
forIn(obj, function(val, key) {
if (hasOwn.call(obj, key)) {
return fn.call(thisArg, obj[key], key, obj);
}
});
};
/***/ },
/* 357 */
/***/ function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;/*! Hammer.JS - v2.0.7 - 2016-04-22
* http://hammerjs.github.io/
*
* Copyright (c) 2016 Jorik Tangelder;
* Licensed under the MIT license */
(function(window, document, exportName, undefined) {
'use strict';
var VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o'];
var TEST_ELEMENT = document.createElement('div');
var TYPE_FUNCTION = 'function';
var round = Math.round;
var abs = Math.abs;
var now = Date.now;
/**
* set a timeout with a given scope
* @param {Function} fn
* @param {Number} timeout
* @param {Object} context
* @returns {number}
*/
function setTimeoutContext(fn, timeout, context) {
return setTimeout(bindFn(fn, context), timeout);
}
/**
* if the argument is an array, we want to execute the fn on each entry
* if it aint an array we don't want to do a thing.
* this is used by all the methods that accept a single and array argument.
* @param {*|Array} arg
* @param {String} fn
* @param {Object} [context]
* @returns {Boolean}
*/
function invokeArrayArg(arg, fn, context) {
if (Array.isArray(arg)) {
each(arg, context[fn], context);
return true;
}
return false;
}
/**
* walk objects and arrays
* @param {Object} obj
* @param {Function} iterator
* @param {Object} context
*/
function each(obj, iterator, context) {
var i;
if (!obj) {
return;
}
if (obj.forEach) {
obj.forEach(iterator, context);
} else if (obj.length !== undefined) {
i = 0;
while (i < obj.length) {
iterator.call(context, obj[i], i, obj);
i++;
}
} else {
for (i in obj) {
obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj);
}
}
}
/**
* wrap a method with a deprecation warning and stack trace
* @param {Function} method
* @param {String} name
* @param {String} message
* @returns {Function} A new function wrapping the supplied method.
*/
function deprecate(method, name, message) {
var deprecationMessage = 'DEPRECATED METHOD: ' + name + '\n' + message + ' AT \n';
return function() {
var e = new Error('get-stack-trace');
var stack = e && e.stack ? e.stack.replace(/^[^\(]+?[\n$]/gm, '')
.replace(/^\s+at\s+/gm, '')
.replace(/^Object.\s*\(/gm, '{anonymous}()@') : 'Unknown Stack Trace';
var log = window.console && (window.console.warn || window.console.log);
if (log) {
log.call(window.console, deprecationMessage, stack);
}
return method.apply(this, arguments);
};
}
/**
* extend object.
* means that properties in dest will be overwritten by the ones in src.
* @param {Object} target
* @param {...Object} objects_to_assign
* @returns {Object} target
*/
var assign;
if (typeof Object.assign !== 'function') {
assign = function assign(target) {
if (target === undefined || target === null) {
throw new TypeError('Cannot convert undefined or null to object');
}
var output = Object(target);
for (var index = 1; index < arguments.length; index++) {
var source = arguments[index];
if (source !== undefined && source !== null) {
for (var nextKey in source) {
if (source.hasOwnProperty(nextKey)) {
output[nextKey] = source[nextKey];
}
}
}
}
return output;
};
} else {
assign = Object.assign;
}
/**
* extend object.
* means that properties in dest will be overwritten by the ones in src.
* @param {Object} dest
* @param {Object} src
* @param {Boolean} [merge=false]
* @returns {Object} dest
*/
var extend = deprecate(function extend(dest, src, merge) {
var keys = Object.keys(src);
var i = 0;
while (i < keys.length) {
if (!merge || (merge && dest[keys[i]] === undefined)) {
dest[keys[i]] = src[keys[i]];
}
i++;
}
return dest;
}, 'extend', 'Use `assign`.');
/**
* merge the values from src in the dest.
* means that properties that exist in dest will not be overwritten by src
* @param {Object} dest
* @param {Object} src
* @returns {Object} dest
*/
var merge = deprecate(function merge(dest, src) {
return extend(dest, src, true);
}, 'merge', 'Use `assign`.');
/**
* simple class inheritance
* @param {Function} child
* @param {Function} base
* @param {Object} [properties]
*/
function inherit(child, base, properties) {
var baseP = base.prototype,
childP;
childP = child.prototype = Object.create(baseP);
childP.constructor = child;
childP._super = baseP;
if (properties) {
assign(childP, properties);
}
}
/**
* simple function bind
* @param {Function} fn
* @param {Object} context
* @returns {Function}
*/
function bindFn(fn, context) {
return function boundFn() {
return fn.apply(context, arguments);
};
}
/**
* let a boolean value also be a function that must return a boolean
* this first item in args will be used as the context
* @param {Boolean|Function} val
* @param {Array} [args]
* @returns {Boolean}
*/
function boolOrFn(val, args) {
if (typeof val == TYPE_FUNCTION) {
return val.apply(args ? args[0] || undefined : undefined, args);
}
return val;
}
/**
* use the val2 when val1 is undefined
* @param {*} val1
* @param {*} val2
* @returns {*}
*/
function ifUndefined(val1, val2) {
return (val1 === undefined) ? val2 : val1;
}
/**
* addEventListener with multiple events at once
* @param {EventTarget} target
* @param {String} types
* @param {Function} handler
*/
function addEventListeners(target, types, handler) {
each(splitStr(types), function(type) {
target.addEventListener(type, handler, false);
});
}
/**
* removeEventListener with multiple events at once
* @param {EventTarget} target
* @param {String} types
* @param {Function} handler
*/
function removeEventListeners(target, types, handler) {
each(splitStr(types), function(type) {
target.removeEventListener(type, handler, false);
});
}
/**
* find if a node is in the given parent
* @method hasParent
* @param {HTMLElement} node
* @param {HTMLElement} parent
* @return {Boolean} found
*/
function hasParent(node, parent) {
while (node) {
if (node == parent) {
return true;
}
node = node.parentNode;
}
return false;
}
/**
* small indexOf wrapper
* @param {String} str
* @param {String} find
* @returns {Boolean} found
*/
function inStr(str, find) {
return str.indexOf(find) > -1;
}
/**
* split string on whitespace
* @param {String} str
* @returns {Array} words
*/
function splitStr(str) {
return str.trim().split(/\s+/g);
}
/**
* find if a array contains the object using indexOf or a simple polyFill
* @param {Array} src
* @param {String} find
* @param {String} [findByKey]
* @return {Boolean|Number} false when not found, or the index
*/
function inArray(src, find, findByKey) {
if (src.indexOf && !findByKey) {
return src.indexOf(find);
} else {
var i = 0;
while (i < src.length) {
if ((findByKey && src[i][findByKey] == find) || (!findByKey && src[i] === find)) {
return i;
}
i++;
}
return -1;
}
}
/**
* convert array-like objects to real arrays
* @param {Object} obj
* @returns {Array}
*/
function toArray(obj) {
return Array.prototype.slice.call(obj, 0);
}
/**
* unique array with objects based on a key (like 'id') or just by the array's value
* @param {Array} src [{id:1},{id:2},{id:1}]
* @param {String} [key]
* @param {Boolean} [sort=False]
* @returns {Array} [{id:1},{id:2}]
*/
function uniqueArray(src, key, sort) {
var results = [];
var values = [];
var i = 0;
while (i < src.length) {
var val = key ? src[i][key] : src[i];
if (inArray(values, val) < 0) {
results.push(src[i]);
}
values[i] = val;
i++;
}
if (sort) {
if (!key) {
results = results.sort();
} else {
results = results.sort(function sortUniqueArray(a, b) {
return a[key] > b[key];
});
}
}
return results;
}
/**
* get the prefixed property
* @param {Object} obj
* @param {String} property
* @returns {String|Undefined} prefixed
*/
function prefixed(obj, property) {
var prefix, prop;
var camelProp = property[0].toUpperCase() + property.slice(1);
var i = 0;
while (i < VENDOR_PREFIXES.length) {
prefix = VENDOR_PREFIXES[i];
prop = (prefix) ? prefix + camelProp : property;
if (prop in obj) {
return prop;
}
i++;
}
return undefined;
}
/**
* get a unique id
* @returns {number} uniqueId
*/
var _uniqueId = 1;
function uniqueId() {
return _uniqueId++;
}
/**
* get the window object of an element
* @param {HTMLElement} element
* @returns {DocumentView|Window}
*/
function getWindowForElement(element) {
var doc = element.ownerDocument || element;
return (doc.defaultView || doc.parentWindow || window);
}
var MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;
var SUPPORT_TOUCH = ('ontouchstart' in window);
var SUPPORT_POINTER_EVENTS = prefixed(window, 'PointerEvent') !== undefined;
var SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent);
var INPUT_TYPE_TOUCH = 'touch';
var INPUT_TYPE_PEN = 'pen';
var INPUT_TYPE_MOUSE = 'mouse';
var INPUT_TYPE_KINECT = 'kinect';
var COMPUTE_INTERVAL = 25;
var INPUT_START = 1;
var INPUT_MOVE = 2;
var INPUT_END = 4;
var INPUT_CANCEL = 8;
var DIRECTION_NONE = 1;
var DIRECTION_LEFT = 2;
var DIRECTION_RIGHT = 4;
var DIRECTION_UP = 8;
var DIRECTION_DOWN = 16;
var DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT;
var DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN;
var DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL;
var PROPS_XY = ['x', 'y'];
var PROPS_CLIENT_XY = ['clientX', 'clientY'];
/**
* create new input type manager
* @param {Manager} manager
* @param {Function} callback
* @returns {Input}
* @constructor
*/
function Input(manager, callback) {
var self = this;
this.manager = manager;
this.callback = callback;
this.element = manager.element;
this.target = manager.options.inputTarget;
// smaller wrapper around the handler, for the scope and the enabled state of the manager,
// so when disabled the input events are completely bypassed.
this.domHandler = function(ev) {
if (boolOrFn(manager.options.enable, [manager])) {
self.handler(ev);
}
};
this.init();
}
Input.prototype = {
/**
* should handle the inputEvent data and trigger the callback
* @virtual
*/
handler: function() { },
/**
* bind the events
*/
init: function() {
this.evEl && addEventListeners(this.element, this.evEl, this.domHandler);
this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler);
this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);
},
/**
* unbind the events
*/
destroy: function() {
this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler);
this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler);
this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);
}
};
/**
* create new input type manager
* called by the Manager constructor
* @param {Hammer} manager
* @returns {Input}
*/
function createInputInstance(manager) {
var Type;
var inputClass = manager.options.inputClass;
if (inputClass) {
Type = inputClass;
} else if (SUPPORT_POINTER_EVENTS) {
Type = PointerEventInput;
} else if (SUPPORT_ONLY_TOUCH) {
Type = TouchInput;
} else if (!SUPPORT_TOUCH) {
Type = MouseInput;
} else {
Type = TouchMouseInput;
}
return new (Type)(manager, inputHandler);
}
/**
* handle input events
* @param {Manager} manager
* @param {String} eventType
* @param {Object} input
*/
function inputHandler(manager, eventType, input) {
var pointersLen = input.pointers.length;
var changedPointersLen = input.changedPointers.length;
var isFirst = (eventType & INPUT_START && (pointersLen - changedPointersLen === 0));
var isFinal = (eventType & (INPUT_END | INPUT_CANCEL) && (pointersLen - changedPointersLen === 0));
input.isFirst = !!isFirst;
input.isFinal = !!isFinal;
if (isFirst) {
manager.session = {};
}
// source event is the normalized value of the domEvents
// like 'touchstart, mouseup, pointerdown'
input.eventType = eventType;
// compute scale, rotation etc
computeInputData(manager, input);
// emit secret event
manager.emit('hammer.input', input);
manager.recognize(input);
manager.session.prevInput = input;
}
/**
* extend the data with some usable properties like scale, rotate, velocity etc
* @param {Object} manager
* @param {Object} input
*/
function computeInputData(manager, input) {
var session = manager.session;
var pointers = input.pointers;
var pointersLength = pointers.length;
// store the first input to calculate the distance and direction
if (!session.firstInput) {
session.firstInput = simpleCloneInputData(input);
}
// to compute scale and rotation we need to store the multiple touches
if (pointersLength > 1 && !session.firstMultiple) {
session.firstMultiple = simpleCloneInputData(input);
} else if (pointersLength === 1) {
session.firstMultiple = false;
}
var firstInput = session.firstInput;
var firstMultiple = session.firstMultiple;
var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center;
var center = input.center = getCenter(pointers);
input.timeStamp = now();
input.deltaTime = input.timeStamp - firstInput.timeStamp;
input.angle = getAngle(offsetCenter, center);
input.distance = getDistance(offsetCenter, center);
computeDeltaXY(session, input);
input.offsetDirection = getDirection(input.deltaX, input.deltaY);
var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY);
input.overallVelocityX = overallVelocity.x;
input.overallVelocityY = overallVelocity.y;
input.overallVelocity = (abs(overallVelocity.x) > abs(overallVelocity.y)) ? overallVelocity.x : overallVelocity.y;
input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;
input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;
input.maxPointers = !session.prevInput ? input.pointers.length : ((input.pointers.length >
session.prevInput.maxPointers) ? input.pointers.length : session.prevInput.maxPointers);
computeIntervalInputData(session, input);
// find the correct target
var target = manager.element;
if (hasParent(input.srcEvent.target, target)) {
target = input.srcEvent.target;
}
input.target = target;
}
function computeDeltaXY(session, input) {
var center = input.center;
var offset = session.offsetDelta || {};
var prevDelta = session.prevDelta || {};
var prevInput = session.prevInput || {};
if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) {
prevDelta = session.prevDelta = {
x: prevInput.deltaX || 0,
y: prevInput.deltaY || 0
};
offset = session.offsetDelta = {
x: center.x,
y: center.y
};
}
input.deltaX = prevDelta.x + (center.x - offset.x);
input.deltaY = prevDelta.y + (center.y - offset.y);
}
/**
* velocity is calculated every x ms
* @param {Object} session
* @param {Object} input
*/
function computeIntervalInputData(session, input) {
var last = session.lastInterval || input,
deltaTime = input.timeStamp - last.timeStamp,
velocity, velocityX, velocityY, direction;
if (input.eventType != INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) {
var deltaX = input.deltaX - last.deltaX;
var deltaY = input.deltaY - last.deltaY;
var v = getVelocity(deltaTime, deltaX, deltaY);
velocityX = v.x;
velocityY = v.y;
velocity = (abs(v.x) > abs(v.y)) ? v.x : v.y;
direction = getDirection(deltaX, deltaY);
session.lastInterval = input;
} else {
// use latest velocity info if it doesn't overtake a minimum period
velocity = last.velocity;
velocityX = last.velocityX;
velocityY = last.velocityY;
direction = last.direction;
}
input.velocity = velocity;
input.velocityX = velocityX;
input.velocityY = velocityY;
input.direction = direction;
}
/**
* create a simple clone from the input used for storage of firstInput and firstMultiple
* @param {Object} input
* @returns {Object} clonedInputData
*/
function simpleCloneInputData(input) {
// make a simple copy of the pointers because we will get a reference if we don't
// we only need clientXY for the calculations
var pointers = [];
var i = 0;
while (i < input.pointers.length) {
pointers[i] = {
clientX: round(input.pointers[i].clientX),
clientY: round(input.pointers[i].clientY)
};
i++;
}
return {
timeStamp: now(),
pointers: pointers,
center: getCenter(pointers),
deltaX: input.deltaX,
deltaY: input.deltaY
};
}
/**
* get the center of all the pointers
* @param {Array} pointers
* @return {Object} center contains `x` and `y` properties
*/
function getCenter(pointers) {
var pointersLength = pointers.length;
// no need to loop when only one touch
if (pointersLength === 1) {
return {
x: round(pointers[0].clientX),
y: round(pointers[0].clientY)
};
}
var x = 0, y = 0, i = 0;
while (i < pointersLength) {
x += pointers[i].clientX;
y += pointers[i].clientY;
i++;
}
return {
x: round(x / pointersLength),
y: round(y / pointersLength)
};
}
/**
* calculate the velocity between two points. unit is in px per ms.
* @param {Number} deltaTime
* @param {Number} x
* @param {Number} y
* @return {Object} velocity `x` and `y`
*/
function getVelocity(deltaTime, x, y) {
return {
x: x / deltaTime || 0,
y: y / deltaTime || 0
};
}
/**
* get the direction between two points
* @param {Number} x
* @param {Number} y
* @return {Number} direction
*/
function getDirection(x, y) {
if (x === y) {
return DIRECTION_NONE;
}
if (abs(x) >= abs(y)) {
return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;
}
return y < 0 ? DIRECTION_UP : DIRECTION_DOWN;
}
/**
* calculate the absolute distance between two points
* @param {Object} p1 {x, y}
* @param {Object} p2 {x, y}
* @param {Array} [props] containing x and y keys
* @return {Number} distance
*/
function getDistance(p1, p2, props) {
if (!props) {
props = PROPS_XY;
}
var x = p2[props[0]] - p1[props[0]],
y = p2[props[1]] - p1[props[1]];
return Math.sqrt((x * x) + (y * y));
}
/**
* calculate the angle between two coordinates
* @param {Object} p1
* @param {Object} p2
* @param {Array} [props] containing x and y keys
* @return {Number} angle
*/
function getAngle(p1, p2, props) {
if (!props) {
props = PROPS_XY;
}
var x = p2[props[0]] - p1[props[0]],
y = p2[props[1]] - p1[props[1]];
return Math.atan2(y, x) * 180 / Math.PI;
}
/**
* calculate the rotation degrees between two pointersets
* @param {Array} start array of pointers
* @param {Array} end array of pointers
* @return {Number} rotation
*/
function getRotation(start, end) {
return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY);
}
/**
* calculate the scale factor between two pointersets
* no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out
* @param {Array} start array of pointers
* @param {Array} end array of pointers
* @return {Number} scale
*/
function getScale(start, end) {
return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY);
}
var MOUSE_INPUT_MAP = {
mousedown: INPUT_START,
mousemove: INPUT_MOVE,
mouseup: INPUT_END
};
var MOUSE_ELEMENT_EVENTS = 'mousedown';
var MOUSE_WINDOW_EVENTS = 'mousemove mouseup';
/**
* Mouse events input
* @constructor
* @extends Input
*/
function MouseInput() {
this.evEl = MOUSE_ELEMENT_EVENTS;
this.evWin = MOUSE_WINDOW_EVENTS;
this.pressed = false; // mousedown state
Input.apply(this, arguments);
}
inherit(MouseInput, Input, {
/**
* handle mouse events
* @param {Object} ev
*/
handler: function MEhandler(ev) {
var eventType = MOUSE_INPUT_MAP[ev.type];
// on start we want to have the left mouse button down
if (eventType & INPUT_START && ev.button === 0) {
this.pressed = true;
}
if (eventType & INPUT_MOVE && ev.which !== 1) {
eventType = INPUT_END;
}
// mouse must be down
if (!this.pressed) {
return;
}
if (eventType & INPUT_END) {
this.pressed = false;
}
this.callback(this.manager, eventType, {
pointers: [ev],
changedPointers: [ev],
pointerType: INPUT_TYPE_MOUSE,
srcEvent: ev
});
}
});
var POINTER_INPUT_MAP = {
pointerdown: INPUT_START,
pointermove: INPUT_MOVE,
pointerup: INPUT_END,
pointercancel: INPUT_CANCEL,
pointerout: INPUT_CANCEL
};
// in IE10 the pointer types is defined as an enum
var IE10_POINTER_TYPE_ENUM = {
2: INPUT_TYPE_TOUCH,
3: INPUT_TYPE_PEN,
4: INPUT_TYPE_MOUSE,
5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816
};
var POINTER_ELEMENT_EVENTS = 'pointerdown';
var POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel';
// IE10 has prefixed support, and case-sensitive
if (window.MSPointerEvent && !window.PointerEvent) {
POINTER_ELEMENT_EVENTS = 'MSPointerDown';
POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';
}
/**
* Pointer events input
* @constructor
* @extends Input
*/
function PointerEventInput() {
this.evEl = POINTER_ELEMENT_EVENTS;
this.evWin = POINTER_WINDOW_EVENTS;
Input.apply(this, arguments);
this.store = (this.manager.session.pointerEvents = []);
}
inherit(PointerEventInput, Input, {
/**
* handle mouse events
* @param {Object} ev
*/
handler: function PEhandler(ev) {
var store = this.store;
var removePointer = false;
var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');
var eventType = POINTER_INPUT_MAP[eventTypeNormalized];
var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType;
var isTouch = (pointerType == INPUT_TYPE_TOUCH);
// get index of the event in the store
var storeIndex = inArray(store, ev.pointerId, 'pointerId');
// start and mouse must be down
if (eventType & INPUT_START && (ev.button === 0 || isTouch)) {
if (storeIndex < 0) {
store.push(ev);
storeIndex = store.length - 1;
}
} else if (eventType & (INPUT_END | INPUT_CANCEL)) {
removePointer = true;
}
// it not found, so the pointer hasn't been down (so it's probably a hover)
if (storeIndex < 0) {
return;
}
// update the event in the store
store[storeIndex] = ev;
this.callback(this.manager, eventType, {
pointers: store,
changedPointers: [ev],
pointerType: pointerType,
srcEvent: ev
});
if (removePointer) {
// remove from the store
store.splice(storeIndex, 1);
}
}
});
var SINGLE_TOUCH_INPUT_MAP = {
touchstart: INPUT_START,
touchmove: INPUT_MOVE,
touchend: INPUT_END,
touchcancel: INPUT_CANCEL
};
var SINGLE_TOUCH_TARGET_EVENTS = 'touchstart';
var SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel';
/**
* Touch events input
* @constructor
* @extends Input
*/
function SingleTouchInput() {
this.evTarget = SINGLE_TOUCH_TARGET_EVENTS;
this.evWin = SINGLE_TOUCH_WINDOW_EVENTS;
this.started = false;
Input.apply(this, arguments);
}
inherit(SingleTouchInput, Input, {
handler: function TEhandler(ev) {
var type = SINGLE_TOUCH_INPUT_MAP[ev.type];
// should we handle the touch events?
if (type === INPUT_START) {
this.started = true;
}
if (!this.started) {
return;
}
var touches = normalizeSingleTouches.call(this, ev, type);
// when done, reset the started state
if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) {
this.started = false;
}
this.callback(this.manager, type, {
pointers: touches[0],
changedPointers: touches[1],
pointerType: INPUT_TYPE_TOUCH,
srcEvent: ev
});
}
});
/**
* @this {TouchInput}
* @param {Object} ev
* @param {Number} type flag
* @returns {undefined|Array} [all, changed]
*/
function normalizeSingleTouches(ev, type) {
var all = toArray(ev.touches);
var changed = toArray(ev.changedTouches);
if (type & (INPUT_END | INPUT_CANCEL)) {
all = uniqueArray(all.concat(changed), 'identifier', true);
}
return [all, changed];
}
var TOUCH_INPUT_MAP = {
touchstart: INPUT_START,
touchmove: INPUT_MOVE,
touchend: INPUT_END,
touchcancel: INPUT_CANCEL
};
var TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel';
/**
* Multi-user touch events input
* @constructor
* @extends Input
*/
function TouchInput() {
this.evTarget = TOUCH_TARGET_EVENTS;
this.targetIds = {};
Input.apply(this, arguments);
}
inherit(TouchInput, Input, {
handler: function MTEhandler(ev) {
var type = TOUCH_INPUT_MAP[ev.type];
var touches = getTouches.call(this, ev, type);
if (!touches) {
return;
}
this.callback(this.manager, type, {
pointers: touches[0],
changedPointers: touches[1],
pointerType: INPUT_TYPE_TOUCH,
srcEvent: ev
});
}
});
/**
* @this {TouchInput}
* @param {Object} ev
* @param {Number} type flag
* @returns {undefined|Array} [all, changed]
*/
function getTouches(ev, type) {
var allTouches = toArray(ev.touches);
var targetIds = this.targetIds;
// when there is only one touch, the process can be simplified
if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) {
targetIds[allTouches[0].identifier] = true;
return [allTouches, allTouches];
}
var i,
targetTouches,
changedTouches = toArray(ev.changedTouches),
changedTargetTouches = [],
target = this.target;
// get target touches from touches
targetTouches = allTouches.filter(function(touch) {
return hasParent(touch.target, target);
});
// collect touches
if (type === INPUT_START) {
i = 0;
while (i < targetTouches.length) {
targetIds[targetTouches[i].identifier] = true;
i++;
}
}
// filter changed touches to only contain touches that exist in the collected target ids
i = 0;
while (i < changedTouches.length) {
if (targetIds[changedTouches[i].identifier]) {
changedTargetTouches.push(changedTouches[i]);
}
// cleanup removed touches
if (type & (INPUT_END | INPUT_CANCEL)) {
delete targetIds[changedTouches[i].identifier];
}
i++;
}
if (!changedTargetTouches.length) {
return;
}
return [
// merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel'
uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true),
changedTargetTouches
];
}
/**
* Combined touch and mouse input
*
* Touch has a higher priority then mouse, and while touching no mouse events are allowed.
* This because touch devices also emit mouse events while doing a touch.
*
* @constructor
* @extends Input
*/
var DEDUP_TIMEOUT = 2500;
var DEDUP_DISTANCE = 25;
function TouchMouseInput() {
Input.apply(this, arguments);
var handler = bindFn(this.handler, this);
this.touch = new TouchInput(this.manager, handler);
this.mouse = new MouseInput(this.manager, handler);
this.primaryTouch = null;
this.lastTouches = [];
}
inherit(TouchMouseInput, Input, {
/**
* handle mouse and touch events
* @param {Hammer} manager
* @param {String} inputEvent
* @param {Object} inputData
*/
handler: function TMEhandler(manager, inputEvent, inputData) {
var isTouch = (inputData.pointerType == INPUT_TYPE_TOUCH),
isMouse = (inputData.pointerType == INPUT_TYPE_MOUSE);
if (isMouse && inputData.sourceCapabilities && inputData.sourceCapabilities.firesTouchEvents) {
return;
}
// when we're in a touch event, record touches to de-dupe synthetic mouse event
if (isTouch) {
recordTouches.call(this, inputEvent, inputData);
} else if (isMouse && isSyntheticEvent.call(this, inputData)) {
return;
}
this.callback(manager, inputEvent, inputData);
},
/**
* remove the event listeners
*/
destroy: function destroy() {
this.touch.destroy();
this.mouse.destroy();
}
});
function recordTouches(eventType, eventData) {
if (eventType & INPUT_START) {
this.primaryTouch = eventData.changedPointers[0].identifier;
setLastTouch.call(this, eventData);
} else if (eventType & (INPUT_END | INPUT_CANCEL)) {
setLastTouch.call(this, eventData);
}
}
function setLastTouch(eventData) {
var touch = eventData.changedPointers[0];
if (touch.identifier === this.primaryTouch) {
var lastTouch = {x: touch.clientX, y: touch.clientY};
this.lastTouches.push(lastTouch);
var lts = this.lastTouches;
var removeLastTouch = function() {
var i = lts.indexOf(lastTouch);
if (i > -1) {
lts.splice(i, 1);
}
};
setTimeout(removeLastTouch, DEDUP_TIMEOUT);
}
}
function isSyntheticEvent(eventData) {
var x = eventData.srcEvent.clientX, y = eventData.srcEvent.clientY;
for (var i = 0; i < this.lastTouches.length; i++) {
var t = this.lastTouches[i];
var dx = Math.abs(x - t.x), dy = Math.abs(y - t.y);
if (dx <= DEDUP_DISTANCE && dy <= DEDUP_DISTANCE) {
return true;
}
}
return false;
}
var PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction');
var NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined;
// magical touchAction value
var TOUCH_ACTION_COMPUTE = 'compute';
var TOUCH_ACTION_AUTO = 'auto';
var TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented
var TOUCH_ACTION_NONE = 'none';
var TOUCH_ACTION_PAN_X = 'pan-x';
var TOUCH_ACTION_PAN_Y = 'pan-y';
var TOUCH_ACTION_MAP = getTouchActionProps();
/**
* Touch Action
* sets the touchAction property or uses the js alternative
* @param {Manager} manager
* @param {String} value
* @constructor
*/
function TouchAction(manager, value) {
this.manager = manager;
this.set(value);
}
TouchAction.prototype = {
/**
* set the touchAction value on the element or enable the polyfill
* @param {String} value
*/
set: function(value) {
// find out the touch-action by the event handlers
if (value == TOUCH_ACTION_COMPUTE) {
value = this.compute();
}
if (NATIVE_TOUCH_ACTION && this.manager.element.style && TOUCH_ACTION_MAP[value]) {
this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;
}
this.actions = value.toLowerCase().trim();
},
/**
* just re-set the touchAction value
*/
update: function() {
this.set(this.manager.options.touchAction);
},
/**
* compute the value for the touchAction property based on the recognizer's settings
* @returns {String} value
*/
compute: function() {
var actions = [];
each(this.manager.recognizers, function(recognizer) {
if (boolOrFn(recognizer.options.enable, [recognizer])) {
actions = actions.concat(recognizer.getTouchAction());
}
});
return cleanTouchActions(actions.join(' '));
},
/**
* this method is called on each input cycle and provides the preventing of the browser behavior
* @param {Object} input
*/
preventDefaults: function(input) {
var srcEvent = input.srcEvent;
var direction = input.offsetDirection;
// if the touch action did prevented once this session
if (this.manager.session.prevented) {
srcEvent.preventDefault();
return;
}
var actions = this.actions;
var hasNone = inStr(actions, TOUCH_ACTION_NONE) && !TOUCH_ACTION_MAP[TOUCH_ACTION_NONE];
var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_Y];
var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_X];
if (hasNone) {
//do not prevent defaults if this is a tap gesture
var isTapPointer = input.pointers.length === 1;
var isTapMovement = input.distance < 2;
var isTapTouchTime = input.deltaTime < 250;
if (isTapPointer && isTapMovement && isTapTouchTime) {
return;
}
}
if (hasPanX && hasPanY) {
// `pan-x pan-y` means browser handles all scrolling/panning, do not prevent
return;
}
if (hasNone ||
(hasPanY && direction & DIRECTION_HORIZONTAL) ||
(hasPanX && direction & DIRECTION_VERTICAL)) {
return this.preventSrc(srcEvent);
}
},
/**
* call preventDefault to prevent the browser's default behavior (scrolling in most cases)
* @param {Object} srcEvent
*/
preventSrc: function(srcEvent) {
this.manager.session.prevented = true;
srcEvent.preventDefault();
}
};
/**
* when the touchActions are collected they are not a valid value, so we need to clean things up. *
* @param {String} actions
* @returns {*}
*/
function cleanTouchActions(actions) {
// none
if (inStr(actions, TOUCH_ACTION_NONE)) {
return TOUCH_ACTION_NONE;
}
var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);
var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);
// if both pan-x and pan-y are set (different recognizers
// for different directions, e.g. horizontal pan but vertical swipe?)
// we need none (as otherwise with pan-x pan-y combined none of these
// recognizers will work, since the browser would handle all panning
if (hasPanX && hasPanY) {
return TOUCH_ACTION_NONE;
}
// pan-x OR pan-y
if (hasPanX || hasPanY) {
return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;
}
// manipulation
if (inStr(actions, TOUCH_ACTION_MANIPULATION)) {
return TOUCH_ACTION_MANIPULATION;
}
return TOUCH_ACTION_AUTO;
}
function getTouchActionProps() {
if (!NATIVE_TOUCH_ACTION) {
return false;
}
var touchMap = {};
var cssSupports = window.CSS && window.CSS.supports;
['auto', 'manipulation', 'pan-y', 'pan-x', 'pan-x pan-y', 'none'].forEach(function(val) {
// If css.supports is not supported but there is native touch-action assume it supports
// all values. This is the case for IE 10 and 11.
touchMap[val] = cssSupports ? window.CSS.supports('touch-action', val) : true;
});
return touchMap;
}
/**
* Recognizer flow explained; *
* All recognizers have the initial state of POSSIBLE when a input session starts.
* The definition of a input session is from the first input until the last input, with all it's movement in it. *
* Example session for mouse-input: mousedown -> mousemove -> mouseup
*
* On each recognizing cycle (see Manager.recognize) the .recognize() method is executed
* which determines with state it should be.
*
* If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to
* POSSIBLE to give it another change on the next cycle.
*
* Possible
* |
* +-----+---------------+
* | |
* +-----+-----+ |
* | | |
* Failed Cancelled |
* +-------+------+
* | |
* Recognized Began
* |
* Changed
* |
* Ended/Recognized
*/
var STATE_POSSIBLE = 1;
var STATE_BEGAN = 2;
var STATE_CHANGED = 4;
var STATE_ENDED = 8;
var STATE_RECOGNIZED = STATE_ENDED;
var STATE_CANCELLED = 16;
var STATE_FAILED = 32;
/**
* Recognizer
* Every recognizer needs to extend from this class.
* @constructor
* @param {Object} options
*/
function Recognizer(options) {
this.options = assign({}, this.defaults, options || {});
this.id = uniqueId();
this.manager = null;
// default is enable true
this.options.enable = ifUndefined(this.options.enable, true);
this.state = STATE_POSSIBLE;
this.simultaneous = {};
this.requireFail = [];
}
Recognizer.prototype = {
/**
* @virtual
* @type {Object}
*/
defaults: {},
/**
* set options
* @param {Object} options
* @return {Recognizer}
*/
set: function(options) {
assign(this.options, options);
// also update the touchAction, in case something changed about the directions/enabled state
this.manager && this.manager.touchAction.update();
return this;
},
/**
* recognize simultaneous with an other recognizer.
* @param {Recognizer} otherRecognizer
* @returns {Recognizer} this
*/
recognizeWith: function(otherRecognizer) {
if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) {
return this;
}
var simultaneous = this.simultaneous;
otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
if (!simultaneous[otherRecognizer.id]) {
simultaneous[otherRecognizer.id] = otherRecognizer;
otherRecognizer.recognizeWith(this);
}
return this;
},
/**
* drop the simultaneous link. it doesnt remove the link on the other recognizer.
* @param {Recognizer} otherRecognizer
* @returns {Recognizer} this
*/
dropRecognizeWith: function(otherRecognizer) {
if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) {
return this;
}
otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
delete this.simultaneous[otherRecognizer.id];
return this;
},
/**
* recognizer can only run when an other is failing
* @param {Recognizer} otherRecognizer
* @returns {Recognizer} this
*/
requireFailure: function(otherRecognizer) {
if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) {
return this;
}
var requireFail = this.requireFail;
otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
if (inArray(requireFail, otherRecognizer) === -1) {
requireFail.push(otherRecognizer);
otherRecognizer.requireFailure(this);
}
return this;
},
/**
* drop the requireFailure link. it does not remove the link on the other recognizer.
* @param {Recognizer} otherRecognizer
* @returns {Recognizer} this
*/
dropRequireFailure: function(otherRecognizer) {
if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) {
return this;
}
otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
var index = inArray(this.requireFail, otherRecognizer);
if (index > -1) {
this.requireFail.splice(index, 1);
}
return this;
},
/**
* has require failures boolean
* @returns {boolean}
*/
hasRequireFailures: function() {
return this.requireFail.length > 0;
},
/**
* if the recognizer can recognize simultaneous with an other recognizer
* @param {Recognizer} otherRecognizer
* @returns {Boolean}
*/
canRecognizeWith: function(otherRecognizer) {
return !!this.simultaneous[otherRecognizer.id];
},
/**
* You should use `tryEmit` instead of `emit` directly to check
* that all the needed recognizers has failed before emitting.
* @param {Object} input
*/
emit: function(input) {
var self = this;
var state = this.state;
function emit(event) {
self.manager.emit(event, input);
}
// 'panstart' and 'panmove'
if (state < STATE_ENDED) {
emit(self.options.event + stateStr(state));
}
emit(self.options.event); // simple 'eventName' events
if (input.additionalEvent) { // additional event(panleft, panright, pinchin, pinchout...)
emit(input.additionalEvent);
}
// panend and pancancel
if (state >= STATE_ENDED) {
emit(self.options.event + stateStr(state));
}
},
/**
* Check that all the require failure recognizers has failed,
* if true, it emits a gesture event,
* otherwise, setup the state to FAILED.
* @param {Object} input
*/
tryEmit: function(input) {
if (this.canEmit()) {
return this.emit(input);
}
// it's failing anyway
this.state = STATE_FAILED;
},
/**
* can we emit?
* @returns {boolean}
*/
canEmit: function() {
var i = 0;
while (i < this.requireFail.length) {
if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) {
return false;
}
i++;
}
return true;
},
/**
* update the recognizer
* @param {Object} inputData
*/
recognize: function(inputData) {
// make a new copy of the inputData
// so we can change the inputData without messing up the other recognizers
var inputDataClone = assign({}, inputData);
// is is enabled and allow recognizing?
if (!boolOrFn(this.options.enable, [this, inputDataClone])) {
this.reset();
this.state = STATE_FAILED;
return;
}
// reset when we've reached the end
if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) {
this.state = STATE_POSSIBLE;
}
this.state = this.process(inputDataClone);
// the recognizer has recognized a gesture
// so trigger an event
if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) {
this.tryEmit(inputDataClone);
}
},
/**
* return the state of the recognizer
* the actual recognizing happens in this method
* @virtual
* @param {Object} inputData
* @returns {Const} STATE
*/
process: function(inputData) { }, // jshint ignore:line
/**
* return the preferred touch-action
* @virtual
* @returns {Array}
*/
getTouchAction: function() { },
/**
* called when the gesture isn't allowed to recognize
* like when another is being recognized or it is disabled
* @virtual
*/
reset: function() { }
};
/**
* get a usable string, used as event postfix
* @param {Const} state
* @returns {String} state
*/
function stateStr(state) {
if (state & STATE_CANCELLED) {
return 'cancel';
} else if (state & STATE_ENDED) {
return 'end';
} else if (state & STATE_CHANGED) {
return 'move';
} else if (state & STATE_BEGAN) {
return 'start';
}
return '';
}
/**
* direction cons to string
* @param {Const} direction
* @returns {String}
*/
function directionStr(direction) {
if (direction == DIRECTION_DOWN) {
return 'down';
} else if (direction == DIRECTION_UP) {
return 'up';
} else if (direction == DIRECTION_LEFT) {
return 'left';
} else if (direction == DIRECTION_RIGHT) {
return 'right';
}
return '';
}
/**
* get a recognizer by name if it is bound to a manager
* @param {Recognizer|String} otherRecognizer
* @param {Recognizer} recognizer
* @returns {Recognizer}
*/
function getRecognizerByNameIfManager(otherRecognizer, recognizer) {
var manager = recognizer.manager;
if (manager) {
return manager.get(otherRecognizer);
}
return otherRecognizer;
}
/**
* This recognizer is just used as a base for the simple attribute recognizers.
* @constructor
* @extends Recognizer
*/
function AttrRecognizer() {
Recognizer.apply(this, arguments);
}
inherit(AttrRecognizer, Recognizer, {
/**
* @namespace
* @memberof AttrRecognizer
*/
defaults: {
/**
* @type {Number}
* @default 1
*/
pointers: 1
},
/**
* Used to check if it the recognizer receives valid input, like input.distance > 10.
* @memberof AttrRecognizer
* @param {Object} input
* @returns {Boolean} recognized
*/
attrTest: function(input) {
var optionPointers = this.options.pointers;
return optionPointers === 0 || input.pointers.length === optionPointers;
},
/**
* Process the input and return the state for the recognizer
* @memberof AttrRecognizer
* @param {Object} input
* @returns {*} State
*/
process: function(input) {
var state = this.state;
var eventType = input.eventType;
var isRecognized = state & (STATE_BEGAN | STATE_CHANGED);
var isValid = this.attrTest(input);
// on cancel input and we've recognized before, return STATE_CANCELLED
if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) {
return state | STATE_CANCELLED;
} else if (isRecognized || isValid) {
if (eventType & INPUT_END) {
return state | STATE_ENDED;
} else if (!(state & STATE_BEGAN)) {
return STATE_BEGAN;
}
return state | STATE_CHANGED;
}
return STATE_FAILED;
}
});
/**
* Pan
* Recognized when the pointer is down and moved in the allowed direction.
* @constructor
* @extends AttrRecognizer
*/
function PanRecognizer() {
AttrRecognizer.apply(this, arguments);
this.pX = null;
this.pY = null;
}
inherit(PanRecognizer, AttrRecognizer, {
/**
* @namespace
* @memberof PanRecognizer
*/
defaults: {
event: 'pan',
threshold: 10,
pointers: 1,
direction: DIRECTION_ALL
},
getTouchAction: function() {
var direction = this.options.direction;
var actions = [];
if (direction & DIRECTION_HORIZONTAL) {
actions.push(TOUCH_ACTION_PAN_Y);
}
if (direction & DIRECTION_VERTICAL) {
actions.push(TOUCH_ACTION_PAN_X);
}
return actions;
},
directionTest: function(input) {
var options = this.options;
var hasMoved = true;
var distance = input.distance;
var direction = input.direction;
var x = input.deltaX;
var y = input.deltaY;
// lock to axis?
if (!(direction & options.direction)) {
if (options.direction & DIRECTION_HORIZONTAL) {
direction = (x === 0) ? DIRECTION_NONE : (x < 0) ? DIRECTION_LEFT : DIRECTION_RIGHT;
hasMoved = x != this.pX;
distance = Math.abs(input.deltaX);
} else {
direction = (y === 0) ? DIRECTION_NONE : (y < 0) ? DIRECTION_UP : DIRECTION_DOWN;
hasMoved = y != this.pY;
distance = Math.abs(input.deltaY);
}
}
input.direction = direction;
return hasMoved && distance > options.threshold && direction & options.direction;
},
attrTest: function(input) {
return AttrRecognizer.prototype.attrTest.call(this, input) &&
(this.state & STATE_BEGAN || (!(this.state & STATE_BEGAN) && this.directionTest(input)));
},
emit: function(input) {
this.pX = input.deltaX;
this.pY = input.deltaY;
var direction = directionStr(input.direction);
if (direction) {
input.additionalEvent = this.options.event + direction;
}
this._super.emit.call(this, input);
}
});
/**
* Pinch
* Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out).
* @constructor
* @extends AttrRecognizer
*/
function PinchRecognizer() {
AttrRecognizer.apply(this, arguments);
}
inherit(PinchRecognizer, AttrRecognizer, {
/**
* @namespace
* @memberof PinchRecognizer
*/
defaults: {
event: 'pinch',
threshold: 0,
pointers: 2
},
getTouchAction: function() {
return [TOUCH_ACTION_NONE];
},
attrTest: function(input) {
return this._super.attrTest.call(this, input) &&
(Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN);
},
emit: function(input) {
if (input.scale !== 1) {
var inOut = input.scale < 1 ? 'in' : 'out';
input.additionalEvent = this.options.event + inOut;
}
this._super.emit.call(this, input);
}
});
/**
* Press
* Recognized when the pointer is down for x ms without any movement.
* @constructor
* @extends Recognizer
*/
function PressRecognizer() {
Recognizer.apply(this, arguments);
this._timer = null;
this._input = null;
}
inherit(PressRecognizer, Recognizer, {
/**
* @namespace
* @memberof PressRecognizer
*/
defaults: {
event: 'press',
pointers: 1,
time: 251, // minimal time of the pointer to be pressed
threshold: 9 // a minimal movement is ok, but keep it low
},
getTouchAction: function() {
return [TOUCH_ACTION_AUTO];
},
process: function(input) {
var options = this.options;
var validPointers = input.pointers.length === options.pointers;
var validMovement = input.distance < options.threshold;
var validTime = input.deltaTime > options.time;
this._input = input;
// we only allow little movement
// and we've reached an end event, so a tap is possible
if (!validMovement || !validPointers || (input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime)) {
this.reset();
} else if (input.eventType & INPUT_START) {
this.reset();
this._timer = setTimeoutContext(function() {
this.state = STATE_RECOGNIZED;
this.tryEmit();
}, options.time, this);
} else if (input.eventType & INPUT_END) {
return STATE_RECOGNIZED;
}
return STATE_FAILED;
},
reset: function() {
clearTimeout(this._timer);
},
emit: function(input) {
if (this.state !== STATE_RECOGNIZED) {
return;
}
if (input && (input.eventType & INPUT_END)) {
this.manager.emit(this.options.event + 'up', input);
} else {
this._input.timeStamp = now();
this.manager.emit(this.options.event, this._input);
}
}
});
/**
* Rotate
* Recognized when two or more pointer are moving in a circular motion.
* @constructor
* @extends AttrRecognizer
*/
function RotateRecognizer() {
AttrRecognizer.apply(this, arguments);
}
inherit(RotateRecognizer, AttrRecognizer, {
/**
* @namespace
* @memberof RotateRecognizer
*/
defaults: {
event: 'rotate',
threshold: 0,
pointers: 2
},
getTouchAction: function() {
return [TOUCH_ACTION_NONE];
},
attrTest: function(input) {
return this._super.attrTest.call(this, input) &&
(Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN);
}
});
/**
* Swipe
* Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction.
* @constructor
* @extends AttrRecognizer
*/
function SwipeRecognizer() {
AttrRecognizer.apply(this, arguments);
}
inherit(SwipeRecognizer, AttrRecognizer, {
/**
* @namespace
* @memberof SwipeRecognizer
*/
defaults: {
event: 'swipe',
threshold: 10,
velocity: 0.3,
direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,
pointers: 1
},
getTouchAction: function() {
return PanRecognizer.prototype.getTouchAction.call(this);
},
attrTest: function(input) {
var direction = this.options.direction;
var velocity;
if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {
velocity = input.overallVelocity;
} else if (direction & DIRECTION_HORIZONTAL) {
velocity = input.overallVelocityX;
} else if (direction & DIRECTION_VERTICAL) {
velocity = input.overallVelocityY;
}
return this._super.attrTest.call(this, input) &&
direction & input.offsetDirection &&
input.distance > this.options.threshold &&
input.maxPointers == this.options.pointers &&
abs(velocity) > this.options.velocity && input.eventType & INPUT_END;
},
emit: function(input) {
var direction = directionStr(input.offsetDirection);
if (direction) {
this.manager.emit(this.options.event + direction, input);
}
this.manager.emit(this.options.event, input);
}
});
/**
* A tap is ecognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur
* between the given interval and position. The delay option can be used to recognize multi-taps without firing
* a single tap.
*
* The eventData from the emitted event contains the property `tapCount`, which contains the amount of
* multi-taps being recognized.
* @constructor
* @extends Recognizer
*/
function TapRecognizer() {
Recognizer.apply(this, arguments);
// previous time and center,
// used for tap counting
this.pTime = false;
this.pCenter = false;
this._timer = null;
this._input = null;
this.count = 0;
}
inherit(TapRecognizer, Recognizer, {
/**
* @namespace
* @memberof PinchRecognizer
*/
defaults: {
event: 'tap',
pointers: 1,
taps: 1,
interval: 300, // max time between the multi-tap taps
time: 250, // max time of the pointer to be down (like finger on the screen)
threshold: 9, // a minimal movement is ok, but keep it low
posThreshold: 10 // a multi-tap can be a bit off the initial position
},
getTouchAction: function() {
return [TOUCH_ACTION_MANIPULATION];
},
process: function(input) {
var options = this.options;
var validPointers = input.pointers.length === options.pointers;
var validMovement = input.distance < options.threshold;
var validTouchTime = input.deltaTime < options.time;
this.reset();
if ((input.eventType & INPUT_START) && (this.count === 0)) {
return this.failTimeout();
}
// we only allow little movement
// and we've reached an end event, so a tap is possible
if (validMovement && validTouchTime && validPointers) {
if (input.eventType != INPUT_END) {
return this.failTimeout();
}
var validInterval = this.pTime ? (input.timeStamp - this.pTime < options.interval) : true;
var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold;
this.pTime = input.timeStamp;
this.pCenter = input.center;
if (!validMultiTap || !validInterval) {
this.count = 1;
} else {
this.count += 1;
}
this._input = input;
// if tap count matches we have recognized it,
// else it has began recognizing...
var tapCount = this.count % options.taps;
if (tapCount === 0) {
// no failing requirements, immediately trigger the tap event
// or wait as long as the multitap interval to trigger
if (!this.hasRequireFailures()) {
return STATE_RECOGNIZED;
} else {
this._timer = setTimeoutContext(function() {
this.state = STATE_RECOGNIZED;
this.tryEmit();
}, options.interval, this);
return STATE_BEGAN;
}
}
}
return STATE_FAILED;
},
failTimeout: function() {
this._timer = setTimeoutContext(function() {
this.state = STATE_FAILED;
}, this.options.interval, this);
return STATE_FAILED;
},
reset: function() {
clearTimeout(this._timer);
},
emit: function() {
if (this.state == STATE_RECOGNIZED) {
this._input.tapCount = this.count;
this.manager.emit(this.options.event, this._input);
}
}
});
/**
* Simple way to create a manager with a default set of recognizers.
* @param {HTMLElement} element
* @param {Object} [options]
* @constructor
*/
function Hammer(element, options) {
options = options || {};
options.recognizers = ifUndefined(options.recognizers, Hammer.defaults.preset);
return new Manager(element, options);
}
/**
* @const {string}
*/
Hammer.VERSION = '2.0.7';
/**
* default settings
* @namespace
*/
Hammer.defaults = {
/**
* set if DOM events are being triggered.
* But this is slower and unused by simple implementations, so disabled by default.
* @type {Boolean}
* @default false
*/
domEvents: false,
/**
* The value for the touchAction property/fallback.
* When set to `compute` it will magically set the correct value based on the added recognizers.
* @type {String}
* @default compute
*/
touchAction: TOUCH_ACTION_COMPUTE,
/**
* @type {Boolean}
* @default true
*/
enable: true,
/**
* EXPERIMENTAL FEATURE -- can be removed/changed
* Change the parent input target element.
* If Null, then it is being set the to main element.
* @type {Null|EventTarget}
* @default null
*/
inputTarget: null,
/**
* force an input class
* @type {Null|Function}
* @default null
*/
inputClass: null,
/**
* Default recognizer setup when calling `Hammer()`
* When creating a new Manager these will be skipped.
* @type {Array}
*/
preset: [
// RecognizerClass, options, [recognizeWith, ...], [requireFailure, ...]
[RotateRecognizer, {enable: false}],
[PinchRecognizer, {enable: false}, ['rotate']],
[SwipeRecognizer, {direction: DIRECTION_HORIZONTAL}],
[PanRecognizer, {direction: DIRECTION_HORIZONTAL}, ['swipe']],
[TapRecognizer],
[TapRecognizer, {event: 'doubletap', taps: 2}, ['tap']],
[PressRecognizer]
],
/**
* Some CSS properties can be used to improve the working of Hammer.
* Add them to this method and they will be set when creating a new Manager.
* @namespace
*/
cssProps: {
/**
* Disables text selection to improve the dragging gesture. Mainly for desktop browsers.
* @type {String}
* @default 'none'
*/
userSelect: 'none',
/**
* Disable the Windows Phone grippers when pressing an element.
* @type {String}
* @default 'none'
*/
touchSelect: 'none',
/**
* Disables the default callout shown when you touch and hold a touch target.
* On iOS, when you touch and hold a touch target such as a link, Safari displays
* a callout containing information about the link. This property allows you to disable that callout.
* @type {String}
* @default 'none'
*/
touchCallout: 'none',
/**
* Specifies whether zooming is enabled. Used by IE10>
* @type {String}
* @default 'none'
*/
contentZooming: 'none',
/**
* Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers.
* @type {String}
* @default 'none'
*/
userDrag: 'none',
/**
* Overrides the highlight color shown when the user taps a link or a JavaScript
* clickable element in iOS. This property obeys the alpha value, if specified.
* @type {String}
* @default 'rgba(0,0,0,0)'
*/
tapHighlightColor: 'rgba(0,0,0,0)'
}
};
var STOP = 1;
var FORCED_STOP = 2;
/**
* Manager
* @param {HTMLElement} element
* @param {Object} [options]
* @constructor
*/
function Manager(element, options) {
this.options = assign({}, Hammer.defaults, options || {});
this.options.inputTarget = this.options.inputTarget || element;
this.handlers = {};
this.session = {};
this.recognizers = [];
this.oldCssProps = {};
this.element = element;
this.input = createInputInstance(this);
this.touchAction = new TouchAction(this, this.options.touchAction);
toggleCssProps(this, true);
each(this.options.recognizers, function(item) {
var recognizer = this.add(new (item[0])(item[1]));
item[2] && recognizer.recognizeWith(item[2]);
item[3] && recognizer.requireFailure(item[3]);
}, this);
}
Manager.prototype = {
/**
* set options
* @param {Object} options
* @returns {Manager}
*/
set: function(options) {
assign(this.options, options);
// Options that need a little more setup
if (options.touchAction) {
this.touchAction.update();
}
if (options.inputTarget) {
// Clean up existing event listeners and reinitialize
this.input.destroy();
this.input.target = options.inputTarget;
this.input.init();
}
return this;
},
/**
* stop recognizing for this session.
* This session will be discarded, when a new [input]start event is fired.
* When forced, the recognizer cycle is stopped immediately.
* @param {Boolean} [force]
*/
stop: function(force) {
this.session.stopped = force ? FORCED_STOP : STOP;
},
/**
* run the recognizers!
* called by the inputHandler function on every movement of the pointers (touches)
* it walks through all the recognizers and tries to detect the gesture that is being made
* @param {Object} inputData
*/
recognize: function(inputData) {
var session = this.session;
if (session.stopped) {
return;
}
// run the touch-action polyfill
this.touchAction.preventDefaults(inputData);
var recognizer;
var recognizers = this.recognizers;
// this holds the recognizer that is being recognized.
// so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED
// if no recognizer is detecting a thing, it is set to `null`
var curRecognizer = session.curRecognizer;
// reset when the last recognizer is recognized
// or when we're in a new session
if (!curRecognizer || (curRecognizer && curRecognizer.state & STATE_RECOGNIZED)) {
curRecognizer = session.curRecognizer = null;
}
var i = 0;
while (i < recognizers.length) {
recognizer = recognizers[i];
// find out if we are allowed try to recognize the input for this one.
// 1. allow if the session is NOT forced stopped (see the .stop() method)
// 2. allow if we still haven't recognized a gesture in this session, or the this recognizer is the one
// that is being recognized.
// 3. allow if the recognizer is allowed to run simultaneous with the current recognized recognizer.
// this can be setup with the `recognizeWith()` method on the recognizer.
if (session.stopped !== FORCED_STOP && ( // 1
!curRecognizer || recognizer == curRecognizer || // 2
recognizer.canRecognizeWith(curRecognizer))) { // 3
recognizer.recognize(inputData);
} else {
recognizer.reset();
}
// if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the
// current active recognizer. but only if we don't already have an active recognizer
if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) {
curRecognizer = session.curRecognizer = recognizer;
}
i++;
}
},
/**
* get a recognizer by its event name.
* @param {Recognizer|String} recognizer
* @returns {Recognizer|Null}
*/
get: function(recognizer) {
if (recognizer instanceof Recognizer) {
return recognizer;
}
var recognizers = this.recognizers;
for (var i = 0; i < recognizers.length; i++) {
if (recognizers[i].options.event == recognizer) {
return recognizers[i];
}
}
return null;
},
/**
* add a recognizer to the manager
* existing recognizers with the same event name will be removed
* @param {Recognizer} recognizer
* @returns {Recognizer|Manager}
*/
add: function(recognizer) {
if (invokeArrayArg(recognizer, 'add', this)) {
return this;
}
// remove existing
var existing = this.get(recognizer.options.event);
if (existing) {
this.remove(existing);
}
this.recognizers.push(recognizer);
recognizer.manager = this;
this.touchAction.update();
return recognizer;
},
/**
* remove a recognizer by name or instance
* @param {Recognizer|String} recognizer
* @returns {Manager}
*/
remove: function(recognizer) {
if (invokeArrayArg(recognizer, 'remove', this)) {
return this;
}
recognizer = this.get(recognizer);
// let's make sure this recognizer exists
if (recognizer) {
var recognizers = this.recognizers;
var index = inArray(recognizers, recognizer);
if (index !== -1) {
recognizers.splice(index, 1);
this.touchAction.update();
}
}
return this;
},
/**
* bind event
* @param {String} events
* @param {Function} handler
* @returns {EventEmitter} this
*/
on: function(events, handler) {
if (events === undefined) {
return;
}
if (handler === undefined) {
return;
}
var handlers = this.handlers;
each(splitStr(events), function(event) {
handlers[event] = handlers[event] || [];
handlers[event].push(handler);
});
return this;
},
/**
* unbind event, leave emit blank to remove all handlers
* @param {String} events
* @param {Function} [handler]
* @returns {EventEmitter} this
*/
off: function(events, handler) {
if (events === undefined) {
return;
}
var handlers = this.handlers;
each(splitStr(events), function(event) {
if (!handler) {
delete handlers[event];
} else {
handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1);
}
});
return this;
},
/**
* emit event to the listeners
* @param {String} event
* @param {Object} data
*/
emit: function(event, data) {
// we also want to trigger dom events
if (this.options.domEvents) {
triggerDomEvent(event, data);
}
// no handlers, so skip it all
var handlers = this.handlers[event] && this.handlers[event].slice();
if (!handlers || !handlers.length) {
return;
}
data.type = event;
data.preventDefault = function() {
data.srcEvent.preventDefault();
};
var i = 0;
while (i < handlers.length) {
handlers[i](data);
i++;
}
},
/**
* destroy the manager and unbinds all events
* it doesn't unbind dom events, that is the user own responsibility
*/
destroy: function() {
this.element && toggleCssProps(this, false);
this.handlers = {};
this.session = {};
this.input.destroy();
this.element = null;
}
};
/**
* add/remove the css properties as defined in manager.options.cssProps
* @param {Manager} manager
* @param {Boolean} add
*/
function toggleCssProps(manager, add) {
var element = manager.element;
if (!element.style) {
return;
}
var prop;
each(manager.options.cssProps, function(value, name) {
prop = prefixed(element.style, name);
if (add) {
manager.oldCssProps[prop] = element.style[prop];
element.style[prop] = value;
} else {
element.style[prop] = manager.oldCssProps[prop] || '';
}
});
if (!add) {
manager.oldCssProps = {};
}
}
/**
* trigger dom event
* @param {String} event
* @param {Object} data
*/
function triggerDomEvent(event, data) {
var gestureEvent = document.createEvent('Event');
gestureEvent.initEvent(event, true, true);
gestureEvent.gesture = data;
data.target.dispatchEvent(gestureEvent);
}
assign(Hammer, {
INPUT_START: INPUT_START,
INPUT_MOVE: INPUT_MOVE,
INPUT_END: INPUT_END,
INPUT_CANCEL: INPUT_CANCEL,
STATE_POSSIBLE: STATE_POSSIBLE,
STATE_BEGAN: STATE_BEGAN,
STATE_CHANGED: STATE_CHANGED,
STATE_ENDED: STATE_ENDED,
STATE_RECOGNIZED: STATE_RECOGNIZED,
STATE_CANCELLED: STATE_CANCELLED,
STATE_FAILED: STATE_FAILED,
DIRECTION_NONE: DIRECTION_NONE,
DIRECTION_LEFT: DIRECTION_LEFT,
DIRECTION_RIGHT: DIRECTION_RIGHT,
DIRECTION_UP: DIRECTION_UP,
DIRECTION_DOWN: DIRECTION_DOWN,
DIRECTION_HORIZONTAL: DIRECTION_HORIZONTAL,
DIRECTION_VERTICAL: DIRECTION_VERTICAL,
DIRECTION_ALL: DIRECTION_ALL,
Manager: Manager,
Input: Input,
TouchAction: TouchAction,
TouchInput: TouchInput,
MouseInput: MouseInput,
PointerEventInput: PointerEventInput,
TouchMouseInput: TouchMouseInput,
SingleTouchInput: SingleTouchInput,
Recognizer: Recognizer,
AttrRecognizer: AttrRecognizer,
Tap: TapRecognizer,
Pan: PanRecognizer,
Swipe: SwipeRecognizer,
Pinch: PinchRecognizer,
Rotate: RotateRecognizer,
Press: PressRecognizer,
on: addEventListeners,
off: removeEventListeners,
each: each,
merge: merge,
extend: extend,
assign: assign,
inherit: inherit,
bindFn: bindFn,
prefixed: prefixed
});
// this prevents errors when Hammer is loaded in the presence of an AMD
// style loader but by script tag, not by the loader.
var freeGlobal = (typeof window !== 'undefined' ? window : (typeof self !== 'undefined' ? self : {})); // jshint ignore:line
freeGlobal.Hammer = Hammer;
if (true) {
!(__WEBPACK_AMD_DEFINE_RESULT__ = function() {
return Hammer;
}.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else if (typeof module != 'undefined' && module.exports) {
module.exports = Hammer;
} else {
window[exportName] = Hammer;
}
})(window, document, 'Hammer');
/***/ },
/* 358 */
/***/ function(module, exports) {
/*!
* is-extendable
*
* Copyright (c) 2015, Jon Schlinkert.
* Licensed under the MIT License.
*/
'use strict';
module.exports = function isExtendable(val) {
return typeof val !== 'undefined' && val !== null
&& (typeof val === 'object' || typeof val === 'function');
};
/***/ },
/* 359 */
/***/ function(module, exports, __webpack_require__) {
(function webpackUniversalModuleDefinition(root, factory) {
if(true)
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["tweenState"] = factory();
else
root["tweenState"] = factory();
})(this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ({
/***/ 0:
/*!*****************!*\
!*** multi lib ***!
\*****************/
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(/*! ./index.js */169);
/***/ },
/***/ 5:
/*!******************************!*\
!*** ./~/process/browser.js ***!
\******************************/
/***/ function(module, exports) {
// shim for using process in browser
var process = module.exports = {};
var queue = [];
var draining = false;
var currentQueue;
var queueIndex = -1;
function cleanUpNextTick() {
draining = false;
if (currentQueue.length) {
queue = currentQueue.concat(queue);
} else {
queueIndex = -1;
}
if (queue.length) {
drainQueue();
}
}
function drainQueue() {
if (draining) {
return;
}
var timeout = setTimeout(cleanUpNextTick);
draining = true;
var len = queue.length;
while(len) {
currentQueue = queue;
queue = [];
while (++queueIndex < len) {
if (currentQueue) {
currentQueue[queueIndex].run();
}
}
queueIndex = -1;
len = queue.length;
}
currentQueue = null;
draining = false;
clearTimeout(timeout);
}
process.nextTick = function (fun) {
var args = new Array(arguments.length - 1);
if (arguments.length > 1) {
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
}
}
queue.push(new Item(fun, args));
if (queue.length === 1 && !draining) {
setTimeout(drainQueue, 0);
}
};
// v8 likes predictible objects
function Item(fun, array) {
this.fun = fun;
this.array = array;
}
Item.prototype.run = function () {
this.fun.apply(null, this.array);
};
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues
process.versions = {};
function noop() {}
process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.binding = function (name) {
throw new Error('process.binding is not supported');
};
process.cwd = function () { return '/' };
process.chdir = function (dir) {
throw new Error('process.chdir is not supported');
};
process.umask = function() { return 0; };
/***/ },
/***/ 169:
/*!******************!*\
!*** ./index.js ***!
\******************/
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _tweenFunctions = __webpack_require__(/*! tween-functions */ 170);
var _tweenFunctions2 = _interopRequireDefault(_tweenFunctions);
var _raf = __webpack_require__(/*! raf */ 171);
var _raf2 = _interopRequireDefault(_raf);
// additive is the new iOS 8 default. In most cases it simulates a physics-
// looking overshoot behavior (especially with easeInOut. You can test that in
// the example
var DEFAULT_STACK_BEHAVIOR = 'ADDITIVE';
var DEFAULT_EASING = _tweenFunctions.easeInOutQuad;
var DEFAULT_DURATION = 300;
var DEFAULT_DELAY = 0;
var stackBehavior = {
ADDITIVE: 'ADDITIVE',
DESTRUCTIVE: 'DESTRUCTIVE'
};
var Mixin = {
_rafID: null,
getInitialState: function getInitialState() {
return {
tweenQueue: []
};
},
componentWillUnmount: function componentWillUnmount() {
_raf2['default'].cancel(this._rafID);
this._rafID = -1;
},
tweenState: function tweenState(path, _ref) {
var _this = this;
var easing = _ref.easing;
var duration = _ref.duration;
var delay = _ref.delay;
var beginValue = _ref.beginValue;
var endValue = _ref.endValue;
var onEnd = _ref.onEnd;
var configSB = _ref.stackBehavior;
this.setState(function (state) {
var cursor = state;
var stateName = undefined;
// see comment below on pash hash
var pathHash = undefined;
if (typeof path === 'string') {
stateName = path;
pathHash = path;
} else {
for (var i = 0; i < path.length - 1; i++) {
cursor = cursor[path[i]];
}
stateName = path[path.length - 1];
pathHash = path.join('|');
}
// see the reasoning for these defaults at the top of file
var newConfig = {
easing: easing || DEFAULT_EASING,
duration: duration == null ? DEFAULT_DURATION : duration,
delay: delay == null ? DEFAULT_DELAY : delay,
beginValue: beginValue == null ? cursor[stateName] : beginValue,
endValue: endValue,
onEnd: onEnd,
stackBehavior: configSB || DEFAULT_STACK_BEHAVIOR
};
var newTweenQueue = state.tweenQueue;
if (newConfig.stackBehavior === stackBehavior.DESTRUCTIVE) {
newTweenQueue = state.tweenQueue.filter(function (item) {
return item.pathHash !== pathHash;
});
}
// we store path hash, so that during value retrieval we can use hash
// comparison to find the path. See the kind of shitty thing you have to
// do when you don't have value comparison for collections?
newTweenQueue.push({
pathHash: pathHash,
config: newConfig,
initTime: Date.now() + newConfig.delay
});
// sorry for mutating. For perf reasons we don't want to deep clone.
// guys, can we please all start using persistent collections so that
// we can stop worrying about nonesense like this
cursor[stateName] = newConfig.endValue;
if (newTweenQueue.length === 1) {
_this._rafID = (0, _raf2['default'])(_this._rafCb);
}
// this will also include the above mutated update
return { tweenQueue: newTweenQueue };
});
},
getTweeningValue: function getTweeningValue(path) {
var state = this.state;
var tweeningValue = undefined;
var pathHash = undefined;
if (typeof path === 'string') {
tweeningValue = state[path];
pathHash = path;
} else {
tweeningValue = state;
for (var i = 0; i < path.length; i++) {
tweeningValue = tweeningValue[path[i]];
}
pathHash = path.join('|');
}
var now = Date.now();
for (var i = 0; i < state.tweenQueue.length; i++) {
var _state$tweenQueue$i = state.tweenQueue[i];
var itemPathHash = _state$tweenQueue$i.pathHash;
var initTime = _state$tweenQueue$i.initTime;
var config = _state$tweenQueue$i.config;
if (itemPathHash !== pathHash) {
continue;
}
var progressTime = now - initTime > config.duration ? config.duration : Math.max(0, now - initTime);
// `now - initTime` can be negative if initTime is scheduled in the
// future by a delay. In this case we take 0
// if duration is 0, consider that as jumping to endValue directly. This
// is needed because the easing functino might have undefined behavior for
// duration = 0
var easeValue = config.duration === 0 ? config.endValue : config.easing(progressTime, config.beginValue, config.endValue, config.duration);
// TODO: some funcs accept a 5th param
var contrib = easeValue - config.endValue;
tweeningValue += contrib;
}
return tweeningValue;
},
_rafCb: function _rafCb() {
var state = this.state;
if (state.tweenQueue.length === 0) {
return;
}
var now = Date.now();
var newTweenQueue = [];
for (var i = 0; i < state.tweenQueue.length; i++) {
var item = state.tweenQueue[i];
var initTime = item.initTime;
var config = item.config;
if (now - initTime < config.duration) {
newTweenQueue.push(item);
} else {
config.onEnd && config.onEnd();
}
}
// onEnd might trigger a parent callback that removes this component
// -1 means we've canceled it in componentWillUnmount
if (this._rafID === -1) {
return;
}
this.setState({
tweenQueue: newTweenQueue
});
this._rafID = (0, _raf2['default'])(this._rafCb);
}
};
exports['default'] = {
Mixin: Mixin,
easingTypes: _tweenFunctions2['default'],
stackBehavior: stackBehavior
};
module.exports = exports['default'];
/***/ },
/***/ 170:
/*!************************************!*\
!*** ./~/tween-functions/index.js ***!
\************************************/
/***/ function(module, exports) {
'use strict';
// t: current time, b: beginning value, _c: final value, d: total duration
var tweenFunctions = {
linear: function(t, b, _c, d) {
var c = _c - b;
return c * t / d + b;
},
easeInQuad: function(t, b, _c, d) {
var c = _c - b;
return c * (t /= d) * t + b;
},
easeOutQuad: function(t, b, _c, d) {
var c = _c - b;
return -c * (t /= d) * (t - 2) + b;
},
easeInOutQuad: function(t, b, _c, d) {
var c = _c - b;
if ((t /= d / 2) < 1) {
return c / 2 * t * t + b;
} else {
return -c / 2 * ((--t) * (t - 2) - 1) + b;
}
},
easeInCubic: function(t, b, _c, d) {
var c = _c - b;
return c * (t /= d) * t * t + b;
},
easeOutCubic: function(t, b, _c, d) {
var c = _c - b;
return c * ((t = t / d - 1) * t * t + 1) + b;
},
easeInOutCubic: function(t, b, _c, d) {
var c = _c - b;
if ((t /= d / 2) < 1) {
return c / 2 * t * t * t + b;
} else {
return c / 2 * ((t -= 2) * t * t + 2) + b;
}
},
easeInQuart: function(t, b, _c, d) {
var c = _c - b;
return c * (t /= d) * t * t * t + b;
},
easeOutQuart: function(t, b, _c, d) {
var c = _c - b;
return -c * ((t = t / d - 1) * t * t * t - 1) + b;
},
easeInOutQuart: function(t, b, _c, d) {
var c = _c - b;
if ((t /= d / 2) < 1) {
return c / 2 * t * t * t * t + b;
} else {
return -c / 2 * ((t -= 2) * t * t * t - 2) + b;
}
},
easeInQuint: function(t, b, _c, d) {
var c = _c - b;
return c * (t /= d) * t * t * t * t + b;
},
easeOutQuint: function(t, b, _c, d) {
var c = _c - b;
return c * ((t = t / d - 1) * t * t * t * t + 1) + b;
},
easeInOutQuint: function(t, b, _c, d) {
var c = _c - b;
if ((t /= d / 2) < 1) {
return c / 2 * t * t * t * t * t + b;
} else {
return c / 2 * ((t -= 2) * t * t * t * t + 2) + b;
}
},
easeInSine: function(t, b, _c, d) {
var c = _c - b;
return -c * Math.cos(t / d * (Math.PI / 2)) + c + b;
},
easeOutSine: function(t, b, _c, d) {
var c = _c - b;
return c * Math.sin(t / d * (Math.PI / 2)) + b;
},
easeInOutSine: function(t, b, _c, d) {
var c = _c - b;
return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b;
},
easeInExpo: function(t, b, _c, d) {
var c = _c - b;
return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
},
easeOutExpo: function(t, b, _c, d) {
var c = _c - b;
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
},
easeInOutExpo: function(t, b, _c, d) {
var c = _c - b;
if (t === 0) {
return b;
}
if (t === d) {
return b + c;
}
if ((t /= d / 2) < 1) {
return c / 2 * Math.pow(2, 10 * (t - 1)) + b;
} else {
return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b;
}
},
easeInCirc: function(t, b, _c, d) {
var c = _c - b;
return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b;
},
easeOutCirc: function(t, b, _c, d) {
var c = _c - b;
return c * Math.sqrt(1 - (t = t / d - 1) * t) + b;
},
easeInOutCirc: function(t, b, _c, d) {
var c = _c - b;
if ((t /= d / 2) < 1) {
return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b;
} else {
return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b;
}
},
easeInElastic: function(t, b, _c, d) {
var c = _c - b;
var a, p, s;
s = 1.70158;
p = 0;
a = c;
if (t === 0) {
return b;
} else if ((t /= d) === 1) {
return b + c;
}
if (!p) {
p = d * 0.3;
}
if (a < Math.abs(c)) {
a = c;
s = p / 4;
} else {
s = p / (2 * Math.PI) * Math.asin(c / a);
}
return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
},
easeOutElastic: function(t, b, _c, d) {
var c = _c - b;
var a, p, s;
s = 1.70158;
p = 0;
a = c;
if (t === 0) {
return b;
} else if ((t /= d) === 1) {
return b + c;
}
if (!p) {
p = d * 0.3;
}
if (a < Math.abs(c)) {
a = c;
s = p / 4;
} else {
s = p / (2 * Math.PI) * Math.asin(c / a);
}
return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b;
},
easeInOutElastic: function(t, b, _c, d) {
var c = _c - b;
var a, p, s;
s = 1.70158;
p = 0;
a = c;
if (t === 0) {
return b;
} else if ((t /= d / 2) === 2) {
return b + c;
}
if (!p) {
p = d * (0.3 * 1.5);
}
if (a < Math.abs(c)) {
a = c;
s = p / 4;
} else {
s = p / (2 * Math.PI) * Math.asin(c / a);
}
if (t < 1) {
return -0.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
} else {
return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * 0.5 + c + b;
}
},
easeInBack: function(t, b, _c, d, s) {
var c = _c - b;
if (s === void 0) {
s = 1.70158;
}
return c * (t /= d) * t * ((s + 1) * t - s) + b;
},
easeOutBack: function(t, b, _c, d, s) {
var c = _c - b;
if (s === void 0) {
s = 1.70158;
}
return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;
},
easeInOutBack: function(t, b, _c, d, s) {
var c = _c - b;
if (s === void 0) {
s = 1.70158;
}
if ((t /= d / 2) < 1) {
return c / 2 * (t * t * (((s *= 1.525) + 1) * t - s)) + b;
} else {
return c / 2 * ((t -= 2) * t * (((s *= 1.525) + 1) * t + s) + 2) + b;
}
},
easeInBounce: function(t, b, _c, d) {
var c = _c - b;
var v;
v = tweenFunctions.easeOutBounce(d - t, 0, c, d);
return c - v + b;
},
easeOutBounce: function(t, b, _c, d) {
var c = _c - b;
if ((t /= d) < 1 / 2.75) {
return c * (7.5625 * t * t) + b;
} else if (t < 2 / 2.75) {
return c * (7.5625 * (t -= 1.5 / 2.75) * t + 0.75) + b;
} else if (t < 2.5 / 2.75) {
return c * (7.5625 * (t -= 2.25 / 2.75) * t + 0.9375) + b;
} else {
return c * (7.5625 * (t -= 2.625 / 2.75) * t + 0.984375) + b;
}
},
easeInOutBounce: function(t, b, _c, d) {
var c = _c - b;
var v;
if (t < d / 2) {
v = tweenFunctions.easeInBounce(t * 2, 0, c, d);
return v * 0.5 + b;
} else {
v = tweenFunctions.easeOutBounce(t * 2 - d, 0, c, d);
return v * 0.5 + c * 0.5 + b;
}
}
};
module.exports = tweenFunctions;
/***/ },
/***/ 171:
/*!************************!*\
!*** ./~/raf/index.js ***!
\************************/
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(global) {var now = __webpack_require__(/*! performance-now */ 172)
, root = typeof window === 'undefined' ? global : window
, vendors = ['moz', 'webkit']
, suffix = 'AnimationFrame'
, raf = root['request' + suffix]
, caf = root['cancel' + suffix] || root['cancelRequest' + suffix]
for(var i = 0; !raf && i < vendors.length; i++) {
raf = root[vendors[i] + 'Request' + suffix]
caf = root[vendors[i] + 'Cancel' + suffix]
|| root[vendors[i] + 'CancelRequest' + suffix]
}
// Some versions of FF have rAF but not cAF
if(!raf || !caf) {
var last = 0
, id = 0
, queue = []
, frameDuration = 1000 / 60
raf = function(callback) {
if(queue.length === 0) {
var _now = now()
, next = Math.max(0, frameDuration - (_now - last))
last = next + _now
setTimeout(function() {
var cp = queue.slice(0)
// Clear queue here to prevent
// callbacks from appending listeners
// to the current frame's queue
queue.length = 0
for(var i = 0; i < cp.length; i++) {
if(!cp[i].cancelled) {
try{
cp[i].callback(last)
} catch(e) {
setTimeout(function() { throw e }, 0)
}
}
}
}, Math.round(next))
}
queue.push({
handle: ++id,
callback: callback,
cancelled: false
})
return id
}
caf = function(handle) {
for(var i = 0; i < queue.length; i++) {
if(queue[i].handle === handle) {
queue[i].cancelled = true
}
}
}
}
module.exports = function(fn) {
// Wrap in a new function to prevent
// `cancel` potentially being assigned
// to the native rAF function
return raf.call(root, fn)
}
module.exports.cancel = function() {
caf.apply(root, arguments)
}
module.exports.polyfill = function() {
root.requestAnimationFrame = raf
root.cancelAnimationFrame = caf
}
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
/***/ },
/***/ 172:
/*!**************************************************!*\
!*** ./~/performance-now/lib/performance-now.js ***!
\**************************************************/
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {// Generated by CoffeeScript 1.7.1
(function() {
var getNanoSeconds, hrtime, loadTime;
if ((typeof performance !== "undefined" && performance !== null) && performance.now) {
module.exports = function() {
return performance.now();
};
} else if ((typeof process !== "undefined" && process !== null) && process.hrtime) {
module.exports = function() {
return (getNanoSeconds() - loadTime) / 1e6;
};
hrtime = process.hrtime;
getNanoSeconds = function() {
var hr;
hr = hrtime();
return hr[0] * 1e9 + hr[1];
};
loadTime = getNanoSeconds();
} else if (Date.now) {
module.exports = function() {
return Date.now() - loadTime;
};
loadTime = Date.now();
} else {
module.exports = function() {
return new Date().getTime() - loadTime;
};
loadTime = new Date().getTime();
}
}).call(this);
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(/*! ./~/process/browser.js */ 5)))
/***/ }
/******/ })
});
;
//# sourceMappingURL=index.js.map
/***/ },
/* 360 */
/***/ 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
*/
/** `Object#toString` result references. */
var funcTag = '[object Function]';
/** Used to detect host constructors (Safari > 5). */
var reIsHostCtor = /^\[object .+?Constructor\]$/;
/**
* 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';
}
/** Used for native method references. */
var objectProto = Object.prototype;
/** Used to resolve the decompiled source of functions. */
var fnToString = Function.prototype.toString;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
* of values.
*/
var objToString = objectProto.toString;
/** Used to detect if a method is native. */
var reIsNative = RegExp('^' +
fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
);
/**
* 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;
}
/**
* 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;
}
/**
* 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');
}
/**
* 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);
}
module.exports = getNative;
/***/ },
/* 361 */
/***/ function(module, exports) {
/* WEBPACK VAR INJECTION */(function(global) {/**
* lodash (Custom Build)
* Build: `lodash modularize exports="npm" -o ./`
* Copyright jQuery Foundation and other contributors
* Released under MIT license
* Based on Underscore.js 1.8.3
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/
/** Used as the `TypeError` message for "Functions" methods. */
var FUNC_ERROR_TEXT = 'Expected a function';
/** Used as references for various `Number` constants. */
var NAN = 0 / 0;
/** `Object#toString` result references. */
var symbolTag = '[object Symbol]';
/** Used to match leading and trailing whitespace. */
var reTrim = /^\s+|\s+$/g;
/** Used to detect bad signed hexadecimal string values. */
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
/** Used to detect binary string values. */
var reIsBinary = /^0b[01]+$/i;
/** Used to detect octal string values. */
var reIsOctal = /^0o[0-7]+$/i;
/** Built-in method references without a dependency on `root`. */
var freeParseInt = parseInt;
/** Detect free variable `global` from Node.js. */
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
/** Detect free variable `self`. */
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
/** Used as a reference to the global object. */
var root = freeGlobal || freeSelf || Function('return this')();
/** Used for built-in method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMax = Math.max,
nativeMin = Math.min;
/**
* Gets the timestamp of the number of milliseconds that have elapsed since
* the Unix epoch (1 January 1970 00:00:00 UTC).
*
* @static
* @memberOf _
* @since 2.4.0
* @category Date
* @returns {number} Returns the timestamp.
* @example
*
* _.defer(function(stamp) {
* console.log(_.now() - stamp);
* }, _.now());
* // => Logs the number of milliseconds it took for the deferred invocation.
*/
var now = function() {
return root.Date.now();
};
/**
* Creates a debounced function that delays invoking `func` until after `wait`
* milliseconds have elapsed since the last time the debounced function was
* invoked. The debounced function comes with a `cancel` method to cancel
* delayed `func` invocations and a `flush` method to immediately invoke them.
* Provide `options` to indicate whether `func` should be invoked on the
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked
* with the last arguments provided to the debounced function. Subsequent
* calls to the debounced function return the result of the last `func`
* invocation.
*
* **Note:** If `leading` and `trailing` options are `true`, `func` is
* invoked on the trailing edge of the timeout only if the debounced function
* is invoked more than once during the `wait` timeout.
*
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
*
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
* for details over the differences between `_.debounce` and `_.throttle`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Function
* @param {Function} func The function to debounce.
* @param {number} [wait=0] The number of milliseconds to delay.
* @param {Object} [options={}] The options object.
* @param {boolean} [options.leading=false]
* Specify invoking on the leading edge of the timeout.
* @param {number} [options.maxWait]
* The maximum time `func` is allowed to be delayed before it's invoked.
* @param {boolean} [options.trailing=true]
* Specify invoking on the trailing edge of the timeout.
* @returns {Function} Returns the new debounced function.
* @example
*
* // Avoid costly calculations while the window size is in flux.
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
*
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
* jQuery(element).on('click', _.debounce(sendMail, 300, {
* 'leading': true,
* 'trailing': false
* }));
*
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
* var source = new EventSource('/stream');
* jQuery(source).on('message', debounced);
*
* // Cancel the trailing debounced invocation.
* jQuery(window).on('popstate', debounced.cancel);
*/
function debounce(func, wait, options) {
var lastArgs,
lastThis,
maxWait,
result,
timerId,
lastCallTime,
lastInvokeTime = 0,
leading = false,
maxing = false,
trailing = true;
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
wait = toNumber(wait) || 0;
if (isObject(options)) {
leading = !!options.leading;
maxing = 'maxWait' in options;
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
trailing = 'trailing' in options ? !!options.trailing : trailing;
}
function invokeFunc(time) {
var args = lastArgs,
thisArg = lastThis;
lastArgs = lastThis = undefined;
lastInvokeTime = time;
result = func.apply(thisArg, args);
return result;
}
function leadingEdge(time) {
// Reset any `maxWait` timer.
lastInvokeTime = time;
// Start the timer for the trailing edge.
timerId = setTimeout(timerExpired, wait);
// Invoke the leading edge.
return leading ? invokeFunc(time) : result;
}
function remainingWait(time) {
var timeSinceLastCall = time - lastCallTime,
timeSinceLastInvoke = time - lastInvokeTime,
result = wait - timeSinceLastCall;
return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
}
function shouldInvoke(time) {
var timeSinceLastCall = time - lastCallTime,
timeSinceLastInvoke = time - lastInvokeTime;
// Either this is the first call, activity has stopped and we're at the
// trailing edge, the system time has gone backwards and we're treating
// it as the trailing edge, or we've hit the `maxWait` limit.
return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
(timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
}
function timerExpired() {
var time = now();
if (shouldInvoke(time)) {
return trailingEdge(time);
}
// Restart the timer.
timerId = setTimeout(timerExpired, remainingWait(time));
}
function trailingEdge(time) {
timerId = undefined;
// Only invoke if we have `lastArgs` which means `func` has been
// debounced at least once.
if (trailing && lastArgs) {
return invokeFunc(time);
}
lastArgs = lastThis = undefined;
return result;
}
function cancel() {
if (timerId !== undefined) {
clearTimeout(timerId);
}
lastInvokeTime = 0;
lastArgs = lastCallTime = lastThis = timerId = undefined;
}
function flush() {
return timerId === undefined ? result : trailingEdge(now());
}
function debounced() {
var time = now(),
isInvoking = shouldInvoke(time);
lastArgs = arguments;
lastThis = this;
lastCallTime = time;
if (isInvoking) {
if (timerId === undefined) {
return leadingEdge(lastCallTime);
}
if (maxing) {
// Handle invocations in a tight loop.
timerId = setTimeout(timerExpired, wait);
return invokeFunc(lastCallTime);
}
}
if (timerId === undefined) {
timerId = setTimeout(timerExpired, wait);
}
return result;
}
debounced.cancel = cancel;
debounced.flush = flush;
return debounced;
}
/**
* Checks if `value` is the
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @since 0.1.0
* @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(_.noop);
* // => true
*
* _.isObject(null);
* // => false
*/
function isObject(value) {
var type = typeof value;
return !!value && (type == 'object' || type == 'function');
}
/**
* Checks if `value` is object-like. A value is object-like if it's not `null`
* and has a `typeof` result of "object".
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
* @example
*
* _.isObjectLike({});
* // => true
*
* _.isObjectLike([1, 2, 3]);
* // => true
*
* _.isObjectLike(_.noop);
* // => false
*
* _.isObjectLike(null);
* // => false
*/
function isObjectLike(value) {
return !!value && typeof value == 'object';
}
/**
* Checks if `value` is classified as a `Symbol` primitive or object.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
* @example
*
* _.isSymbol(Symbol.iterator);
* // => true
*
* _.isSymbol('abc');
* // => false
*/
function isSymbol(value) {
return typeof value == 'symbol' ||
(isObjectLike(value) && objectToString.call(value) == symbolTag);
}
/**
* Converts `value` to a number.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to process.
* @returns {number} Returns the number.
* @example
*
* _.toNumber(3.2);
* // => 3.2
*
* _.toNumber(Number.MIN_VALUE);
* // => 5e-324
*
* _.toNumber(Infinity);
* // => Infinity
*
* _.toNumber('3.2');
* // => 3.2
*/
function toNumber(value) {
if (typeof value == 'number') {
return value;
}
if (isSymbol(value)) {
return NAN;
}
if (isObject(value)) {
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
value = isObject(other) ? (other + '') : other;
}
if (typeof value != 'string') {
return value === 0 ? value : +value;
}
value = value.replace(reTrim, '');
var isBinary = reIsBinary.test(value);
return (isBinary || reIsOctal.test(value))
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
: (reIsBadHex.test(value) ? NAN : +value);
}
module.exports = debounce;
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
/***/ },
/* 362 */
/***/ function(module, exports) {
/* WEBPACK VAR INJECTION */(function(global) {/**
* lodash (Custom Build)
* Build: `lodash modularize exports="npm" -o ./`
* Copyright jQuery Foundation and other contributors
* Released under MIT license
* Based on Underscore.js 1.8.3
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/
/** Used as the `TypeError` message for "Functions" methods. */
var FUNC_ERROR_TEXT = 'Expected a function';
/** Used to stand-in for `undefined` hash values. */
var HASH_UNDEFINED = '__lodash_hash_undefined__';
/** Used as references for various `Number` constants. */
var INFINITY = 1 / 0;
/** `Object#toString` result references. */
var funcTag = '[object Function]',
genTag = '[object GeneratorFunction]',
symbolTag = '[object Symbol]';
/** Used to match property names within property paths. */
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
reIsPlainProp = /^\w*$/,
reLeadingDot = /^\./,
rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
/**
* Used to match `RegExp`
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
*/
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
/** Used to match backslashes in property paths. */
var reEscapeChar = /\\(\\)?/g;
/** Used to detect host constructors (Safari). */
var reIsHostCtor = /^\[object .+?Constructor\]$/;
/** Detect free variable `global` from Node.js. */
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
/** Detect free variable `self`. */
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
/** Used as a reference to the global object. */
var root = freeGlobal || freeSelf || Function('return this')();
/**
* Gets the value at `key` of `object`.
*
* @private
* @param {Object} [object] The object to query.
* @param {string} key The key of the property to get.
* @returns {*} Returns the property value.
*/
function getValue(object, key) {
return object == null ? undefined : object[key];
}
/**
* Checks if `value` is a host object in IE < 9.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a host object, else `false`.
*/
function isHostObject(value) {
// Many host objects are `Object` objects that can coerce to strings
// despite having improperly defined `toString` methods.
var result = false;
if (value != null && typeof value.toString != 'function') {
try {
result = !!(value + '');
} catch (e) {}
}
return result;
}
/** Used for built-in method references. */
var arrayProto = Array.prototype,
funcProto = Function.prototype,
objectProto = Object.prototype;
/** Used to detect overreaching core-js shims. */
var coreJsData = root['__core-js_shared__'];
/** Used to detect methods masquerading as native. */
var maskSrcKey = (function() {
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
return uid ? ('Symbol(src)_1.' + uid) : '';
}());
/** Used to resolve the decompiled source of functions. */
var funcToString = funcProto.toString;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
/** Used to detect if a method is native. */
var reIsNative = RegExp('^' +
funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
);
/** Built-in value references. */
var Symbol = root.Symbol,
splice = arrayProto.splice;
/* Built-in method references that are verified to be native. */
var Map = getNative(root, 'Map'),
nativeCreate = getNative(Object, 'create');
/** Used to convert symbols to primitives and strings. */
var symbolProto = Symbol ? Symbol.prototype : undefined,
symbolToString = symbolProto ? symbolProto.toString : undefined;
/**
* Creates a hash object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Hash(entries) {
var index = -1,
length = entries ? entries.length : 0;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
/**
* Removes all key-value entries from the hash.
*
* @private
* @name clear
* @memberOf Hash
*/
function hashClear() {
this.__data__ = nativeCreate ? nativeCreate(null) : {};
}
/**
* Removes `key` and its value from the hash.
*
* @private
* @name delete
* @memberOf Hash
* @param {Object} hash The hash to modify.
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function hashDelete(key) {
return this.has(key) && delete this.__data__[key];
}
/**
* Gets the hash value for `key`.
*
* @private
* @name get
* @memberOf Hash
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function hashGet(key) {
var data = this.__data__;
if (nativeCreate) {
var result = data[key];
return result === HASH_UNDEFINED ? undefined : result;
}
return hasOwnProperty.call(data, key) ? data[key] : undefined;
}
/**
* Checks if a hash value for `key` exists.
*
* @private
* @name has
* @memberOf Hash
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function hashHas(key) {
var data = this.__data__;
return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
}
/**
* Sets the hash `key` to `value`.
*
* @private
* @name set
* @memberOf Hash
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the hash instance.
*/
function hashSet(key, value) {
var data = this.__data__;
data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
return this;
}
// Add methods to `Hash`.
Hash.prototype.clear = hashClear;
Hash.prototype['delete'] = hashDelete;
Hash.prototype.get = hashGet;
Hash.prototype.has = hashHas;
Hash.prototype.set = hashSet;
/**
* Creates an list cache object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function ListCache(entries) {
var index = -1,
length = entries ? entries.length : 0;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
/**
* Removes all key-value entries from the list cache.
*
* @private
* @name clear
* @memberOf ListCache
*/
function listCacheClear() {
this.__data__ = [];
}
/**
* Removes `key` and its value from the list cache.
*
* @private
* @name delete
* @memberOf ListCache
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function listCacheDelete(key) {
var data = this.__data__,
index = assocIndexOf(data, key);
if (index < 0) {
return false;
}
var lastIndex = data.length - 1;
if (index == lastIndex) {
data.pop();
} else {
splice.call(data, index, 1);
}
return true;
}
/**
* Gets the list cache value for `key`.
*
* @private
* @name get
* @memberOf ListCache
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function listCacheGet(key) {
var data = this.__data__,
index = assocIndexOf(data, key);
return index < 0 ? undefined : data[index][1];
}
/**
* Checks if a list cache value for `key` exists.
*
* @private
* @name has
* @memberOf ListCache
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function listCacheHas(key) {
return assocIndexOf(this.__data__, key) > -1;
}
/**
* Sets the list cache `key` to `value`.
*
* @private
* @name set
* @memberOf ListCache
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the list cache instance.
*/
function listCacheSet(key, value) {
var data = this.__data__,
index = assocIndexOf(data, key);
if (index < 0) {
data.push([key, value]);
} else {
data[index][1] = value;
}
return this;
}
// Add methods to `ListCache`.
ListCache.prototype.clear = listCacheClear;
ListCache.prototype['delete'] = listCacheDelete;
ListCache.prototype.get = listCacheGet;
ListCache.prototype.has = listCacheHas;
ListCache.prototype.set = listCacheSet;
/**
* Creates a map cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function MapCache(entries) {
var index = -1,
length = entries ? entries.length : 0;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
/**
* Removes all key-value entries from the map.
*
* @private
* @name clear
* @memberOf MapCache
*/
function mapCacheClear() {
this.__data__ = {
'hash': new Hash,
'map': new (Map || ListCache),
'string': new Hash
};
}
/**
* Removes `key` and its value from the map.
*
* @private
* @name delete
* @memberOf MapCache
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function mapCacheDelete(key) {
return getMapData(this, key)['delete'](key);
}
/**
* Gets the map value for `key`.
*
* @private
* @name get
* @memberOf MapCache
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function mapCacheGet(key) {
return getMapData(this, key).get(key);
}
/**
* Checks if a map value for `key` exists.
*
* @private
* @name has
* @memberOf MapCache
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function mapCacheHas(key) {
return getMapData(this, key).has(key);
}
/**
* Sets the map `key` to `value`.
*
* @private
* @name set
* @memberOf MapCache
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the map cache instance.
*/
function mapCacheSet(key, value) {
getMapData(this, key).set(key, value);
return this;
}
// Add methods to `MapCache`.
MapCache.prototype.clear = mapCacheClear;
MapCache.prototype['delete'] = mapCacheDelete;
MapCache.prototype.get = mapCacheGet;
MapCache.prototype.has = mapCacheHas;
MapCache.prototype.set = mapCacheSet;
/**
* Gets the index at which the `key` is found in `array` of key-value pairs.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} key The key to search for.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function assocIndexOf(array, key) {
var length = array.length;
while (length--) {
if (eq(array[length][0], key)) {
return length;
}
}
return -1;
}
/**
* The base implementation of `_.get` without support for default values.
*
* @private
* @param {Object} object The object to query.
* @param {Array|string} path The path of the property to get.
* @returns {*} Returns the resolved value.
*/
function baseGet(object, path) {
path = isKey(path, object) ? [path] : castPath(path);
var index = 0,
length = path.length;
while (object != null && index < length) {
object = object[toKey(path[index++])];
}
return (index && index == length) ? object : undefined;
}
/**
* The base implementation of `_.isNative` without bad shim checks.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a native function,
* else `false`.
*/
function baseIsNative(value) {
if (!isObject(value) || isMasked(value)) {
return false;
}
var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
return pattern.test(toSource(value));
}
/**
* The base implementation of `_.toString` which doesn't convert nullish
* values to empty strings.
*
* @private
* @param {*} value The value to process.
* @returns {string} Returns the string.
*/
function baseToString(value) {
// Exit early for strings to avoid a performance hit in some environments.
if (typeof value == 'string') {
return value;
}
if (isSymbol(value)) {
return symbolToString ? symbolToString.call(value) : '';
}
var result = (value + '');
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
}
/**
* Casts `value` to a path array if it's not one.
*
* @private
* @param {*} value The value to inspect.
* @returns {Array} Returns the cast property path array.
*/
function castPath(value) {
return isArray(value) ? value : stringToPath(value);
}
/**
* Gets the data for `map`.
*
* @private
* @param {Object} map The map to query.
* @param {string} key The reference key.
* @returns {*} Returns the map data.
*/
function getMapData(map, key) {
var data = map.__data__;
return isKeyable(key)
? data[typeof key == 'string' ? 'string' : 'hash']
: data.map;
}
/**
* 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 = getValue(object, key);
return baseIsNative(value) ? value : undefined;
}
/**
* Checks if `value` is a property name and not a property path.
*
* @private
* @param {*} value The value to check.
* @param {Object} [object] The object to query keys on.
* @returns {boolean} Returns `true` if `value` is a property name, else `false`.
*/
function isKey(value, object) {
if (isArray(value)) {
return false;
}
var type = typeof value;
if (type == 'number' || type == 'symbol' || type == 'boolean' ||
value == null || isSymbol(value)) {
return true;
}
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
(object != null && value in Object(object));
}
/**
* Checks if `value` is suitable for use as unique object key.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
*/
function isKeyable(value) {
var type = typeof value;
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
? (value !== '__proto__')
: (value === null);
}
/**
* Checks if `func` has its source masked.
*
* @private
* @param {Function} func The function to check.
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
*/
function isMasked(func) {
return !!maskSrcKey && (maskSrcKey in func);
}
/**
* Converts `string` to a property path array.
*
* @private
* @param {string} string The string to convert.
* @returns {Array} Returns the property path array.
*/
var stringToPath = memoize(function(string) {
string = toString(string);
var result = [];
if (reLeadingDot.test(string)) {
result.push('');
}
string.replace(rePropName, function(match, number, quote, string) {
result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
});
return result;
});
/**
* Converts `value` to a string key if it's not a string or symbol.
*
* @private
* @param {*} value The value to inspect.
* @returns {string|symbol} Returns the key.
*/
function toKey(value) {
if (typeof value == 'string' || isSymbol(value)) {
return value;
}
var result = (value + '');
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
}
/**
* Converts `func` to its source code.
*
* @private
* @param {Function} func The function to process.
* @returns {string} Returns the source code.
*/
function toSource(func) {
if (func != null) {
try {
return funcToString.call(func);
} catch (e) {}
try {
return (func + '');
} catch (e) {}
}
return '';
}
/**
* Creates a function that memoizes the result of `func`. If `resolver` is
* provided, it determines the cache key for storing the result based on the
* arguments provided to the memoized function. By default, the first argument
* provided to the memoized function is used as the map cache key. The `func`
* is invoked with the `this` binding of the memoized function.
*
* **Note:** The cache is exposed as the `cache` property on the memoized
* function. Its creation may be customized by replacing the `_.memoize.Cache`
* constructor with one whose instances implement the
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
* method interface of `delete`, `get`, `has`, and `set`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Function
* @param {Function} func The function to have its output memoized.
* @param {Function} [resolver] The function to resolve the cache key.
* @returns {Function} Returns the new memoized function.
* @example
*
* var object = { 'a': 1, 'b': 2 };
* var other = { 'c': 3, 'd': 4 };
*
* var values = _.memoize(_.values);
* values(object);
* // => [1, 2]
*
* values(other);
* // => [3, 4]
*
* object.a = 2;
* values(object);
* // => [1, 2]
*
* // Modify the result cache.
* values.cache.set(object, ['a', 'b']);
* values(object);
* // => ['a', 'b']
*
* // Replace `_.memoize.Cache`.
* _.memoize.Cache = WeakMap;
*/
function memoize(func, resolver) {
if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {
throw new TypeError(FUNC_ERROR_TEXT);
}
var memoized = function() {
var args = arguments,
key = resolver ? resolver.apply(this, args) : args[0],
cache = memoized.cache;
if (cache.has(key)) {
return cache.get(key);
}
var result = func.apply(this, args);
memoized.cache = cache.set(key, result);
return result;
};
memoized.cache = new (memoize.Cache || MapCache);
return memoized;
}
// Assign cache to `_.memoize`.
memoize.Cache = MapCache;
/**
* Performs a
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* comparison between two values to determine if they are equivalent.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* @example
*
* var object = { 'a': 1 };
* var other = { 'a': 1 };
*
* _.eq(object, object);
* // => true
*
* _.eq(object, other);
* // => false
*
* _.eq('a', 'a');
* // => true
*
* _.eq('a', Object('a'));
* // => false
*
* _.eq(NaN, NaN);
* // => true
*/
function eq(value, other) {
return value === other || (value !== value && other !== other);
}
/**
* Checks if `value` is classified as an `Array` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
* @example
*
* _.isArray([1, 2, 3]);
* // => true
*
* _.isArray(document.body.children);
* // => false
*
* _.isArray('abc');
* // => false
*
* _.isArray(_.noop);
* // => false
*/
var isArray = Array.isArray;
/**
* Checks if `value` is classified as a `Function` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
* @example
*
* _.isFunction(_);
* // => true
*
* _.isFunction(/abc/);
* // => false
*/
function isFunction(value) {
// The use of `Object#toString` avoids issues with the `typeof` operator
// in Safari 8-9 which returns 'object' for typed array and other constructors.
var tag = isObject(value) ? objectToString.call(value) : '';
return tag == funcTag || tag == genTag;
}
/**
* Checks if `value` is the
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @since 0.1.0
* @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(_.noop);
* // => true
*
* _.isObject(null);
* // => false
*/
function isObject(value) {
var type = typeof value;
return !!value && (type == 'object' || type == 'function');
}
/**
* Checks if `value` is object-like. A value is object-like if it's not `null`
* and has a `typeof` result of "object".
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
* @example
*
* _.isObjectLike({});
* // => true
*
* _.isObjectLike([1, 2, 3]);
* // => true
*
* _.isObjectLike(_.noop);
* // => false
*
* _.isObjectLike(null);
* // => false
*/
function isObjectLike(value) {
return !!value && typeof value == 'object';
}
/**
* Checks if `value` is classified as a `Symbol` primitive or object.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
* @example
*
* _.isSymbol(Symbol.iterator);
* // => true
*
* _.isSymbol('abc');
* // => false
*/
function isSymbol(value) {
return typeof value == 'symbol' ||
(isObjectLike(value) && objectToString.call(value) == symbolTag);
}
/**
* Converts `value` to a string. An empty string is returned for `null`
* and `undefined` values. The sign of `-0` is preserved.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to process.
* @returns {string} Returns the string.
* @example
*
* _.toString(null);
* // => ''
*
* _.toString(-0);
* // => '-0'
*
* _.toString([1, 2, 3]);
* // => '1,2,3'
*/
function toString(value) {
return value == null ? '' : baseToString(value);
}
/**
* Gets the value at `path` of `object`. If the resolved value is
* `undefined`, the `defaultValue` is returned in its place.
*
* @static
* @memberOf _
* @since 3.7.0
* @category Object
* @param {Object} object The object to query.
* @param {Array|string} path The path of the property to get.
* @param {*} [defaultValue] The value returned for `undefined` resolved values.
* @returns {*} Returns the resolved value.
* @example
*
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
*
* _.get(object, 'a[0].b.c');
* // => 3
*
* _.get(object, ['a', '0', 'b', 'c']);
* // => 3
*
* _.get(object, 'a.b.c', 'default');
* // => 'default'
*/
function get(object, path, defaultValue) {
var result = object == null ? undefined : baseGet(object, path);
return result === undefined ? defaultValue : result;
}
module.exports = get;
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
/***/ },
/* 363 */
/***/ function(module, exports) {
/**
* lodash (Custom Build)
* Build: `lodash modularize exports="npm" -o ./`
* Copyright jQuery Foundation and other contributors
* Released under MIT license
* Based on Underscore.js 1.8.3
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/
/** Used as references for various `Number` constants. */
var MAX_SAFE_INTEGER = 9007199254740991;
/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
funcTag = '[object Function]',
genTag = '[object GeneratorFunction]';
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
/** Built-in value references. */
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
/**
* Checks if `value` is likely an `arguments` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
* else `false`.
* @example
*
* _.isArguments(function() { return arguments; }());
* // => true
*
* _.isArguments([1, 2, 3]);
* // => false
*/
function isArguments(value) {
// Safari 8.1 makes `arguments.callee` enumerable in strict mode.
return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
(!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
}
/**
* Checks if `value` is array-like. A value is considered array-like if it's
* not a function and has a `value.length` that's an integer greater than or
* equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
* @example
*
* _.isArrayLike([1, 2, 3]);
* // => true
*
* _.isArrayLike(document.body.children);
* // => true
*
* _.isArrayLike('abc');
* // => true
*
* _.isArrayLike(_.noop);
* // => false
*/
function isArrayLike(value) {
return value != null && isLength(value.length) && !isFunction(value);
}
/**
* This method is like `_.isArrayLike` except that it also checks if `value`
* is an object.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an array-like object,
* else `false`.
* @example
*
* _.isArrayLikeObject([1, 2, 3]);
* // => true
*
* _.isArrayLikeObject(document.body.children);
* // => true
*
* _.isArrayLikeObject('abc');
* // => false
*
* _.isArrayLikeObject(_.noop);
* // => false
*/
function isArrayLikeObject(value) {
return isObjectLike(value) && isArrayLike(value);
}
/**
* Checks if `value` is classified as a `Function` object.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
* @example
*
* _.isFunction(_);
* // => true
*
* _.isFunction(/abc/);
* // => false
*/
function isFunction(value) {
// The use of `Object#toString` avoids issues with the `typeof` operator
// in Safari 8-9 which returns 'object' for typed array and other constructors.
var tag = isObject(value) ? objectToString.call(value) : '';
return tag == funcTag || tag == genTag;
}
/**
* Checks if `value` is a valid array-like length.
*
* **Note:** This method is loosely based on
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
* @example
*
* _.isLength(3);
* // => true
*
* _.isLength(Number.MIN_VALUE);
* // => false
*
* _.isLength(Infinity);
* // => false
*
* _.isLength('3');
* // => false
*/
function isLength(value) {
return typeof value == 'number' &&
value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
}
/**
* Checks if `value` is the
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @since 0.1.0
* @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(_.noop);
* // => true
*
* _.isObject(null);
* // => false
*/
function isObject(value) {
var type = typeof value;
return !!value && (type == 'object' || type == 'function');
}
/**
* Checks if `value` is object-like. A value is object-like if it's not `null`
* and has a `typeof` result of "object".
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
* @example
*
* _.isObjectLike({});
* // => true
*
* _.isObjectLike([1, 2, 3]);
* // => true
*
* _.isObjectLike(_.noop);
* // => false
*
* _.isObjectLike(null);
* // => false
*/
function isObjectLike(value) {
return !!value && typeof value == 'object';
}
module.exports = isArguments;
/***/ },
/* 364 */
/***/ 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
*/
/** `Object#toString` result references. */
var arrayTag = '[object Array]',
funcTag = '[object Function]';
/** Used to detect host constructors (Safari > 5). */
var reIsHostCtor = /^\[object .+?Constructor\]$/;
/**
* 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';
}
/** Used for native method references. */
var objectProto = Object.prototype;
/** Used to resolve the decompiled source of functions. */
var fnToString = Function.prototype.toString;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
* of values.
*/
var objToString = objectProto.toString;
/** Used to detect if a method is native. */
var reIsNative = RegExp('^' +
fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
);
/* Native method references for those with the same name as other `lodash` methods. */
var nativeIsArray = getNative(Array, 'isArray');
/**
* 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;
/**
* 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;
}
/**
* 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;
}
/**
* 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;
};
/**
* 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;
}
/**
* 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');
}
/**
* 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);
}
module.exports = isArray;
/***/ },
/* 365 */
/***/ function(module, exports, __webpack_require__) {
/**
* 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__(360),
isArguments = __webpack_require__(363),
isArray = __webpack_require__(364);
/** Used to detect unsigned integer values. */
var reIsUint = /^\d+$/;
/** Used for native method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/* Native method references for those with the same name as other `lodash` methods. */
var nativeKeys = getNative(Object, 'keys');
/**
* 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;
/**
* 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];
};
}
/**
* 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');
/**
* 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));
}
/**
* 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;
}
/**
* 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;
}
/**
* 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;
var allowIndexes = !!length && isLength(length) &&
(isArray(object) || isArguments(object));
var index = -1,
result = [];
while (++index < propsLength) {
var key = props[index];
if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) {
result.push(key);
}
}
return result;
}
/**
* 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');
}
/**
* 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);
}
return isObject(object) ? nativeKeys(object) : [];
};
/**
* 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;
var Ctor = object.constructor,
index = -1,
isProto = typeof Ctor == 'function' && Ctor.prototype === object,
result = Array(length),
skipIndexes = length > 0;
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 result;
}
module.exports = keys;
/***/ },
/* 366 */
/***/ function(module, exports) {
// shim for using process in browser
var process = module.exports = {};
// cached from whatever global is present so that test runners that stub it
// don't break things. But we need to wrap it in a try catch in case it is
// wrapped in strict mode code which doesn't define any globals. It's inside a
// function because try/catches deoptimize in certain engines.
var cachedSetTimeout;
var cachedClearTimeout;
function defaultSetTimout() {
throw new Error('setTimeout has not been defined');
}
function defaultClearTimeout () {
throw new Error('clearTimeout has not been defined');
}
(function () {
try {
if (typeof setTimeout === 'function') {
cachedSetTimeout = setTimeout;
} else {
cachedSetTimeout = defaultSetTimout;
}
} catch (e) {
cachedSetTimeout = defaultSetTimout;
}
try {
if (typeof clearTimeout === 'function') {
cachedClearTimeout = clearTimeout;
} else {
cachedClearTimeout = defaultClearTimeout;
}
} catch (e) {
cachedClearTimeout = defaultClearTimeout;
}
} ())
function runTimeout(fun) {
if (cachedSetTimeout === setTimeout) {
//normal enviroments in sane situations
return setTimeout(fun, 0);
}
// if setTimeout wasn't available but was latter defined
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
cachedSetTimeout = setTimeout;
return setTimeout(fun, 0);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedSetTimeout(fun, 0);
} catch(e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedSetTimeout.call(null, fun, 0);
} catch(e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
return cachedSetTimeout.call(this, fun, 0);
}
}
}
function runClearTimeout(marker) {
if (cachedClearTimeout === clearTimeout) {
//normal enviroments in sane situations
return clearTimeout(marker);
}
// if clearTimeout wasn't available but was latter defined
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
cachedClearTimeout = clearTimeout;
return clearTimeout(marker);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedClearTimeout(marker);
} catch (e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedClearTimeout.call(null, marker);
} catch (e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
return cachedClearTimeout.call(this, marker);
}
}
}
var queue = [];
var draining = false;
var currentQueue;
var queueIndex = -1;
function cleanUpNextTick() {
if (!draining || !currentQueue) {
return;
}
draining = false;
if (currentQueue.length) {
queue = currentQueue.concat(queue);
} else {
queueIndex = -1;
}
if (queue.length) {
drainQueue();
}
}
function drainQueue() {
if (draining) {
return;
}
var timeout = runTimeout(cleanUpNextTick);
draining = true;
var len = queue.length;
while(len) {
currentQueue = queue;
queue = [];
while (++queueIndex < len) {
if (currentQueue) {
currentQueue[queueIndex].run();
}
}
queueIndex = -1;
len = queue.length;
}
currentQueue = null;
draining = false;
runClearTimeout(timeout);
}
process.nextTick = function (fun) {
var args = new Array(arguments.length - 1);
if (arguments.length > 1) {
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
}
}
queue.push(new Item(fun, args));
if (queue.length === 1 && !draining) {
runTimeout(drainQueue);
}
};
// v8 likes predictible objects
function Item(fun, array) {
this.fun = fun;
this.array = array;
}
Item.prototype.run = function () {
this.fun.apply(null, this.array);
};
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues
process.versions = {};
function noop() {}
process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.binding = function (name) {
throw new Error('process.binding is not supported');
};
process.cwd = function () { return '/' };
process.chdir = function (dir) {
throw new Error('process.chdir is not supported');
};
process.umask = function() { return 0; };
/***/ },
/* 367 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var Carousel = __webpack_require__(368);
module.exports = Carousel;
/***/ },
/* 368 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _reactDom = __webpack_require__(10);
var _reactDom2 = _interopRequireDefault(_reactDom);
var _kwReactTweenState = __webpack_require__(359);
var _kwReactTweenState2 = _interopRequireDefault(_kwReactTweenState);
var _decorators = __webpack_require__(369);
var _decorators2 = _interopRequireDefault(_decorators);
var _objectAssign = __webpack_require__(12);
var _objectAssign2 = _interopRequireDefault(_objectAssign);
var _exenv = __webpack_require__(303);
var _exenv2 = _interopRequireDefault(_exenv);
var addEvent = function addEvent(elem, type, eventHandle) {
if (elem === null || typeof elem === 'undefined') {
return;
}
if (elem.addEventListener) {
elem.addEventListener(type, eventHandle, false);
} else if (elem.attachEvent) {
elem.attachEvent('on' + type, eventHandle);
} else {
elem['on' + type] = eventHandle;
}
};
var removeEvent = function removeEvent(elem, type, eventHandle) {
if (elem === null || typeof elem === 'undefined') {
return;
}
if (elem.removeEventListener) {
elem.removeEventListener(type, eventHandle, false);
} else if (elem.detachEvent) {
elem.detachEvent('on' + type, eventHandle);
} else {
elem['on' + type] = null;
}
};
var Carousel = _react2['default'].createClass({
displayName: 'Carousel',
mixins: [_kwReactTweenState2['default'].Mixin],
propTypes: {
afterSlide: _react2['default'].PropTypes.func,
autoplay: _react2['default'].PropTypes.bool,
autoplayInterval: _react2['default'].PropTypes.number,
beforeSlide: _react2['default'].PropTypes.func,
cellAlign: _react2['default'].PropTypes.oneOf(['left', 'center', 'right']),
cellSpacing: _react2['default'].PropTypes.number,
data: _react2['default'].PropTypes.func,
decorators: _react2['default'].PropTypes.arrayOf(_react2['default'].PropTypes.shape({
component: _react2['default'].PropTypes.func,
position: _react2['default'].PropTypes.oneOf(['TopLeft', 'TopCenter', 'TopRight', 'CenterLeft', 'CenterCenter', 'CenterRight', 'BottomLeft', 'BottomCenter', 'BottomRight']),
style: _react2['default'].PropTypes.object
})),
dragging: _react2['default'].PropTypes.bool,
easing: _react2['default'].PropTypes.string,
edgeEasing: _react2['default'].PropTypes.string,
framePadding: _react2['default'].PropTypes.string,
frameOverflow: _react2['default'].PropTypes.string,
initialSlideHeight: _react2['default'].PropTypes.number,
initialSlideWidth: _react2['default'].PropTypes.number,
slideIndex: _react2['default'].PropTypes.number,
slidesToShow: _react2['default'].PropTypes.number,
slidesToScroll: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.number, _react2['default'].PropTypes.oneOf(['auto'])]),
slideWidth: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.string, _react2['default'].PropTypes.number]),
speed: _react2['default'].PropTypes.number,
swiping: _react2['default'].PropTypes.bool,
vertical: _react2['default'].PropTypes.bool,
width: _react2['default'].PropTypes.string,
wrapAround: _react2['default'].PropTypes.bool
},
getDefaultProps: function getDefaultProps() {
return {
afterSlide: function afterSlide() {},
autoplay: false,
autoplayInterval: 3000,
beforeSlide: function beforeSlide() {},
cellAlign: 'left',
cellSpacing: 0,
data: function data() {},
decorators: _decorators2['default'],
dragging: true,
easing: 'easeOutCirc',
edgeEasing: 'easeOutElastic',
framePadding: '0px',
frameOverflow: 'hidden',
slideIndex: 0,
slidesToScroll: 1,
slidesToShow: 1,
slideWidth: 1,
speed: 500,
swiping: true,
vertical: false,
width: '100%',
wrapAround: false
};
},
getInitialState: function getInitialState() {
return {
currentSlide: this.props.slideIndex,
dragging: false,
frameWidth: 0,
left: 0,
slideCount: 0,
slidesToScroll: this.props.slidesToScroll,
slideWidth: 0,
top: 0
};
},
componentWillMount: function componentWillMount() {
this.setInitialDimensions();
},
componentDidMount: function componentDidMount() {
this.setDimensions();
this.bindEvents();
this.setExternalData();
if (this.props.autoplay) {
this.startAutoplay();
}
},
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
this.setState({
slideCount: nextProps.children.length
});
this.setDimensions(nextProps);
if (this.props.slideIndex !== nextProps.slideIndex && nextProps.slideIndex !== this.state.currentSlide) {
this.goToSlide(nextProps.slideIndex);
}
if (this.props.autoplay !== nextProps.autoplay) {
if (nextProps.autoplay) {
this.startAutoplay();
} else {
this.stopAutoplay();
}
}
},
componentWillUnmount: function componentWillUnmount() {
this.unbindEvents();
this.stopAutoplay();
},
render: function render() {
var self = this;
var children = _react2['default'].Children.count(this.props.children) > 1 ? this.formatChildren(this.props.children) : this.props.children;
return _react2['default'].createElement(
'div',
{ className: ['slider', this.props.className || ''].join(' '), ref: 'slider', style: (0, _objectAssign2['default'])(this.getSliderStyles(), this.props.style || {}) },
_react2['default'].createElement(
'div',
_extends({ className: 'slider-frame',
ref: 'frame',
style: this.getFrameStyles()
}, this.getTouchEvents(), this.getMouseEvents(), {
onClick: this.handleClick }),
_react2['default'].createElement(
'ul',
{ className: 'slider-list', ref: 'list', style: this.getListStyles() },
children
)
),
this.props.decorators ? this.props.decorators.map(function (Decorator, index) {
return _react2['default'].createElement(
'div',
{
style: (0, _objectAssign2['default'])(self.getDecoratorStyles(Decorator.position), Decorator.style || {}),
className: 'slider-decorator-' + index,
key: index },
_react2['default'].createElement(Decorator.component, {
currentSlide: self.state.currentSlide,
slideCount: self.state.slideCount,
frameWidth: self.state.frameWidth,
slideWidth: self.state.slideWidth,
slidesToScroll: self.state.slidesToScroll,
cellSpacing: self.props.cellSpacing,
slidesToShow: self.props.slidesToShow,
wrapAround: self.props.wrapAround,
nextSlide: self.nextSlide,
previousSlide: self.previousSlide,
goToSlide: self.goToSlide })
);
}) : null,
_react2['default'].createElement('style', { type: 'text/css', dangerouslySetInnerHTML: { __html: self.getStyleTagStyles() } })
);
},
// Touch Events
touchObject: {},
getTouchEvents: function getTouchEvents() {
var self = this;
if (self.props.swiping === false) {
return null;
}
return {
onTouchStart: function onTouchStart(e) {
self.touchObject = {
startX: e.touches[0].pageX,
startY: e.touches[0].pageY
};
self.handleMouseOver();
},
onTouchMove: function onTouchMove(e) {
var direction = self.swipeDirection(self.touchObject.startX, e.touches[0].pageX, self.touchObject.startY, e.touches[0].pageY);
if (direction !== 0) {
e.preventDefault();
}
var length = self.props.vertical ? Math.round(Math.sqrt(Math.pow(e.touches[0].pageY - self.touchObject.startY, 2))) : Math.round(Math.sqrt(Math.pow(e.touches[0].pageX - self.touchObject.startX, 2)));
self.touchObject = {
startX: self.touchObject.startX,
startY: self.touchObject.startY,
endX: e.touches[0].pageX,
endY: e.touches[0].pageY,
length: length,
direction: direction
};
self.setState({
left: self.props.vertical ? 0 : self.getTargetLeft(self.touchObject.length * self.touchObject.direction),
top: self.props.vertical ? self.getTargetLeft(self.touchObject.length * self.touchObject.direction) : 0
});
},
onTouchEnd: function onTouchEnd(e) {
self.handleSwipe(e);
self.handleMouseOut();
},
onTouchCancel: function onTouchCancel(e) {
self.handleSwipe(e);
}
};
},
clickSafe: true,
getMouseEvents: function getMouseEvents() {
var self = this;
if (this.props.dragging === false) {
return null;
}
return {
onMouseOver: function onMouseOver() {
self.handleMouseOver();
},
onMouseOut: function onMouseOut() {
self.handleMouseOut();
},
onMouseDown: function onMouseDown(e) {
self.touchObject = {
startX: e.clientX,
startY: e.clientY
};
self.setState({
dragging: true
});
},
onMouseMove: function onMouseMove(e) {
if (!self.state.dragging) {
return;
}
var direction = self.swipeDirection(self.touchObject.startX, e.clientX, self.touchObject.startY, e.clientY);
if (direction !== 0) {
e.preventDefault();
}
var length = self.props.vertical ? Math.round(Math.sqrt(Math.pow(e.clientY - self.touchObject.startY, 2))) : Math.round(Math.sqrt(Math.pow(e.clientX - self.touchObject.startX, 2)));
self.touchObject = {
startX: self.touchObject.startX,
startY: self.touchObject.startY,
endX: e.clientX,
endY: e.clientY,
length: length,
direction: direction
};
self.setState({
left: self.props.vertical ? 0 : self.getTargetLeft(self.touchObject.length * self.touchObject.direction),
top: self.props.vertical ? self.getTargetLeft(self.touchObject.length * self.touchObject.direction) : 0
});
},
onMouseUp: function onMouseUp(e) {
if (!self.state.dragging) {
return;
}
self.handleSwipe(e);
},
onMouseLeave: function onMouseLeave(e) {
if (!self.state.dragging) {
return;
}
self.handleSwipe(e);
}
};
},
handleMouseOver: function handleMouseOver() {
if (this.props.autoplay) {
this.autoplayPaused = true;
this.stopAutoplay();
}
},
handleMouseOut: function handleMouseOut() {
if (this.props.autoplay && this.autoplayPaused) {
this.startAutoplay();
this.autoplayPaused = null;
}
},
handleClick: function handleClick(e) {
if (this.clickSafe === true) {
e.preventDefault();
e.stopPropagation();
if (e.nativeEvent) {
e.nativeEvent.stopPropagation();
}
}
},
handleSwipe: function handleSwipe(e) {
if (typeof this.touchObject.length !== 'undefined' && this.touchObject.length > 44) {
this.clickSafe = true;
} else {
this.clickSafe = false;
}
var slidesToShow = this.props.slidesToShow;
if (this.props.slidesToScroll === 'auto') {
slidesToShow = this.state.slidesToScroll;
}
if (this.touchObject.length > this.state.slideWidth / slidesToShow / 5) {
if (this.touchObject.direction === 1) {
if (this.state.currentSlide >= _react2['default'].Children.count(this.props.children) - slidesToShow && !this.props.wrapAround) {
this.animateSlide(_kwReactTweenState2['default'].easingTypes[this.props.edgeEasing]);
} else {
this.nextSlide();
}
} else if (this.touchObject.direction === -1) {
if (this.state.currentSlide <= 0 && !this.props.wrapAround) {
this.animateSlide(_kwReactTweenState2['default'].easingTypes[this.props.edgeEasing]);
} else {
this.previousSlide();
}
}
} else {
this.goToSlide(this.state.currentSlide);
}
this.touchObject = {};
this.setState({
dragging: false
});
},
swipeDirection: function swipeDirection(x1, x2, y1, y2) {
var xDist, yDist, r, swipeAngle;
xDist = x1 - x2;
yDist = y1 - y2;
r = Math.atan2(yDist, xDist);
swipeAngle = Math.round(r * 180 / Math.PI);
if (swipeAngle < 0) {
swipeAngle = 360 - Math.abs(swipeAngle);
}
if (swipeAngle <= 45 && swipeAngle >= 0) {
return 1;
}
if (swipeAngle <= 360 && swipeAngle >= 315) {
return 1;
}
if (swipeAngle >= 135 && swipeAngle <= 225) {
return -1;
}
if (this.props.vertical === true) {
if (swipeAngle >= 35 && swipeAngle <= 135) {
return 1;
} else {
return -1;
}
}
return 0;
},
autoplayIterator: function autoplayIterator() {
if (this.props.wrapAround) {
return this.nextSlide();
}
if (this.state.currentSlide !== this.state.slideCount - this.state.slidesToShow) {
this.nextSlide();
} else {
this.stopAutoplay();
}
},
startAutoplay: function startAutoplay() {
this.autoplayID = setInterval(this.autoplayIterator, this.props.autoplayInterval);
},
resetAutoplay: function resetAutoplay() {
if (this.props.autoplay && !this.autoplayPaused) {
this.stopAutoplay();
this.startAutoplay();
}
},
stopAutoplay: function stopAutoplay() {
this.autoplayID && clearInterval(this.autoplayID);
},
// Action Methods
goToSlide: function goToSlide(index) {
var self = this;
if (index >= _react2['default'].Children.count(this.props.children) || index < 0) {
if (!this.props.wrapAround) {
return;
};
if (index >= _react2['default'].Children.count(this.props.children)) {
this.props.beforeSlide(this.state.currentSlide, 0);
return this.setState({
currentSlide: 0
}, function () {
self.animateSlide(null, null, self.getTargetLeft(null, index), function () {
self.animateSlide(null, 0.01);
self.props.afterSlide(0);
self.resetAutoplay();
self.setExternalData();
});
});
} else {
var endSlide = _react2['default'].Children.count(this.props.children) - this.state.slidesToScroll;
this.props.beforeSlide(this.state.currentSlide, endSlide);
return this.setState({
currentSlide: endSlide
}, function () {
self.animateSlide(null, null, self.getTargetLeft(null, index), function () {
self.animateSlide(null, 0.01);
self.props.afterSlide(endSlide);
self.resetAutoplay();
self.setExternalData();
});
});
}
}
this.props.beforeSlide(this.state.currentSlide, index);
this.setState({
currentSlide: index
}, function () {
self.animateSlide();
this.props.afterSlide(index);
self.resetAutoplay();
self.setExternalData();
});
},
nextSlide: function nextSlide() {
var childrenCount = _react2['default'].Children.count(this.props.children);
var slidesToShow = this.props.slidesToShow;
if (this.props.slidesToScroll === 'auto') {
slidesToShow = this.state.slidesToScroll;
}
if (this.state.currentSlide >= childrenCount - slidesToShow && !this.props.wrapAround) {
return;
}
if (this.props.wrapAround) {
this.goToSlide(this.state.currentSlide + this.state.slidesToScroll);
} else {
if (this.props.slideWidth !== 1) {
return this.goToSlide(this.state.currentSlide + this.state.slidesToScroll);
}
this.goToSlide(Math.min(this.state.currentSlide + this.state.slidesToScroll, childrenCount - slidesToShow));
}
},
previousSlide: function previousSlide() {
if (this.state.currentSlide <= 0 && !this.props.wrapAround) {
return;
}
if (this.props.wrapAround) {
this.goToSlide(this.state.currentSlide - this.state.slidesToScroll);
} else {
this.goToSlide(Math.max(0, this.state.currentSlide - this.state.slidesToScroll));
}
},
// Animation
animateSlide: function animateSlide(easing, duration, endValue, callback) {
this.tweenState(this.props.vertical ? 'top' : 'left', {
easing: easing || _kwReactTweenState2['default'].easingTypes[this.props.easing],
duration: duration || this.props.speed,
endValue: endValue || this.getTargetLeft(),
onEnd: callback || null
});
},
getTargetLeft: function getTargetLeft(touchOffset, slide) {
var offset;
var target = slide || this.state.currentSlide;
switch (this.props.cellAlign) {
case 'left':
{
offset = 0;
offset -= this.props.cellSpacing * target;
break;
}
case 'center':
{
offset = (this.state.frameWidth - this.state.slideWidth) / 2;
offset -= this.props.cellSpacing * target;
break;
}
case 'right':
{
offset = this.state.frameWidth - this.state.slideWidth;
offset -= this.props.cellSpacing * target;
break;
}
}
var left = this.state.slideWidth * target;
var lastSlide = this.state.currentSlide > 0 && target + this.state.slidesToScroll >= this.state.slideCount;
if (lastSlide && this.props.slideWidth !== 1 && !this.props.wrapAround && this.props.slidesToScroll === 'auto') {
left = this.state.slideWidth * this.state.slideCount - this.state.frameWidth;
offset = 0;
offset -= this.props.cellSpacing * (this.state.slideCount - 1);
}
offset -= touchOffset || 0;
return (left - offset) * -1;
},
// Bootstrapping
bindEvents: function bindEvents() {
var self = this;
if (_exenv2['default'].canUseDOM) {
addEvent(window, 'resize', self.onResize);
addEvent(document, 'readystatechange', self.onReadyStateChange);
}
},
onResize: function onResize() {
this.setDimensions();
},
onReadyStateChange: function onReadyStateChange() {
this.setDimensions();
},
unbindEvents: function unbindEvents() {
var self = this;
if (_exenv2['default'].canUseDOM) {
removeEvent(window, 'resize', self.onResize);
removeEvent(document, 'readystatechange', self.onReadyStateChange);
}
},
formatChildren: function formatChildren(children) {
var self = this;
var positionValue = this.props.vertical ? this.getTweeningValue('top') : this.getTweeningValue('left');
return _react2['default'].Children.map(children, function (child, index) {
return _react2['default'].createElement(
'li',
{ className: 'slider-slide', style: self.getSlideStyles(index, positionValue), key: index },
child
);
});
},
setInitialDimensions: function setInitialDimensions() {
var self = this,
slideWidth,
frameHeight,
slideHeight;
slideWidth = this.props.vertical ? this.props.initialSlideHeight || 0 : this.props.initialSlideWidth || 0;
slideHeight = this.props.initialSlideHeight ? this.props.initialSlideHeight * this.props.slidesToShow : 0;
frameHeight = slideHeight + this.props.cellSpacing * (this.props.slidesToShow - 1);
this.setState({
slideHeight: slideHeight,
frameWidth: this.props.vertical ? frameHeight : '100%',
slideCount: _react2['default'].Children.count(this.props.children),
slideWidth: slideWidth
}, function () {
self.setLeft();
self.setExternalData();
});
},
setDimensions: function setDimensions(props) {
props = props || this.props;
var self = this,
slideWidth,
slidesToScroll,
firstSlide,
frame,
frameWidth,
frameHeight,
slideHeight;
slidesToScroll = props.slidesToScroll;
frame = this.refs.frame;
firstSlide = frame.childNodes[0].childNodes[0];
if (firstSlide) {
firstSlide.style.height = 'auto';
slideHeight = this.props.vertical ? firstSlide.offsetHeight * props.slidesToShow : firstSlide.offsetHeight;
} else {
slideHeight = 100;
}
if (typeof props.slideWidth !== 'number') {
slideWidth = parseInt(props.slideWidth);
} else {
if (props.vertical) {
slideWidth = slideHeight / props.slidesToShow * props.slideWidth;
} else {
slideWidth = frame.offsetWidth / props.slidesToShow * props.slideWidth;
}
}
if (!props.vertical) {
slideWidth -= props.cellSpacing * ((100 - 100 / props.slidesToShow) / 100);
}
frameHeight = slideHeight + props.cellSpacing * (props.slidesToShow - 1);
frameWidth = props.vertical ? frameHeight : frame.offsetWidth;
if (props.slidesToScroll === 'auto') {
slidesToScroll = Math.floor(frameWidth / (slideWidth + props.cellSpacing));
}
this.setState({
slideHeight: slideHeight,
frameWidth: frameWidth,
slideWidth: slideWidth,
slidesToScroll: slidesToScroll,
left: props.vertical ? 0 : this.getTargetLeft(),
top: props.vertical ? this.getTargetLeft() : 0
}, function () {
self.setLeft();
});
},
setLeft: function setLeft() {
this.setState({
left: this.props.vertical ? 0 : this.getTargetLeft(),
top: this.props.vertical ? this.getTargetLeft() : 0
});
},
// Data
setExternalData: function setExternalData() {
if (this.props.data) {
this.props.data();
}
},
// Styles
getListStyles: function getListStyles() {
var listWidth = this.state.slideWidth * _react2['default'].Children.count(this.props.children);
var spacingOffset = this.props.cellSpacing * _react2['default'].Children.count(this.props.children);
var transform = 'translate3d(' + this.getTweeningValue('left') + 'px, ' + this.getTweeningValue('top') + 'px, 0)';
return {
transform: transform,
WebkitTransform: transform,
msTransform: 'translate(' + this.getTweeningValue('left') + 'px, ' + this.getTweeningValue('top') + 'px)',
position: 'relative',
display: 'block',
margin: this.props.vertical ? this.props.cellSpacing / 2 * -1 + 'px 0px' : '0px ' + this.props.cellSpacing / 2 * -1 + 'px',
padding: 0,
height: this.props.vertical ? listWidth + spacingOffset : this.state.slideHeight,
width: this.props.vertical ? 'auto' : listWidth + spacingOffset,
cursor: this.state.dragging === true ? 'pointer' : 'inherit',
boxSizing: 'border-box',
MozBoxSizing: 'border-box'
};
},
getFrameStyles: function getFrameStyles() {
return {
position: 'relative',
display: 'block',
overflow: this.props.frameOverflow,
height: this.props.vertical ? this.state.frameWidth || 'initial' : 'auto',
margin: this.props.framePadding,
padding: 0,
transform: 'translate3d(0, 0, 0)',
WebkitTransform: 'translate3d(0, 0, 0)',
msTransform: 'translate(0, 0)',
boxSizing: 'border-box',
MozBoxSizing: 'border-box'
};
},
getSlideStyles: function getSlideStyles(index, positionValue) {
var targetPosition = this.getSlideTargetPosition(index, positionValue);
return {
position: 'absolute',
left: this.props.vertical ? 0 : targetPosition,
top: this.props.vertical ? targetPosition : 0,
display: this.props.vertical ? 'block' : 'inline-block',
listStyleType: 'none',
verticalAlign: 'top',
width: this.props.vertical ? '100%' : this.state.slideWidth,
height: 'auto',
boxSizing: 'border-box',
MozBoxSizing: 'border-box',
marginLeft: this.props.vertical ? 'auto' : this.props.cellSpacing / 2,
marginRight: this.props.vertical ? 'auto' : this.props.cellSpacing / 2,
marginTop: this.props.vertical ? this.props.cellSpacing / 2 : 'auto',
marginBottom: this.props.vertical ? this.props.cellSpacing / 2 : 'auto'
};
},
getSlideTargetPosition: function getSlideTargetPosition(index, positionValue) {
var slidesToShow = this.state.frameWidth / this.state.slideWidth;
var targetPosition = (this.state.slideWidth + this.props.cellSpacing) * index;
var end = (this.state.slideWidth + this.props.cellSpacing) * slidesToShow * -1;
if (this.props.wrapAround) {
var slidesBefore = Math.ceil(positionValue / this.state.slideWidth);
if (this.state.slideCount - slidesBefore <= index) {
return (this.state.slideWidth + this.props.cellSpacing) * (this.state.slideCount - index) * -1;
}
var slidesAfter = Math.ceil((Math.abs(positionValue) - Math.abs(end)) / this.state.slideWidth);
if (this.state.slideWidth !== 1) {
slidesAfter = Math.ceil((Math.abs(positionValue) - this.state.slideWidth) / this.state.slideWidth);
}
if (index <= slidesAfter - 1) {
return (this.state.slideWidth + this.props.cellSpacing) * (this.state.slideCount + index);
}
}
return targetPosition;
},
getSliderStyles: function getSliderStyles() {
return {
position: 'relative',
display: 'block',
width: this.props.width,
height: 'auto',
boxSizing: 'border-box',
MozBoxSizing: 'border-box',
visibility: this.state.slideWidth ? 'visible' : 'hidden'
};
},
getStyleTagStyles: function getStyleTagStyles() {
return '.slider-slide > img {width: 100%; display: block;}';
},
getDecoratorStyles: function getDecoratorStyles(position) {
switch (position) {
case 'TopLeft':
{
return {
position: 'absolute',
top: 0,
left: 0
};
}
case 'TopCenter':
{
return {
position: 'absolute',
top: 0,
left: '50%',
transform: 'translateX(-50%)',
WebkitTransform: 'translateX(-50%)',
msTransform: 'translateX(-50%)'
};
}
case 'TopRight':
{
return {
position: 'absolute',
top: 0,
right: 0
};
}
case 'CenterLeft':
{
return {
position: 'absolute',
top: '50%',
left: 0,
transform: 'translateY(-50%)',
WebkitTransform: 'translateY(-50%)',
msTransform: 'translateY(-50%)'
};
}
case 'CenterCenter':
{
return {
position: 'absolute',
top: '50%',
left: '50%',
transform: 'translate(-50%,-50%)',
WebkitTransform: 'translate(-50%, -50%)',
msTransform: 'translate(-50%, -50%)'
};
}
case 'CenterRight':
{
return {
position: 'absolute',
top: '50%',
right: 0,
transform: 'translateY(-50%)',
WebkitTransform: 'translateY(-50%)',
msTransform: 'translateY(-50%)'
};
}
case 'BottomLeft':
{
return {
position: 'absolute',
bottom: 0,
left: 0
};
}
case 'BottomCenter':
{
return {
position: 'absolute',
bottom: 0,
left: '50%',
transform: 'translateX(-50%)',
WebkitTransform: 'translateX(-50%)',
msTransform: 'translateX(-50%)'
};
}
case 'BottomRight':
{
return {
position: 'absolute',
bottom: 0,
right: 0
};
}
default:
{
return {
position: 'absolute',
top: 0,
left: 0
};
}
}
}
});
Carousel.ControllerMixin = {
getInitialState: function getInitialState() {
return {
carousels: {}
};
},
setCarouselData: function setCarouselData(carousel) {
var data = this.state.carousels;
data[carousel] = this.refs[carousel];
this.setState({
carousels: data
});
}
};
exports['default'] = Carousel;
module.exports = exports['default'];
/***/ },
/* 369 */
/***/ 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__(1);
var _react2 = _interopRequireDefault(_react);
var DefaultDecorators = [{
component: _react2['default'].createClass({
displayName: 'component',
render: function render() {
return _react2['default'].createElement(
'button',
{
style: this.getButtonStyles(this.props.currentSlide === 0 && !this.props.wrapAround),
onClick: this.handleClick },
'PREV'
);
},
handleClick: function handleClick(e) {
e.preventDefault();
this.props.previousSlide();
},
getButtonStyles: function getButtonStyles(disabled) {
return {
border: 0,
background: 'rgba(0,0,0,0.4)',
color: 'white',
padding: 10,
outline: 0,
opacity: disabled ? 0.3 : 1,
cursor: 'pointer'
};
}
}),
position: 'CenterLeft'
}, {
component: _react2['default'].createClass({
displayName: 'component',
render: function render() {
return _react2['default'].createElement(
'button',
{
style: this.getButtonStyles(this.props.currentSlide + this.props.slidesToScroll >= this.props.slideCount && !this.props.wrapAround),
onClick: this.handleClick },
'NEXT'
);
},
handleClick: function handleClick(e) {
e.preventDefault();
this.props.nextSlide();
},
getButtonStyles: function getButtonStyles(disabled) {
return {
border: 0,
background: 'rgba(0,0,0,0.4)',
color: 'white',
padding: 10,
outline: 0,
opacity: disabled ? 0.3 : 1,
cursor: 'pointer'
};
}
}),
position: 'CenterRight'
}, {
component: _react2['default'].createClass({
displayName: 'component',
render: function render() {
var self = this;
var indexes = this.getIndexes(self.props.slideCount, self.props.slidesToScroll);
return _react2['default'].createElement(
'ul',
{ style: self.getListStyles() },
indexes.map(function (index) {
return _react2['default'].createElement(
'li',
{ style: self.getListItemStyles(), key: index },
_react2['default'].createElement(
'button',
{
style: self.getButtonStyles(self.props.currentSlide === index),
onClick: self.props.goToSlide.bind(null, index) },
'•'
)
);
})
);
},
getIndexes: function getIndexes(count, inc) {
var arr = [];
for (var i = 0; i < count; i += inc) {
arr.push(i);
}
return arr;
},
getListStyles: function getListStyles() {
return {
position: 'relative',
margin: 0,
top: -10,
padding: 0
};
},
getListItemStyles: function getListItemStyles() {
return {
listStyleType: 'none',
display: 'inline-block'
};
},
getButtonStyles: function getButtonStyles(active) {
return {
border: 0,
background: 'transparent',
color: 'black',
cursor: 'pointer',
padding: 10,
outline: 0,
fontSize: 24,
opacity: active ? 1 : 0.5
};
}
}),
position: 'BottomCenter'
}];
exports['default'] = DefaultDecorators;
module.exports = exports['default'];
/***/ },
/* 370 */
/***/ function(module, exports, __webpack_require__) {
/*!
* object.omit
*
* Copyright (c) 2014-2015, Jon Schlinkert.
* Licensed under the MIT License.
*/
'use strict';
var isObject = __webpack_require__(358);
var forOwn = __webpack_require__(356);
module.exports = function omit(obj, keys) {
if (!isObject(obj)) return {};
keys = [].concat.apply([], [].slice.call(arguments, 1));
var last = keys[keys.length - 1];
var res = {}, fn;
if (typeof last === 'function') {
fn = keys.pop();
}
var isFunction = typeof fn === 'function';
if (!keys.length && !isFunction) {
return obj;
}
forOwn(obj, function(value, key) {
if (keys.indexOf(key) === -1) {
if (!isFunction) {
res[key] = value;
} else if (fn(value, key, obj)) {
res[key] = value;
}
}
});
return res;
};
/***/ },
/* 371 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {// Generated by CoffeeScript 1.7.1
(function() {
var getNanoSeconds, hrtime, loadTime;
if ((typeof performance !== "undefined" && performance !== null) && performance.now) {
module.exports = function() {
return performance.now();
};
} else if ((typeof process !== "undefined" && process !== null) && process.hrtime) {
module.exports = function() {
return (getNanoSeconds() - loadTime) / 1e6;
};
hrtime = process.hrtime;
getNanoSeconds = function() {
var hr;
hr = hrtime();
return hr[0] * 1e9 + hr[1];
};
loadTime = getNanoSeconds();
} else if (Date.now) {
module.exports = function() {
return Date.now() - loadTime;
};
loadTime = Date.now();
} else {
module.exports = function() {
return new Date().getTime() - loadTime;
};
loadTime = new Date().getTime();
}
}).call(this);
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(366)))
/***/ },
/* 372 */
/***/ function(module, exports, __webpack_require__) {
/**
* Copyright 2013-present, 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.
*/
'use strict';
if (true) {
var invariant = __webpack_require__(39);
var warning = __webpack_require__(40);
var ReactPropTypesSecret = __webpack_require__(112);
var loggedTypeFailures = {};
}
/**
* Assert that the values match with the type specs.
* Error messages are memorized and will only be shown once.
*
* @param {object} typeSpecs Map of name to a ReactPropType
* @param {object} values Runtime values that need to be type-checked
* @param {string} location e.g. "prop", "context", "child context"
* @param {string} componentName Name of the component for error messages.
* @param {?Function} getStack Returns the component stack.
* @private
*/
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
if (true) {
for (var typeSpecName in typeSpecs) {
if (typeSpecs.hasOwnProperty(typeSpecName)) {
var error;
// Prop type validation may throw. In case they do, we don't want to
// fail the render phase where it didn't fail before. So we log it.
// After these have been cleaned up, we'll let them throw.
try {
// This is intentionally an invariant that gets caught. It's the same
// behavior as without this statement except with a better message.
invariant(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', componentName || 'React class', location, typeSpecName);
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
} catch (ex) {
error = ex;
}
warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error);
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
// Only monitor this failure once because there tends to be a lot of the
// same error.
loggedTypeFailures[error.message] = true;
var stack = getStack ? getStack() : '';
warning(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : '');
}
}
}
}
}
module.exports = checkPropTypes;
/***/ },
/* 373 */
/***/ function(module, exports, __webpack_require__) {
/**
* Copyright 2013-present, 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.
*/
'use strict';
var emptyFunction = __webpack_require__(110);
var invariant = __webpack_require__(39);
var warning = __webpack_require__(40);
var ReactPropTypesSecret = __webpack_require__(112);
var checkPropTypes = __webpack_require__(372);
module.exports = function(isValidElement, throwOnDirectAccess) {
/* global Symbol */
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
/**
* Returns the iterator method function contained on the iterable object.
*
* Be sure to invoke the function with the iterable as context:
*
* var iteratorFn = getIteratorFn(myIterable);
* if (iteratorFn) {
* var iterator = iteratorFn.call(myIterable);
* ...
* }
*
* @param {?object} maybeIterable
* @return {?function}
*/
function getIteratorFn(maybeIterable) {
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
if (typeof iteratorFn === 'function') {
return iteratorFn;
}
}
/**
* Collection of methods that allow declaration and validation of props that are
* supplied to React components. Example usage:
*
* var Props = require('ReactPropTypes');
* var MyArticle = React.createClass({
* propTypes: {
* // An optional string prop named "description".
* description: Props.string,
*
* // A required enum prop named "category".
* category: Props.oneOf(['News','Photos']).isRequired,
*
* // A prop named "dialog" that requires an instance of Dialog.
* dialog: Props.instanceOf(Dialog).isRequired
* },
* render: function() { ... }
* });
*
* A more formal specification of how these methods are used:
*
* type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
* decl := ReactPropTypes.{type}(.isRequired)?
*
* Each and every declaration produces a function with the same signature. This
* allows the creation of custom validation functions. For example:
*
* var MyLink = React.createClass({
* propTypes: {
* // An optional string or URI prop named "href".
* href: function(props, propName, componentName) {
* var propValue = props[propName];
* if (propValue != null && typeof propValue !== 'string' &&
* !(propValue instanceof URI)) {
* return new Error(
* 'Expected a string or an URI for ' + propName + ' in ' +
* componentName
* );
* }
* }
* },
* render: function() {...}
* });
*
* @internal
*/
var ANONYMOUS = '<>';
// Important!
// Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
var ReactPropTypes = {
array: createPrimitiveTypeChecker('array'),
bool: createPrimitiveTypeChecker('boolean'),
func: createPrimitiveTypeChecker('function'),
number: createPrimitiveTypeChecker('number'),
object: createPrimitiveTypeChecker('object'),
string: createPrimitiveTypeChecker('string'),
symbol: createPrimitiveTypeChecker('symbol'),
any: createAnyTypeChecker(),
arrayOf: createArrayOfTypeChecker,
element: createElementTypeChecker(),
instanceOf: createInstanceTypeChecker,
node: createNodeChecker(),
objectOf: createObjectOfTypeChecker,
oneOf: createEnumTypeChecker,
oneOfType: createUnionTypeChecker,
shape: createShapeTypeChecker
};
/**
* inlined Object.is polyfill to avoid requiring consumers ship their own
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
*/
/*eslint-disable no-self-compare*/
function is(x, y) {
// SameValue algorithm
if (x === y) {
// Steps 1-5, 7-10
// Steps 6.b-6.e: +0 != -0
return x !== 0 || 1 / x === 1 / y;
} else {
// Step 6.a: NaN == NaN
return x !== x && y !== y;
}
}
/*eslint-enable no-self-compare*/
/**
* We use an Error-like object for backward compatibility as people may call
* PropTypes directly and inspect their output. However, we don't use real
* Errors anymore. We don't inspect their stack anyway, and creating them
* is prohibitively expensive if they are created too often, such as what
* happens in oneOfType() for any type before the one that matched.
*/
function PropTypeError(message) {
this.message = message;
this.stack = '';
}
// Make `instanceof Error` still work for returned errors.
PropTypeError.prototype = Error.prototype;
function createChainableTypeChecker(validate) {
if (true) {
var manualPropTypeCallCache = {};
var manualPropTypeWarningCount = 0;
}
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
componentName = componentName || ANONYMOUS;
propFullName = propFullName || propName;
if (secret !== ReactPropTypesSecret) {
if (throwOnDirectAccess) {
// New behavior only for users of `prop-types` package
invariant(
false,
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
'Use `PropTypes.checkPropTypes()` to call them. ' +
'Read more at http://fb.me/use-check-prop-types'
);
} else if (("development") !== 'production' && typeof console !== 'undefined') {
// Old behavior for people using React.PropTypes
var cacheKey = componentName + ':' + propName;
if (
!manualPropTypeCallCache[cacheKey] &&
// Avoid spamming the console because they are often not actionable except for lib authors
manualPropTypeWarningCount < 3
) {
warning(
false,
'You are manually calling a React.PropTypes validation ' +
'function for the `%s` prop on `%s`. This is deprecated ' +
'and will throw in the standalone `prop-types` package. ' +
'You may be seeing this warning due to a third-party PropTypes ' +
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.',
propFullName,
componentName
);
manualPropTypeCallCache[cacheKey] = true;
manualPropTypeWarningCount++;
}
}
}
if (props[propName] == null) {
if (isRequired) {
if (props[propName] === null) {
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
}
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
}
return null;
} else {
return validate(props, propName, componentName, location, propFullName);
}
}
var chainedCheckType = checkType.bind(null, false);
chainedCheckType.isRequired = checkType.bind(null, true);
return chainedCheckType;
}
function createPrimitiveTypeChecker(expectedType) {
function validate(props, propName, componentName, location, propFullName, secret) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== expectedType) {
// `propValue` being instance of, say, date/regexp, pass the 'object'
// check, but we can offer a more precise error message here rather than
// 'of type `object`'.
var preciseType = getPreciseType(propValue);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createAnyTypeChecker() {
return createChainableTypeChecker(emptyFunction.thatReturnsNull);
}
function createArrayOfTypeChecker(typeChecker) {
function validate(props, propName, componentName, location, propFullName) {
if (typeof typeChecker !== 'function') {
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
}
var propValue = props[propName];
if (!Array.isArray(propValue)) {
var propType = getPropType(propValue);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
}
for (var i = 0; i < propValue.length; i++) {
var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
if (error instanceof Error) {
return error;
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function createElementTypeChecker() {
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
if (!isValidElement(propValue)) {
var propType = getPropType(propValue);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createInstanceTypeChecker(expectedClass) {
function validate(props, propName, componentName, location, propFullName) {
if (!(props[propName] instanceof expectedClass)) {
var expectedClassName = expectedClass.name || ANONYMOUS;
var actualClassName = getClassName(props[propName]);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createEnumTypeChecker(expectedValues) {
if (!Array.isArray(expectedValues)) {
true ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0;
return emptyFunction.thatReturnsNull;
}
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
for (var i = 0; i < expectedValues.length; i++) {
if (is(propValue, expectedValues[i])) {
return null;
}
}
var valuesString = JSON.stringify(expectedValues);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
}
return createChainableTypeChecker(validate);
}
function createObjectOfTypeChecker(typeChecker) {
function validate(props, propName, componentName, location, propFullName) {
if (typeof typeChecker !== 'function') {
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
}
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== 'object') {
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
}
for (var key in propValue) {
if (propValue.hasOwnProperty(key)) {
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
if (error instanceof Error) {
return error;
}
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function createUnionTypeChecker(arrayOfTypeCheckers) {
if (!Array.isArray(arrayOfTypeCheckers)) {
true ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
return emptyFunction.thatReturnsNull;
}
function validate(props, propName, componentName, location, propFullName) {
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
var checker = arrayOfTypeCheckers[i];
if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {
return null;
}
}
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
}
return createChainableTypeChecker(validate);
}
function createNodeChecker() {
function validate(props, propName, componentName, location, propFullName) {
if (!isNode(props[propName])) {
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createShapeTypeChecker(shapeTypes) {
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== 'object') {
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
}
for (var key in shapeTypes) {
var checker = shapeTypes[key];
if (!checker) {
continue;
}
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
if (error) {
return error;
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function isNode(propValue) {
switch (typeof propValue) {
case 'number':
case 'string':
case 'undefined':
return true;
case 'boolean':
return !propValue;
case 'object':
if (Array.isArray(propValue)) {
return propValue.every(isNode);
}
if (propValue === null || isValidElement(propValue)) {
return true;
}
var iteratorFn = getIteratorFn(propValue);
if (iteratorFn) {
var iterator = iteratorFn.call(propValue);
var step;
if (iteratorFn !== propValue.entries) {
while (!(step = iterator.next()).done) {
if (!isNode(step.value)) {
return false;
}
}
} else {
// Iterator will provide entry [k,v] tuples rather than values.
while (!(step = iterator.next()).done) {
var entry = step.value;
if (entry) {
if (!isNode(entry[1])) {
return false;
}
}
}
}
} else {
return false;
}
return true;
default:
return false;
}
}
function isSymbol(propType, propValue) {
// Native Symbol.
if (propType === 'symbol') {
return true;
}
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
if (propValue['@@toStringTag'] === 'Symbol') {
return true;
}
// Fallback for non-spec compliant Symbols which are polyfilled.
if (typeof Symbol === 'function' && propValue instanceof Symbol) {
return true;
}
return false;
}
// Equivalent of `typeof` but with special handling for array and regexp.
function getPropType(propValue) {
var propType = typeof propValue;
if (Array.isArray(propValue)) {
return 'array';
}
if (propValue instanceof RegExp) {
// Old webkits (at least until Android 4.0) return 'function' rather than
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/
// passes PropTypes.object.
return 'object';
}
if (isSymbol(propType, propValue)) {
return 'symbol';
}
return propType;
}
// This handles more types than `getPropType`. Only used for error messages.
// See `createPrimitiveTypeChecker`.
function getPreciseType(propValue) {
var propType = getPropType(propValue);
if (propType === 'object') {
if (propValue instanceof Date) {
return 'date';
} else if (propValue instanceof RegExp) {
return 'regexp';
}
}
return propType;
}
// Returns class name of the object, if any.
function getClassName(propValue) {
if (!propValue.constructor || !propValue.constructor.name) {
return ANONYMOUS;
}
return propValue.constructor.name;
}
ReactPropTypes.checkPropTypes = checkPropTypes;
ReactPropTypes.PropTypes = ReactPropTypes;
return ReactPropTypes;
};
/***/ },
/* 374 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__(9);
var _propTypes2 = _interopRequireDefault(_propTypes);
var _reactDom = __webpack_require__(10);
var _reactDom2 = _interopRequireDefault(_reactDom);
var _domAlign = __webpack_require__(301);
var _domAlign2 = _interopRequireDefault(_domAlign);
var _addEventListener = __webpack_require__(50);
var _addEventListener2 = _interopRequireDefault(_addEventListener);
var _isWindow = __webpack_require__(376);
var _isWindow2 = _interopRequireDefault(_isWindow);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
function buffer(fn, ms) {
var timer = void 0;
function clear() {
if (timer) {
clearTimeout(timer);
timer = null;
}
}
function bufferFn() {
clear();
timer = setTimeout(fn, ms);
}
bufferFn.clear = clear;
return bufferFn;
}
var Align = function (_Component) {
_inherits(Align, _Component);
function Align() {
var _temp, _this, _ret;
_classCallCheck(this, Align);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.forceAlign = function () {
var props = _this.props;
if (!props.disabled) {
var source = _reactDom2["default"].findDOMNode(_this);
props.onAlign(source, (0, _domAlign2["default"])(source, props.target(), props.align));
}
}, _temp), _possibleConstructorReturn(_this, _ret);
}
Align.prototype.componentDidMount = function componentDidMount() {
var props = this.props;
// if parent ref not attached .... use document.getElementById
this.forceAlign();
if (!props.disabled && props.monitorWindowResize) {
this.startMonitorWindowResize();
}
};
Align.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
var reAlign = false;
var props = this.props;
if (!props.disabled) {
if (prevProps.disabled || prevProps.align !== props.align) {
reAlign = true;
} else {
var lastTarget = prevProps.target();
var currentTarget = props.target();
if ((0, _isWindow2["default"])(lastTarget) && (0, _isWindow2["default"])(currentTarget)) {
reAlign = false;
} else if (lastTarget !== currentTarget) {
reAlign = true;
}
}
}
if (reAlign) {
this.forceAlign();
}
if (props.monitorWindowResize && !props.disabled) {
this.startMonitorWindowResize();
} else {
this.stopMonitorWindowResize();
}
};
Align.prototype.componentWillUnmount = function componentWillUnmount() {
this.stopMonitorWindowResize();
};
Align.prototype.startMonitorWindowResize = function startMonitorWindowResize() {
if (!this.resizeHandler) {
this.bufferMonitor = buffer(this.forceAlign, this.props.monitorBufferTime);
this.resizeHandler = (0, _addEventListener2["default"])(window, 'resize', this.bufferMonitor);
}
};
Align.prototype.stopMonitorWindowResize = function stopMonitorWindowResize() {
if (this.resizeHandler) {
this.bufferMonitor.clear();
this.resizeHandler.remove();
this.resizeHandler = null;
}
};
Align.prototype.render = function render() {
var _props = this.props,
childrenProps = _props.childrenProps,
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;
};
return Align;
}(_react.Component);
Align.propTypes = {
childrenProps: _propTypes2["default"].object,
align: _propTypes2["default"].object.isRequired,
target: _propTypes2["default"].func,
onAlign: _propTypes2["default"].func,
monitorBufferTime: _propTypes2["default"].number,
monitorWindowResize: _propTypes2["default"].bool,
disabled: _propTypes2["default"].bool,
children: _propTypes2["default"].any
};
Align.defaultProps = {
target: function target() {
return window;
},
onAlign: function onAlign() {},
monitorBufferTime: 50,
monitorWindowResize: false,
disabled: false
};
exports["default"] = Align;
module.exports = exports['default'];
/***/ },
/* 375 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _Align = __webpack_require__(374);
var _Align2 = _interopRequireDefault(_Align);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
exports["default"] = _Align2["default"]; // export this package's api
module.exports = exports['default'];
/***/ },
/* 376 */
/***/ 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'];
/***/ },
/* 377 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__(9);
var _propTypes2 = _interopRequireDefault(_propTypes);
var _ChildrenUtils = __webpack_require__(379);
var _AnimateChild = __webpack_require__(378);
var _AnimateChild2 = _interopRequireDefault(_AnimateChild);
var _util = __webpack_require__(114);
var _util2 = _interopRequireDefault(_util);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return 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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
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 = function (_React$Component) {
_inherits(Animate, _React$Component);
function Animate(props) {
_classCallCheck(this, Animate);
var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
_initialiseProps.call(_this);
_this.currentlyAnimatingKeys = {};
_this.keysToEnter = [];
_this.keysToLeave = [];
_this.state = {
children: (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(_this.props))
};
return _this;
}
Animate.prototype.componentDidMount = function componentDidMount() {
var _this2 = 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) {
if (child) {
_this2.performAppear(child.key);
}
});
};
Animate.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
var _this3 = this;
this.nextProps = nextProps;
var nextChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(nextProps));
var props = this.props;
// exclusive needs immediate response
if (props.exclusive) {
Object.keys(this.currentlyAnimatingKeys).forEach(function (key) {
_this3.stop(key);
});
}
var showProp = props.showProp;
var currentlyAnimatingKeys = this.currentlyAnimatingKeys;
// last props children if exclusive
var currentChildren = props.exclusive ? (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props)) : this.state.children;
// in case destroy in showProp mode
var newChildren = [];
if (showProp) {
currentChildren.forEach(function (currentChild) {
var nextChild = currentChild && (0, _ChildrenUtils.findChildInChildrenByKey)(nextChildren, currentChild.key);
var newChild = void 0;
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 (!nextChild || !(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 && child.key;
if (child && currentlyAnimatingKeys[key]) {
return;
}
var hasPrev = child && (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) {
_this3.keysToEnter.push(key);
}
} else if (showInNext) {
_this3.keysToEnter.push(key);
}
} else if (!hasPrev) {
_this3.keysToEnter.push(key);
}
});
currentChildren.forEach(function (child) {
var key = child && child.key;
if (child && currentlyAnimatingKeys[key]) {
return;
}
var hasNext = child && (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) {
_this3.keysToLeave.push(key);
}
} else if (showInNow) {
_this3.keysToLeave.push(key);
}
} else if (!hasNext) {
_this3.keysToLeave.push(key);
}
});
};
Animate.prototype.componentDidUpdate = function componentDidUpdate() {
var keysToEnter = this.keysToEnter;
this.keysToEnter = [];
keysToEnter.forEach(this.performEnter);
var keysToLeave = this.keysToLeave;
this.keysToLeave = [];
keysToLeave.forEach(this.performLeave);
};
Animate.prototype.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);
};
Animate.prototype.stop = function stop(key) {
delete this.currentlyAnimatingKeys[key];
var component = this.refs[key];
if (component) {
component.stop();
}
};
Animate.prototype.render = function render() {
var props = this.props;
this.nextProps = props;
var stateChildren = this.state.children;
var children = null;
if (stateChildren) {
children = stateChildren.map(function (child) {
if (child === null || child === undefined) {
return 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) {
var passedProps = props;
if (typeof Component === 'string') {
passedProps = _extends({
className: props.className,
style: props.style
}, props.componentProps);
}
return _react2["default"].createElement(
Component,
passedProps,
children
);
}
return children[0] || null;
};
return Animate;
}(_react2["default"].Component);
Animate.propTypes = {
component: _propTypes2["default"].any,
componentProps: _propTypes2["default"].object,
animation: _propTypes2["default"].object,
transitionName: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].object]),
transitionEnter: _propTypes2["default"].bool,
transitionAppear: _propTypes2["default"].bool,
exclusive: _propTypes2["default"].bool,
transitionLeave: _propTypes2["default"].bool,
onEnd: _propTypes2["default"].func,
onEnter: _propTypes2["default"].func,
onLeave: _propTypes2["default"].func,
onAppear: _propTypes2["default"].func,
showProp: _propTypes2["default"].string
};
Animate.defaultProps = {
animation: {},
component: 'span',
componentProps: {},
transitionEnter: true,
transitionLeave: true,
transitionAppear: false,
onEnd: noop,
onEnter: noop,
onLeave: noop,
onAppear: noop
};
var _initialiseProps = function _initialiseProps() {
var _this4 = this;
this.performEnter = function (key) {
// may already remove by exclusive
if (_this4.refs[key]) {
_this4.currentlyAnimatingKeys[key] = true;
_this4.refs[key].componentWillEnter(_this4.handleDoneAdding.bind(_this4, key, 'enter'));
}
};
this.performAppear = function (key) {
if (_this4.refs[key]) {
_this4.currentlyAnimatingKeys[key] = true;
_this4.refs[key].componentWillAppear(_this4.handleDoneAdding.bind(_this4, key, 'appear'));
}
};
this.handleDoneAdding = function (key, type) {
var props = _this4.props;
delete _this4.currentlyAnimatingKeys[key];
// if update on exclusive mode, skip check
if (props.exclusive && props !== _this4.nextProps) {
return;
}
var currentChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props));
if (!_this4.isValidChildByKey(currentChildren, key)) {
// exclusive will not need this
_this4.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);
}
}
}
};
this.performLeave = function (key) {
// may already remove by exclusive
if (_this4.refs[key]) {
_this4.currentlyAnimatingKeys[key] = true;
_this4.refs[key].componentWillLeave(_this4.handleDoneLeaving.bind(_this4, key));
}
};
this.handleDoneLeaving = function (key) {
var props = _this4.props;
delete _this4.currentlyAnimatingKeys[key];
// if update on exclusive mode, skip check
if (props.exclusive && props !== _this4.nextProps) {
return;
}
var currentChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props));
// in case state change is too fast
if (_this4.isValidChildByKey(currentChildren, key)) {
_this4.performEnter(key);
} else {
var end = function end() {
if (_util2["default"].allowLeaveCallback(props)) {
props.onLeave(key);
props.onEnd(key, false);
}
};
if (!(0, _ChildrenUtils.isSameChildren)(_this4.state.children, currentChildren, props.showProp)) {
_this4.setState({
children: currentChildren
}, end);
} else {
end();
}
}
};
};
exports["default"] = Animate;
module.exports = exports['default'];
/***/ },
/* 378 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _reactDom = __webpack_require__(10);
var _reactDom2 = _interopRequireDefault(_reactDom);
var _propTypes = __webpack_require__(9);
var _propTypes2 = _interopRequireDefault(_propTypes);
var _cssAnimation = __webpack_require__(108);
var _cssAnimation2 = _interopRequireDefault(_cssAnimation);
var _util = __webpack_require__(114);
var _util2 = _interopRequireDefault(_util);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var transitionMap = {
enter: 'transitionEnter',
appear: 'transitionAppear',
leave: 'transitionLeave'
};
var AnimateChild = function (_React$Component) {
_inherits(AnimateChild, _React$Component);
function AnimateChild() {
_classCallCheck(this, AnimateChild);
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
}
AnimateChild.prototype.componentWillUnmount = function componentWillUnmount() {
this.stop();
};
AnimateChild.prototype.componentWillEnter = function componentWillEnter(done) {
if (_util2["default"].isEnterSupported(this.props)) {
this.transition('enter', done);
} else {
done();
}
};
AnimateChild.prototype.componentWillAppear = function componentWillAppear(done) {
if (_util2["default"].isAppearSupported(this.props)) {
this.transition('appear', done);
} else {
done();
}
};
AnimateChild.prototype.componentWillLeave = function componentWillLeave(done) {
if (_util2["default"].isLeaveSupported(this.props)) {
this.transition('leave', done);
} else {
// always sync, do not interupt with react component life cycle
// update hidden -> animate hidden ->
// didUpdate -> animate leave -> unmount (if animate is none)
done();
}
};
AnimateChild.prototype.transition = function transition(animationType, finishCallback) {
var _this2 = this;
var node = _reactDom2["default"].findDOMNode(this);
var props = this.props;
var transitionName = props.transitionName;
var nameIsObj = (typeof transitionName === 'undefined' ? 'undefined' : _typeof(transitionName)) === 'object';
this.stop();
var end = function end() {
_this2.stopper = null;
finishCallback();
};
if ((_cssAnimation.isCssAnimationSupported || !props.animation[animationType]) && transitionName && props[transitionMap[animationType]]) {
var name = nameIsObj ? transitionName[animationType] : transitionName + '-' + animationType;
var activeName = name + '-active';
if (nameIsObj && transitionName[animationType + 'Active']) {
activeName = transitionName[animationType + 'Active'];
}
this.stopper = (0, _cssAnimation2["default"])(node, {
name: name,
active: activeName
}, end);
} else {
this.stopper = props.animation[animationType](node, end);
}
};
AnimateChild.prototype.stop = function stop() {
var stopper = this.stopper;
if (stopper) {
this.stopper = null;
stopper.stop();
}
};
AnimateChild.prototype.render = function render() {
return this.props.children;
};
return AnimateChild;
}(_react2["default"].Component);
AnimateChild.propTypes = {
children: _propTypes2["default"].any
};
exports["default"] = AnimateChild;
module.exports = exports['default'];
/***/ },
/* 379 */
/***/ 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;
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
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 && child.key === key) {
ret = child;
}
});
}
return ret;
}
function findShownChildInChildrenByKey(children, key, showProp) {
var ret = null;
if (children) {
children.forEach(function (child) {
if (child && 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 && 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 && child2) {
if (child && !child2 || !child && child2) {
same = false;
} else 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 (child && findChildInChildrenByKey(next, child.key)) {
if (pendingChildren.length) {
nextChildrenPending[child.key] = pendingChildren;
pendingChildren = [];
}
} else {
pendingChildren.push(child);
}
});
next.forEach(function (child) {
if (child && nextChildrenPending.hasOwnProperty(child.key)) {
ret = ret.concat(nextChildrenPending[child.key]);
}
ret.push(child);
});
ret = ret.concat(pendingChildren);
return ret;
}
/***/ },
/* 380 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__(9);
var _propTypes2 = _interopRequireDefault(_propTypes);
var _PureRenderMixin = __webpack_require__(435);
var _PureRenderMixin2 = _interopRequireDefault(_PureRenderMixin);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return 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; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var Checkbox = function (_React$Component) {
_inherits(Checkbox, _React$Component);
function Checkbox(props) {
_classCallCheck(this, Checkbox);
var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
_initialiseProps.call(_this);
var checked = 'checked' in props ? props.checked : props.defaultChecked;
_this.state = {
checked: checked
};
return _this;
}
Checkbox.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
if ('checked' in nextProps) {
this.setState({
checked: nextProps.checked
});
}
};
Checkbox.prototype.shouldComponentUpdate = function shouldComponentUpdate() {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _PureRenderMixin2["default"].shouldComponentUpdate.apply(this, args);
};
Checkbox.prototype.render = function render() {
var _classNames;
var _props = this.props,
prefixCls = _props.prefixCls,
className = _props.className,
style = _props.style,
name = _props.name,
type = _props.type,
disabled = _props.disabled,
readOnly = _props.readOnly,
tabIndex = _props.tabIndex,
onClick = _props.onClick,
onFocus = _props.onFocus,
onBlur = _props.onBlur,
others = _objectWithoutProperties(_props, ['prefixCls', 'className', 'style', 'name', 'type', 'disabled', 'readOnly', 'tabIndex', 'onClick', 'onFocus', 'onBlur']);
var globalProps = Object.keys(others).reduce(function (prev, key) {
if (key.substr(0, 5) === 'aria-' || key.substr(0, 5) === 'data-' || key === 'role') {
prev[key] = others[key];
}
return prev;
}, {});
var checked = this.state.checked;
var classString = (0, _classnames2["default"])(prefixCls, className, (_classNames = {}, _defineProperty(_classNames, prefixCls + '-checked', checked), _defineProperty(_classNames, prefixCls + '-disabled', disabled), _classNames));
return _react2["default"].createElement(
'span',
{ className: classString, style: style },
_react2["default"].createElement('input', _extends({
name: name,
type: type,
readOnly: readOnly,
disabled: disabled,
tabIndex: tabIndex,
className: prefixCls + '-input',
checked: !!checked,
onClick: onClick,
onFocus: onFocus,
onBlur: onBlur,
onChange: this.handleChange
}, globalProps)),
_react2["default"].createElement('span', { className: prefixCls + '-inner' })
);
};
return Checkbox;
}(_react2["default"].Component);
Checkbox.propTypes = {
prefixCls: _propTypes2["default"].string,
className: _propTypes2["default"].string,
style: _propTypes2["default"].object,
name: _propTypes2["default"].string,
type: _propTypes2["default"].string,
defaultChecked: _propTypes2["default"].oneOfType([_propTypes2["default"].number, _propTypes2["default"].bool]),
checked: _propTypes2["default"].oneOfType([_propTypes2["default"].number, _propTypes2["default"].bool]),
disabled: _propTypes2["default"].bool,
onFocus: _propTypes2["default"].func,
onBlur: _propTypes2["default"].func,
onChange: _propTypes2["default"].func,
onClick: _propTypes2["default"].func,
tabIndex: _propTypes2["default"].string,
readOnly: _propTypes2["default"].bool
};
Checkbox.defaultProps = {
prefixCls: 'rc-checkbox',
className: '',
style: {},
type: 'checkbox',
defaultChecked: false,
onFocus: function onFocus() {},
onBlur: function onBlur() {},
onChange: function onChange() {}
};
var _initialiseProps = function _initialiseProps() {
var _this2 = this;
this.handleChange = function (e) {
var props = _this2.props;
if (props.disabled) {
return;
}
if (!('checked' in props)) {
_this2.setState({
checked: e.target.checked
});
}
props.onChange({
target: _extends({}, props, {
checked: e.target.checked
}),
stopPropagation: function stopPropagation() {
e.stopPropagation();
},
preventDefault: function preventDefault() {
e.preventDefault();
}
});
};
};
exports["default"] = Checkbox;
module.exports = exports['default'];
/***/ },
/* 381 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__(9);
var _propTypes2 = _interopRequireDefault(_propTypes);
var _Panel = __webpack_require__(382);
var _Panel2 = _interopRequireDefault(_Panel);
var _openAnimationFactory = __webpack_require__(385);
var _openAnimationFactory2 = _interopRequireDefault(_openAnimationFactory);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return 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; }
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
function toArray(activeKey) {
var currentActiveKey = activeKey;
if (!Array.isArray(currentActiveKey)) {
currentActiveKey = currentActiveKey ? [currentActiveKey] : [];
}
return currentActiveKey;
}
var Collapse = function (_Component) {
_inherits(Collapse, _Component);
function Collapse(props) {
_classCallCheck(this, Collapse);
var _this = _possibleConstructorReturn(this, _Component.call(this, props));
var _this$props = _this.props,
activeKey = _this$props.activeKey,
defaultActiveKey = _this$props.defaultActiveKey;
var currentActiveKey = defaultActiveKey;
if ('activeKey' in _this.props) {
currentActiveKey = activeKey;
}
_this.state = {
openAnimation: _this.props.openAnimation || (0, _openAnimationFactory2["default"])(_this.props.prefixCls),
activeKey: toArray(currentActiveKey)
};
return _this;
}
Collapse.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
if ('activeKey' in nextProps) {
this.setState({
activeKey: toArray(nextProps.activeKey)
});
}
if ('openAnimation' in nextProps) {
this.setState({
openAnimation: nextProps.openAnimation
});
}
};
Collapse.prototype.onClickItem = function onClickItem(key) {
var _this2 = this;
return function () {
var activeKey = _this2.state.activeKey;
if (_this2.props.accordion) {
activeKey = activeKey[0] === key ? [] : [key];
} else {
activeKey = [].concat(_toConsumableArray(activeKey));
var index = activeKey.indexOf(key);
var isActive = index > -1;
if (isActive) {
// remove active state
activeKey.splice(index, 1);
} else {
activeKey.push(key);
}
}
_this2.setActiveKey(activeKey);
};
};
Collapse.prototype.getItems = function getItems() {
var _this3 = this;
var activeKey = this.state.activeKey;
var _props = this.props,
prefixCls = _props.prefixCls,
accordion = _props.accordion,
destroyInactivePanel = _props.destroyInactivePanel;
var newChildren = [];
_react.Children.forEach(this.props.children, function (child, index) {
if (!child) return;
// If there is no key provide, use the panel order as default key
var key = child.key || String(index);
var header = child.props.header;
var isActive = false;
if (accordion) {
isActive = activeKey[0] === key;
} else {
isActive = activeKey.indexOf(key) > -1;
}
var props = {
key: key,
header: header,
isActive: isActive,
prefixCls: prefixCls,
destroyInactivePanel: destroyInactivePanel,
openAnimation: _this3.state.openAnimation,
children: child.props.children,
onItemClick: _this3.onClickItem(key).bind(_this3)
};
newChildren.push(_react2["default"].cloneElement(child, props));
});
return newChildren;
};
Collapse.prototype.setActiveKey = function setActiveKey(activeKey) {
if (!('activeKey' in this.props)) {
this.setState({ activeKey: activeKey });
}
this.props.onChange(this.props.accordion ? activeKey[0] : activeKey);
};
Collapse.prototype.render = function render() {
var _classNames;
var _props2 = this.props,
prefixCls = _props2.prefixCls,
className = _props2.className,
style = _props2.style;
var collapseClassName = (0, _classnames2["default"])((_classNames = {}, _defineProperty(_classNames, prefixCls, true), _defineProperty(_classNames, className, !!className), _classNames));
return _react2["default"].createElement(
'div',
{ className: collapseClassName, style: style },
this.getItems()
);
};
return Collapse;
}(_react.Component);
Collapse.propTypes = {
children: _propTypes2["default"].any,
prefixCls: _propTypes2["default"].string,
activeKey: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].arrayOf(_propTypes2["default"].string)]),
defaultActiveKey: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].arrayOf(_propTypes2["default"].string)]),
openAnimation: _propTypes2["default"].object,
onChange: _propTypes2["default"].func,
accordion: _propTypes2["default"].bool,
className: _propTypes2["default"].string,
style: _propTypes2["default"].object,
destroyInactivePanel: _propTypes2["default"].bool
};
Collapse.defaultProps = {
prefixCls: 'rc-collapse',
onChange: function onChange() {},
accordion: false,
destroyInactivePanel: false
};
Collapse.Panel = _Panel2["default"];
exports["default"] = Collapse;
module.exports = exports['default'];
/***/ },
/* 382 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__(9);
var _propTypes2 = _interopRequireDefault(_propTypes);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var _PanelContent = __webpack_require__(383);
var _PanelContent2 = _interopRequireDefault(_PanelContent);
var _rcAnimate = __webpack_require__(47);
var _rcAnimate2 = _interopRequireDefault(_rcAnimate);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return 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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var CollapsePanel = function (_Component) {
_inherits(CollapsePanel, _Component);
function CollapsePanel() {
_classCallCheck(this, CollapsePanel);
return _possibleConstructorReturn(this, _Component.apply(this, arguments));
}
CollapsePanel.prototype.handleItemClick = function handleItemClick() {
this.props.onItemClick();
};
CollapsePanel.prototype.render = function render() {
var _classNames;
var _props = this.props,
className = _props.className,
style = _props.style,
prefixCls = _props.prefixCls,
header = _props.header,
children = _props.children,
isActive = _props.isActive,
showArrow = _props.showArrow,
destroyInactivePanel = _props.destroyInactivePanel;
var headerCls = prefixCls + '-header';
var itemCls = (0, _classnames2["default"])((_classNames = {}, _defineProperty(_classNames, prefixCls + '-item', true), _defineProperty(_classNames, prefixCls + '-item-active', isActive), _classNames), className);
return _react2["default"].createElement(
'div',
{ className: itemCls, style: style },
_react2["default"].createElement(
'div',
{
className: headerCls,
onClick: this.handleItemClick.bind(this),
role: 'tab',
'aria-expanded': isActive
},
showArrow && _react2["default"].createElement('i', { className: 'arrow' }),
header
),
_react2["default"].createElement(
_rcAnimate2["default"],
{
showProp: 'isActive',
exclusive: true,
component: '',
animation: this.props.openAnimation
},
_react2["default"].createElement(
_PanelContent2["default"],
{
prefixCls: prefixCls,
isActive: isActive,
destroyInactivePanel: destroyInactivePanel
},
children
)
)
);
};
return CollapsePanel;
}(_react.Component);
CollapsePanel.propTypes = {
className: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].object]),
children: _propTypes2["default"].any,
openAnimation: _propTypes2["default"].object,
prefixCls: _propTypes2["default"].string,
header: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].number, _propTypes2["default"].node]),
showArrow: _propTypes2["default"].bool,
isActive: _propTypes2["default"].bool,
onItemClick: _propTypes2["default"].func,
style: _propTypes2["default"].object,
destroyInactivePanel: _propTypes2["default"].bool
};
CollapsePanel.defaultProps = {
showArrow: true,
isActive: false,
destroyInactivePanel: false,
onItemClick: function onItemClick() {}
};
exports["default"] = CollapsePanel;
module.exports = exports['default'];
/***/ },
/* 383 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__(9);
var _propTypes2 = _interopRequireDefault(_propTypes);
var _classnames2 = __webpack_require__(5);
var _classnames3 = _interopRequireDefault(_classnames2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return 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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var PanelContent = function (_Component) {
_inherits(PanelContent, _Component);
function PanelContent() {
_classCallCheck(this, PanelContent);
return _possibleConstructorReturn(this, _Component.apply(this, arguments));
}
PanelContent.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {
return this.props.isActive || nextProps.isActive;
};
PanelContent.prototype.render = function render() {
var _classnames;
this._isActived = this._isActived || this.props.isActive;
if (!this._isActived) {
return null;
}
var _props = this.props,
prefixCls = _props.prefixCls,
isActive = _props.isActive,
children = _props.children,
destroyInactivePanel = _props.destroyInactivePanel;
var contentCls = (0, _classnames3["default"])((_classnames = {}, _defineProperty(_classnames, prefixCls + '-content', true), _defineProperty(_classnames, prefixCls + '-content-active', isActive), _defineProperty(_classnames, prefixCls + '-content-inactive', !isActive), _classnames));
var child = !isActive && destroyInactivePanel ? null : _react2["default"].createElement(
'div',
{ className: prefixCls + '-content-box' },
children
);
return _react2["default"].createElement(
'div',
{
className: contentCls,
role: 'tabpanel'
},
child
);
};
return PanelContent;
}(_react.Component);
PanelContent.propTypes = {
prefixCls: _propTypes2["default"].string,
isActive: _propTypes2["default"].bool,
children: _propTypes2["default"].any,
destroyInactivePanel: _propTypes2["default"].bool
};
exports["default"] = PanelContent;
module.exports = exports['default'];
/***/ },
/* 384 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _Collapse = __webpack_require__(381);
var _Collapse2 = _interopRequireDefault(_Collapse);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
exports["default"] = _Collapse2["default"];
module.exports = exports['default'];
/***/ },
/* 385 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _cssAnimation = __webpack_require__(108);
var _cssAnimation2 = _interopRequireDefault(_cssAnimation);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function animate(node, show, transitionName, done) {
var height = void 0;
return (0, _cssAnimation2["default"])(node, transitionName, {
start: function start() {
if (!show) {
node.style.height = node.offsetHeight + 'px';
} else {
height = node.offsetHeight;
node.style.height = 0;
}
},
active: function active() {
node.style.height = (show ? height : 0) + 'px';
},
end: function end() {
node.style.height = '';
done();
}
});
}
function animation(prefixCls) {
return {
enter: function enter(node, done) {
return animate(node, true, prefixCls + '-anim', done);
},
leave: function leave(node, done) {
return animate(node, false, prefixCls + '-anim', done);
}
};
}
exports["default"] = animation;
module.exports = exports['default'];
/***/ },
/* 386 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _reactDom = __webpack_require__(10);
var _reactDom2 = _interopRequireDefault(_reactDom);
var _KeyCode = __webpack_require__(434);
var _KeyCode2 = _interopRequireDefault(_KeyCode);
var _rcAnimate = __webpack_require__(47);
var _rcAnimate2 = _interopRequireDefault(_rcAnimate);
var _LazyRenderBox = __webpack_require__(387);
var _LazyRenderBox2 = _interopRequireDefault(_LazyRenderBox);
var _getScrollBarSize = __webpack_require__(437);
var _getScrollBarSize2 = _interopRequireDefault(_getScrollBarSize);
var _objectAssign = __webpack_require__(12);
var _objectAssign2 = _interopRequireDefault(_objectAssign);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var __assign = undefined && undefined.__assign || Object.assign || function (t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) {
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
}
return t;
};
var uuid = 0;
var openCount = 0;
/* eslint react/no-is-mounted:0 */
function noop() {}
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;
ret = d.documentElement[method];
if (typeof ret !== 'number') {
ret = d.body[method];
}
}
return ret;
}
function setTransformOrigin(node, value) {
var style = node.style;
['Webkit', 'Moz', 'Ms', 'ms'].forEach(function (prefix) {
style[prefix + 'TransformOrigin'] = value;
});
style['transformOrigin'] = value;
}
function offset(el) {
var rect = el.getBoundingClientRect();
var pos = {
left: rect.left,
top: rect.top
};
var doc = el.ownerDocument;
var w = doc.defaultView || doc.parentWindow;
pos.left += getScroll(w);
pos.top += getScroll(w, true);
return pos;
}
var Dialog = _react2["default"].createClass({
displayName: 'Dialog',
getDefaultProps: function getDefaultProps() {
return {
afterClose: noop,
className: '',
mask: true,
visible: false,
keyboard: true,
closable: true,
maskClosable: true,
prefixCls: 'rc-dialog',
onClose: noop
};
},
componentWillMount: function componentWillMount() {
this.inTransition = false;
this.titleId = 'rcDialogTitle' + uuid++;
},
componentDidMount: function componentDidMount() {
this.componentDidUpdate({});
},
componentDidUpdate: function componentDidUpdate(prevProps) {
var props = this.props;
var mousePosition = this.props.mousePosition;
if (props.visible) {
// first show
if (!prevProps.visible) {
this.openTime = Date.now();
this.lastOutSideFocusNode = document.activeElement;
this.addScrollingEffect();
this.refs.wrap.focus();
var dialogNode = _reactDom2["default"].findDOMNode(this.refs.dialog);
if (mousePosition) {
var elOffset = offset(dialogNode);
setTransformOrigin(dialogNode, mousePosition.x - elOffset.left + 'px ' + (mousePosition.y - elOffset.top) + 'px');
} else {
setTransformOrigin(dialogNode, '');
}
}
} else if (prevProps.visible) {
this.inTransition = true;
if (props.mask && this.lastOutSideFocusNode) {
try {
this.lastOutSideFocusNode.focus();
} catch (e) {
this.lastOutSideFocusNode = null;
}
this.lastOutSideFocusNode = null;
}
}
},
componentWillUnmount: function componentWillUnmount() {
if (this.props.visible || this.inTransition) {
this.removeScrollingEffect();
}
},
onAnimateLeave: function onAnimateLeave() {
// need demo?
// https://github.com/react-component/dialog/pull/28
if (this.refs.wrap) {
this.refs.wrap.style.display = 'none';
}
this.inTransition = false;
this.removeScrollingEffect();
this.props.afterClose();
},
onMaskClick: function onMaskClick(e) {
// android trigger click on open (fastclick??)
if (Date.now() - this.openTime < 300) {
return;
}
if (e.target === e.currentTarget) {
this.close(e);
}
},
onKeyDown: function onKeyDown(e) {
var props = this.props;
if (props.keyboard && e.keyCode === _KeyCode2["default"].ESC) {
this.close(e);
}
// keep focus inside dialog
if (props.visible) {
if (e.keyCode === _KeyCode2["default"].TAB) {
var activeElement = document.activeElement;
var dialogRoot = this.refs.wrap;
var sentinel = this.refs.sentinel;
if (e.shiftKey) {
if (activeElement === dialogRoot) {
sentinel.focus();
}
} else if (activeElement === this.refs.sentinel) {
dialogRoot.focus();
}
}
}
},
getDialogElement: function getDialogElement() {
var props = this.props;
var closable = props.closable;
var prefixCls = props.prefixCls;
var dest = {};
if (props.width !== undefined) {
dest.width = props.width;
}
if (props.height !== undefined) {
dest.height = props.height;
}
var footer = void 0;
if (props.footer) {
footer = _react2["default"].createElement("div", { className: prefixCls + '-footer', ref: "footer" }, props.footer);
}
var header = void 0;
if (props.title) {
header = _react2["default"].createElement("div", { className: prefixCls + '-header', ref: "header" }, _react2["default"].createElement("div", { className: prefixCls + '-title', id: this.titleId }, props.title));
}
var closer = void 0;
if (closable) {
closer = _react2["default"].createElement("button", { onClick: this.close, "aria-label": "Close", className: prefixCls + '-close' }, _react2["default"].createElement("span", { className: prefixCls + '-close-x' }));
}
var style = (0, _objectAssign2["default"])({}, props.style, dest);
var transitionName = this.getTransitionName();
var dialogElement = _react2["default"].createElement(_LazyRenderBox2["default"], { key: "dialog-element", role: "document", ref: "dialog", style: style, className: prefixCls + ' ' + (props.className || ''), visible: props.visible }, _react2["default"].createElement("div", { className: prefixCls + '-content' }, closer, header, _react2["default"].createElement("div", __assign({ className: prefixCls + '-body', style: props.bodyStyle, ref: "body" }, props.bodyProps), props.children), footer), _react2["default"].createElement("div", { tabIndex: 0, ref: "sentinel", style: { width: 0, height: 0, overflow: 'hidden' } }, "sentinel"));
return _react2["default"].createElement(_rcAnimate2["default"], { key: "dialog", showProp: "visible", onLeave: this.onAnimateLeave, transitionName: transitionName, component: "", transitionAppear: true }, dialogElement);
},
getZIndexStyle: function getZIndexStyle() {
var style = {};
var props = this.props;
if (props.zIndex !== undefined) {
style.zIndex = props.zIndex;
}
return style;
},
getWrapStyle: function getWrapStyle() {
return (0, _objectAssign2["default"])({}, this.getZIndexStyle(), this.props.wrapStyle);
},
getMaskStyle: function getMaskStyle() {
return (0, _objectAssign2["default"])({}, this.getZIndexStyle(), this.props.maskStyle);
},
getMaskElement: function getMaskElement() {
var props = this.props;
var maskElement = void 0;
if (props.mask) {
var maskTransition = this.getMaskTransitionName();
maskElement = _react2["default"].createElement(_LazyRenderBox2["default"], __assign({ style: this.getMaskStyle(), key: "mask", className: props.prefixCls + '-mask', hiddenClassName: props.prefixCls + '-mask-hidden', visible: props.visible }, props.maskProps));
if (maskTransition) {
maskElement = _react2["default"].createElement(_rcAnimate2["default"], { key: "mask", showProp: "visible", transitionAppear: true, component: "", transitionName: maskTransition }, maskElement);
}
}
return maskElement;
},
getMaskTransitionName: function getMaskTransitionName() {
var props = this.props;
var transitionName = props.maskTransitionName;
var animation = props.maskAnimation;
if (!transitionName && animation) {
transitionName = props.prefixCls + '-' + animation;
}
return transitionName;
},
getTransitionName: function getTransitionName() {
var props = this.props;
var transitionName = props.transitionName;
var animation = props.animation;
if (!transitionName && animation) {
transitionName = props.prefixCls + '-' + animation;
}
return transitionName;
},
getElement: function getElement(part) {
return this.refs[part];
},
setScrollbar: function setScrollbar() {
if (this.bodyIsOverflowing && this.scrollbarWidth !== undefined) {
document.body.style.paddingRight = this.scrollbarWidth + 'px';
}
},
addScrollingEffect: function addScrollingEffect() {
openCount++;
if (openCount !== 1) {
return;
}
this.checkScrollbar();
this.setScrollbar();
document.body.style.overflow = 'hidden';
// this.adjustDialog();
},
removeScrollingEffect: function removeScrollingEffect() {
openCount--;
if (openCount !== 0) {
return;
}
document.body.style.overflow = '';
this.resetScrollbar();
// this.resetAdjustments();
},
close: function close(e) {
this.props.onClose(e);
},
checkScrollbar: function checkScrollbar() {
var fullWindowWidth = window.innerWidth;
if (!fullWindowWidth) {
var documentElementRect = document.documentElement.getBoundingClientRect();
fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left);
}
this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth;
if (this.bodyIsOverflowing) {
this.scrollbarWidth = (0, _getScrollBarSize2["default"])();
}
},
resetScrollbar: function resetScrollbar() {
document.body.style.paddingRight = '';
},
adjustDialog: function adjustDialog() {
if (this.refs.wrap && this.scrollbarWidth !== undefined) {
var modalIsOverflowing = this.refs.wrap.scrollHeight > document.documentElement.clientHeight;
this.refs.wrap.style.paddingLeft = (!this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '') + 'px';
this.refs.wrap.style.paddingRight = (this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : '') + 'px';
}
},
resetAdjustments: function resetAdjustments() {
if (this.refs.wrap) {
this.refs.wrap.style.paddingLeft = this.refs.wrap.style.paddingLeft = '';
}
},
render: function render() {
var props = this.props;
var prefixCls = props.prefixCls,
maskClosable = props.maskClosable;
var style = this.getWrapStyle();
// clear hide display
// and only set display after async anim, not here for hide
if (props.visible) {
style.display = null;
}
return _react2["default"].createElement("div", null, this.getMaskElement(), _react2["default"].createElement("div", __assign({ tabIndex: -1, onKeyDown: this.onKeyDown, className: prefixCls + '-wrap ' + (props.wrapClassName || ''), ref: "wrap", onClick: maskClosable ? this.onMaskClick : undefined, role: "dialog", "aria-labelledby": props.title ? this.titleId : null, style: style }, props.wrapProps), this.getDialogElement()));
}
});
exports["default"] = Dialog;
module.exports = exports['default'];
/***/ },
/* 387 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _objectAssign = __webpack_require__(12);
var _objectAssign2 = _interopRequireDefault(_objectAssign);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var __assign = undefined && undefined.__assign || Object.assign || function (t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) {
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
}
return t;
};
var LazyRenderBox = _react2["default"].createClass({
displayName: 'LazyRenderBox',
shouldComponentUpdate: function shouldComponentUpdate(nextProps) {
return !!nextProps.hiddenClassName || !!nextProps.visible;
},
render: function render() {
var className = this.props.className;
if (!!this.props.hiddenClassName && !this.props.visible) {
className += ' ' + this.props.hiddenClassName;
}
var props = (0, _objectAssign2["default"])({}, this.props);
delete props.hiddenClassName;
delete props.visible;
props.className = className;
return _react2["default"].createElement("div", __assign({}, props));
}
});
exports["default"] = LazyRenderBox;
module.exports = exports['default'];
/***/ },
/* 388 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _defineProperty2 = __webpack_require__(6);
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _extends2 = __webpack_require__(7);
var _extends3 = _interopRequireDefault(_extends2);
var _typeof2 = __webpack_require__(33);
var _typeof3 = _interopRequireDefault(_typeof2);
var _classCallCheck2 = __webpack_require__(2);
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _possibleConstructorReturn2 = __webpack_require__(4);
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = __webpack_require__(3);
var _inherits3 = _interopRequireDefault(_inherits2);
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _reactDom = __webpack_require__(10);
var _reactDom2 = _interopRequireDefault(_reactDom);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function getOffset(ele) {
var el = ele;
var _x = 0;
var _y = 0;
while (el && !isNaN(el.offsetLeft) && !isNaN(el.offsetTop)) {
_x += el.offsetLeft - el.scrollLeft;
_y += el.offsetTop - el.scrollTop;
el = el.offsetParent;
}
return { top: _y, left: _x };
}
var CANCEL_DISTANCE_ON_SCROLL = 20;
var Drawer = function (_React$Component) {
(0, _inherits3["default"])(Drawer, _React$Component);
function Drawer(props) {
(0, _classCallCheck3["default"])(this, Drawer);
var _this = (0, _possibleConstructorReturn3["default"])(this, _React$Component.call(this, props));
_this.onOverlayClicked = function () {
if (_this.props.open) {
_this.props.onOpenChange(false, { overlayClicked: true });
}
};
_this.onTouchStart = function (ev) {
// filter out if a user starts swiping with a second finger
if (!_this.isTouching()) {
var touch = ev.targetTouches[0];
_this.setState({
touchIdentifier: !_this.notTouch ? touch.identifier : null,
touchStartX: touch.clientX,
touchStartY: touch.clientY,
touchCurrentX: touch.clientX,
touchCurrentY: touch.clientY
});
}
};
_this.onTouchMove = function (ev) {
// ev.preventDefault(); // cannot touchmove with FastClick
if (_this.isTouching()) {
for (var ind = 0; ind < ev.targetTouches.length; ind++) {
// we only care about the finger that we are tracking
if (ev.targetTouches[ind].identifier === _this.state.touchIdentifier) {
_this.setState({
touchCurrentX: ev.targetTouches[ind].clientX,
touchCurrentY: ev.targetTouches[ind].clientY
});
break;
}
}
}
};
_this.onTouchEnd = function () {
_this.notTouch = false;
if (_this.isTouching()) {
// trigger a change to open if sidebar has been dragged beyond dragToggleDistance
var touchWidth = _this.touchSidebarWidth();
if (_this.props.open && touchWidth < _this.state.sidebarWidth - _this.props.dragToggleDistance || !_this.props.open && touchWidth > _this.props.dragToggleDistance) {
_this.props.onOpenChange(!_this.props.open);
}
var touchHeight = _this.touchSidebarHeight();
if (_this.props.open && touchHeight < _this.state.sidebarHeight - _this.props.dragToggleDistance || !_this.props.open && touchHeight > _this.props.dragToggleDistance) {
_this.props.onOpenChange(!_this.props.open);
}
_this.setState({
touchIdentifier: null,
touchStartX: null,
touchStartY: null,
touchCurrentX: null,
touchCurrentY: null
});
}
};
_this.onScroll = function () {
if (_this.isTouching() && _this.inCancelDistanceOnScroll()) {
_this.setState({
touchIdentifier: null,
touchStartX: null,
touchStartY: null,
touchCurrentX: null,
touchCurrentY: null
});
}
};
_this.inCancelDistanceOnScroll = function () {
var cancelDistanceOnScroll = void 0;
switch (_this.props.position) {
case 'right':
cancelDistanceOnScroll = Math.abs(_this.state.touchCurrentX - _this.state.touchStartX) < CANCEL_DISTANCE_ON_SCROLL;
break;
case 'bottom':
cancelDistanceOnScroll = Math.abs(_this.state.touchCurrentY - _this.state.touchStartY) < CANCEL_DISTANCE_ON_SCROLL;
break;
case 'top':
cancelDistanceOnScroll = Math.abs(_this.state.touchStartY - _this.state.touchCurrentY) < CANCEL_DISTANCE_ON_SCROLL;
break;
case 'left':
default:
cancelDistanceOnScroll = Math.abs(_this.state.touchStartX - _this.state.touchCurrentX) < CANCEL_DISTANCE_ON_SCROLL;
}
return cancelDistanceOnScroll;
};
_this.isTouching = function () {
return _this.state.touchIdentifier !== null;
};
_this.saveSidebarSize = function () {
var sidebar = _reactDom2["default"].findDOMNode(_this.refs.sidebar);
var width = sidebar.offsetWidth;
var height = sidebar.offsetHeight;
var sidebarTop = getOffset(_reactDom2["default"].findDOMNode(_this.refs.sidebar)).top;
var dragHandleTop = getOffset(_reactDom2["default"].findDOMNode(_this.refs.dragHandle)).top;
if (width !== _this.state.sidebarWidth) {
_this.setState({ sidebarWidth: width });
}
if (height !== _this.state.sidebarHeight) {
_this.setState({ sidebarHeight: height });
}
if (sidebarTop !== _this.state.sidebarTop) {
_this.setState({ sidebarTop: sidebarTop });
}
if (dragHandleTop !== _this.state.dragHandleTop) {
_this.setState({ dragHandleTop: dragHandleTop });
}
};
_this.touchSidebarWidth = function () {
// if the sidebar is open and start point of drag is inside the sidebar
// we will only drag the distance they moved their finger
// otherwise we will move the sidebar to be below the finger.
if (_this.props.position === 'right') {
if (_this.props.open && window.innerWidth - _this.state.touchStartX < _this.state.sidebarWidth) {
if (_this.state.touchCurrentX > _this.state.touchStartX) {
return _this.state.sidebarWidth + _this.state.touchStartX - _this.state.touchCurrentX;
}
return _this.state.sidebarWidth;
}
return Math.min(window.innerWidth - _this.state.touchCurrentX, _this.state.sidebarWidth);
}
if (_this.props.position === 'left') {
if (_this.props.open && _this.state.touchStartX < _this.state.sidebarWidth) {
if (_this.state.touchCurrentX > _this.state.touchStartX) {
return _this.state.sidebarWidth;
}
return _this.state.sidebarWidth - _this.state.touchStartX + _this.state.touchCurrentX;
}
return Math.min(_this.state.touchCurrentX, _this.state.sidebarWidth);
}
};
_this.touchSidebarHeight = function () {
// if the sidebar is open and start point of drag is inside the sidebar
// we will only drag the distance they moved their finger
// otherwise we will move the sidebar to be below the finger.
if (_this.props.position === 'bottom') {
if (_this.props.open && window.innerHeight - _this.state.touchStartY < _this.state.sidebarHeight) {
if (_this.state.touchCurrentY > _this.state.touchStartY) {
return _this.state.sidebarHeight + _this.state.touchStartY - _this.state.touchCurrentY;
}
return _this.state.sidebarHeight;
}
return Math.min(window.innerHeight - _this.state.touchCurrentY, _this.state.sidebarHeight);
}
if (_this.props.position === 'top') {
var touchStartOffsetY = _this.state.touchStartY - _this.state.sidebarTop;
if (_this.props.open && touchStartOffsetY < _this.state.sidebarHeight) {
if (_this.state.touchCurrentY > _this.state.touchStartY) {
return _this.state.sidebarHeight;
}
return _this.state.sidebarHeight - _this.state.touchStartY + _this.state.touchCurrentY;
}
return Math.min(_this.state.touchCurrentY - _this.state.dragHandleTop, _this.state.sidebarHeight);
}
};
_this.renderStyle = function (_ref) {
var sidebarStyle = _ref.sidebarStyle,
isTouching = _ref.isTouching,
overlayStyle = _ref.overlayStyle,
contentStyle = _ref.contentStyle;
if (_this.props.position === 'right' || _this.props.position === 'left') {
sidebarStyle.transform = 'translateX(0%)';
sidebarStyle.WebkitTransform = 'translateX(0%)';
if (isTouching) {
var percentage = _this.touchSidebarWidth() / _this.state.sidebarWidth;
// slide open to what we dragged
if (_this.props.position === 'right') {
sidebarStyle.transform = 'translateX(' + (1 - percentage) * 100 + '%)';
sidebarStyle.WebkitTransform = 'translateX(' + (1 - percentage) * 100 + '%)';
}
if (_this.props.position === 'left') {
sidebarStyle.transform = 'translateX(-' + (1 - percentage) * 100 + '%)';
sidebarStyle.WebkitTransform = 'translateX(-' + (1 - percentage) * 100 + '%)';
}
// fade overlay to match distance of drag
overlayStyle.opacity = percentage;
overlayStyle.visibility = 'visible';
}
if (contentStyle) {
contentStyle[_this.props.position] = _this.state.sidebarWidth + 'px';
}
}
if (_this.props.position === 'top' || _this.props.position === 'bottom') {
sidebarStyle.transform = 'translateY(0%)';
sidebarStyle.WebkitTransform = 'translateY(0%)';
if (isTouching) {
var _percentage = _this.touchSidebarHeight() / _this.state.sidebarHeight;
// slide open to what we dragged
if (_this.props.position === 'bottom') {
sidebarStyle.transform = 'translateY(' + (1 - _percentage) * 100 + '%)';
sidebarStyle.WebkitTransform = 'translateY(' + (1 - _percentage) * 100 + '%)';
}
if (_this.props.position === 'top') {
sidebarStyle.transform = 'translateY(-' + (1 - _percentage) * 100 + '%)';
sidebarStyle.WebkitTransform = 'translateY(-' + (1 - _percentage) * 100 + '%)';
}
// fade overlay to match distance of drag
overlayStyle.opacity = _percentage;
overlayStyle.visibility = 'visible';
}
if (contentStyle) {
contentStyle[_this.props.position] = _this.state.sidebarHeight + 'px';
}
}
};
_this.state = {
// the detected width of the sidebar in pixels
sidebarWidth: 0,
sidebarHeight: 0,
sidebarTop: 0,
dragHandleTop: 0,
// keep track of touching params
touchIdentifier: null,
touchStartX: null,
touchStartY: null,
touchCurrentX: null,
touchCurrentY: null,
// if touch is supported by the browser
touchSupported: (typeof window === 'undefined' ? 'undefined' : (0, _typeof3["default"])(window)) === 'object' && 'ontouchstart' in window
};
return _this;
}
Drawer.prototype.componentDidMount = function componentDidMount() {
this.saveSidebarSize();
};
Drawer.prototype.componentDidUpdate = function componentDidUpdate() {
// filter out the updates when we're touching
if (!this.isTouching()) {
this.saveSidebarSize();
}
};
// This logic helps us prevents the user from sliding the sidebar horizontally
// while scrolling the sidebar vertically. When a scroll event comes in, we're
// cancelling the ongoing gesture if it did not move horizontally much.
// True if the on going gesture X distance is less than the cancel distance
// calculate the sidebarWidth based on current touch info
// calculate the sidebarHeight based on current touch info
Drawer.prototype.render = function render() {
var _rootCls,
_this2 = this;
var _props = this.props,
className = _props.className,
style = _props.style,
prefixCls = _props.prefixCls,
position = _props.position,
transitions = _props.transitions,
touch = _props.touch,
enableDragHandle = _props.enableDragHandle,
sidebar = _props.sidebar,
children = _props.children,
docked = _props.docked,
open = _props.open;
var sidebarStyle = (0, _extends3["default"])({}, this.props.sidebarStyle);
var contentStyle = (0, _extends3["default"])({}, this.props.contentStyle);
var overlayStyle = (0, _extends3["default"])({}, this.props.overlayStyle);
var rootCls = (_rootCls = {}, (0, _defineProperty3["default"])(_rootCls, className, !!className), (0, _defineProperty3["default"])(_rootCls, prefixCls, true), (0, _defineProperty3["default"])(_rootCls, prefixCls + '-' + position, true), _rootCls);
var rootProps = { style: style };
var isTouching = this.isTouching();
if (isTouching) {
this.renderStyle({ sidebarStyle: sidebarStyle, isTouching: true, overlayStyle: overlayStyle });
} else if (docked) {
if (this.state.sidebarWidth !== 0) {
rootCls[prefixCls + '-docked'] = true;
this.renderStyle({ sidebarStyle: sidebarStyle, contentStyle: contentStyle });
}
} else if (open) {
rootCls[prefixCls + '-open'] = true;
this.renderStyle({ sidebarStyle: sidebarStyle });
overlayStyle.opacity = 1;
overlayStyle.visibility = 'visible';
}
if (isTouching || !transitions) {
sidebarStyle.transition = 'none';
sidebarStyle.WebkitTransition = 'none';
contentStyle.transition = 'none';
overlayStyle.transition = 'none';
}
var dragHandle = null;
if (this.state.touchSupported && touch) {
if (open) {
rootProps.onTouchStart = function (ev) {
_this2.notTouch = true;
_this2.onTouchStart(ev);
};
rootProps.onTouchMove = this.onTouchMove;
rootProps.onTouchEnd = this.onTouchEnd;
rootProps.onTouchCancel = this.onTouchEnd;
rootProps.onScroll = this.onScroll;
} else if (enableDragHandle) {
dragHandle = _react2["default"].createElement('div', { className: prefixCls + '-draghandle', style: this.props.dragHandleStyle,
onTouchStart: this.onTouchStart, onTouchMove: this.onTouchMove,
onTouchEnd: this.onTouchEnd, onTouchCancel: this.onTouchEnd,
ref: 'dragHandle'
});
}
}
// const evt = {};
// // FastClick use touchstart instead of click
// if (this.state.touchSupported) {
// evt.onTouchStart = () => {
// this.notTouch = true;
// this.onOverlayClicked();
// };
// evt.onTouchEnd = () => {
// this.notTouch = false;
// this.setState({
// touchIdentifier: null,
// });
// };
// } else {
// evt.onClick = this.onOverlayClicked;
// }
return _react2["default"].createElement(
'div',
(0, _extends3["default"])({ className: (0, _classnames2["default"])(rootCls) }, rootProps),
_react2["default"].createElement(
'div',
{ className: prefixCls + '-sidebar', style: sidebarStyle,
ref: 'sidebar'
},
sidebar
),
_react2["default"].createElement('div', { className: prefixCls + '-overlay',
style: overlayStyle,
role: 'presentation',
ref: 'overlay',
onClick: this.onOverlayClicked
}),
_react2["default"].createElement(
'div',
{ className: prefixCls + '-content', style: contentStyle,
ref: 'content'
},
dragHandle,
children
)
);
};
return Drawer;
}(_react2["default"].Component);
Drawer.propTypes = {
prefixCls: _react2["default"].PropTypes.string,
className: _react2["default"].PropTypes.string,
// main content to render
children: _react2["default"].PropTypes.node.isRequired,
// styles
// styles: React.PropTypes.shape({
// dragHandle: React.PropTypes.object,
// }),
style: _react2["default"].PropTypes.object,
sidebarStyle: _react2["default"].PropTypes.object,
contentStyle: _react2["default"].PropTypes.object,
overlayStyle: _react2["default"].PropTypes.object,
dragHandleStyle: _react2["default"].PropTypes.object,
// sidebar content to render
sidebar: _react2["default"].PropTypes.node.isRequired,
// boolean if sidebar should be docked
docked: _react2["default"].PropTypes.bool,
// boolean if sidebar should slide open
open: _react2["default"].PropTypes.bool,
// boolean if transitions should be disabled
transitions: _react2["default"].PropTypes.bool,
// boolean if touch gestures are enabled
touch: _react2["default"].PropTypes.bool,
enableDragHandle: _react2["default"].PropTypes.bool,
// where to place the sidebar
position: _react2["default"].PropTypes.oneOf(['left', 'right', 'top', 'bottom']),
// distance we have to drag the sidebar to toggle open state
dragToggleDistance: _react2["default"].PropTypes.number,
// callback called when the overlay is clicked
onOpenChange: _react2["default"].PropTypes.func
};
Drawer.defaultProps = {
prefixCls: 'rc-drawer',
sidebarStyle: {},
contentStyle: {},
overlayStyle: {},
dragHandleStyle: {},
docked: false,
open: false,
transitions: true,
touch: true,
enableDragHandle: true,
position: 'left',
dragToggleDistance: 30,
onOpenChange: function onOpenChange() {}
};
exports["default"] = Drawer;
module.exports = exports['default'];
/***/ },
/* 389 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _Drawer = __webpack_require__(388);
var _Drawer2 = _interopRequireDefault(_Drawer);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
exports["default"] = _Drawer2["default"]; // export this package's api
module.exports = exports['default'];
/***/ },
/* 390 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _objectWithoutProperties2 = __webpack_require__(18);
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
var _classCallCheck2 = __webpack_require__(2);
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _possibleConstructorReturn2 = __webpack_require__(4);
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = __webpack_require__(3);
var _inherits3 = _interopRequireDefault(_inherits2);
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__(9);
var _propTypes2 = _interopRequireDefault(_propTypes);
var _rcTouchable = __webpack_require__(17);
var _rcTouchable2 = _interopRequireDefault(_rcTouchable);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var InputHandler = function (_Component) {
(0, _inherits3["default"])(InputHandler, _Component);
function InputHandler() {
(0, _classCallCheck3["default"])(this, InputHandler);
return (0, _possibleConstructorReturn3["default"])(this, _Component.apply(this, arguments));
}
InputHandler.prototype.render = function render() {
var _props = this.props,
prefixCls = _props.prefixCls,
disabled = _props.disabled,
otherProps = (0, _objectWithoutProperties3["default"])(_props, ['prefixCls', 'disabled']);
return _react2["default"].createElement(
_rcTouchable2["default"],
{ disabled: disabled, activeClassName: prefixCls + '-handler-active' },
_react2["default"].createElement('span', otherProps)
);
};
return InputHandler;
}(_react.Component);
InputHandler.propTypes = {
prefixCls: _propTypes2["default"].string,
disabled: _propTypes2["default"].bool
};
exports["default"] = InputHandler;
module.exports = exports['default'];
/***/ },
/* 391 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _defineProperty2 = __webpack_require__(6);
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _extends2 = __webpack_require__(7);
var _extends3 = _interopRequireDefault(_extends2);
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__(9);
var _propTypes2 = _interopRequireDefault(_propTypes);
var _createReactClass = __webpack_require__(46);
var _createReactClass2 = _interopRequireDefault(_createReactClass);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var _mixin = __webpack_require__(392);
var _mixin2 = _interopRequireDefault(_mixin);
var _InputHandler = __webpack_require__(390);
var _InputHandler2 = _interopRequireDefault(_InputHandler);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function noop() {}
function preventDefault(e) {
e.preventDefault();
}
var InputNumber = (0, _createReactClass2["default"])({
propTypes: {
focusOnUpDown: _propTypes2["default"].bool,
onChange: _propTypes2["default"].func,
onKeyDown: _propTypes2["default"].func,
onKeyUp: _propTypes2["default"].func,
prefixCls: _propTypes2["default"].string,
disabled: _propTypes2["default"].bool,
onFocus: _propTypes2["default"].func,
onBlur: _propTypes2["default"].func,
readOnly: _propTypes2["default"].bool,
max: _propTypes2["default"].number,
min: _propTypes2["default"].number,
step: _propTypes2["default"].oneOfType([_propTypes2["default"].number, _propTypes2["default"].string]),
upHandler: _propTypes2["default"].node,
downHandler: _propTypes2["default"].node,
useTouch: _propTypes2["default"].bool,
formatter: _propTypes2["default"].func,
parser: _propTypes2["default"].func,
onMouseEnter: _propTypes2["default"].func,
onMouseLeave: _propTypes2["default"].func,
onMouseOver: _propTypes2["default"].func,
onMouseOut: _propTypes2["default"].func
},
mixins: [_mixin2["default"]],
getDefaultProps: function getDefaultProps() {
return {
focusOnUpDown: true,
useTouch: false,
prefixCls: 'rc-input-number'
};
},
componentDidMount: function componentDidMount() {
this.componentDidUpdate();
},
componentWillUpdate: function componentWillUpdate() {
try {
this.start = this.refs.input.selectionStart;
this.end = this.refs.input.selectionEnd;
} catch (e) {
// Fix error in Chrome:
// Failed to read the 'selectionStart' property from 'HTMLInputElement'
// http://stackoverflow.com/q/21177489/3040605
}
},
componentDidUpdate: function componentDidUpdate() {
if (this.props.focusOnUpDown && this.state.focused) {
var selectionRange = this.refs.input.setSelectionRange;
if (selectionRange && typeof selectionRange === 'function' && this.start !== undefined && this.end !== undefined && this.start !== this.end) {
this.refs.input.setSelectionRange(this.start, this.end);
} else {
this.focus();
}
}
},
onKeyDown: function onKeyDown(e) {
if (e.keyCode === 38) {
var ratio = this.getRatio(e);
this.up(e, ratio);
this.stop();
} else if (e.keyCode === 40) {
var _ratio = this.getRatio(e);
this.down(e, _ratio);
this.stop();
}
var onKeyDown = this.props.onKeyDown;
if (onKeyDown) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
onKeyDown.apply(undefined, [e].concat(args));
}
},
onKeyUp: function onKeyUp(e) {
this.stop();
var onKeyUp = this.props.onKeyUp;
if (onKeyUp) {
for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
args[_key2 - 1] = arguments[_key2];
}
onKeyUp.apply(undefined, [e].concat(args));
}
},
getRatio: function getRatio(e) {
var ratio = 1;
if (e.metaKey || e.ctrlKey) {
ratio = 0.1;
} else if (e.shiftKey) {
ratio = 10;
}
return ratio;
},
getValueFromEvent: function getValueFromEvent(e) {
return e.target.value;
},
focus: function focus() {
this.refs.input.focus();
},
formatWrapper: function formatWrapper(num) {
if (this.props.formatter) {
return this.props.formatter(num);
}
return num;
},
render: function render() {
var _classNames;
var props = (0, _extends3["default"])({}, this.props);
var prefixCls = props.prefixCls,
disabled = props.disabled,
readOnly = props.readOnly,
useTouch = props.useTouch;
var classes = (0, _classnames2["default"])((_classNames = {}, (0, _defineProperty3["default"])(_classNames, prefixCls, true), (0, _defineProperty3["default"])(_classNames, props.className, !!props.className), (0, _defineProperty3["default"])(_classNames, prefixCls + '-disabled', disabled), (0, _defineProperty3["default"])(_classNames, prefixCls + '-focused', this.state.focused), _classNames));
var upDisabledClass = '';
var downDisabledClass = '';
var value = this.state.value;
if (value) {
if (!isNaN(value)) {
var val = Number(value);
if (val >= props.max) {
upDisabledClass = prefixCls + '-handler-up-disabled';
}
if (val <= props.min) {
downDisabledClass = prefixCls + '-handler-down-disabled';
}
} else {
upDisabledClass = prefixCls + '-handler-up-disabled';
downDisabledClass = prefixCls + '-handler-down-disabled';
}
}
var editable = !props.readOnly && !props.disabled;
// focus state, show input value
// unfocus state, show valid value
var inputDisplayValue = void 0;
if (this.state.focused) {
inputDisplayValue = this.state.inputValue;
} else {
inputDisplayValue = this.toPrecisionAsStep(this.state.value);
}
if (inputDisplayValue === undefined || inputDisplayValue === null) {
inputDisplayValue = '';
}
var upEvents = void 0;
var downEvents = void 0;
if (useTouch) {
upEvents = {
onTouchStart: editable && !upDisabledClass ? this.up : noop,
onTouchEnd: this.stop
};
downEvents = {
onTouchStart: editable && !downDisabledClass ? this.down : noop,
onTouchEnd: this.stop
};
} else {
upEvents = {
onMouseDown: editable && !upDisabledClass ? this.up : noop,
onMouseUp: this.stop,
onMouseLeave: this.stop
};
downEvents = {
onMouseDown: editable && !downDisabledClass ? this.down : noop,
onMouseUp: this.stop,
onMouseLeave: this.stop
};
}
var inputDisplayValueFormat = this.formatWrapper(inputDisplayValue);
// ref for test
return _react2["default"].createElement(
'div',
{
className: classes,
style: props.style,
onMouseEnter: props.onMouseEnter,
onMouseLeave: props.onMouseLeave,
onMouseOver: props.onMouseOver,
onMouseOut: props.onMouseOut
},
_react2["default"].createElement(
'div',
{ className: prefixCls + '-handler-wrap' },
_react2["default"].createElement(
_InputHandler2["default"],
(0, _extends3["default"])({
ref: 'up',
disabled: !!upDisabledClass || disabled || readOnly,
prefixCls: prefixCls,
unselectable: 'unselectable'
}, upEvents, {
className: prefixCls + '-handler ' + prefixCls + '-handler-up ' + upDisabledClass
}),
this.props.upHandler || _react2["default"].createElement('span', {
unselectable: 'unselectable',
className: prefixCls + '-handler-up-inner',
onClick: preventDefault
})
),
_react2["default"].createElement(
_InputHandler2["default"],
(0, _extends3["default"])({
ref: 'down',
disabled: !!downDisabledClass || disabled || readOnly,
prefixCls: prefixCls,
unselectable: 'unselectable'
}, downEvents, {
className: prefixCls + '-handler ' + prefixCls + '-handler-down ' + downDisabledClass
}),
this.props.downHandler || _react2["default"].createElement('span', {
unselectable: 'unselectable',
className: prefixCls + '-handler-down-inner',
onClick: preventDefault
})
)
),
_react2["default"].createElement(
'div',
{ className: prefixCls + '-input-wrap' },
_react2["default"].createElement('input', {
type: props.type,
placeholder: props.placeholder,
onClick: props.onClick,
className: prefixCls + '-input',
autoComplete: 'off',
onFocus: this.onFocus,
onBlur: this.onBlur,
onKeyDown: editable ? this.onKeyDown : noop,
onKeyUp: editable ? this.onKeyUp : noop,
autoFocus: props.autoFocus,
maxLength: props.maxLength,
readOnly: props.readOnly,
disabled: props.disabled,
max: props.max,
min: props.min,
name: props.name,
onChange: this.onChange,
ref: 'input',
value: inputDisplayValueFormat
})
)
);
}
});
exports["default"] = InputNumber;
module.exports = exports['default'];
/***/ },
/* 392 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
function noop() {}
function defaultParser(input) {
return input.replace(/[^\w\.-]+/g, '');
}
/**
* When click and hold on a button - the speed of auto changin the value.
*/
var SPEED = 200;
/**
* When click and hold on a button - the delay before auto changin the value.
*/
var DELAY = 600;
exports["default"] = {
getDefaultProps: function getDefaultProps() {
return {
max: Infinity,
min: -Infinity,
step: 1,
style: {},
onChange: noop,
onKeyDown: noop,
onFocus: noop,
onBlur: noop,
parser: defaultParser
};
},
getInitialState: function getInitialState() {
var value = void 0;
var props = this.props;
if ('value' in props) {
value = props.value;
} else {
value = props.defaultValue;
}
value = this.toNumber(value);
return {
inputValue: this.toPrecisionAsStep(value),
value: value,
focused: props.autoFocus
};
},
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
if ('value' in nextProps) {
this.setState({
inputValue: nextProps.value,
value: nextProps.value
});
}
},
componentWillUnmount: function componentWillUnmount() {
this.stop();
},
onChange: function onChange(e) {
var input = this.props.parser(this.getValueFromEvent(e).trim());
this.setState({ inputValue: input });
this.props.onChange(this.toNumberWhenUserInput(input)); // valid number or invalid string
},
onFocus: function onFocus() {
var _props;
this.setState({
focused: true
});
(_props = this.props).onFocus.apply(_props, arguments);
},
onBlur: function onBlur(e) {
var _this = this;
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
this.setState({
focused: false
});
var value = this.getCurrentValidValue(this.state.inputValue);
e.persist(); // fix https://github.com/react-component/input-number/issues/51
this.setValue(value, function () {
var _props2;
(_props2 = _this.props).onBlur.apply(_props2, [e].concat(args));
});
},
getCurrentValidValue: function getCurrentValidValue(value) {
var val = value;
var props = this.props;
if (val === '') {
val = '';
} else if (!this.isNotCompleteNumber(val)) {
val = Number(val);
if (val < props.min) {
val = props.min;
}
if (val > props.max) {
val = props.max;
}
} else {
val = this.state.value;
}
return this.toNumber(val);
},
setValue: function setValue(v, callback) {
// trigger onChange
var newValue = this.isNotCompleteNumber(parseFloat(v, 10)) ? undefined : parseFloat(v, 10);
var changed = newValue !== this.state.value;
if (!('value' in this.props)) {
this.setState({
value: newValue,
inputValue: this.toPrecisionAsStep(v)
}, callback);
} else {
// always set input value same as value
this.setState({
inputValue: this.toPrecisionAsStep(this.state.value)
}, callback);
}
if (changed) {
this.props.onChange(newValue);
}
},
getPrecision: function getPrecision(value) {
var valueString = value.toString();
if (valueString.indexOf('e-') >= 0) {
return parseInt(valueString.slice(valueString.indexOf('e-') + 2), 10);
}
var precision = 0;
if (valueString.indexOf('.') >= 0) {
precision = valueString.length - valueString.indexOf('.') - 1;
}
return precision;
},
// step={1.0} value={1.51}
// press +
// then value should be 2.51, rather than 2.5
// https://github.com/react-component/input-number/issues/39
getMaxPrecision: function getMaxPrecision(currentValue) {
var ratio = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
var step = this.props.step;
var ratioPrecision = this.getPrecision(ratio);
var stepPrecision = this.getPrecision(step);
var currentValuePrecision = this.getPrecision(currentValue);
if (!currentValue) {
return ratioPrecision + stepPrecision;
}
return Math.max(currentValuePrecision, ratioPrecision + stepPrecision);
},
getPrecisionFactor: function getPrecisionFactor(currentValue) {
var ratio = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
var precision = this.getMaxPrecision(currentValue, ratio);
return Math.pow(10, precision);
},
toPrecisionAsStep: function toPrecisionAsStep(num) {
if (this.isNotCompleteNumber(num) || num === '') {
return num;
}
var precision = Math.abs(this.getMaxPrecision(num));
if (precision) {
return Number(num).toFixed(precision);
}
return num.toString();
},
// '1.' '1x' 'xx' '' => are not complete numbers
isNotCompleteNumber: function isNotCompleteNumber(num) {
return isNaN(num) || num === '' || num === null || num && num.toString().indexOf('.') === num.toString().length - 1;
},
toNumber: function toNumber(num) {
if (this.isNotCompleteNumber(num)) {
return num;
}
return Number(num);
},
// '1.0' '1.00' => may be a inputing number
toNumberWhenUserInput: function toNumberWhenUserInput(num) {
// num.length > 16 => prevent input large number will became Infinity
if ((/\.0+$/.test(num) || num.length > 16) && this.state.focused) {
return num;
}
return this.toNumber(num);
},
upStep: function upStep(val, rat) {
var _props3 = this.props,
step = _props3.step,
min = _props3.min;
var precisionFactor = this.getPrecisionFactor(val, rat);
var precision = Math.abs(this.getMaxPrecision(val, rat));
var result = void 0;
if (typeof val === 'number') {
result = ((precisionFactor * val + precisionFactor * step * rat) / precisionFactor).toFixed(precision);
} else {
result = min === -Infinity ? step : min;
}
return this.toNumber(result);
},
downStep: function downStep(val, rat) {
var _props4 = this.props,
step = _props4.step,
min = _props4.min;
var precisionFactor = this.getPrecisionFactor(val, rat);
var precision = Math.abs(this.getMaxPrecision(val, rat));
var result = void 0;
if (typeof val === 'number') {
result = ((precisionFactor * val - precisionFactor * step * rat) / precisionFactor).toFixed(precision);
} else {
result = min === -Infinity ? -step : min;
}
return this.toNumber(result);
},
step: function step(type, e) {
var ratio = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
if (e) {
e.preventDefault();
}
var props = this.props;
if (props.disabled) {
return;
}
var value = this.getCurrentValidValue(this.state.inputValue) || 0;
if (this.isNotCompleteNumber(value)) {
return;
}
var val = this[type + 'Step'](value, ratio);
if (val > props.max) {
val = props.max;
} else if (val < props.min) {
val = props.min;
}
this.setValue(val);
this.setState({
focused: true
});
},
stop: function stop() {
if (this.autoStepTimer) {
clearTimeout(this.autoStepTimer);
}
},
down: function down(e, ratio, recursive) {
var _this2 = this;
if (e.persist) {
e.persist();
}
this.stop();
this.step('down', e, ratio);
this.autoStepTimer = setTimeout(function () {
_this2.down(e, ratio, true);
}, recursive ? SPEED : DELAY);
},
up: function up(e, ratio, recursive) {
var _this3 = this;
if (e.persist) {
e.persist();
}
this.stop();
this.step('up', e, ratio);
this.autoStepTimer = setTimeout(function () {
_this3.up(e, ratio, true);
}, recursive ? SPEED : DELAY);
}
};
module.exports = exports['default'];
/***/ },
/* 393 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
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 Notice = _react2["default"].createClass({
displayName: 'Notice',
propTypes: {
duration: _react.PropTypes.number,
onClose: _react.PropTypes.func,
children: _react.PropTypes.any
},
getDefaultProps: function getDefaultProps() {
return {
onEnd: function onEnd() {},
onClose: function onClose() {},
duration: 1.5,
style: {
right: '50%'
}
};
},
componentDidMount: function componentDidMount() {
var _this = this;
if (this.props.duration) {
this.closeTimer = setTimeout(function () {
_this.close();
}, this.props.duration * 1000);
}
},
componentWillUnmount: function componentWillUnmount() {
this.clearCloseTimer();
},
clearCloseTimer: function clearCloseTimer() {
if (this.closeTimer) {
clearTimeout(this.closeTimer);
this.closeTimer = null;
}
},
close: function close() {
this.clearCloseTimer();
this.props.onClose();
},
render: function render() {
var _className;
var props = this.props;
var componentClass = props.prefixCls + '-notice';
var className = (_className = {}, _defineProperty(_className, '' + componentClass, 1), _defineProperty(_className, componentClass + '-closable', props.closable), _defineProperty(_className, props.className, !!props.className), _className);
return _react2["default"].createElement(
'div',
{ className: (0, _classnames2["default"])(className), style: props.style },
_react2["default"].createElement(
'div',
{ className: componentClass + '-content' },
props.children
),
props.closable ? _react2["default"].createElement(
'a',
{ tabIndex: '0', onClick: this.close, className: componentClass + '-close' },
_react2["default"].createElement('span', { className: componentClass + '-close-x' })
) : null
);
}
});
exports["default"] = Notice;
module.exports = exports['default'];
/***/ },
/* 394 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _reactDom = __webpack_require__(10);
var _reactDom2 = _interopRequireDefault(_reactDom);
var _rcAnimate = __webpack_require__(47);
var _rcAnimate2 = _interopRequireDefault(_rcAnimate);
var _createChainedFunction = __webpack_require__(436);
var _createChainedFunction2 = _interopRequireDefault(_createChainedFunction);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var _Notice = __webpack_require__(393);
var _Notice2 = _interopRequireDefault(_Notice);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
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 seed = 0;
var now = Date.now();
function getUuid() {
return 'rcNotification_' + now + '_' + seed++;
}
var Notification = _react2["default"].createClass({
displayName: 'Notification',
propTypes: {
prefixCls: _react.PropTypes.string,
transitionName: _react.PropTypes.string,
animation: _react.PropTypes.oneOfType([_react.PropTypes.string, _react.PropTypes.object]),
style: _react.PropTypes.object
},
getDefaultProps: function getDefaultProps() {
return {
prefixCls: 'rc-notification',
animation: 'fade',
style: {
top: 65,
left: '50%'
}
};
},
getInitialState: function getInitialState() {
return {
notices: []
};
},
getTransitionName: function getTransitionName() {
var props = this.props;
var transitionName = props.transitionName;
if (!transitionName && props.animation) {
transitionName = props.prefixCls + '-' + props.animation;
}
return transitionName;
},
add: function add(notice) {
var key = notice.key = notice.key || getUuid();
this.setState(function (previousState) {
var notices = previousState.notices;
if (!notices.filter(function (v) {
return v.key === key;
}).length) {
return {
notices: notices.concat(notice)
};
}
});
},
remove: function remove(key) {
this.setState(function (previousState) {
return {
notices: previousState.notices.filter(function (notice) {
return notice.key !== key;
})
};
});
},
render: function render() {
var _this = this,
_className;
var props = this.props;
var noticeNodes = this.state.notices.map(function (notice) {
var onClose = (0, _createChainedFunction2["default"])(_this.remove.bind(_this, notice.key), notice.onClose);
return _react2["default"].createElement(
_Notice2["default"],
_extends({
prefixCls: props.prefixCls
}, notice, {
onClose: onClose
}),
notice.content
);
});
var className = (_className = {}, _defineProperty(_className, props.prefixCls, 1), _defineProperty(_className, props.className, !!props.className), _className);
return _react2["default"].createElement(
'div',
{ className: (0, _classnames2["default"])(className), style: props.style },
_react2["default"].createElement(
_rcAnimate2["default"],
{ transitionName: this.getTransitionName() },
noticeNodes
)
);
}
});
Notification.newInstance = function newNotificationInstance(properties) {
var _ref = properties || {},
getContainer = _ref.getContainer,
props = _objectWithoutProperties(_ref, ['getContainer']);
var div = void 0;
if (getContainer) {
div = getContainer();
} else {
div = document.createElement('div');
document.body.appendChild(div);
}
var notification = _reactDom2["default"].render(_react2["default"].createElement(Notification, props), div);
return {
notice: function notice(noticeProps) {
notification.add(noticeProps);
},
removeNotice: function removeNotice(key) {
notification.remove(key);
},
component: notification,
destroy: function destroy() {
_reactDom2["default"].unmountComponentAtNode(div);
document.body.removeChild(div);
}
};
};
exports["default"] = Notification;
module.exports = exports['default'];
/***/ },
/* 395 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _Notification = __webpack_require__(394);
var _Notification2 = _interopRequireDefault(_Notification);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
exports["default"] = _Notification2["default"];
module.exports = exports['default'];
/***/ },
/* 396 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _defineProperty2 = __webpack_require__(6);
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _toConsumableArray2 = __webpack_require__(94);
var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);
var _extends2 = __webpack_require__(7);
var _extends3 = _interopRequireDefault(_extends2);
var _classCallCheck2 = __webpack_require__(2);
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _possibleConstructorReturn2 = __webpack_require__(4);
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = __webpack_require__(3);
var _inherits3 = _interopRequireDefault(_inherits2);
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__(9);
var _propTypes2 = _interopRequireDefault(_propTypes);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var _Track = __webpack_require__(117);
var _Track2 = _interopRequireDefault(_Track);
var _createSlider = __webpack_require__(118);
var _createSlider2 = _interopRequireDefault(_createSlider);
var _utils = __webpack_require__(73);
var utils = _interopRequireWildcard(_utils);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/* eslint-disable react/prop-types */
var Range = function (_React$Component) {
(0, _inherits3["default"])(Range, _React$Component);
function Range(props) {
(0, _classCallCheck3["default"])(this, Range);
var _this = (0, _possibleConstructorReturn3["default"])(this, _React$Component.call(this, props));
_this.onEnd = function () {
_this.setState({ handle: null });
_this.removeDocumentEvents();
_this.props.onAfterChange(_this.getValue());
};
var count = props.count,
min = props.min,
max = props.max;
var initialValue = Array.apply(null, Array(count + 1)).map(function () {
return min;
});
var defaultValue = 'defaultValue' in props ? props.defaultValue : initialValue;
var value = props.value !== undefined ? props.value : defaultValue;
var bounds = value.map(function (v) {
return _this.trimAlignValue(v);
});
var recent = bounds[0] === max ? 0 : bounds.length - 1;
_this.state = {
handle: null,
recent: recent,
bounds: bounds
};
return _this;
}
Range.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
var _this2 = this;
if (!('value' in nextProps || 'min' in nextProps || 'max' in nextProps)) return;
var bounds = this.state.bounds;
var value = nextProps.value || bounds;
var nextBounds = value.map(function (v) {
return _this2.trimAlignValue(v, nextProps);
});
if (nextBounds.length === bounds.length && nextBounds.every(function (v, i) {
return v === bounds[i];
})) return;
this.setState({ bounds: nextBounds });
if (bounds.some(function (v) {
return utils.isValueOutOfRange(v, nextProps);
})) {
this.props.onChange(nextBounds);
}
};
Range.prototype.onChange = function onChange(state) {
var props = this.props;
var isNotControlled = !('value' in props);
if (isNotControlled) {
this.setState(state);
} else if (state.handle !== undefined) {
this.setState({ handle: state.handle });
}
var data = (0, _extends3["default"])({}, this.state, state);
var changedValue = data.bounds;
props.onChange(changedValue);
};
Range.prototype.onStart = function onStart(position) {
var props = this.props;
var state = this.state;
var bounds = this.getValue();
props.onBeforeChange(bounds);
var value = this.calcValueByPos(position);
this.startValue = value;
this.startPosition = position;
var closestBound = this.getClosestBound(value);
var boundNeedMoving = this.getBoundNeedMoving(value, closestBound);
this.setState({
handle: boundNeedMoving,
recent: boundNeedMoving
});
var prevValue = bounds[boundNeedMoving];
if (value === prevValue) return;
var nextBounds = [].concat((0, _toConsumableArray3["default"])(state.bounds));
nextBounds[boundNeedMoving] = value;
this.onChange({ bounds: nextBounds });
};
Range.prototype.onMove = function onMove(e, position) {
utils.pauseEvent(e);
var props = this.props;
var state = this.state;
var value = this.calcValueByPos(position);
var oldValue = state.bounds[state.handle];
if (value === oldValue) return;
var nextBounds = [].concat((0, _toConsumableArray3["default"])(state.bounds));
nextBounds[state.handle] = value;
var nextHandle = state.handle;
if (props.pushable !== false) {
var originalValue = state.bounds[nextHandle];
this.pushSurroundingHandles(nextBounds, nextHandle, originalValue);
} else if (props.allowCross) {
nextBounds.sort(function (a, b) {
return a - b;
});
nextHandle = nextBounds.indexOf(value);
}
this.onChange({
handle: nextHandle,
bounds: nextBounds
});
};
Range.prototype.getValue = function getValue() {
return this.state.bounds;
};
Range.prototype.getClosestBound = function getClosestBound(value) {
var bounds = this.state.bounds;
var closestBound = 0;
for (var i = 1; i < bounds.length - 1; ++i) {
if (value > bounds[i]) {
closestBound = i;
}
}
if (Math.abs(bounds[closestBound + 1] - value) < Math.abs(bounds[closestBound] - value)) {
closestBound = closestBound + 1;
}
return closestBound;
};
Range.prototype.getBoundNeedMoving = function getBoundNeedMoving(value, closestBound) {
var _state = this.state,
bounds = _state.bounds,
recent = _state.recent;
var boundNeedMoving = closestBound;
var isAtTheSamePoint = bounds[closestBound + 1] === bounds[closestBound];
if (isAtTheSamePoint) {
boundNeedMoving = recent;
}
if (isAtTheSamePoint && value !== bounds[closestBound + 1]) {
boundNeedMoving = value < bounds[closestBound + 1] ? closestBound : closestBound + 1;
}
return boundNeedMoving;
};
Range.prototype.getLowerBound = function getLowerBound() {
return this.state.bounds[0];
};
Range.prototype.getUpperBound = function getUpperBound() {
var bounds = this.state.bounds;
return bounds[bounds.length - 1];
};
/**
* Returns an array of possible slider points, taking into account both
* `marks` and `step`. The result is cached.
*/
Range.prototype.getPoints = function getPoints() {
var _props = this.props,
marks = _props.marks,
step = _props.step,
min = _props.min,
max = _props.max;
var cache = this._getPointsCache;
if (!cache || cache.marks !== marks || cache.step !== step) {
var pointsObject = (0, _extends3["default"])({}, marks);
if (step !== null) {
for (var point = min; point <= max; point += step) {
pointsObject[point] = point;
}
}
var points = Object.keys(pointsObject).map(parseFloat);
points.sort(function (a, b) {
return a - b;
});
this._getPointsCache = { marks: marks, step: step, points: points };
}
return this._getPointsCache.points;
};
Range.prototype.pushSurroundingHandles = function pushSurroundingHandles(bounds, handle, originalValue) {
var threshold = this.props.pushable;
var value = bounds[handle];
var direction = 0;
if (bounds[handle + 1] - value < threshold) {
direction = +1; // push to right
}
if (value - bounds[handle - 1] < threshold) {
direction = -1; // push to left
}
if (direction === 0) {
return;
}
var nextHandle = handle + direction;
var diffToNext = direction * (bounds[nextHandle] - value);
if (!this.pushHandle(bounds, nextHandle, direction, threshold - diffToNext)) {
// revert to original value if pushing is impossible
bounds[handle] = originalValue;
}
};
Range.prototype.pushHandle = function pushHandle(bounds, handle, direction, amount) {
var originalValue = bounds[handle];
var currentValue = bounds[handle];
while (direction * (currentValue - originalValue) < amount) {
if (!this.pushHandleOnePoint(bounds, handle, direction)) {
// can't push handle enough to create the needed `amount` gap, so we
// revert its position to the original value
bounds[handle] = originalValue;
return false;
}
currentValue = bounds[handle];
}
// the handle was pushed enough to create the needed `amount` gap
return true;
};
Range.prototype.pushHandleOnePoint = function pushHandleOnePoint(bounds, handle, direction) {
var points = this.getPoints();
var pointIndex = points.indexOf(bounds[handle]);
var nextPointIndex = pointIndex + direction;
if (nextPointIndex >= points.length || nextPointIndex < 0) {
// reached the minimum or maximum available point, can't push anymore
return false;
}
var nextHandle = handle + direction;
var nextValue = points[nextPointIndex];
var threshold = this.props.pushable;
var diffToNext = direction * (bounds[nextHandle] - nextValue);
if (!this.pushHandle(bounds, nextHandle, direction, threshold - diffToNext)) {
// couldn't push next handle, so we won't push this one either
return false;
}
// push the handle
bounds[handle] = nextValue;
return true;
};
Range.prototype.trimAlignValue = function trimAlignValue(v) {
var nextProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var mergedProps = (0, _extends3["default"])({}, this.props, nextProps);
var valInRange = utils.ensureValueInRange(v, mergedProps);
var valNotConflict = this.ensureValueNotConflict(valInRange, mergedProps);
return utils.ensureValuePrecision(valNotConflict, mergedProps);
};
Range.prototype.ensureValueNotConflict = function ensureValueNotConflict(val, _ref) {
var allowCross = _ref.allowCross;
var state = this.state || {};
var handle = state.handle,
bounds = state.bounds;
/* eslint-disable eqeqeq */
if (!allowCross && handle != null) {
if (handle > 0 && val <= bounds[handle - 1]) {
return bounds[handle - 1];
}
if (handle < bounds.length - 1 && val >= bounds[handle + 1]) {
return bounds[handle + 1];
}
}
/* eslint-enable eqeqeq */
return val;
};
Range.prototype.render = function render() {
var _this3 = this;
var _state2 = this.state,
handle = _state2.handle,
bounds = _state2.bounds;
var _props2 = this.props,
prefixCls = _props2.prefixCls,
vertical = _props2.vertical,
included = _props2.included,
disabled = _props2.disabled,
handleGenerator = _props2.handle;
var offsets = bounds.map(function (v) {
return _this3.calcOffset(v);
});
var handleClassName = prefixCls + '-handle';
var handles = bounds.map(function (v, i) {
var _classNames;
return handleGenerator({
className: (0, _classnames2["default"])((_classNames = {}, (0, _defineProperty3["default"])(_classNames, handleClassName, true), (0, _defineProperty3["default"])(_classNames, handleClassName + '-' + (i + 1), true), _classNames)),
vertical: vertical,
offset: offsets[i],
value: v,
dragging: handle === i,
index: i,
disabled: disabled,
ref: function ref(h) {
return _this3.saveHandle(i, h);
}
});
});
var tracks = bounds.slice(0, -1).map(function (_, index) {
var _classNames2;
var i = index + 1;
var trackClassName = (0, _classnames2["default"])((_classNames2 = {}, (0, _defineProperty3["default"])(_classNames2, prefixCls + '-track', true), (0, _defineProperty3["default"])(_classNames2, prefixCls + '-track-' + i, true), _classNames2));
return _react2["default"].createElement(_Track2["default"], {
className: trackClassName,
vertical: vertical,
included: included,
offset: offsets[i - 1],
length: offsets[i] - offsets[i - 1],
key: i
});
});
return { tracks: tracks, handles: handles };
};
return Range;
}(_react2["default"].Component);
Range.displayName = 'Range';
Range.propTypes = {
defaultValue: _propTypes2["default"].arrayOf(_propTypes2["default"].number),
value: _propTypes2["default"].arrayOf(_propTypes2["default"].number),
count: _propTypes2["default"].number,
pushable: _propTypes2["default"].oneOfType([_propTypes2["default"].bool, _propTypes2["default"].number]),
allowCross: _propTypes2["default"].bool,
disabled: _propTypes2["default"].bool
};
Range.defaultProps = {
count: 1,
allowCross: true,
pushable: false
};
exports["default"] = (0, _createSlider2["default"])(Range);
module.exports = exports['default'];
/***/ },
/* 397 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = __webpack_require__(7);
var _extends3 = _interopRequireDefault(_extends2);
var _classCallCheck2 = __webpack_require__(2);
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _possibleConstructorReturn2 = __webpack_require__(4);
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = __webpack_require__(3);
var _inherits3 = _interopRequireDefault(_inherits2);
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__(9);
var _propTypes2 = _interopRequireDefault(_propTypes);
var _Track = __webpack_require__(117);
var _Track2 = _interopRequireDefault(_Track);
var _createSlider = __webpack_require__(118);
var _createSlider2 = _interopRequireDefault(_createSlider);
var _utils = __webpack_require__(73);
var utils = _interopRequireWildcard(_utils);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj["default"] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var Slider = function (_React$Component) {
(0, _inherits3["default"])(Slider, _React$Component);
function Slider(props) {
(0, _classCallCheck3["default"])(this, Slider);
var _this = (0, _possibleConstructorReturn3["default"])(this, _React$Component.call(this, props));
_this.onEnd = function () {
_this.setState({ dragging: false });
_this.removeDocumentEvents();
_this.props.onAfterChange(_this.getValue());
};
var defaultValue = props.defaultValue !== undefined ? props.defaultValue : props.min;
var value = props.value !== undefined ? props.value : defaultValue;
_this.state = {
value: _this.trimAlignValue(value),
dragging: false
};
return _this;
}
Slider.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
if (!('value' in nextProps || 'min' in nextProps || 'max' in nextProps)) return;
var prevValue = this.state.value;
var value = nextProps.value !== undefined ? nextProps.value : prevValue;
var nextValue = this.trimAlignValue(value, nextProps);
if (nextValue === prevValue) return;
this.setState({ value: nextValue });
if (utils.isValueOutOfRange(value, nextProps)) {
this.props.onChange(nextValue);
}
};
Slider.prototype.onChange = function onChange(state) {
var props = this.props;
var isNotControlled = !('value' in props);
if (isNotControlled) {
this.setState(state);
}
var changedValue = state.value;
props.onChange(changedValue);
};
Slider.prototype.onStart = function onStart(position) {
this.setState({ dragging: true });
var props = this.props;
var prevValue = this.getValue();
props.onBeforeChange(prevValue);
var value = this.calcValueByPos(position);
this.startValue = value;
this.startPosition = position;
if (value === prevValue) return;
this.onChange({ value: value });
};
Slider.prototype.onMove = function onMove(e, position) {
utils.pauseEvent(e);
var state = this.state;
var value = this.calcValueByPos(position);
var oldValue = state.value;
if (value === oldValue) return;
this.onChange({ value: value });
};
Slider.prototype.getValue = function getValue() {
return this.state.value;
};
Slider.prototype.getLowerBound = function getLowerBound() {
return this.props.min;
};
Slider.prototype.getUpperBound = function getUpperBound() {
return this.state.value;
};
Slider.prototype.trimAlignValue = function trimAlignValue(v) {
var nextProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var mergedProps = (0, _extends3["default"])({}, this.props, nextProps);
var val = utils.ensureValueInRange(v, mergedProps);
return utils.ensureValuePrecision(val, mergedProps);
};
Slider.prototype.render = function render() {
var _this2 = this;
var _props = this.props,
prefixCls = _props.prefixCls,
vertical = _props.vertical,
included = _props.included,
disabled = _props.disabled,
minimumTrackStyle = _props.minimumTrackStyle,
handleStyle = _props.handleStyle,
handleGenerator = _props.handle;
var _state = this.state,
value = _state.value,
dragging = _state.dragging;
var offset = this.calcOffset(value);
var handle = handleGenerator({
className: prefixCls + '-handle',
vertical: vertical,
offset: offset,
value: value,
dragging: dragging,
disabled: disabled,
handleStyle: handleStyle,
ref: function ref(h) {
return _this2.saveHandle(0, h);
}
});
var track = _react2["default"].createElement(_Track2["default"], {
className: prefixCls + '-track',
vertical: vertical,
included: included,
offset: 0,
length: offset,
minimumTrackStyle: minimumTrackStyle
});
return { tracks: track, handles: handle };
};
return Slider;
}(_react2["default"].Component); /* eslint-disable react/prop-types */
Slider.displayName = 'Slider';
Slider.propTypes = {
defaultValue: _propTypes2["default"].number,
value: _propTypes2["default"].number,
disabled: _propTypes2["default"].bool
};
Slider.defaultProps = {};
exports["default"] = (0, _createSlider2["default"])(Slider);
module.exports = exports['default'];
/***/ },
/* 398 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = __webpack_require__(7);
var _extends3 = _interopRequireDefault(_extends2);
var _typeof2 = __webpack_require__(33);
var _typeof3 = _interopRequireDefault(_typeof2);
var _defineProperty2 = __webpack_require__(6);
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var Marks = function Marks(_ref) {
var className = _ref.className,
vertical = _ref.vertical,
marks = _ref.marks,
included = _ref.included,
upperBound = _ref.upperBound,
lowerBound = _ref.lowerBound,
max = _ref.max,
min = _ref.min;
var marksKeys = Object.keys(marks);
var marksCount = marksKeys.length;
var unit = 100 / (marksCount - 1);
var markWidth = unit * 0.9;
var range = max - min;
var elements = marksKeys.map(parseFloat).sort(function (a, b) {
return a - b;
}).map(function (point) {
var _classNames;
var isActive = !included && point === upperBound || included && point <= upperBound && point >= lowerBound;
var markClassName = (0, _classnames2["default"])((_classNames = {}, (0, _defineProperty3["default"])(_classNames, className + '-text', true), (0, _defineProperty3["default"])(_classNames, className + '-text-active', isActive), _classNames));
var bottomStyle = {
marginBottom: '-50%',
bottom: (point - min) / range * 100 + '%'
};
var leftStyle = {
width: markWidth + '%',
marginLeft: -markWidth / 2 + '%',
left: (point - min) / range * 100 + '%'
};
var style = vertical ? bottomStyle : leftStyle;
var markPoint = marks[point];
var markPointIsObject = (typeof markPoint === 'undefined' ? 'undefined' : (0, _typeof3["default"])(markPoint)) === 'object' && !_react2["default"].isValidElement(markPoint);
var markLabel = markPointIsObject ? markPoint.label : markPoint;
var markStyle = markPointIsObject ? (0, _extends3["default"])({}, style, markPoint.style) : style;
return _react2["default"].createElement(
'span',
{
className: markClassName,
style: markStyle,
key: point
},
markLabel
);
});
return _react2["default"].createElement(
'div',
{ className: className },
elements
);
};
exports["default"] = Marks;
module.exports = exports['default'];
/***/ },
/* 399 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _defineProperty2 = __webpack_require__(6);
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var _warning = __webpack_require__(119);
var _warning2 = _interopRequireDefault(_warning);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var calcPoints = function calcPoints(vertical, marks, dots, step, min, max) {
(0, _warning2["default"])(dots ? step > 0 : true, '`Slider[step]` should be a positive number in order to make Slider[dots] work.');
var points = Object.keys(marks).map(parseFloat);
if (dots) {
for (var i = min; i <= max; i = i + step) {
if (points.indexOf(i) >= 0) continue;
points.push(i);
}
}
return points;
};
var Steps = function Steps(_ref) {
var prefixCls = _ref.prefixCls,
vertical = _ref.vertical,
marks = _ref.marks,
dots = _ref.dots,
step = _ref.step,
included = _ref.included,
lowerBound = _ref.lowerBound,
upperBound = _ref.upperBound,
max = _ref.max,
min = _ref.min;
var range = max - min;
var elements = calcPoints(vertical, marks, dots, step, min, max).map(function (point) {
var _classNames;
var offset = Math.abs(point - min) / range * 100 + '%';
var style = vertical ? { bottom: offset } : { left: offset };
var isActived = !included && point === upperBound || included && point <= upperBound && point >= lowerBound;
var pointClassName = (0, _classnames2["default"])((_classNames = {}, (0, _defineProperty3["default"])(_classNames, prefixCls + '-dot', true), (0, _defineProperty3["default"])(_classNames, prefixCls + '-dot-active', isActived), _classNames));
return _react2["default"].createElement('span', { className: pointClassName, style: style, key: point });
});
return _react2["default"].createElement(
'div',
{ className: prefixCls + '-step' },
elements
);
};
exports["default"] = Steps;
module.exports = exports['default'];
/***/ },
/* 400 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _objectWithoutProperties2 = __webpack_require__(18);
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
var _defineProperty2 = __webpack_require__(6);
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _extends3 = __webpack_require__(7);
var _extends4 = _interopRequireDefault(_extends3);
var _classCallCheck2 = __webpack_require__(2);
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _possibleConstructorReturn2 = __webpack_require__(4);
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = __webpack_require__(3);
var _inherits3 = _interopRequireDefault(_inherits2);
exports["default"] = createSliderWithTooltip;
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__(9);
var _propTypes2 = _interopRequireDefault(_propTypes);
var _rcTooltip = __webpack_require__(123);
var _rcTooltip2 = _interopRequireDefault(_rcTooltip);
var _Handle = __webpack_require__(116);
var _Handle2 = _interopRequireDefault(_Handle);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function createSliderWithTooltip(Component) {
var _class, _temp;
return _temp = _class = function (_React$Component) {
(0, _inherits3["default"])(ComponentWrapper, _React$Component);
function ComponentWrapper(props) {
(0, _classCallCheck3["default"])(this, ComponentWrapper);
var _this = (0, _possibleConstructorReturn3["default"])(this, _React$Component.call(this, props));
_this.handleTooltipVisibleChange = function (index, visible) {
_this.setState({
visibles: (0, _extends4["default"])({}, _this.state.visibles, (0, _defineProperty3["default"])({}, index, visible))
});
};
_this.handleWithTooltip = function (_ref) {
var value = _ref.value,
dragging = _ref.dragging,
index = _ref.index,
disabled = _ref.disabled,
restProps = (0, _objectWithoutProperties3["default"])(_ref, ['value', 'dragging', 'index', 'disabled']);
var tipFormatter = _this.props.tipFormatter;
return _react2["default"].createElement(
_rcTooltip2["default"],
{
prefixCls: 'rc-slider-tooltip',
overlay: tipFormatter(value),
visible: !disabled && (_this.state.visibles[index] || dragging),
placement: 'top',
key: index
},
_react2["default"].createElement(_Handle2["default"], (0, _extends4["default"])({}, restProps, {
onMouseEnter: function onMouseEnter() {
return _this.handleTooltipVisibleChange(index, true);
},
onMouseLeave: function onMouseLeave() {
return _this.handleTooltipVisibleChange(index, false);
}
}))
);
};
_this.state = { visibles: {} };
return _this;
}
ComponentWrapper.prototype.render = function render() {
return _react2["default"].createElement(Component, (0, _extends4["default"])({}, this.props, { handle: this.handleWithTooltip }));
};
return ComponentWrapper;
}(_react2["default"].Component), _class.propTypes = {
tipFormatter: _propTypes2["default"].func
}, _class.defaultProps = {
tipFormatter: function tipFormatter(value) {
return value;
}
}, _temp;
}
module.exports = exports['default'];
/***/ },
/* 401 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__(9);
var _propTypes2 = _interopRequireDefault(_propTypes);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return 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; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
function isString(str) {
return typeof str === 'string';
}
var Step = function (_React$Component) {
_inherits(Step, _React$Component);
function Step() {
_classCallCheck(this, Step);
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
}
Step.prototype.render = function render() {
var _classNames, _classNames2;
var _props = this.props;
var className = _props.className;
var prefixCls = _props.prefixCls;
var style = _props.style;
var itemWidth = _props.itemWidth;
var _props$status = _props.status;
var status = _props$status === undefined ? 'wait' : _props$status;
var iconPrefix = _props.iconPrefix;
var icon = _props.icon;
var wrapperStyle = _props.wrapperStyle;
var adjustMarginRight = _props.adjustMarginRight;
var stepNumber = _props.stepNumber;
var description = _props.description;
var title = _props.title;
var progressDot = _props.progressDot;
var restProps = _objectWithoutProperties(_props, ['className', 'prefixCls', 'style', 'itemWidth', 'status', 'iconPrefix', 'icon', 'wrapperStyle', 'adjustMarginRight', 'stepNumber', 'description', 'title', 'progressDot']);
var iconClassName = (0, _classnames2["default"])((_classNames = {}, _defineProperty(_classNames, prefixCls + '-icon', true), _defineProperty(_classNames, iconPrefix + 'icon', true), _defineProperty(_classNames, iconPrefix + 'icon-' + icon, icon && isString(icon)), _defineProperty(_classNames, iconPrefix + 'icon-check', !icon && status === 'finish'), _defineProperty(_classNames, iconPrefix + 'icon-cross', !icon && status === 'error'), _classNames));
var iconNode = void 0;
var iconDot = _react2["default"].createElement('span', { className: prefixCls + '-icon-dot' });
// `progressDot` enjoy the highest priority
if (!!progressDot) {
if (typeof progressDot === 'function') {
iconNode = _react2["default"].createElement(
'span',
{ className: prefixCls + '-icon' },
progressDot(iconDot, { index: stepNumber - 1, status: status, title: title, description: description })
);
} else {
iconNode = _react2["default"].createElement(
'span',
{ className: prefixCls + '-icon' },
iconDot
);
}
} else if (icon && !isString(icon)) {
iconNode = _react2["default"].createElement(
'span',
{ className: prefixCls + '-icon' },
icon
);
} else if (icon || status === 'finish' || status === 'error') {
iconNode = _react2["default"].createElement('span', { className: iconClassName });
} else {
iconNode = _react2["default"].createElement(
'span',
{ className: prefixCls + '-icon' },
stepNumber
);
}
var classString = (0, _classnames2["default"])((_classNames2 = {}, _defineProperty(_classNames2, prefixCls + '-item', true), _defineProperty(_classNames2, prefixCls + '-status-' + status, true), _defineProperty(_classNames2, prefixCls + '-custom', icon), _defineProperty(_classNames2, className, !!className), _classNames2));
return _react2["default"].createElement(
'div',
_extends({}, restProps, {
className: classString,
style: _extends({ width: itemWidth, marginRight: adjustMarginRight }, style)
}),
_react2["default"].createElement(
'div',
{
ref: 'tail',
className: prefixCls + '-tail',
style: { paddingRight: -adjustMarginRight }
},
_react2["default"].createElement('i', null)
),
_react2["default"].createElement(
'div',
{ className: prefixCls + '-step' },
_react2["default"].createElement(
'div',
{
className: prefixCls + '-head',
style: { background: wrapperStyle.background || wrapperStyle.backgroundColor }
},
_react2["default"].createElement(
'div',
{ className: prefixCls + '-head-inner' },
iconNode
)
),
_react2["default"].createElement(
'div',
{ ref: 'main', className: prefixCls + '-main' },
_react2["default"].createElement(
'div',
{
className: prefixCls + '-title',
style: { background: wrapperStyle.background || wrapperStyle.backgroundColor }
},
title
),
description ? _react2["default"].createElement(
'div',
{ className: prefixCls + '-description' },
description
) : ''
)
)
);
};
return Step;
}(_react2["default"].Component);
exports["default"] = Step;
Step.propTypes = {
className: _propTypes2["default"].string,
prefixCls: _propTypes2["default"].string,
style: _propTypes2["default"].object,
wrapperStyle: _propTypes2["default"].object,
itemWidth: _propTypes2["default"].oneOfType([_propTypes2["default"].number, _propTypes2["default"].string]),
status: _propTypes2["default"].string,
iconPrefix: _propTypes2["default"].string,
icon: _propTypes2["default"].node,
adjustMarginRight: _propTypes2["default"].oneOfType([_propTypes2["default"].number, _propTypes2["default"].string]),
stepNumber: _propTypes2["default"].string,
description: _propTypes2["default"].any,
title: _propTypes2["default"].any,
progressDot: _propTypes2["default"].oneOfType([_propTypes2["default"].bool, _propTypes2["default"].func])
};
module.exports = exports['default'];
/***/ },
/* 402 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__(9);
var _propTypes2 = _interopRequireDefault(_propTypes);
var _reactDom = __webpack_require__(10);
var _reactDom2 = _interopRequireDefault(_reactDom);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var _lodash = __webpack_require__(361);
var _lodash2 = _interopRequireDefault(_lodash);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return 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; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var Steps = function (_React$Component) {
_inherits(Steps, _React$Component);
function Steps(props) {
_classCallCheck(this, Steps);
var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
_this.calcStepOffsetWidth = function () {
var domNode = _reactDom2["default"].findDOMNode(_this);
if (domNode.children.length > 0) {
if (_this.calcTimeout) {
clearTimeout(_this.calcTimeout);
}
_this.calcTimeout = setTimeout(function () {
// +1 for fit edge bug of digit width, like 35.4px
var lastStepOffsetWidth = (domNode.lastChild.offsetWidth || 0) + 1;
// Reduce shake bug
if (_this.state.lastStepOffsetWidth === lastStepOffsetWidth || Math.abs(_this.state.lastStepOffsetWidth - lastStepOffsetWidth) <= 3) {
return;
}
_this.setState({ lastStepOffsetWidth: lastStepOffsetWidth });
});
}
};
_this.state = {
lastStepOffsetWidth: 0
};
_this.calcStepOffsetWidth = (0, _lodash2["default"])(_this.calcStepOffsetWidth, 150);
return _this;
}
Steps.prototype.componentDidMount = function componentDidMount() {
this.calcStepOffsetWidth();
};
Steps.prototype.componentDidUpdate = function componentDidUpdate() {
this.calcStepOffsetWidth();
};
Steps.prototype.componentWillUnmount = function componentWillUnmount() {
if (this.calcTimeout) {
clearTimeout(this.calcTimeout);
}
if (this.calcStepOffsetWidth.cancel) {
this.calcStepOffsetWidth.cancel();
}
};
Steps.prototype.render = function render() {
var _classNames,
_this2 = this;
var props = this.props;
var prefixCls = props.prefixCls;
var _props$style = props.style;
var style = _props$style === undefined ? {} : _props$style;
var className = props.className;
var children = props.children;
var direction = props.direction;
var labelPlacement = props.labelPlacement;
var iconPrefix = props.iconPrefix;
var status = props.status;
var size = props.size;
var current = props.current;
var progressDot = props.progressDot;
var restProps = _objectWithoutProperties(props, ['prefixCls', 'style', 'className', 'children', 'direction', 'labelPlacement', 'iconPrefix', 'status', 'size', 'current', 'progressDot']);
var lastIndex = children.length - 1;
var reLayouted = this.state.lastStepOffsetWidth > 0;
var adjustedlabelPlacement = !!progressDot ? 'vertical' : labelPlacement;
var classString = (0, _classnames2["default"])((_classNames = {}, _defineProperty(_classNames, prefixCls, true), _defineProperty(_classNames, prefixCls + '-' + size, size), _defineProperty(_classNames, prefixCls + '-' + direction, true), _defineProperty(_classNames, prefixCls + '-label-' + adjustedlabelPlacement, direction === 'horizontal'), _defineProperty(_classNames, prefixCls + '-hidden', !reLayouted), _defineProperty(_classNames, prefixCls + '-dot', !!progressDot), _defineProperty(_classNames, className, className), _classNames));
return _react2["default"].createElement(
'div',
_extends({ className: classString, style: style }, restProps),
_react2["default"].Children.map(children, function (ele, idx) {
var itemWidth = direction === 'vertical' || idx === lastIndex || !reLayouted ? null : 100 / lastIndex + '%';
var adjustMarginRight = direction === 'vertical' || idx === lastIndex ? null : -Math.round(_this2.state.lastStepOffsetWidth / lastIndex + 1);
var np = {
stepNumber: (idx + 1).toString(),
itemWidth: itemWidth,
adjustMarginRight: adjustMarginRight,
prefixCls: prefixCls,
iconPrefix: iconPrefix,
wrapperStyle: style,
progressDot: progressDot
};
// fix tail color
if (status === 'error' && idx === current - 1) {
np.className = props.prefixCls + '-next-error';
}
if (!ele.props.status) {
if (idx === current) {
np.status = status;
} else if (idx < current) {
np.status = 'finish';
} else {
np.status = 'wait';
}
}
return _react2["default"].cloneElement(ele, np);
}, this)
);
};
return Steps;
}(_react2["default"].Component);
exports["default"] = Steps;
Steps.propTypes = {
prefixCls: _propTypes2["default"].string,
iconPrefix: _propTypes2["default"].string,
direction: _propTypes2["default"].string,
labelPlacement: _propTypes2["default"].string,
children: _propTypes2["default"].any,
status: _propTypes2["default"].string,
size: _propTypes2["default"].string,
progressDot: _propTypes2["default"].oneOfType([_propTypes2["default"].bool, _propTypes2["default"].func])
};
Steps.defaultProps = {
prefixCls: 'rc-steps',
iconPrefix: 'rc',
direction: 'horizontal',
labelPlacement: 'horizontal',
current: 0,
status: 'process',
size: '',
progressDot: false
};
module.exports = exports['default'];
/***/ },
/* 403 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _Steps = __webpack_require__(402);
var _Steps2 = _interopRequireDefault(_Steps);
var _Step = __webpack_require__(401);
var _Step2 = _interopRequireDefault(_Step);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
_Steps2["default"].Step = _Step2["default"];
exports["default"] = _Steps2["default"];
module.exports = exports['default'];
/***/ },
/* 404 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = __webpack_require__(7);
var _extends3 = _interopRequireDefault(_extends2);
var _slicedToArray2 = __webpack_require__(251);
var _slicedToArray3 = _interopRequireDefault(_slicedToArray2);
var _classCallCheck2 = __webpack_require__(2);
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _possibleConstructorReturn2 = __webpack_require__(4);
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = __webpack_require__(3);
var _inherits3 = _interopRequireDefault(_inherits2);
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _reactHammerjs = __webpack_require__(76);
var _reactHammerjs2 = _interopRequireDefault(_reactHammerjs);
var _object = __webpack_require__(370);
var _object2 = _interopRequireDefault(_object);
var _splitObject3 = __webpack_require__(406);
var _splitObject4 = _interopRequireDefault(_splitObject3);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var Swipeout = function (_React$Component) {
(0, _inherits3["default"])(Swipeout, _React$Component);
function Swipeout(props) {
(0, _classCallCheck3["default"])(this, Swipeout);
var _this = (0, _possibleConstructorReturn3["default"])(this, _React$Component.call(this, props));
_this.onPanStart = _this.onPanStart.bind(_this);
_this.onPan = _this.onPan.bind(_this);
_this.onPanEnd = _this.onPanEnd.bind(_this);
_this.openedLeft = false;
_this.openedRight = false;
return _this;
}
Swipeout.prototype.componentDidMount = function componentDidMount() {
var _props = this.props,
left = _props.left,
right = _props.right;
var width = this.refs.content.offsetWidth;
if (this.refs.cover) {
this.refs.cover.style.width = width + 'px';
}
this.contentWidth = width;
this.btnsLeftWidth = width / 5 * left.length;
this.btnsRightWidth = width / 5 * right.length;
document.body.addEventListener('touchstart', this.onCloseSwipe.bind(this), true);
};
Swipeout.prototype.componentWillUnmount = function componentWillUnmount() {
document.body.removeEventListener('touchstart', this.onCloseSwipe.bind(this));
};
Swipeout.prototype.onCloseSwipe = function onCloseSwipe(ev) {
var _this2 = this;
if (this.openedLeft || this.openedRight) {
var pNode = function (node) {
while (node.parentNode && node.parentNode !== document.body) {
if (node.className.indexOf(_this2.props.prefixCls + '-actions') > -1) {
return node;
}
node = node.parentNode;
}
}(ev.target);
if (!pNode) {
ev.preventDefault();
this.close();
}
}
};
Swipeout.prototype.onPanStart = function onPanStart(e) {
if (this.props.disabled) {
return;
}
this.panStartX = e.deltaX;
};
Swipeout.prototype.onPan = function onPan(e) {
if (this.props.disabled) {
return;
}
var _props2 = this.props,
left = _props2.left,
right = _props2.right;
var posX = e.deltaX - this.panStartX;
if (posX < 0 && right.length) {
this._setStyle(Math.min(posX, 0));
} else if (posX > 0 && left.length) {
this._setStyle(Math.max(posX, 0));
}
};
Swipeout.prototype.onPanEnd = function onPanEnd(e) {
if (this.props.disabled) {
return;
}
var _props3 = this.props,
left = _props3.left,
right = _props3.right;
var posX = e.deltaX - this.panStartX;
var contentWidth = this.contentWidth;
var btnsLeftWidth = this.btnsLeftWidth;
var btnsRightWidth = this.btnsRightWidth;
var openX = contentWidth * 0.33;
var openLeft = posX > openX || posX > btnsLeftWidth / 2;
var openRight = posX < -openX || posX < -btnsRightWidth / 2;
if (openRight && posX < 0 && right.length) {
this.open(-btnsRightWidth, false, true);
} else if (openLeft && posX > 0 && left.length) {
this.open(btnsLeftWidth, true, false);
} else {
this.close();
}
};
// left & right button click
Swipeout.prototype.onBtnClick = function onBtnClick(ev, btn) {
var onPress = btn.onPress;
if (onPress) {
onPress(ev);
}
if (this.props.autoClose) {
this.close();
}
};
Swipeout.prototype._getContentEasing = function _getContentEasing(value, limit) {
// limit content style left when value > actions width
if (value < 0 && value < limit) {
return limit - Math.pow(limit - value, 0.85);
} else if (value > 0 && value > limit) {
return limit + Math.pow(value - limit, 0.85);
}
return value;
};
// set content & actions style
Swipeout.prototype._setStyle = function _setStyle(value) {
var _props4 = this.props,
left = _props4.left,
right = _props4.right;
var limit = value > 0 ? this.btnsLeftWidth : -this.btnsRightWidth;
var contentLeft = this._getContentEasing(value, limit);
this.refs.content.style.left = contentLeft + 'px';
this.refs.cover.style.display = Math.abs(value) > 0 ? 'block' : 'none';
this.refs.cover.style.left = contentLeft + 'px';
if (left.length) {
var leftWidth = Math.max(Math.min(value, Math.abs(limit)), 0);
this.refs.left.style.width = leftWidth + 'px';
}
if (right.length) {
var rightWidth = Math.max(Math.min(-value, Math.abs(limit)), 0);
this.refs.right.style.width = rightWidth + 'px';
}
};
Swipeout.prototype.open = function open(value, openedLeft, openedRight) {
if (!this.openedLeft && !this.openedRight) {
this.props.onOpen();
}
this.openedLeft = openedLeft;
this.openedRight = openedRight;
this._setStyle(value);
};
Swipeout.prototype.close = function close() {
if (this.openedLeft || this.openedRight) {
this.props.onClose();
}
this._setStyle(0);
this.openedLeft = false;
this.openedRight = false;
};
Swipeout.prototype.renderButtons = function renderButtons(buttons, ref) {
var _this3 = this;
var prefixCls = this.props.prefixCls;
return buttons && buttons.length ? _react2["default"].createElement(
'div',
{ className: prefixCls + '-actions ' + prefixCls + '-actions-' + ref, ref: ref },
buttons.map(function (btn, i) {
return _react2["default"].createElement(
'div',
{ key: i,
className: prefixCls + '-btn ' + (btn.hasOwnProperty('className') ? btn.className : ''),
style: btn.style,
onClick: function onClick(e) {
return _this3.onBtnClick(e, btn);
}
},
_react2["default"].createElement(
'div',
{ className: prefixCls + '-text' },
btn.text || 'Click'
)
);
})
) : null;
};
Swipeout.prototype.render = function render() {
var _splitObject = (0, _splitObject4["default"])(this.props, ['prefixCls', 'left', 'right', 'children']),
_splitObject2 = (0, _slicedToArray3["default"])(_splitObject, 2),
_splitObject2$ = _splitObject2[0],
prefixCls = _splitObject2$.prefixCls,
left = _splitObject2$.left,
right = _splitObject2$.right,
children = _splitObject2$.children,
restProps = _splitObject2[1];
var divProps = (0, _object2["default"])(restProps, ['disabled', 'autoClose', 'onOpen', 'onClose']);
return left.length || right.length ? _react2["default"].createElement(
'div',
(0, _extends3["default"])({ className: '' + prefixCls }, divProps),
_react2["default"].createElement('div', { className: prefixCls + '-cover', ref: 'cover' }),
this.renderButtons(left, 'left'),
this.renderButtons(right, 'right'),
_react2["default"].createElement(
_reactHammerjs2["default"],
{
direction: 'DIRECTION_HORIZONTAL',
onPanStart: this.onPanStart,
onPan: this.onPan,
onPanEnd: this.onPanEnd
},
_react2["default"].createElement(
'div',
{ className: prefixCls + '-content', ref: 'content' },
children
)
)
) : _react2["default"].createElement(
'div',
(0, _extends3["default"])({ ref: 'content' }, divProps),
children
);
};
return Swipeout;
}(_react2["default"].Component);
Swipeout.propTypes = {
prefixCls: _react.PropTypes.string,
autoClose: _react.PropTypes.bool,
disabled: _react.PropTypes.bool,
left: _react.PropTypes.arrayOf(_react.PropTypes.object),
right: _react.PropTypes.arrayOf(_react.PropTypes.object),
onOpen: _react.PropTypes.func,
onClose: _react.PropTypes.func,
children: _react.PropTypes.any
};
Swipeout.defaultProps = {
prefixCls: 'rc-swipeout',
autoClose: false,
disabled: false,
left: [],
right: [],
onOpen: function onOpen() {},
onClose: function onClose() {}
};
exports["default"] = Swipeout;
module.exports = exports['default'];
/***/ },
/* 405 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _Swipeout = __webpack_require__(404);
Object.defineProperty(exports, 'default', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Swipeout)["default"];
}
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
module.exports = exports['default'];
/***/ },
/* 406 */
/***/ function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = splitObject;
function splitObject(obj, parts) {
var left = {};
var right = {};
Object.keys(obj).forEach(function (k) {
if (parts.indexOf(k) !== -1) {
left[k] = obj[k];
} else {
right[k] = obj[k];
}
});
return [left, right];
}
module.exports = exports['default'];
/***/ },
/* 407 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__(1);
var _propTypes = __webpack_require__(9);
var _propTypes2 = _interopRequireDefault(_propTypes);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var Column = function (_Component) {
_inherits(Column, _Component);
function Column() {
_classCallCheck(this, Column);
return _possibleConstructorReturn(this, _Component.apply(this, arguments));
}
return Column;
}(_react.Component);
Column.propTypes = {
className: _propTypes2["default"].string,
colSpan: _propTypes2["default"].number,
title: _propTypes2["default"].node,
dataIndex: _propTypes2["default"].string,
width: _propTypes2["default"].oneOfType([_propTypes2["default"].number, _propTypes2["default"].string]),
fixed: _propTypes2["default"].oneOf([true, 'left', 'right']),
render: _propTypes2["default"].func,
onCellClick: _propTypes2["default"].func
};
exports["default"] = Column;
module.exports = exports['default'];
/***/ },
/* 408 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__(1);
var _propTypes = __webpack_require__(9);
var _propTypes2 = _interopRequireDefault(_propTypes);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var ColumnGroup = function (_Component) {
_inherits(ColumnGroup, _Component);
function ColumnGroup() {
_classCallCheck(this, ColumnGroup);
return _possibleConstructorReturn(this, _Component.apply(this, arguments));
}
return ColumnGroup;
}(_react.Component);
ColumnGroup.propTypes = {
title: _propTypes2["default"].node
};
ColumnGroup.isTableColumnGroup = true;
exports["default"] = ColumnGroup;
module.exports = exports['default'];
/***/ },
/* 409 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var ColumnManager = function () {
function ColumnManager(columns, elements) {
_classCallCheck(this, ColumnManager);
this._cached = {};
this.columns = columns || this.normalize(elements);
}
ColumnManager.prototype.isAnyColumnsFixed = function isAnyColumnsFixed() {
var _this = this;
return this._cache('isAnyColumnsFixed', function () {
return _this.columns.some(function (column) {
return !!column.fixed;
});
});
};
ColumnManager.prototype.isAnyColumnsLeftFixed = function isAnyColumnsLeftFixed() {
var _this2 = this;
return this._cache('isAnyColumnsLeftFixed', function () {
return _this2.columns.some(function (column) {
return column.fixed === 'left' || column.fixed === true;
});
});
};
ColumnManager.prototype.isAnyColumnsRightFixed = function isAnyColumnsRightFixed() {
var _this3 = this;
return this._cache('isAnyColumnsRightFixed', function () {
return _this3.columns.some(function (column) {
return column.fixed === 'right';
});
});
};
ColumnManager.prototype.leftColumns = function leftColumns() {
var _this4 = this;
return this._cache('leftColumns', function () {
return _this4.groupedColumns().filter(function (column) {
return column.fixed === 'left' || column.fixed === true;
});
});
};
ColumnManager.prototype.rightColumns = function rightColumns() {
var _this5 = this;
return this._cache('rightColumns', function () {
return _this5.groupedColumns().filter(function (column) {
return column.fixed === 'right';
});
});
};
ColumnManager.prototype.leafColumns = function leafColumns() {
var _this6 = this;
return this._cache('leafColumns', function () {
return _this6._leafColumns(_this6.columns);
});
};
ColumnManager.prototype.leftLeafColumns = function leftLeafColumns() {
var _this7 = this;
return this._cache('leftLeafColumns', function () {
return _this7._leafColumns(_this7.leftColumns());
});
};
ColumnManager.prototype.rightLeafColumns = function rightLeafColumns() {
var _this8 = this;
return this._cache('rightLeafColumns', function () {
return _this8._leafColumns(_this8.rightColumns());
});
};
// add appropriate rowspan and colspan to column
ColumnManager.prototype.groupedColumns = function groupedColumns() {
var _this9 = this;
return this._cache('groupedColumns', function () {
var _groupColumns = function _groupColumns(columns) {
var currentRow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var parentColumn = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var rows = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
// track how many rows we got
rows[currentRow] = rows[currentRow] || [];
var grouped = [];
var setRowSpan = function setRowSpan(column) {
var rowSpan = rows.length - currentRow;
if (column && !column.children && // parent columns are supposed to be one row
rowSpan > 1 && (!column.rowSpan || column.rowSpan < rowSpan)) {
column.rowSpan = rowSpan;
}
};
columns.forEach(function (column, index) {
var newColumn = _extends({}, column);
rows[currentRow].push(newColumn);
parentColumn.colSpan = parentColumn.colSpan || 0;
if (newColumn.children && newColumn.children.length > 0) {
newColumn.children = _groupColumns(newColumn.children, currentRow + 1, newColumn, rows);
parentColumn.colSpan = parentColumn.colSpan + newColumn.colSpan;
} else {
parentColumn.colSpan++;
}
// update rowspan to all same row columns
for (var i = 0; i < rows[currentRow].length - 1; ++i) {
setRowSpan(rows[currentRow][i]);
}
// last column, update rowspan immediately
if (index + 1 === columns.length) {
setRowSpan(newColumn);
}
grouped.push(newColumn);
});
return grouped;
};
return _groupColumns(_this9.columns);
});
};
ColumnManager.prototype.normalize = function normalize(elements) {
var _this10 = this;
var columns = [];
_react2["default"].Children.forEach(elements, function (element) {
if (!_react2["default"].isValidElement(element)) {
return;
}
var column = _extends({}, element.props);
if (element.key) {
column.key = element.key;
}
if (element.type.isTableColumnGroup) {
column.children = _this10.normalize(column.children);
}
columns.push(column);
});
return columns;
};
ColumnManager.prototype.reset = function reset(columns, elements) {
this.columns = columns || this.normalize(elements);
this._cached = {};
};
ColumnManager.prototype._cache = function _cache(name, fn) {
if (name in this._cached) {
return this._cached[name];
}
this._cached[name] = fn();
return this._cached[name];
};
ColumnManager.prototype._leafColumns = function _leafColumns(columns) {
var _this11 = this;
var leafColumns = [];
columns.forEach(function (column) {
if (!column.children) {
leafColumns.push(column);
} else {
leafColumns.push.apply(leafColumns, _toConsumableArray(_this11._leafColumns(column.children)));
}
});
return leafColumns;
};
return ColumnManager;
}();
exports["default"] = ColumnManager;
module.exports = exports['default'];
/***/ },
/* 410 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__(9);
var _propTypes2 = _interopRequireDefault(_propTypes);
var _shallowequal = __webpack_require__(52);
var _shallowequal2 = _interopRequireDefault(_shallowequal);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var ExpandIcon = function (_React$Component) {
_inherits(ExpandIcon, _React$Component);
function ExpandIcon() {
_classCallCheck(this, ExpandIcon);
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
}
ExpandIcon.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {
return !(0, _shallowequal2["default"])(nextProps, this.props);
};
ExpandIcon.prototype.render = function render() {
var _props = this.props,
expandable = _props.expandable,
prefixCls = _props.prefixCls,
onExpand = _props.onExpand,
needIndentSpaced = _props.needIndentSpaced,
expanded = _props.expanded,
record = _props.record;
if (expandable) {
var expandClassName = expanded ? 'expanded' : 'collapsed';
return _react2["default"].createElement('span', {
className: prefixCls + '-expand-icon ' + prefixCls + '-' + expandClassName,
onClick: function onClick(e) {
return onExpand(!expanded, record, e);
}
});
} else if (needIndentSpaced) {
return _react2["default"].createElement('span', { className: prefixCls + '-expand-icon ' + prefixCls + '-spaced' });
}
return null;
};
return ExpandIcon;
}(_react2["default"].Component);
ExpandIcon.propTypes = {
record: _propTypes2["default"].object,
prefixCls: _propTypes2["default"].string,
expandable: _propTypes2["default"].any,
expanded: _propTypes2["default"].bool,
needIndentSpaced: _propTypes2["default"].bool,
onExpand: _propTypes2["default"].func
};
exports["default"] = ExpandIcon;
module.exports = exports['default'];
/***/ },
/* 411 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__(9);
var _propTypes2 = _interopRequireDefault(_propTypes);
var _TableRow = __webpack_require__(414);
var _TableRow2 = _interopRequireDefault(_TableRow);
var _TableHeader = __webpack_require__(413);
var _TableHeader2 = _interopRequireDefault(_TableHeader);
var _utils = __webpack_require__(417);
var _shallowequal = __webpack_require__(52);
var _shallowequal2 = _interopRequireDefault(_shallowequal);
var _addEventListener = __webpack_require__(50);
var _addEventListener2 = _interopRequireDefault(_addEventListener);
var _ColumnManager = __webpack_require__(409);
var _ColumnManager2 = _interopRequireDefault(_ColumnManager);
var _createStore = __webpack_require__(415);
var _createStore2 = _interopRequireDefault(_createStore);
var _componentClasses = __webpack_require__(95);
var _componentClasses2 = _interopRequireDefault(_componentClasses);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var Table = function (_React$Component) {
_inherits(Table, _React$Component);
function Table(props) {
_classCallCheck(this, Table);
var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
_this.onExpanded = function (expanded, record, e, index) {
if (e) {
e.preventDefault();
e.stopPropagation();
}
var info = _this.findExpandedRow(record);
if (typeof info !== 'undefined' && !expanded) {
_this.onRowDestroy(record, index);
} else if (!info && expanded) {
var expandedRows = _this.getExpandedRows().concat();
expandedRows.push(_this.getRowKey(record, index));
_this.onExpandedRowsChange(expandedRows);
}
_this.props.onExpand(expanded, record);
};
_this.onRowDestroy = function (record, rowIndex) {
var expandedRows = _this.getExpandedRows().concat();
var rowKey = _this.getRowKey(record, rowIndex);
var index = -1;
expandedRows.forEach(function (r, i) {
if (r === rowKey) {
index = i;
}
});
if (index !== -1) {
expandedRows.splice(index, 1);
}
_this.onExpandedRowsChange(expandedRows);
};
_this.handleWindowResize = function () {
_this.syncFixedTableRowHeight();
_this.setScrollPositionClassName();
};
_this.syncFixedTableRowHeight = function () {
var tableRect = _this.tableNode.getBoundingClientRect();
// If tableNode's height less than 0, suppose it is hidden and don't recalculate rowHeight.
// see: https://github.com/ant-design/ant-design/issues/4836
if (tableRect.height !== undefined && tableRect.height <= 0) {
return;
}
var prefixCls = _this.props.prefixCls;
var headRows = _this.refs.headTable ? _this.refs.headTable.querySelectorAll('thead') : _this.refs.bodyTable.querySelectorAll('thead');
var bodyRows = _this.refs.bodyTable.querySelectorAll('.' + prefixCls + '-row') || [];
var fixedColumnsHeadRowsHeight = [].map.call(headRows, function (row) {
return row.getBoundingClientRect().height || 'auto';
});
var fixedColumnsBodyRowsHeight = [].map.call(bodyRows, function (row) {
return row.getBoundingClientRect().height || 'auto';
});
if ((0, _shallowequal2["default"])(_this.state.fixedColumnsHeadRowsHeight, fixedColumnsHeadRowsHeight) && (0, _shallowequal2["default"])(_this.state.fixedColumnsBodyRowsHeight, fixedColumnsBodyRowsHeight)) {
return;
}
_this.setState({
fixedColumnsHeadRowsHeight: fixedColumnsHeadRowsHeight,
fixedColumnsBodyRowsHeight: fixedColumnsBodyRowsHeight
});
};
_this.detectScrollTarget = function (e) {
if (_this.scrollTarget !== e.currentTarget) {
_this.scrollTarget = e.currentTarget;
}
};
_this.handleBodyScroll = function (e) {
// Prevent scrollTop setter trigger onScroll event
// http://stackoverflow.com/q/1386696
if (e.target !== _this.scrollTarget) {
return;
}
var _this$props$scroll = _this.props.scroll,
scroll = _this$props$scroll === undefined ? {} : _this$props$scroll;
var _this$refs = _this.refs,
headTable = _this$refs.headTable,
bodyTable = _this$refs.bodyTable,
fixedColumnsBodyLeft = _this$refs.fixedColumnsBodyLeft,
fixedColumnsBodyRight = _this$refs.fixedColumnsBodyRight;
if (scroll.x && e.target.scrollLeft !== _this.lastScrollLeft) {
if (e.target === bodyTable && headTable) {
headTable.scrollLeft = e.target.scrollLeft;
} else if (e.target === headTable && bodyTable) {
bodyTable.scrollLeft = e.target.scrollLeft;
}
_this.setScrollPositionClassName(e.target);
}
if (scroll.y) {
if (fixedColumnsBodyLeft && e.target !== fixedColumnsBodyLeft) {
fixedColumnsBodyLeft.scrollTop = e.target.scrollTop;
}
if (fixedColumnsBodyRight && e.target !== fixedColumnsBodyRight) {
fixedColumnsBodyRight.scrollTop = e.target.scrollTop;
}
if (bodyTable && e.target !== bodyTable) {
bodyTable.scrollTop = e.target.scrollTop;
}
}
// Remember last scrollLeft for scroll direction detecting.
_this.lastScrollLeft = e.target.scrollLeft;
};
_this.handleRowHover = function (isHover, key) {
_this.store.setState({
currentHoverKey: isHover ? key : null
});
};
var expandedRowKeys = [];
var rows = [].concat(_toConsumableArray(props.data));
_this.columnManager = new _ColumnManager2["default"](props.columns, props.children);
_this.store = (0, _createStore2["default"])({
currentHoverKey: null,
expandedRowsHeight: {}
});
_this.setScrollPosition('left');
if (props.defaultExpandAllRows) {
for (var i = 0; i < rows.length; i++) {
var row = rows[i];
expandedRowKeys.push(_this.getRowKey(row, i));
rows = rows.concat(row[props.childrenColumnName] || []);
}
} else {
expandedRowKeys = props.expandedRowKeys || props.defaultExpandedRowKeys;
}
_this.state = {
expandedRowKeys: expandedRowKeys,
currentHoverKey: null,
fixedColumnsHeadRowsHeight: [],
fixedColumnsBodyRowsHeight: []
};
return _this;
}
Table.prototype.componentDidMount = function componentDidMount() {
if (this.columnManager.isAnyColumnsFixed()) {
this.handleWindowResize();
this.debouncedWindowResize = (0, _utils.debounce)(this.handleWindowResize, 150);
this.resizeEvent = (0, _addEventListener2["default"])(window, 'resize', this.debouncedWindowResize);
}
};
Table.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
if ('expandedRowKeys' in nextProps) {
this.setState({
expandedRowKeys: nextProps.expandedRowKeys
});
}
if (nextProps.columns && nextProps.columns !== this.props.columns) {
this.columnManager.reset(nextProps.columns);
} else if (nextProps.children !== this.props.children) {
this.columnManager.reset(null, nextProps.children);
}
};
Table.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
if (this.columnManager.isAnyColumnsFixed()) {
this.handleWindowResize();
}
// when table changes to empty, reset scrollLeft
if (prevProps.data.length > 0 && this.props.data.length === 0 && this.hasScrollX()) {
this.resetScrollX();
}
};
Table.prototype.componentWillUnmount = function componentWillUnmount() {
if (this.resizeEvent) {
this.resizeEvent.remove();
}
if (this.debouncedWindowResize) {
this.debouncedWindowResize.cancel();
}
};
Table.prototype.onExpandedRowsChange = function onExpandedRowsChange(expandedRowKeys) {
if (!this.props.expandedRowKeys) {
this.setState({ expandedRowKeys: expandedRowKeys });
}
this.props.onExpandedRowsChange(expandedRowKeys);
};
Table.prototype.getRowKey = function getRowKey(record, index) {
var rowKey = this.props.rowKey;
var key = typeof rowKey === 'function' ? rowKey(record, index) : record[rowKey];
(0, _utils.warningOnce)(key !== undefined, 'Each record in table should have a unique `key` prop,' + 'or set `rowKey` to an unique primary key.');
return key === undefined ? index : key;
};
Table.prototype.getExpandedRows = function getExpandedRows() {
return this.props.expandedRowKeys || this.state.expandedRowKeys;
};
Table.prototype.getHeader = function getHeader(columns, fixed) {
var _props = this.props,
showHeader = _props.showHeader,
expandIconAsCell = _props.expandIconAsCell,
prefixCls = _props.prefixCls;
var rows = this.getHeaderRows(columns);
if (expandIconAsCell && fixed !== 'right') {
rows[0].unshift({
key: 'rc-table-expandIconAsCell',
className: prefixCls + '-expand-icon-th',
title: '',
rowSpan: rows.length
});
}
var trStyle = fixed ? this.getHeaderRowStyle(columns, rows) : null;
return showHeader ? _react2["default"].createElement(_TableHeader2["default"], {
prefixCls: prefixCls,
rows: rows,
rowStyle: trStyle
}) : null;
};
Table.prototype.getHeaderRows = function getHeaderRows(columns) {
var _this2 = this;
var currentRow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var rows = arguments[2];
rows = rows || [];
rows[currentRow] = rows[currentRow] || [];
columns.forEach(function (column) {
if (column.rowSpan && rows.length < column.rowSpan) {
while (rows.length < column.rowSpan) {
rows.push([]);
}
}
var cell = {
key: column.key,
className: column.className || '',
children: column.title
};
if (column.children) {
_this2.getHeaderRows(column.children, currentRow + 1, rows);
}
if ('colSpan' in column) {
cell.colSpan = column.colSpan;
}
if ('rowSpan' in column) {
cell.rowSpan = column.rowSpan;
}
if (cell.colSpan !== 0) {
rows[currentRow].push(cell);
}
});
return rows.filter(function (row) {
return row.length > 0;
});
};
Table.prototype.getExpandedRow = function getExpandedRow(key, content, visible, className, fixed) {
var _props2 = this.props,
prefixCls = _props2.prefixCls,
expandIconAsCell = _props2.expandIconAsCell;
var colCount = void 0;
if (fixed === 'left') {
colCount = this.columnManager.leftLeafColumns().length;
} else if (fixed === 'right') {
colCount = this.columnManager.rightLeafColumns().length;
} else {
colCount = this.columnManager.leafColumns().length;
}
var columns = [{
key: 'extra-row',
render: function render() {
return {
props: {
colSpan: colCount
},
children: fixed !== 'right' ? content : ' '
};
}
}];
if (expandIconAsCell && fixed !== 'right') {
columns.unshift({
key: 'expand-icon-placeholder',
render: function render() {
return null;
}
});
}
return _react2["default"].createElement(_TableRow2["default"], {
columns: columns,
visible: visible,
className: className,
key: key + '-extra-row',
rowKey: key + '-extra-row',
prefixCls: prefixCls + '-expanded-row',
indent: 1,
expandable: false,
store: this.store,
expandedRow: true,
fixed: !!fixed
});
};
Table.prototype.getRowsByData = function getRowsByData(data, visible, indent, columns, fixed) {
var props = this.props;
var childrenColumnName = props.childrenColumnName;
var expandedRowRender = props.expandedRowRender;
var expandRowByClick = props.expandRowByClick;
var fixedColumnsBodyRowsHeight = this.state.fixedColumnsBodyRowsHeight;
var rst = [];
var rowClassName = props.rowClassName;
var rowRef = props.rowRef;
var expandedRowClassName = props.expandedRowClassName;
var needIndentSpaced = props.data.some(function (record) {
return record[childrenColumnName];
});
var onRowClick = props.onRowClick;
var onRowDoubleClick = props.onRowDoubleClick;
var expandIconAsCell = fixed !== 'right' ? props.expandIconAsCell : false;
var expandIconColumnIndex = fixed !== 'right' ? props.expandIconColumnIndex : -1;
for (var i = 0; i < data.length; i++) {
var record = data[i];
var key = this.getRowKey(record, i);
var childrenColumn = record[childrenColumnName];
var isRowExpanded = this.isRowExpanded(record, i);
var expandedRowContent = void 0;
if (expandedRowRender && isRowExpanded) {
expandedRowContent = expandedRowRender(record, i, indent);
}
var className = rowClassName(record, i, indent);
var onHoverProps = {};
if (this.columnManager.isAnyColumnsFixed()) {
onHoverProps.onHover = this.handleRowHover;
}
var height = fixed && fixedColumnsBodyRowsHeight[i] ? fixedColumnsBodyRowsHeight[i] : null;
var leafColumns = void 0;
if (fixed === 'left') {
leafColumns = this.columnManager.leftLeafColumns();
} else if (fixed === 'right') {
leafColumns = this.columnManager.rightLeafColumns();
} else {
leafColumns = this.columnManager.leafColumns();
}
rst.push(_react2["default"].createElement(_TableRow2["default"], _extends({
indent: indent,
indentSize: props.indentSize,
needIndentSpaced: needIndentSpaced,
className: className,
record: record,
expandIconAsCell: expandIconAsCell,
onDestroy: this.onRowDestroy,
index: i,
visible: visible,
expandRowByClick: expandRowByClick,
onExpand: this.onExpanded,
expandable: childrenColumn || expandedRowRender,
expanded: isRowExpanded,
prefixCls: props.prefixCls + '-row',
childrenColumnName: childrenColumnName,
columns: leafColumns,
expandIconColumnIndex: expandIconColumnIndex,
onRowClick: onRowClick,
onRowDoubleClick: onRowDoubleClick,
height: height
}, onHoverProps, {
key: key,
hoverKey: key,
ref: rowRef(record, i, indent),
store: this.store
})));
var subVisible = visible && isRowExpanded;
if (expandedRowContent && isRowExpanded) {
rst.push(this.getExpandedRow(key, expandedRowContent, subVisible, expandedRowClassName(record, i, indent), fixed));
}
if (childrenColumn) {
rst = rst.concat(this.getRowsByData(childrenColumn, subVisible, indent + 1, columns, fixed));
}
}
return rst;
};
Table.prototype.getRows = function getRows(columns, fixed) {
return this.getRowsByData(this.props.data, true, 0, columns, fixed);
};
Table.prototype.getColGroup = function getColGroup(columns, fixed) {
var cols = [];
if (this.props.expandIconAsCell && fixed !== 'right') {
cols.push(_react2["default"].createElement('col', {
className: this.props.prefixCls + '-expand-icon-col',
key: 'rc-table-expand-icon-col'
}));
}
var leafColumns = void 0;
if (fixed === 'left') {
leafColumns = this.columnManager.leftLeafColumns();
} else if (fixed === 'right') {
leafColumns = this.columnManager.rightLeafColumns();
} else {
leafColumns = this.columnManager.leafColumns();
}
cols = cols.concat(leafColumns.map(function (c) {
return _react2["default"].createElement('col', { key: c.key, style: { width: c.width, minWidth: c.width } });
}));
return _react2["default"].createElement(
'colgroup',
null,
cols
);
};
Table.prototype.getLeftFixedTable = function getLeftFixedTable() {
return this.getTable({
columns: this.columnManager.leftColumns(),
fixed: 'left'
});
};
Table.prototype.getRightFixedTable = function getRightFixedTable() {
return this.getTable({
columns: this.columnManager.rightColumns(),
fixed: 'right'
});
};
Table.prototype.getTable = function getTable() {
var _this3 = this;
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var columns = options.columns,
fixed = options.fixed;
var _props3 = this.props,
prefixCls = _props3.prefixCls,
_props3$scroll = _props3.scroll,
scroll = _props3$scroll === undefined ? {} : _props3$scroll,
getBodyWrapper = _props3.getBodyWrapper;
var useFixedHeader = this.props.useFixedHeader;
var bodyStyle = _extends({}, this.props.bodyStyle);
var headStyle = {};
var tableClassName = '';
if (scroll.x || fixed) {
tableClassName = prefixCls + '-fixed';
bodyStyle.overflowX = bodyStyle.overflowX || 'auto';
}
var innerBodyStyle = {};
if (scroll.y) {
// maxHeight will make fixed-Table scrolling not working
// so we only set maxHeight to body-Table here
if (fixed) {
innerBodyStyle.maxHeight = bodyStyle.maxHeight || scroll.y;
innerBodyStyle.overflowY = bodyStyle.overflowY || 'scroll';
} else {
bodyStyle.maxHeight = bodyStyle.maxHeight || scroll.y;
}
bodyStyle.overflowY = bodyStyle.overflowY || 'scroll';
useFixedHeader = true;
// Add negative margin bottom for scroll bar overflow bug
var scrollbarWidth = (0, _utils.measureScrollbar)();
if (scrollbarWidth > 0) {
(fixed ? bodyStyle : headStyle).marginBottom = '-' + scrollbarWidth + 'px';
(fixed ? bodyStyle : headStyle).paddingBottom = '0px';
}
}
var renderTable = function renderTable() {
var hasHead = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
var hasBody = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
var tableStyle = {};
if (!fixed && scroll.x) {
// not set width, then use content fixed width
if (scroll.x === true) {
tableStyle.tableLayout = 'fixed';
} else {
tableStyle.width = scroll.x;
}
}
var tableBody = hasBody ? getBodyWrapper(_react2["default"].createElement(
'tbody',
{ className: prefixCls + '-tbody' },
_this3.getRows(columns, fixed)
)) : null;
return _react2["default"].createElement(
'table',
{ className: tableClassName, style: tableStyle, key: 'table' },
_this3.getColGroup(columns, fixed),
hasHead ? _this3.getHeader(columns, fixed) : null,
tableBody
);
};
var headTable = void 0;
if (useFixedHeader) {
headTable = _react2["default"].createElement(
'div',
{
key: 'headTable',
className: prefixCls + '-header',
ref: fixed ? null : 'headTable',
style: headStyle,
onMouseOver: this.detectScrollTarget,
onTouchStart: this.detectScrollTarget,
onScroll: this.handleBodyScroll
},
renderTable(true, false)
);
}
var bodyTable = _react2["default"].createElement(
'div',
{
key: 'bodyTable',
className: prefixCls + '-body',
style: bodyStyle,
ref: 'bodyTable',
onMouseOver: this.detectScrollTarget,
onTouchStart: this.detectScrollTarget,
onScroll: this.handleBodyScroll
},
renderTable(!useFixedHeader)
);
if (fixed && columns.length) {
var refName = void 0;
if (columns[0].fixed === 'left' || columns[0].fixed === true) {
refName = 'fixedColumnsBodyLeft';
} else if (columns[0].fixed === 'right') {
refName = 'fixedColumnsBodyRight';
}
delete bodyStyle.overflowX;
delete bodyStyle.overflowY;
bodyTable = _react2["default"].createElement(
'div',
{
key: 'bodyTable',
className: prefixCls + '-body-outer',
style: _extends({}, bodyStyle)
},
_react2["default"].createElement(
'div',
{
className: prefixCls + '-body-inner',
style: innerBodyStyle,
ref: refName,
onMouseOver: this.detectScrollTarget,
onTouchStart: this.detectScrollTarget,
onScroll: this.handleBodyScroll
},
renderTable(!useFixedHeader)
)
);
}
return [headTable, bodyTable];
};
Table.prototype.getTitle = function getTitle() {
var _props4 = this.props,
title = _props4.title,
prefixCls = _props4.prefixCls;
return title ? _react2["default"].createElement(
'div',
{ className: prefixCls + '-title', key: 'title' },
title(this.props.data)
) : null;
};
Table.prototype.getFooter = function getFooter() {
var _props5 = this.props,
footer = _props5.footer,
prefixCls = _props5.prefixCls;
return footer ? _react2["default"].createElement(
'div',
{ className: prefixCls + '-footer', key: 'footer' },
footer(this.props.data)
) : null;
};
Table.prototype.getEmptyText = function getEmptyText() {
var _props6 = this.props,
emptyText = _props6.emptyText,
prefixCls = _props6.prefixCls,
data = _props6.data;
return !data.length ? _react2["default"].createElement(
'div',
{ className: prefixCls + '-placeholder', key: 'emptyText' },
typeof emptyText === 'function' ? emptyText() : emptyText
) : null;
};
Table.prototype.getHeaderRowStyle = function getHeaderRowStyle(columns, rows) {
var fixedColumnsHeadRowsHeight = this.state.fixedColumnsHeadRowsHeight;
var headerHeight = fixedColumnsHeadRowsHeight[0];
if (headerHeight && columns) {
if (headerHeight === 'auto') {
return { height: 'auto' };
}
return { height: headerHeight / rows.length };
}
return null;
};
Table.prototype.setScrollPosition = function setScrollPosition(position) {
this.scrollPosition = position;
if (this.tableNode) {
var prefixCls = this.props.prefixCls;
if (position === 'both') {
(0, _componentClasses2["default"])(this.tableNode).remove(new RegExp('^' + prefixCls + '-scroll-position-.+$')).add(prefixCls + '-scroll-position-left').add(prefixCls + '-scroll-position-right');
} else {
(0, _componentClasses2["default"])(this.tableNode).remove(new RegExp('^' + prefixCls + '-scroll-position-.+$')).add(prefixCls + '-scroll-position-' + position);
}
}
};
Table.prototype.setScrollPositionClassName = function setScrollPositionClassName(target) {
var node = target || this.refs.bodyTable;
var scrollToLeft = node.scrollLeft === 0;
var scrollToRight = node.scrollLeft + 1 >= node.children[0].getBoundingClientRect().width - node.getBoundingClientRect().width;
if (scrollToLeft && scrollToRight) {
this.setScrollPosition('both');
} else if (scrollToLeft) {
this.setScrollPosition('left');
} else if (scrollToRight) {
this.setScrollPosition('right');
} else if (this.scrollPosition !== 'middle') {
this.setScrollPosition('middle');
}
};
Table.prototype.resetScrollX = function resetScrollX() {
if (this.refs.headTable) {
this.refs.headTable.scrollLeft = 0;
}
if (this.refs.bodyTable) {
this.refs.bodyTable.scrollLeft = 0;
}
};
Table.prototype.findExpandedRow = function findExpandedRow(record, index) {
var _this4 = this;
var rows = this.getExpandedRows().filter(function (i) {
return i === _this4.getRowKey(record, index);
});
return rows[0];
};
Table.prototype.isRowExpanded = function isRowExpanded(record, index) {
return typeof this.findExpandedRow(record, index) !== 'undefined';
};
Table.prototype.hasScrollX = function hasScrollX() {
var _props$scroll = this.props.scroll,
scroll = _props$scroll === undefined ? {} : _props$scroll;
return 'x' in scroll;
};
Table.prototype.render = function render() {
var _this5 = this;
var props = this.props;
var prefixCls = props.prefixCls;
var className = props.prefixCls;
if (props.className) {
className += ' ' + props.className;
}
if (props.useFixedHeader || props.scroll && props.scroll.y) {
className += ' ' + prefixCls + '-fixed-header';
}
if (this.scrollPosition === 'both') {
className += ' ' + prefixCls + '-scroll-position-left ' + prefixCls + '-scroll-position-right';
} else {
className += ' ' + prefixCls + '-scroll-position-' + this.scrollPosition;
}
var isTableScroll = this.columnManager.isAnyColumnsFixed() || props.scroll.x || props.scroll.y;
var content = [this.getTable({ columns: this.columnManager.groupedColumns() }), this.getEmptyText(), this.getFooter()];
var scrollTable = isTableScroll ? _react2["default"].createElement(
'div',
{ className: prefixCls + '-scroll' },
content
) : content;
return _react2["default"].createElement(
'div',
{ ref: function ref(node) {
return _this5.tableNode = node;
}, className: className, style: props.style },
this.getTitle(),
_react2["default"].createElement(
'div',
{ className: prefixCls + '-content' },
scrollTable,
this.columnManager.isAnyColumnsLeftFixed() && _react2["default"].createElement(
'div',
{ className: prefixCls + '-fixed-left' },
this.getLeftFixedTable()
),
this.columnManager.isAnyColumnsRightFixed() && _react2["default"].createElement(
'div',
{ className: prefixCls + '-fixed-right' },
this.getRightFixedTable()
)
)
);
};
return Table;
}(_react2["default"].Component);
Table.propTypes = {
data: _propTypes2["default"].array,
expandIconAsCell: _propTypes2["default"].bool,
defaultExpandAllRows: _propTypes2["default"].bool,
expandedRowKeys: _propTypes2["default"].array,
defaultExpandedRowKeys: _propTypes2["default"].array,
useFixedHeader: _propTypes2["default"].bool,
columns: _propTypes2["default"].array,
prefixCls: _propTypes2["default"].string,
bodyStyle: _propTypes2["default"].object,
style: _propTypes2["default"].object,
rowKey: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].func]),
rowClassName: _propTypes2["default"].func,
expandedRowClassName: _propTypes2["default"].func,
childrenColumnName: _propTypes2["default"].string,
onExpand: _propTypes2["default"].func,
onExpandedRowsChange: _propTypes2["default"].func,
indentSize: _propTypes2["default"].number,
onRowClick: _propTypes2["default"].func,
onRowDoubleClick: _propTypes2["default"].func,
expandIconColumnIndex: _propTypes2["default"].number,
showHeader: _propTypes2["default"].bool,
title: _propTypes2["default"].func,
footer: _propTypes2["default"].func,
emptyText: _propTypes2["default"].oneOfType([_propTypes2["default"].node, _propTypes2["default"].func]),
scroll: _propTypes2["default"].object,
rowRef: _propTypes2["default"].func,
getBodyWrapper: _propTypes2["default"].func,
children: _propTypes2["default"].node
};
Table.defaultProps = {
data: [],
useFixedHeader: false,
expandIconAsCell: false,
defaultExpandAllRows: false,
defaultExpandedRowKeys: [],
rowKey: 'key',
rowClassName: function rowClassName() {
return '';
},
expandedRowClassName: function expandedRowClassName() {
return '';
},
onExpand: function onExpand() {},
onExpandedRowsChange: function onExpandedRowsChange() {},
onRowClick: function onRowClick() {},
onRowDoubleClick: function onRowDoubleClick() {},
prefixCls: 'rc-table',
bodyStyle: {},
style: {},
childrenColumnName: 'children',
indentSize: 15,
expandIconColumnIndex: 0,
showHeader: true,
scroll: {},
rowRef: function rowRef() {
return null;
},
getBodyWrapper: function getBodyWrapper(body) {
return body;
},
emptyText: function emptyText() {
return 'No Data';
}
};
exports["default"] = Table;
module.exports = exports['default'];
/***/ },
/* 412 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__(9);
var _propTypes2 = _interopRequireDefault(_propTypes);
var _lodash = __webpack_require__(362);
var _lodash2 = _interopRequireDefault(_lodash);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var TableCell = function (_React$Component) {
_inherits(TableCell, _React$Component);
function TableCell() {
var _temp, _this, _ret;
_classCallCheck(this, TableCell);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.handleClick = function (e) {
var _this$props = _this.props,
record = _this$props.record,
onCellClick = _this$props.column.onCellClick;
if (onCellClick) {
onCellClick(record, e);
}
}, _temp), _possibleConstructorReturn(_this, _ret);
}
TableCell.prototype.isInvalidRenderCellText = function isInvalidRenderCellText(text) {
return text && !_react2["default"].isValidElement(text) && Object.prototype.toString.call(text) === '[object Object]';
};
TableCell.prototype.render = function render() {
var _props = this.props,
record = _props.record,
indentSize = _props.indentSize,
prefixCls = _props.prefixCls,
indent = _props.indent,
index = _props.index,
expandIcon = _props.expandIcon,
column = _props.column;
var dataIndex = column.dataIndex,
render = column.render,
_column$className = column.className,
className = _column$className === undefined ? '' : _column$className;
// We should return undefined if no dataIndex is specified, but in order to
// be compatible with object-path's behavior, we return the record object instead.
var text = void 0;
if (typeof dataIndex === 'number') {
text = (0, _lodash2["default"])(record, dataIndex);
} else if (!dataIndex || dataIndex.length === 0) {
text = record;
} else {
text = (0, _lodash2["default"])(record, dataIndex);
}
var tdProps = void 0;
var colSpan = void 0;
var rowSpan = void 0;
if (render) {
text = render(text, record, index);
if (this.isInvalidRenderCellText(text)) {
tdProps = text.props || {};
colSpan = tdProps.colSpan;
rowSpan = tdProps.rowSpan;
text = text.children;
}
}
// Fix https://github.com/ant-design/ant-design/issues/1202
if (this.isInvalidRenderCellText(text)) {
text = null;
}
var indentText = expandIcon ? _react2["default"].createElement('span', {
style: { paddingLeft: indentSize * indent + 'px' },
className: prefixCls + '-indent indent-level-' + indent
}) : null;
if (rowSpan === 0 || colSpan === 0) {
return null;
}
return _react2["default"].createElement(
'td',
_extends({
className: className
}, tdProps, {
onClick: this.handleClick
}),
indentText,
expandIcon,
text
);
};
return TableCell;
}(_react2["default"].Component);
TableCell.propTypes = {
record: _propTypes2["default"].object,
prefixCls: _propTypes2["default"].string,
index: _propTypes2["default"].number,
indent: _propTypes2["default"].number,
indentSize: _propTypes2["default"].number,
column: _propTypes2["default"].object,
expandIcon: _propTypes2["default"].node
};
exports["default"] = TableCell;
module.exports = exports['default'];
/***/ },
/* 413 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__(9);
var _propTypes2 = _interopRequireDefault(_propTypes);
var _shallowequal = __webpack_require__(52);
var _shallowequal2 = _interopRequireDefault(_shallowequal);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var TableHeader = function (_React$Component) {
_inherits(TableHeader, _React$Component);
function TableHeader() {
_classCallCheck(this, TableHeader);
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
}
TableHeader.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {
return !(0, _shallowequal2["default"])(nextProps, this.props);
};
TableHeader.prototype.render = function render() {
var _props = this.props,
prefixCls = _props.prefixCls,
rowStyle = _props.rowStyle,
rows = _props.rows;
return _react2["default"].createElement(
'thead',
{ className: prefixCls + '-thead' },
rows.map(function (row, index) {
return _react2["default"].createElement(
'tr',
{ key: index, style: rowStyle },
row.map(function (cellProps, i) {
return _react2["default"].createElement('th', _extends({}, cellProps, { key: i }));
})
);
})
);
};
return TableHeader;
}(_react2["default"].Component);
TableHeader.propTypes = {
prefixCls: _propTypes2["default"].string,
rowStyle: _propTypes2["default"].object,
rows: _propTypes2["default"].array
};
exports["default"] = TableHeader;
module.exports = exports['default'];
/***/ },
/* 414 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__(9);
var _propTypes2 = _interopRequireDefault(_propTypes);
var _TableCell = __webpack_require__(412);
var _TableCell2 = _interopRequireDefault(_TableCell);
var _ExpandIcon = __webpack_require__(410);
var _ExpandIcon2 = _interopRequireDefault(_ExpandIcon);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
var TableRow = function (_React$Component) {
_inherits(TableRow, _React$Component);
function TableRow() {
var _temp, _this, _ret;
_classCallCheck(this, TableRow);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.state = {
hovered: false,
height: null
}, _this.onRowClick = function (event) {
var _this$props = _this.props,
record = _this$props.record,
index = _this$props.index,
onRowClick = _this$props.onRowClick,
expandable = _this$props.expandable,
expandRowByClick = _this$props.expandRowByClick,
expanded = _this$props.expanded,
onExpand = _this$props.onExpand;
if (expandable && expandRowByClick) {
onExpand(!expanded, record, event, index);
}
onRowClick(record, index, event);
}, _this.onRowDoubleClick = function (event) {
var _this$props2 = _this.props,
record = _this$props2.record,
index = _this$props2.index,
onRowDoubleClick = _this$props2.onRowDoubleClick;
onRowDoubleClick(record, index, event);
}, _this.onMouseEnter = function () {
var _this$props3 = _this.props,
onHover = _this$props3.onHover,
hoverKey = _this$props3.hoverKey;
onHover(true, hoverKey);
}, _this.onMouseLeave = function () {
var _this$props4 = _this.props,
onHover = _this$props4.onHover,
hoverKey = _this$props4.hoverKey;
onHover(false, hoverKey);
}, _temp), _possibleConstructorReturn(_this, _ret);
}
TableRow.prototype.componentDidMount = function componentDidMount() {
var _this2 = this;
var store = this.props.store;
this.pushHeight();
this.pullHeight();
this.unsubscribe = store.subscribe(function () {
_this2.setHover();
_this2.pullHeight();
});
};
TableRow.prototype.componentWillUnmount = function componentWillUnmount() {
var _props = this.props,
record = _props.record,
onDestroy = _props.onDestroy,
index = _props.index;
onDestroy(record, index);
if (this.unsubscribe) {
this.unsubscribe();
}
};
TableRow.prototype.setHover = function setHover() {
var _props2 = this.props,
store = _props2.store,
hoverKey = _props2.hoverKey;
var _store$getState = store.getState(),
currentHoverKey = _store$getState.currentHoverKey;
if (currentHoverKey === hoverKey) {
this.setState({ hovered: true });
} else if (this.state.hovered === true) {
this.setState({ hovered: false });
}
};
TableRow.prototype.pullHeight = function pullHeight() {
var _props3 = this.props,
store = _props3.store,
expandedRow = _props3.expandedRow,
fixed = _props3.fixed,
rowKey = _props3.rowKey;
var _store$getState2 = store.getState(),
expandedRowsHeight = _store$getState2.expandedRowsHeight;
if (expandedRow && fixed && expandedRowsHeight[rowKey]) {
this.setState({ height: expandedRowsHeight[rowKey] });
}
};
TableRow.prototype.pushHeight = function pushHeight() {
var _props4 = this.props,
store = _props4.store,
expandedRow = _props4.expandedRow,
fixed = _props4.fixed,
rowKey = _props4.rowKey;
if (expandedRow && !fixed) {
var _store$getState3 = store.getState(),
expandedRowsHeight = _store$getState3.expandedRowsHeight;
var height = this.trRef.getBoundingClientRect().height;
expandedRowsHeight[rowKey] = height;
store.setState({ expandedRowsHeight: expandedRowsHeight });
}
};
TableRow.prototype.render = function render() {
var _this3 = this;
var _props5 = this.props,
prefixCls = _props5.prefixCls,
columns = _props5.columns,
record = _props5.record,
visible = _props5.visible,
index = _props5.index,
expandIconColumnIndex = _props5.expandIconColumnIndex,
expandIconAsCell = _props5.expandIconAsCell,
expanded = _props5.expanded,
expandRowByClick = _props5.expandRowByClick,
expandable = _props5.expandable,
onExpand = _props5.onExpand,
needIndentSpaced = _props5.needIndentSpaced,
indent = _props5.indent,
indentSize = _props5.indentSize;
var className = this.props.className;
if (this.state.hovered) {
className += ' ' + prefixCls + '-hover';
}
var cells = [];
var expandIcon = _react2["default"].createElement(_ExpandIcon2["default"], {
expandable: expandable,
prefixCls: prefixCls,
onExpand: onExpand,
needIndentSpaced: needIndentSpaced,
expanded: expanded,
record: record
});
for (var i = 0; i < columns.length; i++) {
if (expandIconAsCell && i === 0) {
cells.push(_react2["default"].createElement(
'td',
{
className: prefixCls + '-expand-icon-cell',
key: 'rc-table-expand-icon-cell'
},
expandIcon
));
}
var isColumnHaveExpandIcon = expandIconAsCell || expandRowByClick ? false : i === expandIconColumnIndex;
cells.push(_react2["default"].createElement(_TableCell2["default"], {
prefixCls: prefixCls,
record: record,
indentSize: indentSize,
indent: indent,
index: index,
column: columns[i],
key: columns[i].key,
expandIcon: isColumnHaveExpandIcon ? expandIcon : null
}));
}
var height = this.props.height || this.state.height;
var style = { height: height };
if (!visible) {
style.display = 'none';
}
return _react2["default"].createElement(
'tr',
{
ref: function ref(node) {
return _this3.trRef = node;
},
onClick: this.onRowClick,
onDoubleClick: this.onRowDoubleClick,
onMouseEnter: this.onMouseEnter,
onMouseLeave: this.onMouseLeave,
className: prefixCls + ' ' + className + ' ' + prefixCls + '-level-' + indent,
style: style
},
cells
);
};
return TableRow;
}(_react2["default"].Component);
TableRow.propTypes = {
onDestroy: _propTypes2["default"].func,
onRowClick: _propTypes2["default"].func,
onRowDoubleClick: _propTypes2["default"].func,
record: _propTypes2["default"].object,
prefixCls: _propTypes2["default"].string,
expandIconColumnIndex: _propTypes2["default"].number,
onHover: _propTypes2["default"].func,
columns: _propTypes2["default"].array,
height: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].number]),
visible: _propTypes2["default"].bool,
index: _propTypes2["default"].number,
hoverKey: _propTypes2["default"].any,
expanded: _propTypes2["default"].bool,
expandable: _propTypes2["default"].any,
onExpand: _propTypes2["default"].func,
needIndentSpaced: _propTypes2["default"].bool,
className: _propTypes2["default"].string,
indent: _propTypes2["default"].number,
indentSize: _propTypes2["default"].number,
expandIconAsCell: _propTypes2["default"].bool,
expandRowByClick: _propTypes2["default"].bool,
store: _propTypes2["default"].object.isRequired,
expandedRow: _propTypes2["default"].bool,
fixed: _propTypes2["default"].bool,
rowKey: _propTypes2["default"].string
};
TableRow.defaultProps = {
onRowClick: function onRowClick() {},
onRowDoubleClick: function onRowDoubleClick() {},
onDestroy: function onDestroy() {},
expandIconColumnIndex: 0,
expandRowByClick: false,
onHover: function onHover() {}
};
exports["default"] = TableRow;
module.exports = exports['default'];
/***/ },
/* 415 */
/***/ function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
exports["default"] = createStore;
function createStore(initialState) {
var state = initialState;
var listeners = [];
function setState(partial) {
state = _extends({}, state, partial);
for (var i = 0; i < listeners.length; i++) {
listeners[i]();
}
}
function getState() {
return state;
}
function subscribe(listener) {
listeners.push(listener);
return function unsubscribe() {
var index = listeners.indexOf(listener);
listeners.splice(index, 1);
};
}
return {
setState: setState,
getState: getState,
subscribe: subscribe
};
}
module.exports = exports['default'];
/***/ },
/* 416 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var Table = __webpack_require__(411);
var Column = __webpack_require__(407);
var ColumnGroup = __webpack_require__(408);
Table.Column = Column;
Table.ColumnGroup = ColumnGroup;
module.exports = Table;
/***/ },
/* 417 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.measureScrollbar = measureScrollbar;
exports.debounce = debounce;
exports.warningOnce = warningOnce;
var _warning = __webpack_require__(418);
var _warning2 = _interopRequireDefault(_warning);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var scrollbarWidth = void 0;
// Measure scrollbar width for padding body during modal show/hide
var scrollbarMeasure = {
position: 'absolute',
top: '-9999px',
width: '50px',
height: '50px',
overflow: 'scroll'
};
function measureScrollbar() {
if (typeof document === 'undefined' || typeof window === 'undefined') {
return 0;
}
if (scrollbarWidth) {
return scrollbarWidth;
}
var scrollDiv = document.createElement('div');
for (var scrollProp in scrollbarMeasure) {
if (scrollbarMeasure.hasOwnProperty(scrollProp)) {
scrollDiv.style[scrollProp] = scrollbarMeasure[scrollProp];
}
}
document.body.appendChild(scrollDiv);
var width = scrollDiv.offsetWidth - scrollDiv.clientWidth;
document.body.removeChild(scrollDiv);
scrollbarWidth = width;
return scrollbarWidth;
}
function debounce(func, wait, immediate) {
var timeout = void 0;
function debounceFunc() {
var context = this;
var args = arguments;
// https://fb.me/react-event-pooling
if (args[0] && args[0].persist) {
args[0].persist();
}
var later = function later() {
timeout = null;
if (!immediate) {
func.apply(context, args);
}
};
var callNow = immediate && !timeout;
clearTimeout(timeout);
timeout = setTimeout(later, wait);
if (callNow) {
func.apply(context, args);
}
}
debounceFunc.cancel = function cancel() {
if (timeout) {
clearTimeout(timeout);
timeout = null;
}
};
return debounceFunc;
}
var warned = {};
function warningOnce(condition, format, args) {
if (!warned[format]) {
(0, _warning2["default"])(condition, format, args);
warned[format] = !condition;
}
}
/***/ },
/* 418 */
119,
/* 419 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _InkTabBarMixin = __webpack_require__(120);
var _InkTabBarMixin2 = _interopRequireDefault(_InkTabBarMixin);
var _TabBarMixin = __webpack_require__(74);
var _TabBarMixin2 = _interopRequireDefault(_TabBarMixin);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var InkTabBar = _react2["default"].createClass({
displayName: 'InkTabBar',
mixins: [_TabBarMixin2["default"], _InkTabBarMixin2["default"]],
render: function render() {
var inkBarNode = this.getInkBarNode();
var tabs = this.getTabs();
return this.getRootNode([inkBarNode, tabs]);
}
});
exports["default"] = InkTabBar;
module.exports = exports['default'];
/***/ },
/* 420 */
/***/ function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = {
/**
* LEFT
*/
LEFT: 37, // also NUM_WEST
/**
* UP
*/
UP: 38, // also NUM_NORTH
/**
* RIGHT
*/
RIGHT: 39, // also NUM_EAST
/**
* DOWN
*/
DOWN: 40 };
module.exports = exports['default'];
/***/ },
/* 421 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = __webpack_require__(7);
var _extends3 = _interopRequireDefault(_extends2);
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _InkTabBarMixin = __webpack_require__(120);
var _InkTabBarMixin2 = _interopRequireDefault(_InkTabBarMixin);
var _SwipeableTabBarMixin = __webpack_require__(422);
var _SwipeableTabBarMixin2 = _interopRequireDefault(_SwipeableTabBarMixin);
var _TabBarMixin = __webpack_require__(74);
var _TabBarMixin2 = _interopRequireDefault(_TabBarMixin);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var SwipeableInkTabBar = _react2["default"].createClass({
displayName: 'SwipeableInkTabBar',
mixins: [_TabBarMixin2["default"], _InkTabBarMixin2["default"], _SwipeableTabBarMixin2["default"]],
getSwipeableTabs: function getSwipeableTabs() {
var _this = this;
var props = this.props;
var children = props.panels;
var activeKey = props.activeKey;
var rst = [];
var prefixCls = props.prefixCls;
var tabStyle = {
display: 'flex',
flex: '0 0 ' + 1 / props.pageSize * 100 + '%'
};
_react2["default"].Children.forEach(children, function (child) {
if (!child) {
return;
}
var key = child.key;
var cls = activeKey === key ? prefixCls + '-tab-active' : '';
cls += ' ' + prefixCls + '-tab';
var events = {};
if (child.props.disabled) {
cls += ' ' + prefixCls + '-tab-disabled';
} else {
events = {
onClick: _this.onTabClick.bind(_this, key)
};
}
var ref = {};
if (activeKey === key) {
ref.ref = 'activeTab';
}
rst.push(_react2["default"].createElement(
'div',
(0, _extends3["default"])({
role: 'tab',
style: tabStyle,
'aria-disabled': child.props.disabled ? 'true' : 'false',
'aria-selected': activeKey === key ? 'true' : 'false'
}, events, {
className: cls,
key: key
}, ref),
child.props.tab
));
});
return rst;
},
render: function render() {
var inkBarNode = this.getInkBarNode();
var tabs = this.getSwipeableTabs();
var scrollbarNode = this.getSwipeBarNode([inkBarNode, tabs]);
return this.getRootNode(scrollbarNode);
}
});
exports["default"] = SwipeableInkTabBar;
module.exports = exports['default'];
/***/ },
/* 422 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = __webpack_require__(7);
var _extends3 = _interopRequireDefault(_extends2);
var _defineProperty2 = __webpack_require__(6);
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _classnames3 = __webpack_require__(5);
var _classnames4 = _interopRequireDefault(_classnames3);
var _reactHammerjs = __webpack_require__(76);
var _reactHammerjs2 = _interopRequireDefault(_reactHammerjs);
var _reactDom = __webpack_require__(10);
var _reactDom2 = _interopRequireDefault(_reactDom);
var _utils = __webpack_require__(49);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
exports["default"] = {
getInitialState: function getInitialState() {
var _checkPaginationByKey = this.checkPaginationByKey(this.props.activeKey),
hasPrevPage = _checkPaginationByKey.hasPrevPage,
hasNextPage = _checkPaginationByKey.hasNextPage;
return {
hasPrevPage: hasPrevPage,
hasNextPage: hasNextPage
};
},
getDefaultProps: function getDefaultProps() {
return {
hammerOptions: {},
pageSize: 5, // per page show how many tabs
speed: 5 };
},
checkPaginationByKey: function checkPaginationByKey(activeKey) {
var _props = this.props,
panels = _props.panels,
pageSize = _props.pageSize;
var index = this.getIndexByKey(activeKey);
var centerTabCount = Math.floor(pageSize / 2);
// the basic rule is to make activeTab be shown in the center of TabBar viewport
return {
hasPrevPage: index - centerTabCount > 0,
hasNextPage: index + centerTabCount < panels.length
};
},
/**
* used for props.activeKey setting, not for swipe callback
*/
getDeltaByKey: function getDeltaByKey(activeKey) {
var pageSize = this.props.pageSize;
var index = this.getIndexByKey(activeKey);
var centerTabCount = Math.floor(pageSize / 2);
var tabWidth = this.cache.tabWidth;
var delta = (index - centerTabCount) * tabWidth * -1;
return delta;
},
getIndexByKey: function getIndexByKey(activeKey) {
var panels = this.props.panels;
var length = panels.length;
for (var i = 0; i <= length; i++) {
if (panels[i].key === activeKey) {
return i;
}
}
return -1;
},
checkPaginationByDelta: function checkPaginationByDelta(delta) {
var totalAvaliableDelta = this.cache.totalAvaliableDelta;
return {
hasPrevPage: delta < 0,
hasNextPage: -delta < totalAvaliableDelta
};
},
setSwipePositionByKey: function setSwipePositionByKey(activeKey) {
var _checkPaginationByKey2 = this.checkPaginationByKey(activeKey),
hasPrevPage = _checkPaginationByKey2.hasPrevPage,
hasNextPage = _checkPaginationByKey2.hasNextPage;
var totalAvaliableDelta = this.cache.totalAvaliableDelta;
this.setState({
hasPrevPage: hasPrevPage,
hasNextPage: hasNextPage
});
var delta = void 0;
if (!hasPrevPage) {
// the first page
delta = 0;
} else if (!hasNextPage) {
// the last page
delta = -totalAvaliableDelta;
} else if (hasNextPage) {
// the middle page
delta = this.getDeltaByKey(activeKey);
}
this.setSwipePositionByDelta(delta);
},
setSwipePositionByDelta: function setSwipePositionByDelta(value) {
var relativeDirection = this.cache.relativeDirection;
(0, _utils.setPxStyle)(this.swipeNode, relativeDirection, value);
},
componentDidMount: function componentDidMount() {
var _refs = this.refs,
swipe = _refs.swipe,
nav = _refs.nav;
var _props2 = this.props,
tabBarPosition = _props2.tabBarPosition,
pageSize = _props2.pageSize,
panels = _props2.panels,
activeKey = _props2.activeKey;
this.swipeNode = _reactDom2["default"].findDOMNode(swipe); // dom which scroll (9999px)
this.realNode = _reactDom2["default"].findDOMNode(nav); // dom which visiable in screen (viewport)
var _isVertical = (0, _utils.isVertical)(tabBarPosition);
var _viewSize = (0, _utils.getStyle)(this.realNode, _isVertical ? 'height' : 'width');
var _tabWidth = _viewSize / pageSize;
this.cache = {
vertical: _isVertical,
relativeDirection: _isVertical ? 'top' : 'left',
totalAvaliableDelta: _tabWidth * panels.length - _viewSize,
tabWidth: _tabWidth
};
this.setSwipePositionByKey(activeKey);
},
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
if (nextProps.activeKey && nextProps.activeKey !== this.props.activeKey) {
this.setSwipePositionByKey(nextProps.activeKey);
}
},
onPan: function onPan(e) {
var _cache = this.cache,
vertical = _cache.vertical,
relativeDirection = _cache.relativeDirection;
var speed = this.props.speed;
var nowDelta = vertical ? e.deltaY : e.deltaX;
nowDelta = nowDelta * (speed / 10);
var preDelta = (0, _utils.getStyle)(this.swipeNode, relativeDirection);
var nextTotalDelta = nowDelta + preDelta;
var _checkPaginationByDel = this.checkPaginationByDelta(nextTotalDelta),
hasPrevPage = _checkPaginationByDel.hasPrevPage,
hasNextPage = _checkPaginationByDel.hasNextPage;
this.setState({
hasPrevPage: hasPrevPage,
hasNextPage: hasNextPage
});
if (hasPrevPage && hasNextPage) {
this.setSwipePositionByDelta(nextTotalDelta);
}
},
getSwipeBarNode: function getSwipeBarNode(tabs) {
var _classnames2;
var _props3 = this.props,
prefixCls = _props3.prefixCls,
hammerOptions = _props3.hammerOptions,
tabBarPosition = _props3.tabBarPosition;
var _state = this.state,
hasPrevPage = _state.hasPrevPage,
hasNextPage = _state.hasNextPage;
var navClassName = prefixCls + '-nav';
var navClasses = (0, _classnames4["default"])((0, _defineProperty3["default"])({}, navClassName, true));
var direction = {};
if ((0, _utils.isVertical)(tabBarPosition)) {
direction = {
vertical: true
};
}
var events = {
onPan: this.onPan
};
return _react2["default"].createElement(
'div',
{
className: (0, _classnames4["default"])((_classnames2 = {}, (0, _defineProperty3["default"])(_classnames2, prefixCls + '-nav-container', 1), (0, _defineProperty3["default"])(_classnames2, prefixCls + '-nav-swipe-container', 1), (0, _defineProperty3["default"])(_classnames2, prefixCls + '-prevpage', hasPrevPage), (0, _defineProperty3["default"])(_classnames2, prefixCls + '-nextpage', hasNextPage), _classnames2)),
key: 'container',
ref: 'container'
},
_react2["default"].createElement(
'div',
{ className: prefixCls + '-nav-wrap', ref: 'navWrap' },
_react2["default"].createElement(
_reactHammerjs2["default"],
(0, _extends3["default"])({}, events, direction, {
options: hammerOptions
}),
_react2["default"].createElement(
'div',
{ className: prefixCls + '-nav-swipe', ref: 'swipe' },
_react2["default"].createElement(
'div',
{ className: navClasses, ref: 'nav' },
tabs
)
)
)
)
);
}
};
module.exports = exports['default'];
/***/ },
/* 423 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = __webpack_require__(7);
var _extends3 = _interopRequireDefault(_extends2);
var _TabContent = __webpack_require__(75);
var _TabContent2 = _interopRequireDefault(_TabContent);
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _reactHammerjs = __webpack_require__(76);
var _reactHammerjs2 = _interopRequireDefault(_reactHammerjs);
var _reactDom = __webpack_require__(10);
var _reactDom2 = _interopRequireDefault(_reactDom);
var _utils = __webpack_require__(49);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var RESISTANCE_COEF = 0.6;
function computeIndex(_ref) {
var maxIndex = _ref.maxIndex,
startIndex = _ref.startIndex,
delta = _ref.delta,
viewSize = _ref.viewSize;
var index = startIndex + -delta / viewSize;
if (index < 0) {
index = Math.exp(index * RESISTANCE_COEF) - 1;
} else if (index > maxIndex) {
index = maxIndex + 1 - Math.exp((maxIndex - index) * RESISTANCE_COEF);
}
return index;
}
function getIndexByDelta(e) {
var delta = (0, _utils.isVertical)(this.props.tabBarPosition) ? e.deltaY : e.deltaX;
var currentIndex = computeIndex({
maxIndex: this.maxIndex,
viewSize: this.viewSize,
startIndex: this.startIndex,
delta: delta
});
var showIndex = delta < 0 ? Math.floor(currentIndex + 1) : Math.floor(currentIndex);
if (showIndex < 0) {
showIndex = 0;
} else if (showIndex > this.maxIndex) {
showIndex = this.maxIndex;
}
if (this.children[showIndex].props.disabled) {
return undefined;
}
return currentIndex;
}
var SwipeableTabContent = _react2["default"].createClass({
displayName: 'SwipeableTabContent',
propTypes: {
tabBarPosition: _react.PropTypes.string,
onChange: _react.PropTypes.func,
children: _react.PropTypes.any,
hammerOptions: _react.PropTypes.any,
animated: _react.PropTypes.bool,
activeKey: _react.PropTypes.string
},
getDefaultProps: function getDefaultProps() {
return {
animated: true
};
},
componentDidMount: function componentDidMount() {
this.rootNode = _reactDom2["default"].findDOMNode(this);
},
onPanStart: function onPanStart() {
var _props = this.props,
tabBarPosition = _props.tabBarPosition,
children = _props.children,
activeKey = _props.activeKey,
animated = _props.animated;
var startIndex = this.startIndex = (0, _utils.getActiveIndex)(children, activeKey);
if (startIndex === -1) {
return;
}
if (animated) {
(0, _utils.setTransition)(this.rootNode.style, 'none');
}
this.startDrag = true;
this.children = (0, _utils.toArray)(children);
this.maxIndex = this.children.length - 1;
this.viewSize = (0, _utils.isVertical)(tabBarPosition) ? this.rootNode.offsetHeight : this.rootNode.offsetWidth;
},
onPan: function onPan(e) {
if (!this.startDrag) {
return;
}
var tabBarPosition = this.props.tabBarPosition;
var currentIndex = getIndexByDelta.call(this, e);
if (currentIndex !== undefined) {
(0, _utils.setTransform)(this.rootNode.style, (0, _utils.getTransformByIndex)(currentIndex, tabBarPosition));
}
},
onPanEnd: function onPanEnd(e) {
if (!this.startDrag) {
return;
}
this.end(e);
},
onSwipe: function onSwipe(e) {
this.end(e, true);
},
end: function end(e, swipe) {
var _props2 = this.props,
tabBarPosition = _props2.tabBarPosition,
animated = _props2.animated;
this.startDrag = false;
if (animated) {
(0, _utils.setTransition)(this.rootNode.style, '');
}
var currentIndex = getIndexByDelta.call(this, e);
var finalIndex = this.startIndex;
if (currentIndex !== undefined) {
if (currentIndex < 0) {
finalIndex = 0;
} else if (currentIndex > this.maxIndex) {
finalIndex = this.maxIndex;
} else if (swipe) {
var delta = (0, _utils.isVertical)(tabBarPosition) ? e.deltaY : e.deltaX;
finalIndex = delta < 0 ? Math.ceil(currentIndex) : Math.floor(currentIndex);
} else {
var floorIndex = Math.floor(currentIndex);
if (currentIndex - floorIndex > 0.6) {
finalIndex = floorIndex + 1;
} else {
finalIndex = floorIndex;
}
}
}
if (this.children[finalIndex].props.disabled) {
return;
}
if (this.startIndex === finalIndex) {
if (animated) {
(0, _utils.setTransform)(this.rootNode.style, (0, _utils.getTransformByIndex)(finalIndex, this.props.tabBarPosition));
}
} else {
this.props.onChange((0, _utils.getActiveKey)(this.props.children, finalIndex));
}
},
render: function render() {
var _props3 = this.props,
tabBarPosition = _props3.tabBarPosition,
hammerOptions = _props3.hammerOptions,
animated = _props3.animated;
var direction = {};
if ((0, _utils.isVertical)(tabBarPosition)) {
direction = {
vertical: true
};
}
var events = {
onSwipe: this.onSwipe,
onPanStart: this.onPanStart
};
if (animated !== false) {
events = (0, _extends3["default"])({}, events, {
onPan: this.onPan,
onPanEnd: this.onPanEnd
});
}
return _react2["default"].createElement(
_reactHammerjs2["default"],
(0, _extends3["default"])({}, events, direction, {
options: hammerOptions
}),
_react2["default"].createElement(_TabContent2["default"], this.props)
);
}
});
exports["default"] = SwipeableTabContent;
module.exports = exports['default'];
/***/ },
/* 424 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _TabBarMixin = __webpack_require__(74);
var _TabBarMixin2 = _interopRequireDefault(_TabBarMixin);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var TabBar = _react2["default"].createClass({
displayName: 'TabBar',
mixins: [_TabBarMixin2["default"]],
render: function render() {
var tabs = this.getTabs();
return this.getRootNode(tabs);
}
});
exports["default"] = TabBar;
module.exports = exports['default'];
/***/ },
/* 425 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _defineProperty2 = __webpack_require__(6);
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _KeyCode = __webpack_require__(420);
var _KeyCode2 = _interopRequireDefault(_KeyCode);
var _TabPane = __webpack_require__(121);
var _TabPane2 = _interopRequireDefault(_TabPane);
var _classnames2 = __webpack_require__(5);
var _classnames3 = _interopRequireDefault(_classnames2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function noop() {}
function getDefaultActiveKey(props) {
var activeKey = void 0;
_react2["default"].Children.forEach(props.children, function (child) {
if (child && !activeKey && !child.props.disabled) {
activeKey = child.key;
}
});
return activeKey;
}
var Tabs = _react2["default"].createClass({
displayName: 'Tabs',
propTypes: {
destroyInactiveTabPane: _react.PropTypes.bool,
renderTabBar: _react.PropTypes.func.isRequired,
renderTabContent: _react.PropTypes.func.isRequired,
onChange: _react.PropTypes.func,
children: _react.PropTypes.any,
prefixCls: _react.PropTypes.string,
className: _react.PropTypes.string,
tabBarPosition: _react.PropTypes.string,
style: _react.PropTypes.object
},
getDefaultProps: function getDefaultProps() {
return {
prefixCls: 'rc-tabs',
destroyInactiveTabPane: false,
onChange: noop,
tabBarPosition: 'top',
style: {}
};
},
getInitialState: function getInitialState() {
var props = this.props;
var activeKey = void 0;
if ('activeKey' in props) {
activeKey = props.activeKey;
} else if ('defaultActiveKey' in props) {
activeKey = props.defaultActiveKey;
} else {
activeKey = getDefaultActiveKey(props);
}
return {
activeKey: activeKey
};
},
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
if ('activeKey' in nextProps) {
this.setState({
activeKey: nextProps.activeKey
});
}
},
onTabClick: function onTabClick(activeKey) {
if (this.tabBar.props.onTabClick) {
this.tabBar.props.onTabClick(activeKey);
}
this.setActiveKey(activeKey);
},
onNavKeyDown: function onNavKeyDown(e) {
var eventKeyCode = e.keyCode;
if (eventKeyCode === _KeyCode2["default"].RIGHT || eventKeyCode === _KeyCode2["default"].DOWN) {
e.preventDefault();
var nextKey = this.getNextActiveKey(true);
this.onTabClick(nextKey);
} else if (eventKeyCode === _KeyCode2["default"].LEFT || eventKeyCode === _KeyCode2["default"].UP) {
e.preventDefault();
var previousKey = this.getNextActiveKey(false);
this.onTabClick(previousKey);
}
},
setActiveKey: function setActiveKey(activeKey) {
if (this.state.activeKey !== activeKey) {
if (!('activeKey' in this.props)) {
this.setState({
activeKey: activeKey
});
}
this.props.onChange(activeKey);
}
},
getNextActiveKey: function getNextActiveKey(next) {
var activeKey = this.state.activeKey;
var children = [];
_react2["default"].Children.forEach(this.props.children, function (c) {
if (c && !c.props.disabled) {
if (next) {
children.push(c);
} else {
children.unshift(c);
}
}
});
var length = children.length;
var ret = length && children[0].key;
children.forEach(function (child, i) {
if (child.key === activeKey) {
if (i === length - 1) {
ret = children[0].key;
} else {
ret = children[i + 1].key;
}
}
});
return ret;
},
render: function render() {
var _classnames;
var props = this.props;
var prefixCls = props.prefixCls,
tabBarPosition = props.tabBarPosition,
className = props.className,
renderTabContent = props.renderTabContent,
renderTabBar = props.renderTabBar;
var cls = (0, _classnames3["default"])((_classnames = {}, (0, _defineProperty3["default"])(_classnames, prefixCls, 1), (0, _defineProperty3["default"])(_classnames, prefixCls + '-' + tabBarPosition, 1), (0, _defineProperty3["default"])(_classnames, className, !!className), _classnames));
this.tabBar = renderTabBar();
var contents = [_react2["default"].cloneElement(this.tabBar, {
prefixCls: prefixCls,
key: 'tabBar',
onKeyDown: this.onNavKeyDown,
tabBarPosition: tabBarPosition,
onTabClick: this.onTabClick,
panels: props.children,
activeKey: this.state.activeKey
}), _react2["default"].cloneElement(renderTabContent(), {
prefixCls: prefixCls,
tabBarPosition: tabBarPosition,
activeKey: this.state.activeKey,
destroyInactiveTabPane: props.destroyInactiveTabPane,
children: props.children,
onChange: this.setActiveKey,
key: 'tabContent'
})];
if (tabBarPosition === 'bottom') {
contents.reverse();
}
return _react2["default"].createElement(
'div',
{
className: cls,
style: props.style
},
contents
);
}
});
Tabs.TabPane = _TabPane2["default"];
exports["default"] = Tabs;
module.exports = exports['default'];
/***/ },
/* 426 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = __webpack_require__(7);
var _extends3 = _interopRequireDefault(_extends2);
var _objectWithoutProperties2 = __webpack_require__(18);
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
var _classCallCheck2 = __webpack_require__(2);
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _possibleConstructorReturn2 = __webpack_require__(4);
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = __webpack_require__(3);
var _inherits3 = _interopRequireDefault(_inherits2);
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__(9);
var _propTypes2 = _interopRequireDefault(_propTypes);
var _rcTrigger = __webpack_require__(431);
var _rcTrigger2 = _interopRequireDefault(_rcTrigger);
var _placements = __webpack_require__(427);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var Tooltip = function (_Component) {
(0, _inherits3["default"])(Tooltip, _Component);
function Tooltip() {
var _temp, _this, _ret;
(0, _classCallCheck3["default"])(this, Tooltip);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3["default"])(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.getPopupElement = function () {
var _this$props = _this.props,
arrowContent = _this$props.arrowContent,
overlay = _this$props.overlay,
prefixCls = _this$props.prefixCls;
return [_react2["default"].createElement(
'div',
{ className: prefixCls + '-arrow', key: 'arrow' },
arrowContent
), _react2["default"].createElement(
'div',
{ className: prefixCls + '-inner', key: 'content' },
typeof overlay === 'function' ? overlay() : overlay
)];
}, _temp), (0, _possibleConstructorReturn3["default"])(_this, _ret);
}
Tooltip.prototype.getPopupDomNode = function getPopupDomNode() {
return this.refs.trigger.getPopupDomNode();
};
Tooltip.prototype.render = function render() {
var _props = this.props,
overlayClassName = _props.overlayClassName,
trigger = _props.trigger,
mouseEnterDelay = _props.mouseEnterDelay,
mouseLeaveDelay = _props.mouseLeaveDelay,
overlayStyle = _props.overlayStyle,
prefixCls = _props.prefixCls,
children = _props.children,
onVisibleChange = _props.onVisibleChange,
transitionName = _props.transitionName,
animation = _props.animation,
placement = _props.placement,
align = _props.align,
destroyTooltipOnHide = _props.destroyTooltipOnHide,
defaultVisible = _props.defaultVisible,
getTooltipContainer = _props.getTooltipContainer,
restProps = (0, _objectWithoutProperties3["default"])(_props, ['overlayClassName', 'trigger', 'mouseEnterDelay', 'mouseLeaveDelay', 'overlayStyle', 'prefixCls', 'children', 'onVisibleChange', 'transitionName', 'animation', 'placement', 'align', 'destroyTooltipOnHide', 'defaultVisible', 'getTooltipContainer']);
var extraProps = (0, _extends3["default"])({}, restProps);
if ('visible' in this.props) {
extraProps.popupVisible = this.props.visible;
}
return _react2["default"].createElement(
_rcTrigger2["default"],
(0, _extends3["default"])({
popupClassName: overlayClassName,
ref: 'trigger',
prefixCls: prefixCls,
popup: this.getPopupElement,
action: trigger,
builtinPlacements: _placements.placements,
popupPlacement: placement,
popupAlign: align,
getPopupContainer: getTooltipContainer,
onPopupVisibleChange: onVisibleChange,
popupTransitionName: transitionName,
popupAnimation: animation,
defaultPopupVisible: defaultVisible,
destroyPopupOnHide: destroyTooltipOnHide,
mouseLeaveDelay: mouseLeaveDelay,
popupStyle: overlayStyle,
mouseEnterDelay: mouseEnterDelay
}, extraProps),
children
);
};
return Tooltip;
}(_react.Component);
Tooltip.propTypes = {
trigger: _propTypes2["default"].any,
children: _propTypes2["default"].any,
defaultVisible: _propTypes2["default"].bool,
visible: _propTypes2["default"].bool,
placement: _propTypes2["default"].string,
transitionName: _propTypes2["default"].string,
animation: _propTypes2["default"].any,
onVisibleChange: _propTypes2["default"].func,
afterVisibleChange: _propTypes2["default"].func,
overlay: _propTypes2["default"].oneOfType([_propTypes2["default"].node, _propTypes2["default"].func]).isRequired,
overlayStyle: _propTypes2["default"].object,
overlayClassName: _propTypes2["default"].string,
prefixCls: _propTypes2["default"].string,
mouseEnterDelay: _propTypes2["default"].number,
mouseLeaveDelay: _propTypes2["default"].number,
getTooltipContainer: _propTypes2["default"].func,
destroyTooltipOnHide: _propTypes2["default"].bool,
align: _propTypes2["default"].object,
arrowContent: _propTypes2["default"].any
};
Tooltip.defaultProps = {
prefixCls: 'rc-tooltip',
mouseEnterDelay: 0,
destroyTooltipOnHide: false,
mouseLeaveDelay: 0.1,
align: {},
placement: 'right',
trigger: ['hover'],
arrowContent: null
};
exports["default"] = Tooltip;
module.exports = exports['default'];
/***/ },
/* 427 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var autoAdjustOverflow = {
adjustX: 1,
adjustY: 1
};
var targetOffset = [0, 0];
var placements = exports.placements = {
left: {
points: ['cr', 'cl'],
overflow: autoAdjustOverflow,
offset: [-4, 0],
targetOffset: targetOffset
},
right: {
points: ['cl', 'cr'],
overflow: autoAdjustOverflow,
offset: [4, 0],
targetOffset: targetOffset
},
top: {
points: ['bc', 'tc'],
overflow: autoAdjustOverflow,
offset: [0, -4],
targetOffset: targetOffset
},
bottom: {
points: ['tc', 'bc'],
overflow: autoAdjustOverflow,
offset: [0, 4],
targetOffset: targetOffset
},
topLeft: {
points: ['bl', 'tl'],
overflow: autoAdjustOverflow,
offset: [0, -4],
targetOffset: targetOffset
},
leftTop: {
points: ['tr', 'tl'],
overflow: autoAdjustOverflow,
offset: [-4, 0],
targetOffset: targetOffset
},
topRight: {
points: ['br', 'tr'],
overflow: autoAdjustOverflow,
offset: [0, -4],
targetOffset: targetOffset
},
rightTop: {
points: ['tl', 'tr'],
overflow: autoAdjustOverflow,
offset: [4, 0],
targetOffset: targetOffset
},
bottomRight: {
points: ['tr', 'br'],
overflow: autoAdjustOverflow,
offset: [0, 4],
targetOffset: targetOffset
},
rightBottom: {
points: ['bl', 'br'],
overflow: autoAdjustOverflow,
offset: [4, 0],
targetOffset: targetOffset
},
bottomLeft: {
points: ['tl', 'bl'],
overflow: autoAdjustOverflow,
offset: [0, 4],
targetOffset: targetOffset
},
leftBottom: {
points: ['br', 'bl'],
overflow: autoAdjustOverflow,
offset: [-4, 0],
targetOffset: targetOffset
}
};
exports["default"] = placements;
/***/ },
/* 428 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = __webpack_require__(7);
var _extends3 = _interopRequireDefault(_extends2);
var _classCallCheck2 = __webpack_require__(2);
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _possibleConstructorReturn2 = __webpack_require__(4);
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = __webpack_require__(3);
var _inherits3 = _interopRequireDefault(_inherits2);
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__(9);
var _propTypes2 = _interopRequireDefault(_propTypes);
var _reactDom = __webpack_require__(10);
var _reactDom2 = _interopRequireDefault(_reactDom);
var _rcAlign = __webpack_require__(375);
var _rcAlign2 = _interopRequireDefault(_rcAlign);
var _rcAnimate = __webpack_require__(47);
var _rcAnimate2 = _interopRequireDefault(_rcAnimate);
var _PopupInner = __webpack_require__(429);
var _PopupInner2 = _interopRequireDefault(_PopupInner);
var _LazyRenderBox = __webpack_require__(124);
var _LazyRenderBox2 = _interopRequireDefault(_LazyRenderBox);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var Popup = function (_Component) {
(0, _inherits3["default"])(Popup, _Component);
function Popup() {
var _temp, _this, _ret;
(0, _classCallCheck3["default"])(this, Popup);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3["default"])(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.onAlign = function (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);
}
props.onAlign(popupDomNode, align);
}, _this.getTarget = function () {
return _this.props.getRootDomNode();
}, _this.saveAlign = function (align) {
_this.alignInstance = align;
}, _temp), (0, _possibleConstructorReturn3["default"])(_this, _ret);
}
Popup.prototype.componentDidMount = function componentDidMount() {
this.rootNode = this.getPopupDomNode();
};
Popup.prototype.getPopupDomNode = function getPopupDomNode() {
return _reactDom2["default"].findDOMNode(this.refs.popup);
};
Popup.prototype.getMaskTransitionName = function getMaskTransitionName() {
var props = this.props;
var transitionName = props.maskTransitionName;
var animation = props.maskAnimation;
if (!transitionName && animation) {
transitionName = props.prefixCls + '-' + animation;
}
return transitionName;
};
Popup.prototype.getTransitionName = function getTransitionName() {
var props = this.props;
var transitionName = props.transitionName;
if (!transitionName && props.animation) {
transitionName = props.prefixCls + '-' + props.animation;
}
return transitionName;
};
Popup.prototype.getClassName = function getClassName(currentAlignClassName) {
return this.props.prefixCls + ' ' + this.props.className + ' ' + currentAlignClassName;
};
Popup.prototype.getPopupElement = function getPopupElement() {
var props = this.props;
var align = props.align,
style = props.style,
visible = props.visible,
prefixCls = props.prefixCls,
destroyPopupOnHide = props.destroyPopupOnHide;
var className = this.getClassName(this.currentAlignClassName || props.getClassNameFromAlign(align));
var hiddenClassName = prefixCls + '-hidden';
if (!visible) {
this.currentAlignClassName = null;
}
var newStyle = (0, _extends3["default"])({}, style, this.getZIndexStyle());
var popupInnerProps = {
className: className,
prefixCls: prefixCls,
ref: 'popup',
onMouseEnter: props.onMouseEnter,
onMouseLeave: props.onMouseLeave,
style: newStyle
};
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',
ref: this.saveAlign,
monitorWindowResize: true,
align: align,
onAlign: this.onAlign
},
_react2["default"].createElement(
_PopupInner2["default"],
(0, _extends3["default"])({
visible: true
}, popupInnerProps),
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',
ref: this.saveAlign,
monitorWindowResize: true,
xVisible: visible,
childrenProps: { visible: 'xVisible' },
disabled: !visible,
align: align,
onAlign: this.onAlign
},
_react2["default"].createElement(
_PopupInner2["default"],
(0, _extends3["default"])({
hiddenClassName: hiddenClassName
}, popupInnerProps),
props.children
)
)
);
};
Popup.prototype.getZIndexStyle = function getZIndexStyle() {
var style = {};
var props = this.props;
if (props.zIndex !== undefined) {
style.zIndex = props.zIndex;
}
return style;
};
Popup.prototype.getMaskElement = function getMaskElement() {
var props = this.props;
var maskElement = void 0;
if (props.mask) {
var maskTransition = this.getMaskTransitionName();
maskElement = _react2["default"].createElement(_LazyRenderBox2["default"], {
style: this.getZIndexStyle(),
key: 'mask',
className: props.prefixCls + '-mask',
hiddenClassName: props.prefixCls + '-mask-hidden',
visible: props.visible
});
if (maskTransition) {
maskElement = _react2["default"].createElement(
_rcAnimate2["default"],
{
key: 'mask',
showProp: 'visible',
transitionAppear: true,
component: '',
transitionName: maskTransition
},
maskElement
);
}
}
return maskElement;
};
Popup.prototype.render = function render() {
return _react2["default"].createElement(
'div',
null,
this.getMaskElement(),
this.getPopupElement()
);
};
return Popup;
}(_react.Component);
Popup.propTypes = {
visible: _propTypes2["default"].bool,
style: _propTypes2["default"].object,
getClassNameFromAlign: _propTypes2["default"].func,
onAlign: _propTypes2["default"].func,
getRootDomNode: _propTypes2["default"].func,
onMouseEnter: _propTypes2["default"].func,
align: _propTypes2["default"].any,
destroyPopupOnHide: _propTypes2["default"].bool,
className: _propTypes2["default"].string,
prefixCls: _propTypes2["default"].string,
onMouseLeave: _propTypes2["default"].func
};
exports["default"] = Popup;
module.exports = exports['default'];
/***/ },
/* 429 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _classCallCheck2 = __webpack_require__(2);
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _possibleConstructorReturn2 = __webpack_require__(4);
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = __webpack_require__(3);
var _inherits3 = _interopRequireDefault(_inherits2);
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__(9);
var _propTypes2 = _interopRequireDefault(_propTypes);
var _LazyRenderBox = __webpack_require__(124);
var _LazyRenderBox2 = _interopRequireDefault(_LazyRenderBox);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var PopupInner = function (_Component) {
(0, _inherits3["default"])(PopupInner, _Component);
function PopupInner() {
(0, _classCallCheck3["default"])(this, PopupInner);
return (0, _possibleConstructorReturn3["default"])(this, _Component.apply(this, arguments));
}
PopupInner.prototype.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
},
_react2["default"].createElement(
_LazyRenderBox2["default"],
{ className: props.prefixCls + '-content', visible: props.visible },
props.children
)
);
};
return PopupInner;
}(_react.Component);
PopupInner.propTypes = {
hiddenClassName: _propTypes2["default"].string,
className: _propTypes2["default"].string,
prefixCls: _propTypes2["default"].string,
onMouseEnter: _propTypes2["default"].func,
onMouseLeave: _propTypes2["default"].func,
children: _propTypes2["default"].any
};
exports["default"] = PopupInner;
module.exports = exports['default'];
/***/ },
/* 430 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = __webpack_require__(7);
var _extends3 = _interopRequireDefault(_extends2);
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__(9);
var _propTypes2 = _interopRequireDefault(_propTypes);
var _reactDom = __webpack_require__(10);
var _createReactClass = __webpack_require__(46);
var _createReactClass2 = _interopRequireDefault(_createReactClass);
var _contains = __webpack_require__(433);
var _contains2 = _interopRequireDefault(_contains);
var _addEventListener = __webpack_require__(50);
var _addEventListener2 = _interopRequireDefault(_addEventListener);
var _Popup = __webpack_require__(428);
var _Popup2 = _interopRequireDefault(_Popup);
var _utils = __webpack_require__(432);
var _getContainerRenderMixin = __webpack_require__(125);
var _getContainerRenderMixin2 = _interopRequireDefault(_getContainerRenderMixin);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function noop() {}
function returnEmptyString() {
return '';
}
function returnDocument() {
return window.document;
}
var ALL_HANDLERS = ['onClick', 'onMouseDown', 'onTouchStart', 'onMouseEnter', 'onMouseLeave', 'onFocus', 'onBlur'];
var Trigger = (0, _createReactClass2["default"])({
displayName: 'Trigger',
propTypes: {
children: _propTypes2["default"].any,
action: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].arrayOf(_propTypes2["default"].string)]),
showAction: _propTypes2["default"].any,
hideAction: _propTypes2["default"].any,
getPopupClassNameFromAlign: _propTypes2["default"].any,
onPopupVisibleChange: _propTypes2["default"].func,
afterPopupVisibleChange: _propTypes2["default"].func,
popup: _propTypes2["default"].oneOfType([_propTypes2["default"].node, _propTypes2["default"].func]).isRequired,
popupStyle: _propTypes2["default"].object,
prefixCls: _propTypes2["default"].string,
popupClassName: _propTypes2["default"].string,
popupPlacement: _propTypes2["default"].string,
builtinPlacements: _propTypes2["default"].object,
popupTransitionName: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].object]),
popupAnimation: _propTypes2["default"].any,
mouseEnterDelay: _propTypes2["default"].number,
mouseLeaveDelay: _propTypes2["default"].number,
zIndex: _propTypes2["default"].number,
focusDelay: _propTypes2["default"].number,
blurDelay: _propTypes2["default"].number,
getPopupContainer: _propTypes2["default"].func,
getDocument: _propTypes2["default"].func,
destroyPopupOnHide: _propTypes2["default"].bool,
mask: _propTypes2["default"].bool,
maskClosable: _propTypes2["default"].bool,
onPopupAlign: _propTypes2["default"].func,
popupAlign: _propTypes2["default"].object,
popupVisible: _propTypes2["default"].bool,
maskTransitionName: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].object]),
maskAnimation: _propTypes2["default"].string
},
mixins: [(0, _getContainerRenderMixin2["default"])({
autoMount: false,
isVisible: function isVisible(instance) {
return instance.state.popupVisible;
},
getContainer: function getContainer(instance) {
var props = instance.props;
var popupContainer = document.createElement('div');
// Make sure default popup container will never cause scrollbar appearing
// https://github.com/react-component/trigger/issues/41
popupContainer.style.position = 'absolute';
popupContainer.style.top = '0';
popupContainer.style.left = '0';
popupContainer.style.width = '100%';
var mountNode = props.getPopupContainer ? props.getPopupContainer((0, _reactDom.findDOMNode)(instance)) : props.getDocument().body;
mountNode.appendChild(popupContainer);
return popupContainer;
}
})],
getDefaultProps: function getDefaultProps() {
return {
prefixCls: 'rc-trigger-popup',
getPopupClassNameFromAlign: returnEmptyString,
getDocument: returnDocument,
onPopupVisibleChange: noop,
afterPopupVisibleChange: noop,
onPopupAlign: noop,
popupClassName: '',
mouseEnterDelay: 0,
mouseLeaveDelay: 0.1,
focusDelay: 0,
blurDelay: 0.15,
popupStyle: {},
destroyPopupOnHide: false,
popupAlign: {},
defaultPopupVisible: false,
mask: false,
maskClosable: true,
action: [],
showAction: [],
hideAction: []
};
},
getInitialState: function getInitialState() {
var props = this.props;
var popupVisible = void 0;
if ('popupVisible' in props) {
popupVisible = !!props.popupVisible;
} else {
popupVisible = !!props.defaultPopupVisible;
}
return {
popupVisible: popupVisible
};
},
componentWillMount: function componentWillMount() {
var _this = this;
ALL_HANDLERS.forEach(function (h) {
_this['fire' + h] = function (e) {
_this.fireEvents(h, e);
};
});
},
componentDidMount: function componentDidMount() {
this.componentDidUpdate({}, {
popupVisible: this.state.popupVisible
});
},
componentWillReceiveProps: function componentWillReceiveProps(_ref) {
var popupVisible = _ref.popupVisible;
if (popupVisible !== undefined) {
this.setState({
popupVisible: popupVisible
});
}
},
componentDidUpdate: function componentDidUpdate(_, prevState) {
var props = this.props;
var state = this.state;
this.renderComponent(null, function () {
if (prevState.popupVisible !== state.popupVisible) {
props.afterPopupVisibleChange(state.popupVisible);
}
});
if (state.popupVisible) {
var currentDocument = void 0;
if (!this.clickOutsideHandler && this.isClickToHide()) {
currentDocument = props.getDocument();
this.clickOutsideHandler = (0, _addEventListener2["default"])(currentDocument, 'mousedown', this.onDocumentClick);
}
// always hide on mobile
if (!this.touchOutsideHandler) {
currentDocument = currentDocument || props.getDocument();
this.touchOutsideHandler = (0, _addEventListener2["default"])(currentDocument, 'touchstart', this.onDocumentClick);
}
return;
}
this.clearOutsideHandler();
},
componentWillUnmount: function componentWillUnmount() {
this.clearDelayTimer();
this.clearOutsideHandler();
},
onMouseEnter: function onMouseEnter(e) {
this.fireEvents('onMouseEnter', e);
this.delaySetPopupVisible(true, this.props.mouseEnterDelay);
},
onMouseLeave: function onMouseLeave(e) {
this.fireEvents('onMouseLeave', e);
this.delaySetPopupVisible(false, this.props.mouseLeaveDelay);
},
onPopupMouseEnter: function onPopupMouseEnter() {
this.clearDelayTimer();
},
onPopupMouseLeave: function onPopupMouseLeave(e) {
// https://github.com/react-component/trigger/pull/13
// react bug?
if (e.relatedTarget && !e.relatedTarget.setTimeout && this._component && (0, _contains2["default"])(this._component.getPopupDomNode(), e.relatedTarget)) {
return;
}
this.delaySetPopupVisible(false, this.props.mouseLeaveDelay);
},
onFocus: function onFocus(e) {
this.fireEvents('onFocus', e);
// incase focusin and focusout
this.clearDelayTimer();
if (this.isFocusToShow()) {
this.focusTime = Date.now();
this.delaySetPopupVisible(true, this.props.focusDelay);
}
},
onMouseDown: function onMouseDown(e) {
this.fireEvents('onMouseDown', e);
this.preClickTime = Date.now();
},
onTouchStart: function onTouchStart(e) {
this.fireEvents('onTouchStart', e);
this.preTouchTime = Date.now();
},
onBlur: function onBlur(e) {
this.fireEvents('onBlur', e);
this.clearDelayTimer();
if (this.isBlurToHide()) {
this.delaySetPopupVisible(false, this.props.blurDelay);
}
},
onClick: function onClick(event) {
this.fireEvents('onClick', event);
// focus will trigger click
if (this.focusTime) {
var preTime = void 0;
if (this.preClickTime && this.preTouchTime) {
preTime = Math.min(this.preClickTime, this.preTouchTime);
} else if (this.preClickTime) {
preTime = this.preClickTime;
} else if (this.preTouchTime) {
preTime = this.preTouchTime;
}
if (Math.abs(preTime - this.focusTime) < 20) {
return;
}
this.focusTime = 0;
}
this.preClickTime = 0;
this.preTouchTime = 0;
event.preventDefault();
var nextVisible = !this.state.popupVisible;
if (this.isClickToHide() && !nextVisible || nextVisible && this.isClickToShow()) {
this.setPopupVisible(!this.state.popupVisible);
}
},
onDocumentClick: function onDocumentClick(event) {
if (this.props.mask && !this.props.maskClosable) {
return;
}
var target = event.target;
var root = (0, _reactDom.findDOMNode)(this);
var popupNode = this.getPopupDomNode();
if (!(0, _contains2["default"])(root, target) && !(0, _contains2["default"])(popupNode, target)) {
this.close();
}
},
getPopupDomNode: function getPopupDomNode() {
// for test
if (this._component && this._component.getPopupDomNode) {
return this._component.getPopupDomNode();
}
return null;
},
getRootDomNode: function getRootDomNode() {
return (0, _reactDom.findDOMNode)(this);
},
getPopupClassNameFromAlign: function getPopupClassNameFromAlign(align) {
var className = [];
var props = this.props;
var popupPlacement = props.popupPlacement,
builtinPlacements = props.builtinPlacements,
prefixCls = props.prefixCls;
if (popupPlacement && builtinPlacements) {
className.push((0, _utils.getPopupClassNameFromAlign)(builtinPlacements, prefixCls, align));
}
if (props.getPopupClassNameFromAlign) {
className.push(props.getPopupClassNameFromAlign(align));
}
return className.join(' ');
},
getPopupAlign: function getPopupAlign() {
var props = this.props;
var popupPlacement = props.popupPlacement,
popupAlign = props.popupAlign,
builtinPlacements = props.builtinPlacements;
if (popupPlacement && builtinPlacements) {
return (0, _utils.getAlignFromPlacement)(builtinPlacements, popupPlacement, popupAlign);
}
return popupAlign;
},
getComponent: function getComponent() {
var props = this.props,
state = this.state;
var mouseProps = {};
if (this.isMouseEnterToShow()) {
mouseProps.onMouseEnter = this.onPopupMouseEnter;
}
if (this.isMouseLeaveToHide()) {
mouseProps.onMouseLeave = this.onPopupMouseLeave;
}
return _react2["default"].createElement(
_Popup2["default"],
(0, _extends3["default"])({
prefixCls: props.prefixCls,
destroyPopupOnHide: props.destroyPopupOnHide,
visible: state.popupVisible,
className: props.popupClassName,
action: props.action,
align: this.getPopupAlign(),
onAlign: props.onPopupAlign,
animation: props.popupAnimation,
getClassNameFromAlign: this.getPopupClassNameFromAlign
}, mouseProps, {
getRootDomNode: this.getRootDomNode,
style: props.popupStyle,
mask: props.mask,
zIndex: props.zIndex,
transitionName: props.popupTransitionName,
maskAnimation: props.maskAnimation,
maskTransitionName: props.maskTransitionName
}),
typeof props.popup === 'function' ? props.popup() : props.popup
);
},
setPopupVisible: function setPopupVisible(popupVisible) {
this.clearDelayTimer();
if (this.state.popupVisible !== popupVisible) {
if (!('popupVisible' in this.props)) {
this.setState({
popupVisible: popupVisible
});
}
this.props.onPopupVisibleChange(popupVisible);
}
},
delaySetPopupVisible: function delaySetPopupVisible(visible, delayS) {
var _this2 = this;
var delay = delayS * 1000;
this.clearDelayTimer();
if (delay) {
this.delayTimer = setTimeout(function () {
_this2.setPopupVisible(visible);
_this2.clearDelayTimer();
}, delay);
} else {
this.setPopupVisible(visible);
}
},
clearDelayTimer: function clearDelayTimer() {
if (this.delayTimer) {
clearTimeout(this.delayTimer);
this.delayTimer = null;
}
},
clearOutsideHandler: function clearOutsideHandler() {
if (this.clickOutsideHandler) {
this.clickOutsideHandler.remove();
this.clickOutsideHandler = null;
}
if (this.touchOutsideHandler) {
this.touchOutsideHandler.remove();
this.touchOutsideHandler = null;
}
},
createTwoChains: function createTwoChains(event) {
var childPros = this.props.children.props;
var props = this.props;
if (childPros[event] && props[event]) {
return this['fire' + event];
}
return childPros[event] || props[event];
},
isClickToShow: function isClickToShow() {
var _props = this.props,
action = _props.action,
showAction = _props.showAction;
return action.indexOf('click') !== -1 || showAction.indexOf('click') !== -1;
},
isClickToHide: function isClickToHide() {
var _props2 = this.props,
action = _props2.action,
hideAction = _props2.hideAction;
return action.indexOf('click') !== -1 || hideAction.indexOf('click') !== -1;
},
isMouseEnterToShow: function isMouseEnterToShow() {
var _props3 = this.props,
action = _props3.action,
showAction = _props3.showAction;
return action.indexOf('hover') !== -1 || showAction.indexOf('mouseEnter') !== -1;
},
isMouseLeaveToHide: function isMouseLeaveToHide() {
var _props4 = this.props,
action = _props4.action,
hideAction = _props4.hideAction;
return action.indexOf('hover') !== -1 || hideAction.indexOf('mouseLeave') !== -1;
},
isFocusToShow: function isFocusToShow() {
var _props5 = this.props,
action = _props5.action,
showAction = _props5.showAction;
return action.indexOf('focus') !== -1 || showAction.indexOf('focus') !== -1;
},
isBlurToHide: function isBlurToHide() {
var _props6 = this.props,
action = _props6.action,
hideAction = _props6.hideAction;
return action.indexOf('focus') !== -1 || hideAction.indexOf('blur') !== -1;
},
forcePopupAlign: function forcePopupAlign() {
if (this.state.popupVisible && this.popupInstance && this.popupInstance.alignInstance) {
this.popupInstance.alignInstance.forceAlign();
}
},
fireEvents: function fireEvents(type, e) {
var childCallback = this.props.children.props[type];
if (childCallback) {
childCallback(e);
}
var callback = this.props[type];
if (callback) {
callback(e);
}
},
close: function close() {
this.setPopupVisible(false);
},
render: function render() {
var props = this.props;
var children = props.children;
var child = _react2["default"].Children.only(children);
var newChildProps = {};
if (this.isClickToHide() || this.isClickToShow()) {
newChildProps.onClick = this.onClick;
newChildProps.onMouseDown = this.onMouseDown;
newChildProps.onTouchStart = this.onTouchStart;
} else {
newChildProps.onClick = this.createTwoChains('onClick');
newChildProps.onMouseDown = this.createTwoChains('onMouseDown');
newChildProps.onTouchStart = this.createTwoChains('onTouchStart');
}
if (this.isMouseEnterToShow()) {
newChildProps.onMouseEnter = this.onMouseEnter;
} else {
newChildProps.onMouseEnter = this.createTwoChains('onMouseEnter');
}
if (this.isMouseLeaveToHide()) {
newChildProps.onMouseLeave = this.onMouseLeave;
} else {
newChildProps.onMouseLeave = this.createTwoChains('onMouseLeave');
}
if (this.isFocusToShow() || this.isBlurToHide()) {
newChildProps.onFocus = this.onFocus;
newChildProps.onBlur = this.onBlur;
} else {
newChildProps.onFocus = this.createTwoChains('onFocus');
newChildProps.onBlur = this.createTwoChains('onBlur');
}
return _react2["default"].cloneElement(child, newChildProps);
}
});
exports["default"] = Trigger;
module.exports = exports['default'];
/***/ },
/* 431 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
module.exports = __webpack_require__(430);
/***/ },
/* 432 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = __webpack_require__(7);
var _extends3 = _interopRequireDefault(_extends2);
exports.getAlignFromPlacement = getAlignFromPlacement;
exports.getPopupClassNameFromAlign = getPopupClassNameFromAlign;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function isPointsEq(a1, a2) {
return a1[0] === a2[0] && a1[1] === a2[1];
}
function getAlignFromPlacement(builtinPlacements, placementStr, align) {
var baseAlign = builtinPlacements[placementStr] || {};
return (0, _extends3["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 '';
}
/***/ },
/* 433 */
/***/ function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = contains;
function contains(root, n) {
var node = n;
while (node) {
if (node === root) {
return true;
}
node = node.parentNode;
}
return false;
}
module.exports = exports['default'];
/***/ },
/* 434 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
/**
* @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
*/
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;
}
};
exports["default"] = KeyCode;
module.exports = exports['default'];
/***/ },
/* 435 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
/**
* Copyright 2013-present, 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
*/
var shallowEqual = __webpack_require__(52);
function shallowCompare(instance, nextProps, nextState) {
return !shallowEqual(instance.props, nextProps) || !shallowEqual(instance.state, nextState);
}
/**
* 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.
*
* See https://facebook.github.io/react/docs/pure-render-mixin.html
*/
var ReactComponentWithPureRenderMixin = {
shouldComponentUpdate: function shouldComponentUpdate(nextProps, nextState) {
return shallowCompare(this, nextProps, nextState);
}
};
module.exports = ReactComponentWithPureRenderMixin;
/***/ },
/* 436 */
/***/ function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = createChainedFunction;
/**
* 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 = [].slice.call(arguments, 0);
if (args.length === 1) {
return args[0];
}
return function chainedFunction() {
for (var i = 0; i < args.length; i++) {
if (args[i] && args[i].apply) {
args[i].apply(this, arguments);
}
}
};
}
module.exports = exports['default'];
/***/ },
/* 437 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = getScrollBarSize;
var cached = void 0;
function getScrollBarSize(fresh) {
if (fresh || cached === undefined) {
var inner = document.createElement('div');
inner.style.width = '100%';
inner.style.height = '200px';
var outer = document.createElement('div');
var outerStyle = outer.style;
outerStyle.position = 'absolute';
outerStyle.top = 0;
outerStyle.left = 0;
outerStyle.pointerEvents = 'none';
outerStyle.visibility = 'hidden';
outerStyle.width = '200px';
outerStyle.height = '150px';
outerStyle.overflow = 'hidden';
outer.appendChild(inner);
document.body.appendChild(outer);
var widthContained = inner.offsetWidth;
outer.style.overflow = 'scroll';
var widthScroll = inner.offsetWidth;
if (widthContained === widthScroll) {
widthScroll = outer.clientWidth;
}
document.body.removeChild(outer);
cached = widthContained - widthScroll;
}
return cached;
}
module.exports = exports['default'];
/***/ },
/* 438 */
/***/ function(module, exports, __webpack_require__) {
var mixin = __webpack_require__(460);
var assign = __webpack_require__(12);
var mixinProto = mixin({
// lifecycle stuff is as you'd expect
componentDidMount: mixin.MANY,
componentWillMount: mixin.MANY,
componentWillReceiveProps: mixin.MANY,
shouldComponentUpdate: mixin.ONCE,
componentWillUpdate: mixin.MANY,
componentDidUpdate: mixin.MANY,
componentWillUnmount: mixin.MANY,
getChildContext: mixin.MANY_MERGED
});
function setDefaultProps(reactMixin) {
var getDefaultProps = reactMixin.getDefaultProps;
if (getDefaultProps) {
reactMixin.defaultProps = getDefaultProps();
delete reactMixin.getDefaultProps;
}
}
function setInitialState(reactMixin) {
var getInitialState = reactMixin.getInitialState;
var componentWillMount = reactMixin.componentWillMount;
function applyInitialState(instance) {
var state = instance.state || {};
assign(state, getInitialState.call(instance));
instance.state = state;
}
if (getInitialState) {
if (!componentWillMount) {
reactMixin.componentWillMount = function() {
applyInitialState(this);
};
} else {
reactMixin.componentWillMount = function() {
applyInitialState(this);
componentWillMount.call(this);
};
}
delete reactMixin.getInitialState;
}
}
function mixinClass(reactClass, reactMixin) {
setDefaultProps(reactMixin);
setInitialState(reactMixin);
var prototypeMethods = {};
var staticProps = {};
Object.keys(reactMixin).forEach(function(key) {
if (key === 'mixins') {
return; // Handled below to ensure proper order regardless of property iteration order
}
if (key === 'statics') {
return; // gets special handling
} else if (typeof reactMixin[key] === 'function') {
prototypeMethods[key] = reactMixin[key];
} else {
staticProps[key] = reactMixin[key];
}
});
mixinProto(reactClass.prototype, prototypeMethods);
var mergePropTypes = function(left, right, key) {
if (!left) return right;
if (!right) return left;
var result = {};
Object.keys(left).forEach(function(leftKey) {
if (!right[leftKey]) {
result[leftKey] = left[leftKey];
}
});
Object.keys(right).forEach(function(rightKey) {
if (left[rightKey]) {
result[rightKey] = function checkBothContextTypes() {
return right[rightKey].apply(this, arguments) && left[rightKey].apply(this, arguments);
};
} else {
result[rightKey] = right[rightKey];
}
});
return result;
};
mixin({
childContextTypes: mergePropTypes,
contextTypes: mergePropTypes,
propTypes: mixin.MANY_MERGED_LOOSE,
defaultProps: mixin.MANY_MERGED_LOOSE
})(reactClass, staticProps);
// statics is a special case because it merges directly onto the class
if (reactMixin.statics) {
Object.getOwnPropertyNames(reactMixin.statics).forEach(function(key) {
var left = reactClass[key];
var right = reactMixin.statics[key];
if (left !== undefined && right !== undefined) {
throw new TypeError('Cannot mixin statics because statics.' + key + ' and Component.' + key + ' are defined.');
}
reactClass[key] = left !== undefined ? left : right;
});
}
// If more mixins are defined, they need to run. This emulate's react's behavior.
// See behavior in code at:
// https://github.com/facebook/react/blob/41aa3496aa632634f650edbe10d617799922d265/src/isomorphic/classic/class/ReactClass.js#L468
// Note the .reverse(). In React, a fresh constructor is created, then all mixins are mixed in recursively,
// then the actual spec is mixed in last.
//
// With ES6 classes, the properties are already there, so smart-mixin mixes functions (a, b) -> b()a(), which is
// the opposite of how React does it. If we reverse this array, we basically do the whole logic in reverse,
// which makes the result the same. See the test for more.
// See also:
// https://github.com/facebook/react/blob/41aa3496aa632634f650edbe10d617799922d265/src/isomorphic/classic/class/ReactClass.js#L853
if (reactMixin.mixins) {
reactMixin.mixins.reverse().forEach(mixinClass.bind(null, reactClass));
}
return reactClass;
}
module.exports = (function() {
var reactMixin = mixinProto;
reactMixin.onClass = function(reactClass, mixin) {
// we mutate the mixin so let's clone it
mixin = assign({}, mixin);
return mixinClass(reactClass, mixin);
};
reactMixin.decorate = function(mixin) {
return function(reactClass) {
return reactMixin.onClass(reactClass, mixin);
};
};
return reactMixin;
})();
/***/ },
/* 439 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__(9);
var _propTypes2 = _interopRequireDefault(_propTypes);
var _reactDom = __webpack_require__(10);
var _reactDom2 = _interopRequireDefault(_reactDom);
var _channel = __webpack_require__(126);
var _channel2 = _interopRequireDefault(_channel);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var Container = function (_React$Component) {
_inherits(Container, _React$Component);
function Container(props) {
_classCallCheck(this, Container);
var _this = _possibleConstructorReturn(this, (Container.__proto__ || Object.getPrototypeOf(Container)).call(this, props));
_this.updateOffset = function (_ref) {
var inherited = _ref.inherited,
offset = _ref.offset;
_this.channel.update(function (data) {
data.inherited = inherited + offset;
});
};
_this.channel = new _channel2.default({ inherited: 0, offset: 0, node: null });
return _this;
}
_createClass(Container, [{
key: 'getChildContext',
value: function getChildContext() {
return { 'sticky-channel': this.channel };
}
}, {
key: 'componentWillMount',
value: function componentWillMount() {
var parentChannel = this.context['sticky-channel'];
if (parentChannel) parentChannel.subscribe(this.updateOffset);
}
}, {
key: 'componentDidMount',
value: function componentDidMount() {
var node = _reactDom2.default.findDOMNode(this);
this.channel.update(function (data) {
data.node = node;
});
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
this.channel.update(function (data) {
data.node = null;
});
var parentChannel = this.context['sticky-channel'];
if (parentChannel) parentChannel.unsubscribe(this.updateOffset);
}
}, {
key: 'render',
value: function render() {
return _react2.default.createElement(
'div',
this.props,
this.props.children
);
}
}]);
return Container;
}(_react2.default.Component);
Container.contextTypes = {
'sticky-channel': _propTypes2.default.any
};
Container.childContextTypes = {
'sticky-channel': _propTypes2.default.any
};
exports.default = Container;
module.exports = exports['default'];
/***/ },
/* 440 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Channel = exports.StickyContainer = exports.Sticky = undefined;
var _sticky = __webpack_require__(441);
var _sticky2 = _interopRequireDefault(_sticky);
var _container = __webpack_require__(439);
var _container2 = _interopRequireDefault(_container);
var _channel = __webpack_require__(126);
var _channel2 = _interopRequireDefault(_channel);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.Sticky = _sticky2.default;
exports.StickyContainer = _container2.default;
exports.Channel = _channel2.default;
exports.default = _sticky2.default;
/***/ },
/* 441 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__(9);
var _propTypes2 = _interopRequireDefault(_propTypes);
var _reactDom = __webpack_require__(10);
var _reactDom2 = _interopRequireDefault(_reactDom);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var Sticky = function (_React$Component) {
_inherits(Sticky, _React$Component);
function Sticky(props) {
_classCallCheck(this, Sticky);
var _this = _possibleConstructorReturn(this, (Sticky.__proto__ || Object.getPrototypeOf(Sticky)).call(this, props));
_this.updateContext = function (_ref) {
var inherited = _ref.inherited,
node = _ref.node;
_this.containerNode = node;
_this.setState({
containerOffset: inherited,
distanceFromBottom: _this.getDistanceFromBottom()
});
};
_this.recomputeState = function () {
var isSticky = _this.isSticky();
var height = _this.getHeight();
var width = _this.getWidth();
var xOffset = _this.getXOffset();
var distanceFromBottom = _this.getDistanceFromBottom();
var hasChanged = _this.state.isSticky !== isSticky;
_this.setState({ isSticky: isSticky, height: height, width: width, xOffset: xOffset, distanceFromBottom: distanceFromBottom });
if (hasChanged) {
if (_this.channel) {
_this.channel.update(function (data) {
data.offset = isSticky ? _this.state.height : 0;
});
}
_this.props.onStickyStateChange(isSticky);
}
};
_this.state = {};
return _this;
}
_createClass(Sticky, [{
key: 'componentWillMount',
value: function componentWillMount() {
this.channel = this.context['sticky-channel'];
this.channel.subscribe(this.updateContext);
}
}, {
key: 'componentDidMount',
value: function componentDidMount() {
this.on(['resize', 'scroll', 'touchstart', 'touchmove', 'touchend', 'pageshow', 'load'], this.recomputeState);
this.recomputeState();
}
}, {
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps() {
this.recomputeState();
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
this.off(['resize', 'scroll', 'touchstart', 'touchmove', 'touchend', 'pageshow', 'load'], this.recomputeState);
this.channel.unsubscribe(this.updateContext);
}
}, {
key: 'getXOffset',
value: function getXOffset() {
return this.refs.placeholder.getBoundingClientRect().left;
}
}, {
key: 'getWidth',
value: function getWidth() {
return this.refs.placeholder.getBoundingClientRect().width;
}
}, {
key: 'getHeight',
value: function getHeight() {
return _reactDom2.default.findDOMNode(this.refs.children).getBoundingClientRect().height;
}
}, {
key: 'getDistanceFromTop',
value: function getDistanceFromTop() {
return this.refs.placeholder.getBoundingClientRect().top;
}
}, {
key: 'getDistanceFromBottom',
value: function getDistanceFromBottom() {
if (!this.containerNode) return 0;
return this.containerNode.getBoundingClientRect().bottom;
}
}, {
key: 'isSticky',
value: function isSticky() {
if (!this.props.isActive) return false;
var fromTop = this.getDistanceFromTop();
var fromBottom = this.getDistanceFromBottom();
var topBreakpoint = this.state.containerOffset - this.props.topOffset;
var bottomBreakpoint = this.state.containerOffset + this.props.bottomOffset;
return fromTop <= topBreakpoint && fromBottom >= bottomBreakpoint;
}
}, {
key: 'on',
value: function on(events, callback) {
events.forEach(function (evt) {
window.addEventListener(evt, callback);
});
}
}, {
key: 'off',
value: function off(events, callback) {
events.forEach(function (evt) {
window.removeEventListener(evt, callback);
});
}
}, {
key: 'shouldComponentUpdate',
value: function shouldComponentUpdate(newProps, newState) {
var _this2 = this;
// Have we changed the number of props?
var propNames = Object.keys(this.props);
if (Object.keys(newProps).length != propNames.length) return true;
// Have we changed any prop values?
var valuesMatch = propNames.every(function (key) {
return newProps.hasOwnProperty(key) && newProps[key] === _this2.props[key];
});
if (!valuesMatch) return true;
// Have we changed any state that will always impact rendering?
var state = this.state;
if (newState.isSticky !== state.isSticky) return true;
// If we are sticky, have we changed any state that will impact rendering?
if (state.isSticky) {
if (newState.height !== state.height) return true;
if (newState.width !== state.width) return true;
if (newState.xOffset !== state.xOffset) return true;
if (newState.containerOffset !== state.containerOffset) return true;
if (newState.distanceFromBottom !== state.distanceFromBottom) return true;
}
return false;
}
/*
* The special sauce.
*/
}, {
key: 'render',
value: function render() {
var placeholderStyle = { paddingBottom: 0 };
var className = this.props.className;
// To ensure that this component becomes sticky immediately on mobile devices instead
// of disappearing until the scroll event completes, we add `transform: translateZ(0)`
// to 'kick' rendering of this element to the GPU
// @see http://stackoverflow.com/questions/32875046
var style = _extends({}, { transform: 'translateZ(0)' }, this.props.style);
if (this.state.isSticky) {
var _stickyStyle = {
position: 'fixed',
top: this.state.containerOffset,
left: this.state.xOffset,
width: this.state.width
};
var bottomLimit = this.state.distanceFromBottom - this.state.height - this.props.bottomOffset;
if (this.state.containerOffset > bottomLimit) {
_stickyStyle.top = bottomLimit;
}
placeholderStyle.paddingBottom = this.state.height;
className += ' ' + this.props.stickyClassName;
style = _extends({}, style, _stickyStyle, this.props.stickyStyle);
}
var _props = this.props,
topOffset = _props.topOffset,
isActive = _props.isActive,
stickyClassName = _props.stickyClassName,
stickyStyle = _props.stickyStyle,
bottomOffset = _props.bottomOffset,
onStickyStateChange = _props.onStickyStateChange,
props = _objectWithoutProperties(_props, ['topOffset', 'isActive', 'stickyClassName', 'stickyStyle', 'bottomOffset', 'onStickyStateChange']);
return _react2.default.createElement(
'div',
null,
_react2.default.createElement('div', { ref: 'placeholder', style: placeholderStyle }),
_react2.default.createElement(
'div',
_extends({}, props, { ref: 'children', className: className, style: style }),
this.props.children
)
);
}
}]);
return Sticky;
}(_react2.default.Component);
Sticky.propTypes = {
isActive: _propTypes2.default.bool,
className: _propTypes2.default.string,
style: _propTypes2.default.object,
stickyClassName: _propTypes2.default.string,
stickyStyle: _propTypes2.default.object,
topOffset: _propTypes2.default.number,
bottomOffset: _propTypes2.default.number,
onStickyStateChange: _propTypes2.default.func
};
Sticky.defaultProps = {
isActive: true,
className: '',
style: {},
stickyClassName: 'sticky',
stickyStyle: {},
topOffset: 0,
bottomOffset: 0,
onStickyStateChange: function onStickyStateChange() {}
};
Sticky.contextTypes = {
'sticky-channel': _propTypes2.default.any
};
exports.default = Sticky;
module.exports = exports['default'];
/***/ },
/* 442 */
/***/ function(module, exports) {
/* WEBPACK VAR INJECTION */(function(global) {/*
* Copyright (c) 2015-present, 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.
*
*/
'use strict';
var GLOBAL = typeof window === 'undefined' ? global : window;
var setter = function(_setter, _clearer, array) {
return function(callback, delta) {
var id = _setter(function() {
_clearer.call(this, id);
callback.apply(this, arguments);
}.bind(this), delta);
if (!this[array]) {
this[array] = [id];
} else {
this[array].push(id);
}
return id;
};
};
var clearer = function(_clearer, array) {
return function(id) {
if (this[array]) {
var index = this[array].indexOf(id);
if (index !== -1) {
this[array].splice(index, 1);
}
}
_clearer(id);
};
};
var _timeouts = 'TimerMixin_timeouts';
var _clearTimeout = clearer(GLOBAL.clearTimeout, _timeouts);
var _setTimeout = setter(GLOBAL.setTimeout, _clearTimeout, _timeouts);
var _intervals = 'TimerMixin_intervals';
var _clearInterval = clearer(GLOBAL.clearInterval, _intervals);
var _setInterval = setter(GLOBAL.setInterval, function() {/* noop */}, _intervals);
var _immediates = 'TimerMixin_immediates';
var _clearImmediate = clearer(GLOBAL.clearImmediate, _immediates);
var _setImmediate = setter(GLOBAL.setImmediate, _clearImmediate, _immediates);
var _rafs = 'TimerMixin_rafs';
var _cancelAnimationFrame = clearer(GLOBAL.cancelAnimationFrame, _rafs);
var _requestAnimationFrame = setter(GLOBAL.requestAnimationFrame, _cancelAnimationFrame, _rafs);
var TimerMixin = {
componentWillUnmount: function() {
this[_timeouts] && this[_timeouts].forEach(function(id) {
GLOBAL.clearTimeout(id);
});
this[_timeouts] = null;
this[_intervals] && this[_intervals].forEach(function(id) {
GLOBAL.clearInterval(id);
});
this[_intervals] = null;
this[_immediates] && this[_immediates].forEach(function(id) {
GLOBAL.clearImmediate(id);
});
this[_immediates] = null;
this[_rafs] && this[_rafs].forEach(function(id) {
GLOBAL.cancelAnimationFrame(id);
});
this[_rafs] = null;
},
setTimeout: _setTimeout,
clearTimeout: _clearTimeout,
setInterval: _setInterval,
clearInterval: _clearInterval,
setImmediate: _setImmediate,
clearImmediate: _clearImmediate,
requestAnimationFrame: _requestAnimationFrame,
cancelAnimationFrame: _cancelAnimationFrame,
};
module.exports = TimerMixin;
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
/***/ },
/* 443 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _Popup = __webpack_require__(130);
var _Popup2 = _interopRequireDefault(_Popup);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var __assign = undefined && undefined.__assign || Object.assign || function (t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) {
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
}
return t;
};
var PopupCascader = _react2["default"].createClass({
displayName: 'PopupCascader',
getDefaultProps: function getDefaultProps() {
return {
pickerValueProp: 'value',
pickerValueChangeProp: 'onChange'
};
},
onOk: function onOk(v) {
var _props = this.props,
onChange = _props.onChange,
onOk = _props.onOk;
if (onChange) {
onChange(v);
}
if (onOk) {
onOk(v);
}
},
render: function render() {
return _react2["default"].createElement(_Popup2["default"], __assign({ picker: this.props.cascader }, this.props, { onOk: this.onOk }));
}
});
exports["default"] = PopupCascader;
module.exports = exports['default'];
/***/ },
/* 444 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _MultiPicker = __webpack_require__(51);
var _MultiPicker2 = _interopRequireDefault(_MultiPicker);
var _moment = __webpack_require__(111);
var _moment2 = _interopRequireDefault(_moment);
var _en_US = __webpack_require__(446);
var _en_US2 = _interopRequireDefault(_en_US);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function getDaysInMonth(now) {
return now.clone().endOf('month').date();
}
function pad(n) {
return n < 10 ? '0' + n : n + '';
}
var smallPickerItem = {
fontSize: 20
};
var DATETIME = 'datetime';
var DATE = 'date';
var TIME = 'time';
var MONTH = 'month';
var YEAR = 'year';
var DatePicker = _react2["default"].createClass({
displayName: 'DatePicker',
getDefaultProps: function getDefaultProps() {
return {
prefixCls: 'rmc-date-picker',
pickerPrefixCls: 'rmc-picker',
locale: _en_US2["default"],
mode: DATE,
minuteStep: 1,
onDateChange: function onDateChange() {}
};
},
getInitialState: function getInitialState() {
return {
date: this.props.date || this.props.defaultDate
};
},
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
if ('date' in nextProps) {
this.setState({
date: nextProps.date || nextProps.defaultDate
});
}
},
onValueChange: function onValueChange(values, index) {
var value = parseInt(values[index], 10);
var props = this.props;
var mode = props.mode;
var newValue = this.getDate().clone();
if (mode === DATETIME || mode === DATE || mode === YEAR || mode === MONTH) {
switch (index) {
case 0:
newValue.year(value);
break;
case 1:
newValue.month(value);
break;
case 2:
newValue.date(value);
break;
case 3:
newValue.hour(value);
break;
case 4:
newValue.minute(value);
break;
default:
break;
}
} else {
switch (index) {
case 0:
newValue.hour(value);
break;
case 1:
newValue.minute(value);
break;
default:
break;
}
}
newValue = this.clipDate(newValue);
if (!('date' in props)) {
this.setState({
date: newValue
});
}
props.onDateChange(newValue);
},
getDefaultMinDate: function getDefaultMinDate() {
if (!this.defaultMinDate) {
this.defaultMinDate = this.getGregorianCalendar([2000, 1, 1, 0, 0, 0]);
}
return this.defaultMinDate;
},
getDefaultMaxDate: function getDefaultMaxDate() {
if (!this.defaultMaxDate) {
this.defaultMaxDate = this.getGregorianCalendar([2030, 1, 1, 23, 59, 59]);
}
return this.defaultMaxDate;
},
getDate: function getDate() {
return this.state.date || this.getDefaultMinDate();
},
getValue: function getValue() {
return this.getDate();
},
getMinYear: function getMinYear() {
return this.getMinDate().year();
},
getMaxYear: function getMaxYear() {
return this.getMaxDate().year();
},
getMinMonth: function getMinMonth() {
return this.getMinDate().month();
},
getMaxMonth: function getMaxMonth() {
return this.getMaxDate().month();
},
getMinDay: function getMinDay() {
return this.getMinDate().date();
},
getMaxDay: function getMaxDay() {
return this.getMaxDate().date();
},
getMinHour: function getMinHour() {
return this.getMinDate().hour();
},
getMaxHour: function getMaxHour() {
return this.getMaxDate().hour();
},
getMinMinute: function getMinMinute() {
return this.getMinDate().minute();
},
getMaxMinute: function getMaxMinute() {
return this.getMaxDate().minute();
},
getMinDate: function getMinDate() {
return this.props.minDate || this.getDefaultMinDate();
},
getMaxDate: function getMaxDate() {
return this.props.maxDate || this.getDefaultMaxDate();
},
getDateData: function getDateData() {
var _props = this.props,
locale = _props.locale,
formatMonth = _props.formatMonth,
formatDay = _props.formatDay,
mode = _props.mode;
var date = this.getDate();
var selYear = date.year();
var selMonth = date.month();
var minDateYear = this.getMinYear();
var maxDateYear = this.getMaxYear();
var minDateMonth = this.getMinMonth();
var maxDateMonth = this.getMaxMonth();
var minDateDay = this.getMinDay();
var maxDateDay = this.getMaxDay();
var years = [];
for (var i = minDateYear; i <= maxDateYear; i++) {
years.push({
value: i + '',
label: i + locale.year + ''
});
}
var yearCol = { key: 'year', props: { children: years } };
if (mode === YEAR) {
return [yearCol];
}
var months = [];
var minMonth = 0;
var maxMonth = 11;
if (minDateYear === selYear) {
minMonth = minDateMonth;
}
if (maxDateYear === selYear) {
maxMonth = maxDateMonth;
}
for (var _i = minMonth; _i <= maxMonth; _i++) {
var label = formatMonth ? formatMonth(_i, date) : _i + 1 + locale.month + '';
months.push({
value: _i + '',
label: label
});
}
var monthCol = { key: 'month', props: { children: months } };
if (mode === MONTH) {
return [yearCol, monthCol];
}
var days = [];
var minDay = 1;
var maxDay = getDaysInMonth(date);
if (minDateYear === selYear && minDateMonth === selMonth) {
minDay = minDateDay;
}
if (maxDateYear === selYear && maxDateMonth === selMonth) {
maxDay = maxDateDay;
}
for (var _i2 = minDay; _i2 <= maxDay; _i2++) {
var _label = formatDay ? formatDay(_i2, date) : _i2 + locale.day + '';
days.push({
value: _i2 + '',
label: _label
});
}
return [yearCol, monthCol, { key: 'day', props: { children: days } }];
},
getTimeData: function getTimeData() {
var minHour = 0;
var maxHour = 23;
var minMinute = 0;
var maxMinute = 59;
var _props2 = this.props,
mode = _props2.mode,
locale = _props2.locale,
minuteStep = _props2.minuteStep;
var date = this.getDate();
var minDateMinute = this.getMinMinute();
var maxDateMinute = this.getMaxMinute();
var minDateHour = this.getMinHour();
var maxDateHour = this.getMaxHour();
var hour = date.hour();
if (mode === DATETIME) {
var year = date.year();
var month = date.month();
var day = date.date();
var minDateYear = this.getMinYear();
var maxDateYear = this.getMaxYear();
var minDateMonth = this.getMinMonth();
var maxDateMonth = this.getMaxMonth();
var minDateDay = this.getMinDay();
var maxDateDay = this.getMaxDay();
if (minDateYear === year && minDateMonth === month && minDateDay === day) {
minHour = minDateHour;
if (minDateHour === hour) {
minMinute = minDateMinute;
}
}
if (maxDateYear === year && maxDateMonth === month && maxDateDay === day) {
maxHour = maxDateHour;
if (maxDateHour === hour) {
maxMinute = maxDateMinute;
}
}
} else {
minHour = minDateHour;
if (minDateHour === hour) {
minMinute = minDateMinute;
}
maxHour = maxDateHour;
if (maxDateHour === hour) {
maxMinute = maxDateMinute;
}
}
var hours = [];
for (var i = minHour; i <= maxHour; i++) {
hours.push({
value: i + '',
label: locale.hour ? i + locale.hour + '' : pad(i)
});
}
var minutes = [];
for (var _i3 = minMinute; _i3 <= maxMinute; _i3 += minuteStep) {
minutes.push({
value: _i3 + '',
label: locale.minute ? _i3 + locale.minute + '' : pad(_i3)
});
}
return [{ key: 'hours', props: { children: hours } }, { key: 'minutes', props: { children: minutes } }];
},
getGregorianCalendar: function getGregorianCalendar(arg) {
return (0, _moment2["default"])(arg);
},
clipDate: function clipDate(date) {
var mode = this.props.mode;
var minDate = this.getMinDate();
var maxDate = this.getMaxDate();
if (mode === DATETIME) {
if (date.isBefore(minDate)) {
return minDate.clone();
}
if (date.isAfter(maxDate)) {
return maxDate.clone();
}
} else if (mode === DATE) {
if (date.isBefore(minDate, 'day')) {
return minDate.clone();
}
if (date.isAfter(maxDate, 'day')) {
return maxDate.clone();
}
} else {
var maxHour = maxDate.hour();
var maxMinutes = maxDate.minute();
var minHour = minDate.hour();
var minMinutes = minDate.minute();
var hour = date.hour();
var minutes = date.minute();
if (hour < minHour || hour === minHour && minutes < minMinutes) {
return minDate.clone();
}
if (hour > maxHour || hour === maxHour && minutes > maxMinutes) {
return maxDate.clone();
}
}
return date;
},
getValueCols: function getValueCols() {
var mode = this.props.mode;
var date = this.getDate();
var cols = [];
var value = [];
if (mode === YEAR) {
return {
cols: this.getDateData(),
value: [date.year() + '']
};
}
if (mode === MONTH) {
return {
cols: this.getDateData(),
value: [date.year() + '', date.month() + '']
};
}
if (mode === DATETIME || mode === DATE) {
cols = this.getDateData();
value = [date.year() + '', date.month() + '', date.date() + ''];
}
if (mode === DATETIME || mode === TIME) {
cols = cols.concat(this.getTimeData());
value = value.concat([date.hour() + '', date.minute() + '']);
}
return {
value: value,
cols: cols
};
},
render: function render() {
var _getValueCols = this.getValueCols(),
value = _getValueCols.value,
cols = _getValueCols.cols;
var _props3 = this.props,
mode = _props3.mode,
prefixCls = _props3.prefixCls,
pickerPrefixCls = _props3.pickerPrefixCls,
rootNativeProps = _props3.rootNativeProps,
className = _props3.className;
return _react2["default"].createElement(_MultiPicker2["default"], { rootNativeProps: rootNativeProps, className: className, prefixCls: prefixCls, pickerPrefixCls: pickerPrefixCls, pickerItemStyle: typeof window === 'undefined' && mode === 'datetime' ? smallPickerItem : undefined, selectedValue: value, onValueChange: this.onValueChange }, cols);
}
});
exports["default"] = DatePicker;
module.exports = exports['default'];
/***/ },
/* 445 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _Popup = __webpack_require__(130);
var _Popup2 = _interopRequireDefault(_Popup);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var __assign = undefined && undefined.__assign || Object.assign || function (t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) {
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
}
return t;
};
var PopupDatePicker = _react2["default"].createClass({
displayName: 'PopupDatePicker',
getDefaultProps: function getDefaultProps() {
return {
pickerValueProp: 'date',
pickerValueChangeProp: 'onDateChange'
};
},
onOk: function onOk(v) {
var _props = this.props,
onChange = _props.onChange,
onOk = _props.onOk;
if (onChange) {
onChange(v);
}
if (onOk) {
onOk(v);
}
},
render: function render() {
return _react2["default"].createElement(_Popup2["default"], __assign({ picker: this.props.datePicker, value: this.props.date }, this.props, { onOk: this.onOk }));
}
});
exports["default"] = PopupDatePicker;
module.exports = exports['default'];
/***/ },
/* 446 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = {
year: '',
month: '',
day: '',
hour: '',
minute: ''
};
module.exports = exports['default'];
/***/ },
/* 447 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = {
year: '年',
month: '月',
day: '日',
hour: '时',
minute: '分'
};
module.exports = exports['default'];
/***/ },
/* 448 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = __webpack_require__(7);
var _extends3 = _interopRequireDefault(_extends2);
var _defineProperty2 = __webpack_require__(6);
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _objectWithoutProperties2 = __webpack_require__(18);
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
var _classCallCheck2 = __webpack_require__(2);
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _possibleConstructorReturn2 = __webpack_require__(4);
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = __webpack_require__(3);
var _inherits3 = _interopRequireDefault(_inherits2);
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _reactDom = __webpack_require__(10);
var _reactDom2 = _interopRequireDefault(_reactDom);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var _ListView = __webpack_require__(128);
var _ListView2 = _interopRequireDefault(_ListView);
var _util = __webpack_require__(129);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/* eslint react/prop-types: 0 */
var IndexedList = function (_React$Component) {
(0, _inherits3["default"])(IndexedList, _React$Component);
function IndexedList(props) {
(0, _classCallCheck3["default"])(this, IndexedList);
var _this = (0, _possibleConstructorReturn3["default"])(this, _React$Component.call(this, props));
_initialiseProps.call(_this);
_this.state = {
pageSize: props.pageSize,
_delay: false
};
return _this;
}
IndexedList.prototype.componentDidMount = function componentDidMount() {
this.dataChange(this.props);
// handle quickSearchBar
this.getQsInfo();
};
IndexedList.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
if (this.props.dataSource !== nextProps.dataSource) {
this.dataChange(nextProps);
}
};
IndexedList.prototype.componentDidUpdate = function componentDidUpdate() {
this.getQsInfo();
};
IndexedList.prototype.componentWillUnmount = function componentWillUnmount() {
if (this._timer) {
clearTimeout(this._timer);
}
this._hCache = null;
};
IndexedList.prototype.renderQuickSearchBar = function renderQuickSearchBar(quickSearchBarTop, quickSearchBarStyle) {
var _this2 = this;
var _props = this.props,
dataSource = _props.dataSource,
prefixCls = _props.prefixCls;
var sectionKvs = dataSource.sectionIdentities.map(function (i) {
return {
value: i,
label: dataSource._getSectionHeaderData(dataSource._dataBlob, i)
};
});
return _react2["default"].createElement(
'ul',
{ ref: 'quickSearchBar',
className: prefixCls + '-quick-search-bar', style: quickSearchBarStyle,
onTouchStart: this.onTouchStart,
onTouchMove: this.onTouchMove,
onTouchEnd: this.onTouchEnd,
onTouchCancel: this.onTouchEnd
},
_react2["default"].createElement(
'li',
{ 'data-qf-target': quickSearchBarTop.value,
onClick: function onClick() {
return _this2.onQuickSearchTop(undefined, quickSearchBarTop.value);
}
},
quickSearchBarTop.label
),
sectionKvs.map(function (i) {
return _react2["default"].createElement(
'li',
{ key: i.value, 'data-qf-target': i.value,
onClick: function onClick() {
return _this2.onQuickSearch(i.value);
}
},
i.label
);
})
);
};
IndexedList.prototype.render = function render() {
var _classNames,
_this3 = this,
_classNames2;
var _state = this.state,
_delay = _state._delay,
pageSize = _state.pageSize;
var _props2 = this.props,
className = _props2.className,
prefixCls = _props2.prefixCls,
children = _props2.children,
quickSearchBarTop = _props2.quickSearchBarTop,
quickSearchBarStyle = _props2.quickSearchBarStyle,
_props2$initialListSi = _props2.initialListSize,
initialListSize = _props2$initialListSi === undefined ? Math.min(20, this.props.dataSource.getRowCount()) : _props2$initialListSi,
showQuickSearchIndicator = _props2.showQuickSearchIndicator,
_renderSectionHeader = _props2.renderSectionHeader,
sectionHeaderClassName = _props2.sectionHeaderClassName,
other = (0, _objectWithoutProperties3["default"])(_props2, ['className', 'prefixCls', 'children', 'quickSearchBarTop', 'quickSearchBarStyle', 'initialListSize', 'showQuickSearchIndicator', 'renderSectionHeader', 'sectionHeaderClassName']);
// initialListSize={this.props.dataSource.getRowCount()}
return _react2["default"].createElement(
'div',
{ className: prefixCls + '-container' },
_delay && this.props.delayActivityIndicator,
_react2["default"].createElement(
_ListView2["default"],
(0, _extends3["default"])({}, other, {
ref: 'indexedListView',
className: (0, _classnames2["default"])((_classNames = {}, (0, _defineProperty3["default"])(_classNames, className, className), (0, _defineProperty3["default"])(_classNames, prefixCls, true), _classNames)),
initialListSize: initialListSize,
pageSize: pageSize,
renderSectionHeader: function renderSectionHeader(sectionData, sectionID) {
return _react2["default"].cloneElement(_renderSectionHeader(sectionData, sectionID), {
ref: function ref(c) {
return _this3.sectionComponents[sectionID] = c;
},
className: sectionHeaderClassName || prefixCls + '-section-header'
});
}
}),
children
),
this.renderQuickSearchBar(quickSearchBarTop, quickSearchBarStyle),
showQuickSearchIndicator ? _react2["default"].createElement('div', { className: (0, _classnames2["default"])((_classNames2 = {}, (0, _defineProperty3["default"])(_classNames2, prefixCls + '-qsindicator', true), (0, _defineProperty3["default"])(_classNames2, prefixCls + '-qsindicator-hide', !showQuickSearchIndicator || !this.state.showQuickSearchIndicator), _classNames2)), ref: 'qsIndicator'
}) : null
);
};
return IndexedList;
}(_react2["default"].Component);
IndexedList.propTypes = (0, _extends3["default"])({}, _ListView2["default"].propTypes, {
children: _react.PropTypes.any,
prefixCls: _react.PropTypes.string,
className: _react.PropTypes.string,
sectionHeaderClassName: _react.PropTypes.string,
quickSearchBarTop: _react.PropTypes.object,
quickSearchBarStyle: _react.PropTypes.object,
onQuickSearch: _react.PropTypes.func,
showQuickSearchIndicator: _react.PropTypes.bool
});
IndexedList.defaultProps = {
prefixCls: 'rmc-indexed-list',
quickSearchBarTop: { value: '#', label: '#' },
onQuickSearch: function onQuickSearch() {},
showQuickSearchIndicator: false,
delayTime: 100,
// delayActivityIndicator:
rendering more
,
delayActivityIndicator: ''
};
var _initialiseProps = function _initialiseProps() {
var _this4 = this;
this.onQuickSearchTop = function (sectionID, topId) {
if (_this4.props.stickyHeader) {
window.document.body.scrollTop = 0;
} else {
_reactDom2["default"].findDOMNode(_this4.refs.indexedListView.refs.listviewscroll).scrollTop = 0;
}
_this4.props.onQuickSearch(sectionID, topId);
};
this.onQuickSearch = function (sectionID) {
var lv = _reactDom2["default"].findDOMNode(_this4.refs.indexedListView.refs.listviewscroll);
var sec = _reactDom2["default"].findDOMNode(_this4.sectionComponents[sectionID]);
if (_this4.props.stickyHeader) {
// react-sticky 会把 header 设置为 fixed ,但提供了 placeholder 记忆原来位置
var stickyComponent = _this4.refs.indexedListView.stickyRefs[sectionID];
if (stickyComponent && stickyComponent.refs.placeholder) {
sec = _reactDom2["default"].findDOMNode(stickyComponent.refs.placeholder);
}
window.document.body.scrollTop = sec.getBoundingClientRect().top - lv.getBoundingClientRect().top + (0, _util.getOffsetTop)(lv);
} else {
lv.scrollTop += sec.getBoundingClientRect().top - lv.getBoundingClientRect().top;
}
_this4.props.onQuickSearch(sectionID);
};
this.onTouchStart = function (e) {
_this4._target = e.target;
_this4._basePos = _this4.refs.quickSearchBar.getBoundingClientRect();
document.addEventListener('touchmove', _this4._disableParent, false);
document.body.className = document.body.className + ' ' + _this4.props.prefixCls + '-qsb-moving';
_this4.updateIndicator(_this4._target);
};
this.onTouchMove = function (e) {
e.preventDefault();
if (_this4._target) {
var ex = (0, _util._event)(e);
var basePos = _this4._basePos;
var _pos = void 0;
if (ex.clientY >= basePos.top && ex.clientY <= basePos.top + _this4._qsHeight) {
_pos = Math.floor((ex.clientY - basePos.top) / _this4._avgH);
var target = void 0;
if (_pos in _this4._hCache) {
target = _this4._hCache[_pos][0];
}
if (target) {
var overValue = target.getAttribute('data-qf-target');
if (_this4._target !== target) {
if (_this4.props.quickSearchBarTop.value === overValue) {
_this4.onQuickSearchTop(undefined, overValue);
} else {
_this4.onQuickSearch(overValue);
}
_this4.updateIndicator(target);
}
_this4._target = target;
}
}
}
};
this.onTouchEnd = function () {
if (!_this4._target) {
return;
}
document.removeEventListener('touchmove', _this4._disableParent, false);
document.body.className = document.body.className.replace(new RegExp('\\s*' + _this4.props.prefixCls + '-qsb-moving', 'g'), '');
_this4.updateIndicator(_this4._target, true);
_this4._target = null;
};
this.getQsInfo = function () {
var quickSearchBar = _this4.refs.quickSearchBar;
var height = quickSearchBar.offsetHeight;
var hCache = [];
[].slice.call(quickSearchBar.querySelectorAll('[data-qf-target]')).forEach(function (d) {
hCache.push([d]);
});
var _avgH = height / hCache.length;
var _top = 0;
for (var i = 0, len = hCache.length; i < len; i++) {
_top = i * _avgH;
hCache[i][1] = [_top, _top + _avgH];
}
_this4._qsHeight = height;
_this4._avgH = _avgH;
_this4._hCache = hCache;
};
this.sectionComponents = {};
this.dataChange = function (props) {
// delay render more
var rowCount = props.dataSource.getRowCount();
if (!rowCount) {
return;
}
_this4.setState({
_delay: true
});
if (_this4._timer) {
clearTimeout(_this4._timer);
}
_this4._timer = setTimeout(function () {
_this4.setState({
pageSize: rowCount,
_delay: false
}, function () {
return _this4.refs.indexedListView._pageInNewRows();
});
}, props.delayTime);
};
this.updateIndicator = function (ele, end) {
var el = ele;
if (!el.getAttribute('data-qf-target')) {
el = el.parentNode;
}
if (_this4.props.showQuickSearchIndicator) {
_this4.refs.qsIndicator.innerText = el.innerText.trim();
_this4.setState({
showQuickSearchIndicator: true
});
if (_this4._indicatorTimer) {
clearTimeout(_this4._indicatorTimer);
}
_this4._indicatorTimer = setTimeout(function () {
_this4.setState({
showQuickSearchIndicator: false
});
}, 1000);
}
var cls = _this4.props.prefixCls + '-quick-search-bar-over';
// can not use setState to change className, it has a big performance issue!
_this4._hCache.forEach(function (d) {
d[0].className = d[0].className.replace(cls, '');
});
if (!end) {
el.className = el.className + ' ' + cls;
}
};
this._disableParent = function (e) {
e.preventDefault();
e.stopPropagation();
};
};
exports["default"] = IndexedList;
module.exports = exports['default'];
/***/ },
/* 449 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _classCallCheck2 = __webpack_require__(2);
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _invariant = __webpack_require__(39);
var _invariant2 = _interopRequireDefault(_invariant);
var _isEmpty = __webpack_require__(354);
var _isEmpty2 = _interopRequireDefault(_isEmpty);
var _warning = __webpack_require__(40);
var _warning2 = _interopRequireDefault(_warning);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function defaultGetRowData(dataBlob, sectionID, rowID) {
return dataBlob[sectionID][rowID];
}
function defaultGetSectionHeaderData(dataBlob, sectionID) {
return dataBlob[sectionID];
}
// type differType = (data1, data2) => bool;
//
// type ParamType = {
// rowHasChanged: differType;
// getRowData: ?typeof defaultGetRowData;
// sectionHeaderHasChanged: ?differType;
// getSectionHeaderData: ?typeof defaultGetSectionHeaderData;
// }
/**
* Provides efficient data processing and access to the
* `ListView` component. A `ListViewDataSource` is created with functions for
* extracting data from the input blob, and comparing elements (with default
* implementations for convenience). The input blob can be as simple as an
* array of strings, or an object with rows nested inside section objects.
*
* To update the data in the datasource, use `cloneWithRows` (or
* `cloneWithRowsAndSections` if you care about sections). The data in the
* data source is immutable, so you can't modify it directly. The clone methods
* suck in the new data and compute a diff for each row so ListView knows
* whether to re-render it or not.
*
* In this example, a component receives data in chunks, handled by
* `_onDataArrived`, which concats the new data onto the old data and updates the
* data source. We use `concat` to create a new array - mutating `this._data`,
* e.g. with `this._data.push(newRowData)`, would be an error. `_rowHasChanged`
* understands the shape of the row data and knows how to efficiently compare
* it.
*
* ```
* getInitialState: function() {
* var ds = new ListViewDataSource({rowHasChanged: this._rowHasChanged});
* return {ds};
* },
* _onDataArrived(newData) {
* this._data = this._data.concat(newData);
* this.setState({
* ds: this.state.ds.cloneWithRows(this._data)
* });
* }
* ```
*/
var ListViewDataSource = function () {
/**
* You can provide custom extraction and `hasChanged` functions for section
* headers and rows. If absent, data will be extracted with the
* `defaultGetRowData` and `defaultGetSectionHeaderData` functions.
*
* The default extractor expects data of one of the following forms:
*
* { sectionID_1: { rowID_1: , ... }, ... }
*
* or
*
* { sectionID_1: [ , , ... ], ... }
*
* or
*
* [ [ , , ... ], ... ]
*
* The constructor takes in a params argument that can contain any of the
* following:
*
* - getRowData(dataBlob, sectionID, rowID);
* - getSectionHeaderData(dataBlob, sectionID);
* - rowHasChanged(prevRowData, nextRowData);
* - sectionHeaderHasChanged(prevSectionData, nextSectionData);
*/
function ListViewDataSource(params) {
(0, _classCallCheck3["default"])(this, ListViewDataSource);
(0, _invariant2["default"])(params && typeof params.rowHasChanged === 'function', 'Must provide a rowHasChanged function.');
this._rowHasChanged = params.rowHasChanged;
this._getRowData = params.getRowData || defaultGetRowData;
this._sectionHeaderHasChanged = params.sectionHeaderHasChanged;
this._getSectionHeaderData = params.getSectionHeaderData || defaultGetSectionHeaderData;
this._dataBlob = null;
this._dirtyRows = [];
this._dirtySections = [];
this._cachedRowCount = 0;
// These two private variables are accessed by outsiders because ListView
// uses them to iterate over the data in this class.
this.rowIdentities = [];
this.sectionIdentities = [];
}
/**
* Clones this `ListViewDataSource` with the specified `dataBlob` and
* `rowIdentities`. The `dataBlob` is just an arbitrary blob of data. At
* construction an extractor to get the interesting information was defined
* (or the default was used).
*
* The `rowIdentities` is is a 2D array of identifiers for rows.
* ie. [['a1', 'a2'], ['b1', 'b2', 'b3'], ...]. If not provided, it's
* assumed that the keys of the section data are the row identities.
*
* Note: This function does NOT clone the data in this data source. It simply
* passes the functions defined at construction to a new data source with
* the data specified. If you wish to maintain the existing data you must
* handle merging of old and new data separately and then pass that into
* this function as the `dataBlob`.
*/
ListViewDataSource.prototype.cloneWithRows = function cloneWithRows(dataBlob, rowIdentities) {
var rowIds = rowIdentities ? [rowIdentities] : null;
if (!this._sectionHeaderHasChanged) {
this._sectionHeaderHasChanged = function () {
return false;
};
}
return this.cloneWithRowsAndSections({ s1: dataBlob }, ['s1'], rowIds);
};
/**
* This performs the same function as the `cloneWithRows` function but here
* you also specify what your `sectionIdentities` are. If you don't care
* about sections you should safely be able to use `cloneWithRows`.
*
* `sectionIdentities` is an array of identifiers for sections.
* ie. ['s1', 's2', ...]. If not provided, it's assumed that the
* keys of dataBlob are the section identities.
*
* Note: this returns a new object!
*/
ListViewDataSource.prototype.cloneWithRowsAndSections = function cloneWithRowsAndSections(dataBlob, sectionIdentities, rowIdentities) {
(0, _invariant2["default"])(typeof this._sectionHeaderHasChanged === 'function', 'Must provide a sectionHeaderHasChanged function with section data.');
(0, _invariant2["default"])(!sectionIdentities || !rowIdentities || sectionIdentities.length === rowIdentities.length, 'row and section ids lengths must be the same');
var newSource = new ListViewDataSource({
getRowData: this._getRowData,
getSectionHeaderData: this._getSectionHeaderData,
rowHasChanged: this._rowHasChanged,
sectionHeaderHasChanged: this._sectionHeaderHasChanged
});
newSource._dataBlob = dataBlob;
if (sectionIdentities) {
newSource.sectionIdentities = sectionIdentities;
} else {
newSource.sectionIdentities = Object.keys(dataBlob);
}
if (rowIdentities) {
newSource.rowIdentities = rowIdentities;
} else {
newSource.rowIdentities = [];
newSource.sectionIdentities.forEach(function (sectionID) {
newSource.rowIdentities.push(Object.keys(dataBlob[sectionID]));
});
}
newSource._cachedRowCount = countRows(newSource.rowIdentities);
newSource._calculateDirtyArrays(this._dataBlob, this.sectionIdentities, this.rowIdentities);
return newSource;
};
ListViewDataSource.prototype.getRowCount = function getRowCount() {
return this._cachedRowCount;
};
ListViewDataSource.prototype.getRowAndSectionCount = function getRowAndSectionCount() {
return this._cachedRowCount + this.sectionIdentities.length;
};
/**
* Returns if the row is dirtied and needs to be rerendered
*/
ListViewDataSource.prototype.rowShouldUpdate = function rowShouldUpdate(sectionIndex, rowIndex) {
var needsUpdate = this._dirtyRows[sectionIndex][rowIndex];
(0, _warning2["default"])(needsUpdate !== undefined, 'missing dirtyBit for section, row: ' + sectionIndex + ', ' + rowIndex);
return needsUpdate;
};
/**
* Gets the data required to render the row.
*/
ListViewDataSource.prototype.getRowData = function getRowData(sectionIndex, rowIndex) {
var sectionID = this.sectionIdentities[sectionIndex];
var rowID = this.rowIdentities[sectionIndex][rowIndex];
(0, _warning2["default"])(sectionID !== undefined && rowID !== undefined, 'rendering invalid section, row: ' + sectionIndex + ', ' + rowIndex);
return this._getRowData(this._dataBlob, sectionID, rowID);
};
/**
* Gets the rowID at index provided if the dataSource arrays were flattened,
* or null of out of range indexes.
*/
ListViewDataSource.prototype.getRowIDForFlatIndex = function getRowIDForFlatIndex(index) {
var accessIndex = index;
for (var ii = 0; ii < this.sectionIdentities.length; ii++) {
if (accessIndex >= this.rowIdentities[ii].length) {
accessIndex -= this.rowIdentities[ii].length;
} else {
return this.rowIdentities[ii][accessIndex];
}
}
return null;
};
/**
* Gets the sectionID at index provided if the dataSource arrays were flattened,
* or null for out of range indexes.
*/
ListViewDataSource.prototype.getSectionIDForFlatIndex = function getSectionIDForFlatIndex(index) {
var accessIndex = index;
for (var ii = 0; ii < this.sectionIdentities.length; ii++) {
if (accessIndex >= this.rowIdentities[ii].length) {
accessIndex -= this.rowIdentities[ii].length;
} else {
return this.sectionIdentities[ii];
}
}
return null;
};
/**
* Returns an array containing the number of rows in each section
*/
ListViewDataSource.prototype.getSectionLengths = function getSectionLengths() {
var results = [];
for (var ii = 0; ii < this.sectionIdentities.length; ii++) {
results.push(this.rowIdentities[ii].length);
}
return results;
};
/**
* Returns if the section header is dirtied and needs to be rerendered
*/
ListViewDataSource.prototype.sectionHeaderShouldUpdate = function sectionHeaderShouldUpdate(sectionIndex) {
var needsUpdate = this._dirtySections[sectionIndex];
(0, _warning2["default"])(needsUpdate !== undefined, 'missing dirtyBit for section: ' + sectionIndex);
return needsUpdate;
};
/**
* Gets the data required to render the section header
*/
ListViewDataSource.prototype.getSectionHeaderData = function getSectionHeaderData(sectionIndex) {
if (!this._getSectionHeaderData) {
return null;
}
var sectionID = this.sectionIdentities[sectionIndex];
(0, _warning2["default"])(sectionID !== undefined, 'renderSection called on invalid section: ' + sectionIndex);
return this._getSectionHeaderData(this._dataBlob, sectionID);
};
/**
* Private members and methods.
*/
// These two 'protected' variables are accessed by ListView to iterate over
// the data in this class.
ListViewDataSource.prototype._calculateDirtyArrays = function _calculateDirtyArrays(prevDataBlob, prevSectionIDs, prevRowIDs) {
// construct a hashmap of the existing (old) id arrays
var prevSectionsHash = keyedDictionaryFromArray(prevSectionIDs);
var prevRowsHash = {};
for (var ii = 0; ii < prevRowIDs.length; ii++) {
var sectionID = prevSectionIDs[ii];
(0, _warning2["default"])(!prevRowsHash[sectionID], 'SectionID appears more than once: ' + sectionID);
prevRowsHash[sectionID] = keyedDictionaryFromArray(prevRowIDs[ii]);
}
// compare the 2 identity array and get the dirtied rows
this._dirtySections = [];
this._dirtyRows = [];
var dirty;
for (var sIndex = 0; sIndex < this.sectionIdentities.length; sIndex++) {
var sectionID = this.sectionIdentities[sIndex];
// dirty if the sectionHeader is new or _sectionHasChanged is true
dirty = !prevSectionsHash[sectionID];
var sectionHeaderHasChanged = this._sectionHeaderHasChanged;
if (!dirty && sectionHeaderHasChanged) {
dirty = sectionHeaderHasChanged(this._getSectionHeaderData(prevDataBlob, sectionID), this._getSectionHeaderData(this._dataBlob, sectionID));
}
this._dirtySections.push(!!dirty);
this._dirtyRows[sIndex] = [];
for (var rIndex = 0; rIndex < this.rowIdentities[sIndex].length; rIndex++) {
var rowID = this.rowIdentities[sIndex][rIndex];
// dirty if the section is new, row is new or _rowHasChanged is true
dirty = !prevSectionsHash[sectionID] || !prevRowsHash[sectionID][rowID] || this._rowHasChanged(this._getRowData(prevDataBlob, sectionID, rowID), this._getRowData(this._dataBlob, sectionID, rowID));
this._dirtyRows[sIndex].push(!!dirty);
}
}
};
return ListViewDataSource;
}();
function countRows(allRowIDs) {
var totalRows = 0;
for (var sectionIdx = 0; sectionIdx < allRowIDs.length; sectionIdx++) {
var rowIDs = allRowIDs[sectionIdx];
totalRows += rowIDs.length;
}
return totalRows;
}
function keyedDictionaryFromArray(arr) {
if ((0, _isEmpty2["default"])(arr)) {
return {};
}
var result = {};
for (var ii = 0; ii < arr.length; ii++) {
var key = arr[ii];
(0, _warning2["default"])(!result[key], 'Value appears more than once in array: ' + key);
result[key] = true;
}
return result;
}
module.exports = ListViewDataSource;
/***/ },
/* 450 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _reactDom = __webpack_require__(10);
var _reactDom2 = _interopRequireDefault(_reactDom);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/* eslint no-unused-vars: 0 */
exports["default"] = {
bindEvt: function bindEvt() {
var ele = this.getEle();
ele.addEventListener('touchstart', this.onPullUpStart);
ele.addEventListener('touchmove', this.onPullUpMove);
ele.addEventListener('touchend', this.onPullUpEnd);
ele.addEventListener('touchcancel', this.onPullUpEnd);
},
unBindEvt: function unBindEvt() {
var ele = this.getEle();
ele.removeEventListener('touchstart', this.onPullUpStart);
ele.removeEventListener('touchmove', this.onPullUpMove);
ele.removeEventListener('touchend', this.onPullUpEnd);
ele.removeEventListener('touchcancel', this.onPullUpEnd);
},
getEle: function getEle() {
var _props = this.props,
stickyHeader = _props.stickyHeader,
useBodyScroll = _props.useBodyScroll;
var ele = void 0;
if (stickyHeader || useBodyScroll) {
ele = document.body;
} else {
ele = _reactDom2["default"].findDOMNode(this.refs.listviewscroll.refs.ScrollView);
}
return ele;
},
componentDidMount: function componentDidMount() {
this.bindEvt();
},
componentWillUnmount: function componentWillUnmount() {
this.unBindEvt();
},
onPullUpStart: function onPullUpStart(e) {
this._pullUpStartPageY = e.touches[0].screenY;
this._isPullUp = false;
this._pullUpEle = this.getEle();
},
onPullUpMove: function onPullUpMove(e) {
// 使用 pageY 对比有问题
if (e.touches[0].screenY < this._pullUpStartPageY && this._reachBottom()) {
// console.log('滚动条到了底部,pull up');
this._isPullUp = true;
}
},
onPullUpEnd: function onPullUpEnd(e) {
if (this._isPullUp && this.props.onEndReached) {
this.props.onEndReached(e);
}
this._isPullUp = false;
},
_reachBottom: function _reachBottom() {
var element = this._pullUpEle;
if (element === document.body) {
return element.scrollHeight - element.scrollTop === window.innerHeight;
}
return element.scrollHeight - element.scrollTop === element.clientHeight;
}
};
module.exports = exports['default'];
/***/ },
/* 451 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _defineProperty2 = __webpack_require__(6);
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
exports["default"] = _react2["default"].createClass({
displayName: 'RefreshControl',
propTypes: {
prefixCls: _react.PropTypes.string,
className: _react.PropTypes.string,
style: _react.PropTypes.object,
icon: _react.PropTypes.any,
loading: _react.PropTypes.any,
distanceToRefresh: _react.PropTypes.number,
refreshing: _react.PropTypes.bool,
onRefresh: _react.PropTypes.func.isRequired
},
getDefaultProps: function getDefaultProps() {
return {
prefixCls: 'list-view-refresh-control',
distanceToRefresh: 50,
refreshing: false,
icon: [_react2["default"].createElement(
'div',
{ key: '0', className: 'list-view-refresh-control-pull' },
'\u2193 \u4E0B\u62C9'
), _react2["default"].createElement(
'div',
{ key: '1', className: 'list-view-refresh-control-release' },
'\u2191 \u91CA\u653E'
)],
loading: _react2["default"].createElement(
'div',
null,
'loading...'
)
};
},
getInitialState: function getInitialState() {
return {
active: false,
deactive: false,
loadingState: false
};
},
render: function render() {
var _classNames;
var _props = this.props,
prefixCls = _props.prefixCls,
_props$className = _props.className,
className = _props$className === undefined ? '' : _props$className,
style = _props.style,
icon = _props.icon,
loading = _props.loading,
refreshing = _props.refreshing;
var _state = this.state,
active = _state.active,
deactive = _state.deactive,
loadingState = _state.loadingState;
var wrapCls = (0, _classnames2["default"])((_classNames = {}, (0, _defineProperty3["default"])(_classNames, className, className), (0, _defineProperty3["default"])(_classNames, prefixCls + '-ptr', true), (0, _defineProperty3["default"])(_classNames, prefixCls + '-active', active), (0, _defineProperty3["default"])(_classNames, prefixCls + '-deactive', deactive), (0, _defineProperty3["default"])(_classNames, prefixCls + '-loading', loadingState || refreshing), _classNames));
return _react2["default"].createElement(
'div',
{ ref: 'ptr', className: wrapCls, style: style },
_react2["default"].createElement(
'div',
{ className: prefixCls + '-ptr-icon' },
icon
),
_react2["default"].createElement(
'div',
{ className: prefixCls + '-ptr-loading' },
loading
)
);
}
});
module.exports = exports['default'];
/***/ },
/* 452 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _reactDom = __webpack_require__(10);
var _reactDom2 = _interopRequireDefault(_reactDom);
var _warning = __webpack_require__(40);
var _warning2 = _interopRequireDefault(_warning);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/**
* Mixin that can be integrated in order to handle scrolling that plays well
* with `ResponderEventPlugin`. Integrate with your platform specific scroll
* views, or even your custom built (every-frame animating) scroll views so that
* all of these systems play well with the `ResponderEventPlugin`.
*
* iOS scroll event timing nuances:
* ===============================
*
*
* Scrolling without bouncing, if you touch down:
* -------------------------------
*
* 1. `onMomentumScrollBegin` (when animation begins after letting up)
* ... physical touch starts ...
* 2. `onTouchStartCapture` (when you press down to stop the scroll)
* 3. `onTouchStart` (same, but bubble phase)
* 4. `onResponderRelease` (when lifting up - you could pause forever before * lifting)
* 5. `onMomentumScrollEnd`
*
*
* Scrolling with bouncing, if you touch down:
* -------------------------------
*
* 1. `onMomentumScrollBegin` (when animation begins after letting up)
* ... bounce begins ...
* ... some time elapses ...
* ... physical touch during bounce ...
* 2. `onMomentumScrollEnd` (Makes no sense why this occurs first during bounce)
* 3. `onTouchStartCapture` (immediately after `onMomentumScrollEnd`)
* 4. `onTouchStart` (same, but bubble phase)
* 5. `onTouchEnd` (You could hold the touch start for a long time)
* 6. `onMomentumScrollBegin` (When releasing the view starts bouncing back)
*
* So when we receive an `onTouchStart`, how can we tell if we are touching
* *during* an animation (which then causes the animation to stop)? The only way
* to tell is if the `touchStart` occurred immediately after the
* `onMomentumScrollEnd`.
*
* This is abstracted out for you, so you can just call this.scrollResponderIsAnimating() if
* necessary
*
* `ScrollResponder` also includes logic for blurring a currently focused input
* if one is focused while scrolling. The `ScrollResponder` is a natural place
* to put this logic since it can support not dismissing the keyboard while
* scrolling, unless a recognized "tap"-like gesture has occurred.
*
* The public lifecycle API includes events for keyboard interaction, responder
* interaction, and scrolling (among others). The keyboard callbacks
* `onKeyboardWill/Did/*` are *global* events, but are invoked on scroll
* responder's props so that you can guarantee that the scroll responder's
* internal state has been updated accordingly (and deterministically) by
* the time the props callbacks are invoke. Otherwise, you would always wonder
* if the scroll responder is currently in a state where it recognizes new
* keyboard positions etc. If coordinating scrolling with keyboard movement,
* *always* use these hooks instead of listening to your own global keyboard
* events.
*
* Public keyboard lifecycle API: (props callbacks)
*
* Standard Keyboard Appearance Sequence:
*
* this.props.onKeyboardWillShow
* this.props.onKeyboardDidShow
*
* `onScrollResponderKeyboardDismissed` will be invoked if an appropriate
* tap inside the scroll responder's scrollable region was responsible
* for the dismissal of the keyboard. There are other reasons why the
* keyboard could be dismissed.
*
* this.props.onScrollResponderKeyboardDismissed
*
* Standard Keyboard Hide Sequence:
*
* this.props.onKeyboardWillHide
* this.props.onKeyboardDidHide
*/
var IS_ANIMATING_TOUCH_START_THRESHOLD_MS = 16;
// type State = {
// isTouching: boolean;
// lastMomentumScrollBeginTime: number;
// lastMomentumScrollEndTime: number;
// observedScrollSinceBecomingResponder: boolean;
// becameResponderWhileAnimating: boolean;
// };
// type Event = Object;
var ScrollResponderMixin = {
// mixins: [Subscribable.Mixin],
// statics: RCTScrollViewConsts,
scrollResponderMixinGetInitialState: function scrollResponderMixinGetInitialState() {
return {
isTouching: false,
lastMomentumScrollBeginTime: 0,
lastMomentumScrollEndTime: 0,
// Reset to false every time becomes responder. This is used to:
// - Determine if the scroll view has been scrolled and therefore should
// refuse to give up its responder lock.
// - Determine if releasing should dismiss the keyboard when we are in
// tap-to-dismiss mode (!this.props.keyboardShouldPersistTaps).
observedScrollSinceBecomingResponder: false,
becameResponderWhileAnimating: false
};
},
/**
* Invoke this from an `onScroll` event.
*/
scrollResponderHandleScrollShouldSetResponder: function scrollResponderHandleScrollShouldSetResponder() {
return this.state.isTouching;
},
/**
* Merely touch starting is not sufficient for a scroll view to become the
* responder. Being the "responder" means that the very next touch move/end
* event will result in an action/movement.
*
* Invoke this from an `onStartShouldSetResponder` event.
*
* `onStartShouldSetResponder` is used when the next move/end will trigger
* some UI movement/action, but when you want to yield priority to views
* nested inside of the view.
*
* There may be some cases where scroll views actually should return `true`
* from `onStartShouldSetResponder`: Any time we are detecting a standard tap
* that gives priority to nested views.
*
* - If a single tap on the scroll view triggers an action such as
* recentering a map style view yet wants to give priority to interaction
* views inside (such as dropped pins or labels), then we would return true
* from this method when there is a single touch.
*
* - Similar to the previous case, if a two finger "tap" should trigger a
* zoom, we would check the `touches` count, and if `>= 2`, we would return
* true.
*
*/
scrollResponderHandleStartShouldSetResponder: function scrollResponderHandleStartShouldSetResponder() {
return false;
},
/**
* There are times when the scroll view wants to become the responder
* (meaning respond to the next immediate `touchStart/touchEnd`), in a way
* that *doesn't* give priority to nested views (hence the capture phase):
*
* - Currently animating.
* - Tapping anywhere that is not the focused input, while the keyboard is
* up (which should dismiss the keyboard).
*
* Invoke this from an `onStartShouldSetResponderCapture` event.
*/
scrollResponderHandleStartShouldSetResponderCapture: function scrollResponderHandleStartShouldSetResponderCapture(e) {
// First see if we want to eat taps while the keyboard is up
// let currentlyFocusedTextInput = TextInputState.currentlyFocusedField();
// if (!this.props.keyboardShouldPersistTaps &&
// currentlyFocusedTextInput != null &&
// e.target !== currentlyFocusedTextInput) {
// return true;
// }
return this.scrollResponderIsAnimating();
},
/**
* make sure responder is `listview` self
*
* Invoke this from an `onMoveShouldSetResponderCapture` event
*/
scrollResponderHandleMoveShouldSetResponderCapture: function scrollResponderHandleMoveShouldSetResponderCapture(e) {
return true;
},
/**
* Invoke this from an `onResponderReject` event.
*
* Some other element is not yielding its role as responder. Normally, we'd
* just disable the `UIScrollView`, but a touch has already began on it, the
* `UIScrollView` will not accept being disabled after that. The easiest
* solution for now is to accept the limitation of disallowing this
* altogether. To improve this, find a way to disable the `UIScrollView` after
* a touch has already started.
*/
scrollResponderHandleResponderReject: function scrollResponderHandleResponderReject() {
(0, _warning2["default"])(false, "ScrollView doesn't take rejection well - scrolls anyway");
},
/**
* We will allow the scroll view to give up its lock iff it acquired the lock
* during an animation. This is a very useful default that happens to satisfy
* many common user experiences.
*
* - Stop a scroll on the left edge, then turn that into an outer view's
* backswipe.
* - Stop a scroll mid-bounce at the top, continue pulling to have the outer
* view dismiss.
* - However, without catching the scroll view mid-bounce (while it is
* motionless), if you drag far enough for the scroll view to become
* responder (and therefore drag the scroll view a bit), any backswipe
* navigation of a swipe gesture higher in the view hierarchy, should be
* rejected.
*/
scrollResponderHandleTerminationRequest: function scrollResponderHandleTerminationRequest() {
return !this.state.observedScrollSinceBecomingResponder;
},
/**
* Invoke this from an `onTouchEnd` event.
*
* @param {SyntheticEvent} e Event.
*/
scrollResponderHandleTouchEnd: function scrollResponderHandleTouchEnd(e) {
var nativeEvent = e.nativeEvent;
this.state.isTouching = nativeEvent.touches.length !== 0;
this.props.onTouchEnd && this.props.onTouchEnd(e);
},
/**
* Invoke this from an `onResponderRelease` event.
*/
scrollResponderHandleResponderRelease: function scrollResponderHandleResponderRelease(e) {
this.props.onResponderRelease && this.props.onResponderRelease(e);
// By default scroll views will unfocus a textField
// if another touch occurs outside of it
// let currentlyFocusedTextInput = TextInputState.currentlyFocusedField();
if (!this.props.keyboardShouldPersistTaps &&
// currentlyFocusedTextInput != null && e.target !== currentlyFocusedTextInput &&
!this.state.observedScrollSinceBecomingResponder && !this.state.becameResponderWhileAnimating) {
this.props.onScrollResponderKeyboardDismissed && this.props.onScrollResponderKeyboardDismissed(e);
// TextInputState.blurTextInput(currentlyFocusedTextInput);
}
},
scrollResponderHandleScroll: function scrollResponderHandleScroll(e) {
this.state.observedScrollSinceBecomingResponder = true;
this.props.onScroll && this.props.onScroll(e);
},
/**
* Invoke this from an `onResponderGrant` event.
*/
scrollResponderHandleResponderGrant: function scrollResponderHandleResponderGrant(e) {
this.state.observedScrollSinceBecomingResponder = false;
this.props.onResponderGrant && this.props.onResponderGrant(e);
this.state.becameResponderWhileAnimating = this.scrollResponderIsAnimating();
},
/**
* Unfortunately, `onScrollBeginDrag` also fires when *stopping* the scroll
* animation, and there's not an easy way to distinguish a drag vs. stopping
* momentum.
*
* Invoke this from an `onScrollBeginDrag` event.
*/
scrollResponderHandleScrollBeginDrag: function scrollResponderHandleScrollBeginDrag(e) {
this.props.onScrollBeginDrag && this.props.onScrollBeginDrag(e);
},
/**
* Invoke this from an `onScrollEndDrag` event.
*/
scrollResponderHandleScrollEndDrag: function scrollResponderHandleScrollEndDrag(e) {
this.props.onScrollEndDrag && this.props.onScrollEndDrag(e);
},
/**
* Invoke this from an `onMomentumScrollBegin` event.
*/
scrollResponderHandleMomentumScrollBegin: function scrollResponderHandleMomentumScrollBegin(e) {
this.state.lastMomentumScrollBeginTime = Date.now();
this.props.onMomentumScrollBegin && this.props.onMomentumScrollBegin(e);
},
/**
* Invoke this from an `onMomentumScrollEnd` event.
*/
scrollResponderHandleMomentumScrollEnd: function scrollResponderHandleMomentumScrollEnd(e) {
this.state.lastMomentumScrollEndTime = Date.now();
this.props.onMomentumScrollEnd && this.props.onMomentumScrollEnd(e);
},
/**
* Invoke this from an `onTouchStart` event.
*
* Since we know that the `SimpleEventPlugin` occurs later in the plugin
* order, after `ResponderEventPlugin`, we can detect that we were *not*
* permitted to be the responder (presumably because a contained view became
* responder). The `onResponderReject` won't fire in that case - it only
* fires when a *current* responder rejects our request.
*
* @param {SyntheticEvent} e Touch Start event.
*/
scrollResponderHandleTouchStart: function scrollResponderHandleTouchStart(e) {
this.state.isTouching = true;
this.props.onTouchStart && this.props.onTouchStart(e);
},
/**
* Invoke this from an `onTouchMove` event.
*
* Since we know that the `SimpleEventPlugin` occurs later in the plugin
* order, after `ResponderEventPlugin`, we can detect that we were *not*
* permitted to be the responder (presumably because a contained view became
* responder). The `onResponderReject` won't fire in that case - it only
* fires when a *current* responder rejects our request.
*
* @param {SyntheticEvent} e Touch Start event.
*/
scrollResponderHandleTouchMove: function scrollResponderHandleTouchMove(e) {
this.props.onTouchMove && this.props.onTouchMove(e);
},
/**
* A helper function for this class that lets us quickly determine if the
* view is currently animating. This is particularly useful to know when
* a touch has just started or ended.
*/
scrollResponderIsAnimating: function scrollResponderIsAnimating() {
var now = Date.now();
var timeSinceLastMomentumScrollEnd = now - this.state.lastMomentumScrollEndTime;
var isAnimating = timeSinceLastMomentumScrollEnd < IS_ANIMATING_TOUCH_START_THRESHOLD_MS || this.state.lastMomentumScrollEndTime < this.state.lastMomentumScrollBeginTime;
return isAnimating;
},
/**
* A helper function to scroll to a specific point in the scrollview.
* This is currently used to help focus on child textview's, but this
* can also be used to quickly scroll to any element we want to focus
*/
scrollResponderScrollTo: function scrollResponderScrollTo(offsetX, offsetY) {
// TODO: Add scroll animation
this.scrollResponderScrollWithouthAnimationTo(offsetX, offsetY);
},
/**
* Like `scrollResponderScrollTo` but immediately scrolls to the given
* position
*/
scrollResponderScrollWithouthAnimationTo: function scrollResponderScrollWithouthAnimationTo(offsetX, offsetY) {
var node = _reactDom2["default"].findDOMNode(this);
node.offsetX = offsetX;
node.offsetY = offsetY;
},
/**
* A helper function to zoom to a specific rect in the scrollview.
* @param {object} rect Should have shape {x, y, width, height}
*/
scrollResponderZoomTo: function scrollResponderZoomTo(rect) {
// RCTUIManager.zoomToRect(React.findNodeHandle(this), rect);
// TODO
},
/**
* This method should be used as the callback to onFocus in a TextInputs'
* parent view. Note that any module using this mixin needs to return
* the parent view's ref in getScrollViewRef() in order to use this method.
* @param {any} nodeHandle The TextInput node handle
* @param {number} additionalOffset The scroll view's top "contentInset".
* Default is 0.
* @param {bool} preventNegativeScrolling Whether to allow pulling the content
* down to make it meet the keyboard's top. Default is false.
*/
scrollResponderScrollNativeHandleToKeyboard: function scrollResponderScrollNativeHandleToKeyboard(nodeHandle, additionalOffset, preventNegativeScrollOffset) {
this.additionalScrollOffset = additionalOffset || 0;
this.preventNegativeScrollOffset = !!preventNegativeScrollOffset;
// RCTUIManager.measureLayout(
// nodeHandle,
// React.findNodeHandle(this.getInnerViewNode()),
// this.scrollResponderTextInputFocusError,
// this.scrollResponderInputMeasureAndScrollToKeyboard
// );
},
/**
* The calculations performed here assume the scroll view takes up the entire
* screen - even if has some content inset. We then measure the offsets of the
* keyboard, and compensate both for the scroll view's "contentInset".
*
* @param {number} left Position of input w.r.t. table view.
* @param {number} top Position of input w.r.t. table view.
* @param {number} width Width of the text input.
* @param {number} height Height of the text input.
*/
scrollResponderInputMeasureAndScrollToKeyboard: function scrollResponderInputMeasureAndScrollToKeyboard(left, top, width, height) {
if (this.keyboardWillOpenTo) {
var scrollOffsetY = top - this.keyboardWillOpenTo.endCoordinates.screenY + height + this.additionalScrollOffset;
// By default, this can scroll with negative offset, pulling the content
// down so that the target component's bottom meets the keyboard's top.
// If requested otherwise, cap the offset at 0 minimum to avoid content
// shifting down.
if (this.preventNegativeScrollOffset) {
scrollOffsetY = Math.max(0, scrollOffsetY);
}
this.scrollResponderScrollTo(0, scrollOffsetY);
}
this.additionalOffset = 0;
this.preventNegativeScrollOffset = false;
},
scrollResponderTextInputFocusError: function scrollResponderTextInputFocusError(e) {
console.error('Error measuring text field: ', e);
},
/**
* `componentWillMount` is the closest thing to a standard "constructor" for
* React components.
*
* The `keyboardWillShow` is called before input focus.
*/
componentWillMount: function componentWillMount() {
// this.keyboardWillOpenTo = null;
// this.additionalScrollOffset = 0;
// this.addListenerOn(RCTDeviceEventEmitter, 'keyboardWillShow', this.scrollResponderKeyboardWillShow);
// this.addListenerOn(RCTDeviceEventEmitter, 'keyboardWillHide', this.scrollResponderKeyboardWillHide);
// this.addListenerOn(RCTDeviceEventEmitter, 'keyboardDidShow', this.scrollResponderKeyboardDidShow);
// this.addListenerOn(RCTDeviceEventEmitter, 'keyboardDidHide', this.scrollResponderKeyboardDidHide);
// warning(this.getInnerViewNode, 'You need to implement getInnerViewNode in '
// + this.constructor.displayName + ' to get full'
// + 'functionality from ScrollResponder mixin. See example of ListView and'
// + ' ScrollView.');
},
/**
* Warning, this may be called several times for a single keyboard opening.
* It's best to store the information in this method and then take any action
* at a later point (either in `keyboardDidShow` or other).
*
* Here's the order that events occur in:
* - focus
* - willShow {startCoordinates, endCoordinates} several times
* - didShow several times
* - blur
* - willHide {startCoordinates, endCoordinates} several times
* - didHide several times
*
* The `ScrollResponder` providesModule callbacks for each of these events.
* Even though any user could have easily listened to keyboard events
* themselves, using these `props` callbacks ensures that ordering of events
* is consistent - and not dependent on the order that the keyboard events are
* subscribed to. This matters when telling the scroll view to scroll to where
* the keyboard is headed - the scroll responder better have been notified of
* the keyboard destination before being instructed to scroll to where the
* keyboard will be. Stick to the `ScrollResponder` callbacks, and everything
* will work.
*
* WARNING: These callbacks will fire even if a keyboard is displayed in a
* different navigation pane. Filter out the events to determine if they are
* relevant to you. (For example, only if you receive these callbacks after
* you had explicitly focused a node etc).
*/
scrollResponderKeyboardWillShow: function scrollResponderKeyboardWillShow(e) {
this.keyboardWillOpenTo = e;
this.props.onKeyboardWillShow && this.props.onKeyboardWillShow(e);
},
scrollResponderKeyboardWillHide: function scrollResponderKeyboardWillHide(e) {
this.keyboardWillOpenTo = null;
this.props.onKeyboardWillHide && this.props.onKeyboardWillHide(e);
},
scrollResponderKeyboardDidShow: function scrollResponderKeyboardDidShow(e) {
// TODO(7693961): The event for DidShow is not available on iOS yet.
// Use the one from WillShow and do not assign.
if (e) {
this.keyboardWillOpenTo = e;
}
this.props.onKeyboardDidShow && this.props.onKeyboardDidShow(e);
},
scrollResponderKeyboardDidHide: function scrollResponderKeyboardDidHide() {
this.keyboardWillOpenTo = null;
this.props.onKeyboardDidHide && this.props.onKeyboardDidHide();
}
};
var ScrollResponder = {
Mixin: ScrollResponderMixin
};
module.exports = ScrollResponder;
/***/ },
/* 453 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _defineProperty2 = __webpack_require__(6);
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _classCallCheck2 = __webpack_require__(2);
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _possibleConstructorReturn2 = __webpack_require__(4);
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = __webpack_require__(3);
var _inherits3 = _interopRequireDefault(_inherits2);
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _reactDom = __webpack_require__(10);
var _reactDom2 = _interopRequireDefault(_reactDom);
var _zscroller = __webpack_require__(131);
var _zscroller2 = _interopRequireDefault(_zscroller);
var _objectAssign = __webpack_require__(12);
var _objectAssign2 = _interopRequireDefault(_objectAssign);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var _util = __webpack_require__(129);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var SCROLLVIEW = 'ScrollView';
var INNERVIEW = 'InnerScrollView';
// https://github.com/facebook/react-native/blob/master/Libraries/Components/ScrollView/ScrollView.js
// https://facebook.github.io/react-native/docs/refreshcontrol.html
/* eslint react/prop-types: 0, react/sort-comp: 0, no-unused-expressions: 0 */
var propTypes = {
children: _react.PropTypes.any,
className: _react.PropTypes.string,
prefixCls: _react.PropTypes.string,
listPrefixCls: _react.PropTypes.string,
listViewPrefixCls: _react.PropTypes.string,
style: _react.PropTypes.object,
contentContainerStyle: _react.PropTypes.object,
onScroll: _react.PropTypes.func,
scrollEventThrottle: _react.PropTypes.number,
removeClippedSubviews: _react.PropTypes.bool, // offscreen views are removed
refreshControl: _react.PropTypes.element
};
var styles = {
base: {
position: 'relative',
overflow: 'auto',
WebkitOverflowScrolling: 'touch',
flex: 1
},
zScroller: {
position: 'relative',
overflow: 'hidden',
flex: 1
}
};
var ScrollView = function (_React$Component) {
(0, _inherits3["default"])(ScrollView, _React$Component);
function ScrollView() {
var _temp, _this, _ret;
(0, _classCallCheck3["default"])(this, ScrollView);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3["default"])(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.throttleScroll = function () {
var handleScroll = function handleScroll() {};
if (_this.props.scrollEventThrottle && _this.props.onScroll) {
handleScroll = (0, _util.throttle)(function (e) {
_this.props.onScroll && _this.props.onScroll(e);
}, _this.props.scrollEventThrottle);
}
return handleScroll;
}, _this.scrollingComplete = function () {
if (_this.props.refreshControl && _this.refs.refreshControl.state.deactive) {
_this.refs.refreshControl.setState({ deactive: false });
}
}, _temp), (0, _possibleConstructorReturn3["default"])(_this, _ret);
}
ScrollView.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
if (prevProps.refreshControl && this.props.refreshControl) {
var preRefreshing = prevProps.refreshControl.props.refreshing;
var nowRefreshing = this.props.refreshControl.props.refreshing;
if (preRefreshing && !nowRefreshing && this.refreshControlRefresh) {
this.refreshControlRefresh();
} else if (!this.manuallyRefresh && !preRefreshing && nowRefreshing) {
this.domScroller.scroller.triggerPullToRefresh();
}
}
};
ScrollView.prototype.componentDidMount = function componentDidMount() {
var _this2 = this;
this.tsExec = this.throttleScroll();
// IE supports onresize on all HTML elements.
// In all other Browsers the onresize is only available at the window object
this.onLayout = function () {
return _this2.props.onLayout({
nativeEvent: { layout: { width: window.innerWidth, height: window.innerHeight } }
});
};
var ele = _reactDom2["default"].findDOMNode(this.refs[SCROLLVIEW]);
if (this.props.stickyHeader || this.props.useBodyScroll) {
window.addEventListener('scroll', this.tsExec);
window.addEventListener('resize', this.onLayout);
// todo
// ele.addEventListener('resize', this.onContentSizeChange);
} else {
// todo
// ele.addEventListener('resize', this.onLayout);
// ReactDOM.findDOMNode(this.refs[INNERVIEW])
// .addEventListener('resize', this.onContentSizeChange);
if (this.props.useZscroller) {
this.renderZscroller();
} else {
ele.addEventListener('scroll', this.tsExec);
}
}
};
ScrollView.prototype.componentWillUnmount = function componentWillUnmount() {
if (this.props.stickyHeader || this.props.useBodyScroll) {
window.removeEventListener('scroll', this.tsExec);
window.removeEventListener('resize', this.onLayout);
} else if (this.props.useZscroller) {
this.domScroller.destroy();
} else {
_reactDom2["default"].findDOMNode(this.refs[SCROLLVIEW]).removeEventListener('scroll', this.tsExec);
}
};
ScrollView.prototype.scrollTo = function scrollTo() {
if (this.props.stickyHeader || this.props.useBodyScroll) {
var _window;
(_window = window).scrollTo.apply(_window, arguments);
} else if (this.props.useZscroller) {
var _domScroller$scroller;
(_domScroller$scroller = this.domScroller.scroller).scrollTo.apply(_domScroller$scroller, arguments);
} else {
var ele = _reactDom2["default"].findDOMNode(this.refs[SCROLLVIEW]);
ele.scrollLeft = arguments.length <= 0 ? undefined : arguments[0];
ele.scrollTop = arguments.length <= 1 ? undefined : arguments[1];
}
};
ScrollView.prototype.renderZscroller = function renderZscroller() {
var _this3 = this;
var _props = this.props,
scrollerOptions = _props.scrollerOptions,
refreshControl = _props.refreshControl;
this.domScroller = new _zscroller2["default"](_reactDom2["default"].findDOMNode(this.refs[INNERVIEW]), (0, _objectAssign2["default"])({}, {
scrollingX: false,
onScroll: this.tsExec,
scrollingComplete: this.scrollingComplete
}, scrollerOptions));
if (refreshControl) {
var scroller = this.domScroller.scroller;
var _refreshControl$props = refreshControl.props,
distanceToRefresh = _refreshControl$props.distanceToRefresh,
onRefresh = _refreshControl$props.onRefresh;
scroller.activatePullToRefresh(distanceToRefresh, function () {
_this3.manuallyRefresh = true;
_this3.refs.refreshControl.setState({ active: true });
}, function () {
_this3.manuallyRefresh = false;
_this3.refs.refreshControl.setState({ deactive: true, active: false, loadingState: false });
}, function () {
_this3.refs.refreshControl.setState({ deactive: false, loadingState: true });
var finishPullToRefresh = function finishPullToRefresh() {
scroller.finishPullToRefresh();
_this3.refreshControlRefresh = null;
};
Promise.all([new Promise(function (resolve) {
onRefresh();
_this3.refreshControlRefresh = resolve;
}),
// at lease 1s for ux
new Promise(function (resolve) {
return setTimeout(resolve, 1000);
})]).then(finishPullToRefresh, finishPullToRefresh);
});
if (refreshControl.props.refreshing) {
scroller.triggerPullToRefresh();
}
}
};
ScrollView.prototype.render = function render() {
var _classNames, _classNames2;
var _props2 = this.props,
children = _props2.children,
className = _props2.className,
_props2$prefixCls = _props2.prefixCls,
prefixCls = _props2$prefixCls === undefined ? '' : _props2$prefixCls,
_props2$listPrefixCls = _props2.listPrefixCls,
listPrefixCls = _props2$listPrefixCls === undefined ? '' : _props2$listPrefixCls,
_props2$listViewPrefi = _props2.listViewPrefixCls,
listViewPrefixCls = _props2$listViewPrefi === undefined ? 'rmc-list-view' : _props2$listViewPrefi,
_props2$style = _props2.style,
style = _props2$style === undefined ? {} : _props2$style,
contentContainerStyle = _props2.contentContainerStyle,
useZscroller = _props2.useZscroller,
refreshControl = _props2.refreshControl,
stickyHeader = _props2.stickyHeader,
useBodyScroll = _props2.useBodyScroll;
var styleBase = styles.base;
if (stickyHeader || useBodyScroll) {
styleBase = null;
} else if (useZscroller) {
styleBase = styles.zScroller;
}
var preCls = prefixCls || listViewPrefixCls || '';
var containerProps = {
ref: SCROLLVIEW,
style: (0, _objectAssign2["default"])({}, styleBase, style),
className: (0, _classnames2["default"])((_classNames = {}, (0, _defineProperty3["default"])(_classNames, className, !!className), (0, _defineProperty3["default"])(_classNames, preCls + '-scrollview', true), _classNames))
};
var contentContainerProps = {
ref: INNERVIEW,
style: (0, _objectAssign2["default"])({}, { position: 'absolute', minWidth: '100%' }, contentContainerStyle),
className: (0, _classnames2["default"])((_classNames2 = {}, (0, _defineProperty3["default"])(_classNames2, preCls + '-scrollview-content', true), (0, _defineProperty3["default"])(_classNames2, listPrefixCls, !!listPrefixCls), _classNames2))
};
if (refreshControl) {
return _react2["default"].createElement(
'div',
containerProps,
_react2["default"].createElement(
'div',
contentContainerProps,
_react2["default"].cloneElement(refreshControl, { ref: 'refreshControl' }),
children
)
);
}
if (stickyHeader || useBodyScroll) {
return _react2["default"].createElement(
'div',
containerProps,
children
);
}
return _react2["default"].createElement(
'div',
containerProps,
_react2["default"].createElement(
'div',
contentContainerProps,
children
)
);
};
return ScrollView;
}(_react2["default"].Component);
ScrollView.propTypes = propTypes;
exports["default"] = ScrollView;
module.exports = exports['default'];
/***/ },
/* 454 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _classCallCheck2 = __webpack_require__(2);
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _possibleConstructorReturn2 = __webpack_require__(4);
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = __webpack_require__(3);
var _inherits3 = _interopRequireDefault(_inherits2);
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var StaticRenderer = function (_React$Component) {
(0, _inherits3["default"])(StaticRenderer, _React$Component);
function StaticRenderer() {
(0, _classCallCheck3["default"])(this, StaticRenderer);
return (0, _possibleConstructorReturn3["default"])(this, _React$Component.apply(this, arguments));
}
StaticRenderer.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps) {
return nextProps.shouldUpdate;
};
StaticRenderer.prototype.render = function render() {
return this.props.render();
};
return StaticRenderer;
}(_react2["default"].Component);
StaticRenderer.propTypes = {
shouldUpdate: _react.PropTypes.bool.isRequired,
render: _react.PropTypes.func.isRequired
};
exports["default"] = StaticRenderer;
module.exports = exports['default'];
/***/ },
/* 455 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = {
getDefaultProps: function getDefaultProps() {
return {
prefixCls: 'rmc-multi-picker',
pickerPrefixCls: 'rmc-picker',
onValueChange: function onValueChange() {},
disabled: false
};
},
getValue: function getValue() {
var _props = this.props,
children = _props.children,
selectedValue = _props.selectedValue;
if (selectedValue && selectedValue.length) {
return selectedValue;
} else {
if (!children) {
return [];
}
return children.map(function (c) {
var cc = c.props.children;
return cc && cc[0] && cc[0].value;
});
}
},
onValueChange: function onValueChange(i, v) {
var value = this.getValue().concat();
value[i] = v;
this.props.onValueChange(value, i);
}
};
module.exports = exports['default'];
/***/ },
/* 456 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _defineProperty2 = __webpack_require__(6);
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var _zscroller = __webpack_require__(131);
var _zscroller2 = _interopRequireDefault(_zscroller);
var _PickerMixin = __webpack_require__(457);
var _PickerMixin2 = _interopRequireDefault(_PickerMixin);
var _isChildrenEqual = __webpack_require__(459);
var _isChildrenEqual2 = _interopRequireDefault(_isChildrenEqual);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var Picker = _react2["default"].createClass({
displayName: 'Picker',
mixins: [_PickerMixin2["default"]],
getDefaultProps: function getDefaultProps() {
return {
prefixCls: 'rmc-picker',
pure: true,
onValueChange: function onValueChange() {}
};
},
getInitialState: function getInitialState() {
var selectedValueState = void 0;
var _props = this.props,
selectedValue = _props.selectedValue,
defaultSelectedValue = _props.defaultSelectedValue,
children = _props.children;
if (selectedValue !== undefined) {
selectedValueState = selectedValue;
} else if (defaultSelectedValue !== undefined) {
selectedValueState = defaultSelectedValue;
} else if (children && children.length) {
selectedValueState = children[0].value;
}
return {
selectedValue: selectedValueState
};
},
componentDidMount: function componentDidMount() {
// https://github.com/react-component/m-picker/issues/18
this.itemHeight = this.refs.indicator.getBoundingClientRect().height;
// compact
this.refs.content.style.padding = this.itemHeight * 3 + 'px 0';
this.zscroller = new _zscroller2["default"](this.refs.content, {
scrollingX: false,
snapping: true,
penetrationDeceleration: .1,
minVelocityToKeepDecelerating: 0.5,
scrollingComplete: this.scrollingComplete
});
this.zscroller.setDisabled(this.props.disabled);
this.zscroller.scroller.setSnapSize(0, this.itemHeight);
this.select(this.state.selectedValue);
},
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
if ('selectedValue' in nextProps) {
this.setState({
selectedValue: nextProps.selectedValue
});
}
this.zscroller.setDisabled(nextProps.disabled);
},
shouldComponentUpdate: function shouldComponentUpdate(nextProps, nextState) {
return this.state.selectedValue !== nextState.selectedValue || !(0, _isChildrenEqual2["default"])(this.props.children, nextProps.children, this.props.pure);
},
componentDidUpdate: function componentDidUpdate() {
this.zscroller.reflow();
this.select(this.state.selectedValue);
},
componentWillUnmount: function componentWillUnmount() {
this.zscroller.destroy();
},
scrollTo: function scrollTo(top) {
this.zscroller.scroller.scrollTo(0, top);
},
fireValueChange: function fireValueChange(selectedValue) {
if (selectedValue !== this.state.selectedValue) {
if (!('selectedValue' in this.props)) {
this.setState({
selectedValue: selectedValue
});
}
this.props.onValueChange(selectedValue);
}
},
scrollingComplete: function scrollingComplete() {
var _zscroller$scroller$g = this.zscroller.scroller.getValues(),
top = _zscroller$scroller$g.top;
if (top >= 0) {
this.doScrollingComplete(top);
}
},
getChildMember: function getChildMember(child, m) {
return child[m];
},
getValue: function getValue() {
return this.props.selectedValue || this.props.children && this.props.children[0] && this.props.children[0].value;
},
toChildrenArray: function toChildrenArray(children) {
return children;
},
render: function render() {
var _pickerCls;
var _props2 = this.props,
children = _props2.children,
prefixCls = _props2.prefixCls,
className = _props2.className,
itemStyle = _props2.itemStyle,
indicatorStyle = _props2.indicatorStyle;
var selectedValue = this.state.selectedValue;
var itemClassName = prefixCls + '-item';
var selectedItemClassName = itemClassName + ' ' + prefixCls + '-item-selected';
var items = children.map(function (item) {
return _react2["default"].createElement(
'div',
{ style: itemStyle, className: selectedValue === item.value ? selectedItemClassName : itemClassName, key: item.value },
item.label
);
});
var pickerCls = (_pickerCls = {}, (0, _defineProperty3["default"])(_pickerCls, className, !!className), (0, _defineProperty3["default"])(_pickerCls, prefixCls, true), _pickerCls);
return _react2["default"].createElement(
'div',
{ className: (0, _classnames2["default"])(pickerCls) },
_react2["default"].createElement('div', { className: prefixCls + '-mask' }),
_react2["default"].createElement('div', { className: prefixCls + '-indicator', ref: 'indicator', style: indicatorStyle }),
_react2["default"].createElement(
'div',
{ className: prefixCls + '-content', ref: 'content' },
items
)
);
}
});
exports["default"] = Picker;
module.exports = exports['default'];
/***/ },
/* 457 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
/* tslint:disable:no-console */
exports["default"] = {
select: function select(value) {
var children = this.toChildrenArray(this.props.children);
for (var i = 0, len = children.length; i < len; i++) {
if (this.getChildMember(children[i], 'value') === value) {
this.selectByIndex(i);
return;
}
}
this.selectByIndex(0);
},
selectByIndex: function selectByIndex(index) {
if (index < 0 || index >= this.toChildrenArray(this.props.children).length || !this.itemHeight) {
return;
}
this.scrollTo(index * this.itemHeight);
},
doScrollingComplete: function doScrollingComplete(top) {
var index = top / this.itemHeight;
var floor = Math.floor(index);
if (index - floor > 0.5) {
index = floor + 1;
} else {
index = floor;
}
var children = this.toChildrenArray(this.props.children);
index = Math.min(index, children.length - 1);
var child = children[index];
if (child) {
this.fireValueChange(this.getChildMember(child, 'value'));
} else if (console.warn) {
console.warn('child not found', children, index);
}
}
};
module.exports = exports['default'];
/***/ },
/* 458 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _defineProperty2 = __webpack_require__(6);
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function noop() {}
exports["default"] = {
getDefaultProps: function getDefaultProps() {
return {
onVisibleChange: noop,
okText: 'Ok',
pickerValueProp: 'selectedValue',
pickerValueChangeProp: 'onValueChange',
dismissText: 'Dismiss',
title: '',
onOk: noop,
onDismiss: noop
};
},
getInitialState: function getInitialState() {
return {
pickerValue: 'value' in this.props ? this.props.value : null,
visible: this.props.visible || false
};
},
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
if ('value' in nextProps) {
this.setState({
pickerValue: nextProps.value
});
}
if ('visible' in nextProps) {
this.setVisibleState(nextProps.visible);
}
},
onPickerChange: function onPickerChange(pickerValue) {
if (this.state.pickerValue !== pickerValue) {
this.setState({
pickerValue: pickerValue
});
var _props = this.props,
picker = _props.picker,
pickerValueChangeProp = _props.pickerValueChangeProp;
if (picker && picker.props[pickerValueChangeProp]) {
picker.props[pickerValueChangeProp](pickerValue);
}
}
},
saveRef: function saveRef(picker) {
this.picker = picker;
},
setVisibleState: function setVisibleState(visible) {
this.setState({
visible: visible
});
if (!visible) {
this.setState({
pickerValue: null
});
}
},
fireVisibleChange: function fireVisibleChange(visible) {
if (this.state.visible !== visible) {
if (!('visible' in this.props)) {
this.setVisibleState(visible);
}
this.props.onVisibleChange(visible);
}
},
getRender: function getRender() {
var props = this.props;
var children = props.children;
if (!children) {
return this.getModal();
}
var _props2 = this.props,
WrapComponent = _props2.WrapComponent,
disabled = _props2.disabled;
var child = children;
var newChildProps = {};
if (!disabled) {
newChildProps[props.triggerType] = this.onTriggerClick;
}
return _react2["default"].createElement(
WrapComponent,
{ style: props.wrapStyle },
_react2["default"].cloneElement(child, newChildProps),
this.getModal()
);
},
onTriggerClick: function onTriggerClick(e) {
var child = this.props.children;
var childProps = child.props || {};
if (childProps[this.props.triggerType]) {
childProps[this.props.triggerType](e);
}
this.fireVisibleChange(!this.state.visible);
},
onOk: function onOk() {
this.props.onOk(this.picker && this.picker.getValue());
this.fireVisibleChange(false);
},
getContent: function getContent() {
if (this.props.picker) {
var _React$cloneElement;
var pickerValue = this.state.pickerValue;
if (pickerValue === null) {
pickerValue = this.props.value;
}
return _react2["default"].cloneElement(this.props.picker, (_React$cloneElement = {}, (0, _defineProperty3["default"])(_React$cloneElement, this.props.pickerValueProp, pickerValue), (0, _defineProperty3["default"])(_React$cloneElement, this.props.pickerValueChangeProp, this.onPickerChange), (0, _defineProperty3["default"])(_React$cloneElement, 'ref', this.saveRef), _React$cloneElement));
} else {
return this.props.content;
}
},
onDismiss: function onDismiss() {
this.props.onDismiss();
this.fireVisibleChange(false);
},
hide: function hide() {
this.fireVisibleChange(false);
}
};
module.exports = exports['default'];
/***/ },
/* 459 */
/***/ function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isEmptyArray = isEmptyArray;
exports["default"] = isChildrenEqual;
function isEmptyArray(a) {
return !a || !a.length;
}
function isChildrenEqual(c1, c2, pure) {
if (isEmptyArray(c1) && isEmptyArray(c2)) {
return true;
}
if (pure) {
return c1 === c2;
}
if (c1.length !== c2.length) {
return false;
}
var len = c1.length;
for (var i = 0; i < len; i++) {
if (c1[i].value !== c2[i].value || c1[i].label !== c2[i].label) {
return false;
}
}
return true;
}
/***/ },
/* 460 */
/***/ function(module, exports) {
function objToStr(x){ return Object.prototype.toString.call(x); };
function returner(x) { return x; }
function wrapIfFunction(thing){
return typeof thing !== "function" ? thing
: function(){
return thing.apply(this, arguments);
};
}
function setNonEnumerable(target, key, value){
if (key in target){
target[key] = value;
}
else {
Object.defineProperty(target, key, {
value: value,
writable: true,
configurable: true
});
}
}
function defaultNonFunctionProperty(left, right, key){
if (left !== undefined && right !== undefined) {
var getTypeName = function(obj){
if (obj && obj.constructor && obj.constructor.name) {
return obj.constructor.name;
}
else {
return objToStr(obj).slice(8, -1);
}
};
throw new TypeError('Cannot mixin key ' + key + ' because it is provided by multiple sources, '
+ 'and the types are ' + getTypeName(left) + ' and ' + getTypeName(right));
}
return left === undefined ? right : left;
};
function assertObject(obj, obj2){
var type = objToStr(obj);
if (type !== '[object Object]') {
var displayType = obj.constructor ? obj.constructor.name : 'Unknown';
var displayType2 = obj2.constructor ? obj2.constructor.name : 'Unknown';
throw new Error('cannot merge returned value of type ' + displayType + ' with an ' + displayType2);
}
};
var mixins = module.exports = function makeMixinFunction(rules, _opts){
var opts = _opts || {};
if (!opts.unknownFunction) {
opts.unknownFunction = mixins.ONCE;
}
if (!opts.nonFunctionProperty) {
opts.nonFunctionProperty = defaultNonFunctionProperty;
}
return function applyMixin(source, mixin){
Object.keys(mixin).forEach(function(key){
var left = source[key], right = mixin[key], rule = rules[key];
// this is just a weird case where the key was defined, but there's no value
// behave like the key wasn't defined
if (left === undefined && right === undefined) return;
// do we have a rule for this key?
if (rule) {
// may throw here
var fn = rule(left, right, key);
setNonEnumerable(source, key, wrapIfFunction(fn));
return;
}
var leftIsFn = typeof left === "function";
var rightIsFn = typeof right === "function";
// check to see if they're some combination of functions or undefined
// we already know there's no rule, so use the unknown function behavior
if (leftIsFn && right === undefined
|| rightIsFn && left === undefined
|| leftIsFn && rightIsFn) {
// may throw, the default is ONCE so if both are functions
// the default is to throw
setNonEnumerable(source, key, wrapIfFunction(opts.unknownFunction(left, right, key)));
return;
}
// we have no rule for them, one may be a function but one or both aren't
// our default is MANY_MERGED_LOOSE which will merge objects, concat arrays
// and throw if there's a type mismatch or both are primitives (how do you merge 3, and "foo"?)
source[key] = opts.nonFunctionProperty(left, right, key);
});
};
};
mixins._mergeObjects = function(obj1, obj2) {
if (Array.isArray(obj1) && Array.isArray(obj2)) {
return obj1.concat(obj2);
}
assertObject(obj1, obj2);
assertObject(obj2, obj1);
var result = {};
Object.keys(obj1).forEach(function(k){
if (Object.prototype.hasOwnProperty.call(obj2, k)) {
throw new Error('cannot merge returns because both have the ' + JSON.stringify(k) + ' key');
}
result[k] = obj1[k];
});
Object.keys(obj2).forEach(function(k){
// we can skip the conflict check because all conflicts would already be found
result[k] = obj2[k];
});
return result;
};
// define our built-in mixin types
mixins.ONCE = function(left, right, key){
if (left && right) {
throw new TypeError('Cannot mixin ' + key + ' because it has a unique constraint.');
}
return left || right;
};
mixins.MANY = function(left, right, key){
return function(){
if (right) right.apply(this, arguments);
return left ? left.apply(this, arguments) : undefined;
};
};
mixins.MANY_MERGED_LOOSE = function(left, right, key) {
if (left && right) {
return mixins._mergeObjects(left, right);
}
return left || right;
};
mixins.MANY_MERGED = function(left, right, key){
return function(){
var res1 = right && right.apply(this, arguments);
var res2 = left && left.apply(this, arguments);
if (res1 && res2) {
return mixins._mergeObjects(res1, res2)
}
return res2 || res1;
};
};
mixins.REDUCE_LEFT = function(_left, _right, key){
var left = _left || returner;
var right = _right || returner;
return function(){
return right.call(this, left.apply(this, arguments));
};
};
mixins.REDUCE_RIGHT = function(_left, _right, key){
var left = _left || returner;
var right = _right || returner;
return function(){
return left.call(this, right.apply(this, arguments));
};
};
/***/ },
/* 461 */
/***/ function(module, exports) {
(function(host) {
var properties = {
browser: [
[/msie ([\.\_\d]+)/, "ie"],
[/trident\/.*?rv:([\.\_\d]+)/, "ie"],
[/firefox\/([\.\_\d]+)/, "firefox"],
[/chrome\/([\.\_\d]+)/, "chrome"],
[/version\/([\.\_\d]+).*?safari/, "safari"],
[/mobile safari ([\.\_\d]+)/, "safari"],
[/android.*?version\/([\.\_\d]+).*?safari/, "com.android.browser"],
[/crios\/([\.\_\d]+).*?safari/, "chrome"],
[/opera/, "opera"],
[/opera\/([\.\_\d]+)/, "opera"],
[/opera ([\.\_\d]+)/, "opera"],
[/opera mini.*?version\/([\.\_\d]+)/, "opera.mini"],
[/opios\/([a-z\.\_\d]+)/, "opera"],
[/blackberry/, "blackberry"],
[/blackberry.*?version\/([\.\_\d]+)/, "blackberry"],
[/bb\d+.*?version\/([\.\_\d]+)/, "blackberry"],
[/rim.*?version\/([\.\_\d]+)/, "blackberry"],
[/iceweasel\/([\.\_\d]+)/, "iceweasel"],
[/edge\/([\.\d]+)/, "edge"]
],
os: [
[/linux ()([a-z\.\_\d]+)/, "linux"],
[/mac os x/, "macos"],
[/mac os x.*?([\.\_\d]+)/, "macos"],
[/os ([\.\_\d]+) like mac os/, "ios"],
[/openbsd ()([a-z\.\_\d]+)/, "openbsd"],
[/android/, "android"],
[/android ([a-z\.\_\d]+);/, "android"],
[/mozilla\/[a-z\.\_\d]+ \((?:mobile)|(?:tablet)/, "firefoxos"],
[/windows\s*(?:nt)?\s*([\.\_\d]+)/, "windows"],
[/windows phone.*?([\.\_\d]+)/, "windows.phone"],
[/windows mobile/, "windows.mobile"],
[/blackberry/, "blackberryos"],
[/bb\d+/, "blackberryos"],
[/rim.*?os\s*([\.\_\d]+)/, "blackberryos"]
],
device: [
[/ipad/, "ipad"],
[/iphone/, "iphone"],
[/lumia/, "lumia"],
[/htc/, "htc"],
[/nexus/, "nexus"],
[/galaxy nexus/, "galaxy.nexus"],
[/nokia/, "nokia"],
[/ gt\-/, "galaxy"],
[/ sm\-/, "galaxy"],
[/xbox/, "xbox"],
[/(?:bb\d+)|(?:blackberry)|(?: rim )/, "blackberry"]
]
};
var UNKNOWN = "Unknown";
var propertyNames = Object.keys(properties);
function Sniffr() {
var self = this;
propertyNames.forEach(function(propertyName) {
self[propertyName] = {
name: UNKNOWN,
version: [],
versionString: UNKNOWN
};
});
}
function determineProperty(self, propertyName, userAgent) {
properties[propertyName].forEach(function(propertyMatcher) {
var propertyRegex = propertyMatcher[0];
var propertyValue = propertyMatcher[1];
var match = userAgent.match(propertyRegex);
if (match) {
self[propertyName].name = propertyValue;
if (match[2]) {
self[propertyName].versionString = match[2];
self[propertyName].version = [];
} else if (match[1]) {
self[propertyName].versionString = match[1].replace(/_/g, ".");
self[propertyName].version = parseVersion(match[1]);
} else {
self[propertyName].versionString = UNKNOWN;
self[propertyName].version = [];
}
}
});
}
function parseVersion(versionString) {
return versionString.split(/[\._]/).map(function(versionPart) {
return parseInt(versionPart);
});
}
Sniffr.prototype.sniff = function(userAgentString) {
var self = this;
var userAgent = (userAgentString || navigator.userAgent || "").toLowerCase();
propertyNames.forEach(function(propertyName) {
determineProperty(self, propertyName, userAgent);
});
};
if (typeof module !== 'undefined' && module.exports) {
module.exports = Sniffr;
} else {
host.Sniffr = new Sniffr();
host.Sniffr.sniff(navigator.userAgent);
}
})(this);
/***/ },
/* 462 */
/***/ function(module, exports, __webpack_require__) {
var sprite = __webpack_require__(11);
var image = "";
module.exports = sprite.add(image, "check-circle-o");
/***/ },
/* 463 */
/***/ function(module, exports, __webpack_require__) {
var sprite = __webpack_require__(11);
var image = "";
module.exports = sprite.add(image, "check-circle");
/***/ },
/* 464 */
/***/ function(module, exports, __webpack_require__) {
var sprite = __webpack_require__(11);
var image = "Operation Icons Copy 6";
module.exports = sprite.add(image, "check");
/***/ },
/* 465 */
/***/ function(module, exports, __webpack_require__) {
var sprite = __webpack_require__(11);
var image = "step-48-错误-实心Created with Sketch.";
module.exports = sprite.add(image, "cross-circle-o");
/***/ },
/* 466 */
/***/ function(module, exports, __webpack_require__) {
var sprite = __webpack_require__(11);
var image = "";
module.exports = sprite.add(image, "cross-circle");
/***/ },
/* 467 */
/***/ function(module, exports, __webpack_require__) {
var sprite = __webpack_require__(11);
var image = "";
module.exports = sprite.add(image, "cross");
/***/ },
/* 468 */
/***/ function(module, exports, __webpack_require__) {
var sprite = __webpack_require__(11);
var image = "Operation Icons Copy 4";
module.exports = sprite.add(image, "down");
/***/ },
/* 469 */
/***/ function(module, exports, __webpack_require__) {
var sprite = __webpack_require__(11);
var image = "ellipsis-circle-cpCreated with Sketch.";
module.exports = sprite.add(image, "ellipsis-circle");
/***/ },
/* 470 */
/***/ function(module, exports, __webpack_require__) {
var sprite = __webpack_require__(11);
var image = "";
module.exports = sprite.add(image, "ellipsis");
/***/ },
/* 471 */
/***/ function(module, exports, __webpack_require__) {
var sprite = __webpack_require__(11);
var image = "Share Icons Copy 3";
module.exports = sprite.add(image, "exclamation-circle");
/***/ },
/* 472 */
/***/ function(module, exports, __webpack_require__) {
var sprite = __webpack_require__(11);
var image = "";
module.exports = sprite.add(image, "info-circle");
/***/ },
/* 473 */
/***/ function(module, exports, __webpack_require__) {
var sprite = __webpack_require__(11);
var image = "";
module.exports = sprite.add(image, "koubei-o");
/***/ },
/* 474 */
/***/ function(module, exports, __webpack_require__) {
var sprite = __webpack_require__(11);
var image = "口碑";
module.exports = sprite.add(image, "koubei");
/***/ },
/* 475 */
/***/ function(module, exports, __webpack_require__) {
var sprite = __webpack_require__(11);
var image = "Operation Icons Copy 4";
module.exports = sprite.add(image, "left");
/***/ },
/* 476 */
/***/ function(module, exports, __webpack_require__) {
var sprite = __webpack_require__(11);
var image = "";
module.exports = sprite.add(image, "loading");
/***/ },
/* 477 */
/***/ function(module, exports, __webpack_require__) {
var sprite = __webpack_require__(11);
var image = "Operation Icons Copy 12";
module.exports = sprite.add(image, "question-circle");
/***/ },
/* 478 */
/***/ function(module, exports, __webpack_require__) {
var sprite = __webpack_require__(11);
var image = "Operation Icons Copy 4";
module.exports = sprite.add(image, "right");
/***/ },
/* 479 */
/***/ function(module, exports, __webpack_require__) {
var sprite = __webpack_require__(11);
var image = "System Icons Copy 8";
module.exports = sprite.add(image, "search");
/***/ },
/* 480 */
/***/ function(module, exports, __webpack_require__) {
var sprite = __webpack_require__(11);
var image = "Operation Icons Copy 4backgroundLayer 1";
module.exports = sprite.add(image, "up");
/***/ },
/* 481 */
/***/ function(module, exports, __webpack_require__) {
var sprite = __webpack_require__(11);
var image = "tripsCreated with Sketch.";
module.exports = sprite.add(image, "trips");
/***/ },
/* 482 */
/***/ function(module, exports, __webpack_require__) {
var sprite = __webpack_require__(11);
var image = "RectangleCreated with Sketch.";
module.exports = sprite.add(image, "minus");
/***/ },
/* 483 */
/***/ function(module, exports, __webpack_require__) {
var sprite = __webpack_require__(11);
var image = "Combined ShapeCreated with Sketch.";
module.exports = sprite.add(image, "plus");
/***/ },
/* 484 */
/***/ function(module, exports, __webpack_require__) {
var sprite = __webpack_require__(11);
var image = "哭脸Created with Sketch.";
module.exports = sprite.add(image, "dislike");
/***/ },
/* 485 */
/***/ function(module, exports, __webpack_require__) {
var sprite = __webpack_require__(11);
var image = "失败Created with Sketch.";
module.exports = sprite.add(image, "fail");
/***/ },
/* 486 */
/***/ function(module, exports, __webpack_require__) {
var sprite = __webpack_require__(11);
var image = "成功Created with Sketch.";
module.exports = sprite.add(image, "success");
/***/ },
/* 487 */
/***/ function(module, exports, __webpack_require__) {
var Sniffr = __webpack_require__(461);
/**
* List of SVG attributes to fix url target in them
* @type {string[]}
*/
var fixAttributes = [
'clipPath',
'colorProfile',
'src',
'cursor',
'fill',
'filter',
'marker',
'markerStart',
'markerMid',
'markerEnd',
'mask',
'stroke'
];
/**
* Query to find'em
* @type {string}
*/
var fixAttributesQuery = '[' + fixAttributes.join('],[') + ']';
/**
* @type {RegExp}
*/
var URI_FUNC_REGEX = /^url\((.*)\)$/;
/**
* Convert array-like to array
* @param {Object} arrayLike
* @returns {Array.<*>}
*/
function arrayFrom(arrayLike) {
return Array.prototype.slice.call(arrayLike, 0);
}
/**
* Handles forbidden symbols which cannot be directly used inside attributes with url(...) content.
* Adds leading slash for the brackets
* @param {string} url
* @return {string} encoded url
*/
function encodeUrlForEmbedding(url) {
return url.replace(/\(|\)/g, "\\$&");
}
/**
* Replaces prefix in `url()` functions
* @param {Element} svg
* @param {string} currentUrlPrefix
* @param {string} newUrlPrefix
*/
function baseUrlWorkAround(svg, currentUrlPrefix, newUrlPrefix) {
var nodes = svg.querySelectorAll(fixAttributesQuery);
if (!nodes) {
return;
}
arrayFrom(nodes).forEach(function (node) {
if (!node.attributes) {
return;
}
arrayFrom(node.attributes).forEach(function (attribute) {
var attributeName = attribute.localName.toLowerCase();
if (fixAttributes.indexOf(attributeName) !== -1) {
var match = URI_FUNC_REGEX.exec(node.getAttribute(attributeName));
// Do not touch urls with unexpected prefix
if (match && match[1].indexOf(currentUrlPrefix) === 0) {
var referenceUrl = encodeUrlForEmbedding(newUrlPrefix + match[1].split(currentUrlPrefix)[1]);
node.setAttribute(attributeName, 'url(' + referenceUrl + ')');
}
}
});
});
}
/**
* Because of Firefox bug #353575 gradients and patterns don't work if they are within a symbol.
* To workaround this we move the gradient definition outside the symbol element
* @see https://bugzilla.mozilla.org/show_bug.cgi?id=353575
* @param {Element} svg
*/
var FirefoxSymbolBugWorkaround = function (svg) {
var defs = svg.querySelector('defs');
var moveToDefsElems = svg.querySelectorAll('symbol linearGradient, symbol radialGradient, symbol pattern');
for (var i = 0, len = moveToDefsElems.length; i < len; i++) {
defs.appendChild(moveToDefsElems[i]);
}
};
/**
* Fix for browser (IE, maybe other too) which are throwing 'WrongDocumentError'
* if you insert an element which is not part of the document
* @see http://stackoverflow.com/questions/7981100/how-do-i-dynamically-insert-an-svg-image-into-html#7986519
* @param {Element} svg
*/
function importSvg(svg) {
try {
if (document.importNode) {
return document.importNode(svg, true);
}
} catch(e) {}
return svg;
}
/**
* @type {string}
*/
var DEFAULT_URI_PREFIX = '#';
/**
* @type {string}
*/
var xLinkHref = 'xlink:href';
/**
* @type {string}
*/
var xLinkNS = 'http://www.w3.org/1999/xlink';
/**
* @type {string}
*/
var svgOpening = '