zreact-redux-rails 3.6.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +47 -0
- data/lib/zreact-redux-rails.rb +10 -0
- data/lib/zreact-redux-rails/version.rb +7 -0
- data/vendor/assets/javascripts/react-redux.js +897 -0
- data/vendor/assets/javascripts/redux.js +945 -0
- metadata +108 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f0b3b0f6e324b4e8f0de10e229c164d0177e571f
|
4
|
+
data.tar.gz: d7ca5d9214859127633bbd68b1cd85c70c1aad29
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6473e1d451caa6bdf697e38a25fff6de8f4775b5af6e1a1c7ac76933269be32087066365cff67cde1b3eceece8ccac48ab38fcfc50f62b39520a7385f65671fb
|
7
|
+
data.tar.gz: 64d69d3b3efa08fae46368df88a2904d8bdea73f200858a5b64b1bbe1aec6f15605c07fdaef2e59ebdfa784db23098eaf4ea03c376e59d020c6426eca372117c
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Thuong Nguyen
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# zreact-redux-rails
|
2
|
+
|
3
|
+
I firstly created this gem for my own usage. However, when I pushed this gem, another gem with the same name, but seemed quite old appeared. I decided to make another gem for up-to-date components.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'zreact-redux-rails'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install zreact-redux-rails
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Simply add below lines to your `application.js` on your behalf:
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
//= require react-redux
|
27
|
+
```
|
28
|
+
|
29
|
+
Or if you are using CoffeeScript, it's your `application.js.coffee`:
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
#= require react-redux
|
33
|
+
```
|
34
|
+
|
35
|
+
## Versioning
|
36
|
+
|
37
|
+
First 3 number of `zreact-redux-rails` version is the version of `redux`.
|
38
|
+
|
39
|
+
## Contributing
|
40
|
+
|
41
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/zelic91/zreact-redux-rails. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
42
|
+
|
43
|
+
|
44
|
+
## License
|
45
|
+
|
46
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
47
|
+
|
@@ -0,0 +1,897 @@
|
|
1
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
2
|
+
if(typeof exports === 'object' && typeof module === 'object')
|
3
|
+
module.exports = factory(require("react"), require("redux"));
|
4
|
+
else if(typeof define === 'function' && define.amd)
|
5
|
+
define(["react", "redux"], factory);
|
6
|
+
else if(typeof exports === 'object')
|
7
|
+
exports["ReactRedux"] = factory(require("react"), require("redux"));
|
8
|
+
else
|
9
|
+
root["ReactRedux"] = factory(root["React"], root["Redux"]);
|
10
|
+
})(this, function(__WEBPACK_EXTERNAL_MODULE_1__, __WEBPACK_EXTERNAL_MODULE_13__) {
|
11
|
+
return /******/ (function(modules) { // webpackBootstrap
|
12
|
+
/******/ // The module cache
|
13
|
+
/******/ var installedModules = {};
|
14
|
+
|
15
|
+
/******/ // The require function
|
16
|
+
/******/ function __webpack_require__(moduleId) {
|
17
|
+
|
18
|
+
/******/ // Check if module is in cache
|
19
|
+
/******/ if(installedModules[moduleId])
|
20
|
+
/******/ return installedModules[moduleId].exports;
|
21
|
+
|
22
|
+
/******/ // Create a new module (and put it into the cache)
|
23
|
+
/******/ var module = installedModules[moduleId] = {
|
24
|
+
/******/ exports: {},
|
25
|
+
/******/ id: moduleId,
|
26
|
+
/******/ loaded: false
|
27
|
+
/******/ };
|
28
|
+
|
29
|
+
/******/ // Execute the module function
|
30
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
31
|
+
|
32
|
+
/******/ // Flag the module as loaded
|
33
|
+
/******/ module.loaded = true;
|
34
|
+
|
35
|
+
/******/ // Return the exports of the module
|
36
|
+
/******/ return module.exports;
|
37
|
+
/******/ }
|
38
|
+
|
39
|
+
|
40
|
+
/******/ // expose the modules object (__webpack_modules__)
|
41
|
+
/******/ __webpack_require__.m = modules;
|
42
|
+
|
43
|
+
/******/ // expose the module cache
|
44
|
+
/******/ __webpack_require__.c = installedModules;
|
45
|
+
|
46
|
+
/******/ // __webpack_public_path__
|
47
|
+
/******/ __webpack_require__.p = "";
|
48
|
+
|
49
|
+
/******/ // Load entry module and return exports
|
50
|
+
/******/ return __webpack_require__(0);
|
51
|
+
/******/ })
|
52
|
+
/************************************************************************/
|
53
|
+
/******/ ([
|
54
|
+
/* 0 */
|
55
|
+
/***/ function(module, exports, __webpack_require__) {
|
56
|
+
|
57
|
+
'use strict';
|
58
|
+
|
59
|
+
exports.__esModule = true;
|
60
|
+
exports.connect = exports.Provider = undefined;
|
61
|
+
|
62
|
+
var _Provider = __webpack_require__(4);
|
63
|
+
|
64
|
+
var _Provider2 = _interopRequireDefault(_Provider);
|
65
|
+
|
66
|
+
var _connect = __webpack_require__(5);
|
67
|
+
|
68
|
+
var _connect2 = _interopRequireDefault(_connect);
|
69
|
+
|
70
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
71
|
+
|
72
|
+
exports.Provider = _Provider2["default"];
|
73
|
+
exports.connect = _connect2["default"];
|
74
|
+
|
75
|
+
/***/ },
|
76
|
+
/* 1 */
|
77
|
+
/***/ function(module, exports) {
|
78
|
+
|
79
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_1__;
|
80
|
+
|
81
|
+
/***/ },
|
82
|
+
/* 2 */
|
83
|
+
/***/ function(module, exports, __webpack_require__) {
|
84
|
+
|
85
|
+
'use strict';
|
86
|
+
|
87
|
+
exports.__esModule = true;
|
88
|
+
|
89
|
+
var _react = __webpack_require__(1);
|
90
|
+
|
91
|
+
exports["default"] = _react.PropTypes.shape({
|
92
|
+
subscribe: _react.PropTypes.func.isRequired,
|
93
|
+
dispatch: _react.PropTypes.func.isRequired,
|
94
|
+
getState: _react.PropTypes.func.isRequired
|
95
|
+
});
|
96
|
+
|
97
|
+
/***/ },
|
98
|
+
/* 3 */
|
99
|
+
/***/ function(module, exports) {
|
100
|
+
|
101
|
+
'use strict';
|
102
|
+
|
103
|
+
exports.__esModule = true;
|
104
|
+
exports["default"] = warning;
|
105
|
+
/**
|
106
|
+
* Prints a warning in the console if it exists.
|
107
|
+
*
|
108
|
+
* @param {String} message The warning message.
|
109
|
+
* @returns {void}
|
110
|
+
*/
|
111
|
+
function warning(message) {
|
112
|
+
/* eslint-disable no-console */
|
113
|
+
if (typeof console !== 'undefined' && typeof console.error === 'function') {
|
114
|
+
console.error(message);
|
115
|
+
}
|
116
|
+
/* eslint-enable no-console */
|
117
|
+
try {
|
118
|
+
// This error was thrown as a convenience so that you can use this stack
|
119
|
+
// to find the callsite that caused this warning to fire.
|
120
|
+
throw new Error(message);
|
121
|
+
/* eslint-disable no-empty */
|
122
|
+
} catch (e) {}
|
123
|
+
/* eslint-enable no-empty */
|
124
|
+
}
|
125
|
+
|
126
|
+
/***/ },
|
127
|
+
/* 4 */
|
128
|
+
/***/ function(module, exports, __webpack_require__) {
|
129
|
+
|
130
|
+
'use strict';
|
131
|
+
|
132
|
+
exports.__esModule = true;
|
133
|
+
exports["default"] = undefined;
|
134
|
+
|
135
|
+
var _react = __webpack_require__(1);
|
136
|
+
|
137
|
+
var _storeShape = __webpack_require__(2);
|
138
|
+
|
139
|
+
var _storeShape2 = _interopRequireDefault(_storeShape);
|
140
|
+
|
141
|
+
var _warning = __webpack_require__(3);
|
142
|
+
|
143
|
+
var _warning2 = _interopRequireDefault(_warning);
|
144
|
+
|
145
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
146
|
+
|
147
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
148
|
+
|
149
|
+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
150
|
+
|
151
|
+
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; }
|
152
|
+
|
153
|
+
var didWarnAboutReceivingStore = false;
|
154
|
+
function warnAboutReceivingStore() {
|
155
|
+
if (didWarnAboutReceivingStore) {
|
156
|
+
return;
|
157
|
+
}
|
158
|
+
didWarnAboutReceivingStore = true;
|
159
|
+
|
160
|
+
(0, _warning2["default"])('<Provider> does not support changing `store` on the fly. ' + 'It is most likely that you see this error because you updated to ' + 'Redux 2.x and React Redux 2.x which no longer hot reload reducers ' + 'automatically. See https://github.com/reactjs/react-redux/releases/' + 'tag/v2.0.0 for the migration instructions.');
|
161
|
+
}
|
162
|
+
|
163
|
+
var Provider = function (_Component) {
|
164
|
+
_inherits(Provider, _Component);
|
165
|
+
|
166
|
+
Provider.prototype.getChildContext = function getChildContext() {
|
167
|
+
return { store: this.store };
|
168
|
+
};
|
169
|
+
|
170
|
+
function Provider(props, context) {
|
171
|
+
_classCallCheck(this, Provider);
|
172
|
+
|
173
|
+
var _this = _possibleConstructorReturn(this, _Component.call(this, props, context));
|
174
|
+
|
175
|
+
_this.store = props.store;
|
176
|
+
return _this;
|
177
|
+
}
|
178
|
+
|
179
|
+
Provider.prototype.render = function render() {
|
180
|
+
var children = this.props.children;
|
181
|
+
|
182
|
+
return _react.Children.only(children);
|
183
|
+
};
|
184
|
+
|
185
|
+
return Provider;
|
186
|
+
}(_react.Component);
|
187
|
+
|
188
|
+
exports["default"] = Provider;
|
189
|
+
|
190
|
+
if (true) {
|
191
|
+
Provider.prototype.componentWillReceiveProps = function (nextProps) {
|
192
|
+
var store = this.store;
|
193
|
+
var nextStore = nextProps.store;
|
194
|
+
|
195
|
+
if (store !== nextStore) {
|
196
|
+
warnAboutReceivingStore();
|
197
|
+
}
|
198
|
+
};
|
199
|
+
}
|
200
|
+
|
201
|
+
Provider.propTypes = {
|
202
|
+
store: _storeShape2["default"].isRequired,
|
203
|
+
children: _react.PropTypes.element.isRequired
|
204
|
+
};
|
205
|
+
Provider.childContextTypes = {
|
206
|
+
store: _storeShape2["default"].isRequired
|
207
|
+
};
|
208
|
+
|
209
|
+
/***/ },
|
210
|
+
/* 5 */
|
211
|
+
/***/ function(module, exports, __webpack_require__) {
|
212
|
+
|
213
|
+
'use strict';
|
214
|
+
|
215
|
+
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; };
|
216
|
+
|
217
|
+
exports.__esModule = true;
|
218
|
+
exports["default"] = connect;
|
219
|
+
|
220
|
+
var _react = __webpack_require__(1);
|
221
|
+
|
222
|
+
var _storeShape = __webpack_require__(2);
|
223
|
+
|
224
|
+
var _storeShape2 = _interopRequireDefault(_storeShape);
|
225
|
+
|
226
|
+
var _shallowEqual = __webpack_require__(6);
|
227
|
+
|
228
|
+
var _shallowEqual2 = _interopRequireDefault(_shallowEqual);
|
229
|
+
|
230
|
+
var _wrapActionCreators = __webpack_require__(7);
|
231
|
+
|
232
|
+
var _wrapActionCreators2 = _interopRequireDefault(_wrapActionCreators);
|
233
|
+
|
234
|
+
var _warning = __webpack_require__(3);
|
235
|
+
|
236
|
+
var _warning2 = _interopRequireDefault(_warning);
|
237
|
+
|
238
|
+
var _isPlainObject = __webpack_require__(12);
|
239
|
+
|
240
|
+
var _isPlainObject2 = _interopRequireDefault(_isPlainObject);
|
241
|
+
|
242
|
+
var _hoistNonReactStatics = __webpack_require__(8);
|
243
|
+
|
244
|
+
var _hoistNonReactStatics2 = _interopRequireDefault(_hoistNonReactStatics);
|
245
|
+
|
246
|
+
var _invariant = __webpack_require__(9);
|
247
|
+
|
248
|
+
var _invariant2 = _interopRequireDefault(_invariant);
|
249
|
+
|
250
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
251
|
+
|
252
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
253
|
+
|
254
|
+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
255
|
+
|
256
|
+
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; }
|
257
|
+
|
258
|
+
var defaultMapStateToProps = function defaultMapStateToProps(state) {
|
259
|
+
return {};
|
260
|
+
}; // eslint-disable-line no-unused-vars
|
261
|
+
var defaultMapDispatchToProps = function defaultMapDispatchToProps(dispatch) {
|
262
|
+
return { dispatch: dispatch };
|
263
|
+
};
|
264
|
+
var defaultMergeProps = function defaultMergeProps(stateProps, dispatchProps, parentProps) {
|
265
|
+
return _extends({}, parentProps, stateProps, dispatchProps);
|
266
|
+
};
|
267
|
+
|
268
|
+
function getDisplayName(WrappedComponent) {
|
269
|
+
return WrappedComponent.displayName || WrappedComponent.name || 'Component';
|
270
|
+
}
|
271
|
+
|
272
|
+
var errorObject = { value: null };
|
273
|
+
function tryCatch(fn, ctx) {
|
274
|
+
try {
|
275
|
+
return fn.apply(ctx);
|
276
|
+
} catch (e) {
|
277
|
+
errorObject.value = e;
|
278
|
+
return errorObject;
|
279
|
+
}
|
280
|
+
}
|
281
|
+
|
282
|
+
// Helps track hot reloading.
|
283
|
+
var nextVersion = 0;
|
284
|
+
|
285
|
+
function connect(mapStateToProps, mapDispatchToProps, mergeProps) {
|
286
|
+
var options = arguments.length <= 3 || arguments[3] === undefined ? {} : arguments[3];
|
287
|
+
|
288
|
+
var shouldSubscribe = Boolean(mapStateToProps);
|
289
|
+
var mapState = mapStateToProps || defaultMapStateToProps;
|
290
|
+
|
291
|
+
var mapDispatch = undefined;
|
292
|
+
if (typeof mapDispatchToProps === 'function') {
|
293
|
+
mapDispatch = mapDispatchToProps;
|
294
|
+
} else if (!mapDispatchToProps) {
|
295
|
+
mapDispatch = defaultMapDispatchToProps;
|
296
|
+
} else {
|
297
|
+
mapDispatch = (0, _wrapActionCreators2["default"])(mapDispatchToProps);
|
298
|
+
}
|
299
|
+
|
300
|
+
var finalMergeProps = mergeProps || defaultMergeProps;
|
301
|
+
var _options$pure = options.pure;
|
302
|
+
var pure = _options$pure === undefined ? true : _options$pure;
|
303
|
+
var _options$withRef = options.withRef;
|
304
|
+
var withRef = _options$withRef === undefined ? false : _options$withRef;
|
305
|
+
|
306
|
+
var checkMergedEquals = pure && finalMergeProps !== defaultMergeProps;
|
307
|
+
|
308
|
+
// Helps track hot reloading.
|
309
|
+
var version = nextVersion++;
|
310
|
+
|
311
|
+
return function wrapWithConnect(WrappedComponent) {
|
312
|
+
var connectDisplayName = 'Connect(' + getDisplayName(WrappedComponent) + ')';
|
313
|
+
|
314
|
+
function checkStateShape(props, methodName) {
|
315
|
+
if (!(0, _isPlainObject2["default"])(props)) {
|
316
|
+
(0, _warning2["default"])(methodName + '() in ' + connectDisplayName + ' must return a plain object. ' + ('Instead received ' + props + '.'));
|
317
|
+
}
|
318
|
+
}
|
319
|
+
|
320
|
+
function computeMergedProps(stateProps, dispatchProps, parentProps) {
|
321
|
+
var mergedProps = finalMergeProps(stateProps, dispatchProps, parentProps);
|
322
|
+
if (true) {
|
323
|
+
checkStateShape(mergedProps, 'mergeProps');
|
324
|
+
}
|
325
|
+
return mergedProps;
|
326
|
+
}
|
327
|
+
|
328
|
+
var Connect = function (_Component) {
|
329
|
+
_inherits(Connect, _Component);
|
330
|
+
|
331
|
+
Connect.prototype.shouldComponentUpdate = function shouldComponentUpdate() {
|
332
|
+
return !pure || this.haveOwnPropsChanged || this.hasStoreStateChanged;
|
333
|
+
};
|
334
|
+
|
335
|
+
function Connect(props, context) {
|
336
|
+
_classCallCheck(this, Connect);
|
337
|
+
|
338
|
+
var _this = _possibleConstructorReturn(this, _Component.call(this, props, context));
|
339
|
+
|
340
|
+
_this.version = version;
|
341
|
+
_this.store = props.store || context.store;
|
342
|
+
|
343
|
+
(0, _invariant2["default"])(_this.store, 'Could not find "store" in either the context or ' + ('props of "' + connectDisplayName + '". ') + 'Either wrap the root component in a <Provider>, ' + ('or explicitly pass "store" as a prop to "' + connectDisplayName + '".'));
|
344
|
+
|
345
|
+
var storeState = _this.store.getState();
|
346
|
+
_this.state = { storeState: storeState };
|
347
|
+
_this.clearCache();
|
348
|
+
return _this;
|
349
|
+
}
|
350
|
+
|
351
|
+
Connect.prototype.computeStateProps = function computeStateProps(store, props) {
|
352
|
+
if (!this.finalMapStateToProps) {
|
353
|
+
return this.configureFinalMapState(store, props);
|
354
|
+
}
|
355
|
+
|
356
|
+
var state = store.getState();
|
357
|
+
var stateProps = this.doStatePropsDependOnOwnProps ? this.finalMapStateToProps(state, props) : this.finalMapStateToProps(state);
|
358
|
+
|
359
|
+
if (true) {
|
360
|
+
checkStateShape(stateProps, 'mapStateToProps');
|
361
|
+
}
|
362
|
+
return stateProps;
|
363
|
+
};
|
364
|
+
|
365
|
+
Connect.prototype.configureFinalMapState = function configureFinalMapState(store, props) {
|
366
|
+
var mappedState = mapState(store.getState(), props);
|
367
|
+
var isFactory = typeof mappedState === 'function';
|
368
|
+
|
369
|
+
this.finalMapStateToProps = isFactory ? mappedState : mapState;
|
370
|
+
this.doStatePropsDependOnOwnProps = this.finalMapStateToProps.length !== 1;
|
371
|
+
|
372
|
+
if (isFactory) {
|
373
|
+
return this.computeStateProps(store, props);
|
374
|
+
}
|
375
|
+
|
376
|
+
if (true) {
|
377
|
+
checkStateShape(mappedState, 'mapStateToProps');
|
378
|
+
}
|
379
|
+
return mappedState;
|
380
|
+
};
|
381
|
+
|
382
|
+
Connect.prototype.computeDispatchProps = function computeDispatchProps(store, props) {
|
383
|
+
if (!this.finalMapDispatchToProps) {
|
384
|
+
return this.configureFinalMapDispatch(store, props);
|
385
|
+
}
|
386
|
+
|
387
|
+
var dispatch = store.dispatch;
|
388
|
+
|
389
|
+
var dispatchProps = this.doDispatchPropsDependOnOwnProps ? this.finalMapDispatchToProps(dispatch, props) : this.finalMapDispatchToProps(dispatch);
|
390
|
+
|
391
|
+
if (true) {
|
392
|
+
checkStateShape(dispatchProps, 'mapDispatchToProps');
|
393
|
+
}
|
394
|
+
return dispatchProps;
|
395
|
+
};
|
396
|
+
|
397
|
+
Connect.prototype.configureFinalMapDispatch = function configureFinalMapDispatch(store, props) {
|
398
|
+
var mappedDispatch = mapDispatch(store.dispatch, props);
|
399
|
+
var isFactory = typeof mappedDispatch === 'function';
|
400
|
+
|
401
|
+
this.finalMapDispatchToProps = isFactory ? mappedDispatch : mapDispatch;
|
402
|
+
this.doDispatchPropsDependOnOwnProps = this.finalMapDispatchToProps.length !== 1;
|
403
|
+
|
404
|
+
if (isFactory) {
|
405
|
+
return this.computeDispatchProps(store, props);
|
406
|
+
}
|
407
|
+
|
408
|
+
if (true) {
|
409
|
+
checkStateShape(mappedDispatch, 'mapDispatchToProps');
|
410
|
+
}
|
411
|
+
return mappedDispatch;
|
412
|
+
};
|
413
|
+
|
414
|
+
Connect.prototype.updateStatePropsIfNeeded = function updateStatePropsIfNeeded() {
|
415
|
+
var nextStateProps = this.computeStateProps(this.store, this.props);
|
416
|
+
if (this.stateProps && (0, _shallowEqual2["default"])(nextStateProps, this.stateProps)) {
|
417
|
+
return false;
|
418
|
+
}
|
419
|
+
|
420
|
+
this.stateProps = nextStateProps;
|
421
|
+
return true;
|
422
|
+
};
|
423
|
+
|
424
|
+
Connect.prototype.updateDispatchPropsIfNeeded = function updateDispatchPropsIfNeeded() {
|
425
|
+
var nextDispatchProps = this.computeDispatchProps(this.store, this.props);
|
426
|
+
if (this.dispatchProps && (0, _shallowEqual2["default"])(nextDispatchProps, this.dispatchProps)) {
|
427
|
+
return false;
|
428
|
+
}
|
429
|
+
|
430
|
+
this.dispatchProps = nextDispatchProps;
|
431
|
+
return true;
|
432
|
+
};
|
433
|
+
|
434
|
+
Connect.prototype.updateMergedPropsIfNeeded = function updateMergedPropsIfNeeded() {
|
435
|
+
var nextMergedProps = computeMergedProps(this.stateProps, this.dispatchProps, this.props);
|
436
|
+
if (this.mergedProps && checkMergedEquals && (0, _shallowEqual2["default"])(nextMergedProps, this.mergedProps)) {
|
437
|
+
return false;
|
438
|
+
}
|
439
|
+
|
440
|
+
this.mergedProps = nextMergedProps;
|
441
|
+
return true;
|
442
|
+
};
|
443
|
+
|
444
|
+
Connect.prototype.isSubscribed = function isSubscribed() {
|
445
|
+
return typeof this.unsubscribe === 'function';
|
446
|
+
};
|
447
|
+
|
448
|
+
Connect.prototype.trySubscribe = function trySubscribe() {
|
449
|
+
if (shouldSubscribe && !this.unsubscribe) {
|
450
|
+
this.unsubscribe = this.store.subscribe(this.handleChange.bind(this));
|
451
|
+
this.handleChange();
|
452
|
+
}
|
453
|
+
};
|
454
|
+
|
455
|
+
Connect.prototype.tryUnsubscribe = function tryUnsubscribe() {
|
456
|
+
if (this.unsubscribe) {
|
457
|
+
this.unsubscribe();
|
458
|
+
this.unsubscribe = null;
|
459
|
+
}
|
460
|
+
};
|
461
|
+
|
462
|
+
Connect.prototype.componentDidMount = function componentDidMount() {
|
463
|
+
this.trySubscribe();
|
464
|
+
};
|
465
|
+
|
466
|
+
Connect.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
467
|
+
if (!pure || !(0, _shallowEqual2["default"])(nextProps, this.props)) {
|
468
|
+
this.haveOwnPropsChanged = true;
|
469
|
+
}
|
470
|
+
};
|
471
|
+
|
472
|
+
Connect.prototype.componentWillUnmount = function componentWillUnmount() {
|
473
|
+
this.tryUnsubscribe();
|
474
|
+
this.clearCache();
|
475
|
+
};
|
476
|
+
|
477
|
+
Connect.prototype.clearCache = function clearCache() {
|
478
|
+
this.dispatchProps = null;
|
479
|
+
this.stateProps = null;
|
480
|
+
this.mergedProps = null;
|
481
|
+
this.haveOwnPropsChanged = true;
|
482
|
+
this.hasStoreStateChanged = true;
|
483
|
+
this.haveStatePropsBeenPrecalculated = false;
|
484
|
+
this.statePropsPrecalculationError = null;
|
485
|
+
this.renderedElement = null;
|
486
|
+
this.finalMapDispatchToProps = null;
|
487
|
+
this.finalMapStateToProps = null;
|
488
|
+
};
|
489
|
+
|
490
|
+
Connect.prototype.handleChange = function handleChange() {
|
491
|
+
if (!this.unsubscribe) {
|
492
|
+
return;
|
493
|
+
}
|
494
|
+
|
495
|
+
var storeState = this.store.getState();
|
496
|
+
var prevStoreState = this.state.storeState;
|
497
|
+
if (pure && prevStoreState === storeState) {
|
498
|
+
return;
|
499
|
+
}
|
500
|
+
|
501
|
+
if (pure && !this.doStatePropsDependOnOwnProps) {
|
502
|
+
var haveStatePropsChanged = tryCatch(this.updateStatePropsIfNeeded, this);
|
503
|
+
if (!haveStatePropsChanged) {
|
504
|
+
return;
|
505
|
+
}
|
506
|
+
if (haveStatePropsChanged === errorObject) {
|
507
|
+
this.statePropsPrecalculationError = errorObject.value;
|
508
|
+
}
|
509
|
+
this.haveStatePropsBeenPrecalculated = true;
|
510
|
+
}
|
511
|
+
|
512
|
+
this.hasStoreStateChanged = true;
|
513
|
+
this.setState({ storeState: storeState });
|
514
|
+
};
|
515
|
+
|
516
|
+
Connect.prototype.getWrappedInstance = function getWrappedInstance() {
|
517
|
+
(0, _invariant2["default"])(withRef, 'To access the wrapped instance, you need to specify ' + '{ withRef: true } as the fourth argument of the connect() call.');
|
518
|
+
|
519
|
+
return this.refs.wrappedInstance;
|
520
|
+
};
|
521
|
+
|
522
|
+
Connect.prototype.render = function render() {
|
523
|
+
var haveOwnPropsChanged = this.haveOwnPropsChanged;
|
524
|
+
var hasStoreStateChanged = this.hasStoreStateChanged;
|
525
|
+
var haveStatePropsBeenPrecalculated = this.haveStatePropsBeenPrecalculated;
|
526
|
+
var statePropsPrecalculationError = this.statePropsPrecalculationError;
|
527
|
+
var renderedElement = this.renderedElement;
|
528
|
+
|
529
|
+
this.haveOwnPropsChanged = false;
|
530
|
+
this.hasStoreStateChanged = false;
|
531
|
+
this.haveStatePropsBeenPrecalculated = false;
|
532
|
+
this.statePropsPrecalculationError = null;
|
533
|
+
|
534
|
+
if (statePropsPrecalculationError) {
|
535
|
+
throw statePropsPrecalculationError;
|
536
|
+
}
|
537
|
+
|
538
|
+
var shouldUpdateStateProps = true;
|
539
|
+
var shouldUpdateDispatchProps = true;
|
540
|
+
if (pure && renderedElement) {
|
541
|
+
shouldUpdateStateProps = hasStoreStateChanged || haveOwnPropsChanged && this.doStatePropsDependOnOwnProps;
|
542
|
+
shouldUpdateDispatchProps = haveOwnPropsChanged && this.doDispatchPropsDependOnOwnProps;
|
543
|
+
}
|
544
|
+
|
545
|
+
var haveStatePropsChanged = false;
|
546
|
+
var haveDispatchPropsChanged = false;
|
547
|
+
if (haveStatePropsBeenPrecalculated) {
|
548
|
+
haveStatePropsChanged = true;
|
549
|
+
} else if (shouldUpdateStateProps) {
|
550
|
+
haveStatePropsChanged = this.updateStatePropsIfNeeded();
|
551
|
+
}
|
552
|
+
if (shouldUpdateDispatchProps) {
|
553
|
+
haveDispatchPropsChanged = this.updateDispatchPropsIfNeeded();
|
554
|
+
}
|
555
|
+
|
556
|
+
var haveMergedPropsChanged = true;
|
557
|
+
if (haveStatePropsChanged || haveDispatchPropsChanged || haveOwnPropsChanged) {
|
558
|
+
haveMergedPropsChanged = this.updateMergedPropsIfNeeded();
|
559
|
+
} else {
|
560
|
+
haveMergedPropsChanged = false;
|
561
|
+
}
|
562
|
+
|
563
|
+
if (!haveMergedPropsChanged && renderedElement) {
|
564
|
+
return renderedElement;
|
565
|
+
}
|
566
|
+
|
567
|
+
if (withRef) {
|
568
|
+
this.renderedElement = (0, _react.createElement)(WrappedComponent, _extends({}, this.mergedProps, {
|
569
|
+
ref: 'wrappedInstance'
|
570
|
+
}));
|
571
|
+
} else {
|
572
|
+
this.renderedElement = (0, _react.createElement)(WrappedComponent, this.mergedProps);
|
573
|
+
}
|
574
|
+
|
575
|
+
return this.renderedElement;
|
576
|
+
};
|
577
|
+
|
578
|
+
return Connect;
|
579
|
+
}(_react.Component);
|
580
|
+
|
581
|
+
Connect.displayName = connectDisplayName;
|
582
|
+
Connect.WrappedComponent = WrappedComponent;
|
583
|
+
Connect.contextTypes = {
|
584
|
+
store: _storeShape2["default"]
|
585
|
+
};
|
586
|
+
Connect.propTypes = {
|
587
|
+
store: _storeShape2["default"]
|
588
|
+
};
|
589
|
+
|
590
|
+
if (true) {
|
591
|
+
Connect.prototype.componentWillUpdate = function componentWillUpdate() {
|
592
|
+
if (this.version === version) {
|
593
|
+
return;
|
594
|
+
}
|
595
|
+
|
596
|
+
// We are hot reloading!
|
597
|
+
this.version = version;
|
598
|
+
this.trySubscribe();
|
599
|
+
this.clearCache();
|
600
|
+
};
|
601
|
+
}
|
602
|
+
|
603
|
+
return (0, _hoistNonReactStatics2["default"])(Connect, WrappedComponent);
|
604
|
+
};
|
605
|
+
}
|
606
|
+
|
607
|
+
/***/ },
|
608
|
+
/* 6 */
|
609
|
+
/***/ function(module, exports) {
|
610
|
+
|
611
|
+
"use strict";
|
612
|
+
|
613
|
+
exports.__esModule = true;
|
614
|
+
exports["default"] = shallowEqual;
|
615
|
+
function shallowEqual(objA, objB) {
|
616
|
+
if (objA === objB) {
|
617
|
+
return true;
|
618
|
+
}
|
619
|
+
|
620
|
+
var keysA = Object.keys(objA);
|
621
|
+
var keysB = Object.keys(objB);
|
622
|
+
|
623
|
+
if (keysA.length !== keysB.length) {
|
624
|
+
return false;
|
625
|
+
}
|
626
|
+
|
627
|
+
// Test for A's keys different from B.
|
628
|
+
var hasOwn = Object.prototype.hasOwnProperty;
|
629
|
+
for (var i = 0; i < keysA.length; i++) {
|
630
|
+
if (!hasOwn.call(objB, keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) {
|
631
|
+
return false;
|
632
|
+
}
|
633
|
+
}
|
634
|
+
|
635
|
+
return true;
|
636
|
+
}
|
637
|
+
|
638
|
+
/***/ },
|
639
|
+
/* 7 */
|
640
|
+
/***/ function(module, exports, __webpack_require__) {
|
641
|
+
|
642
|
+
'use strict';
|
643
|
+
|
644
|
+
exports.__esModule = true;
|
645
|
+
exports["default"] = wrapActionCreators;
|
646
|
+
|
647
|
+
var _redux = __webpack_require__(13);
|
648
|
+
|
649
|
+
function wrapActionCreators(actionCreators) {
|
650
|
+
return function (dispatch) {
|
651
|
+
return (0, _redux.bindActionCreators)(actionCreators, dispatch);
|
652
|
+
};
|
653
|
+
}
|
654
|
+
|
655
|
+
/***/ },
|
656
|
+
/* 8 */
|
657
|
+
/***/ function(module, exports) {
|
658
|
+
|
659
|
+
/**
|
660
|
+
* Copyright 2015, Yahoo! Inc.
|
661
|
+
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
|
662
|
+
*/
|
663
|
+
'use strict';
|
664
|
+
|
665
|
+
var REACT_STATICS = {
|
666
|
+
childContextTypes: true,
|
667
|
+
contextTypes: true,
|
668
|
+
defaultProps: true,
|
669
|
+
displayName: true,
|
670
|
+
getDefaultProps: true,
|
671
|
+
mixins: true,
|
672
|
+
propTypes: true,
|
673
|
+
type: true
|
674
|
+
};
|
675
|
+
|
676
|
+
var KNOWN_STATICS = {
|
677
|
+
name: true,
|
678
|
+
length: true,
|
679
|
+
prototype: true,
|
680
|
+
caller: true,
|
681
|
+
arguments: true,
|
682
|
+
arity: true
|
683
|
+
};
|
684
|
+
|
685
|
+
module.exports = function hoistNonReactStatics(targetComponent, sourceComponent) {
|
686
|
+
var keys = Object.getOwnPropertyNames(sourceComponent);
|
687
|
+
for (var i=0; i<keys.length; ++i) {
|
688
|
+
if (!REACT_STATICS[keys[i]] && !KNOWN_STATICS[keys[i]]) {
|
689
|
+
targetComponent[keys[i]] = sourceComponent[keys[i]];
|
690
|
+
}
|
691
|
+
}
|
692
|
+
|
693
|
+
return targetComponent;
|
694
|
+
};
|
695
|
+
|
696
|
+
|
697
|
+
/***/ },
|
698
|
+
/* 9 */
|
699
|
+
/***/ function(module, exports, __webpack_require__) {
|
700
|
+
|
701
|
+
/**
|
702
|
+
* Copyright 2013-2015, Facebook, Inc.
|
703
|
+
* All rights reserved.
|
704
|
+
*
|
705
|
+
* This source code is licensed under the BSD-style license found in the
|
706
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
707
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
708
|
+
*/
|
709
|
+
|
710
|
+
'use strict';
|
711
|
+
|
712
|
+
/**
|
713
|
+
* Use invariant() to assert state which your program assumes to be true.
|
714
|
+
*
|
715
|
+
* Provide sprintf-style format (only %s is supported) and arguments
|
716
|
+
* to provide information about what broke and what you were
|
717
|
+
* expecting.
|
718
|
+
*
|
719
|
+
* The invariant message will be stripped in production, but the invariant
|
720
|
+
* will remain to ensure logic does not differ in production.
|
721
|
+
*/
|
722
|
+
|
723
|
+
var invariant = function(condition, format, a, b, c, d, e, f) {
|
724
|
+
if (true) {
|
725
|
+
if (format === undefined) {
|
726
|
+
throw new Error('invariant requires an error message argument');
|
727
|
+
}
|
728
|
+
}
|
729
|
+
|
730
|
+
if (!condition) {
|
731
|
+
var error;
|
732
|
+
if (format === undefined) {
|
733
|
+
error = new Error(
|
734
|
+
'Minified exception occurred; use the non-minified dev environment ' +
|
735
|
+
'for the full error message and additional helpful warnings.'
|
736
|
+
);
|
737
|
+
} else {
|
738
|
+
var args = [a, b, c, d, e, f];
|
739
|
+
var argIndex = 0;
|
740
|
+
error = new Error(
|
741
|
+
format.replace(/%s/g, function() { return args[argIndex++]; })
|
742
|
+
);
|
743
|
+
error.name = 'Invariant Violation';
|
744
|
+
}
|
745
|
+
|
746
|
+
error.framesToPop = 1; // we don't care about invariant's own frame
|
747
|
+
throw error;
|
748
|
+
}
|
749
|
+
};
|
750
|
+
|
751
|
+
module.exports = invariant;
|
752
|
+
|
753
|
+
|
754
|
+
/***/ },
|
755
|
+
/* 10 */
|
756
|
+
/***/ function(module, exports) {
|
757
|
+
|
758
|
+
/**
|
759
|
+
* Checks if `value` is a host object in IE < 9.
|
760
|
+
*
|
761
|
+
* @private
|
762
|
+
* @param {*} value The value to check.
|
763
|
+
* @returns {boolean} Returns `true` if `value` is a host object, else `false`.
|
764
|
+
*/
|
765
|
+
function isHostObject(value) {
|
766
|
+
// Many host objects are `Object` objects that can coerce to strings
|
767
|
+
// despite having improperly defined `toString` methods.
|
768
|
+
var result = false;
|
769
|
+
if (value != null && typeof value.toString != 'function') {
|
770
|
+
try {
|
771
|
+
result = !!(value + '');
|
772
|
+
} catch (e) {}
|
773
|
+
}
|
774
|
+
return result;
|
775
|
+
}
|
776
|
+
|
777
|
+
module.exports = isHostObject;
|
778
|
+
|
779
|
+
|
780
|
+
/***/ },
|
781
|
+
/* 11 */
|
782
|
+
/***/ function(module, exports) {
|
783
|
+
|
784
|
+
/**
|
785
|
+
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
786
|
+
* and has a `typeof` result of "object".
|
787
|
+
*
|
788
|
+
* @static
|
789
|
+
* @memberOf _
|
790
|
+
* @category Lang
|
791
|
+
* @param {*} value The value to check.
|
792
|
+
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
793
|
+
* @example
|
794
|
+
*
|
795
|
+
* _.isObjectLike({});
|
796
|
+
* // => true
|
797
|
+
*
|
798
|
+
* _.isObjectLike([1, 2, 3]);
|
799
|
+
* // => true
|
800
|
+
*
|
801
|
+
* _.isObjectLike(_.noop);
|
802
|
+
* // => false
|
803
|
+
*
|
804
|
+
* _.isObjectLike(null);
|
805
|
+
* // => false
|
806
|
+
*/
|
807
|
+
function isObjectLike(value) {
|
808
|
+
return !!value && typeof value == 'object';
|
809
|
+
}
|
810
|
+
|
811
|
+
module.exports = isObjectLike;
|
812
|
+
|
813
|
+
|
814
|
+
/***/ },
|
815
|
+
/* 12 */
|
816
|
+
/***/ function(module, exports, __webpack_require__) {
|
817
|
+
|
818
|
+
var isHostObject = __webpack_require__(10),
|
819
|
+
isObjectLike = __webpack_require__(11);
|
820
|
+
|
821
|
+
/** `Object#toString` result references. */
|
822
|
+
var objectTag = '[object Object]';
|
823
|
+
|
824
|
+
/** Used for built-in method references. */
|
825
|
+
var objectProto = Object.prototype;
|
826
|
+
|
827
|
+
/** Used to resolve the decompiled source of functions. */
|
828
|
+
var funcToString = Function.prototype.toString;
|
829
|
+
|
830
|
+
/** Used to infer the `Object` constructor. */
|
831
|
+
var objectCtorString = funcToString.call(Object);
|
832
|
+
|
833
|
+
/**
|
834
|
+
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
835
|
+
* of values.
|
836
|
+
*/
|
837
|
+
var objectToString = objectProto.toString;
|
838
|
+
|
839
|
+
/** Built-in value references. */
|
840
|
+
var getPrototypeOf = Object.getPrototypeOf;
|
841
|
+
|
842
|
+
/**
|
843
|
+
* Checks if `value` is a plain object, that is, an object created by the
|
844
|
+
* `Object` constructor or one with a `[[Prototype]]` of `null`.
|
845
|
+
*
|
846
|
+
* @static
|
847
|
+
* @memberOf _
|
848
|
+
* @category Lang
|
849
|
+
* @param {*} value The value to check.
|
850
|
+
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
|
851
|
+
* @example
|
852
|
+
*
|
853
|
+
* function Foo() {
|
854
|
+
* this.a = 1;
|
855
|
+
* }
|
856
|
+
*
|
857
|
+
* _.isPlainObject(new Foo);
|
858
|
+
* // => false
|
859
|
+
*
|
860
|
+
* _.isPlainObject([1, 2, 3]);
|
861
|
+
* // => false
|
862
|
+
*
|
863
|
+
* _.isPlainObject({ 'x': 0, 'y': 0 });
|
864
|
+
* // => true
|
865
|
+
*
|
866
|
+
* _.isPlainObject(Object.create(null));
|
867
|
+
* // => true
|
868
|
+
*/
|
869
|
+
function isPlainObject(value) {
|
870
|
+
if (!isObjectLike(value) || objectToString.call(value) != objectTag || isHostObject(value)) {
|
871
|
+
return false;
|
872
|
+
}
|
873
|
+
var proto = objectProto;
|
874
|
+
if (typeof value.constructor == 'function') {
|
875
|
+
proto = getPrototypeOf(value);
|
876
|
+
}
|
877
|
+
if (proto === null) {
|
878
|
+
return true;
|
879
|
+
}
|
880
|
+
var Ctor = proto.constructor;
|
881
|
+
return (typeof Ctor == 'function' &&
|
882
|
+
Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString);
|
883
|
+
}
|
884
|
+
|
885
|
+
module.exports = isPlainObject;
|
886
|
+
|
887
|
+
|
888
|
+
/***/ },
|
889
|
+
/* 13 */
|
890
|
+
/***/ function(module, exports) {
|
891
|
+
|
892
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_13__;
|
893
|
+
|
894
|
+
/***/ }
|
895
|
+
/******/ ])
|
896
|
+
});
|
897
|
+
;
|