rc-drawer
Version:
drawer component for react
1,598 lines (1,334 loc) • 116 kB
JavaScript
(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["rc-drawer"] = factory(require("react"), require("react-dom"));
else
root["rc-drawer"] = factory(root["React"], root["ReactDOM"]);
})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_44__, __WEBPACK_EXTERNAL_MODULE_45__) {
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] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = 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;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 47);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (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
// eslint-disable-next-line no-new-func
: Function('return this')();
if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef
/***/ }),
/* 1 */
/***/ (function(module, exports) {
var core = module.exports = { version: '2.5.7' };
if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
var anObject = __webpack_require__(10);
var IE8_DOM_DEFINE = __webpack_require__(35);
var toPrimitive = __webpack_require__(17);
var dP = Object.defineProperty;
exports.f = __webpack_require__(3) ? 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;
};
/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {
// Thank's IE8 for his funny defineProperty
module.exports = !__webpack_require__(12)(function () {
return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
});
/***/ }),
/* 4 */
/***/ (function(module, exports) {
var hasOwnProperty = {}.hasOwnProperty;
module.exports = function (it, key) {
return hasOwnProperty.call(it, key);
};
/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
var dP = __webpack_require__(2);
var createDesc = __webpack_require__(13);
module.exports = __webpack_require__(3) ? function (object, key, value) {
return dP.f(object, key, createDesc(1, value));
} : function (object, key, value) {
object[key] = value;
return object;
};
/***/ }),
/* 6 */
/***/ (function(module, exports) {
module.exports = function (it) {
return typeof it === 'object' ? it !== null : typeof it === 'function';
};
/***/ }),
/* 7 */
/***/ (function(module, exports, __webpack_require__) {
// to indexed object, toObject with fallback for non-array-like ES3 strings
var IObject = __webpack_require__(58);
var defined = __webpack_require__(16);
module.exports = function (it) {
return IObject(defined(it));
};
/***/ }),
/* 8 */
/***/ (function(module, exports, __webpack_require__) {
var store = __webpack_require__(22)('wks');
var uid = __webpack_require__(14);
var Symbol = __webpack_require__(0).Symbol;
var 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;
/***/ }),
/* 9 */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(0);
var core = __webpack_require__(1);
var ctx = __webpack_require__(34);
var hide = __webpack_require__(5);
var has = __webpack_require__(4);
var PROTOTYPE = 'prototype';
var $export = function (type, name, source) {
var IS_FORCED = type & $export.F;
var IS_GLOBAL = type & $export.G;
var IS_STATIC = type & $export.S;
var IS_PROTO = type & $export.P;
var IS_BIND = type & $export.B;
var IS_WRAP = type & $export.W;
var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});
var expProto = exports[PROTOTYPE];
var target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE];
var key, own, out;
if (IS_GLOBAL) source = name;
for (key in source) {
// contains in native
own = !IS_FORCED && target && target[key] !== undefined;
if (own && has(exports, key)) 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;
/***/ }),
/* 10 */
/***/ (function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(6);
module.exports = function (it) {
if (!isObject(it)) throw TypeError(it + ' is not an object!');
return it;
};
/***/ }),
/* 11 */
/***/ (function(module, exports) {
module.exports = true;
/***/ }),
/* 12 */
/***/ (function(module, exports) {
module.exports = function (exec) {
try {
return !!exec();
} catch (e) {
return true;
}
};
/***/ }),
/* 13 */
/***/ (function(module, exports) {
module.exports = function (bitmap, value) {
return {
enumerable: !(bitmap & 1),
configurable: !(bitmap & 2),
writable: !(bitmap & 4),
value: value
};
};
/***/ }),
/* 14 */
/***/ (function(module, exports) {
var id = 0;
var px = Math.random();
module.exports = function (key) {
return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
};
/***/ }),
/* 15 */
/***/ (function(module, exports) {
// 7.1.4 ToInteger
var ceil = Math.ceil;
var floor = Math.floor;
module.exports = function (it) {
return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
};
/***/ }),
/* 16 */
/***/ (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;
};
/***/ }),
/* 17 */
/***/ (function(module, exports, __webpack_require__) {
// 7.1.1 ToPrimitive(input [, PreferredType])
var isObject = __webpack_require__(6);
// 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");
};
/***/ }),
/* 18 */
/***/ (function(module, exports) {
module.exports = {};
/***/ }),
/* 19 */
/***/ (function(module, exports, __webpack_require__) {
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
var anObject = __webpack_require__(10);
var dPs = __webpack_require__(57);
var enumBugKeys = __webpack_require__(23);
var IE_PROTO = __webpack_require__(21)('IE_PROTO');
var Empty = function () { /* empty */ };
var 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__(36)('iframe');
var i = enumBugKeys.length;
var lt = '<';
var gt = '>';
var iframeDocument;
iframe.style.display = 'none';
__webpack_require__(62).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);
};
/***/ }),
/* 20 */
/***/ (function(module, exports, __webpack_require__) {
// 19.1.2.14 / 15.2.3.14 Object.keys(O)
var $keys = __webpack_require__(38);
var enumBugKeys = __webpack_require__(23);
module.exports = Object.keys || function keys(O) {
return $keys(O, enumBugKeys);
};
/***/ }),
/* 21 */
/***/ (function(module, exports, __webpack_require__) {
var shared = __webpack_require__(22)('keys');
var uid = __webpack_require__(14);
module.exports = function (key) {
return shared[key] || (shared[key] = uid(key));
};
/***/ }),
/* 22 */
/***/ (function(module, exports, __webpack_require__) {
var core = __webpack_require__(1);
var global = __webpack_require__(0);
var SHARED = '__core-js_shared__';
var store = global[SHARED] || (global[SHARED] = {});
(module.exports = function (key, value) {
return store[key] || (store[key] = value !== undefined ? value : {});
})('versions', []).push({
version: core.version,
mode: __webpack_require__(11) ? 'pure' : 'global',
copyright: '© 2018 Denis Pushkarev (zloirock.ru)'
});
/***/ }),
/* 23 */
/***/ (function(module, exports) {
// IE 8- don't enum bug keys
module.exports = (
'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
).split(',');
/***/ }),
/* 24 */
/***/ (function(module, exports, __webpack_require__) {
var def = __webpack_require__(2).f;
var has = __webpack_require__(4);
var TAG = __webpack_require__(8)('toStringTag');
module.exports = function (it, tag, stat) {
if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });
};
/***/ }),
/* 25 */
/***/ (function(module, exports, __webpack_require__) {
exports.f = __webpack_require__(8);
/***/ }),
/* 26 */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(0);
var core = __webpack_require__(1);
var LIBRARY = __webpack_require__(11);
var wksExt = __webpack_require__(25);
var defineProperty = __webpack_require__(2).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) });
};
/***/ }),
/* 27 */
/***/ (function(module, exports) {
exports.f = {}.propertyIsEnumerable;
/***/ }),
/* 28 */
/***/ (function(module, exports) {
// shim for using process in browser
var process = module.exports = {};
// cached from whatever global is present so that test runners that stub it
// don't break things. But we need to wrap it in a try catch in case it is
// wrapped in strict mode code which doesn't define any globals. It's inside a
// function because try/catches deoptimize in certain engines.
var cachedSetTimeout;
var cachedClearTimeout;
function defaultSetTimout() {
throw new Error('setTimeout has not been defined');
}
function defaultClearTimeout () {
throw new Error('clearTimeout has not been defined');
}
(function () {
try {
if (typeof setTimeout === 'function') {
cachedSetTimeout = setTimeout;
} else {
cachedSetTimeout = defaultSetTimout;
}
} catch (e) {
cachedSetTimeout = defaultSetTimout;
}
try {
if (typeof clearTimeout === 'function') {
cachedClearTimeout = clearTimeout;
} else {
cachedClearTimeout = defaultClearTimeout;
}
} catch (e) {
cachedClearTimeout = defaultClearTimeout;
}
} ())
function runTimeout(fun) {
if (cachedSetTimeout === setTimeout) {
//normal enviroments in sane situations
return setTimeout(fun, 0);
}
// if setTimeout wasn't available but was latter defined
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
cachedSetTimeout = setTimeout;
return setTimeout(fun, 0);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedSetTimeout(fun, 0);
} catch(e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedSetTimeout.call(null, fun, 0);
} catch(e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
return cachedSetTimeout.call(this, fun, 0);
}
}
}
function runClearTimeout(marker) {
if (cachedClearTimeout === clearTimeout) {
//normal enviroments in sane situations
return clearTimeout(marker);
}
// if clearTimeout wasn't available but was latter defined
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
cachedClearTimeout = clearTimeout;
return clearTimeout(marker);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedClearTimeout(marker);
} catch (e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedClearTimeout.call(null, marker);
} catch (e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
return cachedClearTimeout.call(this, marker);
}
}
}
var queue = [];
var draining = false;
var currentQueue;
var queueIndex = -1;
function cleanUpNextTick() {
if (!draining || !currentQueue) {
return;
}
draining = false;
if (currentQueue.length) {
queue = currentQueue.concat(queue);
} else {
queueIndex = -1;
}
if (queue.length) {
drainQueue();
}
}
function drainQueue() {
if (draining) {
return;
}
var timeout = runTimeout(cleanUpNextTick);
draining = true;
var len = queue.length;
while(len) {
currentQueue = queue;
queue = [];
while (++queueIndex < len) {
if (currentQueue) {
currentQueue[queueIndex].run();
}
}
queueIndex = -1;
len = queue.length;
}
currentQueue = null;
draining = false;
runClearTimeout(timeout);
}
process.nextTick = function (fun) {
var args = new Array(arguments.length - 1);
if (arguments.length > 1) {
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
}
}
queue.push(new Item(fun, args));
if (queue.length === 1 && !draining) {
runTimeout(drainQueue);
}
};
// v8 likes predictible objects
function Item(fun, array) {
this.fun = fun;
this.array = array;
}
Item.prototype.run = function () {
this.fun.apply(null, this.array);
};
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues
process.versions = {};
function noop() {}
process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.prependListener = noop;
process.prependOnceListener = noop;
process.listeners = function (name) { return [] }
process.binding = function (name) {
throw new Error('process.binding is not supported');
};
process.cwd = function () { return '/' };
process.chdir = function (dir) {
throw new Error('process.chdir is not supported');
};
process.umask = function() { return 0; };
/***/ }),
/* 29 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
module.exports = ReactPropTypesSecret;
/***/ }),
/* 30 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
exports.default = function (instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
};
/***/ }),
/* 31 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _typeof2 = __webpack_require__(32);
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;
};
/***/ }),
/* 32 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _iterator = __webpack_require__(51);
var _iterator2 = _interopRequireDefault(_iterator);
var _symbol = __webpack_require__(69);
var _symbol2 = _interopRequireDefault(_symbol);
var _typeof = typeof _symbol2.default === "function" && typeof _iterator2.default === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj; };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = typeof _symbol2.default === "function" && _typeof(_iterator2.default) === "symbol" ? function (obj) {
return typeof obj === "undefined" ? "undefined" : _typeof(obj);
} : function (obj) {
return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof(obj);
};
/***/ }),
/* 33 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var LIBRARY = __webpack_require__(11);
var $export = __webpack_require__(9);
var redefine = __webpack_require__(37);
var hide = __webpack_require__(5);
var Iterators = __webpack_require__(18);
var $iterCreate = __webpack_require__(56);
var setToStringTag = __webpack_require__(24);
var getPrototypeOf = __webpack_require__(63);
var ITERATOR = __webpack_require__(8)('iterator');
var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`
var FF_ITERATOR = '@@iterator';
var KEYS = 'keys';
var 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';
var DEF_VALUES = DEFAULT == VALUES;
var VALUES_BUG = false;
var proto = Base.prototype;
var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];
var $default = $native || getMethod(DEFAULT);
var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;
var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;
var methods, key, IteratorPrototype;
// Fix native
if ($anyNative) {
IteratorPrototype = getPrototypeOf($anyNative.call(new Base()));
if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {
// Set @@toStringTag to native iterators
setToStringTag(IteratorPrototype, TAG, true);
// fix for some old engines
if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') 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;
};
/***/ }),
/* 34 */
/***/ (function(module, exports, __webpack_require__) {
// optional / simple context binding
var aFunction = __webpack_require__(55);
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);
};
};
/***/ }),
/* 35 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = !__webpack_require__(3) && !__webpack_require__(12)(function () {
return Object.defineProperty(__webpack_require__(36)('div'), 'a', { get: function () { return 7; } }).a != 7;
});
/***/ }),
/* 36 */
/***/ (function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(6);
var document = __webpack_require__(0).document;
// typeof document.createElement is 'object' in old IE
var is = isObject(document) && isObject(document.createElement);
module.exports = function (it) {
return is ? document.createElement(it) : {};
};
/***/ }),
/* 37 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(5);
/***/ }),
/* 38 */
/***/ (function(module, exports, __webpack_require__) {
var has = __webpack_require__(4);
var toIObject = __webpack_require__(7);
var arrayIndexOf = __webpack_require__(59)(false);
var IE_PROTO = __webpack_require__(21)('IE_PROTO');
module.exports = function (object, names) {
var O = toIObject(object);
var i = 0;
var result = [];
var 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;
};
/***/ }),
/* 39 */
/***/ (function(module, exports) {
var toString = {}.toString;
module.exports = function (it) {
return toString.call(it).slice(8, -1);
};
/***/ }),
/* 40 */
/***/ (function(module, exports) {
exports.f = Object.getOwnPropertySymbols;
/***/ }),
/* 41 */
/***/ (function(module, exports, __webpack_require__) {
// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
var $keys = __webpack_require__(38);
var hiddenKeys = __webpack_require__(23).concat('length', 'prototype');
exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
return $keys(O, hiddenKeys);
};
/***/ }),
/* 42 */
/***/ (function(module, exports, __webpack_require__) {
var pIE = __webpack_require__(27);
var createDesc = __webpack_require__(13);
var toIObject = __webpack_require__(7);
var toPrimitive = __webpack_require__(17);
var has = __webpack_require__(4);
var IE8_DOM_DEFINE = __webpack_require__(35);
var gOPD = Object.getOwnPropertyDescriptor;
exports.f = __webpack_require__(3) ? 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]);
};
/***/ }),
/* 43 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _setPrototypeOf = __webpack_require__(79);
var _setPrototypeOf2 = _interopRequireDefault(_setPrototypeOf);
var _create = __webpack_require__(83);
var _create2 = _interopRequireDefault(_create);
var _typeof2 = __webpack_require__(32);
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;
};
/***/ }),
/* 44 */
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_44__;
/***/ }),
/* 45 */
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_45__;
/***/ }),
/* 46 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(process) {/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
if (process.env.NODE_ENV !== 'production') {
var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&
Symbol.for &&
Symbol.for('react.element')) ||
0xeac7;
var isValidElement = function(object) {
return typeof object === 'object' &&
object !== null &&
object.$$typeof === REACT_ELEMENT_TYPE;
};
// By explicitly using `prop-types` you are opting into new development behavior.
// http://fb.me/prop-types-in-prod
var throwOnDirectAccess = true;
module.exports = __webpack_require__(86)(isValidElement, throwOnDirectAccess);
} else {
// By explicitly using `prop-types` you are opting into new production behavior.
// http://fb.me/prop-types-in-prod
module.exports = __webpack_require__(89)();
}
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(28)))
/***/ }),
/* 47 */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(48);
module.exports = __webpack_require__(49);
/***/ }),
/* 48 */
/***/ (function(module, exports) {
// removed by extract-text-webpack-plugin
/***/ }),
/* 49 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Drawer__ = __webpack_require__(50);
// export this package's api
/* harmony default export */ __webpack_exports__["default"] = (__WEBPACK_IMPORTED_MODULE_0__Drawer__["a" /* default */]);
/***/ }),
/* 50 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_classCallCheck__ = __webpack_require__(30);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_classCallCheck___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_classCallCheck__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_possibleConstructorReturn__ = __webpack_require__(31);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_possibleConstructorReturn___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_possibleConstructorReturn__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_inherits__ = __webpack_require__(43);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_inherits___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_inherits__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_react__ = __webpack_require__(44);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_react__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_react_dom__ = __webpack_require__(45);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_react_dom___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_react_dom__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_prop_types__ = __webpack_require__(46);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_prop_types___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_prop_types__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_classnames__ = __webpack_require__(90);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_classnames___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_classnames__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_rc_util_es_ContainerRender__ = __webpack_require__(91);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8_rc_util_es_getScrollBarSize__ = __webpack_require__(96);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__utils__ = __webpack_require__(97);
var IS_REACT_16 = 'createPortal' in __WEBPACK_IMPORTED_MODULE_4_react_dom___default.a;
var currentDrawer = {};
var windowIsUndefined = typeof window === 'undefined';
var Drawer = function (_React$PureComponent) {
__WEBPACK_IMPORTED_MODULE_2_babel_runtime_helpers_inherits___default()(Drawer, _React$PureComponent);
function Drawer(props) {
__WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_classCallCheck___default()(this, Drawer);
var _this = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_helpers_possibleConstructorReturn___default()(this, _React$PureComponent.call(this, props));
_initialiseProps.call(_this);
_this.levelDom = [];
_this.contextDom = null;
_this.maskDom = null;
_this.handlerdom = null;
_this.mousePos = null;
_this.firstEnter = false; // 记录首次进入.
_this.timeout = null;
_this.drawerId = Number((Date.now() + Math.random()).toString().replace('.', Math.round(Math.random() * 9))).toString(16);
if (props.onIconClick || props.parent || props.iconChild || props.width // eslint-disable-line react/prop-types
|| props.handleChild) {
// eslint-disable-line react/prop-types
console.warn( // eslint-disable-line no-console
'rc-drawer-menu API has been changed, please look at the releases, ' + 'https://github.com/react-component/drawer-menu/releases');
}
var open = props.open !== undefined ? props.open : !!props.defaultOpen;
currentDrawer[_this.drawerId] = open;
_this.state = {
open: open
};
return _this;
}
Drawer.prototype.componentDidMount = function componentDidMount() {
if (!windowIsUndefined) {
var passiveSupported = false;
window.addEventListener('test', null, Object.defineProperty({}, 'passive', {
get: function get() {
passiveSupported = true;
return null;
}
}));
this.passive = passiveSupported ? { passive: false } : false;
}
var open = this.getOpen();
if (this.props.handler || open) {
this.getDefault(this.props);
this.forceUpdate();
}
};
Drawer.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
var open = nextProps.open,
placement = nextProps.placement;
if (open !== undefined && open !== this.props.open) {
this.isOpenChange = true;
// 没渲染 dom 时,获取默认数据;
if (!this.container) {
this.getDefault(nextProps);
}
this.setState({
open: open
});
}
if (placement !== this.props.placement) {
// test 的 bug, 有动画过场,删除 dom
this.contextDom = null;
}
if (this.props.level !== nextProps.level) {
this.getParentAndLevelDom(nextProps);
}
};
Drawer.prototype.componentDidUpdate = function componentDidUpdate() {
// dom 没渲染时,重走一遍。
if (!this.firstEnter && this.container) {
this.forceUpdate();
this.firstEnter = true;
}
};
Drawer.prototype.componentWillUnmount = function componentWillUnmount() {
if (this.container) {
this.setLevelDomTransform(false, true);
// 拦不住。。直接删除;
if (this.props.getContainer) {
this.container.parentNode.removeChild(this.container);
}
}
clearTimeout(this.timeout);
delete currentDrawer[this.drawerId];
// suppport react15
if (IS_REACT_16) {
return;
}
this.renderComponent({
afterClose: this.removeContainer,
onClose: function onClose() {},
visible: false
});
};
Drawer.prototype.render = function render() {
var _this2 = this;
var _props = this.props,
getContainer = _props.getContainer,
wrapperClassName = _props.wrapperClassName;
var open = this.getOpen();
currentDrawer[this.drawerId] = open ? this.container : open;
var children = this.getChildToRender(this.firstEnter ? open : false);
if (!getContainer) {
return __WEBPACK_IMPORTED_MODULE_3_react___default.a.createElement(
'div',
{
className: wrapperClassName,
ref: function ref(c) {
_this2.container = c;
}
},
children
);
}
if (!this.container || !open && !this.firstEnter) {
return null;
}
// suppport react15
if (!IS_REACT_16) {
return __WEBPACK_IMPORTED_MODULE_3_react___default.a.createElement(
__WEBPACK_IMPORTED_MODULE_7_rc_util_es_ContainerRender__["a" /* default */],
{
parent: this,
visible: true,
autoMount: true,
autoDestroy: false,
getComponent: this.getChildToRender,
getContainer: this.getContainer
},
function (_ref) {
var renderComponent = _ref.renderComponent,
removeContainer = _ref.removeContainer;
_this2.renderComponent = renderComponent;
_this2.removeContainer = removeContainer;
return null;
}
);
}
return __WEBPACK_IMPORTED_MODULE_4_react_dom___default.a.createPortal(children, this.container);
};
return Drawer;
}(__WEBPACK_IMPORTED_MODULE_3_react___default.a.PureComponent);
Drawer.defaultProps = {
prefixCls: 'drawer',
placement: 'left',
getContainer: 'body',
level: 'all',
duration: '.3s',
ease: 'cubic-bezier(0.78, 0.14, 0.15, 0.86)',
onChange: function onChange() {},
onMaskClick: function onMaskClick() {},
onHandleClick: function onHandleClick() {},
handler: __WEBPACK_IMPORTED_MODULE_3_react___default.a.createElement(
'div',
{ className: 'drawer-handle' },
__WEBPACK_IMPORTED_MODULE_3_react___default.a.createElement('i', { className: 'drawer-handle-icon' })
),
showMask: true,
maskStyle: {},
wrapperClassName: '',
className: ''
};
var _initialiseProps = function _initialiseProps() {
var _this3 = this;
this.onMaskTouchEnd = function (e) {
_this3.props.onMaskClick(e);
_this3.onTouchEnd(e, true);
};
this.onIconTouchEnd = function (e) {
_this3.props.onHandleClick(e);
_this3.onTouchEnd(e);
};
this.onTouchEnd = function (e, close) {
if (_this3.props.open !== undefined) {
return;
}
var open = close || _this3.state.open;
_this3.isOpenChange = true;
_this3.setState({
open: !open
});
};
this.onWrapperTransitionEnd = function () {
_this3.dom.style.transition = '';
};
this.getDefault = function (props) {
_this3.getParentAndLevelDom(props);
if (props.getContainer || props.parent) {
_this3.container = _this3.defaultGetContainer();
}
};
this.getContainer = function () {
return _this3.container;
};
this.getParentAndLevelDom = function (props) {
if (windowIsUndefined) {
return;
}
var level = props.level,
getContainer = props.getContainer;
_this3.levelDom = [];
if (getContainer) {
if (typeof getContainer === 'string') {
var dom = document.querySelectorAll(getContainer)[0];
_this3.parent = dom;
}
if (typeof getContainer === 'function') {
_this3.parent = getContainer();
}
if (typeof getContainer === 'object' && getContainer instanceof window.HTMLElement) {
_this3.parent = getContainer;
}
}
if (!getContainer && _this3.container) {
_this3.parent = _this3.container.parentNode;
}
if (level === 'all') {
var children = Array.prototype.slice.call(_this3.parent.children);
children.forEach(function (child) {
if (child.nodeName !== 'SCRIPT' && child.nodeName !== 'STYLE' && child !== _this3.container) {
_this3.levelDom.push(child);
}
});
} else if (level) {
Object(__WEBPACK_IMPORTED_MODULE_9__utils__["b" /* dataToArray */])(level).forEach(function (key) {
document.querySelectorAll(key).forEach(function (item) {
_this3.levelDom.push(item);
});
});
}
};
this.setLevelDomTransform = function (open, openTransition, placementName, value) {
var _props2 = _this3.props,
placement = _props2.placement,
levelMove = _props2.levelMove,
duration = _props2.duration,
ease = _props2.ease,
onChange = _props2.onChange;
if (!windowIsUndefined) {
// self = this;
_this3.levelDom.forEach(function (dom) {
if (_this3.isOpenChange || openTransition) {
/* eslint no-param-reassign: "error" */
dom.style.transition = 'transform ' + duration + ' ' + ease;
Object(__WEBPACK_IMPORTED_MODULE_9__utils__["a" /* addEventListener */])(dom, __WEBPACK_IMPORTED_MODULE_9__utils__["e" /* transitionEnd */], _this3.trnasitionEnd);
var levelValue = open ? value : 0;
if (levelMove) {
var $levelMove = Object(__WEBPACK_IMPORTED_MODULE_9__utils__["d" /* transformArguments */])(levelMove, { target: dom, open: open });
levelValue = open ? $levelMove[0] : $levelMove[1] || 0;
}
var placementPos = placement === 'left' || placement === 'top' ? levelValue : -levelValue;
dom.style.transform = placementPos ? placementName + '(' + placementPos + 'px)' : '';
}
});
// 处理 body 滚动
var eventArray = ['touchstart'];
var domArray = [document.body, _this3.maskDom, _this3.handlerdom, _this3.contextDom];
var right = Object(__WEBPACK_IMPORTED_MODULE_8_rc_util_es_getScrollBarSize__["a" /* default */])();
var widthTransition = 'width ' + duration + ' ' + ease;
var trannsformTransition = 'transform ' + duration + ' ' + ease;
if (open && document.body.style.overflow !== 'hidden') {
document.body.style.overflow = 'hidden';
if (right) {
document.body.style.position = 'relative';
document.body.style.width = 'calc(100% - ' + right + 'px)';
_this3.dom.style.transition = 'none';
switch (placement) {
case 'right':
_this3.dom.style.transform = 'translateX(-' + right + 'px)';
break;
case 'top':
case 'bottom':
_this3.dom.style.width = 'calc(100% - ' + right + 'px)';
break;
default:
break;
}
clearTimeout(_this3.timeout);
_this3.timeout = setTimeout(function () {
_this3.dom.style.transition = trannsformTransition + ',' + widthTransition;
_this3.dom.style.width = '';
_this3.dom.style.transform = '';
});
}
// 手机禁滚
if (document.body.addEventListener) {
domArray.forEach(function (item, i) {
if (!item) {
return;
}
item.addEventListener(eventArray[i] || 'touchmove', i ? _this3.removeMoveHandler : _this3.removeStartHandler, _this3.passive);
});
}
} else if (!Object.keys(currentDrawer).some(function (key) {
return currentDrawer[key];
})) {
document.body.style.overflow = '';
if (_this3.isOpenChange && right) {
document.body.style.position = '';
document.body.style.width = '';
_this3.dom.style.transition = 'none';
switch (placement) {
case 'right':
{
_this3.dom.style.transform = 'translateX(' + right + 'px)';
_this3.maskDom.style.right = right + 'px';
_this3.maskDom.style.width = 'calc(100% + ' + right + 'px)';
break;
}
case 'top':
case 'bottom':
{
_this3.dom.style.width = 'calc(100% + ' + right + 'px)';
break;
}
default:
break;
}
clearTimeout(_this3.timeout);
_this3.timeout = setTimeout(function () {
_this3.dom.style.transition = trannsformTransition + ',' + widthTransition;
_this3.dom.style.transform = '';
_this3.dom.style.width = '';
});
}
if (document.body.removeEventListener) {
domArray.forEach(function (item, i) {
if (!item) {
return;
}
item.removeEventListener(eventArray[i] || 'touchmove', i ? _this3.removeMoveHandler : _this3.removeStartHandler, _this3.passive);
});
}
}
}
if (onChange && _this3.isOpenChange && _this3.firstEnter) {
onChange(open);
_this3.isOpenChange = false;
}
};
this.getChildToRender = function (open) {
var _classnames;
var _props3 = _this3.props,
className = _props3.className,
prefixCls = _props3.prefixCls,
style = _props3.style,
placement = _props3.placement,
children = _props3.children,
handler = _props3.handler,
showMask = _props3.showMask,
maskStyle = _props3.maskStyle;
var wrapperClassname = __WEBPACK_IMPORTED_MODULE_6_classnames___default()(prefixCls, (_classnames = {}, _classnames[prefixCls + '-' + placement] = true, _classnames[prefixCls + '-open'] = open, _classnames[className] = !!className, _classnames));
var value = _this3.contextDom ? _this3.contextDom.getBoundingClientRect()[placement === 'left' || placement === 'right' ? 'width' : 'height'] : 0;
var placementName = 'translate' + (placement === 'left' || placement === 'right' ? 'X' : 'Y');
// 百分比与像素动画不同步,第一次打用后全用像素动画。
var defaultValue = !_this3.contextDom ? '100%' : value + 'px';
var placementPos = placement === 'left' || placement === 'top' ? '-' + defaultValue : defaultValue;
var transform = open ? '' : placementName + '(' + placementPos + ')';
if (_this3.isOpenChange === undefined || _this3.isOpenChange) {
_this3.setLevelDomTransform(open, false, placementName, value);
}
var handlerCildren = handler && __WEBPACK_IMPORTED_MODULE_3_react___default.a.cloneElement(handler, {
onClick: function onClick(e) {
if (handler.props.onClick) {
handler.props.onClick();
}
_this3.onIconTouchEnd(e);
},
ref: function ref(c) {
_this3.handlerdom = c;
}
});
return __WEBPACK_IMPORTED_MODULE_3_react___default.a.createElement(
'div',
{
className: wrapperClassname,
style: style,
ref: function ref(c) {
_this3.dom = c;
},
onTransitionEnd: _this3.onWrapperTransitionEnd
},
showMask && __WEBPACK_IMPORTED_MODULE_3_react___default.a.createElement('div', {
className: prefixCls + '-mask',
onClick: _this3.onMaskTouchEnd,
style: maskStyle,
ref: function ref(c) {
_this3.maskDom = c;
}
}),
__WEBPACK_IMPORTED_MODULE_3_react___default.a.createElement(
'div',
{
className: prefixCls + '-content-wrapper',
style: { transform: transform }
},
__WEBPACK_IMPORTED_MODULE_3_react___default.a.createElement(
'div',
{
className: prefixCls + '-content',
ref: function ref(c) {
_this3.contextDom = c;
},
onTouchStart: open ? _this3.removeStartHandler : null // 跑用例用
, onTouchMove: open ? _this3.removeMoveHandler : null // 跑用例用
},
children
),
handlerCildren
)
);
};
this.getOpen = function () {
return _this3.props.open !== undefined ? _this3.props.open : _this3.state.open;
};
this.removeStartHandler = function (e) {
if (e.touches.length > 1) {
return;
}
_this3.startPos = {
x: e.touches[0].clientX,
y: e.touches[0].clientY
};
};
this.removeMoveHandler = function (e) {
if (e.changedTouches.length > 1) {
return;
}
var currentTarget = e.currentTarget;
var differX = e.changedTouches[0].clientX - _this3.startPos.x;
var differY = e.changedTouches[0].clientY - _this3.startPos.y;
if (currentTarget === _this3.maskDom || currentTarget === _this3.handlerdom || currentTarget === _this3.contextDom && ((currentTarget.scrollTo