maishu-chitu-react
Advanced tools
Comparing version 1.34.0 to 1.35.0
/*! | ||
* | ||
* maishu-chitu-react v1.34.0 | ||
* maishu-chitu-react v1.35.0 | ||
* https://github.com/ansiboy/services-sdk | ||
@@ -241,3 +241,3 @@ * | ||
regeneratorRuntime.mark(function _callee() { | ||
var actionExports, action, props, element, component; | ||
var actionExports, action, props, partialProps, element, component; | ||
return regeneratorRuntime.wrap(function _callee$(_context) { | ||
@@ -271,17 +271,3 @@ while (1) { | ||
case 8: | ||
props = {}; | ||
if (!action.loadProps) { | ||
_context.next = 13; | ||
break; | ||
} | ||
_context.next = 12; | ||
return action.loadProps(); | ||
case 12: | ||
props = _context.sent; | ||
case 13: | ||
Object.assign(props, { | ||
props = { | ||
app: app, | ||
@@ -299,3 +285,17 @@ data: page.data, | ||
} | ||
}); | ||
}; | ||
if (!action.loadProps) { | ||
_context.next = 14; | ||
break; | ||
} | ||
_context.next = 12; | ||
return action.loadProps(props); | ||
case 12: | ||
partialProps = _context.sent; | ||
Object.assign(props, partialProps); | ||
case 14: | ||
element = React.createElement(action, props); | ||
@@ -302,0 +302,0 @@ component = ReactDOM.render(element, page.element); |
/*! | ||
* | ||
* maishu-chitu-react v1.34.0 | ||
* maishu-chitu-react v1.35.0 | ||
* https://github.com/ansiboy/services-sdk | ||
@@ -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?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.loadProps){o.next=13;break}return o.next=12,f.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)}])}); | ||
!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,d;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={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)}},!f.loadProps){o.next=14;break}return o.next=12,f.loadProps(s);case 12:l=o.sent,Object.assign(s,l);case 14:p=n.createElement(f,s),d=r.render(p,u.element),u.component=d;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 |
/*! | ||
* | ||
* maishu-chitu-react v1.34.0 | ||
* maishu-chitu-react v1.35.0 | ||
* https://github.com/ansiboy/services-sdk | ||
@@ -163,7 +163,3 @@ * | ||
} | ||
let props = {}; | ||
if (action.loadProps) { | ||
props = yield action.loadProps(); | ||
} | ||
Object.assign(props, { | ||
let props = { | ||
app: app, | ||
@@ -181,3 +177,7 @@ data: page.data, | ||
} | ||
}); | ||
}; | ||
if (action.loadProps) { | ||
let partialProps = yield action.loadProps(props); | ||
Object.assign(props, partialProps); | ||
} | ||
let element = React.createElement(action, props); | ||
@@ -184,0 +184,0 @@ let component = ReactDOM.render(element, page.element); |
/*! | ||
* | ||
* maishu-chitu-react v1.34.0 | ||
* maishu-chitu-react v1.35.0 | ||
* https://github.com/ansiboy/services-sdk | ||
@@ -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={};s.loadProps&&(c=yield s.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),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={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)};if(s.loadProps){let e=yield s.loadProps(c);Object.assign(c,e)}let 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)}])}); | ||
//# sourceMappingURL=index.min.js.map |
@@ -126,3 +126,3 @@ "use strict"; | ||
regeneratorRuntime.mark(function _callee() { | ||
var actionExports, action, props, element, component; | ||
var actionExports, action, props, partialProps, element, component; | ||
return regeneratorRuntime.wrap(function _callee$(_context) { | ||
@@ -156,17 +156,3 @@ while (1) { | ||
case 8: | ||
props = {}; | ||
if (!action.loadProps) { | ||
_context.next = 13; | ||
break; | ||
} | ||
_context.next = 12; | ||
return action.loadProps(); | ||
case 12: | ||
props = _context.sent; | ||
case 13: | ||
Object.assign(props, { | ||
props = { | ||
app: app, | ||
@@ -184,3 +170,17 @@ data: page.data, | ||
} | ||
}); | ||
}; | ||
if (!action.loadProps) { | ||
_context.next = 14; | ||
break; | ||
} | ||
_context.next = 12; | ||
return action.loadProps(props); | ||
case 12: | ||
partialProps = _context.sent; | ||
Object.assign(props, partialProps); | ||
case 14: | ||
element = React.createElement(action, props); | ||
@@ -187,0 +187,0 @@ component = ReactDOM.render(element, page.element); |
@@ -49,7 +49,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
} | ||
let props = {}; | ||
if (action.loadProps) { | ||
props = yield action.loadProps(); | ||
} | ||
Object.assign(props, { | ||
let props = { | ||
app: app, | ||
@@ -67,3 +63,7 @@ data: page.data, | ||
} | ||
}); | ||
}; | ||
if (action.loadProps) { | ||
let partialProps = yield action.loadProps(props); | ||
Object.assign(props, partialProps); | ||
} | ||
let element = React.createElement(action, props); | ||
@@ -70,0 +70,0 @@ let component = ReactDOM.render(element, page.element); |
{ | ||
"name": "maishu-chitu-react", | ||
"version": "1.34.0", | ||
"version": "1.35.0", | ||
"description": "", | ||
@@ -40,2 +40,2 @@ "main": "dist/index.js", | ||
} | ||
} | ||
} |
export { Application, Page, PageProps } from './application' | ||
export { dataLoader, LoadData } from "./data-loader"; |
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
499801
66
2862