@dckj-npm/lowcode-code-generator 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,99 @@
1
+ // src/standalone-loader.ts
2
+ import fetch from "node-fetch";
3
+ var packageVersion = "1.0.0";
4
+ var DEFAULT_WORKER_JS = `https://cdn.jsdelivr.net/npm/@alilc/lowcode-code-generator@${packageVersion}/dist/standalone-worker.min.js`;
5
+ var DEFAULT_TIMEOUT_IN_MS = 60 * 1e3;
6
+ var workerJsCache = /* @__PURE__ */ new Map();
7
+ async function init({
8
+ workerJsUrl = DEFAULT_WORKER_JS
9
+ } = {}) {
10
+ await loadWorkerJs(workerJsUrl);
11
+ }
12
+ async function generateCode(options) {
13
+ if (typeof self !== "object") {
14
+ throw new Error("self is not defined");
15
+ }
16
+ if (typeof Worker !== "function") {
17
+ throw new Error("Worker is not supported");
18
+ }
19
+ const workerJsUrl = options.workerJsUrl || DEFAULT_WORKER_JS;
20
+ const workerJs = await loadWorkerJs(workerJsUrl);
21
+ const worker = new Worker(workerJs.url, {
22
+ type: "classic",
23
+ credentials: "omit"
24
+ });
25
+ return new Promise((resolve, reject) => {
26
+ const timer = setTimeout(() => {
27
+ reject(new Error("timeout"));
28
+ worker.terminate();
29
+ }, options.timeoutInMs || DEFAULT_TIMEOUT_IN_MS);
30
+ worker.onmessage = (event) => {
31
+ const msg = event.data;
32
+ switch (msg.type) {
33
+ case "ready":
34
+ print("worker is ready.");
35
+ break;
36
+ case "run:begin":
37
+ print("worker is running...");
38
+ break;
39
+ case "run:end":
40
+ print("worker is done.");
41
+ resolve(msg.result);
42
+ clearTimeout(timer);
43
+ worker.terminate();
44
+ break;
45
+ case "run:error":
46
+ printErr(`worker error: ${msg.errorMsg}`);
47
+ clearTimeout(timer);
48
+ reject(new Error(msg.errorMsg || "unknown error"));
49
+ worker.terminate();
50
+ break;
51
+ default:
52
+ print("got unknown msg: %o", msg);
53
+ break;
54
+ }
55
+ };
56
+ worker.onerror = (err) => {
57
+ printErr("worker error: %o", err);
58
+ clearTimeout(timer);
59
+ reject(err);
60
+ worker.terminate();
61
+ };
62
+ worker.postMessage({
63
+ type: "run",
64
+ solution: options.solution,
65
+ schema: options.schema,
66
+ flattenResult: options.flattenResult
67
+ });
68
+ });
69
+ }
70
+ async function loadWorkerJs(workerJsUrl) {
71
+ const cached = workerJsCache.get(workerJsUrl);
72
+ if (cached) {
73
+ return cached;
74
+ }
75
+ const workerJsContent = await fetch(workerJsUrl).then((res) => res.text()).catch((err) => {
76
+ throw new Error(`Failed to fetch worker js: ${err}`);
77
+ });
78
+ const workerJs = {
79
+ content: workerJsContent,
80
+ url: self.URL.createObjectURL(
81
+ new self.Blob([workerJsContent], { type: "application/javascript" })
82
+ )
83
+ };
84
+ workerJsCache.set(workerJsUrl, workerJs);
85
+ return workerJs;
86
+ }
87
+ function print(msg, ...args) {
88
+ console.debug(`[code-generator/loader]: ${msg}`, ...args);
89
+ }
90
+ function printErr(msg, ...args) {
91
+ console.debug(`[code-generator/loader]: %c${msg}`, "color:red", ...args);
92
+ }
93
+ export {
94
+ DEFAULT_TIMEOUT_IN_MS,
95
+ DEFAULT_WORKER_JS,
96
+ generateCode,
97
+ init
98
+ };
99
+ //# sourceMappingURL=standalone-loader.esm.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/standalone-loader.ts"],
4
+ "sourcesContent": ["import fetch from 'node-fetch';\r\nimport type { IPublicTypeProjectSchema, ResultDir } from '@alilc/lowcode-types';\r\nimport type { FlattenFile } from './types/file';\r\n\r\ndeclare const Worker: any;\r\ndeclare const self: any;\r\ndeclare const __PACKAGE_VERSION__: string;\r\n\r\nconst packageVersion = __PACKAGE_VERSION__ || 'latest';\r\n\r\nexport const DEFAULT_WORKER_JS = `https://cdn.jsdelivr.net/npm/@alilc/lowcode-code-generator@${packageVersion}/dist/standalone-worker.min.js`;\r\n\r\nexport const DEFAULT_TIMEOUT_IN_MS = 60 * 1000;\r\n\r\nconst workerJsCache = new Map<string, { content: string; url: string }>();\r\n\r\nexport async function init({\r\n workerJsUrl = DEFAULT_WORKER_JS,\r\n}: {\r\n workerJsUrl?: string;\r\n} = {}) {\r\n await loadWorkerJs(workerJsUrl);\r\n}\r\n\r\nexport type Result = ResultDir | FlattenFile[];\r\n\r\nexport async function generateCode(options: {\r\n solution: 'icejs' | 'rax';\r\n schema: IPublicTypeProjectSchema;\r\n flattenResult?: boolean;\r\n workerJsUrl?: string;\r\n timeoutInMs?: number;\r\n}): Promise<Result> {\r\n if (typeof self !== 'object') {\r\n throw new Error('self is not defined');\r\n }\r\n\r\n if (typeof Worker !== 'function') {\r\n throw new Error('Worker is not supported');\r\n }\r\n\r\n const workerJsUrl = options.workerJsUrl || DEFAULT_WORKER_JS;\r\n\r\n const workerJs = await loadWorkerJs(workerJsUrl);\r\n\r\n const worker = new Worker(workerJs.url, {\r\n type: 'classic',\r\n credentials: 'omit',\r\n });\r\n\r\n return new Promise((resolve, reject) => {\r\n const timer = setTimeout(() => {\r\n reject(new Error('timeout'));\r\n worker.terminate();\r\n }, options.timeoutInMs || DEFAULT_TIMEOUT_IN_MS);\r\n\r\n worker.onmessage = (event: any) => {\r\n const msg = event.data;\r\n switch (msg.type) {\r\n case 'ready':\r\n print('worker is ready.');\r\n break;\r\n\r\n case 'run:begin':\r\n print('worker is running...');\r\n break;\r\n case 'run:end':\r\n print('worker is done.');\r\n resolve(msg.result);\r\n clearTimeout(timer);\r\n worker.terminate();\r\n break;\r\n case 'run:error':\r\n printErr(`worker error: ${msg.errorMsg}`);\r\n clearTimeout(timer);\r\n reject(new Error(msg.errorMsg || 'unknown error'));\r\n worker.terminate();\r\n break;\r\n default:\r\n print('got unknown msg: %o', msg);\r\n break;\r\n }\r\n };\r\n\r\n worker.onerror = (err: any) => {\r\n printErr('worker error: %o', err);\r\n clearTimeout(timer);\r\n reject(err);\r\n worker.terminate();\r\n };\r\n\r\n worker.postMessage({\r\n type: 'run',\r\n solution: options.solution,\r\n schema: options.schema,\r\n flattenResult: options.flattenResult,\r\n });\r\n });\r\n}\r\n\r\nasync function loadWorkerJs(workerJsUrl: string) {\r\n const cached = workerJsCache.get(workerJsUrl);\r\n if (cached) {\r\n return cached;\r\n }\r\n\r\n const workerJsContent = await fetch(workerJsUrl)\r\n .then((res) => res.text())\r\n .catch((err) => {\r\n throw new Error(`Failed to fetch worker js: ${err}`);\r\n });\r\n\r\n const workerJs = {\r\n content: workerJsContent,\r\n url: self.URL.createObjectURL(\r\n new self.Blob([workerJsContent], { type: 'application/javascript' }),\r\n ),\r\n };\r\n\r\n workerJsCache.set(workerJsUrl, workerJs);\r\n\r\n return workerJs;\r\n}\r\n\r\nfunction print(msg: string, ...args: unknown[]) {\r\n // eslint-disable-next-line no-console\r\n console.debug(`[code-generator/loader]: ${msg}`, ...args);\r\n}\r\n\r\nfunction printErr(msg: string, ...args: unknown[]) {\r\n // eslint-disable-next-line no-console\r\n console.debug(`[code-generator/loader]: %c${msg}`, 'color:red', ...args);\r\n}\r\n"],
5
+ "mappings": ";AAAA,OAAO,WAAW;AAQlB,IAAM,iBAAiB;AAEhB,IAAM,oBAAoB,8DAA8D;AAExF,IAAM,wBAAwB,KAAK;AAE1C,IAAM,gBAAgB,oBAAI,IAA8C;AAExE,eAAsB,KAAK;AAAA,EACzB,cAAc;AAChB,IAEI,CAAC,GAAG;AACN,QAAM,aAAa,WAAW;AAChC;AAIA,eAAsB,aAAa,SAMf;AAClB,MAAI,OAAO,SAAS,UAAU;AAC5B,UAAM,IAAI,MAAM,qBAAqB;AAAA,EACvC;AAEA,MAAI,OAAO,WAAW,YAAY;AAChC,UAAM,IAAI,MAAM,yBAAyB;AAAA,EAC3C;AAEA,QAAM,cAAc,QAAQ,eAAe;AAE3C,QAAM,WAAW,MAAM,aAAa,WAAW;AAE/C,QAAM,SAAS,IAAI,OAAO,SAAS,KAAK;AAAA,IACtC,MAAM;AAAA,IACN,aAAa;AAAA,EACf,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AAAA,MACZ,IAAI,KAAK,KAAK,CAAC,eAAe,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAAA,IACrE;AAAA,EACF;AAEA,gBAAc,IAAI,aAAa,QAAQ;AAEvC,SAAO;AACT;AAEA,SAAS,MAAM,QAAgB,MAAiB;AAE9C,UAAQ,MAAM,4BAA4B,OAAO,GAAG,IAAI;AAC1D;AAEA,SAAS,SAAS,QAAgB,MAAiB;AAEjD,UAAQ,MAAM,8BAA8B,OAAO,aAAa,GAAG,IAAI;AACzE;",
6
+ "names": []
7
+ }
@@ -0,0 +1,125 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
+ mod
22
+ ));
23
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
+
25
+ // src/standalone-loader.ts
26
+ var standalone_loader_exports = {};
27
+ __export(standalone_loader_exports, {
28
+ DEFAULT_TIMEOUT_IN_MS: () => DEFAULT_TIMEOUT_IN_MS,
29
+ DEFAULT_WORKER_JS: () => DEFAULT_WORKER_JS,
30
+ generateCode: () => generateCode,
31
+ init: () => init
32
+ });
33
+ module.exports = __toCommonJS(standalone_loader_exports);
34
+ var import_node_fetch = __toESM(require("node-fetch"));
35
+ var packageVersion = "1.0.0";
36
+ var DEFAULT_WORKER_JS = `https://cdn.jsdelivr.net/npm/@alilc/lowcode-code-generator@${packageVersion}/dist/standalone-worker.min.js`;
37
+ var DEFAULT_TIMEOUT_IN_MS = 60 * 1e3;
38
+ var workerJsCache = /* @__PURE__ */ new Map();
39
+ async function init({
40
+ workerJsUrl = DEFAULT_WORKER_JS
41
+ } = {}) {
42
+ await loadWorkerJs(workerJsUrl);
43
+ }
44
+ async function generateCode(options) {
45
+ if (typeof self !== "object") {
46
+ throw new Error("self is not defined");
47
+ }
48
+ if (typeof Worker !== "function") {
49
+ throw new Error("Worker is not supported");
50
+ }
51
+ const workerJsUrl = options.workerJsUrl || DEFAULT_WORKER_JS;
52
+ const workerJs = await loadWorkerJs(workerJsUrl);
53
+ const worker = new Worker(workerJs.url, {
54
+ type: "classic",
55
+ credentials: "omit"
56
+ });
57
+ return new Promise((resolve, reject) => {
58
+ const timer = setTimeout(() => {
59
+ reject(new Error("timeout"));
60
+ worker.terminate();
61
+ }, options.timeoutInMs || DEFAULT_TIMEOUT_IN_MS);
62
+ worker.onmessage = (event) => {
63
+ const msg = event.data;
64
+ switch (msg.type) {
65
+ case "ready":
66
+ print("worker is ready.");
67
+ break;
68
+ case "run:begin":
69
+ print("worker is running...");
70
+ break;
71
+ case "run:end":
72
+ print("worker is done.");
73
+ resolve(msg.result);
74
+ clearTimeout(timer);
75
+ worker.terminate();
76
+ break;
77
+ case "run:error":
78
+ printErr(`worker error: ${msg.errorMsg}`);
79
+ clearTimeout(timer);
80
+ reject(new Error(msg.errorMsg || "unknown error"));
81
+ worker.terminate();
82
+ break;
83
+ default:
84
+ print("got unknown msg: %o", msg);
85
+ break;
86
+ }
87
+ };
88
+ worker.onerror = (err) => {
89
+ printErr("worker error: %o", err);
90
+ clearTimeout(timer);
91
+ reject(err);
92
+ worker.terminate();
93
+ };
94
+ worker.postMessage({
95
+ type: "run",
96
+ solution: options.solution,
97
+ schema: options.schema,
98
+ flattenResult: options.flattenResult
99
+ });
100
+ });
101
+ }
102
+ async function loadWorkerJs(workerJsUrl) {
103
+ const cached = workerJsCache.get(workerJsUrl);
104
+ if (cached) {
105
+ return cached;
106
+ }
107
+ const workerJsContent = await (0, import_node_fetch.default)(workerJsUrl).then((res) => res.text()).catch((err) => {
108
+ throw new Error(`Failed to fetch worker js: ${err}`);
109
+ });
110
+ const workerJs = {
111
+ content: workerJsContent,
112
+ url: self.URL.createObjectURL(
113
+ new self.Blob([workerJsContent], { type: "application/javascript" })
114
+ )
115
+ };
116
+ workerJsCache.set(workerJsUrl, workerJs);
117
+ return workerJs;
118
+ }
119
+ function print(msg, ...args) {
120
+ console.debug(`[code-generator/loader]: ${msg}`, ...args);
121
+ }
122
+ function printErr(msg, ...args) {
123
+ console.debug(`[code-generator/loader]: %c${msg}`, "color:red", ...args);
124
+ }
125
+ //# sourceMappingURL=standalone-loader.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/standalone-loader.ts"],
4
+ "sourcesContent": ["import fetch from 'node-fetch';\r\nimport type { IPublicTypeProjectSchema, ResultDir } from '@alilc/lowcode-types';\r\nimport type { FlattenFile } from './types/file';\r\n\r\ndeclare const Worker: any;\r\ndeclare const self: any;\r\ndeclare const __PACKAGE_VERSION__: string;\r\n\r\nconst packageVersion = __PACKAGE_VERSION__ || 'latest';\r\n\r\nexport const DEFAULT_WORKER_JS = `https://cdn.jsdelivr.net/npm/@alilc/lowcode-code-generator@${packageVersion}/dist/standalone-worker.min.js`;\r\n\r\nexport const DEFAULT_TIMEOUT_IN_MS = 60 * 1000;\r\n\r\nconst workerJsCache = new Map<string, { content: string; url: string }>();\r\n\r\nexport async function init({\r\n workerJsUrl = DEFAULT_WORKER_JS,\r\n}: {\r\n workerJsUrl?: string;\r\n} = {}) {\r\n await loadWorkerJs(workerJsUrl);\r\n}\r\n\r\nexport type Result = ResultDir | FlattenFile[];\r\n\r\nexport async function generateCode(options: {\r\n solution: 'icejs' | 'rax';\r\n schema: IPublicTypeProjectSchema;\r\n flattenResult?: boolean;\r\n workerJsUrl?: string;\r\n timeoutInMs?: number;\r\n}): Promise<Result> {\r\n if (typeof self !== 'object') {\r\n throw new Error('self is not defined');\r\n }\r\n\r\n if (typeof Worker !== 'function') {\r\n throw new Error('Worker is not supported');\r\n }\r\n\r\n const workerJsUrl = options.workerJsUrl || DEFAULT_WORKER_JS;\r\n\r\n const workerJs = await loadWorkerJs(workerJsUrl);\r\n\r\n const worker = new Worker(workerJs.url, {\r\n type: 'classic',\r\n credentials: 'omit',\r\n });\r\n\r\n return new Promise((resolve, reject) => {\r\n const timer = setTimeout(() => {\r\n reject(new Error('timeout'));\r\n worker.terminate();\r\n }, options.timeoutInMs || DEFAULT_TIMEOUT_IN_MS);\r\n\r\n worker.onmessage = (event: any) => {\r\n const msg = event.data;\r\n switch (msg.type) {\r\n case 'ready':\r\n print('worker is ready.');\r\n break;\r\n\r\n case 'run:begin':\r\n print('worker is running...');\r\n break;\r\n case 'run:end':\r\n print('worker is done.');\r\n resolve(msg.result);\r\n clearTimeout(timer);\r\n worker.terminate();\r\n break;\r\n case 'run:error':\r\n printErr(`worker error: ${msg.errorMsg}`);\r\n clearTimeout(timer);\r\n reject(new Error(msg.errorMsg || 'unknown error'));\r\n worker.terminate();\r\n break;\r\n default:\r\n print('got unknown msg: %o', msg);\r\n break;\r\n }\r\n };\r\n\r\n worker.onerror = (err: any) => {\r\n printErr('worker error: %o', err);\r\n clearTimeout(timer);\r\n reject(err);\r\n worker.terminate();\r\n };\r\n\r\n worker.postMessage({\r\n type: 'run',\r\n solution: options.solution,\r\n schema: options.schema,\r\n flattenResult: options.flattenResult,\r\n });\r\n });\r\n}\r\n\r\nasync function loadWorkerJs(workerJsUrl: string) {\r\n const cached = workerJsCache.get(workerJsUrl);\r\n if (cached) {\r\n return cached;\r\n }\r\n\r\n const workerJsContent = await fetch(workerJsUrl)\r\n .then((res) => res.text())\r\n .catch((err) => {\r\n throw new Error(`Failed to fetch worker js: ${err}`);\r\n });\r\n\r\n const workerJs = {\r\n content: workerJsContent,\r\n url: self.URL.createObjectURL(\r\n new self.Blob([workerJsContent], { type: 'application/javascript' }),\r\n ),\r\n };\r\n\r\n workerJsCache.set(workerJsUrl, workerJs);\r\n\r\n return workerJs;\r\n}\r\n\r\nfunction print(msg: string, ...args: unknown[]) {\r\n // eslint-disable-next-line no-console\r\n console.debug(`[code-generator/loader]: ${msg}`, ...args);\r\n}\r\n\r\nfunction printErr(msg: string, ...args: unknown[]) {\r\n // eslint-disable-next-line no-console\r\n console.debug(`[code-generator/loader]: %c${msg}`, 'color:red', ...args);\r\n}\r\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAkB;AAQlB,IAAM,iBAAiB;AAEhB,IAAM,oBAAoB,8DAA8D;AAExF,IAAM,wBAAwB,KAAK;AAE1C,IAAM,gBAAgB,oBAAI,IAA8C;AAExE,eAAsB,KAAK;AAAA,EACzB,cAAc;AAChB,IAEI,CAAC,GAAG;AACN,QAAM,aAAa,WAAW;AAChC;AAIA,eAAsB,aAAa,SAMf;AAClB,MAAI,OAAO,SAAS,UAAU;AAC5B,UAAM,IAAI,MAAM,qBAAqB;AAAA,EACvC;AAEA,MAAI,OAAO,WAAW,YAAY;AAChC,UAAM,IAAI,MAAM,yBAAyB;AAAA,EAC3C;AAEA,QAAM,cAAc,QAAQ,eAAe;AAE3C,QAAM,WAAW,MAAM,aAAa,WAAW;AAE/C,QAAM,SAAS,IAAI,OAAO,SAAS,KAAK;AAAA,IACtC,MAAM;AAAA,IACN,aAAa;AAAA,EACf,CAAC;AAED,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtC,UAAM,QAAQ,WAAW,MAAM;A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C;AAAA,IACrE;AAAA,EACF;AAEA,gBAAc,IAAI,aAAa,QAAQ;AAEvC,SAAO;AACT;AAEA,SAAS,MAAM,QAAgB,MAAiB;AAE9C,UAAQ,MAAM,4BAA4B,OAAO,GAAG,IAAI;AAC1D;AAEA,SAAS,SAAS,QAAgB,MAAiB;AAEjD,UAAQ,MAAM,8BAA8B,OAAO,aAAa,GAAG,IAAI;AACzE;",
6
+ "names": ["fetch"]
7
+ }
@@ -0,0 +1,276 @@
1
+ {
2
+ "version": "1.0.0",
3
+ "componentsMap": [
4
+ {
5
+ "componentName": "Button",
6
+ "package": "@alifd/next",
7
+ "version": "1.19.18",
8
+ "destructuring": true,
9
+ "exportName": "Button"
10
+ },
11
+ {
12
+ "componentName": "Button.Group",
13
+ "package": "@alifd/next",
14
+ "version": "1.19.18",
15
+ "destructuring": true,
16
+ "exportName": "Button",
17
+ "subName": "Group"
18
+ },
19
+ {
20
+ "componentName": "Input",
21
+ "package": "@alifd/next",
22
+ "version": "1.19.18",
23
+ "destructuring": true,
24
+ "exportName": "Input"
25
+ },
26
+ {
27
+ "componentName": "Form",
28
+ "package": "@alifd/next",
29
+ "version": "1.19.18",
30
+ "destructuring": true,
31
+ "exportName": "Form"
32
+ },
33
+ {
34
+ "componentName": "Form.Item",
35
+ "package": "@alifd/next",
36
+ "version": "1.19.18",
37
+ "destructuring": true,
38
+ "exportName": "Form",
39
+ "subName": "Item"
40
+ },
41
+ {
42
+ "componentName": "NumberPicker",
43
+ "package": "@alifd/next",
44
+ "version": "1.19.18",
45
+ "destructuring": true,
46
+ "exportName": "NumberPicker"
47
+ },
48
+ {
49
+ "componentName": "Select",
50
+ "package": "@alifd/next",
51
+ "version": "1.19.18",
52
+ "destructuring": true,
53
+ "exportName": "Select"
54
+ }
55
+ ],
56
+ "componentsTree": [
57
+ {
58
+ "componentName": "Page",
59
+ "id": "node$1",
60
+ "meta": {
61
+ "title": "测试",
62
+ "router": "/"
63
+ },
64
+ "props": {
65
+ "ref": "outerView",
66
+ "autoLoading": true
67
+ },
68
+ "fileName": "test",
69
+ "state": {
70
+ "text": "outer"
71
+ },
72
+ "lifeCycles": {
73
+ "componentDidMount": {
74
+ "type": "JSFunction",
75
+ "value": "function componentDidMount() { console.log('componentDidMount'); }"
76
+ }
77
+ },
78
+ "dataSource": {
79
+ "list": [
80
+ {
81
+ "id": "urlParams",
82
+ "type": "urlParams"
83
+ },
84
+
85
+ {
86
+ "id": "user",
87
+ "type": "fetch",
88
+ "options": {
89
+ "method": "GET",
90
+ "uri": "https://shs.xxx.com/mock/1458/demo/user",
91
+ "isSync": true
92
+ },
93
+ "dataHandler": {
94
+ "type": "JSFunction",
95
+ "value": "function (response) {\nif (!response.data.success){\n throw new Error(response.data.message);\n }\n return response.data.data;\n}"
96
+ }
97
+ },
98
+
99
+ {
100
+ "id": "orders",
101
+ "type": "fetch",
102
+ "options": {
103
+ "method": "GET",
104
+ "uri": "https://shs.xxx.com/mock/1458/demo/orders",
105
+ "isSync": true
106
+ },
107
+ "dataHandler": {
108
+ "type": "JSFunction",
109
+ "value": "function (response) {\nif (!response.data.success){\n throw new Error(response.data.message);\n }\n return response.data.data.result;\n}"
110
+ }
111
+ }
112
+ ],
113
+ "dataHandler": {
114
+ "type": "JSFunction",
115
+ "value": "function (dataMap) {\n console.info(\"All datasources loaded:\", dataMap);\n}"
116
+ }
117
+ },
118
+ "children": [
119
+ {
120
+ "componentName": "Form",
121
+ "id": "node$2",
122
+ "props": {
123
+ "labelCol": {
124
+ "type": "JSExpression",
125
+ "value": "this.state.colNum"
126
+ },
127
+ "style": {},
128
+ "ref": "testForm"
129
+ },
130
+ "children": [
131
+ {
132
+ "componentName": "Form.Item",
133
+ "id": "node$3",
134
+ "props": {
135
+ "label": "姓名:",
136
+ "name": "name",
137
+ "initValue": "李雷"
138
+ },
139
+ "children": [
140
+ {
141
+ "componentName": "Input",
142
+ "id": "node$4",
143
+ "props": {
144
+ "placeholder": "请输入",
145
+ "size": "medium",
146
+ "style": {
147
+ "width": 320
148
+ }
149
+ }
150
+ }
151
+ ]
152
+ },
153
+ {
154
+ "componentName": "Form.Item",
155
+ "id": "node$5",
156
+ "props": {
157
+ "label": "年龄:",
158
+ "name": "age",
159
+ "initValue": "22"
160
+ },
161
+ "children": [
162
+ {
163
+ "componentName": "NumberPicker",
164
+ "id": "node$6",
165
+ "props": {
166
+ "size": "medium",
167
+ "type": "normal"
168
+ }
169
+ }
170
+ ]
171
+ },
172
+ {
173
+ "componentName": "Form.Item",
174
+ "id": "node$7",
175
+ "props": {
176
+ "label": "职业:",
177
+ "name": "profession"
178
+ },
179
+ "children": [
180
+ {
181
+ "componentName": "Select",
182
+ "id": "node$8",
183
+ "props": {
184
+ "dataSource": [
185
+ {
186
+ "label": "教师",
187
+ "value": "t"
188
+ },
189
+ {
190
+ "label": "医生",
191
+ "value": "d"
192
+ },
193
+ {
194
+ "label": "歌手",
195
+ "value": "s"
196
+ }
197
+ ]
198
+ }
199
+ }
200
+ ]
201
+ },
202
+ {
203
+ "componentName": "Div",
204
+ "id": "node$9",
205
+ "props": {
206
+ "style": {
207
+ "textAlign": "center"
208
+ }
209
+ },
210
+ "children": [
211
+ {
212
+ "componentName": "Button.Group",
213
+ "id": "node$a",
214
+ "props": {},
215
+ "children": [
216
+ {
217
+ "componentName": "Button",
218
+ "id": "node$b",
219
+ "condition": {
220
+ "type": "JSExpression",
221
+ "value": "this.index >= 1"
222
+ },
223
+ "loop": ["a", "b", "c"],
224
+ "props": {
225
+ "type": "primary",
226
+ "style": {
227
+ "margin": "0 5px 0 5px"
228
+ }
229
+ },
230
+ "children": [
231
+ {
232
+ "type": "JSExpression",
233
+ "value": "this.item"
234
+ }
235
+ ]
236
+ }
237
+ ]
238
+ }
239
+ ]
240
+ }
241
+ ]
242
+ }
243
+ ]
244
+ }
245
+ ],
246
+ "constants": {
247
+ "ENV": "prod",
248
+ "DOMAIN": "xxx.xxx.com"
249
+ },
250
+ "css": "body {font-size: 12px;} .table { width: 100px;}",
251
+ "config": {
252
+ "sdkVersion": "1.0.3",
253
+ "historyMode": "hash",
254
+ "targetRootID": "J_Container",
255
+ "layout": {
256
+ "componentName": "BasicLayout",
257
+ "props": {
258
+ "logo": "...",
259
+ "name": "测试网站"
260
+ }
261
+ },
262
+ "theme": {
263
+ "package": "@alife/theme-fusion",
264
+ "version": "^0.1.0",
265
+ "primary": "#ff9966"
266
+ }
267
+ },
268
+ "meta": {
269
+ "name": "demo应用",
270
+ "git_group": "appGroup",
271
+ "project_name": "app_demo",
272
+ "description": "这是一个测试应用",
273
+ "spma": "spa23d",
274
+ "creator": "Test"
275
+ }
276
+ }