x25 17.1.4 → 17.1.7
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/Async/InitModule.d.ts +7 -3
- package/Async/InitModule.js +15 -92
- package/Async/InitModule.js.map +1 -1
- package/Async/helpers.d.ts +6 -0
- package/Async/helpers.js +64 -0
- package/Async/helpers.js.map +1 -0
- package/Async/index.js +1 -1
- package/Async/index.js.map +1 -1
- package/Async/types.d.ts +18 -14
- package/Async/util.d.ts +2 -0
- package/Async/util.js +103 -0
- package/Async/util.js.map +1 -0
- package/package.json +1 -1
package/Async/InitModule.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type {
|
|
3
|
-
declare
|
|
4
|
-
|
|
2
|
+
import type { Loaded } from "./types";
|
|
3
|
+
declare type InitModuleProps = {
|
|
4
|
+
loaded: Loaded;
|
|
5
|
+
props: any;
|
|
6
|
+
};
|
|
7
|
+
declare const InitModule: ({ loaded, props }: InitModuleProps) => JSX.Element;
|
|
8
|
+
export default InitModule;
|
package/Async/InitModule.js
CHANGED
|
@@ -1,19 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
2
|
var __assign = (this && this.__assign) || function () {
|
|
18
3
|
__assign = Object.assign || function(t) {
|
|
19
4
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -45,89 +30,27 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
45
30
|
return result;
|
|
46
31
|
};
|
|
47
32
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
-
var redux_injector_1 = require("redux-injector");
|
|
49
33
|
var react_redux_1 = require("react-redux");
|
|
50
34
|
var React = __importStar(require("react"));
|
|
51
|
-
var util_1 = require("../Modal/util");
|
|
52
35
|
var utility_1 = require("../utility");
|
|
53
|
-
var injectPaginator = function (_a) {
|
|
54
|
-
var key = _a.key, itemsReducer = _a.itemsReducer, pagesReducer = _a.pagesReducer;
|
|
55
|
-
(0, redux_injector_1.injectReducer)("entities.".concat(key), itemsReducer);
|
|
56
|
-
(0, redux_injector_1.injectReducer)("paginations.".concat(key), pagesReducer);
|
|
57
|
-
};
|
|
58
36
|
var Loading_1 = require("../Messages/Loading");
|
|
59
37
|
var module_1 = require("../reducer/module");
|
|
60
|
-
var
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
return ({
|
|
68
|
-
initModule: function () {
|
|
69
|
-
var _a = route.default, reducers = _a.reducers, modals = _a.modals, paginators = _a.paginators, module = _a.module;
|
|
70
|
-
(0, utility_1.delay)().then(function () {
|
|
71
|
-
if (reducers) {
|
|
72
|
-
if (Array.isArray(reducers)) {
|
|
73
|
-
for (var _i = 0, reducers_1 = reducers; _i < reducers_1.length; _i++) {
|
|
74
|
-
var _a = reducers_1[_i], key = _a.key, func = _a.func;
|
|
75
|
-
(0, redux_injector_1.injectReducer)(key, func);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
var key = reducers.key, func = reducers.func;
|
|
80
|
-
(0, redux_injector_1.injectReducer)(key, func);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}).
|
|
84
|
-
then(function () {
|
|
85
|
-
if (modals) {
|
|
86
|
-
(0, util_1.injectModals)(modals);
|
|
87
|
-
}
|
|
88
|
-
}).
|
|
89
|
-
then(function () {
|
|
90
|
-
if (paginators) {
|
|
91
|
-
if (Array.isArray(paginators)) {
|
|
92
|
-
for (var _i = 0, paginators_1 = paginators; _i < paginators_1.length; _i++) {
|
|
93
|
-
var paginator = paginators_1[_i];
|
|
94
|
-
injectPaginator(paginator);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
injectPaginator(paginators);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}).
|
|
102
|
-
then(function () {
|
|
38
|
+
var util_1 = require("./util");
|
|
39
|
+
var InitModule = function (_a) {
|
|
40
|
+
var loaded = _a.loaded, props = _a.props;
|
|
41
|
+
var current = loaded.default, module = current.module, Component = current.Component, ready = (0, react_redux_1.useSelector)(function (state) { return (0, module_1.getIsModuleReady)(state, module); }), dispatch = (0, react_redux_1.useDispatch)();
|
|
42
|
+
React.useEffect(function () {
|
|
43
|
+
if (!ready) {
|
|
44
|
+
(0, util_1.initModule)(current, function () {
|
|
103
45
|
dispatch((0, module_1.moduleIsReadyAction)(module));
|
|
104
46
|
});
|
|
105
|
-
},
|
|
106
|
-
});
|
|
107
|
-
};
|
|
108
|
-
var InitModule = /** @class */ (function (_super) {
|
|
109
|
-
__extends(InitModule, _super);
|
|
110
|
-
function InitModule() {
|
|
111
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
112
|
-
}
|
|
113
|
-
InitModule.prototype.componentDidMount = function () {
|
|
114
|
-
if (!this.props.ready) {
|
|
115
|
-
this.props.initModule();
|
|
116
47
|
}
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
return
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
-
return (React.createElement("div", { className: "mt-3" },
|
|
127
|
-
React.createElement(Loading_1.LoadingMessage, { message: utility_1.words.PleaseWait })));
|
|
128
|
-
};
|
|
129
|
-
return InitModule;
|
|
130
|
-
}(React.Component));
|
|
131
|
-
var WrapInitModule = (0, react_redux_1.connect)(mapStateToProps, mapDispatchToProps)(InitModule), createWrap = function (route, props) { return React.createElement(WrapInitModule, { props: props, route: route }); };
|
|
132
|
-
exports.default = createWrap;
|
|
48
|
+
}, [ready]);
|
|
49
|
+
if (ready) {
|
|
50
|
+
return React.createElement(Component, __assign({}, props));
|
|
51
|
+
}
|
|
52
|
+
return (React.createElement("div", { className: "mt-3" },
|
|
53
|
+
React.createElement(Loading_1.LoadingMessage, { message: utility_1.words.PleaseWait })));
|
|
54
|
+
};
|
|
55
|
+
exports.default = InitModule;
|
|
133
56
|
//# sourceMappingURL=InitModule.js.map
|
package/Async/InitModule.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InitModule.js","sourceRoot":"","sources":["../../src/Async/InitModule.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"InitModule.js","sourceRoot":"","sources":["../../src/Async/InitModule.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,2CAAuD;AACvD,2CAA+B;AAC/B,sCAAmC;AAEnC,+CAAqD;AACrD,4CAA0E;AAE1E,+BAAoC;AAQpC,IAAM,UAAU,GAAG,UAAC,EAAmC;QAAjC,MAAM,YAAA,EAAE,KAAK,WAAA;IACjC,IACE,OAAO,GAAG,MAAM,CAAC,OAAO,EACtB,MAAM,GAAgB,OAAO,OAAvB,EAAE,SAAS,GAAK,OAAO,UAAZ,EACnB,KAAK,GAAG,IAAA,yBAAW,EAAC,UAAC,KAAW,IAAK,OAAA,IAAA,yBAAgB,EAAC,KAAK,EAAE,MAAM,CAAC,EAA/B,CAA+B,CAAC,EACrE,QAAQ,GAAG,IAAA,yBAAW,GAAE,CAAC;IAE3B,KAAK,CAAC,SAAS,CAAC;QACd,IAAI,CAAC,KAAK,EAAE;YACV,IAAA,iBAAU,EAAC,OAAO,EAAE;gBAClB,QAAQ,CAAC,IAAA,4BAAmB,EAAC,MAAM,CAAC,CAAC,CAAC;YACxC,CAAC,CAAC,CAAC;SACJ;IACH,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,IAAI,KAAK,EAAE;QACT,OAAO,oBAAC,SAAS,eAAK,KAAK,EAAI,CAAC;KACjC;IAED,OAAO,CACL,6BAAK,SAAS,EAAC,MAAM;QACnB,oBAAC,wBAAc,IAAC,OAAO,EAAE,eAAK,CAAC,UAAU,GAAI,CACzC,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Reducers } from "./types";
|
|
2
|
+
export declare const has: (obj: any, key: string) => boolean, get: (obj: any, key: string, defaultValue: any) => any, set: (obj: any, keys: any, val: any) => void;
|
|
3
|
+
export declare class CombineReducersError extends Error {
|
|
4
|
+
reducers: Reducers;
|
|
5
|
+
constructor(message: string, reducers: Reducers);
|
|
6
|
+
}
|
package/Async/helpers.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable prefer-object-has-own */
|
|
3
|
+
/* eslint-disable no-undefined */
|
|
4
|
+
var __extends = (this && this.__extends) || (function () {
|
|
5
|
+
var extendStatics = function (d, b) {
|
|
6
|
+
extendStatics = Object.setPrototypeOf ||
|
|
7
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
8
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
9
|
+
return extendStatics(d, b);
|
|
10
|
+
};
|
|
11
|
+
return function (d, b) {
|
|
12
|
+
if (typeof b !== "function" && b !== null)
|
|
13
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
14
|
+
extendStatics(d, b);
|
|
15
|
+
function __() { this.constructor = d; }
|
|
16
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
17
|
+
};
|
|
18
|
+
})();
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.CombineReducersError = exports.set = exports.get = exports.has = void 0;
|
|
21
|
+
var has = function (obj, key) {
|
|
22
|
+
var keyParts = key.split(".");
|
|
23
|
+
return Boolean(obj) && (keyParts.length > 1
|
|
24
|
+
? (0, exports.has)(obj[key.split(".")[0]], keyParts.slice(1).join("."))
|
|
25
|
+
: Object.hasOwnProperty.call(obj, key));
|
|
26
|
+
}, get = function (obj, key, defaultValue) {
|
|
27
|
+
var theObject = obj;
|
|
28
|
+
var theKey = typeof key === "string" && String(key).includes(".") ? key.split(".") : key, getKey = function (current) {
|
|
29
|
+
if (typeof theObject !== "object") {
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
return theObject[theKey[current]];
|
|
33
|
+
};
|
|
34
|
+
for (var current = 0; current < theKey.length; current += 1) {
|
|
35
|
+
theObject = theObject ? getKey(current) : undefined;
|
|
36
|
+
}
|
|
37
|
+
return theObject === undefined ? defaultValue : theObject;
|
|
38
|
+
},
|
|
39
|
+
/* eslint-disable */
|
|
40
|
+
set = function (obj, keys, val) {
|
|
41
|
+
keys.split && (keys = keys.split('.'));
|
|
42
|
+
var i = 0, l = keys.length, t = obj, x, k;
|
|
43
|
+
while (i < l) {
|
|
44
|
+
k = keys[i++];
|
|
45
|
+
if (k === '__proto__' || k === 'constructor' || k === 'prototype')
|
|
46
|
+
break;
|
|
47
|
+
t = t[k] = (i === l) ? val : (typeof (x = t[k]) === typeof (keys)) ? x : (keys[i] * 0 !== 0 || !!~('' + keys[i]).indexOf('.')) ? {} : [];
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
exports.has = has, exports.get = get,
|
|
51
|
+
/* eslint-disable */
|
|
52
|
+
exports.set = set;
|
|
53
|
+
var CombineReducersError = /** @class */ (function (_super) {
|
|
54
|
+
__extends(CombineReducersError, _super);
|
|
55
|
+
function CombineReducersError(message, reducers) {
|
|
56
|
+
var _this = _super.call(this, message) || this;
|
|
57
|
+
_this.name = "CombineReducersError";
|
|
58
|
+
_this.reducers = reducers;
|
|
59
|
+
return _this;
|
|
60
|
+
}
|
|
61
|
+
return CombineReducersError;
|
|
62
|
+
}(Error));
|
|
63
|
+
exports.CombineReducersError = CombineReducersError;
|
|
64
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/Async/helpers.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,iCAAiC;;;;;;;;;;;;;;;;;;AAI1B,IACL,GAAG,GAAG,UAAC,GAAS,EAAE,GAAY;IAC5B,IAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAEhC,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,CACrB,QAAQ,CAAC,MAAM,GAAG,CAAC;QACjB,CAAC,CAAC,IAAA,WAAG,EAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC1D,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CACzC,CAAC;AACJ,CAAC,EACD,GAAG,GAAG,UAAC,GAAQ,EAAE,GAAW,EAAE,YAAiB;IAG7C,IAAI,SAAS,GAAG,GAAG,CAAC;IAEpB,IACE,MAAM,GAAG,OAAO,GAAG,KAAK,QAAQ,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,GAAG,C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I,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,GAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC/H;AACF,CAAC,CAAA;AAxCC,QAAA,GAAG,QASH,QAAA,GAAG;AAsBH,oBAAoB;AACpB,QAAA,GAAG,OAQJ;AAGD;IAA0C,wCAAK;IAG7C,8BAAa,OAAgB,EAAE,QAAmB;QAAlD,YACE,kBAAM,OAAO,CAAC,SAGf;QAFC,KAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;QACnC,KAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;;IAC3B,CAAC;IACH,2BAAC;AAAD,CAAC,AARD,CAA0C,KAAK,GAQ9C;AARY,oDAAoB"}
|
package/Async/index.js
CHANGED
|
@@ -79,7 +79,7 @@ var setErrorBoundary = function (theError) {
|
|
|
79
79
|
}, createAsyncRoute = function (loader) { return (0, react_loadable_1.default)({
|
|
80
80
|
loader: loader,
|
|
81
81
|
loading: RouteLoading_1.default,
|
|
82
|
-
render: InitModule_1.default,
|
|
82
|
+
render: function (loaded, props) { return React.createElement(InitModule_1.default, { loaded: loaded, props: props }); },
|
|
83
83
|
timeout: timeout,
|
|
84
84
|
}); };
|
|
85
85
|
exports.setErrorBoundary = setErrorBoundary, exports.createAsyncRoute = createAsyncRoute;
|
package/Async/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Async/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yFAAyF;AACzF,kEAAsC;AACtC,2CAA+B;AAC/B,sCAAmC;AACnC,gEAA0C;AAC1C,4DAAsC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Async/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yFAAyF;AACzF,kEAAsC;AACtC,2CAA+B;AAC/B,sCAAmC;AACnC,gEAA0C;AAC1C,4DAAsC;AAGtC,gCAAgC;AAChC,iBAAiB;AACjB,uBAAuB;AACvB,uBAAuB;AACvB,KAAK;AACL,kDAAkD;AAClD,gDAAgD;AAChD,IAAM,OAAO,GAAG,KAAK,CAAC;AAEf,IAAI,aAAa,GAAG,cAAM,OAAA,iCAAM,eAAK,CAAC,aAAa,CAAO,EAAhC,CAAgC,CAAC;AAAvD,QAAA,aAAa,iBAA0C;AAClE,4FAA4F;AAC5F,oDAAoD;AACpD,uDAAuD;AACvD,KAAK;AACL,gDAAgD;AAChD,uEAAuE;AACvE,EAAE;AACF,oBAAoB;AACpB,qCAAqC;AACrC,gDAAgD;AAChD,oCAAoC;AACpC,UAAU;AACV,eAAe;AACf,wCAAwC;AACxC,EAAE;AACF,kCAAkC;AAClC,QAAQ;AACR,MAAM;AACN,EAAE;AACF,kBAAkB;AAClB,4BAA4B;AAC5B,MAAM;AACN,EAAE;AACF,sBAAsB;AACtB,uCAAuC;AACvC,8CAA8C;AAC9C,sCAAsC;AACtC,UAAU;AACV,eAAe;AACf,qCAAqC;AACrC,QAAQ;AACR,MAAM;AACN,EAAE;AACF,qCAAqC;AACrC,KAAK;AACE,IACL,gBAAgB,GAAG,UAAC,QAAa;IAC/B,qBAAa,GAAG,QAAQ,CAAC;AAC3B,CAAC,EACD,gBAAgB,GAAG,UAAC,MAAY,IAAK,OAAA,IAAA,wBAAQ,EAAC;IAC5C,MAAM,QAAA;IACN,OAAO,EAAG,sBAAY;IACtB,MAAM,EAAI,UAAC,MAAe,EAAE,KAAW,IAAK,OAAA,oBAAC,oBAAU,IAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAI,EAA5C,CAA4C;IACxF,OAAO,SAAA;CACR,CAAC,EALmC,CAKnC,CAAC;AARH,QAAA,gBAAgB,qBAGhB,QAAA,gBAAgB,oBAKb"}
|
package/Async/types.d.ts
CHANGED
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
import type { State } from "src/types";
|
|
2
2
|
import type { ModalsTypes } from "../Modal/types";
|
|
3
|
-
declare type Reducer = (state: State, action: any) => void;
|
|
4
|
-
declare type
|
|
3
|
+
export declare type Reducer = (state: State, action: any) => void;
|
|
4
|
+
export declare type Reducers = {
|
|
5
|
+
[key: string]: Reducer;
|
|
6
|
+
};
|
|
7
|
+
export declare type ReducerOptionsType = {
|
|
5
8
|
key: string;
|
|
6
9
|
func: Reducer;
|
|
7
10
|
};
|
|
8
|
-
declare type PaginatorType = {
|
|
11
|
+
export declare type PaginatorType = {
|
|
9
12
|
key: string;
|
|
10
13
|
itemsReducer: Reducer;
|
|
11
14
|
pagesReducer: Reducer;
|
|
12
15
|
};
|
|
13
|
-
declare type ReducersTypes = Array<ReducerOptionsType> | ReducerOptionsType;
|
|
14
|
-
declare type PaginatorsTypes = Array<PaginatorType> | PaginatorType;
|
|
15
|
-
declare type
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
export declare type ReducersTypes = Array<ReducerOptionsType> | ReducerOptionsType;
|
|
17
|
+
export declare type PaginatorsTypes = Array<PaginatorType> | PaginatorType;
|
|
18
|
+
export declare type ModuleParts = {
|
|
19
|
+
module: string;
|
|
20
|
+
Component: any;
|
|
21
|
+
reducers: ReducersTypes;
|
|
22
|
+
modals: ModalsTypes;
|
|
23
|
+
paginators: PaginatorsTypes;
|
|
24
|
+
};
|
|
25
|
+
export declare type Loaded = {
|
|
26
|
+
default: ModuleParts;
|
|
23
27
|
};
|
|
24
|
-
export type
|
|
28
|
+
export declare type InitModule = (module: ModuleParts, moduleIsLoadedCb: () => any) => any;
|
package/Async/util.d.ts
ADDED
package/Async/util.js
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
+
if (ar || !(i in from)) {
|
|
5
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
+
ar[i] = from[i];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.initModule = exports.createInjectStore = void 0;
|
|
13
|
+
/* eslint-disable no-prototype-builtins */
|
|
14
|
+
var redux_1 = require("redux");
|
|
15
|
+
var util_1 = require("../Modal/util");
|
|
16
|
+
var helpers_1 = require("./helpers");
|
|
17
|
+
var store = {
|
|
18
|
+
injectedReducers: {},
|
|
19
|
+
}, combine = redux_1.combineReducers;
|
|
20
|
+
var combineReducersRecurse = function (reducers) {
|
|
21
|
+
// If this is a leaf or already combined.
|
|
22
|
+
if (typeof reducers === "function") {
|
|
23
|
+
return reducers;
|
|
24
|
+
}
|
|
25
|
+
// If this is an object of functions, combine reducers.
|
|
26
|
+
if (typeof reducers === "object") {
|
|
27
|
+
var combinedReducers = {};
|
|
28
|
+
for (var _i = 0, _a = Object.keys(reducers); _i < _a.length; _i++) {
|
|
29
|
+
var key = _a[_i];
|
|
30
|
+
combinedReducers[key] = combineReducersRecurse(reducers[key]);
|
|
31
|
+
}
|
|
32
|
+
return combine(combinedReducers);
|
|
33
|
+
}
|
|
34
|
+
// If we get here we have an invalid item in the reducer path.
|
|
35
|
+
throw new helpers_1.CombineReducersError("Invalid item in reducer tree", reducers);
|
|
36
|
+
};
|
|
37
|
+
var createInjectStore = function (initialReducers) {
|
|
38
|
+
var args = [];
|
|
39
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
40
|
+
args[_i - 1] = arguments[_i];
|
|
41
|
+
}
|
|
42
|
+
// If last item is an object, it is overrides.
|
|
43
|
+
if (typeof args[args.length - 1] === "object") {
|
|
44
|
+
var overrides = args.pop(), overridesExists = (overrides.hasOwnProperty("combineReducers") &&
|
|
45
|
+
typeof overrides.combineReducers === "function");
|
|
46
|
+
if (overridesExists) {
|
|
47
|
+
combine = overrides.combineReducers;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
store = redux_1.createStore.apply(void 0, __spreadArray([combineReducersRecurse(initialReducers)], args, false));
|
|
51
|
+
store.injectedReducers = initialReducers;
|
|
52
|
+
return store;
|
|
53
|
+
}, initModule = function (_a, moduleIsLoadedCb) {
|
|
54
|
+
var reducers = _a.reducers, modals = _a.modals, paginators = _a.paginators;
|
|
55
|
+
var injectReducer = function (key, reducer, force) {
|
|
56
|
+
if (force === void 0) { force = false; }
|
|
57
|
+
if ((0, helpers_1.has)(store.injectedReducers, key) || force) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
(0, helpers_1.set)(store.injectedReducers, key, reducer);
|
|
61
|
+
store.replaceReducer(combineReducersRecurse(store.injectedReducers));
|
|
62
|
+
}, injectReducers = function () {
|
|
63
|
+
if (reducers) {
|
|
64
|
+
if (Array.isArray(reducers)) {
|
|
65
|
+
for (var _i = 0, reducers_1 = reducers; _i < reducers_1.length; _i++) {
|
|
66
|
+
var _a = reducers_1[_i], key = _a.key, func = _a.func;
|
|
67
|
+
injectReducer(key, func);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
var key = reducers.key, func = reducers.func;
|
|
72
|
+
injectReducer(key, func);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}, injectModals = function () {
|
|
76
|
+
if (modals) {
|
|
77
|
+
(0, util_1.injectModals)(modals);
|
|
78
|
+
}
|
|
79
|
+
}, injectPaginators = function () {
|
|
80
|
+
var injectPaginator = function (_a) {
|
|
81
|
+
var key = _a.key, itemsReducer = _a.itemsReducer, pagesReducer = _a.pagesReducer;
|
|
82
|
+
injectReducer("entities.".concat(key), itemsReducer);
|
|
83
|
+
injectReducer("paginations.".concat(key), pagesReducer);
|
|
84
|
+
};
|
|
85
|
+
if (paginators) {
|
|
86
|
+
if (Array.isArray(paginators)) {
|
|
87
|
+
for (var _i = 0, paginators_1 = paginators; _i < paginators_1.length; _i++) {
|
|
88
|
+
var paginator = paginators_1[_i];
|
|
89
|
+
injectPaginator(paginator);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
injectPaginator(paginators);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
injectReducers();
|
|
98
|
+
injectModals();
|
|
99
|
+
injectPaginators();
|
|
100
|
+
moduleIsLoadedCb();
|
|
101
|
+
};
|
|
102
|
+
exports.createInjectStore = createInjectStore, exports.initModule = initModule;
|
|
103
|
+
//# sourceMappingURL=util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/Async/util.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0CAA0C;AAC1C,+BAAqD;AACrD,sCAAoE;AACpE,qCAA2D;AAG3D,IACE,KAAK,GAAS;IACZ,gBAAgB,EAAE,EAAE;CACrB,EACD,OAAO,GAAG,uBAAe,CAAC;AAE5B,IACE,sBAAsB,GAAG,UAAC,QAAc;IACxC,yCAAyC;IACvC,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE;QAClC,OAAO,QAAQ,CAAC;KACjB;IAED,uDAAuD;IACvD,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE;QAChC,IAAM,gBAAgB,GAAc,EAAE,CAAC;QAEvC,KAAkB,UAAqB,EAArB,KAAA,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAArB,cAAqB,EAArB,IAAqB,EAAE;YAApC,IAAM,GAAG,SAAA;YACZ,gBAAgB,CA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