maishu-chitu-react
Advanced tools
Comparing version 1.30.0 to 1.32.0
@@ -270,6 +270,17 @@ /*! | ||
case 8: | ||
// if (isClassComponent(action)) { | ||
// console.assert(this.app != null); | ||
// let app = this.app; | ||
props = { | ||
props = {}; | ||
if (!action.prototype.loadProps) { | ||
_context.next = 13; | ||
break; | ||
} | ||
_context.next = 12; | ||
return action.prototype.loadProps(); | ||
case 12: | ||
props = _context.sent; | ||
case 13: | ||
Object.assign(props, { | ||
app: app, | ||
@@ -287,13 +298,8 @@ data: page.data, | ||
} | ||
}; // let element = React.createElement(PageContext.Provider, { value: { page: page as Page } }, | ||
element = React.createElement(action, props); // ) | ||
}); | ||
element = React.createElement(action, props); | ||
component = ReactDOM.render(element, page.element); | ||
page.component = component; // } | ||
// else { | ||
// action(page); | ||
// } | ||
page.component = component; | ||
case 12: | ||
case 17: | ||
case "end": | ||
@@ -355,19 +361,4 @@ return _context.stop(); | ||
exports.Application = Application; | ||
function isClassComponent(component) { | ||
return typeof component === 'function' && !!component.prototype.isReactComponent ? true : false; | ||
} | ||
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), | ||
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); // function isFunctionComponent(component: any) { | ||
// return ( | ||
// typeof component === 'function' && | ||
// String(component).includes('return React.createElement') | ||
// ) ? true : false; | ||
// } | ||
// function isReactComponent(component: any) { | ||
// return ( | ||
// isClassComponent(component) || | ||
// isFunctionComponent(component) | ||
// ) ? true : false; | ||
// } | ||
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); | ||
//# sourceMappingURL=application.js.map | ||
@@ -374,0 +365,0 @@ |
@@ -10,3 +10,3 @@ /*! | ||
*/ | ||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("react"),require("react-dom"),require("maishu-chitu"));else if("function"==typeof define&&define.amd)define(["react","react-dom","maishu-chitu"],t);else{var n="object"==typeof exports?t(require("react"),require("react-dom"),require("maishu-chitu")):t(e.react,e["react-dom"],e["maishu-chitu"]);for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}("undefined"==typeof window?global:window,function(e,t,n){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";var r,o;r=[n,t,n(1)],void 0===(o=function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.Page=t.Application=void 0,Object.defineProperty(t,"Application",{enumerable:!0,get:function(){return n.Application}}),Object.defineProperty(t,"Page",{enumerable:!0,get:function(){return n.Page}})}.apply(t,r))||(e.exports=o)},function(e,t,n){"use strict";var r,o;function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function u(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e,t,n){return t&&u(e.prototype,t),n&&u(e,n),e}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t){return!t||"object"!==i(t)&&"function"!=typeof t?l(e):t}function l(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function p(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&d(e,t)}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var y=function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function u(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(u,a)}c((r=r.apply(e,t||[])).next())})};r=[n,t,n(2),n(3),n(4),n(5)],void 0===(o=function(e,t,n,r,o,i){Object.defineProperty(t,"__esModule",{value:!0}),t.Application=t.Page=void 0;var u=function(e){function t(){var e;return c(this,t),(e=f(this,s(t).apply(this,arguments))).component=null,e}return p(t,o.Page),t}();t.Page=u;var d=function(){function e(t){c(this,e),this.nodes={},this.modulesPath=t.endsWith("/")?t.substr(0,t.length-1):t}return a(e,[{key:"parse",value:function(e){var t=this,n=this.nodes[e];if(null==n){var r="".concat(e).split("_").join("/");this.modulesPath&&(r="".concat(this.modulesPath,"/").concat(r)),n={action:this.createDefaultAction(r,function(e){return t.loadjs(e)}),name:e},this.nodes[e]=n}return n}},{key:"createDefaultAction",value:function(e,t){var o=this;return function(u,a){return y(o,void 0,void 0,regeneratorRuntime.mark(function o(){var c,f,l,s,p;return regeneratorRuntime.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,t(e);case 2:if(c=o.sent){o.next=5;break}throw i.Errors.exportsCanntNull(e);case 5:if(null!=(f=c.default)){o.next=8;break}throw i.Errors.canntFindAction(u.name);case 8:l={app:a,data:u.data,events:{shown:u.shown,showing:u.showing,hidden:u.hidden,hiding:u.hiding},source:u,createService:function(e){return u.createService(e)}},s=n.createElement(f,l),p=r.render(s,u.element),u.component=p;case 12:case"end":return o.stop()}},o)}))}}}]),e}(),h=function(e){function t(e){var n;return c(this,t),void 0===(e=e||{}).modulesPath&&(e.modulesPath="modules"),e.parser||(e.parser=t.createPageNodeParser(e.modulesPath)),n=f(this,s(t).call(this,e)),e.parser.app=l(n),e.parser.loadjs=function(e){return n.loadjs(e)},n.pageType=u,n}return p(t,o.Application),a(t,null,[{key:"createPageNodeParser",value:function(e){return new d(e)}}]),t}();t.Application=h}.apply(t,r))||(e.exports=o)},function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t){e.exports=n},function(e,t,n){"use strict";var r;function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}void 0===(r=function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Errors=void 0;var n=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n,r;return t=e,r=[{key:"canntFindAction",value:function(e){var t="Cannt find action in page '".concat(e,"', is the exports has default field?");return new Error(t)}},{key:"exportsCanntNull",value:function(e){var t="Exports of page '".concat(e,"' is null.");return new Error(t)}}],(n=null)&&o(t.prototype,n),r&&o(t,r),e}();t.Errors=n}.apply(t,[n,t]))||(e.exports=r)}])}); | ||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("react"),require("react-dom"),require("maishu-chitu"));else if("function"==typeof define&&define.amd)define(["react","react-dom","maishu-chitu"],t);else{var n="object"==typeof exports?t(require("react"),require("react-dom"),require("maishu-chitu")):t(e.react,e["react-dom"],e["maishu-chitu"]);for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}("undefined"==typeof window?global:window,function(e,t,n){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";var r,o;r=[n,t,n(1)],void 0===(o=function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.Page=t.Application=void 0,Object.defineProperty(t,"Application",{enumerable:!0,get:function(){return n.Application}}),Object.defineProperty(t,"Page",{enumerable:!0,get:function(){return n.Page}})}.apply(t,r))||(e.exports=o)},function(e,t,n){"use strict";var r,o;function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function u(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e,t,n){return t&&u(e.prototype,t),n&&u(e,n),e}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t){return!t||"object"!==i(t)&&"function"!=typeof t?s(e):t}function s(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function p(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&d(e,t)}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var y=function(e,t,n,r){return new(n||(n=Promise))(function(o,i){function u(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(u,a)}c((r=r.apply(e,t||[])).next())})};r=[n,t,n(2),n(3),n(4),n(5)],void 0===(o=function(e,t,n,r,o,i){Object.defineProperty(t,"__esModule",{value:!0}),t.Application=t.Page=void 0;var u=function(e){function t(){var e;return c(this,t),(e=f(this,l(t).apply(this,arguments))).component=null,e}return p(t,o.Page),t}();t.Page=u;var d=function(){function e(t){c(this,e),this.nodes={},this.modulesPath=t.endsWith("/")?t.substr(0,t.length-1):t}return a(e,[{key:"parse",value:function(e){var t=this,n=this.nodes[e];if(null==n){var r="".concat(e).split("_").join("/");this.modulesPath&&(r="".concat(this.modulesPath,"/").concat(r)),n={action:this.createDefaultAction(r,function(e){return t.loadjs(e)}),name:e},this.nodes[e]=n}return n}},{key:"createDefaultAction",value:function(e,t){var o=this;return function(u,a){return y(o,void 0,void 0,regeneratorRuntime.mark(function o(){var c,f,s,l,p;return regeneratorRuntime.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,t(e);case 2:if(c=o.sent){o.next=5;break}throw i.Errors.exportsCanntNull(e);case 5:if(null!=(f=c.default)){o.next=8;break}throw i.Errors.canntFindAction(u.name);case 8:if(s={},!f.prototype.loadProps){o.next=13;break}return o.next=12,f.prototype.loadProps();case 12:s=o.sent;case 13:Object.assign(s,{app:a,data:u.data,events:{shown:u.shown,showing:u.showing,hidden:u.hidden,hiding:u.hiding},source:u,createService:function(e){return u.createService(e)}}),l=n.createElement(f,s),p=r.render(l,u.element),u.component=p;case 17:case"end":return o.stop()}},o)}))}}}]),e}(),h=function(e){function t(e){var n;return c(this,t),void 0===(e=e||{}).modulesPath&&(e.modulesPath="modules"),e.parser||(e.parser=t.createPageNodeParser(e.modulesPath)),n=f(this,l(t).call(this,e)),e.parser.app=s(n),e.parser.loadjs=function(e){return n.loadjs(e)},n.pageType=u,n}return p(t,o.Application),a(t,null,[{key:"createPageNodeParser",value:function(e){return new d(e)}}]),t}();t.Application=h}.apply(t,r))||(e.exports=o)},function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t){e.exports=n},function(e,t,n){"use strict";var r;function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}void 0===(r=function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Errors=void 0;var n=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n,r;return t=e,r=[{key:"canntFindAction",value:function(e){var t="Cannt find action in page '".concat(e,"', is the exports has default field?");return new Error(t)}},{key:"exportsCanntNull",value:function(e){var t="Exports of page '".concat(e,"' is null.");return new Error(t)}}],(n=null)&&o(t.prototype,n),r&&o(t,r),e}();t.Errors=n}.apply(t,[n,t]))||(e.exports=r)}])}); | ||
//# sourceMappingURL=index.es5.min.js.map |
@@ -163,6 +163,7 @@ /*! | ||
} | ||
// if (isClassComponent(action)) { | ||
// console.assert(this.app != null); | ||
// let app = this.app; | ||
let props = { | ||
let props = {}; | ||
if (action.prototype.loadProps) { | ||
props = yield action.prototype.loadProps(); | ||
} | ||
Object.assign(props, { | ||
app: app, | ||
@@ -180,12 +181,6 @@ data: page.data, | ||
} | ||
}; | ||
// let element = React.createElement(PageContext.Provider, { value: { page: page as Page } }, | ||
}); | ||
let element = React.createElement(action, props); | ||
// ) | ||
let component = ReactDOM.render(element, page.element); | ||
page.component = component; | ||
// } | ||
// else { | ||
// action(page); | ||
// } | ||
}); | ||
@@ -216,20 +211,4 @@ } | ||
exports.Application = Application; | ||
function isClassComponent(component) { | ||
return (typeof component === 'function' && | ||
!!component.prototype.isReactComponent) ? true : false; | ||
} | ||
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), | ||
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); | ||
// function isFunctionComponent(component: any) { | ||
// return ( | ||
// typeof component === 'function' && | ||
// String(component).includes('return React.createElement') | ||
// ) ? true : false; | ||
// } | ||
// function isReactComponent(component: any) { | ||
// return ( | ||
// isClassComponent(component) || | ||
// isFunctionComponent(component) | ||
// ) ? true : false; | ||
// } | ||
@@ -236,0 +215,0 @@ |
@@ -10,3 +10,3 @@ /*! | ||
*/ | ||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("react"),require("react-dom"),require("maishu-chitu"));else if("function"==typeof define&&define.amd)define(["react","react-dom","maishu-chitu"],t);else{var r="object"==typeof exports?t(require("react"),require("react-dom"),require("maishu-chitu")):t(e.react,e["react-dom"],e["maishu-chitu"]);for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}("undefined"==typeof window?global:window,function(e,t,r){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){var n,o;n=[r,t,r(1)],void 0===(o=function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Page=t.Application=void 0,Object.defineProperty(t,"Application",{enumerable:!0,get:function(){return r.Application}}),Object.defineProperty(t,"Page",{enumerable:!0,get:function(){return r.Page}})}.apply(t,n))||(e.exports=o)},function(e,t,r){var n,o,i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{s(n.next(e))}catch(e){i(e)}}function u(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,u)}s((n=n.apply(e,t||[])).next())})};n=[r,t,r(2),r(3),r(4),r(5)],void 0===(o=function(e,t,r,n,o,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Application=t.Page=void 0;class u extends o.Page{constructor(){super(...arguments),this.component=null}}t.Page=u;class s{constructor(e){this.nodes={},this.modulesPath=e.endsWith("/")?e.substr(0,e.length-1):e}parse(e){let t=this.nodes[e];if(null==t){let r=`${e}`.split("_").join("/");this.modulesPath&&(r=`${this.modulesPath}/${r}`),t={action:this.createDefaultAction(r,e=>this.loadjs(e)),name:e},this.nodes[e]=t}return t}createDefaultAction(e,t){return(o,u)=>i(this,void 0,void 0,function*(){let i=yield t(e);if(!i)throw a.Errors.exportsCanntNull(e);let s=i.default;if(null==s)throw a.Errors.canntFindAction(o.name);let c={app:u,data:o.data,events:{shown:o.shown,showing:o.showing,hidden:o.hidden,hiding:o.hiding},source:o,createService:e=>o.createService(e)},l=r.createElement(s,c),d=n.render(l,o.element);o.component=d})}}class c extends o.Application{constructor(e){void 0===(e=e||{}).modulesPath&&(e.modulesPath="modules"),e.parser||(e.parser=c.createPageNodeParser(e.modulesPath)),super(e),e.parser.app=this,e.parser.loadjs=e=>this.loadjs(e),this.pageType=u}static createPageNodeParser(e){return new s(e)}}t.Application=c}.apply(t,n))||(e.exports=o)},function(t,r){t.exports=e},function(e,r){e.exports=t},function(e,t){e.exports=r},function(e,t,r){var n;void 0===(n=function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Errors=void 0;t.Errors=class{static canntFindAction(e){return new Error(`Cannt find action in page '${e}', is the exports has default field?`)}static exportsCanntNull(e){return new Error(`Exports of page '${e}' is null.`)}}}.apply(t,[r,t]))||(e.exports=n)}])}); | ||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("react"),require("react-dom"),require("maishu-chitu"));else if("function"==typeof define&&define.amd)define(["react","react-dom","maishu-chitu"],t);else{var r="object"==typeof exports?t(require("react"),require("react-dom"),require("maishu-chitu")):t(e.react,e["react-dom"],e["maishu-chitu"]);for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}("undefined"==typeof window?global:window,function(e,t,r){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){var n,o;n=[r,t,r(1)],void 0===(o=function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Page=t.Application=void 0,Object.defineProperty(t,"Application",{enumerable:!0,get:function(){return r.Application}}),Object.defineProperty(t,"Page",{enumerable:!0,get:function(){return r.Page}})}.apply(t,n))||(e.exports=o)},function(e,t,r){var n,o,i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{s(n.next(e))}catch(e){i(e)}}function u(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,u)}s((n=n.apply(e,t||[])).next())})};n=[r,t,r(2),r(3),r(4),r(5)],void 0===(o=function(e,t,r,n,o,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Application=t.Page=void 0;class u extends o.Page{constructor(){super(...arguments),this.component=null}}t.Page=u;class s{constructor(e){this.nodes={},this.modulesPath=e.endsWith("/")?e.substr(0,e.length-1):e}parse(e){let t=this.nodes[e];if(null==t){let r=`${e}`.split("_").join("/");this.modulesPath&&(r=`${this.modulesPath}/${r}`),t={action:this.createDefaultAction(r,e=>this.loadjs(e)),name:e},this.nodes[e]=t}return t}createDefaultAction(e,t){return(o,u)=>i(this,void 0,void 0,function*(){let i=yield t(e);if(!i)throw a.Errors.exportsCanntNull(e);let s=i.default;if(null==s)throw a.Errors.canntFindAction(o.name);let c={};s.prototype.loadProps&&(c=yield s.prototype.loadProps()),Object.assign(c,{app:u,data:o.data,events:{shown:o.shown,showing:o.showing,hidden:o.hidden,hiding:o.hiding},source:o,createService:e=>o.createService(e)});let l=r.createElement(s,c),p=n.render(l,o.element);o.component=p})}}class c extends o.Application{constructor(e){void 0===(e=e||{}).modulesPath&&(e.modulesPath="modules"),e.parser||(e.parser=c.createPageNodeParser(e.modulesPath)),super(e),e.parser.app=this,e.parser.loadjs=e=>this.loadjs(e),this.pageType=u}static createPageNodeParser(e){return new s(e)}}t.Application=c}.apply(t,n))||(e.exports=o)},function(t,r){t.exports=e},function(e,r){e.exports=t},function(e,t){e.exports=r},function(e,t,r){var n;void 0===(n=function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Errors=void 0;t.Errors=class{static canntFindAction(e){return new Error(`Cannt find action in page '${e}', is the exports has default field?`)}static exportsCanntNull(e){return new Error(`Exports of page '${e}' is null.`)}}}.apply(t,[r,t]))||(e.exports=n)}])}); | ||
//# sourceMappingURL=index.min.js.map |
@@ -155,6 +155,17 @@ "use strict"; | ||
case 8: | ||
// if (isClassComponent(action)) { | ||
// console.assert(this.app != null); | ||
// let app = this.app; | ||
props = { | ||
props = {}; | ||
if (!action.prototype.loadProps) { | ||
_context.next = 13; | ||
break; | ||
} | ||
_context.next = 12; | ||
return action.prototype.loadProps(); | ||
case 12: | ||
props = _context.sent; | ||
case 13: | ||
Object.assign(props, { | ||
app: app, | ||
@@ -172,13 +183,8 @@ data: page.data, | ||
} | ||
}; // let element = React.createElement(PageContext.Provider, { value: { page: page as Page } }, | ||
element = React.createElement(action, props); // ) | ||
}); | ||
element = React.createElement(action, props); | ||
component = ReactDOM.render(element, page.element); | ||
page.component = component; // } | ||
// else { | ||
// action(page); | ||
// } | ||
page.component = component; | ||
case 12: | ||
case 17: | ||
case "end": | ||
@@ -240,18 +246,3 @@ return _context.stop(); | ||
exports.Application = Application; | ||
function isClassComponent(component) { | ||
return typeof component === 'function' && !!component.prototype.isReactComponent ? true : false; | ||
} | ||
}); // function isFunctionComponent(component: any) { | ||
// return ( | ||
// typeof component === 'function' && | ||
// String(component).includes('return React.createElement') | ||
// ) ? true : false; | ||
// } | ||
// function isReactComponent(component: any) { | ||
// return ( | ||
// isClassComponent(component) || | ||
// isFunctionComponent(component) | ||
// ) ? true : false; | ||
// } | ||
}); | ||
//# sourceMappingURL=application.js.map |
@@ -49,6 +49,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
} | ||
// if (isClassComponent(action)) { | ||
// console.assert(this.app != null); | ||
// let app = this.app; | ||
let props = { | ||
let props = {}; | ||
if (action.prototype.loadProps) { | ||
props = yield action.prototype.loadProps(); | ||
} | ||
Object.assign(props, { | ||
app: app, | ||
@@ -66,12 +67,6 @@ data: page.data, | ||
} | ||
}; | ||
// let element = React.createElement(PageContext.Provider, { value: { page: page as Page } }, | ||
}); | ||
let element = React.createElement(action, props); | ||
// ) | ||
let component = ReactDOM.render(element, page.element); | ||
page.component = component; | ||
// } | ||
// else { | ||
// action(page); | ||
// } | ||
}); | ||
@@ -102,18 +97,2 @@ } | ||
exports.Application = Application; | ||
function isClassComponent(component) { | ||
return (typeof component === 'function' && | ||
!!component.prototype.isReactComponent) ? true : false; | ||
} | ||
}); | ||
// function isFunctionComponent(component: any) { | ||
// return ( | ||
// typeof component === 'function' && | ||
// String(component).includes('return React.createElement') | ||
// ) ? true : false; | ||
// } | ||
// function isReactComponent(component: any) { | ||
// return ( | ||
// isClassComponent(component) || | ||
// isFunctionComponent(component) | ||
// ) ? true : false; | ||
// } |
{ | ||
"name": "maishu-chitu-react", | ||
"version": "1.30.0", | ||
"version": "1.32.0", | ||
"description": "", | ||
@@ -21,3 +21,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"maishu-chitu": "^3.6.4", | ||
"maishu-chitu": "^3.40.0", | ||
"maishu-chitu-service": "^1.1.16", | ||
@@ -41,2 +41,2 @@ "react": "^16.8.2", | ||
} | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
499235
2853
Updatedmaishu-chitu@^3.40.0