@dckj-npm/lowcode-code-generator 1.0.0 → 1.0.1
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.
- package/CHANGELOG.md +280 -280
- package/CONTRIBUTING.md +40 -40
- package/README.md +123 -123
- package/bin/lowcode-code-generator.js +52 -52
- package/dist/cli.js.map +1 -1
- package/dist/standalone-loader.esm.js +2 -2
- package/dist/standalone-loader.esm.js.map +2 -2
- package/dist/standalone-loader.js +2 -2
- package/dist/standalone-loader.js.map +2 -2
- package/example-schema.json +276 -276
- package/example-schema.json5 +276 -276
- package/package.json +155 -155
- package/standalone/index.js +6 -6
- package/standalone/package.json +5 -5
- package/standalone-loader/index.js +2 -2
- package/standalone-loader/package.json +6 -6
- package/standalone-worker/index.js +6 -6
- package/standalone-worker/package.json +5 -5
- package/lib/index.js +0 -10199
- package/lib/index.js.map +0 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/standalone-loader.ts
|
|
2
2
|
import fetch from "node-fetch";
|
|
3
|
-
var packageVersion = "1.0.
|
|
4
|
-
var DEFAULT_WORKER_JS = `https://cdn.jsdelivr.net/npm/@
|
|
3
|
+
var packageVersion = "1.0.1";
|
|
4
|
+
var DEFAULT_WORKER_JS = `https://cdn.jsdelivr.net/npm/@dckj-npm/lowcode-code-generator@${packageVersion}/dist/standalone-worker.min.js`;
|
|
5
5
|
var DEFAULT_TIMEOUT_IN_MS = 60 * 1e3;
|
|
6
6
|
var workerJsCache = /* @__PURE__ */ new Map();
|
|
7
7
|
async function init({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/standalone-loader.ts"],
|
|
4
|
-
"sourcesContent": ["import fetch from 'node-fetch';\
|
|
5
|
-
"mappings": ";AAAA,OAAO,WAAW;AAQlB,IAAM,iBAAiB;AAEhB,IAAM,oBAAoB,
|
|
4
|
+
"sourcesContent": ["import fetch from 'node-fetch';\nimport type { IPublicTypeProjectSchema, ResultDir } from '@alilc/lowcode-types';\nimport type { FlattenFile } from './types/file';\n\ndeclare const Worker: any;\ndeclare const self: any;\ndeclare const __PACKAGE_VERSION__: string;\n\nconst packageVersion = __PACKAGE_VERSION__ || 'latest';\n\nexport const DEFAULT_WORKER_JS = `https://cdn.jsdelivr.net/npm/@dckj-npm/lowcode-code-generator@${packageVersion}/dist/standalone-worker.min.js`;\n\nexport const DEFAULT_TIMEOUT_IN_MS = 60 * 1000;\n\nconst workerJsCache = new Map<string, { content: string; url: string }>();\n\nexport async function init({\n workerJsUrl = DEFAULT_WORKER_JS,\n}: {\n workerJsUrl?: string;\n} = {}) {\n await loadWorkerJs(workerJsUrl);\n}\n\nexport type Result = ResultDir | FlattenFile[];\n\nexport async function generateCode(options: {\n solution: 'icejs' | 'rax' | 'vuejs3';\n schema: IPublicTypeProjectSchema;\n flattenResult?: boolean;\n workerJsUrl?: string;\n timeoutInMs?: number;\n}): Promise<Result> {\n if (typeof self !== 'object') {\n throw new Error('self is not defined');\n }\n\n if (typeof Worker !== 'function') {\n throw new Error('Worker is not supported');\n }\n\n const workerJsUrl = options.workerJsUrl || DEFAULT_WORKER_JS;\n\n const workerJs = await loadWorkerJs(workerJsUrl);\n\n const worker = new Worker(workerJs.url, {\n type: 'classic',\n credentials: 'omit',\n });\n\n return new Promise((resolve, reject) => {\n const timer = setTimeout(() => {\n reject(new Error('timeout'));\n worker.terminate();\n }, options.timeoutInMs || DEFAULT_TIMEOUT_IN_MS);\n\n worker.onmessage = (event: any) => {\n const msg = event.data;\n switch (msg.type) {\n case 'ready':\n print('worker is ready.');\n break;\n\n case 'run:begin':\n print('worker is running...');\n break;\n case 'run:end':\n print('worker is done.');\n resolve(msg.result);\n clearTimeout(timer);\n worker.terminate();\n break;\n case 'run:error':\n printErr(`worker error: ${msg.errorMsg}`);\n clearTimeout(timer);\n reject(new Error(msg.errorMsg || 'unknown error'));\n worker.terminate();\n break;\n default:\n print('got unknown msg: %o', msg);\n break;\n }\n };\n\n worker.onerror = (err: any) => {\n printErr('worker error: %o', err);\n clearTimeout(timer);\n reject(err);\n worker.terminate();\n };\n\n worker.postMessage({\n type: 'run',\n solution: options.solution,\n schema: options.schema,\n flattenResult: options.flattenResult,\n });\n });\n}\n\nasync function loadWorkerJs(workerJsUrl: string) {\n const cached = workerJsCache.get(workerJsUrl);\n if (cached) {\n return cached;\n }\n\n const workerJsContent = await fetch(workerJsUrl)\n .then((res) => res.text())\n .catch((err) => {\n throw new Error(`Failed to fetch worker js: ${err}`);\n });\n\n const workerJs = {\n content: workerJsContent,\n url: self.URL.createObjectURL(\n new self.Blob([workerJsContent], { type: 'application/javascript' }),\n ),\n };\n\n workerJsCache.set(workerJsUrl, workerJs);\n\n return workerJs;\n}\n\nfunction print(msg: string, ...args: unknown[]) {\n // eslint-disable-next-line no-console\n console.debug(`[code-generator/loader]: ${msg}`, ...args);\n}\n\nfunction printErr(msg: string, ...args: unknown[]) {\n // eslint-disable-next-line no-console\n console.debug(`[code-generator/loader]: %c${msg}`, 'color:red', ...args);\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,OAAO,WAAW;AAQlB,IAAM,iBAAiB;AAEhB,IAAM,oBAAoB,iEAAiE;AAE3F,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,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ACT,KAAK,KAAK,IAAI;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
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -32,8 +32,8 @@ __export(standalone_loader_exports, {
|
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(standalone_loader_exports);
|
|
34
34
|
var import_node_fetch = __toESM(require("node-fetch"));
|
|
35
|
-
var packageVersion = "1.0.
|
|
36
|
-
var DEFAULT_WORKER_JS = `https://cdn.jsdelivr.net/npm/@
|
|
35
|
+
var packageVersion = "1.0.1";
|
|
36
|
+
var DEFAULT_WORKER_JS = `https://cdn.jsdelivr.net/npm/@dckj-npm/lowcode-code-generator@${packageVersion}/dist/standalone-worker.min.js`;
|
|
37
37
|
var DEFAULT_TIMEOUT_IN_MS = 60 * 1e3;
|
|
38
38
|
var workerJsCache = /* @__PURE__ */ new Map();
|
|
39
39
|
async function init({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/standalone-loader.ts"],
|
|
4
|
-
"sourcesContent": ["import fetch from 'node-fetch';\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAkB;AAQlB,IAAM,iBAAiB;AAEhB,IAAM,oBAAoB,
|
|
4
|
+
"sourcesContent": ["import fetch from 'node-fetch';\nimport type { IPublicTypeProjectSchema, ResultDir } from '@alilc/lowcode-types';\nimport type { FlattenFile } from './types/file';\n\ndeclare const Worker: any;\ndeclare const self: any;\ndeclare const __PACKAGE_VERSION__: string;\n\nconst packageVersion = __PACKAGE_VERSION__ || 'latest';\n\nexport const DEFAULT_WORKER_JS = `https://cdn.jsdelivr.net/npm/@dckj-npm/lowcode-code-generator@${packageVersion}/dist/standalone-worker.min.js`;\n\nexport const DEFAULT_TIMEOUT_IN_MS = 60 * 1000;\n\nconst workerJsCache = new Map<string, { content: string; url: string }>();\n\nexport async function init({\n workerJsUrl = DEFAULT_WORKER_JS,\n}: {\n workerJsUrl?: string;\n} = {}) {\n await loadWorkerJs(workerJsUrl);\n}\n\nexport type Result = ResultDir | FlattenFile[];\n\nexport async function generateCode(options: {\n solution: 'icejs' | 'rax' | 'vuejs3';\n schema: IPublicTypeProjectSchema;\n flattenResult?: boolean;\n workerJsUrl?: string;\n timeoutInMs?: number;\n}): Promise<Result> {\n if (typeof self !== 'object') {\n throw new Error('self is not defined');\n }\n\n if (typeof Worker !== 'function') {\n throw new Error('Worker is not supported');\n }\n\n const workerJsUrl = options.workerJsUrl || DEFAULT_WORKER_JS;\n\n const workerJs = await loadWorkerJs(workerJsUrl);\n\n const worker = new Worker(workerJs.url, {\n type: 'classic',\n credentials: 'omit',\n });\n\n return new Promise((resolve, reject) => {\n const timer = setTimeout(() => {\n reject(new Error('timeout'));\n worker.terminate();\n }, options.timeoutInMs || DEFAULT_TIMEOUT_IN_MS);\n\n worker.onmessage = (event: any) => {\n const msg = event.data;\n switch (msg.type) {\n case 'ready':\n print('worker is ready.');\n break;\n\n case 'run:begin':\n print('worker is running...');\n break;\n case 'run:end':\n print('worker is done.');\n resolve(msg.result);\n clearTimeout(timer);\n worker.terminate();\n break;\n case 'run:error':\n printErr(`worker error: ${msg.errorMsg}`);\n clearTimeout(timer);\n reject(new Error(msg.errorMsg || 'unknown error'));\n worker.terminate();\n break;\n default:\n print('got unknown msg: %o', msg);\n break;\n }\n };\n\n worker.onerror = (err: any) => {\n printErr('worker error: %o', err);\n clearTimeout(timer);\n reject(err);\n worker.terminate();\n };\n\n worker.postMessage({\n type: 'run',\n solution: options.solution,\n schema: options.schema,\n flattenResult: options.flattenResult,\n });\n });\n}\n\nasync function loadWorkerJs(workerJsUrl: string) {\n const cached = workerJsCache.get(workerJsUrl);\n if (cached) {\n return cached;\n }\n\n const workerJsContent = await fetch(workerJsUrl)\n .then((res) => res.text())\n .catch((err) => {\n throw new Error(`Failed to fetch worker js: ${err}`);\n });\n\n const workerJs = {\n content: workerJsContent,\n url: self.URL.createObjectURL(\n new self.Blob([workerJsContent], { type: 'application/javascript' }),\n ),\n };\n\n workerJsCache.set(workerJsUrl, workerJs);\n\n return workerJs;\n}\n\nfunction print(msg: string, ...args: unknown[]) {\n // eslint-disable-next-line no-console\n console.debug(`[code-generator/loader]: ${msg}`, ...args);\n}\n\nfunction printErr(msg: string, ...args: unknown[]) {\n // eslint-disable-next-line no-console\n console.debug(`[code-generator/loader]: %c${msg}`, 'color:red', ...args);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAkB;AAQlB,IAAM,iBAAiB;AAEhB,IAAM,oBAAoB,iEAAiE;AAE3F,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,K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,QAAM,WAAW;AAAA,IACf,SAAS;AAAA,IACT,KAAK,KAAK,IAAI;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
6
|
"names": ["fetch"]
|
|
7
7
|
}
|
package/example-schema.json
CHANGED
|
@@ -1,276 +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
|
-
}
|
|
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
|
+
}
|