esp-js-react 6.5.1 → 7.0.0-next.0
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.
- package/.dist/esp-react.js +568 -539
- package/.dist/esp-react.js.map +1 -1
- package/.dist/esp-react.min.js +1 -1
- package/.dist/esp-react.min.js.map +1 -1
- package/.dist/typings/connectableComponent.d.ts +6 -8
- package/.dist/typings/connectableComponentHooks.d.ts +35 -0
- package/.dist/typings/index.d.ts +3 -2
- package/.dist/typings/polimer/polimerExtentsions.d.ts +1 -1
- package/.dist/typings/routerProvider.d.ts +2 -1
- package/.dist/typings/shouldUpdateMixin.d.ts +3 -1
- package/.dist/typings/smartComponent.d.ts +1 -1
- package/.dist/typings/utils.d.ts +1 -1
- package/package.json +9 -9
- package/src/connectableComponent.tsx +3 -5
- package/src/connectableComponentHooks.tsx +67 -0
- package/src/index.ts +18 -3
- package/src/polimer/polimerExtentsions.ts +1 -1
- package/src/routerProvider.tsx +7 -3
- package/tests/connectableComponentTests.tsx +19 -19
- package/tests/indexTests.ts +60 -3
package/.dist/esp-react.js
CHANGED
|
@@ -1,243 +1,233 @@
|
|
|
1
1
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
2
2
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
3
|
-
module.exports = factory(require("
|
|
3
|
+
module.exports = factory(require("esp-js"), require("esp-js-polimer"), require("prop-types"), require("react"));
|
|
4
4
|
else if(typeof define === 'function' && define.amd)
|
|
5
|
-
define(["
|
|
5
|
+
define(["esp-js", "esp-js-polimer", "prop-types", "react"], factory);
|
|
6
6
|
else if(typeof exports === 'object')
|
|
7
|
-
exports["esp-js-react"] = factory(require("
|
|
7
|
+
exports["esp-js-react"] = factory(require("esp-js"), require("esp-js-polimer"), require("prop-types"), require("react"));
|
|
8
8
|
else
|
|
9
|
-
root["esp-js-react"] = factory(root["
|
|
10
|
-
})(
|
|
11
|
-
return /******/ (
|
|
12
|
-
/******/
|
|
13
|
-
/******/ var
|
|
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
|
-
/******/ i: moduleId,
|
|
25
|
-
/******/ l: false,
|
|
26
|
-
/******/ exports: {}
|
|
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.l = 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
|
-
/******/ // define getter function for harmony exports
|
|
47
|
-
/******/ __webpack_require__.d = function(exports, name, getter) {
|
|
48
|
-
/******/ if(!__webpack_require__.o(exports, name)) {
|
|
49
|
-
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
|
50
|
-
/******/ }
|
|
51
|
-
/******/ };
|
|
52
|
-
/******/
|
|
53
|
-
/******/ // define __esModule on exports
|
|
54
|
-
/******/ __webpack_require__.r = function(exports) {
|
|
55
|
-
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
56
|
-
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
57
|
-
/******/ }
|
|
58
|
-
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
59
|
-
/******/ };
|
|
60
|
-
/******/
|
|
61
|
-
/******/ // create a fake namespace object
|
|
62
|
-
/******/ // mode & 1: value is a module id, require it
|
|
63
|
-
/******/ // mode & 2: merge all properties of value into the ns
|
|
64
|
-
/******/ // mode & 4: return value when already ns object
|
|
65
|
-
/******/ // mode & 8|1: behave like require
|
|
66
|
-
/******/ __webpack_require__.t = function(value, mode) {
|
|
67
|
-
/******/ if(mode & 1) value = __webpack_require__(value);
|
|
68
|
-
/******/ if(mode & 8) return value;
|
|
69
|
-
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
|
70
|
-
/******/ var ns = Object.create(null);
|
|
71
|
-
/******/ __webpack_require__.r(ns);
|
|
72
|
-
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
|
73
|
-
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
|
74
|
-
/******/ return ns;
|
|
75
|
-
/******/ };
|
|
76
|
-
/******/
|
|
77
|
-
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
78
|
-
/******/ __webpack_require__.n = function(module) {
|
|
79
|
-
/******/ var getter = module && module.__esModule ?
|
|
80
|
-
/******/ function getDefault() { return module['default']; } :
|
|
81
|
-
/******/ function getModuleExports() { return module; };
|
|
82
|
-
/******/ __webpack_require__.d(getter, 'a', getter);
|
|
83
|
-
/******/ return getter;
|
|
84
|
-
/******/ };
|
|
85
|
-
/******/
|
|
86
|
-
/******/ // Object.prototype.hasOwnProperty.call
|
|
87
|
-
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
|
88
|
-
/******/
|
|
89
|
-
/******/ // __webpack_public_path__
|
|
90
|
-
/******/ __webpack_require__.p = "";
|
|
91
|
-
/******/
|
|
92
|
-
/******/
|
|
93
|
-
/******/ // Load entry module and return exports
|
|
94
|
-
/******/ return __webpack_require__(__webpack_require__.s = 5);
|
|
95
|
-
/******/ })
|
|
96
|
-
/************************************************************************/
|
|
97
|
-
/******/ ([
|
|
98
|
-
/* 0 */
|
|
99
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
9
|
+
root["esp-js-react"] = factory(root["esp-js"], root["esp-js-polimer"], root["prop-types"], root["react"]);
|
|
10
|
+
})(self, (__WEBPACK_EXTERNAL_MODULE__152__, __WEBPACK_EXTERNAL_MODULE__43__, __WEBPACK_EXTERNAL_MODULE__949__, __WEBPACK_EXTERNAL_MODULE__155__) => {
|
|
11
|
+
return /******/ (() => { // webpackBootstrap
|
|
12
|
+
/******/ "use strict";
|
|
13
|
+
/******/ var __webpack_modules__ = ({
|
|
100
14
|
|
|
101
|
-
|
|
15
|
+
/***/ 397:
|
|
16
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
102
17
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
18
|
+
|
|
19
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
20
|
+
var t = {};
|
|
21
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
22
|
+
t[p] = s[p];
|
|
23
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
24
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
25
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
26
|
+
t[p[i]] = s[p[i]];
|
|
27
|
+
}
|
|
28
|
+
return t;
|
|
29
|
+
};
|
|
30
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
31
|
+
exports.connect = exports.ConnectableComponent = void 0;
|
|
32
|
+
const React = __webpack_require__(155);
|
|
33
|
+
const PropTypes = __webpack_require__(949);
|
|
34
|
+
const esp_js_1 = __webpack_require__(152);
|
|
35
|
+
const viewBindingDecorator_1 = __webpack_require__(213);
|
|
36
|
+
const getEspReactRenderModel_1 = __webpack_require__(102);
|
|
37
|
+
const connectableComponentHooks_1 = __webpack_require__(901);
|
|
38
|
+
class ConnectableComponent extends React.Component {
|
|
39
|
+
constructor(props, context) {
|
|
40
|
+
super(props, context);
|
|
41
|
+
this._isMounted = false;
|
|
42
|
+
this._publishEvent = (router, modelId) => (eventType, event) => router.publishEvent(modelId, eventType, event);
|
|
43
|
+
this.state = { model: null, currentModelId: null };
|
|
128
44
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
* It does this using the following order:
|
|
135
|
-
* 1) If a @viewBinding decorator was used and a display context was given, try get a view for that
|
|
136
|
-
* 2) Else if a view was explicitly provided use that
|
|
137
|
-
* 3) Else if a @viewBinding decorator was used and there is a view associated with the default display context, use that view
|
|
138
|
-
* @param model
|
|
139
|
-
* @param props
|
|
140
|
-
* @param displayContext
|
|
141
|
-
* @param view
|
|
142
|
-
*/
|
|
143
|
-
function createViewForModel(model, props, displayContext, view) {
|
|
144
|
-
let finalView = view; // default to that passed in, if any.
|
|
145
|
-
// displayContext = displayContext || DEFAULT_VIEW_KEY;
|
|
146
|
-
// the view decorator isn't on the instance, it's on the constructor function that created that instance
|
|
147
|
-
if (model) {
|
|
148
|
-
let constructorFunction = model.constructor;
|
|
149
|
-
if (constructorFunction._viewMetadata) {
|
|
150
|
-
let viewMetadata = constructorFunction._viewMetadata;
|
|
151
|
-
if (displayContext && viewMetadata.hasRegisteredViewContext(displayContext)) {
|
|
152
|
-
let viewMetadataRegistration = viewMetadata.viewRegistrations[displayContext];
|
|
153
|
-
// we've found a view for the display context, use that
|
|
154
|
-
finalView = viewMetadataRegistration.view;
|
|
155
|
-
}
|
|
156
|
-
// if we've not found a view yet, and one wasn't provided, is there a default one?
|
|
157
|
-
if (!finalView && viewMetadata.hasRegisteredViewContext(exports.DEFAULT_VIEW_KEY)) {
|
|
158
|
-
let viewMetadataRegistration = viewMetadata.viewRegistrations[exports.DEFAULT_VIEW_KEY];
|
|
159
|
-
finalView = viewMetadataRegistration.view;
|
|
160
|
-
}
|
|
45
|
+
componentWillReceiveProps(nextProps, nextContext) {
|
|
46
|
+
const modelId = nextProps.modelId || nextContext.modelId;
|
|
47
|
+
const oldModelId = this._getModelId();
|
|
48
|
+
if (modelId === oldModelId) {
|
|
49
|
+
return;
|
|
161
50
|
}
|
|
51
|
+
if (nextProps.modelId === oldModelId) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
this._tryObserveModel(modelId);
|
|
162
55
|
}
|
|
163
|
-
|
|
164
|
-
|
|
56
|
+
componentDidMount() {
|
|
57
|
+
this._isMounted = true;
|
|
58
|
+
this._tryObserveModel(this._getModelId());
|
|
165
59
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* An ES7 style decorator that associates a model with a view
|
|
171
|
-
* @param view the react component that will be used to display this model
|
|
172
|
-
* @param displayContext an optional context allowing for different views to display the same model
|
|
173
|
-
* @returns {Function}
|
|
174
|
-
*/
|
|
175
|
-
function viewBinding(view, displayContext = exports.DEFAULT_VIEW_KEY) {
|
|
176
|
-
esp_js_1.Guard.isDefined(view, 'view must be defined');
|
|
177
|
-
esp_js_1.Guard.isString(displayContext, 'displayContext must be a string');
|
|
178
|
-
return function (target) {
|
|
179
|
-
let viewMetadata = getMetadata(target);
|
|
180
|
-
if (viewMetadata.hasRegisteredViewContext(displayContext)) {
|
|
181
|
-
throw new Error(`Context ${displayContext} already registered for view`);
|
|
182
|
-
}
|
|
183
|
-
viewMetadata.viewRegistrations[displayContext] = new ViewMetadataRegistration(view, displayContext);
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
exports.viewBinding = viewBinding;
|
|
187
|
-
class ViewMetadata {
|
|
188
|
-
constructor() {
|
|
189
|
-
this._viewRegistrations = {};
|
|
60
|
+
componentWillUnmount() {
|
|
61
|
+
this._isMounted = false;
|
|
62
|
+
this._tryDisposeModelSubscription();
|
|
190
63
|
}
|
|
191
|
-
|
|
192
|
-
|
|
64
|
+
_getModelId() {
|
|
65
|
+
// props override context
|
|
66
|
+
return this.props.modelId || this.context.modelId;
|
|
193
67
|
}
|
|
194
|
-
|
|
195
|
-
|
|
68
|
+
_tryObserveModel(modelId) {
|
|
69
|
+
this._tryDisposeModelSubscription();
|
|
70
|
+
if (!modelId) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
let stateChanged = modelId !== this.state.currentModelId;
|
|
74
|
+
let publishEvent = this.state.publishEvent;
|
|
75
|
+
if (stateChanged) {
|
|
76
|
+
publishEvent = this._publishEvent(this.context.router, modelId);
|
|
77
|
+
}
|
|
78
|
+
let publishProps = this.state.publishProps;
|
|
79
|
+
// We only map the publish props once, as for well behaving components these callbacks should never change
|
|
80
|
+
if (stateChanged && this.props.createPublishEventProps) {
|
|
81
|
+
publishProps = this.props.createPublishEventProps(publishEvent);
|
|
82
|
+
}
|
|
83
|
+
if (stateChanged) {
|
|
84
|
+
this.setState({
|
|
85
|
+
currentModelId: modelId,
|
|
86
|
+
publishEvent,
|
|
87
|
+
publishProps
|
|
88
|
+
});
|
|
89
|
+
this._observationSubscription = this.context.router
|
|
90
|
+
.getModelObservable(modelId)
|
|
91
|
+
.subscribe(model => {
|
|
92
|
+
if (this._isMounted) {
|
|
93
|
+
this.setState({ model });
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
196
97
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
98
|
+
_tryDisposeModelSubscription() {
|
|
99
|
+
if (this._observationSubscription) {
|
|
100
|
+
this._observationSubscription.dispose();
|
|
101
|
+
this._observationSubscription = new esp_js_1.DisposableBase();
|
|
102
|
+
this.setState({ model: null, currentModelId: null, publishProps: null, publishEvent: null });
|
|
103
|
+
}
|
|
203
104
|
}
|
|
204
|
-
|
|
205
|
-
|
|
105
|
+
render() {
|
|
106
|
+
if (this.state.model == null) {
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
let childProps = this._getChildProps();
|
|
110
|
+
let view = (0, viewBindingDecorator_1.createViewForModel)(this.state.model, childProps, this.props.viewContext, this.props.view);
|
|
111
|
+
return (React.createElement(connectableComponentHooks_1.ConnectableComponentHooks, Object.assign({ modelId: this.props.modelId }, childProps), view));
|
|
206
112
|
}
|
|
207
|
-
|
|
208
|
-
|
|
113
|
+
_getChildProps() {
|
|
114
|
+
// consume what this component owns, and let the rest end up in `...rest`
|
|
115
|
+
const _a = this.props, { children, createPublishEventProps, modelId, mapModelToProps, view, viewContext } = _a, rest = __rest(_a, ["children", "createPublishEventProps", "modelId", "mapModelToProps", "view", "viewContext"]);
|
|
116
|
+
const model = this._getRenderModel(this.state.model);
|
|
117
|
+
let childProps = Object.assign(Object.assign(Object.assign({ modelId, router: this.context.router }, rest), this.state.publishProps), { model });
|
|
118
|
+
if (this.props.mapModelToProps) {
|
|
119
|
+
childProps = Object.assign(Object.assign({}, childProps), this.props.mapModelToProps(model, this.state.publishProps));
|
|
120
|
+
}
|
|
121
|
+
return childProps;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Sees if there is a special selector function which can be invoked to return a render model rather than the top level model model itself
|
|
125
|
+
*/
|
|
126
|
+
_getRenderModel(model) {
|
|
127
|
+
// does the given model have a decorated function we can invoke to get a different model to render?
|
|
128
|
+
if (esp_js_1.EspDecoratorUtil.hasMetadata(model)) {
|
|
129
|
+
let metadata = esp_js_1.EspDecoratorUtil.getCustomData(model, getEspReactRenderModel_1.GetEspReactRenderModelConsts.CustomDataKey);
|
|
130
|
+
if (metadata) {
|
|
131
|
+
return model[metadata.functionName]();
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
// else see if there is a function with name GetEspReactRenderModelConsts.HandlerFunctionName we can invoke to get a different model to render?
|
|
135
|
+
let renderModelGetter = model[getEspReactRenderModel_1.GetEspReactRenderModelConsts.HandlerFunctionName];
|
|
136
|
+
if (renderModelGetter && esp_js_1.utils.isFunction(renderModelGetter)) {
|
|
137
|
+
return renderModelGetter.call(model);
|
|
138
|
+
}
|
|
139
|
+
// else just return the default model
|
|
140
|
+
return model;
|
|
209
141
|
}
|
|
210
142
|
}
|
|
211
|
-
exports.
|
|
143
|
+
exports.ConnectableComponent = ConnectableComponent;
|
|
144
|
+
ConnectableComponent.contextTypes = {
|
|
145
|
+
router: PropTypes.instanceOf(esp_js_1.Router).isRequired,
|
|
146
|
+
modelId: PropTypes.string
|
|
147
|
+
};
|
|
148
|
+
const connect = function (mapModelToProps, createPublishEventProps) {
|
|
149
|
+
return function (view) {
|
|
150
|
+
return function (props) {
|
|
151
|
+
const { modelId, viewContext } = props, rest = __rest(props, ["modelId", "viewContext"]);
|
|
152
|
+
return React.createElement(ConnectableComponent, Object.assign({ modelId: modelId, view: view, viewContext: viewContext, createPublishEventProps: createPublishEventProps, mapModelToProps: mapModelToProps }, rest));
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
exports.connect = connect;
|
|
212
157
|
|
|
213
158
|
|
|
214
159
|
/***/ }),
|
|
215
|
-
/* 1 */
|
|
216
|
-
/***/ (function(module, exports) {
|
|
217
|
-
|
|
218
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE__1__;
|
|
219
160
|
|
|
220
|
-
/***/
|
|
221
|
-
|
|
222
|
-
/***/ (function(module, exports) {
|
|
161
|
+
/***/ 901:
|
|
162
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
223
163
|
|
|
224
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE__2__;
|
|
225
164
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
165
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
166
|
+
exports.ConnectableComponentHooks = exports.usePublishModelEventWithEntityKey = exports.PublishModelEventWithEntityKeyContext = exports.usePublishModelEvent = exports.PublishModelEventContext = exports.usePublishEvent = exports.PublishEventContext = exports.useGetModelId = exports.GetModelIdContext = void 0;
|
|
167
|
+
const React = __webpack_require__(155);
|
|
168
|
+
const esp_js_1 = __webpack_require__(152);
|
|
169
|
+
const react_1 = __webpack_require__(155);
|
|
170
|
+
const routerProvider_1 = __webpack_require__(182);
|
|
171
|
+
exports.GetModelIdContext = (0, react_1.createContext)(null);
|
|
172
|
+
/**
|
|
173
|
+
* Returns a function which will return the ID of the model currently being rendered.
|
|
174
|
+
*/
|
|
175
|
+
const useGetModelId = () => (0, react_1.useContext)(exports.GetModelIdContext);
|
|
176
|
+
exports.useGetModelId = useGetModelId;
|
|
177
|
+
exports.PublishEventContext = (0, react_1.createContext)(null);
|
|
178
|
+
/**
|
|
179
|
+
* Returns a function which can be used to publish an event.
|
|
180
|
+
*/
|
|
181
|
+
const usePublishEvent = () => (0, react_1.useContext)(exports.PublishEventContext);
|
|
182
|
+
exports.usePublishEvent = usePublishEvent;
|
|
183
|
+
exports.PublishModelEventContext = (0, react_1.createContext)(null);
|
|
184
|
+
/**
|
|
185
|
+
* Returns a function which can be used to publish an event to the current model being rendered.
|
|
186
|
+
*
|
|
187
|
+
* Effectively, this is a version of usePublishEvent() which closes over the current modelId.
|
|
188
|
+
*/
|
|
189
|
+
const usePublishModelEvent = () => (0, react_1.useContext)(exports.PublishModelEventContext);
|
|
190
|
+
exports.usePublishModelEvent = usePublishModelEvent;
|
|
191
|
+
exports.PublishModelEventWithEntityKeyContext = (0, react_1.createContext)(null);
|
|
192
|
+
/**
|
|
193
|
+
* Returns a function which can be used to publish an event to the current model being rendered, allows an entityKey to be specified.
|
|
194
|
+
*
|
|
195
|
+
* Effectively, this is a version of usePublishEvent() which closes over the current modelId.
|
|
196
|
+
*/
|
|
197
|
+
const usePublishModelEventWithEntityKey = () => (0, react_1.useContext)(exports.PublishModelEventWithEntityKeyContext);
|
|
198
|
+
exports.usePublishModelEventWithEntityKey = usePublishModelEventWithEntityKey;
|
|
199
|
+
const ConnectableComponentHooks = ({ modelId, children }) => {
|
|
200
|
+
const router = (0, routerProvider_1.useRouter)();
|
|
201
|
+
const getModelId = (0, react_1.useCallback)(() => {
|
|
202
|
+
return modelId;
|
|
203
|
+
}, [router, modelId]);
|
|
204
|
+
const publishEvent = (0, react_1.useCallback)((modelIdOrModelAddress, eventType, event) => {
|
|
205
|
+
router.publishEvent(modelIdOrModelAddress, eventType, event);
|
|
206
|
+
}, [router]);
|
|
207
|
+
const publishModelEvent = (0, react_1.useCallback)((eventType, event) => {
|
|
208
|
+
router.publishEvent(modelId, eventType, event);
|
|
209
|
+
}, [router, modelId]);
|
|
210
|
+
const publishModelEventWithEntityKey = (0, react_1.useCallback)((entityKey, eventType, event) => {
|
|
211
|
+
router.publishEvent(new esp_js_1.DefaultModelAddress(modelId, entityKey), eventType, event);
|
|
212
|
+
}, [router, modelId]);
|
|
213
|
+
return (React.createElement(exports.GetModelIdContext.Provider, { value: getModelId },
|
|
214
|
+
React.createElement(exports.PublishEventContext.Provider, { value: publishEvent },
|
|
215
|
+
React.createElement(exports.PublishModelEventContext.Provider, { value: publishModelEvent },
|
|
216
|
+
React.createElement(exports.PublishModelEventWithEntityKeyContext.Provider, { value: publishModelEventWithEntityKey }, children)))));
|
|
217
|
+
};
|
|
218
|
+
exports.ConnectableComponentHooks = ConnectableComponentHooks;
|
|
229
219
|
|
|
230
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE__3__;
|
|
231
220
|
|
|
232
221
|
/***/ }),
|
|
233
|
-
/* 4 */
|
|
234
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
235
222
|
|
|
236
|
-
|
|
223
|
+
/***/ 102:
|
|
224
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
225
|
+
|
|
237
226
|
|
|
238
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
239
|
-
exports.
|
|
240
|
-
|
|
227
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
228
|
+
exports.GetEspReactRenderModelConsts = void 0;
|
|
229
|
+
exports.getEspReactRenderModel = getEspReactRenderModel;
|
|
230
|
+
const esp_js_1 = __webpack_require__(152);
|
|
241
231
|
var GetEspReactRenderModelConsts;
|
|
242
232
|
(function (GetEspReactRenderModelConsts) {
|
|
243
233
|
GetEspReactRenderModelConsts.CustomDataKey = 'GetEspReactRenderModelCustomDataKey';
|
|
@@ -245,7 +235,7 @@ var GetEspReactRenderModelConsts;
|
|
|
245
235
|
* If there is no @getEspReactRenderModel decorator and a function by this name exists on a model, then it will be invoked to identify the sub model which will replaced the `model` prop passed to the child view of a ConnectableComponent
|
|
246
236
|
*/
|
|
247
237
|
GetEspReactRenderModelConsts.HandlerFunctionName = 'getEspReactRenderModel';
|
|
248
|
-
})(GetEspReactRenderModelConsts
|
|
238
|
+
})(GetEspReactRenderModelConsts || (exports.GetEspReactRenderModelConsts = GetEspReactRenderModelConsts = {}));
|
|
249
239
|
/**
|
|
250
240
|
* A decorator which can be used to identify the render model which will replaced the `model` prop passed to the child view of a ConnectableComponent
|
|
251
241
|
*/
|
|
@@ -256,14 +246,13 @@ function getEspReactRenderModel() {
|
|
|
256
246
|
return descriptor;
|
|
257
247
|
};
|
|
258
248
|
}
|
|
259
|
-
exports.getEspReactRenderModel = getEspReactRenderModel;
|
|
260
249
|
|
|
261
250
|
|
|
262
251
|
/***/ }),
|
|
263
|
-
/* 5 */
|
|
264
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
265
252
|
|
|
266
|
-
|
|
253
|
+
/***/ 872:
|
|
254
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
255
|
+
|
|
267
256
|
|
|
268
257
|
// notice_start
|
|
269
258
|
/*
|
|
@@ -285,7 +274,11 @@ exports.getEspReactRenderModel = getEspReactRenderModel;
|
|
|
285
274
|
//
|
|
286
275
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
287
276
|
if (k2 === undefined) k2 = k;
|
|
288
|
-
Object.
|
|
277
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
278
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
279
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
280
|
+
}
|
|
281
|
+
Object.defineProperty(o, k2, desc);
|
|
289
282
|
}) : (function(o, m, k, k2) {
|
|
290
283
|
if (k2 === undefined) k2 = k;
|
|
291
284
|
o[k2] = m[k];
|
|
@@ -293,41 +286,49 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
293
286
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
294
287
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
295
288
|
};
|
|
296
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
297
|
-
exports.PublishModelEventContext = exports.connect = exports.ConnectableComponent = exports.createViewForModel = exports.shouldUpdateMixin = exports.DEFAULT_VIEW_KEY = exports.viewBinding = exports.ViewBinder = exports.SmartComponent = exports.
|
|
289
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
290
|
+
exports.usePublishModelEventWithEntityKey = exports.PublishModelEventWithEntityKeyContext = exports.usePublishModelEvent = exports.PublishModelEventContext = exports.usePublishEvent = exports.PublishEventContext = exports.GetModelIdContext = exports.useGetModelId = exports.connect = exports.ConnectableComponent = exports.createViewForModel = exports.shouldUpdateMixin = exports.DEFAULT_VIEW_KEY = exports.viewBinding = exports.ViewBinder = exports.SmartComponent = exports.useRouter = exports.RouterContext = exports.RouterProvider = void 0;
|
|
298
291
|
// import for side effects
|
|
299
|
-
__webpack_require__(
|
|
300
|
-
var routerProvider_1 = __webpack_require__(
|
|
301
|
-
Object.defineProperty(exports, "RouterProvider", { enumerable: true, get: function () { return routerProvider_1.RouterProvider; } });
|
|
302
|
-
Object.defineProperty(exports, "
|
|
303
|
-
Object.defineProperty(exports, "
|
|
304
|
-
var smartComponent_1 = __webpack_require__(
|
|
305
|
-
Object.defineProperty(exports, "SmartComponent", { enumerable: true, get: function () { return smartComponent_1.SmartComponent; } });
|
|
306
|
-
var viewBinder_1 = __webpack_require__(
|
|
307
|
-
Object.defineProperty(exports, "ViewBinder", { enumerable: true, get: function () { return viewBinder_1.ViewBinder; } });
|
|
308
|
-
var viewBindingDecorator_1 = __webpack_require__(
|
|
309
|
-
Object.defineProperty(exports, "viewBinding", { enumerable: true, get: function () { return viewBindingDecorator_1.viewBinding; } });
|
|
310
|
-
Object.defineProperty(exports, "DEFAULT_VIEW_KEY", { enumerable: true, get: function () { return viewBindingDecorator_1.DEFAULT_VIEW_KEY; } });
|
|
311
|
-
__exportStar(__webpack_require__(
|
|
312
|
-
var shouldUpdateMixin_1 = __webpack_require__(
|
|
313
|
-
Object.defineProperty(exports, "shouldUpdateMixin", { enumerable: true, get: function () { return shouldUpdateMixin_1.shouldUpdateMixin; } });
|
|
314
|
-
var viewBindingDecorator_2 = __webpack_require__(
|
|
315
|
-
Object.defineProperty(exports, "createViewForModel", { enumerable: true, get: function () { return viewBindingDecorator_2.createViewForModel; } });
|
|
316
|
-
var connectableComponent_1 = __webpack_require__(
|
|
317
|
-
Object.defineProperty(exports, "ConnectableComponent", { enumerable: true, get: function () { return connectableComponent_1.ConnectableComponent; } });
|
|
318
|
-
Object.defineProperty(exports, "connect", { enumerable: true, get: function () { return connectableComponent_1.connect; } });
|
|
319
|
-
|
|
292
|
+
__webpack_require__(637);
|
|
293
|
+
var routerProvider_1 = __webpack_require__(182);
|
|
294
|
+
Object.defineProperty(exports, "RouterProvider", ({ enumerable: true, get: function () { return routerProvider_1.RouterProvider; } }));
|
|
295
|
+
Object.defineProperty(exports, "RouterContext", ({ enumerable: true, get: function () { return routerProvider_1.RouterContext; } }));
|
|
296
|
+
Object.defineProperty(exports, "useRouter", ({ enumerable: true, get: function () { return routerProvider_1.useRouter; } }));
|
|
297
|
+
var smartComponent_1 = __webpack_require__(438);
|
|
298
|
+
Object.defineProperty(exports, "SmartComponent", ({ enumerable: true, get: function () { return smartComponent_1.SmartComponent; } }));
|
|
299
|
+
var viewBinder_1 = __webpack_require__(453);
|
|
300
|
+
Object.defineProperty(exports, "ViewBinder", ({ enumerable: true, get: function () { return viewBinder_1.ViewBinder; } }));
|
|
301
|
+
var viewBindingDecorator_1 = __webpack_require__(213);
|
|
302
|
+
Object.defineProperty(exports, "viewBinding", ({ enumerable: true, get: function () { return viewBindingDecorator_1.viewBinding; } }));
|
|
303
|
+
Object.defineProperty(exports, "DEFAULT_VIEW_KEY", ({ enumerable: true, get: function () { return viewBindingDecorator_1.DEFAULT_VIEW_KEY; } }));
|
|
304
|
+
__exportStar(__webpack_require__(102), exports);
|
|
305
|
+
var shouldUpdateMixin_1 = __webpack_require__(79);
|
|
306
|
+
Object.defineProperty(exports, "shouldUpdateMixin", ({ enumerable: true, get: function () { return shouldUpdateMixin_1.shouldUpdateMixin; } }));
|
|
307
|
+
var viewBindingDecorator_2 = __webpack_require__(213);
|
|
308
|
+
Object.defineProperty(exports, "createViewForModel", ({ enumerable: true, get: function () { return viewBindingDecorator_2.createViewForModel; } }));
|
|
309
|
+
var connectableComponent_1 = __webpack_require__(397);
|
|
310
|
+
Object.defineProperty(exports, "ConnectableComponent", ({ enumerable: true, get: function () { return connectableComponent_1.ConnectableComponent; } }));
|
|
311
|
+
Object.defineProperty(exports, "connect", ({ enumerable: true, get: function () { return connectableComponent_1.connect; } }));
|
|
312
|
+
var connectableComponentHooks_1 = __webpack_require__(901);
|
|
313
|
+
Object.defineProperty(exports, "useGetModelId", ({ enumerable: true, get: function () { return connectableComponentHooks_1.useGetModelId; } }));
|
|
314
|
+
Object.defineProperty(exports, "GetModelIdContext", ({ enumerable: true, get: function () { return connectableComponentHooks_1.GetModelIdContext; } }));
|
|
315
|
+
Object.defineProperty(exports, "PublishEventContext", ({ enumerable: true, get: function () { return connectableComponentHooks_1.PublishEventContext; } }));
|
|
316
|
+
Object.defineProperty(exports, "usePublishEvent", ({ enumerable: true, get: function () { return connectableComponentHooks_1.usePublishEvent; } }));
|
|
317
|
+
Object.defineProperty(exports, "PublishModelEventContext", ({ enumerable: true, get: function () { return connectableComponentHooks_1.PublishModelEventContext; } }));
|
|
318
|
+
Object.defineProperty(exports, "usePublishModelEvent", ({ enumerable: true, get: function () { return connectableComponentHooks_1.usePublishModelEvent; } }));
|
|
319
|
+
Object.defineProperty(exports, "PublishModelEventWithEntityKeyContext", ({ enumerable: true, get: function () { return connectableComponentHooks_1.PublishModelEventWithEntityKeyContext; } }));
|
|
320
|
+
Object.defineProperty(exports, "usePublishModelEventWithEntityKey", ({ enumerable: true, get: function () { return connectableComponentHooks_1.usePublishModelEventWithEntityKey; } }));
|
|
320
321
|
|
|
321
322
|
|
|
322
323
|
/***/ }),
|
|
323
|
-
/* 6 */
|
|
324
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
325
324
|
|
|
326
|
-
|
|
325
|
+
/***/ 637:
|
|
326
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
327
327
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
const
|
|
328
|
+
|
|
329
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
330
|
+
const esp_js_polimer_1 = __webpack_require__(43);
|
|
331
|
+
const viewBindingDecorator_1 = __webpack_require__(213);
|
|
331
332
|
esp_js_polimer_1.PolimerModelBuilder.prototype.withViewBindings = function (view, displayContext = viewBindingDecorator_1.DEFAULT_VIEW_KEY) {
|
|
332
333
|
let builder = this;
|
|
333
334
|
// store some metadata on the builder which we'll use later to tack onto the model
|
|
@@ -353,16 +354,10 @@ esp_js_polimer_1.PolimerModelBuilder.prototype.registerWithRouter = function ()
|
|
|
353
354
|
|
|
354
355
|
|
|
355
356
|
/***/ }),
|
|
356
|
-
/* 7 */
|
|
357
|
-
/***/ (function(module, exports) {
|
|
358
|
-
|
|
359
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE__7__;
|
|
360
357
|
|
|
361
|
-
/***/
|
|
362
|
-
|
|
363
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
358
|
+
/***/ 182:
|
|
359
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
364
360
|
|
|
365
|
-
"use strict";
|
|
366
361
|
|
|
367
362
|
// notice_start
|
|
368
363
|
/*
|
|
@@ -381,13 +376,15 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__7__;
|
|
|
381
376
|
* limitations under the License.
|
|
382
377
|
*/
|
|
383
378
|
// notice_end
|
|
384
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
385
|
-
exports.RouterProvider = exports.
|
|
386
|
-
const React = __webpack_require__(
|
|
387
|
-
const PropTypes = __webpack_require__(
|
|
388
|
-
const esp_js_1 = __webpack_require__(
|
|
379
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
380
|
+
exports.RouterProvider = exports.useRouter = exports.RouterContext = void 0;
|
|
381
|
+
const React = __webpack_require__(155);
|
|
382
|
+
const PropTypes = __webpack_require__(949);
|
|
383
|
+
const esp_js_1 = __webpack_require__(152);
|
|
384
|
+
const react_1 = __webpack_require__(155);
|
|
389
385
|
exports.RouterContext = React.createContext(null);
|
|
390
|
-
|
|
386
|
+
const useRouter = () => (0, react_1.useContext)(exports.RouterContext);
|
|
387
|
+
exports.useRouter = useRouter;
|
|
391
388
|
class RouterProvider extends React.Component {
|
|
392
389
|
getChildContext() {
|
|
393
390
|
return {
|
|
@@ -395,7 +392,7 @@ class RouterProvider extends React.Component {
|
|
|
395
392
|
};
|
|
396
393
|
}
|
|
397
394
|
render() {
|
|
398
|
-
return (React.createElement(exports.
|
|
395
|
+
return (React.createElement(exports.RouterContext.Provider, { value: this.props.router }, this.props.children));
|
|
399
396
|
}
|
|
400
397
|
}
|
|
401
398
|
exports.RouterProvider = RouterProvider;
|
|
@@ -405,16 +402,163 @@ RouterProvider.childContextTypes = {
|
|
|
405
402
|
|
|
406
403
|
|
|
407
404
|
/***/ }),
|
|
408
|
-
/* 9 */
|
|
409
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
410
405
|
|
|
411
|
-
|
|
406
|
+
/***/ 234:
|
|
407
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
412
408
|
|
|
413
|
-
//
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
*
|
|
409
|
+
// taken from fbjs:
|
|
410
|
+
// https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/core/shallowEqual.js
|
|
411
|
+
// Licence (MIT) https://github.com/facebook/fbjs/blob/master/packages/fbjs/LICENSE
|
|
412
|
+
/**
|
|
413
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
414
|
+
*
|
|
415
|
+
* This source code is licensed under the MIT license found in the
|
|
416
|
+
* LICENSE file in the root directory of this source tree.
|
|
417
|
+
*
|
|
418
|
+
* @providesModule shallowEqual
|
|
419
|
+
* @typechecks
|
|
420
|
+
* @flow
|
|
421
|
+
*/
|
|
422
|
+
/*eslint-disable no-self-compare */
|
|
423
|
+
|
|
424
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
425
|
+
exports.is = is;
|
|
426
|
+
exports.shallowEqual = shallowEqual;
|
|
427
|
+
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
428
|
+
/**
|
|
429
|
+
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
|
430
|
+
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
431
|
+
*/
|
|
432
|
+
function is(x, y) {
|
|
433
|
+
// SameValue algorithm
|
|
434
|
+
if (x === y) { // Steps 1-5, 7-10
|
|
435
|
+
// Steps 6.b-6.e: +0 != -0
|
|
436
|
+
// Added the nonzero y check to make Flow happy, but it is redundant
|
|
437
|
+
return x !== 0 || y !== 0 || 1 / x === 1 / y;
|
|
438
|
+
}
|
|
439
|
+
else {
|
|
440
|
+
// Step 6.a: NaN == NaN
|
|
441
|
+
return x !== x && y !== y;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* Performs equality by iterating through keys on an object and returning false
|
|
446
|
+
* when any key has values which are not strictly equal between the arguments.
|
|
447
|
+
* Returns true when the values of all keys are strictly equal.
|
|
448
|
+
*/
|
|
449
|
+
function shallowEqual(objA, objB) {
|
|
450
|
+
if (is(objA, objB)) {
|
|
451
|
+
return true;
|
|
452
|
+
}
|
|
453
|
+
if (typeof objA !== 'object' || objA === null ||
|
|
454
|
+
typeof objB !== 'object' || objB === null) {
|
|
455
|
+
return false;
|
|
456
|
+
}
|
|
457
|
+
const keysA = Object.keys(objA);
|
|
458
|
+
const keysB = Object.keys(objB);
|
|
459
|
+
if (keysA.length !== keysB.length) {
|
|
460
|
+
return false;
|
|
461
|
+
}
|
|
462
|
+
// Test for A's keys different from B.
|
|
463
|
+
for (let i = 0; i < keysA.length; i++) {
|
|
464
|
+
if (!hasOwnProperty.call(objB, keysA[i]) ||
|
|
465
|
+
!is(objA[keysA[i]], objB[keysA[i]])) {
|
|
466
|
+
return false;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
return true;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
/***/ }),
|
|
474
|
+
|
|
475
|
+
/***/ 79:
|
|
476
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
477
|
+
|
|
478
|
+
|
|
479
|
+
// notice_start
|
|
480
|
+
/*
|
|
481
|
+
* Copyright 2018 Keith Woods
|
|
482
|
+
*
|
|
483
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
484
|
+
* you may not use this file except in compliance with the License.
|
|
485
|
+
* You may obtain a copy of the License at
|
|
486
|
+
*
|
|
487
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
488
|
+
*
|
|
489
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
490
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
491
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
492
|
+
* See the License for the specific language governing permissions and
|
|
493
|
+
* limitations under the License.
|
|
494
|
+
*/
|
|
495
|
+
// notice_end
|
|
496
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
497
|
+
exports.shouldUpdateMixin = shouldUpdateMixin;
|
|
498
|
+
const React = __webpack_require__(155);
|
|
499
|
+
const shallowEqual_1 = __webpack_require__(234);
|
|
500
|
+
// WORKS (compiles at least):
|
|
501
|
+
//
|
|
502
|
+
// export function shouldUpdateMixin<TProps, TState, TPropBindings>(itemsThatEffectUpdateSelector: (nextProps: TProps) => TPropBindings) {
|
|
503
|
+
// return function <T extends {new(...args:any[]):{}}>(constructor:T) {
|
|
504
|
+
// return class extends constructor {
|
|
505
|
+
// _propBindings : {};
|
|
506
|
+
// shouldComponentUpdate(nextProps, nextState) {
|
|
507
|
+
// let newBindings = itemsThatEffectUpdateSelector(nextProps);
|
|
508
|
+
// let bindingsAreEqual = shallowEqual(this._propBindings, newBindings);
|
|
509
|
+
// this._propBindings = newBindings;
|
|
510
|
+
// return !bindingsAreEqual;
|
|
511
|
+
// }
|
|
512
|
+
// render() {
|
|
513
|
+
// return React.createElement(<any>constructor, (<any>this).props);
|
|
514
|
+
// }
|
|
515
|
+
// };
|
|
516
|
+
// };
|
|
517
|
+
// }
|
|
518
|
+
function shouldUpdateMixin(itemsThatEffectUpdateSelector) {
|
|
519
|
+
return function (Constructor) {
|
|
520
|
+
return class extends Constructor {
|
|
521
|
+
shouldComponentUpdate(nextProps, nextState) {
|
|
522
|
+
let newBindings = itemsThatEffectUpdateSelector(nextProps);
|
|
523
|
+
let bindingsAreEqual = (0, shallowEqual_1.shallowEqual)(this._propBindings, newBindings);
|
|
524
|
+
this._propBindings = newBindings;
|
|
525
|
+
return !bindingsAreEqual;
|
|
526
|
+
}
|
|
527
|
+
render() {
|
|
528
|
+
return React.createElement(Constructor, this.props);
|
|
529
|
+
}
|
|
530
|
+
};
|
|
531
|
+
};
|
|
532
|
+
}
|
|
533
|
+
// export function shouldUpdateMixin<TProps, TState, TPropBindings>(itemsThatEffectUpdateSelector: (nextProps: TProps) => TPropBindings) {
|
|
534
|
+
// return function(Comp: React.ComponentClass<TProps, TState>) {
|
|
535
|
+
// return class extends React.Component<TProps, TState> {
|
|
536
|
+
// _propBindings : {};
|
|
537
|
+
// shouldComponentUpdate(nextProps, nextState) {
|
|
538
|
+
// let newBindings = itemsThatEffectUpdateSelector(nextProps);
|
|
539
|
+
// let bindingsAreEqual = shallowEqual(this._propBindings, newBindings);
|
|
540
|
+
// this._propBindings = newBindings;
|
|
541
|
+
// return !bindingsAreEqual;
|
|
542
|
+
// }
|
|
543
|
+
// render() {
|
|
544
|
+
// return React.createElement(Comp, this.props);
|
|
545
|
+
// }
|
|
546
|
+
// };
|
|
547
|
+
// };
|
|
548
|
+
// }
|
|
549
|
+
|
|
550
|
+
|
|
551
|
+
/***/ }),
|
|
552
|
+
|
|
553
|
+
/***/ 438:
|
|
554
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
555
|
+
|
|
556
|
+
|
|
557
|
+
// notice_start
|
|
558
|
+
/*
|
|
559
|
+
* Copyright 2015 Dev Shop Limited
|
|
560
|
+
*
|
|
561
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
418
562
|
* you may not use this file except in compliance with the License.
|
|
419
563
|
* You may obtain a copy of the License at
|
|
420
564
|
*
|
|
@@ -438,12 +582,12 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
438
582
|
}
|
|
439
583
|
return t;
|
|
440
584
|
};
|
|
441
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
585
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
442
586
|
exports.SmartComponent = void 0;
|
|
443
|
-
const React = __webpack_require__(
|
|
444
|
-
const PropTypes = __webpack_require__(
|
|
445
|
-
const viewBindingDecorator_1 = __webpack_require__(
|
|
446
|
-
const esp_js_1 = __webpack_require__(
|
|
587
|
+
const React = __webpack_require__(155);
|
|
588
|
+
const PropTypes = __webpack_require__(949);
|
|
589
|
+
const viewBindingDecorator_1 = __webpack_require__(213);
|
|
590
|
+
const esp_js_1 = __webpack_require__(152);
|
|
447
591
|
class SmartComponent extends React.Component {
|
|
448
592
|
constructor() {
|
|
449
593
|
super(...arguments);
|
|
@@ -508,10 +652,10 @@ SmartComponent.contextTypes = {
|
|
|
508
652
|
|
|
509
653
|
|
|
510
654
|
/***/ }),
|
|
511
|
-
/* 10 */
|
|
512
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
513
655
|
|
|
514
|
-
|
|
656
|
+
/***/ 453:
|
|
657
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
658
|
+
|
|
515
659
|
|
|
516
660
|
// notice_start
|
|
517
661
|
/*
|
|
@@ -541,12 +685,12 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
541
685
|
}
|
|
542
686
|
return t;
|
|
543
687
|
};
|
|
544
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
688
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
545
689
|
exports.ViewBinder = void 0;
|
|
546
|
-
const esp = __webpack_require__(
|
|
547
|
-
const React = __webpack_require__(
|
|
548
|
-
const PropTypes = __webpack_require__(
|
|
549
|
-
const viewBindingDecorator_1 = __webpack_require__(
|
|
690
|
+
const esp = __webpack_require__(152);
|
|
691
|
+
const React = __webpack_require__(155);
|
|
692
|
+
const PropTypes = __webpack_require__(949);
|
|
693
|
+
const viewBindingDecorator_1 = __webpack_require__(213);
|
|
550
694
|
class ViewBinder extends React.Component {
|
|
551
695
|
render() {
|
|
552
696
|
if (this.props.model) {
|
|
@@ -564,14 +708,14 @@ ViewBinder.contextTypes = {
|
|
|
564
708
|
|
|
565
709
|
|
|
566
710
|
/***/ }),
|
|
567
|
-
/* 11 */
|
|
568
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
569
711
|
|
|
570
|
-
|
|
712
|
+
/***/ 213:
|
|
713
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
714
|
+
|
|
571
715
|
|
|
572
716
|
// notice_start
|
|
573
717
|
/*
|
|
574
|
-
* Copyright
|
|
718
|
+
* Copyright 2015 Dev Shop Limited
|
|
575
719
|
*
|
|
576
720
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
577
721
|
* you may not use this file except in compliance with the License.
|
|
@@ -586,280 +730,165 @@ ViewBinder.contextTypes = {
|
|
|
586
730
|
* limitations under the License.
|
|
587
731
|
*/
|
|
588
732
|
// notice_end
|
|
589
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
590
|
-
exports.
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
// let bindingsAreEqual = shallowEqual(this._propBindings, newBindings);
|
|
602
|
-
// this._propBindings = newBindings;
|
|
603
|
-
// return !bindingsAreEqual;
|
|
604
|
-
// }
|
|
605
|
-
// render() {
|
|
606
|
-
// return React.createElement(<any>constructor, (<any>this).props);
|
|
607
|
-
// }
|
|
608
|
-
// };
|
|
609
|
-
// };
|
|
610
|
-
// }
|
|
611
|
-
function shouldUpdateMixin(itemsThatEffectUpdateSelector) {
|
|
612
|
-
return function (Constructor) {
|
|
613
|
-
return class extends Constructor {
|
|
614
|
-
shouldComponentUpdate(nextProps, nextState) {
|
|
615
|
-
let newBindings = itemsThatEffectUpdateSelector(nextProps);
|
|
616
|
-
let bindingsAreEqual = (0, shallowEqual_1.shallowEqual)(this._propBindings, newBindings);
|
|
617
|
-
this._propBindings = newBindings;
|
|
618
|
-
return !bindingsAreEqual;
|
|
619
|
-
}
|
|
620
|
-
render() {
|
|
621
|
-
return React.createElement(Constructor, this.props);
|
|
622
|
-
}
|
|
623
|
-
};
|
|
624
|
-
};
|
|
733
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
734
|
+
exports.ViewMetadataRegistration = exports.ViewMetadata = exports.DEFAULT_VIEW_KEY = void 0;
|
|
735
|
+
exports.createViewForModel = createViewForModel;
|
|
736
|
+
exports.viewBinding = viewBinding;
|
|
737
|
+
const React = __webpack_require__(155);
|
|
738
|
+
const esp_js_1 = __webpack_require__(152);
|
|
739
|
+
exports.DEFAULT_VIEW_KEY = 'default-view-key';
|
|
740
|
+
function getMetadata(target) {
|
|
741
|
+
if (!target._viewMetadata) {
|
|
742
|
+
target._viewMetadata = new ViewMetadata();
|
|
743
|
+
}
|
|
744
|
+
return target._viewMetadata;
|
|
625
745
|
}
|
|
626
|
-
exports.shouldUpdateMixin = shouldUpdateMixin;
|
|
627
|
-
// export function shouldUpdateMixin<TProps, TState, TPropBindings>(itemsThatEffectUpdateSelector: (nextProps: TProps) => TPropBindings) {
|
|
628
|
-
// return function(Comp: React.ComponentClass<TProps, TState>) {
|
|
629
|
-
// return class extends React.Component<TProps, TState> {
|
|
630
|
-
// _propBindings : {};
|
|
631
|
-
// shouldComponentUpdate(nextProps, nextState) {
|
|
632
|
-
// let newBindings = itemsThatEffectUpdateSelector(nextProps);
|
|
633
|
-
// let bindingsAreEqual = shallowEqual(this._propBindings, newBindings);
|
|
634
|
-
// this._propBindings = newBindings;
|
|
635
|
-
// return !bindingsAreEqual;
|
|
636
|
-
// }
|
|
637
|
-
// render() {
|
|
638
|
-
// return React.createElement(Comp, this.props);
|
|
639
|
-
// }
|
|
640
|
-
// };
|
|
641
|
-
// };
|
|
642
|
-
// }
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
/***/ }),
|
|
646
|
-
/* 12 */
|
|
647
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
648
|
-
|
|
649
|
-
"use strict";
|
|
650
|
-
// taken from fbjs:
|
|
651
|
-
// https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/core/shallowEqual.js
|
|
652
|
-
// Licence (MIT) https://github.com/facebook/fbjs/blob/master/packages/fbjs/LICENSE
|
|
653
746
|
/**
|
|
654
|
-
*
|
|
655
|
-
*
|
|
656
|
-
* This source code is licensed under the MIT license found in the
|
|
657
|
-
* LICENSE file in the root directory of this source tree.
|
|
747
|
+
* Tries to get a view for the given model.
|
|
658
748
|
*
|
|
659
|
-
*
|
|
660
|
-
* @
|
|
661
|
-
*
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
668
|
-
/**
|
|
669
|
-
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
|
670
|
-
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
749
|
+
* It does this using the following order:
|
|
750
|
+
* 1) If a @viewBinding decorator was used and a display context was given, try get a view for that
|
|
751
|
+
* 2) Else if a view was explicitly provided use that
|
|
752
|
+
* 3) Else if a @viewBinding decorator was used and there is a view associated with the default display context, use that view
|
|
753
|
+
* @param model
|
|
754
|
+
* @param props
|
|
755
|
+
* @param displayContext
|
|
756
|
+
* @param view
|
|
671
757
|
*/
|
|
672
|
-
function
|
|
673
|
-
//
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
758
|
+
function createViewForModel(model, props, displayContext, view) {
|
|
759
|
+
let finalView = view; // default to that passed in, if any.
|
|
760
|
+
// displayContext = displayContext || DEFAULT_VIEW_KEY;
|
|
761
|
+
// the view decorator isn't on the instance, it's on the constructor function that created that instance
|
|
762
|
+
if (model) {
|
|
763
|
+
let constructorFunction = model.constructor;
|
|
764
|
+
if (constructorFunction._viewMetadata) {
|
|
765
|
+
let viewMetadata = constructorFunction._viewMetadata;
|
|
766
|
+
if (displayContext && viewMetadata.hasRegisteredViewContext(displayContext)) {
|
|
767
|
+
let viewMetadataRegistration = viewMetadata.viewRegistrations[displayContext];
|
|
768
|
+
// we've found a view for the display context, use that
|
|
769
|
+
finalView = viewMetadataRegistration.view;
|
|
770
|
+
}
|
|
771
|
+
// if we've not found a view yet, and one wasn't provided, is there a default one?
|
|
772
|
+
if (!finalView && viewMetadata.hasRegisteredViewContext(exports.DEFAULT_VIEW_KEY)) {
|
|
773
|
+
let viewMetadataRegistration = viewMetadata.viewRegistrations[exports.DEFAULT_VIEW_KEY];
|
|
774
|
+
finalView = viewMetadataRegistration.view;
|
|
775
|
+
}
|
|
776
|
+
}
|
|
678
777
|
}
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
return x !== x && y !== y;
|
|
778
|
+
if (!finalView) {
|
|
779
|
+
throw new Error(`No suitable view found for model id '${model.modelId}' using context '${displayContext}'`);
|
|
682
780
|
}
|
|
781
|
+
return React.createElement(finalView, props);
|
|
683
782
|
}
|
|
684
|
-
exports.is = is;
|
|
685
783
|
/**
|
|
686
|
-
*
|
|
687
|
-
*
|
|
688
|
-
*
|
|
784
|
+
* An ES7 style decorator that associates a model with a view
|
|
785
|
+
* @param view the react component that will be used to display this model
|
|
786
|
+
* @param displayContext an optional context allowing for different views to display the same model
|
|
787
|
+
* @returns {Function}
|
|
689
788
|
*/
|
|
690
|
-
function
|
|
691
|
-
|
|
692
|
-
|
|
789
|
+
function viewBinding(view, displayContext = exports.DEFAULT_VIEW_KEY) {
|
|
790
|
+
esp_js_1.Guard.isDefined(view, 'view must be defined');
|
|
791
|
+
esp_js_1.Guard.isString(displayContext, 'displayContext must be a string');
|
|
792
|
+
return function (target) {
|
|
793
|
+
let viewMetadata = getMetadata(target);
|
|
794
|
+
if (viewMetadata.hasRegisteredViewContext(displayContext)) {
|
|
795
|
+
throw new Error(`Context ${displayContext} already registered for view`);
|
|
796
|
+
}
|
|
797
|
+
viewMetadata.viewRegistrations[displayContext] = new ViewMetadataRegistration(view, displayContext);
|
|
798
|
+
};
|
|
799
|
+
}
|
|
800
|
+
class ViewMetadata {
|
|
801
|
+
constructor() {
|
|
802
|
+
this._viewRegistrations = {};
|
|
693
803
|
}
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
return false;
|
|
804
|
+
get viewRegistrations() {
|
|
805
|
+
return this._viewRegistrations;
|
|
697
806
|
}
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
if (keysA.length !== keysB.length) {
|
|
701
|
-
return false;
|
|
807
|
+
hasRegisteredViewContext(displayContext) {
|
|
808
|
+
return typeof this._viewRegistrations[displayContext] !== 'undefined';
|
|
702
809
|
}
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
810
|
+
}
|
|
811
|
+
exports.ViewMetadata = ViewMetadata;
|
|
812
|
+
class ViewMetadataRegistration {
|
|
813
|
+
constructor(_view, _displayContext) {
|
|
814
|
+
this._view = _view;
|
|
815
|
+
this._displayContext = _displayContext;
|
|
816
|
+
}
|
|
817
|
+
get view() {
|
|
818
|
+
return this._view;
|
|
819
|
+
}
|
|
820
|
+
get displayContext() {
|
|
821
|
+
return this._displayContext;
|
|
709
822
|
}
|
|
710
|
-
return true;
|
|
711
823
|
}
|
|
712
|
-
exports.
|
|
824
|
+
exports.ViewMetadataRegistration = ViewMetadataRegistration;
|
|
713
825
|
|
|
714
826
|
|
|
715
827
|
/***/ }),
|
|
716
|
-
/* 13 */
|
|
717
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
718
828
|
|
|
719
|
-
|
|
829
|
+
/***/ 152:
|
|
830
|
+
/***/ ((module) => {
|
|
720
831
|
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
728
|
-
t[p[i]] = s[p[i]];
|
|
729
|
-
}
|
|
730
|
-
return t;
|
|
731
|
-
};
|
|
732
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
733
|
-
exports.connect = exports.ConnectableComponent = exports.HooksPublishModelEventProvider = exports.PublishModelEventContext = void 0;
|
|
734
|
-
const React = __webpack_require__(1);
|
|
735
|
-
const PropTypes = __webpack_require__(3);
|
|
736
|
-
const esp_js_1 = __webpack_require__(2);
|
|
737
|
-
const viewBindingDecorator_1 = __webpack_require__(0);
|
|
738
|
-
const getEspReactRenderModel_1 = __webpack_require__(4);
|
|
739
|
-
exports.PublishModelEventContext = React.createContext(null);
|
|
740
|
-
exports.HooksPublishModelEventProvider = exports.PublishModelEventContext.Provider;
|
|
741
|
-
class ConnectableComponent extends React.Component {
|
|
742
|
-
constructor(props, context) {
|
|
743
|
-
super(props, context);
|
|
744
|
-
this._isMounted = false;
|
|
745
|
-
this._publishEvent = (router, modelId) => (eventType, event) => router.publishEvent(modelId, eventType, event);
|
|
746
|
-
this.state = { model: null, currentModelId: null };
|
|
747
|
-
}
|
|
748
|
-
componentWillReceiveProps(nextProps, nextContext) {
|
|
749
|
-
const modelId = nextProps.modelId || nextContext.modelId;
|
|
750
|
-
const oldModelId = this._getModelId();
|
|
751
|
-
if (modelId === oldModelId) {
|
|
752
|
-
return;
|
|
753
|
-
}
|
|
754
|
-
if (nextProps.modelId === oldModelId) {
|
|
755
|
-
return;
|
|
756
|
-
}
|
|
757
|
-
this._tryObserveModel(modelId);
|
|
758
|
-
}
|
|
759
|
-
componentDidMount() {
|
|
760
|
-
this._isMounted = true;
|
|
761
|
-
this._tryObserveModel(this._getModelId());
|
|
762
|
-
}
|
|
763
|
-
componentWillUnmount() {
|
|
764
|
-
this._isMounted = false;
|
|
765
|
-
this._tryDisposeModelSubscription();
|
|
766
|
-
}
|
|
767
|
-
_getModelId() {
|
|
768
|
-
// props override context
|
|
769
|
-
return this.props.modelId || this.context.modelId;
|
|
770
|
-
}
|
|
771
|
-
_tryObserveModel(modelId) {
|
|
772
|
-
this._tryDisposeModelSubscription();
|
|
773
|
-
if (!modelId) {
|
|
774
|
-
return;
|
|
775
|
-
}
|
|
776
|
-
let stateChanged = modelId !== this.state.currentModelId;
|
|
777
|
-
let publishEvent = this.state.publishEvent;
|
|
778
|
-
if (stateChanged) {
|
|
779
|
-
publishEvent = this._publishEvent(this.context.router, modelId);
|
|
780
|
-
}
|
|
781
|
-
let publishProps = this.state.publishProps;
|
|
782
|
-
// We only map the publish props once, as for well behaving components these callbacks should never change
|
|
783
|
-
if (stateChanged && this.props.createPublishEventProps) {
|
|
784
|
-
publishProps = this.props.createPublishEventProps(publishEvent);
|
|
785
|
-
}
|
|
786
|
-
if (stateChanged) {
|
|
787
|
-
this.setState({
|
|
788
|
-
currentModelId: modelId,
|
|
789
|
-
publishEvent,
|
|
790
|
-
publishProps
|
|
791
|
-
});
|
|
792
|
-
this._observationSubscription = this.context.router
|
|
793
|
-
.getModelObservable(modelId)
|
|
794
|
-
.subscribe(model => {
|
|
795
|
-
if (this._isMounted) {
|
|
796
|
-
this.setState({ model });
|
|
797
|
-
}
|
|
798
|
-
});
|
|
799
|
-
}
|
|
800
|
-
}
|
|
801
|
-
_tryDisposeModelSubscription() {
|
|
802
|
-
if (this._observationSubscription) {
|
|
803
|
-
this._observationSubscription.dispose();
|
|
804
|
-
this._observationSubscription = new esp_js_1.DisposableBase();
|
|
805
|
-
this.setState({ model: null, currentModelId: null, publishProps: null, publishEvent: null });
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
render() {
|
|
809
|
-
if (this.state.model == null) {
|
|
810
|
-
return null;
|
|
811
|
-
}
|
|
812
|
-
let childProps = this._getChildProps();
|
|
813
|
-
let view = (0, viewBindingDecorator_1.createViewForModel)(this.state.model, childProps, this.props.viewContext, this.props.view);
|
|
814
|
-
return (React.createElement(exports.HooksPublishModelEventProvider, { value: this.state.publishEvent }, view));
|
|
815
|
-
}
|
|
816
|
-
_getChildProps() {
|
|
817
|
-
// consume what this component owns, and let the rest end up in `...rest`
|
|
818
|
-
const _a = this.props, { children, createPublishEventProps, modelId, mapModelToProps, view, viewContext } = _a, rest = __rest(_a, ["children", "createPublishEventProps", "modelId", "mapModelToProps", "view", "viewContext"]);
|
|
819
|
-
const model = this._getRenderModel(this.state.model);
|
|
820
|
-
let childProps = Object.assign(Object.assign(Object.assign({ modelId, router: this.context.router }, rest), this.state.publishProps), { model });
|
|
821
|
-
if (this.props.mapModelToProps) {
|
|
822
|
-
childProps = Object.assign(Object.assign({}, childProps), this.props.mapModelToProps(model, this.state.publishProps));
|
|
823
|
-
}
|
|
824
|
-
return childProps;
|
|
825
|
-
}
|
|
826
|
-
/**
|
|
827
|
-
* Sees if there is a special selector function which can be invoked to return a render model rather than the top level model model itself
|
|
828
|
-
*/
|
|
829
|
-
_getRenderModel(model) {
|
|
830
|
-
// does the given model have a decorated function we can invoke to get a different model to render?
|
|
831
|
-
if (esp_js_1.EspDecoratorUtil.hasMetadata(model)) {
|
|
832
|
-
let metadata = esp_js_1.EspDecoratorUtil.getCustomData(model, getEspReactRenderModel_1.GetEspReactRenderModelConsts.CustomDataKey);
|
|
833
|
-
if (metadata) {
|
|
834
|
-
return model[metadata.functionName]();
|
|
835
|
-
}
|
|
836
|
-
}
|
|
837
|
-
// else see if there is a function with name GetEspReactRenderModelConsts.HandlerFunctionName we can invoke to get a different model to render?
|
|
838
|
-
let renderModelGetter = model[getEspReactRenderModel_1.GetEspReactRenderModelConsts.HandlerFunctionName];
|
|
839
|
-
if (renderModelGetter && esp_js_1.utils.isFunction(renderModelGetter)) {
|
|
840
|
-
return renderModelGetter.call(model);
|
|
841
|
-
}
|
|
842
|
-
// else just return the default model
|
|
843
|
-
return model;
|
|
844
|
-
}
|
|
845
|
-
}
|
|
846
|
-
exports.ConnectableComponent = ConnectableComponent;
|
|
847
|
-
ConnectableComponent.contextTypes = {
|
|
848
|
-
router: PropTypes.instanceOf(esp_js_1.Router).isRequired,
|
|
849
|
-
modelId: PropTypes.string
|
|
850
|
-
};
|
|
851
|
-
const connect = function (mapModelToProps, createPublishEventProps) {
|
|
852
|
-
return function (view) {
|
|
853
|
-
return function (props) {
|
|
854
|
-
const { modelId, viewContext } = props, rest = __rest(props, ["modelId", "viewContext"]);
|
|
855
|
-
return React.createElement(ConnectableComponent, Object.assign({ modelId: modelId, view: view, viewContext: viewContext, createPublishEventProps: createPublishEventProps, mapModelToProps: mapModelToProps }, rest));
|
|
856
|
-
};
|
|
857
|
-
};
|
|
858
|
-
};
|
|
859
|
-
exports.connect = connect;
|
|
832
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__152__;
|
|
833
|
+
|
|
834
|
+
/***/ }),
|
|
835
|
+
|
|
836
|
+
/***/ 43:
|
|
837
|
+
/***/ ((module) => {
|
|
860
838
|
|
|
839
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__43__;
|
|
840
|
+
|
|
841
|
+
/***/ }),
|
|
842
|
+
|
|
843
|
+
/***/ 949:
|
|
844
|
+
/***/ ((module) => {
|
|
845
|
+
|
|
846
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__949__;
|
|
847
|
+
|
|
848
|
+
/***/ }),
|
|
849
|
+
|
|
850
|
+
/***/ 155:
|
|
851
|
+
/***/ ((module) => {
|
|
852
|
+
|
|
853
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__155__;
|
|
861
854
|
|
|
862
855
|
/***/ })
|
|
863
|
-
|
|
856
|
+
|
|
857
|
+
/******/ });
|
|
858
|
+
/************************************************************************/
|
|
859
|
+
/******/ // The module cache
|
|
860
|
+
/******/ var __webpack_module_cache__ = {};
|
|
861
|
+
/******/
|
|
862
|
+
/******/ // The require function
|
|
863
|
+
/******/ function __webpack_require__(moduleId) {
|
|
864
|
+
/******/ // Check if module is in cache
|
|
865
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
866
|
+
/******/ if (cachedModule !== undefined) {
|
|
867
|
+
/******/ return cachedModule.exports;
|
|
868
|
+
/******/ }
|
|
869
|
+
/******/ // Create a new module (and put it into the cache)
|
|
870
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
871
|
+
/******/ // no module.id needed
|
|
872
|
+
/******/ // no module.loaded needed
|
|
873
|
+
/******/ exports: {}
|
|
874
|
+
/******/ };
|
|
875
|
+
/******/
|
|
876
|
+
/******/ // Execute the module function
|
|
877
|
+
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
878
|
+
/******/
|
|
879
|
+
/******/ // Return the exports of the module
|
|
880
|
+
/******/ return module.exports;
|
|
881
|
+
/******/ }
|
|
882
|
+
/******/
|
|
883
|
+
/************************************************************************/
|
|
884
|
+
/******/
|
|
885
|
+
/******/ // startup
|
|
886
|
+
/******/ // Load entry module and return exports
|
|
887
|
+
/******/ // This entry module is referenced by other modules so it can't be inlined
|
|
888
|
+
/******/ var __webpack_exports__ = __webpack_require__(872);
|
|
889
|
+
/******/
|
|
890
|
+
/******/ return __webpack_exports__;
|
|
891
|
+
/******/ })()
|
|
892
|
+
;
|
|
864
893
|
});
|
|
865
894
|
//# sourceMappingURL=esp-react.js.map
|