@moneko/core 2.0.32 → 2.0.33
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(){return(e=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)}import r,{Fragment as t,Suspense as a,cloneElement as n,createElement as o,useEffect as i,isValidElement as
|
|
1
|
+
function e(){return(e=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)}import r,{Fragment as t,Suspense as a,cloneElement as n,createElement as o,useEffect as i,isValidElement as l}from"react";import{isObject as c}from"@moneko/common";import{AliveScope as p,KeepAlive as m,useAliveController as u}from"react-activation";import{createBrowserRouter as f,createHashRouter as s}from"react-router-dom";import{router as d}from"../router";var h=fallbackCompPath?require("./fallback").default:r.createElement(r.Fragment,null),g=function(t){var a=t.children,o=t.name,l=function(e,r){if(null==e)return{};var t,a,n={},o=Object.keys(e);for(a=0;a<o.length;a++)r.indexOf(t=o[a])>=0||(n[t]=e[t]);return n}(t,["children","name"]),c=u(),p=c.drop,f=c.dropScope,s=c.clear,d=c.getCachingNodes,h=window.location.pathname+window.location.hash;return i(function(){window.__POWERED_BY_QIANKUN__&&window.primaryApp&&(window.primaryApp.currentTarget||(window.primaryApp.currentTarget={}),Object.assign(window.primaryApp.currentTarget,{aliveController:{drop:p,dropScope:f,clear:s,getCachingNodes:d}}))},[s,p,f,d]),r.createElement(m,e({id:h,name:h},l),n(a,{path:o,selfUrl:h}))},v=!1;export var createRouter="hash"===programInfo.routerMode?s:f;export var RouterFragment=t;export function prefixRouter(e,t){return e.map(function(e){var i=Object.assign({},e);if(i.alive&&!v&&(v=!0,RouterFragment=p),i.element){var m=Object.assign({path:i.key},i.props),u=l(i.element)?n(i.element,m):o(i.element,m);if(i.alive){var f={name:i.key,cacheKey:i.key};c(i.alive)&&Object.assign(f,i.alive),i.element=o(g,f,u)}else i.element=r.createElement(a,{fallback:e.fallback||t},u)}return Array.isArray(i.children)&&(i.children=prefixRouter(i.children,t)),i})}export var routerData=prefixRouter(d,r.createElement(h,null));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
export interface FallbackCompProps {
|
|
3
3
|
/** 组件所在父级目录(默认:components) */
|
|
4
4
|
directory?: string;
|
|
@@ -6,5 +6,6 @@ export interface FallbackCompProps {
|
|
|
6
6
|
compName: string;
|
|
7
7
|
[key: string]: any;
|
|
8
8
|
}
|
|
9
|
+
export declare const Fallback: React.FC;
|
|
9
10
|
declare const _default: React.NamedExoticComponent<FallbackCompProps>;
|
|
10
11
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(){return(e=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}import
|
|
1
|
+
function e(){return(e=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}import r,{useMemo as t,useState as n}from"react";import{useOutlet as o}from"react-router-dom";var a=function(t){var n=t.directory,o=void 0===n?"components":n,a=t.compName,c=function(e,r){if(null==e)return{};var t,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r.indexOf(t=a[n])>=0||(o[t]=e[t]);return o}(t,["directory","compName"]),l=r.Fragment;try{l=require("@/"+o+"/"+a).default}catch(e){console.info(a+" 组件不存在, 请在 @/"+o+"/"+a+" 目录下新建 index.tsx, 并导出默认组件")}return r.isValidElement(l)?null:r.createElement(l,e({},c))};export var Fallback=function(){var e,c=null==(e=o())?void 0:e.props.children,l=n(r.createElement(r.Fragment,null,"Loading...")),i=l[0],m=l[1];return t(function(){if("string"==typeof fallbackCompPath){var e=fallbackCompPath.replace(/@\//,"").split("/"),t=e[0],n=e.slice(1);m(r.createElement(a,{directory:t,compName:n.join("/")}))}},[]),c||i};export default r.memo(a);
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export default _default;
|
|
1
|
+
declare const Fallback: any;
|
|
2
|
+
export default Fallback;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import a from"react";var e=fallbackCompPath?require("./fallback").Fallback:function(){return a.createElement(a.Fragment,null)};export default e;
|