@common-stack/client-react 0.1.15 → 0.1.19
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/lib/index.d.ts +2 -0
- package/lib/index.js +567 -21
- package/lib/index.js.map +1 -1
- package/lib/interfaces/router.d.ts +10 -1
- package/lib/inversify/InversifyContext.d.ts +14 -0
- package/lib/inversify/index.d.ts +1 -0
- package/lib/plugin-area/browser-plugin-area.d.ts +2 -0
- package/lib/plugin-area/index.d.ts +1 -0
- package/lib/slot-fill/context.d.ts +94 -0
- package/lib/slot-fill/fill.d.ts +10 -0
- package/lib/slot-fill/index.d.ts +4 -0
- package/lib/slot-fill/slot.d.ts +8 -0
- package/lib/slot-fill/utils/index.d.ts +1 -0
- package/lib/slot-fill/utils/isEmptyElement.d.ts +8 -0
- package/package.json +4 -4
- package/CHANGELOG.md +0 -214
package/lib/index.js
CHANGED
|
@@ -111,7 +111,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
111
111
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
112
112
|
if (mod && mod.__esModule) return mod;
|
|
113
113
|
var result = {};
|
|
114
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
114
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
115
115
|
__setModuleDefault(result, mod);
|
|
116
116
|
return result;
|
|
117
117
|
};
|
|
@@ -253,7 +253,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
253
253
|
o[k2] = m[k];
|
|
254
254
|
}));
|
|
255
255
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
256
|
-
for (var p in m) if (p !== "default" && !
|
|
256
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
257
257
|
};
|
|
258
258
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
259
259
|
__exportStar(__webpack_require__(/*! ./connector */ "./src/connector/connector.tsx"), exports);
|
|
@@ -278,9 +278,10 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
278
278
|
o[k2] = m[k];
|
|
279
279
|
}));
|
|
280
280
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
281
|
-
for (var p in m) if (p !== "default" && !
|
|
281
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
282
282
|
};
|
|
283
283
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
284
|
+
exports.ClientTypes = void 0;
|
|
284
285
|
var client_core_1 = __webpack_require__(/*! @common-stack/client-core */ "@common-stack/client-core");
|
|
285
286
|
Object.defineProperty(exports, "ClientTypes", { enumerable: true, get: function () { return client_core_1.ClientTypes; } });
|
|
286
287
|
__exportStar(__webpack_require__(/*! ./connector */ "./src/connector/index.ts"), exports);
|
|
@@ -290,6 +291,8 @@ __exportStar(__webpack_require__(/*! ./utils */ "./src/utils/index.ts"), exports
|
|
|
290
291
|
__exportStar(__webpack_require__(/*! ./interfaces */ "./src/interfaces/index.ts"), exports);
|
|
291
292
|
__exportStar(__webpack_require__(/*! ./plugin-area */ "./src/plugin-area/index.ts"), exports);
|
|
292
293
|
__exportStar(__webpack_require__(/*! ./route-based-plugin-area */ "./src/route-based-plugin-area/index.ts"), exports);
|
|
294
|
+
__exportStar(__webpack_require__(/*! ./slot-fill */ "./src/slot-fill/index.ts"), exports);
|
|
295
|
+
__exportStar(__webpack_require__(/*! ./inversify */ "./src/inversify/index.ts"), exports);
|
|
293
296
|
|
|
294
297
|
|
|
295
298
|
/***/ }),
|
|
@@ -325,7 +328,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
325
328
|
o[k2] = m[k];
|
|
326
329
|
}));
|
|
327
330
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
328
|
-
for (var p in m) if (p !== "default" && !
|
|
331
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
329
332
|
};
|
|
330
333
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
331
334
|
__exportStar(__webpack_require__(/*! ./router */ "./src/interfaces/router.ts"), exports);
|
|
@@ -385,6 +388,120 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
385
388
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
386
389
|
|
|
387
390
|
|
|
391
|
+
/***/ }),
|
|
392
|
+
|
|
393
|
+
/***/ "./src/inversify/InversifyContext.tsx":
|
|
394
|
+
/*!********************************************!*\
|
|
395
|
+
!*** ./src/inversify/InversifyContext.tsx ***!
|
|
396
|
+
\********************************************/
|
|
397
|
+
/*! no static exports found */
|
|
398
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
399
|
+
|
|
400
|
+
"use strict";
|
|
401
|
+
|
|
402
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
403
|
+
if (k2 === undefined) k2 = k;
|
|
404
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
405
|
+
}) : (function(o, m, k, k2) {
|
|
406
|
+
if (k2 === undefined) k2 = k;
|
|
407
|
+
o[k2] = m[k];
|
|
408
|
+
}));
|
|
409
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
410
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
411
|
+
}) : function(o, v) {
|
|
412
|
+
o["default"] = v;
|
|
413
|
+
});
|
|
414
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
415
|
+
if (mod && mod.__esModule) return mod;
|
|
416
|
+
var result = {};
|
|
417
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
418
|
+
__setModuleDefault(result, mod);
|
|
419
|
+
return result;
|
|
420
|
+
};
|
|
421
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
422
|
+
exports.useInjection = exports.InversifyProvider = exports.InversifyContext = void 0;
|
|
423
|
+
const React = __importStar(__webpack_require__(/*! react */ "react"));
|
|
424
|
+
exports.InversifyContext = React.createContext({ container: null, modules: null });
|
|
425
|
+
const InversifyProvider = (props) => {
|
|
426
|
+
return (React.createElement(exports.InversifyContext.Provider, { value: { container: props.container, modules: props.modules } }, props.children));
|
|
427
|
+
};
|
|
428
|
+
exports.InversifyProvider = InversifyProvider;
|
|
429
|
+
function useInjection(identifier) {
|
|
430
|
+
const { container } = React.useContext(exports.InversifyContext);
|
|
431
|
+
if (!container) {
|
|
432
|
+
throw new Error('Container is null');
|
|
433
|
+
}
|
|
434
|
+
return container.get(identifier);
|
|
435
|
+
}
|
|
436
|
+
exports.useInjection = useInjection;
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
/***/ }),
|
|
440
|
+
|
|
441
|
+
/***/ "./src/inversify/index.ts":
|
|
442
|
+
/*!********************************!*\
|
|
443
|
+
!*** ./src/inversify/index.ts ***!
|
|
444
|
+
\********************************/
|
|
445
|
+
/*! no static exports found */
|
|
446
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
447
|
+
|
|
448
|
+
"use strict";
|
|
449
|
+
|
|
450
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
451
|
+
if (k2 === undefined) k2 = k;
|
|
452
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
453
|
+
}) : (function(o, m, k, k2) {
|
|
454
|
+
if (k2 === undefined) k2 = k;
|
|
455
|
+
o[k2] = m[k];
|
|
456
|
+
}));
|
|
457
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
458
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
459
|
+
};
|
|
460
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
461
|
+
__exportStar(__webpack_require__(/*! ./InversifyContext */ "./src/inversify/InversifyContext.tsx"), exports);
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
/***/ }),
|
|
465
|
+
|
|
466
|
+
/***/ "./src/plugin-area/browser-plugin-area.tsx":
|
|
467
|
+
/*!*************************************************!*\
|
|
468
|
+
!*** ./src/plugin-area/browser-plugin-area.tsx ***!
|
|
469
|
+
\*************************************************/
|
|
470
|
+
/*! no static exports found */
|
|
471
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
472
|
+
|
|
473
|
+
"use strict";
|
|
474
|
+
|
|
475
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
476
|
+
if (k2 === undefined) k2 = k;
|
|
477
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
478
|
+
}) : (function(o, m, k, k2) {
|
|
479
|
+
if (k2 === undefined) k2 = k;
|
|
480
|
+
o[k2] = m[k];
|
|
481
|
+
}));
|
|
482
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
483
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
484
|
+
}) : function(o, v) {
|
|
485
|
+
o["default"] = v;
|
|
486
|
+
});
|
|
487
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
488
|
+
if (mod && mod.__esModule) return mod;
|
|
489
|
+
var result = {};
|
|
490
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
491
|
+
__setModuleDefault(result, mod);
|
|
492
|
+
return result;
|
|
493
|
+
};
|
|
494
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
495
|
+
exports.BrowserPluginArea = void 0;
|
|
496
|
+
const React = __importStar(__webpack_require__(/*! react */ "react"));
|
|
497
|
+
const plugin_area_1 = __webpack_require__(/*! ./plugin-area */ "./src/plugin-area/plugin-area.tsx");
|
|
498
|
+
const BrowserPluginArea = () => {
|
|
499
|
+
return React.createElement("div", { style: { display: "none" } },
|
|
500
|
+
React.createElement(plugin_area_1.PluginArea, null));
|
|
501
|
+
};
|
|
502
|
+
exports.BrowserPluginArea = BrowserPluginArea;
|
|
503
|
+
|
|
504
|
+
|
|
388
505
|
/***/ }),
|
|
389
506
|
|
|
390
507
|
/***/ "./src/plugin-area/higher-order-component-util.ts":
|
|
@@ -438,11 +555,12 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
438
555
|
o[k2] = m[k];
|
|
439
556
|
}));
|
|
440
557
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
441
|
-
for (var p in m) if (p !== "default" && !
|
|
558
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
442
559
|
};
|
|
443
560
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
444
561
|
__exportStar(__webpack_require__(/*! ./plugin-area */ "./src/plugin-area/plugin-area.tsx"), exports);
|
|
445
562
|
__exportStar(__webpack_require__(/*! ./plugin-api */ "./src/plugin-area/plugin-api.ts"), exports);
|
|
563
|
+
__exportStar(__webpack_require__(/*! ./browser-plugin-area */ "./src/plugin-area/browser-plugin-area.tsx"), exports);
|
|
446
564
|
|
|
447
565
|
|
|
448
566
|
/***/ }),
|
|
@@ -561,7 +679,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
561
679
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
562
680
|
if (mod && mod.__esModule) return mod;
|
|
563
681
|
var result = {};
|
|
564
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
682
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
565
683
|
__setModuleDefault(result, mod);
|
|
566
684
|
return result;
|
|
567
685
|
};
|
|
@@ -607,7 +725,7 @@ class PluginArea extends React.Component {
|
|
|
607
725
|
this.setState(this.getCurrentPluginsState);
|
|
608
726
|
}
|
|
609
727
|
render() {
|
|
610
|
-
return (React.createElement(
|
|
728
|
+
return (React.createElement(React.Fragment, null, lodash_1.map(this.state.plugins, ({ context, Plugin }) => (React.createElement(plugin_context_1.PluginContextProvider, { key: context.name, value: context },
|
|
611
729
|
React.createElement(Plugin, null))))));
|
|
612
730
|
}
|
|
613
731
|
}
|
|
@@ -640,7 +758,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
640
758
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
641
759
|
if (mod && mod.__esModule) return mod;
|
|
642
760
|
var result = {};
|
|
643
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
761
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
644
762
|
__setModuleDefault(result, mod);
|
|
645
763
|
return result;
|
|
646
764
|
};
|
|
@@ -663,9 +781,10 @@ exports.PluginContextProvider = Provider;
|
|
|
663
781
|
*
|
|
664
782
|
* @return Enhanced component with injected context as props.
|
|
665
783
|
*/
|
|
666
|
-
|
|
784
|
+
const withPluginContext = (mapContextToProps) => higher_order_component_util_1.createHigherOrderComponent((OriginalComponent) => {
|
|
667
785
|
return (props) => (React.createElement(Consumer, null, (context) => (React.createElement(OriginalComponent, Object.assign({}, props, mapContextToProps(context, props))))));
|
|
668
786
|
}, 'withPluginContext');
|
|
787
|
+
exports.withPluginContext = withPluginContext;
|
|
669
788
|
|
|
670
789
|
|
|
671
790
|
/***/ }),
|
|
@@ -721,7 +840,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
721
840
|
o[k2] = m[k];
|
|
722
841
|
}));
|
|
723
842
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
724
|
-
for (var p in m) if (p !== "default" && !
|
|
843
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
725
844
|
};
|
|
726
845
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
727
846
|
__exportStar(__webpack_require__(/*! ./route-based-plugin-area */ "./src/route-based-plugin-area/route-based-plugin-area.tsx"), exports);
|
|
@@ -844,7 +963,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
844
963
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
845
964
|
if (mod && mod.__esModule) return mod;
|
|
846
965
|
var result = {};
|
|
847
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
966
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
848
967
|
__setModuleDefault(result, mod);
|
|
849
968
|
return result;
|
|
850
969
|
};
|
|
@@ -867,9 +986,10 @@ exports.PluginContextProvider = Provider;
|
|
|
867
986
|
*
|
|
868
987
|
* @return Enhanced component with injected context as props.
|
|
869
988
|
*/
|
|
870
|
-
|
|
989
|
+
const withPluginContext = (mapContextToProps) => higher_order_component_util_1.createHigherOrderComponent((OriginalComponent) => {
|
|
871
990
|
return (props) => (React.createElement(Consumer, null, (context) => (React.createElement(OriginalComponent, Object.assign({}, props, mapContextToProps(context, props))))));
|
|
872
991
|
}, 'withPluginContext');
|
|
992
|
+
exports.withPluginContext = withPluginContext;
|
|
873
993
|
|
|
874
994
|
|
|
875
995
|
/***/ }),
|
|
@@ -898,7 +1018,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
898
1018
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
899
1019
|
if (mod && mod.__esModule) return mod;
|
|
900
1020
|
var result = {};
|
|
901
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
1021
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
902
1022
|
__setModuleDefault(result, mod);
|
|
903
1023
|
return result;
|
|
904
1024
|
};
|
|
@@ -970,7 +1090,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
970
1090
|
o[k2] = m[k];
|
|
971
1091
|
}));
|
|
972
1092
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
973
|
-
for (var p in m) if (p !== "default" && !
|
|
1093
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
974
1094
|
};
|
|
975
1095
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
976
1096
|
__exportStar(__webpack_require__(/*! ./render-routes */ "./src/route/render-routes.tsx"), exports);
|
|
@@ -1002,7 +1122,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
1002
1122
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
1003
1123
|
if (mod && mod.__esModule) return mod;
|
|
1004
1124
|
var result = {};
|
|
1005
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
1125
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
1006
1126
|
__setModuleDefault(result, mod);
|
|
1007
1127
|
return result;
|
|
1008
1128
|
};
|
|
@@ -1161,7 +1281,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
1161
1281
|
o[k2] = m[k];
|
|
1162
1282
|
}));
|
|
1163
1283
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
1164
|
-
for (var p in m) if (p !== "default" && !
|
|
1284
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
1165
1285
|
};
|
|
1166
1286
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1167
1287
|
__exportStar(__webpack_require__(/*! ./router */ "./src/router/router.tsx"), exports);
|
|
@@ -1193,7 +1313,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
1193
1313
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
1194
1314
|
if (mod && mod.__esModule) return mod;
|
|
1195
1315
|
var result = {};
|
|
1196
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
1316
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
1197
1317
|
__setModuleDefault(result, mod);
|
|
1198
1318
|
return result;
|
|
1199
1319
|
};
|
|
@@ -1208,6 +1328,419 @@ exports.FeatureWithRouterFactory = new connector_1.Feature({
|
|
|
1208
1328
|
});
|
|
1209
1329
|
|
|
1210
1330
|
|
|
1331
|
+
/***/ }),
|
|
1332
|
+
|
|
1333
|
+
/***/ "./src/slot-fill/context.tsx":
|
|
1334
|
+
/*!***********************************!*\
|
|
1335
|
+
!*** ./src/slot-fill/context.tsx ***!
|
|
1336
|
+
\***********************************/
|
|
1337
|
+
/*! no static exports found */
|
|
1338
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1339
|
+
|
|
1340
|
+
"use strict";
|
|
1341
|
+
|
|
1342
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
1343
|
+
if (k2 === undefined) k2 = k;
|
|
1344
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
1345
|
+
}) : (function(o, m, k, k2) {
|
|
1346
|
+
if (k2 === undefined) k2 = k;
|
|
1347
|
+
o[k2] = m[k];
|
|
1348
|
+
}));
|
|
1349
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
1350
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
1351
|
+
}) : function(o, v) {
|
|
1352
|
+
o["default"] = v;
|
|
1353
|
+
});
|
|
1354
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
1355
|
+
if (mod && mod.__esModule) return mod;
|
|
1356
|
+
var result = {};
|
|
1357
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
1358
|
+
__setModuleDefault(result, mod);
|
|
1359
|
+
return result;
|
|
1360
|
+
};
|
|
1361
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1362
|
+
exports.Consumer = exports.useSlot = void 0;
|
|
1363
|
+
const React = __importStar(__webpack_require__(/*! react */ "react"));
|
|
1364
|
+
const lodash_1 = __webpack_require__(/*! lodash */ "lodash");
|
|
1365
|
+
const SlotFillContext = React.createContext({
|
|
1366
|
+
registerSlot: () => { },
|
|
1367
|
+
unregisterSlot: () => { },
|
|
1368
|
+
registerFill: () => { },
|
|
1369
|
+
unregisterFill: () => { },
|
|
1370
|
+
getSlot: () => ({}),
|
|
1371
|
+
getFills: () => ([]),
|
|
1372
|
+
subscribe: () => { },
|
|
1373
|
+
});
|
|
1374
|
+
const { Provider, Consumer } = SlotFillContext;
|
|
1375
|
+
exports.Consumer = Consumer;
|
|
1376
|
+
class SlotFillProvider extends React.Component {
|
|
1377
|
+
constructor(props) {
|
|
1378
|
+
super(props);
|
|
1379
|
+
this.registerSlot = this.registerSlot.bind(this);
|
|
1380
|
+
this.registerFill = this.registerFill.bind(this);
|
|
1381
|
+
this.unregisterSlot = this.unregisterSlot.bind(this);
|
|
1382
|
+
this.unregisterFill = this.unregisterFill.bind(this);
|
|
1383
|
+
this.getSlot = this.getSlot.bind(this);
|
|
1384
|
+
this.getFills = this.getFills.bind(this);
|
|
1385
|
+
this.subscribe = this.subscribe.bind(this);
|
|
1386
|
+
this.slots = {};
|
|
1387
|
+
this.fills = {};
|
|
1388
|
+
this.listeners = [];
|
|
1389
|
+
this.contextValue = {
|
|
1390
|
+
registerSlot: this.registerSlot,
|
|
1391
|
+
unregisterSlot: this.unregisterSlot,
|
|
1392
|
+
registerFill: this.registerFill,
|
|
1393
|
+
unregisterFill: this.unregisterFill,
|
|
1394
|
+
getSlot: this.getSlot,
|
|
1395
|
+
getFills: this.getFills,
|
|
1396
|
+
subscribe: this.subscribe,
|
|
1397
|
+
};
|
|
1398
|
+
}
|
|
1399
|
+
registerSlot(name, slot) {
|
|
1400
|
+
const previousSlot = this.slots[name];
|
|
1401
|
+
this.slots[name] = slot;
|
|
1402
|
+
this.triggerListeners();
|
|
1403
|
+
// Sometimes the fills are registered after the initial render of slot
|
|
1404
|
+
// But before the registerSlot call, we need to rerender the slot
|
|
1405
|
+
this.forceUpdateSlot(name);
|
|
1406
|
+
// If a new instance of a slot is being mounted while another with the
|
|
1407
|
+
// same name exists, force its update _after_ the new slot has been
|
|
1408
|
+
// assigned into the instance, suich that its own rendering of children
|
|
1409
|
+
// will be empty (the new Slot will subsume all fills for this name).
|
|
1410
|
+
if (previousSlot) {
|
|
1411
|
+
previousSlot.forceUpdate();
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
registerFill(name, instance) {
|
|
1415
|
+
this.fills[name] = [...(this.fills[name] || []), instance];
|
|
1416
|
+
this.forceUpdateSlot(name);
|
|
1417
|
+
}
|
|
1418
|
+
unregisterSlot(name, instance) {
|
|
1419
|
+
// If a previous instance of a Slot by this name unmounts, do nothing,
|
|
1420
|
+
// as the slot and its fills should only be removed for the current
|
|
1421
|
+
// known instance.
|
|
1422
|
+
if (this.slots[name] !== instance) {
|
|
1423
|
+
return;
|
|
1424
|
+
}
|
|
1425
|
+
delete this.slots[name];
|
|
1426
|
+
this.triggerListeners();
|
|
1427
|
+
}
|
|
1428
|
+
unregisterFill(name, instance) {
|
|
1429
|
+
this.fills[name] = lodash_1.without(this.fills[name], instance);
|
|
1430
|
+
this.resetFillOccurrence(name);
|
|
1431
|
+
this.forceUpdateSlot(name);
|
|
1432
|
+
}
|
|
1433
|
+
getSlot(name) {
|
|
1434
|
+
return this.slots[name];
|
|
1435
|
+
}
|
|
1436
|
+
getFills(name, slotInstance) {
|
|
1437
|
+
// Commented following as we need the Slot to render at multiple places
|
|
1438
|
+
// Fills should only be returned for the current instance of the slot
|
|
1439
|
+
// in which they occupy.
|
|
1440
|
+
// if (this.slots[name] !== slotInstance) {
|
|
1441
|
+
// return [];
|
|
1442
|
+
// }
|
|
1443
|
+
return lodash_1.sortBy(this.fills[name], 'occurrence');
|
|
1444
|
+
}
|
|
1445
|
+
resetFillOccurrence(name) {
|
|
1446
|
+
lodash_1.forEach(this.fills[name], instance => {
|
|
1447
|
+
instance.occurrence = undefined;
|
|
1448
|
+
});
|
|
1449
|
+
}
|
|
1450
|
+
forceUpdateSlot(name) {
|
|
1451
|
+
const slot = this.getSlot(name);
|
|
1452
|
+
if (slot) {
|
|
1453
|
+
slot.forceUpdate();
|
|
1454
|
+
}
|
|
1455
|
+
}
|
|
1456
|
+
triggerListeners() {
|
|
1457
|
+
this.listeners.forEach((listener) => listener());
|
|
1458
|
+
}
|
|
1459
|
+
subscribe(listener) {
|
|
1460
|
+
this.listeners.push(listener);
|
|
1461
|
+
return () => {
|
|
1462
|
+
this.listeners = lodash_1.without(this.listeners, listener);
|
|
1463
|
+
};
|
|
1464
|
+
}
|
|
1465
|
+
render() {
|
|
1466
|
+
return React.createElement(Provider, { value: this.contextValue }, this.props.children);
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
/**
|
|
1470
|
+
* React hook returning the active slot given a name.
|
|
1471
|
+
*
|
|
1472
|
+
* @param {string} name Slot name.
|
|
1473
|
+
* @return {Object} Slot object.
|
|
1474
|
+
*/
|
|
1475
|
+
const useSlot = (name) => {
|
|
1476
|
+
const { getSlot, subscribe } = React.useContext(SlotFillContext);
|
|
1477
|
+
const [slot, setSlot] = React.useState(getSlot(name));
|
|
1478
|
+
React.useEffect(() => {
|
|
1479
|
+
setSlot(getSlot(name));
|
|
1480
|
+
const unsubscribe = subscribe(() => {
|
|
1481
|
+
setSlot(getSlot(name));
|
|
1482
|
+
});
|
|
1483
|
+
return unsubscribe;
|
|
1484
|
+
}, [name]);
|
|
1485
|
+
return slot;
|
|
1486
|
+
};
|
|
1487
|
+
exports.useSlot = useSlot;
|
|
1488
|
+
exports.default = SlotFillProvider;
|
|
1489
|
+
|
|
1490
|
+
|
|
1491
|
+
/***/ }),
|
|
1492
|
+
|
|
1493
|
+
/***/ "./src/slot-fill/fill.tsx":
|
|
1494
|
+
/*!********************************!*\
|
|
1495
|
+
!*** ./src/slot-fill/fill.tsx ***!
|
|
1496
|
+
\********************************/
|
|
1497
|
+
/*! no static exports found */
|
|
1498
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1499
|
+
|
|
1500
|
+
"use strict";
|
|
1501
|
+
|
|
1502
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
1503
|
+
if (k2 === undefined) k2 = k;
|
|
1504
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
1505
|
+
}) : (function(o, m, k, k2) {
|
|
1506
|
+
if (k2 === undefined) k2 = k;
|
|
1507
|
+
o[k2] = m[k];
|
|
1508
|
+
}));
|
|
1509
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
1510
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
1511
|
+
}) : function(o, v) {
|
|
1512
|
+
o["default"] = v;
|
|
1513
|
+
});
|
|
1514
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
1515
|
+
if (mod && mod.__esModule) return mod;
|
|
1516
|
+
var result = {};
|
|
1517
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
1518
|
+
__setModuleDefault(result, mod);
|
|
1519
|
+
return result;
|
|
1520
|
+
};
|
|
1521
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1522
|
+
exports.Fill = void 0;
|
|
1523
|
+
const React = __importStar(__webpack_require__(/*! react */ "react"));
|
|
1524
|
+
const react_dom_1 = __webpack_require__(/*! react-dom */ "react-dom");
|
|
1525
|
+
const context_1 = __webpack_require__(/*! ./context */ "./src/slot-fill/context.tsx");
|
|
1526
|
+
const lodash_1 = __webpack_require__(/*! lodash */ "lodash");
|
|
1527
|
+
let occurrences = 0;
|
|
1528
|
+
const FillComponent = ({ name, children, registerFill, unregisterFill, }) => {
|
|
1529
|
+
const slot = context_1.useSlot(name);
|
|
1530
|
+
const ref = React.useRef({
|
|
1531
|
+
name,
|
|
1532
|
+
children,
|
|
1533
|
+
occurrence: 0,
|
|
1534
|
+
});
|
|
1535
|
+
if (!ref.current.occurrence) {
|
|
1536
|
+
ref.current.occurrence = ++occurrences;
|
|
1537
|
+
}
|
|
1538
|
+
React.useLayoutEffect(() => {
|
|
1539
|
+
registerFill(name, ref.current);
|
|
1540
|
+
return () => unregisterFill(name, ref.current);
|
|
1541
|
+
}, []);
|
|
1542
|
+
React.useLayoutEffect(() => {
|
|
1543
|
+
ref.current.children = children;
|
|
1544
|
+
if (slot && !slot.props.bubblesVirtually) {
|
|
1545
|
+
slot.forceUpdate();
|
|
1546
|
+
}
|
|
1547
|
+
}, [children]);
|
|
1548
|
+
React.useLayoutEffect(() => {
|
|
1549
|
+
if (name === ref.current.name) {
|
|
1550
|
+
// ignore initial effect
|
|
1551
|
+
return;
|
|
1552
|
+
}
|
|
1553
|
+
unregisterFill(ref.current.name, ref.current);
|
|
1554
|
+
ref.current.name = name;
|
|
1555
|
+
registerFill(name, ref.current);
|
|
1556
|
+
}, [name]);
|
|
1557
|
+
if (!slot || !slot.node || !slot.props.bubblesVirtually) {
|
|
1558
|
+
return null;
|
|
1559
|
+
}
|
|
1560
|
+
// If a function is passed as a child, provide it with the fillProps.
|
|
1561
|
+
if (lodash_1.isFunction(children)) {
|
|
1562
|
+
children = children(slot.props.fillProps);
|
|
1563
|
+
}
|
|
1564
|
+
return react_dom_1.createPortal(children, slot.node);
|
|
1565
|
+
};
|
|
1566
|
+
const Fill = props => {
|
|
1567
|
+
return (React.createElement(context_1.Consumer, null, ({ registerFill, unregisterFill }) => (React.createElement(FillComponent, Object.assign({}, props, { registerFill: registerFill, unregisterFill: unregisterFill })))));
|
|
1568
|
+
};
|
|
1569
|
+
exports.Fill = Fill;
|
|
1570
|
+
|
|
1571
|
+
|
|
1572
|
+
/***/ }),
|
|
1573
|
+
|
|
1574
|
+
/***/ "./src/slot-fill/index.ts":
|
|
1575
|
+
/*!********************************!*\
|
|
1576
|
+
!*** ./src/slot-fill/index.ts ***!
|
|
1577
|
+
\********************************/
|
|
1578
|
+
/*! no static exports found */
|
|
1579
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1580
|
+
|
|
1581
|
+
"use strict";
|
|
1582
|
+
|
|
1583
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
1584
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
1585
|
+
};
|
|
1586
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1587
|
+
exports.SlotFillProvider = exports.Fill = exports.Slot = void 0;
|
|
1588
|
+
const slot_1 = __webpack_require__(/*! ./slot */ "./src/slot-fill/slot.tsx");
|
|
1589
|
+
Object.defineProperty(exports, "Slot", { enumerable: true, get: function () { return slot_1.Slot; } });
|
|
1590
|
+
const fill_1 = __webpack_require__(/*! ./fill */ "./src/slot-fill/fill.tsx");
|
|
1591
|
+
Object.defineProperty(exports, "Fill", { enumerable: true, get: function () { return fill_1.Fill; } });
|
|
1592
|
+
const context_1 = __importDefault(__webpack_require__(/*! ./context */ "./src/slot-fill/context.tsx"));
|
|
1593
|
+
exports.SlotFillProvider = context_1.default;
|
|
1594
|
+
|
|
1595
|
+
|
|
1596
|
+
/***/ }),
|
|
1597
|
+
|
|
1598
|
+
/***/ "./src/slot-fill/slot.tsx":
|
|
1599
|
+
/*!********************************!*\
|
|
1600
|
+
!*** ./src/slot-fill/slot.tsx ***!
|
|
1601
|
+
\********************************/
|
|
1602
|
+
/*! no static exports found */
|
|
1603
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1604
|
+
|
|
1605
|
+
"use strict";
|
|
1606
|
+
|
|
1607
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
1608
|
+
if (k2 === undefined) k2 = k;
|
|
1609
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
1610
|
+
}) : (function(o, m, k, k2) {
|
|
1611
|
+
if (k2 === undefined) k2 = k;
|
|
1612
|
+
o[k2] = m[k];
|
|
1613
|
+
}));
|
|
1614
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
1615
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
1616
|
+
}) : function(o, v) {
|
|
1617
|
+
o["default"] = v;
|
|
1618
|
+
});
|
|
1619
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
1620
|
+
if (mod && mod.__esModule) return mod;
|
|
1621
|
+
var result = {};
|
|
1622
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
1623
|
+
__setModuleDefault(result, mod);
|
|
1624
|
+
return result;
|
|
1625
|
+
};
|
|
1626
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1627
|
+
exports.Slot = void 0;
|
|
1628
|
+
const lodash_1 = __webpack_require__(/*! lodash */ "lodash");
|
|
1629
|
+
const React = __importStar(__webpack_require__(/*! react */ "react"));
|
|
1630
|
+
const context_1 = __webpack_require__(/*! ./context */ "./src/slot-fill/context.tsx");
|
|
1631
|
+
const utils_1 = __webpack_require__(/*! ./utils */ "./src/slot-fill/utils/index.ts");
|
|
1632
|
+
class SlotComponent extends React.Component {
|
|
1633
|
+
constructor(props) {
|
|
1634
|
+
super(props);
|
|
1635
|
+
this.bindNode = this.bindNode.bind(this);
|
|
1636
|
+
}
|
|
1637
|
+
componentDidMount() {
|
|
1638
|
+
const { registerSlot } = this.props;
|
|
1639
|
+
registerSlot(this.props.name, this);
|
|
1640
|
+
}
|
|
1641
|
+
componentWillUnmount() {
|
|
1642
|
+
const { unregisterSlot } = this.props;
|
|
1643
|
+
unregisterSlot(this.props.name, this);
|
|
1644
|
+
}
|
|
1645
|
+
componentDidUpdate(prevProps) {
|
|
1646
|
+
const { name, unregisterSlot, registerSlot } = this.props;
|
|
1647
|
+
// Commented following as we need the Slot to render at multiple places
|
|
1648
|
+
// if (prevProps.name !== name) {
|
|
1649
|
+
// unregisterSlot(prevProps.name);
|
|
1650
|
+
// registerSlot(name, this);
|
|
1651
|
+
// }
|
|
1652
|
+
}
|
|
1653
|
+
bindNode(node) {
|
|
1654
|
+
this.node = node;
|
|
1655
|
+
}
|
|
1656
|
+
render() {
|
|
1657
|
+
const { children, name, bubblesVirtually = false, fillProps = {}, getFills, className, } = this.props;
|
|
1658
|
+
if (bubblesVirtually) {
|
|
1659
|
+
return React.createElement("div", { ref: this.bindNode, className: className });
|
|
1660
|
+
}
|
|
1661
|
+
const fills = lodash_1.map(getFills(name, this), fill => {
|
|
1662
|
+
const fillKey = fill.occurrence;
|
|
1663
|
+
const fillChildren = lodash_1.isFunction(fill.children)
|
|
1664
|
+
? fill.children(fillProps)
|
|
1665
|
+
: fill.children;
|
|
1666
|
+
return React.Children.map(fillChildren, (child, childIndex) => {
|
|
1667
|
+
if (!child || lodash_1.isString(child)) {
|
|
1668
|
+
return child;
|
|
1669
|
+
}
|
|
1670
|
+
const childKey = `${fillKey}---${child.key || childIndex}`;
|
|
1671
|
+
return React.cloneElement(child, { key: childKey });
|
|
1672
|
+
});
|
|
1673
|
+
}).filter(
|
|
1674
|
+
// In some cases fills are rendered only when some conditions apply.
|
|
1675
|
+
// This ensures that we only use non-empty fills when rendering, i.e.,
|
|
1676
|
+
// it allows us to render wrappers only when the fills are actually present.
|
|
1677
|
+
lodash_1.negate(utils_1.isEmptyElement));
|
|
1678
|
+
return React.createElement(React.Fragment, null, lodash_1.isFunction(children) ? children(fills) : fills);
|
|
1679
|
+
}
|
|
1680
|
+
}
|
|
1681
|
+
const Slot = props => {
|
|
1682
|
+
return (React.createElement(context_1.Consumer, null, ({ registerSlot, unregisterSlot, getFills }) => (React.createElement(SlotComponent, Object.assign({}, props, { getFills: getFills, registerSlot: registerSlot, unregisterSlot: unregisterSlot })))));
|
|
1683
|
+
};
|
|
1684
|
+
exports.Slot = Slot;
|
|
1685
|
+
|
|
1686
|
+
|
|
1687
|
+
/***/ }),
|
|
1688
|
+
|
|
1689
|
+
/***/ "./src/slot-fill/utils/index.ts":
|
|
1690
|
+
/*!**************************************!*\
|
|
1691
|
+
!*** ./src/slot-fill/utils/index.ts ***!
|
|
1692
|
+
\**************************************/
|
|
1693
|
+
/*! no static exports found */
|
|
1694
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1695
|
+
|
|
1696
|
+
"use strict";
|
|
1697
|
+
|
|
1698
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
1699
|
+
if (k2 === undefined) k2 = k;
|
|
1700
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
1701
|
+
}) : (function(o, m, k, k2) {
|
|
1702
|
+
if (k2 === undefined) k2 = k;
|
|
1703
|
+
o[k2] = m[k];
|
|
1704
|
+
}));
|
|
1705
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
1706
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
1707
|
+
};
|
|
1708
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1709
|
+
__exportStar(__webpack_require__(/*! ./isEmptyElement */ "./src/slot-fill/utils/isEmptyElement.tsx"), exports);
|
|
1710
|
+
|
|
1711
|
+
|
|
1712
|
+
/***/ }),
|
|
1713
|
+
|
|
1714
|
+
/***/ "./src/slot-fill/utils/isEmptyElement.tsx":
|
|
1715
|
+
/*!************************************************!*\
|
|
1716
|
+
!*** ./src/slot-fill/utils/isEmptyElement.tsx ***!
|
|
1717
|
+
\************************************************/
|
|
1718
|
+
/*! no static exports found */
|
|
1719
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
1720
|
+
|
|
1721
|
+
"use strict";
|
|
1722
|
+
|
|
1723
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1724
|
+
exports.isEmptyElement = void 0;
|
|
1725
|
+
const lodash_1 = __webpack_require__(/*! lodash */ "lodash");
|
|
1726
|
+
/**
|
|
1727
|
+
* Checks if the provided element to check.
|
|
1728
|
+
*
|
|
1729
|
+
* @param element React Component to check.
|
|
1730
|
+
* @returns True when an element is considered empty.
|
|
1731
|
+
*/
|
|
1732
|
+
const isEmptyElement = (element) => {
|
|
1733
|
+
if (lodash_1.isNumber(element)) {
|
|
1734
|
+
return false;
|
|
1735
|
+
}
|
|
1736
|
+
if (lodash_1.isString(element) || lodash_1.isArray(element)) {
|
|
1737
|
+
return !element.length;
|
|
1738
|
+
}
|
|
1739
|
+
return !element;
|
|
1740
|
+
};
|
|
1741
|
+
exports.isEmptyElement = isEmptyElement;
|
|
1742
|
+
|
|
1743
|
+
|
|
1211
1744
|
/***/ }),
|
|
1212
1745
|
|
|
1213
1746
|
/***/ "./src/utils/index.ts":
|
|
@@ -1227,7 +1760,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
1227
1760
|
o[k2] = m[k];
|
|
1228
1761
|
}));
|
|
1229
1762
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
1230
|
-
for (var p in m) if (p !== "default" && !
|
|
1763
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
1231
1764
|
};
|
|
1232
1765
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1233
1766
|
__exportStar(__webpack_require__(/*! ./route-utils */ "./src/utils/route-utils.tsx"), exports);
|
|
@@ -1259,7 +1792,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
1259
1792
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
1260
1793
|
if (mod && mod.__esModule) return mod;
|
|
1261
1794
|
var result = {};
|
|
1262
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
1795
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
1263
1796
|
__setModuleDefault(result, mod);
|
|
1264
1797
|
return result;
|
|
1265
1798
|
};
|
|
@@ -1455,18 +1988,20 @@ function getMenus(path, menuData) {
|
|
|
1455
1988
|
return root.children;
|
|
1456
1989
|
}
|
|
1457
1990
|
exports.getMenus = getMenus;
|
|
1458
|
-
|
|
1991
|
+
const renderRoutes = (routes, solidRoutes, extraProps = {}, switchProps = {}) => routes ? (React.createElement(React.Fragment, null, [
|
|
1459
1992
|
...solidRoutes,
|
|
1460
1993
|
...routes.map((route, i) => (React.createElement(react_router_dom_1.Route, { key: route.key || i, path: route.path, exact: route.exact, strict: route.strict, render: props => route.render ? (route.render(Object.assign(Object.assign(Object.assign({}, props), extraProps), { route: route }))) : (React.createElement(route.component, Object.assign({}, props, extraProps, { route: route }))) }))),
|
|
1461
1994
|
])) : null;
|
|
1995
|
+
exports.renderRoutes = renderRoutes;
|
|
1462
1996
|
function sortKeys(routeData) {
|
|
1463
1997
|
return defaultSortKeys(routeData, { compare });
|
|
1464
1998
|
}
|
|
1465
1999
|
exports.sortKeys = sortKeys;
|
|
1466
|
-
|
|
2000
|
+
const getSortedRoutes = (path, routeData, authWrapper = null) => {
|
|
1467
2001
|
const sortedRoutes = sortKeys(routeData);
|
|
1468
2002
|
return getRoutes(path, sortedRoutes, authWrapper);
|
|
1469
2003
|
};
|
|
2004
|
+
exports.getSortedRoutes = getSortedRoutes;
|
|
1470
2005
|
const compare = ((a, b) => {
|
|
1471
2006
|
const aStr = String(a).toLowerCase();
|
|
1472
2007
|
const bStr = String(b).toLowerCase();
|
|
@@ -1579,6 +2114,17 @@ module.exports = require("react");
|
|
|
1579
2114
|
|
|
1580
2115
|
/***/ }),
|
|
1581
2116
|
|
|
2117
|
+
/***/ "react-dom":
|
|
2118
|
+
/*!****************************!*\
|
|
2119
|
+
!*** external "react-dom" ***!
|
|
2120
|
+
\****************************/
|
|
2121
|
+
/*! no static exports found */
|
|
2122
|
+
/***/ (function(module, exports) {
|
|
2123
|
+
|
|
2124
|
+
module.exports = require("react-dom");
|
|
2125
|
+
|
|
2126
|
+
/***/ }),
|
|
2127
|
+
|
|
1582
2128
|
/***/ "react-router":
|
|
1583
2129
|
/*!*******************************!*\
|
|
1584
2130
|
!*** external "react-router" ***!
|