@cloudbase/cals 1.0.3-alpha.1 → 1.0.3-alpha.10
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/cloudbase.cals.umd.min.js +5 -0
- package/lib/parser/cals/index.d.ts +366 -371
- package/lib/parser/cals/index.d.ts.map +1 -1
- package/lib/parser/cals/index.js +20 -12
- package/lib/parser/cals/utils/block/index.d.ts +14 -14
- package/lib/parser/cals/utils/block/index.d.ts.map +1 -1
- package/lib/parser/cals/utils/block/index.js +7 -3
- package/lib/parser/cals/utils/code/index.d.ts +30 -30
- package/lib/parser/cals/utils/code/index.d.ts.map +1 -1
- package/lib/parser/cals/utils/code/index.js +18 -12
- package/lib/parser/cals/utils/common.d.ts +11 -11
- package/lib/parser/cals/utils/runtime.d.ts +13 -13
- package/lib/parser/cals/utils/runtime.d.ts.map +1 -1
- package/lib/parser/cals/utils/runtime.js +5 -2
- package/lib/parser/cals/utils/spinoff/index.d.ts +9 -9
- package/lib/parser/cals/utils/style.d.ts +42 -42
- package/lib/parser/cals/utils/style.d.ts.map +1 -1
- package/lib/parser/cals/utils/style.js +7 -3
- package/lib/parser/cals/utils/template.d.ts +5 -5
- package/lib/parser/cals/utils/version/common.d.ts +4 -4
- package/lib/parser/cals/utils/version/common.d.ts.map +1 -1
- package/lib/parser/cals/utils/version/common.js +16 -33
- package/lib/parser/cals/utils/version/config.d.ts +13 -13
- package/lib/parser/cals/utils/version/index.d.ts +2 -2
- package/lib/parser/cals/utils/version/parses.d.ts +15 -15
- package/lib/parser/cals/utils/version/parses.d.ts.map +1 -1
- package/lib/parser/cals/utils/version/parses.js +18 -36
- package/lib/parser/cals/utils/version/utils.d.ts +13 -13
- package/lib/parser/cals/utils/version/utils.d.ts.map +1 -1
- package/lib/parser/cals/utils/version/utils.js +5 -2
- package/lib/parser/expression/index.d.ts +122 -122
- package/lib/parser/index.d.ts +8 -8
- package/lib/parser/plugins/postcss-rpx2clac.d.ts +17 -17
- package/lib/parser/plugins/postcss-rpx2clac.js +2 -2
- package/lib/types/basic/app.d.ts +72 -72
- package/lib/types/basic/common.d.ts +88 -88
- package/lib/types/basic/component.d.ts +208 -208
- package/lib/types/basic/datasource.d.ts +49 -49
- package/lib/types/index.d.ts +9 -9
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/index.js +14 -1
- package/lib/types/lcds.d.ts +447 -197
- package/lib/types/lcds.d.ts.map +1 -1
- package/lib/types/platform/app.d.ts +176 -176
- package/lib/types/platform/common.d.ts +137 -137
- package/lib/types/platform/component.d.ts +140 -140
- package/lib/types/platform/datasource.d.ts +466 -466
- package/lib/types/platform/widget/form.d.ts +89 -89
- package/lib/types/platform/widget/meta.d.ts +59 -59
- package/lib/utils/CSSProperty.d.ts +63 -63
- package/lib/utils/build.d.ts +1 -1
- package/lib/utils/build.js +3 -3
- package/lib/utils/constant.d.ts +40 -40
- package/lib/utils/dts/auto-generated.d.ts +1 -1
- package/lib/utils/dts/auto-generated.d.ts.map +1 -1
- package/lib/utils/dts/auto-generated.js +141 -30
- package/lib/utils/dts/build.d.ts +1 -1
- package/lib/utils/dts/index.d.ts +130 -130
- package/lib/utils/dts/index.d.ts.map +1 -1
- package/lib/utils/dts/index.js +118 -78
- package/lib/utils/index.d.ts +7 -7
- package/lib/utils/version/common.d.ts +2 -2
- package/lib/utils/version/featureChecker.d.ts +2 -2
- package/lib/utils/version/featureChecker.d.ts.map +1 -1
- package/lib/utils/version/migrations/version4.d.ts +2 -2
- package/lib/utils/version/migrations/version4.js +2 -2
- package/package.json +10 -1
- package/lib/utils/version-migrations/common.d.ts +0 -5
- package/lib/utils/version-migrations/common.d.ts.map +0 -1
- package/lib/utils/version-migrations/common.js +0 -29
- package/lib/utils/version-migrations/version4.d.ts +0 -3
- package/lib/utils/version-migrations/version4.d.ts.map +0 -1
- package/lib/utils/version-migrations/version4.js +0 -199
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/dts/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/dts/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGhE,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE;QAEd,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,OAAO,CAAC;KACrB,CAAC;IACF,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,iBAAiB,CAAC;IACrC,aAAa,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,iBAAiB,CAAC;QAAC,MAAM,CAAC,EAAE,cAAc,CAAA;KAAE,EAAE,CAAC;CACxF;AACD,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AACD,MA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AC,MAAM,CACX,OAAO,GAAE,IAAI,CAAC,QAAQ,EAAE,YAAY,CAInC;CAcJ;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,SAAS,GAAE,UAAe,EAC1B,OAAO,GAAE,QAA0G,GAClH,OAAO,CAAC,MAAM,CAAC,CA4CjB;AAgfD,eAAO,MAAM,UAAU,6yDA8DtB,CAAC;AAyDF;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAO5D;AAED,eAAO,MAAM,mBAAmB,+tBAmB/B,CAAC;AAEF;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,KAAA,GAAG,OAAO,CAAC,MAAM,CAAC,CAQ5D"}
|
package/lib/utils/dts/index.js
CHANGED
|
@@ -13,7 +13,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.compileJSONToDTS = exports.jsonToDTSWorkerCode = exports.transpileToDTS = exports.workerCode = exports.generateWeDaAppDTS = exports.WeDaDTS = exports.IInputDataType = void 0;
|
|
16
|
-
const
|
|
16
|
+
const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
|
|
17
|
+
const pick_1 = __importDefault(require("lodash/pick"));
|
|
18
|
+
const set_1 = __importDefault(require("lodash/set"));
|
|
17
19
|
const json_easy_filter_1 = __importDefault(require("json-easy-filter"));
|
|
18
20
|
const auto_generated_1 = require("./auto-generated");
|
|
19
21
|
var IInputDataType;
|
|
@@ -50,20 +52,20 @@ const DtsPlaceholder = {
|
|
|
50
52
|
[IInputDataType.redefineAnyType]: "// Redefine Any Type - Don't touch me",
|
|
51
53
|
};
|
|
52
54
|
const DtsInnerSign = {
|
|
53
|
-
[IInputDataType.globalState]:
|
|
54
|
-
[IInputDataType.pageState]:
|
|
55
|
-
[IInputDataType.compState]:
|
|
56
|
-
[IInputDataType.pageParams]:
|
|
57
|
-
[IInputDataType.forState]:
|
|
58
|
-
[IInputDataType.globalCommonCodes]:
|
|
59
|
-
[IInputDataType.pageHandlerCodes]:
|
|
60
|
-
[IInputDataType.compHandlerCodes]:
|
|
61
|
-
[IInputDataType.compPropData]:
|
|
62
|
-
[IInputDataType.compPropEvents]:
|
|
63
|
-
[IInputDataType.usedComponents]:
|
|
64
|
-
[IInputDataType.usedWidgets]:
|
|
65
|
-
[IInputDataType.repeaterScope]:
|
|
66
|
-
[IInputDataType.redefineAnyType]:
|
|
55
|
+
[IInputDataType.globalState]: 'Global State Inner',
|
|
56
|
+
[IInputDataType.pageState]: 'Page State Inner',
|
|
57
|
+
[IInputDataType.compState]: 'Comp State Inner',
|
|
58
|
+
[IInputDataType.pageParams]: 'Page Param Inner',
|
|
59
|
+
[IInputDataType.forState]: 'Global For Inner',
|
|
60
|
+
[IInputDataType.globalCommonCodes]: 'Global Common Inner',
|
|
61
|
+
[IInputDataType.pageHandlerCodes]: 'Page Handler Inner',
|
|
62
|
+
[IInputDataType.compHandlerCodes]: 'Comp Handler Inner',
|
|
63
|
+
[IInputDataType.compPropData]: 'Comp Prop Data Inner',
|
|
64
|
+
[IInputDataType.compPropEvents]: 'Comp Prop Events Inner',
|
|
65
|
+
[IInputDataType.usedComponents]: 'Used Components Inner',
|
|
66
|
+
[IInputDataType.usedWidgets]: 'used widgets Inner',
|
|
67
|
+
[IInputDataType.repeaterScope]: 'repeater scope Inner',
|
|
68
|
+
[IInputDataType.redefineAnyType]: 'Redefine Any Type Inner',
|
|
67
69
|
};
|
|
68
70
|
var GroupEnum;
|
|
69
71
|
(function (GroupEnum) {
|
|
@@ -94,7 +96,7 @@ class WeDaDTS {
|
|
|
94
96
|
return __awaiter(this, void 0, void 0, function* () {
|
|
95
97
|
try {
|
|
96
98
|
const [dts, replaceRules] = yield _generateOneItemDTS(inputData, itemType);
|
|
97
|
-
replaceRules.forEach(rule => {
|
|
99
|
+
replaceRules.forEach((rule) => {
|
|
98
100
|
WeDaDTS._dts = WeDaDTS._dts.replace(rule.from, rule.to);
|
|
99
101
|
});
|
|
100
102
|
WeDaDTS._dts = WeDaDTS._dts.replace(new RegExp(`^(\\s*\\/\\/ ${DtsInnerSign[itemType]} Begin)[\\s\\S]*(^\\s*\\/\\/ ${DtsInnerSign[itemType]} End)`, 'm'), `$1\n${dts}\n$2`);
|
|
@@ -106,7 +108,11 @@ class WeDaDTS {
|
|
|
106
108
|
}
|
|
107
109
|
});
|
|
108
110
|
}
|
|
109
|
-
static getDTS(options = {
|
|
111
|
+
static getDTS(options = {
|
|
112
|
+
needGlobalFormula: false,
|
|
113
|
+
needGlobalFor: false,
|
|
114
|
+
needRepeaterScope: false,
|
|
115
|
+
}) {
|
|
110
116
|
let resultDts = WeDaDTS._dts;
|
|
111
117
|
if (!options.needGlobalFormula) {
|
|
112
118
|
resultDts = resultDts.replace(/^\/\/ Global Formula Begin[\s\S]*^\/\/ Global Formula End$/m, '');
|
|
@@ -134,7 +140,7 @@ function generateWeDaAppDTS(inputData = {}, options = { isCompMode: false, needG
|
|
|
134
140
|
// 防止某项错误导致全部都错误
|
|
135
141
|
try {
|
|
136
142
|
const [dts, replaceRules] = yield _generateOneItemDTS(inputData[key], key);
|
|
137
|
-
replaceRules.forEach(rule => {
|
|
143
|
+
replaceRules.forEach((rule) => {
|
|
138
144
|
resultDts = resultDts.replace(rule.from, rule.to);
|
|
139
145
|
});
|
|
140
146
|
resultDts = resultDts.replace(placeholder, dts + '\n' + placeholder);
|
|
@@ -171,8 +177,18 @@ exports.generateWeDaAppDTS = generateWeDaAppDTS;
|
|
|
171
177
|
* 生成 weda 专有的注释信息
|
|
172
178
|
*/
|
|
173
179
|
function genWeDaCodeComment({ fieldName, title, description, type, dataFieldInfo, group, schema, subGroup, baseClass, datasource, }) {
|
|
174
|
-
const desc =
|
|
175
|
-
return desc +
|
|
180
|
+
const desc = title || fieldName ? `${title || fieldName}\n${description || ''}` : '';
|
|
181
|
+
return (desc +
|
|
182
|
+
`\n@privateForWeDa\n${JSON.stringify({
|
|
183
|
+
group,
|
|
184
|
+
displayType: type,
|
|
185
|
+
displayName: title || '',
|
|
186
|
+
schema,
|
|
187
|
+
subGroup,
|
|
188
|
+
baseClass,
|
|
189
|
+
datasource,
|
|
190
|
+
dataFieldInfo,
|
|
191
|
+
})}`);
|
|
176
192
|
}
|
|
177
193
|
/**
|
|
178
194
|
* 生成指定类型的 DTS
|
|
@@ -185,23 +201,23 @@ function _generateOneItemDTS(inputData, itemType) {
|
|
|
185
201
|
*/
|
|
186
202
|
function getDataFieldDisplayType(format) {
|
|
187
203
|
const nameMap = {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
204
|
+
email: 'email',
|
|
205
|
+
url: 'url',
|
|
206
|
+
tel: 'tel',
|
|
207
|
+
phone: 'phone',
|
|
208
|
+
'x-image': 'image',
|
|
209
|
+
'x-rtf': 'rtf',
|
|
210
|
+
datetime: 'datetime',
|
|
211
|
+
date: 'date',
|
|
212
|
+
time: 'time',
|
|
213
|
+
'x-enum': 'enum',
|
|
214
|
+
'x-location': 'location',
|
|
215
|
+
'x-file': 'file',
|
|
216
|
+
related: 'related',
|
|
217
|
+
'father-son': 'father-son',
|
|
218
|
+
'x-autonumber': 'autonumber',
|
|
219
|
+
'x-area-code': 'area-code',
|
|
220
|
+
function: 'function',
|
|
205
221
|
};
|
|
206
222
|
return nameMap[format];
|
|
207
223
|
}
|
|
@@ -209,7 +225,7 @@ function _generateOneItemDTS(inputData, itemType) {
|
|
|
209
225
|
* 处理注释信息
|
|
210
226
|
*/
|
|
211
227
|
function _handleComment(inputData, group, needKeepSchema) {
|
|
212
|
-
const _inputData = (0,
|
|
228
|
+
const _inputData = (0, cloneDeep_1.default)(inputData);
|
|
213
229
|
json_easy_filter_1.default.traverse(_inputData, function (key, value, path) {
|
|
214
230
|
var _a;
|
|
215
231
|
if ((value === null || value === void 0 ? void 0 : value.type) && !((_a = value === null || value === void 0 ? void 0 : value.type) === null || _a === void 0 ? void 0 : _a.type)) {
|
|
@@ -219,7 +235,7 @@ function _generateOneItemDTS(inputData, itemType) {
|
|
|
219
235
|
const isFirstLevel = path.length === 2 && (path === null || path === void 0 ? void 0 : path[0]) === 'properties';
|
|
220
236
|
if (isFirstLevel) {
|
|
221
237
|
// 只需要第一级属性需要保存,且只保存子信息(对象或数组的子项)
|
|
222
|
-
schema =
|
|
238
|
+
schema = value.properties || value.items ? value : null;
|
|
223
239
|
}
|
|
224
240
|
}
|
|
225
241
|
// 特殊处理数据字段的类型
|
|
@@ -233,8 +249,8 @@ function _generateOneItemDTS(inputData, itemType) {
|
|
|
233
249
|
description: value.description,
|
|
234
250
|
group,
|
|
235
251
|
type,
|
|
236
|
-
dataFieldInfo: (0,
|
|
237
|
-
schema
|
|
252
|
+
dataFieldInfo: (0, pick_1.default)(value, ['type', 'format', 'x-system']),
|
|
253
|
+
schema,
|
|
238
254
|
});
|
|
239
255
|
}
|
|
240
256
|
});
|
|
@@ -341,9 +357,11 @@ function _generateOneItemDTS(inputData, itemType) {
|
|
|
341
357
|
},
|
|
342
358
|
[IInputDataType.compPropEvents]: function (inputData) {
|
|
343
359
|
const IData = `any`;
|
|
344
|
-
return inputData
|
|
360
|
+
return inputData
|
|
361
|
+
.map((eventName) => {
|
|
345
362
|
return `function ${eventName}(data?: ${IData}): void`;
|
|
346
|
-
})
|
|
363
|
+
})
|
|
364
|
+
.join('\n');
|
|
347
365
|
},
|
|
348
366
|
[IInputDataType.usedComponents]: function (inputData) {
|
|
349
367
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -391,7 +409,10 @@ function _generateOneItemDTS(inputData, itemType) {
|
|
|
391
409
|
${genWeDaCodeComment({
|
|
392
410
|
fieldName: interfaceName,
|
|
393
411
|
schema: item.exportProperties,
|
|
394
|
-
})
|
|
412
|
+
})
|
|
413
|
+
.split('\n')
|
|
414
|
+
.map((item) => `* ${item}`)
|
|
415
|
+
.join('\n')}
|
|
395
416
|
*/
|
|
396
417
|
declare class ${interfaceName} extends UserWidget {
|
|
397
418
|
|
|
@@ -405,10 +426,12 @@ function _generateOneItemDTS(inputData, itemType) {
|
|
|
405
426
|
});
|
|
406
427
|
},
|
|
407
428
|
[IInputDataType.usedWidgets]: function (inputData) {
|
|
408
|
-
return inputData
|
|
429
|
+
return inputData
|
|
430
|
+
.map((item) => {
|
|
409
431
|
if (item.idList && item.idList.length > 0) {
|
|
410
432
|
const interfaceName = _genCompInterfaceName(item.module, item.component);
|
|
411
|
-
return item.idList
|
|
433
|
+
return item.idList
|
|
434
|
+
.map((id) => `
|
|
412
435
|
/**
|
|
413
436
|
${genWeDaCodeComment({
|
|
414
437
|
fieldName: id,
|
|
@@ -417,13 +440,18 @@ function _generateOneItemDTS(inputData, itemType) {
|
|
|
417
440
|
group: GroupEnum.COMPONENT,
|
|
418
441
|
type: 'component',
|
|
419
442
|
baseClass: interfaceName,
|
|
420
|
-
datasource: `$${id}_start$ $${id}_end
|
|
421
|
-
})
|
|
443
|
+
datasource: `$${id}_start$ $${id}_end$`,
|
|
444
|
+
})
|
|
445
|
+
.split('\n')
|
|
446
|
+
.map((item) => `* ${item}`)
|
|
447
|
+
.join('\n')}
|
|
422
448
|
*/
|
|
423
|
-
const ${id}: ${interfaceName}`)
|
|
449
|
+
const ${id}: ${interfaceName}`)
|
|
450
|
+
.join('\n');
|
|
424
451
|
}
|
|
425
452
|
return '';
|
|
426
|
-
})
|
|
453
|
+
})
|
|
454
|
+
.join('\n');
|
|
427
455
|
},
|
|
428
456
|
[IInputDataType.repeaterScope]: function (inputData) {
|
|
429
457
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -447,8 +475,11 @@ function _generateOneItemDTS(inputData, itemType) {
|
|
|
447
475
|
group: GroupEnum.REPEATER,
|
|
448
476
|
type: getDisplayReturnType(itemDataDTS),
|
|
449
477
|
schema: item.itemData,
|
|
450
|
-
subGroup: item.widgetId
|
|
451
|
-
})
|
|
478
|
+
subGroup: item.widgetId,
|
|
479
|
+
})
|
|
480
|
+
.split('\n')
|
|
481
|
+
.map((item) => `* ${item}`)
|
|
482
|
+
.join('\n')}
|
|
452
483
|
*/
|
|
453
484
|
const ${item.currentItemAlias}: ${itemDataDTS}
|
|
454
485
|
/**
|
|
@@ -458,8 +489,11 @@ function _generateOneItemDTS(inputData, itemType) {
|
|
|
458
489
|
description: '',
|
|
459
490
|
group: GroupEnum.REPEATER,
|
|
460
491
|
type: 'number',
|
|
461
|
-
subGroup: item.widgetId
|
|
462
|
-
})
|
|
492
|
+
subGroup: item.widgetId,
|
|
493
|
+
})
|
|
494
|
+
.split('\n')
|
|
495
|
+
.map((item) => `* ${item}`)
|
|
496
|
+
.join('\n')}
|
|
463
497
|
*/
|
|
464
498
|
const ${item.currentIndexAlias}: number
|
|
465
499
|
`;
|
|
@@ -477,7 +511,7 @@ function _generateOneItemDTS(inputData, itemType) {
|
|
|
477
511
|
*/
|
|
478
512
|
replaceRules.push({
|
|
479
513
|
from: new RegExp(`(const ${item.widgetId}): .*`),
|
|
480
|
-
to: `$1: ${widgetInterfaceName}
|
|
514
|
+
to: `$1: ${widgetInterfaceName}`,
|
|
481
515
|
});
|
|
482
516
|
/**
|
|
483
517
|
* 增加类
|
|
@@ -492,7 +526,10 @@ function _generateOneItemDTS(inputData, itemType) {
|
|
|
492
526
|
datasources[id] = {
|
|
493
527
|
fields: [{ name: prop.widgetPropName, title: prop.widgetPropTitle }],
|
|
494
528
|
schema: prop.widgetPropTypeSchema,
|
|
495
|
-
name: prop.datasource.name,
|
|
529
|
+
name: prop.datasource.name,
|
|
530
|
+
title: prop.datasource.title,
|
|
531
|
+
id: prop.datasource.id,
|
|
532
|
+
type: prop.datasource.type,
|
|
496
533
|
};
|
|
497
534
|
}
|
|
498
535
|
else {
|
|
@@ -507,7 +544,7 @@ function _generateOneItemDTS(inputData, itemType) {
|
|
|
507
544
|
let othersFields = [];
|
|
508
545
|
if (multiLevelField) {
|
|
509
546
|
multiLevelFields = prop.widgetPropName.split('.');
|
|
510
|
-
(0,
|
|
547
|
+
(0, set_1.default)(multiLevelFieldObj, prop.widgetPropName, '$$schema$$');
|
|
511
548
|
const [_firstField, ..._othersFields] = multiLevelFields;
|
|
512
549
|
firstField = _firstField;
|
|
513
550
|
othersFields = _othersFields;
|
|
@@ -519,10 +556,15 @@ function _generateOneItemDTS(inputData, itemType) {
|
|
|
519
556
|
title: prop.widgetPropTypeSchema.title,
|
|
520
557
|
description: prop.widgetPropTypeSchema.description,
|
|
521
558
|
group: undefined,
|
|
522
|
-
type: getDisplayReturnType(widgetPropTypeDTS)
|
|
523
|
-
})
|
|
559
|
+
type: getDisplayReturnType(widgetPropTypeDTS),
|
|
560
|
+
})
|
|
561
|
+
.split('\n')
|
|
562
|
+
.map((item) => `* ${item}`)
|
|
563
|
+
.join('\n')}
|
|
524
564
|
*/
|
|
525
|
-
${multiLevelField
|
|
565
|
+
${multiLevelField
|
|
566
|
+
? `${firstField}: Omit<${compInterfaceName}['${firstField}'], '${othersFields.join('.')}'> & ${JSON.stringify(multiLevelFieldObj[firstField]).replace('"$$schema$$"', widgetPropTypeDTS)}`
|
|
567
|
+
: `${prop.widgetPropName}: ${widgetPropTypeDTS}`}
|
|
526
568
|
`;
|
|
527
569
|
})));
|
|
528
570
|
/**
|
|
@@ -533,7 +575,7 @@ function _generateOneItemDTS(inputData, itemType) {
|
|
|
533
575
|
replaceRules.push({
|
|
534
576
|
from: new RegExp(`(\\$${item.widgetId}_start\\$).*(\\$${item.widgetId}_end\\$)`),
|
|
535
577
|
// encodeURIComponent 是为了能正常 parse 成 JSON
|
|
536
|
-
to: `$1${encodeURIComponent(JSON.stringify(datasourceInfoList))}$2
|
|
578
|
+
to: `$1${encodeURIComponent(JSON.stringify(datasourceInfoList))}$2`,
|
|
537
579
|
});
|
|
538
580
|
}
|
|
539
581
|
return `
|
|
@@ -544,7 +586,7 @@ function _generateOneItemDTS(inputData, itemType) {
|
|
|
544
586
|
})));
|
|
545
587
|
return results.join('\n');
|
|
546
588
|
});
|
|
547
|
-
}
|
|
589
|
+
},
|
|
548
590
|
};
|
|
549
591
|
let dts = '';
|
|
550
592
|
if (!inputData)
|
|
@@ -635,20 +677,18 @@ function TypescriptWorker(workerId, workerCode) {
|
|
|
635
677
|
typescriptWorker.onmessage = function (event) {
|
|
636
678
|
const { action } = event.data;
|
|
637
679
|
if (action === 'dts_back') {
|
|
638
|
-
const { data: { id, dts } } = event.data;
|
|
680
|
+
const { data: { id, dts }, } = event.data;
|
|
639
681
|
sendMessageCallbackFn[id] && sendMessageCallbackFn[id](dts);
|
|
640
682
|
}
|
|
641
683
|
};
|
|
642
684
|
typescriptWorkerMap[workerId] = {
|
|
643
685
|
typescriptWorker,
|
|
644
|
-
sendMessageCallbackFn
|
|
686
|
+
sendMessageCallbackFn,
|
|
645
687
|
};
|
|
646
688
|
}
|
|
647
689
|
function sendMessage(msgData, callbackFn) {
|
|
648
690
|
const { typescriptWorker, sendMessageCallbackFn } = typescriptWorkerMap[workerId];
|
|
649
|
-
const id = Math.random()
|
|
650
|
-
.toString(36)
|
|
651
|
-
.substring(2, 5);
|
|
691
|
+
const id = Math.random().toString(36).substring(2, 5);
|
|
652
692
|
msgData.data.id = id;
|
|
653
693
|
sendMessageCallbackFn[id] = callbackFn;
|
|
654
694
|
typescriptWorker.postMessage(msgData);
|
|
@@ -657,22 +697,22 @@ function TypescriptWorker(workerId, workerCode) {
|
|
|
657
697
|
};
|
|
658
698
|
}
|
|
659
699
|
/**
|
|
660
|
-
* 使用:
|
|
661
|
-
* const typescriptWorker = getTypescriptWorker();
|
|
662
|
-
* typescriptWorker.sendMessage({ action: 'dts', data: { code } }, dts => {
|
|
663
|
-
*
|
|
664
|
-
* })
|
|
665
|
-
* // 以下暂未实现
|
|
666
|
-
* typescriptWorker.sendMessage({ action: 'ts', data: { code } }, ts => {
|
|
667
|
-
*
|
|
668
|
-
* })
|
|
669
|
-
*/
|
|
700
|
+
* 使用:
|
|
701
|
+
* const typescriptWorker = getTypescriptWorker();
|
|
702
|
+
* typescriptWorker.sendMessage({ action: 'dts', data: { code } }, dts => {
|
|
703
|
+
*
|
|
704
|
+
* })
|
|
705
|
+
* // 以下暂未实现
|
|
706
|
+
* typescriptWorker.sendMessage({ action: 'ts', data: { code } }, ts => {
|
|
707
|
+
*
|
|
708
|
+
* })
|
|
709
|
+
*/
|
|
670
710
|
const getTypescriptWorker = TypescriptWorker('transpileToDTS', exports.workerCode);
|
|
671
711
|
/**
|
|
672
712
|
* 通过 js/ts 代码生成 dts
|
|
673
713
|
*/
|
|
674
714
|
function transpileToDTS(code) {
|
|
675
|
-
return new Promise(resolve => {
|
|
715
|
+
return new Promise((resolve) => {
|
|
676
716
|
const typescriptWorker = getTypescriptWorker();
|
|
677
717
|
typescriptWorker.sendMessage({ action: 'dts', data: { code } }, (dts) => {
|
|
678
718
|
resolve(dts);
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export * from '../parser';
|
|
2
|
-
export * from '../types/index';
|
|
3
|
-
export * from './constant';
|
|
4
|
-
export * from './dts/index';
|
|
5
|
-
export { version4 } from './version/migrations/version4';
|
|
6
|
-
export { semverComp } from './version/common';
|
|
7
|
-
export { isUnitlessNumber } from './CSSProperty';
|
|
1
|
+
export * from '../parser';
|
|
2
|
+
export * from '../types/index';
|
|
3
|
+
export * from './constant';
|
|
4
|
+
export * from './dts/index';
|
|
5
|
+
export { version4 } from './version/migrations/version4';
|
|
6
|
+
export { semverComp } from './version/common';
|
|
7
|
+
export { isUnitlessNumber } from './CSSProperty';
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare function semverComp(a: string, b: string): number;
|
|
2
|
-
export declare function toFixed(num: number, precision: number): number;
|
|
1
|
+
export declare function semverComp(a: string, b: string): number;
|
|
2
|
+
export declare function toFixed(num: number, precision: number): number;
|
|
3
3
|
//# sourceMappingURL=common.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare function isEnbaleObserverVersion(dependencies?:
|
|
2
|
-
export declare function isEnablePageRoot(dependencies: any): boolean;
|
|
1
|
+
export declare function isEnbaleObserverVersion(dependencies?: never[]): boolean;
|
|
2
|
+
export declare function isEnablePageRoot(dependencies: any): boolean;
|
|
3
3
|
//# sourceMappingURL=featureChecker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"featureChecker.d.ts","sourceRoot":"","sources":["../../../src/utils/version/featureChecker.ts"],"names":[],"mappings":"AAqBA,wBAAgB,uBAAuB,CAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"featureChecker.d.ts","sourceRoot":"","sources":["../../../src/utils/version/featureChecker.ts"],"names":[],"mappings":"AAqBA,wBAAgB,uBAAuB,CAAC,YAAY,UAAK,WAExD;AAED,wBAAgB,gBAAgB,CAAC,YAAY,KAAA,WAE5C"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { IPlatformApp } from '../../../types';
|
|
2
|
-
export declare function version4(cals: IPlatformApp, isUpgrade: boolean, setSchemaVersionCallback?: (version: string | undefined) => void): IPlatformApp;
|
|
1
|
+
import type { IPlatformApp } from '../../../types';
|
|
2
|
+
export declare function version4(cals: IPlatformApp, isUpgrade: boolean, setSchemaVersionCallback?: (version: string | undefined) => void): IPlatformApp;
|
|
3
3
|
//# sourceMappingURL=version4.d.ts.map
|
|
@@ -15,7 +15,7 @@ exports.version4 = version4;
|
|
|
15
15
|
const transformPxLowcodeCompAndSourceComp = (cals, isUpgrade, setSchemaVersionCallback) => {
|
|
16
16
|
var _a, _b, _c, _d;
|
|
17
17
|
{
|
|
18
|
-
|
|
18
|
+
const transformCals = (items, isUpgradeToPx) => {
|
|
19
19
|
return items.map((item) => {
|
|
20
20
|
var _a;
|
|
21
21
|
// 对于表单操作区的按钮组件的父容器添加.wd-form__action, 兼容组件规范化按钮升级样式
|
|
@@ -52,7 +52,7 @@ const transformPxLowcodeCompAndSourceComp = (cals, isUpgrade, setSchemaVersionCa
|
|
|
52
52
|
}
|
|
53
53
|
return item;
|
|
54
54
|
});
|
|
55
|
-
}
|
|
55
|
+
};
|
|
56
56
|
let pages = cals['items'];
|
|
57
57
|
let isDivision;
|
|
58
58
|
if (isUpgrade && (0, common_1.semverComp)((_a = cals['schemaVersion']) !== null && _a !== void 0 ? _a : '3.0.0', '4.0.0') < 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/cals",
|
|
3
|
-
"version": "1.0.3-alpha.
|
|
3
|
+
"version": "1.0.3-alpha.10",
|
|
4
4
|
"description": "Common application specifications",
|
|
5
5
|
"main": "lib/utils/index.js",
|
|
6
6
|
"source": "src/utils/index.ts",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"build": "tsc",
|
|
16
16
|
"build:schema": "ts-node src/utils/build.ts",
|
|
17
17
|
"build:dts": "ts-node src/utils/dts/build.ts",
|
|
18
|
+
"build:umd": "tsc && rollup -c rollup.config.js --bundleConfigAsCjs",
|
|
18
19
|
"build:dts:watch": "ts-node src/utils/dts/build.ts --watch",
|
|
19
20
|
"develop": "tsc --watch",
|
|
20
21
|
"docs": "typedoc --options typedoc.json types",
|
|
@@ -37,6 +38,8 @@
|
|
|
37
38
|
"postcss-less": "^6.0.0"
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
|
41
|
+
"@rollup/plugin-node-resolve": "^15.0.2",
|
|
42
|
+
"@rollup/plugin-typescript": "^11.1.0",
|
|
40
43
|
"@types/acorn": "^4.0.5",
|
|
41
44
|
"@types/jest": "^27.4.0",
|
|
42
45
|
"@types/lodash": "^4.14.168",
|
|
@@ -49,6 +52,12 @@
|
|
|
49
52
|
"jest-fetch-mock": "^3.0.3",
|
|
50
53
|
"jsdom-worker": "^0.3.0",
|
|
51
54
|
"node-watch": "^0.7.3",
|
|
55
|
+
"rollup": "^3.21.6",
|
|
56
|
+
"rollup-plugin-babel": "^4.4.0",
|
|
57
|
+
"rollup-plugin-commonjs": "^10.1.0",
|
|
58
|
+
"rollup-plugin-size-snapshot": "^0.12.0",
|
|
59
|
+
"rollup-plugin-terser": "^7.0.2",
|
|
60
|
+
"rollup-plugin-typescript2": "0.31.2",
|
|
52
61
|
"ts-jest": "^27.1.5",
|
|
53
62
|
"ts-node": "^10.4.0",
|
|
54
63
|
"typescript": "^4.7.4",
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare function semverComp(a: string, b: string): number;
|
|
2
|
-
export declare function toFixed(num: number, precision: number): number;
|
|
3
|
-
export declare const OFFICIAL_COMPONENT_LIB_NAME = "CLOUDBASE_STANDARD";
|
|
4
|
-
export declare const OFFICIAL_MATERIAL_LIB_NAME = "gsd-h5-react";
|
|
5
|
-
//# sourceMappingURL=common.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/utils/version-migrations/common.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAYvD;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAI9D;AAED,eAAO,MAAM,2BAA2B,uBAAuB,CAAC;AAChE,eAAO,MAAM,0BAA0B,iBAAiB,CAAC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OFFICIAL_MATERIAL_LIB_NAME = exports.OFFICIAL_COMPONENT_LIB_NAME = exports.toFixed = exports.semverComp = void 0;
|
|
4
|
-
function semverComp(a, b) {
|
|
5
|
-
const pa = a.split('.');
|
|
6
|
-
const pb = b.split('.');
|
|
7
|
-
for (let i = 0; i < 3; i++) {
|
|
8
|
-
const na = Number(pa[i]);
|
|
9
|
-
const nb = Number(pb[i]);
|
|
10
|
-
if (na > nb)
|
|
11
|
-
return 1;
|
|
12
|
-
if (nb > na)
|
|
13
|
-
return -1;
|
|
14
|
-
if (!isNaN(na) && isNaN(nb))
|
|
15
|
-
return 1;
|
|
16
|
-
if (isNaN(na) && !isNaN(nb))
|
|
17
|
-
return -1;
|
|
18
|
-
}
|
|
19
|
-
return 0;
|
|
20
|
-
}
|
|
21
|
-
exports.semverComp = semverComp;
|
|
22
|
-
function toFixed(num, precision) {
|
|
23
|
-
const multiplier = Math.pow(10, (precision + 1));
|
|
24
|
-
const wholeNumber = Math.floor(num * multiplier);
|
|
25
|
-
return (Math.round(wholeNumber / 10) * 10) / multiplier;
|
|
26
|
-
}
|
|
27
|
-
exports.toFixed = toFixed;
|
|
28
|
-
exports.OFFICIAL_COMPONENT_LIB_NAME = 'CLOUDBASE_STANDARD';
|
|
29
|
-
exports.OFFICIAL_MATERIAL_LIB_NAME = 'gsd-h5-react';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"version4.d.ts","sourceRoot":"","sources":["../../../src/utils/version-migrations/version4.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAkB,MAAM,aAAa,CAAC;AAGhE,wBAAgB,QAAQ,CACtB,IAAI,EAAE,YAAY,EAClB,SAAS,EAAE,OAAO,EAClB,wBAAwB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,GAC/D,YAAY,CAEd"}
|