/*!
* antd-mobile v0.7.3
*
* 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_9__) {
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__(133);
/***/ },
/* 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__(233);
var _setPrototypeOf2 = _interopRequireDefault(_setPrototypeOf);
var _create = __webpack_require__(231);
var _create2 = _interopRequireDefault(_create);
var _typeof2 = __webpack_require__(39);
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__(39);
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__(232);
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';
__webpack_require__(340);
__webpack_require__(326);
var pixelRatio = Math.floor(window.devicePixelRatio || 1);
if (pixelRatio >= 2) {
document.querySelector('html').classList.add('pixel-ratio-' + pixelRatio);
}
/***/ },
/* 8 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _assign = __webpack_require__(230);
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;
};
/***/ },
/* 9 */
/***/ function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_9__;
/***/ },
/* 10 */
/***/ function(module, exports) {
var core = module.exports = {version: '2.4.0'};
if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef
/***/ },
/* 11 */
/***/ function(module, exports) {
'use strict';
/* eslint-disable no-unused-vars */
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
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 (e) {
// 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 (Object.getOwnPropertySymbols) {
symbols = Object.getOwnPropertySymbols(from);
for (var i = 0; i < symbols.length; i++) {
if (propIsEnumerable.call(from, symbols[i])) {
to[symbols[i]] = from[symbols[i]];
}
}
}
}
return to;
};
/***/ },
/* 12 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _isIterable2 = __webpack_require__(229);
var _isIterable3 = _interopRequireDefault(_isIterable2);
var _getIterator2 = __webpack_require__(228);
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");
}
};
}();
/***/ },
/* 13 */
/***/ function(module, exports, __webpack_require__) {
var store = __webpack_require__(63)('wks')
, uid = __webpack_require__(42)
, Symbol = __webpack_require__(18).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;
/***/ },
/* 14 */
/***/ 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'];
/***/ },
/* 15 */
/***/ 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 React = _interopRequireWildcard(_react);
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 Icon = function (_React$Component) {
(0, _inherits3.default)(Icon, _React$Component);
function Icon() {
(0, _classCallCheck3.default)(this, Icon);
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
}
Icon.prototype.render = function render() {
var _props = this.props;
var type = _props.type;
var className = _props.className;
return React.createElement('i', { className: (className + ' anticon anticon-' + type).trim() });
};
return Icon;
}(React.Component);
exports.default = Icon;
Icon.defaultProps = {
className: ''
};
module.exports = exports['default'];
/***/ },
/* 16 */
/***/ 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 React = _interopRequireWildcard(_react);
var _ListHeader = __webpack_require__(175);
var _ListHeader2 = _interopRequireDefault(_ListHeader);
var _ListBody = __webpack_require__(173);
var _ListBody2 = _interopRequireDefault(_ListBody);
var _ListFooter = __webpack_require__(174);
var _ListFooter2 = _interopRequireDefault(_ListFooter);
var _ListItem = __webpack_require__(176);
var _ListItem2 = _interopRequireDefault(_ListItem);
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 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;
var prefixCls = _props.prefixCls;
var children = _props.children;
var className = _props.className;
var style = _props.style;
var wrapCls = (0, _classnames2.default)((_classNames = {}, (0, _defineProperty3.default)(_classNames, prefixCls, true), (0, _defineProperty3.default)(_classNames, className, className), _classNames));
return React.createElement(
'div',
{ className: wrapCls, style: style },
children
);
};
return List;
}(React.Component);
List.defaultProps = {
prefixCls: 'am-list'
};
List.Header = _ListHeader2.default;
List.Body = _ListBody2.default;
List.Footer = _ListFooter2.default;
List.Item = _ListItem2.default;
exports.default = List;
module.exports = exports['default'];
/***/ },
/* 17 */
/***/ function(module, exports, __webpack_require__) {
var global = __webpack_require__(18)
, core = __webpack_require__(10)
, ctx = __webpack_require__(55)
, hide = __webpack_require__(28)
, 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;
/***/ },
/* 18 */
/***/ 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
/***/ },
/* 19 */
/***/ function(module, exports, __webpack_require__) {
var anObject = __webpack_require__(20)
, IE8_DOM_DEFINE = __webpack_require__(93)
, toPrimitive = __webpack_require__(65)
, dP = Object.defineProperty;
exports.f = __webpack_require__(21) ? 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;
};
/***/ },
/* 20 */
/***/ function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(34);
module.exports = function(it){
if(!isObject(it))throw TypeError(it + ' is not an object!');
return it;
};
/***/ },
/* 21 */
/***/ function(module, exports, __webpack_require__) {
// Thank's IE8 for his funny defineProperty
module.exports = !__webpack_require__(27)(function(){
return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7;
});
/***/ },
/* 22 */
/***/ function(module, exports) {
var hasOwnProperty = {}.hasOwnProperty;
module.exports = function(it, key){
return hasOwnProperty.call(it, key);
};
/***/ },
/* 23 */
/***/ function(module, exports, __webpack_require__) {
// to indexed object, toObject with fallback for non-array-like ES3 strings
var IObject = __webpack_require__(94)
, defined = __webpack_require__(56);
module.exports = function(it){
return IObject(defined(it));
};
/***/ },
/* 24 */
/***/ 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__(343);
/**
* 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) {
warning = function warning(condition, format) {
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _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.indexOf('Failed Composite propType: ') === 0) {
return; // Ignore CompositeComponent proptype check.
}
if (!condition) {
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) {}
}
};
}
module.exports = warning;
/***/ },
/* 25 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
__webpack_require__(309);
/***/ },
/* 26 */
[474, 312],
/* 27 */
/***/ function(module, exports) {
module.exports = function(exec){
try {
return !!exec();
} catch(e){
return true;
}
};
/***/ },
/* 28 */
/***/ function(module, exports, __webpack_require__) {
var dP = __webpack_require__(19)
, createDesc = __webpack_require__(35);
module.exports = __webpack_require__(21) ? function(object, key, value){
return dP.f(object, key, createDesc(1, value));
} : function(object, key, value){
object[key] = value;
return object;
};
/***/ },
/* 29 */
/***/ function(module, exports) {
module.exports = {};
/***/ },
/* 30 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.2.14 / 15.2.3.14 Object.keys(O)
var $keys = __webpack_require__(98)
, enumBugKeys = __webpack_require__(57);
module.exports = Object.keys || function keys(O){
return $keys(O, enumBugKeys);
};
/***/ },
/* 31 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
// export this package's api
module.exports = __webpack_require__(365);
/***/ },
/* 32 */
/***/ 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'];
/***/ },
/* 33 */
/***/ function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(244), __esModule: true };
/***/ },
/* 34 */
/***/ function(module, exports) {
module.exports = function(it){
return typeof it === 'object' ? it !== null : typeof it === 'function';
};
/***/ },
/* 35 */
/***/ function(module, exports) {
module.exports = function(bitmap, value){
return {
enumerable : !(bitmap & 1),
configurable: !(bitmap & 2),
writable : !(bitmap & 4),
value : value
};
};
/***/ },
/* 36 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
var RE_NUM = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source;
var getComputedStyleX = undefined;
function css(el, name, v) {
var value = v;
if (typeof name === 'object') {
for (var i in name) {
if (name.hasOwnProperty(i)) {
css(el, i, name[i]);
}
}
return undefined;
}
if (typeof value !== 'undefined') {
if (typeof value === 'number') {
value = value + 'px';
}
el.style[name] = value;
return undefined;
}
return getComputedStyleX(el, name);
}
function getClientPosition(elem) {
var box = undefined;
var x = undefined;
var y = undefined;
var doc = elem.ownerDocument;
var body = doc.body;
var docElem = doc && doc.documentElement;
// 根据 GBS 最新数据,A-Grade Browsers 都已支持 getBoundingClientRect 方法,不用再考虑传统的实现方式
box = elem.getBoundingClientRect();
// 注:jQuery 还考虑减去 docElem.clientLeft/clientTop
// 但测试发现,这样反而会导致当 html 和 body 有边距/边框样式时,获取的值不正确
// 此外,ie6 会忽略 html 的 margin 值,幸运地是没有谁会去设置 html 的 margin
x = box.left;
y = box.top;
// In IE, most of the time, 2 extra pixels are added to the top and left
// due to the implicit 2-pixel inset border. In IE6/7 quirks mode and
// IE6 standards mode, this border can be overridden by setting the
// document element's border to zero -- thus, we cannot rely on the
// offset always being 2 pixels.
// In quirks mode, the offset can be determined by querying the body's
// clientLeft/clientTop, but in standards mode, it is found by querying
// the document element's clientLeft/clientTop. Since we already called
// getClientBoundingRect we have already forced a reflow, so it is not
// too expensive just to query them all.
// ie 下应该减去窗口的边框吧,毕竟默认 absolute 都是相对窗口定位的
// 窗口边框标准是设 documentElement ,quirks 时设置 body
// 最好禁止在 body 和 html 上边框 ,但 ie < 9 html 默认有 2px ,减去
// 但是非 ie 不可能设置窗口边框,body html 也不是窗口 ,ie 可以通过 html,body 设置
// 标准 ie 下 docElem.clientTop 就是 border-top
// ie7 html 即窗口边框改变不了。永远为 2
// 但标准 firefox/chrome/ie9 下 docElem.clientTop 是窗口边框,即使设了 border-top 也为 0
x -= docElem.clientLeft || body.clientLeft || 0;
y -= docElem.clientTop || body.clientTop || 0;
return { left: x, top: y };
}
function getScroll(w, top) {
var ret = w['page' + (top ? 'Y' : 'X') + 'Offset'];
var method = 'scroll' + (top ? 'Top' : 'Left');
if (typeof ret !== 'number') {
var d = w.document;
// ie6,7,8 standard mode
ret = d.documentElement[method];
if (typeof ret !== 'number') {
// quirks mode
ret = d.body[method];
}
}
return ret;
}
function getScrollLeft(w) {
return getScroll(w);
}
function getScrollTop(w) {
return getScroll(w, true);
}
function getOffset(el) {
var pos = getClientPosition(el);
var doc = el.ownerDocument;
var w = doc.defaultView || doc.parentWindow;
pos.left += getScrollLeft(w);
pos.top += getScrollTop(w);
return pos;
}
function _getComputedStyle(elem, name, cs) {
var computedStyle = cs;
var val = '';
var d = elem.ownerDocument;
computedStyle = computedStyle || d.defaultView.getComputedStyle(elem, null);
// https://github.com/kissyteam/kissy/issues/61
if (computedStyle) {
val = computedStyle.getPropertyValue(name) || computedStyle[name];
}
return val;
}
var _RE_NUM_NO_PX = new RegExp('^(' + RE_NUM + ')(?!px)[a-z%]+$', 'i');
var RE_POS = /^(top|right|bottom|left)$/;
var CURRENT_STYLE = 'currentStyle';
var RUNTIME_STYLE = 'runtimeStyle';
var LEFT = 'left';
var PX = 'px';
function _getComputedStyleIE(elem, name) {
// currentStyle maybe null
// http://msdn.microsoft.com/en-us/library/ms535231.aspx
var ret = elem[CURRENT_STYLE] && elem[CURRENT_STYLE][name];
// 当 width/height 设置为百分比时,通过 pixelLeft 方式转换的 width/height 值
// 一开始就处理了! CUSTOM_STYLE.height,CUSTOM_STYLE.width ,cssHook 解决@2011-08-19
// 在 ie 下不对,需要直接用 offset 方式
// borderWidth 等值也有问题,但考虑到 borderWidth 设为百分比的概率很小,这里就不考虑了
// From the awesome hack by Dean Edwards
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
// If we're not dealing with a regular pixel number
// but a number that has a weird ending, we need to convert it to pixels
// exclude left right for relativity
if (_RE_NUM_NO_PX.test(ret) && !RE_POS.test(name)) {
// Remember the original values
var style = elem.style;
var left = style[LEFT];
var rsLeft = elem[RUNTIME_STYLE][LEFT];
// prevent flashing of content
elem[RUNTIME_STYLE][LEFT] = elem[CURRENT_STYLE][LEFT];
// Put in the new values to get a computed value out
style[LEFT] = name === 'fontSize' ? '1em' : ret || 0;
ret = style.pixelLeft + PX;
// Revert the changed values
style[LEFT] = left;
elem[RUNTIME_STYLE][LEFT] = rsLeft;
}
return ret === '' ? 'auto' : ret;
}
if (typeof window !== 'undefined') {
getComputedStyleX = window.getComputedStyle ? _getComputedStyle : _getComputedStyleIE;
}
function getOffsetDirection(dir, option) {
if (dir === 'left') {
return option.useCssRight ? 'right' : dir;
}
return option.useCssBottom ? 'bottom' : dir;
}
function oppositeOffsetDirection(dir) {
if (dir === 'left') {
return 'right';
} else if (dir === 'right') {
return 'left';
} else if (dir === 'top') {
return 'bottom';
} else if (dir === 'bottom') {
return 'top';
}
}
// 设置 elem 相对 elem.ownerDocument 的坐标
function setOffset(elem, offset, option) {
// set position first, in-case top/left are set even on static elem
if (css(elem, 'position') === 'static') {
elem.style.position = 'relative';
}
var presetH = -999;
var presetV = -999;
var horizontalProperty = getOffsetDirection('left', option);
var verticalProperty = getOffsetDirection('top', option);
var oppositeHorizontalProperty = oppositeOffsetDirection(horizontalProperty);
var oppositeVerticalProperty = oppositeOffsetDirection(verticalProperty);
if (horizontalProperty !== 'left') {
presetH = 999;
}
if (verticalProperty !== 'top') {
presetV = 999;
}
if ('left' in offset) {
elem.style[oppositeHorizontalProperty] = '';
elem.style[horizontalProperty] = presetH + 'px';
}
if ('top' in offset) {
elem.style[oppositeVerticalProperty] = '';
elem.style[verticalProperty] = presetV + 'px';
}
var old = getOffset(elem);
var ret = {};
var key = undefined;
for (key in offset) {
if (offset.hasOwnProperty(key)) {
var dir = getOffsetDirection(key, option);
var preset = key === 'left' ? presetH : presetV;
if (dir === key) {
ret[dir] = preset + offset[key] - old[key];
} else {
ret[dir] = preset + old[key] - offset[key];
}
}
}
css(elem, ret);
}
function each(arr, fn) {
for (var i = 0; i < arr.length; i++) {
fn(arr[i]);
}
}
function isBorderBoxFn(elem) {
return getComputedStyleX(elem, 'boxSizing') === 'border-box';
}
var BOX_MODELS = ['margin', 'border', 'padding'];
var CONTENT_INDEX = -1;
var PADDING_INDEX = 2;
var BORDER_INDEX = 1;
var MARGIN_INDEX = 0;
function swap(elem, options, callback) {
var old = {};
var style = elem.style;
var name = undefined;
// Remember the old values, and insert the new ones
for (name in options) {
if (options.hasOwnProperty(name)) {
old[name] = style[name];
style[name] = options[name];
}
}
callback.call(elem);
// Revert the old values
for (name in options) {
if (options.hasOwnProperty(name)) {
style[name] = old[name];
}
}
}
function getPBMWidth(elem, props, which) {
var value = 0;
var prop = undefined;
var j = undefined;
var i = undefined;
for (j = 0; j < props.length; j++) {
prop = props[j];
if (prop) {
for (i = 0; i < which.length; i++) {
var cssProp = undefined;
if (prop === 'border') {
cssProp = prop + which[i] + 'Width';
} else {
cssProp = prop + which[i];
}
value += parseFloat(getComputedStyleX(elem, cssProp)) || 0;
}
}
}
return value;
}
/**
* A crude way of determining if an object is a window
* @member util
*/
function isWindow(obj) {
// must use == for ie8
/* eslint eqeqeq:0 */
return obj !== null && obj !== undefined && obj == obj.window;
}
var domUtils = {};
each(['Width', 'Height'], function (name) {
domUtils['doc' + name] = function (refWin) {
var d = refWin.document;
return Math.max(
// firefox chrome documentElement.scrollHeight< body.scrollHeight
// ie standard mode : documentElement.scrollHeight> body.scrollHeight
d.documentElement['scroll' + name],
// quirks : documentElement.scrollHeight 最大等于可视窗口多一点?
d.body['scroll' + name], domUtils['viewport' + name](d));
};
domUtils['viewport' + name] = function (win) {
// pc browser includes scrollbar in window.innerWidth
var prop = 'client' + name;
var doc = win.document;
var body = doc.body;
var documentElement = doc.documentElement;
var documentElementProp = documentElement[prop];
// 标准模式取 documentElement
// backcompat 取 body
return doc.compatMode === 'CSS1Compat' && documentElementProp || body && body[prop] || documentElementProp;
};
});
/*
得到元素的大小信息
@param elem
@param name
@param {String} [extra] 'padding' : (css width) + padding
'border' : (css width) + padding + border
'margin' : (css width) + padding + border + margin
*/
function getWH(elem, name, ex) {
var extra = ex;
if (isWindow(elem)) {
return name === 'width' ? domUtils.viewportWidth(elem) : domUtils.viewportHeight(elem);
} else if (elem.nodeType === 9) {
return name === 'width' ? domUtils.docWidth(elem) : domUtils.docHeight(elem);
}
var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];
var borderBoxValue = name === 'width' ? elem.offsetWidth : elem.offsetHeight;
var computedStyle = getComputedStyleX(elem);
var isBorderBox = isBorderBoxFn(elem, computedStyle);
var cssBoxValue = 0;
if (borderBoxValue === null || borderBoxValue === undefined || borderBoxValue <= 0) {
borderBoxValue = undefined;
// Fall back to computed then un computed css if necessary
cssBoxValue = getComputedStyleX(elem, name);
if (cssBoxValue === null || cssBoxValue === undefined || Number(cssBoxValue) < 0) {
cssBoxValue = elem.style[name] || 0;
}
// Normalize '', auto, and prepare for extra
cssBoxValue = parseFloat(cssBoxValue) || 0;
}
if (extra === undefined) {
extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX;
}
var borderBoxValueOrIsBorderBox = borderBoxValue !== undefined || isBorderBox;
var val = borderBoxValue || cssBoxValue;
if (extra === CONTENT_INDEX) {
if (borderBoxValueOrIsBorderBox) {
return val - getPBMWidth(elem, ['border', 'padding'], which, computedStyle);
}
return cssBoxValue;
} else if (borderBoxValueOrIsBorderBox) {
if (extra === BORDER_INDEX) {
return val;
}
return val + (extra === PADDING_INDEX ? -getPBMWidth(elem, ['border'], which, computedStyle) : getPBMWidth(elem, ['margin'], which, computedStyle));
}
return cssBoxValue + getPBMWidth(elem, BOX_MODELS.slice(extra), which, computedStyle);
}
var cssShow = { position: 'absolute', visibility: 'hidden', display: 'block' };
// fix #119 : https://github.com/kissyteam/kissy/issues/119
function getWHIgnoreDisplay() {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var val = undefined;
var elem = args[0];
// in case elem is window
// elem.offsetWidth === undefined
if (elem.offsetWidth !== 0) {
val = getWH.apply(undefined, args);
} else {
swap(elem, cssShow, function () {
val = getWH.apply(undefined, args);
});
}
return val;
}
each(['width', 'height'], function (name) {
var first = name.charAt(0).toUpperCase() + name.slice(1);
domUtils['outer' + first] = function (el, includeMargin) {
return el && getWHIgnoreDisplay(el, name, includeMargin ? MARGIN_INDEX : BORDER_INDEX);
};
var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];
domUtils[name] = function (elem, v) {
var val = v;
if (val !== undefined) {
if (elem) {
var computedStyle = getComputedStyleX(elem);
var isBorderBox = isBorderBoxFn(elem);
if (isBorderBox) {
val += getPBMWidth(elem, ['padding', 'border'], which, computedStyle);
}
return css(elem, name, val);
}
return undefined;
}
return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX);
};
});
function mix(to, from) {
for (var i in from) {
if (from.hasOwnProperty(i)) {
to[i] = from[i];
}
}
return to;
}
var utils = {
getWindow: function getWindow(node) {
if (node && node.document && node.setTimeout) {
return node;
}
var doc = node.ownerDocument || node;
return doc.defaultView || doc.parentWindow;
},
offset: function offset(el, value, option) {
if (typeof value !== 'undefined') {
setOffset(el, value, option || {});
} else {
return getOffset(el);
}
},
isWindow: isWindow,
each: each,
css: css,
clone: function clone(obj) {
var i = undefined;
var ret = {};
for (i in obj) {
if (obj.hasOwnProperty(i)) {
ret[i] = obj[i];
}
}
var overflow = obj.overflow;
if (overflow) {
for (i in obj) {
if (obj.hasOwnProperty(i)) {
ret.overflow[i] = obj.overflow[i];
}
}
}
return ret;
},
mix: mix,
getWindowScrollLeft: function getWindowScrollLeft(w) {
return getScrollLeft(w);
},
getWindowScrollTop: function getWindowScrollTop(w) {
return getScrollTop(w);
},
merge: function merge() {
var ret = {};
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
for (var i = 0; i < args.length; i++) {
utils.mix(ret, args[i]);
}
return ret;
},
viewportWidth: 0,
viewportHeight: 0
};
mix(utils, domUtils);
exports['default'] = utils;
module.exports = exports['default'];
/***/ },
/* 37 */
/***/ function(module, exports) {
/**
* 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 canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
/**
* Simple, lightweight module assisting with the detection and context of
* Worker. Helps avoid circular dependencies and allows code to reason about
* whether or not they are in a Worker, even if they never include the main
* `ReactWorker` dependency.
*/
var ExecutionEnvironment = {
canUseDOM: canUseDOM,
canUseWorkers: typeof Worker !== 'undefined',
canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent),
canUseViewport: canUseDOM && !!window.screen,
isInWorker: !canUseDOM // For now, this is true - might change in the future.
};
module.exports = ExecutionEnvironment;
/***/ },
/* 38 */
[474, 306],
/* 39 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _iterator = __webpack_require__(235);
var _iterator2 = _interopRequireDefault(_iterator);
var _symbol = __webpack_require__(234);
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 ? "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 ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof(obj);
};
/***/ },
/* 40 */
/***/ function(module, exports) {
exports.f = {}.propertyIsEnumerable;
/***/ },
/* 41 */
/***/ function(module, exports, __webpack_require__) {
// 7.1.13 ToObject(argument)
var defined = __webpack_require__(56);
module.exports = function(it){
return Object(defined(it));
};
/***/ },
/* 42 */
/***/ function(module, exports) {
var id = 0
, px = Math.random();
module.exports = function(key){
return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
};
/***/ },
/* 43 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $at = __webpack_require__(268)(true);
// 21.1.3.27 String.prototype[@@iterator]()
__webpack_require__(95)(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};
});
/***/ },
/* 44 */
/***/ 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.
*/
function invariant(condition, format, a, b, c, d, e, f) {
if (true) {
if (format === undefined) {
throw new Error('invariant requires an error message argument');
}
}
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;
/***/ },
/* 45 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
module.exports = __webpack_require__(375);
/***/ },
/* 46 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = addEventListenerWrap;
var _addDomEventListener = __webpack_require__(132);
var _addDomEventListener2 = _interopRequireDefault(_addDomEventListener);
var _reactDom = __webpack_require__(9);
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'];
/***/ },
/* 47 */
/***/ function(module, exports, __webpack_require__) {
var React = __webpack_require__(1);
var ReactDOM = __webpack_require__(9);
// 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__(352) : 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;
/***/ },
/* 48 */
/***/ function(module, exports) {
'use strict';
function ToObject(val) {
if (val == null) {
throw new TypeError('Object.assign cannot be called with null or undefined');
}
return Object(val);
}
module.exports = Object.assign || function (target, source) {
var from;
var keys;
var to = ToObject(target);
for (var s = 1; s < arguments.length; s++) {
from = arguments[s];
keys = Object.keys(Object(from));
for (var i = 0; i < keys.length; i++) {
to[keys[i]] = from[keys[i]];
}
}
return to;
};
/***/ },
/* 49 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var fetchKeys = __webpack_require__(358);
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;
};
/***/ },
/* 50 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _extends2 = __webpack_require__(8);
var _extends3 = _interopRequireDefault(_extends2);
var _defineProperty2 = __webpack_require__(6);
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _slicedToArray2 = __webpack_require__(12);
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 React = _interopRequireWildcard(_react);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var _index = __webpack_require__(15);
var _index2 = _interopRequireDefault(_index);
var _splitObject3 = __webpack_require__(14);
var _splitObject4 = _interopRequireDefault(_splitObject3);
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 rxTwoCNChar = /^[\u4e00-\u9fa5]{2}$/;
var isTwoCNChar = rxTwoCNChar.test.bind(rxTwoCNChar);
function isString(str) {
return typeof str === 'string';
}
// Insert one space between two chinese characters automatically.
function insertSpace(child) {
if (isString(child.type) && isTwoCNChar(child.props.children)) {
return React.cloneElement(child, {}, child.props.children.split('').join(' '));
}
if (isString(child)) {
if (isTwoCNChar(child)) {
child = child.split('').join(' ');
}
return React.createElement(
'span',
null,
child
);
}
return child;
}
var Button = function (_React$Component) {
(0, _inherits3.default)(Button, _React$Component);
function Button() {
(0, _classCallCheck3.default)(this, Button);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var _this = (0, _possibleConstructorReturn3.default)(this, _React$Component.call.apply(_React$Component, [this].concat(args)));
_this.onClick = function () {
_this.props.onClick(_this);
};
return _this;
}
Button.prototype.render = function render() {
var _classNames;
var _splitObject = (0, _splitObject4.default)(this.props, ['children', 'className', 'prefixCls', 'type', 'size', 'ghost', 'inline', 'disabled', 'htmlType', 'icon', 'loading']);
var _splitObject2 = (0, _slicedToArray3.default)(_splitObject, 2);
var _splitObject2$ = _splitObject2[0];
var children = _splitObject2$.children;
var className = _splitObject2$.className;
var prefixCls = _splitObject2$.prefixCls;
var type = _splitObject2$.type;
var size = _splitObject2$.size;
var ghost = _splitObject2$.ghost;
var inline = _splitObject2$.inline;
var disabled = _splitObject2$.disabled;
var htmlType = _splitObject2$.htmlType;
var icon = _splitObject2$.icon;
var loading = _splitObject2$.loading;
var restProps = _splitObject2[1];
var wrapCls = (0, _classnames2.default)((_classNames = {}, (0, _defineProperty3.default)(_classNames, className, className), (0, _defineProperty3.default)(_classNames, prefixCls, true), (0, _defineProperty3.default)(_classNames, prefixCls + '-primary', type === 'primary'), (0, _defineProperty3.default)(_classNames, prefixCls + '-ghost', ghost), (0, _defineProperty3.default)(_classNames, prefixCls + '-warning', type === 'warning'), (0, _defineProperty3.default)(_classNames, prefixCls + '-small', size === 'small' && inline), (0, _defineProperty3.default)(_classNames, prefixCls + '-loading', loading), (0, _defineProperty3.default)(_classNames, prefixCls + '-inline', inline), (0, _defineProperty3.default)(_classNames, prefixCls + '-disabled', disabled), _classNames));
var iconType = loading ? 'loading' : icon;
var kids = React.Children.map(children, insertSpace);
return React.createElement(
'button',
(0, _extends3.default)({}, restProps, { type: htmlType || 'button', className: wrapCls, disabled: disabled, onClick: this.onClick }),
iconType ? React.createElement(_index2.default, { type: iconType }) : null,
kids
);
};
return Button;
}(React.Component);
exports.default = Button;
Button.propTypes = {
prefixCls: _react.PropTypes.string,
type: _react.PropTypes.string,
size: _react.PropTypes.oneOf(['large', 'small']),
htmlType: _react.PropTypes.oneOf(['submit', 'button', 'reset']),
ghost: _react.PropTypes.bool,
inline: _react.PropTypes.bool,
disabled: _react.PropTypes.bool,
loading: _react.PropTypes.bool,
icon: _react.PropTypes.bool,
onClick: _react.PropTypes.func
};
Button.defaultProps = {
prefixCls: 'am-button',
size: 'large',
ghost: false,
inline: false,
disabled: false,
loading: false,
onClick: function onClick() {}
};
module.exports = exports['default'];
/***/ },
/* 51 */
/***/ 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 React = _interopRequireWildcard(_react);
var _rcCheckbox = __webpack_require__(109);
var _rcCheckbox2 = _interopRequireDefault(_rcCheckbox);
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 Checkbox = function (_React$Component) {
(0, _inherits3.default)(Checkbox, _React$Component);
function Checkbox() {
(0, _classCallCheck3.default)(this, Checkbox);
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
}
Checkbox.prototype.render = function render() {
var _props = this.props;
var prefixCls = _props.prefixCls;
var style = _props.style;
var name = _props.name;
var defaultChecked = _props.defaultChecked;
var checked = _props.checked;
var disabled = _props.disabled;
var className = _props.className;
var onChange = _props.onChange;
return React.createElement(_rcCheckbox2.default, { prefixCls: prefixCls, className: className, style: style, checked: checked, defaultChecked: defaultChecked, name: name, onChange: onChange, disabled: disabled });
};
return Checkbox;
}(React.Component);
exports.default = Checkbox;
Checkbox.defaultProps = {
prefixCls: 'am-checkbox'
};
module.exports = exports['default'];
/***/ },
/* 52 */
/***/ 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 React = _interopRequireWildcard(_react);
var _rcDialog = __webpack_require__(45);
var _rcDialog2 = _interopRequireDefault(_rcDialog);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var _objectAssign = __webpack_require__(11);
var _objectAssign2 = _interopRequireDefault(_objectAssign);
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 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.componentWillMount = function componentWillMount() {
var _props = this.props;
var visible = _props.visible;
var onShow = _props.onShow;
if (visible) {
onShow();
}
};
Modal.prototype.componentDidMount = function componentDidMount() {
this.componentDidUpdate(this.props);
};
Modal.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
if (nextProps.visible) {
this.props.onShow();
}
};
Modal.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
var _props2 = this.props;
var prefixCls = _props2.prefixCls;
var closable = _props2.closable;
// visible always true
if (prevProps.visible === true && !closable) {
var closeDom = document.getElementsByClassName(prefixCls + '-close')[0];
if (closeDom) {
closeDom.style.display = 'none';
}
}
};
Modal.prototype.render = function render() {
var _classNames;
var _props3 = this.props;
var prefixCls = _props3.prefixCls;
var className = _props3.className;
var wrapClassName = _props3.wrapClassName;
var transparent = _props3.transparent;
var animated = _props3.animated;
var transitionName = _props3.transitionName;
var maskTransitionName = _props3.maskTransitionName;
var closable = _props3.closable;
var maskClosable = _props3.maskClosable;
var style = _props3.style;
var bodyStyle = _props3.bodyStyle;
var visible = _props3.visible;
var children = _props3.children;
var onClose = _props3.onClose;
var footer = _props3.footer;
var wrapCls = (0, _classnames2.default)((_classNames = {}, (0, _defineProperty3.default)(_classNames, className, !!className), (0, _defineProperty3.default)(_classNames, prefixCls + '-transparent', transparent), _classNames));
var anim = transitionName || (animated ? 'am-slide-up' : null);
var maskAnim = maskTransitionName || (animated ? 'am-slide-up' : null);
// transparent 模式下, 内容默认居中
var rootStyle = transparent ? (0, _objectAssign2.default)({
width: '286px',
height: 'auto'
}, style) : (0, _objectAssign2.default)({
width: '100%',
height: '100%'
}, style);
return React.createElement(
_rcDialog2.default,
{ prefixCls: prefixCls, className: wrapCls, wrapClassName: wrapClassName, transitionName: anim, maskTransitionName: maskAnim, style: rootStyle, bodyStyle: bodyStyle, visible: visible, closable: closable || maskClosable, maskClosable: maskClosable, onClose: onClose, footer: footer },
children
);
};
return Modal;
}(React.Component);
exports.default = Modal;
Modal.defaultProps = {
prefixCls: 'am-modal',
wrapClassName: '',
visible: false,
closable: false,
maskClosable: false,
transparent: false,
animated: true,
style: {},
bodyStyle: {},
onClose: function onClose() {},
onShow: function onShow() {},
footer: null
};
module.exports = exports['default'];
/***/ },
/* 53 */
/***/ 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;
};
/***/ },
/* 54 */
/***/ function(module, exports) {
var toString = {}.toString;
module.exports = function(it){
return toString.call(it).slice(8, -1);
};
/***/ },
/* 55 */
/***/ function(module, exports, __webpack_require__) {
// optional / simple context binding
var aFunction = __webpack_require__(248);
module.exports = function(fn, that, length){
aFunction(fn);
if(that === undefined)return fn;
switch(length){
case 1: return function(a){
return fn.call(that, a);
};
case 2: return function(a, b){
return fn.call(that, a, b);
};
case 3: return function(a, b, c){
return fn.call(that, a, b, c);
};
}
return function(/* ...args */){
return fn.apply(that, arguments);
};
};
/***/ },
/* 56 */
/***/ function(module, exports) {
// 7.2.1 RequireObjectCoercible(argument)
module.exports = function(it){
if(it == undefined)throw TypeError("Can't call method on " + it);
return it;
};
/***/ },
/* 57 */
/***/ function(module, exports) {
// IE 8- don't enum bug keys
module.exports = (
'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
).split(',');
/***/ },
/* 58 */
/***/ function(module, exports) {
module.exports = true;
/***/ },
/* 59 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
var anObject = __webpack_require__(20)
, dPs = __webpack_require__(263)
, enumBugKeys = __webpack_require__(57)
, IE_PROTO = __webpack_require__(62)('IE_PROTO')
, Empty = function(){ /* empty */ }
, PROTOTYPE = 'prototype';
// Create object with fake `null` prototype: use iframe Object with cleared prototype
var createDict = function(){
// Thrash, waste and sodomy: IE GC bug
var iframe = __webpack_require__(92)('iframe')
, i = enumBugKeys.length
, lt = '<'
, gt = '>'
, iframeDocument;
iframe.style.display = 'none';
__webpack_require__(253).appendChild(iframe);
iframe.src = 'javascript:'; // eslint-disable-line no-script-url
// createDict = iframe.contentWindow.Object;
// html.removeChild(iframe);
iframeDocument = iframe.contentWindow.document;
iframeDocument.open();
iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
iframeDocument.close();
createDict = iframeDocument.F;
while(i--)delete createDict[PROTOTYPE][enumBugKeys[i]];
return createDict();
};
module.exports = Object.create || function create(O, Properties){
var result;
if(O !== null){
Empty[PROTOTYPE] = anObject(O);
result = new Empty;
Empty[PROTOTYPE] = null;
// add "__proto__" for Object.getPrototypeOf polyfill
result[IE_PROTO] = O;
} else result = createDict();
return Properties === undefined ? result : dPs(result, Properties);
};
/***/ },
/* 60 */
/***/ function(module, exports) {
exports.f = Object.getOwnPropertySymbols;
/***/ },
/* 61 */
/***/ function(module, exports, __webpack_require__) {
var def = __webpack_require__(19).f
, has = __webpack_require__(22)
, TAG = __webpack_require__(13)('toStringTag');
module.exports = function(it, tag, stat){
if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag});
};
/***/ },
/* 62 */
/***/ function(module, exports, __webpack_require__) {
var shared = __webpack_require__(63)('keys')
, uid = __webpack_require__(42);
module.exports = function(key){
return shared[key] || (shared[key] = uid(key));
};
/***/ },
/* 63 */
/***/ function(module, exports, __webpack_require__) {
var global = __webpack_require__(18)
, SHARED = '__core-js_shared__'
, store = global[SHARED] || (global[SHARED] = {});
module.exports = function(key){
return store[key] || (store[key] = {});
};
/***/ },
/* 64 */
/***/ function(module, exports) {
// 7.1.4 ToInteger
var ceil = Math.ceil
, floor = Math.floor;
module.exports = function(it){
return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
};
/***/ },
/* 65 */
/***/ function(module, exports, __webpack_require__) {
// 7.1.1 ToPrimitive(input [, PreferredType])
var isObject = __webpack_require__(34);
// 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");
};
/***/ },
/* 66 */
/***/ function(module, exports, __webpack_require__) {
var global = __webpack_require__(18)
, core = __webpack_require__(10)
, LIBRARY = __webpack_require__(58)
, wksExt = __webpack_require__(67)
, defineProperty = __webpack_require__(19).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)});
};
/***/ },
/* 67 */
/***/ function(module, exports, __webpack_require__) {
exports.f = __webpack_require__(13);
/***/ },
/* 68 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(273);
var global = __webpack_require__(18)
, hide = __webpack_require__(28)
, Iterators = __webpack_require__(29)
, TO_STRING_TAG = __webpack_require__(13)('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;
}
/***/ },
/* 69 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
/**
* Export javascript style and css style vendor prefixes.
* Based on "transform" support test.
*/
var js = '';
var css = '';
// We should not do anything if required serverside.
if (typeof document != 'undefined') {
var jsCssMap = {
Webkit: '-webkit-',
Moz: '-moz-',
// IE did it wrong again ...
ms: '-ms-',
O: '-o-'
};
var style = document.createElement('p').style;
var testProp = 'Transform';
for (var key in jsCssMap) {
if (key + testProp in style) {
js = key;
css = jsCssMap[key];
break;
}
}
}
/**
* Vendor prefix string for the current browser.
*
* @type {{js: String, css: String}}
* @api public
*/
exports.default = { js: js, css: css };
/***/ },
/* 70 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
module.exports = __webpack_require__(406);
/***/ },
/* 71 */
/***/ 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;
/***/ },
/* 72 */
/***/ 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);
}
return {
configurable: true,
get: function get() {
if (this === target.prototype || this.hasOwnProperty(key)) {
return fn;
}
var boundFn = fn.bind(this);
Object.defineProperty(this, key, {
value: boundFn,
configurable: true,
writable: true
});
return boundFn;
}
};
}
module.exports = exports['default'];
/***/ },
/* 73 */
[475, 298],
/* 74 */
/***/ 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 React = _interopRequireWildcard(_react);
var _reactSlick = __webpack_require__(420);
var _reactSlick2 = _interopRequireDefault(_reactSlick);
var _objectAssign = __webpack_require__(11);
var _objectAssign2 = _interopRequireDefault(_objectAssign);
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 }; }
// matchMedia polyfill for
// https://github.com/WickyNilliams/enquire.js/issues/82
if (typeof window !== 'undefined') {
var matchMediaPolyfill = function matchMediaPolyfill() {
return {
matches: false,
addListener: function addListener() {},
removeListener: function removeListener() {}
};
};
window.matchMedia = window.matchMedia || matchMediaPolyfill;
}
var Carousel = function (_React$Component) {
(0, _inherits3.default)(Carousel, _React$Component);
function Carousel() {
(0, _classCallCheck3.default)(this, Carousel);
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
}
Carousel.prototype.render = function render() {
var props = (0, _objectAssign2.default)({}, this.props);
if (props.effect === 'fade') {
props.fade = true;
props.draggable = false;
}
var className = 'am-carousel';
if (props.vertical) {
className = className + ' am-carousel-vertical';
}
if (props.mode === 'banner') {
className = className + ' am-carousel-banner';
}
if (props.mode === 'card') {
className = className + ' am-carousel-card center slider variable-width';
props.centerMode = true;
props.infinite = true;
props.slidesToShow = 1;
props.slidesToScroll = 1;
props.variableWidth = true;
}
return React.createElement(
'div',
{ className: className },
React.createElement(_reactSlick2.default, props)
);
};
return Carousel;
}(React.Component);
exports.default = Carousel;
Carousel.defaultProps = {
dots: true,
arrows: false
};
module.exports = exports['default'];
/***/ },
/* 75 */
[474, 300],
/* 76 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__(1);
var React = _interopRequireWildcard(_react);
var _reactDom = __webpack_require__(9);
var _reactDom2 = _interopRequireDefault(_reactDom);
var _list = __webpack_require__(16);
var _list2 = _interopRequireDefault(_list);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
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; } }
var throttle = function throttle(fn, delay) {
var allowSample = true;
return function (e) {
if (allowSample) {
allowSample = false;
setTimeout(function () {
allowSample = true;
}, delay);
fn(e);
}
};
};
var SCROLLVIEW = 'ScrollView';
exports.default = React.createClass({
displayName: 'MyList',
componentDidMount: function componentDidMount() {
this.__handleScroll = this._handleScroll();
_reactDom2.default.findDOMNode(this.refs[SCROLLVIEW]).addEventListener('scroll', this.__handleScroll);
},
componentWillUnmount: function componentWillUnmount() {
_reactDom2.default.findDOMNode(this.refs[SCROLLVIEW]).removeEventListener('scroll', this.__handleScroll);
},
handleScroll: function handleScroll(e) {
var _props$onScroll = this.props.onScroll;
var onScroll = _props$onScroll === undefined ? function (ev) {} : _props$onScroll;
onScroll(e);
},
_handleScroll: function _handleScroll(e) {
var handleScroll = function handleScroll(ev) {};
// let handleScroll = this.handleScroll;
if (this.props.scrollEventThrottle && this.props.onScroll) {
handleScroll = throttle(this.handleScroll, this.props.scrollEventThrottle);
}
return handleScroll;
},
render: function render() {
var _props = this.props;
var children = _props.children;
var className = _props.className;
var style = _props.style;
var divProps = { className: className, style: style };
return React.cloneElement(React.createElement(_list2.default, { ref: SCROLLVIEW }), divProps, children);
}
});
module.exports = exports['default'];
/***/ },
/* 77 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _Modal = __webpack_require__(52);
var _Modal2 = _interopRequireDefault(_Modal);
var _alert = __webpack_require__(180);
var _alert2 = _interopRequireDefault(_alert);
var _prompt = __webpack_require__(181);
var _prompt2 = _interopRequireDefault(_prompt);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
_Modal2.default.alert = _alert2.default;
_Modal2.default.prompt = _prompt2.default;
exports.default = _Modal2.default;
module.exports = exports['default'];
/***/ },
/* 78 */
[474, 314],
/* 79 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _extends2 = __webpack_require__(8);
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 React = _interopRequireWildcard(_react);
var _rcCheckbox = __webpack_require__(109);
var _rcCheckbox2 = _interopRequireDefault(_rcCheckbox);
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 Radio = function (_React$Component) {
(0, _inherits3.default)(Radio, _React$Component);
function Radio() {
(0, _classCallCheck3.default)(this, Radio);
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
}
Radio.prototype.render = function render() {
return React.createElement(_rcCheckbox2.default, (0, _extends3.default)({}, this.props, { type: 'radio' }));
};
return Radio;
}(React.Component);
exports.default = Radio;
Radio.defaultProps = {
prefixCls: 'am-radio'
};
module.exports = exports['default'];
/***/ },
/* 80 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _Radio = __webpack_require__(79);
var _Radio2 = _interopRequireDefault(_Radio);
var _RadioItem = __webpack_require__(192);
var _RadioItem2 = _interopRequireDefault(_RadioItem);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
_Radio2.default.RadioItem = _RadioItem2.default;
exports.default = _Radio2.default;
module.exports = exports['default'];
/***/ },
/* 81 */
[476, 320],
/* 82 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _extends2 = __webpack_require__(8);
var _extends3 = _interopRequireDefault(_extends2);
var _defineProperty2 = __webpack_require__(6);
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _slicedToArray2 = __webpack_require__(12);
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 React = _interopRequireWildcard(_react);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var _splitObject3 = __webpack_require__(14);
var _splitObject4 = _interopRequireDefault(_splitObject3);
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 TimelineItem = function (_React$Component) {
(0, _inherits3.default)(TimelineItem, _React$Component);
function TimelineItem() {
(0, _classCallCheck3.default)(this, TimelineItem);
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
}
TimelineItem.prototype.render = function render() {
var _classNames;
var _splitObject = (0, _splitObject4.default)(this.props, ['prefixCls', 'color', 'last', 'children', 'pending', 'className']);
var _splitObject2 = (0, _slicedToArray3.default)(_splitObject, 2);
var _splitObject2$ = _splitObject2[0];
var prefixCls = _splitObject2$.prefixCls;
var color = _splitObject2$.color;
var last = _splitObject2$.last;
var children = _splitObject2$.children;
var pending = _splitObject2$.pending;
var className = _splitObject2$.className;
var restProps = _splitObject2[1];
var itemClassName = (0, _classnames2.default)((_classNames = {}, (0, _defineProperty3.default)(_classNames, prefixCls + '-item', true), (0, _defineProperty3.default)(_classNames, prefixCls + '-item-last', last), (0, _defineProperty3.default)(_classNames, prefixCls + '-item-pending', pending), (0, _defineProperty3.default)(_classNames, className, className), _classNames));
return React.createElement(
'li',
(0, _extends3.default)({}, restProps, { className: itemClassName }),
React.createElement('div', { className: prefixCls + '-item-tail' }),
React.createElement('div', { className: prefixCls + '-item-head ' + prefixCls + '-item-head-' + color }),
React.createElement(
'div',
{ className: prefixCls + '-item-content' },
children
)
);
};
return TimelineItem;
}(React.Component);
exports.default = TimelineItem;
TimelineItem.defaultProps = {
prefixCls: 'am-timeline',
color: 'blue',
last: false,
pending: false
};
module.exports = exports['default'];
/***/ },
/* 83 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__(1);
var React = _interopRequireWildcard(_react);
var _rcNotification = __webpack_require__(383);
var _rcNotification2 = _interopRequireDefault(_rcNotification);
var _icon = __webpack_require__(15);
var _icon2 = _interopRequireDefault(_icon);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
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; } }
var messageInstance = void 0;
var prefixCls = 'am-toast';
function getMessageInstance() {
messageInstance = _rcNotification2.default.newInstance({
prefixCls: prefixCls,
style: { top: 0 },
transitionName: 'am-fade'
});
return messageInstance;
}
function notice(content, type) {
var duration = arguments.length <= 2 || arguments[2] === undefined ? 3 : arguments[2];
var _onClose = arguments[3];
var iconType = {
info: '',
success: 'check-circle-o',
fail: 'cross-circle-o',
network: 'frown',
loading: 'loading'
}[type];
if (typeof duration === 'function') {
_onClose = duration;
duration = 3;
}
var instance = getMessageInstance();
instance.notice({
duration: duration,
style: {},
content: React.createElement(
'div',
{ className: prefixCls + '-text' },
!!iconType && React.createElement(_icon2.default, { type: iconType }),
React.createElement(
'div',
null,
content
)
),
onClose: function onClose() {
if (_onClose) {
_onClose();
}
instance.destroy();
instance = null;
}
});
}
exports.default = {
SHORT: 3,
LONG: 8,
show: function show(content, duration) {
return notice(content, 'info', duration, function () {});
},
info: function info(content, duration, onClose) {
return notice(content, 'info', duration, onClose);
},
success: function success(content, duration, onClose) {
return notice(content, 'success', duration, onClose);
},
fail: function fail(content, duration, onClose) {
return notice(content, 'fail', duration, onClose);
},
offline: function offline(content, duration, onClose) {
return notice(content, 'offline', duration, onClose);
},
loading: function loading(content, duration, onClose) {
return notice(content, 'loading', duration, onClose);
},
hide: function hide() {
if (messageInstance) {
messageInstance.destroy();
messageInstance = null;
}
}
};
module.exports = exports['default'];
/***/ },
/* 84 */
[475, 334],
/* 85 */
[474, 335],
/* 86 */
/***/ 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 React = _interopRequireWildcard(_react);
var _objectAssign = __webpack_require__(11);
var _objectAssign2 = _interopRequireDefault(_objectAssign);
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 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)) {
(function () {
var style = {};
props.style.forEach(function (s) {
(0, _objectAssign2.default)(style, s);
});
props.style = style;
})();
}
var Component = props.Component;
return React.createElement(Component, props);
};
return View;
}(React.Component);
exports.default = View;
View.defaultProps = {
Component: 'div'
};
module.exports = exports['default'];
/***/ },
/* 87 */
/***/ 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 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 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;
var prefixCls = _props.prefixCls;
var size = _props.size;
var className = _props.className;
var children = _props.children;
var style = _props.style;
var wrapCls = (0, _classnames2.default)((_classNames = {}, (0, _defineProperty3.default)(_classNames, '' + prefixCls, true), (0, _defineProperty3.default)(_classNames, className, !!className), (0, _defineProperty3.default)(_classNames, prefixCls + '-wb' + size, true), _classNames));
return React.createElement(
'div',
{ className: wrapCls, style: style },
children
);
};
return WingBlank;
}(React.Component);
exports.default = WingBlank;
WingBlank.defaultProps = {
prefixCls: 'am-wingblank',
size: 8
};
module.exports = exports['default'];
/***/ },
/* 88 */
[474, 339],
/* 89 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _from = __webpack_require__(227);
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);
}
};
/***/ },
/* 90 */
/***/ 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;
};
/***/ },
/* 91 */
/***/ function(module, exports, __webpack_require__) {
// getting tag from 19.1.3.6 Object.prototype.toString()
var cof = __webpack_require__(54)
, TAG = __webpack_require__(13)('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;
};
/***/ },
/* 92 */
/***/ function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(34)
, document = __webpack_require__(18).document
// in old IE typeof document.createElement is 'object'
, is = isObject(document) && isObject(document.createElement);
module.exports = function(it){
return is ? document.createElement(it) : {};
};
/***/ },
/* 93 */
/***/ function(module, exports, __webpack_require__) {
module.exports = !__webpack_require__(21) && !__webpack_require__(27)(function(){
return Object.defineProperty(__webpack_require__(92)('div'), 'a', {get: function(){ return 7; }}).a != 7;
});
/***/ },
/* 94 */
/***/ function(module, exports, __webpack_require__) {
// fallback for non-array-like ES3 and non-enumerable old V8 strings
var cof = __webpack_require__(54);
module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){
return cof(it) == 'String' ? it.split('') : Object(it);
};
/***/ },
/* 95 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var LIBRARY = __webpack_require__(58)
, $export = __webpack_require__(17)
, redefine = __webpack_require__(99)
, hide = __webpack_require__(28)
, has = __webpack_require__(22)
, Iterators = __webpack_require__(29)
, $iterCreate = __webpack_require__(257)
, setToStringTag = __webpack_require__(61)
, getPrototypeOf = __webpack_require__(265)
, ITERATOR = __webpack_require__(13)('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;
};
/***/ },
/* 96 */
/***/ function(module, exports, __webpack_require__) {
var pIE = __webpack_require__(40)
, createDesc = __webpack_require__(35)
, toIObject = __webpack_require__(23)
, toPrimitive = __webpack_require__(65)
, has = __webpack_require__(22)
, IE8_DOM_DEFINE = __webpack_require__(93)
, gOPD = Object.getOwnPropertyDescriptor;
exports.f = __webpack_require__(21) ? 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]);
};
/***/ },
/* 97 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
var $keys = __webpack_require__(98)
, hiddenKeys = __webpack_require__(57).concat('length', 'prototype');
exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O){
return $keys(O, hiddenKeys);
};
/***/ },
/* 98 */
/***/ function(module, exports, __webpack_require__) {
var has = __webpack_require__(22)
, toIObject = __webpack_require__(23)
, arrayIndexOf = __webpack_require__(250)(false)
, IE_PROTO = __webpack_require__(62)('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;
};
/***/ },
/* 99 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(28);
/***/ },
/* 100 */
/***/ function(module, exports, __webpack_require__) {
// 7.1.15 ToLength
var toInteger = __webpack_require__(64)
, min = Math.min;
module.exports = function(it){
return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
};
/***/ },
/* 101 */
/***/ function(module, exports, __webpack_require__) {
var classof = __webpack_require__(91)
, ITERATOR = __webpack_require__(13)('iterator')
, Iterators = __webpack_require__(29);
module.exports = __webpack_require__(10).getIteratorMethod = function(it){
if(it != undefined)return it[ITERATOR]
|| it['@@iterator']
|| Iterators[classof(it)];
};
/***/ },
/* 102 */
/***/ 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 ? "symbol" : typeof obj; };
var _Event = __webpack_require__(283);
var _Event2 = _interopRequireDefault(_Event);
var _componentClasses = __webpack_require__(237);
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) {
var style = window.getComputedStyle(node);
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'];
/***/ },
/* 103 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _utils = __webpack_require__(36);
var _utils2 = _interopRequireDefault(_utils);
/**
* 得到会导致元素显示不全的祖先元素
*/
function getOffsetParent(element) {
// ie 这个也不是完全可行
/*
*/
// element.offsetParent does the right thing in ie7 and below. Return parent with layout!
// In other browsers it only includes elements with position absolute, relative or
// fixed, not elements with overflow set to auto or scroll.
// if (UA.ie && ieMode < 8) {
// return element.offsetParent;
// }
// 统一的 offsetParent 方法
var doc = element.ownerDocument;
var body = doc.body;
var parent = undefined;
var positionStyle = _utils2['default'].css(element, 'position');
var skipStatic = positionStyle === 'fixed' || positionStyle === 'absolute';
if (!skipStatic) {
return element.nodeName.toLowerCase() === 'html' ? null : element.parentNode;
}
for (parent = element.parentNode; parent && parent !== body; parent = parent.parentNode) {
positionStyle = _utils2['default'].css(parent, 'position');
if (positionStyle !== 'static') {
return parent;
}
}
return null;
}
exports['default'] = getOffsetParent;
module.exports = exports['default'];
/***/ },
/* 104 */
/***/ function(module, exports) {
'use strict';
module.exports = function(fn, delay) {
var allowSample = true;
return function(e) {
if (allowSample) {
allowSample = false;
setTimeout(function() { allowSample = true; }, delay);
fn(e);
}
};
}
/***/ },
/* 105 */
/***/ function(module, exports, __webpack_require__) {
/*!
* for-own
*
* Copyright (c) 2014-2016, Jon Schlinkert.
* Licensed under the MIT License.
*/
'use strict';
var forIn = __webpack_require__(351);
var hasOwn = Object.prototype.hasOwnProperty;
module.exports = function forOwn(o, fn, thisArg) {
forIn(o, function(val, key) {
if (hasOwn.call(o, key)) {
return fn.call(thisArg, o[key], key, o);
}
});
};
/***/ },
/* 106 */
/***/ function(module, exports, __webpack_require__) {
var camel2hyphen = __webpack_require__(472);
var isDimension = function (feature) {
var re = /[height|width]$/;
return re.test(feature);
};
var obj2mq = function (obj) {
var mq = '';
var features = Object.keys(obj);
features.forEach(function (feature, index) {
var value = obj[feature];
feature = camel2hyphen(feature);
// Add px to dimension features
if (isDimension(feature) && typeof value === 'number') {
value = value + 'px';
}
if (value === true) {
mq += feature;
} else if (value === false) {
mq += 'not ' + feature;
} else {
mq += '(' + feature + ': ' + value + ')';
}
if (index < features.length-1) {
mq += ' and '
}
});
return mq;
};
var json2mq = function (query) {
var mq = '';
if (typeof query === 'string') {
return query;
}
// Handling array of media queries
if (query instanceof Array) {
query.forEach(function (q, index) {
mq += obj2mq(q);
if (index < query.length-1) {
mq += ', '
}
});
return mq;
}
// Handling single media query
return obj2mq(query);
};
module.exports = json2mq;
/***/ },
/* 107 */
/***/ function(module, exports) {
//! moment.js
//! version : 2.14.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 utils_hooks__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) {
return 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 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 create_utc__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
};
}
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;
};
}
function valid__isValid(m) {
if (m._isValid == null) {
var flags = getParsingFlags(m);
var parsedParts = some.call(flags.parsedDateParts, function (i) {
return i != null;
});
m._isValid = !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) {
m._isValid = m._isValid &&
flags.charsLeftOver === 0 &&
flags.unusedTokens.length === 0 &&
flags.bigHour === undefined;
}
}
return m._isValid;
}
function valid__createInvalid (flags) {
var m = create_utc__createUTC(NaN);
if (flags != null) {
extend(getParsingFlags(m), flags);
}
else {
getParsingFlags(m).userInvalidated = true;
}
return m;
}
function isUndefined(input) {
return input === void 0;
}
// Plugins that add properties should also add the key here (null value),
// so we can properly clone ourselves.
var momentProperties = utils_hooks__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 in momentProperties) {
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);
// Prevent infinite loop in case updateOffset creates new moment
// objects.
if (updateInProgress === false) {
updateInProgress = true;
utils_hooks__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 (utils_hooks__hooks.suppressDeprecationWarnings === false &&
(typeof console !== 'undefined') && console.warn) {
console.warn('Deprecation warning: ' + msg);
}
}
function deprecate(msg, fn) {
var firstTime = true;
return extend(function () {
if (utils_hooks__hooks.deprecationHandler != null) {
utils_hooks__hooks.deprecationHandler(null, msg);
}
if (firstTime) {
warn(msg + '\nArguments: ' + Array.prototype.slice.call(arguments).join(', ') + '\n' + (new Error()).stack);
firstTime = false;
}
return fn.apply(this, arguments);
}, fn);
}
var deprecations = {};
function deprecateSimple(name, msg) {
if (utils_hooks__hooks.deprecationHandler != null) {
utils_hooks__hooks.deprecationHandler(name, msg);
}
if (!deprecations[name]) {
warn(msg);
deprecations[name] = true;
}
}
utils_hooks__hooks.suppressDeprecationWarnings = false;
utils_hooks__hooks.deprecationHandler = null;
function isFunction(input) {
return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]';
}
function locale_set__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 _ordinalParseLenient.
this._ordinalParseLenient = new RegExp(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 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 locale_calendar__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 defaultOrdinalParse = /\d{1,2}/;
function ordinal (number) {
return this._ordinal.replace('%d', number);
}
var defaultRelativeTime = {
future : 'in %s',
past : '%s ago',
s : 'a few 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 relative__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) {
get_set__set(this, unit, value);
utils_hooks__hooks.updateOffset(this, keepTime);
return this;
} else {
return get_set__get(this, unit);
}
};
}
function get_set__get (mom, unit) {
return mom.isValid() ?
mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN;
}
function get_set__set (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 += array[i] instanceof Function ? 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 (typeof callback === 'number') {
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;
};
}
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) {
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) {
return isArray(this._monthsShort) ? this._monthsShort[m.month()] :
this._monthsShort[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()];
}
function units_month__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 = create_utc__createUTC([2000, i]);
this._shortMonthsParse[i] = this.monthsShort(mom, '').toLocaleLowerCase();
this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase();
}
}
if (strict) {
if (format === 'MMM') {
ii = indexOf.call(this._shortMonthsParse, llc);
return ii !== -1 ? ii : null;
} else {
ii = indexOf.call(this._longMonthsParse, llc);
return ii !== -1 ? ii : null;
}
} else {
if (format === 'MMM') {
ii = indexOf.call(this._shortMonthsParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf.call(this._longMonthsParse, llc);
return ii !== -1 ? ii : null;
} else {
ii = indexOf.call(this._longMonthsParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf.call(this._shortMonthsParse, llc);
return ii !== -1 ? ii : null;
}
}
}
function localeMonthsParse (monthName, format, strict) {
var i, mom, regex;
if (this._monthsParseExact) {
return units_month__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 = create_utc__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 (typeof value !== 'number') {
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);
utils_hooks__hooks.updateOffset(this, true);
return this;
} else {
return get_set__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 = create_utc__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 ? utils_hooks__hooks.parseTwoDigitYear(input) : toInt(input);
});
addParseToken('YY', function (input, array) {
array[YEAR] = utils_hooks__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
utils_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:
//http://stackoverflow.com/questions/181348/instantiating-a-javascript-object-by-calling-prototype-constructor-apply
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;
}
//http://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) {
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 this._weekdaysShort[m.day()];
}
var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_');
function localeWeekdaysMin (m) {
return this._weekdaysMin[m.day()];
}
function day_of_week__handleStrictParse(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 = create_utc__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.call(this._weekdaysParse, llc);
return ii !== -1 ? ii : null;
} else if (format === 'ddd') {
ii = indexOf.call(this._shortWeekdaysParse, llc);
return ii !== -1 ? ii : null;
} else {
ii = indexOf.call(this._minWeekdaysParse, llc);
return ii !== -1 ? ii : null;
}
} else {
if (format === 'dddd') {
ii = indexOf.call(this._weekdaysParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf.call(this._shortWeekdaysParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf.call(this._minWeekdaysParse, llc);
return ii !== -1 ? ii : null;
} else if (format === 'ddd') {
ii = indexOf.call(this._shortWeekdaysParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf.call(this._weekdaysParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf.call(this._minWeekdaysParse, llc);
return ii !== -1 ? ii : null;
} else {
ii = indexOf.call(this._minWeekdaysParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf.call(this._weekdaysParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf.call(this._shortWeekdaysParse, llc);
return ii !== -1 ? ii : null;
}
}
}
function localeWeekdaysParse (weekdayName, format, strict) {
var i, mom, regex;
if (this._weekdaysParseExact) {
return day_of_week__handleStrictParse.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 = create_utc__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 = create_utc__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('HH', match1to2, match2);
addRegexToken('hh', match1to2, match2);
addRegexToken('hmm', match3to4);
addRegexToken('hmmss', match5to6);
addRegexToken('Hmm', match3to4);
addRegexToken('Hmmss', match5to6);
addParseToken(['H', 'HH'], HOUR);
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);
var baseConfig = {
calendar: defaultCalendar,
longDateFormat: defaultLongDateFormat,
invalidDate: defaultInvalidDate,
ordinal: defaultOrdinal,
ordinalParse: defaultOrdinalParse,
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 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
locale_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 locale_locales__getSetGlobalLocale (key, values) {
var data;
if (key) {
if (isUndefined(values)) {
data = locale_locales__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 {
// treat as if there is no base config
deprecateSimple('parentLocaleUndefined',
'specified parentLocale is not defined yet. See http://momentjs.com/guides/#/warnings/parent-locale/');
}
}
locales[name] = new Locale(mergeConfigs(parentConfig, config));
// backwards compat for now: also set the locale
locale_locales__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
locale_locales__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 locale_locales__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 locale_locales__listLocales() {
return keys(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;
}
}
// 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;
utils_hooks__hooks.createFromInputFallback(config);
}
}
utils_hooks__hooks.createFromInputFallback = deprecate(
'moment construction falls back to js Date. This is ' +
'discouraged and will be removed in 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(utils_hooks__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) {
yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
if (config._dayOfYear > daysInYear(yearToUse)) {
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(local__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;
weekYear = defaults(w.gg, config._a[YEAR], weekOfYear(local__createLocal(), dow, doy).year);
week = defaults(w.w, 1);
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
utils_hooks__hooks.ISO_8601 = 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 === utils_hooks__hooks.ISO_8601) {
configFromISO(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 (!valid__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 || locale_locales__getLocale(config._l);
if (input === null || (format === undefined && input === '')) {
return valid__createInvalid({nullInput: true});
}
if (typeof input === 'string') {
config._i = input = config._locale.preparse(input);
}
if (isMoment(input)) {
return new Moment(checkOverflow(input));
} else if (isArray(format)) {
configFromStringAndArray(config);
} else if (isDate(input)) {
config._d = input;
} else if (format) {
configFromStringAndFormat(config);
} else {
configFromInput(config);
}
if (!valid__isValid(config)) {
config._d = null;
}
return config;
}
function configFromInput(config) {
var input = config._i;
if (input === undefined) {
config._d = new Date(utils_hooks__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 (typeof(input) === 'object') {
configFromObject(config);
} else if (typeof(input) === 'number') {
// from milliseconds
config._d = new Date(input);
} else {
utils_hooks__hooks.createFromInputFallback(config);
}
}
function createLocalOrUTC (input, format, locale, strict, isUTC) {
var c = {};
if (typeof(locale) === 'boolean') {
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 local__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 = local__createLocal.apply(null, arguments);
if (this.isValid() && other.isValid()) {
return other < this ? this : other;
} else {
return valid__createInvalid();
}
}
);
var prototypeMax = deprecate(
'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/',
function () {
var other = local__createLocal.apply(null, arguments);
if (this.isValid() && other.isValid()) {
return other > this ? this : other;
} else {
return valid__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 local__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());
};
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;
// 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 = locale_locales__getLocale();
this._bubble();
}
function isDuration (obj) {
return obj instanceof Duration;
}
// 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) || []);
var chunk = matches[matches.length - 1] || [];
var parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];
var minutes = +(parts[1] * 60) + toInt(parts[2]);
return 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() : local__createLocal(input).valueOf()) - res.valueOf();
// Use low-level api, because this fn is low-level api.
res._d.setTime(res._d.valueOf() + diff);
utils_hooks__hooks.updateOffset(res, false);
return res;
} else {
return local__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.
utils_hooks__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) {
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);
} else if (Math.abs(input) < 16) {
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) {
add_subtract__addSubtract(this, create__createDuration(input - offset, 'm'), 1, false);
} else if (!this._changeInProgress) {
this._changeInProgress = true;
utils_hooks__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) {
this.utcOffset(this._tzm);
} else if (typeof this._i === 'string') {
this.utcOffset(offsetFromString(matchOffset, this._i));
}
return this;
}
function hasAlignedHourOffset (input) {
if (!this.isValid()) {
return false;
}
input = input ? local__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 ? create_utc__createUTC(c._a) : local__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{3})?\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 create__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 (typeof input === 'number') {
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(match[MILLISECOND]) * sign
};
} 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(local__createLocal(duration.from), local__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;
}
create__createDuration.fn = Duration.prototype;
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;
}
function absRound (number) {
if (number < 0) {
return Math.round(-1 * number) * -1;
} else {
return Math.round(number);
}
}
// 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 = create__createDuration(val, period);
add_subtract__addSubtract(this, dur, direction);
return this;
};
}
function add_subtract__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) {
get_set__set(mom, 'Date', get_set__get(mom, 'Date') + days * isAdding);
}
if (months) {
setMonth(mom, get_set__get(mom, 'Month') + months * isAdding);
}
if (updateOffset) {
utils_hooks__hooks.updateOffset(mom, days || months);
}
}
var add_subtract__add = createAdder(1, 'add');
var add_subtract__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 moment_calendar__calendar (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 || local__createLocal(),
sod = cloneWithOffset(now, this).startOf('day'),
format = utils_hooks__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, local__createLocal(now)));
}
function clone () {
return new Moment(this);
}
function isAfter (input, units) {
var localInput = isMoment(input) ? input : local__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 : local__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 : local__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;
}
utils_hooks__hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';
utils_hooks__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 moment_format__toISOString () {
var m = this.clone().utc();
if (0 < m.year() && m.year() <= 9999) {
if (isFunction(Date.prototype.toISOString)) {
// native implementation is ~50x faster, use it when we can
return this.toDate().toISOString();
} else {
return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
}
} else {
return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
}
}
function format (inputString) {
if (!inputString) {
inputString = this.isUtc() ? utils_hooks__hooks.defaultFormatUtc : utils_hooks__hooks.defaultFormat;
}
var output = formatMoment(this, inputString);
return this.localeData().postformat(output);
}
function from (time, withoutSuffix) {
if (this.isValid() &&
((isMoment(time) && time.isValid()) ||
local__createLocal(time).isValid())) {
return create__createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix);
} else {
return this.localeData().invalidDate();
}
}
function fromNow (withoutSuffix) {
return this.from(local__createLocal(), withoutSuffix);
}
function to (time, withoutSuffix) {
if (this.isValid() &&
((isMoment(time) && time.isValid()) ||
local__createLocal(time).isValid())) {
return create__createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix);
} else {
return this.localeData().invalidDate();
}
}
function toNow (withoutSuffix) {
return this.to(local__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 = locale_locales__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 to_type__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 moment_valid__isValid () {
return valid__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] = utils_hooks__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) {
return isStrict ? locale._ordinalParse : locale._ordinalParseLenient;
});
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 momentPrototype__proto = Moment.prototype;
momentPrototype__proto.add = add_subtract__add;
momentPrototype__proto.calendar = moment_calendar__calendar;
momentPrototype__proto.clone = clone;
momentPrototype__proto.diff = diff;
momentPrototype__proto.endOf = endOf;
momentPrototype__proto.format = format;
momentPrototype__proto.from = from;
momentPrototype__proto.fromNow = fromNow;
momentPrototype__proto.to = to;
momentPrototype__proto.toNow = toNow;
momentPrototype__proto.get = stringGet;
momentPrototype__proto.invalidAt = invalidAt;
momentPrototype__proto.isAfter = isAfter;
momentPrototype__proto.isBefore = isBefore;
momentPrototype__proto.isBetween = isBetween;
momentPrototype__proto.isSame = isSame;
momentPrototype__proto.isSameOrAfter = isSameOrAfter;
momentPrototype__proto.isSameOrBefore = isSameOrBefore;
momentPrototype__proto.isValid = moment_valid__isValid;
momentPrototype__proto.lang = lang;
momentPrototype__proto.locale = locale;
momentPrototype__proto.localeData = localeData;
momentPrototype__proto.max = prototypeMax;
momentPrototype__proto.min = prototypeMin;
momentPrototype__proto.parsingFlags = parsingFlags;
momentPrototype__proto.set = stringSet;
momentPrototype__proto.startOf = startOf;
momentPrototype__proto.subtract = add_subtract__subtract;
momentPrototype__proto.toArray = toArray;
momentPrototype__proto.toObject = toObject;
momentPrototype__proto.toDate = toDate;
momentPrototype__proto.toISOString = moment_format__toISOString;
momentPrototype__proto.toJSON = toJSON;
momentPrototype__proto.toString = toString;
momentPrototype__proto.unix = unix;
momentPrototype__proto.valueOf = to_type__valueOf;
momentPrototype__proto.creationData = creationData;
// Year
momentPrototype__proto.year = getSetYear;
momentPrototype__proto.isLeapYear = getIsLeapYear;
// Week Year
momentPrototype__proto.weekYear = getSetWeekYear;
momentPrototype__proto.isoWeekYear = getSetISOWeekYear;
// Quarter
momentPrototype__proto.quarter = momentPrototype__proto.quarters = getSetQuarter;
// Month
momentPrototype__proto.month = getSetMonth;
momentPrototype__proto.daysInMonth = getDaysInMonth;
// Week
momentPrototype__proto.week = momentPrototype__proto.weeks = getSetWeek;
momentPrototype__proto.isoWeek = momentPrototype__proto.isoWeeks = getSetISOWeek;
momentPrototype__proto.weeksInYear = getWeeksInYear;
momentPrototype__proto.isoWeeksInYear = getISOWeeksInYear;
// Day
momentPrototype__proto.date = getSetDayOfMonth;
momentPrototype__proto.day = momentPrototype__proto.days = getSetDayOfWeek;
momentPrototype__proto.weekday = getSetLocaleDayOfWeek;
momentPrototype__proto.isoWeekday = getSetISODayOfWeek;
momentPrototype__proto.dayOfYear = getSetDayOfYear;
// Hour
momentPrototype__proto.hour = momentPrototype__proto.hours = getSetHour;
// Minute
momentPrototype__proto.minute = momentPrototype__proto.minutes = getSetMinute;
// Second
momentPrototype__proto.second = momentPrototype__proto.seconds = getSetSecond;
// Millisecond
momentPrototype__proto.millisecond = momentPrototype__proto.milliseconds = getSetMillisecond;
// Offset
momentPrototype__proto.utcOffset = getSetOffset;
momentPrototype__proto.utc = setOffsetToUTC;
momentPrototype__proto.local = setOffsetToLocal;
momentPrototype__proto.parseZone = setOffsetToParsedOffset;
momentPrototype__proto.hasAlignedHourOffset = hasAlignedHourOffset;
momentPrototype__proto.isDST = isDaylightSavingTime;
momentPrototype__proto.isLocal = isLocal;
momentPrototype__proto.isUtcOffset = isUtcOffset;
momentPrototype__proto.isUtc = isUtc;
momentPrototype__proto.isUTC = isUtc;
// Timezone
momentPrototype__proto.zoneAbbr = getZoneAbbr;
momentPrototype__proto.zoneName = getZoneName;
// Deprecations
momentPrototype__proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth);
momentPrototype__proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth);
momentPrototype__proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear);
momentPrototype__proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', getSetZone);
momentPrototype__proto.isDSTShifted = deprecate('isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', isDaylightSavingTimeShifted);
var momentPrototype = momentPrototype__proto;
function moment__createUnix (input) {
return local__createLocal(input * 1000);
}
function moment__createInZone () {
return local__createLocal.apply(null, arguments).parseZone();
}
function preParsePostFormat (string) {
return string;
}
var prototype__proto = Locale.prototype;
prototype__proto.calendar = locale_calendar__calendar;
prototype__proto.longDateFormat = longDateFormat;
prototype__proto.invalidDate = invalidDate;
prototype__proto.ordinal = ordinal;
prototype__proto.preparse = preParsePostFormat;
prototype__proto.postformat = preParsePostFormat;
prototype__proto.relativeTime = relative__relativeTime;
prototype__proto.pastFuture = pastFuture;
prototype__proto.set = locale_set__set;
// Month
prototype__proto.months = localeMonths;
prototype__proto.monthsShort = localeMonthsShort;
prototype__proto.monthsParse = localeMonthsParse;
prototype__proto.monthsRegex = monthsRegex;
prototype__proto.monthsShortRegex = monthsShortRegex;
// Week
prototype__proto.week = localeWeek;
prototype__proto.firstDayOfYear = localeFirstDayOfYear;
prototype__proto.firstDayOfWeek = localeFirstDayOfWeek;
// Day of Week
prototype__proto.weekdays = localeWeekdays;
prototype__proto.weekdaysMin = localeWeekdaysMin;
prototype__proto.weekdaysShort = localeWeekdaysShort;
prototype__proto.weekdaysParse = localeWeekdaysParse;
prototype__proto.weekdaysRegex = weekdaysRegex;
prototype__proto.weekdaysShortRegex = weekdaysShortRegex;
prototype__proto.weekdaysMinRegex = weekdaysMinRegex;
// Hours
prototype__proto.isPM = localeIsPM;
prototype__proto.meridiem = localeMeridiem;
function lists__get (format, index, field, setter) {
var locale = locale_locales__getLocale();
var utc = create_utc__createUTC().set(setter, index);
return locale[field](utc, format);
}
function listMonthsImpl (format, index, field) {
if (typeof format === 'number') {
index = format;
format = undefined;
}
format = format || '';
if (index != null) {
return lists__get(format, index, field, 'month');
}
var i;
var out = [];
for (i = 0; i < 12; i++) {
out[i] = lists__get(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 (typeof format === 'number') {
index = format;
format = undefined;
}
format = format || '';
} else {
format = localeSorted;
index = format;
localeSorted = false;
if (typeof format === 'number') {
index = format;
format = undefined;
}
format = format || '';
}
var locale = locale_locales__getLocale(),
shift = localeSorted ? locale._week.dow : 0;
if (index != null) {
return lists__get(format, (index + shift) % 7, field, 'day');
}
var i;
var out = [];
for (i = 0; i < 7; i++) {
out[i] = lists__get(format, (i + shift) % 7, field, 'day');
}
return out;
}
function lists__listMonths (format, index) {
return listMonthsImpl(format, index, 'months');
}
function lists__listMonthsShort (format, index) {
return listMonthsImpl(format, index, 'monthsShort');
}
function lists__listWeekdays (localeSorted, format, index) {
return listWeekdaysImpl(localeSorted, format, index, 'weekdays');
}
function lists__listWeekdaysShort (localeSorted, format, index) {
return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort');
}
function lists__listWeekdaysMin (localeSorted, format, index) {
return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin');
}
locale_locales__getSetGlobalLocale('en', {
ordinalParse: /\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
utils_hooks__hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', locale_locales__getSetGlobalLocale);
utils_hooks__hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', locale_locales__getLocale);
var mathAbs = Math.abs;
function duration_abs__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 duration_add_subtract__addSubtract (duration, input, value, direction) {
var other = create__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 duration_add_subtract__add (input, value) {
return duration_add_subtract__addSubtract(this, input, value, 1);
}
// supports only 2.0-style subtract(1, 's') or subtract(duration)
function duration_add_subtract__subtract (input, value) {
return duration_add_subtract__addSubtract(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) {
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 duration_as__valueOf () {
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 duration_get__get (units) {
units = normalizeUnits(units);
return this[units + 's']();
}
function makeGetter(name) {
return function () {
return this._data[name];
};
}
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 = {
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 duration_humanize__relativeTime (posNegDuration, withoutSuffix, locale) {
var duration = create__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.s && ['s', 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 duration_humanize__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 duration_humanize__getSetRelativeTimeThreshold (threshold, limit) {
if (thresholds[threshold] === undefined) {
return false;
}
if (limit === undefined) {
return thresholds[threshold];
}
thresholds[threshold] = limit;
return true;
}
function humanize (withSuffix) {
var locale = this.localeData();
var output = duration_humanize__relativeTime(this, !withSuffix, locale);
if (withSuffix) {
output = locale.pastFuture(+this, output);
}
return locale.postformat(output);
}
var iso_string__abs = Math.abs;
function iso_string__toISOString() {
// 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)
var seconds = iso_string__abs(this._milliseconds) / 1000;
var days = iso_string__abs(this._days);
var months = iso_string__abs(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 duration_prototype__proto = Duration.prototype;
duration_prototype__proto.abs = duration_abs__abs;
duration_prototype__proto.add = duration_add_subtract__add;
duration_prototype__proto.subtract = duration_add_subtract__subtract;
duration_prototype__proto.as = as;
duration_prototype__proto.asMilliseconds = asMilliseconds;
duration_prototype__proto.asSeconds = asSeconds;
duration_prototype__proto.asMinutes = asMinutes;
duration_prototype__proto.asHours = asHours;
duration_prototype__proto.asDays = asDays;
duration_prototype__proto.asWeeks = asWeeks;
duration_prototype__proto.asMonths = asMonths;
duration_prototype__proto.asYears = asYears;
duration_prototype__proto.valueOf = duration_as__valueOf;
duration_prototype__proto._bubble = bubble;
duration_prototype__proto.get = duration_get__get;
duration_prototype__proto.milliseconds = milliseconds;
duration_prototype__proto.seconds = seconds;
duration_prototype__proto.minutes = minutes;
duration_prototype__proto.hours = hours;
duration_prototype__proto.days = days;
duration_prototype__proto.weeks = weeks;
duration_prototype__proto.months = months;
duration_prototype__proto.years = years;
duration_prototype__proto.humanize = humanize;
duration_prototype__proto.toISOString = iso_string__toISOString;
duration_prototype__proto.toString = iso_string__toISOString;
duration_prototype__proto.toJSON = iso_string__toISOString;
duration_prototype__proto.locale = locale;
duration_prototype__proto.localeData = localeData;
// Deprecations
duration_prototype__proto.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', iso_string__toISOString);
duration_prototype__proto.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
utils_hooks__hooks.version = '2.14.1';
setHookCallback(local__createLocal);
utils_hooks__hooks.fn = momentPrototype;
utils_hooks__hooks.min = min;
utils_hooks__hooks.max = max;
utils_hooks__hooks.now = now;
utils_hooks__hooks.utc = create_utc__createUTC;
utils_hooks__hooks.unix = moment__createUnix;
utils_hooks__hooks.months = lists__listMonths;
utils_hooks__hooks.isDate = isDate;
utils_hooks__hooks.locale = locale_locales__getSetGlobalLocale;
utils_hooks__hooks.invalid = valid__createInvalid;
utils_hooks__hooks.duration = create__createDuration;
utils_hooks__hooks.isMoment = isMoment;
utils_hooks__hooks.weekdays = lists__listWeekdays;
utils_hooks__hooks.parseZone = moment__createInZone;
utils_hooks__hooks.localeData = locale_locales__getLocale;
utils_hooks__hooks.isDuration = isDuration;
utils_hooks__hooks.monthsShort = lists__listMonthsShort;
utils_hooks__hooks.weekdaysMin = lists__listWeekdaysMin;
utils_hooks__hooks.defineLocale = defineLocale;
utils_hooks__hooks.updateLocale = updateLocale;
utils_hooks__hooks.locales = locale_locales__listLocales;
utils_hooks__hooks.weekdaysShort = lists__listWeekdaysShort;
utils_hooks__hooks.normalizeUnits = normalizeUnits;
utils_hooks__hooks.relativeTimeRounding = duration_humanize__getSetRelativeTimeRounding;
utils_hooks__hooks.relativeTimeThreshold = duration_humanize__getSetRelativeTimeThreshold;
utils_hooks__hooks.calendarFormat = getCalendarFormat;
utils_hooks__hooks.prototype = momentPrototype;
var _moment = utils_hooks__hooks;
return _moment;
}));
/***/ },
/* 108 */
/***/ 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'];
/***/ },
/* 109 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
module.exports = __webpack_require__(368);
/***/ },
/* 110 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _shallowequal = __webpack_require__(49);
var _shallowequal2 = _interopRequireDefault(_shallowequal);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var ExpandIcon = _react2["default"].createClass({
displayName: 'ExpandIcon',
propTypes: {
record: _react.PropTypes.object,
prefixCls: _react.PropTypes.string,
expandable: _react.PropTypes.any,
expanded: _react.PropTypes.bool,
needIndentSpaced: _react.PropTypes.bool,
onExpand: _react.PropTypes.func
},
shouldComponentUpdate: function shouldComponentUpdate(nextProps) {
return !(0, _shallowequal2["default"])(nextProps, this.props);
},
render: function render() {
var _props = this.props;
var expandable = _props.expandable;
var prefixCls = _props.prefixCls;
var onExpand = _props.onExpand;
var needIndentSpaced = _props.needIndentSpaced;
var expanded = _props.expanded;
var record = _props.record;
if (expandable) {
var expandClassName = expanded ? 'expanded' : 'collapsed';
return _react2["default"].createElement('span', {
className: prefixCls + '-expand-icon ' + prefixCls + '-' + expandClassName,
onClick: function onClick() {
return onExpand(!expanded, record);
}
});
} else if (needIndentSpaced) {
return _react2["default"].createElement('span', { className: prefixCls + '-expand-icon ' + prefixCls + '-spaced' });
}
return null;
}
});
exports["default"] = ExpandIcon;
module.exports = exports['default'];
/***/ },
/* 111 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
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 _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 TabPane = _react2["default"].createClass({
displayName: 'TabPane',
propTypes: {
active: _react.PropTypes.bool
},
render: function render() {
var _classnames;
var props = this.props;
this._isActived = this._isActived || props.active;
if (!this._isActived) {
return null;
}
var prefixCls = props.rootPrefixCls + '-tabpane';
var cls = (0, _classnames3["default"])((_classnames = {}, _defineProperty(_classnames, prefixCls + '-hidden', !props.active), _defineProperty(_classnames, prefixCls, 1), _classnames));
return _react2["default"].createElement(
'div',
{
role: 'tabpanel',
'aria-hidden': props.active ? 'false' : 'true',
className: cls
},
props.children
);
}
});
exports["default"] = TabPane;
module.exports = exports['default'];
/***/ },
/* 112 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getScroll = getScroll;
exports.offset = offset;
exports.getTransformPropertyName = getTransformPropertyName;
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
};
}
var transformPropertyName = void 0;
function getTransformPropertyName() {
if (!window.getComputedStyle) {
return false;
}
if (transformPropertyName !== undefined) {
return transformPropertyName;
}
var el = document.createElement('p');
var has3d = void 0;
var transforms = {
webkitTransform: '-webkit-transform',
OTransform: '-o-transform',
msTransform: '-ms-transform',
MozTransform: '-moz-transform',
transform: 'transform'
};
// Add it to the body to get the computed style.
document.body.insertBefore(el, null);
for (var t in transforms) {
if (el.style[t] !== undefined) {
el.style[t] = 'translate3d(1px,1px,1px)';
has3d = window.getComputedStyle(el).getPropertyValue(transforms[t]);
if (has3d !== undefined && has3d.length > 0 && has3d !== 'none') {
transformPropertyName = t;
}
}
}
document.body.removeChild(el);
return transformPropertyName;
}
/***/ },
/* 113 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
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; }
var LazyRenderBox = _react2["default"].createClass({
displayName: 'LazyRenderBox',
propTypes: {
children: _react.PropTypes.any,
className: _react.PropTypes.string,
visible: _react.PropTypes.bool,
hiddenClassName: _react.PropTypes.string
},
shouldComponentUpdate: function shouldComponentUpdate(nextProps) {
return nextProps.hiddenClassName || nextProps.visible;
},
render: function render() {
var _props = this.props;
var hiddenClassName = _props.hiddenClassName;
var visible = _props.visible;
var props = _objectWithoutProperties(_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);
}
});
exports["default"] = LazyRenderBox;
module.exports = exports['default'];
/***/ },
/* 114 */
/***/ 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__(9);
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;
var autoMount = _config$autoMount === undefined ? true : _config$autoMount;
var _config$autoDestroy = config.autoDestroy;
var autoDestroy = _config$autoDestroy === undefined ? true : _config$autoDestroy;
var isVisible = config.isVisible;
var getComponent = config.getComponent;
var _config$getContainer = config.getContainer;
var 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);
}
_reactDom2["default"].unstable_renderSubtreeIntoContainer(instance, getComponent(instance, componentArg), 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'];
/***/ },
/* 115 */
/***/ function(module, exports, __webpack_require__) {
var mixin = __webpack_require__(471);
var assign = __webpack_require__(11);
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;
})();
/***/ },
/* 116 */
/***/ function(module, exports) {
'use strict';
var defaultProps = {
className: '',
// accessibility: true,
adaptiveHeight: false,
arrows: true,
autoplay: false,
autoplaySpeed: 3000,
centerMode: false,
centerPadding: '50px',
cssEase: 'ease',
dots: false,
dotsClass: 'slick-dots',
draggable: true,
easing: 'linear',
edgeFriction: 0.35,
fade: false,
focusOnSelect: false,
infinite: true,
initialSlide: 0,
lazyLoad: false,
pauseOnHover: false,
responsive: null,
rtl: false,
slide: 'div',
slidesToShow: 1,
slidesToScroll: 1,
speed: 500,
swipe: true,
swipeToSlide: false,
touchMove: true,
touchThreshold: 5,
useCSS: true,
variableWidth: false,
vertical: false,
waitForAnimate: true,
afterChange: null,
beforeChange: null,
edgeEvent: null,
init: null,
swipeEvent: null,
// nextArrow, prevArrow are react componets
nextArrow: null,
prevArrow: null
};
module.exports = defaultProps;
/***/ },
/* 117 */
/***/ 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 _reactDom = __webpack_require__(9);
var _reactDom2 = _interopRequireDefault(_reactDom);
var ReactDOM = _react2['default'].version >= '0.14.0' ? _reactDom2['default'] : _react2['default'];
exports['default'] = ReactDOM;
module.exports = exports['default'];
/***/ },
/* 118 */
/***/ 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 _ReactDOM = __webpack_require__(117);
var _ReactDOM2 = _interopRequireDefault(_ReactDOM);
var _reactLibReactTransitionEvents = __webpack_require__(438);
var _reactLibReactTransitionEvents2 = _interopRequireDefault(_reactLibReactTransitionEvents);
var _trackHelper = __webpack_require__(119);
var _objectAssign = __webpack_require__(48);
var _objectAssign2 = _interopRequireDefault(_objectAssign);
var helpers = {
initialize: function initialize(props) {
var slideCount = _react2['default'].Children.count(props.children);
var listWidth = this.getWidth(_ReactDOM2['default'].findDOMNode(this.refs.list));
var trackWidth = this.getWidth(_ReactDOM2['default'].findDOMNode(this.refs.track));
var slideWidth = this.getWidth(_ReactDOM2['default'].findDOMNode(this)) / props.slidesToShow;
var currentSlide = props.rtl ? slideCount - 1 - props.initialSlide : props.initialSlide;
this.setState({
slideCount: slideCount,
slideWidth: slideWidth,
listWidth: listWidth,
trackWidth: trackWidth,
currentSlide: currentSlide
}, function () {
var targetLeft = (0, _trackHelper.getTrackLeft)((0, _objectAssign2['default'])({
slideIndex: this.state.currentSlide,
trackRef: this.refs.track
}, props, this.state));
// getCSS function needs previously set state
var trackStyle = (0, _trackHelper.getTrackCSS)((0, _objectAssign2['default'])({ left: targetLeft }, props, this.state));
this.setState({ trackStyle: trackStyle });
this.autoPlay(); // once we're set up, trigger the initial autoplay.
});
},
update: function update(props) {
// This method has mostly same code as initialize method.
// Refactor it
var slideCount = _react2['default'].Children.count(props.children);
var listWidth = this.getWidth(_ReactDOM2['default'].findDOMNode(this.refs.list));
var trackWidth = this.getWidth(_ReactDOM2['default'].findDOMNode(this.refs.track));
var slideWidth = this.getWidth(_ReactDOM2['default'].findDOMNode(this)) / props.slidesToShow;
this.setState({
slideCount: slideCount,
slideWidth: slideWidth,
listWidth: listWidth,
trackWidth: trackWidth
}, function () {
var targetLeft = (0, _trackHelper.getTrackLeft)((0, _objectAssign2['default'])({
slideIndex: this.state.currentSlide,
trackRef: this.refs.track
}, props, this.state));
// getCSS function needs previously set state
var trackStyle = (0, _trackHelper.getTrackCSS)((0, _objectAssign2['default'])({ left: targetLeft }, props, this.state));
this.setState({ trackStyle: trackStyle });
});
},
getWidth: function getWidth(elem) {
return elem.getBoundingClientRect().width || elem.offsetWidth;
},
adaptHeight: function adaptHeight() {
if (this.props.adaptiveHeight) {
var selector = '[data-index="' + this.state.currentSlide + '"]';
if (this.refs.list) {
var slickList = _ReactDOM2['default'].findDOMNode(this.refs.list);
slickList.style.height = slickList.querySelector(selector).offsetHeight + 'px';
}
}
},
slideHandler: function slideHandler(index) {
var _this = this;
// Functionality of animateSlide and postSlide is merged into this function
// console.log('slideHandler', index);
var targetSlide, currentSlide;
var targetLeft, currentLeft;
var callback;
if (this.props.waitForAnimate && this.state.animating) {
return;
}
if (this.props.fade) {
currentSlide = this.state.currentSlide;
// Shifting targetSlide back into the range
if (index < 0) {
targetSlide = index + this.state.slideCount;
} else if (index >= this.state.slideCount) {
targetSlide = index - this.state.slideCount;
} else {
targetSlide = index;
}
if (this.props.lazyLoad && this.state.lazyLoadedList.indexOf(targetSlide) < 0) {
this.setState({
lazyLoadedList: this.state.lazyLoadedList.concat(targetSlide)
});
}
callback = function () {
_this.setState({
animating: false
});
if (_this.props.afterChange) {
_this.props.afterChange(currentSlide);
}
_reactLibReactTransitionEvents2['default'].removeEndEventListener(_ReactDOM2['default'].findDOMNode(_this.refs.track).children[currentSlide], callback);
};
this.setState({
animating: true,
currentSlide: targetSlide
}, function () {
_reactLibReactTransitionEvents2['default'].addEndEventListener(_ReactDOM2['default'].findDOMNode(this.refs.track).children[currentSlide], callback);
});
if (this.props.beforeChange) {
this.props.beforeChange(this.state.currentSlide, currentSlide);
}
this.autoPlay();
return;
}
targetSlide = index;
if (targetSlide < 0) {
if (this.props.infinite === false) {
currentSlide = 0;
} else if (this.state.slideCount % this.props.slidesToScroll !== 0) {
currentSlide = this.state.slideCount - this.state.slideCount % this.props.slidesToScroll;
} else {
currentSlide = this.state.slideCount + targetSlide;
}
} else if (targetSlide >= this.state.slideCount) {
if (this.props.infinite === false) {
currentSlide = this.state.slideCount - this.props.slidesToShow;
} else if (this.state.slideCount % this.props.slidesToScroll !== 0) {
currentSlide = 0;
} else {
currentSlide = targetSlide - this.state.slideCount;
}
} else {
currentSlide = targetSlide;
}
targetLeft = (0, _trackHelper.getTrackLeft)((0, _objectAssign2['default'])({
slideIndex: targetSlide,
trackRef: this.refs.track
}, this.props, this.state));
currentLeft = (0, _trackHelper.getTrackLeft)((0, _objectAssign2['default'])({
slideIndex: currentSlide,
trackRef: this.refs.track
}, this.props, this.state));
if (this.props.infinite === false) {
targetLeft = currentLeft;
}
if (this.props.beforeChange) {
this.props.beforeChange(this.state.currentSlide, currentSlide);
}
if (this.props.lazyLoad) {
var loaded = true;
var slidesToLoad = [];
for (var i = targetSlide; i < targetSlide + this.props.slidesToShow; i++) {
loaded = loaded && this.state.lazyLoadedList.indexOf(i) >= 0;
if (!loaded) {
slidesToLoad.push(i);
}
}
if (!loaded) {
this.setState({
lazyLoadedList: this.state.lazyLoadedList.concat(slidesToLoad)
});
}
}
// Slide Transition happens here.
// animated transition happens to target Slide and
// non - animated transition happens to current Slide
// If CSS transitions are false, directly go the current slide.
if (this.props.useCSS === false) {
this.setState({
currentSlide: currentSlide,
trackStyle: (0, _trackHelper.getTrackCSS)((0, _objectAssign2['default'])({ left: currentLeft }, this.props, this.state))
}, function () {
if (this.props.afterChange) {
this.props.afterChange(currentSlide);
}
});
} else {
var nextStateChanges = {
animating: false,
currentSlide: currentSlide,
trackStyle: (0, _trackHelper.getTrackCSS)((0, _objectAssign2['default'])({ left: currentLeft }, this.props, this.state)),
swipeLeft: null
};
callback = function () {
_this.setState(nextStateChanges);
if (_this.props.afterChange) {
_this.props.afterChange(currentSlide);
}
_reactLibReactTransitionEvents2['default'].removeEndEventListener(_ReactDOM2['default'].findDOMNode(_this.refs.track), callback);
};
this.setState({
animating: true,
currentSlide: currentSlide,
trackStyle: (0, _trackHelper.getTrackAnimateCSS)((0, _objectAssign2['default'])({ left: targetLeft }, this.props, this.state))
}, function () {
_reactLibReactTransitionEvents2['default'].addEndEventListener(_ReactDOM2['default'].findDOMNode(this.refs.track), callback);
});
}
this.autoPlay();
},
swipeDirection: function swipeDirection(touchObject) {
var xDist, yDist, r, swipeAngle;
xDist = touchObject.startX - touchObject.curX;
yDist = touchObject.startY - touchObject.curY;
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 || swipeAngle <= 360 && swipeAngle >= 315) {
return this.props.rtl === false ? 'left' : 'right';
}
if (swipeAngle >= 135 && swipeAngle <= 225) {
return this.props.rtl === false ? 'right' : 'left';
}
return 'vertical';
},
autoPlay: function autoPlay() {
var _this2 = this;
if (this.state.autoPlayTimer) {
return;
}
var play = function play() {
if (_this2.state.mounted) {
var nextIndex = _this2.props.rtl ? _this2.state.currentSlide - _this2.props.slidesToScroll : _this2.state.currentSlide + _this2.props.slidesToScroll;
_this2.slideHandler(nextIndex);
}
};
if (this.props.autoplay) {
this.setState({
autoPlayTimer: window.setInterval(play, this.props.autoplaySpeed)
});
}
},
pause: function pause() {
if (this.state.autoPlayTimer) {
window.clearInterval(this.state.autoPlayTimer);
this.setState({
autoPlayTimer: null
});
}
}
};
exports['default'] = helpers;
module.exports = exports['default'];
/***/ },
/* 119 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _ReactDOM = __webpack_require__(117);
var _ReactDOM2 = _interopRequireDefault(_ReactDOM);
var checkSpecKeys = function checkSpecKeys(spec, keysArray) {
return keysArray.reduce(function (value, key) {
return value && spec.hasOwnProperty(key);
}, true) ? null : console.error('Keys Missing', spec);
};
var getTrackCSS = function getTrackCSS(spec) {
checkSpecKeys(spec, ['left', 'variableWidth', 'slideCount', 'slidesToShow', 'slideWidth']);
var trackWidth;
if (spec.variableWidth) {
trackWidth = (spec.slideCount + 2 * spec.slidesToShow) * spec.slideWidth;
} else if (spec.centerMode) {
trackWidth = (spec.slideCount + 2 * (spec.slidesToShow + 1)) * spec.slideWidth;
} else {
trackWidth = (spec.slideCount + 2 * spec.slidesToShow) * spec.slideWidth;
}
var style = {
opacity: 1,
width: trackWidth,
WebkitTransform: 'translate3d(' + spec.left + 'px, 0px, 0px)',
transform: 'translate3d(' + spec.left + 'px, 0px, 0px)',
transition: '',
WebkitTransition: '',
msTransform: 'translateX(' + spec.left + 'px)'
};
// Fallback for IE8
if (!window.addEventListener && window.attachEvent) {
style.marginLeft = spec.left + 'px';
}
return style;
};
exports.getTrackCSS = getTrackCSS;
var getTrackAnimateCSS = function getTrackAnimateCSS(spec) {
checkSpecKeys(spec, ['left', 'variableWidth', 'slideCount', 'slidesToShow', 'slideWidth', 'speed', 'cssEase']);
var style = getTrackCSS(spec);
// useCSS is true by default so it can be undefined
style.WebkitTransition = '-webkit-transform ' + spec.speed + 'ms ' + spec.cssEase;
style.transition = 'transform ' + spec.speed + 'ms ' + spec.cssEase;
return style;
};
exports.getTrackAnimateCSS = getTrackAnimateCSS;
var getTrackLeft = function getTrackLeft(spec) {
checkSpecKeys(spec, ['slideIndex', 'trackRef', 'infinite', 'centerMode', 'slideCount', 'slidesToShow', 'slidesToScroll', 'slideWidth', 'listWidth', 'variableWidth']);
var slideOffset = 0;
var targetLeft;
var targetSlide;
if (spec.fade) {
return 0;
}
if (spec.infinite) {
if (spec.slideCount > spec.slidesToShow) {
slideOffset = spec.slideWidth * spec.slidesToShow * -1;
}
if (spec.slideCount % spec.slidesToScroll !== 0) {
if (spec.slideIndex + spec.slidesToScroll > spec.slideCount && spec.slideCount > spec.slidesToShow) {
if (spec.slideIndex > spec.slideCount) {
slideOffset = (spec.slidesToShow - (spec.slideIndex - spec.slideCount)) * spec.slideWidth * -1;
} else {
slideOffset = spec.slideCount % spec.slidesToScroll * spec.slideWidth * -1;
}
}
}
}
if (spec.centerMode) {
if (spec.infinite) {
slideOffset += spec.slideWidth * Math.floor(spec.slidesToShow / 2);
} else {
slideOffset = spec.slideWidth * Math.floor(spec.slidesToShow / 2);
}
}
targetLeft = spec.slideIndex * spec.slideWidth * -1 + slideOffset;
if (spec.variableWidth === true) {
var targetSlideIndex;
if (spec.slideCount <= spec.slidesToShow || spec.infinite === false) {
targetSlide = _ReactDOM2['default'].findDOMNode(spec.trackRef).childNodes[spec.slideIndex];
} else {
targetSlideIndex = spec.slideIndex + spec.slidesToShow;
targetSlide = _ReactDOM2['default'].findDOMNode(spec.trackRef).childNodes[targetSlideIndex];
}
targetLeft = targetSlide ? targetSlide.offsetLeft * -1 : 0;
if (spec.centerMode === true) {
if (spec.infinite === false) {
targetSlide = _ReactDOM2['default'].findDOMNode(spec.trackRef).children[spec.slideIndex];
} else {
targetSlide = _ReactDOM2['default'].findDOMNode(spec.trackRef).children[spec.slideIndex + spec.slidesToShow + 1];
}
targetLeft = targetSlide ? targetSlide.offsetLeft * -1 : 0;
targetLeft += (spec.listWidth - targetSlide.offsetWidth) / 2;
}
}
return targetLeft;
};
exports.getTrackLeft = getTrackLeft;
/***/ },
/* 120 */
/***/ 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'];
/***/ },
/* 121 */
/***/ 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.
*
* @providesModule CSSProperty
*/
'use strict';
/**
* CSS properties which accept numbers but are not in units of "px".
*/
var isUnitlessNumber = {
animationIterationCount: true,
borderImageOutset: true,
borderImageSlice: true,
borderImageWidth: true,
boxFlex: true,
boxFlexGroup: true,
boxOrdinalGroup: true,
columnCount: true,
flex: true,
flexGrow: true,
flexPositive: true,
flexShrink: true,
flexNegative: true,
flexOrder: true,
gridRow: true,
gridColumn: true,
fontWeight: true,
lineClamp: true,
lineHeight: true,
opacity: true,
order: true,
orphans: true,
tabSize: true,
widows: true,
zIndex: true,
zoom: true,
// SVG-related properties
fillOpacity: true,
floodOpacity: true,
stopOpacity: true,
strokeDasharray: true,
strokeDashoffset: true,
strokeMiterlimit: true,
strokeOpacity: true,
strokeWidth: true
};
/**
* @param {string} prefix vendor-specific prefix, eg: Webkit
* @param {string} key style name, eg: transitionDuration
* @return {string} style name prefixed with `prefix`, properly camelCased, eg:
* WebkitTransitionDuration
*/
function prefixKey(prefix, key) {
return prefix + key.charAt(0).toUpperCase() + key.substring(1);
}
/**
* Support style names that may come passed in prefixed by adding permutations
* of vendor prefixes.
*/
var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
// Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
// infinite loop, because it iterates over the newly added props too.
Object.keys(isUnitlessNumber).forEach(function (prop) {
prefixes.forEach(function (prefix) {
isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
});
});
/**
* Most style properties can be unset by doing .style[prop] = '' but IE8
* doesn't like doing that with shorthand properties so for the properties that
* IE8 breaks on, which are listed here, we instead unset each of the
* individual properties. See http://bugs.jquery.com/ticket/12385.
* The 4-value 'clock' properties like margin, padding, border-width seem to
* behave without any problems. Curiously, list-style works too without any
* special prodding.
*/
var shorthandPropertyExpansions = {
background: {
backgroundAttachment: true,
backgroundColor: true,
backgroundImage: true,
backgroundPositionX: true,
backgroundPositionY: true,
backgroundRepeat: true
},
backgroundPosition: {
backgroundPositionX: true,
backgroundPositionY: true
},
border: {
borderWidth: true,
borderStyle: true,
borderColor: true
},
borderBottom: {
borderBottomWidth: true,
borderBottomStyle: true,
borderBottomColor: true
},
borderLeft: {
borderLeftWidth: true,
borderLeftStyle: true,
borderLeftColor: true
},
borderRight: {
borderRightWidth: true,
borderRightStyle: true,
borderRightColor: true
},
borderTop: {
borderTopWidth: true,
borderTopStyle: true,
borderTopColor: true
},
font: {
fontStyle: true,
fontVariant: true,
fontWeight: true,
fontSize: true,
lineHeight: true,
fontFamily: true
},
outline: {
outlineWidth: true,
outlineStyle: true,
outlineColor: true
}
};
var CSSProperty = {
isUnitlessNumber: isUnitlessNumber,
shorthandPropertyExpansions: shorthandPropertyExpansions
};
module.exports = CSSProperty;
/***/ },
/* 122 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.COLS = undefined;
var _keys = __webpack_require__(33);
var _keys2 = _interopRequireDefault(_keys);
exports.getDefaultValue = getDefaultValue;
exports.exclude = exclude;
exports.noop = noop;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function getDefaultValue(d, val, cols) {
var data = d;
var value = val;
if (!value || !value.length) {
value = [];
for (var i = 0; i < cols; i++) {
if (data && data.length) {
value[i] = data[0].value;
data = data[0].children;
} else {
value[i] = undefined;
}
}
}
return value;
}
function exclude(props, bl) {
var ret = {};
(0, _keys2["default"])(props).forEach(function (k) {
if (!bl[k]) {
ret[k] = props[k];
}
});
return ret;
}
function noop() {}
var COLS = exports.COLS = 3;
/***/ },
/* 123 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = {
year: '',
month: '',
day: '',
hour: '',
minute: ''
};
module.exports = exports['default'];
/***/ },
/* 124 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = __webpack_require__(8);
var _extends3 = _interopRequireDefault(_extends2);
var _objectWithoutProperties2 = __webpack_require__(53);
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
var _keys = __webpack_require__(33);
var _keys2 = _interopRequireDefault(_keys);
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__(9);
var _reactDom2 = _interopRequireDefault(_reactDom);
var _ListViewDataSource = __webpack_require__(452);
var _ListViewDataSource2 = _interopRequireDefault(_ListViewDataSource);
var _ScrollView = __webpack_require__(453);
var _ScrollView2 = _interopRequireDefault(_ScrollView);
var _ScrollResponder = __webpack_require__(125);
var _ScrollResponder2 = _interopRequireDefault(_ScrollResponder);
var _StaticRenderer = __webpack_require__(454);
var _StaticRenderer2 = _interopRequireDefault(_StaticRenderer);
var _reactTimerMixin = __webpack_require__(429);
var _reactTimerMixin2 = _interopRequireDefault(_reactTimerMixin);
var _objectAssign = __webpack_require__(11);
var _objectAssign2 = _interopRequireDefault(_objectAssign);
var _reactMixin = __webpack_require__(115);
var _reactMixin2 = _interopRequireDefault(_reactMixin);
var _autobindDecorator = __webpack_require__(72);
var _autobindDecorator2 = _interopRequireDefault(_autobindDecorator);
var _reactSticky = __webpack_require__(427);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var throttle = __webpack_require__(104);
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';
/**
* ListView - A core component designed for efficient display of vertically
* scrolling lists of changing data. The minimal API is to create a
* `ListView.DataSource`, populate it with a simple array of data blobs, and
* instantiate a `ListView` component with that data source and a `renderRow`
* callback which takes a blob from the data array and returns a renderable
* component.
*
* Minimal example:
*
* ```
* getInitialState: function() {
* let ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
* return {
* dataSource: ds.cloneWithRows(['row 1', 'row 2']),
* };
* },
*
* render: function() {
* return (
* {rowData}}
* />
* );
* },
* ```
*
* ListView also supports more advanced features, including sections with sticky
* section headers, header and footer support, callbacks on reaching the end of
* the available data (`onEndReached`) and on the set of rows that are visible
* in the device viewport change (`onChangeVisibleRows`), and several
* performance optimizations.
*
* There are a few performance operations designed to make ListView scroll
* smoothly while dynamically loading potentially very large (or conceptually
* infinite) data sets:
*
* * Only re-render changed rows - the rowHasChanged function provided to the
* data source tells the ListView if it needs to re-render a row because the
* source data has changed - see ListViewDataSource for more details.
*
* * Rate-limited row rendering - By default, only one row is rendered per
* event-loop (customizable with the `pageSize` prop). This breaks up the
* work into smaller chunks to reduce the chance of dropping frames while
* rendering rows.
*/
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);
}
/**
* You must provide a renderRow function. If you omit any of the other render
* functions, ListView will simply skip rendering them.
*
* - renderRow(rowData, sectionID, rowID, highlightRow);
* - renderSectionHeader(sectionData, sectionID);
*/
/**
* 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: (0, _keys2["default"])(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();
// });
if (this.props.stickyHeader) {
// this.container = document.createElement('div');
// window.document.body.insertBefore(this.container, window.document.body.firstChild || null);
this.__onScroll = throttle(this._onScroll, this.props.scrollEventThrottle);
window.addEventListener('scroll', this.__onScroll);
}
this.componentDidUpdate();
};
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.componentDidUpdate = function componentDidUpdate() {
var _this3 = this;
this.requestAnimationFrame(function () {
_this3._measureAndUpdateScrollProps();
});
// if (this.props.stickyHeader) {
// ReactDOM.unstable_renderSubtreeIntoContainer(this, this._sc, this.container);
// }
};
ListView.prototype.componentWillUnmount = function componentWillUnmount() {
if (this.props.stickyHeader) {
// if (this.container) {
// ReactDOM.unmountComponentAtNode(this.container);
// window.document.body.removeChild(this.container);
// }
window.removeEventListener('scroll', this.__onScroll);
}
};
ListView.prototype.onRowHighlighted = function onRowHighlighted(sectionID, rowID) {
this.setState({ highlightedRow: { sectionID: sectionID, rowID: rowID } });
};
ListView.prototype.render = function render() {
var _this4 = 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 (_this4.props.renderSectionHeader) {
var shouldUpdateHeader = rowCount >= _this4._prevRenderedRowsCount && dataSource.sectionHeaderShouldUpdate(sectionIdx);
var renderSectionHeader = _react2["default"].createElement(_StaticRenderer2["default"], {
key: 's_' + sectionID,
shouldUpdate: !!shouldUpdateHeader,
render: _this4.props.renderSectionHeader.bind(null, dataSource.getSectionHeaderData(sectionIdx), sectionID)
});
if (_this4.props.stickyHeader) {
renderSectionHeader = _react2["default"].createElement(
_reactSticky.Sticky,
(0, _extends3["default"])({}, _this4.props.stickyProps, { key: 's_' + sectionID,
ref: function ref(c) {
_this4.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 >= _this4._prevRenderedRowsCount && dataSource.rowShouldUpdate(sectionIdx, rowIdx);
var row = _react2["default"].createElement(_StaticRenderer2["default"], {
key: 'r_' + comboID,
shouldUpdate: !!shouldUpdateRow,
render: _this4.props.renderRow.bind(null, dataSource.getRowData(sectionIdx, rowIdx), sectionID, rowID, _this4.onRowHighlighted)
});
// bodyComponents.push(row);
sectionBody.push(row);
totalIndex++;
if (_this4.props.renderSeparator && (rowIdx !== rowIDs.length - 1 || sectionIdx === allRowIDs.length - 1)) {
var adjacentRowHighlighted = _this4.state.highlightedRow.sectionID === sectionID && (_this4.state.highlightedRow.rowID === rowID || _this4.state.highlightedRow.rowID === rowIDs[rowIdx + 1]);
var separator = _this4.props.renderSeparator(sectionID, rowID, adjacentRowHighlighted);
if (separator) {
// bodyComponents.push(separator);
sectionBody.push(separator);
totalIndex++;
}
}
if (++rowCount === _this4.state.curRenderedRowsCount) {
break;
}
}
bodyComponents.push(_react2["default"].createElement(
'div',
{ key: sectionID, className: 'list-view-section-body' },
sectionBody
));
if (rowCount >= _this4.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;
var renderScrollComponent = _props.renderScrollComponent;
var 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
);
}
// if (!props.scrollEventThrottle) {
// props.scrollEventThrottle = DEFAULT_SCROLL_CALLBACK_THROTTLE;
// }
if (props.removeClippedSubviews === undefined) {
props.removeClippedSubviews = true;
}
(0, _objectAssign2["default"])(props, {
onScroll: this._onScroll,
stickyHeaderIndices: this.props.stickyHeaderIndices.concat(sectionHeaderIndices),
// Do not pass these events downstream to ScrollView since they will be
// registered in ListView's own ScrollResponder.Mixin
onKeyboardWillShow: undefined,
onKeyboardWillHide: undefined,
onKeyboardDidShow: undefined,
onKeyboardDidHide: undefined
});
// TODO(ide): Use function refs so we can compose with the scroll
// component's original ref instead of clobbering it
if (props.stickyHeader) {
delete props.onScroll;
}
this._sc = _react2["default"].cloneElement(renderScrollComponent(props), {
ref: SCROLLVIEW_REF,
onContentSizeChange: this._onContentSizeChange,
onLayout: props.stickyHeader ? function (event) {
_this4.props.onLayout && _this4.props.onLayout(event);
} : this._onLayout
}, header, bodyComponents, footer, props.children);
// if (props.stickyHeader) {
// return null;
// }
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;
var width = _event$nativeEvent$la.width;
var 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) , this.props.onEndReachedThreshold);
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 _this5 = this;
this.setState(function (state, props) {
var rowsToRender = Math.min(state.curRenderedRowsCount + props.pageSize, props.dataSource.getRowCount());
_this5._prevRenderedRowsCount = state.curRenderedRowsCount;
return {
curRenderedRowsCount: rowsToRender
};
}, function () {
_this5._measureAndUpdateScrollProps();
_this5._prevRenderedRowsCount = _this5.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 target = _reactDom2["default"].findDOMNode(this.refs[SCROLLVIEW_REF]);
if (this.props.stickyHeader) {
this.scrollProperties.visibleLength = window[isVertical ? 'innerHeight' : 'innerWidth'];
this.scrollProperties.contentLength = target[isVertical ? 'scrollHeight' : 'scrollWidth'];
this.scrollProperties.offset = window.document.body[isVertical ? 'scrollTop' : 'scrollTop'];
} else {
this.scrollProperties.visibleLength = target[isVertical ? 'offsetHeight' : 'offsetWidth'];
this.scrollProperties.contentLength = target[isVertical ? 'scrollHeight' : 'scrollWidth'];
this.scrollProperties.offset = target[isVertical ? 'scrollTop' : 'scrollTop'];
}
// this._updateVisibleRows(e.nativeEvent.updatedChildFrames);
if (!this._maybeCallOnEndReached(e)) {
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(e);
};
return ListView;
}(_react2["default"].Component);
ListView.DataSource = _ListViewDataSource2["default"];
ListView.propTypes = (0, _extends3["default"])({}, _ScrollView2["default"].propTypes, {
dataSource: _react.PropTypes.instanceOf(_ListViewDataSource2["default"]).isRequired,
/**
* (sectionID, rowID, adjacentRowHighlighted) => renderable
*
* If provided, a renderable component to be rendered as the separator
* below each row but not the last row if there is a section header below.
* Take a sectionID and rowID of the row above and whether its adjacent row
* is highlighted.
*/
renderSeparator: _react.PropTypes.func,
/**
* (rowData, sectionID, rowID, highlightRow) => renderable
*
* Takes a data entry from the data source and its ids and should return
* a renderable component to be rendered as the row. By default the data
* is exactly what was put into the data source, but it's also possible to
* provide custom extractors. ListView can be notified when a row is
* being highlighted by calling highlightRow function. The separators above and
* below will be hidden when a row is highlighted. The highlighted state of
* a row can be reset by calling highlightRow(null).
*/
renderRow: _react.PropTypes.func.isRequired,
/**
* How many rows to render on initial component mount. Use this to make
* it so that the first screen worth of data appears at one time instead of
* over the course of multiple frames.
*/
initialListSize: _react.PropTypes.number,
/**
* Called when all rows have been rendered and the list has been scrolled
* to within onEndReachedThreshold of the bottom. The native scroll
* event is provided.
*/
onEndReached: _react.PropTypes.func,
/**
* Threshold in pixels (virtual, not physical) for calling onEndReached.
*/
onEndReachedThreshold: _react.PropTypes.number,
/**
* Number of rows to render per event loop. Note: if your 'rows' are actually
* cells, i.e. they don't span the full width of your view (as in the
* ListViewGridLayoutExample), you should set the pageSize to be a multiple
* of the number of cells per row, otherwise you're likely to see gaps at
* the edge of the ListView as new pages are loaded.
*/
pageSize: _react.PropTypes.number,
/**
* () => renderable
*
* The header and footer are always rendered (if these props are provided)
* on every render pass. If they are expensive to re-render, wrap them
* in StaticContainer or other mechanism as appropriate. Footer is always
* at the bottom of the list, and header at the top, on every render pass.
*/
renderFooter: _react.PropTypes.func,
renderHeader: _react.PropTypes.func,
renderBodyComponent: _react.PropTypes.func, // add
/**
* (sectionData, sectionID) => renderable
*
* If provided, a sticky header is rendered for this section. The sticky
* behavior means that it will scroll with the content at the top of the
* section until it reaches the top of the screen, at which point it will
* stick to the top until it is pushed off the screen by the next section
* header.
*/
renderSectionHeader: _react.PropTypes.func,
/**
* (props) => renderable
*
* A function that returns the scrollable component in which the list rows
* are rendered. Defaults to returning a ScrollView with the given props.
*/
renderScrollComponent: _react2["default"].PropTypes.func.isRequired,
/**
* How early to start rendering rows before they come on screen, in
* pixels.
*/
scrollRenderAheadDistance: _react2["default"].PropTypes.number,
scrollEventThrottle: _react2["default"].PropTypes.number,
/**
* (visibleRows, changedRows) => void
*
* Called when the set of visible rows changes. `visibleRows` maps
* { sectionID: { rowID: true }} for all the visible rows, and
* `changedRows` maps { sectionID: { rowID: true | false }} for the rows
* that have changed their visibility, with true indicating visible, and
* false indicating the view has moved out of view.
*/
onChangeVisibleRows: _react2["default"].PropTypes.func,
/**
* A performance optimization for improving scroll perf of
* large lists, used in conjunction with overflow: 'hidden' on the row
* containers. This is enabled by default.
*/
removeClippedSubviews: _react2["default"].PropTypes.bool,
/**
* An array of child indices determining which children get docked to the
* top of the screen when scrolling. For example, passing
* `stickyHeaderIndices={[0]}` will cause the first child to be fixed to the
* top of the scroll view. This property is not supported in conjunction
* with `horizontal={true}`.
* @platform ios
*/
stickyHeaderIndices: _react.PropTypes.arrayOf(_react.PropTypes.number),
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);
},
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, _autobindDecorator2["default"])(ListView);
ListView.isReactNativeComponent = true;
exports["default"] = ListView;
module.exports = exports['default'];
/***/ },
/* 125 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _reactDom = __webpack_require__(9);
var _reactDom2 = _interopRequireDefault(_reactDom);
var _warning = __webpack_require__(24);
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;
/***/ },
/* 126 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _ListView = __webpack_require__(124);
var _ListView2 = _interopRequireDefault(_ListView);
var _Indexed = __webpack_require__(451);
var _Indexed2 = _interopRequireDefault(_Indexed);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
// export this package's api
_ListView2["default"].IndexedList = _Indexed2["default"];
exports["default"] = _ListView2["default"];
module.exports = exports['default'];
/***/ },
/* 127 */
/***/ 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 React = _interopRequireWildcard(_react);
var _Animate = __webpack_require__(463);
var _reactHammerjs = __webpack_require__(47);
var _reactHammerjs2 = _interopRequireDefault(_reactHammerjs);
var _objectAssign = __webpack_require__(11);
var _objectAssign2 = _interopRequireDefault(_objectAssign);
var _utils = __webpack_require__(467);
var _isChildrenEqual = __webpack_require__(466);
var _isChildrenEqual2 = _interopRequireDefault(_isChildrenEqual);
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 }; }
/*
* Based on Zynga Scroller (http://github.com/zynga/scroller)
* Copyright 2011, Zynga Inc.
* Licensed under the MIT License.
* https://raw.github.com/zynga/scroller/master/MIT-LICENSE.txt
*/
var DECELERATION_VELOCITY_RATE = 0.95;
// How much velocity is required to keep the deceleration running
var MIN_VELOCITY_TO_KEEP_DECELERATING = 0.5;
var POSITION_MAX_LENGTH = 40;
var DEFAULT_ANIM_DURATION = 250;
var TIME_FRAME = 100;
// How much velocity is required to start the deceleration
var MIN_VELOCITY_TO_START_DECELERATION = 4;
var hammerOption = {
recognizers: {
pan: {
threshold: 5
}
}
};
var HAMMER_DOWN = 16;
var Picker = function (_React$Component) {
(0, _inherits3["default"])(Picker, _React$Component);
function Picker(props) {
(0, _classCallCheck3["default"])(this, Picker);
var _this = (0, _possibleConstructorReturn3["default"])(this, _React$Component.call(this, props));
_this.onPanStart = function (e) {
if (e.target.tagName.match(/input|textarea|select/i)) {
return;
}
e.preventDefault();
_this.clearAnim();
_this.lastTouchMove = Date.now();
_this.isTracking = true;
_this.didDecelerationComplete = false;
_this.positions = [];
_this.startScrollTop = _this.scrollTop;
};
_this.onPan = function (e) {
// Ignore event when tracking is not enabled (event might be outside of element)
if (!_this.isTracking) {
return;
}
var timeStamp = Date.now();
_this.lastTouchMove = timeStamp;
var positions = _this.positions;
var scrollTop = _this.startScrollTop + (e.offsetDirection === HAMMER_DOWN ? -e.distance : e.distance);
var minScrollTop = _this.minScrollTop;
var maxScrollTop = _this.maxScrollTop;
if (scrollTop > maxScrollTop || scrollTop < minScrollTop) {
// Slow down on the edges
if (scrollTop > maxScrollTop) {
scrollTop = maxScrollTop;
} else {
scrollTop = minScrollTop;
}
}
// Keep list from growing infinitely (holding min 10, max 20 measure points)
if (positions.length > POSITION_MAX_LENGTH) {
positions.splice(0, POSITION_MAX_LENGTH / 2);
}
// Track scroll movement for declaration
positions.push(scrollTop, timeStamp);
// Sync scroll position
_this.publish(scrollTop);
// Otherwise figure out whether we are switching into dragging mode now.
};
_this.onPanEnd = function () {
// Ignore event when tracking is not enabled (no touchstart event on element)
// This is required as this listener ('touchmove')
// sits on the document and not on the element itself.
if (!_this.isTracking) {
return;
}
var timeStamp = Date.now();
// Not touching anymore (when two finger hit the screen there are two touch end events)
_this.isTracking = false;
// Be sure to reset the dragging flag now. Here we also detect whether
// the finger has moved fast enough to switch into a deceleration animation.
// Start deceleration
// Verify that the last move detected was in some relevant time frame
if (timeStamp - _this.lastTouchMove <= TIME_FRAME) {
// Then figure out what the scroll position was about 100ms ago
var positions = _this.positions;
var endPos = positions.length - 1;
var startPos = endPos;
// Move pointer to position measured 100ms ago
for (var i = endPos; i > 0 && positions[i] > _this.lastTouchMove - TIME_FRAME; i -= 2) {
startPos = i;
}
// If start and stop position is identical in a 100ms timeframe,
// we cannot compute any useful deceleration.
if (startPos !== endPos) {
// Compute relative movement between these two points
var timeOffset = positions[endPos] - positions[startPos];
var movedTop = _this.scrollTop - positions[startPos - 1];
// Based on 50ms compute the movement to apply for each render step
_this.decelerationVelocityY = movedTop / timeOffset * (1000 / 60);
// Verify that we have enough velocity to start deceleration
if (Math.abs(_this.decelerationVelocityY) > MIN_VELOCITY_TO_START_DECELERATION) {
_this.startDeceleration();
}
}
}
if (!_this.isDecelerating) {
_this.scrollTo(_this.scrollTop);
}
// Fully cleanup list
_this.positions.length = 0;
};
var selectedValueState = void 0;
var selectedValue = props.selectedValue;
var defaultSelectedValue = props.defaultSelectedValue;
var children = props.children;
if (selectedValue !== undefined) {
selectedValueState = selectedValue;
} else if (defaultSelectedValue !== undefined) {
selectedValueState = defaultSelectedValue;
} else if (children.length) {
selectedValueState = children[0].value;
}
_this.state = {
selectedValue: selectedValueState
};
return _this;
}
Picker.prototype.componentDidMount = function componentDidMount() {
(0, _objectAssign2["default"])(this, {
isTracking: false,
didDecelerationComplete: false,
isDecelerating: false,
isAnimating: false,
clientHeight: 0,
contentHeight: 0,
itemHeight: 0,
scrollTop: 0,
minScrollTop: 0,
maxScrollTop: 0,
scheduledTop: 0,
positions: [],
minDecelerationScrollTop: 0,
maxDecelerationScrollTop: 0,
decelerationVelocityY: 0
});
var _refs = this.refs;
var indicator = _refs.indicator;
var component = _refs.component;
var content = _refs.content;
this.itemHeight = parseInt((0, _utils.getComputedStyle)(indicator, 'height'), 10);
this.setDimensions(component.clientHeight, content.offsetHeight);
this.select(this.state.selectedValue, false);
};
Picker.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
if ('selectedValue' in nextProps) {
this.setState({
selectedValue: nextProps.selectedValue
});
}
};
Picker.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps, nextState) {
return this.state.selectedValue !== nextState.selectedValue || !(0, _isChildrenEqual2["default"])(this.props.children, nextProps.children, this.props.pure);
};
Picker.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
if (!(0, _isChildrenEqual2["default"])(prevProps.children, this.props.children, this.props.pure)) {
this.componentDidMount();
} else {
this.select(this.state.selectedValue, false);
}
};
Picker.prototype.componentWillUnmount = function componentWillUnmount() {
this.clearAnim();
};
Picker.prototype.setTop = function setTop(top) {
if (this.refs.content) {
this.refs.content.style.webkitTransform = 'translate3d(0, ' + -top + 'px, 0)';
}
};
Picker.prototype.setDimensions = function setDimensions(clientHeight, contentHeight) {
this.clientHeight = clientHeight;
this.contentHeight = contentHeight;
var totalItemCount = this.props.children.length;
var clientItemCount = Math.round(this.clientHeight / this.itemHeight);
this.minScrollTop = -this.itemHeight * (clientItemCount / 2);
this.maxScrollTop = this.minScrollTop + totalItemCount * this.itemHeight - 0.1;
};
Picker.prototype.clearAnim = function clearAnim() {
if (this.isDecelerating) {
_Animate.Animate.stop(this.isDecelerating);
this.isDecelerating = 0;
}
if (this.isAnimating) {
_Animate.Animate.stop(this.isAnimating);
this.isAnimating = 0;
}
};
Picker.prototype.selectByIndex = function selectByIndex(index, animate) {
if (index < 0 || index >= this.props.children.length) {
return;
}
this.scrollTop = this.minScrollTop + index * this.itemHeight;
this.scrollTo(this.scrollTop, animate);
};
Picker.prototype.select = function select(value, animate) {
var children = this.props.children;
for (var i = 0, len = children.length; i < len; i++) {
if (children[i].value === value) {
this.selectByIndex(i, animate);
return;
}
}
this.selectByIndex(0, animate);
};
Picker.prototype.scrollTo = function scrollTo(t, a) {
var top = t;
var animate = a;
animate = animate === undefined ? true : animate;
this.clearAnim();
top = Math.round(top / this.itemHeight) * this.itemHeight;
top = Math.max(Math.min(this.maxScrollTop, top), this.minScrollTop);
if (top === this.scrollTop || !animate) {
this.publish(top);
this.scrollingComplete();
return;
}
this.publish(top, DEFAULT_ANIM_DURATION);
};
Picker.prototype.fireValueChange = function fireValueChange(selectedValue) {
if (selectedValue !== this.state.selectedValue) {
if (!('selectedValue' in this.props)) {
this.setState({
selectedValue: selectedValue
});
}
this.props.onValueChange(selectedValue);
}
};
Picker.prototype.scrollingComplete = function scrollingComplete() {
var index = Math.round((this.scrollTop - this.minScrollTop - this.itemHeight / 2) / this.itemHeight);
var child = this.props.children[index];
if (child) {
this.fireValueChange(child.value);
}
};
// Applies the scroll position to the content element
Picker.prototype.publish = function publish(top, animationDuration) {
var _this2 = this;
// Remember whether we had an animation,
// then we try to continue based on the current "drive" of the animation
var wasAnimating = this.isAnimating;
if (wasAnimating) {
_Animate.Animate.stop(wasAnimating);
this.isAnimating = 0;
}
if (animationDuration) {
(function () {
// Keep scheduled positions for scrollBy functionality
_this2.scheduledTop = top;
var oldTop = _this2.scrollTop;
var diffTop = top - oldTop;
var step = function step(percent) {
_this2.scrollTop = oldTop + diffTop * percent;
// Push values out
_this2.setTop(_this2.scrollTop);
};
var verify = function verify(id) {
return _this2.isAnimating === id;
};
var completed = function completed(renderedFramesPerSecond, animationId, wasFinished) {
if (animationId === _this2.isAnimating) {
_this2.isAnimating = 0;
}
if (_this2.didDecelerationComplete || wasFinished) {
_this2.scrollingComplete();
}
};
// When continuing based on previous animation
// we choose an ease-out animation instead of ease-in-out
_this2.isAnimating = _Animate.Animate.start(step, verify, completed, animationDuration, wasAnimating ? _Animate.easeOutCubic : _Animate.easeInOutCubic);
})();
} else {
this.scheduledTop = this.scrollTop = top;
// Push values out
this.setTop(top);
}
};
// Called when a touch sequence end and the speed of
// the finger was high enough to switch into deceleration mode.
Picker.prototype.startDeceleration = function startDeceleration() {
var _this3 = this;
this.minDecelerationScrollTop = this.minScrollTop;
this.maxDecelerationScrollTop = this.maxScrollTop;
// Wrap class method
var step = function step(percent, now, render) {
_this3.stepThroughDeceleration();
};
// Detect whether it's still worth to continue animating steps
// If we are already slow enough to not being user perceivable anymore,
// we stop the whole process here.
var verify = function verify() {
var shouldContinue = Math.abs(_this3.decelerationVelocityY) >= MIN_VELOCITY_TO_KEEP_DECELERATING;
if (!shouldContinue) {
_this3.didDecelerationComplete = true;
}
return shouldContinue;
};
var completed = function completed() {
_this3.isDecelerating = 0;
if (_this3.scrollTop <= _this3.minScrollTop || _this3.scrollTop >= _this3.maxScrollTop) {
_this3.scrollTo(_this3.scrollTop);
return;
}
if (_this3.didDecelerationComplete) {
_this3.scrollingComplete();
}
};
// Start animation and switch on flag
this.isDecelerating = _Animate.Animate.start(step, verify, completed);
};
// Called on every step of the animation
Picker.prototype.stepThroughDeceleration = function stepThroughDeceleration() {
var scrollTop = this.scrollTop + this.decelerationVelocityY;
var scrollTopFixed = Math.max(Math.min(this.maxDecelerationScrollTop, scrollTop), this.minDecelerationScrollTop);
if (scrollTopFixed !== scrollTop) {
scrollTop = scrollTopFixed;
this.decelerationVelocityY = 0;
}
if (Math.abs(this.decelerationVelocityY) <= 1) {
if (Math.abs(scrollTop % this.itemHeight) < 1) {
this.decelerationVelocityY = 0;
}
} else {
this.decelerationVelocityY *= DECELERATION_VELOCITY_RATE;
}
this.publish(scrollTop);
};
Picker.prototype.render = function render() {
var _props = this.props;
var children = _props.children;
var prefixCls = _props.prefixCls;
var selectedValue = this.state.selectedValue;
var itemClassName = prefixCls + '-item';
var selectedItemClassName = itemClassName + ' ' + prefixCls + '-item-selected';
var items = children.map(function (item) {
return React.createElement(
'div',
{ className: selectedValue === item.value ? selectedItemClassName : itemClassName, key: item.value, 'data-value': item.value },
item.label
);
});
return React.createElement(
_reactHammerjs2["default"],
{ direction: 'DIRECTION_ALL', onPanStart: this.onPanStart, onPan: this.onPan, onPanEnd: this.onPanEnd, options: hammerOption },
React.createElement(
'div',
{ className: '' + prefixCls, 'data-role': 'component', ref: 'component' },
React.createElement('div', { className: prefixCls + '-mask', 'data-role': 'mask' }),
React.createElement('div', { className: prefixCls + '-indicator', 'data-role': 'indicator', ref: 'indicator' }),
React.createElement(
'div',
{ className: prefixCls + '-content', 'data-role': 'content', ref: 'content' },
items
)
)
);
};
return Picker;
}(React.Component);
exports["default"] = Picker;
Picker.defaultProps = {
prefixCls: 'rmc-picker',
pure: true,
onValueChange: function onValueChange() {}
};
module.exports = exports['default'];
/***/ },
/* 128 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__(1);
var React = _interopRequireWildcard(_react);
var _rcDialog = __webpack_require__(45);
var _rcDialog2 = _interopRequireDefault(_rcDialog);
var _PopupMixin = __webpack_require__(464);
var _PopupMixin2 = _interopRequireDefault(_PopupMixin);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
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; } }
var PopupPicker = React.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;
}
return React.createElement(
_rcDialog2["default"],
{ prefixCls: '' + props.prefixCls, visible: true, transitionName: props.popupTransitionName, maskTransitionName: props.maskTransitionName, onClose: this.hide, style: props.modalStyle },
React.createElement(
'div',
null,
React.createElement(
'div',
{ className: props.prefixCls + '-header' },
React.createElement(
'div',
{ className: props.prefixCls + '-item ' + props.prefixCls + '-header-left', onClick: this.onDismiss },
props.dismissText
),
React.createElement(
'div',
{ className: props.prefixCls + '-item ' + props.prefixCls + '-title' },
props.title
),
React.createElement(
'div',
{ className: props.prefixCls + '-item ' + props.prefixCls + '-header-right', onClick: this.onOk },
props.okText
)
),
this.props.content
)
);
},
render: function render() {
return this.getRender();
}
});
exports["default"] = PopupPicker;
module.exports = exports['default'];
/***/ },
/* 129 */
/***/ function(module, exports, __webpack_require__) {
var map = {
"./action-sheet/index.web.tsx": 135,
"./action-sheet/style/index.web.tsx": 136,
"./activity-indicator/index.web.tsx": 137,
"./activity-indicator/style/index.web.tsx": 138,
"./badge/index.web.tsx": 140,
"./badge/style/index.web.tsx": 141,
"./button/index.web.tsx": 50,
"./button/style/index.web.tsx": 73,
"./card/index.web.tsx": 145,
"./card/style/index.web.tsx": 146,
"./carousel/index.web.tsx": 74,
"./carousel/style/index.web.tsx": 75,
"./checkbox/index.web.tsx": 149,
"./checkbox/style/index.web.tsx": 150,
"./collapse/index.web.tsx": 151,
"./collapse/style/index.web.tsx": 152,
"./date-picker/index.web.tsx": 153,
"./date-picker/style/index.web.tsx": 155,
"./drawer/index.web.tsx": 157,
"./drawer/style/index.web.tsx": 158,
"./dropdown/index.web.tsx": 159,
"./dropdown/style/index.web.tsx": 160,
"./flex/index.web.tsx": 32,
"./flex/style/index.web.tsx": 38,
"./float-menu/index.web.tsx": 163,
"./float-menu/style/index.web.tsx": 165,
"./grid/index.web.tsx": 166,
"./grid/style/index.web.tsx": 167,
"./icon/index.web.tsx": 15,
"./icon/style/index.web.tsx": 25,
"./input-item/index.web.tsx": 168,
"./input-item/style/index.web.tsx": 169,
"./list-view/index.web.tsx": 171,
"./list-view/style/index.web.tsx": 172,
"./list/index.web.tsx": 16,
"./list/style/index.web.tsx": 26,
"./menu/index.web.tsx": 178,
"./menu/style/index.web.tsx": 179,
"./modal/index.web.tsx": 77,
"./modal/style/index.web.tsx": 78,
"./nav-bar/index.web.tsx": 182,
"./nav-bar/style/index.web.tsx": 183,
"./page-result/index.web.tsx": 184,
"./page-result/style/index.web.tsx": 185,
"./pagination/index.web.tsx": 186,
"./pagination/style/index.web.tsx": 187,
"./picker/index.web.tsx": 188,
"./picker/style/index.web.tsx": 189,
"./progress/index.web.tsx": 190,
"./progress/style/index.web.tsx": 191,
"./radio/index.web.tsx": 80,
"./radio/style/index.web.tsx": 81,
"./refresh-control/index.web.tsx": 193,
"./refresh-control/style/index.web.tsx": 194,
"./search-bar/index.web.tsx": 195,
"./search-bar/style/index.web.tsx": 196,
"./slider/index.web.tsx": 197,
"./slider/style/index.web.tsx": 198,
"./stepper/index.web.tsx": 199,
"./stepper/style/index.web.tsx": 200,
"./steps/index.web.tsx": 201,
"./steps/style/index.web.tsx": 202,
"./style-sheet/index.web.tsx": 203,
"./swipe-action/index.web.tsx": 204,
"./swipe-action/style/index.web.tsx": 205,
"./switch/index.web.tsx": 206,
"./switch/style/index.web.tsx": 207,
"./table/index.web.tsx": 208,
"./table/style/index.web.tsx": 209,
"./tabs/index.web.tsx": 210,
"./tabs/style/index.web.tsx": 211,
"./tag/index.web.tsx": 212,
"./tag/style/index.web.tsx": 213,
"./text/index.web.tsx": 214,
"./textarea-item/index.web.tsx": 215,
"./textarea-item/style/index.web.tsx": 216,
"./timeline/index.web.tsx": 218,
"./timeline/style/index.web.tsx": 219,
"./toast/index.web.tsx": 83,
"./toast/style/index.web.tsx": 84,
"./tooltip/index.web.tsx": 220,
"./tooltip/style/index.web.tsx": 85,
"./top-notice/index.web.tsx": 221,
"./top-notice/style/index.web.tsx": 222,
"./uploader/index.web.tsx": 223,
"./uploader/style/index.web.tsx": 224,
"./view/index.web.tsx": 86,
"./white-space/index.web.tsx": 225,
"./white-space/style/index.web.tsx": 226,
"./wing-blank/index.web.tsx": 87,
"./wing-blank/style/index.web.tsx": 88
};
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 = 129;
/***/ },
/* 130 */
/***/ function(module, exports) {
/**
* @ignore
* base event object for custom and dom event.
* @author yiminghe@gmail.com
*/
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
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"];
/***/ },
/* 131 */
/***/ function(module, exports, __webpack_require__) {
/**
* @ignore
* event object for dom
* @author yiminghe@gmail.com
*/
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _EventBaseObject = __webpack_require__(130);
var _EventBaseObject2 = _interopRequireDefault(_EventBaseObject);
var _objectAssign = __webpack_require__(11);
var _objectAssign2 = _interopRequireDefault(_objectAssign);
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 = undefined;
var deltaY = undefined;
var delta = undefined;
var wheelDelta = nativeEvent.wheelDelta;
var axis = nativeEvent.axis;
var wheelDeltaY = nativeEvent.wheelDeltaY;
var wheelDeltaX = nativeEvent.wheelDeltaX;
var detail = nativeEvent.detail;
// ie/webkit
if (wheelDelta) {
delta = wheelDelta / 120;
}
// 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 = undefined;
var doc = undefined;
var body = undefined;
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 = undefined;
var l = undefined;
var prop = undefined;
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'];
/***/ },
/* 132 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
exports['default'] = addEventListener;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _EventObject = __webpack_require__(131);
var _EventObject2 = _interopRequireDefault(_EventObject);
function addEventListener(target, eventType, callback) {
function wrapCallback(e) {
var ne = new _EventObject2['default'](e);
callback.call(target, ne);
}
if (target.addEventListener) {
target.addEventListener(eventType, wrapCallback, false);
return {
remove: function remove() {
target.removeEventListener(eventType, wrapCallback, false);
}
};
} else if (target.attachEvent) {
target.attachEvent('on' + eventType, wrapCallback);
return {
remove: function remove() {
target.detachEvent('on' + eventType, wrapCallback);
}
};
}
}
module.exports = exports['default'];
/***/ },
/* 133 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
/* eslint no-console:0 */
function camelCase(name) {
return name.charAt(0).toUpperCase() + name.slice(1).replace(/-(\w)/g, function (m, n) {
return n.toUpperCase();
});
}
var req = __webpack_require__(129);
req.keys().forEach(function (mod) {
var v = req(mod);
if (v && v.default) {
v = v.default;
}
var match = mod.match(/^\.\/([^_][\w-]+)\/index\.web\.tsx?$/);
if (match && match[1]) {
exports[camelCase(match[1])] = v;
}
});
if (typeof console !== 'undefined' && console.warn) {
console.warn('you are using prebuild antm,\nplease use https://github.com/ant-design/babel-plugin-antd to reduce app bundle size.');
}
/***/ },
/* 134 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var animation = void 0;
function isCssAnimationSupported() {
if (animation !== undefined) {
return animation;
}
var domPrefixes = 'Webkit Moz O ms Khtml'.split(' ');
var elm = document.createElement('div');
if (elm.style.animationName !== undefined) {
animation = true;
}
if (animation !== undefined) {
for (var i = 0; i < domPrefixes.length; i++) {
if (elm.style[domPrefixes[i] + 'AnimationName'] !== undefined) {
animation = true;
break;
}
}
}
animation = animation || false;
return animation;
}
exports.default = isCssAnimationSupported;
module.exports = exports['default'];
/***/ },
/* 135 */
/***/ 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 _defineProperty2 = __webpack_require__(6);
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _extends2 = __webpack_require__(8);
var _extends3 = _interopRequireDefault(_extends2);
var _react = __webpack_require__(1);
var React = _interopRequireWildcard(_react);
var _reactDom = __webpack_require__(9);
var ReactDOM = _interopRequireWildcard(_reactDom);
var _rcDialog = __webpack_require__(45);
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__(11);
var _objectAssign2 = _interopRequireDefault(_objectAssign);
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 NORMAL = 'NORMAL';
var SHARE = 'SHARE';
var closeFn = function closeFn() {};
function createActionSheet(flag, config, callback) {
var props = (0, _objectAssign2.default)({}, {
prefixCls: 'am-action-sheet'
}, config);
var prefixCls = props.prefixCls;
var transitionName = props.transitionName;
var maskTransitionName = props.maskTransitionName;
var _props$maskClosable = props.maskClosable;
var maskClosable = _props$maskClosable === undefined ? true : _props$maskClosable;
var div = document.createElement('div');
document.body.appendChild(div);
function close() {
if (div) {
ReactDOM.unmountComponentAtNode(div);
div.parentNode.removeChild(div);
div = null;
}
}
closeFn = close;
function cb(info) {
callback(info);
close();
}
var title = props.title;
var message = props.message;
var options = props.options;
var destructiveButtonIndex = props.destructiveButtonIndex;
var cancelButtonIndex = props.cancelButtonIndex;
var titleMsg = [title ? React.createElement(
'h3',
{ key: '0', className: prefixCls + '-title' },
title
) : null, message ? React.createElement(
'div',
{ key: '1', className: prefixCls + '-message' },
message
) : null];
var children = null;
switch (flag) {
case NORMAL:
children = React.createElement(
'div',
{ className: prefixCls + '-normal' },
titleMsg,
React.createElement(
'ul',
{ className: prefixCls + '-button-list' },
options.map(function (item, index) {
var _cls;
var extraProp = {
onClick: function onClick() {
return cb(index);
}
};
var li = React.createElement(
'li',
(0, _extends3.default)({ className: [prefixCls + '-button-list-item'], key: index }, extraProp),
item
);
var cls = (_cls = {}, (0, _defineProperty3.default)(_cls, prefixCls + '-destructive-button', destructiveButtonIndex === index), (0, _defineProperty3.default)(_cls, prefixCls + '-cancel-button', cancelButtonIndex === index), _cls);
if (cancelButtonIndex === index || destructiveButtonIndex === index) {
li = React.createElement(
'li',
(0, _extends3.default)({ key: index, className: (0, _classnames2.default)(cls) }, extraProp),
item,
cancelButtonIndex === index ? React.createElement('span', { className: prefixCls + '-cancel-button-mask' }) : null
);
}
return li;
})
)
);
break;
case SHARE:
children = React.createElement(
'div',
{ className: prefixCls + '-share' },
titleMsg,
React.createElement(
'ul',
{ className: prefixCls + '-share-content' },
options.map(function (item, index) {
var extraProp = {
onClick: function onClick() {
return cb(index);
}
};
return React.createElement(
'li',
(0, _extends3.default)({ key: index }, extraProp),
React.createElement(
'p',
{ className: prefixCls + '-share-item-icon' },
item.iconName ? React.createElement(_index2.default, { type: item.iconName }) : item.icon
),
React.createElement(
'p',
{ className: prefixCls + '-share-item-title' },
item.title
)
);
})
)
);
break;
default:
children = React.createElement(
'div',
{ className: prefixCls + '-custom' },
titleMsg,
React.createElement(
'div',
{ className: prefixCls + '-custom-content' },
props.component
)
);
}
ReactDOM.render(React.createElement(
_rcDialog2.default,
{ prefixCls: prefixCls, visible: true, title: '', footer: '', transitionName: transitionName || 'am-slide-up', maskTransitionName: maskTransitionName || 'am-fade', onClose: close, maskClosable: maskClosable },
children
), div);
}
var ActionSheet = function ActionSheet() {
(0, _classCallCheck3.default)(this, ActionSheet);
};
exports.default = ActionSheet;
ActionSheet.showActionSheetWithOptions = function (config) {
var callback = arguments.length <= 1 || arguments[1] === undefined ? function () {} : arguments[1];
createActionSheet(NORMAL, config, callback);
};
ActionSheet.showShareActionSheetWithOptions = function (config) {
var callback = arguments.length <= 1 || arguments[1] === undefined ? function () {} : arguments[1];
createActionSheet(SHARE, config, callback);
};
ActionSheet.showActionSheetWithCustom = function (config) {
var callback = arguments.length <= 1 || arguments[1] === undefined ? function () {} : arguments[1];
createActionSheet(null, config, callback);
};
ActionSheet.close = function () {
closeFn();
};
module.exports = exports['default'];
/***/ },
/* 136 */
[474, 295],
/* 137 */
/***/ 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 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 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;
var prefixCls = _props.prefixCls;
var className = _props.className;
var animating = _props.animating;
var toast = _props.toast;
var size = _props.size;
var color = _props.color;
var 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 React.createElement(
'div',
{ className: wrapClass },
React.createElement(
'div',
{ className: prefixCls + '-content' },
React.createElement('span', { className: spinnerClass }),
text && React.createElement(
'span',
{ className: prefixCls + '-toast' },
text
)
)
);
} else {
return React.createElement(
'div',
{ className: wrapClass },
React.createElement('span', { className: spinnerClass }),
text && React.createElement(
'span',
{ className: prefixCls + '-tip' },
text
)
);
}
} else {
return null;
}
};
return ActivityIndicator;
}(React.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'];
/***/ },
/* 138 */
[474, 296],
/* 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 React = _interopRequireWildcard(_react);
var _reactDom = __webpack_require__(9);
var _isCssAnimationSupported = __webpack_require__(134);
var _isCssAnimationSupported2 = _interopRequireDefault(_isCssAnimationSupported);
var _objectAssign = __webpack_require__(11);
var _objectAssign2 = _interopRequireDefault(_objectAssign);
var _objectOmit = __webpack_require__(359);
var _objectOmit2 = _interopRequireDefault(_objectOmit);
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 getNumberArray(num) {
return num ? num.toString().split('').reverse().map(function (i) {
return Number(i);
}) : [];
}
var ScrollNumber = function (_React$Component) {
(0, _inherits3.default)(ScrollNumber, _React$Component);
function ScrollNumber(props) {
(0, _classCallCheck3.default)(this, ScrollNumber);
var _this = (0, _possibleConstructorReturn3.default)(this, _React$Component.call(this, props));
_this.state = {
animateStarted: true,
count: props.count
};
return _this;
}
ScrollNumber.prototype.componentDidMount = function componentDidMount() {
if (!(0, _isCssAnimationSupported2.default)()) {
(0, _reactDom.findDOMNode)(this).className += ' not-support-css-animation';
}
};
ScrollNumber.prototype.getPositionByNum = function getPositionByNum(num, i) {
if (this.state.animateStarted) {
return 10 + num;
}
var currentDigit = getNumberArray(this.state.count)[i];
var lastDigit = getNumberArray(this.lastCount)[i];
// 同方向则在同一侧切换数字
if (this.state.count > this.lastCount) {
if (currentDigit >= lastDigit) {
return 10 + num;
}
return 20 + num;
}
if (currentDigit <= lastDigit) {
return 10 + num;
}
return num;
};
ScrollNumber.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
var _this2 = this;
if ('count' in nextProps) {
if (this.state.count === nextProps.count) {
return;
}
this.lastCount = this.state.count;
// 复原数字初始位置
this.setState({
animateStarted: true
}, function () {
// 等待数字位置复原完毕
// 开始设置完整的数字
setTimeout(function () {
_this2.setState({
animateStarted: false,
count: nextProps.count
}, function () {
_this2.props.onAnimated();
});
}, 5);
});
}
};
ScrollNumber.prototype.renderNumberList = function renderNumberList(position) {
var childrenToReturn = [];
for (var i = 0; i < 30; i++) {
var currentClassName = position === i ? 'current' : null;
childrenToReturn.push(React.createElement(
'p',
{ key: i, className: currentClassName },
i % 10
));
}
return childrenToReturn;
};
ScrollNumber.prototype.renderCurrentNumber = function renderCurrentNumber(num, i) {
var position = this.getPositionByNum(num, i);
var height = this.props.height;
var removeTransition = this.state.animateStarted || getNumberArray(this.lastCount)[i] === undefined;
return (0, _react.createElement)('span', {
className: this.props.prefixCls + '-only',
style: {
transition: removeTransition && 'none',
WebkitTransform: 'translate3d(0, ' + -position * height + 'px, 0)',
transform: 'translate3d(0, ' + -position * height + 'px, 0)',
height: height
},
key: i
}, this.renderNumberList(position));
};
ScrollNumber.prototype.renderNumberElement = function renderNumberElement() {
var _this3 = this;
var state = this.state;
if (!state.count || isNaN(state.count)) {
return state.count;
}
return getNumberArray(state.count).map(function (num, i) {
return _this3.renderCurrentNumber(num, i);
}).reverse();
};
ScrollNumber.prototype.render = function render() {
// fix https://fb.me/react-unknown-prop
var props = (0, _objectAssign2.default)({}, (0, _objectOmit2.default)(this.props, ['count', 'onAnimated', 'component', 'prefixCls']), {
className: this.props.prefixCls + ' ' + this.props.className
});
return (0, _react.createElement)(this.props.component, props, this.renderNumberElement());
};
return ScrollNumber;
}(React.Component);
exports.default = ScrollNumber;
ScrollNumber.defaultProps = {
prefixCls: 'am-scroll-number',
count: null,
component: 'sup',
onAnimated: function onAnimated() {},
height: 24
};
ScrollNumber.propTypes = {
count: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.number]),
component: React.PropTypes.string,
onAnimated: React.PropTypes.func,
height: React.PropTypes.number
};
module.exports = exports['default'];
/***/ },
/* 140 */
/***/ 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 React = _interopRequireWildcard(_react);
var _rcAnimate = __webpack_require__(31);
var _rcAnimate2 = _interopRequireDefault(_rcAnimate);
var _ScrollNumber = __webpack_require__(139);
var _ScrollNumber2 = _interopRequireDefault(_ScrollNumber);
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 Badge = function (_React$Component) {
(0, _inherits3.default)(Badge, _React$Component);
function Badge() {
(0, _classCallCheck3.default)(this, Badge);
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
}
Badge.prototype.render = function render() {
var _classNames, _classNames2;
var _props = this.props;
var text = _props.text;
var prefixCls = _props.prefixCls;
var overflowCount = _props.overflowCount;
var className = _props.className;
var style = _props.style;
var children = _props.children;
var dot = this.props.dot;
var size = this.props.size;
var corner = this.props.corner;
text = text > overflowCount ? overflowCount + '+' : text;
// dot mode don't need text
if (dot) {
text = '';
}
// null undefined "" "0" 0
var hidden = (!text || text === '0') && !dot;
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 + '-corner-wrapper-large', corner && size === 'large'), _classNames2));
return React.createElement(
'span',
{ className: badgeCls, title: text },
children,
React.createElement(
_rcAnimate2.default,
{ component: '', showProp: 'data-show', transitionName: prefixCls + '-zoom', transitionAppear: true },
hidden ? null : React.createElement(_ScrollNumber2.default, { 'data-show': !hidden, className: scrollNumberCls, count: text, style: style })
)
);
};
return Badge;
}(React.Component);
exports.default = Badge;
Badge.propTypes = {
prefixCls: _react.PropTypes.string,
text: _react.PropTypes.oneOfType([_react.PropTypes.string, _react.PropTypes.number]),
dot: _react.PropTypes.bool,
corner: _react.PropTypes.bool,
overflowCount: _react.PropTypes.number,
size: _react.PropTypes.string
};
Badge.defaultProps = {
prefixCls: 'am-badge',
text: null,
dot: false,
corner: false,
overflowCount: 99,
size: null
};
module.exports = exports['default'];
/***/ },
/* 141 */
[475, 297],
/* 142 */
/***/ 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 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 CardBody = function (_React$Component) {
(0, _inherits3.default)(CardBody, _React$Component);
function CardBody() {
(0, _classCallCheck3.default)(this, CardBody);
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
}
CardBody.prototype.render = function render() {
var _classNames;
var _props = this.props;
var prefixCls = _props.prefixCls;
var children = _props.children;
var className = _props.className;
var wrapCls = (0, _classnames2.default)((_classNames = {}, (0, _defineProperty3.default)(_classNames, prefixCls + '-body', true), (0, _defineProperty3.default)(_classNames, className, className), _classNames));
return React.createElement(
'div',
{ className: wrapCls },
children
);
};
return CardBody;
}(React.Component);
exports.default = CardBody;
CardBody.defaultProps = {
prefixCls: 'am-card'
};
module.exports = exports['default'];
/***/ },
/* 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 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 CardFooter = function (_React$Component) {
(0, _inherits3.default)(CardFooter, _React$Component);
function CardFooter() {
(0, _classCallCheck3.default)(this, CardFooter);
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
}
CardFooter.prototype.render = function render() {
var _classNames;
var _props = this.props;
var prefixCls = _props.prefixCls;
var content = _props.content;
var className = _props.className;
var extra = _props.extra;
var wrapCls = (0, _classnames2.default)((_classNames = {}, (0, _defineProperty3.default)(_classNames, prefixCls + '-footer', true), (0, _defineProperty3.default)(_classNames, className, className), _classNames));
return React.createElement(
'div',
{ className: wrapCls },
React.createElement(
'div',
{ className: prefixCls + '-footer-content' },
content
),
extra ? React.createElement(
'div',
{ className: prefixCls + '-footer-extra' },
extra
) : null
);
};
return CardFooter;
}(React.Component);
exports.default = CardFooter;
CardFooter.defaultProps = {
prefixCls: 'am-card'
};
module.exports = exports['default'];
/***/ },
/* 144 */
/***/ 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 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 CardHeader = function (_React$Component) {
(0, _inherits3.default)(CardHeader, _React$Component);
function CardHeader() {
(0, _classCallCheck3.default)(this, CardHeader);
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
}
CardHeader.prototype.render = function render() {
var _classNames;
var _props = this.props;
var prefixCls = _props.prefixCls;
var className = _props.className;
var title = _props.title;
var thumb = _props.thumb;
var thumbStyle = _props.thumbStyle;
var extra = _props.extra;
var wrapCls = (0, _classnames2.default)((_classNames = {}, (0, _defineProperty3.default)(_classNames, prefixCls + '-header', true), (0, _defineProperty3.default)(_classNames, className, className), _classNames));
return React.createElement(
'div',
{ className: wrapCls },
React.createElement(
'div',
{ className: prefixCls + '-header-content' },
thumb ? React.createElement('img', { style: thumbStyle, src: thumb }) : null,
title
),
extra ? React.createElement(
'div',
{ className: prefixCls + '-header-extra' },
extra
) : null
);
};
return CardHeader;
}(React.Component);
exports.default = CardHeader;
CardHeader.defaultProps = {
prefixCls: 'am-card',
thumbStyle: {}
};
module.exports = exports['default'];
/***/ },
/* 145 */
/***/ 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 React = _interopRequireWildcard(_react);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var _CardHeader = __webpack_require__(144);
var _CardHeader2 = _interopRequireDefault(_CardHeader);
var _CardBody = __webpack_require__(142);
var _CardBody2 = _interopRequireDefault(_CardBody);
var _CardFooter = __webpack_require__(143);
var _CardFooter2 = _interopRequireDefault(_CardFooter);
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 Card = function (_React$Component) {
(0, _inherits3.default)(Card, _React$Component);
function Card() {
(0, _classCallCheck3.default)(this, Card);
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
}
Card.prototype.render = function render() {
var _classNames;
var _props = this.props;
var prefixCls = _props.prefixCls;
var children = _props.children;
var className = _props.className;
var wrapCls = (0, _classnames2.default)((_classNames = {}, (0, _defineProperty3.default)(_classNames, prefixCls, true), (0, _defineProperty3.default)(_classNames, className, className), _classNames));
return React.createElement(
'div',
{ className: wrapCls },
children
);
};
return Card;
}(React.Component);
exports.default = Card;
Card.defaultProps = {
prefixCls: 'am-card'
};
Card.Header = _CardHeader2.default;
Card.Body = _CardBody2.default;
Card.Footer = _CardFooter2.default;
module.exports = exports['default'];
/***/ },
/* 146 */
[474, 299],
/* 147 */
/***/ 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 React = _interopRequireWildcard(_react);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var _Checkbox = __webpack_require__(51);
var _Checkbox2 = _interopRequireDefault(_Checkbox);
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 AgreeItem = function (_React$Component) {
(0, _inherits3.default)(AgreeItem, _React$Component);
function AgreeItem() {
(0, _classCallCheck3.default)(this, AgreeItem);
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
}
AgreeItem.prototype.render = function render() {
var _classNames;
var _props = this.props;
var prefixCls = _props.prefixCls;
var style = _props.style;
var name = _props.name;
var defaultChecked = _props.defaultChecked;
var checked = _props.checked;
var disabled = _props.disabled;
var children = _props.children;
var onChange = _props.onChange;
var className = _props.className;
var wrapCls = (0, _classnames2.default)((_classNames = {}, (0, _defineProperty3.default)(_classNames, prefixCls + '-agree', true), (0, _defineProperty3.default)(_classNames, className, className), _classNames));
return React.createElement(
'div',
{ className: wrapCls, style: style },
React.createElement(_Checkbox2.default, { prefixCls: prefixCls, defaultChecked: defaultChecked, checked: checked, name: name, onChange: onChange, disabled: disabled }),
React.createElement(
'label',
{ className: prefixCls + '-agree-label', htmlFor: name },
children
)
);
};
return AgreeItem;
}(React.Component);
exports.default = AgreeItem;
AgreeItem.defaultProps = {
prefixCls: 'am-checkbox'
};
module.exports = exports['default'];
/***/ },
/* 148 */
/***/ 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 React = _interopRequireWildcard(_react);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var _Checkbox = __webpack_require__(51);
var _Checkbox2 = _interopRequireDefault(_Checkbox);
var _list = __webpack_require__(16);
var _list2 = _interopRequireDefault(_list);
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 ListItem = _list2.default.Item;
var CheckboxItem = function (_React$Component) {
(0, _inherits3.default)(CheckboxItem, _React$Component);
function CheckboxItem() {
(0, _classCallCheck3.default)(this, CheckboxItem);
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
}
CheckboxItem.prototype.render = function render() {
var _classNames;
var _props = this.props;
var prefixCls = _props.prefixCls;
var listPrefixCls = _props.listPrefixCls;
var style = _props.style;
var className = _props.className;
var name = _props.name;
var defaultChecked = _props.defaultChecked;
var checked = _props.checked;
var disabled = _props.disabled;
var children = _props.children;
var extra = _props.extra;
var onChange = _props.onChange;
var wrapCls = (0, _classnames2.default)((_classNames = {}, (0, _defineProperty3.default)(_classNames, prefixCls + '-item', true), (0, _defineProperty3.default)(_classNames, prefixCls + '-item-disabled', disabled === true), (0, _defineProperty3.default)(_classNames, className, className), _classNames));
return React.createElement(
ListItem,
{ prefixCls: listPrefixCls, style: style, className: wrapCls, extra: extra, thumb: React.createElement(_Checkbox2.default, { prefixCls: prefixCls, defaultChecked: defaultChecked, checked: checked, name: name, onChange: onChange, disabled: disabled }) },
children
);
};
return CheckboxItem;
}(React.Component);
exports.default = CheckboxItem;
CheckboxItem.propTypes = {
prefixCls: _react.PropTypes.string,
style: _react.PropTypes.object,
name: _react.PropTypes.string,
checked: _react.PropTypes.bool,
disabled: _react.PropTypes.bool,
onChange: _react.PropTypes.func
};
CheckboxItem.defaultProps = {
prefixCls: 'am-checkbox',
listPrefixCls: 'am-list'
};
module.exports = exports['default'];
/***/ },
/* 149 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _Checkbox = __webpack_require__(51);
var _Checkbox2 = _interopRequireDefault(_Checkbox);
var _CheckboxItem = __webpack_require__(148);
var _CheckboxItem2 = _interopRequireDefault(_CheckboxItem);
var _AgreeItem = __webpack_require__(147);
var _AgreeItem2 = _interopRequireDefault(_AgreeItem);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
_Checkbox2.default.CheckboxItem = _CheckboxItem2.default;
_Checkbox2.default.AgreeItem = _AgreeItem2.default;
exports.default = _Checkbox2.default;
module.exports = exports['default'];
/***/ },
/* 150 */
[476, 301],
/* 151 */
/***/ 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 React = _interopRequireWildcard(_react);
var _rcCollapse = __webpack_require__(372);
var _rcCollapse2 = _interopRequireDefault(_rcCollapse);
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 Collapse = function (_React$Component) {
(0, _inherits3.default)(Collapse, _React$Component);
function Collapse() {
(0, _classCallCheck3.default)(this, Collapse);
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
}
Collapse.prototype.render = function render() {
return React.createElement(_rcCollapse2.default, this.props);
};
return Collapse;
}(React.Component);
exports.default = Collapse;
Collapse.Panel = _rcCollapse.Panel;
Collapse.defaultProps = {
prefixCls: 'am-collapse'
};
module.exports = exports['default'];
/***/ },
/* 152 */
[474, 302],
/* 153 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _extends2 = __webpack_require__(8);
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 React = _interopRequireWildcard(_react);
var _Popup = __webpack_require__(448);
var _Popup2 = _interopRequireDefault(_Popup);
var _utils = __webpack_require__(156);
var _objectAssign = __webpack_require__(11);
var _objectAssign2 = _interopRequireDefault(_objectAssign);
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 getDefaultProps() {
return (0, _objectAssign2.default)({
prefixCls: 'am-date-picker',
pickerPrefixCls: 'am-date-picker-picker',
popupPrefixCls: 'am-date-picker-popup'
}, (0, _utils.getProps)());
}
// api changed by chengyu(yiminghe)
var DatePicker = function (_React$Component) {
(0, _inherits3.default)(DatePicker, _React$Component);
function DatePicker() {
(0, _classCallCheck3.default)(this, DatePicker);
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
}
DatePicker.prototype.render = function render() {
var _props = this.props;
var children = _props.children;
var extra = _props.extra;
var value = _props.value;
var defaultDate = _props.defaultDate;
var extraProps = {
extra: value ? (0, _utils.formatFn)(this, value) : extra
};
return React.createElement(
_Popup2.default,
(0, _extends3.default)({}, this.props, { WrapComponent: 'div', popupTransitionName: 'am-slide-up', maskTransitionName: 'am-fade', date: value || defaultDate }),
React.cloneElement(children, extraProps)
);
};
return DatePicker;
}(React.Component);
exports.default = DatePicker;
DatePicker.defaultProps = getDefaultProps();
module.exports = exports['default'];
/***/ },
/* 154 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _zh_CN = __webpack_require__(449);
Object.defineProperty(exports, 'default', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_zh_CN).default;
}
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
module.exports = exports['default'];
/***/ },
/* 155 */
[474, 303],
/* 156 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _typeof2 = __webpack_require__(39);
var _typeof3 = _interopRequireDefault(_typeof2);
exports.formatFn = formatFn;
exports.getProps = getProps;
var _zh_CN = __webpack_require__(154);
var _zh_CN2 = _interopRequireDefault(_zh_CN);
var _moment = __webpack_require__(107);
var _moment2 = _interopRequireDefault(_moment);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function getFormatter(type) {
var formatter = void 0;
if (type === 'time') {
formatter = 'HH:mm';
} else if (type === 'datetime') {
formatter = 'YYYY-MM-DD HH:mm';
} else {
formatter = 'YYYY-MM-DD';
}
return formatter;
}
function formatFn(instance, value) {
var format = instance.props.format;
var type = typeof format === 'undefined' ? 'undefined' : (0, _typeof3.default)(format);
if (type === 'string') {
return value.format(type);
}
if (type === 'function') {
return format(value);
}
return value.format(getFormatter(instance.props.mode));
}
function getProps() {
return {
mode: 'datetime',
locale: _zh_CN2.default,
extra: '请选择',
defaultDate: (0, _moment2.default)(),
onChange: function onChange() {},
okText: '确定',
dismissText: '取消',
title: ''
};
}
/***/ },
/* 157 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _extends2 = __webpack_require__(8);
var _extends3 = _interopRequireDefault(_extends2);
var _slicedToArray2 = __webpack_require__(12);
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 React = _interopRequireWildcard(_react);
var _rcDrawer = __webpack_require__(378);
var _rcDrawer2 = _interopRequireDefault(_rcDrawer);
var _splitObject3 = __webpack_require__(14);
var _splitObject4 = _interopRequireDefault(_splitObject3);
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 Drawer = function (_React$Component) {
(0, _inherits3.default)(Drawer, _React$Component);
function Drawer() {
(0, _classCallCheck3.default)(this, Drawer);
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
}
Drawer.prototype.render = function render() {
var _splitObject = (0, _splitObject4.default)(this.props, ['prefixCls', 'children']);
var _splitObject2 = (0, _slicedToArray3.default)(_splitObject, 2);
var _splitObject2$ = _splitObject2[0];
var prefixCls = _splitObject2$.prefixCls;
var children = _splitObject2$.children;
var restProps = _splitObject2[1];
return React.createElement(
_rcDrawer2.default,
(0, _extends3.default)({ prefixCls: prefixCls }, restProps),
children
);
};
return Drawer;
}(React.Component);
exports.default = Drawer;
Drawer.propTypes = {
prefixCls: _react.PropTypes.string,
enableDragHandle: _react.PropTypes.bool
};
Drawer.defaultProps = {
prefixCls: 'am-drawer',
enableDragHandle: false
};
module.exports = exports['default'];
/***/ },
/* 158 */
[474, 304],
/* 159 */
/***/ 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 React = _interopRequireWildcard(_react);
var _reactDom = __webpack_require__(9);
var ReactDOM = _interopRequireWildcard(_reactDom);
var _rcDialog = __webpack_require__(45);
var _rcDialog2 = _interopRequireDefault(_rcDialog);
var _objectAssign = __webpack_require__(11);
var _objectAssign2 = _interopRequireDefault(_objectAssign);
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 create(instanceId, config, content) {
var afterClose = arguments.length <= 3 || arguments[3] === undefined ? function (x) {} : arguments[3];
var props = (0, _objectAssign2.default)({}, {
prefixCls: 'am-dropdown'
}, config);
var prefixCls = props.prefixCls;
var transitionName = props.transitionName;
var maskTransitionName = props.maskTransitionName;
var _props$maskClosable = props.maskClosable;
var maskClosable = _props$maskClosable === undefined ? true : _props$maskClosable;
var div = document.createElement('div');
document.body.appendChild(div);
function close() {
if (div) {
ReactDOM.unmountComponentAtNode(div);
div.parentNode.removeChild(div);
div = null;
}
afterClose(instanceId);
}
ReactDOM.render(React.createElement(
_rcDialog2.default,
{ prefixCls: prefixCls, visible: true, title: '', footer: '', transitionName: transitionName || 'am-slide-down', maskTransitionName: maskTransitionName || 'am-fade', onClose: close, maskClosable: maskClosable },
content
), div);
return {
instanceId: instanceId,
close: close
};
}
var ins = {
defaultInstance: null,
instances: []
};
var instanceId = 1;
var Dropdown = function Dropdown() {
(0, _classCallCheck3.default)(this, Dropdown);
};
exports.default = Dropdown;
Dropdown.newInstance = function () {
var j = void 0;
return {
show: function show(content, config) {
j = create(instanceId++, config, content, function (iId) {
for (var i = 0; i < ins.instances.length; i++) {
if (ins.instances[i].instanceId === iId) {
ins.instances.splice(i, 1);
return;
}
}
});
ins.instances.push(j);
},
hide: function hide() {
j.close();
}
};
};
Dropdown.show = function (content, config) {
ins.defaultInstance = create('0', config, content, function (iId) {
if (iId === '0') {
ins.defaultInstance = null;
}
});
};
Dropdown.hide = function () {
ins.defaultInstance.close();
};
module.exports = exports['default'];
/***/ },
/* 160 */
[474, 305],
/* 161 */
/***/ 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 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 Flex = function (_React$Component) {
(0, _inherits3.default)(Flex, _React$Component);
function Flex() {
(0, _classCallCheck3.default)(this, Flex);
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
}
Flex.prototype.render = function render() {
var _classNames;
var _props = this.props;
var direction = _props.direction;
var wrap = _props.wrap;
var justify = _props.justify;
var align = _props.align;
var alignContent = _props.alignContent;
var className = _props.className;
var children = _props.children;
var prefixCls = _props.prefixCls;
var style = _props.style;
var onClick = _props.onClick;
var wrapCls = (0, _classnames2.default)((_classNames = {}, (0, _defineProperty3.default)(_classNames, prefixCls, true), (0, _defineProperty3.default)(_classNames, prefixCls + '-dir-row', direction === 'row'), (0, _defineProperty3.default)(_classNames, prefixCls + '-dir-row-reverse', direction === 'row-reverse'), (0, _defineProperty3.default)(_classNames, prefixCls + '-dir-column', direction === 'column'), (0, _defineProperty3.default)(_classNames, prefixCls + '-dir-column-reverse', direction === 'column-reverse'), (0, _defineProperty3.default)(_classNames, prefixCls + '-nowrap', wrap === 'nowrap'), (0, _defineProperty3.default)(_classNames, prefixCls + '-wrap', wrap === 'wrap'), (0, _defineProperty3.default)(_classNames, prefixCls + '-wrap-reverse', wrap === 'wrap-reverse'), (0, _defineProperty3.default)(_classNames, prefixCls + '-justify-start', justify === 'start'), (0, _defineProperty3.default)(_classNames, prefixCls + '-justify-end', justify === 'end'), (0, _defineProperty3.default)(_classNames, prefixCls + '-justify-center', justify === 'center'), (0, _defineProperty3.default)(_classNames, prefixCls + '-justify-between', justify === 'between'), (0, _defineProperty3.default)(_classNames, prefixCls + '-justify-around', justify === 'around'), (0, _defineProperty3.default)(_classNames, prefixCls + '-align-top', align === 'top' || align === 'start'), (0, _defineProperty3.default)(_classNames, prefixCls + '-align-middle', align === 'middle' || align === 'center'), (0, _defineProperty3.default)(_classNames, prefixCls + '-align-bottom', align === 'bottom' || align === 'end'), (0, _defineProperty3.default)(_classNames, prefixCls + '-align-baseline', align === 'baseline'), (0, _defineProperty3.default)(_classNames, prefixCls + '-align-stretch', align === 'stretch'), (0, _defineProperty3.default)(_classNames, prefixCls + '-align-content-start', alignContent === 'start'), (0, _defineProperty3.default)(_classNames, prefixCls + '-align-content-end', alignContent === 'end'), (0, _defineProperty3.default)(_classNames, prefixCls + '-align-content-center', alignContent === 'center'), (0, _defineProperty3.default)(_classNames, prefixCls + '-align-content-between', alignContent === 'between'), (0, _defineProperty3.default)(_classNames, prefixCls + '-align-content-around', alignContent === 'around'), (0, _defineProperty3.default)(_classNames, prefixCls + '-align-content-stretch', alignContent === 'stretch'), (0, _defineProperty3.default)(_classNames, className, className), _classNames));
return React.createElement(
'div',
{ className: wrapCls, style: style, onClick: onClick },
children
);
};
return Flex;
}(React.Component);
exports.default = Flex;
Flex.propTypes = {
direction: _react.PropTypes.oneOf(['row', 'row-reverse', 'column', 'column-reverse']),
wrap: _react.PropTypes.oneOf(['nowrap', 'wrap', 'wrap-reverse']),
justify: _react.PropTypes.oneOf(['start', 'end', 'center', 'between', 'around']),
align: _react.PropTypes.oneOf(['start', 'end', 'center', 'top', 'middle', 'bottom', 'baseline', 'stretch']),
alignContent: _react.PropTypes.oneOf(['start', 'end', 'center', 'between', 'around', 'stretch'])
};
Flex.defaultProps = {
prefixCls: 'am-flexbox',
align: 'center',
onClick: function onClick() {}
};
module.exports = exports['default'];
/***/ },
/* 162 */
/***/ 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 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 FlexItem = function (_React$Component) {
(0, _inherits3.default)(FlexItem, _React$Component);
function FlexItem() {
(0, _classCallCheck3.default)(this, FlexItem);
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
}
FlexItem.prototype.render = function render() {
var _classNames;
var _props = this.props;
var children = _props.children;
var className = _props.className;
var prefixCls = _props.prefixCls;
var style = _props.style;
var onClick = _props.onClick;
var wrapCls = (0, _classnames2.default)((_classNames = {}, (0, _defineProperty3.default)(_classNames, prefixCls + '-item', true), (0, _defineProperty3.default)(_classNames, className, className), _classNames));
return React.createElement(
'div',
{ className: wrapCls, style: style, onClick: onClick },
children
);
};
return FlexItem;
}(React.Component);
exports.default = FlexItem;
FlexItem.defaultProps = {
prefixCls: 'am-flexbox'
};
module.exports = exports['default'];
/***/ },
/* 163 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _extends2 = __webpack_require__(8);
var _extends3 = _interopRequireDefault(_extends2);
var _slicedToArray2 = __webpack_require__(12);
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 React = _interopRequireWildcard(_react);
var _rcTooltip = __webpack_require__(70);
var _rcTooltip2 = _interopRequireDefault(_rcTooltip);
var _item = __webpack_require__(164);
var _item2 = _interopRequireDefault(_item);
var _splitObject3 = __webpack_require__(14);
var _splitObject4 = _interopRequireDefault(_splitObject3);
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 recursiveCloneChildren(children) {
var cb = arguments.length <= 1 || arguments[1] === undefined ? function (ch) {
return ch;
} : arguments[1];
return React.Children.map(children, function (child) {
var newChild = cb(child);
if (newChild && newChild.props && newChild.props.children) {
return React.cloneElement(newChild, {}, recursiveCloneChildren(newChild.props.children, cb));
}
return newChild;
});
}
var FloatMenu = function (_React$Component) {
(0, _inherits3.default)(FloatMenu, _React$Component);
function FloatMenu() {
(0, _classCallCheck3.default)(this, FloatMenu);
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
}
FloatMenu.prototype.render = function render() {
var _splitObject = (0, _splitObject4.default)(this.props, ['children', 'prefixCls', 'placement', 'trigger', 'overlay', 'onSelect', 'popupAlign']);
var _splitObject2 = (0, _slicedToArray3.default)(_splitObject, 2);
var _splitObject2$ = _splitObject2[0];
var children = _splitObject2$.children;
var prefixCls = _splitObject2$.prefixCls;
var placement = _splitObject2$.placement;
var trigger = _splitObject2$.trigger;
var overlay = _splitObject2$.overlay;
var onSelect = _splitObject2$.onSelect;
var popupAlign = _splitObject2$.popupAlign;
var restProps = _splitObject2[1];
var newChildren = recursiveCloneChildren(overlay, function (child) {
var extraProps = {
onClick: function onClick() {}
};
if (child && child.type && child.type.FloatMenuItem && !child.props.disabled) {
extraProps.onClick = function () {
onSelect(child);
};
return React.cloneElement(child, extraProps);
}
return child;
});
return React.createElement(
_rcTooltip2.default,
(0, _extends3.default)({ prefixCls: prefixCls, placement: placement, trigger: trigger, overlay: newChildren, popupAlign: popupAlign }, restProps),
children
);
};
return FloatMenu;
}(React.Component);
exports.default = FloatMenu;
FloatMenu.propTypes = {
prefixCls: _react.PropTypes.string,
placement: _react.PropTypes.string,
popupAlign: _react.PropTypes.object,
trigger: _react.PropTypes.array,
onSelect: _react.PropTypes.func
};
FloatMenu.defaultProps = {
prefixCls: 'am-float-menu',
placement: 'bottomRight',
popupAlign: { overflow: { adjustY: 0, adjustX: 0 } },
trigger: ['click'],
onSelect: function onSelect() {}
};
FloatMenu.Item = _item2.default;
module.exports = exports['default'];
/***/ },
/* 164 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _extends2 = __webpack_require__(8);
var _extends3 = _interopRequireDefault(_extends2);
var _defineProperty2 = __webpack_require__(6);
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _slicedToArray2 = __webpack_require__(12);
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 React = _interopRequireWildcard(_react);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var _icon = __webpack_require__(15);
var _icon2 = _interopRequireDefault(_icon);
var _splitObject3 = __webpack_require__(14);
var _splitObject4 = _interopRequireDefault(_splitObject3);
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 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() {
var _cls;
var _splitObject = (0, _splitObject4.default)(this.props, ['children', 'className', 'prefixCls', 'iconName', 'disabled']);
var _splitObject2 = (0, _slicedToArray3.default)(_splitObject, 2);
var _splitObject2$ = _splitObject2[0];
var children = _splitObject2$.children;
var className = _splitObject2$.className;
var prefixCls = _splitObject2$.prefixCls;
var iconName = _splitObject2$.iconName;
var disabled = _splitObject2$.disabled;
var restProps = _splitObject2[1];
var cls = (_cls = {}, (0, _defineProperty3.default)(_cls, className, className), (0, _defineProperty3.default)(_cls, prefixCls + '-item', true), (0, _defineProperty3.default)(_cls, prefixCls + '-item-disabled', disabled), _cls);
return React.createElement(
'div',
(0, _extends3.default)({ className: (0, _classnames2.default)(cls) }, restProps),
iconName ? React.createElement(
'span',
{ className: prefixCls + '-item-icon' },
React.createElement(_icon2.default, { type: iconName })
) : null,
React.createElement(
'span',
{ className: prefixCls + '-item-content' },
children
)
);
};
return Item;
}(React.Component);
exports.default = Item;
Item.propTypes = {
prefixCls: _react.PropTypes.string,
iconName: _react.PropTypes.string,
disabled: _react.PropTypes.bool
};
Item.defaultProps = {
prefixCls: 'am-float-menu',
disabled: false
};
Item.FloatMenuItem = true;
module.exports = exports['default'];
/***/ },
/* 165 */
[474, 307],
/* 166 */
/***/ 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 React = _interopRequireWildcard(_react);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var _flex = __webpack_require__(32);
var _flex2 = _interopRequireDefault(_flex);
var _index = __webpack_require__(74);
var _index2 = _interopRequireDefault(_index);
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() {}
var Grid = function (_React$Component) {
(0, _inherits3.default)(Grid, _React$Component);
function Grid(props) {
(0, _classCallCheck3.default)(this, Grid);
var _this = (0, _possibleConstructorReturn3.default)(this, _React$Component.call(this, props));
_this.onTouchStart = function (index) {
if (_this.props.needActive) {
_this.setState({
hover: true,
hoverIndex: index
});
}
};
_this.onTouchEnd = function () {
if (_this.props.needActive) {
_this.setState({
hover: false
});
}
};
_this.state = {
hover: false
};
return _this;
}
Grid.prototype.componentWillMount = function componentWillMount() {
this.clientWidth = document.documentElement.clientWidth;
};
Grid.prototype.render = function render() {
var _classNames,
_this2 = this;
var _props = this.props;
var className = _props.className;
var data = _props.data;
var prefixCls = _props.prefixCls;
var hasLine = _props.hasLine;
var isCarousel = _props.isCarousel;
var needActive = _props.needActive;
var wrapCls = (0, _classnames2.default)((_classNames = {}, (0, _defineProperty3.default)(_classNames, prefixCls, true), (0, _defineProperty3.default)(_classNames, prefixCls + '-line', hasLine), (0, _defineProperty3.default)(_classNames, className, className), _classNames));
var itemCls = (0, _classnames2.default)((0, _defineProperty3.default)({}, prefixCls + '-item-hover', needActive));
var dataLength = data.length;
var FlexCount = Math.ceil(dataLength / 4);
var gridContent = [];
var carouselContent = [];
var flexItemStyle = {
height: this.clientWidth / 4 + 'px',
paddingTop: (this.clientWidth / 4 - 40) / 2 + 'px'
};
var _loop = function _loop(i) {
var flexContent = [];
var _loop2 = function _loop2(j) {
if (i * 4 + j < dataLength) {
flexContent.push(React.createElement(
_flex2.default.Item,
{ className: itemCls, style: flexItemStyle, onClick: function onClick() {
_this2.props.onClick(data[i * 4 + j], i * 4 + j);
}, key: 'griditem-' + (i * 4 + j) },
React.createElement('div', { className: prefixCls + '-icon', style: { backgroundImage: 'url(' + data[i * 4 + j].icon + ')' } }),
React.createElement(
'div',
{ className: prefixCls + '-text' },
data[i * 4 + j].text
)
));
} else {
flexContent.push(React.createElement(_flex2.default.Item, { style: flexItemStyle, key: 'griditem-' + (i * 4 + j) }));
}
};
for (var j = 0; j < 4; j++) {
_loop2(j);
}
gridContent.push(React.createElement(
_flex2.default,
{ key: 'fridflex' + i },
flexContent
));
};
for (var i = 0; i < FlexCount; i++) {
_loop(i);
}
if (isCarousel) {
var gridContentLength = gridContent.length;
for (var k = 0, len = Math.ceil(gridContentLength / 2); k < len; k++) {
if (k * 2 < gridContentLength) {
carouselContent.push();
}
if (k * 2 + 1 < gridContentLength) {
carouselContent.push(React.createElement(
'div',
{ key: 'carouselitem-' + (k * 2 + 1) },
gridContent[k * 2],
gridContent[k * 2 + 1]
));
} else {
carouselContent.push(React.createElement(
'div',
{ key: 'carouselitem-' + k * 2 },
gridContent[k * 2],
React.createElement(
_flex2.default,
null,
React.createElement(_flex2.default.Item, { className: itemCls, style: flexItemStyle }),
React.createElement(_flex2.default.Item, { className: itemCls, style: flexItemStyle }),
React.createElement(_flex2.default.Item, { className: itemCls, style: flexItemStyle }),
React.createElement(_flex2.default.Item, { className: itemCls, style: flexItemStyle })
)
));
}
}
}
return React.createElement(
'div',
{ className: wrapCls },
isCarousel ? React.createElement(
_index2.default,
{ mode: 'banner', infinite: false },
carouselContent
) : gridContent
);
};
return Grid;
}(React.Component);
exports.default = Grid;
Grid.propTypes = {
prefixCls: _react.PropTypes.string,
data: _react.PropTypes.array,
onClick: _react.PropTypes.func,
hasLine: _react.PropTypes.bool,
needActive: _react.PropTypes.bool,
isCarousel: _react.PropTypes.bool
};
Grid.defaultProps = {
prefixCls: 'am-grid',
data: [],
onClick: noop,
hasLine: true,
needActive: true,
isCarousel: false
};
module.exports = exports['default'];
/***/ },
/* 167 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
__webpack_require__(7);
__webpack_require__(38);
__webpack_require__(75);
__webpack_require__(308);
/***/ },
/* 168 */
/***/ 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 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 }; }
function noop() {}
var InputItem = function (_React$Component) {
(0, _inherits3.default)(InputItem, _React$Component);
function InputItem(props) {
(0, _classCallCheck3.default)(this, InputItem);
var _this = (0, _possibleConstructorReturn3.default)(this, _React$Component.call(this, props));
_this.onInputChange = function (e) {
var value = e.target.value;
var _this$props = _this.props;
var maxLength = _this$props.maxLength;
var onChange = _this$props.onChange;
var format = _this$props.format;
switch (format) {
case 'text':
if (maxLength > 0) {
value = value.substring(0, maxLength);
}
break;
case 'bankCard':
value = value.replace(/\D/g, '');
if (maxLength > 0) {
value = value.substring(0, maxLength);
}
value = value.replace(/\D/g, '').replace(/(....)(?=.)/g, '$1 ');
break;
case 'phone':
value = value.replace(/\D/g, '');
if (maxLength > 0) {
value = value.substring(0, 11);
}
var valueLen = value.length;
if (valueLen > 3 && 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;
}
onChange(value);
};
_this.onInputBlur = function (e) {
setTimeout(function () {
_this.setState({
focus: false
});
}, 300);
var value = e.target.value;
_this.props.onBlur(value);
};
_this.onInputFocus = function (e) {
_this.setState({
focus: true
});
var value = e.target.value;
_this.props.onFocus(value);
};
_this.onExtraClick = function (e) {
_this.props.onExtraClick(e);
};
_this.onErrorClick = function (e) {
_this.props.onErrorClick(e);
};
_this.clearInput = function () {
_this.setState({
placeholder: _this.props.value
});
_this.props.onChange('');
};
_this.state = {
focus: false,
placeholder: _this.props.placeholder
};
return _this;
}
InputItem.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
if ('placeholder' in nextProps && this.state.placeholder !== nextProps.placeholder) {
this.setState({
placeholder: nextProps.placeholder
});
}
};
InputItem.prototype.render = function render() {
var _classNames, _classNames2;
var _props = this.props;
var prefixCls = _props.prefixCls;
var prefixListCls = _props.prefixListCls;
var format = _props.format;
var type = _props.type;
var name = _props.name;
var editable = _props.editable;
var value = _props.value;
var style = _props.style;
var clear = _props.clear;
var children = _props.children;
var error = _props.error;
var className = _props.className;
var extra = _props.extra;
var labelNumber = _props.labelNumber;
var _state = this.state;
var focus = _state.focus;
var placeholder = _state.placeholder;
var wrapCls = (0, _classnames2.default)((_classNames = {}, (0, _defineProperty3.default)(_classNames, prefixListCls + '-item', type === 'hasLine'), (0, _defineProperty3.default)(_classNames, prefixCls + '-item', true), (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 inputType = 'text';
if (format === 'bankCard' || format === 'phone') {
inputType = 'tel';
} else if (format === 'password') {
inputType = 'password';
}
return React.createElement(
'div',
{ className: wrapCls, style: style },
children ? React.createElement(
'div',
{ className: labelCls },
children
) : null,
React.createElement(
'div',
{ className: prefixCls + '-control' },
React.createElement('input', { type: inputType, name: name, placeholder: placeholder, value: value, onChange: this.onInputChange, onBlur: this.onInputBlur, onFocus: this.onInputFocus, readOnly: !editable, pattern: format === 'number' ? '[0-9]*' : '' })
),
clear && editable && value.length > 0 ? React.createElement('div', { className: prefixCls + '-clear', onClick: this.clearInput }) : null,
error ? React.createElement('div', { className: prefixCls + '-error-extra', onClick: this.onErrorClick }) : null,
extra !== '' ? React.createElement(
'div',
{ className: prefixCls + '-extra', onClick: this.onExtraClick },
extra
) : null
);
};
return InputItem;
}(React.Component);
exports.default = InputItem;
InputItem.propTypes = {
type: _react.PropTypes.oneOf(['hasLine']),
format: _react.PropTypes.oneOf(['text', 'bankCard', 'phone', 'password', 'number']),
extra: _react.PropTypes.oneOfType([_react.PropTypes.string, _react.PropTypes.node]),
size: _react.PropTypes.oneOf(['large', 'small']),
labelNumber: _react.PropTypes.oneOf([2, 3, 4, 5, 6, 7]),
labelPosition: _react.PropTypes.oneOf(['left', 'top']),
textAlign: _react.PropTypes.oneOf(['left', 'center'])
};
InputItem.defaultProps = {
prefixCls: 'am-input',
prefixListCls: 'am-list',
type: 'hasLine',
format: 'text',
editable: true,
name: '',
value: '',
placeholder: '',
clear: false,
maxLength: -1,
onChange: noop,
onBlur: noop,
onFocus: noop,
extra: '',
onExtraClick: noop,
error: false,
onErrorClick: noop,
size: 'large',
labelNumber: 4,
labelPosition: 'left',
textAlign: 'left'
};
module.exports = exports['default'];
/***/ },
/* 169 */
[476, 310],
/* 170 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _extends2 = __webpack_require__(8);
var _extends3 = _interopRequireDefault(_extends2);
var _slicedToArray2 = __webpack_require__(12);
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 React = _interopRequireWildcard(_react);
var _rmcListView = __webpack_require__(126);
var _rmcListView2 = _interopRequireDefault(_rmcListView);
var _list = __webpack_require__(16);
var _list2 = _interopRequireDefault(_list);
var _MyList = __webpack_require__(76);
var _MyList2 = _interopRequireDefault(_MyList);
var _splitObject3 = __webpack_require__(14);
var _splitObject4 = _interopRequireDefault(_splitObject3);
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 Header = _list2.default.Header;
var Body = _list2.default.Body;
var Footer = _list2.default.Footer;
var Item = _list2.default.Item;
var MListViewIndexedList = _rmcListView2.default.IndexedList;
var IndexedList = function (_React$Component) {
(0, _inherits3.default)(IndexedList, _React$Component);
function IndexedList() {
(0, _classCallCheck3.default)(this, IndexedList);
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
}
IndexedList.prototype.render = function render() {
var _splitObject = (0, _splitObject4.default)(this.props, ['renderHeader', 'renderFooter', 'renderSectionHeader', 'renderRow']);
var _splitObject2 = (0, _slicedToArray3.default)(_splitObject, 2);
var _splitObject2$ = _splitObject2[0];
var renderHeader = _splitObject2$.renderHeader;
var renderFooter = _splitObject2$.renderFooter;
var renderSectionHeader = _splitObject2$.renderSectionHeader;
var renderRow = _splitObject2$.renderRow;
var restProps = _splitObject2[1];
var extraProps = {
renderHeader: null,
renderFooter: null,
renderSectionHeader: null
};
if (renderHeader) {
extraProps.renderHeader = function () {
return React.createElement(
Header,
null,
renderHeader()
);
};
}
if (renderFooter) {
extraProps.renderFooter = function () {
return React.createElement(
Footer,
null,
renderFooter()
);
};
}
if (renderSectionHeader) {
extraProps.renderSectionHeader = function (sectionData, sectionID) {
return React.createElement(
Item,
null,
renderSectionHeader(sectionData, sectionID)
);
};
}
return React.createElement(
MListViewIndexedList,
(0, _extends3.default)({}, restProps, extraProps, { renderScrollComponent: function renderScrollComponent(props) {
return React.createElement(_MyList2.default, props);
}, renderRow: renderRow, renderBodyComponent: function renderBodyComponent() {
return React.createElement(Body, null);
} }),
this.props.children
);
};
return IndexedList;
}(React.Component);
exports.default = IndexedList;
IndexedList.propTypes = {
prefixCls: _react.PropTypes.string
};
IndexedList.defaultProps = {
prefixCls: 'am-indexed-list'
};
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__(8);
var _extends3 = _interopRequireDefault(_extends2);
var _slicedToArray2 = __webpack_require__(12);
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 React = _interopRequireWildcard(_react);
var _rmcListView = __webpack_require__(126);
var _rmcListView2 = _interopRequireDefault(_rmcListView);
var _list = __webpack_require__(16);
var _list2 = _interopRequireDefault(_list);
var _MyList = __webpack_require__(76);
var _MyList2 = _interopRequireDefault(_MyList);
var _splitObject3 = __webpack_require__(14);
var _splitObject4 = _interopRequireDefault(_splitObject3);
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 DataSource = _rmcListView2.default.DataSource;
var Header = _list2.default.Header;
var Body = _list2.default.Body;
var Footer = _list2.default.Footer;
var Item = _list2.default.Item;
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 _splitObject = (0, _splitObject4.default)(this.props, ['renderHeader', 'renderFooter', 'renderSectionHeader', 'renderRow']);
var _splitObject2 = (0, _slicedToArray3.default)(_splitObject, 2);
var _splitObject2$ = _splitObject2[0];
var renderHeader = _splitObject2$.renderHeader;
var renderFooter = _splitObject2$.renderFooter;
var renderSectionHeader = _splitObject2$.renderSectionHeader;
var renderRow = _splitObject2$.renderRow;
var restProps = _splitObject2[1];
var extraProps = {
renderHeader: null,
renderFooter: null,
renderSectionHeader: null
};
if (renderHeader) {
extraProps.renderHeader = function () {
return React.createElement(
Header,
null,
renderHeader()
);
};
}
if (renderFooter) {
extraProps.renderFooter = function () {
return React.createElement(
Footer,
null,
renderFooter()
);
};
}
if (renderSectionHeader) {
extraProps.renderSectionHeader = function (sectionData, sectionID) {
return React.createElement(
Item,
null,
renderSectionHeader(sectionData, sectionID)
);
};
}
return React.createElement(_rmcListView2.default, (0, _extends3.default)({}, restProps, extraProps, { renderScrollComponent: function renderScrollComponent(props) {
return React.createElement(_MyList2.default, props);
}, renderRow: renderRow, renderBodyComponent: function renderBodyComponent() {
return React.createElement(Body, null);
} }));
};
return ListView;
}(React.Component);
exports.default = ListView;
ListView.propTypes = {
dataSource: React.PropTypes.object
};
ListView.DataSource = DataSource;
ListView.IndexedList = __webpack_require__(170);
module.exports = exports['default'];
/***/ },
/* 172 */
[474, 311],
/* 173 */
/***/ 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 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 ListBody = function (_React$Component) {
(0, _inherits3.default)(ListBody, _React$Component);
function ListBody() {
(0, _classCallCheck3.default)(this, ListBody);
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
}
ListBody.prototype.render = function render() {
var _classNames;
var _props = this.props;
var prefixCls = _props.prefixCls;
var children = _props.children;
var className = _props.className;
var style = _props.style;
var wrapCls = (0, _classnames2.default)((_classNames = {}, (0, _defineProperty3.default)(_classNames, prefixCls + '-body', true), (0, _defineProperty3.default)(_classNames, className, className), _classNames));
return React.createElement(
'div',
{ className: wrapCls, style: style },
children
);
};
return ListBody;
}(React.Component);
exports.default = ListBody;
ListBody.defaultProps = {
prefixCls: 'am-list'
};
module.exports = exports['default'];
/***/ },
/* 174 */
/***/ 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 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 ListFooter = function (_React$Component) {
(0, _inherits3.default)(ListFooter, _React$Component);
function ListFooter() {
(0, _classCallCheck3.default)(this, ListFooter);
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
}
ListFooter.prototype.render = function render() {
var _classNames;
var _props = this.props;
var prefixCls = _props.prefixCls;
var children = _props.children;
var className = _props.className;
var style = _props.style;
var onClick = _props.onClick;
var wrapCls = (0, _classnames2.default)((_classNames = {}, (0, _defineProperty3.default)(_classNames, prefixCls + '-footer', true), (0, _defineProperty3.default)(_classNames, className, className), _classNames));
return React.createElement(
'div',
{ className: wrapCls, style: style, onClick: onClick },
children
);
};
return ListFooter;
}(React.Component);
exports.default = ListFooter;
ListFooter.propTypes = {
prefixCls: _react.PropTypes.string
};
ListFooter.defaultProps = {
prefixCls: 'am-list'
};
module.exports = exports['default'];
/***/ },
/* 175 */
/***/ 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 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 ListHeader = function (_React$Component) {
(0, _inherits3.default)(ListHeader, _React$Component);
function ListHeader() {
(0, _classCallCheck3.default)(this, ListHeader);
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
}
ListHeader.prototype.render = function render() {
var _classNames;
var _props = this.props;
var prefixCls = _props.prefixCls;
var children = _props.children;
var className = _props.className;
var style = _props.style;
var onClick = _props.onClick;
var wrapCls = (0, _classnames2.default)((_classNames = {}, (0, _defineProperty3.default)(_classNames, prefixCls + '-header', true), (0, _defineProperty3.default)(_classNames, className, className), _classNames));
return React.createElement(
'div',
{ className: wrapCls, style: style, onClick: onClick },
children
);
};
return ListHeader;
}(React.Component);
exports.default = ListHeader;
ListHeader.defaultProps = {
prefixCls: 'am-list'
};
module.exports = exports['default'];
/***/ },
/* 176 */
/***/ 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 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 ListItem = function (_React$Component) {
(0, _inherits3.default)(ListItem, _React$Component);
function ListItem(props) {
(0, _classCallCheck3.default)(this, ListItem);
var _this = (0, _possibleConstructorReturn3.default)(this, _React$Component.call(this, props));
_this.onClick = function (e) {
if (_this.props.onClick) {
_this.setState({
hover: true
});
setTimeout(function () {
_this.setState({
hover: false
});
}, 200);
_this.props.onClick(e);
}
};
_this.onTouchStart = function () {
if (_this.props.onClick) {
_this.setState({
hover: true
});
}
};
_this.onTouchEnd = function () {
if (_this.props.onClick) {
_this.setState({
hover: false
});
}
};
_this.state = {
hover: false
};
return _this;
}
ListItem.prototype.render = function render() {
var _classNames, _classNames2;
var _props = this.props;
var prefixCls = _props.prefixCls;
var thumb = _props.thumb;
var arrow = _props.arrow;
var error = _props.error;
var children = _props.children;
var extra = _props.extra;
var className = _props.className;
var align = _props.align;
var style = _props.style;
var hover = this.state.hover;
var thumbDom = void 0;
var arrowDom = void 0;
var wrapCls = (0, _classnames2.default)((_classNames = {}, (0, _defineProperty3.default)(_classNames, prefixCls + '-item', true), (0, _defineProperty3.default)(_classNames, prefixCls + '-item-error', error), (0, _defineProperty3.default)(_classNames, prefixCls + '-item-top', align === 'top'), (0, _defineProperty3.default)(_classNames, prefixCls + '-item-middle', align === 'middle'), (0, _defineProperty3.default)(_classNames, prefixCls + '-item-bottom', align === 'bottom'), (0, _defineProperty3.default)(_classNames, prefixCls + '-item-hover', hover), (0, _defineProperty3.default)(_classNames, className, className), _classNames));
var arrowCls = (0, _classnames2.default)((_classNames2 = {}, (0, _defineProperty3.default)(_classNames2, prefixCls + '-arrow-horizontal', arrow === 'horizontal'), (0, _defineProperty3.default)(_classNames2, prefixCls + '-arrow-vertical', arrow === 'down' || arrow === 'up'), (0, _defineProperty3.default)(_classNames2, prefixCls + '-arrow-vertical-up', arrow === 'up'), _classNames2));
if (thumb) {
if (typeof thumb === 'string') {
thumbDom = React.createElement(
'div',
{ className: prefixCls + '-thumb' },
React.createElement('img', { src: thumb })
);
} else {
thumbDom = React.createElement(
'div',
{ className: prefixCls + '-thumb' },
thumb
);
}
}
/* arrow有值,则保留这个dom坑位 */
if (arrow !== '') {
/* 当值是horizontal时,渲染水平箭头 */
if (arrow === 'empty') {
arrowDom = React.createElement('div', { className: prefixCls + '-arrow' });
} else {
arrowDom = React.createElement(
'div',
{ className: prefixCls + '-arrow' },
React.createElement('span', { className: arrowCls })
);
}
} else {
arrowDom = null;
}
return React.createElement(
'div',
{ className: wrapCls, onClick: this.onClick, onTouchStart: this.onTouchStart, onTouchEnd: this.onTouchEnd, onTouchCancel: this.onTouchEnd, style: style },
thumbDom,
React.createElement(
'div',
{ className: prefixCls + '-line' },
children !== '' ? React.createElement(
'div',
{ className: prefixCls + '-content' },
children
) : null,
extra !== '' ? React.createElement(
'div',
{ className: prefixCls + '-extra' },
extra
) : null,
arrowDom
)
);
};
return ListItem;
}(React.Component);
exports.default = ListItem;
ListItem.defaultProps = {
prefixCls: 'am-list',
thumb: '',
arrow: '',
children: '',
extra: '',
error: false,
align: 'middle'
};
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 React = _interopRequireWildcard(_react);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var _index = __webpack_require__(16);
var _index2 = _interopRequireDefault(_index);
var _index3 = __webpack_require__(80);
var _index4 = _interopRequireDefault(_index3);
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 SubMenu = function (_React$Component) {
(0, _inherits3.default)(SubMenu, _React$Component);
function SubMenu(props) {
(0, _classCallCheck3.default)(this, SubMenu);
var _this = (0, _possibleConstructorReturn3.default)(this, _React$Component.call(this, props));
_this.onClick = function (el) {
_this.setState({
value: [el]
});
_this.props.onChange(el);
};
_this.state = {
value: _this.props.value,
data: _this.props.data
};
return _this;
}
SubMenu.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
if ('data' in nextProps) {
this.setState({
data: nextProps.data
});
}
};
SubMenu.prototype.render = function render() {
var _classNames,
_this2 = this;
var _state = this.state;
var value = _state.value;
var data = _state.data;
var _props = this.props;
var className = _props.className;
var prefixCls = _props.prefixCls;
var radioPrefixCls = _props.radioPrefixCls;
var subMenuCls = (0, _classnames2.default)((_classNames = {}, (0, _defineProperty3.default)(_classNames, '' + prefixCls, true), (0, _defineProperty3.default)(_classNames, className, className), _classNames));
var itemsDom = [];
data.forEach(function (el, idx) {
var _classNames2;
var listItemCls = (0, _classnames2.default)((_classNames2 = {}, (0, _defineProperty3.default)(_classNames2, radioPrefixCls + '-item', true), (0, _defineProperty3.default)(_classNames2, prefixCls + '-item-selected', value.length > 0 && value[0].value === el.value), (0, _defineProperty3.default)(_classNames2, prefixCls + '-item-disabled', el.disabled), _classNames2));
itemsDom.push(React.createElement(
_index2.default.Item,
{ className: listItemCls, key: idx, extra: React.createElement(_index4.default, { checked: value.length > 0 && value[0].value === el.value, disabled: el.disabled, onChange: _this2.onClick.bind(_this2, el) }) },
el.label
));
});
return React.createElement(
_index2.default,
{ style: { paddingTop: 0 }, className: subMenuCls },
React.createElement(
_index2.default.Body,
null,
itemsDom
)
);
};
return SubMenu;
}(React.Component);
exports.default = SubMenu;
SubMenu.defaultProps = {
prefixCls: 'am-sub-menu',
radioPrefixCls: 'am-radio',
value: [],
data: [],
onChange: function onChange() {}
};
module.exports = exports['default'];
/***/ },
/* 178 */
/***/ 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 React = _interopRequireWildcard(_react);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var _objectAssign = __webpack_require__(11);
var _objectAssign2 = _interopRequireDefault(_objectAssign);
var _SubMenu = __webpack_require__(177);
var _SubMenu2 = _interopRequireDefault(_SubMenu);
var _list = __webpack_require__(16);
var _list2 = _interopRequireDefault(_list);
var _flex = __webpack_require__(32);
var _flex2 = _interopRequireDefault(_flex);
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 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.onClickListItem = function (el) {
if (el.isLeaf === true) {
_this.setState({
firstValue: el.value,
SubMenuData: []
}, function () {
_this.props.onChange([el.value]);
});
} else {
_this.setState({
firstValue: el.value,
SubMenuData: el.children || []
});
}
};
_this.onClickSubMenuItem = function (el) {
setTimeout(function () {
if (_this.props.level === 2) {
_this.props.onChange([_this.state.firstValue, el.value]);
} else {
_this.props.onChange([el.value]);
}
}, 300);
};
var _this$props = _this.props;
var data = _this$props.data;
var value = _this$props.value;
var level = _this$props.level;
if (value.length > 0) {
if (level === 2) {
var SubMenuData = data.filter(function (el) {
return el.value === (value.length > 0 && value[0] || null);
})[0].children || [];
_this.state = {
SubMenuData: SubMenuData,
firstValue: value[0] || ''
};
} else {
_this.state = {
SubMenuData: data
};
}
} else {
if (level === 2) {
var _SubMenuData = data[0].children || [];
if (data[0].isLeaf) {
_this.state = {
SubMenuData: [],
firstValue: ''
};
} else {
_this.state = {
SubMenuData: _SubMenuData,
firstValue: data[0].value
};
}
} else {
_this.state = {
SubMenuData: data
};
}
}
return _this;
}
Menu.prototype.render = function render() {
var _classNames,
_this2 = this;
var _props = this.props;
var className = _props.className;
var data = _props.data;
var prefixCls = _props.prefixCls;
var height = _props.height;
var value = _props.value;
var level = _props.level;
var style = _props.style;
if (!height) {
height = document.documentElement.clientHeight / 2;
}
var heightStyle = {
height: Math.round(height / 44) * 44 - 1 + 'px',
overflowY: 'scroll'
};
style = (0, _objectAssign2.default)(style || {}, heightStyle);
var _state = this.state;
var SubMenuData = _state.SubMenuData;
var firstValue = _state.firstValue;
var wrapCls = (0, _classnames2.default)((_classNames = {}, (0, _defineProperty3.default)(_classNames, prefixCls, true), (0, _defineProperty3.default)(_classNames, className, className), _classNames));
var listContent = [];
data.forEach(function (el, index) {
listContent.push(React.createElement(
_list2.default.Item,
{ className: el.value === firstValue ? prefixCls + '-selected' : '', onClick: _this2.onClickListItem.bind(_this2, el), key: 'listitem-1-' + index },
el.label
));
});
return React.createElement(
'div',
{ className: wrapCls, style: style },
React.createElement(
_flex2.default,
{ align: 'top' },
level === 2 ? React.createElement(
_flex2.default.Item,
{ style: heightStyle },
React.createElement(
_list2.default,
null,
React.createElement(
_list2.default.Body,
null,
listContent
)
)
) : null,
React.createElement(
_flex2.default.Item,
{ style: heightStyle },
React.createElement(_SubMenu2.default, { value: SubMenuData.filter(function (el) {
return el.value === (value.length && value[value.length - 1]);
}), data: SubMenuData, onChange: this.onClickSubMenuItem })
)
)
);
};
return Menu;
}(React.Component);
exports.default = Menu;
Menu.propTypes = {
level: _react.PropTypes.oneOf([1, 2])
};
Menu.defaultProps = {
prefixCls: 'am-menu',
value: [],
data: [],
level: 2,
onChange: function onChange() {}
};
module.exports = exports['default'];
/***/ },
/* 179 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
__webpack_require__(7);
__webpack_require__(38);
__webpack_require__(26);
__webpack_require__(81);
__webpack_require__(313);
/***/ },
/* 180 */
/***/ 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) {
// console.log('Must specify either an alert title, or message, or both');
return;
}
var prefixCls = 'am-modal';
var div = document.createElement('div');
document.body.appendChild(div);
function close() {
ReactDOM.unmountComponentAtNode(div);
div.parentNode.removeChild(div);
}
var btnGroupClass = prefixCls + '-button-group-' + (actions.length === 2 ? 'h' : 'v');
var footer = [React.createElement(
'div',
{ key: 'footer', className: btnGroupClass },
actions.map(function (button, i) {
return React.createElement(
'a',
{ key: i, className: prefixCls + '-button', href: '#', onClick: function onClick(e) {
e.preventDefault();
if (button.onPress) {
button.onPress();
}
close();
} },
button.text || '按钮' + i
);
})
)];
ReactDOM.render(React.createElement(
_Modal2.default,
{ visible: true, transparent: true, prefixCls: prefixCls, title: title, transitionName: 'am-zoom', footer: footer, maskTransitionName: 'am-fade' },
React.createElement(
'div',
{ style: { zoom: 1, overflow: 'hidden' } },
content
)
), div);
};
var _react = __webpack_require__(1);
var React = _interopRequireWildcard(_react);
var _reactDom = __webpack_require__(9);
var ReactDOM = _interopRequireWildcard(_reactDom);
var _Modal = __webpack_require__(52);
var _Modal2 = _interopRequireDefault(_Modal);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
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; } }
module.exports = exports['default'];
/***/ },
/* 181 */
/***/ 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]) {
// console.log('Must specify callbackOrActions');
return;
}
var prefixCls = 'am-modal';
var title = args[0];
var inputDom = void 0;
var type = args[3] || 'default';
var data = {};
function onChange(e) {
var target = e.target;
var inputType = target.getAttribute('type');
data[inputType] = target.value;
}
switch (type) {
case 'login-password':
inputDom = React.createElement(
'div',
null,
React.createElement(
'div',
{ className: prefixCls + '-input' },
React.createElement('input', { type: 'text', defaultValue: '', onChange: onChange })
),
React.createElement(
'div',
{ className: prefixCls + '-input' },
React.createElement('input', { type: 'password', defaultValue: '', onChange: onChange })
)
);
break;
case 'secure-text':
inputDom = React.createElement(
'div',
null,
React.createElement(
'div',
{ className: prefixCls + '-input' },
React.createElement('input', { type: 'password', defaultValue: '', onChange: onChange })
)
);
break;
case 'plain-text':
case 'default':
default:
inputDom = React.createElement(
'div',
null,
React.createElement(
'div',
{ className: prefixCls + '-input' },
React.createElement('input', { type: 'text', defaultValue: '', onChange: onChange })
)
);
break;
}
var content = React.createElement(
'div',
null,
args[1],
inputDom
);
var div = document.createElement('div');
document.body.appendChild(div);
function close() {
ReactDOM.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) {
getArgs(item.onPress);
}
}
};
});
}
var footer = [React.createElement(
'div',
{ key: 'footer', className: prefixCls + '-button-group-h' },
actions.map(function (button, i) {
return React.createElement(
'a',
{ key: i, className: prefixCls + '-button', href: '#', onClick: function onClick(e) {
e.preventDefault();
if (button.onPress) {
button.onPress();
}
close();
} },
button.text
);
})
)];
ReactDOM.render(React.createElement(
_Modal2.default,
{ visible: true, transparent: true, prefixCls: prefixCls, title: title, transitionName: 'am-zoom', footer: footer, maskTransitionName: 'am-fade' },
React.createElement(
'div',
{ style: { zoom: 1, overflow: 'hidden' } },
content
)
), div);
};
var _react = __webpack_require__(1);
var React = _interopRequireWildcard(_react);
var _reactDom = __webpack_require__(9);
var ReactDOM = _interopRequireWildcard(_reactDom);
var _Modal = __webpack_require__(52);
var _Modal2 = _interopRequireDefault(_Modal);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
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; } }
module.exports = exports['default'];
/***/ },
/* 182 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _extends2 = __webpack_require__(8);
var _extends3 = _interopRequireDefault(_extends2);
var _defineProperty2 = __webpack_require__(6);
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _slicedToArray2 = __webpack_require__(12);
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 React = _interopRequireWildcard(_react);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var _icon = __webpack_require__(15);
var _icon2 = _interopRequireDefault(_icon);
var _splitObject3 = __webpack_require__(14);
var _splitObject4 = _interopRequireDefault(_splitObject3);
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 NavBar = function (_React$Component) {
(0, _inherits3.default)(NavBar, _React$Component);
function NavBar() {
(0, _classCallCheck3.default)(this, NavBar);
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
}
NavBar.prototype.render = function render() {
var _classNames;
var _splitObject = (0, _splitObject4.default)(this.props, ['prefixCls', 'children', 'mode', 'className', 'iconName', 'leftContent', 'rightContent', 'onLeftClick']);
var _splitObject2 = (0, _slicedToArray3.default)(_splitObject, 2);
var _splitObject2$ = _splitObject2[0];
var prefixCls = _splitObject2$.prefixCls;
var children = _splitObject2$.children;
var mode = _splitObject2$.mode;
var className = _splitObject2$.className;
var iconName = _splitObject2$.iconName;
var leftContent = _splitObject2$.leftContent;
var rightContent = _splitObject2$.rightContent;
var onLeftClick = _splitObject2$.onLeftClick;
var restProps = _splitObject2[1];
var wrapCls = (0, _classnames2.default)((_classNames = {}, (0, _defineProperty3.default)(_classNames, className, className), (0, _defineProperty3.default)(_classNames, prefixCls, true), (0, _defineProperty3.default)(_classNames, prefixCls + '-' + mode, true), _classNames));
return React.createElement(
'div',
(0, _extends3.default)({}, restProps, { className: wrapCls }),
React.createElement(
'div',
{ className: prefixCls + '-left', onClick: onLeftClick },
iconName ? React.createElement(
'span',
{ className: prefixCls + '-left-icon' },
React.createElement(_icon2.default, { type: iconName })
) : null,
React.createElement(
'span',
{ className: prefixCls + '-left-content' },
leftContent
)
),
React.createElement(
'div',
{ className: prefixCls + '-title' },
children
),
React.createElement(
'div',
{ className: prefixCls + '-right' },
rightContent
)
);
};
return NavBar;
}(React.Component);
exports.default = NavBar;
NavBar.defaultProps = {
prefixCls: 'am-navbar',
mode: 'dark',
iconName: 'left',
onLeftClick: function onLeftClick() {}
};
module.exports = exports['default'];
/***/ },
/* 183 */
[474, 315],
/* 184 */
/***/ 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 React = _interopRequireWildcard(_react);
var _button = __webpack_require__(50);
var _button2 = _interopRequireDefault(_button);
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 }; }
function noop() {}
var PageResult = function (_React$Component) {
(0, _inherits3.default)(PageResult, _React$Component);
function PageResult() {
(0, _classCallCheck3.default)(this, PageResult);
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
}
PageResult.prototype.render = function render() {
var _classNames;
var _props = this.props;
var prefixCls = _props.prefixCls;
var imgUrl = _props.imgUrl;
var title = _props.title;
var message = _props.message;
var buttonTxt = _props.buttonTxt;
var buttonClick = _props.buttonClick;
var buttonType = _props.buttonType;
var buttonGhost = _props.buttonGhost;
var className = _props.className;
var wrapCls = (0, _classnames2.default)((_classNames = {}, (0, _defineProperty3.default)(_classNames, '' + prefixCls, true), (0, _defineProperty3.default)(_classNames, className, className), _classNames));
return React.createElement(
'div',
{ className: wrapCls },
React.createElement('div', { className: prefixCls + '-pic', style: { backgroundImage: 'url(' + imgUrl + ')' } }),
title !== '' ? React.createElement(
'div',
{ className: prefixCls + '-title' },
title
) : null,
message !== '' ? React.createElement(
'div',
{ className: prefixCls + '-message' },
message
) : null,
buttonTxt !== '' ? React.createElement(
'div',
{ className: prefixCls + '-button' },
React.createElement(
_button2.default,
{ type: buttonType, ghost: buttonGhost, onClick: buttonClick },
buttonTxt
)
) : null
);
};
return PageResult;
}(React.Component);
exports.default = PageResult;
PageResult.defaultProps = {
prefixCls: 'am-page-result',
imgUrl: '',
title: '',
message: '',
buttonTxt: '',
buttonType: 'default',
buttonGhost: false,
buttonClick: noop
};
module.exports = exports['default'];
/***/ },
/* 185 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
__webpack_require__(7);
__webpack_require__(73);
__webpack_require__(316);
/***/ },
/* 186 */
/***/ 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 React = _interopRequireWildcard(_react);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var _button = __webpack_require__(50);
var _button2 = _interopRequireDefault(_button);
var _flex = __webpack_require__(32);
var _flex2 = _interopRequireDefault(_flex);
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() {}
var Pagination = function (_React$Component) {
(0, _inherits3.default)(Pagination, _React$Component);
function Pagination(props) {
(0, _classCallCheck3.default)(this, Pagination);
var _this = (0, _possibleConstructorReturn3.default)(this, _React$Component.call(this, props));
_this.state = {
current: props.current
};
_this.onPrev = _this.onPrev.bind(_this);
_this.onNext = _this.onNext.bind(_this);
return _this;
}
Pagination.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
this.setState({
current: nextProps.current
});
};
Pagination.prototype._hasPrev = function _hasPrev() {
return this.state.current > 0;
};
Pagination.prototype._hasNext = function _hasNext() {
return this.state.current < this.props.total;
};
Pagination.prototype._handleChange = function _handleChange(p) {
this.setState({
current: p
});
this.props.onChange(p);
return p;
};
Pagination.prototype.onPrev = function onPrev() {
this._handleChange(this.state.current - 1);
};
Pagination.prototype.onNext = function onNext() {
this._handleChange(this.state.current + 1);
};
Pagination.prototype.getIndexes = function getIndexes(count) {
var arr = [];
for (var i = 0; i < count; i++) {
arr.push(i);
}
return arr;
};
Pagination.prototype.render = function render() {
var _classNames;
var _props = this.props;
var prefixCls = _props.prefixCls;
var className = _props.className;
var mode = _props.mode;
var total = _props.total;
var size = _props.size;
var simple = _props.simple;
var prevText = _props.prevText;
var nextText = _props.nextText;
var current = this.state.current;
var numWrapCls = (0, _classnames2.default)((_classNames = {
className: className
}, (0, _defineProperty3.default)(_classNames, prefixCls + '-wrap', true), (0, _defineProperty3.default)(_classNames, prefixCls + '-wrap-lg', size === 'large'), (0, _defineProperty3.default)(_classNames, prefixCls + '-wrap-sm', size === 'small'), _classNames));
var markup = void 0;
switch (mode) {
case 'button':
markup = React.createElement(
_flex2.default,
null,
React.createElement(
_flex2.default.Item,
{ className: prefixCls + '-wrap-btn' },
React.createElement(
_button2.default,
{ size: size, inline: true, disabled: current <= 0, onClick: this.onPrev },
prevText
)
),
this.props.children ? React.createElement(
_flex2.default.Item,
null,
this.props.children
) : !simple && React.createElement(
_flex2.default.Item,
{ className: numWrapCls },
React.createElement(
'span',
{ className: 'active' },
current + 1
),
'/',
React.createElement(
'span',
null,
total
)
),
React.createElement(
_flex2.default.Item,
null,
React.createElement(
_button2.default,
{ size: size, disabled: current >= total - 1, inline: true, onClick: this.onNext },
nextText
)
)
);
break;
case 'number':
markup = React.createElement(
'div',
{ className: numWrapCls },
React.createElement(
'span',
{ className: 'active' },
current + 1
),
'/',
React.createElement(
'span',
null,
total
)
);
break;
case 'pointer':
var indexes = this.getIndexes(total);
markup = React.createElement(
'div',
{ className: numWrapCls },
indexes.map(function (index) {
var _classNames2;
var dotCls = (0, _classnames2.default)((_classNames2 = {}, (0, _defineProperty3.default)(_classNames2, prefixCls + '-wrap-dot', true), (0, _defineProperty3.default)(_classNames2, prefixCls + '-wrap-dot-active', index === current), _classNames2));
return React.createElement(
'div',
{ className: dotCls, key: 'dot-' + index },
React.createElement('span', null)
);
})
);
break;
default:
markup = false;
break;
}
return React.createElement(
'div',
{ className: prefixCls },
markup
);
};
return Pagination;
}(React.Component);
exports.default = Pagination;
Pagination.defaultProps = {
prefixCls: 'am-pagination',
mode: 'button',
size: 'large',
current: 0,
simple: false,
prevText: 'Prev',
nextText: 'Next',
onChange: noop
};
module.exports = exports['default'];
/***/ },
/* 187 */
[474, 317],
/* 188 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _extends2 = __webpack_require__(8);
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 React = _interopRequireWildcard(_react);
var _Popup = __webpack_require__(445);
var _Popup2 = _interopRequireDefault(_Popup);
var _arrayTreeFilter = __webpack_require__(71);
var _arrayTreeFilter2 = _interopRequireDefault(_arrayTreeFilter);
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 getDefaultProps() {
var defaultFormat = function defaultFormat(values) {
return values.join(',');
};
return {
prefixCls: 'am-picker',
pickerPrefixCls: 'am-picker-picker',
popupPrefixCls: 'am-picker-popup',
format: defaultFormat,
style: { left: 0, bottom: 0 },
cols: 3,
value: [],
extra: '请选择',
okText: '确定',
dismissText: '取消',
title: ''
};
}
var Picker = function (_React$Component) {
(0, _inherits3.default)(Picker, _React$Component);
function Picker() {
(0, _classCallCheck3.default)(this, Picker);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var _this = (0, _possibleConstructorReturn3.default)(this, _React$Component.call.apply(_React$Component, [this].concat(args)));
_this.getSel = function () {
var value = _this.props.value || [];
var treeChildren = (0, _arrayTreeFilter2.default)(_this.props.data, function (c, level) {
return c.value === value[level];
});
return _this.props.format(treeChildren.map(function (v) {
return v.label;
}));
};
return _this;
}
Picker.prototype.render = function render() {
var _props = this.props;
var children = _props.children;
var data = _props.data;
var value = _props.value;
var okText = _props.okText;
var dismissText = _props.dismissText;
var title = _props.title;
var extra = _props.extra;
var extraProps = {
extra: this.getSel() || extra
};
var childEl = React.cloneElement(children, extraProps);
return React.createElement(
_Popup2.default,
(0, _extends3.default)({ WrapComponent: 'div', popupTransitionName: 'am-slide-up', maskTransitionName: 'am-fade' }, this.props, { data: data, value: value, dismissText: dismissText, title: title, okText: okText }),
childEl
);
};
return Picker;
}(React.Component);
exports.default = Picker;
Picker.propTypes = {
format: _react.PropTypes.func
};
Picker.defaultProps = getDefaultProps();
module.exports = exports['default'];
/***/ },
/* 189 */
[474, 318],
/* 190 */
/***/ 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 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 Progress = function (_React$Component) {
(0, _inherits3.default)(Progress, _React$Component);
function Progress(props) {
(0, _classCallCheck3.default)(this, Progress);
var _this = (0, _possibleConstructorReturn3.default)(this, _React$Component.call(this, props));
_this.state = {};
return _this;
}
Progress.prototype.render = function render() {
var _classNames;
var _props = this.props;
var prefixCls = _props.prefixCls;
var percent = _props.percent;
var position = _props.position;
var percentStyle = {
width: percent + '%',
height: 0
};
var wrapCls = (0, _classnames2.default)((_classNames = {}, (0, _defineProperty3.default)(_classNames, prefixCls + '-outer', true), (0, _defineProperty3.default)(_classNames, prefixCls + '-fixed-outer', position === 'fixed'), _classNames));
return React.createElement(
'div',
{ className: wrapCls },
React.createElement('div', { className: prefixCls + '-bar', style: percentStyle })
);
};
return Progress;
}(React.Component);
exports.default = Progress;
Progress.propTypes = {
prefixCls: _react.PropTypes.string,
position: _react.PropTypes.oneOf(['fixed', 'normal']),
percent: _react.PropTypes.number
};
Progress.defaultProps = {
prefixCls: 'am-progress',
percent: 0,
position: 'fixed'
};
module.exports = exports['default'];
/***/ },
/* 191 */
[474, 319],
/* 192 */
/***/ 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 React = _interopRequireWildcard(_react);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var _Radio = __webpack_require__(79);
var _Radio2 = _interopRequireDefault(_Radio);
var _list = __webpack_require__(16);
var _list2 = _interopRequireDefault(_list);
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 ListItem = _list2.default.Item;
var RadioItem = function (_React$Component) {
(0, _inherits3.default)(RadioItem, _React$Component);
function RadioItem() {
(0, _classCallCheck3.default)(this, RadioItem);
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
}
RadioItem.prototype.render = function render() {
var _classNames;
var _props = this.props;
var prefixCls = _props.prefixCls;
var listPrefixCls = _props.listPrefixCls;
var style = _props.style;
var name = _props.name;
var defaultChecked = _props.defaultChecked;
var checked = _props.checked;
var disabled = _props.disabled;
var children = _props.children;
var className = _props.className;
var onChange = _props.onChange;
var wrapCls = (0, _classnames2.default)((_classNames = {}, (0, _defineProperty3.default)(_classNames, prefixCls + '-item', true), (0, _defineProperty3.default)(_classNames, prefixCls + '-item-disabled', disabled === true), (0, _defineProperty3.default)(_classNames, className, className), _classNames));
return React.createElement(
ListItem,
{ prefixCls: listPrefixCls, style: style, className: wrapCls, extra: React.createElement(_Radio2.default, { defaultChecked: defaultChecked, checked: checked, name: name, onChange: onChange, disabled: disabled }) },
children
);
};
return RadioItem;
}(React.Component);
exports.default = RadioItem;
RadioItem.defaultProps = {
prefixCls: 'am-radio',
listPrefixCls: 'am-list'
};
module.exports = exports['default'];
/***/ },
/* 193 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _extends2 = __webpack_require__(8);
var _extends3 = _interopRequireDefault(_extends2);
var _slicedToArray2 = __webpack_require__(12);
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 React = _interopRequireWildcard(_react);
var _rmcPullToRefresh = __webpack_require__(469);
var _rmcPullToRefresh2 = _interopRequireDefault(_rmcPullToRefresh);
var _icon = __webpack_require__(15);
var _icon2 = _interopRequireDefault(_icon);
var _splitObject3 = __webpack_require__(14);
var _splitObject4 = _interopRequireDefault(_splitObject3);
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 RefreshControl = function (_React$Component) {
(0, _inherits3.default)(RefreshControl, _React$Component);
function RefreshControl() {
(0, _classCallCheck3.default)(this, RefreshControl);
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
}
RefreshControl.prototype.render = function render() {
var _splitObject = (0, _splitObject4.default)(this.props, ['prefixCls', 'children', 'icon', 'loading', 'hammerOptions']);
var _splitObject2 = (0, _slicedToArray3.default)(_splitObject, 2);
var _splitObject2$ = _splitObject2[0];
var prefixCls = _splitObject2$.prefixCls;
var children = _splitObject2$.children;
var icon = _splitObject2$.icon;
var loading = _splitObject2$.loading;
var hammerOptions = _splitObject2$.hammerOptions;
var restProps = _splitObject2[1];
return React.createElement(
_rmcPullToRefresh2.default,
(0, _extends3.default)({}, restProps, { prefixCls: prefixCls, icon: icon, loading: loading, hammerOptions: hammerOptions || {} }),
children
);
};
return RefreshControl;
}(React.Component);
exports.default = RefreshControl;
RefreshControl.propTypes = {
prefixCls: _react.PropTypes.string,
children: _react.PropTypes.any,
icon: _react.PropTypes.any,
loading: _react.PropTypes.any,
hammerOptions: _react.PropTypes.object
};
RefreshControl.defaultProps = {
prefixCls: 'am-refresh-control',
icon: React.createElement(
'div',
null,
React.createElement(
'div',
{ className: 'pull' },
React.createElement(_icon2.default, { type: 'down' })
),
React.createElement(
'div',
{ className: 'release' },
React.createElement(_icon2.default, { type: 'up' })
)
),
loading: React.createElement(_icon2.default, { type: 'loading' })
};
module.exports = exports['default'];
/***/ },
/* 194 */
[474, 321],
/* 195 */
/***/ 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 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 }; }
function noop() {}
var SearchBar = function (_React$Component) {
(0, _inherits3.default)(SearchBar, _React$Component);
function SearchBar(props) {
(0, _classCallCheck3.default)(this, SearchBar);
var _this = (0, _possibleConstructorReturn3.default)(this, _React$Component.call(this, props));
_this.onSubmit = function (e) {
e.preventDefault();
_this.props.onSubmit(_this.state.value);
};
_this.onChange = function (e) {
var value = e.target.value;
_this.setState({ value: value });
_this.props.onChange(value);
};
_this.onFocus = function (e) {
if (_this.props.disablSearch) {
e.preventDefault();
e.stopPropagation();
return;
}
var value = e.target.value;
_this.setState({
focus: true
});
_this.props.onFocus(value);
};
_this.onBlur = function (e) {
var value = e.target.value;
_this.setState({
focus: false
});
_this.props.onBlur(value);
};
_this.onCancel = function () {
_this.setState({ value: '' });
_this.props.onCancel('');
_this.props.onChange('');
};
_this.onClear = function () {
_this.setState({
value: ''
});
_this.refs.searchInput.focus();
_this.props.onClear('');
_this.props.onChange('');
};
_this.state = {
value: _this.props.value,
focus: false
};
return _this;
}
SearchBar.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
if ('value' in nextProps && this.props.value !== nextProps.value) {
this.setState({
value: nextProps.value
});
}
};
SearchBar.prototype.render = function render() {
var _classNames, _classNames2;
var _props = this.props;
var prefixCls = _props.prefixCls;
var showCancelButton = _props.showCancelButton;
var disablSearch = _props.disablSearch;
var placeholder = _props.placeholder;
var cancelTxt = _props.cancelTxt;
var className = _props.className;
var _state = this.state;
var value = _state.value;
var focus = _state.focus;
var wrapCls = (0, _classnames2.default)((_classNames = {}, (0, _defineProperty3.default)(_classNames, '' + prefixCls, true), (0, _defineProperty3.default)(_classNames, className, className), _classNames));
var inputCls = (0, _classnames2.default)((_classNames2 = {}, (0, _defineProperty3.default)(_classNames2, prefixCls + '-input', true), (0, _defineProperty3.default)(_classNames2, prefixCls + '-input-focus', focus), (0, _defineProperty3.default)(_classNames2, prefixCls + '-start', value.length > 0), _classNames2));
var cancelStyle = value.length > 0 ? { display: 'block' } : { display: 'none' };
return React.createElement(
'form',
{ onSubmit: this.onSubmit },
React.createElement(
'div',
{ className: wrapCls },
React.createElement(
'div',
{ className: inputCls },
React.createElement('input', { type: 'search', className: prefixCls + '-value', value: value, disabled: disablSearch, placeholder: placeholder, onChange: this.onChange, onFocus: this.onFocus, onBlur: this.onBlur, ref: 'searchInput' }),
React.createElement('a', { onClick: this.onClear, className: prefixCls + '-clear' })
),
React.createElement(
'div',
{ className: prefixCls + '-cancel', style: showCancelButton ? { display: 'block' } : cancelStyle, onClick: this.onCancel },
cancelTxt
)
)
);
};
return SearchBar;
}(React.Component);
exports.default = SearchBar;
SearchBar.propTypes = {
prefixCls: _react.PropTypes.string,
style: _react.PropTypes.object,
value: _react.PropTypes.string,
placeholder: _react.PropTypes.string,
onSubmit: _react.PropTypes.func,
onChange: _react.PropTypes.func,
onFocus: _react.PropTypes.func,
onBlur: _react.PropTypes.func,
onCancel: _react.PropTypes.func,
onClear: _react.PropTypes.func,
showCancelButton: _react.PropTypes.bool,
cancelTxt: _react.PropTypes.string,
disablSearch: _react.PropTypes.bool
};
SearchBar.defaultProps = {
prefixCls: 'am-search',
value: '',
placeholder: '',
onSubmit: noop,
onChange: noop,
onFocus: noop,
onBlur: noop,
onCancel: noop,
onClear: noop,
showCancelButton: false,
cancelTxt: '取消',
disablSearch: false
};
module.exports = exports['default'];
/***/ },
/* 196 */
[474, 322],
/* 197 */
/***/ 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 React = _interopRequireWildcard(_react);
var _rcSlider = __webpack_require__(389);
var _rcSlider2 = _interopRequireDefault(_rcSlider);
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() {
(0, _classCallCheck3.default)(this, Slider);
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
}
Slider.prototype.render = function render() {
return React.createElement(_rcSlider2.default, this.props);
};
return Slider;
}(React.Component);
exports.default = Slider;
Slider.defaultProps = {
prefixCls: 'am-slider',
tipTransitionName: 'zoom-down'
};
module.exports = exports['default'];
/***/ },
/* 198 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
__webpack_require__(7);
__webpack_require__(85);
__webpack_require__(323);
/***/ },
/* 199 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _extends2 = __webpack_require__(8);
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);
var _rcInputNumber = __webpack_require__(379);
var _rcInputNumber2 = _interopRequireDefault(_rcInputNumber);
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 Stepper = function (_React$Component) {
(0, _inherits3.default)(Stepper, _React$Component);
function Stepper() {
(0, _classCallCheck3.default)(this, Stepper);
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
}
Stepper.prototype.componentDidMount = function componentDidMount() {
this.refs.inputNumber.refs.input.setAttribute('disabled', true);
};
Stepper.prototype.render = function render() {
var _classNames;
var _props = this.props;
var prefixCls = _props.prefixCls;
var className = _props.className;
var size = _props.size;
var showNumber = _props.showNumber;
var stepperClass = (0, _classnames2.default)((_classNames = {}, (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, 'showNumber', !!showNumber), _classNames));
var restProps = Object.assign({}, this.props);
['className', 'prefixCls', 'size', 'showNumber'].forEach(function (prop) {
if (restProps.hasOwnProperty(prop)) {
delete restProps[prop];
}
});
return React.createElement(_rcInputNumber2.default, (0, _extends3.default)({ ref: 'inputNumber', prefixCls: prefixCls, className: stepperClass, size: size }, restProps));
};
return Stepper;
}(React.Component);
exports.default = Stepper;
Stepper.defaultProps = {
prefixCls: 'am-stepper',
step: 1,
readOnly: true,
showNumber: false,
size: 'small'
};
module.exports = exports['default'];
/***/ },
/* 200 */
[474, 324],
/* 201 */
/***/ 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 React = _interopRequireWildcard(_react);
var _rcSteps = __webpack_require__(392);
var _rcSteps2 = _interopRequireDefault(_rcSteps);
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 Steps = function (_React$Component) {
(0, _inherits3.default)(Steps, _React$Component);
function Steps() {
(0, _classCallCheck3.default)(this, Steps);
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
}
Steps.prototype.render = function render() {
return React.createElement(_rcSteps2.default, this.props);
};
return Steps;
}(React.Component);
exports.default = Steps;
Steps.Step = _rcSteps2.default.Step;
Steps.defaultProps = {
prefixCls: 'am-steps',
iconPrefix: 'ant',
labelPlacement: 'vertical',
current: 0
};
module.exports = exports['default'];
/***/ },
/* 202 */
[474, 325],
/* 203 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.create = create;
var _cssVendor = __webpack_require__(285);
function create(styles) {
var ret = {};
for (var s in styles) {
if (styles.hasOwnProperty(s)) {
var style = styles;
var ret2 = {};
for (var property in style) {
if (style.hasOwnProperty(property)) {
var value = style[property];
property = (0, _cssVendor.supportedProperty)(property) || property;
if (typeof value === 'string') {
value = (0, _cssVendor.supportedValue)(property, value) || value;
}
ret2[property] = value;
}
}
ret[s] = ret2;
}
}
return ret;
}
/***/ },
/* 204 */
/***/ 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__(89);
var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);
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 _rcSwipeout = __webpack_require__(394);
var _rcSwipeout2 = _interopRequireDefault(_rcSwipeout);
var _reactHammerjs = __webpack_require__(47);
var _reactHammerjs2 = _interopRequireDefault(_reactHammerjs);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var _modal = __webpack_require__(77);
var _modal2 = _interopRequireDefault(_modal);
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 SwipeAction = function (_React$Component) {
(0, _inherits3.default)(SwipeAction, _React$Component);
function SwipeAction(props) {
(0, _classCallCheck3.default)(this, SwipeAction);
var _this = (0, _possibleConstructorReturn3.default)(this, _React$Component.call(this, props));
_this.state = {
showModal: false
};
_this.onLongTap = _this.onLongTap.bind(_this);
_this.onClose = _this.onClose.bind(_this);
return _this;
}
SwipeAction.prototype.onLongTap = function onLongTap() {
var _props = this.props;
var disabled = _props.disabled;
var onOpen = _props.onOpen;
if (disabled) {
return;
}
onOpen();
this.setState({
showModal: true
});
};
SwipeAction.prototype.onClose = function onClose() {
this.props.onClose();
this.setState({
showModal: false
});
};
SwipeAction.prototype.onAndroidBtnClick = function onAndroidBtnClick(btn) {
var onPress = btn.onPress;
if (onPress) {
onPress();
}
if (this.props.autoClose) {
this.onClose();
}
};
SwipeAction.prototype.renderAndroid = function renderAndroid() {
var _props2 = this.props;
var children = _props2.children;
var title = _props2.title;
var pressOption = {
recognizers: {
press: {
time: 500,
threshold: 50
}
}
};
return React.createElement(
'div',
null,
React.createElement(
_reactHammerjs2.default,
{ onPress: this.onLongTap, options: pressOption },
children
),
this.state.showModal ? React.createElement(_modal2.default, { animated: false, title: title, transparent: true, closable: false, maskClosable: true, onClose: this.onClose, footer: this.renderAndroidBtn(), visible: true }) : null
);
};
SwipeAction.prototype.renderAndroidBtn = function renderAndroidBtn() {
var _this2 = this;
var _props3 = this.props;
var prefixCls = _props3.prefixCls;
var left = _props3.left;
var right = _props3.right;
var actions = [].concat((0, _toConsumableArray3.default)(left), (0, _toConsumableArray3.default)(right));
return React.createElement(
'ul',
{ className: prefixCls + '-android-actions' },
actions.map(function (btn, i) {
return React.createElement(
'li',
{ key: i, className: prefixCls + '-android-btn', onClick: function onClick() {
return _this2.onAndroidBtnClick(btn);
} },
btn.text
);
})
);
};
SwipeAction.prototype.render = function render() {
var _classNames;
var _props4 = this.props;
var className = _props4.className;
var prefixCls = _props4.prefixCls;
var left = _props4.left;
var right = _props4.right;
var autoClose = _props4.autoClose;
var disabled = _props4.disabled;
var onOpen = _props4.onOpen;
var onClose = _props4.onClose;
var children = _props4.children;
var isAndroid = !!navigator.userAgent.match(/Android/i);
var wrapClass = (0, _classnames2.default)((_classNames = {}, (0, _defineProperty3.default)(_classNames, '' + prefixCls, 1), (0, _defineProperty3.default)(_classNames, className, !!className), _classNames));
return left.length || right.length ? React.createElement(
'div',
{ className: wrapClass },
isAndroid ? this.renderAndroid() : React.createElement(
_rcSwipeout2.default,
{ prefixCls: prefixCls, left: left, right: right, autoClose: autoClose, disabled: disabled, onOpen: onOpen, onClose: onClose },
children
)
) : React.createElement(
'div',
{ className: wrapClass },
children
);
};
return SwipeAction;
}(React.Component);
SwipeAction.propTypes = {
prefixCls: _react.PropTypes.string,
autoClose: _react.PropTypes.bool,
disabled: _react.PropTypes.bool,
title: _react.PropTypes.string,
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
};
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'];
/***/ },
/* 205 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
__webpack_require__(7);
__webpack_require__(78);
__webpack_require__(327);
/***/ },
/* 206 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _extends2 = __webpack_require__(8);
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 Switch = function (_React$Component) {
(0, _inherits3.default)(Switch, _React$Component);
function Switch() {
(0, _classCallCheck3.default)(this, Switch);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var _this = (0, _possibleConstructorReturn3.default)(this, _React$Component.call.apply(_React$Component, [this].concat(args)));
_this.onChange = function (e) {
var checked = e.target.checked;
_this.props.onChange(checked);
};
return _this;
}
Switch.prototype.render = function render() {
var _classNames;
var _props = this.props;
var prefixCls = _props.prefixCls;
var style = _props.style;
var name = _props.name;
var checked = _props.checked;
var disabled = _props.disabled;
var className = _props.className;
var wrapCls = (0, _classnames2.default)((_classNames = {}, (0, _defineProperty3.default)(_classNames, '' + prefixCls, true), (0, _defineProperty3.default)(_classNames, className, className), _classNames));
return React.createElement(
'label',
{ className: wrapCls, style: style },
React.createElement('input', (0, _extends3.default)({ type: 'checkbox', name: name, className: prefixCls + '-checkbox' }, disabled ? { disabled: 'disabled' } : '', { checked: checked, onChange: this.onChange })),
React.createElement('div', { className: 'checkbox' })
);
};
return Switch;
}(React.Component);
exports.default = Switch;
Switch.propTypes = {
prefixCls: _react.PropTypes.string,
style: _react.PropTypes.object,
name: _react.PropTypes.string,
checked: _react.PropTypes.bool,
disabled: _react.PropTypes.bool,
onChange: _react.PropTypes.func
};
Switch.defaultProps = {
prefixCls: 'am-switch',
name: '',
checked: false,
disabled: false,
onChange: function onChange() {}
};
module.exports = exports['default'];
/***/ },
/* 207 */
[474, 328],
/* 208 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _extends2 = __webpack_require__(8);
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 React = _interopRequireWildcard(_react);
var _rcTable = __webpack_require__(399);
var _rcTable2 = _interopRequireDefault(_rcTable);
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 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;
var columns = _props.columns;
var dataSource = _props.dataSource;
var direction = _props.direction;
var scrollX = _props.scrollX;
var titleFixed = _props.titleFixed;
var _props2 = this.props;
var style = _props2.style;
var className = _props2.className;
var restProps = Object.assign({}, this.props);
['style', 'className'].forEach(function (prop) {
if (restProps.hasOwnProperty(prop)) {
delete restProps[prop];
}
});
var table = void 0;
// 默认纵向
if (!direction || direction === 'vertical') {
if (titleFixed) {
table = React.createElement(_rcTable2.default, (0, _extends3.default)({}, restProps, { columns: columns, data: dataSource, className: 'am-table', scroll: { x: true }, showHeader: false }));
} else {
table = React.createElement(_rcTable2.default, (0, _extends3.default)({}, restProps, { columns: columns, data: dataSource, className: 'am-table', scroll: { x: scrollX } }));
}
} else if (direction === 'horizon') {
columns[0].className = 'am-table-horizonTitle';
table = React.createElement(_rcTable2.default, (0, _extends3.default)({}, restProps, { columns: columns, data: dataSource, className: 'am-table', showHeader: false, scroll: { x: scrollX } }));
} else if (direction === 'mix') {
columns[0].className = 'am-table-horizonTitle';
table = React.createElement(_rcTable2.default, (0, _extends3.default)({}, restProps, { columns: columns, data: dataSource, className: 'am-table', scroll: { x: scrollX } }));
}
return React.createElement(
'div',
{ className: className, style: style },
table
);
};
return Table;
}(React.Component);
exports.default = Table;
Table.defaultProps = {
dataSource: [],
prefixCls: 'am-table'
};
module.exports = exports['default'];
/***/ },
/* 209 */
[474, 329],
/* 210 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _extends2 = __webpack_require__(8);
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);
var _rcTabs = __webpack_require__(405);
var _rcTabs2 = _interopRequireDefault(_rcTabs);
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 Tabs = function (_React$Component) {
(0, _inherits3.default)(Tabs, _React$Component);
function Tabs() {
(0, _classCallCheck3.default)(this, Tabs);
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
}
Tabs.prototype.render = function render() {
var _classNames;
var _props = this.props;
var className = _props.className;
var prefixCls = _props.prefixCls;
var type = _props.type;
var children = _props.children;
var animation = _props.animation;
var mode = _props.mode;
var tabPosition = _props.tabPosition;
var cls = (0, _classnames2.default)((_classNames = {}, (0, _defineProperty3.default)(_classNames, className, !!className), (0, _defineProperty3.default)(_classNames, prefixCls + '-' + type, true), (0, _defineProperty3.default)(_classNames, prefixCls + '-' + mode, type === 'tabbar'), _classNames));
var position = type !== 'tabbar' ? tabPosition : 'bottom';
var anim = type === 'tabbar' || !animation ? '' : animation;
var restProps = Object.assign({}, this.props);
['className', 'prefixCls', 'type', 'animation', 'mode', 'tabPosition', 'children'].forEach(function (prop) {
if (restProps.hasOwnProperty(prop)) {
delete restProps[prop];
}
});
return React.createElement(
_rcTabs2.default,
(0, _extends3.default)({ prefixCls: prefixCls, className: cls, tabPosition: position, animation: anim }, restProps),
children
);
};
return Tabs;
}(React.Component);
exports.default = Tabs;
Tabs.TabPane = _rcTabs2.default.TabPane;
Tabs.defaultProps = {
prefixCls: 'am-tab',
animation: 'slide-horizontal',
type: 'line',
mode: 'light',
onChange: function onChange() {},
onTabClick: function onTabClick() {}
};
module.exports = exports['default'];
/***/ },
/* 211 */
[474, 330],
/* 212 */
/***/ 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 React = _interopRequireWildcard(_react);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var _icon = __webpack_require__(15);
var _icon2 = _interopRequireDefault(_icon);
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 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;
var type = _this$props.type;
var disabled = _this$props.disabled;
var closable = _this$props.closable;
var onChange = _this$props.onChange;
if (type === 'read' || disabled) {
return;
}
if (closable) {
_this.onClose();
} else {
(function () {
var isSelect = _this.state.selected;
_this.setState({
selected: !isSelect
}, function () {
onChange(!isSelect);
});
})();
}
};
_this.onClose = function () {
var _this$props2 = _this.props;
var onClose = _this$props2.onClose;
var afterClose = _this$props2.afterClose;
onClose();
_this.setState({
closed: true
}, afterClose);
};
_this.state = {
selected: props.selected,
closed: false
};
return _this;
}
Tag.prototype.render = function render() {
var _classNames;
var _props = this.props;
var children = _props.children;
var className = _props.className;
var prefixCls = _props.prefixCls;
var type = _props.type;
var size = _props.size;
var disabled = _props.disabled;
var closable = _props.closable;
var selected = this.state.selected;
var wrapCls = (0, _classnames2.default)((_classNames = {}, (0, _defineProperty3.default)(_classNames, className, !!className), (0, _defineProperty3.default)(_classNames, prefixCls, true), (0, _defineProperty3.default)(_classNames, prefixCls + '-normal', !selected), (0, _defineProperty3.default)(_classNames, prefixCls + '-active', (selected || closable) && !disabled && type !== 'read'), (0, _defineProperty3.default)(_classNames, prefixCls + '-read', type === 'read'), (0, _defineProperty3.default)(_classNames, prefixCls + '-disabled', disabled), (0, _defineProperty3.default)(_classNames, prefixCls + '-size-small', size === 'small'), (0, _defineProperty3.default)(_classNames, prefixCls + '-size-large', size === 'large'), _classNames));
var close = closable && !disabled && type !== 'read' && size === 'large' ? React.createElement(
'div',
{ className: prefixCls + '-close' },
React.createElement(_icon2.default, { type: 'cross' })
) : null;
return this.state.closed ? null : React.createElement(
'div',
{ className: wrapCls, onClick: this.onClick },
React.createElement(
'div',
{ className: prefixCls + '-text' },
children
),
close
);
};
return Tag;
}(React.Component);
exports.default = Tag;
Tag.defaultProps = {
prefixCls: 'am-tag',
type: 'read',
disabled: false,
size: 'large',
closable: false,
selected: false,
onChange: function onChange() {},
onClose: function onClose() {},
afterClose: function afterClose() {}
};
module.exports = exports['default'];
/***/ },
/* 213 */
[475, 331],
/* 214 */
/***/ 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 React = _interopRequireWildcard(_react);
var _view = __webpack_require__(86);
var _view2 = _interopRequireDefault(_view);
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 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 React.createElement(_view2.default, this.props);
};
return Text;
}(React.Component);
exports.default = Text;
Text.defaultProps = {
Component: 'span'
};
module.exports = exports['default'];
/***/ },
/* 215 */
/***/ 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 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 }; }
function noop() {}
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.componentDidMount = function () {
if (_this.props.autoHeight) {
_this.initialTextHeight = _this.refs.textarea.offsetHeight;
_this.componentDidUpdate();
}
};
_this.componentDidUpdate = function () {
if (_this.props.autoHeight) {
var textareaDom = _this.refs.textarea;
textareaDom.style.height = '';
textareaDom.style.height = Math.max(_this.initialTextHeight, textareaDom.scrollHeight) + 'px';
}
};
_this.onChange = function (e) {
var value = e.target.value;
var _this$props = _this.props;
var count = _this$props.count;
var onChange = _this$props.onChange;
if (count > 0) {
value = value.substring(0, count);
}
onChange(value);
};
_this.onBlur = function (e) {
setTimeout(function () {
_this.setState({
focus: false
});
}, 500);
var value = e.target.value;
_this.props.onBlur(value);
};
_this.onFocus = function (e) {
_this.setState({
focus: true
});
var value = e.target.value;
_this.props.onFocus(value);
};
_this.onErrorClick = function () {
_this.props.onErrorClick();
};
_this.clearInput = function () {
_this.props.onChange('');
};
_this.state = {
focus: false
};
return _this;
}
TextareaItem.prototype.render = function render() {
var _classNames, _classNames2;
var _props = this.props;
var prefixCls = _props.prefixCls;
var prefixListCls = _props.prefixListCls;
var style = _props.style;
var title = _props.title;
var name = _props.name;
var value = _props.value;
var placeholder = _props.placeholder;
var clear = _props.clear;
var rows = _props.rows;
var count = _props.count;
var editable = _props.editable;
var error = _props.error;
var className = _props.className;
var labelNumber = _props.labelNumber;
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 + '-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));
return React.createElement(
'div',
{ className: wrapCls, style: style },
title ? React.createElement(
'div',
{ className: labelCls },
title
) : null,
React.createElement(
'div',
{ className: prefixCls + '-control' },
React.createElement('textarea', { ref: 'textarea', name: name, rows: rows, placeholder: placeholder, onChange: this.onChange, onBlur: this.onBlur, onFocus: this.onFocus, value: value, readOnly: !editable })
),
clear && editable && value.length > 0 ? React.createElement('div', { className: prefixCls + '-clear', onClick: this.clearInput, onTouchStart: this.clearInput }) : null,
error ? React.createElement('div', { className: prefixCls + '-error-extra', onClick: this.onErrorClick }) : null,
count > 0 && rows > 1 ? React.createElement(
'span',
{ className: prefixCls + '-count' },
React.createElement(
'span',
null,
value.length
),
'/',
count
) : null
);
};
return TextareaItem;
}(React.Component);
exports.default = TextareaItem;
TextareaItem.propTypes = {
type: _react.PropTypes.oneOf(['hasLine']),
title: _react.PropTypes.oneOfType([_react.PropTypes.string, _react.PropTypes.node]),
labelNumber: _react.PropTypes.oneOf([2, 3, 4, 5, 6, 7])
};
TextareaItem.defaultProps = {
prefixCls: 'am-textarea',
prefixListCls: 'am-list',
title: '',
type: 'hasLine',
autoHeight: false,
editable: true,
name: '',
value: '',
placeholder: '',
clear: false,
rows: 1,
count: 0,
onChange: noop,
onBlur: noop,
onFocus: noop,
onErrorClick: noop,
error: false,
labelNumber: 4
};
module.exports = exports['default'];
/***/ },
/* 216 */
[476, 332],
/* 217 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _extends2 = __webpack_require__(8);
var _extends3 = _interopRequireDefault(_extends2);
var _defineProperty2 = __webpack_require__(6);
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _slicedToArray2 = __webpack_require__(12);
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 React = _interopRequireWildcard(_react);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var _TimelineItem = __webpack_require__(82);
var _TimelineItem2 = _interopRequireDefault(_TimelineItem);
var _splitObject3 = __webpack_require__(14);
var _splitObject4 = _interopRequireDefault(_splitObject3);
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 Timeline = function (_React$Component) {
(0, _inherits3.default)(Timeline, _React$Component);
function Timeline() {
(0, _classCallCheck3.default)(this, Timeline);
return (0, _possibleConstructorReturn3.default)(this, _React$Component.apply(this, arguments));
}
Timeline.prototype.render = function render() {
var _classNames;
var _splitObject = (0, _splitObject4.default)(this.props, ['prefixCls', 'children', 'pending', 'className']);
var _splitObject2 = (0, _slicedToArray3.default)(_splitObject, 2);
var _splitObject2$ = _splitObject2[0];
var prefixCls = _splitObject2$.prefixCls;
var children = _splitObject2$.children;
var pending = _splitObject2$.pending;
var className = _splitObject2$.className;
var restProps = _splitObject2[1];
var pendingNode = typeof pending === 'boolean' ? null : pending;
var classString = (0, _classnames2.default)((_classNames = {}, (0, _defineProperty3.default)(_classNames, prefixCls, true), (0, _defineProperty3.default)(_classNames, prefixCls + '-pending', !!pending), (0, _defineProperty3.default)(_classNames, className, className), _classNames));
return React.createElement(
'ul',
(0, _extends3.default)({}, restProps, { className: classString }),
React.Children.map(children, function (ele, idx) {
return React.cloneElement(ele, {
last: idx === children.length - 1
});
}),
!!pending ? React.createElement(
_TimelineItem2.default,
{ pending: !!pending },
pendingNode
) : null
);
};
return Timeline;
}(React.Component);
exports.default = Timeline;
Timeline.defaultProps = {
prefixCls: 'am-timeline'
};
module.exports = exports['default'];
/***/ },
/* 218 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _Timeline = __webpack_require__(217);
var _Timeline2 = _interopRequireDefault(_Timeline);
var _TimelineItem = __webpack_require__(82);
var _TimelineItem2 = _interopRequireDefault(_TimelineItem);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
_Timeline2.default.Item = _TimelineItem2.default;
exports.default = _Timeline2.default;
module.exports = exports['default'];
/***/ },
/* 219 */
[474, 333],
/* 220 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _extends2 = __webpack_require__(8);
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 React = _interopRequireWildcard(_react);
var _rcTooltip = __webpack_require__(70);
var _rcTooltip2 = _interopRequireDefault(_rcTooltip);
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 Tooltip = function (_React$Component) {
(0, _inherits3.default)(Tooltip, _React$Component);
function Tooltip(props) {
(0, _classCallCheck3.default)(this, Tooltip);
var _this = (0, _possibleConstructorReturn3.default)(this, _React$Component.call(this, props));
_this.onVisibleChange = function (visible) {
_this.setState({ visible: visible });
_this.props.onVisibleChange(visible);
};
_this.state = {
visible: false
};
return _this;
}
Tooltip.prototype.render = function render() {
var _props = this.props;
var children = _props.children;
var prefixCls = _props.prefixCls;
var title = _props.title;
var overlay = _props.overlay;
// Hide tooltip when there is no title
var visible = this.state.visible;
if (!title && !overlay) {
visible = false;
}
if ('visible' in this.props) {
visible = this.props.visible;
}
var restProps = Object.assign({}, this.props);
['prefixCls', 'overlay', 'visible', 'trigger', 'onVisibleChange', 'children'].forEach(function (prop) {
if (restProps.hasOwnProperty(prop)) {
delete restProps[prop];
}
});
return React.createElement(
_rcTooltip2.default,
(0, _extends3.default)({ prefixCls: prefixCls, overlay: title, visible: visible, trigger: ['click'], onVisibleChange: this.onVisibleChange }, restProps),
children
);
};
return Tooltip;
}(React.Component);
exports.default = Tooltip;
Tooltip.defaultProps = {
prefixCls: 'am-tooltip',
placement: 'bootomLeft',
onVisibleChange: function onVisibleChange() {}
};
module.exports = exports['default'];
/***/ },
/* 221 */
/***/ 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 React = _interopRequireWildcard(_react);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var _icon = __webpack_require__(15);
var _icon2 = _interopRequireDefault(_icon);
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 TopNotice = function (_React$Component) {
(0, _inherits3.default)(TopNotice, _React$Component);
function TopNotice(props) {
(0, _classCallCheck3.default)(this, TopNotice);
var _this = (0, _possibleConstructorReturn3.default)(this, _React$Component.call(this, props));
_this.state = {
show: true
};
return _this;
}
TopNotice.prototype.onClick = function onClick() {
var _props = this.props;
var mode = _props.mode;
var onClick = _props.onClick;
onClick();
if (mode === 'closable') {
this.setState({
show: false
});
}
};
TopNotice.prototype.render = function render() {
var _classNames,
_this2 = this;
var _props2 = this.props;
var prefixCls = _props2.prefixCls;
var children = _props2.children;
var mode = _props2.mode;
var type = _props2.type;
var onClick = _props2.onClick;
var className = _props2.className;
var wrapCls = (0, _classnames2.default)((_classNames = {}, (0, _defineProperty3.default)(_classNames, prefixCls, true), (0, _defineProperty3.default)(_classNames, className, !!className), _classNames));
var operationDom = void 0;
switch (mode) {
case 'closable':
operationDom = React.createElement(
'div',
{ className: 'am-top-notice-operation', onClick: function onClick() {
return _this2.onClick();
} },
React.createElement(_icon2.default, { type: 'cross' })
);
break;
case 'link':
operationDom = React.createElement(
'div',
{ className: 'am-top-notice-operation', onClick: onClick },
React.createElement(_icon2.default, { type: 'right' })
);
break;
default:
operationDom = null;
break;
}
var iconType = '';
switch (type) {
case 'success':
iconType = 'check-circle';
break;
case 'error':
iconType = 'cross-circle';
break;
case 'warn':
iconType = 'exclamation-circle';
break;
case 'question':
iconType = 'question-circle';
break;
case 'info':
default:
iconType = 'info-circle';
break;
}
var iconDom = type ? React.createElement(
'div',
{ className: 'am-top-notice-icon' },
React.createElement(_icon2.default, { type: iconType })
) : null;
return this.state.show ? React.createElement(
'div',
{ className: wrapCls },
iconDom,
React.createElement(
'div',
{ className: 'am-top-notice-content' },
children
),
operationDom
) : null;
};
return TopNotice;
}(React.Component);
exports.default = TopNotice;
TopNotice.defaultProps = {
prefixCls: 'am-top-notice',
mode: '',
onClick: function onClick() {}
};
module.exports = exports['default'];
/***/ },
/* 222 */
[475, 336],
/* 223 */
/***/ 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 React = _interopRequireWildcard(_react);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var _wingBlank = __webpack_require__(87);
var _wingBlank2 = _interopRequireDefault(_wingBlank);
var _flex = __webpack_require__(32);
var _flex2 = _interopRequireDefault(_flex);
var _toast = __webpack_require__(83);
var _toast2 = _interopRequireDefault(_toast);
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() {}
var Uploader = function (_React$Component) {
(0, _inherits3.default)(Uploader, _React$Component);
function Uploader() {
(0, _classCallCheck3.default)(this, Uploader);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
// http://stackoverflow.com/questions/7584794/accessing-jpeg-exif-rotation-data-in-javascript-on-the-client-side
var _this = (0, _possibleConstructorReturn3.default)(this, _React$Component.call.apply(_React$Component, [this].concat(args)));
_this.getOrientation = function (file, callback) {
if (!/iphone|ipad/i.test(navigator.userAgent)) {
callback('-1');
} else {
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 (offset < length) {
var marker = view.getUint16(offset, false);
offset += 2;
if (marker === 0xFFE1) {
var tmp = view.getUint32(offset += 2, false);
if (tmp !== 0x45786966) {
return callback(-1);
}
var little = view.getUint16(offset += 6, false) === 0x4949;
offset += view.getUint32(offset + 4, little);
var tags = view.getUint16(offset, little);
offset += 2;
for (var i = 0; i < tags; i++) {
if (view.getUint16(offset + i * 12, little) === 0x0112) {
return callback(view.getUint16(offset + i * 12 + 8, little));
}
}
} else if ((marker & 0xFF00) !== 0xFF00) {
break;
} else {
offset += view.getUint16(offset, false);
}
}
return callback(-1);
};
reader.readAsArrayBuffer(file.slice(0, 64 * 1024));
}
};
_this.removeImage = function (index) {
var newImages = [];
_this.props.files.forEach(function (image, idx) {
if (index !== idx) {
newImages.push(image);
}
});
_this.props.onChange(newImages);
};
_this.addImage = function (imgItem) {
var newImages = _this.props.files.concat(imgItem);
_this.props.onChange(newImages);
};
_this.onFileChange = function () {
var fileSelectorEl = _this.refs.fileSelectorInput;
if (fileSelectorEl.files && fileSelectorEl.files.length) {
(function () {
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) {
// -2: not jpeg , -1: not defined
if (res > 0) {
orientation = res;
}
_this.addImage({
url: dataURL,
orientation: orientation
});
});
};
reader.readAsDataURL(file);
})();
}
};
return _this;
}
Uploader.prototype.render = function render() {
var _classNames,
_this2 = this;
var _props = this.props;
var prefixCls = _props.prefixCls;
var style = _props.style;
var className = _props.className;
var files = _props.files;
var imgItemList = [];
var customWidth = (document.documentElement.clientWidth - 32 - 24) / 4;
var wrapCls = (0, _classnames2.default)((_classNames = {}, (0, _defineProperty3.default)(_classNames, '' + prefixCls, true), (0, _defineProperty3.default)(_classNames, className, className), _classNames));
var itemStyle = {
width: customWidth + 'px',
height: customWidth + 'px'
};
var inputWrapStyle = {
width: customWidth - 2 + 'px',
height: customWidth - 2 + 'px'
};
files.forEach(function (image, index) {
imgItemList.push(React.createElement(
'div',
{ key: index, className: prefixCls + '-item', style: itemStyle },
React.createElement('div', { className: prefixCls + '-item-remove', onClick: _this2.removeImage.bind(_this2, index) }),
React.createElement('div', { className: prefixCls + '-item-content', style: { backgroundImage: 'url(' + image.url + ')' } })
));
});
return React.createElement(
'div',
{ className: wrapCls, style: style },
React.createElement(
'div',
{ className: prefixCls + '-list' },
React.createElement(
_wingBlank2.default,
{ size: 16 },
React.createElement(
_flex2.default,
{ wrap: 'wrap' },
imgItemList,
React.createElement(
'div',
{ className: prefixCls + '-item ' + prefixCls + '-upload-btn', style: inputWrapStyle },
React.createElement('input', { style: itemStyle, ref: 'fileSelectorInput', type: 'file', accept: 'image/jpg,image/jpeg,image/png,image/gif', onChange: this.onFileChange })
)
)
)
)
);
};
return Uploader;
}(React.Component);
exports.default = Uploader;
Uploader.defaultProps = {
prefixCls: 'am-uploader',
files: [],
onChange: noop
};
module.exports = exports['default'];
/***/ },
/* 224 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
__webpack_require__(7);
__webpack_require__(88);
__webpack_require__(38);
__webpack_require__(84);
__webpack_require__(337);
/***/ },
/* 225 */
/***/ 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 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 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;
var prefixCls = _props.prefixCls;
var size = _props.size;
var className = _props.className;
var style = _props.style;
var onClick = _props.onClick;
var wrapCls = (0, _classnames2.default)((_classNames = {}, (0, _defineProperty3.default)(_classNames, '' + prefixCls, true), (0, _defineProperty3.default)(_classNames, className, !!className), (0, _defineProperty3.default)(_classNames, prefixCls + '-ws' + size, true), _classNames));
return React.createElement('div', { className: wrapCls, style: style, onClick: onClick });
};
return WhiteSpace;
}(React.Component);
exports.default = WhiteSpace;
WhiteSpace.defaultProps = {
prefixCls: 'am-whitespace',
size: 8
};
module.exports = exports['default'];
/***/ },
/* 226 */
[474, 338],
/* 227 */
/***/ function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(238), __esModule: true };
/***/ },
/* 228 */
/***/ function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(239), __esModule: true };
/***/ },
/* 229 */
/***/ function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(240), __esModule: true };
/***/ },
/* 230 */
/***/ function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(241), __esModule: true };
/***/ },
/* 231 */
/***/ function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(242), __esModule: true };
/***/ },
/* 232 */
/***/ function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(243), __esModule: true };
/***/ },
/* 233 */
/***/ function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(245), __esModule: true };
/***/ },
/* 234 */
/***/ function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(246), __esModule: true };
/***/ },
/* 235 */
/***/ function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(247), __esModule: true };
/***/ },
/* 236 */
/***/ function(module, exports) {
var canUseDOM = !!(
typeof window !== 'undefined' &&
window.document &&
window.document.createElement
);
module.exports = canUseDOM;
/***/ },
/* 237 */
/***/ function(module, exports, __webpack_require__) {
/**
* Module dependencies.
*/
try {
var index = __webpack_require__(90);
} catch (err) {
var index = __webpack_require__(90);
}
/**
* 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);
};
/***/ },
/* 238 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(43);
__webpack_require__(272);
module.exports = __webpack_require__(10).Array.from;
/***/ },
/* 239 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(68);
__webpack_require__(43);
module.exports = __webpack_require__(270);
/***/ },
/* 240 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(68);
__webpack_require__(43);
module.exports = __webpack_require__(271);
/***/ },
/* 241 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(274);
module.exports = __webpack_require__(10).Object.assign;
/***/ },
/* 242 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(275);
var $Object = __webpack_require__(10).Object;
module.exports = function create(P, D){
return $Object.create(P, D);
};
/***/ },
/* 243 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(276);
var $Object = __webpack_require__(10).Object;
module.exports = function defineProperty(it, key, desc){
return $Object.defineProperty(it, key, desc);
};
/***/ },
/* 244 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(277);
module.exports = __webpack_require__(10).Object.keys;
/***/ },
/* 245 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(278);
module.exports = __webpack_require__(10).Object.setPrototypeOf;
/***/ },
/* 246 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(280);
__webpack_require__(279);
__webpack_require__(281);
__webpack_require__(282);
module.exports = __webpack_require__(10).Symbol;
/***/ },
/* 247 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(43);
__webpack_require__(68);
module.exports = __webpack_require__(67).f('iterator');
/***/ },
/* 248 */
/***/ function(module, exports) {
module.exports = function(it){
if(typeof it != 'function')throw TypeError(it + ' is not a function!');
return it;
};
/***/ },
/* 249 */
/***/ function(module, exports) {
module.exports = function(){ /* empty */ };
/***/ },
/* 250 */
/***/ function(module, exports, __webpack_require__) {
// false -> Array#indexOf
// true -> Array#includes
var toIObject = __webpack_require__(23)
, toLength = __webpack_require__(100)
, toIndex = __webpack_require__(269);
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;
};
};
/***/ },
/* 251 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $defineProperty = __webpack_require__(19)
, createDesc = __webpack_require__(35);
module.exports = function(object, index, value){
if(index in object)$defineProperty.f(object, index, createDesc(0, value));
else object[index] = value;
};
/***/ },
/* 252 */
/***/ function(module, exports, __webpack_require__) {
// all enumerable object keys, includes symbols
var getKeys = __webpack_require__(30)
, gOPS = __webpack_require__(60)
, pIE = __webpack_require__(40);
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;
};
/***/ },
/* 253 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(18).document && document.documentElement;
/***/ },
/* 254 */
/***/ function(module, exports, __webpack_require__) {
// check on default Array iterator
var Iterators = __webpack_require__(29)
, ITERATOR = __webpack_require__(13)('iterator')
, ArrayProto = Array.prototype;
module.exports = function(it){
return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);
};
/***/ },
/* 255 */
/***/ function(module, exports, __webpack_require__) {
// 7.2.2 IsArray(argument)
var cof = __webpack_require__(54);
module.exports = Array.isArray || function isArray(arg){
return cof(arg) == 'Array';
};
/***/ },
/* 256 */
/***/ function(module, exports, __webpack_require__) {
// call something on iterator step with safe closing on error
var anObject = __webpack_require__(20);
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;
}
};
/***/ },
/* 257 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var create = __webpack_require__(59)
, descriptor = __webpack_require__(35)
, setToStringTag = __webpack_require__(61)
, IteratorPrototype = {};
// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
__webpack_require__(28)(IteratorPrototype, __webpack_require__(13)('iterator'), function(){ return this; });
module.exports = function(Constructor, NAME, next){
Constructor.prototype = create(IteratorPrototype, {next: descriptor(1, next)});
setToStringTag(Constructor, NAME + ' Iterator');
};
/***/ },
/* 258 */
/***/ function(module, exports, __webpack_require__) {
var ITERATOR = __webpack_require__(13)('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;
};
/***/ },
/* 259 */
/***/ function(module, exports) {
module.exports = function(done, value){
return {value: value, done: !!done};
};
/***/ },
/* 260 */
/***/ function(module, exports, __webpack_require__) {
var getKeys = __webpack_require__(30)
, toIObject = __webpack_require__(23);
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;
};
/***/ },
/* 261 */
/***/ function(module, exports, __webpack_require__) {
var META = __webpack_require__(42)('meta')
, isObject = __webpack_require__(34)
, has = __webpack_require__(22)
, setDesc = __webpack_require__(19).f
, id = 0;
var isExtensible = Object.isExtensible || function(){
return true;
};
var FREEZE = !__webpack_require__(27)(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
};
/***/ },
/* 262 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
// 19.1.2.1 Object.assign(target, source, ...)
var getKeys = __webpack_require__(30)
, gOPS = __webpack_require__(60)
, pIE = __webpack_require__(40)
, toObject = __webpack_require__(41)
, IObject = __webpack_require__(94)
, $assign = Object.assign;
// should work with symbols and should have deterministic property order (V8 bug)
module.exports = !$assign || __webpack_require__(27)(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;
/***/ },
/* 263 */
/***/ function(module, exports, __webpack_require__) {
var dP = __webpack_require__(19)
, anObject = __webpack_require__(20)
, getKeys = __webpack_require__(30);
module.exports = __webpack_require__(21) ? 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;
};
/***/ },
/* 264 */
/***/ function(module, exports, __webpack_require__) {
// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
var toIObject = __webpack_require__(23)
, gOPN = __webpack_require__(97).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));
};
/***/ },
/* 265 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
var has = __webpack_require__(22)
, toObject = __webpack_require__(41)
, IE_PROTO = __webpack_require__(62)('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;
};
/***/ },
/* 266 */
/***/ function(module, exports, __webpack_require__) {
// most Object methods by ES6 should accept primitives
var $export = __webpack_require__(17)
, core = __webpack_require__(10)
, fails = __webpack_require__(27);
module.exports = function(KEY, exec){
var fn = (core.Object || {})[KEY] || Object[KEY]
, exp = {};
exp[KEY] = exec(fn);
$export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp);
};
/***/ },
/* 267 */
/***/ 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__(34)
, anObject = __webpack_require__(20);
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__(55)(Function.call, __webpack_require__(96).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
};
/***/ },
/* 268 */
/***/ function(module, exports, __webpack_require__) {
var toInteger = __webpack_require__(64)
, defined = __webpack_require__(56);
// 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;
};
};
/***/ },
/* 269 */
/***/ function(module, exports, __webpack_require__) {
var toInteger = __webpack_require__(64)
, max = Math.max
, min = Math.min;
module.exports = function(index, length){
index = toInteger(index);
return index < 0 ? max(index + length, 0) : min(index, length);
};
/***/ },
/* 270 */
/***/ function(module, exports, __webpack_require__) {
var anObject = __webpack_require__(20)
, get = __webpack_require__(101);
module.exports = __webpack_require__(10).getIterator = function(it){
var iterFn = get(it);
if(typeof iterFn != 'function')throw TypeError(it + ' is not iterable!');
return anObject(iterFn.call(it));
};
/***/ },
/* 271 */
/***/ function(module, exports, __webpack_require__) {
var classof = __webpack_require__(91)
, ITERATOR = __webpack_require__(13)('iterator')
, Iterators = __webpack_require__(29);
module.exports = __webpack_require__(10).isIterable = function(it){
var O = Object(it);
return O[ITERATOR] !== undefined
|| '@@iterator' in O
|| Iterators.hasOwnProperty(classof(O));
};
/***/ },
/* 272 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var ctx = __webpack_require__(55)
, $export = __webpack_require__(17)
, toObject = __webpack_require__(41)
, call = __webpack_require__(256)
, isArrayIter = __webpack_require__(254)
, toLength = __webpack_require__(100)
, createProperty = __webpack_require__(251)
, getIterFn = __webpack_require__(101);
$export($export.S + $export.F * !__webpack_require__(258)(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;
}
});
/***/ },
/* 273 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var addToUnscopables = __webpack_require__(249)
, step = __webpack_require__(259)
, Iterators = __webpack_require__(29)
, toIObject = __webpack_require__(23);
// 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__(95)(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');
/***/ },
/* 274 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.3.1 Object.assign(target, source)
var $export = __webpack_require__(17);
$export($export.S + $export.F, 'Object', {assign: __webpack_require__(262)});
/***/ },
/* 275 */
/***/ function(module, exports, __webpack_require__) {
var $export = __webpack_require__(17)
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
$export($export.S, 'Object', {create: __webpack_require__(59)});
/***/ },
/* 276 */
/***/ function(module, exports, __webpack_require__) {
var $export = __webpack_require__(17);
// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
$export($export.S + $export.F * !__webpack_require__(21), 'Object', {defineProperty: __webpack_require__(19).f});
/***/ },
/* 277 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.2.14 Object.keys(O)
var toObject = __webpack_require__(41)
, $keys = __webpack_require__(30);
__webpack_require__(266)('keys', function(){
return function keys(it){
return $keys(toObject(it));
};
});
/***/ },
/* 278 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.3.19 Object.setPrototypeOf(O, proto)
var $export = __webpack_require__(17);
$export($export.S, 'Object', {setPrototypeOf: __webpack_require__(267).set});
/***/ },
/* 279 */
/***/ function(module, exports) {
/***/ },
/* 280 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
// ECMAScript 6 symbols shim
var global = __webpack_require__(18)
, has = __webpack_require__(22)
, DESCRIPTORS = __webpack_require__(21)
, $export = __webpack_require__(17)
, redefine = __webpack_require__(99)
, META = __webpack_require__(261).KEY
, $fails = __webpack_require__(27)
, shared = __webpack_require__(63)
, setToStringTag = __webpack_require__(61)
, uid = __webpack_require__(42)
, wks = __webpack_require__(13)
, wksExt = __webpack_require__(67)
, wksDefine = __webpack_require__(66)
, keyOf = __webpack_require__(260)
, enumKeys = __webpack_require__(252)
, isArray = __webpack_require__(255)
, anObject = __webpack_require__(20)
, toIObject = __webpack_require__(23)
, toPrimitive = __webpack_require__(65)
, createDesc = __webpack_require__(35)
, _create = __webpack_require__(59)
, gOPNExt = __webpack_require__(264)
, $GOPD = __webpack_require__(96)
, $DP = __webpack_require__(19)
, $keys = __webpack_require__(30)
, 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__(97).f = gOPNExt.f = $getOwnPropertyNames;
__webpack_require__(40).f = $propertyIsEnumerable;
__webpack_require__(60).f = $getOwnPropertySymbols;
if(DESCRIPTORS && !__webpack_require__(58)){
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__(28)($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);
/***/ },
/* 281 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(66)('asyncIterator');
/***/ },
/* 282 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(66)('observable');
/***/ },
/* 283 */
/***/ 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'];
/***/ },
/* 284 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = camelize;
var regExp = /[-\s]+(.)?/g;
/**
* Convert dash separated strings to camel cased.
*
* @param {String} str
* @return {String}
*/
function camelize(str) {
return str.replace(regExp, toUpper);
}
function toUpper(match, c) {
return c ? c.toUpperCase() : '';
}
/***/ },
/* 285 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.supportedValue = exports.supportedProperty = exports.prefix = undefined;
var _prefix = __webpack_require__(69);
var _prefix2 = _interopRequireDefault(_prefix);
var _supportedProperty = __webpack_require__(286);
var _supportedProperty2 = _interopRequireDefault(_supportedProperty);
var _supportedValue = __webpack_require__(287);
var _supportedValue2 = _interopRequireDefault(_supportedValue);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
prefix: _prefix2.default,
supportedProperty: _supportedProperty2.default,
supportedValue: _supportedValue2.default
}; /**
* CSS Vendor prefix detection and property feature testing.
*
* @copyright Oleg Slobodskoi 2015
* @website https://github.com/jsstyles/css-vendor
* @license MIT
*/
exports.prefix = _prefix2.default;
exports.supportedProperty = _supportedProperty2.default;
exports.supportedValue = _supportedValue2.default;
/***/ },
/* 286 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = supportedProperty;
var _prefix = __webpack_require__(69);
var _prefix2 = _interopRequireDefault(_prefix);
var _camelize = __webpack_require__(284);
var _camelize2 = _interopRequireDefault(_camelize);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var el = void 0;
var cache = {};
// For server-side rendering.
if (typeof document != 'undefined') {
el = document.createElement('p');
/**
* We test every property on vendor prefix requirement.
* Once tested, result is cached. It gives us up to 70% perf boost.
* http://jsperf.com/element-style-object-access-vs-plain-object
*
* Prefill cache with known css properties to reduce amount of
* properties we need to feature test at runtime.
* http://davidwalsh.name/vendor-prefix
*/
var computed = window.getComputedStyle(document.documentElement, '');
for (var key in computed) {
cache[computed[key]] = computed[key];
}
}
/**
* Test if a property is supported, returns supported property with vendor
* prefix if required. Returns `false` if not supported.
*
* @param {String} prop dash separated
* @return {String|Boolean}
* @api public
*/
function supportedProperty(prop) {
// For server-side rendering.
if (!el) return prop;
// We have not tested this prop yet, lets do the test.
if (cache[prop] != null) return cache[prop];
// Camelization is required because we can't test using
// css syntax for e.g. in FF.
// Test if property is supported as it is.
if ((0, _camelize2.default)(prop) in el.style) {
cache[prop] = prop;
}
// Test if property is supported with vendor prefix.
else if (_prefix2.default.js + (0, _camelize2.default)('-' + prop) in el.style) {
cache[prop] = _prefix2.default.css + prop;
} else {
cache[prop] = false;
}
return cache[prop];
}
/***/ },
/* 287 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = supportedValue;
var _prefix = __webpack_require__(69);
var _prefix2 = _interopRequireDefault(_prefix);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var cache = {};
var el = void 0;
// For server-side rendering.
if (typeof document != 'undefined') el = document.createElement('p');
/**
* Returns prefixed value if needed. Returns `false` if value is not supported.
*
* @param {String} property
* @param {String} value
* @return {String|Boolean}
* @api public
*/
function supportedValue(property, value) {
// For server-side rendering.
if (!el) return value;
// It is a string or a number as a string like '1'.
// We want only prefixable values here.
if (typeof value !== 'string' || !isNaN(parseInt(value, 10))) return value;
var cacheKey = property + value;
if (cache[cacheKey] != null) return cache[cacheKey];
// IE can even throw an error in some cases, for e.g. style.content = 'bar'
try {
// Test value as it is.
el.style[property] = value;
} catch (err) {
cache[cacheKey] = false;
return false;
}
// Value is supported as it is.
if (el.style[property] === value) {
cache[cacheKey] = value;
} else {
// Test value with vendor prefix.
value = _prefix2.default.css + value;
// Hardcode test to convert "flex" to "-ms-flexbox" for IE10.
if (value === '-ms-flex') value = '-ms-flexbox';
el.style[property] = value;
// Value is supported with vendor prefix.
if (el.style[property] === value) cache[cacheKey] = value;
}
if (!cache[cacheKey]) cache[cacheKey] = false;
return cache[cacheKey];
}
/***/ },
/* 288 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _utils = __webpack_require__(36);
var _utils2 = _interopRequireDefault(_utils);
function adjustForViewport(elFuturePos, elRegion, visibleRect, overflow) {
var pos = _utils2['default'].clone(elFuturePos);
var size = {
width: elRegion.width,
height: elRegion.height
};
if (overflow.adjustX && pos.left < visibleRect.left) {
pos.left = visibleRect.left;
}
// Left edge inside and right edge outside viewport, try to resize it.
if (overflow.resizeWidth && pos.left >= visibleRect.left && pos.left + size.width > visibleRect.right) {
size.width -= pos.left + size.width - visibleRect.right;
}
// Right edge outside viewport, try to move it.
if (overflow.adjustX && pos.left + size.width > visibleRect.right) {
// 保证左边界和可视区域左边界对齐
pos.left = Math.max(visibleRect.right - size.width, visibleRect.left);
}
// Top edge outside viewport, try to move it.
if (overflow.adjustY && pos.top < visibleRect.top) {
pos.top = visibleRect.top;
}
// Top edge inside and bottom edge outside viewport, try to resize it.
if (overflow.resizeHeight && pos.top >= visibleRect.top && pos.top + size.height > visibleRect.bottom) {
size.height -= pos.top + size.height - visibleRect.bottom;
}
// Bottom edge outside viewport, try to move it.
if (overflow.adjustY && pos.top + size.height > visibleRect.bottom) {
// 保证上边界和可视区域上边界对齐
pos.top = Math.max(visibleRect.bottom - size.height, visibleRect.top);
}
return _utils2['default'].mix(pos, size);
}
exports['default'] = adjustForViewport;
module.exports = exports['default'];
/***/ },
/* 289 */
/***/ function(module, exports) {
/**
* 获取 node 上的 align 对齐点 相对于页面的坐标
*/
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
function getAlignOffset(region, align) {
var V = align.charAt(0);
var H = align.charAt(1);
var w = region.width;
var h = region.height;
var x = undefined;
var y = undefined;
x = region.left;
y = region.top;
if (V === 'c') {
y += h / 2;
} else if (V === 'b') {
y += h;
}
if (H === 'c') {
x += w / 2;
} else if (H === 'r') {
x += w;
}
return {
left: x,
top: y
};
}
exports['default'] = getAlignOffset;
module.exports = exports['default'];
/***/ },
/* 290 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _getAlignOffset = __webpack_require__(289);
var _getAlignOffset2 = _interopRequireDefault(_getAlignOffset);
function getElFuturePos(elRegion, refNodeRegion, points, offset, targetOffset) {
var xy = undefined;
var diff = undefined;
var p1 = undefined;
var p2 = undefined;
xy = {
left: elRegion.left,
top: elRegion.top
};
p1 = (0, _getAlignOffset2['default'])(refNodeRegion, points[1]);
p2 = (0, _getAlignOffset2['default'])(elRegion, points[0]);
diff = [p2.left - p1.left, p2.top - p1.top];
return {
left: xy.left - diff[0] + offset[0] - targetOffset[0],
top: xy.top - diff[1] + offset[1] - targetOffset[1]
};
}
exports['default'] = getElFuturePos;
module.exports = exports['default'];
/***/ },
/* 291 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _utils = __webpack_require__(36);
var _utils2 = _interopRequireDefault(_utils);
function getRegion(node) {
var offset = undefined;
var w = undefined;
var h = undefined;
if (!_utils2['default'].isWindow(node) && node.nodeType !== 9) {
offset = _utils2['default'].offset(node);
w = _utils2['default'].outerWidth(node);
h = _utils2['default'].outerHeight(node);
} else {
var win = _utils2['default'].getWindow(node);
offset = {
left: _utils2['default'].getWindowScrollLeft(win),
top: _utils2['default'].getWindowScrollTop(win)
};
w = _utils2['default'].viewportWidth(win);
h = _utils2['default'].viewportHeight(win);
}
offset.width = w;
offset.height = h;
return offset;
}
exports['default'] = getRegion;
module.exports = exports['default'];
/***/ },
/* 292 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _utils = __webpack_require__(36);
var _utils2 = _interopRequireDefault(_utils);
var _getOffsetParent = __webpack_require__(103);
var _getOffsetParent2 = _interopRequireDefault(_getOffsetParent);
/**
* 获得元素的显示部分的区域
*/
function getVisibleRectForElement(element) {
var visibleRect = {
left: 0,
right: Infinity,
top: 0,
bottom: Infinity
};
var el = (0, _getOffsetParent2['default'])(element);
var scrollX = undefined;
var scrollY = undefined;
var winSize = undefined;
var doc = element.ownerDocument;
var win = doc.defaultView || doc.parentWindow;
var body = doc.body;
var documentElement = doc.documentElement;
// Determine the size of the visible rect by climbing the dom accounting for
// all scrollable containers.
while (el) {
// clientWidth is zero for inline block elements in ie.
if ((navigator.userAgent.indexOf('MSIE') === -1 || el.clientWidth !== 0) &&
// body may have overflow set on it, yet we still get the entire
// viewport. In some browsers, el.offsetParent may be
// document.documentElement, so check for that too.
el !== body && el !== documentElement && _utils2['default'].css(el, 'overflow') !== 'visible') {
var pos = _utils2['default'].offset(el);
// add border
pos.left += el.clientLeft;
pos.top += el.clientTop;
visibleRect.top = Math.max(visibleRect.top, pos.top);
visibleRect.right = Math.min(visibleRect.right,
// consider area without scrollBar
pos.left + el.clientWidth);
visibleRect.bottom = Math.min(visibleRect.bottom, pos.top + el.clientHeight);
visibleRect.left = Math.max(visibleRect.left, pos.left);
} else if (el === body || el === documentElement) {
break;
}
el = (0, _getOffsetParent2['default'])(el);
}
// Clip by window's viewport.
scrollX = _utils2['default'].getWindowScrollLeft(win);
scrollY = _utils2['default'].getWindowScrollTop(win);
visibleRect.left = Math.max(visibleRect.left, scrollX);
visibleRect.top = Math.max(visibleRect.top, scrollY);
winSize = {
width: _utils2['default'].viewportWidth(win),
height: _utils2['default'].viewportHeight(win)
};
visibleRect.right = Math.min(visibleRect.right, scrollX + winSize.width);
visibleRect.bottom = Math.min(visibleRect.bottom, scrollY + winSize.height);
return visibleRect.top >= 0 && visibleRect.left >= 0 && visibleRect.bottom > visibleRect.top && visibleRect.right > visibleRect.left ? visibleRect : null;
}
exports['default'] = getVisibleRectForElement;
module.exports = exports['default'];
/***/ },
/* 293 */
/***/ function(module, exports, __webpack_require__) {
/**
* align dom node flexibly
* @author yiminghe@gmail.com
*/
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _utils = __webpack_require__(36);
var _utils2 = _interopRequireDefault(_utils);
var _getOffsetParent = __webpack_require__(103);
var _getOffsetParent2 = _interopRequireDefault(_getOffsetParent);
var _getVisibleRectForElement = __webpack_require__(292);
var _getVisibleRectForElement2 = _interopRequireDefault(_getVisibleRectForElement);
var _adjustForViewport = __webpack_require__(288);
var _adjustForViewport2 = _interopRequireDefault(_adjustForViewport);
var _getRegion = __webpack_require__(291);
var _getRegion2 = _interopRequireDefault(_getRegion);
var _getElFuturePos = __webpack_require__(290);
var _getElFuturePos2 = _interopRequireDefault(_getElFuturePos);
// http://yiminghe.iteye.com/blog/1124720
function isFailX(elFuturePos, elRegion, visibleRect) {
return elFuturePos.left < visibleRect.left || elFuturePos.left + elRegion.width > visibleRect.right;
}
function isFailY(elFuturePos, elRegion, visibleRect) {
return elFuturePos.top < visibleRect.top || elFuturePos.top + elRegion.height > visibleRect.bottom;
}
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 = undefined;
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', source.width() + newElRegion.width - elRegion.width);
}
if (newElRegion.height !== elRegion.height) {
_utils2['default'].css(source, 'height', source.height() + newElRegion.height - elRegion.height);
}
// https://github.com/kissyteam/kissy/issues/190
// http://localhost:8888/kissy/src/overlay/demo/other/relative_align/align.html
// 相对于屏幕位置没变,而 left/top 变了
// 例如
_utils2['default'].offset(source, {
left: newElRegion.left,
top: newElRegion.top
}, {
useCssRight: align.useCssRight,
useCssBottom: align.useCssBottom
});
return {
points: points,
offset: offset,
targetOffset: targetOffset,
overflow: newOverflowCfg
};
}
domAlign.__getOffsetParent = _getOffsetParent2['default'];
domAlign.__getVisibleRectForElement = _getVisibleRectForElement2['default'];
exports['default'] = domAlign;
/**
* 2012-04-26 yiminghe@gmail.com
* - 优化智能对齐算法
* - 慎用 resizeXX
*
* 2011-07-13 yiminghe@gmail.com note:
* - 增加智能对齐,以及大小调整选项
**/
module.exports = exports['default'];
/***/ },
/* 294 */
/***/ function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;/*!
* enquire.js v2.1.1 - Awesome Media Queries in JavaScript
* Copyright (c) 2014 Nick Williams - http://wicky.nillia.ms/enquire.js
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
*/
;(function (name, context, factory) {
var matchMedia = window.matchMedia;
if (typeof module !== 'undefined' && module.exports) {
module.exports = factory(matchMedia);
}
else if (true) {
!(__WEBPACK_AMD_DEFINE_RESULT__ = function() {
return (context[name] = factory(matchMedia));
}.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
}
else {
context[name] = factory(matchMedia);
}
}('enquire', this, function (matchMedia) {
'use strict';
/*jshint unused:false */
/**
* Helper function for iterating over a collection
*
* @param collection
* @param fn
*/
function each(collection, fn) {
var i = 0,
length = collection.length,
cont;
for(i; i < length; i++) {
cont = fn(collection[i], i);
if(cont === false) {
break; //allow early exit
}
}
}
/**
* Helper function for determining whether target object is an array
*
* @param target the object under test
* @return {Boolean} true if array, false otherwise
*/
function isArray(target) {
return Object.prototype.toString.apply(target) === '[object Array]';
}
/**
* Helper function for determining whether target object is a function
*
* @param target the object under test
* @return {Boolean} true if function, false otherwise
*/
function isFunction(target) {
return typeof target === 'function';
}
/**
* Delegate to handle a media query being matched and unmatched.
*
* @param {object} options
* @param {function} options.match callback for when the media query is matched
* @param {function} [options.unmatch] callback for when the media query is unmatched
* @param {function} [options.setup] one-time callback triggered the first time a query is matched
* @param {boolean} [options.deferSetup=false] should the setup callback be run immediately, rather than first time query is matched?
* @constructor
*/
function QueryHandler(options) {
this.options = options;
!options.deferSetup && this.setup();
}
QueryHandler.prototype = {
/**
* coordinates setup of the handler
*
* @function
*/
setup : function() {
if(this.options.setup) {
this.options.setup();
}
this.initialised = true;
},
/**
* coordinates setup and triggering of the handler
*
* @function
*/
on : function() {
!this.initialised && this.setup();
this.options.match && this.options.match();
},
/**
* coordinates the unmatch event for the handler
*
* @function
*/
off : function() {
this.options.unmatch && this.options.unmatch();
},
/**
* called when a handler is to be destroyed.
* delegates to the destroy or unmatch callbacks, depending on availability.
*
* @function
*/
destroy : function() {
this.options.destroy ? this.options.destroy() : this.off();
},
/**
* determines equality by reference.
* if object is supplied compare options, if function, compare match callback
*
* @function
* @param {object || function} [target] the target for comparison
*/
equals : function(target) {
return this.options === target || this.options.match === target;
}
};
/**
* Represents a single media query, manages it's state and registered handlers for this query
*
* @constructor
* @param {string} query the media query string
* @param {boolean} [isUnconditional=false] whether the media query should run regardless of whether the conditions are met. Primarily for helping older browsers deal with mobile-first design
*/
function MediaQuery(query, isUnconditional) {
this.query = query;
this.isUnconditional = isUnconditional;
this.handlers = [];
this.mql = matchMedia(query);
var self = this;
this.listener = function(mql) {
self.mql = mql;
self.assess();
};
this.mql.addListener(this.listener);
}
MediaQuery.prototype = {
/**
* add a handler for this query, triggering if already active
*
* @param {object} handler
* @param {function} handler.match callback for when query is activated
* @param {function} [handler.unmatch] callback for when query is deactivated
* @param {function} [handler.setup] callback for immediate execution when a query handler is registered
* @param {boolean} [handler.deferSetup=false] should the setup callback be deferred until the first time the handler is matched?
*/
addHandler : function(handler) {
var qh = new QueryHandler(handler);
this.handlers.push(qh);
this.matches() && qh.on();
},
/**
* removes the given handler from the collection, and calls it's destroy methods
*
* @param {object || function} handler the handler to remove
*/
removeHandler : function(handler) {
var handlers = this.handlers;
each(handlers, function(h, i) {
if(h.equals(handler)) {
h.destroy();
return !handlers.splice(i,1); //remove from array and exit each early
}
});
},
/**
* Determine whether the media query should be considered a match
*
* @return {Boolean} true if media query can be considered a match, false otherwise
*/
matches : function() {
return this.mql.matches || this.isUnconditional;
},
/**
* Clears all handlers and unbinds events
*/
clear : function() {
each(this.handlers, function(handler) {
handler.destroy();
});
this.mql.removeListener(this.listener);
this.handlers.length = 0; //clear array
},
/*
* Assesses the query, turning on all handlers if it matches, turning them off if it doesn't match
*/
assess : function() {
var action = this.matches() ? 'on' : 'off';
each(this.handlers, function(handler) {
handler[action]();
});
}
};
/**
* Allows for registration of query handlers.
* Manages the query handler's state and is responsible for wiring up browser events
*
* @constructor
*/
function MediaQueryDispatch () {
if(!matchMedia) {
throw new Error('matchMedia not present, legacy browsers require a polyfill');
}
this.queries = {};
this.browserIsIncapable = !matchMedia('only all').matches;
}
MediaQueryDispatch.prototype = {
/**
* Registers a handler for the given media query
*
* @param {string} q the media query
* @param {object || Array || Function} options either a single query handler object, a function, or an array of query handlers
* @param {function} options.match fired when query matched
* @param {function} [options.unmatch] fired when a query is no longer matched
* @param {function} [options.setup] fired when handler first triggered
* @param {boolean} [options.deferSetup=false] whether setup should be run immediately or deferred until query is first matched
* @param {boolean} [shouldDegrade=false] whether this particular media query should always run on incapable browsers
*/
register : function(q, options, shouldDegrade) {
var queries = this.queries,
isUnconditional = shouldDegrade && this.browserIsIncapable;
if(!queries[q]) {
queries[q] = new MediaQuery(q, isUnconditional);
}
//normalise to object in an array
if(isFunction(options)) {
options = { match : options };
}
if(!isArray(options)) {
options = [options];
}
each(options, function(handler) {
queries[q].addHandler(handler);
});
return this;
},
/**
* unregisters a query and all it's handlers, or a specific handler for a query
*
* @param {string} q the media query to target
* @param {object || function} [handler] specific handler to unregister
*/
unregister : function(q, handler) {
var query = this.queries[q];
if(query) {
if(handler) {
query.removeHandler(handler);
}
else {
query.clear();
delete this.queries[q];
}
}
return this;
}
};
return new MediaQueryDispatch();
}));
/***/ },
/* 295 */
/***/ function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ },
/* 296 */
295,
/* 297 */
295,
/* 298 */
295,
/* 299 */
295,
/* 300 */
295,
/* 301 */
295,
/* 302 */
295,
/* 303 */
295,
/* 304 */
295,
/* 305 */
295,
/* 306 */
295,
/* 307 */
295,
/* 308 */
295,
/* 309 */
295,
/* 310 */
295,
/* 311 */
295,
/* 312 */
295,
/* 313 */
295,
/* 314 */
295,
/* 315 */
295,
/* 316 */
295,
/* 317 */
295,
/* 318 */
295,
/* 319 */
295,
/* 320 */
295,
/* 321 */
295,
/* 322 */
295,
/* 323 */
295,
/* 324 */
295,
/* 325 */
295,
/* 326 */
295,
/* 327 */
295,
/* 328 */
295,
/* 329 */
295,
/* 330 */
295,
/* 331 */
295,
/* 332 */
295,
/* 333 */
295,
/* 334 */
295,
/* 335 */
295,
/* 336 */
295,
/* 337 */
295,
/* 338 */
295,
/* 339 */
295,
/* 340 */
295,
/* 341 */
/***/ 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.
*
* @typechecks
*/
var _hyphenPattern = /-(.)/g;
/**
* Camelcases a hyphenated string, for example:
*
* > camelize('background-color')
* < "backgroundColor"
*
* @param {string} string
* @return {string}
*/
function camelize(string) {
return string.replace(_hyphenPattern, function (_, character) {
return character.toUpperCase();
});
}
module.exports = camelize;
/***/ },
/* 342 */
/***/ 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.
*
* @typechecks
*/
'use strict';
var camelize = __webpack_require__(341);
var msPattern = /^-ms-/;
/**
* Camelcases a hyphenated CSS property name, for example:
*
* > camelizeStyleName('background-color')
* < "backgroundColor"
* > camelizeStyleName('-moz-transition')
* < "MozTransition"
* > camelizeStyleName('-ms-transition')
* < "msTransition"
*
* As Andi Smith suggests
* (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
* is converted to lowercase `ms`.
*
* @param {string} string
* @return {string}
*/
function camelizeStyleName(string) {
return camelize(string.replace(msPattern, 'ms-'));
}
module.exports = camelizeStyleName;
/***/ },
/* 343 */
/***/ 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;
/***/ },
/* 344 */
/***/ 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.
*
* @typechecks
*/
var _uppercasePattern = /([A-Z])/g;
/**
* Hyphenates a camelcased string, for example:
*
* > hyphenate('backgroundColor')
* < "background-color"
*
* For CSS style names, use `hyphenateStyleName` instead which works properly
* with all vendor prefixes, including `ms`.
*
* @param {string} string
* @return {string}
*/
function hyphenate(string) {
return string.replace(_uppercasePattern, '-$1').toLowerCase();
}
module.exports = hyphenate;
/***/ },
/* 345 */
/***/ 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.
*
* @typechecks
*/
'use strict';
var hyphenate = __webpack_require__(344);
var msPattern = /^ms-/;
/**
* Hyphenates a camelcased CSS property name, for example:
*
* > hyphenateStyleName('backgroundColor')
* < "background-color"
* > hyphenateStyleName('MozTransition')
* < "-moz-transition"
* > hyphenateStyleName('msTransition')
* < "-ms-transition"
*
* As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
* is converted to `-ms-`.
*
* @param {string} string
* @return {string}
*/
function hyphenateStyleName(string) {
return hyphenate(string).replace(msPattern, '-ms-');
}
module.exports = hyphenateStyleName;
/***/ },
/* 346 */
/***/ 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__(44);
/**
* 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;
/***/ },
/* 347 */
/***/ function(module, exports) {
/**
* 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.
*
*
* @typechecks static-only
*/
'use strict';
/**
* Memoizes the return value of a function that accepts one string argument.
*/
function memoizeStringOnly(callback) {
var cache = {};
return function (string) {
if (!cache.hasOwnProperty(string)) {
cache[string] = callback.call(this, string);
}
return cache[string];
};
}
module.exports = memoizeStringOnly;
/***/ },
/* 348 */
/***/ 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.
*
* @typechecks
*/
'use strict';
var ExecutionEnvironment = __webpack_require__(37);
var performance;
if (ExecutionEnvironment.canUseDOM) {
performance = window.performance || window.msPerformance || window.webkitPerformance;
}
module.exports = performance || {};
/***/ },
/* 349 */
/***/ function(module, exports, __webpack_require__) {
'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.
*
* @typechecks
*/
var performance = __webpack_require__(348);
var performanceNow;
/**
* Detect if we can use `window.performance.now()` and gracefully fallback to
* `Date.now()` if it doesn't exist. We need to support Firefox < 15 for now
* because of Facebook's testing infrastructure.
*/
if (performance.now) {
performanceNow = function performanceNow() {
return performance.now();
};
} else {
performanceNow = function performanceNow() {
return Date.now();
};
}
module.exports = performanceNow;
/***/ },
/* 350 */
/***/ function(module, exports) {
/**
* 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.
*
* @typechecks
*
*/
/*eslint-disable no-self-compare */
'use strict';
var hasOwnProperty = Object.prototype.hasOwnProperty;
/**
* 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
*/
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;
}
}
/**
* Performs equality by iterating through keys on an object and returning false
* when any key has values which are not strictly equal between the arguments.
* Returns true when the values of all keys are strictly equal.
*/
function shallowEqual(objA, objB) {
if (is(objA, objB)) {
return true;
}
if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
return false;
}
var keysA = Object.keys(objA);
var keysB = Object.keys(objB);
if (keysA.length !== keysB.length) {
return false;
}
// Test for A's keys different from B.
for (var i = 0; i < keysA.length; i++) {
if (!hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
return false;
}
}
return true;
}
module.exports = shallowEqual;
/***/ },
/* 351 */
/***/ function(module, exports) {
/*!
* for-in
*
* Copyright (c) 2014-2016, Jon Schlinkert.
* Licensed under the MIT License.
*/
'use strict';
module.exports = function forIn(o, fn, thisArg) {
for (var key in o) {
if (fn.call(thisArg, o[key], key, o) === false) {
break;
}
}
};
/***/ },
/* 352 */
/***/ 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');
/***/ },
/* 353 */
/***/ 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');
};
/***/ },
/* 354 */
/***/ function(module, exports) {
/*!
* isobject
*
* Copyright (c) 2014 Jon Schlinkert, contributors.
* Licensed under the MIT License
*/
'use strict';
/**
* is the value an object, and not an array?
*
* @param {*} `value`
* @return {Boolean}
*/
module.exports = function isObject(o) {
return o != null && typeof o === 'object'
&& !Array.isArray(o);
};
/***/ },
/* 355 */
/***/ 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;
/***/ },
/* 356 */
/***/ 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]';
/**
* 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 accessor function.
*/
function baseProperty(key) {
return function(object) {
return object == null ? undefined : object[key];
};
}
/** 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/6.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
/** Built-in value references. */
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
/**
* 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 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 incorrectly 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(getLength(value)) && !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 which returns 'object' for typed array and weak map constructors,
// and PhantomJS 1.9 which returns 'function' for `NodeList` instances.
var tag = isObject(value) ? objectToString.call(value) : '';
return tag == funcTag || tag == genTag;
}
/**
* Checks if `value` is a valid array-like length.
*
* **Note:** This function is loosely based on
* [`ToLength`](http://ecma-international.org/ecma-262/6.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/6.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;
/***/ },
/* 357 */
/***/ 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;
/***/ },
/* 358 */
/***/ 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__(355),
isArguments = __webpack_require__(356),
isArray = __webpack_require__(357);
/** 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;
/***/ },
/* 359 */
/***/ function(module, exports, __webpack_require__) {
/*!
* object.omit
*
* Copyright (c) 2014-2015 Jon Schlinkert.
* Licensed under the MIT License
*/
'use strict';
var isObject = __webpack_require__(354);
var forOwn = __webpack_require__(105);
module.exports = function omit(obj, props) {
if (obj == null || !isObject(obj)) {
return {};
}
if (props == null) {
return obj;
}
if (typeof props === 'string') {
props = [].slice.call(arguments, 1);
}
var o = {};
if (!Object.keys(obj).length) {
return o;
}
forOwn(obj, function (value, key) {
if (props.indexOf(key) === -1) {
o[key] = value;
}
});
return o;
};
/***/ },
/* 360 */
/***/ function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (root, factory){
'use strict';
/*istanbul ignore next:cant test*/
if (typeof module === 'object' && typeof module.exports === 'object') {
module.exports = factory();
} else if (true) {
// AMD. Register as an anonymous module.
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {
// Browser globals
root.objectPath = factory();
}
})(this, function(){
'use strict';
var
toStr = Object.prototype.toString,
_hasOwnProperty = Object.prototype.hasOwnProperty;
function isEmpty(value){
if (!value) {
return true;
}
if (isArray(value) && value.length === 0) {
return true;
} else if (typeof value !== 'string') {
for (var i in value) {
if (_hasOwnProperty.call(value, i)) {
return false;
}
}
return true;
}
return false;
}
function toString(type){
return toStr.call(type);
}
function isObject(obj){
return typeof obj === 'object' && toString(obj) === "[object Object]";
}
var isArray = Array.isArray || function(obj){
/*istanbul ignore next:cant test*/
return toStr.call(obj) === '[object Array]';
}
function isBoolean(obj){
return typeof obj === 'boolean' || toString(obj) === '[object Boolean]';
}
function getKey(key){
var intKey = parseInt(key);
if (intKey.toString() === key) {
return intKey;
}
return key;
}
function factory(options) {
options = options || {}
var objectPath = function(obj) {
return Object.keys(objectPath).reduce(function(proxy, prop) {
if(prop === 'create') {
return proxy;
}
/*istanbul ignore else*/
if (typeof objectPath[prop] === 'function') {
proxy[prop] = objectPath[prop].bind(objectPath, obj);
}
return proxy;
}, {});
};
function getShallowProperty(obj, prop) {
if (options.includeInheritedProps || (typeof prop === 'number' && Array.isArray(obj)) || _hasOwnProperty.call(obj, prop)) {
return obj[prop];
}
}
function set(obj, path, value, doNotReplace){
if (typeof path === 'number') {
path = [path];
}
if (!path || path.length === 0) {
return obj;
}
if (typeof path === 'string') {
return set(obj, path.split('.').map(getKey), value, doNotReplace);
}
var currentPath = path[0];
var currentValue = getShallowProperty(obj, currentPath);
if (path.length === 1) {
if (currentValue === void 0 || !doNotReplace) {
obj[currentPath] = value;
}
return currentValue;
}
if (currentValue === void 0) {
//check if we assume an array
if(typeof path[1] === 'number') {
obj[currentPath] = [];
} else {
obj[currentPath] = {};
}
}
return set(obj[currentPath], path.slice(1), value, doNotReplace);
}
objectPath.has = function (obj, path) {
if (obj == null) {
return false;
}
if (typeof path === 'number') {
path = [path];
} else if (typeof path === 'string') {
path = path.split('.');
}
if (!path || path.length === 0) {
return false;
}
for (var i = 0; i < path.length; i++) {
var j = getKey(path[i]);
if((typeof j === 'number' && isArray(obj) && j < obj.length) ||
(options.includeInheritedProps ? (j in Object(obj)) : _hasOwnProperty.call(obj, j))) {
obj = obj[j];
} else {
return false;
}
}
return true;
};
objectPath.ensureExists = function (obj, path, value){
return set(obj, path, value, true);
};
objectPath.set = function (obj, path, value, doNotReplace){
return set(obj, path, value, doNotReplace);
};
objectPath.insert = function (obj, path, value, at){
var arr = objectPath.get(obj, path);
at = ~~at;
if (!isArray(arr)) {
arr = [];
objectPath.set(obj, path, arr);
}
arr.splice(at, 0, value);
};
objectPath.empty = function(obj, path) {
if (isEmpty(path)) {
return void 0;
}
if (obj == null) {
return void 0;
}
var value, i;
if (!(value = objectPath.get(obj, path))) {
return void 0;
}
if (typeof value === 'string') {
return objectPath.set(obj, path, '');
} else if (isBoolean(value)) {
return objectPath.set(obj, path, false);
} else if (typeof value === 'number') {
return objectPath.set(obj, path, 0);
} else if (isArray(value)) {
value.length = 0;
} else if (isObject(value)) {
for (i in value) {
if (_hasOwnProperty.call(value, i)) {
delete value[i];
}
}
} else {
return objectPath.set(obj, path, null);
}
};
objectPath.push = function (obj, path /*, values */){
var arr = objectPath.get(obj, path);
if (!isArray(arr)) {
arr = [];
objectPath.set(obj, path, arr);
}
arr.push.apply(arr, Array.prototype.slice.call(arguments, 2));
};
objectPath.coalesce = function (obj, paths, defaultValue) {
var value;
for (var i = 0, len = paths.length; i < len; i++) {
if ((value = objectPath.get(obj, paths[i])) !== void 0) {
return value;
}
}
return defaultValue;
};
objectPath.get = function (obj, path, defaultValue){
if (typeof path === 'number') {
path = [path];
}
if (!path || path.length === 0) {
return obj;
}
if (obj == null) {
return defaultValue;
}
if (typeof path === 'string') {
return objectPath.get(obj, path.split('.'), defaultValue);
}
var currentPath = getKey(path[0]);
var nextObj = getShallowProperty(obj, currentPath)
if (nextObj === void 0) {
return defaultValue;
}
if (path.length === 1) {
return nextObj;
}
return objectPath.get(obj[currentPath], path.slice(1), defaultValue);
};
objectPath.del = function del(obj, path) {
if (typeof path === 'number') {
path = [path];
}
if (obj == null) {
return obj;
}
if (isEmpty(path)) {
return obj;
}
if(typeof path === 'string') {
return objectPath.del(obj, path.split('.'));
}
var currentPath = getKey(path[0]);
var currentVal = getShallowProperty(obj, currentPath);
if(currentVal == null) {
return currentVal;
}
if(path.length === 1) {
if (isArray(obj)) {
obj.splice(currentPath, 1);
} else {
delete obj[currentPath];
}
} else {
if (obj[currentPath] !== void 0) {
return objectPath.del(obj[currentPath], path.slice(1));
}
}
return obj;
}
return objectPath;
}
var mod = factory();
mod.create = factory;
mod.withInheritedProps = factory({includeInheritedProps: true})
return mod;
});
/***/ },
/* 361 */
/***/ function(module, exports, __webpack_require__) {
/*!
* object.omit
*
* Copyright (c) 2014-2015, Jon Schlinkert.
* Licensed under the MIT License.
*/
'use strict';
var isObject = __webpack_require__(353);
var forOwn = __webpack_require__(105);
module.exports = function omit(obj, keys) {
if (!isObject(obj)) return {};
var 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;
};
/***/ },
/* 362 */
/***/ 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__(9);
var _reactDom2 = _interopRequireDefault(_reactDom);
var _domAlign = __webpack_require__(293);
var _domAlign2 = _interopRequireDefault(_domAlign);
var _addEventListener = __webpack_require__(46);
var _addEventListener2 = _interopRequireDefault(_addEventListener);
var _isWindow = __webpack_require__(364);
var _isWindow2 = _interopRequireDefault(_isWindow);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
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 = _react2["default"].createClass({
displayName: 'Align',
propTypes: {
childrenProps: _react.PropTypes.object,
align: _react.PropTypes.object.isRequired,
target: _react.PropTypes.func,
onAlign: _react.PropTypes.func,
monitorBufferTime: _react.PropTypes.number,
monitorWindowResize: _react.PropTypes.bool,
disabled: _react.PropTypes.bool,
children: _react.PropTypes.any
},
getDefaultProps: function getDefaultProps() {
return {
target: function target() {
return window;
},
onAlign: function onAlign() {},
monitorBufferTime: 50,
monitorWindowResize: false,
disabled: false
};
},
componentDidMount: function componentDidMount() {
var props = this.props;
// if parent ref not attached .... use document.getElementById
this.forceAlign();
if (!props.disabled && props.monitorWindowResize) {
this.startMonitorWindowResize();
}
},
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();
}
},
componentWillUnmount: function componentWillUnmount() {
this.stopMonitorWindowResize();
},
startMonitorWindowResize: function startMonitorWindowResize() {
if (!this.resizeHandler) {
this.bufferMonitor = buffer(this.forceAlign, this.props.monitorBufferTime);
this.resizeHandler = (0, _addEventListener2["default"])(window, 'resize', this.bufferMonitor);
}
},
stopMonitorWindowResize: function stopMonitorWindowResize() {
if (this.resizeHandler) {
this.bufferMonitor.clear();
this.resizeHandler.remove();
this.resizeHandler = null;
}
},
forceAlign: function forceAlign() {
var props = this.props;
if (!props.disabled) {
var source = _reactDom2["default"].findDOMNode(this);
props.onAlign(source, (0, _domAlign2["default"])(source, props.target(), props.align));
}
},
render: function render() {
var _props = this.props;
var childrenProps = _props.childrenProps;
var children = _props.children;
var child = _react2["default"].Children.only(children);
if (childrenProps) {
var newProps = {};
for (var prop in childrenProps) {
if (childrenProps.hasOwnProperty(prop)) {
newProps[prop] = this.props[childrenProps[prop]];
}
}
return _react2["default"].cloneElement(child, newProps);
}
return child;
}
});
exports["default"] = Align;
module.exports = exports['default'];
/***/ },
/* 363 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _Align = __webpack_require__(362);
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'];
/***/ },
/* 364 */
/***/ 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'];
/***/ },
/* 365 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _ChildrenUtils = __webpack_require__(367);
var _AnimateChild = __webpack_require__(366);
var _AnimateChild2 = _interopRequireDefault(_AnimateChild);
var _util = __webpack_require__(108);
var _util2 = _interopRequireDefault(_util);
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 defaultKey = 'rc_animate_' + Date.now();
function getChildrenFromProps(props) {
var children = props.children;
if (_react2["default"].isValidElement(children)) {
if (!children.key) {
return _react2["default"].cloneElement(children, {
key: defaultKey
});
}
}
return children;
}
function noop() {}
var Animate = _react2["default"].createClass({
displayName: 'Animate',
propTypes: {
component: _react2["default"].PropTypes.any,
animation: _react2["default"].PropTypes.object,
transitionName: _react2["default"].PropTypes.oneOfType([_react2["default"].PropTypes.string, _react2["default"].PropTypes.object]),
transitionEnter: _react2["default"].PropTypes.bool,
transitionAppear: _react2["default"].PropTypes.bool,
exclusive: _react2["default"].PropTypes.bool,
transitionLeave: _react2["default"].PropTypes.bool,
onEnd: _react2["default"].PropTypes.func,
onEnter: _react2["default"].PropTypes.func,
onLeave: _react2["default"].PropTypes.func,
onAppear: _react2["default"].PropTypes.func,
showProp: _react2["default"].PropTypes.string
},
getDefaultProps: function getDefaultProps() {
return {
animation: {},
component: 'span',
transitionEnter: true,
transitionLeave: true,
transitionAppear: false,
onEnd: noop,
onEnter: noop,
onLeave: noop,
onAppear: noop
};
},
getInitialState: function getInitialState() {
this.currentlyAnimatingKeys = {};
this.keysToEnter = [];
this.keysToLeave = [];
return {
children: (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(this.props))
};
},
componentDidMount: function componentDidMount() {
var _this = this;
var showProp = this.props.showProp;
var children = this.state.children;
if (showProp) {
children = children.filter(function (child) {
return !!child.props[showProp];
});
}
children.forEach(function (child) {
if (child) {
_this.performAppear(child.key);
}
});
},
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
var _this2 = 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) {
_this2.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) {
_this2.keysToEnter.push(key);
}
} else if (showInNext) {
_this2.keysToEnter.push(key);
}
} else if (!hasPrev) {
_this2.keysToEnter.push(key);
}
});
currentChildren.forEach(function (child) {
var key = child && 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) {
_this2.keysToLeave.push(key);
}
} else if (showInNow) {
_this2.keysToLeave.push(key);
}
} else if (!hasNext) {
_this2.keysToLeave.push(key);
}
});
},
componentDidUpdate: function componentDidUpdate() {
var keysToEnter = this.keysToEnter;
this.keysToEnter = [];
keysToEnter.forEach(this.performEnter);
var keysToLeave = this.keysToLeave;
this.keysToLeave = [];
keysToLeave.forEach(this.performLeave);
},
performEnter: function performEnter(key) {
// may already remove by exclusive
if (this.refs[key]) {
this.currentlyAnimatingKeys[key] = true;
this.refs[key].componentWillEnter(this.handleDoneAdding.bind(this, key, 'enter'));
}
},
performAppear: function performAppear(key) {
if (this.refs[key]) {
this.currentlyAnimatingKeys[key] = true;
this.refs[key].componentWillAppear(this.handleDoneAdding.bind(this, key, 'appear'));
}
},
handleDoneAdding: function handleDoneAdding(key, type) {
var props = this.props;
delete this.currentlyAnimatingKeys[key];
// if update on exclusive mode, skip check
if (props.exclusive && props !== this.nextProps) {
return;
}
var currentChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props));
if (!this.isValidChildByKey(currentChildren, key)) {
// exclusive will not need this
this.performLeave(key);
} else {
if (type === 'appear') {
if (_util2["default"].allowAppearCallback(props)) {
props.onAppear(key);
props.onEnd(key, true);
}
} else {
if (_util2["default"].allowEnterCallback(props)) {
props.onEnter(key);
props.onEnd(key, true);
}
}
}
},
performLeave: function performLeave(key) {
// may already remove by exclusive
if (this.refs[key]) {
this.currentlyAnimatingKeys[key] = true;
this.refs[key].componentWillLeave(this.handleDoneLeaving.bind(this, key));
}
},
handleDoneLeaving: function handleDoneLeaving(key) {
var props = this.props;
delete this.currentlyAnimatingKeys[key];
// if update on exclusive mode, skip check
if (props.exclusive && props !== this.nextProps) {
return;
}
var currentChildren = (0, _ChildrenUtils.toArrayChildren)(getChildrenFromProps(props));
// in case state change is too fast
if (this.isValidChildByKey(currentChildren, key)) {
this.performEnter(key);
} else {
var end = function end() {
if (_util2["default"].allowLeaveCallback(props)) {
props.onLeave(key);
props.onEnd(key, false);
}
};
/* eslint react/no-is-mounted:0 */
if (this.isMounted() && !(0, _ChildrenUtils.isSameChildren)(this.state.children, currentChildren, props.showProp)) {
this.setState({
children: currentChildren
}, end);
} else {
end();
}
}
},
isValidChildByKey: function isValidChildByKey(currentChildren, key) {
var showProp = this.props.showProp;
if (showProp) {
return (0, _ChildrenUtils.findShownChildInChildrenByKey)(currentChildren, key, showProp);
}
return (0, _ChildrenUtils.findChildInChildrenByKey)(currentChildren, key);
},
stop: function stop(key) {
delete this.currentlyAnimatingKeys[key];
var component = this.refs[key];
if (component) {
component.stop();
}
},
render: function render() {
var props = this.props;
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 = {
className: props.className,
style: props.style
};
}
return _react2["default"].createElement(
Component,
passedProps,
children
);
}
return children[0] || null;
}
});
exports["default"] = Animate;
module.exports = exports['default'];
/***/ },
/* 366 */
/***/ 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 ? "symbol" : typeof obj; };
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _reactDom = __webpack_require__(9);
var _reactDom2 = _interopRequireDefault(_reactDom);
var _cssAnimation = __webpack_require__(102);
var _cssAnimation2 = _interopRequireDefault(_cssAnimation);
var _util = __webpack_require__(108);
var _util2 = _interopRequireDefault(_util);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var transitionMap = {
enter: 'transitionEnter',
appear: 'transitionAppear',
leave: 'transitionLeave'
};
var AnimateChild = _react2["default"].createClass({
displayName: 'AnimateChild',
propTypes: {
children: _react2["default"].PropTypes.any
},
componentWillUnmount: function componentWillUnmount() {
this.stop();
},
componentWillEnter: function componentWillEnter(done) {
if (_util2["default"].isEnterSupported(this.props)) {
this.transition('enter', done);
} else {
done();
}
},
componentWillAppear: function componentWillAppear(done) {
if (_util2["default"].isAppearSupported(this.props)) {
this.transition('appear', done);
} else {
done();
}
},
componentWillLeave: function componentWillLeave(done) {
if (_util2["default"].isLeaveSupported(this.props)) {
this.transition('leave', done);
} else {
// always sync, do not interupt with react component life cycle
// update hidden -> animate hidden ->
// didUpdate -> animate leave -> unmount (if animate is none)
done();
}
},
transition: function transition(animationType, finishCallback) {
var _this = 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() {
_this.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);
}
},
stop: function stop() {
var stopper = this.stopper;
if (stopper) {
this.stopper = null;
stopper.stop();
}
},
render: function render() {
return this.props.children;
}
});
exports["default"] = AnimateChild;
module.exports = exports['default'];
/***/ },
/* 367 */
/***/ 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;
}
/***/ },
/* 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; };
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _reactAddonsPureRenderMixin = __webpack_require__(416);
var _reactAddonsPureRenderMixin2 = _interopRequireDefault(_reactAddonsPureRenderMixin);
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 _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));
_this.handleFocus = function (e) {
_this.setState({ focus: true });
_this.props.onFocus(e);
};
_this.handleBlur = function (e) {
_this.setState({ focus: false });
_this.props.onBlur(e);
};
_this.handleChange = function (e) {
if (!('checked' in _this.props)) {
_this.setState({
checked: e.target.checked
});
}
_this.props.onChange({
target: _extends({}, _this.props, {
checked: e.target.checked
}),
stopPropagation: function stopPropagation() {
e.stopPropagation();
},
preventDefault: function preventDefault() {
e.preventDefault();
}
});
};
var checked = false;
if ('checked' in props) {
checked = props.checked;
} else {
checked = props.defaultChecked;
}
_this.state = {
checked: checked,
focus: false
};
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 _reactAddonsPureRenderMixin2["default"].shouldComponentUpdate.apply(this, args);
};
Checkbox.prototype.render = function render() {
var _classNames;
var props = _extends({}, this.props);
// Remove React warning.
// Warning: Input elements must be either controlled or uncontrolled
// (specify either the value prop, or the defaultValue prop, but not both).
delete props.defaultChecked;
var state = this.state;
var prefixCls = props.prefixCls;
var checked = state.checked;
if (typeof checked === 'boolean') {
checked = checked ? 1 : 0;
}
var className = (0, _classnames2["default"])((_classNames = {}, _defineProperty(_classNames, props.className, !!props.className), _defineProperty(_classNames, prefixCls, 1), _defineProperty(_classNames, prefixCls + '-checked', checked), _defineProperty(_classNames, prefixCls + '-checked-' + checked, !!checked), _defineProperty(_classNames, prefixCls + '-focused', state.focus), _defineProperty(_classNames, prefixCls + '-disabled', props.disabled), _classNames));
return _react2["default"].createElement(
'span',
{
className: className,
style: props.style
},
_react2["default"].createElement('span', { className: prefixCls + '-inner' }),
_react2["default"].createElement('input', {
name: props.name,
type: props.type,
readOnly: props.readOnly,
disabled: props.disabled,
className: prefixCls + '-input',
checked: !!checked,
onClick: this.props.onClick,
onFocus: this.handleFocus,
onBlur: this.handleBlur,
onChange: this.handleChange
})
);
};
return Checkbox;
}(_react2["default"].Component);
Checkbox.propTypes = {
name: _react2["default"].PropTypes.string,
prefixCls: _react2["default"].PropTypes.string,
style: _react2["default"].PropTypes.object,
type: _react2["default"].PropTypes.string,
className: _react2["default"].PropTypes.string,
defaultChecked: _react2["default"].PropTypes.oneOfType([_react2["default"].PropTypes.number, _react2["default"].PropTypes.bool]),
checked: _react2["default"].PropTypes.oneOfType([_react2["default"].PropTypes.number, _react2["default"].PropTypes.bool]),
onFocus: _react2["default"].PropTypes.func,
onBlur: _react2["default"].PropTypes.func,
onChange: _react2["default"].PropTypes.func,
onClick: _react2["default"].PropTypes.func
};
Checkbox.defaultProps = {
prefixCls: 'rc-checkbox',
style: {},
type: 'checkbox',
className: '',
defaultChecked: false,
onFocus: function onFocus() {},
onBlur: function onBlur() {},
onChange: function onChange() {}
};
exports["default"] = Checkbox;
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 }; }
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); } }
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _Panel = __webpack_require__(370);
var _Panel2 = _interopRequireDefault(_Panel);
var _openAnimationFactory = __webpack_require__(373);
var _openAnimationFactory2 = _interopRequireDefault(_openAnimationFactory);
function toArray(activeKey) {
var currentActiveKey = activeKey;
if (!Array.isArray(currentActiveKey)) {
currentActiveKey = currentActiveKey ? [currentActiveKey] : [];
}
return currentActiveKey;
}
var Collapse = _react2['default'].createClass({
displayName: 'Collapse',
propTypes: {
children: _react.PropTypes.any,
prefixCls: _react.PropTypes.string,
activeKey: _react.PropTypes.oneOfType([_react.PropTypes.string, _react.PropTypes.arrayOf(_react.PropTypes.string)]),
defaultActiveKey: _react.PropTypes.oneOfType([_react.PropTypes.string, _react.PropTypes.arrayOf(_react.PropTypes.string)]),
openAnimation: _react.PropTypes.object,
onChange: _react.PropTypes.func,
accordion: _react.PropTypes.bool
},
statics: {
Panel: _Panel2['default']
},
getDefaultProps: function getDefaultProps() {
return {
prefixCls: 'rc-collapse',
onChange: function onChange() {},
accordion: false
};
},
getInitialState: function getInitialState() {
var _props = this.props;
var activeKey = _props.activeKey;
var defaultActiveKey = _props.defaultActiveKey;
var currentActiveKey = defaultActiveKey;
if ('activeKey' in this.props) {
currentActiveKey = activeKey;
}
return {
openAnimation: this.props.openAnimation || (0, _openAnimationFactory2['default'])(this.props.prefixCls),
activeKey: toArray(currentActiveKey)
};
},
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
if ('activeKey' in nextProps) {
this.setState({
activeKey: toArray(nextProps.activeKey)
});
}
if ('openAnimation' in nextProps) {
this.setState({
openAnimation: nextProps.openAnimation
});
}
},
onClickItem: function onClickItem(key) {
var _this = this;
return function () {
var activeKey = _this.state.activeKey;
if (_this.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);
}
}
_this.setActiveKey(activeKey);
};
},
getItems: function getItems() {
var _this2 = this;
var activeKey = this.state.activeKey;
var _props2 = this.props;
var prefixCls = _props2.prefixCls;
var accordion = _props2.accordion;
return _react.Children.map(this.props.children, function (child, index) {
// 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,
openAnimation: _this2.state.openAnimation,
children: child.props.children,
onItemClick: _this2.onClickItem(key).bind(_this2)
};
return _react2['default'].cloneElement(child, props);
});
},
setActiveKey: function setActiveKey(activeKey) {
if (!('activeKey' in this.props)) {
this.setState({
activeKey: activeKey
});
}
this.props.onChange(this.props.accordion ? activeKey[0] : activeKey);
},
render: function render() {
var prefixCls = this.props.prefixCls;
return _react2['default'].createElement(
'div',
{ className: prefixCls },
this.getItems()
);
}
});
exports['default'] = Collapse;
module.exports = exports['default'];
/***/ },
/* 370 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var _PanelContent = __webpack_require__(371);
var _PanelContent2 = _interopRequireDefault(_PanelContent);
var _rcAnimate = __webpack_require__(31);
var _rcAnimate2 = _interopRequireDefault(_rcAnimate);
var CollapsePanel = _react2['default'].createClass({
displayName: 'CollapsePanel',
propTypes: {
className: _react.PropTypes.oneOfType([_react.PropTypes.string, _react.PropTypes.object]),
children: _react.PropTypes.any,
openAnimation: _react.PropTypes.object,
prefixCls: _react.PropTypes.string,
header: _react.PropTypes.oneOfType([_react.PropTypes.string, _react.PropTypes.number, _react.PropTypes.node]),
isActive: _react.PropTypes.bool,
onItemClick: _react.PropTypes.func
},
getDefaultProps: function getDefaultProps() {
return {
isActive: false,
onItemClick: function onItemClick() {}
};
},
handleItemClick: function handleItemClick() {
this.props.onItemClick();
},
render: function render() {
var _classNames;
var _props = this.props;
var className = _props.className;
var prefixCls = _props.prefixCls;
var header = _props.header;
var children = _props.children;
var isActive = _props.isActive;
var headerCls = prefixCls + '-header';
var itemCls = (0, _classnames2['default'])((_classNames = {}, _defineProperty(_classNames, prefixCls + '-item', true), _defineProperty(_classNames, prefixCls + '-item-active', isActive), _defineProperty(_classNames, className, className), _classNames));
return _react2['default'].createElement(
'div',
{ className: itemCls },
_react2['default'].createElement(
'div',
{
className: headerCls,
onClick: this.handleItemClick,
role: 'tab',
'aria-expanded': isActive
},
_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 },
children
)
)
);
}
});
exports['default'] = CollapsePanel;
module.exports = exports['default'];
/***/ },
/* 371 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _classnames2 = __webpack_require__(5);
var _classnames3 = _interopRequireDefault(_classnames2);
var PanelContent = _react2['default'].createClass({
displayName: 'PanelContent',
propTypes: {
prefixCls: _react.PropTypes.string,
isActive: _react.PropTypes.bool,
children: _react.PropTypes.any
},
shouldComponentUpdate: function shouldComponentUpdate(nextProps) {
return this.props.isActive || nextProps.isActive;
},
render: function render() {
var _classnames;
this._isActived = this._isActived || this.props.isActive;
if (!this._isActived) {
return null;
}
var _props = this.props;
var prefixCls = _props.prefixCls;
var isActive = _props.isActive;
var children = _props.children;
var contentCls = (0, _classnames3['default'])((_classnames = {}, _defineProperty(_classnames, prefixCls + '-content', true), _defineProperty(_classnames, prefixCls + '-content-active', isActive), _defineProperty(_classnames, prefixCls + '-content-inactive', !isActive), _classnames));
return _react2['default'].createElement(
'div',
{
className: contentCls,
role: 'tabpanel'
},
_react2['default'].createElement(
'div',
{ className: prefixCls + '-content-box' },
children
)
);
}
});
exports['default'] = PanelContent;
module.exports = exports['default'];
/***/ },
/* 372 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _Collapse = __webpack_require__(369);
var _Collapse2 = _interopRequireDefault(_Collapse);
exports['default'] = _Collapse2['default'];
module.exports = exports['default'];
/***/ },
/* 373 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _cssAnimation = __webpack_require__(102);
var _cssAnimation2 = _interopRequireDefault(_cssAnimation);
function animate(node, show, transitionName, done) {
var height = undefined;
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'];
/***/ },
/* 374 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = __webpack_require__(8);
var _extends3 = _interopRequireDefault(_extends2);
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _reactDom = __webpack_require__(9);
var _reactDom2 = _interopRequireDefault(_reactDom);
var _KeyCode = __webpack_require__(414);
var _KeyCode2 = _interopRequireDefault(_KeyCode);
var _rcAnimate = __webpack_require__(31);
var _rcAnimate2 = _interopRequireDefault(_rcAnimate);
var _LazyRenderBox = __webpack_require__(376);
var _LazyRenderBox2 = _interopRequireDefault(_LazyRenderBox);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var uuid = 0;
var openCount = 0;
// Measure scrollbar width for padding body during modal show/hide
var scrollbarMeasure = {
position: 'absolute',
top: '-9999px',
width: '50px',
height: '50px',
overflow: 'scroll'
};
/* 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, 1);
return pos;
}
var Dialog = _react2["default"].createClass({
displayName: 'Dialog',
propTypes: {
className: _react.PropTypes.string,
keyboard: _react.PropTypes.bool,
style: _react.PropTypes.object,
mask: _react.PropTypes.bool,
children: _react.PropTypes.any,
onAfterClose: _react.PropTypes.func,
onClose: _react.PropTypes.func,
closable: _react.PropTypes.bool,
maskClosable: _react.PropTypes.bool,
visible: _react.PropTypes.bool,
mousePosition: _react.PropTypes.object,
wrapStyle: _react.PropTypes.object,
maskStyle: _react.PropTypes.object,
prefixCls: _react.PropTypes.string,
wrapClassName: _react.PropTypes.string
},
getDefaultProps: function getDefaultProps() {
return {
onAfterClose: noop,
className: '',
mask: true,
visible: false,
keyboard: true,
closable: true,
maskClosable: true,
prefixCls: 'rc-dialog',
onClose: noop
};
},
componentWillMount: function componentWillMount() {
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.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) {
if (props.mask && this.lastOutSideFocusNode) {
try {
this.lastOutSideFocusNode.focus();
} catch (e) {
this.lastOutSideFocusNode = null;
}
this.lastOutSideFocusNode = null;
}
}
},
onAnimateLeave: function onAnimateLeave() {
// need demo?
// https://github.com/react-component/dialog/pull/28
if (this.refs.wrap) {
this.refs.wrap.style.display = 'none';
}
this.removeScrollingEffect();
this.props.onAfterClose();
},
onMaskClick: function onMaskClick(e) {
if (e.target === e.currentTarget && this.props.closable && this.props.maskClosable) {
this.close(e);
}
},
onKeyDown: function onKeyDown(e) {
var props = this.props;
if (props.closable && props.keyboard) {
if (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, _extends3["default"])({}, props.style, dest);
var transitionName = this.getTransitionName();
var dialogElement = _react2["default"].createElement(
_LazyRenderBox2["default"],
{
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',
{ className: prefixCls + '-body', style: props.bodyStyle, ref: 'body' },
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, _extends3["default"])({}, this.getZIndexStyle(), this.props.wrapStyle);
},
getMaskStyle: function getMaskStyle() {
return (0, _extends3["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"], {
style: this.getMaskStyle(),
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;
},
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) {
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) {
// workaround for missing window.innerWidth in IE8
var documentElementRect = document.documentElement.getBoundingClientRect();
fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left);
}
this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth;
if (this.bodyIsOverflowing) {
this.scrollbarWidth = this.measureScrollbar();
}
},
resetScrollbar: function resetScrollbar() {
document.body.style.paddingRight = '';
},
measureScrollbar: function measureScrollbar() {
if (this.scrollbarWidth !== undefined) {
return this.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 scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
document.body.removeChild(scrollDiv);
this.scrollbarWidth = scrollbarWidth;
return scrollbarWidth;
},
adjustDialog: function adjustDialog() {
if (this.refs.wrap && this.scrollbarWidth) {
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;
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',
{
tabIndex: '-1',
onKeyDown: this.onKeyDown,
className: prefixCls + '-wrap ' + (props.wrapClassName || ''),
ref: 'wrap',
onClick: this.onMaskClick,
role: 'dialog',
'aria-labelledby': props.title ? this.titleId : null,
style: style
},
this.getDialogElement()
)
);
}
});
exports["default"] = Dialog;
module.exports = exports['default'];
/***/ },
/* 375 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = __webpack_require__(8);
var _extends3 = _interopRequireDefault(_extends2);
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _Dialog = __webpack_require__(374);
var _Dialog2 = _interopRequireDefault(_Dialog);
var _getContainerRenderMixin = __webpack_require__(114);
var _getContainerRenderMixin2 = _interopRequireDefault(_getContainerRenderMixin);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var DialogWrap = _react2["default"].createClass({
displayName: 'DialogWrap',
propTypes: {
visible: _react.PropTypes.bool
},
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"], (0, _extends3["default"])({}, instance.props, extra, {
key: 'dialog'
}));
}
})],
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({
onAfterClose: 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'];
/***/ },
/* 376 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = __webpack_require__(8);
var _extends3 = _interopRequireDefault(_extends2);
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var LazyRenderBox = _react2["default"].createClass({
displayName: 'LazyRenderBox',
propTypes: {
className: _react.PropTypes.string,
visible: _react.PropTypes.bool,
hiddenClassName: _react.PropTypes.string
},
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, _extends3["default"])({}, this.props);
delete props.hiddenClassName;
delete props.visible;
props.className = className;
return _react2["default"].createElement('div', props);
}
});
exports["default"] = LazyRenderBox;
module.exports = exports['default'];
/***/ },
/* 377 */
/***/ 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__(8);
var _extends3 = _interopRequireDefault(_extends2);
var _typeof2 = __webpack_require__(39);
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__(9);
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: touch.identifier,
touchStartX: touch.clientX,
touchStartY: touch.clientY,
touchCurrentX: touch.clientX,
touchCurrentY: touch.clientY
});
}
};
_this.onTouchMove = function (ev) {
ev.preventDefault();
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 () {
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;
var isTouching = _ref.isTouching;
var overlayStyle = _ref.overlayStyle;
var 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;
var _props = this.props;
var className = _props.className;
var prefixCls = _props.prefixCls;
var position = _props.position;
var transitions = _props.transitions;
var touch = _props.touch;
var enableDragHandle = _props.enableDragHandle;
var sidebar = _props.sidebar;
var children = _props.children;
var docked = _props.docked;
var 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 = {};
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 = this.onTouchStart;
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'
});
}
}
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',
tabIndex: '0',
onClick: this.onOverlayClicked,
ref: 'overlay'
}),
_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,
// }),
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'];
/***/ },
/* 378 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _Drawer = __webpack_require__(377);
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'];
/***/ },
/* 379 */
/***/ 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__(8);
var _extends3 = _interopRequireDefault(_extends2);
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var _mixin = __webpack_require__(380);
var _mixin2 = _interopRequireDefault(_mixin);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function noop() {}
function preventDefault(e) {
e.preventDefault();
}
var InputNumber = _react2["default"].createClass({
displayName: 'InputNumber',
propTypes: {
onChange: _react.PropTypes.func,
onKeyDown: _react.PropTypes.func,
onFocus: _react.PropTypes.func,
onBlur: _react.PropTypes.func,
max: _react.PropTypes.number,
min: _react.PropTypes.number,
step: _react.PropTypes.oneOfType([_react.PropTypes.number, _react.PropTypes.string])
},
mixins: [_mixin2["default"]],
getDefaultProps: function getDefaultProps() {
return {
prefixCls: 'rc-input-number'
};
},
componentDidMount: function componentDidMount() {
this.componentDidUpdate();
},
componentDidUpdate: function componentDidUpdate() {
if (this.state.focused && document.activeElement !== this.refs.input) {
this.refs.input.focus();
}
},
onKeyDown: function onKeyDown(e) {
var _props;
if (e.keyCode === 38) {
this.up(e);
} else if (e.keyCode === 40) {
this.down(e);
}
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
(_props = this.props).onKeyDown.apply(_props, [e].concat(args));
},
getValueFromEvent: function getValueFromEvent(e) {
return e.target.value;
},
focus: function focus() {
this.refs.input.focus();
},
render: function render() {
var _classNames;
var props = (0, _extends3["default"])({}, this.props);
var prefixCls = props.prefixCls;
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', props.disabled), (0, _defineProperty3["default"])(_classNames, prefixCls + '-focused', this.state.focused), _classNames));
var upDisabledClass = '';
var downDisabledClass = '';
var value = this.state.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';
}
// 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.state.value;
}
if (inputDisplayValue === undefined) {
inputDisplayValue = '';
}
// Remove React warning.
// Warning: Input elements must be either controlled
// or uncontrolled (specify either the value prop, or
// the defaultValue prop, but not both).
delete props.defaultValue;
// https://fb.me/react-unknown-prop
delete props.prefixCls;
// ref for test
return _react2["default"].createElement(
'div',
{ className: classes, style: props.style },
_react2["default"].createElement(
'div',
{ className: prefixCls + '-handler-wrap' },
_react2["default"].createElement(
'a',
{
unselectable: 'unselectable',
ref: 'up',
onClick: upDisabledClass ? noop : this.up,
className: prefixCls + '-handler ' + prefixCls + '-handler-up ' + upDisabledClass
},
_react2["default"].createElement('span', {
unselectable: 'unselectable',
className: prefixCls + '-handler-up-inner',
onClick: preventDefault
})
),
_react2["default"].createElement(
'a',
{
unselectable: 'unselectable',
ref: 'down',
onClick: downDisabledClass ? noop : this.down,
className: prefixCls + '-handler ' + prefixCls + '-handler-down ' + downDisabledClass
},
_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', (0, _extends3["default"])({}, props, {
style: null,
className: prefixCls + '-input',
autoComplete: 'off',
onFocus: this.onFocus,
onBlur: this.onBlur,
onKeyDown: this.onKeyDown,
autoFocus: props.autoFocus,
readOnly: props.readOnly,
disabled: props.disabled,
max: props.max,
min: props.min,
name: props.name,
onChange: this.onChange,
ref: 'input',
value: inputDisplayValue
}))
)
);
}
});
exports["default"] = InputNumber;
module.exports = exports['default'];
/***/ },
/* 380 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
function noop() {}
exports["default"] = {
getDefaultProps: function getDefaultProps() {
return {
max: Infinity,
min: -Infinity,
step: 1,
style: {},
defaultValue: null,
onChange: noop,
onKeyDown: noop,
onFocus: noop,
onBlur: noop
};
},
getInitialState: function getInitialState() {
var value = void 0;
var props = this.props;
if ('value' in props) {
value = props.value;
} else {
value = props.defaultValue;
}
value = this.toPrecisionAsStep(value);
return {
inputValue: value,
value: value,
focused: props.autoFocus
};
},
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
if ('value' in nextProps) {
var value = this.toPrecisionAsStep(nextProps.value);
this.setState({
inputValue: value,
value: value
});
}
},
onChange: function onChange(e) {
this.setInputValue(this.getValueFromEvent(e).trim());
},
onFocus: function onFocus() {
var _props;
this.setState({
focused: true
});
(_props = this.props).onFocus.apply(_props, arguments);
},
onBlur: function onBlur(e) {
var _props2;
this.setState({
focused: false
});
var value = this.getCurrentValidValue(this.getValueFromEvent(e).trim());
this.setValue(value);
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
(_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 (!isNaN(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.toPrecisionAsStep(val);
},
setValue: function setValue(v) {
if (!('value' in this.props)) {
this.setState({
value: v,
inputValue: v
});
}
var newValue = isNaN(v) || v === '' ? undefined : v;
if (newValue !== this.state.value) {
this.props.onChange(newValue);
} else {
// revert input value
this.setState({
inputValue: this.state.value
});
}
},
setInputValue: function setInputValue(v) {
this.setState({
inputValue: v
});
},
getPrecision: function getPrecision() {
var props = this.props;
var stepString = props.step.toString();
if (stepString.indexOf('e-') >= 0) {
return parseInt(stepString.slice(stepString.indexOf('e-') + 1), 10);
}
var precision = 0;
if (stepString.indexOf('.') >= 0) {
precision = stepString.length - stepString.indexOf('.') - 1;
}
return precision;
},
getPrecisionFactor: function getPrecisionFactor() {
var precision = this.getPrecision();
return Math.pow(10, precision);
},
toPrecisionAsStep: function toPrecisionAsStep(num) {
if (isNaN(num) || num === '') {
return num;
}
var precision = this.getPrecision();
return Number(Number(num).toFixed(Math.abs(precision)));
},
upStep: function upStep(val) {
var _props3 = this.props;
var step = _props3.step;
var min = _props3.min;
var precisionFactor = this.getPrecisionFactor();
var result = void 0;
if (typeof val === 'number') {
result = (precisionFactor * val + precisionFactor * step) / precisionFactor;
} else {
result = min === -Infinity ? step : min;
}
return this.toPrecisionAsStep(result);
},
downStep: function downStep(val) {
var _props4 = this.props;
var step = _props4.step;
var min = _props4.min;
var precisionFactor = this.getPrecisionFactor();
var result = void 0;
if (typeof val === 'number') {
result = (precisionFactor * val - precisionFactor * step) / precisionFactor;
} else {
result = min === -Infinity ? -step : min;
}
return this.toPrecisionAsStep(result);
},
step: function step(type, e) {
if (e) {
e.preventDefault();
}
var props = this.props;
if (props.disabled) {
return;
}
var value = this.getCurrentValidValue(this.state.value);
this.setState({ value: value });
if (isNaN(value)) {
return;
}
var val = this[type + 'Step'](value);
if (val > props.max || val < props.min) {
return;
}
this.setValue(val);
this.setState({
focused: true
});
},
down: function down(e) {
this.step('down', e);
},
up: function up(e) {
this.step('up', e);
}
};
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 _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'];
/***/ },
/* 382 */
/***/ 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__(9);
var _reactDom2 = _interopRequireDefault(_reactDom);
var _rcAnimate = __webpack_require__(31);
var _rcAnimate2 = _interopRequireDefault(_rcAnimate);
var _createChainedFunction = __webpack_require__(415);
var _createChainedFunction2 = _interopRequireDefault(_createChainedFunction);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var _Notice = __webpack_require__(381);
var _Notice2 = _interopRequireDefault(_Notice);
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 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 props = properties || {};
var 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'];
/***/ },
/* 383 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _Notification = __webpack_require__(382);
var _Notification2 = _interopRequireDefault(_Notification);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
exports["default"] = _Notification2["default"];
module.exports = exports['default'];
/***/ },
/* 384 */
/***/ 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 _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
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 _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 _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _rcTooltip = __webpack_require__(70);
var _rcTooltip2 = _interopRequireDefault(_rcTooltip);
var Handle = (function (_React$Component) {
_inherits(Handle, _React$Component);
function Handle(props) {
_classCallCheck(this, Handle);
_get(Object.getPrototypeOf(Handle.prototype), 'constructor', this).call(this, props);
this.state = {
isTooltipVisible: false
};
}
_createClass(Handle, [{
key: 'showTooltip',
value: function showTooltip() {
this.setState({
isTooltipVisible: true
});
}
}, {
key: 'hideTooltip',
value: function hideTooltip() {
this.setState({
isTooltipVisible: false
});
}
}, {
key: 'render',
value: function render() {
var _props = this.props;
var prefixCls = _props.prefixCls;
var className = _props.className;
var tipTransitionName = _props.tipTransitionName;
var tipFormatter = _props.tipFormatter;
var vertical = _props.vertical;
var offset = _props.offset;
var value = _props.value;
var dragging = _props.dragging;
var noTip = _props.noTip;
var style = vertical ? { bottom: offset + '%' } : { left: offset + '%' };
var handle = _react2['default'].createElement('div', { className: className, style: style,
onMouseUp: this.showTooltip.bind(this),
onMouseEnter: this.showTooltip.bind(this),
onMouseLeave: this.hideTooltip.bind(this)
});
if (noTip) {
return handle;
}
var isTooltipVisible = dragging || this.state.isTooltipVisible;
return _react2['default'].createElement(
_rcTooltip2['default'],
{
prefixCls: prefixCls.replace('slider', 'tooltip'),
placement: 'top',
visible: isTooltipVisible,
overlay: _react2['default'].createElement(
'span',
null,
tipFormatter(value)
),
delay: 0,
transitionName: tipTransitionName
},
handle
);
}
}]);
return Handle;
})(_react2['default'].Component);
exports['default'] = Handle;
Handle.propTypes = {
prefixCls: _react2['default'].PropTypes.string,
className: _react2['default'].PropTypes.string,
vertical: _react2['default'].PropTypes.bool,
offset: _react2['default'].PropTypes.number,
tipTransitionName: _react2['default'].PropTypes.string,
tipFormatter: _react2['default'].PropTypes.func,
value: _react2['default'].PropTypes.number,
dragging: _react2['default'].PropTypes.bool,
noTip: _react2['default'].PropTypes.bool
};
module.exports = exports['default'];
/***/ },
/* 385 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var Marks = function Marks(_ref) {
var className = _ref.className;
var vertical = _ref.vertical;
var marks = _ref.marks;
var included = _ref.included;
var upperBound = _ref.upperBound;
var lowerBound = _ref.lowerBound;
var max = _ref.max;
var 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 isActived = !included && point === upperBound || included && point <= upperBound && point >= lowerBound;
var markClassName = (0, _classnames2['default'])((_classNames = {}, _defineProperty(_classNames, className + '-text', true), _defineProperty(_classNames, className + '-text-active', isActived), _classNames));
var bottomStyle = {
// height: markWidth + '%',
marginBottom: '-200' + '%',
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 === 'object' && !_react2['default'].isValidElement(markPoint);
var markLabel = markPointIsObject ? markPoint.label : markPoint;
var markStyle = markPointIsObject ? _extends({}, 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'];
/***/ },
/* 386 */
/***/ 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 _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
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; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
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 _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _rcUtilLibDomAddEventListener = __webpack_require__(46);
var _rcUtilLibDomAddEventListener2 = _interopRequireDefault(_rcUtilLibDomAddEventListener);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var _Track = __webpack_require__(388);
var _Track2 = _interopRequireDefault(_Track);
var _Handle = __webpack_require__(384);
var _Handle2 = _interopRequireDefault(_Handle);
var _Steps = __webpack_require__(387);
var _Steps2 = _interopRequireDefault(_Steps);
var _Marks = __webpack_require__(385);
var _Marks2 = _interopRequireDefault(_Marks);
function noop() {}
function isNotTouchEvent(e) {
return e.touches.length > 1 || e.type.toLowerCase() === 'touchend' && e.touches.length > 0;
}
function getTouchPosition(vertical, e) {
return vertical ? e.touches[0].clientY : e.touches[0].pageX;
}
function getMousePosition(vertical, e) {
return vertical ? e.clientY : e.pageX;
}
function pauseEvent(e) {
e.stopPropagation();
e.preventDefault();
}
var Slider = (function (_React$Component) {
_inherits(Slider, _React$Component);
function Slider(props) {
_classCallCheck(this, Slider);
_get(Object.getPrototypeOf(Slider.prototype), 'constructor', this).call(this, props);
var range = props.range;
var min = props.min;
var max = props.max;
var initialValue = range ? [min, min] : min;
var defaultValue = 'defaultValue' in props ? props.defaultValue : initialValue;
var value = props.value !== undefined ? props.value : defaultValue;
var upperBound = undefined;
var lowerBound = undefined;
if (props.range) {
lowerBound = this.trimAlignValue(value[0]);
upperBound = this.trimAlignValue(value[1]);
} else {
upperBound = this.trimAlignValue(value);
}
var recent = undefined;
if (props.range && upperBound === lowerBound) {
recent = lowerBound === max ? 'lowerBound' : 'upperBound';
} else {
recent = 'upperBound';
}
this.state = {
handle: null,
recent: recent,
upperBound: upperBound,
// If Slider is not range, set `lowerBound` equal to `min`.
lowerBound: lowerBound || min
};
}
_createClass(Slider, [{
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(nextProps) {
if (!('value' in nextProps || 'min' in nextProps || 'max' in nextProps)) return;
var _state = this.state;
var lowerBound = _state.lowerBound;
var upperBound = _state.upperBound;
if (nextProps.range) {
var value = nextProps.value || [lowerBound, upperBound];
var nextUpperBound = this.trimAlignValue(value[1], nextProps);
var nextLowerBound = this.trimAlignValue(value[0], nextProps);
if (nextLowerBound === lowerBound && nextUpperBound === upperBound) return;
this.setState({
upperBound: nextUpperBound,
lowerBound: nextLowerBound
});
if (this.isValueOutOfBounds(upperBound, nextProps) || this.isValueOutOfBounds(lowerBound, nextProps)) {
this.props.onChange([nextLowerBound, nextUpperBound]);
}
} else {
var value = nextProps.value !== undefined ? nextProps.value : upperBound;
var nextValue = this.trimAlignValue(value, nextProps);
if (nextValue === upperBound && lowerBound === nextProps.min) return;
this.setState({
upperBound: nextValue,
lowerBound: nextProps.min
});
if (this.isValueOutOfBounds(upperBound, nextProps)) {
this.props.onChange(nextValue);
}
}
}
}, {
key: 'onChange',
value: function onChange(state) {
var props = this.props;
var isNotControlled = !('value' in props);
if (isNotControlled) {
this.setState(state);
} else if (state.handle) {
this.setState({ handle: state.handle });
}
var data = _extends({}, this.state, state);
var changedValue = props.range ? [data.lowerBound, data.upperBound] : data.upperBound;
props.onChange(changedValue);
}
}, {
key: 'onMouseMove',
value: function onMouseMove(e) {
var position = getMousePosition(this.props.vertical, e);
this.onMove(e, position);
}
}, {
key: 'onTouchMove',
value: function onTouchMove(e) {
if (isNotTouchEvent(e)) {
this.end('touch');
return;
}
var position = getTouchPosition(this.props.vertical, e);
this.onMove(e, position);
}
}, {
key: 'onMove',
value: function onMove(e, position) {
pauseEvent(e);
var props = this.props;
var state = this.state;
var diffPosition = position - this.startPosition;
diffPosition = this.props.vertical ? -diffPosition : diffPosition;
var diffValue = diffPosition / this.getSliderLength() * (props.max - props.min);
var value = this.trimAlignValue(this.startValue + diffValue);
var oldValue = state[state.handle];
if (value === oldValue) return;
if (props.allowCross && value < state.lowerBound && state.handle === 'upperBound') {
this.onChange({
handle: 'lowerBound',
lowerBound: value,
upperBound: this.state.lowerBound
});
return;
}
if (props.allowCross && value > state.upperBound && state.handle === 'lowerBound') {
this.onChange({
handle: 'upperBound',
upperBound: value,
lowerBound: this.state.upperBound
});
return;
}
this.onChange(_defineProperty({}, state.handle, value));
}
}, {
key: 'onTouchStart',
value: function onTouchStart(e) {
if (isNotTouchEvent(e)) return;
var position = getTouchPosition(this.props.vertical, e);
this.onStart(position);
this.addDocumentEvents('touch');
pauseEvent(e);
}
}, {
key: 'onMouseDown',
value: function onMouseDown(e) {
if (e.button !== 0) {
return;
}
var position = getMousePosition(this.props.vertical, e);
this.onStart(position);
this.addDocumentEvents('mouse');
pauseEvent(e);
}
}, {
key: 'onStart',
value: function onStart(position) {
var props = this.props;
props.onBeforeChange(this.getValue());
var value = this.calcValueByPos(position);
this.startValue = value;
this.startPosition = position;
var state = this.state;
var upperBound = state.upperBound;
var lowerBound = state.lowerBound;
var valueNeedChanging = 'upperBound';
if (this.props.range) {
var isLowerBoundCloser = Math.abs(upperBound - value) > Math.abs(lowerBound - value);
if (isLowerBoundCloser) {
valueNeedChanging = 'lowerBound';
}
var isAtTheSamePoint = upperBound === lowerBound;
if (isAtTheSamePoint) {
valueNeedChanging = state.recent;
}
if (isAtTheSamePoint && value !== upperBound) {
valueNeedChanging = value < upperBound ? 'lowerBound' : 'upperBound';
}
}
this.setState({
handle: valueNeedChanging,
recent: valueNeedChanging
});
var oldValue = state[valueNeedChanging];
if (value === oldValue) return;
this.onChange(_defineProperty({}, valueNeedChanging, value));
}
}, {
key: 'getValue',
value: function getValue() {
var _state2 = this.state;
var lowerBound = _state2.lowerBound;
var upperBound = _state2.upperBound;
return this.props.range ? [lowerBound, upperBound] : upperBound;
}
}, {
key: 'getSliderLength',
value: function getSliderLength() {
var slider = this.refs.slider;
if (!slider) {
return 0;
}
return this.props.vertical ? slider.clientHeight : slider.clientWidth;
}
}, {
key: 'getSliderStart',
value: function getSliderStart() {
var slider = this.refs.slider;
var rect = slider.getBoundingClientRect();
return this.props.vertical ? rect.top : rect.left;
}
}, {
key: 'getPrecision',
value: function getPrecision(step) {
var stepString = step.toString();
var precision = 0;
if (stepString.indexOf('.') >= 0) {
precision = stepString.length - stepString.indexOf('.') - 1;
}
return precision;
}
}, {
key: 'isValueOutOfBounds',
value: function isValueOutOfBounds(value, props) {
return value < props.min || value > props.max;
}
}, {
key: 'trimAlignValue',
value: function trimAlignValue(v, nextProps) {
var state = this.state || {};
var handle = state.handle;
var lowerBound = state.lowerBound;
var upperBound = state.upperBound;
var _extends2 = _extends({}, this.props, nextProps || {});
var marks = _extends2.marks;
var step = _extends2.step;
var min = _extends2.min;
var max = _extends2.max;
var allowCross = _extends2.allowCross;
var val = v;
if (val <= min) {
val = min;
}
if (val >= max) {
val = max;
}
if (!allowCross && handle === 'upperBound' && val <= lowerBound) {
val = lowerBound;
}
if (!allowCross && handle === 'lowerBound' && val >= upperBound) {
val = upperBound;
}
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);
});
var closestPoint = points[diffs.indexOf(Math.min.apply(Math, diffs))];
return step !== null ? parseFloat(closestPoint.toFixed(this.getPrecision(step))) : closestPoint;
}
}, {
key: 'calcOffset',
value: function calcOffset(value) {
var _props = this.props;
var min = _props.min;
var max = _props.max;
var ratio = (value - min) / (max - min);
return ratio * 100;
}
}, {
key: 'calcValue',
value: function calcValue(offset) {
var _props2 = this.props;
var vertical = _props2.vertical;
var min = _props2.min;
var max = _props2.max;
var ratio = Math.abs(offset / this.getSliderLength());
var value = vertical ? (1 - ratio) * (max - min) + min : ratio * (max - min) + min;
return value;
}
}, {
key: 'calcValueByPos',
value: function calcValueByPos(position) {
var pixelOffset = position - this.getSliderStart();
var nextValue = this.trimAlignValue(this.calcValue(pixelOffset));
return nextValue;
}
}, {
key: 'addDocumentEvents',
value: function addDocumentEvents(type) {
if (type === 'touch') {
// just work for chrome iOS Safari and Android Browser
this.onTouchMoveListener = (0, _rcUtilLibDomAddEventListener2['default'])(document, 'touchmove', this.onTouchMove.bind(this));
this.onTouchUpListener = (0, _rcUtilLibDomAddEventListener2['default'])(document, 'touchend', this.end.bind(this, 'touch'));
} else if (type === 'mouse') {
this.onMouseMoveListener = (0, _rcUtilLibDomAddEventListener2['default'])(document, 'mousemove', this.onMouseMove.bind(this));
this.onMouseUpListener = (0, _rcUtilLibDomAddEventListener2['default'])(document, 'mouseup', this.end.bind(this, 'mouse'));
}
}
}, {
key: 'removeEvents',
value: function removeEvents(type) {
if (type === 'touch') {
this.onTouchMoveListener.remove();
this.onTouchUpListener.remove();
} else if (type === 'mouse') {
this.onMouseMoveListener.remove();
this.onMouseUpListener.remove();
}
}
}, {
key: 'end',
value: function end(type) {
this.removeEvents(type);
this.props.onAfterChange(this.getValue());
this.setState({ handle: null });
}
}, {
key: 'render',
value: function render() {
var _classNames, _classNames2, _classNames3;
var _state3 = this.state;
var handle = _state3.handle;
var upperBound = _state3.upperBound;
var lowerBound = _state3.lowerBound;
var _props3 = this.props;
var className = _props3.className;
var prefixCls = _props3.prefixCls;
var disabled = _props3.disabled;
var vertical = _props3.vertical;
var dots = _props3.dots;
var included = _props3.included;
var range = _props3.range;
var step = _props3.step;
var marks = _props3.marks;
var max = _props3.max;
var min = _props3.min;
var tipTransitionName = _props3.tipTransitionName;
var tipFormatter = _props3.tipFormatter;
var children = _props3.children;
var customHandle = this.props.handle;
var upperOffset = this.calcOffset(upperBound);
var lowerOffset = this.calcOffset(lowerBound);
var handleClassName = prefixCls + '-handle';
var upperClassName = (0, _classnames2['default'])((_classNames = {}, _defineProperty(_classNames, handleClassName, true), _defineProperty(_classNames, handleClassName + '-upper', true), _classNames));
var lowerClassName = (0, _classnames2['default'])((_classNames2 = {}, _defineProperty(_classNames2, handleClassName, true), _defineProperty(_classNames2, handleClassName + '-lower', true), _classNames2));
var isNoTip = step === null || tipFormatter === null;
var commonHandleProps = {
prefixCls: prefixCls,
noTip: isNoTip,
tipTransitionName: tipTransitionName,
tipFormatter: tipFormatter,
vertical: vertical
};
var upper = (0, _react.cloneElement)(customHandle, _extends({}, commonHandleProps, {
className: upperClassName,
value: upperBound,
offset: upperOffset,
dragging: handle === 'upperBound'
}));
var lower = null;
if (range) {
lower = (0, _react.cloneElement)(customHandle, _extends({}, commonHandleProps, {
className: lowerClassName,
value: lowerBound,
offset: lowerOffset,
dragging: handle === 'lowerBound'
}));
}
var sliderClassName = (0, _classnames2['default'])((_classNames3 = {}, _defineProperty(_classNames3, prefixCls, true), _defineProperty(_classNames3, prefixCls + '-disabled', disabled), _defineProperty(_classNames3, className, !!className), _defineProperty(_classNames3, prefixCls + '-vertical', this.props.vertical), _classNames3));
var isIncluded = included || range;
return _react2['default'].createElement(
'div',
{ ref: 'slider', className: sliderClassName,
onTouchStart: disabled ? noop : this.onTouchStart.bind(this),
onMouseDown: disabled ? noop : this.onMouseDown.bind(this)
},
upper,
lower,
_react2['default'].createElement(_Track2['default'], { className: prefixCls + '-track', vertical: vertical, included: isIncluded,
offset: lowerOffset, length: upperOffset - lowerOffset }),
_react2['default'].createElement(_Steps2['default'], { prefixCls: prefixCls, vertical: vertical, marks: marks, dots: dots, step: step,
included: isIncluded, lowerBound: lowerBound,
upperBound: upperBound, max: max, min: min }),
_react2['default'].createElement(_Marks2['default'], { className: prefixCls + '-mark', vertical: vertical, marks: marks,
included: isIncluded, lowerBound: lowerBound,
upperBound: upperBound, max: max, min: min }),
children
);
}
}]);
return Slider;
})(_react2['default'].Component);
Slider.propTypes = {
min: _react2['default'].PropTypes.number,
max: _react2['default'].PropTypes.number,
step: _react2['default'].PropTypes.number,
defaultValue: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.number, _react2['default'].PropTypes.arrayOf(_react2['default'].PropTypes.number)]),
value: _react2['default'].PropTypes.oneOfType([_react2['default'].PropTypes.number, _react2['default'].PropTypes.arrayOf(_react2['default'].PropTypes.number)]),
marks: _react2['default'].PropTypes.object,
included: _react2['default'].PropTypes.bool,
className: _react2['default'].PropTypes.string,
prefixCls: _react2['default'].PropTypes.string,
disabled: _react2['default'].PropTypes.bool,
children: _react2['default'].PropTypes.any,
onBeforeChange: _react2['default'].PropTypes.func,
onChange: _react2['default'].PropTypes.func,
onAfterChange: _react2['default'].PropTypes.func,
handle: _react2['default'].PropTypes.element,
tipTransitionName: _react2['default'].PropTypes.string,
tipFormatter: _react2['default'].PropTypes.func,
dots: _react2['default'].PropTypes.bool,
range: _react2['default'].PropTypes.bool,
vertical: _react2['default'].PropTypes.bool,
allowCross: _react2['default'].PropTypes.bool
};
Slider.defaultProps = {
prefixCls: 'rc-slider',
className: '',
tipTransitionName: '',
min: 0,
max: 100,
step: 1,
marks: {},
handle: _react2['default'].createElement(_Handle2['default'], null),
onBeforeChange: noop,
onChange: noop,
onAfterChange: noop,
tipFormatter: function tipFormatter(value) {
return value;
},
included: true,
disabled: false,
dots: false,
range: false,
vertical: false,
allowCross: true
};
exports['default'] = Slider;
module.exports = exports['default'];
/***/ },
/* 387 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var _warning = __webpack_require__(473);
var _warning2 = _interopRequireDefault(_warning);
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;
var vertical = _ref.vertical;
var marks = _ref.marks;
var dots = _ref.dots;
var step = _ref.step;
var included = _ref.included;
var lowerBound = _ref.lowerBound;
var upperBound = _ref.upperBound;
var max = _ref.max;
var 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 = {}, _defineProperty(_classNames, prefixCls + '-dot', true), _defineProperty(_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'];
/***/ },
/* 388 */
/***/ 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 Track = function Track(_ref) {
var className = _ref.className;
var included = _ref.included;
var vertical = _ref.vertical;
var offset = _ref.offset;
var length = _ref.length;
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: style });
};
exports['default'] = Track;
module.exports = exports['default'];
/***/ },
/* 389 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
module.exports = __webpack_require__(386);
/***/ },
/* 390 */
/***/ 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; };
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; }
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 Step(props) {
var _classNames, _classNames2;
var className = props.className;
var prefixCls = props.prefixCls;
var style = props.style;
var tailWidth = props.tailWidth;
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 stepLast = props.stepLast;
var stepNumber = props.stepNumber;
var description = props.description;
var title = props.title;
var restProps = _objectWithoutProperties(props, ['className', 'prefixCls', 'style', 'tailWidth', 'status', 'iconPrefix', 'icon', 'wrapperStyle', 'adjustMarginRight', 'stepLast', 'stepNumber', 'description', 'title']);
var iconClassName = (0, _classnames2["default"])((_classNames = {}, _defineProperty(_classNames, prefixCls + '-icon', true), _defineProperty(_classNames, iconPrefix + 'icon', true), _defineProperty(_classNames, iconPrefix + 'icon-' + icon, icon), _defineProperty(_classNames, iconPrefix + 'icon-check', !icon && status === 'finish'), _defineProperty(_classNames, iconPrefix + 'icon-cross', !icon && status === 'error'), _classNames));
var iconNode = icon || status === 'finish' || status === 'error' ? _react2["default"].createElement('span', { className: iconClassName }) : _react2["default"].createElement(
'span',
{ className: prefixCls + '-icon' },
stepNumber
);
var classString = (0, _classnames2["default"])((_classNames2 = {}, _defineProperty(_classNames2, prefixCls + '-item', true), _defineProperty(_classNames2, prefixCls + '-item-last', stepLast), _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: tailWidth, marginRight: adjustMarginRight }, style)
}),
stepLast ? '' : _react2["default"].createElement(
'div',
{ className: prefixCls + '-tail' },
_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',
{ 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
) : ''
)
)
);
}
Step.propTypes = {
className: _react.PropTypes.string,
prefixCls: _react.PropTypes.string,
style: _react.PropTypes.object,
wrapperStyle: _react.PropTypes.object,
tailWidth: _react.PropTypes.oneOfType([_react.PropTypes.number, _react.PropTypes.string]),
status: _react.PropTypes.string,
iconPrefix: _react.PropTypes.string,
icon: _react.PropTypes.string,
adjustMarginRight: _react.PropTypes.oneOfType([_react.PropTypes.number, _react.PropTypes.string]),
stepLast: _react.PropTypes.bool,
stepNumber: _react.PropTypes.string,
description: _react.PropTypes.any,
title: _react.PropTypes.any
};
module.exports = Step;
/***/ },
/* 391 */
/***/ 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__(9);
var _reactDom2 = _interopRequireDefault(_reactDom);
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 Steps = function (_React$Component) {
_inherits(Steps, _React$Component);
function Steps(props) {
_classCallCheck(this, Steps);
var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));
_this.culcLastStepOffsetWidth = function () {
var domNode = _reactDom2["default"].findDOMNode(_this);
if (domNode.children.length > 0) {
_this.culcTimeout = setTimeout(function () {
// +1 for fit edge bug of digit width, like 35.4px
var lastStepOffsetWidth = domNode.lastChild.offsetWidth + 1;
if (_this.state.lastStepOffsetWidth === lastStepOffsetWidth) {
return;
}
_this.setState({ lastStepOffsetWidth: lastStepOffsetWidth });
});
}
};
_this.state = {
lastStepOffsetWidth: 0
};
return _this;
}
Steps.prototype.componentDidMount = function componentDidMount() {
this.culcLastStepOffsetWidth();
};
Steps.prototype.componentDidUpdate = function componentDidUpdate() {
this.culcLastStepOffsetWidth();
};
Steps.prototype.componentWillUnmount = function componentWillUnmount() {
if (this.culcTimeout) {
clearTimeout(this.culcTimeout);
}
};
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 restProps = _objectWithoutProperties(props, ['prefixCls', 'style', 'className', 'children', 'direction', 'labelPlacement', 'iconPrefix', 'status', 'size', 'current']);
var lastIndex = children.length - 1;
var reLayouted = this.state.lastStepOffsetWidth > 0;
var classString = (0, _classnames2["default"])((_classNames = {}, _defineProperty(_classNames, prefixCls, true), _defineProperty(_classNames, prefixCls + '-' + size, size), _defineProperty(_classNames, prefixCls + '-' + direction, true), _defineProperty(_classNames, prefixCls + '-label-' + labelPlacement, direction === 'horizontal'), _defineProperty(_classNames, prefixCls + '-hidden', !reLayouted), _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 tailWidth = direction === 'vertical' || idx === lastIndex || !reLayouted ? null : 100 / lastIndex + '%';
var adjustMarginRight = direction === 'vertical' || idx === lastIndex ? null : -(_this2.state.lastStepOffsetWidth / lastIndex + 1);
var np = {
stepNumber: (idx + 1).toString(),
stepLast: idx === lastIndex,
tailWidth: tailWidth,
adjustMarginRight: adjustMarginRight,
prefixCls: prefixCls,
iconPrefix: iconPrefix,
wrapperStyle: style
};
// 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: _react.PropTypes.string,
iconPrefix: _react.PropTypes.string,
direction: _react.PropTypes.string,
labelPlacement: _react.PropTypes.string,
children: _react.PropTypes.any,
status: _react.PropTypes.string,
size: _react.PropTypes.string
};
Steps.defaultProps = {
prefixCls: 'rc-steps',
iconPrefix: 'rc',
direction: 'horizontal',
labelPlacement: 'horizontal',
current: 0,
status: 'process',
size: ''
};
module.exports = exports['default'];
/***/ },
/* 392 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var Steps = __webpack_require__(391);
Steps.Step = __webpack_require__(390);
module.exports = Steps;
/***/ },
/* 393 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = __webpack_require__(8);
var _extends3 = _interopRequireDefault(_extends2);
var _slicedToArray2 = __webpack_require__(12);
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__(47);
var _reactHammerjs2 = _interopRequireDefault(_reactHammerjs);
var _object = __webpack_require__(361);
var _object2 = _interopRequireDefault(_object);
var _splitObject3 = __webpack_require__(395);
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.onTap = _this.onTap.bind(_this);
_this.openedLeft = false;
_this.openedRight = false;
return _this;
}
Swipeout.prototype.componentDidMount = function componentDidMount() {
var _props = this.props;
var left = _props.left;
var right = _props.right;
var width = this.refs.content.offsetWidth;
this.contentWidth = width;
this.btnsLeftWidth = left ? width / 5 * left.length : 0;
this.btnsRightWidth = right ? width / 5 * right.length : 0;
};
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;
}
// get pan distance
var posX = e.deltaX - this.panStartX;
if (this.openedRight) {
posX = posX - this.btnsRightWidth;
} else if (this.openedLeft) {
posX = posX + this.btnsLeftWidth;
}
if (posX < 0 && this.props.right) {
this._setStyle(Math.min(posX, 0));
} else if (posX > 0 && this.props.left) {
this._setStyle(Math.max(posX, 0));
}
};
Swipeout.prototype.onPanEnd = function onPanEnd(e) {
if (this.props.disabled) {
return;
}
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 (this.openedRight) {
openRight = posX - openX < -openX;
}
if (this.openedLeft) {
openLeft = posX + openX > openX;
}
if (openRight && posX < 0) {
this.open(-btnsRightWidth, false, true);
} else if (openLeft && posX > 0) {
this.open(btnsLeftWidth, true, false);
} else {
this.close();
}
};
Swipeout.prototype.onTap = function onTap(e) {
if (this.openedLeft || this.openedRight) {
e.preventDefault();
this.close();
}
};
// left & right button click
Swipeout.prototype.onBtnClick = function onBtnClick(btn) {
var onPress = btn.onPress;
if (onPress) {
onPress();
}
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 _props2 = this.props;
var left = _props2.left;
var right = _props2.right;
var limit = value > 0 ? this.btnsLeftWidth : -this.btnsRightWidth;
var contentLeft = this._getContentEasing(value, limit);
this.refs.content.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.openedLeft = false;
this.openedRight = false;
this._setStyle(0);
};
Swipeout.prototype.renderButtons = function renderButtons(buttons, ref) {
var _this2 = 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',
style: btn.style,
onClick: function onClick() {
return _this2.onBtnClick(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']);
var _splitObject2 = (0, _slicedToArray3["default"])(_splitObject, 2);
var _splitObject2$ = _splitObject2[0];
var prefixCls = _splitObject2$.prefixCls;
var left = _splitObject2$.left;
var right = _splitObject2$.right;
var children = _splitObject2$.children;
var restProps = _splitObject2[1];
var divProps = (0, _object2["default"])(restProps, ['disabled', 'autoClose', 'onOpen', 'onClose']);
var direction = 'DIRECTION_HORIZONTAL';
if (left.length && right.length === 0) {
direction = 'DIRECTION_RIGHT';
}
if (right.length && left.length === 0) {
direction = 'DIRECTION_LEFT';
}
return left.length || right.length ? _react2["default"].createElement(
'div',
(0, _extends3["default"])({ className: '' + prefixCls }, divProps),
_react2["default"].createElement(
_reactHammerjs2["default"],
{
direction: direction,
onPanStart: this.onPanStart,
onPan: this.onPan,
onPanEnd: this.onPanEnd,
onTap: this.onTap
},
_react2["default"].createElement(
'div',
{ className: prefixCls + '-content', ref: 'content' },
children
)
),
this.renderButtons(left, 'left'),
this.renderButtons(right, 'right')
) : _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'];
/***/ },
/* 394 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _Swipeout = __webpack_require__(393);
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'];
/***/ },
/* 395 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _keys = __webpack_require__(33);
var _keys2 = _interopRequireDefault(_keys);
exports["default"] = splitObject;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function splitObject(obj, parts) {
var left = {};
var right = {};
(0, _keys2["default"])(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'];
/***/ },
/* 396 */
/***/ 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 _TableRow = __webpack_require__(398);
var _TableRow2 = _interopRequireDefault(_TableRow);
var _utils = __webpack_require__(400);
var _shallowequal = __webpack_require__(49);
var _shallowequal2 = _interopRequireDefault(_shallowequal);
var _addEventListener = __webpack_require__(46);
var _addEventListener2 = _interopRequireDefault(_addEventListener);
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); } }
var Table = _react2["default"].createClass({
displayName: 'Table',
propTypes: {
data: _react.PropTypes.array,
expandIconAsCell: _react.PropTypes.bool,
defaultExpandAllRows: _react.PropTypes.bool,
expandedRowKeys: _react.PropTypes.array,
defaultExpandedRowKeys: _react.PropTypes.array,
useFixedHeader: _react.PropTypes.bool,
columns: _react.PropTypes.array,
prefixCls: _react.PropTypes.string,
bodyStyle: _react.PropTypes.object,
style: _react.PropTypes.object,
rowKey: _react.PropTypes.oneOfType([_react.PropTypes.string, _react.PropTypes.func]),
rowClassName: _react.PropTypes.func,
expandedRowClassName: _react.PropTypes.func,
childrenColumnName: _react.PropTypes.string,
onExpand: _react.PropTypes.func,
onExpandedRowsChange: _react.PropTypes.func,
indentSize: _react.PropTypes.number,
onRowClick: _react.PropTypes.func,
columnsPageRange: _react.PropTypes.array,
columnsPageSize: _react.PropTypes.number,
expandIconColumnIndex: _react.PropTypes.number,
showHeader: _react.PropTypes.bool,
title: _react.PropTypes.func,
footer: _react.PropTypes.func,
scroll: _react.PropTypes.object,
rowRef: _react.PropTypes.func,
getBodyWrapper: _react.PropTypes.func
},
getDefaultProps: function getDefaultProps() {
return {
data: [],
useFixedHeader: false,
expandIconAsCell: false,
columns: [],
defaultExpandAllRows: false,
defaultExpandedRowKeys: [],
rowKey: 'key',
rowClassName: function rowClassName() {
return '';
},
expandedRowClassName: function expandedRowClassName() {
return '';
},
onExpand: function onExpand() {},
onExpandedRowsChange: function onExpandedRowsChange() {},
prefixCls: 'rc-table',
bodyStyle: {},
style: {},
childrenColumnName: 'children',
indentSize: 15,
columnsPageSize: 5,
expandIconColumnIndex: 0,
showHeader: true,
scroll: {},
rowRef: function rowRef() {
return null;
},
getBodyWrapper: function getBodyWrapper(body) {
return body;
}
};
},
getInitialState: function getInitialState() {
var props = this.props;
var expandedRowKeys = [];
var rows = [].concat(_toConsumableArray(props.data));
if (props.defaultExpandAllRows) {
for (var i = 0; i < rows.length; i++) {
var row = rows[i];
expandedRowKeys.push(this.getRowKey(row));
rows = rows.concat(row[props.childrenColumnName] || []);
}
} else {
expandedRowKeys = props.expandedRowKeys || props.defaultExpandedRowKeys;
}
return {
expandedRowKeys: expandedRowKeys,
data: props.data,
currentColumnsPage: 0,
currentHoverKey: null,
scrollPosition: 'left',
fixedColumnsHeadRowsHeight: [],
fixedColumnsBodyRowsHeight: []
};
},
componentDidMount: function componentDidMount() {
this.resetScrollY();
this.syncFixedTableRowHeight();
var isAnyColumnsFixed = this.isAnyColumnsFixed();
if (isAnyColumnsFixed) {
this.resizeEvent = (0, _addEventListener2["default"])(window, 'resize', (0, _utils.debounce)(this.syncFixedTableRowHeight, 150));
}
},
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
if ('data' in nextProps) {
this.setState({
data: nextProps.data
});
if (!nextProps.data || nextProps.data.length === 0) {
this.resetScrollY();
}
}
if ('expandedRowKeys' in nextProps) {
this.setState({
expandedRowKeys: nextProps.expandedRowKeys
});
}
if (nextProps.columns !== this.props.columns) {
delete this.isAnyColumnsFixedCache;
delete this.isAnyColumnsLeftFixedCache;
delete this.isAnyColumnsRightFixedCache;
}
},
componentDidUpdate: function componentDidUpdate() {
this.syncFixedTableRowHeight();
},
componentWillUnmount: function componentWillUnmount() {
clearTimeout(this.timer);
if (this.resizeEvent) {
this.resizeEvent.remove();
}
},
onExpandedRowsChange: function onExpandedRowsChange(expandedRowKeys) {
if (!this.props.expandedRowKeys) {
this.setState({ expandedRowKeys: expandedRowKeys });
}
this.props.onExpandedRowsChange(expandedRowKeys);
},
onExpanded: function onExpanded(expanded, record) {
var info = this.findExpandedRow(record);
if (typeof info !== 'undefined' && !expanded) {
this.onRowDestroy(record);
} else if (!info && expanded) {
var expandedRows = this.getExpandedRows().concat();
expandedRows.push(this.getRowKey(record));
this.onExpandedRowsChange(expandedRows);
}
this.props.onExpand(expanded, record);
},
onRowDestroy: function onRowDestroy(record) {
var expandedRows = this.getExpandedRows().concat();
var rowKey = this.getRowKey(record);
var index = -1;
expandedRows.forEach(function (r, i) {
if (r === rowKey) {
index = i;
}
});
if (index !== -1) {
expandedRows.splice(index, 1);
}
this.onExpandedRowsChange(expandedRows);
},
getRowKey: function getRowKey(record, index) {
var rowKey = this.props.rowKey;
if (typeof rowKey === 'function') {
return rowKey(record, index);
}
return typeof record[rowKey] !== 'undefined' ? record[rowKey] : index;
},
getExpandedRows: function getExpandedRows() {
return this.props.expandedRowKeys || this.state.expandedRowKeys;
},
getHeader: function getHeader(columns, fixed) {
var _props = this.props;
var showHeader = _props.showHeader;
var expandIconAsCell = _props.expandIconAsCell;
var prefixCls = _props.prefixCls;
var ths = [];
if (expandIconAsCell && fixed !== 'right') {
ths.push({
key: 'rc-table-expandIconAsCell',
className: prefixCls + '-expand-icon-th',
title: ''
});
}
ths = ths.concat(columns || this.getCurrentColumns()).map(function (c) {
if (c.colSpan !== 0) {
return _react2["default"].createElement(
'th',
{ key: c.key, colSpan: c.colSpan, className: c.className || '' },
c.title
);
}
});
var fixedColumnsHeadRowsHeight = this.state.fixedColumnsHeadRowsHeight;
var trStyle = fixedColumnsHeadRowsHeight[0] && columns ? {
height: fixedColumnsHeadRowsHeight[0]
} : null;
return showHeader ? _react2["default"].createElement(
'thead',
{ className: prefixCls + '-thead' },
_react2["default"].createElement(
'tr',
{ style: trStyle },
ths
)
) : null;
},
getExpandedRow: function getExpandedRow(key, content, visible, className, fixed) {
var prefixCls = this.props.prefixCls;
return _react2["default"].createElement(
'tr',
{
key: key + '-extra-row',
style: { display: visible ? '' : 'none' },
className: prefixCls + '-expanded-row ' + className
},
this.props.expandIconAsCell && fixed !== 'right' ? _react2["default"].createElement('td', { key: 'rc-table-expand-icon-placeholder' }) : null,
_react2["default"].createElement(
'td',
{ colSpan: this.props.columns.length },
fixed !== 'right' ? content : ' '
)
);
},
getRowsByData: function getRowsByData(data, visible, indent, columns, fixed) {
var props = this.props;
var childrenColumnName = props.childrenColumnName;
var expandedRowRender = props.expandedRowRender;
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 isAnyColumnsFixed = this.isAnyColumnsFixed();
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);
var expandedRowContent = void 0;
if (expandedRowRender && isRowExpanded) {
expandedRowContent = expandedRowRender(record, i);
}
var className = rowClassName(record, i);
if (this.state.currentHoverKey === key) {
className += ' ' + props.prefixCls + '-row-hover';
}
var onHoverProps = {};
if (isAnyColumnsFixed) {
onHoverProps.onHover = this.handleRowHover;
}
var style = fixed && fixedColumnsBodyRowsHeight[i] ? {
height: fixedColumnsBodyRowsHeight[i]
} : {};
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,
onExpand: this.onExpanded,
expandable: childrenColumn || expandedRowRender,
expanded: isRowExpanded,
prefixCls: props.prefixCls + '-row',
childrenColumnName: childrenColumnName,
columns: columns || this.getCurrentColumns(),
expandIconColumnIndex: expandIconColumnIndex,
onRowClick: onRowClick,
style: style
}, onHoverProps, {
key: key,
hoverKey: key,
ref: rowRef(record, i)
})));
var subVisible = visible && isRowExpanded;
if (expandedRowContent && isRowExpanded) {
rst.push(this.getExpandedRow(key, expandedRowContent, subVisible, expandedRowClassName(record, i), fixed));
}
if (childrenColumn) {
rst = rst.concat(this.getRowsByData(childrenColumn, subVisible, indent + 1, columns, fixed));
}
}
return rst;
},
getRows: function getRows(columns, fixed) {
return this.getRowsByData(this.state.data, true, 0, columns, fixed);
},
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'
}));
}
cols = cols.concat((columns || this.props.columns).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
);
},
getCurrentColumns: function getCurrentColumns() {
var _this = this;
var _props2 = this.props;
var columns = _props2.columns;
var columnsPageRange = _props2.columnsPageRange;
var columnsPageSize = _props2.columnsPageSize;
var prefixCls = _props2.prefixCls;
var currentColumnsPage = this.state.currentColumnsPage;
if (!columnsPageRange || columnsPageRange[0] > columnsPageRange[1]) {
return columns;
}
return columns.map(function (column, i) {
var newColumn = _extends({}, column);
if (i >= columnsPageRange[0] && i <= columnsPageRange[1]) {
var pageIndexStart = columnsPageRange[0] + currentColumnsPage * columnsPageSize;
var pageIndexEnd = columnsPageRange[0] + (currentColumnsPage + 1) * columnsPageSize - 1;
if (pageIndexEnd > columnsPageRange[1]) {
pageIndexEnd = columnsPageRange[1];
}
if (i < pageIndexStart || i > pageIndexEnd) {
newColumn.className = newColumn.className || '';
newColumn.className += ' ' + prefixCls + '-column-hidden';
}
newColumn = _this.wrapPageColumn(newColumn, i === pageIndexStart, i === pageIndexEnd);
}
return newColumn;
});
},
getLeftFixedTable: function getLeftFixedTable() {
var columns = this.props.columns;
var fixedColumns = columns.filter(function (column) {
return column.fixed === 'left' || column.fixed === true;
});
return this.getTable({
columns: fixedColumns,
fixed: 'left'
});
},
getRightFixedTable: function getRightFixedTable() {
var columns = this.props.columns;
var fixedColumns = columns.filter(function (column) {
return column.fixed === 'right';
});
return this.getTable({
columns: fixedColumns,
fixed: 'right'
});
},
getTable: function getTable() {
var _this2 = this;
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var columns = options.columns;
var fixed = options.fixed;
var _props3 = this.props;
var prefixCls = _props3.prefixCls;
var _props3$scroll = _props3.scroll;
var scroll = _props3$scroll === undefined ? {} : _props3$scroll;
var getBodyWrapper = _props3.getBodyWrapper;
var useFixedHeader = this.props.useFixedHeader;
var bodyStyle = _extends({}, this.props.bodyStyle);
var headStyle = {};
var tableClassName = '';
if (scroll.x || columns) {
tableClassName = prefixCls + '-fixed';
bodyStyle.overflowX = bodyStyle.overflowX || 'auto';
}
if (scroll.y) {
// maxHeight will make fixed-Table scrolling not working
// so we only set maxHeight to body-Table here
if (fixed) {
bodyStyle.height = bodyStyle.height || scroll.y;
} 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 ? true : arguments[0];
var hasBody = arguments.length <= 1 || arguments[1] === undefined ? true : arguments[1];
var tableStyle = {};
if (!columns && 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' },
_this2.getRows(columns, fixed)
)) : null;
return _react2["default"].createElement(
'table',
{ className: tableClassName, style: tableStyle },
_this2.getColGroup(columns, fixed),
hasHead ? _this2.getHeader(columns, fixed) : null,
tableBody
);
};
var headTable = void 0;
if (useFixedHeader) {
headTable = _react2["default"].createElement(
'div',
{
className: prefixCls + '-header',
ref: columns ? null : 'headTable',
style: headStyle,
onMouseOver: this.detectScrollTarget,
onTouchStart: this.detectScrollTarget,
onScroll: this.handleBodyScroll
},
renderTable(true, false)
);
}
var BodyTable = _react2["default"].createElement(
'div',
{
className: prefixCls + '-body',
style: bodyStyle,
ref: 'bodyTable',
onMouseOver: this.detectScrollTarget,
onTouchStart: this.detectScrollTarget,
onScroll: this.handleBodyScroll
},
renderTable(!useFixedHeader)
);
if (columns && 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',
{
className: prefixCls + '-body-outer',
style: _extends({}, bodyStyle)
},
_react2["default"].createElement(
'div',
{
className: prefixCls + '-body-inner',
ref: refName,
onMouseOver: this.detectScrollTarget,
onTouchStart: this.detectScrollTarget,
onScroll: this.handleBodyScroll
},
renderTable(!useFixedHeader)
)
);
}
return _react2["default"].createElement(
'span',
null,
headTable,
BodyTable
);
},
getTitle: function getTitle() {
var _props4 = this.props;
var title = _props4.title;
var prefixCls = _props4.prefixCls;
return title ? _react2["default"].createElement(
'div',
{ className: prefixCls + '-title' },
title(this.state.data)
) : null;
},
getFooter: function getFooter() {
var _props5 = this.props;
var footer = _props5.footer;
var prefixCls = _props5.prefixCls;
return footer ? _react2["default"].createElement(
'div',
{ className: prefixCls + '-footer' },
footer(this.state.data)
) : null;
},
getMaxColumnsPage: function getMaxColumnsPage() {
var _props6 = this.props;
var columnsPageRange = _props6.columnsPageRange;
var columnsPageSize = _props6.columnsPageSize;
return Math.ceil((columnsPageRange[1] - columnsPageRange[0] + 1) / columnsPageSize) - 1;
},
goToColumnsPage: function goToColumnsPage(currentColumnsPage) {
var maxColumnsPage = this.getMaxColumnsPage();
var page = currentColumnsPage;
if (page < 0) {
page = 0;
}
if (page > maxColumnsPage) {
page = maxColumnsPage;
}
this.setState({
currentColumnsPage: page
});
},
syncFixedTableRowHeight: function syncFixedTableRowHeight() {
var _this3 = this;
var prefixCls = this.props.prefixCls;
var headRows = this.refs.headTable ? this.refs.headTable.querySelectorAll('tr') : [];
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.timer = setTimeout(function () {
_this3.setState({
fixedColumnsHeadRowsHeight: fixedColumnsHeadRowsHeight,
fixedColumnsBodyRowsHeight: fixedColumnsBodyRowsHeight
});
});
},
resetScrollY: function resetScrollY() {
if (this.refs.headTable) {
this.refs.headTable.scrollLeft = 0;
}
if (this.refs.bodyTable) {
this.refs.bodyTable.scrollLeft = 0;
}
},
prevColumnsPage: function prevColumnsPage() {
this.goToColumnsPage(this.state.currentColumnsPage - 1);
},
nextColumnsPage: function nextColumnsPage() {
this.goToColumnsPage(this.state.currentColumnsPage + 1);
},
wrapPageColumn: function wrapPageColumn(column, hasPrev, hasNext) {
var prefixCls = this.props.prefixCls;
var currentColumnsPage = this.state.currentColumnsPage;
var maxColumnsPage = this.getMaxColumnsPage();
var prevHandlerCls = prefixCls + '-prev-columns-page';
if (currentColumnsPage === 0) {
prevHandlerCls += ' ' + prefixCls + '-prev-columns-page-disabled';
}
var prevHandler = _react2["default"].createElement('span', { className: prevHandlerCls, onClick: this.prevColumnsPage });
var nextHandlerCls = prefixCls + '-next-columns-page';
if (currentColumnsPage === maxColumnsPage) {
nextHandlerCls += ' ' + prefixCls + '-next-columns-page-disabled';
}
var nextHandler = _react2["default"].createElement('span', { className: nextHandlerCls, onClick: this.nextColumnsPage });
if (hasPrev) {
column.title = _react2["default"].createElement(
'span',
null,
prevHandler,
column.title
);
column.className = (column.className || '') + ' ' + prefixCls + '-column-has-prev';
}
if (hasNext) {
column.title = _react2["default"].createElement(
'span',
null,
column.title,
nextHandler
);
column.className = (column.className || '') + ' ' + prefixCls + '-column-has-next';
}
return column;
},
findExpandedRow: function findExpandedRow(record) {
var _this4 = this;
var rows = this.getExpandedRows().filter(function (i) {
return i === _this4.getRowKey(record);
});
return rows[0];
},
isRowExpanded: function isRowExpanded(record) {
return typeof this.findExpandedRow(record) !== 'undefined';
},
detectScrollTarget: function detectScrollTarget(e) {
if (this.scrollTarget !== e.currentTarget) {
this.scrollTarget = e.currentTarget;
}
},
isAnyColumnsFixed: function isAnyColumnsFixed() {
if ('isAnyColumnsFixedCache' in this) {
return this.isAnyColumnsFixedCache;
}
this.isAnyColumnsFixedCache = this.getCurrentColumns().some(function (column) {
return !!column.fixed;
});
return this.isAnyColumnsFixedCache;
},
isAnyColumnsLeftFixed: function isAnyColumnsLeftFixed() {
if ('isAnyColumnsLeftFixedCache' in this) {
return this.isAnyColumnsLeftFixedCache;
}
this.isAnyColumnsLeftFixedCache = this.getCurrentColumns().some(function (column) {
return column.fixed === 'left' || column.fixed === true;
});
return this.isAnyColumnsLeftFixedCache;
},
isAnyColumnsRightFixed: function isAnyColumnsRightFixed() {
if ('isAnyColumnsRightFixedCache' in this) {
return this.isAnyColumnsRightFixedCache;
}
this.isAnyColumnsRightFixedCache = this.getCurrentColumns().some(function (column) {
return column.fixed === 'right';
});
return this.isAnyColumnsRightFixedCache;
},
handleBodyScroll: function handleBodyScroll(e) {
// Prevent scrollTop setter trigger onScroll event
// http://stackoverflow.com/q/1386696
if (e.target !== this.scrollTarget) {
return;
}
var _props$scroll = this.props.scroll;
var scroll = _props$scroll === undefined ? {} : _props$scroll;
var _refs = this.refs;
var headTable = _refs.headTable;
var bodyTable = _refs.bodyTable;
var fixedColumnsBodyLeft = _refs.fixedColumnsBodyLeft;
var fixedColumnsBodyRight = _refs.fixedColumnsBodyRight;
if (scroll.x) {
if (e.target === bodyTable && headTable) {
headTable.scrollLeft = e.target.scrollLeft;
} else if (e.target === headTable && bodyTable) {
bodyTable.scrollLeft = e.target.scrollLeft;
}
if (e.target.scrollLeft === 0) {
this.setState({ scrollPosition: 'left' });
} else if (e.target.scrollLeft + 1 >= e.target.children[0].getBoundingClientRect().width - e.target.getBoundingClientRect().width) {
this.setState({ scrollPosition: 'right' });
} else if (this.state.scrollPosition !== 'middle') {
this.setState({ scrollPosition: 'middle' });
}
}
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;
}
}
},
handleRowHover: function handleRowHover(isHover, key) {
this.setState({
currentHoverKey: isHover ? key : null
});
},
render: function render() {
var props = this.props;
var prefixCls = props.prefixCls;
var className = props.prefixCls;
if (props.className) {
className += ' ' + props.className;
}
if (props.columnsPageRange) {
className += ' ' + prefixCls + '-columns-paging';
}
if (props.useFixedHeader || props.scroll && props.scroll.y) {
className += ' ' + prefixCls + '-fixed-header';
}
className += ' ' + prefixCls + '-scroll-position-' + this.state.scrollPosition;
var isTableScroll = this.isAnyColumnsFixed() || props.scroll.x || props.scroll.y;
return _react2["default"].createElement(
'div',
{ className: className, style: props.style },
this.getTitle(),
_react2["default"].createElement(
'div',
{ className: prefixCls + '-content' },
this.isAnyColumnsLeftFixed() && _react2["default"].createElement(
'div',
{ className: prefixCls + '-fixed-left' },
this.getLeftFixedTable()
),
_react2["default"].createElement(
'div',
{ className: isTableScroll ? prefixCls + '-scroll' : '' },
this.getTable(),
this.getFooter()
),
this.isAnyColumnsRightFixed() && _react2["default"].createElement(
'div',
{ className: prefixCls + '-fixed-right' },
this.getRightFixedTable()
)
)
);
}
});
exports["default"] = Table;
module.exports = exports['default'];
/***/ },
/* 397 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _objectPath = __webpack_require__(360);
var _objectPath2 = _interopRequireDefault(_objectPath);
var _shallowequal = __webpack_require__(49);
var _shallowequal2 = _interopRequireDefault(_shallowequal);
var _ExpandIcon = __webpack_require__(110);
var _ExpandIcon2 = _interopRequireDefault(_ExpandIcon);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var TableCell = _react2["default"].createClass({
displayName: 'TableCell',
propTypes: {
record: _react.PropTypes.object,
prefixCls: _react.PropTypes.string,
isColumnHaveExpandIcon: _react.PropTypes.bool,
index: _react.PropTypes.number,
expanded: _react.PropTypes.bool,
expandable: _react.PropTypes.any,
onExpand: _react.PropTypes.func,
needIndentSpaced: _react.PropTypes.bool,
indent: _react.PropTypes.number,
indentSize: _react.PropTypes.number,
column: _react.PropTypes.object
},
shouldComponentUpdate: function shouldComponentUpdate(nextProps) {
return !(0, _shallowequal2["default"])(nextProps, this.props);
},
isInvalidRenderCellText: function isInvalidRenderCellText(text) {
return text && !_react2["default"].isValidElement(text) && Object.prototype.toString.call(text) === '[object Object]';
},
render: function render() {
var _props = this.props;
var record = _props.record;
var indentSize = _props.indentSize;
var prefixCls = _props.prefixCls;
var indent = _props.indent;
var isColumnHaveExpandIcon = _props.isColumnHaveExpandIcon;
var index = _props.index;
var expandable = _props.expandable;
var onExpand = _props.onExpand;
var needIndentSpaced = _props.needIndentSpaced;
var expanded = _props.expanded;
var column = _props.column;
var dataIndex = column.dataIndex;
var render = column.render;
var className = column.className;
var text = _objectPath2["default"].get(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 || {};
rowSpan = tdProps.rowSpan;
colSpan = tdProps.colSpan;
text = text.children;
}
}
// Fix https://github.com/ant-design/ant-design/issues/1202
if (this.isInvalidRenderCellText(text)) {
text = null;
}
var expandIcon = _react2["default"].createElement(_ExpandIcon2["default"], {
expandable: expandable,
prefixCls: prefixCls,
onExpand: onExpand,
needIndentSpaced: needIndentSpaced,
expanded: expanded,
record: record
});
var indentText = _react2["default"].createElement('span', {
style: { paddingLeft: indentSize * indent + 'px' },
className: prefixCls + '-indent indent-level-' + indent
});
if (rowSpan === 0 || colSpan === 0) {
return null;
}
return _react2["default"].createElement(
'td',
{
colSpan: colSpan,
rowSpan: rowSpan,
className: className || ''
},
isColumnHaveExpandIcon ? indentText : null,
isColumnHaveExpandIcon ? expandIcon : null,
text
);
}
});
exports["default"] = TableCell;
module.exports = exports['default'];
/***/ },
/* 398 */
/***/ 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 _shallowequal = __webpack_require__(49);
var _shallowequal2 = _interopRequireDefault(_shallowequal);
var _TableCell = __webpack_require__(397);
var _TableCell2 = _interopRequireDefault(_TableCell);
var _ExpandIcon = __webpack_require__(110);
var _ExpandIcon2 = _interopRequireDefault(_ExpandIcon);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var TableRow = _react2["default"].createClass({
displayName: 'TableRow',
propTypes: {
onDestroy: _react.PropTypes.func,
onRowClick: _react.PropTypes.func,
record: _react.PropTypes.object,
prefixCls: _react.PropTypes.string,
expandIconColumnIndex: _react.PropTypes.number,
onHover: _react.PropTypes.func,
columns: _react.PropTypes.array,
style: _react.PropTypes.object,
visible: _react.PropTypes.bool,
index: _react.PropTypes.number,
hoverKey: _react.PropTypes.any,
expanded: _react.PropTypes.bool,
expandable: _react.PropTypes.any,
onExpand: _react.PropTypes.func,
needIndentSpaced: _react.PropTypes.bool,
className: _react.PropTypes.string,
indent: _react.PropTypes.number,
indentSize: _react.PropTypes.number,
expandIconAsCell: _react.PropTypes.bool
},
getDefaultProps: function getDefaultProps() {
return {
onRowClick: function onRowClick() {},
onDestroy: function onDestroy() {},
expandIconColumnIndex: 0,
onHover: function onHover() {}
};
},
shouldComponentUpdate: function shouldComponentUpdate(nextProps) {
return !(0, _shallowequal2["default"])(nextProps, this.props);
},
componentWillUnmount: function componentWillUnmount() {
this.props.onDestroy(this.props.record);
},
onRowClick: function onRowClick() {
var _props = this.props;
var record = _props.record;
var index = _props.index;
var onRowClick = _props.onRowClick;
onRowClick(record, index);
},
onMouseEnter: function onMouseEnter() {
var _props2 = this.props;
var onHover = _props2.onHover;
var hoverKey = _props2.hoverKey;
onHover(true, hoverKey);
},
onMouseLeave: function onMouseLeave() {
var _props3 = this.props;
var onHover = _props3.onHover;
var hoverKey = _props3.hoverKey;
onHover(false, hoverKey);
},
render: function render() {
var _props4 = this.props;
var prefixCls = _props4.prefixCls;
var columns = _props4.columns;
var record = _props4.record;
var style = _props4.style;
var visible = _props4.visible;
var index = _props4.index;
var expandIconColumnIndex = _props4.expandIconColumnIndex;
var expandIconAsCell = _props4.expandIconAsCell;
var expanded = _props4.expanded;
var expandable = _props4.expandable;
var onExpand = _props4.onExpand;
var needIndentSpaced = _props4.needIndentSpaced;
var className = _props4.className;
var indent = _props4.indent;
var indentSize = _props4.indentSize;
var cells = [];
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'
},
_react2["default"].createElement(_ExpandIcon2["default"], {
expandable: expandable,
prefixCls: prefixCls,
onExpand: onExpand,
needIndentSpaced: needIndentSpaced,
expanded: expanded,
record: record
})
));
}
var isColumnHaveExpandIcon = expandIconAsCell ? false : i === expandIconColumnIndex;
cells.push(_react2["default"].createElement(_TableCell2["default"], {
prefixCls: prefixCls,
record: record,
indentSize: indentSize,
indent: indent,
index: index,
expandable: expandable,
onExpand: onExpand,
needIndentSpaced: needIndentSpaced,
expanded: expanded,
isColumnHaveExpandIcon: isColumnHaveExpandIcon,
column: columns[i],
key: columns[i].key
}));
}
return _react2["default"].createElement(
'tr',
{
onClick: this.onRowClick,
onMouseEnter: this.onMouseEnter,
onMouseLeave: this.onMouseLeave,
className: prefixCls + ' ' + className + ' ' + prefixCls + '-level-' + indent,
style: visible ? style : _extends({}, style, { display: 'none' })
},
cells
);
}
});
exports["default"] = TableRow;
module.exports = exports['default'];
/***/ },
/* 399 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
module.exports = __webpack_require__(396);
/***/ },
/* 400 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.measureScrollbar = measureScrollbar;
exports.debounce = debounce;
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 (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;
return 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);
}
};
}
/***/ },
/* 401 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _utils = __webpack_require__(112);
function _componentDidUpdate(component) {
var refs = component.refs;
var containerNode = refs.nav;
var containerOffset = (0, _utils.offset)(containerNode);
var inkBarNode = refs.inkBar;
var activeTab = refs.activeTab;
var tabPosition = component.props.tabPosition;
if (activeTab) {
var tabNode = activeTab;
var tabOffset = (0, _utils.offset)(tabNode);
var transformPropertyName = (0, _utils.getTransformPropertyName)();
if (tabPosition === 'top' || tabPosition === 'bottom') {
var left = tabOffset.left - containerOffset.left;
// use 3d gpu to optimize render
if (transformPropertyName) {
inkBarNode.style[transformPropertyName] = 'translate3d(' + left + 'px,0,0)';
inkBarNode.style.width = tabNode.offsetWidth + 'px';
inkBarNode.style.height = '';
} else {
inkBarNode.style.left = left + 'px';
inkBarNode.style.top = '';
inkBarNode.style.bottom = '';
inkBarNode.style.right = containerNode.offsetWidth - left - tabNode.offsetWidth + 'px';
}
} else {
var top = tabOffset.top - containerOffset.top;
if (transformPropertyName) {
inkBarNode.style[transformPropertyName] = 'translate3d(0,' + top + 'px,0)';
inkBarNode.style.height = tabNode.offsetHeight + 'px';
inkBarNode.style.width = '';
} else {
inkBarNode.style.left = '';
inkBarNode.style.right = '';
inkBarNode.style.top = top + 'px';
inkBarNode.style.bottom = containerNode.offsetHeight - top - tabNode.offsetHeight + 'px';
}
}
}
inkBarNode.style.display = activeTab ? 'block' : 'none';
}
exports["default"] = {
componentDidUpdate: function componentDidUpdate() {
_componentDidUpdate(this);
},
componentDidMount: function componentDidMount() {
_componentDidUpdate(this);
}
};
module.exports = exports['default'];
/***/ },
/* 402 */
/***/ 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'];
/***/ },
/* 403 */
/***/ 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 _classnames3 = __webpack_require__(5);
var _classnames4 = _interopRequireDefault(_classnames3);
var _InkBarMixin = __webpack_require__(401);
var _InkBarMixin2 = _interopRequireDefault(_InkBarMixin);
var _utils = __webpack_require__(112);
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 tabBarExtraContentStyle = {
"float": 'right'
};
function noop() {}
var Nav = _react2["default"].createClass({
displayName: 'Nav',
propTypes: {
tabPosition: _react.PropTypes.string,
tabBarExtraContent: _react.PropTypes.any,
onTabClick: _react.PropTypes.func,
onKeyDown: _react.PropTypes.func
},
mixins: [_InkBarMixin2["default"]],
getInitialState: function getInitialState() {
return {
next: false,
offset: 0,
prev: false
};
},
componentDidMount: function componentDidMount() {
this.componentDidUpdate();
},
componentDidUpdate: function componentDidUpdate(prevProps) {
var props = this.props;
if (prevProps && prevProps.tabPosition !== props.tabPosition) {
this.setOffset(0);
return;
}
var navNode = this.refs.nav;
var navNodeWH = this.getOffsetWH(navNode);
var navWrapNode = this.refs.navWrap;
var navWrapNodeWH = this.getOffsetWH(navWrapNode);
var state = this.state;
var offset = state.offset;
var minOffset = navWrapNodeWH - navNodeWH;
var _state = this.state;
var next = _state.next;
var prev = _state.prev;
if (minOffset >= 0) {
next = false;
this.setOffset(0);
offset = 0;
} else if (minOffset < offset) {
next = true;
} else {
next = false;
this.setOffset(minOffset);
offset = minOffset;
}
if (offset < 0) {
prev = true;
} else {
prev = false;
}
this.setNext(next);
this.setPrev(prev);
var nextPrev = {
next: next,
prev: prev
};
// wait next,prev show hide
if (this.isNextPrevShown(state) !== this.isNextPrevShown(nextPrev)) {
this.setNextPrev({}, this.scrollToActiveTab);
} else {
// can not use props.activeKey
if (!prevProps || props.activeKey !== prevProps.activeKey) {
this.scrollToActiveTab();
}
}
},
onTabClick: function onTabClick(key) {
this.props.onTabClick(key);
},
// work around eslint warning
setNextPrev: function setNextPrev(nextPrev, callback) {
this.setState(nextPrev, callback);
},
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) {
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',
_extends({
role: 'tab',
'aria-disabled': child.props.disabled ? 'true' : 'false',
'aria-selected': activeKey === key ? 'true' : 'false'
}, events, {
className: cls,
key: key
}, ref),
_react2["default"].createElement(
'div',
{ className: prefixCls + '-tab-inner' },
child.props.tab
)
));
});
return rst;
},
getOffsetWH: function getOffsetWH(node) {
var tabPosition = this.props.tabPosition;
var prop = 'offsetWidth';
if (tabPosition === 'left' || tabPosition === 'right') {
prop = 'offsetHeight';
}
return node[prop];
},
getOffsetLT: function getOffsetLT(node) {
var tabPosition = this.props.tabPosition;
var prop = 'left';
if (tabPosition === 'left' || tabPosition === 'right') {
prop = 'top';
}
return node.getBoundingClientRect()[prop];
},
setOffset: function setOffset(offset) {
var target = Math.min(0, offset);
if (this.state.offset !== target) {
this.setState({
offset: target
});
var navOffset = {};
var tabPosition = this.props.tabPosition;
var transformProperty = (0, _utils.getTransformPropertyName)();
if (tabPosition === 'left' || tabPosition === 'right') {
if (transformProperty) {
navOffset = {
name: transformProperty,
value: 'translate3d(0,' + target + 'px,0)'
};
} else {
navOffset = {
name: 'top',
value: target + 'px'
};
}
} else {
if (transformProperty) {
navOffset = {
name: transformProperty,
value: 'translate3d(' + target + 'px,0,0)'
};
} else {
navOffset = {
name: 'left',
value: target + 'px'
};
}
}
this.refs.nav.style[navOffset.name] = navOffset.value;
}
},
setPrev: function setPrev(v) {
if (this.state.prev !== v) {
this.setState({
prev: v
});
}
},
setNext: function setNext(v) {
if (this.state.next !== v) {
this.setState({
next: v
});
}
},
isNextPrevShown: function isNextPrevShown(state) {
return state.next || state.prev;
},
scrollToActiveTab: function scrollToActiveTab() {
var _refs = this.refs;
var activeTab = _refs.activeTab;
var navWrap = _refs.navWrap;
if (activeTab) {
var activeTabWH = this.getOffsetWH(activeTab);
var navWrapNodeWH = this.getOffsetWH(navWrap);
var offset = this.state.offset;
var wrapOffset = this.getOffsetLT(navWrap);
var activeTabOffset = this.getOffsetLT(activeTab);
if (wrapOffset > activeTabOffset) {
offset += wrapOffset - activeTabOffset;
this.setState({
offset: offset
});
} else if (wrapOffset + navWrapNodeWH < activeTabOffset + activeTabWH) {
offset -= activeTabOffset + activeTabWH - (wrapOffset + navWrapNodeWH);
this.setState({
offset: offset
});
}
}
},
prev: function prev() {
var navWrapNode = this.refs.navWrap;
var navWrapNodeWH = this.getOffsetWH(navWrapNode);
var state = this.state;
var offset = state.offset;
this.setOffset(offset + navWrapNodeWH);
},
next: function next() {
var navWrapNode = this.refs.navWrap;
var navWrapNodeWH = this.getOffsetWH(navWrapNode);
var state = this.state;
var offset = state.offset;
this.setOffset(offset - navWrapNodeWH);
},
render: function render() {
var props = this.props;
var state = this.state;
var prefixCls = props.prefixCls;
var tabs = this.getTabs();
var tabMovingDirection = props.tabMovingDirection;
var inkBarClass = prefixCls + '-ink-bar';
if (tabMovingDirection) {
inkBarClass += ' ' + prefixCls + '-ink-bar-transition-' + tabMovingDirection;
}
var nextButton = void 0;
var prevButton = void 0;
var showNextPrev = state.prev || state.next;
if (showNextPrev) {
var _classnames, _classnames2;
prevButton = _react2["default"].createElement(
'span',
{
onClick: state.prev ? this.prev : noop,
unselectable: 'unselectable',
className: (0, _classnames4["default"])((_classnames = {}, _defineProperty(_classnames, prefixCls + '-tab-prev', 1), _defineProperty(_classnames, prefixCls + '-tab-btn-disabled', !state.prev), _classnames))
},
_react2["default"].createElement('span', { className: prefixCls + '-tab-prev-icon' })
);
nextButton = _react2["default"].createElement(
'span',
{
onClick: state.next ? this.next : noop,
unselectable: 'unselectable',
className: (0, _classnames4["default"])((_classnames2 = {}, _defineProperty(_classnames2, prefixCls + '-tab-next', 1), _defineProperty(_classnames2, prefixCls + '-tab-btn-disabled', !state.next), _classnames2))
},
_react2["default"].createElement('span', { className: prefixCls + '-tab-next-icon' })
);
}
var tabBarExtraContent = this.props.tabBarExtraContent;
return _react2["default"].createElement(
'div',
{
role: 'tablist',
className: prefixCls + '-bar',
tabIndex: '0',
onKeyDown: this.props.onKeyDown
},
tabBarExtraContent ? _react2["default"].createElement(
'div',
{ style: tabBarExtraContentStyle },
tabBarExtraContent
) : null,
_react2["default"].createElement(
'div',
{
className: prefixCls + '-nav-container ' + (showNextPrev ? prefixCls + '-nav-container-scrolling' : ''),
style: props.style,
ref: 'container'
},
prevButton,
nextButton,
_react2["default"].createElement(
'div',
{ className: prefixCls + '-nav-wrap', ref: 'navWrap' },
_react2["default"].createElement(
'div',
{ className: prefixCls + '-nav-scroll' },
_react2["default"].createElement(
'div',
{ className: prefixCls + '-nav', ref: 'nav' },
_react2["default"].createElement('div', { className: inkBarClass, ref: 'inkBar' }),
tabs
)
)
)
)
);
}
});
exports["default"] = Nav;
module.exports = exports['default'];
/***/ },
/* 404 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _KeyCode = __webpack_require__(402);
var _KeyCode2 = _interopRequireDefault(_KeyCode);
var _TabPane = __webpack_require__(111);
var _TabPane2 = _interopRequireDefault(_TabPane);
var _Nav = __webpack_require__(403);
var _Nav2 = _interopRequireDefault(_Nav);
var _rcAnimate = __webpack_require__(31);
var _rcAnimate2 = _interopRequireDefault(_rcAnimate);
var _classnames2 = __webpack_require__(5);
var _classnames3 = _interopRequireDefault(_classnames2);
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; }
function noop() {}
function getDefaultActiveKey(props) {
var activeKey = void 0;
_react2["default"].Children.forEach(props.children, function (child) {
if (!activeKey && !child.props.disabled) {
activeKey = child.key;
}
});
return activeKey;
}
var Tabs = _react2["default"].createClass({
displayName: 'Tabs',
propTypes: {
destroyInactiveTabPane: _react.PropTypes.bool,
onTabClick: _react.PropTypes.func,
onChange: _react.PropTypes.func,
children: _react.PropTypes.any,
tabBarExtraContent: _react.PropTypes.any,
animation: _react.PropTypes.string,
prefixCls: _react.PropTypes.string,
className: _react.PropTypes.string,
tabPosition: _react.PropTypes.string
},
getDefaultProps: function getDefaultProps() {
return {
prefixCls: 'rc-tabs',
destroyInactiveTabPane: false,
tabBarExtraContent: null,
onChange: noop,
tabPosition: 'top',
style: {},
contentStyle: {},
navStyle: {},
onTabClick: noop
};
},
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) {
var newActiveKey = this.state.activeKey;
if ('activeKey' in nextProps) {
newActiveKey = nextProps.activeKey;
if (!newActiveKey) {
this.setState({
activeKey: newActiveKey
});
return;
}
}
var found = void 0;
_react2["default"].Children.forEach(nextProps.children, function (child) {
if (child.key === newActiveKey) {
found = true;
}
});
if (found) {
this.setActiveKey(newActiveKey, nextProps);
} else {
this.setActiveKey(getDefaultActiveKey(nextProps), nextProps);
}
},
onTabClick: function onTabClick(key) {
this.setActiveKey(key);
this.props.onTabClick(key);
if (this.state.activeKey !== key) {
this.props.onChange(key);
}
},
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);
}
},
getNextActiveKey: function getNextActiveKey(next) {
var activeKey = this.state.activeKey;
var children = [];
_react2["default"].Children.forEach(this.props.children, function (c) {
if (!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;
},
getTabPanes: function getTabPanes() {
var state = this.state;
var props = this.props;
var activeKey = state.activeKey;
var children = props.children;
var newChildren = [];
_react2["default"].Children.forEach(children, function (child) {
var key = child.key;
var active = activeKey === key;
newChildren.push(_react2["default"].cloneElement(child, {
active: active,
// eventKey: key,
rootPrefixCls: props.prefixCls
}));
});
return newChildren;
},
getIndexPair: function getIndexPair(props, currentActiveKey, activeKey) {
var keys = [];
_react2["default"].Children.forEach(props.children, function (c) {
keys.push(c.key);
});
var currentIndex = keys.indexOf(currentActiveKey);
var nextIndex = keys.indexOf(activeKey);
return {
currentIndex: currentIndex, nextIndex: nextIndex
};
},
setActiveKey: function setActiveKey(activeKey, ps) {
var props = ps || this.props;
var currentActiveKey = this.state.activeKey;
if (currentActiveKey === activeKey || 'activeKey' in props && props === this.props) {
return;
}
if (!currentActiveKey) {
this.setState({
activeKey: activeKey
});
} else {
var _getIndexPair = this.getIndexPair(props, currentActiveKey, activeKey);
var currentIndex = _getIndexPair.currentIndex;
var nextIndex = _getIndexPair.nextIndex;
// removed
if (currentIndex === -1) {
var newPair = this.getIndexPair(this.props, currentActiveKey, activeKey);
currentIndex = newPair.currentIndex;
nextIndex = newPair.nextIndex;
}
var tabMovingDirection = currentIndex > nextIndex ? 'backward' : 'forward';
this.setState({
activeKey: activeKey,
tabMovingDirection: tabMovingDirection
});
}
},
render: function render() {
var _classnames;
var props = this.props;
var destroyInactiveTabPane = props.destroyInactiveTabPane;
var prefixCls = props.prefixCls;
var tabPosition = props.tabPosition;
var className = props.className;
var animation = props.animation;
var cls = (0, _classnames3["default"])((_classnames = {}, _defineProperty(_classnames, prefixCls, 1), _defineProperty(_classnames, prefixCls + '-' + tabPosition, 1), _defineProperty(_classnames, className, !!className), _classnames));
var tabMovingDirection = this.state.tabMovingDirection;
var tabPanes = this.getTabPanes();
var transitionName = void 0;
transitionName = props.transitionName && props.transitionName[tabMovingDirection || 'backward'];
if (!transitionName && animation) {
transitionName = prefixCls + '-' + animation + '-' + (tabMovingDirection || 'backward');
}
if (destroyInactiveTabPane) {
tabPanes = tabPanes.filter(function (panel) {
return panel.props.active;
});
}
if (transitionName) {
if (destroyInactiveTabPane) {
tabPanes = _react2["default"].createElement(
_rcAnimate2["default"],
{
exclusive: true,
component: 'div',
transitionName: transitionName
},
tabPanes
);
} else {
tabPanes = _react2["default"].createElement(
_rcAnimate2["default"],
{
showProp: 'active',
exclusive: true,
component: 'div',
transitionName: transitionName
},
tabPanes
);
}
}
var contents = [_react2["default"].createElement(_Nav2["default"], {
prefixCls: prefixCls,
key: 'nav',
onKeyDown: this.onNavKeyDown,
tabBarExtraContent: this.props.tabBarExtraContent,
tabPosition: tabPosition,
style: props.navStyle,
onTabClick: this.onTabClick,
tabMovingDirection: tabMovingDirection,
panels: this.props.children,
activeKey: this.state.activeKey
}), _react2["default"].createElement(
'div',
{
className: prefixCls + '-content',
style: props.contentStyle,
key: 'content'
},
tabPanes
)];
if (tabPosition === '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'];
/***/ },
/* 405 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.TabPane = exports["default"] = undefined;
var _Tabs = __webpack_require__(404);
var _Tabs2 = _interopRequireDefault(_Tabs);
var _TabPane2 = __webpack_require__(111);
var _TabPane3 = _interopRequireDefault(_TabPane2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
exports["default"] = _Tabs2["default"];
exports.TabPane = _TabPane3["default"];
/***/ },
/* 406 */
/***/ 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 _placements = __webpack_require__(407);
var _rcTrigger = __webpack_require__(411);
var _rcTrigger2 = _interopRequireDefault(_rcTrigger);
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; }
var Tooltip = _react2["default"].createClass({
displayName: 'Tooltip',
propTypes: {
trigger: _react.PropTypes.any,
children: _react.PropTypes.any,
defaultVisible: _react.PropTypes.bool,
visible: _react.PropTypes.bool,
placement: _react.PropTypes.string,
transitionName: _react.PropTypes.string,
animation: _react.PropTypes.any,
onVisibleChange: _react.PropTypes.func,
afterVisibleChange: _react.PropTypes.func,
overlay: _react.PropTypes.oneOfType([_react2["default"].PropTypes.node, _react2["default"].PropTypes.func]).isRequired,
overlayStyle: _react.PropTypes.object,
overlayClassName: _react.PropTypes.string,
prefixCls: _react.PropTypes.string,
mouseEnterDelay: _react.PropTypes.number,
mouseLeaveDelay: _react.PropTypes.number,
getTooltipContainer: _react.PropTypes.func,
destroyTooltipOnHide: _react.PropTypes.bool,
align: _react.PropTypes.object,
arrowContent: _react.PropTypes.any
},
getDefaultProps: function getDefaultProps() {
return {
prefixCls: 'rc-tooltip',
mouseEnterDelay: 0,
destroyTooltipOnHide: false,
mouseLeaveDelay: 0.1,
align: {},
placement: 'right',
trigger: ['hover'],
arrowContent: null
};
},
getPopupElement: function getPopupElement() {
var _props = this.props;
var arrowContent = _props.arrowContent;
var overlay = _props.overlay;
var prefixCls = _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
)];
},
getPopupDomNode: function getPopupDomNode() {
return this.refs.trigger.getPopupDomNode();
},
render: function render() {
var _props2 = this.props;
var overlayClassName = _props2.overlayClassName;
var trigger = _props2.trigger;
var mouseEnterDelay = _props2.mouseEnterDelay;
var mouseLeaveDelay = _props2.mouseLeaveDelay;
var overlayStyle = _props2.overlayStyle;
var prefixCls = _props2.prefixCls;
var children = _props2.children;
var onVisibleChange = _props2.onVisibleChange;
var transitionName = _props2.transitionName;
var animation = _props2.animation;
var placement = _props2.placement;
var align = _props2.align;
var destroyTooltipOnHide = _props2.destroyTooltipOnHide;
var defaultVisible = _props2.defaultVisible;
var getTooltipContainer = _props2.getTooltipContainer;
var restProps = _objectWithoutProperties(_props2, ['overlayClassName', 'trigger', 'mouseEnterDelay', 'mouseLeaveDelay', 'overlayStyle', 'prefixCls', 'children', 'onVisibleChange', 'transitionName', 'animation', 'placement', 'align', 'destroyTooltipOnHide', 'defaultVisible', 'getTooltipContainer']);
var extraProps = _extends({}, restProps);
if ('visible' in this.props) {
extraProps.popupVisible = this.props.visible;
}
return _react2["default"].createElement(
_rcTrigger2["default"],
_extends({
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
);
}
});
exports["default"] = Tooltip;
module.exports = exports['default'];
/***/ },
/* 407 */
/***/ 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;
/***/ },
/* 408 */
/***/ 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__(9);
var _reactDom2 = _interopRequireDefault(_reactDom);
var _rcAlign = __webpack_require__(363);
var _rcAlign2 = _interopRequireDefault(_rcAlign);
var _rcAnimate = __webpack_require__(31);
var _rcAnimate2 = _interopRequireDefault(_rcAnimate);
var _PopupInner = __webpack_require__(409);
var _PopupInner2 = _interopRequireDefault(_PopupInner);
var _LazyRenderBox = __webpack_require__(113);
var _LazyRenderBox2 = _interopRequireDefault(_LazyRenderBox);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var Popup = _react2["default"].createClass({
displayName: 'Popup',
propTypes: {
visible: _react.PropTypes.bool,
style: _react.PropTypes.object,
getClassNameFromAlign: _react.PropTypes.func,
onAlign: _react.PropTypes.func,
getRootDomNode: _react.PropTypes.func,
onMouseEnter: _react.PropTypes.func,
align: _react.PropTypes.any,
destroyPopupOnHide: _react.PropTypes.bool,
className: _react.PropTypes.string,
prefixCls: _react.PropTypes.string,
onMouseLeave: _react.PropTypes.func
},
componentDidMount: function componentDidMount() {
this.rootNode = this.getPopupDomNode();
},
onAlign: function onAlign(popupDomNode, align) {
var props = this.props;
var alignClassName = props.getClassNameFromAlign(props.align);
var currentAlignClassName = props.getClassNameFromAlign(align);
if (alignClassName !== currentAlignClassName) {
this.currentAlignClassName = currentAlignClassName;
popupDomNode.className = this.getClassName(currentAlignClassName);
}
props.onAlign(popupDomNode, align);
},
getPopupDomNode: function getPopupDomNode() {
return _reactDom2["default"].findDOMNode(this.refs.popup);
},
getTarget: function getTarget() {
return this.props.getRootDomNode();
},
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;
if (!transitionName && props.animation) {
transitionName = props.prefixCls + '-' + props.animation;
}
return transitionName;
},
getClassName: function getClassName(currentAlignClassName) {
return this.props.prefixCls + ' ' + this.props.className + ' ' + currentAlignClassName;
},
getPopupElement: function getPopupElement() {
var props = this.props;
var align = props.align;
var style = props.style;
var visible = props.visible;
var prefixCls = props.prefixCls;
var destroyPopupOnHide = props.destroyPopupOnHide;
var className = this.getClassName(this.currentAlignClassName || props.getClassNameFromAlign(align));
var hiddenClassName = prefixCls + '-hidden';
if (!visible) {
this.currentAlignClassName = null;
}
var newStyle = _extends({}, 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"],
_extends({
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"],
_extends({
hiddenClassName: hiddenClassName
}, popupInnerProps),
props.children
)
)
);
},
getZIndexStyle: function getZIndexStyle() {
var style = {};
var props = this.props;
if (props.zIndex !== undefined) {
style.zIndex = props.zIndex;
}
return style;
},
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;
},
saveAlign: function saveAlign(align) {
this.alignInstance = align;
},
render: function render() {
return _react2["default"].createElement(
'div',
null,
this.getMaskElement(),
this.getPopupElement()
);
}
});
exports["default"] = Popup;
module.exports = exports['default'];
/***/ },
/* 409 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _LazyRenderBox = __webpack_require__(113);
var _LazyRenderBox2 = _interopRequireDefault(_LazyRenderBox);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var PopupInner = _react2["default"].createClass({
displayName: 'PopupInner',
propTypes: {
hiddenClassName: _react.PropTypes.string,
className: _react.PropTypes.string,
prefixCls: _react.PropTypes.string,
onMouseEnter: _react.PropTypes.func,
onMouseLeave: _react.PropTypes.func,
children: _react.PropTypes.any
},
render: function render() {
var props = this.props;
var className = props.className;
if (!props.visible) {
className += ' ' + props.hiddenClassName;
}
return _react2["default"].createElement(
'div',
{
className: className,
onMouseEnter: props.onMouseEnter,
onMouseLeave: props.onMouseLeave,
style: props.style
},
_react2["default"].createElement(
_LazyRenderBox2["default"],
{ className: props.prefixCls + '-content', visible: props.visible },
props.children
)
);
}
});
exports["default"] = PopupInner;
module.exports = exports['default'];
/***/ },
/* 410 */
/***/ 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__(9);
var _reactDom2 = _interopRequireDefault(_reactDom);
var _contains = __webpack_require__(413);
var _contains2 = _interopRequireDefault(_contains);
var _addEventListener = __webpack_require__(46);
var _addEventListener2 = _interopRequireDefault(_addEventListener);
var _Popup = __webpack_require__(408);
var _Popup2 = _interopRequireDefault(_Popup);
var _utils = __webpack_require__(412);
var _getContainerRenderMixin = __webpack_require__(114);
var _getContainerRenderMixin2 = _interopRequireDefault(_getContainerRenderMixin);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function noop() {}
function returnEmptyString() {
return '';
}
var ALL_HANDLERS = ['onClick', 'onMouseDown', 'onTouchStart', 'onMouseEnter', 'onMouseLeave', 'onFocus', 'onBlur'];
var Trigger = _react2["default"].createClass({
displayName: 'Trigger',
propTypes: {
children: _react.PropTypes.any,
action: _react.PropTypes.oneOfType([_react.PropTypes.string, _react.PropTypes.arrayOf(_react.PropTypes.string)]),
showAction: _react.PropTypes.any,
hideAction: _react.PropTypes.any,
getPopupClassNameFromAlign: _react.PropTypes.any,
onPopupVisibleChange: _react.PropTypes.func,
afterPopupVisibleChange: _react.PropTypes.func,
popup: _react.PropTypes.oneOfType([_react.PropTypes.node, _react.PropTypes.func]).isRequired,
popupStyle: _react.PropTypes.object,
prefixCls: _react.PropTypes.string,
popupClassName: _react.PropTypes.string,
popupPlacement: _react.PropTypes.string,
builtinPlacements: _react.PropTypes.object,
popupTransitionName: _react.PropTypes.string,
popupAnimation: _react.PropTypes.any,
mouseEnterDelay: _react.PropTypes.number,
mouseLeaveDelay: _react.PropTypes.number,
zIndex: _react.PropTypes.number,
focusDelay: _react.PropTypes.number,
blurDelay: _react.PropTypes.number,
getPopupContainer: _react.PropTypes.func,
destroyPopupOnHide: _react.PropTypes.bool,
mask: _react.PropTypes.bool,
onPopupAlign: _react.PropTypes.func,
popupAlign: _react.PropTypes.object,
popupVisible: _react.PropTypes.bool,
maskTransitionName: _react.PropTypes.string,
maskAnimation: _react.PropTypes.string
},
mixins: [(0, _getContainerRenderMixin2["default"])({
autoMount: false,
isVisible: function isVisible(instance) {
return instance.state.popupVisible;
},
getContainer: function getContainer(instance) {
var popupContainer = document.createElement('div');
var mountNode = instance.props.getPopupContainer ? instance.props.getPopupContainer((0, _reactDom.findDOMNode)(instance)) : document.body;
mountNode.appendChild(popupContainer);
return popupContainer;
},
getComponent: function getComponent(instance) {
var props = instance.props;
var state = instance.state;
var mouseProps = {};
if (instance.isMouseEnterToShow()) {
mouseProps.onMouseEnter = instance.onPopupMouseEnter;
}
if (instance.isMouseLeaveToHide()) {
mouseProps.onMouseLeave = instance.onPopupMouseLeave;
}
return _react2["default"].createElement(
_Popup2["default"],
_extends({
prefixCls: props.prefixCls,
destroyPopupOnHide: props.destroyPopupOnHide,
visible: state.popupVisible,
className: props.popupClassName,
action: props.action,
align: instance.getPopupAlign(),
onAlign: props.onPopupAlign,
animation: props.popupAnimation,
getClassNameFromAlign: instance.getPopupClassNameFromAlign
}, mouseProps, {
getRootDomNode: instance.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
);
}
})],
getDefaultProps: function getDefaultProps() {
return {
prefixCls: 'rc-trigger-popup',
getPopupClassNameFromAlign: returnEmptyString,
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,
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 (this.isClickToHide()) {
if (state.popupVisible) {
if (!this.clickOutsideHandler) {
this.clickOutsideHandler = (0, _addEventListener2["default"])(document, 'mousedown', this.onDocumentClick);
this.touchOutsideHandler = (0, _addEventListener2["default"])(document, 'touchstart', this.onDocumentClick);
}
return;
}
}
if (this.clickOutsideHandler) {
this.clickOutsideHandler.remove();
this.touchOutsideHandler.remove();
this.clickOutsideHandler = null;
this.touchOutsideHandler = null;
}
},
componentWillUnmount: function componentWillUnmount() {
this.clearDelayTimer();
if (this.clickOutsideHandler) {
this.clickOutsideHandler.remove();
this.touchOutsideHandler.remove();
this.clickOutsideHandler = null;
this.touchOutsideHandler = null;
}
},
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) {
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.setPopupVisible(false);
}
},
getPopupDomNode: function getPopupDomNode() {
// for test
if (this._component) {
return this._component.isMounted() ? this._component.getPopupDomNode() : null;
}
return null;
},
getRootDomNode: function getRootDomNode() {
return _reactDom2["default"].findDOMNode(this);
},
getPopupClassNameFromAlign: function getPopupClassNameFromAlign(align) {
var className = [];
var props = this.props;
var popupPlacement = props.popupPlacement;
var builtinPlacements = props.builtinPlacements;
var 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;
var popupAlign = props.popupAlign;
var builtinPlacements = props.builtinPlacements;
if (popupPlacement && builtinPlacements) {
return (0, _utils.getAlignFromPlacement)(builtinPlacements, popupPlacement, popupAlign);
}
return popupAlign;
},
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;
}
},
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;
var action = _props.action;
var showAction = _props.showAction;
return action.indexOf('click') !== -1 || showAction.indexOf('click') !== -1;
},
isClickToHide: function isClickToHide() {
var _props2 = this.props;
var action = _props2.action;
var hideAction = _props2.hideAction;
return action.indexOf('click') !== -1 || hideAction.indexOf('click') !== -1;
},
isMouseEnterToShow: function isMouseEnterToShow() {
var _props3 = this.props;
var action = _props3.action;
var showAction = _props3.showAction;
return action.indexOf('hover') !== -1 || showAction.indexOf('mouseEnter') !== -1;
},
isMouseLeaveToHide: function isMouseLeaveToHide() {
var _props4 = this.props;
var action = _props4.action;
var hideAction = _props4.hideAction;
return action.indexOf('hover') !== -1 || hideAction.indexOf('mouseLeave') !== -1;
},
isFocusToShow: function isFocusToShow() {
var _props5 = this.props;
var action = _props5.action;
var showAction = _props5.showAction;
return action.indexOf('focus') !== -1 || showAction.indexOf('focus') !== -1;
},
isBlurToHide: function isBlurToHide() {
var _props6 = this.props;
var action = _props6.action;
var 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);
}
},
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'];
/***/ },
/* 411 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
module.exports = __webpack_require__(410);
/***/ },
/* 412 */
/***/ 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.getAlignFromPlacement = getAlignFromPlacement;
exports.getPopupClassNameFromAlign = getPopupClassNameFromAlign;
function isPointsEq(a1, a2) {
return a1[0] === a2[0] && a1[1] === a2[1];
}
function getAlignFromPlacement(builtinPlacements, placementStr, align) {
var baseAlign = builtinPlacements[placementStr] || {};
return _extends({}, 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 '';
}
/***/ },
/* 413 */
/***/ function(module, exports) {
"use strict";
module.exports = function contains(root, n) {
var node = n;
while (node) {
if (node === root) {
return true;
}
node = node.parentNode;
}
return false;
};
/***/ },
/* 414 */
/***/ function(module, exports) {
'use strict';
/**
* @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;
}
};
module.exports = KeyCode;
/***/ },
/* 415 */
/***/ function(module, exports) {
"use strict";
/**
* Safe chained function
*
* Will only create a new function if needed,
* otherwise will pass back existing functions or null.
*
* @returns {function|null}
*/
function createChainedFunction() {
var args = arguments;
return function chainedFunction() {
for (var i = 0; i < args.length; i++) {
if (args[i] && args[i].apply) {
args[i].apply(this, arguments);
}
}
};
}
module.exports = createChainedFunction;
/***/ },
/* 416 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(432);
/***/ },
/* 417 */
/***/ function(module, exports, __webpack_require__) {
var canUseDOM = __webpack_require__(236);
var enquire = canUseDOM && __webpack_require__(294);
var json2mq = __webpack_require__(106);
var ResponsiveMixin = {
media: function (query, handler) {
query = json2mq(query);
if (typeof handler === 'function') {
handler = {
match: handler
};
}
enquire.register(query, handler);
// Queue the handlers to unregister them at unmount
if (! this._responsiveMediaHandlers) {
this._responsiveMediaHandlers = [];
}
this._responsiveMediaHandlers.push({query: query, handler: handler});
},
componentWillUnmount: function () {
if (this._responsiveMediaHandlers) {
this._responsiveMediaHandlers.forEach(function(obj) {
enquire.unregister(obj.query, obj.handler);
});
}
}
};
module.exports = ResponsiveMixin;
/***/ },
/* 418 */
/***/ 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 _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var PrevArrow = _react2['default'].createClass({
displayName: 'PrevArrow',
clickHandler: function clickHandler(options, e) {
e.preventDefault();
this.props.clickHandler(options, e);
},
render: function render() {
var prevClasses = { 'slick-prev': true };
var prevHandler = this.clickHandler.bind(this, { message: 'previous' });
if (!this.props.infinite && (this.props.currentSlide === 0 || this.props.slideCount <= this.props.slidesToShow)) {
prevClasses['slick-disabled'] = true;
prevHandler = null;
}
var prevArrowProps = {
key: '0',
'data-role': 'none',
className: (0, _classnames2['default'])(prevClasses),
style: { display: 'block' },
onClick: prevHandler
};
var prevArrow;
if (this.props.prevArrow) {
prevArrow = _react2['default'].cloneElement(this.props.prevArrow, prevArrowProps);
} else {
prevArrow = _react2['default'].createElement(
'button',
_extends({ key: '0', type: 'button' }, prevArrowProps),
' Previous'
);
}
return prevArrow;
}
});
exports.PrevArrow = PrevArrow;
var NextArrow = _react2['default'].createClass({
displayName: 'NextArrow',
clickHandler: function clickHandler(options, e) {
e.preventDefault();
this.props.clickHandler(options, e);
},
render: function render() {
var nextClasses = { 'slick-next': true };
var nextHandler = this.clickHandler.bind(this, { message: 'next' });
if (!this.props.infinite) {
if (this.props.centerMode && this.props.currentSlide >= this.props.slideCount - 1) {
nextClasses['slick-disabled'] = true;
nextHandler = null;
} else {
if (this.props.currentSlide >= this.props.slideCount - this.props.slidesToShow) {
nextClasses['slick-disabled'] = true;
nextHandler = null;
}
}
if (this.props.slideCount <= this.props.slidesToShow) {
nextClasses['slick-disabled'] = true;
nextHandler = null;
}
}
var nextArrowProps = {
key: '1',
'data-role': 'none',
className: (0, _classnames2['default'])(nextClasses),
style: { display: 'block' },
onClick: nextHandler
};
var nextArrow;
if (this.props.nextArrow) {
nextArrow = _react2['default'].cloneElement(this.props.nextArrow, nextArrowProps);
} else {
nextArrow = _react2['default'].createElement(
'button',
_extends({ key: '1', type: 'button' }, nextArrowProps),
' Next'
);
}
return nextArrow;
}
});
exports.NextArrow = NextArrow;
/***/ },
/* 419 */
/***/ 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 _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var getDotCount = function getDotCount(spec) {
var dots;
dots = Math.ceil(spec.slideCount / spec.slidesToScroll);
return dots;
};
var Dots = _react2['default'].createClass({
displayName: 'Dots',
clickHandler: function clickHandler(options, e) {
// In Autoplay the focus stays on clicked button even after transition
// to next slide. That only goes away by click somewhere outside
e.preventDefault();
this.props.clickHandler(options);
},
render: function render() {
var _this = this;
var dotCount = getDotCount({
slideCount: this.props.slideCount,
slidesToScroll: this.props.slidesToScroll
});
// Apply join & split to Array to pre-fill it for IE8
//
// Credit: http://stackoverflow.com/a/13735425/1849458
var dots = Array.apply(null, Array(dotCount + 1).join('0').split('')).map(function (x, i) {
var className = (0, _classnames2['default'])({
'slick-active': _this.props.currentSlide === i * _this.props.slidesToScroll
});
var dotOptions = {
message: 'dots',
index: i,
slidesToScroll: _this.props.slidesToScroll,
currentSlide: _this.props.currentSlide
};
return _react2['default'].createElement(
'li',
{ key: i, className: className },
_react2['default'].createElement(
'button',
{ onClick: _this.clickHandler.bind(_this, dotOptions) },
i + 1
)
);
});
return _react2['default'].createElement(
'ul',
{ className: this.props.dotsClass, style: { display: 'block' } },
dots
);
}
});
exports.Dots = Dots;
/***/ },
/* 420 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
module.exports = __webpack_require__(424);
/***/ },
/* 421 */
/***/ function(module, exports) {
"use strict";
var initialState = {
animating: false,
dragging: false,
autoPlayTimer: null,
currentDirection: 0,
currentLeft: null,
currentSlide: 0,
direction: 1,
// listWidth: null,
// listHeight: null,
// loadIndex: 0,
slideCount: null,
slideWidth: null,
// sliding: false,
// slideOffset: 0,
swipeLeft: null,
touchObject: {
startX: 0,
startY: 0,
curX: 0,
curY: 0
},
lazyLoadedList: [],
// added for react
initialized: false,
edgeDragged: false,
swiped: false, // used by swipeEvent. differentites between touch and swipe.
trackStyle: {},
trackWidth: 0
// Removed
// transformsEnabled: false,
// $nextArrow: null,
// $prevArrow: null,
// $dots: null,
// $list: null,
// $slideTrack: null,
// $slides: null,
};
module.exports = initialState;
/***/ },
/* 422 */
/***/ 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 _mixinsEventHandlers = __webpack_require__(423);
var _mixinsEventHandlers2 = _interopRequireDefault(_mixinsEventHandlers);
var _mixinsHelpers = __webpack_require__(118);
var _mixinsHelpers2 = _interopRequireDefault(_mixinsHelpers);
var _initialState = __webpack_require__(421);
var _initialState2 = _interopRequireDefault(_initialState);
var _defaultProps = __webpack_require__(116);
var _defaultProps2 = _interopRequireDefault(_defaultProps);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var _track = __webpack_require__(425);
var _dots = __webpack_require__(419);
var _arrows = __webpack_require__(418);
var InnerSlider = _react2['default'].createClass({
displayName: 'InnerSlider',
mixins: [_mixinsHelpers2['default'], _mixinsEventHandlers2['default']],
getInitialState: function getInitialState() {
return _initialState2['default'];
},
getDefaultProps: function getDefaultProps() {
return _defaultProps2['default'];
},
componentWillMount: function componentWillMount() {
if (this.props.init) {
this.props.init();
}
this.setState({
mounted: true
});
var lazyLoadedList = [];
for (var i = 0; i < _react2['default'].Children.count(this.props.children); i++) {
if (i >= this.state.currentSlide && i < this.state.currentSlide + this.props.slidesToShow) {
lazyLoadedList.push(i);
}
}
if (this.props.lazyLoad && this.state.lazyLoadedList.length === 0) {
this.setState({
lazyLoadedList: lazyLoadedList
});
}
},
componentDidMount: function componentDidMount() {
// Hack for autoplay -- Inspect Later
this.initialize(this.props);
this.adaptHeight();
if (window.addEventListener) {
window.addEventListener('resize', this.onWindowResized);
} else {
window.attachEvent('onresize', this.onWindowResized);
}
},
componentWillUnmount: function componentWillUnmount() {
if (window.addEventListener) {
window.removeEventListener('resize', this.onWindowResized);
} else {
window.detachEvent('onresize', this.onWindowResized);
}
if (this.state.autoPlayTimer) {
window.clearInterval(this.state.autoPlayTimer);
}
},
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
if (this.props.slickGoTo != nextProps.slickGoTo) {
this.changeSlide({
message: 'index',
index: nextProps.slickGoTo,
currentSlide: this.state.currentSlide
});
} else {
this.update(nextProps);
}
},
componentDidUpdate: function componentDidUpdate() {
this.adaptHeight();
},
onWindowResized: function onWindowResized() {
this.update(this.props);
},
render: function render() {
var className = (0, _classnames2['default'])('slick-initialized', 'slick-slider', this.props.className);
var trackProps = {
fade: this.props.fade,
cssEase: this.props.cssEase,
speed: this.props.speed,
infinite: this.props.infinite,
centerMode: this.props.centerMode,
currentSlide: this.state.currentSlide,
lazyLoad: this.props.lazyLoad,
lazyLoadedList: this.state.lazyLoadedList,
rtl: this.props.rtl,
slideWidth: this.state.slideWidth,
slidesToShow: this.props.slidesToShow,
slideCount: this.state.slideCount,
trackStyle: this.state.trackStyle,
variableWidth: this.props.variableWidth
};
var dots;
if (this.props.dots === true && this.state.slideCount > this.props.slidesToShow) {
var dotProps = {
dotsClass: this.props.dotsClass,
slideCount: this.state.slideCount,
slidesToShow: this.props.slidesToShow,
currentSlide: this.state.currentSlide,
slidesToScroll: this.props.slidesToScroll,
clickHandler: this.changeSlide
};
dots = _react2['default'].createElement(_dots.Dots, dotProps);
}
var prevArrow, nextArrow;
var arrowProps = {
infinite: this.props.infinite,
centerMode: this.props.centerMode,
currentSlide: this.state.currentSlide,
slideCount: this.state.slideCount,
slidesToShow: this.props.slidesToShow,
prevArrow: this.props.prevArrow,
nextArrow: this.props.nextArrow,
clickHandler: this.changeSlide
};
if (this.props.arrows) {
prevArrow = _react2['default'].createElement(_arrows.PrevArrow, arrowProps);
nextArrow = _react2['default'].createElement(_arrows.NextArrow, arrowProps);
}
return _react2['default'].createElement(
'div',
{ className: className, onMouseEnter: this.onInnerSliderEnter, onMouseLeave: this.onInnerSliderLeave },
_react2['default'].createElement(
'div',
{
ref: 'list',
className: 'slick-list',
onMouseDown: this.swipeStart,
onMouseMove: this.state.dragging ? this.swipeMove : null,
onMouseUp: this.swipeEnd,
onMouseLeave: this.state.dragging ? this.swipeEnd : null,
onTouchStart: this.swipeStart,
onTouchMove: this.state.dragging ? this.swipeMove : null,
onTouchEnd: this.swipeEnd,
onTouchCancel: this.state.dragging ? this.swipeEnd : null },
_react2['default'].createElement(
_track.Track,
_extends({ ref: 'track' }, trackProps),
this.props.children
)
),
prevArrow,
nextArrow,
dots
);
}
});
exports.InnerSlider = InnerSlider;
/***/ },
/* 423 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _trackHelper = __webpack_require__(119);
var _helpers = __webpack_require__(118);
var _helpers2 = _interopRequireDefault(_helpers);
var _objectAssign = __webpack_require__(48);
var _objectAssign2 = _interopRequireDefault(_objectAssign);
var EventHandlers = {
// Event handler for previous and next
changeSlide: function changeSlide(options) {
var indexOffset, previousInt, slideOffset, unevenOffset, targetSlide;
unevenOffset = this.state.slideCount % this.props.slidesToScroll !== 0;
indexOffset = unevenOffset ? 0 : (this.state.slideCount - this.state.currentSlide) % this.props.slidesToScroll;
if (options.message === 'previous') {
slideOffset = indexOffset === 0 ? this.props.slidesToScroll : this.props.slidesToShow - indexOffset;
targetSlide = this.state.currentSlide - slideOffset;
if (this.props.lazyLoad) {
previousInt = this.state.currentSlide - slideOffset;
targetSlide = previousInt === -1 ? this.state.slideCount - 1 : previousInt;
}
} else if (options.message === 'next') {
slideOffset = indexOffset === 0 ? this.props.slidesToScroll : indexOffset;
targetSlide = this.state.currentSlide + slideOffset;
} else if (options.message === 'dots') {
// Click on dots
targetSlide = options.index * options.slidesToScroll;
if (targetSlide === options.currentSlide) {
return;
}
} else if (options.message === 'index') {
targetSlide = options.index;
if (targetSlide === options.currentSlide) {
return;
}
}
this.slideHandler(targetSlide);
},
// Accessiblity handler for previous and next
keyHandler: function keyHandler(e) {},
// Focus on selecting a slide (click handler on track)
selectHandler: function selectHandler(e) {},
swipeStart: function swipeStart(e) {
var touches, posX, posY;
if (this.props.swipe === false || 'ontouchend' in document && this.props.swipe === false) {
return;
} else if (this.props.draggable === false && e.type.indexOf('mouse') !== -1) {
return;
}
posX = e.touches !== undefined ? e.touches[0].pageX : e.clientX;
posY = e.touches !== undefined ? e.touches[0].pageY : e.clientY;
this.setState({
dragging: true,
touchObject: {
startX: posX,
startY: posY,
curX: posX,
curY: posY
}
});
},
swipeMove: function swipeMove(e) {
if (!this.state.dragging) {
return;
}
if (this.state.animating) {
return;
}
var swipeLeft;
var curLeft, positionOffset;
var touchObject = this.state.touchObject;
curLeft = (0, _trackHelper.getTrackLeft)((0, _objectAssign2['default'])({
slideIndex: this.state.currentSlide,
trackRef: this.refs.track
}, this.props, this.state));
touchObject.curX = e.touches ? e.touches[0].pageX : e.clientX;
touchObject.curY = e.touches ? e.touches[0].pageY : e.clientY;
touchObject.swipeLength = Math.round(Math.sqrt(Math.pow(touchObject.curX - touchObject.startX, 2)));
positionOffset = (this.props.rtl === false ? 1 : -1) * (touchObject.curX > touchObject.startX ? 1 : -1);
var currentSlide = this.state.currentSlide;
var dotCount = Math.ceil(this.state.slideCount / this.props.slidesToScroll);
var swipeDirection = this.swipeDirection(this.state.touchObject);
var touchSwipeLength = touchObject.swipeLength;
if (this.props.infinite === false) {
if (currentSlide === 0 && swipeDirection === 'right' || currentSlide + 1 >= dotCount && swipeDirection === 'left') {
touchSwipeLength = touchObject.swipeLength * this.props.edgeFriction;
if (this.state.edgeDragged === false && this.props.edgeEvent) {
this.props.edgeEvent(swipeDirection);
this.setState({ edgeDragged: true });
}
}
}
if (this.state.swiped === false && this.props.swipeEvent) {
this.props.swipeEvent(swipeDirection);
this.setState({ swiped: true });
}
swipeLeft = curLeft + touchSwipeLength * positionOffset;
this.setState({
touchObject: touchObject,
swipeLeft: swipeLeft,
trackStyle: (0, _trackHelper.getTrackCSS)((0, _objectAssign2['default'])({ left: swipeLeft }, this.props, this.state))
});
if (Math.abs(touchObject.curX - touchObject.startX) < Math.abs(touchObject.curY - touchObject.startY) * 0.8) {
return;
}
if (touchObject.swipeLength > 4) {
e.preventDefault();
}
},
swipeEnd: function swipeEnd(e) {
if (!this.state.dragging) {
return;
}
var touchObject = this.state.touchObject;
var minSwipe = this.state.listWidth / this.props.touchThreshold;
var swipeDirection = this.swipeDirection(touchObject);
// reset the state of touch related state variables.
this.setState({
dragging: false,
edgeDragged: false,
swiped: false,
swipeLeft: null,
touchObject: {}
});
// Fix for #13
if (!touchObject.swipeLength) {
return;
}
if (touchObject.swipeLength > minSwipe) {
e.preventDefault();
if (swipeDirection === 'left') {
this.slideHandler(this.state.currentSlide + this.props.slidesToScroll);
} else if (swipeDirection === 'right') {
this.slideHandler(this.state.currentSlide - this.props.slidesToScroll);
} else {
this.slideHandler(this.state.currentSlide);
}
} else {
// Adjust the track back to it's original position.
var currentLeft = (0, _trackHelper.getTrackLeft)((0, _objectAssign2['default'])({
slideIndex: this.state.currentSlide,
trackRef: this.refs.track
}, this.props, this.state));
this.setState({
trackStyle: (0, _trackHelper.getTrackAnimateCSS)((0, _objectAssign2['default'])({ left: currentLeft }, this.props, this.state))
});
}
},
onInnerSliderEnter: function onInnerSliderEnter(e) {
if (this.props.autoplay && this.props.pauseOnHover) {
this.pause();
}
},
onInnerSliderLeave: function onInnerSliderLeave(e) {
if (this.props.autoplay && this.props.pauseOnHover) {
this.autoPlay();
}
}
};
exports['default'] = EventHandlers;
module.exports = exports['default'];
/***/ },
/* 424 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _innerSlider = __webpack_require__(422);
var _objectAssign = __webpack_require__(48);
var _objectAssign2 = _interopRequireDefault(_objectAssign);
var _json2mq = __webpack_require__(106);
var _json2mq2 = _interopRequireDefault(_json2mq);
var _reactResponsiveMixin = __webpack_require__(417);
var _reactResponsiveMixin2 = _interopRequireDefault(_reactResponsiveMixin);
var _defaultProps = __webpack_require__(116);
var _defaultProps2 = _interopRequireDefault(_defaultProps);
var Slider = _react2['default'].createClass({
displayName: 'Slider',
mixins: [_reactResponsiveMixin2['default']],
getInitialState: function getInitialState() {
return {
breakpoint: null
};
},
componentDidMount: function componentDidMount() {
var _this = this;
if (this.props.responsive) {
var breakpoints = this.props.responsive.map(function (breakpt) {
return breakpt.breakpoint;
});
breakpoints.sort(function (x, y) {
return x - y;
});
breakpoints.forEach(function (breakpoint, index) {
var bQuery;
if (index === 0) {
bQuery = (0, _json2mq2['default'])({ minWidth: 0, maxWidth: breakpoint });
} else {
bQuery = (0, _json2mq2['default'])({ minWidth: breakpoints[index - 1], maxWidth: breakpoint });
}
_this.media(bQuery, function () {
_this.setState({ breakpoint: breakpoint });
});
});
// Register media query for full screen. Need to support resize from small to large
var query = (0, _json2mq2['default'])({ minWidth: breakpoints.slice(-1)[0] });
this.media(query, function () {
_this.setState({ breakpoint: null });
});
}
},
render: function render() {
var _this2 = this;
var settings;
var newProps;
if (this.state.breakpoint) {
newProps = this.props.responsive.filter(function (resp) {
return resp.breakpoint === _this2.state.breakpoint;
});
settings = newProps[0].settings === 'unslick' ? 'unslick' : (0, _objectAssign2['default'])({}, this.props, newProps[0].settings);
} else {
settings = (0, _objectAssign2['default'])({}, _defaultProps2['default'], this.props);
}
if (settings === 'unslick') {
// if 'unslick' responsive breakpoint setting used, just return the tag nested HTML
return _react2['default'].createElement(
'div',
null,
this.props.children
);
} else {
return _react2['default'].createElement(
_innerSlider.InnerSlider,
settings,
this.props.children
);
}
}
});
module.exports = Slider;
/***/ },
/* 425 */
/***/ 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 _objectAssign = __webpack_require__(48);
var _objectAssign2 = _interopRequireDefault(_objectAssign);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var getSlideClasses = function getSlideClasses(spec) {
var slickActive, slickCenter, slickCloned;
var centerOffset, index;
if (spec.rtl) {
index = spec.slideCount - 1 - spec.index;
} else {
index = spec.index;
}
slickCloned = index < 0 || index >= spec.slideCount;
if (spec.centerMode) {
centerOffset = Math.floor(spec.slidesToShow / 2);
slickCenter = (index - spec.currentSlide) % spec.slideCount === 0;
if (index > spec.currentSlide - centerOffset - 1 && index <= spec.currentSlide + centerOffset) {
slickActive = true;
}
} else {
slickActive = spec.currentSlide <= index && index < spec.currentSlide + spec.slidesToShow;
}
return (0, _classnames2['default'])({
'slick-slide': true,
'slick-active': slickActive,
'slick-center': slickCenter,
'slick-cloned': slickCloned
});
};
var getSlideStyle = function getSlideStyle(spec) {
var style = {};
if (spec.variableWidth === undefined || spec.variableWidth === false) {
style.width = spec.slideWidth;
}
if (spec.fade) {
style.position = 'relative';
style.left = -spec.index * spec.slideWidth;
style.opacity = spec.currentSlide === spec.index ? 1 : 0;
style.transition = 'opacity ' + spec.speed + 'ms ' + spec.cssEase;
style.WebkitTransition = 'opacity ' + spec.speed + 'ms ' + spec.cssEase;
}
return style;
};
var getKey = function getKey(child, fallbackKey) {
// key could be a zero
return child.key === null || child.key === undefined ? fallbackKey : child.key;
};
var renderSlides = function renderSlides(spec) {
var key;
var slides = [];
var preCloneSlides = [];
var postCloneSlides = [];
var count = _react2['default'].Children.count(spec.children);
var child;
_react2['default'].Children.forEach(spec.children, function (elem, index) {
if (!spec.lazyLoad | (spec.lazyLoad && spec.lazyLoadedList.indexOf(index) >= 0)) {
child = elem;
} else {
child = _react2['default'].createElement('div', null);
}
var childStyle = getSlideStyle((0, _objectAssign2['default'])({}, spec, { index: index }));
var slickClasses = getSlideClasses((0, _objectAssign2['default'])({ index: index }, spec));
var cssClasses;
if (child.props.className) {
cssClasses = (0, _classnames2['default'])(slickClasses, child.props.className);
} else {
cssClasses = slickClasses;
}
slides.push(_react2['default'].cloneElement(child, {
key: 'original' + getKey(child, index),
'data-index': index,
className: cssClasses,
style: (0, _objectAssign2['default'])({}, child.props.style || {}, childStyle)
}));
// variableWidth doesn't wrap properly.
if (spec.infinite && spec.fade === false) {
var infiniteCount = spec.variableWidth ? spec.slidesToShow + 1 : spec.slidesToShow;
if (index >= count - infiniteCount) {
key = -(count - index);
preCloneSlides.push(_react2['default'].cloneElement(child, {
key: 'cloned' + getKey(child, key),
'data-index': key,
className: cssClasses,
style: (0, _objectAssign2['default'])({}, child.props.style || {}, childStyle)
}));
}
if (index < infiniteCount) {
key = count + index;
postCloneSlides.push(_react2['default'].cloneElement(child, {
key: 'cloned' + getKey(child, key),
'data-index': key,
className: cssClasses,
style: (0, _objectAssign2['default'])({}, child.props.style || {}, childStyle)
}));
}
}
});
if (spec.rtl) {
return preCloneSlides.concat(slides, postCloneSlides).reverse();
} else {
return preCloneSlides.concat(slides, postCloneSlides);
}
};
var Track = _react2['default'].createClass({
displayName: 'Track',
render: function render() {
var slides = renderSlides(this.props);
return _react2['default'].createElement(
'div',
{ className: 'slick-track', style: this.props.trackStyle },
slides
);
}
});
exports.Track = Track;
/***/ },
/* 426 */
/***/ 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 _reactDom = __webpack_require__(9);
var _reactDom2 = _interopRequireDefault(_reactDom);
var _channel = __webpack_require__(120);
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, Object.getPrototypeOf(Container).call(this, props));
_this.updateOffset = function (_ref) {
var inherited = _ref.inherited;
var 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': _react2.default.PropTypes.any
};
Container.childContextTypes = {
'sticky-channel': _react2.default.PropTypes.any
};
exports.default = Container;
module.exports = exports['default'];
/***/ },
/* 427 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Channel = exports.StickyContainer = exports.Sticky = undefined;
var _sticky = __webpack_require__(428);
var _sticky2 = _interopRequireDefault(_sticky);
var _container = __webpack_require__(426);
var _container2 = _interopRequireDefault(_container);
var _channel = __webpack_require__(120);
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;
/***/ },
/* 428 */
/***/ 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 _reactDom = __webpack_require__(9);
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, Object.getPrototypeOf(Sticky).call(this, props));
_this.updateContext = function (_ref) {
var inherited = _ref.inherited;
var 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;
var style = 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;
var topOffset = _props.topOffset;
var isActive = _props.isActive;
var stickyClassName = _props.stickyClassName;
var stickyStyle = _props.stickyStyle;
var bottomOffset = _props.bottomOffset;
var onStickyStateChange = _props.onStickyStateChange;
var 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: _react2.default.PropTypes.bool,
className: _react2.default.PropTypes.string,
style: _react2.default.PropTypes.object,
stickyClassName: _react2.default.PropTypes.string,
stickyStyle: _react2.default.PropTypes.object,
topOffset: _react2.default.PropTypes.number,
bottomOffset: _react2.default.PropTypes.number,
onStickyStateChange: _react2.default.PropTypes.func
};
Sticky.defaultProps = {
isActive: true,
className: '',
style: {},
stickyClassName: 'sticky',
stickyStyle: {},
topOffset: 0,
bottomOffset: 0,
onStickyStateChange: function onStickyStateChange() {}
};
Sticky.contextTypes = {
'sticky-channel': _react2.default.PropTypes.any
};
exports.default = Sticky;
module.exports = exports['default'];
/***/ },
/* 429 */
/***/ 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; }())))
/***/ },
/* 430 */
/***/ 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.
*
* @providesModule CSSPropertyOperations
*/
'use strict';
var CSSProperty = __webpack_require__(121);
var ExecutionEnvironment = __webpack_require__(37);
var ReactInstrumentation = __webpack_require__(436);
var camelizeStyleName = __webpack_require__(342);
var dangerousStyleValue = __webpack_require__(439);
var hyphenateStyleName = __webpack_require__(345);
var memoizeStringOnly = __webpack_require__(347);
var warning = __webpack_require__(24);
var processStyleName = memoizeStringOnly(function (styleName) {
return hyphenateStyleName(styleName);
});
var hasShorthandPropertyBug = false;
var styleFloatAccessor = 'cssFloat';
if (ExecutionEnvironment.canUseDOM) {
var tempStyle = document.createElement('div').style;
try {
// IE8 throws "Invalid argument." if resetting shorthand style properties.
tempStyle.font = '';
} catch (e) {
hasShorthandPropertyBug = true;
}
// IE8 only supports accessing cssFloat (standard) as styleFloat
if (document.documentElement.style.cssFloat === undefined) {
styleFloatAccessor = 'styleFloat';
}
}
if (true) {
// 'msTransform' is correct, but the other prefixes should be capitalized
var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
// style values shouldn't contain a semicolon
var badStyleValueWithSemicolonPattern = /;\s*$/;
var warnedStyleNames = {};
var warnedStyleValues = {};
var warnedForNaNValue = false;
var warnHyphenatedStyleName = function (name, owner) {
if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
return;
}
warnedStyleNames[name] = true;
true ? warning(false, 'Unsupported style property %s. Did you mean %s?%s', name, camelizeStyleName(name), checkRenderMessage(owner)) : void 0;
};
var warnBadVendoredStyleName = function (name, owner) {
if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
return;
}
warnedStyleNames[name] = true;
true ? warning(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?%s', name, name.charAt(0).toUpperCase() + name.slice(1), checkRenderMessage(owner)) : void 0;
};
var warnStyleValueWithSemicolon = function (name, value, owner) {
if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
return;
}
warnedStyleValues[value] = true;
true ? warning(false, 'Style property values shouldn\'t contain a semicolon.%s ' + 'Try "%s: %s" instead.', checkRenderMessage(owner), name, value.replace(badStyleValueWithSemicolonPattern, '')) : void 0;
};
var warnStyleValueIsNaN = function (name, value, owner) {
if (warnedForNaNValue) {
return;
}
warnedForNaNValue = true;
true ? warning(false, '`NaN` is an invalid value for the `%s` css style property.%s', name, checkRenderMessage(owner)) : void 0;
};
var checkRenderMessage = function (owner) {
if (owner) {
var name = owner.getName();
if (name) {
return ' Check the render method of `' + name + '`.';
}
}
return '';
};
/**
* @param {string} name
* @param {*} value
* @param {ReactDOMComponent} component
*/
var warnValidStyle = function (name, value, component) {
var owner;
if (component) {
owner = component._currentElement._owner;
}
if (name.indexOf('-') > -1) {
warnHyphenatedStyleName(name, owner);
} else if (badVendoredStyleNamePattern.test(name)) {
warnBadVendoredStyleName(name, owner);
} else if (badStyleValueWithSemicolonPattern.test(value)) {
warnStyleValueWithSemicolon(name, value, owner);
}
if (typeof value === 'number' && isNaN(value)) {
warnStyleValueIsNaN(name, value, owner);
}
};
}
/**
* Operations for dealing with CSS properties.
*/
var CSSPropertyOperations = {
/**
* Serializes a mapping of style properties for use as inline styles:
*
* > createMarkupForStyles({width: '200px', height: 0})
* "width:200px;height:0;"
*
* Undefined values are ignored so that declarative programming is easier.
* The result should be HTML-escaped before insertion into the DOM.
*
* @param {object} styles
* @param {ReactDOMComponent} component
* @return {?string}
*/
createMarkupForStyles: function (styles, component) {
var serialized = '';
for (var styleName in styles) {
if (!styles.hasOwnProperty(styleName)) {
continue;
}
var styleValue = styles[styleName];
if (true) {
warnValidStyle(styleName, styleValue, component);
}
if (styleValue != null) {
serialized += processStyleName(styleName) + ':';
serialized += dangerousStyleValue(styleName, styleValue, component) + ';';
}
}
return serialized || null;
},
/**
* Sets the value for multiple styles on a node. If a value is specified as
* '' (empty string), the corresponding style property will be unset.
*
* @param {DOMElement} node
* @param {object} styles
* @param {ReactDOMComponent} component
*/
setValueForStyles: function (node, styles, component) {
if (true) {
ReactInstrumentation.debugTool.onHostOperation(component._debugID, 'update styles', styles);
}
var style = node.style;
for (var styleName in styles) {
if (!styles.hasOwnProperty(styleName)) {
continue;
}
if (true) {
warnValidStyle(styleName, styles[styleName], component);
}
var styleValue = dangerousStyleValue(styleName, styles[styleName], component);
if (styleName === 'float' || styleName === 'cssFloat') {
styleName = styleFloatAccessor;
}
if (styleValue) {
style[styleName] = styleValue;
} else {
var expansion = hasShorthandPropertyBug && CSSProperty.shorthandPropertyExpansions[styleName];
if (expansion) {
// Shorthand property that IE8 won't like unsetting, so unset each
// component to placate it
for (var individualStyleName in expansion) {
style[individualStyleName] = '';
}
} else {
style[styleName] = '';
}
}
}
}
};
module.exports = CSSPropertyOperations;
/***/ },
/* 431 */
/***/ function(module, exports, __webpack_require__) {
/**
* Copyright 2016-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 ReactComponentTreeDevtool
*/
'use strict';
var _prodInvariant = __webpack_require__(441);
var ReactCurrentOwner = __webpack_require__(433);
var invariant = __webpack_require__(44);
var warning = __webpack_require__(24);
var tree = {};
var unmountedIDs = {};
var rootIDs = {};
function updateTree(id, update) {
if (!tree[id]) {
tree[id] = {
element: null,
parentID: null,
ownerID: null,
text: null,
childIDs: [],
displayName: 'Unknown',
isMounted: false,
updateCount: 0
};
}
update(tree[id]);
}
function purgeDeep(id) {
var item = tree[id];
if (item) {
var childIDs = item.childIDs;
delete tree[id];
childIDs.forEach(purgeDeep);
}
}
function describeComponentFrame(name, source, ownerName) {
return '\n in ' + name + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
}
function describeID(id) {
var name = ReactComponentTreeDevtool.getDisplayName(id);
var element = ReactComponentTreeDevtool.getElement(id);
var ownerID = ReactComponentTreeDevtool.getOwnerID(id);
var ownerName;
if (ownerID) {
ownerName = ReactComponentTreeDevtool.getDisplayName(ownerID);
}
true ? warning(element, 'ReactComponentTreeDevtool: Missing React element for debugID %s when ' + 'building stack', id) : void 0;
return describeComponentFrame(name, element && element._source, ownerName);
}
var ReactComponentTreeDevtool = {
onSetDisplayName: function (id, displayName) {
updateTree(id, function (item) {
return item.displayName = displayName;
});
},
onSetChildren: function (id, nextChildIDs) {
updateTree(id, function (item) {
item.childIDs = nextChildIDs;
nextChildIDs.forEach(function (nextChildID) {
var nextChild = tree[nextChildID];
!nextChild ? true ? invariant(false, 'Expected devtool events to fire for the child before its parent includes it in onSetChildren().') : _prodInvariant('68') : void 0;
!(nextChild.displayName != null) ? true ? invariant(false, 'Expected onSetDisplayName() to fire for the child before its parent includes it in onSetChildren().') : _prodInvariant('69') : void 0;
!(nextChild.childIDs != null || nextChild.text != null) ? true ? invariant(false, 'Expected onSetChildren() or onSetText() to fire for the child before its parent includes it in onSetChildren().') : _prodInvariant('70') : void 0;
!nextChild.isMounted ? true ? invariant(false, 'Expected onMountComponent() to fire for the child before its parent includes it in onSetChildren().') : _prodInvariant('71') : void 0;
if (nextChild.parentID == null) {
nextChild.parentID = id;
// TODO: This shouldn't be necessary but mounting a new root during in
// componentWillMount currently causes not-yet-mounted components to
// be purged from our tree data so their parent ID is missing.
}
!(nextChild.parentID === id) ? true ? invariant(false, 'Expected onSetParent() and onSetChildren() to be consistent (%s has parents %s and %s).', nextChildID, nextChild.parentID, id) : _prodInvariant('72', nextChildID, nextChild.parentID, id) : void 0;
});
});
},
onSetOwner: function (id, ownerID) {
updateTree(id, function (item) {
return item.ownerID = ownerID;
});
},
onSetParent: function (id, parentID) {
updateTree(id, function (item) {
return item.parentID = parentID;
});
},
onSetText: function (id, text) {
updateTree(id, function (item) {
return item.text = text;
});
},
onBeforeMountComponent: function (id, element) {
updateTree(id, function (item) {
return item.element = element;
});
},
onBeforeUpdateComponent: function (id, element) {
updateTree(id, function (item) {
return item.element = element;
});
},
onMountComponent: function (id) {
updateTree(id, function (item) {
return item.isMounted = true;
});
},
onMountRootComponent: function (id) {
rootIDs[id] = true;
},
onUpdateComponent: function (id) {
updateTree(id, function (item) {
return item.updateCount++;
});
},
onUnmountComponent: function (id) {
updateTree(id, function (item) {
return item.isMounted = false;
});
unmountedIDs[id] = true;
delete rootIDs[id];
},
purgeUnmountedComponents: function () {
if (ReactComponentTreeDevtool._preventPurging) {
// Should only be used for testing.
return;
}
for (var id in unmountedIDs) {
purgeDeep(id);
}
unmountedIDs = {};
},
isMounted: function (id) {
var item = tree[id];
return item ? item.isMounted : false;
},
getCurrentStackAddendum: function (topElement) {
var info = '';
if (topElement) {
var type = topElement.type;
var name = typeof type === 'function' ? type.displayName || type.name : type;
var owner = topElement._owner;
info += describeComponentFrame(name || 'Unknown', topElement._source, owner && owner.getName());
}
var currentOwner = ReactCurrentOwner.current;
var id = currentOwner && currentOwner._debugID;
info += ReactComponentTreeDevtool.getStackAddendumByID(id);
return info;
},
getStackAddendumByID: function (id) {
var info = '';
while (id) {
info += describeID(id);
id = ReactComponentTreeDevtool.getParentID(id);
}
return info;
},
getChildIDs: function (id) {
var item = tree[id];
return item ? item.childIDs : [];
},
getDisplayName: function (id) {
var item = tree[id];
return item ? item.displayName : 'Unknown';
},
getElement: function (id) {
var item = tree[id];
return item ? item.element : null;
},
getOwnerID: function (id) {
var item = tree[id];
return item ? item.ownerID : null;
},
getParentID: function (id) {
var item = tree[id];
return item ? item.parentID : null;
},
getSource: function (id) {
var item = tree[id];
var element = item ? item.element : null;
var source = element != null ? element._source : null;
return source;
},
getText: function (id) {
var item = tree[id];
return item ? item.text : null;
},
getUpdateCount: function (id) {
var item = tree[id];
return item ? item.updateCount : 0;
},
getRootIDs: function () {
return Object.keys(rootIDs);
},
getRegisteredIDs: function () {
return Object.keys(tree);
}
};
module.exports = ReactComponentTreeDevtool;
/***/ },
/* 432 */
/***/ 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.
*
* @providesModule ReactComponentWithPureRenderMixin
*/
'use strict';
var shallowCompare = __webpack_require__(442);
/**
* 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 (nextProps, nextState) {
return shallowCompare(this, nextProps, nextState);
}
};
module.exports = ReactComponentWithPureRenderMixin;
/***/ },
/* 433 */
/***/ 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.
*
* @providesModule ReactCurrentOwner
*/
'use strict';
/**
* Keeps track of the current owner.
*
* The current owner is the component who should own any components that are
* currently being constructed.
*/
var ReactCurrentOwner = {
/**
* @internal
* @type {ReactComponent}
*/
current: null
};
module.exports = ReactCurrentOwner;
/***/ },
/* 434 */
/***/ function(module, exports, __webpack_require__) {
/**
* Copyright 2016-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 ReactDebugTool
*/
'use strict';
var ReactInvalidSetStateWarningDevTool = __webpack_require__(437);
var ReactHostOperationHistoryDevtool = __webpack_require__(435);
var ReactComponentTreeDevtool = __webpack_require__(431);
var ExecutionEnvironment = __webpack_require__(37);
var performanceNow = __webpack_require__(349);
var warning = __webpack_require__(24);
var eventHandlers = [];
var handlerDoesThrowForEvent = {};
function emitEvent(handlerFunctionName, arg1, arg2, arg3, arg4, arg5) {
eventHandlers.forEach(function (handler) {
try {
if (handler[handlerFunctionName]) {
handler[handlerFunctionName](arg1, arg2, arg3, arg4, arg5);
}
} catch (e) {
true ? warning(handlerDoesThrowForEvent[handlerFunctionName], 'exception thrown by devtool while handling %s: %s', handlerFunctionName, e + '\n' + e.stack) : void 0;
handlerDoesThrowForEvent[handlerFunctionName] = true;
}
});
}
var isProfiling = false;
var flushHistory = [];
var lifeCycleTimerStack = [];
var currentFlushNesting = 0;
var currentFlushMeasurements = null;
var currentFlushStartTime = null;
var currentTimerDebugID = null;
var currentTimerStartTime = null;
var currentTimerNestedFlushDuration = null;
var currentTimerType = null;
function clearHistory() {
ReactComponentTreeDevtool.purgeUnmountedComponents();
ReactHostOperationHistoryDevtool.clearHistory();
}
function getTreeSnapshot(registeredIDs) {
return registeredIDs.reduce(function (tree, id) {
var ownerID = ReactComponentTreeDevtool.getOwnerID(id);
var parentID = ReactComponentTreeDevtool.getParentID(id);
tree[id] = {
displayName: ReactComponentTreeDevtool.getDisplayName(id),
text: ReactComponentTreeDevtool.getText(id),
updateCount: ReactComponentTreeDevtool.getUpdateCount(id),
childIDs: ReactComponentTreeDevtool.getChildIDs(id),
// Text nodes don't have owners but this is close enough.
ownerID: ownerID || ReactComponentTreeDevtool.getOwnerID(parentID),
parentID: parentID
};
return tree;
}, {});
}
function resetMeasurements() {
var previousStartTime = currentFlushStartTime;
var previousMeasurements = currentFlushMeasurements || [];
var previousOperations = ReactHostOperationHistoryDevtool.getHistory();
if (currentFlushNesting === 0) {
currentFlushStartTime = null;
currentFlushMeasurements = null;
clearHistory();
return;
}
if (previousMeasurements.length || previousOperations.length) {
var registeredIDs = ReactComponentTreeDevtool.getRegisteredIDs();
flushHistory.push({
duration: performanceNow() - previousStartTime,
measurements: previousMeasurements || [],
operations: previousOperations || [],
treeSnapshot: getTreeSnapshot(registeredIDs)
});
}
clearHistory();
currentFlushStartTime = performanceNow();
currentFlushMeasurements = [];
}
function checkDebugID(debugID) {
true ? warning(debugID, 'ReactDebugTool: debugID may not be empty.') : void 0;
}
function beginLifeCycleTimer(debugID, timerType) {
if (currentFlushNesting === 0) {
return;
}
true ? warning(!currentTimerType, 'There is an internal error in the React performance measurement code. ' + 'Did not expect %s timer to start while %s timer is still in ' + 'progress for %s instance.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another') : void 0;
currentTimerStartTime = performanceNow();
currentTimerNestedFlushDuration = 0;
currentTimerDebugID = debugID;
currentTimerType = timerType;
}
function endLifeCycleTimer(debugID, timerType) {
if (currentFlushNesting === 0) {
return;
}
true ? warning(currentTimerType === timerType, 'There is an internal error in the React performance measurement code. ' + 'We did not expect %s timer to stop while %s timer is still in ' + 'progress for %s instance. Please report this as a bug in React.', timerType, currentTimerType || 'no', debugID === currentTimerDebugID ? 'the same' : 'another') : void 0;
if (isProfiling) {
currentFlushMeasurements.push({
timerType: timerType,
instanceID: debugID,
duration: performanceNow() - currentTimerStartTime - currentTimerNestedFlushDuration
});
}
currentTimerStartTime = null;
currentTimerNestedFlushDuration = null;
currentTimerDebugID = null;
currentTimerType = null;
}
function pauseCurrentLifeCycleTimer() {
var currentTimer = {
startTime: currentTimerStartTime,
nestedFlushStartTime: performanceNow(),
debugID: currentTimerDebugID,
timerType: currentTimerType
};
lifeCycleTimerStack.push(currentTimer);
currentTimerStartTime = null;
currentTimerNestedFlushDuration = null;
currentTimerDebugID = null;
currentTimerType = null;
}
function resumeCurrentLifeCycleTimer() {
var _lifeCycleTimerStack$ = lifeCycleTimerStack.pop();
var startTime = _lifeCycleTimerStack$.startTime;
var nestedFlushStartTime = _lifeCycleTimerStack$.nestedFlushStartTime;
var debugID = _lifeCycleTimerStack$.debugID;
var timerType = _lifeCycleTimerStack$.timerType;
var nestedFlushDuration = performanceNow() - nestedFlushStartTime;
currentTimerStartTime = startTime;
currentTimerNestedFlushDuration += nestedFlushDuration;
currentTimerDebugID = debugID;
currentTimerType = timerType;
}
var ReactDebugTool = {
addDevtool: function (devtool) {
eventHandlers.push(devtool);
},
removeDevtool: function (devtool) {
for (var i = 0; i < eventHandlers.length; i++) {
if (eventHandlers[i] === devtool) {
eventHandlers.splice(i, 1);
i--;
}
}
},
isProfiling: function () {
return isProfiling;
},
beginProfiling: function () {
if (isProfiling) {
return;
}
isProfiling = true;
flushHistory.length = 0;
resetMeasurements();
ReactDebugTool.addDevtool(ReactHostOperationHistoryDevtool);
},
endProfiling: function () {
if (!isProfiling) {
return;
}
isProfiling = false;
resetMeasurements();
ReactDebugTool.removeDevtool(ReactHostOperationHistoryDevtool);
},
getFlushHistory: function () {
return flushHistory;
},
onBeginFlush: function () {
currentFlushNesting++;
resetMeasurements();
pauseCurrentLifeCycleTimer();
emitEvent('onBeginFlush');
},
onEndFlush: function () {
resetMeasurements();
currentFlushNesting--;
resumeCurrentLifeCycleTimer();
emitEvent('onEndFlush');
},
onBeginLifeCycleTimer: function (debugID, timerType) {
checkDebugID(debugID);
emitEvent('onBeginLifeCycleTimer', debugID, timerType);
beginLifeCycleTimer(debugID, timerType);
},
onEndLifeCycleTimer: function (debugID, timerType) {
checkDebugID(debugID);
endLifeCycleTimer(debugID, timerType);
emitEvent('onEndLifeCycleTimer', debugID, timerType);
},
onBeginReconcilerTimer: function (debugID, timerType) {
checkDebugID(debugID);
emitEvent('onBeginReconcilerTimer', debugID, timerType);
},
onEndReconcilerTimer: function (debugID, timerType) {
checkDebugID(debugID);
emitEvent('onEndReconcilerTimer', debugID, timerType);
},
onError: function (debugID) {
if (currentTimerDebugID != null) {
endLifeCycleTimer(currentTimerDebugID, currentTimerType);
}
emitEvent('onError', debugID);
},
onBeginProcessingChildContext: function () {
emitEvent('onBeginProcessingChildContext');
},
onEndProcessingChildContext: function () {
emitEvent('onEndProcessingChildContext');
},
onHostOperation: function (debugID, type, payload) {
checkDebugID(debugID);
emitEvent('onHostOperation', debugID, type, payload);
},
onSetState: function () {
emitEvent('onSetState');
},
onSetDisplayName: function (debugID, displayName) {
checkDebugID(debugID);
emitEvent('onSetDisplayName', debugID, displayName);
},
onSetChildren: function (debugID, childDebugIDs) {
checkDebugID(debugID);
childDebugIDs.forEach(checkDebugID);
emitEvent('onSetChildren', debugID, childDebugIDs);
},
onSetOwner: function (debugID, ownerDebugID) {
checkDebugID(debugID);
emitEvent('onSetOwner', debugID, ownerDebugID);
},
onSetParent: function (debugID, parentDebugID) {
checkDebugID(debugID);
emitEvent('onSetParent', debugID, parentDebugID);
},
onSetText: function (debugID, text) {
checkDebugID(debugID);
emitEvent('onSetText', debugID, text);
},
onMountRootComponent: function (debugID) {
checkDebugID(debugID);
emitEvent('onMountRootComponent', debugID);
},
onBeforeMountComponent: function (debugID, element) {
checkDebugID(debugID);
emitEvent('onBeforeMountComponent', debugID, element);
},
onMountComponent: function (debugID) {
checkDebugID(debugID);
emitEvent('onMountComponent', debugID);
},
onBeforeUpdateComponent: function (debugID, element) {
checkDebugID(debugID);
emitEvent('onBeforeUpdateComponent', debugID, element);
},
onUpdateComponent: function (debugID) {
checkDebugID(debugID);
emitEvent('onUpdateComponent', debugID);
},
onUnmountComponent: function (debugID) {
checkDebugID(debugID);
emitEvent('onUnmountComponent', debugID);
},
onTestEvent: function () {
emitEvent('onTestEvent');
}
};
ReactDebugTool.addDevtool(ReactInvalidSetStateWarningDevTool);
ReactDebugTool.addDevtool(ReactComponentTreeDevtool);
var url = ExecutionEnvironment.canUseDOM && window.location.href || '';
if (/[?&]react_perf\b/.test(url)) {
ReactDebugTool.beginProfiling();
}
module.exports = ReactDebugTool;
/***/ },
/* 435 */
/***/ function(module, exports) {
/**
* Copyright 2016-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 ReactHostOperationHistoryDevtool
*/
'use strict';
var history = [];
var ReactHostOperationHistoryDevtool = {
onHostOperation: function (debugID, type, payload) {
history.push({
instanceID: debugID,
type: type,
payload: payload
});
},
clearHistory: function () {
if (ReactHostOperationHistoryDevtool._preventClearing) {
// Should only be used for tests.
return;
}
history = [];
},
getHistory: function () {
return history;
}
};
module.exports = ReactHostOperationHistoryDevtool;
/***/ },
/* 436 */
/***/ function(module, exports, __webpack_require__) {
/**
* Copyright 2016-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 ReactInstrumentation
*/
'use strict';
var debugTool = null;
if (true) {
var ReactDebugTool = __webpack_require__(434);
debugTool = ReactDebugTool;
}
module.exports = { debugTool: debugTool };
/***/ },
/* 437 */
/***/ function(module, exports, __webpack_require__) {
/**
* Copyright 2016-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 ReactInvalidSetStateWarningDevTool
*/
'use strict';
var warning = __webpack_require__(24);
if (true) {
var processingChildContext = false;
var warnInvalidSetState = function () {
true ? warning(!processingChildContext, 'setState(...): Cannot call setState() inside getChildContext()') : void 0;
};
}
var ReactInvalidSetStateWarningDevTool = {
onBeginProcessingChildContext: function () {
processingChildContext = true;
},
onEndProcessingChildContext: function () {
processingChildContext = false;
},
onSetState: function () {
warnInvalidSetState();
}
};
module.exports = ReactInvalidSetStateWarningDevTool;
/***/ },
/* 438 */
/***/ 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.
*
* @providesModule ReactTransitionEvents
*/
'use strict';
var ExecutionEnvironment = __webpack_require__(37);
var getVendorPrefixedEventName = __webpack_require__(440);
var endEvents = [];
function detectEvents() {
var animEnd = getVendorPrefixedEventName('animationend');
var transEnd = getVendorPrefixedEventName('transitionend');
if (animEnd) {
endEvents.push(animEnd);
}
if (transEnd) {
endEvents.push(transEnd);
}
}
if (ExecutionEnvironment.canUseDOM) {
detectEvents();
}
// We use the raw {add|remove}EventListener() call because EventListener
// does not know how to remove event listeners and we really should
// clean up. Also, these events are not triggered in older browsers
// so we should be A-OK here.
function addEventListener(node, eventName, eventListener) {
node.addEventListener(eventName, eventListener, false);
}
function removeEventListener(node, eventName, eventListener) {
node.removeEventListener(eventName, eventListener, false);
}
var ReactTransitionEvents = {
addEndEventListener: function (node, eventListener) {
if (endEvents.length === 0) {
// If CSS transitions are not supported, trigger an "end animation"
// event immediately.
window.setTimeout(eventListener, 0);
return;
}
endEvents.forEach(function (endEvent) {
addEventListener(node, endEvent, eventListener);
});
},
removeEndEventListener: function (node, eventListener) {
if (endEvents.length === 0) {
return;
}
endEvents.forEach(function (endEvent) {
removeEventListener(node, endEvent, eventListener);
});
}
};
module.exports = ReactTransitionEvents;
/***/ },
/* 439 */
/***/ 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.
*
* @providesModule dangerousStyleValue
*/
'use strict';
var CSSProperty = __webpack_require__(121);
var warning = __webpack_require__(24);
var isUnitlessNumber = CSSProperty.isUnitlessNumber;
var styleWarnings = {};
/**
* Convert a value into the proper css writable value. The style name `name`
* should be logical (no hyphens), as specified
* in `CSSProperty.isUnitlessNumber`.
*
* @param {string} name CSS property name such as `topMargin`.
* @param {*} value CSS property value such as `10px`.
* @param {ReactDOMComponent} component
* @return {string} Normalized style value with dimensions applied.
*/
function dangerousStyleValue(name, value, component) {
// Note that we've removed escapeTextForBrowser() calls here since the
// whole string will be escaped when the attribute is injected into
// the markup. If you provide unsafe user data here they can inject
// arbitrary CSS which may be problematic (I couldn't repro this):
// https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
// http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/
// This is not an XSS hole but instead a potential CSS injection issue
// which has lead to a greater discussion about how we're going to
// trust URLs moving forward. See #2115901
var isEmpty = value == null || typeof value === 'boolean' || value === '';
if (isEmpty) {
return '';
}
var isNonNumeric = isNaN(value);
if (isNonNumeric || value === 0 || isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) {
return '' + value; // cast to string
}
if (typeof value === 'string') {
if (true) {
// Allow '0' to pass through without warning. 0 is already special and
// doesn't require units, so we don't need to warn about it.
if (component && value !== '0') {
var owner = component._currentElement._owner;
var ownerName = owner ? owner.getName() : null;
if (ownerName && !styleWarnings[ownerName]) {
styleWarnings[ownerName] = {};
}
var warned = false;
if (ownerName) {
var warnings = styleWarnings[ownerName];
warned = warnings[name];
if (!warned) {
warnings[name] = true;
}
}
if (!warned) {
true ? warning(false, 'a `%s` tag (owner: `%s`) was passed a numeric string value ' + 'for CSS property `%s` (value: `%s`) which will be treated ' + 'as a unitless number in a future version of React.', component._currentElement.type, ownerName || 'unknown', name, value) : void 0;
}
}
}
value = value.trim();
}
return value + 'px';
}
module.exports = dangerousStyleValue;
/***/ },
/* 440 */
/***/ 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.
*
* @providesModule getVendorPrefixedEventName
*/
'use strict';
var ExecutionEnvironment = __webpack_require__(37);
/**
* Generate a mapping of standard vendor prefixes using the defined style property and event name.
*
* @param {string} styleProp
* @param {string} eventName
* @returns {object}
*/
function makePrefixMap(styleProp, eventName) {
var prefixes = {};
prefixes[styleProp.toLowerCase()] = eventName.toLowerCase();
prefixes['Webkit' + styleProp] = 'webkit' + eventName;
prefixes['Moz' + styleProp] = 'moz' + eventName;
prefixes['ms' + styleProp] = 'MS' + eventName;
prefixes['O' + styleProp] = 'o' + eventName.toLowerCase();
return prefixes;
}
/**
* A list of event names to a configurable list of vendor prefixes.
*/
var vendorPrefixes = {
animationend: makePrefixMap('Animation', 'AnimationEnd'),
animationiteration: makePrefixMap('Animation', 'AnimationIteration'),
animationstart: makePrefixMap('Animation', 'AnimationStart'),
transitionend: makePrefixMap('Transition', 'TransitionEnd')
};
/**
* Event names that have already been detected and prefixed (if applicable).
*/
var prefixedEventNames = {};
/**
* Element to check for prefixes on.
*/
var style = {};
/**
* Bootstrap if a DOM exists.
*/
if (ExecutionEnvironment.canUseDOM) {
style = document.createElement('div').style;
// On some platforms, in particular some releases of Android 4.x,
// the un-prefixed "animation" and "transition" properties are defined on the
// style object but the events that fire will still be prefixed, so we need
// to check if the un-prefixed events are usable, and if not remove them from the map.
if (!('AnimationEvent' in window)) {
delete vendorPrefixes.animationend.animation;
delete vendorPrefixes.animationiteration.animation;
delete vendorPrefixes.animationstart.animation;
}
// Same as above
if (!('TransitionEvent' in window)) {
delete vendorPrefixes.transitionend.transition;
}
}
/**
* Attempts to determine the correct vendor prefixed event name.
*
* @param {string} eventName
* @returns {string}
*/
function getVendorPrefixedEventName(eventName) {
if (prefixedEventNames[eventName]) {
return prefixedEventNames[eventName];
} else if (!vendorPrefixes[eventName]) {
return eventName;
}
var prefixMap = vendorPrefixes[eventName];
for (var styleProp in prefixMap) {
if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) {
return prefixedEventNames[eventName] = prefixMap[styleProp];
}
}
return '';
}
module.exports = getVendorPrefixedEventName;
/***/ },
/* 441 */
/***/ function(module, exports) {
/**
* 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.
*
* @providesModule reactProdInvariant
*
*/
'use strict';
/**
* WARNING: DO NOT manually require this module.
* This is a replacement for `invariant(...)` used by the error code system
* and will _only_ be required by the corresponding babel pass.
* It always throws.
*/
function reactProdInvariant(code) {
var argCount = arguments.length - 1;
var message = 'Minified React error #' + code + '; visit ' + 'http://facebook.github.io/react/docs/error-decoder.html?invariant=' + code;
for (var argIdx = 0; argIdx < argCount; argIdx++) {
message += '&args[]=' + encodeURIComponent(arguments[argIdx + 1]);
}
message += ' for the full message or use the non-minified dev environment' + ' for full errors and additional helpful warnings.';
var error = new Error(message);
error.name = 'Invariant Violation';
error.framesToPop = 1; // we don't care about reactProdInvariant's own frame
throw error;
}
module.exports = reactProdInvariant;
/***/ },
/* 442 */
/***/ 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.
*
* @providesModule shallowCompare
*/
'use strict';
var shallowEqual = __webpack_require__(350);
/**
* Does a shallow comparison for props and state.
* See ReactComponentWithPureRenderMixin
* See also https://facebook.github.io/react/docs/shallow-compare.html
*/
function shallowCompare(instance, nextProps, nextState) {
return !shallowEqual(instance.props, nextProps) || !shallowEqual(instance.state, nextState);
}
module.exports = shallowCompare;
/***/ },
/* 443 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__(1);
var React = _interopRequireWildcard(_react);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var _Picker = __webpack_require__(127);
var _Picker2 = _interopRequireDefault(_Picker);
var _CascaderMixin = __webpack_require__(444);
var _CascaderMixin2 = _interopRequireDefault(_CascaderMixin);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
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; } }
var Cascader = React.createClass({
displayName: 'Cascader',
mixins: [_CascaderMixin2["default"]],
getDefaultProps: function getDefaultProps() {
return {
prefixCls: 'rmc-cascader',
pickerPrefixCls: 'rmc-picker',
data: []
};
},
render: function render() {
var _this = this;
var props = this.props;
var prefixCls = props.prefixCls;
var pickerPrefixCls = props.pickerPrefixCls;
var className = props.className;
var value = this.state.value;
var childrenTree = this.getChildrenTree();
var cols = this.getColArray().map(function (v, i) {
return React.createElement(
'div',
{ key: i, className: prefixCls + '-main-item' },
React.createElement(
_Picker2["default"],
{ prefixCls: pickerPrefixCls, selectedValue: value[i], onValueChange: _this.onValueChange.bind(_this, i) },
childrenTree[i] || []
)
);
});
return React.createElement(
'div',
{ className: (0, _classnames2["default"])(className, prefixCls) },
cols
);
}
});
exports["default"] = Cascader;
module.exports = exports['default'];
/***/ },
/* 444 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _arrayTreeFilter = __webpack_require__(71);
var _arrayTreeFilter2 = _interopRequireDefault(_arrayTreeFilter);
var _utils = __webpack_require__(122);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
exports["default"] = {
getDefaultProps: function getDefaultProps() {
return {
cols: _utils.COLS
};
},
getInitialState: function getInitialState() {
return {
value: this.getNewValue(this.props.data, this.props.defaultValue || this.props.value)
};
},
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
if ('value' in nextProps) {
this.setState({
value: this.getNewValue(nextProps.data, nextProps.value)
});
}
},
onValueChange: function onValueChange(index, selectNameValue) {
var value = this.state.value.concat();
value[index] = selectNameValue;
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);
},
getNewValue: function getNewValue(d, val) {
return (0, _utils.getDefaultValue)(d, val, this.props.cols);
},
getColArray: function getColArray() {
var ret = [];
for (var i = 0; i < this.props.cols; i++) {
ret[i] = undefined;
}
return ret;
},
getChildrenTree: function getChildrenTree() {
var _props = this.props;
var data = _props.data;
var 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;
}
};
module.exports = exports['default'];
/***/ },
/* 445 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = __webpack_require__(8);
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 React = _interopRequireWildcard(_react);
var _Cascader = __webpack_require__(443);
var _Cascader2 = _interopRequireDefault(_Cascader);
var _utils = __webpack_require__(122);
var _Popup = __webpack_require__(128);
var _Popup2 = _interopRequireDefault(_Popup);
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 EXCLUDE_PROPS = {
popupPrefixCls: 1,
pickerPrefixCls: 1,
visible: 1,
mode: 1,
onPickerChange: 1,
onChange: 1,
onVisibleChange: 1
};
var PopupCascader = function (_React$Component) {
(0, _inherits3["default"])(PopupCascader, _React$Component);
function PopupCascader(props) {
(0, _classCallCheck3["default"])(this, PopupCascader);
var _this = (0, _possibleConstructorReturn3["default"])(this, _React$Component.call(this, props));
_this.onPickerChange = function (value) {
console.log('inner onPickerChange', value);
_this.setState({
pickerValue: value
});
_this.props.onPickerChange(value);
};
_this.onOk = function () {
var _this$props = _this.props;
var value = _this$props.value;
var cols = _this$props.cols;
var data = _this$props.data;
console.log('inner onOk', _this.state.pickerValue);
_this.props.onChange((0, _utils.getDefaultValue)(data, _this.state.pickerValue || value, cols).filter(function (c) {
return !!c;
}));
};
_this.fireVisibleChange = function (visible) {
if (_this.state.visible !== visible) {
if (!('visible' in _this.props)) {
_this.setVisibleState(visible);
}
_this.props.onVisibleChange(visible);
}
};
_this.state = {
pickerValue: null,
visible: _this.props.visible || false
};
return _this;
}
PopupCascader.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
if ('visible' in nextProps) {
this.setVisibleState(nextProps.visible);
}
};
PopupCascader.prototype.setVisibleState = function setVisibleState(visible) {
this.setState({
visible: visible
});
if (!visible) {
this.setState({
pickerValue: null
});
}
};
PopupCascader.prototype.getModal = function getModal() {
var _props = this.props;
var data = _props.data;
var cols = _props.cols;
var prefixCls = _props.prefixCls;
var pickerPrefixCls = _props.pickerPrefixCls;
var value = _props.value;
var extraProps = {
data: data
};
if (pickerPrefixCls) {
extraProps.pickerPrefixCls = pickerPrefixCls;
}
if (prefixCls) {
extraProps.prefixCls = prefixCls;
}
return React.createElement(_Cascader2["default"], (0, _extends3["default"])({ value: this.state.pickerValue || value, cols: cols, onChange: this.onPickerChange }, extraProps));
};
PopupCascader.prototype.render = function render() {
var props = (0, _utils.exclude)(this.props, EXCLUDE_PROPS);
props.prefixCls = this.props.popupPrefixCls;
return React.createElement(_Popup2["default"], (0, _extends3["default"])({}, props, { onVisibleChange: this.fireVisibleChange, onOk: this.onOk, content: this.getModal(), visible: this.state.visible }));
};
return PopupCascader;
}(React.Component);
exports["default"] = PopupCascader;
PopupCascader.defaultProps = {
popupPrefixCls: 'rmc-picker-popup',
onVisibleChange: _utils.noop,
cols: _utils.COLS,
onChange: _utils.noop,
onPickerChange: _utils.noop
};
module.exports = exports['default'];
/***/ },
/* 446 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__(1);
var React = _interopRequireWildcard(_react);
var _index = __webpack_require__(465);
var _index2 = _interopRequireDefault(_index);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var _DatePickerMixin = __webpack_require__(447);
var _DatePickerMixin2 = _interopRequireDefault(_DatePickerMixin);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
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; } }
var DatePickerWeb = React.createClass({
displayName: 'DatePickerWeb',
mixins: [_DatePickerMixin2["default"]],
getDefaultProps: function getDefaultProps() {
return {
prefixCls: 'rmc-date-picker',
pickerPrefixCls: 'rmc-picker'
};
},
render: function render() {
var _this = this;
var props = this.props;
var prefixCls = props.prefixCls;
var pickerPrefixCls = props.pickerPrefixCls;
var className = props.className;
var _getValueDataSource = this.getValueDataSource();
var value = _getValueDataSource.value;
var dataSource = _getValueDataSource.dataSource;
var inner = dataSource.map(function (items, i) {
return React.createElement(
'div',
{ key: i, className: prefixCls + '-item' },
React.createElement(
_index2["default"],
{ prefixCls: pickerPrefixCls, pure: false, selectedValue: value[i], onValueChange: function onValueChange(v) {
_this.onValueChange(i, v);
} },
items
)
);
});
return React.createElement(
'div',
{ className: (0, _classnames2["default"])(className, prefixCls) },
inner
);
}
});
exports["default"] = DatePickerWeb;
module.exports = exports['default'];
/***/ },
/* 447 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _toConsumableArray2 = __webpack_require__(89);
var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);
var _moment = __webpack_require__(107);
var _moment2 = _interopRequireDefault(_moment);
var _en_US = __webpack_require__(123);
var _en_US2 = _interopRequireDefault(_en_US);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function getDaysInMonth(now, selYear, selMonth) {
return now.clone().year(selYear).month(selMonth).endOf('month').date();
}
var DATETIME = 'datetime';
var DATE = 'date';
var TIME = 'time';
exports["default"] = {
getDefaultProps: function getDefaultProps() {
return {
locale: _en_US2["default"],
mode: DATE,
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
});
}
},
onValueChange: function onValueChange(index, value) {
var props = this.props;
var newValue = this.getDate().clone();
if (props.mode === DATETIME || props.mode === DATE) {
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 this.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();
},
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 locale = this.props.locale;
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 months = [];
var minMonth = 0;
var maxMonth = 11;
if (minDateYear === selYear) {
minMonth = minDateMonth;
}
if (maxDateYear === selYear) {
maxMonth = maxDateMonth;
}
for (var _i = minMonth; _i <= maxMonth; _i++) {
months.push({
value: _i,
label: _i + 1 + locale.month
});
}
var days = [];
var minDay = 1;
var maxDay = getDaysInMonth(date, selYear, selMonth);
if (minDateYear === selYear && minDateMonth === selMonth) {
minDay = minDateDay;
}
if (maxDateYear === selYear && maxDateMonth === selMonth) {
maxDay = maxDateDay;
}
for (var _i2 = minDay; _i2 <= maxDay; _i2++) {
days.push({
value: _i2,
label: _i2 + locale.day
});
}
return [years, months, days];
},
getTimeData: function getTimeData() {
var minHour = 0;
var maxHour = 23;
var minMinute = 0;
var maxMinute = 59;
var _props = this.props;
var mode = _props.mode;
var locale = _props.locale;
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: i + locale.hour
});
}
var minutes = [];
for (var _i3 = minMinute; _i3 <= maxMinute; _i3++) {
minutes.push({
value: _i3,
label: _i3 + locale.minute
});
}
return [hours, 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') < 0) {
return minDate.clone();
}
if (date.isAfter(maxDate, 'day') > 0) {
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;
},
getValueDataSource: function getValueDataSource() {
var mode = this.props.mode;
var date = this.getDate();
var dataSource = [];
var value = [];
if (mode === DATETIME || mode === DATE) {
dataSource = [].concat((0, _toConsumableArray3["default"])(this.getDateData()));
value = [date.year(), date.month(), date.date()];
}
if (mode === DATETIME || mode === TIME) {
dataSource = dataSource.concat(this.getTimeData());
value = value.concat([date.hour(), date.minute()]);
}
return {
value: value,
dataSource: dataSource
};
}
};
module.exports = exports['default'];
/***/ },
/* 448 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = __webpack_require__(8);
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 React = _interopRequireWildcard(_react);
var _DatePicker = __webpack_require__(446);
var _DatePicker2 = _interopRequireDefault(_DatePicker);
var _en_US = __webpack_require__(123);
var _en_US2 = _interopRequireDefault(_en_US);
var _utils = __webpack_require__(450);
var _Popup = __webpack_require__(128);
var _Popup2 = _interopRequireDefault(_Popup);
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 EXCLUDE_PROPS = {
popupPrefixCls: 1,
pickerPrefixCls: 1,
minDate: 1,
maxDate: 1,
mode: 1,
onPickerChange: 1,
onChange: 1,
locale: 1,
date: 1
};
var PopupDatePicker = function (_React$Component) {
(0, _inherits3["default"])(PopupDatePicker, _React$Component);
function PopupDatePicker(props) {
(0, _classCallCheck3["default"])(this, PopupDatePicker);
var _this = (0, _possibleConstructorReturn3["default"])(this, _React$Component.call(this, props));
_this.onPickerChange = function (pickerDate) {
_this.setState({
pickerDate: pickerDate
});
_this.props.onPickerChange(pickerDate);
};
_this.onOk = function () {
_this.props.onChange(_this.state.pickerDate || _this.props.date);
};
_this.fireVisibleChange = function (visible) {
if (_this.state.visible !== visible) {
if (!('visible' in _this.props)) {
_this.setVisibleState(visible);
}
_this.props.onVisibleChange(visible);
}
};
_this.state = {
pickerDate: null,
visible: _this.props.visible || false
};
return _this;
}
PopupDatePicker.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
if ('visible' in nextProps) {
this.setVisibleState(nextProps.visible);
}
};
PopupDatePicker.prototype.setVisibleState = function setVisibleState(visible) {
this.setState({
visible: visible
});
if (!visible) {
this.setState({
pickerDate: null
});
}
};
PopupDatePicker.prototype.getModal = function getModal() {
var props = this.props;
var dpProps = {};
if (props.minDate) {
dpProps.minDate = props.minDate;
}
if (props.maxDate) {
dpProps.maxDate = props.maxDate;
}
if (props.pickerPrefixCls) {
dpProps.pickerPrefixCls = props.pickerPrefixCls;
}
if (props.prefixCls) {
dpProps.prefixCls = props.prefixCls;
}
return React.createElement(_DatePicker2["default"], (0, _extends3["default"])({ date: this.state.pickerDate || props.date, mode: props.mode, locale: props.locale, onDateChange: this.onPickerChange }, dpProps));
};
PopupDatePicker.prototype.render = function render() {
var props = (0, _utils.exclude)(this.props, EXCLUDE_PROPS);
props.prefixCls = this.props.popupPrefixCls;
return React.createElement(_Popup2["default"], (0, _extends3["default"])({}, props, { onVisibleChange: this.fireVisibleChange, onOk: this.onOk, content: this.getModal(), visible: this.state.visible }));
};
return PopupDatePicker;
}(React.Component);
exports["default"] = PopupDatePicker;
PopupDatePicker.defaultProps = {
onVisibleChange: _utils.noop,
popupPrefixCls: 'rmc-picker-popup',
mode: 'datetime',
locale: _en_US2["default"],
onChange: _utils.noop,
onDismiss: _utils.noop,
onPickerChange: _utils.noop
};
module.exports = exports['default'];
/***/ },
/* 449 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = {
year: '年',
month: '月',
day: '日',
hour: '时',
minute: '分'
};
module.exports = exports['default'];
/***/ },
/* 450 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _keys = __webpack_require__(33);
var _keys2 = _interopRequireDefault(_keys);
exports.exclude = exclude;
exports.noop = noop;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function exclude(props, bl) {
var ret = {};
(0, _keys2["default"])(props).forEach(function (k) {
if (!bl[k]) {
ret[k] = props[k];
}
});
return ret;
}
function noop() {}
/***/ },
/* 451 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = __webpack_require__(8);
var _extends3 = _interopRequireDefault(_extends2);
var _defineProperty2 = __webpack_require__(6);
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
var _objectWithoutProperties2 = __webpack_require__(53);
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__(9);
var _reactDom2 = _interopRequireDefault(_reactDom);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var _ListView = __webpack_require__(124);
var _ListView2 = _interopRequireDefault(_ListView);
var _indexedUtil = __webpack_require__(462);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
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));
_this.sectionComponents = {};
_this.onQuickSearchTop = function (sectionID, topId) {
if (_this.props.stickyHeader) {
window.document.body.scrollTop = 0;
} else {
_reactDom2["default"].findDOMNode(_this.refs.indexedListView.refs.listviewscroll).scrollTop = 0;
}
_this.props.onQuickSearch(sectionID, topId);
};
_this.onQuickSearch = function (sectionID) {
var lv = _reactDom2["default"].findDOMNode(_this.refs.indexedListView.refs.listviewscroll);
var sec = _reactDom2["default"].findDOMNode(_this.sectionComponents[sectionID]);
if (_this.props.stickyHeader) {
// react-sticky 会把 header 设置为 fixed ,但提供了 placeholder 记忆原来位置
var stickyComponent = _this.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, _indexedUtil.getOffsetTop)(lv);
} else {
lv.scrollTop += sec.getBoundingClientRect().top - lv.getBoundingClientRect().top;
}
_this.props.onQuickSearch(sectionID);
};
_this.onTouchStart = function (e) {
_this._target = e.target;
_this._basePos = _this.refs.quickSearchBar.getBoundingClientRect();
document.addEventListener('touchmove', _this._disableParent, false);
document.body.className = document.body.className + ' ' + _this.props.prefixCls + '-qsb-moving';
_this.updateCls(_this._target);
};
_this.onTouchMove = function (e) {
e.preventDefault();
if (_this._target) {
var ex = (0, _indexedUtil._event)(e);
var basePos = _this._basePos;
var _pos = void 0;
if (ex.clientY >= basePos.top && ex.clientY <= basePos.top + _this._qsHeight) {
_pos = Math.floor((ex.clientY - basePos.top) / _this._avgH);
var target = void 0;
if (_pos in _this._hCache) {
target = _this._hCache[_pos][0];
}
if (target) {
var overValue = target.getAttribute('data-qf-target');
if (_this._target !== target) {
if (_this.props.quickSearchBarTop.value === overValue) {
_this.onQuickSearchTop(undefined, overValue);
} else {
_this.onQuickSearch(overValue);
}
_this.updateCls(target);
}
_this._target = target;
}
}
}
};
_this.onTouchEnd = function (e) {
if (!_this._target) {
return;
}
document.removeEventListener('touchmove', _this._disableParent, false);
document.body.className = document.body.className.replace(new RegExp(_this.props.prefixCls + '-qsb-moving', 'g'), '');
_this.updateCls(_this._target, true);
_this._target = null;
};
_this.updateCls = function (el, end) {
var cls = _this.props.prefixCls + '-quick-search-bar-over';
// can not use setState to change className, it has a big performance issue!
_this._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();
};
_this.state = {
pageSize: props.pageSize,
_delay: false
};
return _this;
}
IndexedList.prototype.componentWillUnmount = function componentWillUnmount() {
if (this._timer) {
clearTimeout(this._timer);
}
this._hCache = null;
};
IndexedList.prototype.componentDidMount = function componentDidMount() {
var _this2 = this;
// delay render more
this.setState({
_delay: true
});
this._timer = setTimeout(function () {
_this2.setState({
pageSize: _this2.props.dataSource.getRowCount(),
_delay: false
}, function () {
_this2.refs.indexedListView._pageInNewRows();
});
}, this.props.delayTime);
// handle quickSearchBar
var quickSearchBar = this.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];
}
this._qsHeight = height;
this._avgH = _avgH;
this._hCache = hCache;
};
IndexedList.prototype.renderQuickSearchBar = function renderQuickSearchBar(quickSearchBarTop, quickSearchBarStyle) {
var _this3 = this;
var _props = this.props;
var dataSource = _props.dataSource;
var 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 _this3.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 _this3.onQuickSearch(i.value);
}
},
i.label
);
})
);
};
IndexedList.prototype.render = function render() {
var _classNames,
_this4 = this;
var _state = this.state;
var _delay = _state._delay;
var pageSize = _state.pageSize;
var _props2 = this.props;
var className = _props2.className;
var prefixCls = _props2.prefixCls;
var children = _props2.children;
var quickSearchBarTop = _props2.quickSearchBarTop;
var quickSearchBarStyle = _props2.quickSearchBarStyle;
var _props2$initialListSi = _props2.initialListSize;
var initialListSize = _props2$initialListSi === undefined ? Math.min(20, this.props.dataSource.getRowCount()) : _props2$initialListSi;
var _renderSectionHeader = _props2.renderSectionHeader;
var other = (0, _objectWithoutProperties3["default"])(_props2, ['className', 'prefixCls', 'children', 'quickSearchBarTop', 'quickSearchBarStyle', 'initialListSize', 'renderSectionHeader']);
var wrapCls = (0, _classnames2["default"])((_classNames = {}, (0, _defineProperty3["default"])(_classNames, className, className), (0, _defineProperty3["default"])(_classNames, prefixCls, true), _classNames));
// 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: wrapCls,
initialListSize: initialListSize,
pageSize: pageSize,
renderSectionHeader: function renderSectionHeader(sectionData, sectionID) {
return _react2["default"].createElement(
'div',
{
className: prefixCls + '-section-header',
ref: function ref(c) {
_this4.sectionComponents[sectionID] = c;
}
},
_renderSectionHeader(sectionData, sectionID)
);
}
}),
this.renderQuickSearchBar(quickSearchBarTop, quickSearchBarStyle),
children
)
);
};
return IndexedList;
}(_react2["default"].Component);
IndexedList.propTypes = {
prefixCls: _react.PropTypes.string,
quickSearchBarTop: _react.PropTypes.object,
onQuickSearch: _react.PropTypes.func
};
IndexedList.defaultProps = {
prefixCls: 'am-indexed-list',
quickSearchBarTop: { value: '#', label: '#' },
onQuickSearch: function onQuickSearch() {},
delayTime: 100,
// delayActivityIndicator: rendering more
,
delayActivityIndicator: ''
};
exports["default"] = IndexedList;
module.exports = exports['default'];
/***/ },
/* 452 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _keys = __webpack_require__(33);
var _keys2 = _interopRequireDefault(_keys);
var _classCallCheck2 = __webpack_require__(2);
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _invariant = __webpack_require__(44);
var _invariant2 = _interopRequireDefault(_invariant);
var _isEmpty = __webpack_require__(346);
var _isEmpty2 = _interopRequireDefault(_isEmpty);
var _warning = __webpack_require__(24);
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 = (0, _keys2["default"])(dataBlob);
}
if (rowIdentities) {
newSource.rowIdentities = rowIdentities;
} else {
newSource.rowIdentities = [];
newSource.sectionIdentities.forEach(function (sectionID) {
newSource.rowIdentities.push((0, _keys2["default"])(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;
/***/ },
/* 453 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = __webpack_require__(8);
var _extends3 = _interopRequireDefault(_extends2);
var _objectWithoutProperties2 = __webpack_require__(53);
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__(9);
var _reactDom2 = _interopRequireDefault(_reactDom);
var _ScrollResponder = __webpack_require__(125);
var _ScrollResponder2 = _interopRequireDefault(_ScrollResponder);
var _StyleSheet = __webpack_require__(455);
var _StyleSheet2 = _interopRequireDefault(_StyleSheet);
var _View = __webpack_require__(461);
var _View2 = _interopRequireDefault(_View);
var _reactMixin = __webpack_require__(115);
var _reactMixin2 = _interopRequireDefault(_reactMixin);
var _autobindDecorator = __webpack_require__(72);
var _autobindDecorator2 = _interopRequireDefault(_autobindDecorator);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var throttle = __webpack_require__(104);
var invariant = __webpack_require__(44);
var SCROLLVIEW = 'ScrollView';
var INNERVIEW = 'InnerScrollView';
var CONTENT_EXT_STYLE = ['padding', 'paddingTop', 'paddingBottom', 'paddingLeft', 'paddingRight'];
/**
* Component that wraps platform ScrollView while providing
* integration with touch locking "responder" system.
*
* Keep in mind that ScrollViews must have a bounded height in order to work,
* since they contain unbounded-height children into a bounded container (via
* a scroll interaction). In order to bound the height of a ScrollView, either
* set the height of the view directly (discouraged) or make sure all parent
* views have bounded height. Forgetting to transfer `{flex: 1}` down the
* view stack can lead to errors here, which the element inspector makes
* easy to debug.
*
* Doesn't yet support other contained responders from blocking this scroll
* view from becoming the responder.
*/
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.state = _this.scrollResponderMixinGetInitialState(), _temp), (0, _possibleConstructorReturn3["default"])(_this, _ret);
}
ScrollView.prototype.componentDidMount = function componentDidMount() {
if (this.props.stickyHeader) {
return;
}
var scrollView = _reactDom2["default"].findDOMNode(this.refs[SCROLLVIEW]);
this.__handleScroll = this._handleScroll();
scrollView.addEventListener('scroll', this.__handleScroll);
};
ScrollView.prototype.componentWillUnmount = function componentWillUnmount() {
if (this.props.stickyHeader) {
return;
}
var scrollView = _reactDom2["default"].findDOMNode(this.refs[SCROLLVIEW]);
scrollView.removeEventListener('scroll', this.__handleScroll);
};
/**
* Returns a reference to the underlying scroll responder, which supports
* operations like `scrollTo`. All ScrollView-like components should
* implement this method so that they can be composed while providing access
* to the underlying scroll responder's methods.
*/
ScrollView.prototype.getScrollResponder = function getScrollResponder() {
return this;
};
ScrollView.prototype.getInnerViewNode = function getInnerViewNode() {
return this.refs[INNERVIEW];
};
ScrollView.prototype.scrollTo = function scrollTo(destY, destX) {
// $FlowFixMe - Don't know how to pass Mixin correctly. Postpone for now
// this.getScrollResponder().scrollResponderScrollTo(destX || 0, destY || 0);
this.scrollWithoutAnimationTo(destY, destX);
};
ScrollView.prototype.scrollWithoutAnimationTo = function scrollWithoutAnimationTo(destY, destX) {
// $FlowFixMe - Don't know how to pass Mixin correctly. Postpone for now
// this.getScrollResponder().scrollResponderScrollWithouthAnimationTo(
// destX || 0,
// destY || 0,
// );
var scrollView = _reactDom2["default"].findDOMNode(this.refs[SCROLLVIEW]);
scrollView.scrollTop = destY || 0;
scrollView.scrollLeft = destX || 0;
};
ScrollView.prototype._handleScroll = function _handleScroll(e) {
var handleScroll = function handleScroll() {};
// let handleScroll = this.handleScroll;
if (this.props.scrollEventThrottle && this.props.onScroll) {
handleScroll = throttle(this.handleScroll, this.props.scrollEventThrottle);
}
return handleScroll;
};
ScrollView.prototype.handleScroll = function handleScroll(e) {
// if (__DEV__) {
// if (this.props.onScroll && !this.props.scrollEventThrottle) {
// console.log(
// 'You specified `onScroll` on a but not ' +
// '`scrollEventThrottle`. You will only receive one event. ' +
// 'Using `16` you get all the events but be aware that it may ' +
// 'cause frame drops, use a bigger number if you don\'t need as ' +
// 'much precision.'
// );
// }
// }
// if (Platform.OS === 'android') {
// if (this.props.keyboardDismissMode === 'on-drag') {
// dismissKeyboard();
// }
// }
this.props.onScroll && this.props.onScroll(e);
};
// _handleContentOnLayout(e) {
// const {width, height} = e.nativeEvent.layout;
// this.props.onContentSizeChange && this.props.onContentSizeChange(width, height);
// }
ScrollView.prototype.render = function render() {
var _props = this.props;
var _props$style = _props.style;
var style = _props$style === undefined ? {} : _props$style;
var otherProps = (0, _objectWithoutProperties3["default"])(_props, ['style']);
var contentContainerExtStyle = {};
for (var i = 0; i < CONTENT_EXT_STYLE.length; i++) {
if (typeof style[CONTENT_EXT_STYLE[i]] === 'number') {
contentContainerExtStyle[CONTENT_EXT_STYLE[i]] = style[CONTENT_EXT_STYLE[i]];
}
}
var contentContainerStyle = [styles.contentContainer, this.props.horizontal && styles.contentContainerHorizontal, this.props.contentContainerStyle, contentContainerExtStyle];
// if (__DEV__ && this.props.style) {
// let style = flattenStyle(this.props.style);
// let childLayoutProps = ['alignItems', 'justifyContent']
// .filter((prop) => style && style[prop] !== undefined);
// invariant(
// childLayoutProps.length === 0,
// 'ScrollView child layout (' + JSON.stringify(childLayoutProps) +
// ') must by applied through the contentContainerStyle prop.'
// );
// }
var contentSizeChangeProps = {};
// if (this.props.onContentSizeChange) { // 会多次触发 scroll 事件
// contentSizeChangeProps = {
// onLayout: this._handleContentOnLayout,
// };
// }
var contentContainer = _react2["default"].createElement(
_View2["default"],
(0, _extends3["default"])({}, contentSizeChangeProps, {
ref: INNERVIEW,
style: _StyleSheet2["default"].flattenStyle(contentContainerStyle),
removeClippedSubviews: this.props.removeClippedSubviews,
collapsable: false }),
this.props.children
);
var alwaysBounceHorizontal = this.props.alwaysBounceHorizontal !== undefined ? this.props.alwaysBounceHorizontal : this.props.horizontal;
var alwaysBounceVertical = this.props.alwaysBounceVertical !== undefined ? this.props.alwaysBounceVertical : !this.props.horizontal;
// const handleScroll = this._handleScroll();
var props = (0, _extends3["default"])({}, otherProps, {
alwaysBounceHorizontal: alwaysBounceHorizontal,
alwaysBounceVertical: alwaysBounceVertical,
style: _StyleSheet2["default"].flattenStyle([otherProps.stickyHeader ? null : styles.base, this.props.style]),
onTouchStart: this.scrollResponderHandleTouchStart,
onTouchMove: this.scrollResponderHandleTouchMove,
onTouchEnd: this.scrollResponderHandleTouchEnd,
onScrollBeginDrag: this.scrollResponderHandleScrollBeginDrag,
onScrollEndDrag: this.scrollResponderHandleScrollEndDrag,
onMomentumScrollBegin: this.scrollResponderHandleMomentumScrollBegin,
onMomentumScrollEnd: this.scrollResponderHandleMomentumScrollEnd,
onStartShouldSetResponder: this.scrollResponderHandleStartShouldSetResponder,
onStartShouldSetResponderCapture: this.scrollResponderHandleStartShouldSetResponderCapture,
// onScrollShouldSetResponder: this.scrollResponderHandleScrollShouldSetResponder,
// onScroll: handleScroll,
// onScrollShouldSetResponder: handleScroll,
// replace onScroll in the props
// onScroll: () => {},
onResponderGrant: this.scrollResponderHandleResponderGrant,
onResponderTerminationRequest: this.scrollResponderHandleTerminationRequest,
onResponderTerminate: this.scrollResponderHandleTerminate,
onResponderRelease: this.scrollResponderHandleResponderRelease,
onResponderReject: this.scrollResponderHandleResponderReject
});
// 这里会绑定多次?放在 componentDidMount 里绑定 onScroll
delete props.onScroll;
var decelerationRate = this.props.decelerationRate;
if (decelerationRate) {
props.decelerationRate = processDecelerationRate(decelerationRate);
}
var ScrollViewClass = _View2["default"];
// if (Platform.OS === 'ios') {
// ScrollViewClass = RCTScrollView;
// } else if (Platform.OS === 'android') {
// if (this.props.horizontal) {
// ScrollViewClass = AndroidHorizontalScrollView;
// } else {
// ScrollViewClass = AndroidScrollView;
// }
// }
// invariant(
// ScrollViewClass !== undefined,
// 'ScrollViewClass must not be undefined'
// );
var refreshControl = this.props.refreshControl;
if (refreshControl) {
// if (Platform.OS === 'ios') {
// // On iOS the RefreshControl is a child of the ScrollView.
// return (
//
// {refreshControl}
// {contentContainer}
//
// );
// } else if (Platform.OS === 'android') {
// // On Android wrap the ScrollView with a AndroidSwipeRefreshLayout.
// // Since the ScrollView is wrapped add the style props to the
// // AndroidSwipeRefreshLayout and use flex: 1 for the ScrollView.
// return React.cloneElement(
// refreshControl,
// {style: props.style},
//
// {contentContainer}
//
// );
// }
if (props.stickyHeader) {
return _react2["default"].createElement(
ScrollViewClass,
(0, _extends3["default"])({}, props, { ref: SCROLLVIEW }),
refreshControl,
this.props.children
);
}
return _react2["default"].createElement(
ScrollViewClass,
(0, _extends3["default"])({}, props, { ref: SCROLLVIEW }),
refreshControl,
contentContainer
);
}
if (props.stickyHeader) {
return _react2["default"].createElement(
ScrollViewClass,
(0, _extends3["default"])({}, props, { ref: SCROLLVIEW }),
this.props.children
);
}
return _react2["default"].createElement(
ScrollViewClass,
(0, _extends3["default"])({}, props, { ref: SCROLLVIEW }),
contentContainer
);
};
return ScrollView;
}(_react2["default"].Component);
ScrollView.propTypes = {
/**
* Controls whether iOS should automatically adjust the content inset
* for scroll views that are placed behind a navigation bar or
* tab bar/ toolbar. The default value is true.
* @platform ios
*/
automaticallyAdjustContentInsets: _react.PropTypes.bool,
/**
* The amount by which the scroll view content is inset from the edges
* of the scroll view. Defaults to `{0, 0, 0, 0}`.
* @platform ios
*/
// contentInset: EdgeInsetsPropType,
/**
* Used to manually set the starting scroll offset.
* The default value is `{x: 0, y: 0}`.
* @platform ios
*/
// contentOffset: PointPropType,
/**
* When true, the scroll view bounces when it reaches the end of the
* content if the content is larger then the scroll view along the axis of
* the scroll direction. When false, it disables all bouncing even if
* the `alwaysBounce*` props are true. The default value is true.
* @platform ios
*/
bounces: _react.PropTypes.bool,
/**
* When true, gestures can drive zoom past min/max and the zoom will animate
* to the min/max value at gesture end, otherwise the zoom will not exceed
* the limits.
* @platform ios
*/
bouncesZoom: _react.PropTypes.bool,
/**
* When true, the scroll view bounces horizontally when it reaches the end
* even if the content is smaller than the scroll view itself. The default
* value is true when `horizontal={true}` and false otherwise.
* @platform ios
*/
alwaysBounceHorizontal: _react.PropTypes.bool,
/**
* When true, the scroll view bounces vertically when it reaches the end
* even if the content is smaller than the scroll view itself. The default
* value is false when `horizontal={true}` and true otherwise.
* @platform ios
*/
alwaysBounceVertical: _react.PropTypes.bool,
/**
* When true, the scroll view automatically centers the content when the
* content is smaller than the scroll view bounds; when the content is
* larger than the scroll view, this property has no effect. The default
* value is false.
* @platform ios
*/
centerContent: _react.PropTypes.bool,
/**
* These styles will be applied to the scroll view content container which
* wraps all of the child views. Example:
*
* return (
*
*
* );
* ...
* var styles = StyleSheet.create({
* contentContainer: {
* paddingVertical: 20
* }
* });
*/
// contentContainerStyle: StyleSheetPropType(ViewStylePropTypes),
/**
* A floating-point number that determines how quickly the scroll view
* decelerates after the user lifts their finger. Reasonable choices include
* - Normal: 0.998 (the default)
* - Fast: 0.9
* @platform ios
*/
decelerationRate: _react.PropTypes.number,
/**
* When true, the scroll view's children are arranged horizontally in a row
* instead of vertically in a column. The default value is false.
*/
horizontal: _react.PropTypes.bool,
/**
* When true, the ScrollView will try to lock to only vertical or horizontal
* scrolling while dragging. The default value is false.
* @platform ios
*/
directionalLockEnabled: _react.PropTypes.bool,
/**
* When false, once tracking starts, won't try to drag if the touch moves.
* The default value is true.
* @platform ios
*/
canCancelContentTouches: _react.PropTypes.bool,
/**
* Determines whether the keyboard gets dismissed in response to a drag.
* - 'none' (the default), drags do not dismiss the keyboard.
* - 'on-drag', the keyboard is dismissed when a drag begins.
* - 'interactive', the keyboard is dismissed interactively with the drag and moves in
* synchrony with the touch; dragging upwards cancels the dismissal.
* On android this is not supported and it will have the same behavior as 'none'.
*/
keyboardDismissMode: _react.PropTypes.oneOf(['none', // default
'interactive', 'on-drag']),
/**
* When false, tapping outside of the focused text input when the keyboard
* is up dismisses the keyboard. When true, the scroll view will not catch
* taps, and the keyboard will not dismiss automatically. The default value
* is false.
*/
keyboardShouldPersistTaps: _react.PropTypes.bool,
/**
* The maximum allowed zoom scale. The default value is 1.0.
* @platform ios
*/
maximumZoomScale: _react.PropTypes.number,
/**
* The minimum allowed zoom scale. The default value is 1.0.
* @platform ios
*/
minimumZoomScale: _react.PropTypes.number,
/**
* Fires at most once per frame during scrolling. The frequency of the
* events can be contolled using the `scrollEventThrottle` prop.
*/
onScroll: _react.PropTypes.func,
/**
* Called when a scrolling animation ends.
* @platform ios
*/
onScrollAnimationEnd: _react.PropTypes.func,
/**
* When true, the scroll view stops on multiples of the scroll view's size
* when scrolling. This can be used for horizontal pagination. The default
* value is false.
* @platform ios
*/
pagingEnabled: _react.PropTypes.bool,
/**
* When false, the content does not scroll.
* The default value is true.
* @platform ios
*/
scrollEnabled: _react.PropTypes.bool,
/**
* This controls how often the scroll event will be fired while scrolling
* (in events per seconds). A higher number yields better accuracy for code
* that is tracking the scroll position, but can lead to scroll performance
* problems due to the volume of information being send over the bridge.
* The default value is zero, which means the scroll event will be sent
* only once each time the view is scrolled.
* @platform ios
*/
scrollEventThrottle: _react.PropTypes.number,
/**
* The amount by which the scroll view indicators are inset from the edges
* of the scroll view. This should normally be set to the same value as
* the `contentInset`. Defaults to `{0, 0, 0, 0}`.
* @platform ios
*/
// scrollIndicatorInsets: EdgeInsetsPropType,
/**
* When true, the scroll view scrolls to top when the status bar is tapped.
* The default value is true.
* @platform ios
*/
scrollsToTop: _react.PropTypes.bool,
/**
* When true, shows a horizontal scroll indicator.
*/
showsHorizontalScrollIndicator: _react.PropTypes.bool,
/**
* When true, shows a vertical scroll indicator.
*/
showsVerticalScrollIndicator: _react.PropTypes.bool,
/**
* An array of child indices determining which children get docked to the
* top of the screen when scrolling. For example, passing
* `stickyHeaderIndices={[0]}` will cause the first child to be fixed to the
* top of the scroll view. This property is not supported in conjunction
* with `horizontal={true}`.
* @platform ios
*/
stickyHeaderIndices: _react.PropTypes.arrayOf(_react.PropTypes.number),
// style: StyleSheetPropType(ViewStylePropTypes),
/**
* When set, causes the scroll view to stop at multiples of the value of
* `snapToInterval`. This can be used for paginating through children
* that have lengths smaller than the scroll view. Used in combination
* with `snapToAlignment`.
* @platform ios
*/
snapToInterval: _react.PropTypes.number,
/**
* When `snapToInterval` is set, `snapToAlignment` will define the relationship
* of the the snapping to the scroll view.
* - `start` (the default) will align the snap at the left (horizontal) or top (vertical)
* - `center` will align the snap in the center
* - `end` will align the snap at the right (horizontal) or bottom (vertical)
* @platform ios
*/
snapToAlignment: _react.PropTypes.oneOf(['start', // default
'center', 'end']),
/**
* Experimental: When true, offscreen child views (whose `overflow` value is
* `hidden`) are removed from their native backing superview when offscreen.
* This can improve scrolling performance on long lists. The default value is
* false.
*/
removeClippedSubviews: _react.PropTypes.bool,
/**
* The current scale of the scroll view content. The default value is 1.0.
* @platform ios
*/
zoomScale: _react.PropTypes.number,
/**
* A RefreshControl component, used to provide pull-to-refresh
* functionality for the ScrollView.
*
* See [RefreshControl](docs/refreshcontrol.html).
*/
refreshControl: _react.PropTypes.element
};
;
var styles = _StyleSheet2["default"].create({
base: {
position: 'relative',
overflow: 'auto',
WebkitOverflowScrolling: 'touch',
flex: 1
},
contentContainer: {
position: 'absolute',
minWidth: '100%'
},
contentContainerHorizontal: {
alignSelf: 'flex-start',
flexDirection: 'row'
}
});
(0, _reactMixin2["default"])(ScrollView.prototype, _ScrollResponder2["default"].Mixin);
(0, _autobindDecorator2["default"])(ScrollView);
ScrollView.isReactNativeComponent = true;
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"] = {
create: function create(styles) {
return styles;
},
flattenStyle: function flattenStyle(style, processor) {
if (!style) {
return undefined;
}
if (!Array.isArray(style)) {
return processor && processor(style) || style;
}
var result = {};
for (var i = 0; i < style.length; ++i) {
var computedStyle = flattenStyle(style[i]);
if (computedStyle) {
for (var key in computedStyle) {
if (computedStyle.hasOwnProperty(key)) {
result[key] = computedStyle[key];
}
}
}
}
return processor && processor(result) || result;
}
};
module.exports = exports['default'];
/***/ },
/* 456 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _reactDom = __webpack_require__(9);
var _reactDom2 = _interopRequireDefault(_reactDom);
var _getLayout = __webpack_require__(459);
var _getLayout2 = _interopRequireDefault(_getLayout);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var LayoutMixin = {
getInitialState: function getInitialState() {
return { layout: {} };
},
componentDidMount: function componentDidMount() {
this.layoutHandle();
},
componentDidUpdate: function componentDidUpdate() {
this.layoutHandle();
},
layoutHandle: function layoutHandle() {
if (this.props.onLayout) {
var layout = (0, _getLayout2["default"])(_reactDom2["default"].findDOMNode(this));
var stateLayout = this.state.layout;
if (stateLayout.x !== layout.x || stateLayout.y !== layout.y || stateLayout.width !== layout.width || stateLayout.height !== layout.height) {
this.props.onLayout({ nativeEvent: { layout: layout } });
this.setState({ layout: layout });
}
}
}
};
// 'use strict';
module.exports = {
Mixin: LayoutMixin
};
/***/ },
/* 457 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _UIManager = __webpack_require__(458);
var _UIManager2 = _interopRequireDefault(_UIManager);
var _reactDom = __webpack_require__(9);
var _reactDom2 = _interopRequireDefault(_reactDom);
var _setNativeProps2 = __webpack_require__(460);
var _setNativeProps3 = _interopRequireDefault(_setNativeProps2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var NativeMethodsMixin = {
/**
* Determines the location on screen, width, and height of the given view and
* returns the values via an async callback. If successful, the callback will
* be called with the following arguments:
*
* - x
* - y
* - width
* - height
* - pageX
* - pageY
*
* Note that these measurements are not available until after the rendering
* has been completed in native. If you need the measurements as soon as
* possible, consider using the [`onLayout`
* prop](/react-native/docs/view.html#onlayout) instead.
*/
measure: function measure(callback) {
_UIManager2["default"].measure(_reactDom2["default"].findDOMNode(this), mountSafeCallback(this, callback));
},
/**
* Like [`measure()`](#measure), but measures the view relative an ancestor,
* specified as `relativeToNativeNode`. This means that the returned x, y
* are relative to the origin x, y of the ancestor view.
*
* As always, to obtain a native node handle for a component, you can use
* `ReactDOM.findDOMNode(component)`.
*/
measureLayout: function measureLayout(relativeToNativeNode, onSuccess, onFail) {
_UIManager2["default"].measureLayout(_reactDom2["default"].findDOMNode(this), relativeToNativeNode, mountSafeCallback(this, onFail), mountSafeCallback(this, onSuccess));
},
/**
* This function sends props straight to native. They will not participate in
* future diff process - this means that if you do not include them in the
* next render, they will remain active (see [Direct
* Manipulation](/react-native/docs/direct-manipulation.html)).
*/
setNativeProps: function setNativeProps(nativeProps) {
(0, _setNativeProps3["default"])(_reactDom2["default"].findDOMNode(this), nativeProps);
},
/**
* Requests focus for the given input or view. The exact behavior triggered
* will depend on the platform and type of view.
*/
focus: function focus() {
_reactDom2["default"].findDOMNode(this).focus();
},
/**
* Removes focus from an input or view. This is the opposite of `focus()`.
*/
blur: function blur() {
_reactDom2["default"].findDOMNode(this).blur();
}
};
/**
* In the future, we should cleanup callbacks by cancelling them instead of
* using this.
*/
// 'use strict';
var mountSafeCallback = function mountSafeCallback(context, callback) {
return function () {
if (!callback || context.isMounted && !context.isMounted()) {
return;
}
return callback.apply(context, arguments);
};
};
module.exports = { Mixin: NativeMethodsMixin };
/***/ },
/* 458 */
/***/ function(module, exports) {
"use strict";
var UIManager = {
measure: function measure(ref, callback) {
var rect = ref.getBoundingClientRect();
callback(0, 0, rect.width, rect.height, rect.left, rect.top);
},
measureLayout: function measureLayout(ref, relativeTo, errorCallback, callback) {
var rect = ref.getBoundingClientRect();
var relativeRef = relativeTo.getBoundingClientRect();
callback(rect.left - relativeRef.left, rect.top - relativeRef.top, rect.width, rect.height);
}
};
module.exports = UIManager;
/***/ },
/* 459 */
/***/ function(module, exports) {
"use strict";
// 'use strict';
// get element x, y
function getCumulativeOffset(obj) {
var left, top;
left = top = 0;
if (obj.offsetParent) {
do {
left += obj.offsetLeft;
top += obj.offsetTop;
} while (obj = obj.offsetParent);
}
return {
x: left,
y: top
};
}
// this functions returns the x, y, width and height of a given dom node
function getLayout(element) {
var rect = getCumulativeOffset(element);
return {
x: rect.x,
y: rect.y,
width: element.offsetWidth,
height: element.offsetHeight
};
}
module.exports = getLayout;
/***/ },
/* 460 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
// 'use strict';
var CSSPropertyOperations = __webpack_require__(430);
function convertTransform(style) {
var result = {};
for (var k in style) {
if (k === 'transformMatrix') {
result.transform = 'matrix3d(' + style[k].join(',') + ') ';
} else {
result[k] = style[k];
}
}
return result;
}
function setNativeProps(node, props) {
for (var name in props) {
if (name === 'style') {
var style = props[name];
if ('transformMatrix' in style) {
style = convertTransform(style);
}
CSSPropertyOperations.setValueForStyles(node, style);
} else {
node.setAttribute(name, props[name]);
}
}
}
module.exports = setNativeProps;
/***/ },
/* 461 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__(1);
var _react2 = _interopRequireDefault(_react);
var _LayoutMixin = __webpack_require__(456);
var _NativeMethodsMixin = __webpack_require__(457);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var View = _react2["default"].createClass({
displayName: 'View',
mixins: [_LayoutMixin.Mixin, _NativeMethodsMixin.Mixin],
propTypes: {
/**
* When true, indicates that the view is an accessibility element. By default,
* all the touchable elements are accessible.
*/
accessible: _react.PropTypes.bool,
/**
* Overrides the text that's read by the screen reader when the user interacts
* with the element. By default, the label is constructed by traversing all the
* children and accumulating all the Text nodes separated by space.
*/
accessibilityLabel: _react.PropTypes.string,
/**
* When `accessible` is true, the system will try to invoke this function
* when the user performs accessibility tap gesture.
*/
onAccessibilityTap: _react.PropTypes.func,
/**
* When `accessible` is true, the system will invoke this function when the
* user performs the magic tap gesture.
*/
onMagicTap: _react.PropTypes.func,
/**
* Used to locate this view in end-to-end tests. NB: disables the 'layout-only
* view removal' optimization for this view!
*/
testID: _react.PropTypes.string,
/**
* For most touch interactions, you'll simply want to wrap your component in
* `TouchableHighlight` or `TouchableOpacity`. Check out `Touchable.js`,
* `ScrollResponder.js` and `ResponderEventPlugin.js` for more discussion.
*/
onResponderGrant: _react.PropTypes.func,
onResponderMove: _react.PropTypes.func,
onResponderReject: _react.PropTypes.func,
onResponderRelease: _react.PropTypes.func,
onResponderTerminate: _react.PropTypes.func,
onResponderTerminationRequest: _react.PropTypes.func,
onStartShouldSetResponder: _react.PropTypes.func,
onStartShouldSetResponderCapture: _react.PropTypes.func,
onMoveShouldSetResponder: _react.PropTypes.func,
onMoveShouldSetResponderCapture: _react.PropTypes.func,
/**
* Invoked on mount and layout changes with
*
* {nativeEvent: { layout: {x, y, width, height}}}.
*
* This event is fired immediately once the layout has been calculated, but
* the new layout may not yet be reflected on the screen at the time the
* event is received, especially if a layout animation is in progress.
*/
onLayout: _react.PropTypes.func,
/**
* Controls whether the View can be the target of touch events.
*
* - 'auto': The View can be the target of touch events.
* - 'none': The View is never the target of touch events.
* - 'box-none': The View is never the target of touch events but it's
* subviews can be. It behaves like if the view had the following classes
* in CSS:
* ```
* .box-none {
* pointer-events: none;
* }
* .box-none * {
* pointer-events: all;
* }
* ```
* - 'box-only': The view can be the target of touch events but it's
* subviews cannot be. It behaves like if the view had the following classes
* in CSS:
* ```
* .box-only {
* pointer-events: all;
* }
* .box-only * {
* pointer-events: none;
* }
* ```
*/
// Since `pointerEvents` does not affect layout/appearance, and we are
// already deviating from the spec by adding additional modes, we opt to not
// include `pointerEvents` on `style`. On some platforms, we would need to
// implement it as a `className` anyways. Using `style` or not is an
// implementation detail of the platform.
pointerEvents: _react.PropTypes.oneOf(['box-none', 'none', 'box-only', 'auto']),
style: _react.PropTypes.oneOfType([_react.PropTypes.object, _react.PropTypes.array]),
/**
* This is a special performance property exposed by RCTView and is useful
* for scrolling content when there are many subviews, most of which are
* offscreen. For this property to be effective, it must be applied to a
* view that contains many subviews that extend outside its bound. The
* subviews must also have overflow: hidden, as should the containing view
* (or one of its superviews).
*/
removeClippedSubviews: _react.PropTypes.bool
},
render: function render() {
var _props = this.props;
var children = _props.children;
var className = _props.className;
var style = _props.style;
var onScroll = _props.onScroll;
var _props$onCick = _props.onCick;
var onCick = _props$onCick === undefined ? function () {} : _props$onCick;
var divProps = { className: className, style: style, onScroll: onScroll, onClick: onCick };
return _react2["default"].createElement(
'div',
divProps,
children
);
}
});
View.isReactNativeComponent = true;
exports["default"] = View;
module.exports = exports['default'];
/***/ },
/* 462 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getOffsetTop = getOffsetTop;
exports._event = _event;
function getOffsetTop(elem) {
var offsetTop = 0;
do {
if (!isNaN(elem.offsetTop)) {
offsetTop += elem.offsetTop;
}
} while (elem = elem.offsetParent);
return offsetTop;
}
var isTouchable = exports.isTouchable = 'ontouchstart' in window;
var START = exports.START = isTouchable ? 'touchstart' : 'mousedown';
var MOVE = exports.MOVE = isTouchable ? 'touchmove' : 'mousemove';
var END = exports.END = isTouchable ? 'touchend' : 'mouseup';
var CANCEL = exports.CANCEL = isTouchable ? 'touchcancel' : 'mousecancel';
var CLICK = exports.CLICK = isTouchable ? 'touchstart' : 'click';
var isBadMobile = /Android[^\d]*(1|2|3|4\.0)/.test(window.navigator.appVersion) || /iPhone[^\d]*(5)/.test(window.navigator.appVersion);
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;
}
/***/ },
/* 463 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.easeOutCubic = easeOutCubic;
exports.easeInOutCubic = easeInOutCubic;
var DESIRED_FRAMES = 60;
var MILLISECONDS_PER_SECOND = 1000;
var running = {};
var counter = 1;
var webkitRequestAnimationFrame = 'webkitRequestAnimationFrame';
var Animate = exports.Animate = {
// A requestAnimationFrame wrapper / polyfill.
requestAnimationFrame: function () {
var requestFrame = window.requestAnimationFrame || window[webkitRequestAnimationFrame];
return function (callback) {
requestFrame(callback);
};
}(),
// Stops the given animation.
stop: function stop(id) {
var cleared = running[id] !== null;
if (cleared) {
running[id] = null;
}
return cleared;
},
// Whether the given animation is still running.
isRunning: function isRunning(id) {
return running[id] !== null;
},
// Start the animation.
start: function start(stepCallback, verifyCallback, completedCallback, duration, easingMethod) {
var start = Date.now();
var lastFrame = start;
var percent = 0;
var dropCounter = 0;
var id = counter++;
// Compacting running db automatically every few new animations
if (id % 20 === 0) {
var newRunning = {};
for (var usedId in running) {
if (running.hasOwnProperty(usedId)) {
newRunning[usedId] = true;
}
}
running = newRunning;
}
// This is the internal step method which is called every few milliseconds
var step = function step(virtual) {
// Normalize virtual value
var render = virtual !== true;
// Get current time
var now = Date.now();
// Verification is executed before next animation step
if (!running[id] || verifyCallback && !verifyCallback(id)) {
running[id] = null;
if (completedCallback) {
completedCallback(DESIRED_FRAMES - dropCounter / ((now - start) / MILLISECONDS_PER_SECOND), id, false);
}
return;
}
// For the current rendering to
// apply let's update omitted steps in memory.
// This is important to bring internal
// state constiables up-to-date with progress in time.
if (render) {
var droppedFrames = Math.round((now - lastFrame) / (MILLISECONDS_PER_SECOND / DESIRED_FRAMES)) - 1;
for (var j = 0; j < Math.min(droppedFrames, 4); j++) {
step(true);
dropCounter++;
}
}
// Compute percent value
if (duration) {
percent = (now - start) / duration;
if (percent > 1) {
percent = 1;
}
}
// Execute step callback, then...
var value = easingMethod ? easingMethod(percent) : percent;
if ((stepCallback(value, now, render) === false || percent === 1) && render) {
running[id] = null;
if (completedCallback) {
completedCallback(DESIRED_FRAMES - dropCounter / ((now - start) / MILLISECONDS_PER_SECOND), id, percent === 1 || duration === null);
}
} else if (render) {
lastFrame = now;
Animate.requestAnimationFrame(step);
}
};
// Mark as running
running[id] = true;
// Init first step
Animate.requestAnimationFrame(step);
// Return unique animation ID
return id;
}
};
// Easing Equations (c) 2003 Robert Penner, all rights reserved.
// Open source under the BSD License.
function easeOutCubic(pos) {
return Math.pow(pos - 1, 3) + 1;
}
function easeInOutCubic(p) {
var pos = p;
pos /= 0.5;
if (pos < 1) {
return 0.5 * Math.pow(pos, 3);
}
return 0.5 * (Math.pow(pos - 2, 3) + 2);
}
/***/ },
/* 464 */
/***/ 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 React = _interopRequireWildcard(_react);
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() {}
exports["default"] = {
getDefaultProps: function getDefaultProps() {
return {
onVisibleChange: noop,
okText: 'Ok',
dismissText: 'Dismiss',
title: '',
onOk: noop,
onDismiss: noop
};
},
getInitialState: function getInitialState() {
return {
visible: this.props.visible || false
};
},
componentWillReceiveProps: function componentWillReceiveProps(nextProps) {
if ('visible' in nextProps) {
this.setVisibleState(nextProps.visible);
}
},
setVisibleState: function setVisibleState(visible) {
this.setState({
visible: visible
});
},
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 WrapComponent = this.props.WrapComponent;
var child = children;
var newChildProps = (0, _defineProperty3["default"])({}, props.triggerType, this.onTriggerClick);
return React.createElement(
WrapComponent,
{ style: props.style },
React.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.fireVisibleChange(false);
},
onDismiss: function onDismiss() {
this.props.onDismiss();
this.fireVisibleChange(false);
},
hide: function hide() {
this.fireVisibleChange(false);
}
};
module.exports = exports['default'];
/***/ },
/* 465 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _Picker = __webpack_require__(127);
Object.defineProperty(exports, 'default', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Picker)["default"];
}
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
module.exports = exports['default'];
/***/ },
/* 466 */
/***/ 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;
}
/***/ },
/* 467 */
/***/ function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getComputedStyle = getComputedStyle;
function getComputedStyle(el, key) {
var computedStyle = window.getComputedStyle(el);
return computedStyle[key] || '';
}
/***/ },
/* 468 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = __webpack_require__(8);
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 _wptr = __webpack_require__(470);
var _wptr2 = _interopRequireDefault(_wptr);
var _reactHammerjs = __webpack_require__(47);
var _reactHammerjs2 = _interopRequireDefault(_reactHammerjs);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var emptyEvents = {
onPanStart: undefined,
onPan: undefined,
onPanEnd: undefined
};
var PullToRefresh = function (_React$Component) {
(0, _inherits3["default"])(PullToRefresh, _React$Component);
function PullToRefresh() {
(0, _classCallCheck3["default"])(this, PullToRefresh);
return (0, _possibleConstructorReturn3["default"])(this, _React$Component.apply(this, arguments));
}
PullToRefresh.prototype.componentWillMount = function componentWillMount() {
this.webPullToRefresh = (0, _wptr2["default"])();
};
PullToRefresh.prototype.componentDidMount = function componentDidMount() {
var props = this.props;
var refs = this.refs;
this.webPullToRefresh.init({
contentEl: refs.content,
containerEl: refs.container,
ptrEl: refs.ptr,
prefixCls: props.prefixCls,
distanceToRefresh: props.distanceToRefresh,
loadingFunction: props.loadingFunction,
resistance: props.resistance
});
};
PullToRefresh.prototype.render = function render() {
var _props = this.props;
var prefixCls = _props.prefixCls;
var children = _props.children;
var icon = _props.icon;
var loading = _props.loading;
var disabled = _props.disabled;
var _props$className = _props.className;
var className = _props$className === undefined ? '' : _props$className;
var style = _props.style;
var contentStyle = _props.contentStyle;
var _props$contentClassNa = _props.contentClassName;
var contentClassName = _props$contentClassNa === undefined ? '' : _props$contentClassNa;
var _props$hammerOptions = _props.hammerOptions;
var hammerOptions = _props$hammerOptions === undefined ? {} : _props$hammerOptions;
var events = disabled ? emptyEvents : this.webPullToRefresh.events;
return _react2["default"].createElement(
'div',
{ className: className + ' ' + prefixCls, style: style, ref: 'container' },
_react2["default"].createElement(
'div',
{ ref: 'ptr', className: prefixCls + '-ptr' },
_react2["default"].createElement(
'div',
{ className: prefixCls + '-ptr-icon' },
icon
),
_react2["default"].createElement(
'div',
{ className: prefixCls + '-ptr-loading' },
loading
)
),
_react2["default"].createElement(
_reactHammerjs2["default"],
(0, _extends3["default"])({ direction: 'DIRECTION_ALL' }, events, { options: hammerOptions }),
_react2["default"].createElement(
'div',
{
ref: 'content',
className: prefixCls + '-content ' + contentClassName,
style: contentStyle
},
children
)
)
);
};
return PullToRefresh;
}(_react2["default"].Component);
PullToRefresh.propTypes = {
loadingFunction: _react.PropTypes.func.isRequired,
icon: _react.PropTypes.element,
prefixCls: _react.PropTypes.string,
loading: _react.PropTypes.element,
disabled: _react.PropTypes.bool,
className: _react.PropTypes.string,
style: _react.PropTypes.object,
contentClassName: _react.PropTypes.string,
contentStyle: _react.PropTypes.object,
distanceToRefresh: _react.PropTypes.number,
resistance: _react.PropTypes.number,
children: _react.PropTypes.any,
hammerOptions: _react.PropTypes.object
};
PullToRefresh.defaultProps = {
prefixCls: 'rmc-pull-to-refresh'
};
exports["default"] = PullToRefresh;
module.exports = exports['default'];
/***/ },
/* 469 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
module.exports = __webpack_require__(468);
/***/ },
/* 470 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = __webpack_require__(8);
var _extends3 = _interopRequireDefault(_extends2);
exports["default"] = WebPullToRefresh;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function WebPullToRefresh() {
/**
* Hold all of the default parameters for the module
* @type {object}
*/
var defaults = {
// Number of pixels of panning until refresh
distanceToRefresh: 70,
// Pointer to function that does the loading and returns a promise
loadingFunction: false,
// Dragging resistance level
resistance: 2.5
};
/**
* Hold all of the merged parameter and default module options
* @type {object}
*/
var options = {};
/**
* Pan event parameters
* @type {object}
*/
var pan = {
enabled: false,
distance: 0,
startingPositionY: 0
};
function bodyClassRemove() {
options.containerEl.classList.remove(options.prefixCls + '-reset');
options.containerEl.removeEventListener('transitionend', bodyClassRemove, false);
}
/**
* Reset all elements to their starting positions before any paning took place.
*/
function _doReset() {
options.containerEl.classList.remove(options.prefixCls + '-loading');
options.containerEl.classList.remove(options.prefixCls + '-refresh');
options.containerEl.classList.add(options.prefixCls + '-reset');
options.containerEl.addEventListener('transitionend', bodyClassRemove, false);
}
/**
* Position content and refresh elements to show that loading is taking place.
*/
function _doLoading() {
options.containerEl.classList.add(options.prefixCls + '-loading');
// If no valid loading function exists, just reset elements
if (!options.loadingFunction) {
return _doReset();
}
// The loading function should return a promise
var loadingPromise = options.loadingFunction();
// For UX continuity, make sure we show loading for at least one second before resetting
setTimeout(function () {
// Once actual loading is complete, reset pull to refresh
loadingPromise.then(_doReset, _doReset);
}, 1000);
}
/**
* Initialize pull to refresh, hammer, and bind pan events.
*
* @param {object=} params - Setup parameters for pull to refresh
*/
function init(params) {
options = (0, _extends3["default"])({}, params, {
distanceToRefresh: params.distanceToRefresh || defaults.distanceToRefresh,
loadingFunction: params.loadingFunction || defaults.loadingFunction,
resistance: params.resistance || defaults.resistance
});
}
/**
* Set the CSS transform on the content element to move it on the screen.
*/
function _setContentPan() {
// Use transforms to smoothly animate elements on desktop and mobile devices
options.contentEl.style.transform = options.contentEl.style.webkitTransform = 'translate3d( 0, ' + pan.distance + 'px, 0 )';
options.ptrEl.style.transform = options.ptrEl.style.webkitTransform = 'translate3d( 0, ' + (pan.distance - options.ptrEl.offsetHeight) + 'px, 0 )';
}
/**
* Set/remove the loading body class to show or hide the loading indicator after pull down.
*/
function _setBodyClass() {
if (pan.distance > options.distanceToRefresh) {
options.containerEl.classList.add(options.prefixCls + '-refresh');
} else {
options.containerEl.classList.remove(options.prefixCls + '-refresh');
}
}
/**
* Determine whether pan events should apply based on scroll position on panstart
*/
function onPanStart() {
if (options.containerEl.classList.contains(options.prefixCls + '-loading')) {
pan.enabled = false;
return;
}
pan.startingPositionY = options.containerEl.scrollTop;
if (pan.startingPositionY === 0) {
pan.enabled = true;
}
}
/**
* Handle element on screen movement when the pandown events is firing.
*
* @param {object} e - Event object
*/
function onPanDown(e) {
if (!pan.enabled) {
return;
}
e.preventDefault();
pan.distance = e.distance / options.resistance;
_setContentPan();
_setBodyClass();
}
/**
* Handle element on screen movement when the pandown events is firing.
*
* @param {object} e - Event object
*/
function onPanUp(e) {
if (!pan.enabled || pan.distance === 0) {
return;
}
e.preventDefault();
if (pan.distance < e.distance / options.resistance) {
pan.distance = 0;
} else {
pan.distance = e.distance / options.resistance;
}
_setContentPan();
_setBodyClass();
}
/**
* Determine how to animate and position elements when the panend event fires.
*
* @param {object} e - Event object
*/
function onPanEnd(e) {
if (!pan.enabled || pan.distance === 0) {
return;
}
e.preventDefault();
options.contentEl.style.transform = options.contentEl.style.webkitTransform = '';
options.ptrEl.style.transform = options.ptrEl.style.webkitTransform = '';
if (options.containerEl.classList.contains(options.prefixCls + '-refresh')) {
_doLoading();
} else {
_doReset();
}
pan.distance = 0;
pan.enabled = false;
}
function onPan(e) {
if (e.additionalEvent === 'pandown') {
onPanDown(e);
}
if (e.additionalEvent === 'panup') {
onPanUp(e);
}
}
return {
init: init,
events: {
onPanStart: onPanStart,
onPan: onPan,
onPanEnd: onPanEnd
}
};
}
module.exports = exports['default'];
/***/ },
/* 471 */
/***/ 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));
};
};
/***/ },
/* 472 */
/***/ function(module, exports) {
var camel2hyphen = function (str) {
return str
.replace(/[A-Z]/g, function (match) {
return '-' + match.toLowerCase();
})
.toLowerCase();
};
module.exports = camel2hyphen;
/***/ },
/* 473 */
/***/ 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;
/***/ },
/* 474 */
/***/ function(module, exports, __webpack_require__, __webpack_module_template_argument_0__) {
'use strict';
__webpack_require__(7);
__webpack_require__(__webpack_module_template_argument_0__);
/***/ },
/* 475 */
/***/ function(module, exports, __webpack_require__, __webpack_module_template_argument_0__) {
'use strict';
__webpack_require__(7);
__webpack_require__(25);
__webpack_require__(__webpack_module_template_argument_0__);
/***/ },
/* 476 */
/***/ function(module, exports, __webpack_require__, __webpack_module_template_argument_0__) {
'use strict';
__webpack_require__(7);
__webpack_require__(26);
__webpack_require__(__webpack_module_template_argument_0__);
/***/ }
/******/ ])))
});
;
//# sourceMappingURL=antd-mobile.js.map