esp-js-react 6.5.1 → 7.0.1-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 +569 -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/espModelContext.d.ts +36 -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/espModelContext.tsx +69 -0
- package/src/index.ts +21 -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 espModelContext_1 = __webpack_require__(680);
|
|
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(espModelContext_1.EspModelContext, Object.assign({ modelId: this.props.modelId, router: this.context.router }, 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
|
+
/***/ 680:
|
|
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.EspModelContext = 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 EspModelContext = ({ modelId, children, router }) => {
|
|
200
|
+
const getModelId = (0, react_1.useCallback)(() => {
|
|
201
|
+
return modelId;
|
|
202
|
+
}, [router, modelId]);
|
|
203
|
+
const publishEvent = (0, react_1.useCallback)((modelIdOrModelAddress, eventType, event) => {
|
|
204
|
+
router.publishEvent(modelIdOrModelAddress, eventType, event);
|
|
205
|
+
}, [router]);
|
|
206
|
+
const publishModelEvent = (0, react_1.useCallback)((eventType, event) => {
|
|
207
|
+
router.publishEvent(modelId, eventType, event);
|
|
208
|
+
}, [router, modelId]);
|
|
209
|
+
const publishModelEventWithEntityKey = (0, react_1.useCallback)((entityKey, eventType, event) => {
|
|
210
|
+
router.publishEvent(new esp_js_1.DefaultModelAddress(modelId, entityKey), eventType, event);
|
|
211
|
+
}, [router, modelId]);
|
|
212
|
+
return (React.createElement(routerProvider_1.RouterContext.Provider, { value: router },
|
|
213
|
+
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.EspModelContext = EspModelContext;
|
|
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,50 @@ 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.EspModelContext = 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 espModelContext_1 = __webpack_require__(680);
|
|
313
|
+
Object.defineProperty(exports, "useGetModelId", ({ enumerable: true, get: function () { return espModelContext_1.useGetModelId; } }));
|
|
314
|
+
Object.defineProperty(exports, "GetModelIdContext", ({ enumerable: true, get: function () { return espModelContext_1.GetModelIdContext; } }));
|
|
315
|
+
Object.defineProperty(exports, "PublishEventContext", ({ enumerable: true, get: function () { return espModelContext_1.PublishEventContext; } }));
|
|
316
|
+
Object.defineProperty(exports, "usePublishEvent", ({ enumerable: true, get: function () { return espModelContext_1.usePublishEvent; } }));
|
|
317
|
+
Object.defineProperty(exports, "PublishModelEventContext", ({ enumerable: true, get: function () { return espModelContext_1.PublishModelEventContext; } }));
|
|
318
|
+
Object.defineProperty(exports, "usePublishModelEvent", ({ enumerable: true, get: function () { return espModelContext_1.usePublishModelEvent; } }));
|
|
319
|
+
Object.defineProperty(exports, "PublishModelEventWithEntityKeyContext", ({ enumerable: true, get: function () { return espModelContext_1.PublishModelEventWithEntityKeyContext; } }));
|
|
320
|
+
Object.defineProperty(exports, "usePublishModelEventWithEntityKey", ({ enumerable: true, get: function () { return espModelContext_1.usePublishModelEventWithEntityKey; } }));
|
|
321
|
+
Object.defineProperty(exports, "EspModelContext", ({ enumerable: true, get: function () { return espModelContext_1.EspModelContext; } }));
|
|
320
322
|
|
|
321
323
|
|
|
322
324
|
/***/ }),
|
|
323
|
-
/* 6 */
|
|
324
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
325
325
|
|
|
326
|
-
|
|
326
|
+
/***/ 637:
|
|
327
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
327
328
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
const
|
|
329
|
+
|
|
330
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
331
|
+
const esp_js_polimer_1 = __webpack_require__(43);
|
|
332
|
+
const viewBindingDecorator_1 = __webpack_require__(213);
|
|
331
333
|
esp_js_polimer_1.PolimerModelBuilder.prototype.withViewBindings = function (view, displayContext = viewBindingDecorator_1.DEFAULT_VIEW_KEY) {
|
|
332
334
|
let builder = this;
|
|
333
335
|
// store some metadata on the builder which we'll use later to tack onto the model
|
|
@@ -353,16 +355,10 @@ esp_js_polimer_1.PolimerModelBuilder.prototype.registerWithRouter = function ()
|
|
|
353
355
|
|
|
354
356
|
|
|
355
357
|
/***/ }),
|
|
356
|
-
/* 7 */
|
|
357
|
-
/***/ (function(module, exports) {
|
|
358
|
-
|
|
359
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE__7__;
|
|
360
358
|
|
|
361
|
-
/***/
|
|
362
|
-
|
|
363
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
359
|
+
/***/ 182:
|
|
360
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
364
361
|
|
|
365
|
-
"use strict";
|
|
366
362
|
|
|
367
363
|
// notice_start
|
|
368
364
|
/*
|
|
@@ -381,13 +377,15 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__7__;
|
|
|
381
377
|
* limitations under the License.
|
|
382
378
|
*/
|
|
383
379
|
// 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__(
|
|
380
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
381
|
+
exports.RouterProvider = exports.useRouter = exports.RouterContext = void 0;
|
|
382
|
+
const React = __webpack_require__(155);
|
|
383
|
+
const PropTypes = __webpack_require__(949);
|
|
384
|
+
const esp_js_1 = __webpack_require__(152);
|
|
385
|
+
const react_1 = __webpack_require__(155);
|
|
389
386
|
exports.RouterContext = React.createContext(null);
|
|
390
|
-
|
|
387
|
+
const useRouter = () => (0, react_1.useContext)(exports.RouterContext);
|
|
388
|
+
exports.useRouter = useRouter;
|
|
391
389
|
class RouterProvider extends React.Component {
|
|
392
390
|
getChildContext() {
|
|
393
391
|
return {
|
|
@@ -395,7 +393,7 @@ class RouterProvider extends React.Component {
|
|
|
395
393
|
};
|
|
396
394
|
}
|
|
397
395
|
render() {
|
|
398
|
-
return (React.createElement(exports.
|
|
396
|
+
return (React.createElement(exports.RouterContext.Provider, { value: this.props.router }, this.props.children));
|
|
399
397
|
}
|
|
400
398
|
}
|
|
401
399
|
exports.RouterProvider = RouterProvider;
|
|
@@ -405,16 +403,163 @@ RouterProvider.childContextTypes = {
|
|
|
405
403
|
|
|
406
404
|
|
|
407
405
|
/***/ }),
|
|
408
|
-
/* 9 */
|
|
409
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
410
406
|
|
|
411
|
-
|
|
407
|
+
/***/ 234:
|
|
408
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
412
409
|
|
|
413
|
-
//
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
*
|
|
410
|
+
// taken from fbjs:
|
|
411
|
+
// https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/core/shallowEqual.js
|
|
412
|
+
// Licence (MIT) https://github.com/facebook/fbjs/blob/master/packages/fbjs/LICENSE
|
|
413
|
+
/**
|
|
414
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
415
|
+
*
|
|
416
|
+
* This source code is licensed under the MIT license found in the
|
|
417
|
+
* LICENSE file in the root directory of this source tree.
|
|
418
|
+
*
|
|
419
|
+
* @providesModule shallowEqual
|
|
420
|
+
* @typechecks
|
|
421
|
+
* @flow
|
|
422
|
+
*/
|
|
423
|
+
/*eslint-disable no-self-compare */
|
|
424
|
+
|
|
425
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
426
|
+
exports.is = is;
|
|
427
|
+
exports.shallowEqual = shallowEqual;
|
|
428
|
+
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
429
|
+
/**
|
|
430
|
+
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
|
431
|
+
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
432
|
+
*/
|
|
433
|
+
function is(x, y) {
|
|
434
|
+
// SameValue algorithm
|
|
435
|
+
if (x === y) { // Steps 1-5, 7-10
|
|
436
|
+
// Steps 6.b-6.e: +0 != -0
|
|
437
|
+
// Added the nonzero y check to make Flow happy, but it is redundant
|
|
438
|
+
return x !== 0 || y !== 0 || 1 / x === 1 / y;
|
|
439
|
+
}
|
|
440
|
+
else {
|
|
441
|
+
// Step 6.a: NaN == NaN
|
|
442
|
+
return x !== x && y !== y;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Performs equality by iterating through keys on an object and returning false
|
|
447
|
+
* when any key has values which are not strictly equal between the arguments.
|
|
448
|
+
* Returns true when the values of all keys are strictly equal.
|
|
449
|
+
*/
|
|
450
|
+
function shallowEqual(objA, objB) {
|
|
451
|
+
if (is(objA, objB)) {
|
|
452
|
+
return true;
|
|
453
|
+
}
|
|
454
|
+
if (typeof objA !== 'object' || objA === null ||
|
|
455
|
+
typeof objB !== 'object' || objB === null) {
|
|
456
|
+
return false;
|
|
457
|
+
}
|
|
458
|
+
const keysA = Object.keys(objA);
|
|
459
|
+
const keysB = Object.keys(objB);
|
|
460
|
+
if (keysA.length !== keysB.length) {
|
|
461
|
+
return false;
|
|
462
|
+
}
|
|
463
|
+
// Test for A's keys different from B.
|
|
464
|
+
for (let i = 0; i < keysA.length; i++) {
|
|
465
|
+
if (!hasOwnProperty.call(objB, keysA[i]) ||
|
|
466
|
+
!is(objA[keysA[i]], objB[keysA[i]])) {
|
|
467
|
+
return false;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
return true;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
/***/ }),
|
|
475
|
+
|
|
476
|
+
/***/ 79:
|
|
477
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
478
|
+
|
|
479
|
+
|
|
480
|
+
// notice_start
|
|
481
|
+
/*
|
|
482
|
+
* Copyright 2018 Keith Woods
|
|
483
|
+
*
|
|
484
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
485
|
+
* you may not use this file except in compliance with the License.
|
|
486
|
+
* You may obtain a copy of the License at
|
|
487
|
+
*
|
|
488
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
489
|
+
*
|
|
490
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
491
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
492
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
493
|
+
* See the License for the specific language governing permissions and
|
|
494
|
+
* limitations under the License.
|
|
495
|
+
*/
|
|
496
|
+
// notice_end
|
|
497
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
498
|
+
exports.shouldUpdateMixin = shouldUpdateMixin;
|
|
499
|
+
const React = __webpack_require__(155);
|
|
500
|
+
const shallowEqual_1 = __webpack_require__(234);
|
|
501
|
+
// WORKS (compiles at least):
|
|
502
|
+
//
|
|
503
|
+
// export function shouldUpdateMixin<TProps, TState, TPropBindings>(itemsThatEffectUpdateSelector: (nextProps: TProps) => TPropBindings) {
|
|
504
|
+
// return function <T extends {new(...args:any[]):{}}>(constructor:T) {
|
|
505
|
+
// return class extends constructor {
|
|
506
|
+
// _propBindings : {};
|
|
507
|
+
// shouldComponentUpdate(nextProps, nextState) {
|
|
508
|
+
// let newBindings = itemsThatEffectUpdateSelector(nextProps);
|
|
509
|
+
// let bindingsAreEqual = shallowEqual(this._propBindings, newBindings);
|
|
510
|
+
// this._propBindings = newBindings;
|
|
511
|
+
// return !bindingsAreEqual;
|
|
512
|
+
// }
|
|
513
|
+
// render() {
|
|
514
|
+
// return React.createElement(<any>constructor, (<any>this).props);
|
|
515
|
+
// }
|
|
516
|
+
// };
|
|
517
|
+
// };
|
|
518
|
+
// }
|
|
519
|
+
function shouldUpdateMixin(itemsThatEffectUpdateSelector) {
|
|
520
|
+
return function (Constructor) {
|
|
521
|
+
return class extends Constructor {
|
|
522
|
+
shouldComponentUpdate(nextProps, nextState) {
|
|
523
|
+
let newBindings = itemsThatEffectUpdateSelector(nextProps);
|
|
524
|
+
let bindingsAreEqual = (0, shallowEqual_1.shallowEqual)(this._propBindings, newBindings);
|
|
525
|
+
this._propBindings = newBindings;
|
|
526
|
+
return !bindingsAreEqual;
|
|
527
|
+
}
|
|
528
|
+
render() {
|
|
529
|
+
return React.createElement(Constructor, this.props);
|
|
530
|
+
}
|
|
531
|
+
};
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
// export function shouldUpdateMixin<TProps, TState, TPropBindings>(itemsThatEffectUpdateSelector: (nextProps: TProps) => TPropBindings) {
|
|
535
|
+
// return function(Comp: React.ComponentClass<TProps, TState>) {
|
|
536
|
+
// return class extends React.Component<TProps, TState> {
|
|
537
|
+
// _propBindings : {};
|
|
538
|
+
// shouldComponentUpdate(nextProps, nextState) {
|
|
539
|
+
// let newBindings = itemsThatEffectUpdateSelector(nextProps);
|
|
540
|
+
// let bindingsAreEqual = shallowEqual(this._propBindings, newBindings);
|
|
541
|
+
// this._propBindings = newBindings;
|
|
542
|
+
// return !bindingsAreEqual;
|
|
543
|
+
// }
|
|
544
|
+
// render() {
|
|
545
|
+
// return React.createElement(Comp, this.props);
|
|
546
|
+
// }
|
|
547
|
+
// };
|
|
548
|
+
// };
|
|
549
|
+
// }
|
|
550
|
+
|
|
551
|
+
|
|
552
|
+
/***/ }),
|
|
553
|
+
|
|
554
|
+
/***/ 438:
|
|
555
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
556
|
+
|
|
557
|
+
|
|
558
|
+
// notice_start
|
|
559
|
+
/*
|
|
560
|
+
* Copyright 2015 Dev Shop Limited
|
|
561
|
+
*
|
|
562
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
418
563
|
* you may not use this file except in compliance with the License.
|
|
419
564
|
* You may obtain a copy of the License at
|
|
420
565
|
*
|
|
@@ -438,12 +583,12 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
438
583
|
}
|
|
439
584
|
return t;
|
|
440
585
|
};
|
|
441
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
586
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
442
587
|
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__(
|
|
588
|
+
const React = __webpack_require__(155);
|
|
589
|
+
const PropTypes = __webpack_require__(949);
|
|
590
|
+
const viewBindingDecorator_1 = __webpack_require__(213);
|
|
591
|
+
const esp_js_1 = __webpack_require__(152);
|
|
447
592
|
class SmartComponent extends React.Component {
|
|
448
593
|
constructor() {
|
|
449
594
|
super(...arguments);
|
|
@@ -508,10 +653,10 @@ SmartComponent.contextTypes = {
|
|
|
508
653
|
|
|
509
654
|
|
|
510
655
|
/***/ }),
|
|
511
|
-
/* 10 */
|
|
512
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
513
656
|
|
|
514
|
-
|
|
657
|
+
/***/ 453:
|
|
658
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
659
|
+
|
|
515
660
|
|
|
516
661
|
// notice_start
|
|
517
662
|
/*
|
|
@@ -541,12 +686,12 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
541
686
|
}
|
|
542
687
|
return t;
|
|
543
688
|
};
|
|
544
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
689
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
545
690
|
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__(
|
|
691
|
+
const esp = __webpack_require__(152);
|
|
692
|
+
const React = __webpack_require__(155);
|
|
693
|
+
const PropTypes = __webpack_require__(949);
|
|
694
|
+
const viewBindingDecorator_1 = __webpack_require__(213);
|
|
550
695
|
class ViewBinder extends React.Component {
|
|
551
696
|
render() {
|
|
552
697
|
if (this.props.model) {
|
|
@@ -564,14 +709,14 @@ ViewBinder.contextTypes = {
|
|
|
564
709
|
|
|
565
710
|
|
|
566
711
|
/***/ }),
|
|
567
|
-
/* 11 */
|
|
568
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
569
712
|
|
|
570
|
-
|
|
713
|
+
/***/ 213:
|
|
714
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
715
|
+
|
|
571
716
|
|
|
572
717
|
// notice_start
|
|
573
718
|
/*
|
|
574
|
-
* Copyright
|
|
719
|
+
* Copyright 2015 Dev Shop Limited
|
|
575
720
|
*
|
|
576
721
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
577
722
|
* you may not use this file except in compliance with the License.
|
|
@@ -586,280 +731,165 @@ ViewBinder.contextTypes = {
|
|
|
586
731
|
* limitations under the License.
|
|
587
732
|
*/
|
|
588
733
|
// 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
|
-
};
|
|
734
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
735
|
+
exports.ViewMetadataRegistration = exports.ViewMetadata = exports.DEFAULT_VIEW_KEY = void 0;
|
|
736
|
+
exports.createViewForModel = createViewForModel;
|
|
737
|
+
exports.viewBinding = viewBinding;
|
|
738
|
+
const React = __webpack_require__(155);
|
|
739
|
+
const esp_js_1 = __webpack_require__(152);
|
|
740
|
+
exports.DEFAULT_VIEW_KEY = 'default-view-key';
|
|
741
|
+
function getMetadata(target) {
|
|
742
|
+
if (!target._viewMetadata) {
|
|
743
|
+
target._viewMetadata = new ViewMetadata();
|
|
744
|
+
}
|
|
745
|
+
return target._viewMetadata;
|
|
625
746
|
}
|
|
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
747
|
/**
|
|
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.
|
|
748
|
+
* Tries to get a view for the given model.
|
|
658
749
|
*
|
|
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
|
|
750
|
+
* It does this using the following order:
|
|
751
|
+
* 1) If a @viewBinding decorator was used and a display context was given, try get a view for that
|
|
752
|
+
* 2) Else if a view was explicitly provided use that
|
|
753
|
+
* 3) Else if a @viewBinding decorator was used and there is a view associated with the default display context, use that view
|
|
754
|
+
* @param model
|
|
755
|
+
* @param props
|
|
756
|
+
* @param displayContext
|
|
757
|
+
* @param view
|
|
671
758
|
*/
|
|
672
|
-
function
|
|
673
|
-
//
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
759
|
+
function createViewForModel(model, props, displayContext, view) {
|
|
760
|
+
let finalView = view; // default to that passed in, if any.
|
|
761
|
+
// displayContext = displayContext || DEFAULT_VIEW_KEY;
|
|
762
|
+
// the view decorator isn't on the instance, it's on the constructor function that created that instance
|
|
763
|
+
if (model) {
|
|
764
|
+
let constructorFunction = model.constructor;
|
|
765
|
+
if (constructorFunction._viewMetadata) {
|
|
766
|
+
let viewMetadata = constructorFunction._viewMetadata;
|
|
767
|
+
if (displayContext && viewMetadata.hasRegisteredViewContext(displayContext)) {
|
|
768
|
+
let viewMetadataRegistration = viewMetadata.viewRegistrations[displayContext];
|
|
769
|
+
// we've found a view for the display context, use that
|
|
770
|
+
finalView = viewMetadataRegistration.view;
|
|
771
|
+
}
|
|
772
|
+
// if we've not found a view yet, and one wasn't provided, is there a default one?
|
|
773
|
+
if (!finalView && viewMetadata.hasRegisteredViewContext(exports.DEFAULT_VIEW_KEY)) {
|
|
774
|
+
let viewMetadataRegistration = viewMetadata.viewRegistrations[exports.DEFAULT_VIEW_KEY];
|
|
775
|
+
finalView = viewMetadataRegistration.view;
|
|
776
|
+
}
|
|
777
|
+
}
|
|
678
778
|
}
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
return x !== x && y !== y;
|
|
779
|
+
if (!finalView) {
|
|
780
|
+
throw new Error(`No suitable view found for model id '${model.modelId}' using context '${displayContext}'`);
|
|
682
781
|
}
|
|
782
|
+
return React.createElement(finalView, props);
|
|
683
783
|
}
|
|
684
|
-
exports.is = is;
|
|
685
784
|
/**
|
|
686
|
-
*
|
|
687
|
-
*
|
|
688
|
-
*
|
|
785
|
+
* An ES7 style decorator that associates a model with a view
|
|
786
|
+
* @param view the react component that will be used to display this model
|
|
787
|
+
* @param displayContext an optional context allowing for different views to display the same model
|
|
788
|
+
* @returns {Function}
|
|
689
789
|
*/
|
|
690
|
-
function
|
|
691
|
-
|
|
692
|
-
|
|
790
|
+
function viewBinding(view, displayContext = exports.DEFAULT_VIEW_KEY) {
|
|
791
|
+
esp_js_1.Guard.isDefined(view, 'view must be defined');
|
|
792
|
+
esp_js_1.Guard.isString(displayContext, 'displayContext must be a string');
|
|
793
|
+
return function (target) {
|
|
794
|
+
let viewMetadata = getMetadata(target);
|
|
795
|
+
if (viewMetadata.hasRegisteredViewContext(displayContext)) {
|
|
796
|
+
throw new Error(`Context ${displayContext} already registered for view`);
|
|
797
|
+
}
|
|
798
|
+
viewMetadata.viewRegistrations[displayContext] = new ViewMetadataRegistration(view, displayContext);
|
|
799
|
+
};
|
|
800
|
+
}
|
|
801
|
+
class ViewMetadata {
|
|
802
|
+
constructor() {
|
|
803
|
+
this._viewRegistrations = {};
|
|
693
804
|
}
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
return false;
|
|
805
|
+
get viewRegistrations() {
|
|
806
|
+
return this._viewRegistrations;
|
|
697
807
|
}
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
if (keysA.length !== keysB.length) {
|
|
701
|
-
return false;
|
|
808
|
+
hasRegisteredViewContext(displayContext) {
|
|
809
|
+
return typeof this._viewRegistrations[displayContext] !== 'undefined';
|
|
702
810
|
}
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
811
|
+
}
|
|
812
|
+
exports.ViewMetadata = ViewMetadata;
|
|
813
|
+
class ViewMetadataRegistration {
|
|
814
|
+
constructor(_view, _displayContext) {
|
|
815
|
+
this._view = _view;
|
|
816
|
+
this._displayContext = _displayContext;
|
|
817
|
+
}
|
|
818
|
+
get view() {
|
|
819
|
+
return this._view;
|
|
820
|
+
}
|
|
821
|
+
get displayContext() {
|
|
822
|
+
return this._displayContext;
|
|
709
823
|
}
|
|
710
|
-
return true;
|
|
711
824
|
}
|
|
712
|
-
exports.
|
|
825
|
+
exports.ViewMetadataRegistration = ViewMetadataRegistration;
|
|
713
826
|
|
|
714
827
|
|
|
715
828
|
/***/ }),
|
|
716
|
-
/* 13 */
|
|
717
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
718
829
|
|
|
719
|
-
|
|
830
|
+
/***/ 152:
|
|
831
|
+
/***/ ((module) => {
|
|
720
832
|
|
|
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;
|
|
833
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__152__;
|
|
834
|
+
|
|
835
|
+
/***/ }),
|
|
836
|
+
|
|
837
|
+
/***/ 43:
|
|
838
|
+
/***/ ((module) => {
|
|
860
839
|
|
|
840
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__43__;
|
|
841
|
+
|
|
842
|
+
/***/ }),
|
|
843
|
+
|
|
844
|
+
/***/ 949:
|
|
845
|
+
/***/ ((module) => {
|
|
846
|
+
|
|
847
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__949__;
|
|
848
|
+
|
|
849
|
+
/***/ }),
|
|
850
|
+
|
|
851
|
+
/***/ 155:
|
|
852
|
+
/***/ ((module) => {
|
|
853
|
+
|
|
854
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__155__;
|
|
861
855
|
|
|
862
856
|
/***/ })
|
|
863
|
-
|
|
857
|
+
|
|
858
|
+
/******/ });
|
|
859
|
+
/************************************************************************/
|
|
860
|
+
/******/ // The module cache
|
|
861
|
+
/******/ var __webpack_module_cache__ = {};
|
|
862
|
+
/******/
|
|
863
|
+
/******/ // The require function
|
|
864
|
+
/******/ function __webpack_require__(moduleId) {
|
|
865
|
+
/******/ // Check if module is in cache
|
|
866
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
867
|
+
/******/ if (cachedModule !== undefined) {
|
|
868
|
+
/******/ return cachedModule.exports;
|
|
869
|
+
/******/ }
|
|
870
|
+
/******/ // Create a new module (and put it into the cache)
|
|
871
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
872
|
+
/******/ // no module.id needed
|
|
873
|
+
/******/ // no module.loaded needed
|
|
874
|
+
/******/ exports: {}
|
|
875
|
+
/******/ };
|
|
876
|
+
/******/
|
|
877
|
+
/******/ // Execute the module function
|
|
878
|
+
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
879
|
+
/******/
|
|
880
|
+
/******/ // Return the exports of the module
|
|
881
|
+
/******/ return module.exports;
|
|
882
|
+
/******/ }
|
|
883
|
+
/******/
|
|
884
|
+
/************************************************************************/
|
|
885
|
+
/******/
|
|
886
|
+
/******/ // startup
|
|
887
|
+
/******/ // Load entry module and return exports
|
|
888
|
+
/******/ // This entry module is referenced by other modules so it can't be inlined
|
|
889
|
+
/******/ var __webpack_exports__ = __webpack_require__(872);
|
|
890
|
+
/******/
|
|
891
|
+
/******/ return __webpack_exports__;
|
|
892
|
+
/******/ })()
|
|
893
|
+
;
|
|
864
894
|
});
|
|
865
895
|
//# sourceMappingURL=esp-react.js.map
|