@cloudbase/cals 0.3.12 → 0.3.16
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/lib/parser/cals/index.d.ts +83 -83
- package/lib/parser/cals/index.d.ts.map +1 -1
- package/lib/parser/cals/index.js +64 -12
- package/lib/parser/cals/utils/runtime.d.ts +2 -0
- package/lib/parser/cals/utils/runtime.d.ts.map +1 -1
- package/lib/parser/cals/utils/runtime.js +89 -1
- package/lib/parser/cals/utils/version/config.d.ts +2 -0
- package/lib/parser/cals/utils/version/config.d.ts.map +1 -1
- package/lib/parser/cals/utils/version/config.js +10 -1
- package/lib/schema/platform_application.json +2176 -0
- package/lib/tests/common-application-specs.test.d.ts +2 -0
- package/lib/tests/common-application-specs.test.d.ts.map +1 -0
- package/lib/tests/common-application-specs.test.js +45 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/platform/component.d.ts +2 -0
- package/lib/types/platform/component.d.ts.map +1 -1
- package/package.json +6 -2
|
@@ -45,12 +45,6 @@ export declare function deserializeValue(ctx: IDeserializeContext, key: string,
|
|
|
45
45
|
type: PropBindType;
|
|
46
46
|
value: any;
|
|
47
47
|
};
|
|
48
|
-
} | {
|
|
49
|
-
key: string;
|
|
50
|
-
value: {
|
|
51
|
-
type: undefined;
|
|
52
|
-
value: any;
|
|
53
|
-
} | undefined;
|
|
54
48
|
};
|
|
55
49
|
export declare function serializeDynamicMap({ ctx, map, scope, streamlineDefaultValue, }: {
|
|
56
50
|
ctx: ISerializeContext;
|
|
@@ -66,7 +60,7 @@ export declare function deserializeDynamicMap(ctx: IDeserializeContext, map: {
|
|
|
66
60
|
[key: string]: string | any;
|
|
67
61
|
}): {
|
|
68
62
|
[key: string]: {
|
|
69
|
-
type?: string
|
|
63
|
+
type?: string;
|
|
70
64
|
value: any;
|
|
71
65
|
};
|
|
72
66
|
};
|
|
@@ -77,18 +71,18 @@ export declare function serializeAttributes(ctx: ISerializeContext, scope: 'page
|
|
|
77
71
|
};
|
|
78
72
|
export declare function deserializeAttributes(ctx: IDeserializeContext, attributes?: IAttributes): {
|
|
79
73
|
[key: string]: {
|
|
80
|
-
type?: string
|
|
74
|
+
type?: string;
|
|
81
75
|
value: any;
|
|
82
76
|
};
|
|
83
77
|
};
|
|
84
78
|
export declare function deserializeDataVariables(ctx: IDeserializeContext, data: IDataSourceVariable): {
|
|
85
|
-
title: string
|
|
79
|
+
title: string;
|
|
86
80
|
name: string;
|
|
87
81
|
varType: "datasource";
|
|
88
|
-
dataType?: "record-collection" | "new-record" | "single-record" | "single-record-edit"
|
|
82
|
+
dataType?: "record-collection" | "new-record" | "single-record" | "single-record-edit";
|
|
89
83
|
dataSourceName: string;
|
|
90
|
-
initMethod?: IDataVarMethod
|
|
91
|
-
updateMethod?: IDataVarMethod
|
|
84
|
+
initMethod?: IDataVarMethod;
|
|
85
|
+
updateMethod?: IDataVarMethod;
|
|
92
86
|
};
|
|
93
87
|
export declare function serializeComponent(ctx: ISerializeContext & ({
|
|
94
88
|
page: Required<ISerializeContext>['page'];
|
|
@@ -132,23 +126,23 @@ export declare function deserializePage(ctx: {
|
|
|
132
126
|
dependencies: IDeserializeContext['dependencies'];
|
|
133
127
|
homePageId: string;
|
|
134
128
|
}, page: IPageComponent): {
|
|
135
|
-
id: string
|
|
129
|
+
id: string;
|
|
136
130
|
isHome: boolean;
|
|
137
131
|
dataset: any;
|
|
138
132
|
vars: {
|
|
139
133
|
data: {
|
|
140
|
-
title: string
|
|
134
|
+
title: string;
|
|
141
135
|
name: string;
|
|
142
136
|
varType: "datasource";
|
|
143
|
-
dataType?: "record-collection" | "new-record" | "single-record" | "single-record-edit"
|
|
137
|
+
dataType?: "record-collection" | "new-record" | "single-record" | "single-record-edit";
|
|
144
138
|
dataSourceName: string;
|
|
145
|
-
initMethod?: IDataVarMethod
|
|
146
|
-
updateMethod?: IDataVarMethod
|
|
139
|
+
initMethod?: IDataVarMethod;
|
|
140
|
+
updateMethod?: IDataVarMethod;
|
|
147
141
|
}[];
|
|
148
142
|
};
|
|
149
143
|
data: {
|
|
150
144
|
[key: string]: {
|
|
151
|
-
type?: string
|
|
145
|
+
type?: string;
|
|
152
146
|
value: any;
|
|
153
147
|
};
|
|
154
148
|
};
|
|
@@ -163,36 +157,36 @@ export declare function deserializePage(ctx: {
|
|
|
163
157
|
propertyPath: string;
|
|
164
158
|
bindDataPath: string;
|
|
165
159
|
type?: any;
|
|
166
|
-
}[]
|
|
160
|
+
}[];
|
|
167
161
|
dataTypes?: {
|
|
168
162
|
propertyPath: string;
|
|
169
|
-
type?: "static" | "slot" | "bind"
|
|
170
|
-
}[]
|
|
163
|
+
type?: "static" | "slot" | "bind";
|
|
164
|
+
}[];
|
|
171
165
|
key: string;
|
|
172
166
|
sourceKey: string;
|
|
173
|
-
instanceFunction?: string
|
|
174
|
-
}
|
|
175
|
-
commonStyle: object
|
|
176
|
-
staticResourceAttribute: string[]
|
|
177
|
-
hideAdminPortalMenu: boolean
|
|
167
|
+
instanceFunction?: string;
|
|
168
|
+
};
|
|
169
|
+
commonStyle: object;
|
|
170
|
+
staticResourceAttribute: string[];
|
|
171
|
+
hideAdminPortalMenu: boolean;
|
|
178
172
|
lowCodes: {
|
|
179
|
-
type: string
|
|
173
|
+
type: string;
|
|
180
174
|
code: string;
|
|
181
|
-
description?: string
|
|
182
|
-
path?: string
|
|
175
|
+
description?: string;
|
|
176
|
+
path?: string;
|
|
183
177
|
name: string;
|
|
184
|
-
}[]
|
|
178
|
+
}[];
|
|
185
179
|
listeners: {
|
|
186
180
|
key: string;
|
|
187
181
|
trigger: string;
|
|
188
|
-
type: string
|
|
182
|
+
type: string;
|
|
189
183
|
handler: {
|
|
190
|
-
name: string
|
|
191
|
-
moduleName: string
|
|
184
|
+
name: string;
|
|
185
|
+
moduleName: string;
|
|
192
186
|
};
|
|
193
187
|
data: {
|
|
194
188
|
[key: string]: {
|
|
195
|
-
type?: string
|
|
189
|
+
type?: string;
|
|
196
190
|
value: any;
|
|
197
191
|
};
|
|
198
192
|
};
|
|
@@ -217,31 +211,31 @@ export declare function deserializePlatformApp(data: IPlatformApp, optsions: {
|
|
|
217
211
|
dependencies: object[];
|
|
218
212
|
}): {
|
|
219
213
|
id: any;
|
|
220
|
-
version: string
|
|
221
|
-
author: string
|
|
222
|
-
name: string
|
|
223
|
-
label: string
|
|
224
|
-
description: string
|
|
214
|
+
version: string;
|
|
215
|
+
author: string;
|
|
216
|
+
name: string;
|
|
217
|
+
label: string;
|
|
218
|
+
description: string;
|
|
225
219
|
selectedPageId: string;
|
|
226
|
-
historyType: "HASH" | "BROWSER"
|
|
220
|
+
historyType: "HASH" | "BROWSER";
|
|
227
221
|
pageInstanceList: {
|
|
228
|
-
id: string
|
|
222
|
+
id: string;
|
|
229
223
|
isHome: boolean;
|
|
230
224
|
dataset: any;
|
|
231
225
|
vars: {
|
|
232
226
|
data: {
|
|
233
|
-
title: string
|
|
227
|
+
title: string;
|
|
234
228
|
name: string;
|
|
235
229
|
varType: "datasource";
|
|
236
|
-
dataType?: "record-collection" | "new-record" | "single-record" | "single-record-edit"
|
|
230
|
+
dataType?: "record-collection" | "new-record" | "single-record" | "single-record-edit";
|
|
237
231
|
dataSourceName: string;
|
|
238
|
-
initMethod?: IDataVarMethod
|
|
239
|
-
updateMethod?: IDataVarMethod
|
|
232
|
+
initMethod?: IDataVarMethod;
|
|
233
|
+
updateMethod?: IDataVarMethod;
|
|
240
234
|
}[];
|
|
241
235
|
};
|
|
242
236
|
data: {
|
|
243
237
|
[key: string]: {
|
|
244
|
-
type?: string
|
|
238
|
+
type?: string;
|
|
245
239
|
value: any;
|
|
246
240
|
};
|
|
247
241
|
};
|
|
@@ -256,36 +250,36 @@ export declare function deserializePlatformApp(data: IPlatformApp, optsions: {
|
|
|
256
250
|
propertyPath: string;
|
|
257
251
|
bindDataPath: string;
|
|
258
252
|
type?: any;
|
|
259
|
-
}[]
|
|
253
|
+
}[];
|
|
260
254
|
dataTypes?: {
|
|
261
255
|
propertyPath: string;
|
|
262
|
-
type?: "static" | "slot" | "bind"
|
|
263
|
-
}[]
|
|
256
|
+
type?: "static" | "slot" | "bind";
|
|
257
|
+
}[];
|
|
264
258
|
key: string;
|
|
265
259
|
sourceKey: string;
|
|
266
|
-
instanceFunction?: string
|
|
267
|
-
}
|
|
268
|
-
commonStyle: object
|
|
269
|
-
staticResourceAttribute: string[]
|
|
270
|
-
hideAdminPortalMenu: boolean
|
|
260
|
+
instanceFunction?: string;
|
|
261
|
+
};
|
|
262
|
+
commonStyle: object;
|
|
263
|
+
staticResourceAttribute: string[];
|
|
264
|
+
hideAdminPortalMenu: boolean;
|
|
271
265
|
lowCodes: {
|
|
272
|
-
type: string
|
|
266
|
+
type: string;
|
|
273
267
|
code: string;
|
|
274
|
-
description?: string
|
|
275
|
-
path?: string
|
|
268
|
+
description?: string;
|
|
269
|
+
path?: string;
|
|
276
270
|
name: string;
|
|
277
|
-
}[]
|
|
271
|
+
}[];
|
|
278
272
|
listeners: {
|
|
279
273
|
key: string;
|
|
280
274
|
trigger: string;
|
|
281
|
-
type: string
|
|
275
|
+
type: string;
|
|
282
276
|
handler: {
|
|
283
|
-
name: string
|
|
284
|
-
moduleName: string
|
|
277
|
+
name: string;
|
|
278
|
+
moduleName: string;
|
|
285
279
|
};
|
|
286
280
|
data: {
|
|
287
281
|
[key: string]: {
|
|
288
|
-
type?: string
|
|
282
|
+
type?: string;
|
|
289
283
|
value: any;
|
|
290
284
|
};
|
|
291
285
|
};
|
|
@@ -294,23 +288,23 @@ export declare function deserializePlatformApp(data: IPlatformApp, optsions: {
|
|
|
294
288
|
}[];
|
|
295
289
|
}[];
|
|
296
290
|
lowCodes: {
|
|
297
|
-
type: string
|
|
291
|
+
type: string;
|
|
298
292
|
code: string;
|
|
299
|
-
description?: string
|
|
300
|
-
path?: string
|
|
293
|
+
description?: string;
|
|
294
|
+
path?: string;
|
|
301
295
|
name: string;
|
|
302
296
|
}[];
|
|
303
|
-
datasources: IPlatformDataSource[]
|
|
297
|
+
datasources: IPlatformDataSource[];
|
|
304
298
|
dataset: any;
|
|
305
299
|
vars: {
|
|
306
300
|
data: {
|
|
307
|
-
title: string
|
|
301
|
+
title: string;
|
|
308
302
|
name: string;
|
|
309
303
|
varType: "datasource";
|
|
310
|
-
dataType?: "record-collection" | "new-record" | "single-record" | "single-record-edit"
|
|
304
|
+
dataType?: "record-collection" | "new-record" | "single-record" | "single-record-edit";
|
|
311
305
|
dataSourceName: string;
|
|
312
|
-
initMethod?: IDataVarMethod
|
|
313
|
-
updateMethod?: IDataVarMethod
|
|
306
|
+
initMethod?: IDataVarMethod;
|
|
307
|
+
updateMethod?: IDataVarMethod;
|
|
314
308
|
}[];
|
|
315
309
|
};
|
|
316
310
|
npmDependencies: {
|
|
@@ -320,28 +314,28 @@ export declare function deserializePlatformApp(data: IPlatformApp, optsions: {
|
|
|
320
314
|
title: string;
|
|
321
315
|
name: string;
|
|
322
316
|
module: string;
|
|
323
|
-
type?: "kbone" | "mp"
|
|
317
|
+
type?: "kbone" | "mp";
|
|
324
318
|
version: string;
|
|
325
319
|
}[];
|
|
326
|
-
maxID: number
|
|
327
|
-
rootPath: string
|
|
320
|
+
maxID: number;
|
|
321
|
+
rootPath: string;
|
|
328
322
|
themeVars: {
|
|
329
323
|
[key: string]: string;
|
|
330
|
-
}
|
|
324
|
+
};
|
|
331
325
|
presetColors: string[];
|
|
332
|
-
appConfig: {}
|
|
326
|
+
appConfig: {};
|
|
333
327
|
miniprogramPlugins: {
|
|
334
328
|
name: string;
|
|
335
329
|
version: string;
|
|
336
330
|
pluginAppId: string;
|
|
337
331
|
componentConfigs: (object & {
|
|
338
|
-
isMiniProgramPlugins?: boolean
|
|
332
|
+
isMiniProgramPlugins?: boolean;
|
|
339
333
|
})[];
|
|
340
|
-
}[]
|
|
334
|
+
}[];
|
|
341
335
|
extra: {
|
|
342
|
-
name: string
|
|
343
|
-
author: string
|
|
344
|
-
description: string
|
|
336
|
+
name: string;
|
|
337
|
+
author: string;
|
|
338
|
+
description: string;
|
|
345
339
|
};
|
|
346
340
|
dependencies: IDependencies;
|
|
347
341
|
};
|
|
@@ -359,6 +353,12 @@ export declare function serializeRuntimeComponent(ctx: ISerializeContext & {
|
|
|
359
353
|
}, component: any & {
|
|
360
354
|
id: string;
|
|
361
355
|
}): IBasicComponent | IComplexComponent;
|
|
356
|
+
/**
|
|
357
|
+
* component
|
|
358
|
+
* [CALS] to [formily]
|
|
359
|
+
* To be continue, currently support listener
|
|
360
|
+
*/
|
|
361
|
+
export declare function deserializeRuntimeComponent(ctx: any, component: any): any;
|
|
362
362
|
export declare function deserializeComponentLibraryMeta(meta: {
|
|
363
363
|
styles?: string[];
|
|
364
364
|
dependencies?: {
|
|
@@ -378,14 +378,14 @@ export declare function deserializeComponentLibraryMeta(meta: {
|
|
|
378
378
|
components: {
|
|
379
379
|
[key: string]: {
|
|
380
380
|
title: string;
|
|
381
|
-
desc?: string
|
|
381
|
+
desc?: string;
|
|
382
382
|
category: string;
|
|
383
383
|
platforms?: {
|
|
384
384
|
[key: string]: {
|
|
385
385
|
tagName: 'audio';
|
|
386
386
|
};
|
|
387
|
-
}
|
|
388
|
-
thumbnail?: string
|
|
387
|
+
};
|
|
388
|
+
thumbnail?: string;
|
|
389
389
|
};
|
|
390
390
|
};
|
|
391
391
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../parser/cals/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../parser/cals/index.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,WAAW,EACX,YAAY,EAEZ,iBAAiB,EACjB,eAAe,EACf,cAAc,EAGd,mBAAmB,EACnB,cAAc,EAAE,cAAc;AAC9B,mBAAmB,EACnB,aAAa,EACb,IAAI,EACL,MAAM,aAAa,CAAA;AAEpB,OAAO,EAGL,aAAa,EACb,YAAY,EACb,MAAM,eAAe,CAAA;AAmB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;sBACH,MAAM;;;6BACwB,OAAO;;;wBACnC,MAAM;;;EA8BvB"}
|
package/lib/parser/cals/index.js
CHANGED
|
@@ -11,7 +11,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
return t;
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.deserializeComponentLibraryMeta = exports.serializeRuntimeComponent = exports.serializeRuntimePage = exports.deserializePlatformApp = exports.serializePlatformApp = exports.deserializePage = exports.serializePage = exports.deserializeComponent = exports.serializeComponent = exports.deserializeDataVariables = exports.deserializeAttributes = exports.serializeAttributes = exports.deserializeDynamicMap = exports.serializeDynamicMap = exports.deserializeValue = exports.serializeValue = void 0;
|
|
14
|
+
exports.deserializeComponentLibraryMeta = exports.deserializeRuntimeComponent = exports.serializeRuntimeComponent = exports.serializeRuntimePage = exports.deserializePlatformApp = exports.serializePlatformApp = exports.deserializePage = exports.serializePage = exports.deserializeComponent = exports.serializeComponent = exports.deserializeDataVariables = exports.deserializeAttributes = exports.serializeAttributes = exports.deserializeDynamicMap = exports.serializeDynamicMap = exports.deserializeValue = exports.serializeValue = void 0;
|
|
15
15
|
const lodash_1 = require("lodash");
|
|
16
16
|
const common_1 = require("../../types/platform/common");
|
|
17
17
|
const types_1 = require("../../types");
|
|
@@ -19,6 +19,7 @@ const expression_1 = require("../expression");
|
|
|
19
19
|
const common_2 = require("./utils/common");
|
|
20
20
|
const style_1 = require("./utils/style");
|
|
21
21
|
const runtime_1 = require("./utils/runtime");
|
|
22
|
+
const config_1 = require("./utils/version/config");
|
|
22
23
|
function serializeValue({ ctx, key, dynamicValue, scope = 'page', streamlineDefaultValue, }) {
|
|
23
24
|
var _a, _b;
|
|
24
25
|
let value = dynamicValue.value;
|
|
@@ -161,19 +162,55 @@ function serializeDynamicMap({ ctx, map = {}, scope = 'page', streamlineDefaultV
|
|
|
161
162
|
(0, lodash_1.unset)(data, originValue);
|
|
162
163
|
}
|
|
163
164
|
if ((0, lodash_1.get)(data, processedKey) == undefined) {
|
|
164
|
-
|
|
165
|
+
let ValueTmp = processedValue;
|
|
166
|
+
/* 选区结构处理 [formily] to [CALS] */
|
|
167
|
+
if (Array.isArray(ValueTmp) &&
|
|
168
|
+
(ValueTmp === null || ValueTmp === void 0 ? void 0 : ValueTmp.some((item) => item.selectableBlock))) {
|
|
169
|
+
ValueTmp = (0, lodash_1.cloneDeep)(processedValue);
|
|
170
|
+
ValueTmp === null || ValueTmp === void 0 ? void 0 : ValueTmp.map((_value) => {
|
|
171
|
+
var _a, _b, _c;
|
|
172
|
+
const xProp = (_a = _value === null || _value === void 0 ? void 0 : _value.selectableBlock) === null || _a === void 0 ? void 0 : _a['x-props'];
|
|
173
|
+
const xComponent = (_c = (_b = _value === null || _value === void 0 ? void 0 : _value.selectableBlock) === null || _b === void 0 ? void 0 : _b['x-component']) === null || _c === void 0 ? void 0 : _c.toLowerCase();
|
|
174
|
+
const module = xComponent === null || xComponent === void 0 ? void 0 : xComponent.split(':')[0];
|
|
175
|
+
const component = xComponent === null || xComponent === void 0 ? void 0 : xComponent.split(':')[1];
|
|
176
|
+
if (xProp &&
|
|
177
|
+
config_1.MODULE_SELECTABLEBLOCK_REGEX.test(module) &&
|
|
178
|
+
config_1.COMPONENT_SELECTABLEBLOCK_WHITELIST.includes(component)) {
|
|
179
|
+
_value.selectableBlock = serializeRuntimeComponent(ctx, _value.selectableBlock);
|
|
180
|
+
}
|
|
181
|
+
return _value;
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
data[processedKey] = ValueTmp;
|
|
165
185
|
}
|
|
166
186
|
});
|
|
167
187
|
return data;
|
|
168
188
|
}
|
|
169
189
|
exports.serializeDynamicMap = serializeDynamicMap;
|
|
170
190
|
function deserializeDynamicMap(ctx, map) {
|
|
171
|
-
var _a;
|
|
191
|
+
var _a, _b, _c;
|
|
172
192
|
let data = {};
|
|
173
193
|
for (let key in map || {}) {
|
|
174
194
|
let value = (_a = map) === null || _a === void 0 ? void 0 : _a[key];
|
|
175
195
|
let { key: processedKey, value: processedValue } = deserializeValue(ctx, key, value);
|
|
176
|
-
|
|
196
|
+
let ValueTmp = processedValue;
|
|
197
|
+
/* 选区结构处理 [CALS] to [formily] */
|
|
198
|
+
if (Array.isArray(processedValue === null || processedValue === void 0 ? void 0 : processedValue.value) &&
|
|
199
|
+
((_b = processedValue === null || processedValue === void 0 ? void 0 : processedValue.value) === null || _b === void 0 ? void 0 : _b.some((item) => item && item.selectableBlock))) {
|
|
200
|
+
ValueTmp = (0, lodash_1.cloneDeep)(processedValue);
|
|
201
|
+
(_c = ValueTmp === null || ValueTmp === void 0 ? void 0 : ValueTmp.value) === null || _c === void 0 ? void 0 : _c.map((_value) => {
|
|
202
|
+
var _a, _b, _c, _d;
|
|
203
|
+
const module = (_b = (_a = _value === null || _value === void 0 ? void 0 : _value.selectableBlock) === null || _a === void 0 ? void 0 : _a.module) === null || _b === void 0 ? void 0 : _b.toLowerCase();
|
|
204
|
+
const component = (_d = (_c = _value === null || _value === void 0 ? void 0 : _value.selectableBlock) === null || _c === void 0 ? void 0 : _c.component) === null || _d === void 0 ? void 0 : _d.toLowerCase();
|
|
205
|
+
if (_value.selectableBlock &&
|
|
206
|
+
config_1.MODULE_SELECTABLEBLOCK_REGEX.test(module) &&
|
|
207
|
+
config_1.COMPONENT_SELECTABLEBLOCK_WHITELIST.includes(component)) {
|
|
208
|
+
_value.selectableBlock = deserializeRuntimeComponent(ctx, _value.selectableBlock);
|
|
209
|
+
}
|
|
210
|
+
return _value;
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
data[processedKey] = ValueTmp;
|
|
177
214
|
}
|
|
178
215
|
return data;
|
|
179
216
|
}
|
|
@@ -851,14 +888,29 @@ function serializeRuntimeComponent(ctx, component //IComponentSchemaJson
|
|
|
851
888
|
return processed;
|
|
852
889
|
}
|
|
853
890
|
exports.serializeRuntimeComponent = serializeRuntimeComponent;
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
891
|
+
/**
|
|
892
|
+
* component
|
|
893
|
+
* [CALS] to [formily]
|
|
894
|
+
* To be continue, currently support listener
|
|
895
|
+
*/
|
|
896
|
+
function deserializeRuntimeComponent(ctx, component) {
|
|
897
|
+
const { id, module, component: runtimeComponent, listeners = [] } = component;
|
|
898
|
+
let listenerInstances = (0, runtime_1.getValidValue)((0, runtime_1.writeListeners)((listeners === null || listeners === void 0 ? void 0 : listeners.map((item) => {
|
|
899
|
+
return Object.assign({ sourceKey: `${module}:${runtimeComponent}` }, deserializeListener(ctx, item));
|
|
900
|
+
})) || []));
|
|
901
|
+
const target = {
|
|
902
|
+
key: id,
|
|
903
|
+
type: 'object',
|
|
904
|
+
properties: {},
|
|
905
|
+
'x-component': `${module}:${runtimeComponent}`,
|
|
906
|
+
'x-props': {
|
|
907
|
+
sourceKey: `${module}:${runtimeComponent}`,
|
|
908
|
+
listenerInstances: listenerInstances || [],
|
|
909
|
+
},
|
|
910
|
+
};
|
|
911
|
+
return target;
|
|
912
|
+
}
|
|
913
|
+
exports.deserializeRuntimeComponent = deserializeRuntimeComponent;
|
|
862
914
|
function processDependenciesMap(dependencies = []) {
|
|
863
915
|
let map = dependencies.reduce((map, componentLib) => {
|
|
864
916
|
let { components = [] } = componentLib;
|
|
@@ -4,6 +4,8 @@ export declare function readComponents(properties?: {
|
|
|
4
4
|
export declare function readDirectives(cmp: any): any;
|
|
5
5
|
export declare function readDynamicData(cmp: any): any;
|
|
6
6
|
export declare function readListeners(listenerInstances?: any[]): any;
|
|
7
|
+
export declare function writeListeners(listeners?: any[]): any[];
|
|
8
|
+
export declare function writeDynamicData(from: any, to: any, properties: any): any;
|
|
7
9
|
export declare function setValidValue(target: any, key: string, value: any): void;
|
|
8
10
|
export declare function getValidValue(value: any): any;
|
|
9
11
|
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../parser/cals/utils/runtime.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../parser/cals/utils/runtime.ts"],"names":[],"mappings":"AAUA,wBAAgB,cAAc,CAC5B,UAAU,GAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAmB,EACnD,WAAW,GAAE,MAAM,EAAO,GACzB,MAAM,CA+DR;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,GAAG,OAuCtC;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,GAAG,OA8BvC;AAED,wBAAgB,aAAa,CAAC,iBAAiB,GAAE,GAAG,EAAO,OAiB1D;AAED,wBAAgB,cAAc,CAAC,SAAS,GAAE,GAAG,EAAO,SAenD;AAGD,wBAAgB,gBAAgB,CAAC,IAAI,KAAU,EAAE,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,OAgExE;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,QAKjE;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,OAWvC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getValidValue = exports.setValidValue = exports.readListeners = exports.readDynamicData = exports.readDirectives = exports.readComponents = void 0;
|
|
3
|
+
exports.getValidValue = exports.setValidValue = exports.writeDynamicData = exports.writeListeners = exports.readListeners = exports.readDynamicData = exports.readDirectives = exports.readComponents = void 0;
|
|
4
4
|
const expression_1 = require("../../expression");
|
|
5
5
|
const style_1 = require("./style");
|
|
6
6
|
const common_1 = require("./common");
|
|
7
|
+
const lodash_1 = require("lodash");
|
|
7
8
|
function readComponents(properties = {}, excludeKeys = []) {
|
|
8
9
|
const cmps = {};
|
|
9
10
|
for (const key in properties) {
|
|
@@ -133,6 +134,93 @@ function readListeners(listenerInstances = []) {
|
|
|
133
134
|
return listeners;
|
|
134
135
|
}
|
|
135
136
|
exports.readListeners = readListeners;
|
|
137
|
+
function writeListeners(listeners = []) {
|
|
138
|
+
return listeners.map((l) => {
|
|
139
|
+
const act = {
|
|
140
|
+
key: l.key || '',
|
|
141
|
+
sourceKey: l.handler.moduleName + ':' + l.handler.name,
|
|
142
|
+
trigger: l.trigger,
|
|
143
|
+
type: l.type,
|
|
144
|
+
data: {},
|
|
145
|
+
dataBinds: [],
|
|
146
|
+
handler: l.handler,
|
|
147
|
+
isCapturePhase: l.isCapturePhase,
|
|
148
|
+
noPropagation: l.noPropagation,
|
|
149
|
+
};
|
|
150
|
+
return writeDynamicData(l.data, act, null);
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
exports.writeListeners = writeListeners;
|
|
154
|
+
// 处理Listeners动态数据
|
|
155
|
+
function writeDynamicData(from = {}, to, properties) {
|
|
156
|
+
const act = (0, lodash_1.cloneDeep)(to);
|
|
157
|
+
act.dataTypes = to.dataTypes || [];
|
|
158
|
+
for (const prop in from) {
|
|
159
|
+
const dv = from[prop];
|
|
160
|
+
if (dv.type === 'static' || dv.type === undefined) {
|
|
161
|
+
act.data = to.data || {};
|
|
162
|
+
act.data[prop] = dv.value;
|
|
163
|
+
act.dataTypes.push({
|
|
164
|
+
propertyPath: prop,
|
|
165
|
+
type: 'static',
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
else if (dv.type === 'slot') {
|
|
169
|
+
act.dataTypes.push({
|
|
170
|
+
propertyPath: prop,
|
|
171
|
+
type: 'slot',
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
act.dataBinds = to.dataBinds || [];
|
|
176
|
+
if (!dv.value.startsWith('!') || dv.value === expression_1.PropBindType.expression) {
|
|
177
|
+
act.dataBinds.push({
|
|
178
|
+
propertyPath: prop,
|
|
179
|
+
bindDataPath: dv.value,
|
|
180
|
+
type: dv.type,
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
// check "!" to be compatible with legacy data
|
|
185
|
+
const globalStateReg = /^!global./;
|
|
186
|
+
let fixedValue = '';
|
|
187
|
+
if (globalStateReg.test(dv.value)) {
|
|
188
|
+
fixedValue = dv.value.replace(globalStateReg, '!app.state.');
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
fixedValue = dv.value.replace(/^!\w+./, '!$page.');
|
|
192
|
+
}
|
|
193
|
+
act.dataBinds.push({
|
|
194
|
+
propertyPath: prop,
|
|
195
|
+
bindDataPath: fixedValue,
|
|
196
|
+
type: expression_1.PropBindType.expression,
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
act.dataTypes.push({
|
|
200
|
+
propertyPath: prop,
|
|
201
|
+
type: 'bind',
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
// 兼容之前的应用,slot类型的字段从 properties 中取
|
|
206
|
+
if (properties) {
|
|
207
|
+
Object.keys(properties).forEach((key) => {
|
|
208
|
+
const foundOne = act.dataTypes.find((dataType) => dataType.propertyPath === key);
|
|
209
|
+
if (foundOne) {
|
|
210
|
+
foundOne.type = 'slot';
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
if (!properties[key].xComponent)
|
|
214
|
+
act.dataTypes.push({
|
|
215
|
+
propertyPath: key,
|
|
216
|
+
type: 'slot',
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
return act;
|
|
222
|
+
}
|
|
223
|
+
exports.writeDynamicData = writeDynamicData;
|
|
136
224
|
function setValidValue(target, key, value) {
|
|
137
225
|
if (!target) {
|
|
138
226
|
return;
|
|
@@ -11,4 +11,6 @@ fetch(`http://dev.weapps.woa.com/api/compositeComp/list?pageIndex=0&category=${e
|
|
|
11
11
|
export declare const COMPLEX_COMPONENT_KEYS: string[];
|
|
12
12
|
export declare const FORM_COMPONENT_KEYS: string[];
|
|
13
13
|
export declare const GSD_H5_REACT_COMPONENT_KEYS: string[];
|
|
14
|
+
export declare const COMPONENT_SELECTABLEBLOCK_WHITELIST: string[];
|
|
15
|
+
export declare const MODULE_SELECTABLEBLOCK_REGEX: RegExp;
|
|
14
16
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../parser/cals/utils/version/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAyKH,eAAO,MAAM,sBAAsB,UAMlC,CAAA;AAED,eAAO,MAAM,mBAAmB,UAgB/B,CAAA;AAED,eAAO,MAAM,2BAA2B,UAgDvC,CAAA"}
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../../parser/cals/utils/version/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAyKH,eAAO,MAAM,sBAAsB,UAMlC,CAAA;AAED,eAAO,MAAM,mBAAmB,UAgB/B,CAAA;AAED,eAAO,MAAM,2BAA2B,UAgDvC,CAAA;AAGD,eAAO,MAAM,mCAAmC,UAK/C,CAAA;AAGD,eAAO,MAAM,4BAA4B,QAA6B,CAAA"}
|
|
@@ -10,7 +10,7 @@ fetch(`http://dev.weapps.woa.com/api/compositeComp/list?pageIndex=0&category=${e
|
|
|
10
10
|
|
|
11
11
|
*/
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.GSD_H5_REACT_COMPONENT_KEYS = exports.FORM_COMPONENT_KEYS = exports.COMPLEX_COMPONENT_KEYS = void 0;
|
|
13
|
+
exports.MODULE_SELECTABLEBLOCK_REGEX = exports.COMPONENT_SELECTABLEBLOCK_WHITELIST = exports.GSD_H5_REACT_COMPONENT_KEYS = exports.FORM_COMPONENT_KEYS = exports.COMPLEX_COMPONENT_KEYS = void 0;
|
|
14
14
|
// 政务组件
|
|
15
15
|
const ZW_COMPLEX_COMPONENT_KEYS = [
|
|
16
16
|
'Input',
|
|
@@ -238,3 +238,12 @@ exports.GSD_H5_REACT_COMPONENT_KEYS = [
|
|
|
238
238
|
'Wx-open-data',
|
|
239
239
|
'Wx-page-mate',
|
|
240
240
|
];
|
|
241
|
+
// 支持选区的组件白名单
|
|
242
|
+
exports.COMPONENT_SELECTABLEBLOCK_WHITELIST = [
|
|
243
|
+
'modeltable',
|
|
244
|
+
'modelcreate',
|
|
245
|
+
'modelupdate',
|
|
246
|
+
'modeldetail',
|
|
247
|
+
];
|
|
248
|
+
// 支持选区的组件库命名正则表达式
|
|
249
|
+
exports.MODULE_SELECTABLEBLOCK_REGEX = /^cloudbase_bussiness.*$/i;
|