maishu-chitu-react
Advanced tools
Comparing version 1.35.0 to 1.36.0
@@ -6,3 +6,5 @@ import React = require("react"); | ||
app: Application; | ||
data: chitu.Page["data"]; | ||
data: { | ||
[key: string]: any; | ||
}; | ||
source: Page; | ||
@@ -9,0 +11,0 @@ createService: chitu.Page["createService"]; |
export { Application, Page, PageProps } from './application'; | ||
export { dataLoader, LoadData } from "./data-loader"; |
@@ -168,3 +168,3 @@ /*! | ||
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__, exports, __webpack_require__(/*! react */ "react"), __webpack_require__(/*! react-dom */ "react-dom"), __webpack_require__(/*! maishu-chitu */ "maishu-chitu"), __webpack_require__(/*! ./errors */ "./out-es5/errors.js")], __WEBPACK_AMD_DEFINE_RESULT__ = (function (require, exports, React, ReactDOM, chitu, errors_1) { | ||
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__, exports, __webpack_require__(/*! react */ "react"), __webpack_require__(/*! react-dom */ "react-dom"), __webpack_require__(/*! maishu-chitu */ "maishu-chitu"), __webpack_require__(/*! ./errors */ "./out-es5/errors.js"), __webpack_require__(/*! ./data-loader */ "./out-es5/data-loader.js")], __WEBPACK_AMD_DEFINE_RESULT__ = (function (require, exports, React, ReactDOM, chitu, errors_1, data_loader_1) { | ||
"use strict"; | ||
@@ -242,3 +242,3 @@ | ||
regeneratorRuntime.mark(function _callee() { | ||
var actionExports, action, props, partialProps, element, component; | ||
var actionExports, action, props, partialData, element, component; | ||
return regeneratorRuntime.wrap(function _callee$(_context) { | ||
@@ -287,3 +287,3 @@ while (1) { | ||
if (!action.loadProps) { | ||
if (!(typeof action[data_loader_1.LOAD_DATA] == "function")) { | ||
_context.next = 14; | ||
@@ -294,7 +294,7 @@ break; | ||
_context.next = 12; | ||
return action.loadProps(props); | ||
return action[data_loader_1.LOAD_DATA](props); | ||
case 12: | ||
partialProps = _context.sent; | ||
Object.assign(props, partialProps); | ||
partialData = _context.sent; | ||
Object.assign(props.data, partialData); | ||
@@ -370,2 +370,36 @@ case 14: | ||
/***/ "./out-es5/data-loader.js": | ||
/*!********************************!*\ | ||
!*** ./out-es5/data-loader.js ***! | ||
\********************************/ | ||
/*! no static exports found */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__; | ||
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__, exports], __WEBPACK_AMD_DEFINE_RESULT__ = (function (require, exports) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.dataLoader = exports.LOAD_DATA = void 0; | ||
exports.LOAD_DATA = "loadData"; | ||
function dataLoader(loadData) { | ||
return function (constructor) { | ||
constructor[exports.LOAD_DATA] = loadData; | ||
return constructor; | ||
}; | ||
} | ||
exports.dataLoader = dataLoader; | ||
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), | ||
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); | ||
//# sourceMappingURL=data-loader.js.map | ||
/***/ }), | ||
/***/ "./out-es5/errors.js": | ||
@@ -437,3 +471,3 @@ /*!***************************!*\ | ||
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__, exports, __webpack_require__(/*! ./application */ "./out-es5/application.js")], __WEBPACK_AMD_DEFINE_RESULT__ = (function (require, exports, application_1) { | ||
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__, exports, __webpack_require__(/*! ./application */ "./out-es5/application.js"), __webpack_require__(/*! ./data-loader */ "./out-es5/data-loader.js")], __WEBPACK_AMD_DEFINE_RESULT__ = (function (require, exports, application_1, data_loader_1) { | ||
"use strict"; | ||
@@ -444,3 +478,3 @@ | ||
}); | ||
exports.Page = exports.Application = void 0; | ||
exports.dataLoader = exports.Page = exports.Application = void 0; | ||
Object.defineProperty(exports, "Application", { | ||
@@ -458,2 +492,8 @@ enumerable: true, | ||
}); | ||
Object.defineProperty(exports, "dataLoader", { | ||
enumerable: true, | ||
get: function get() { | ||
return data_loader_1.dataLoader; | ||
} | ||
}); | ||
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), | ||
@@ -460,0 +500,0 @@ __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); |
@@ -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,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)}])}); | ||
!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=1)}([function(e,t,n){"use strict";var r;void 0===(r=function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.dataLoader=t.LOAD_DATA=void 0,t.LOAD_DATA="loadData",t.dataLoader=function(e){return function(n){return n[t.LOAD_DATA]=e,n}}}.apply(t,[n,t]))||(e.exports=r)},function(e,t,n){"use strict";var r,o;r=[n,t,n(2),n(0)],void 0===(o=function(e,t,n,r){Object.defineProperty(t,"__esModule",{value:!0}),t.dataLoader=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}}),Object.defineProperty(t,"dataLoader",{enumerable:!0,get:function(){return r.dataLoader}})}.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(3),n(4),n(5),n(6),n(0)],void 0===(o=function(e,t,n,r,o,i,u){Object.defineProperty(t,"__esModule",{value:!0}),t.Application=t.Page=void 0;var d=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=d;var v=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(a,c){return y(o,void 0,void 0,regeneratorRuntime.mark(function o(){var f,s,l,p,d,y;return regeneratorRuntime.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,t(e);case 2:if(f=o.sent){o.next=5;break}throw i.Errors.exportsCanntNull(e);case 5:if(null!=(s=f.default)){o.next=8;break}throw i.Errors.canntFindAction(a.name);case 8:if(l={app:c,data:a.data,events:{shown:a.shown,showing:a.showing,hidden:a.hidden,hiding:a.hiding},source:a,createService:function(e){return a.createService(e)}},"function"!=typeof s[u.LOAD_DATA]){o.next=14;break}return o.next=12,s[u.LOAD_DATA](l);case 12:p=o.sent,Object.assign(l.data,p);case 14:d=n.createElement(s,l),y=r.render(d,a.element),a.component=y;case 17:case"end":return o.stop()}},o)}))}}}]),e}(),b=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=d,n}return p(t,o.Application),a(t,null,[{key:"createPageNodeParser",value:function(e){return new v(e)}}]),t}();t.Application=b}.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 |
@@ -124,3 +124,3 @@ /*! | ||
}; | ||
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__, exports, __webpack_require__(/*! react */ "react"), __webpack_require__(/*! react-dom */ "react-dom"), __webpack_require__(/*! maishu-chitu */ "maishu-chitu"), __webpack_require__(/*! ./errors */ "./out/errors.js")], __WEBPACK_AMD_DEFINE_RESULT__ = (function (require, exports, React, ReactDOM, chitu, errors_1) { | ||
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__, exports, __webpack_require__(/*! react */ "react"), __webpack_require__(/*! react-dom */ "react-dom"), __webpack_require__(/*! maishu-chitu */ "maishu-chitu"), __webpack_require__(/*! ./errors */ "./out/errors.js"), __webpack_require__(/*! ./data-loader */ "./out/data-loader.js")], __WEBPACK_AMD_DEFINE_RESULT__ = (function (require, exports, React, ReactDOM, chitu, errors_1, data_loader_1) { | ||
"use strict"; | ||
@@ -178,5 +178,5 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
}; | ||
if (action.loadProps) { | ||
let partialProps = yield action.loadProps(props); | ||
Object.assign(props, partialProps); | ||
if (typeof action[data_loader_1.LOAD_DATA] == "function") { | ||
let partialData = yield action[data_loader_1.LOAD_DATA](props); | ||
Object.assign(props.data, partialData); | ||
} | ||
@@ -217,2 +217,27 @@ let element = React.createElement(action, props); | ||
/***/ "./out/data-loader.js": | ||
/*!****************************!*\ | ||
!*** ./out/data-loader.js ***! | ||
\****************************/ | ||
/*! no static exports found */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__, exports], __WEBPACK_AMD_DEFINE_RESULT__ = (function (require, exports) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.dataLoader = exports.LOAD_DATA = void 0; | ||
exports.LOAD_DATA = "loadData"; | ||
function dataLoader(loadData) { | ||
return function (constructor) { | ||
constructor[exports.LOAD_DATA] = loadData; | ||
return constructor; | ||
}; | ||
} | ||
exports.dataLoader = dataLoader; | ||
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), | ||
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); | ||
/***/ }), | ||
/***/ "./out/errors.js": | ||
@@ -253,8 +278,9 @@ /*!***********************!*\ | ||
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__, exports, __webpack_require__(/*! ./application */ "./out/application.js")], __WEBPACK_AMD_DEFINE_RESULT__ = (function (require, exports, application_1) { | ||
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__, exports, __webpack_require__(/*! ./application */ "./out/application.js"), __webpack_require__(/*! ./data-loader */ "./out/data-loader.js")], __WEBPACK_AMD_DEFINE_RESULT__ = (function (require, exports, application_1, data_loader_1) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Page = exports.Application = void 0; | ||
exports.dataLoader = exports.Page = exports.Application = void 0; | ||
Object.defineProperty(exports, "Application", { enumerable: true, get: function () { return application_1.Application; } }); | ||
Object.defineProperty(exports, "Page", { enumerable: true, get: function () { return application_1.Page; } }); | ||
Object.defineProperty(exports, "dataLoader", { enumerable: true, get: function () { return data_loader_1.dataLoader; } }); | ||
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), | ||
@@ -261,0 +287,0 @@ __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); |
@@ -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)};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)}])}); | ||
!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=1)}([function(e,t,r){var n;void 0===(n=function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dataLoader=t.LOAD_DATA=void 0,t.LOAD_DATA="loadData",t.dataLoader=function(e){return function(r){return r[t.LOAD_DATA]=e,r}}}.apply(t,[r,t]))||(e.exports=n)},function(e,t,r){var n,o;n=[r,t,r(2),r(0)],void 0===(o=function(e,t,r,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dataLoader=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}}),Object.defineProperty(t,"dataLoader",{enumerable:!0,get:function(){return n.dataLoader}})}.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{c(n.next(e))}catch(e){i(e)}}function u(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,u)}c((n=n.apply(e,t||[])).next())})};n=[r,t,r(3),r(4),r(5),r(6),r(0)],void 0===(o=function(e,t,r,n,o,a,u){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Application=t.Page=void 0;class c extends o.Page{constructor(){super(...arguments),this.component=null}}t.Page=c;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,c)=>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 d={app:c,data:o.data,events:{shown:o.shown,showing:o.showing,hidden:o.hidden,hiding:o.hiding},source:o,createService:e=>o.createService(e)};if("function"==typeof s[u.LOAD_DATA]){let e=yield s[u.LOAD_DATA](d);Object.assign(d.data,e)}let l=r.createElement(s,d),p=n.render(l,o.element);o.component=p})}}class d extends o.Application{constructor(e){void 0===(e=e||{}).modulesPath&&(e.modulesPath="modules"),e.parser||(e.parser=d.createPageNodeParser(e.modulesPath)),super(e),e.parser.app=this,e.parser.loadjs=e=>this.loadjs(e),this.pageType=c}static createPageNodeParser(e){return new s(e)}}t.Application=d}.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 |
@@ -53,3 +53,3 @@ "use strict"; | ||
define(["require", "exports", "react", "react-dom", "maishu-chitu", "./errors"], function (require, exports, React, ReactDOM, chitu, errors_1) { | ||
define(["require", "exports", "react", "react-dom", "maishu-chitu", "./errors", "./data-loader"], function (require, exports, React, ReactDOM, chitu, errors_1, data_loader_1) { | ||
"use strict"; | ||
@@ -127,3 +127,3 @@ | ||
regeneratorRuntime.mark(function _callee() { | ||
var actionExports, action, props, partialProps, element, component; | ||
var actionExports, action, props, partialData, element, component; | ||
return regeneratorRuntime.wrap(function _callee$(_context) { | ||
@@ -172,3 +172,3 @@ while (1) { | ||
if (!action.loadProps) { | ||
if (!(typeof action[data_loader_1.LOAD_DATA] == "function")) { | ||
_context.next = 14; | ||
@@ -179,7 +179,7 @@ break; | ||
_context.next = 12; | ||
return action.loadProps(props); | ||
return action[data_loader_1.LOAD_DATA](props); | ||
case 12: | ||
partialProps = _context.sent; | ||
Object.assign(props, partialProps); | ||
partialData = _context.sent; | ||
Object.assign(props.data, partialData); | ||
@@ -186,0 +186,0 @@ case 14: |
"use strict"; | ||
define(["require", "exports", "./application"], function (require, exports, application_1) { | ||
define(["require", "exports", "./application", "./data-loader"], function (require, exports, application_1, data_loader_1) { | ||
"use strict"; | ||
@@ -9,3 +9,3 @@ | ||
}); | ||
exports.Page = exports.Application = void 0; | ||
exports.dataLoader = exports.Page = exports.Application = void 0; | ||
Object.defineProperty(exports, "Application", { | ||
@@ -23,3 +23,9 @@ enumerable: true, | ||
}); | ||
Object.defineProperty(exports, "dataLoader", { | ||
enumerable: true, | ||
get: function get() { | ||
return data_loader_1.dataLoader; | ||
} | ||
}); | ||
}); | ||
//# sourceMappingURL=index.js.map |
@@ -6,3 +6,5 @@ import React = require("react"); | ||
app: Application; | ||
data: chitu.Page["data"]; | ||
data: { | ||
[key: string]: any; | ||
}; | ||
source: Page; | ||
@@ -9,0 +11,0 @@ createService: chitu.Page["createService"]; |
@@ -10,3 +10,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
}; | ||
define(["require", "exports", "react", "react-dom", "maishu-chitu", "./errors"], function (require, exports, React, ReactDOM, chitu, errors_1) { | ||
define(["require", "exports", "react", "react-dom", "maishu-chitu", "./errors", "./data-loader"], function (require, exports, React, ReactDOM, chitu, errors_1, data_loader_1) { | ||
"use strict"; | ||
@@ -64,5 +64,5 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
}; | ||
if (action.loadProps) { | ||
let partialProps = yield action.loadProps(props); | ||
Object.assign(props, partialProps); | ||
if (typeof action[data_loader_1.LOAD_DATA] == "function") { | ||
let partialData = yield action[data_loader_1.LOAD_DATA](props); | ||
Object.assign(props.data, partialData); | ||
} | ||
@@ -69,0 +69,0 @@ let element = React.createElement(action, props); |
export { Application, Page, PageProps } from './application'; | ||
export { dataLoader, LoadData } from "./data-loader"; |
@@ -1,7 +0,8 @@ | ||
define(["require", "exports", "./application"], function (require, exports, application_1) { | ||
define(["require", "exports", "./application", "./data-loader"], function (require, exports, application_1, data_loader_1) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Page = exports.Application = void 0; | ||
exports.dataLoader = exports.Page = exports.Application = void 0; | ||
Object.defineProperty(exports, "Application", { enumerable: true, get: function () { return application_1.Application; } }); | ||
Object.defineProperty(exports, "Page", { enumerable: true, get: function () { return application_1.Page; } }); | ||
Object.defineProperty(exports, "dataLoader", { enumerable: true, get: function () { return data_loader_1.dataLoader; } }); | ||
}); |
{ | ||
"name": "maishu-chitu-react", | ||
"version": "1.35.0", | ||
"version": "1.36.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
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
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
512005
71
2970