zent
Version:
一套前端设计语言和基于React的实现
1,760 lines (1,385 loc) • 812 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof define === 'function' && define.amd)
define(["react", "react-dom"], factory);
else if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("react"), require("react-dom"));
else if(typeof exports === 'object')
exports["zent"] = factory(require("react"), require("react-dom"));
else
root["zent"] = factory(root["React"], root["ReactDOM"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_4__, __WEBPACK_EXTERNAL_MODULE_200__) {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(1);
/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _zentAlert = __webpack_require__(2);
var _zentAlert2 = _interopRequireDefault(_zentAlert);
var _zentBreadcrumb = __webpack_require__(17);
var _zentBreadcrumb2 = _interopRequireDefault(_zentBreadcrumb);
var _zentButton = __webpack_require__(20);
var _zentButton2 = _interopRequireDefault(_zentButton);
var _zentCheckbox = __webpack_require__(155);
var _zentCheckbox2 = _interopRequireDefault(_zentCheckbox);
var _zentDatetimepicker = __webpack_require__(158);
var _zentDialog = __webpack_require__(182);
var _zentDialog2 = _interopRequireDefault(_zentDialog);
var _zentForm = __webpack_require__(208);
var _zentForm2 = _interopRequireDefault(_zentForm);
var _zentLayout = __webpack_require__(282);
var _zentLayout2 = _interopRequireDefault(_zentLayout);
var _zentLoading = __webpack_require__(285);
var _zentLoading2 = _interopRequireDefault(_zentLoading);
var _zentIcon = __webpack_require__(162);
var _zentIcon2 = _interopRequireDefault(_zentIcon);
var _zentInput = __webpack_require__(258);
var _zentInput2 = _interopRequireDefault(_zentInput);
var _zentMenu = __webpack_require__(289);
var _zentMenu2 = _interopRequireDefault(_zentMenu);
var _zentNotify = __webpack_require__(349);
var _zentNotify2 = _interopRequireDefault(_zentNotify);
var _zentPagination = __webpack_require__(352);
var _zentPagination2 = _interopRequireDefault(_zentPagination);
var _zentPop = __webpack_require__(358);
var _zentPop2 = _interopRequireDefault(_zentPop);
var _zentPopover = __webpack_require__(295);
var _zentPopover2 = _interopRequireDefault(_zentPopover);
var _zentPortal = __webpack_require__(184);
var _zentPortal2 = _interopRequireDefault(_zentPortal);
var _zentRadio = __webpack_require__(263);
var _zentRadio2 = _interopRequireDefault(_zentRadio);
var _zentSelect = __webpack_require__(267);
var _zentSelect2 = _interopRequireDefault(_zentSelect);
var _zentSteps = __webpack_require__(362);
var _zentSteps2 = _interopRequireDefault(_zentSteps);
var _zentSweetalert = __webpack_require__(368);
var _zentSweetalert2 = _interopRequireDefault(_zentSweetalert);
var _zentSwitch = __webpack_require__(369);
var _zentSwitch2 = _interopRequireDefault(_zentSwitch);
var _zentTable = __webpack_require__(371);
var _zentTable2 = _interopRequireDefault(_zentTable);
var _zentTabs = __webpack_require__(377);
var _zentTabs2 = _interopRequireDefault(_zentTabs);
var _zentTree = __webpack_require__(384);
var _zentTree2 = _interopRequireDefault(_zentTree);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var Zent = {
Alert: _zentAlert2['default'],
Breadcrumb: _zentBreadcrumb2['default'],
Button: _zentButton2['default'],
Checkbox: _zentCheckbox2['default'],
DatePicker: _zentDatetimepicker.DatePicker,
DateRangePicker: _zentDatetimepicker.DateRangePicker,
Dialog: _zentDialog2['default'],
Form: _zentForm2['default'],
Layout: _zentLayout2['default'],
Loading: _zentLoading2['default'],
Icon: _zentIcon2['default'],
Input: _zentInput2['default'],
Menu: _zentMenu2['default'],
MonthPicker: _zentDatetimepicker.MonthPicker,
Notify: _zentNotify2['default'],
Pagination: _zentPagination2['default'],
Pop: _zentPop2['default'],
Popover: _zentPopover2['default'],
Portal: _zentPortal2['default'],
Radio: _zentRadio2['default'],
Select: _zentSelect2['default'],
Steps: _zentSteps2['default'],
Sweetalert: _zentSweetalert2['default'],
Table: _zentTable2['default'],
Tabs: _zentTabs2['default'],
Tree: _zentTree2['default'],
Switch: _zentSwitch2['default']
};
exports['default'] = Zent;
module.exports = exports['default'];
/***/ },
/* 2 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = undefined;
var _Alert = __webpack_require__(3);
var _Alert2 = _interopRequireDefault(_Alert);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { 'default': obj };
}
exports['default'] = _Alert2['default'];
module.exports = exports['default'];
/***/ },
/* 3 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = undefined;
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 _class, _temp2;
var _react = __webpack_require__(4);
var _react2 = _interopRequireDefault(_react);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var _isFunction = __webpack_require__(8);
var _isFunction2 = _interopRequireDefault(_isFunction);
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 _possibleConstructorReturn(self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}return call && ((typeof call === 'undefined' ? 'undefined' : _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 === 'undefined' ? 'undefined' : _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;
}
// 忽略不支持的style
var styleClassMap = {
info: 'alert-style-info',
warning: 'alert-style-warning',
// error as an alias to danger
error: 'alert-style-danger',
danger: 'alert-style-danger'
};
// 忽略不支持的size
var sizeClassMap = {
normal: 'alert-size-normal',
large: 'alert-size-large'
};
var Alert = (_temp2 = _class = function (_Component) {
_inherits(Alert, _Component);
function Alert() {
var _ref;
var _temp, _this, _ret;
_classCallCheck(this, Alert);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Alert.__proto__ || Object.getPrototypeOf(Alert)).call.apply(_ref, [this].concat(args))), _this), _this.state = {
closed: false
}, _this.onClose = function () {
_this.setState({
closed: true
}, function () {
// onClose是在*关闭以后*被调用的
var onClose = _this.props.onClose;
if ((0, _isFunction2['default'])(onClose)) {
onClose();
}
});
}, _temp), _possibleConstructorReturn(_this, _ret);
}
_createClass(Alert, [{
key: 'render',
value: function render() {
var _cx;
var closed = this.state.closed;
if (closed) {
return null;
}
var _props = this.props,
type = _props.type,
prefix = _props.prefix,
rounded = _props.rounded,
className = _props.className,
closable = _props.closable,
size = _props.size,
children = _props.children;
var containerCls = (0, _classnames2['default'])(prefix + '-alert', prefix + '-' + styleClassMap[type], prefix + '-' + sizeClassMap[size], (_cx = {}, _defineProperty(_cx, className, !!className), _defineProperty(_cx, prefix + '-alert-border-rounded', rounded), _defineProperty(_cx, prefix + '-alert-closable', closable), _cx));
return _react2['default'].createElement('div', { className: containerCls }, closable && _react2['default'].createElement('div', { className: prefix + '-alert-close-wrapper' }, _react2['default'].createElement('span', { className: prefix + '-alert-close-btn', onClick: this.onClose }, '\xD7')), _react2['default'].createElement('div', { className: prefix + '-alert-content-wrapper' }, _react2['default'].createElement('div', { className: prefix + '-alert-content' }, children)));
}
}]);
return Alert;
}(_react.Component), _class.propTypes = {
type: _react.PropTypes.oneOf(['info', 'warning', 'danger', 'error']).isRequired,
size: _react.PropTypes.oneOf(['large', 'normal']),
rounded: _react.PropTypes.bool,
closable: _react.PropTypes.bool,
onClose: _react.PropTypes.func,
children: _react.PropTypes.node,
className: _react.PropTypes.string,
prefix: _react.PropTypes.string
}, _class.defaultProps = {
type: 'info',
size: 'normal',
closable: false,
rounded: false,
className: '',
prefix: 'zent'
}, _temp2);
exports['default'] = Alert;
module.exports = exports['default'];
/***/ },
/* 4 */
/***/ function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_4__;
/***/ },
/* 5 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _classnames = __webpack_require__(6);
Object.defineProperty(exports, 'default', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_classnames)['default'];
}
});
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { 'default': obj };
}
module.exports = exports['default'];
/***/ },
/* 6 */
/***/ function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
/*!
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 === 'undefined' ? 'undefined' : _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 ("function" === 'function' && _typeof(__webpack_require__(7)) === 'object' && __webpack_require__(7)) {
// 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;
}
})();
/***/ },
/* 7 */
/***/ function(module, exports) {
/* WEBPACK VAR INJECTION */(function(__webpack_amd_options__) {module.exports = __webpack_amd_options__;
/* WEBPACK VAR INJECTION */}.call(exports, {}))
/***/ },
/* 8 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
/* DO NOT EDIT!! Auto genetated wrapper for lodash/isFunction. */
var isFunction = __webpack_require__(9);
module.exports = isFunction;
/***/ },
/* 9 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var baseGetTag = __webpack_require__(10),
isObject = __webpack_require__(16);
/** `Object#toString` result references. */
var asyncTag = '[object AsyncFunction]',
funcTag = '[object Function]',
genTag = '[object GeneratorFunction]',
proxyTag = '[object Proxy]';
/**
* 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) {
if (!isObject(value)) {
return false;
}
// The use of `Object#toString` avoids issues with the `typeof` operator
// in Safari 9 which returns 'object' for typed arrays and other constructors.
var tag = baseGetTag(value);
return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
}
module.exports = isFunction;
/***/ },
/* 10 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _Symbol = __webpack_require__(11),
getRawTag = __webpack_require__(14),
objectToString = __webpack_require__(15);
/** `Object#toString` result references. */
var nullTag = '[object Null]',
undefinedTag = '[object Undefined]';
/** Built-in value references. */
var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
/**
* The base implementation of `getTag` without fallbacks for buggy environments.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
function baseGetTag(value) {
if (value == null) {
return value === undefined ? undefinedTag : nullTag;
}
return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
}
module.exports = baseGetTag;
/***/ },
/* 11 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var root = __webpack_require__(12);
/** Built-in value references. */
var _Symbol = root.Symbol;
module.exports = _Symbol;
/***/ },
/* 12 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var freeGlobal = __webpack_require__(13);
/** Detect free variable `self`. */
var freeSelf = (typeof self === 'undefined' ? 'undefined' : _typeof(self)) == 'object' && self && self.Object === Object && self;
/** Used as a reference to the global object. */
var root = freeGlobal || freeSelf || Function('return this')();
module.exports = root;
/***/ },
/* 13 */
/***/ function(module, exports) {
/* WEBPACK VAR INJECTION */(function(global) {'use strict';
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
/** Detect free variable `global` from Node.js. */
var freeGlobal = (typeof global === 'undefined' ? 'undefined' : _typeof(global)) == 'object' && global && global.Object === Object && global;
module.exports = freeGlobal;
/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
/***/ },
/* 14 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _Symbol = __webpack_require__(11);
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var nativeObjectToString = objectProto.toString;
/** Built-in value references. */
var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
/**
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the raw `toStringTag`.
*/
function getRawTag(value) {
var isOwn = hasOwnProperty.call(value, symToStringTag),
tag = value[symToStringTag];
try {
value[symToStringTag] = undefined;
var unmasked = true;
} catch (e) {}
var result = nativeObjectToString.call(value);
if (unmasked) {
if (isOwn) {
value[symToStringTag] = tag;
} else {
delete value[symToStringTag];
}
}
return result;
}
module.exports = getRawTag;
/***/ },
/* 15 */
/***/ function(module, exports) {
"use strict";
/** Used for built-in method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var nativeObjectToString = objectProto.toString;
/**
* Converts `value` to a string using `Object.prototype.toString`.
*
* @private
* @param {*} value The value to convert.
* @returns {string} Returns the converted string.
*/
function objectToString(value) {
return nativeObjectToString.call(value);
}
module.exports = objectToString;
/***/ },
/* 16 */
/***/ function(module, exports) {
'use strict';
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
/**
* Checks if `value` is the
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
*
* _.isObject(_.noop);
* // => true
*
* _.isObject(null);
* // => false
*/
function isObject(value) {
var type = typeof value === 'undefined' ? 'undefined' : _typeof(value);
return value != null && (type == 'object' || type == 'function');
}
module.exports = isObject;
/***/ },
/* 17 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = undefined;
var _Breadcrumb = __webpack_require__(18);
var _Breadcrumb2 = _interopRequireDefault(_Breadcrumb);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { 'default': obj };
}
exports['default'] = _Breadcrumb2['default'];
module.exports = exports['default'];
/***/ },
/* 18 */
/***/ 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__(4);
var _react2 = _interopRequireDefault(_react);
var _Item = __webpack_require__(19);
var _Item2 = _interopRequireDefault(_Item);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { 'default': obj };
}
var Breadcrumb = function Breadcrumb(props) {
return _react2['default'].createElement('div', { className: props.prefix + '-breadcrumb ' + props.className }, props.children && _react2['default'].Children.map(props.children, function (child) {
return child;
}), props.breads.length > 0 && props.breads.map(function (item, index) {
return _react2['default'].createElement(_Item2['default'], _extends({}, item, { key: index }));
}));
};
Breadcrumb.Item = _Item2['default'];
Breadcrumb.propTypes = {
prefix: _react2['default'].PropTypes.string,
className: _react2['default'].PropTypes.string,
breads: _react2['default'].PropTypes.array
};
Breadcrumb.defaultProps = {
prefix: 'zent',
className: '',
breads: []
};
exports['default'] = Breadcrumb;
module.exports = exports['default'];
/***/ },
/* 19 */
/***/ 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__(4);
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 Item = function Item(props) {
var href = props.href,
name = props.name,
others = _objectWithoutProperties(props, ['href', 'name']);
if (props.children) {
return props.children;
}
return href ? _react2['default'].createElement('a', _extends({}, others, { href: href }), name) : _react2['default'].createElement('span', others, name);
};
Item.propTypes = {
href: _react.PropTypes.string
};
exports['default'] = Item;
module.exports = exports['default'];
/***/ },
/* 20 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = undefined;
var _Button = __webpack_require__(21);
var _Button2 = _interopRequireDefault(_Button);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { 'default': obj };
}
exports['default'] = _Button2['default'];
module.exports = exports['default'];
/***/ },
/* 21 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = undefined;
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 _class, _temp;
var _react = __webpack_require__(4);
var _react2 = _interopRequireDefault(_react);
var _classnames = __webpack_require__(5);
var _classnames2 = _interopRequireDefault(_classnames);
var _omit = __webpack_require__(22);
var _omit2 = _interopRequireDefault(_omit);
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 _possibleConstructorReturn(self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}return call && ((typeof call === 'undefined' ? 'undefined' : _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 === 'undefined' ? 'undefined' : _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 Button = (_temp = _class = function (_Component) {
_inherits(Button, _Component);
function Button(props) {
_classCallCheck(this, Button);
var _this = _possibleConstructorReturn(this, (Button.__proto__ || Object.getPrototypeOf(Button)).call(this, props));
_this.handleClick = _this.handleClick.bind(_this);
return _this;
}
// 处理点击事件
_createClass(Button, [{
key: 'handleClick',
value: function handleClick(event) {
if (this.props.disabled || this.props.loading) return;
if (this.props.onClick) {
this.props.onClick(event);
}
}
// render a 标签
}, {
key: 'renderLink',
value: function renderLink(classNames) {
var Node = this.props.component || 'a';
var disabled = this.props.disabled || this.props.loading;
var _props = this.props,
_props$href = _props.href,
href = _props$href === undefined ? '' : _props$href,
target = _props.target;
return _react2['default'].createElement(Node, _extends({}, disabled ? {} : { href: href, target: target }, {
className: classNames,
onClick: this.handleClick
}), this.props.children);
}
// render button 标签
}, {
key: 'renderButton',
value: function renderButton(classNames) {
var Node = this.props.component || 'button';
var disabled = this.props.disabled || this.props.loading;
var htmlType = this.props.htmlType;
var nodeProps = (0, _omit2['default'])(this.props, ['type', 'size', 'className', 'block', 'component', 'disabled', 'loading', 'outline', 'bordered', 'prefix', 'htmlType']);
return _react2['default'].createElement(Node, _extends({}, nodeProps, htmlType ? { type: htmlType } : {}, {
className: classNames,
disabled: disabled,
onClick: this.handleClick
}), this.props.children);
}
}, {
key: 'render',
value: function render() {
var _setClass;
var renderer = this.props.href || this.props.target ? 'renderLink' : 'renderButton';
var _props2 = this.props,
className = _props2.className,
type = _props2.type,
size = _props2.size,
block = _props2.block,
disabled = _props2.disabled,
loading = _props2.loading,
outline = _props2.outline,
bordered = _props2.bordered,
prefix = _props2.prefix;
var classNames = (0, _classnames2['default'])((_setClass = {}, _defineProperty(_setClass, prefix + '-btn-' + type + (outline ? '-outline' : ''), type !== 'default'), _defineProperty(_setClass, prefix + '-btn-' + size, size !== 'medium'), _defineProperty(_setClass, prefix + '-btn-block', block), _defineProperty(_setClass, prefix + '-btn-loading', loading), _defineProperty(_setClass, prefix + '-btn-disabled', disabled), _defineProperty(_setClass, prefix + '-btn-border-transparent', !bordered), _setClass), prefix + '-btn', className);
return this[renderer](classNames);
}
}]);
return Button;
}(_react.Component), _class.propTypes = {
type: _react2['default'].PropTypes.oneOf(['default', 'primary', 'success', 'danger', 'link']),
size: _react2['default'].PropTypes.oneOf(['large', 'medium', 'small']),
htmlType: _react2['default'].PropTypes.oneOf(['button', 'submit', 'reset']),
className: _react2['default'].PropTypes.string,
block: _react2['default'].PropTypes.bool,
component: _react2['default'].PropTypes.string,
disabled: _react2['default'].PropTypes.bool,
loading: _react2['default'].PropTypes.bool,
outline: _react2['default'].PropTypes.bool,
bordered: _react2['default'].PropTypes.bool,
prefix: _react2['default'].PropTypes.string
}, _class.defaultProps = {
type: 'default',
size: 'medium',
className: '',
block: false,
disabled: false,
loading: false,
outline: false,
bordered: true,
prefix: 'zent'
}, _temp);
exports['default'] = Button;
module.exports = exports['default'];
/***/ },
/* 22 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
/* DO NOT EDIT!! Auto genetated wrapper for lodash/omit. */
var omit = __webpack_require__(23);
module.exports = omit;
/***/ },
/* 23 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var arrayMap = __webpack_require__(24),
baseClone = __webpack_require__(25),
baseUnset = __webpack_require__(128),
castPath = __webpack_require__(129),
copyObject = __webpack_require__(67),
customOmitClone = __webpack_require__(142),
flatRest = __webpack_require__(144),
getAllKeysIn = __webpack_require__(105);
/** Used to compose bitmasks for cloning. */
var CLONE_DEEP_FLAG = 1,
CLONE_FLAT_FLAG = 2,
CLONE_SYMBOLS_FLAG = 4;
/**
* The opposite of `_.pick`; this method creates an object composed of the
* own and inherited enumerable property paths of `object` that are not omitted.
*
* **Note:** This method is considerably slower than `_.pick`.
*
* @static
* @since 0.1.0
* @memberOf _
* @category Object
* @param {Object} object The source object.
* @param {...(string|string[])} [paths] The property paths to omit.
* @returns {Object} Returns the new object.
* @example
*
* var object = { 'a': 1, 'b': '2', 'c': 3 };
*
* _.omit(object, ['a', 'c']);
* // => { 'b': '2' }
*/
var omit = flatRest(function (object, paths) {
var result = {};
if (object == null) {
return result;
}
var isDeep = false;
paths = arrayMap(paths, function (path) {
path = castPath(path, object);
isDeep || (isDeep = path.length > 1);
return path;
});
copyObject(object, getAllKeysIn(object), result);
if (isDeep) {
result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
}
var length = paths.length;
while (length--) {
baseUnset(result, paths[length]);
}
return result;
});
module.exports = omit;
/***/ },
/* 24 */
/***/ function(module, exports) {
"use strict";
/**
* A specialized version of `_.map` for arrays without support for iteratee
* shorthands.
*
* @private
* @param {Array} [array] The array to iterate over.
* @param {Function} iteratee The function invoked per iteration.
* @returns {Array} Returns the new mapped array.
*/
function arrayMap(array, iteratee) {
var index = -1,
length = array == null ? 0 : array.length,
result = Array(length);
while (++index < length) {
result[index] = iteratee(array[index], index, array);
}
return result;
}
module.exports = arrayMap;
/***/ },
/* 25 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var Stack = __webpack_require__(26),
arrayEach = __webpack_require__(62),
assignValue = __webpack_require__(63),
baseAssign = __webpack_require__(66),
baseAssignIn = __webpack_require__(89),
cloneBuffer = __webpack_require__(93),
copyArray = __webpack_require__(94),
copySymbols = __webpack_require__(95),
copySymbolsIn = __webpack_require__(99),
getAllKeys = __webpack_require__(103),
getAllKeysIn = __webpack_require__(105),
getTag = __webpack_require__(106),
initCloneArray = __webpack_require__(111),
initCloneByTag = __webpack_require__(112),
initCloneObject = __webpack_require__(126),
isArray = __webpack_require__(74),
isBuffer = __webpack_require__(75),
isObject = __webpack_require__(16),
keys = __webpack_require__(68);
/** Used to compose bitmasks for cloning. */
var CLONE_DEEP_FLAG = 1,
CLONE_FLAT_FLAG = 2,
CLONE_SYMBOLS_FLAG = 4;
/** `Object#toString` result references. */
var argsTag = '[object Arguments]',
arrayTag = '[object Array]',
boolTag = '[object Boolean]',
dateTag = '[object Date]',
errorTag = '[object Error]',
funcTag = '[object Function]',
genTag = '[object GeneratorFunction]',
mapTag = '[object Map]',
numberTag = '[object Number]',
objectTag = '[object Object]',
regexpTag = '[object RegExp]',
setTag = '[object Set]',
stringTag = '[object String]',
symbolTag = '[object Symbol]',
weakMapTag = '[object WeakMap]';
var arrayBufferTag = '[object ArrayBuffer]',
dataViewTag = '[object DataView]',
float32Tag = '[object Float32Array]',
float64Tag = '[object Float64Array]',
int8Tag = '[object Int8Array]',
int16Tag = '[object Int16Array]',
int32Tag = '[object Int32Array]',
uint8Tag = '[object Uint8Array]',
uint8ClampedTag = '[object Uint8ClampedArray]',
uint16Tag = '[object Uint16Array]',
uint32Tag = '[object Uint32Array]';
/** Used to identify `toStringTag` values supported by `_.clone`. */
var cloneableTags = {};
cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
/**
* The base implementation of `_.clone` and `_.cloneDeep` which tracks
* traversed objects.
*
* @private
* @param {*} value The value to clone.
* @param {boolean} bitmask The bitmask flags.
* 1 - Deep clone
* 2 - Flatten inherited properties
* 4 - Clone symbols
* @param {Function} [customizer] The function to customize cloning.
* @param {string} [key] The key of `value`.
* @param {Object} [object] The parent object of `value`.
* @param {Object} [stack] Tracks traversed objects and their clone counterparts.
* @returns {*} Returns the cloned value.
*/
function baseClone(value, bitmask, customizer, key, object, stack) {
var result,
isDeep = bitmask & CLONE_DEEP_FLAG,
isFlat = bitmask & CLONE_FLAT_FLAG,
isFull = bitmask & CLONE_SYMBOLS_FLAG;
if (customizer) {
result = object ? customizer(value, key, object, stack) : customizer(value);
}
if (result !== undefined) {
return result;
}
if (!isObject(value)) {
return value;
}
var isArr = isArray(value);
if (isArr) {
result = initCloneArray(value);
if (!isDeep) {
return copyArray(value, result);
}
} else {
var tag = getTag(value),
isFunc = tag == funcTag || tag == genTag;
if (isBuffer(value)) {
return cloneBuffer(value, isDeep);
}
if (tag == objectTag || tag == argsTag || isFunc && !object) {
result = isFlat || isFunc ? {} : initCloneObject(value);
if (!isDeep) {
return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value));
}
} else {
if (!cloneableTags[tag]) {
return object ? value : {};
}
result = initCloneByTag(value, tag, baseClone, isDeep);
}
}
// Check for circular references and return its corresponding clone.
stack || (stack = new Stack());
var stacked = stack.get(value);
if (stacked) {
return stacked;
}
stack.set(value, result);
var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys;
var props = isArr ? undefined : keysFunc(value);
arrayEach(props || value, function (subValue, key) {
if (props) {
key = subValue;
subValue = value[key];
}
// Recursively populate clone (susceptible to call stack limits).
assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
});
return result;
}
module.exports = baseClone;
/***/ },
/* 26 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var ListCache = __webpack_require__(27),
stackClear = __webpack_require__(35),
stackDelete = __webpack_require__(36),
stackGet = __webpack_require__(37),
stackHas = __webpack_require__(38),
stackSet = __webpack_require__(39);
/**
* Creates a stack cache object to store key-value pairs.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function Stack(entries) {
var data = this.__data__ = new ListCache(entries);
this.size = data.size;
}
// Add methods to `Stack`.
Stack.prototype.clear = stackClear;
Stack.prototype['delete'] = stackDelete;
Stack.prototype.get = stackGet;
Stack.prototype.has = stackHas;
Stack.prototype.set = stackSet;
module.exports = Stack;
/***/ },
/* 27 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var listCacheClear = __webpack_require__(28),
listCacheDelete = __webpack_require__(29),
listCacheGet = __webpack_require__(32),
listCacheHas = __webpack_require__(33),
listCacheSet = __webpack_require__(34);
/**
* Creates an list cache object.
*
* @private
* @constructor
* @param {Array} [entries] The key-value pairs to cache.
*/
function ListCache(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
}
// Add methods to `ListCache`.
ListCache.prototype.clear = listCacheClear;
ListCache.prototype['delete'] = listCacheDelete;
ListCache.prototype.get = listCacheGet;
ListCache.prototype.has = listCacheHas;
ListCache.prototype.set = listCacheSet;
module.exports = ListCache;
/***/ },
/* 28 */
/***/ function(module, exports) {
"use strict";
/**
* Removes all key-value entries from the list cache.
*
* @private
* @name clear
* @memberOf ListCache
*/
function listCacheClear() {
this.__data__ = [];
this.size = 0;
}
module.exports = listCacheClear;
/***/ },
/* 29 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var assocIndexOf = __webpack_require__(30);
/** Used for built-in method references. */
var arrayProto = Array.prototype;
/** Built-in value references. */
var splice = arrayProto.splice;
/**
* Removes `key` and its value from the list cache.
*
* @private
* @name delete
* @memberOf ListCache
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function listCacheDelete(key) {
var data = this.__data__,
index = assocIndexOf(data, key);
if (index < 0) {
return false;
}
var lastIndex = data.length - 1;
if (index == lastIndex) {
data.pop();
} else {
splice.call(data, index, 1);
}
--this.size;
return true;
}
module.exports = listCacheDelete;
/***/ },
/* 30 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var eq = __webpack_require__(31);
/**
* Gets the index at which the `key` is found in `array` of key-value pairs.
*
* @private
* @param {Array} array The array to inspect.
* @param {*} key The key to search for.
* @returns {number} Returns the index of the matched value, else `-1`.
*/
function assocIndexOf(array, key) {
var length = array.length;
while (length--) {
if (eq(array[length][0], key)) {
return length;
}
}
return -1;
}
module.exports = assocIndexOf;
/***/ },
/* 31 */
/***/ function(module, exports) {
"use strict";
/**
* Performs a
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* comparison between two values to determine if they are equivalent.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to compare.
* @param {*} other The other value to compare.
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
* @example
*
* var object = { 'a': 1 };
* var other = { 'a': 1 };
*
* _.eq(object, object);
* // => true
*
* _.eq(object, other);
* // => false
*
* _.eq('a', 'a');
* // => true
*
* _.eq('a', Object('a'));
* // => false
*
* _.eq(NaN, NaN);
* // => true
*/
function eq(value, other) {
return value === other || value !== value && other !== other;
}
module.exports = eq;
/***/ },
/* 32 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var assocIndexOf = __webpack_require__(30);
/**
* Gets the list cache value for `key`.
*
* @private
* @name get
* @memberOf ListCache
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function listCacheGet(key) {
var data = this.__data__,
index = assocIndexOf(data, key);
return index < 0 ? undefined : data[index][1];
}
module.exports = listCacheGet;
/***/ },
/* 33 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var assocIndexOf = __webpack_require__(30);
/**
* Checks if a list cache value for `key` exists.
*
* @private
* @name has
* @memberOf ListCache
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function listCacheHas(key) {
return assocIndexOf(this.__data__, key) > -1;
}
module.exports = listCacheHas;
/***/ },
/* 34 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var assocIndexOf = __webpack_require__(30);
/**
* Sets the list cache `key` to `value`.
*
* @private
* @name set
* @memberOf ListCache
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the list cache instance.
*/
function listCacheSet(key, value) {
var data = this.__data__,
index = assocIndexOf(data, key);
if (index < 0) {
++this.size;
data.push([key, value]);
} else {
data[index][1] = value;
}
return this;
}
module.exports = listCacheSet;
/***/ },
/* 35 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var ListCache = __webpack_require__(27);
/**
* Removes all key-value entries from the stack.
*
* @private
* @name clear
* @memberOf Stack
*/
function stackClear() {
this.__data__ = new ListCache();
this.size = 0;
}
module.exports = stackClear;
/***/ },
/* 36 */
/***/ function(module, exports) {
'use strict';
/**
* Removes `key` and its value from the stack.
*
* @private
* @name delete
* @memberOf Stack
* @param {string} key The key of the value to remove.
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
*/
function stackDelete(key) {
var data = this.__data__,
result = data['delete'](key);
this.size = data.size;
return result;
}
module.exports = stackDelete;
/***/ },
/* 37 */
/***/ function(module, exports) {
"use strict";
/**
* Gets the stack value for `key`.
*
* @private
* @name get
* @memberOf Stack
* @param {string} key The key of the value to get.
* @returns {*} Returns the entry value.
*/
function stackGet(key) {
return this.__data__.get(key);
}
module.exports = stackGet;
/***/ },
/* 38 */
/***/ function(module, exports) {
"use strict";
/**
* Checks if a stack value for `key` exists.
*
* @private
* @name has
* @memberOf Stack
* @param {string} key The key of the entry to check.
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
*/
function stackHas(key) {
return this.__data__.has(key);
}
module.exports = stackHas;
/***/ },
/* 39 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var ListCache = __webpack_require__(27),
Map = __webpack_require__(40),
MapCache = __webpack_require__(47);
/** Used as the size to enable large array optimizations. */
var LARGE_ARRAY_SIZE = 200;
/**
* Sets the stack `key` to `value`.
*
* @private
* @name set
* @memberOf Stack
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the stack cache instance.
*/
function stackSet(key, value) {
var data = this.__data__;
if (data instanceof ListCache) {
var pairs = data.__data__;
if (!Map || pairs.length < LARGE_ARRAY_SIZE - 1) {
pairs.push([key, value]);
this.size = ++data.size;
return this;
}
data = this.__data__ = new MapCache(pairs);
}
data.set(key, value);
this.size = data.size;
return this;
}
module.exports = stackSet;
/***/ },
/* 40 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var getNative = __webpack_require__(41),
root = __webpack_require__(12);
/* Built-in method references that are verified to be native. */
var Map = getNative(root, 'Map');
module.exports = Map;
/***/ },
/* 41 */
/***/ function(module, exports, __webpack_require__) {
'use strict