source: imaps-frontend/node_modules/react-universal-interface/lib/createEnhancer.js

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 1.7 KB
Line 
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.divWrapper = void 0;
4var tslib_1 = require("tslib");
5var React = tslib_1.__importStar(require("react"));
6var addClassDecoratorSupport_1 = tslib_1.__importDefault(require("./addClassDecoratorSupport"));
7var h = React.createElement;
8var noWrap = function (Comp, propName, props, state) {
9 var _a;
10 return h(Comp, propName ? tslib_1.__assign((_a = {}, _a[propName] = state, _a), props) : tslib_1.__assign(tslib_1.__assign({}, state), props));
11};
12exports.divWrapper = function (Comp, propName, props, state) {
13 return h('div', null, noWrap(Comp, propName, props, state));
14};
15var createEnhancer = function (Facc, prop, wrapper) {
16 if (wrapper === void 0) { wrapper = noWrap; }
17 var enhancer = function (Comp, propName, faccProps) {
18 if (propName === void 0) { propName = prop; }
19 if (faccProps === void 0) { faccProps = null; }
20 var isClassDecoratorMethodCall = typeof Comp === 'string';
21 if (isClassDecoratorMethodCall) {
22 return function (Klass) { return enhancer(Klass, Comp || prop, propName); };
23 }
24 var Enhanced = function (props) {
25 return h(Facc, faccProps, function (state) { return wrapper(Comp, propName, props, state); });
26 };
27 if (process.env.NODE_ENV !== 'production') {
28 Enhanced.displayName = (Facc.displayName || Facc.name) + "(" + (Comp.displayName || Comp.name) + ")";
29 }
30 return isClassDecoratorMethodCall ? addClassDecoratorSupport_1.default(Enhanced) : Enhanced;
31 };
32 return enhancer;
33};
34exports.default = createEnhancer;
35//# sourceMappingURL=createEnhancer.js.map
Note: See TracBrowser for help on using the repository browser.