Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

maishu-chitu-react

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

maishu-chitu-react - npm Package Compare versions

Comparing version 1.40.0 to 1.42.0

14

dist/application.d.ts
import React = require("react");
import * as chitu from 'maishu-chitu';
import { PageNodeParser } from "maishu-chitu";
import { Router } from "maishu-router";
export interface ComponentModule {
default: React.ComponentClass<any>;
loadData?: (props: any) => Promise<any>;
loadProps?: (data: any, context: Pick<Application, "createService">) => Promise<any>;
}
export interface PageProps {

@@ -31,2 +37,3 @@ app: Application;

export declare class Application extends chitu.Application {
private defaultPage;
constructor(args?: {

@@ -38,7 +45,12 @@ parser?: chitu.PageNodeParser;

};
/** 模块路径 */
/** 页面路径, 默认为 modules */
modulesPath?: string;
mode?: "history" | "hash";
routers?: Router[];
defaultPage?: string;
});
createPageElement(pageName: string, containerName: string): HTMLElement;
private getRouteString;
static createPageNodeParser(modulesPath: string): DefaultPageNodeParser;
}
export {};
export declare const LOAD_DATA = "loadData";
export declare type LoadData<Props, T> = (props: Props) => Promise<Partial<T>>;
export declare function dataLoader<Props, T>(loadData: LoadData<Props, T>): any;
export declare const LOAD_PROPS = "loadProps";
export declare class Errors {
static canntFindAction(pageName: string): Error;
static exportsCanntNull(pageName: string): Error;
static containerNotExist(containerName: string): Error;
}

2

dist/index.d.ts

@@ -1,2 +0,2 @@

export { Application, Page, PageProps } from './application';
export { Application, Page, PageProps, ComponentModule } from './application';
export { dataLoader, LoadData } from "./data-loader";
/*!
*
* maishu-chitu-react v1.35.0
* maishu-chitu-react v1.40.0
* https://github.com/ansiboy/services-sdk

@@ -58,3 +58,7 @@ *

/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }

@@ -65,24 +69,5 @@ /******/ };

/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules

@@ -118,6 +103,8 @@ /******/ __webpack_require__.n = function(module) {

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

@@ -127,2 +114,4 @@

function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

@@ -172,195 +161,308 @@

!(__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";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Application = exports.Page = void 0;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Application = exports.Page = void 0;
var React = __webpack_require__(/*! react */ "react");
var Page =
/*#__PURE__*/
function (_chitu$Page) {
_inherits(Page, _chitu$Page);
var ReactDOM = __webpack_require__(/*! react-dom */ "react-dom");
function Page() {
var _this;
var chitu = __webpack_require__(/*! maishu-chitu */ "maishu-chitu");
_classCallCheck(this, Page);
var errors_1 = __webpack_require__(/*! ./errors */ "./out-es5/errors.js");
_this = _possibleConstructorReturn(this, _getPrototypeOf(Page).apply(this, arguments));
_this.component = null; // app: Application
var data_loader_1 = __webpack_require__(/*! ./data-loader */ "./out-es5/data-loader.js");
return _this;
}
var Page =
/*#__PURE__*/
function (_chitu$Page) {
_inherits(Page, _chitu$Page);
return Page;
}(chitu.Page);
function Page() {
var _this;
exports.Page = Page; // export let PageContext = React.createContext<{ page: Page | null }>({ page: null })
_classCallCheck(this, Page);
var DefaultPageNodeParser =
/*#__PURE__*/
function () {
function DefaultPageNodeParser(modulesPath) {
_classCallCheck(this, DefaultPageNodeParser);
_this = _possibleConstructorReturn(this, _getPrototypeOf(Page).apply(this, arguments));
_this.component = null;
return _this;
}
this.nodes = {};
this.modulesPath = modulesPath.endsWith("/") ? modulesPath.substr(0, modulesPath.length - 1) : modulesPath;
}
return Page;
}(chitu.Page);
_createClass(DefaultPageNodeParser, [{
key: "parse",
value: function parse(pageName) {
var _this2 = this;
exports.Page = Page;
var node = this.nodes[pageName];
var DefaultPageNodeParser =
/*#__PURE__*/
function () {
function DefaultPageNodeParser(modulesPath) {
_classCallCheck(this, DefaultPageNodeParser);
if (node == null) {
var path = "".concat(pageName).split('_').join('/');
this.nodes = {};
this.modulesPath = modulesPath.endsWith("/") ? modulesPath.substr(0, modulesPath.length - 1) : modulesPath;
}
if (this.modulesPath) {
path = "".concat(this.modulesPath, "/").concat(path);
}
_createClass(DefaultPageNodeParser, [{
key: "parse",
value: function parse(pageName) {
var _this2 = this;
node = {
action: this.createDefaultAction(path, function (path) {
return _this2.loadjs(path);
}),
name: pageName
};
this.nodes[pageName] = node;
var node = this.nodes[pageName];
if (node == null) {
var path = "".concat(pageName).split('_').join('/');
if (this.modulesPath) {
path = "".concat(this.modulesPath, "/").concat(path);
}
return node;
node = {
action: this.createDefaultAction(path, function (path) {
return _this2.loadjs(path);
}),
name: pageName
};
this.nodes[pageName] = node;
}
}, {
key: "createDefaultAction",
value: function createDefaultAction(url, loadjs) {
var _this3 = this;
return function (page, app) {
return __awaiter(_this3, void 0, void 0,
/*#__PURE__*/
regeneratorRuntime.mark(function _callee() {
var actionExports, action, props, partialData, element, component;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return loadjs(url);
return node;
}
}, {
key: "createDefaultAction",
value: function createDefaultAction(url, loadjs) {
var _this3 = this;
case 2:
actionExports = _context.sent;
return function (page, app) {
return __awaiter(_this3, void 0, void 0,
/*#__PURE__*/
regeneratorRuntime.mark(function _callee() {
var actionExports, action, props, loadProps, partialProps, loadData, partialData, element, component;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return loadjs(url);
if (actionExports) {
_context.next = 5;
break;
}
case 2:
actionExports = _context.sent;
throw errors_1.Errors.exportsCanntNull(url);
if (actionExports) {
_context.next = 5;
break;
}
case 5:
action = actionExports['default'];
throw errors_1.Errors.exportsCanntNull(url);
if (!(action == null)) {
_context.next = 8;
break;
}
case 5:
action = actionExports.default;
throw errors_1.Errors.canntFindAction(page.name);
if (!(action == null)) {
_context.next = 8;
break;
}
case 8:
props = {
app: app,
data: page.data,
events: {
shown: page.shown,
showing: page.showing,
hidden: page.hidden,
hiding: page.hiding
},
source: page,
createService: function createService(type) {
return page.createService(type);
}
};
throw errors_1.Errors.canntFindAction(page.name);
if (!(typeof action[data_loader_1.LOAD_DATA] == "function")) {
_context.next = 14;
break;
case 8:
props = {
app: app,
data: page.data,
events: {
shown: page.shown,
showing: page.showing,
hidden: page.hidden,
hiding: page.hiding
},
source: page,
createService: function createService(type) {
return page.createService(type);
}
};
loadProps = actionExports.loadProps;
_context.next = 12;
return action[data_loader_1.LOAD_DATA](props);
if (!(typeof loadProps == "function")) {
_context.next = 15;
break;
}
case 12:
partialData = _context.sent;
Object.assign(props.data, partialData);
_context.next = 13;
return loadProps(page.data, app);
case 14:
element = React.createElement(action, props);
component = ReactDOM.render(element, page.element);
page.component = component;
case 13:
partialProps = _context.sent;
props = Object.assign(props, partialProps || {});
case 17:
case "end":
return _context.stop();
}
case 15:
loadData = actionExports.loadData || action[data_loader_1.LOAD_DATA];
if (!(typeof loadData == "function")) {
_context.next = 21;
break;
}
_context.next = 19;
return loadData(props);
case 19:
partialData = _context.sent;
Object.assign(props.data, partialData);
case 21:
element = React.createElement(action, props);
component = ReactDOM.render(element, page.element); // let component = ReactDOM.hydrate(element, page.element) as React.Component;
page.component = component;
case 24:
case "end":
return _context.stop();
}
}, _callee);
}));
};
}
}]);
}
}, _callee);
}));
};
}
}]);
return DefaultPageNodeParser;
}();
return DefaultPageNodeParser;
}();
var Application =
/*#__PURE__*/
function (_chitu$Application) {
_inherits(Application, _chitu$Application);
var TargetUrlVariableName = "targetUrl";
var DefaultPage = "index";
function Application(args) {
var _this4;
var Application =
/*#__PURE__*/
function (_chitu$Application) {
_inherits(Application, _chitu$Application);
_classCallCheck(this, Application);
function Application(args) {
var _this4;
args = args || {};
_classCallCheck(this, Application);
if (args.modulesPath === undefined) {
args.modulesPath = "modules";
}
args = args || {};
if (!args.parser) args.parser = Application.createPageNodeParser(args.modulesPath);
_this4 = _possibleConstructorReturn(this, _getPrototypeOf(Application).call(this, args));
args.parser.app = _assertThisInitialized(_this4);
if (args.modulesPath === undefined) {
args.modulesPath = "modules";
}
args.parser.loadjs = function (path) {
return _this4.loadjs(path);
}; // this.pageCreated.add((sender, page) => {
// page.element.className = "page"
// })
if (!args.parser) args.parser = Application.createPageNodeParser(args.modulesPath);
_this4 = _possibleConstructorReturn(this, _getPrototypeOf(Application).call(this, args));
args.parser.app = _assertThisInitialized(_this4);
args.parser.loadjs = function (path) {
return _this4.loadjs(path);
};
_this4.pageType = Page;
return _this4;
_this4.defaultPage = args.defaultPage || DefaultPage;
_this4.pageType = Page;
var mode = args.mode || "hash";
if (mode == "history") {
_this4.run = function () {
var routeString = _this4.getRouteString();
_this4.showPage(routeString);
};
_this4.parseUrl = function (url) {
var searchIndex = url.indexOf("?");
var search;
var pathName;
if (searchIndex > 0) {
search = url.substr(searchIndex);
pathName = url.substr(0, searchIndex);
} else {
pathName = url;
}
var routers = args === null || args === void 0 ? void 0 : args.routers;
var values = {};
if (routers != null) {
for (var i = 0; i < routers.length; i++) {
var m = routers[i].match(pathName);
if (m) {
var controller = m.controller,
action = m.action;
if (!controller) throw new Error("Can not get controller from route data.");
if (!action) throw new Error("Can not get action from route data.");
Object.assign(values, m);
break;
}
}
}
if (search) {
var q = search.substr(1);
var r = q ? _this4.pareeUrlQuery(q) : {};
Object.assign(values, r);
}
var arr = pathName.split("/").filter(function (o) {
return o;
});
var pageName = arr.length == 0 ? "index" : arr.join("_");
return {
pageName: pageName,
values: values
};
};
}
_createClass(Application, null, [{
key: "createPageNodeParser",
value: function createPageNodeParser(modulesPath) {
var p = new DefaultPageNodeParser(modulesPath);
return p;
return _this4;
}
_createClass(Application, [{
key: "createPageElement",
value: function createPageElement(pageName, containerName) {
var container = this.containers[containerName];
if (container == null) throw errors_1.Errors.containerNotExist(containerName);
var e = container.querySelector("[name=\"".concat(pageName, "\"]"));
if (e == null) {
e = _get(_getPrototypeOf(Application.prototype), "createPageElement", this).call(this, pageName, containerName);
e.setAttribute("name", pageName);
}
}]);
return Application;
}(chitu.Application);
return e;
}
}, {
key: "getRouteString",
value: function getRouteString() {
var routeString = window[TargetUrlVariableName];
exports.Application = Application;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
if (!routeString) {
routeString = location.pathname || this.defaultPage;
if (location.search) {
routeString = routeString + location.search;
}
}
routeString = routeString.trim();
if (routeString[0] == '/') {
routeString = routeString.substr(1);
}
return routeString;
}
}], [{
key: "createPageNodeParser",
value: function createPageNodeParser(modulesPath) {
var p = new DefaultPageNodeParser(modulesPath);
return p;
}
}]);
return Application;
}(chitu.Application);
exports.Application = Application;
//# sourceMappingURL=application.js.map

@@ -379,23 +481,19 @@

"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";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.LOAD_PROPS = exports.dataLoader = exports.LOAD_DATA = void 0;
exports.LOAD_DATA = "loadData";
function dataLoader(loadData) {
return function (constructor) {
constructor[exports.LOAD_DATA] = loadData;
return constructor;
};
}
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__));
exports.dataLoader = dataLoader;
exports.LOAD_PROPS = "loadProps";
//# sourceMappingURL=data-loader.js.map

@@ -414,4 +512,4 @@

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

@@ -423,37 +521,38 @@

!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__, exports], __WEBPACK_AMD_DEFINE_RESULT__ = (function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Errors = void 0;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Errors = void 0;
var Errors =
/*#__PURE__*/
function () {
function Errors() {
_classCallCheck(this, Errors);
}
var Errors =
/*#__PURE__*/
function () {
function Errors() {
_classCallCheck(this, Errors);
_createClass(Errors, null, [{
key: "canntFindAction",
value: function canntFindAction(pageName) {
var msg = "Cannt find action in page '".concat(pageName, "', is the exports has default field?");
return new Error(msg);
}
}, {
key: "exportsCanntNull",
value: function exportsCanntNull(pageName) {
var msg = "Exports of page '".concat(pageName, "' is null.");
return new Error(msg);
}
}, {
key: "containerNotExist",
value: function containerNotExist(containerName) {
var msg = "Container ".concat(containerName, " is not exists.");
return new Error(msg);
}
}]);
_createClass(Errors, null, [{
key: "canntFindAction",
value: function canntFindAction(pageName) {
var msg = "Cannt find action in page '".concat(pageName, "', is the exports has default field?");
return new Error(msg);
}
}, {
key: "exportsCanntNull",
value: function exportsCanntNull(pageName) {
var msg = "Exports of page '".concat(pageName, "' is null.");
return new Error(msg);
}
}]);
return Errors;
}();
return Errors;
}();
exports.Errors = Errors;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
exports.Errors = Errors;
//# sourceMappingURL=errors.js.map

@@ -472,31 +571,32 @@

"use strict";
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
!(__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";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.dataLoader = exports.Page = exports.Application = void 0;
Object.defineProperty(exports, "Application", {
enumerable: true,
get: function get() {
return application_1.Application;
}
});
Object.defineProperty(exports, "Page", {
enumerable: true,
get: function get() {
return application_1.Page;
}
});
Object.defineProperty(exports, "dataLoader", {
enumerable: true,
get: function get() {
return data_loader_1.dataLoader;
}
});
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.dataLoader = exports.Page = exports.Application = void 0;
var application_1 = __webpack_require__(/*! ./application */ "./out-es5/application.js");
Object.defineProperty(exports, "Application", {
enumerable: true,
get: function get() {
return application_1.Application;
}
});
Object.defineProperty(exports, "Page", {
enumerable: true,
get: function get() {
return application_1.Page;
}
});
var data_loader_1 = __webpack_require__(/*! ./data-loader */ "./out-es5/data-loader.js");
Object.defineProperty(exports, "dataLoader", {
enumerable: true,
get: function get() {
return data_loader_1.dataLoader;
}
});
//# sourceMappingURL=index.js.map

@@ -503,0 +603,0 @@

/*!
*
* maishu-chitu-react v1.35.0
* maishu-chitu-react v1.40.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=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)}])});
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("maishu-chitu"),require("react-dom"),require("react"));else if("function"==typeof define&&define.amd)define(["maishu-chitu","react-dom","react"],t);else{var n="object"==typeof exports?t(require("maishu-chitu"),require("react-dom"),require("react")):t(e["maishu-chitu"],e["react-dom"],e.react);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,{configurable:!1,enumerable:!0,get:r})},n.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},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=6)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LOAD_PROPS=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}},t.LOAD_PROPS="loadProps"},function(e,t,n){"use strict";function r(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)}}Object.defineProperty(t,"__esModule",{value:!0}),t.Errors=void 0;var o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return function(e,t,n){t&&r(e.prototype,t),n&&r(e,n)}(e,null,[{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)}},{key:"containerNotExist",value:function(e){var t="Container ".concat(e," is not exists.");return new Error(t)}}]),e}();t.Errors=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";function r(e,t,n){return(r="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=f(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(n):o.value}})(e,t,n||e)}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)}}function a(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}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){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(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 f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function l(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&&p(e,t)}function p(e,t){return(p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var d=function(e,t,n,r){return new(n||(n=Promise))(function(o,a){function i(e){try{c(r.next(e))}catch(e){a(e)}}function u(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?o(e.value):function(e){return e instanceof n?e:new n(function(t){t(e)})}(e.value).then(i,u)}c((r=r.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.Application=t.Page=void 0;var h=n(4),v=n(3),y=n(2),b=n(1),g=n(0),m=function(e){function t(){var e;return u(this,t),(e=c(this,f(t).apply(this,arguments))).component=null,e}return l(t,y.Page),t}();t.Page=m;var P=function(){function e(t){u(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 n=this;return function(r,o){return d(n,void 0,void 0,regeneratorRuntime.mark(function n(){var a,i,u,c,s,f,l,p,d;return regeneratorRuntime.wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,t(e);case 2:if(a=n.sent){n.next=5;break}throw b.Errors.exportsCanntNull(e);case 5:if(null!=(i=a.default)){n.next=8;break}throw b.Errors.canntFindAction(r.name);case 8:if(u={app:o,data:r.data,events:{shown:r.shown,showing:r.showing,hidden:r.hidden,hiding:r.hiding},source:r,createService:function(e){return r.createService(e)}},"function"!=typeof(c=a.loadProps)){n.next=15;break}return n.next=13,c(r.data,o);case 13:s=n.sent,u=Object.assign(u,s||{});case 15:if("function"!=typeof(f=a.loadData||i[g.LOAD_DATA])){n.next=21;break}return n.next=19,f(u);case 19:l=n.sent,Object.assign(u.data,l);case 21:p=h.createElement(i,u),d=v.render(p,r.element),r.component=d;case 24:case"end":return n.stop()}},n)}))}}}]),e}(),w="index",O=function(e){function t(e){var n;return u(this,t),void 0===(e=e||{}).modulesPath&&(e.modulesPath="modules"),e.parser||(e.parser=t.createPageNodeParser(e.modulesPath)),n=c(this,f(t).call(this,e)),e.parser.app=s(n),e.parser.loadjs=function(e){return n.loadjs(e)},n.defaultPage=e.defaultPage||w,n.pageType=m,"history"==(e.mode||"hash")&&(n.run=function(){var e=n.getRouteString();n.showPage(e)},n.parseUrl=function(t){var r,o,a=t.indexOf("?");a>0?(r=t.substr(a),o=t.substr(0,a)):o=t;var i=null===e||void 0===e?void 0:e.routers,u={};if(null!=i)for(var c=0;c<i.length;c++){var s=i[c].match(o);if(s){var f=s.controller,l=s.action;if(!f)throw new Error("Can not get controller from route data.");if(!l)throw new Error("Can not get action from route data.");Object.assign(u,s);break}}if(r){var p=r.substr(1),d=p?n.pareeUrlQuery(p):{};Object.assign(u,d)}var h=o.split("/").filter(function(e){return e});return{pageName:0==h.length?"index":h.join("_"),values:u}}),n}return l(t,y.Application),a(t,[{key:"createPageElement",value:function(e,n){var o=this.containers[n];if(null==o)throw b.Errors.containerNotExist(n);var a=o.querySelector('[name="'.concat(e,'"]'));return null==a&&(a=r(f(t.prototype),"createPageElement",this).call(this,e,n)).setAttribute("name",e),a}},{key:"getRouteString",value:function(){var e=window.targetUrl;return e||(e=location.pathname||this.defaultPage,location.search&&(e+=location.search)),"/"==(e=e.trim())[0]&&(e=e.substr(1)),e}}],[{key:"createPageNodeParser",value:function(e){return new P(e)}}]),t}();t.Application=O},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dataLoader=t.Page=t.Application=void 0;var r=n(5);Object.defineProperty(t,"Application",{enumerable:!0,get:function(){return r.Application}}),Object.defineProperty(t,"Page",{enumerable:!0,get:function(){return r.Page}});var o=n(0);Object.defineProperty(t,"dataLoader",{enumerable:!0,get:function(){return o.dataLoader}})}])});
//# sourceMappingURL=index.es5.min.js.map
/*!
*
* maishu-chitu-react v1.36.0
* maishu-chitu-react v1.40.0
* https://github.com/ansiboy/services-sdk
*
*
* Copyright (c) 2016-2018, shu mai <ansiboy@163.com>
* Licensed under the MIT License.
*
*
*/

@@ -20,5 +20,74 @@ (function webpackUniversalModuleDefinition(root, factory) {

})(typeof window === 'undefined' ? global : window, function(__WEBPACK_EXTERNAL_MODULE_maishu_chitu__, __WEBPACK_EXTERNAL_MODULE_react__, __WEBPACK_EXTERNAL_MODULE_react_dom__) {
return /******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = "./out/index.js");
/******/ })
/************************************************************************/
/******/ ({

@@ -29,4 +98,6 @@ /***/ "./out/application.js":

\****************************/
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";

@@ -42,3 +113,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

};
Object.defineProperty(exports, "__esModule", ({ value: true }));
Object.defineProperty(exports, "__esModule", { value: true });
exports.Application = exports.Page = void 0;

@@ -99,3 +170,3 @@ const React = __webpack_require__(/*! react */ "react");

if (typeof loadProps == "function") {
let partialProps = yield loadProps(page.data);
let partialProps = yield loadProps(page.data, app);
props = Object.assign(props, partialProps || {});

@@ -213,6 +284,8 @@ }

\****************************/
/***/ ((__unused_webpack_module, exports) => {
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
Object.defineProperty(exports, "__esModule", { value: true });
exports.LOAD_PROPS = exports.dataLoader = exports.LOAD_DATA = void 0;

@@ -236,6 +309,8 @@ exports.LOAD_DATA = "loadData";

\***********************/
/***/ ((__unused_webpack_module, exports) => {
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
Object.defineProperty(exports, "__esModule", { value: true });
exports.Errors = void 0;

@@ -261,2 +336,22 @@ class Errors {

/***/ "./out/index.js":
/*!**********************!*\
!*** ./out/index.js ***!
\**********************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.dataLoader = exports.Page = exports.Application = void 0;
var application_1 = __webpack_require__(/*! ./application */ "./out/application.js");
Object.defineProperty(exports, "Application", { enumerable: true, get: function () { return application_1.Application; } });
Object.defineProperty(exports, "Page", { enumerable: true, get: function () { return application_1.Page; } });
var data_loader_1 = __webpack_require__(/*! ./data-loader */ "./out/data-loader.js");
Object.defineProperty(exports, "dataLoader", { enumerable: true, get: function () { return data_loader_1.dataLoader; } });
/***/ }),
/***/ "maishu-chitu":

@@ -266,3 +361,4 @@ /*!*******************************!*\

\*******************************/
/***/ ((module) => {
/*! no static exports found */
/***/ (function(module, exports) {

@@ -277,3 +373,4 @@ module.exports = __WEBPACK_EXTERNAL_MODULE_maishu_chitu__;

\************************/
/***/ ((module) => {
/*! no static exports found */
/***/ (function(module, exports) {

@@ -288,3 +385,4 @@ module.exports = __WEBPACK_EXTERNAL_MODULE_react__;

\****************************/
/***/ ((module) => {
/*! no static exports found */
/***/ (function(module, exports) {

@@ -295,51 +393,4 @@ module.exports = __WEBPACK_EXTERNAL_MODULE_react_dom__;

/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(() => {
var exports = __webpack_exports__;
/*!**********************!*\
!*** ./out/index.js ***!
\**********************/
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.dataLoader = exports.Page = exports.Application = void 0;
var application_1 = __webpack_require__(/*! ./application */ "./out/application.js");
Object.defineProperty(exports, "Application", ({ enumerable: true, get: function () { return application_1.Application; } }));
Object.defineProperty(exports, "Page", ({ enumerable: true, get: function () { return application_1.Page; } }));
var data_loader_1 = __webpack_require__(/*! ./data-loader */ "./out/data-loader.js");
Object.defineProperty(exports, "dataLoader", ({ enumerable: true, get: function () { return data_loader_1.dataLoader; } }));
})();
/******/ return __webpack_exports__;
/******/ })()
;
/******/ });
});
//# sourceMappingURL=index.js.map
/*!
*
* maishu-chitu-react v1.35.0
* maishu-chitu-react v1.40.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=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)}])});
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("maishu-chitu"),require("react-dom"),require("react"));else if("function"==typeof define&&define.amd)define(["maishu-chitu","react-dom","react"],t);else{var r="object"==typeof exports?t(require("maishu-chitu"),require("react-dom"),require("react")):t(e["maishu-chitu"],e["react-dom"],e.react);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,{configurable:!1,enumerable:!0,get:n})},r.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},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=6)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LOAD_PROPS=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}},t.LOAD_PROPS="loadProps"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Errors=void 0;t.Errors=class{static canntFindAction(e){let t=`Cannt find action in page '${e}', is the exports has default field?`;return new Error(t)}static exportsCanntNull(e){let t=`Exports of page '${e}' is null.`;return new Error(t)}static containerNotExist(e){let t=`Container ${e} is not exists.`;return new Error(t)}}},function(t,r){t.exports=e},function(e,r){e.exports=t},function(e,t){e.exports=r},function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){e.done?o(e.value):function(e){return e instanceof r?e:new r(function(t){t(e)})}(e.value).then(a,s)}u((n=n.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:!0}),t.Application=t.Page=void 0;const o=r(4),i=r(3),a=r(2),s=r(1),u=r(0);class c extends a.Page{constructor(){super(...arguments),this.component=null}}t.Page=c;class l{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(r,a)=>n(this,void 0,void 0,function*(){let n=yield t(e);if(!n)throw s.Errors.exportsCanntNull(e);let c=n.default;if(null==c)throw s.Errors.canntFindAction(r.name);let l={app:a,data:r.data,events:{shown:r.shown,showing:r.showing,hidden:r.hidden,hiding:r.hiding},source:r,createService:e=>r.createService(e)},d=n.loadProps;if("function"==typeof d){let e=yield d(r.data,a);l=Object.assign(l,e||{})}let f=n.loadData||c[u.LOAD_DATA];if("function"==typeof f){let e=yield f(l);Object.assign(l.data,e)}let p=o.createElement(c,l),h=i.render(p,r.element);r.component=h})}}const d="targetUrl",f="index";class p extends a.Application{constructor(e){void 0===(e=e||{}).modulesPath&&(e.modulesPath="modules"),e.parser||(e.parser=p.createPageNodeParser(e.modulesPath)),super(e),e.parser.app=this,e.parser.loadjs=(e=>this.loadjs(e)),this.defaultPage=e.defaultPage||f,this.pageType=c,"history"==(e.mode||"hash")&&(this.run=(()=>{let e=this.getRouteString();this.showPage(e)}),this.parseUrl=(t=>{let r,n,o=t.indexOf("?");o>0?(r=t.substr(o),n=t.substr(0,o)):n=t;let i=null===e||void 0===e?void 0:e.routers,a={};if(null!=i)for(let e=0;e<i.length;e++){let t=i[e].match(n);if(t){let{controller:e,action:r}=t;if(!e)throw new Error("Can not get controller from route data.");if(!r)throw new Error("Can not get action from route data.");Object.assign(a,t);break}}if(r){let e=r.substr(1),t=e?this.pareeUrlQuery(e):{};Object.assign(a,t)}let s=n.split("/").filter(e=>e);return{pageName:0==s.length?"index":s.join("_"),values:a}}))}createPageElement(e,t){let r=this.containers[t];if(null==r)throw s.Errors.containerNotExist(t);let n=r.querySelector(`[name="${e}"]`);return null==n&&(n=super.createPageElement(e,t)).setAttribute("name",e),n}getRouteString(){let e=window[d];return e||(e=location.pathname||this.defaultPage,location.search&&(e+=location.search)),"/"==(e=e.trim())[0]&&(e=e.substr(1)),e}static createPageNodeParser(e){return new l(e)}}t.Application=p},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dataLoader=t.Page=t.Application=void 0;var n=r(5);Object.defineProperty(t,"Application",{enumerable:!0,get:function(){return n.Application}}),Object.defineProperty(t,"Page",{enumerable:!0,get:function(){return n.Page}});var o=r(0);Object.defineProperty(t,"dataLoader",{enumerable:!0,get:function(){return o.dataLoader}})}])});
//# sourceMappingURL=index.min.js.map

@@ -22,3 +22,7 @@

require('load-grunt-tasks')(grunt);
// require('load-grunt-tasks')(grunt);
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-babel');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-webpack');

@@ -67,3 +71,3 @@ grunt.initConfig({

grunt.registerTask('default', ['shell', 'babel', 'webpack', 'copy']);
grunt.registerTask('default', ['shell', 'babel', 'copy']);
}

@@ -1,2 +0,2 @@

export { Application, Page, PageProps } from './application';
export { Application, Page, PageProps, ComponentModule } from './application';
export { dataLoader, LoadData } from "./data-loader";
{
"name": "maishu-chitu-react",
"version": "1.40.0",
"version": "1.42.0",
"description": "",

@@ -38,5 +38,5 @@ "main": "dist/index.js",

"load-grunt-tasks": "^4.0.0",
"webpack": "^5.70.0",
"webpack": "4.0",
"webpack-cli": "^4.9.2"
}
}

@@ -1,2 +0,2 @@

export { Application, Page, PageProps } from './application'
export { Application, Page, PageProps, ComponentModule } 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc