UNPKG

selector2

Version:

Virtual selector component for react.js

1,307 lines (1,179 loc) 1.11 MB
/******/ (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 = "/statics/"; /******/ // Load entry module and return exports /******/ return __webpack_require__(0); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ function(module, exports, __webpack_require__) { module.exports = __webpack_require__(13); /***/ }, /* 1 */, /* 2 */, /* 3 */, /* 4 */, /* 5 */, /* 6 */, /* 7 */, /* 8 */, /* 9 */, /* 10 */, /* 11 */, /* 12 */, /* 13 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; 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__(14); var _react2 = _interopRequireDefault(_react); var _reactDom = __webpack_require__(170); var _reactDom2 = _interopRequireDefault(_reactDom); var _Selector2Jsx = __webpack_require__(171); var _Selector2Jsx2 = _interopRequireDefault(_Selector2Jsx); __webpack_require__(179); __webpack_require__(183); var Selector2Example = (function (_React$Component) { _inherits(Selector2Example, _React$Component); function Selector2Example(props) { _classCallCheck(this, Selector2Example); _get(Object.getPrototypeOf(Selector2Example.prototype), 'constructor', this).call(this, props); this.state = { remote: { url: './mocks/options.json', field: 'results', loading: 'loading...', defaults: 'label-1, label-2' }, options: [{ label: 'hello-01', value: 'hello-01' }, { label: 'disabled', value: 'disabled', disabled: true }, { label: 'hello-02', value: 'hello-02' }, { label: 'hello-03', value: 'hello-03' }, { label: 'hello-04', value: 'hello-04' }, { label: 'hello-05', value: 'hello-05' }, { label: 'hello-06', value: 'hello-06' }, { label: 'hello-07', value: 'hello-07' }, { label: 'hello-08', value: 'hello-08' }, { label: 'hello-09', value: 'hello-09' }, { label: 'hello-10', value: 'hello-10' }, { label: 'hello-11', value: 'hello-11' }], defaults: ['hello-02', 'hello-05'], countries: { options: [{ label: '阿尔巴尼亚', value: '阿尔巴尼亚' }, { label: '阿尔及利亚', value: '阿尔及利亚' }, { label: '阿富汗', value: '阿富汗' }, { label: '阿根廷', value: '阿根廷' }], defaults: '阿尔及利亚' }, groups: { options: [{ group: 'group-1', options: [{ label: 'group-label-1-1', value: 'group-label-1-1' }, { label: 'group-label-1-2', value: 'group-label-1-2' }, { label: 'group-label-1-3', value: 'group-label-1-3', disabled: true }, { label: 'group-label-1-4', value: 'group-label-1-4' }] }, { group: 'group-2', options: [{ label: 'group-label-2-1', value: 'group-label-2-1' }, { label: 'group-label-2-2', value: 'group-label-2-2' }] }, { group: 'group-3', options: [{ label: 'group-label-3-1', value: 'group-label-3-1' }, { label: 'group-label-3-2', value: 'group-label-3-2' }, { label: 'group-label-3-3', value: 'group-label-3-3' }] }], defaults: ['group-label-3-2', 'group-label-2-2'] } }; this.displayName = 'Selector2Example'; } _createClass(Selector2Example, [{ key: 'handleUpdateRemote', value: function handleUpdateRemote() { this.setState({ remote: { url: './mocks/options-1.json?norce=foo&time=1234567890', field: 'results', loading: 'reloading...', defaults: 'label-3, label-4, label-5, label-6' } }); } }, { key: 'render', value: function render() { return _react2['default'].createElement( 'div', { className: 'form-horizontal' }, _react2['default'].createElement( 'div', { className: 'form-group' }, _react2['default'].createElement(_Selector2Jsx2['default'], { options: this.state.groups.options, theme: 'sm selector-default', defaults: this.state.groups.defaults, onSelectClose: true }) ), _react2['default'].createElement( 'div', { className: 'form-group' }, _react2['default'].createElement(_Selector2Jsx2['default'], { options: this.state.groups.options, defaults: this.state.groups.defaults, onSelectClose: true }) ), _react2['default'].createElement( 'div', { className: 'form-group' }, _react2['default'].createElement(_Selector2Jsx2['default'], { options: this.state.groups.options, theme: 'lg selector-default', defaults: this.state.groups.defaults, onSelectClose: true }) ), _react2['default'].createElement( 'div', { className: 'form-group' }, _react2['default'].createElement(_Selector2Jsx2['default'], { options: this.state.groups.options, multiple: true, theme: 'sm selector-danger', defaults: this.state.groups.defaults, onSelectClose: true }) ), _react2['default'].createElement( 'div', { className: 'form-group' }, _react2['default'].createElement(_Selector2Jsx2['default'], { options: this.state.groups.options, multiple: true, theme: 'warning', defaults: this.state.groups.defaults, onSelectClose: true }) ), _react2['default'].createElement( 'div', { className: 'form-group' }, _react2['default'].createElement(_Selector2Jsx2['default'], { options: this.state.groups.options, multiple: true, theme: 'lg selector-success', defaults: this.state.groups.defaults, onSelectClose: true }) ), _react2['default'].createElement( 'div', { className: 'form-group' }, _react2['default'].createElement( 'div', { className: 'input-group' }, _react2['default'].createElement( 'div', { className: 'input-group-btn' }, _react2['default'].createElement( 'button', { type: 'button', className: 'btn btn-success' }, 'Go!' ) ), _react2['default'].createElement(_Selector2Jsx2['default'], { options: this.state.groups.options, multiple: true, theme: 'success', defaults: this.state.groups.defaults, onSelectClose: true }) ) ), _react2['default'].createElement( 'div', { className: 'form-group' }, _react2['default'].createElement( 'div', { className: 'input-group' }, _react2['default'].createElement(_Selector2Jsx2['default'], { options: this.state.groups.options, multiple: true, theme: 'success', defaults: this.state.groups.defaults, onSelectClose: true }), _react2['default'].createElement( 'div', { className: 'input-group-btn' }, _react2['default'].createElement( 'button', { type: 'button', className: 'btn btn-success' }, 'Go!' ) ) ) ), _react2['default'].createElement( 'div', { className: 'form-group' }, _react2['default'].createElement( 'div', { className: 'row' }, _react2['default'].createElement( 'div', { className: 'col-lg-6' }, _react2['default'].createElement( 'div', { className: 'input-group' }, _react2['default'].createElement( 'div', { className: 'input-group-btn' }, _react2['default'].createElement( 'button', { type: 'button', className: 'btn btn-default' }, 'Action' ), _react2['default'].createElement( 'button', { type: 'button', className: 'btn btn-default dropdown-toggle', 'data-toggle': 'dropdown', 'aria-haspopup': 'true', 'aria-expanded': 'false' }, _react2['default'].createElement('span', { className: 'caret' }), _react2['default'].createElement( 'span', { className: 'sr-only' }, 'Toggle Dropdown' ) ), _react2['default'].createElement( 'ul', { className: 'dropdown-menu' }, _react2['default'].createElement( 'li', null, _react2['default'].createElement( 'a', { href: '#' }, 'Action' ) ), _react2['default'].createElement( 'li', null, _react2['default'].createElement( 'a', { href: '#' }, 'Another action' ) ), _react2['default'].createElement( 'li', null, _react2['default'].createElement( 'a', { href: '#' }, 'Something else here' ) ), _react2['default'].createElement('li', { role: 'separator', className: 'divider' }), _react2['default'].createElement( 'li', null, _react2['default'].createElement( 'a', { href: '#' }, 'Separated link' ) ) ) ), _react2['default'].createElement(_Selector2Jsx2['default'], { options: this.state.groups.options, defaults: this.state.groups.defaults, onSelectClose: true }) ) ), _react2['default'].createElement( 'div', { className: 'col-lg-6' }, _react2['default'].createElement( 'div', { className: 'input-group' }, _react2['default'].createElement(_Selector2Jsx2['default'], { options: this.state.groups.options, defaults: this.state.groups.defaults, onSelectClose: true }), _react2['default'].createElement( 'div', { className: 'input-group-btn' }, _react2['default'].createElement( 'button', { type: 'button', className: 'btn btn-default' }, 'Action' ), _react2['default'].createElement( 'button', { type: 'button', className: 'btn btn-default dropdown-toggle', 'data-toggle': 'dropdown', 'aria-haspopup': 'true', 'aria-expanded': 'false' }, _react2['default'].createElement('span', { className: 'caret' }), _react2['default'].createElement( 'span', { className: 'sr-only' }, 'Toggle Dropdown' ) ), _react2['default'].createElement( 'ul', { className: 'dropdown-menu dropdown-menu-right' }, _react2['default'].createElement( 'li', null, _react2['default'].createElement( 'a', { href: '#' }, 'Action' ) ), _react2['default'].createElement( 'li', null, _react2['default'].createElement( 'a', { href: '#' }, 'Another action' ) ), _react2['default'].createElement( 'li', null, _react2['default'].createElement( 'a', { href: '#' }, 'Something else here' ) ), _react2['default'].createElement('li', { role: 'separator', className: 'divider' }), _react2['default'].createElement( 'li', null, _react2['default'].createElement( 'a', { href: '#' }, 'Separated link' ) ) ) ) ) ) ) ), _react2['default'].createElement( 'div', { className: 'form-group' }, _react2['default'].createElement( 'div', { className: 'row' }, _react2['default'].createElement( 'div', { className: 'col-xs-6' }, _react2['default'].createElement( 'div', { className: 'input-group' }, _react2['default'].createElement( 'span', { className: 'input-group-addon' }, _react2['default'].createElement('input', { type: 'radio' }) ), _react2['default'].createElement(_Selector2Jsx2['default'], { options: this.state.groups.options, theme: 'sm selector-default', defaults: this.state.groups.defaults, onSelectClose: true }) ) ), _react2['default'].createElement( 'div', { className: 'col-xs-6' }, _react2['default'].createElement( 'div', { className: 'input-group' }, _react2['default'].createElement( 'span', { className: 'input-group-addon' }, _react2['default'].createElement('input', { type: 'checkbox', name: '', id: '' }) ), _react2['default'].createElement(_Selector2Jsx2['default'], { options: this.state.groups.options, theme: 'sm selector-default', defaults: this.state.groups.defaults, onSelectClose: true }) ) ) ) ), _react2['default'].createElement( 'div', { className: 'form-group' }, _react2['default'].createElement( 'div', { className: 'row' }, _react2['default'].createElement( 'div', { className: 'col-xs-6' }, _react2['default'].createElement( 'div', { className: 'input-group' }, _react2['default'].createElement( 'span', { className: 'input-group-addon' }, '分组单选:' ), _react2['default'].createElement(_Selector2Jsx2['default'], { options: this.state.groups.options, theme: 'sm selector-default', defaults: this.state.groups.defaults, onSelectClose: true }) ) ), _react2['default'].createElement( 'div', { className: 'col-xs-6' }, _react2['default'].createElement( 'div', { className: 'input-group' }, _react2['default'].createElement( 'span', { className: 'input-group-addon' }, '分组单选:' ), _react2['default'].createElement(_Selector2Jsx2['default'], { options: this.state.groups.options, theme: 'sm selector-default', defaults: this.state.groups.defaults, onSelectClose: true }) ) ) ) ), _react2['default'].createElement( 'div', { className: 'form-group' }, _react2['default'].createElement( 'div', { className: 'input-group' }, _react2['default'].createElement( 'span', { className: 'input-group-addon' }, '分组单选:' ), _react2['default'].createElement(_Selector2Jsx2['default'], { options: this.state.groups.options, theme: 'sm selector-default', disabled: true, defaults: this.state.groups.defaults, onSelectClose: true }) ) ), _react2['default'].createElement( 'div', { className: 'form-group' }, _react2['default'].createElement( 'div', { className: 'input-group' }, _react2['default'].createElement( 'span', { className: 'input-group-addon' }, '远程获取:' ), _react2['default'].createElement(_Selector2Jsx2['default'], { defaults: this.state.remote.defaults, remote: this.state.remote, onSelectClose: true, multiple: true }), _react2['default'].createElement( 'div', { className: 'input-group-btn' }, _react2['default'].createElement( 'button', { className: 'btn btn-success', onClick: this.handleUpdateRemote.bind(this) }, 'update' ) ) ) ), _react2['default'].createElement( 'div', { className: 'form-group' }, _react2['default'].createElement( 'div', { className: 'input-group' }, _react2['default'].createElement( 'span', { className: 'input-group-addon' }, '分组单选:' ), _react2['default'].createElement(_Selector2Jsx2['default'], { options: this.state.groups.options, theme: 'sm selector-default', defaults: this.state.groups.defaults, onSelectClose: true }) ) ), _react2['default'].createElement( 'div', { className: 'form-group' }, _react2['default'].createElement( 'div', { className: 'input-group' }, _react2['default'].createElement( 'span', { className: 'input-group-addon' }, '分组单选:' ), _react2['default'].createElement(_Selector2Jsx2['default'], { options: this.state.groups.options, theme: 'lg selector-default', defaults: this.state.groups.defaults, onSelectClose: true }) ) ), _react2['default'].createElement( 'div', { className: 'form-group' }, _react2['default'].createElement( 'div', { className: 'input-group' }, _react2['default'].createElement( 'span', { className: 'input-group-addon' }, '分组单选:' ), _react2['default'].createElement(_Selector2Jsx2['default'], { options: this.state.groups.options, defaults: this.state.groups.defaults, onSelectClose: true }) ) ), _react2['default'].createElement( 'div', { className: 'form-group' }, _react2['default'].createElement( 'div', { className: 'input-group' }, _react2['default'].createElement( 'span', { className: 'input-group-addon' }, '分组多选:' ), _react2['default'].createElement(_Selector2Jsx2['default'], { options: this.state.groups.options, defaults: this.state.groups.defaults, multiple: true, onSelectClose: true }) ) ), _react2['default'].createElement( 'div', { className: 'form-group' }, _react2['default'].createElement( 'div', { className: 'input-group has-success' }, _react2['default'].createElement( 'span', { className: 'input-group-addon' }, '分组多选:' ), _react2['default'].createElement(_Selector2Jsx2['default'], { options: this.state.groups.options, defaults: this.state.groups.defaults, multiple: true, onSelectClose: true }) ) ), _react2['default'].createElement( 'div', { className: 'form-group' }, _react2['default'].createElement( 'div', { className: 'input-group has-error' }, _react2['default'].createElement( 'span', { className: 'input-group-addon' }, '分组多选:' ), _react2['default'].createElement(_Selector2Jsx2['default'], { options: this.state.groups.options, defaults: this.state.groups.defaults, multiple: true, onSelectClose: true }) ) ), _react2['default'].createElement( 'div', { className: 'form-group' }, _react2['default'].createElement( 'div', { className: 'input-group has-warning' }, _react2['default'].createElement( 'span', { className: 'input-group-addon' }, '分组多选:' ), _react2['default'].createElement(_Selector2Jsx2['default'], { options: this.state.groups.options, defaults: this.state.groups.defaults, multiple: true, onSelectClose: true }) ) ), _react2['default'].createElement( 'div', { className: 'form-group' }, _react2['default'].createElement( 'div', { className: 'input-group' }, _react2['default'].createElement( 'span', { className: 'input-group-addon' }, '单选:' ), _react2['default'].createElement(_Selector2Jsx2['default'], { options: this.state.options, onChange: function (arg) { console.log(arg); }, defaults: this.state.defaults, onSelectClose: true }) ) ), _react2['default'].createElement( 'div', { className: 'form-group' }, _react2['default'].createElement( 'div', { className: 'input-group' }, _react2['default'].createElement( 'span', { className: 'input-group-addon' }, '默认皮肤:' ), _react2['default'].createElement(_Selector2Jsx2['default'], { options: this.state.options, defaults: this.state.defaults, multiple: true }) ) ), _react2['default'].createElement( 'div', { className: 'form-group' }, _react2['default'].createElement( 'div', { className: 'input-group' }, _react2['default'].createElement( 'span', { className: 'input-group-addon' }, 'warning:' ), _react2['default'].createElement(_Selector2Jsx2['default'], { options: this.state.options, defaults: this.state.defaults, multiple: true }) ) ), _react2['default'].createElement( 'div', { className: 'form-group' }, _react2['default'].createElement( 'div', { className: 'input-group' }, _react2['default'].createElement( 'span', { className: 'input-group-addon' }, 'danger:' ), _react2['default'].createElement(_Selector2Jsx2['default'], { options: this.state.options, defaults: this.state.defaults, multiple: true }) ) ), _react2['default'].createElement( 'div', { className: 'form-group' }, _react2['default'].createElement( 'div', { className: 'input-group' }, _react2['default'].createElement( 'span', { className: 'input-group-addon' }, 'success:' ), _react2['default'].createElement(_Selector2Jsx2['default'], { options: this.state.options, defaults: this.state.defaults, multiple: true }) ) ), _react2['default'].createElement( 'div', { className: 'form-group' }, _react2['default'].createElement( 'div', { className: 'input-group' }, _react2['default'].createElement( 'span', { className: 'input-group-addon' }, '选择后关闭下拉列表:' ), _react2['default'].createElement(_Selector2Jsx2['default'], { options: this.state.options, defaults: this.state.defaults, multiple: true, onSelectClose: true }) ) ), _react2['default'].createElement( 'div', { className: 'form-group' }, _react2['default'].createElement( 'div', { className: 'input-group' }, _react2['default'].createElement( 'span', { className: 'input-group-addon' }, '选择后不关闭下拉列表:' ), _react2['default'].createElement(_Selector2Jsx2['default'], { options: this.state.options, defaults: this.state.defaults, multiple: true }) ) ), _react2['default'].createElement( 'div', { className: 'form-group' }, _react2['default'].createElement( 'div', { className: 'input-group' }, _react2['default'].createElement( 'span', { className: 'input-group-addon' }, '自定义模板:' ), _react2['default'].createElement(_Selector2Jsx2['default'], { options: this.state.countries.options, defaults: this.state.countries.defaults, multiple: false, onSelectClose: true, template: { option: '<i class="example-country" style="background-position: 0px -<%= unique * 11 %>px"></i><%= label %>', selected: '<i class="example-country" style="background-position: 0px -<%= unique * 11 %>px"></i><%= label %>' }, clearable: false }) ) ) ); } }]); return Selector2Example; })(_react2['default'].Component); _reactDom2['default'].render(_react2['default'].createElement(Selector2Example, null), document.getElementById('virtual-selector')); /***/ }, /* 14 */ /***/ function(module, exports, __webpack_require__) { 'use strict'; module.exports = __webpack_require__(15); /***/ }, /* 15 */ /***/ function(module, exports, __webpack_require__) { /** * Copyright 2013-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. * * @providesModule React */ 'use strict'; var ReactDOM = __webpack_require__(16); var ReactDOMServer = __webpack_require__(160); var ReactIsomorphic = __webpack_require__(164); var assign = __webpack_require__(51); var deprecated = __webpack_require__(169); // `version` will be added here by ReactIsomorphic. var React = {}; assign(React, ReactIsomorphic); assign(React, { // ReactDOM findDOMNode: deprecated('findDOMNode', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.findDOMNode), render: deprecated('render', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.render), unmountComponentAtNode: deprecated('unmountComponentAtNode', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.unmountComponentAtNode), // ReactDOMServer renderToString: deprecated('renderToString', 'ReactDOMServer', 'react-dom/server', ReactDOMServer, ReactDOMServer.renderToString), renderToStaticMarkup: deprecated('renderToStaticMarkup', 'ReactDOMServer', 'react-dom/server', ReactDOMServer, ReactDOMServer.renderToStaticMarkup) }); React.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOM; React.__SECRET_DOM_SERVER_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOMServer; module.exports = React; /***/ }, /* 16 */ /***/ function(module, exports, __webpack_require__) { /** * Copyright 2013-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. * * @providesModule ReactDOM */ /* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/ 'use strict'; var ReactCurrentOwner = __webpack_require__(17); var ReactDOMTextComponent = __webpack_require__(18); var ReactDefaultInjection = __webpack_require__(83); var ReactInstanceHandles = __webpack_require__(57); var ReactMount = __webpack_require__(40); var ReactPerf = __webpack_require__(30); var ReactReconciler = __webpack_require__(62); var ReactUpdates = __webpack_require__(66); var ReactVersion = __webpack_require__(158); var findDOMNode = __webpack_require__(103); var renderSubtreeIntoContainer = __webpack_require__(159); var warning = __webpack_require__(37); ReactDefaultInjection.inject(); var render = ReactPerf.measure('React', 'render', ReactMount.render); var React = { findDOMNode: findDOMNode, render: render, unmountComponentAtNode: ReactMount.unmountComponentAtNode, version: ReactVersion, /* eslint-disable camelcase */ unstable_batchedUpdates: ReactUpdates.batchedUpdates, unstable_renderSubtreeIntoContainer: renderSubtreeIntoContainer }; // Inject the runtime into a devtools global hook regardless of browser. // Allows for debugging when the hook is injected on the page. /* eslint-enable camelcase */ if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') { __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({ CurrentOwner: ReactCurrentOwner, InstanceHandles: ReactInstanceHandles, Mount: ReactMount, Reconciler: ReactReconciler, TextComponent: ReactDOMTextComponent }); } if ((undefined) !== 'production') { var ExecutionEnvironment = __webpack_require__(21); if (ExecutionEnvironment.canUseDOM && window.top === window.self) { // First check if devtools is not installed if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') { // If we're in Chrome or Firefox, provide a download link if not installed. if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) { console.debug('Download the React DevTools for a better development experience: ' + 'https://fb.me/react-devtools'); } } // If we're in IE8, check to see if we are in compatibility mode and provide // information on preventing compatibility mode var ieCompatibilityMode = document.documentMode && document.documentMode < 8; (undefined) !== 'production' ? warning(!ieCompatibilityMode, 'Internet Explorer is running in compatibility mode; please add the ' + 'following tag to your HTML to prevent this from happening: ' + '<meta http-equiv="X-UA-Compatible" content="IE=edge" />') : undefined; var expectedFeatures = [ // shims Array.isArray, Array.prototype.every, Array.prototype.forEach, Array.prototype.indexOf, Array.prototype.map, Date.now, Function.prototype.bind, Object.keys, String.prototype.split, String.prototype.trim, // shams Object.create, Object.freeze]; for (var i = 0; i < expectedFeatures.length; i++) { if (!expectedFeatures[i]) { console.error('One or more ES5 shim/shams expected by React are not available: ' + 'https://fb.me/react-warning-polyfills'); break; } } } } module.exports = React; /***/ }, /* 17 */ /***/ function(module, exports) { /** * Copyright 2013-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. * * @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; /***/ }, /* 18 */ /***/ function(module, exports, __webpack_require__) { /** * Copyright 2013-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. * * @providesModule ReactDOMTextComponent * @typechecks static-only */ 'use strict'; var DOMChildrenOperations = __webpack_require__(19); var DOMPropertyOperations = __webpack_require__(34); var ReactComponentBrowserEnvironment = __webpack_require__(38); var ReactMount = __webpack_require__(40); var assign = __webpack_require__(51); var escapeTextContentForBrowser = __webpack_require__(33); var setTextContent = __webpack_require__(32); var validateDOMNesting = __webpack_require__(82); /** * Text nodes violate a couple assumptions that React makes about components: * * - When mounting text into the DOM, adjacent text nodes are merged. * - Text nodes cannot be assigned a React root ID. * * This component is used to wrap strings in elements so that they can undergo * the same reconciliation that is applied to elements. * * TODO: Investigate representing React components in the DOM with text nodes. * * @class ReactDOMTextComponent * @extends ReactComponent * @internal */ var ReactDOMTextComponent = function (props) { // This constructor and its argument is currently used by mocks. }; assign(ReactDOMTextComponent.prototype, { /** * @param {ReactText} text * @internal */ construct: function (text) { // TODO: This is really a ReactText (ReactNode), not a ReactElement this._currentElement = text; this._stringText = '' + text; // Properties this._rootNodeID = null; this._mountIndex = 0; }, /** * Creates the markup for this text node. This node is not intended to have * any features besides containing text content. * * @param {string} rootID DOM ID of the root node. * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction * @return {string} Markup for this text node. * @internal */ mountComponent: function (rootID, transaction, context) { if ((undefined) !== 'production') { if (context[validateDOMNesting.ancestorInfoContextKey]) { validateDOMNesting('span', null, context[validateDOMNesting.ancestorInfoContextKey]); } } this._rootNodeID = rootID; if (transaction.useCreateElement) { var ownerDocument = context[ReactMount.ownerDocumentContextKey]; var el = ownerDocument.createElement('span'); DOMPropertyOperations.setAttributeForID(el, rootID); // Populate node cache ReactMount.getID(el); setTextContent(el, this._stringText); return el; } else { var escapedText = escapeTextContentForBrowser(this._stringText); if (transaction.renderToStaticMarkup) { // Normally we'd wrap this in a `span` for the reasons stated above, but // since this is a situation where React won't take over (static pages), // we can simply return the text as it is. return escapedText; } return '<span ' + DOMPropertyOperations.createMarkupForID(rootID) + '>' + escapedText + '</span>'; } }, /** * Updates this component by updating the text content. * * @param {ReactText} nextText The next text content * @param {ReactReconcileTransaction} transaction * @internal */ receiveComponent: function (nextText, transaction) { if (nextText !== this._currentElement) { this._currentElement = nextText; var nextStringText = '' + nextText; if (nextStringText !== this._stringText) { // TODO: Save this as pending props and use performUpdateIfNecessary // and/or updateComponent to do the actual update for consistency with // other component types? this._stringText = nextStringText; var node = ReactMount.getNode(this._rootNodeID); DOMChildrenOperations.updateTextContent(node, nextStringText); } } }, unmountComponent: function () { ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID); } }); module.exports = ReactDOMTextComponent; /***/ }, /* 19 */ /***/ function(module, exports, __webpack_require__) { /** * Copyright 2013-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. * * @providesModule DOMChildrenOperations * @typechecks static-only */ 'use strict'; var Danger = __webpack_require__(20); var ReactMultiChildUpdateTypes = __webpack_require__(28); var ReactPerf = __webpack_require__(30); var setInnerHTML = __webpack_require__(31); var setTextContent = __webpack_require__(32); var invariant = __webpack_require__(25); /** * Inserts `childNode` as a child of `parentNode` at the `index`. * * @param {DOMElement} parentNode Parent node in which to insert. * @param {DOMElement} childNode Child node to insert. * @param {number} index Index at which to insert the child. * @internal */ function insertChildAt(parentNode, childNode, index) { // By exploiting arrays returning `undefined` for an undefined index, we can // rely exclusively on `insertBefore(node, null)` instead of also using // `appendChild(node)`. However, using `undefined` is not allowed by all // browsers so we must replace it with `null`. // fix render order error in safari // IE8 will throw error when index out of list size. var beforeChild = index >= parentNode.childNodes.length ? null : parentNode.childNodes.item(index); parentNode.insertBefore(childNode, beforeChild); } /** * Operations for updating with DOM children. */ var DOMChildrenOperations = { dangerouslyReplaceNodeWithMarkup: Danger.dangerouslyReplaceNodeWithMarkup, updateTextContent: setTextContent, /** * Updates a component's children by processing a series of updates. The * update configurations are each expected to have a `parentNode` property. * * @param {array<object>} updates List of update configurations. * @param {array<string>} markupList List of markup strings. * @internal */ processUpdates: function (updates, markupList) { var update; // Mapping from parent IDs to initial child orderings. var initialChildren = null; // List of children that will be moved or removed. var updatedChildren = null; for (var i = 0; i < updates.length; i++) { update = updates[i]; if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING || update.type === ReactMultiChildUpdateTypes.REMOVE_NODE) { var updatedIndex = update.fromIndex; var updatedChild = update.parentNode.childNodes[updatedIndex]; var parentID = update.parentID; !updatedChild ? (undefined) !== 'production' ? invariant(false, 'processUpdates(): Unable to find child %s of element. This ' + 'probably means the DOM was unexpectedly mutated (e.g., by the ' + 'browser), usually due to forgetting a <tbody> when using tables, ' + 'nesting tags like <form>, <p>, or <a>, or using non-SVG elements ' + 'in an <svg> parent. Try inspecting the child nodes of the element ' + 'with React ID `%s`.', updatedIndex, parentID) : invariant(false) : undefined; initialChildren = initialChildren || {}; initialChildren[parentID] = initialChildren[parentID] || []; initialChildren[parentID][updatedIndex] = updatedChild; updatedChildren = updatedChildren || []; updatedChildren.push(updatedChild); } } var renderedMarkup; // markupList is either a list of markup or just a list of elements if (markupList.length && typeof markupList[0] === 'string') { renderedMarkup = Danger.dangerouslyRenderMarkup(markupList); } else { renderedMarkup = markupList; } // Remove updated children first so that `toIndex` is consistent. if (updatedChildren) { for (var j = 0; j < updatedChildren.length; j++) { updatedChildren[j].parentNode.removeChild(updatedChildren[j]); } } for (var k = 0; k < updates.length; k++) { update = updates[k]; switch (update.type) { case ReactMultiChildUpdateTypes.INSERT_MARKUP: insertChildAt(update.parentNode, renderedMarkup[update.markupIndex], update.toIndex); break; case ReactMultiChildUpdateTypes.MOVE_EXISTING: insertChildAt(update.parentNode, initialChildren[update.parentID][update.fromIndex], update.toIndex); break; case ReactMultiChildUpdateTypes.SET_MARKUP: setInnerHTML(update.parentNode, update.content); break; case ReactMultiChildUpdateTypes.TEXT_CONTENT: setTextContent(update.parentNode, update.content); break; case ReactMultiChildUpdateTypes.REMOVE_NODE: // Already removed by the for-loop above. break; } } } }; ReactPerf.measureMethods(DOMChildrenOperations, 'DOMChildrenOperations', { updateTextContent: 'updateTextContent' }); module.exports = DOMChildrenOperations; /***/ }, /* 20 */ /***/ function(module, exports, __webpack_require__) { /** * Copyright 2013-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. * * @providesModule Danger * @typechecks static-only */ 'use strict'; var ExecutionEnvironment = __webpack_require__(21); var createNodesFromMarkup = __webpack_require__(22); var emptyFunction = __webpack_require__(27); var getMarkupWrap = __webpack_require__(26); var invariant = __webpack_require__(25); var OPEN_TAG_NAME_EXP = /^(<[^ \/>]+)/; var RESULT_INDEX_ATTR = 'data-danger-index'; /** * Extracts the `nodeName` from a string of markup. * * NOTE: Extracting the `nodeName` does not require a regular expression match * because we make assumptions about React-generated markup (i.e. there are no * spaces surrounding the opening tag and there is at least one attribute). * * @param {string} markup String of markup. * @return {string} Node name of the supplied markup. * @see http://jsperf.com/extract-nodename */ function getNodeName(markup) { return markup.substring(1, markup.indexOf(' ')); } var Danger = { /** * Renders markup into an array of nodes. The markup is expected to render * into a list of root nodes. Also, the length of `resultList` and * `markupList` should be the same. * * @param {array<string>} markupList List of markup strings to render. * @return {array<DOMElement>} List of rendered nodes. * @internal */ dangerouslyRenderMarkup: function (markupList) { !ExecutionEnvironment.canUseDOM ? (undefined) !== 'production' ? invariant(false, 'dangerouslyRenderMarkup(...): Cannot render markup in a worker ' + 'thread. Make sure `window` and `document` are available globally ' + 'before requiring React when unit testing or use ' + 'ReactDOMServer.renderToString for server rendering.') : invariant(false) : undefined; var nodeName; var markupByNodeName = {}; // Group markup by `nodeName` if a wrap is necessary, else by '*'. for (var i = 0; i < markupList.length; i++) { !markupList[i] ? (undefined) !== 'production' ? invariant(false, 'dangerouslyRenderMarkup(...): Missing markup.') : invariant(false) : undefined; nodeName = getNodeName(markupList[i]); nodeName = getMarkupWrap(nodeName) ? nodeName : '*'; markupByNodeName[nodeName] = markupByNodeName[nodeName] || []; markupByNodeName[nodeName][i] = markupList[i]; } var resultList = []; var resultListAssignmentCount = 0; for (nodeName in markupByNodeName) { if (!markupByNodeName.hasOwnProperty(nodeName)) { continue; } var markupListByNodeName = markupByNodeName[nodeName]; // This for-in loop skips the holes of the sparse array. The order of // iteration should follow the order of assignment, which happens to match // numerical index order, but we don't rely on that. var resultIndex; for (resultIndex in markupListByNodeName) { if (markupListByNodeName.hasOwnProperty(resultIndex)) { var markup = markupListByNodeName[resultIndex];