@cloudbase/cals 1.0.3 → 1.0.4-alpha.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.
- package/lib/parser/cals/index.d.ts +1 -1
- 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.map +1 -1
- package/lib/parser/cals/utils/block/index.js +7 -3
- 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/runtime.d.ts.map +1 -1
- package/lib/parser/cals/utils/runtime.js +5 -2
- 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/version/common.d.ts.map +1 -1
- package/lib/parser/cals/utils/version/common.js +16 -33
- 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.js +5 -2
- package/lib/parser/plugins/postcss-rpx2clac.js +2 -2
- package/lib/utils/build.js +3 -3
- package/lib/utils/dts/index.d.ts +2 -2
- package/lib/utils/dts/index.d.ts.map +1 -1
- package/lib/utils/dts/index.js +141 -78
- package/lib/utils/version/migrations/version4.js +2 -2
- package/package.json +1 -1
|
@@ -360,7 +360,7 @@ export declare function deserializeComponentLibraryMeta(meta: {
|
|
|
360
360
|
export declare function processRuntimeCodeResources(ctx: {
|
|
361
361
|
id: string;
|
|
362
362
|
version?: string;
|
|
363
|
-
}, resources: any
|
|
363
|
+
}, resources: any, scope: string): any;
|
|
364
364
|
/**
|
|
365
365
|
* 解析 cals version 来生成 feature map
|
|
366
366
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/parser/cals/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../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AIG;AACH,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,GAAG,GAAG,CAwBzE;AAaD,wBAAgB,+BAA+B,CAAC,IAAI,EAAE;IACpD,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,YAAY,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IACzC,UAAU,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC,UAAU,CAAA;KAAE,CAAC;IAC/C,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC,OAAO,CAAA;KAAE,CAAC;CAC1C;;;;;;;mBAIY,MAAM;mBACN,MAAM;sBACH,MAAM;;;6BACwB,OAAO;;;wBACnC,MAAM;;;;;;EAiCvB;AAED,wBAAgB,2BAA2B,CACzC,GAAG,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,EACrC,SAAS,EAAE,GAA4B,EACvC,KAAK,EAAE,MAAM,OAkCd;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,OAAO,SAAK,EACZ,YAAY,QAAK,GAChB;IACD,qBAAqB,EAAE,OAAO,CAAC;IAC/B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,cAAc,EAAE,OAAO,CAAC;CACzB,CA0BA"}
|
package/lib/parser/cals/index.js
CHANGED
|
@@ -10,9 +10,17 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
}
|
|
11
11
|
return t;
|
|
12
12
|
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
13
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
17
|
exports.parseVersion = exports.processRuntimeCodeResources = 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 = exports.generateDefaultCode = exports.getUsedComps = void 0;
|
|
15
|
-
const
|
|
18
|
+
const get_1 = __importDefault(require("lodash/get"));
|
|
19
|
+
const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
|
|
20
|
+
const unset_1 = __importDefault(require("lodash/unset"));
|
|
21
|
+
const set_1 = __importDefault(require("lodash/set"));
|
|
22
|
+
const isArray_1 = __importDefault(require("lodash/isArray"));
|
|
23
|
+
const isObject_1 = __importDefault(require("lodash/isObject"));
|
|
16
24
|
const common_1 = require("../../types/platform/common");
|
|
17
25
|
const expression_1 = require("../expression");
|
|
18
26
|
const common_2 = require("./utils/common");
|
|
@@ -175,13 +183,13 @@ function serializeDynamicMapWithExtra({ ctx, map = {}, scope = 'page', streamlin
|
|
|
175
183
|
let originKey = processedKey;
|
|
176
184
|
if (matched) {
|
|
177
185
|
originKey = matched[1];
|
|
178
|
-
(0,
|
|
186
|
+
(0, unset_1.default)(data, originKey);
|
|
179
187
|
}
|
|
180
188
|
const originKeyArr = originKey.split('.');
|
|
181
|
-
if ((0,
|
|
189
|
+
if ((0, get_1.default)(data, processedKey) == undefined) {
|
|
182
190
|
/* 选区结构处理 [formily] to [CALS] */
|
|
183
191
|
if (Array.isArray(processedValue) && (processedValue === null || processedValue === void 0 ? void 0 : processedValue.some((item) => !!(item === null || item === void 0 ? void 0 : item.selectableBlock)))) {
|
|
184
|
-
let valueTmp = (0,
|
|
192
|
+
let valueTmp = (0, cloneDeep_1.default)(processedValue);
|
|
185
193
|
processedValue = valueTmp === null || valueTmp === void 0 ? void 0 : valueTmp.map((_value) => {
|
|
186
194
|
var _a, _b, _c;
|
|
187
195
|
const xProp = (_a = _value === null || _value === void 0 ? void 0 : _value.selectableBlock) === null || _a === void 0 ? void 0 : _a['x-props'];
|
|
@@ -198,10 +206,10 @@ function serializeDynamicMapWithExtra({ ctx, map = {}, scope = 'page', streamlin
|
|
|
198
206
|
}
|
|
199
207
|
// 为动态数据且有多级,将{":range.0.label": "$page.dataset.state.test1"}转为{ range: [{ label: "$page.dataset.state.test1"}] }
|
|
200
208
|
if (matched && originKeyArr.length >= 2) {
|
|
201
|
-
(0,
|
|
209
|
+
(0, set_1.default)(data, replaceWithColon(originKey), (0, cloneDeep_1.default)(processedValue));
|
|
202
210
|
}
|
|
203
211
|
else {
|
|
204
|
-
data[processedKey] = (0,
|
|
212
|
+
data[processedKey] = (0, cloneDeep_1.default)(processedValue);
|
|
205
213
|
}
|
|
206
214
|
}
|
|
207
215
|
extra[originKey] = processedExtra;
|
|
@@ -231,19 +239,19 @@ function replaceWithColon(key) {
|
|
|
231
239
|
function recoverSynamicMap(parent, current, path = '') {
|
|
232
240
|
Object.keys(current).forEach((key) => {
|
|
233
241
|
let value = current[key];
|
|
234
|
-
if ((0,
|
|
242
|
+
if ((0, isArray_1.default)(value)) {
|
|
235
243
|
// 注意如果是 selectableBlock 独立处理
|
|
236
244
|
if (value === null || value === void 0 ? void 0 : value.some((item) => !!(item === null || item === void 0 ? void 0 : item.selectableBlock))) {
|
|
237
245
|
return;
|
|
238
246
|
}
|
|
239
247
|
// 数组必须在前面
|
|
240
248
|
value.forEach((valueItem, valueIndex) => {
|
|
241
|
-
if ((0,
|
|
249
|
+
if ((0, isObject_1.default)(valueItem)) {
|
|
242
250
|
valueItem = recoverSynamicMap(parent, valueItem, `${path === '' ? '' : `${path}.`}${key}.${valueIndex}`);
|
|
243
251
|
}
|
|
244
252
|
});
|
|
245
253
|
}
|
|
246
|
-
else if ((0,
|
|
254
|
+
else if ((0, isObject_1.default)(value)) {
|
|
247
255
|
value = recoverSynamicMap(parent, value, `${path === '' ? '' : `${path}.`}${key}`);
|
|
248
256
|
}
|
|
249
257
|
else {
|
|
@@ -252,7 +260,7 @@ function recoverSynamicMap(parent, current, path = '') {
|
|
|
252
260
|
parent[`:${path === '' ? '' : `${path}.`}${matched[1]}`] = current[key];
|
|
253
261
|
if (current !== parent) {
|
|
254
262
|
// 如果是第一层级,说明current和parent相等,不unset
|
|
255
|
-
(0,
|
|
263
|
+
(0, unset_1.default)(current, key);
|
|
256
264
|
}
|
|
257
265
|
}
|
|
258
266
|
}
|
|
@@ -262,7 +270,7 @@ function recoverSynamicMap(parent, current, path = '') {
|
|
|
262
270
|
function deserializeDynamicMap(ctx, map, extraMap) {
|
|
263
271
|
var _a, _b;
|
|
264
272
|
let data = {};
|
|
265
|
-
const clonedMap = (0,
|
|
273
|
+
const clonedMap = (0, cloneDeep_1.default)(map);
|
|
266
274
|
// 还原flatten path
|
|
267
275
|
map = recoverSynamicMap(clonedMap, clonedMap, '');
|
|
268
276
|
for (let key in map || {}) {
|
|
@@ -1057,7 +1065,7 @@ function deserializeComponentLibraryMeta(meta) {
|
|
|
1057
1065
|
dependencies, components: processedComponents, actions });
|
|
1058
1066
|
}
|
|
1059
1067
|
exports.deserializeComponentLibraryMeta = deserializeComponentLibraryMeta;
|
|
1060
|
-
function processRuntimeCodeResources(ctx, resources
|
|
1068
|
+
function processRuntimeCodeResources(ctx, resources = [], scope) {
|
|
1061
1069
|
const { id } = ctx;
|
|
1062
1070
|
const fileTypes = [common_1.ECodeType.STYLE, common_1.ECodeType.STATE, common_1.ECodeType.LIFECYCLE, common_1.ECodeType.COMPUTEDN];
|
|
1063
1071
|
const CODE_TYPE_NAME_MAP = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/parser/cals/utils/block/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAqB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/parser/cals/utils/block/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAqB,MAAM,mBAAmB,CAAC;AAK1F,UAAU,aAAa;IACrB,SAAS,CAAC,EAAE;QACV,EAAE,EAAE,MAAM,CAAC;KACZ,CAAC;IACF,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAChC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACnC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAClC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAChC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACtC;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,eAAe,GAAG,iBAAiB,GAAG,aAAa,CAyD/G"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.parseComponentCals = void 0;
|
|
4
|
-
const
|
|
7
|
+
const get_1 = __importDefault(require("lodash/get"));
|
|
8
|
+
const set_1 = __importDefault(require("lodash/set"));
|
|
5
9
|
const expression_1 = require("../../../expression");
|
|
6
10
|
function parseComponentCals(ctx, cals) {
|
|
7
11
|
if (!ctx.datasetMap) {
|
|
@@ -23,8 +27,8 @@ function parseComponentCals(ctx, cals) {
|
|
|
23
27
|
id: cals.id || '',
|
|
24
28
|
};
|
|
25
29
|
const { component, module, attributes = {}, items = [], listeners = [], directives = {}, [':class']: dynamicClassList, [':style']: dynamicStyle, } = cals;
|
|
26
|
-
if (module && component && !(0,
|
|
27
|
-
(0,
|
|
30
|
+
if (module && component && !(0, get_1.default)(ctx.componentMap, `${module}.${component}`)) {
|
|
31
|
+
(0, set_1.default)(ctx.componentMap, `${module}.${component}`, true);
|
|
28
32
|
ctx.componentLibMap[module] = true;
|
|
29
33
|
}
|
|
30
34
|
// 优先处理 directives 因为其他绑定会用到for
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/parser/cals/utils/code/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAsE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/parser/cals/utils/code/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAsE,MAAM,mBAAmB,CAAC;AAKrH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,YAAY,EAAE,OAAO,GAAE,IAAI,GAAG,IAAW,GAAG,SAAS,EAAE,CAwL3F;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,SAAS,EAAE,EAAE,OAAO,GAAE,IAAI,GAAG,IAAW,GAAG,YAAY,CA+J3F;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,MAAM,CA6BlF"}
|
|
@@ -3,10 +3,15 @@
|
|
|
3
3
|
* cals 与 code 互转
|
|
4
4
|
* 这里的 code 是中间状态的 code,即非最终生成的可运行的项目代码
|
|
5
5
|
*/
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
6
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
10
|
exports.autoResolveConflicts = exports.checkForConflicts = exports.codeToCals = exports.calsToCode = void 0;
|
|
8
11
|
const types_1 = require("../../../../types");
|
|
9
|
-
const
|
|
12
|
+
const pick_1 = __importDefault(require("lodash/pick"));
|
|
13
|
+
const omit_1 = __importDefault(require("lodash/omit"));
|
|
14
|
+
const concat_1 = __importDefault(require("lodash/concat"));
|
|
10
15
|
/**
|
|
11
16
|
* CALS 转成 中间状态的代码
|
|
12
17
|
*
|
|
@@ -115,10 +120,10 @@ function calsToCode(calsJSON, version = 'v1') {
|
|
|
115
120
|
}
|
|
116
121
|
function genConfig(itemJSON, configFields, configPath, otherConfigFields) {
|
|
117
122
|
var _a;
|
|
118
|
-
const config = (0,
|
|
123
|
+
const config = (0, pick_1.default)(itemJSON, configFields);
|
|
119
124
|
if (otherConfigFields) {
|
|
120
125
|
Object.keys(otherConfigFields).forEach((key) => {
|
|
121
|
-
config[key] = (0,
|
|
126
|
+
config[key] = (0, pick_1.default)(config[key], otherConfigFields[key]);
|
|
122
127
|
});
|
|
123
128
|
}
|
|
124
129
|
// state, computed 类型以及名称为 ____index____ 的都不生成代码
|
|
@@ -200,7 +205,7 @@ function codeToCals(codeList, version = 'v1') {
|
|
|
200
205
|
resources: [],
|
|
201
206
|
};
|
|
202
207
|
const appConfigCodeItem = codeList.find((item) => item.path === 'src/app-config.json');
|
|
203
|
-
const appConfig = JSON.parse(appConfigCodeItem.code);
|
|
208
|
+
const appConfig = JSON.parse((appConfigCodeItem === null || appConfigCodeItem === void 0 ? void 0 : appConfigCodeItem.code) || '{}');
|
|
204
209
|
let pagePaths = appConfig.extra.pages;
|
|
205
210
|
codeList.forEach((codeItem) => {
|
|
206
211
|
if (codeItem.path === 'src/app-config.json') {
|
|
@@ -208,14 +213,14 @@ function codeToCals(codeList, version = 'v1') {
|
|
|
208
213
|
* app-config.json
|
|
209
214
|
*/
|
|
210
215
|
const config = appConfig;
|
|
211
|
-
Object.assign(calsJSON, (0,
|
|
212
|
-
calsJSON.resources = (0,
|
|
216
|
+
Object.assign(calsJSON, (0, omit_1.default)(config, ['_ignoreResources', 'extra.pages']));
|
|
217
|
+
calsJSON.resources = (0, concat_1.default)(calsJSON.resources, config._ignoreResources);
|
|
213
218
|
}
|
|
214
219
|
else if (isPageFile(codeItem.path)) {
|
|
215
220
|
/**
|
|
216
221
|
* page
|
|
217
222
|
*/
|
|
218
|
-
const [, pageId] = codeItem.path.match(versionConfig.pageIdRegExp);
|
|
223
|
+
const [, pageId] = codeItem.path.match(versionConfig.pageIdRegExp) || [];
|
|
219
224
|
let pageItem = calsJSON.items.find((item) => item.id === pageId);
|
|
220
225
|
if (!pageItem) {
|
|
221
226
|
pageItem = {
|
|
@@ -233,9 +238,9 @@ function codeToCals(codeList, version = 'v1') {
|
|
|
233
238
|
* page-config.json
|
|
234
239
|
*/
|
|
235
240
|
const config = JSON.parse(codeItem.code);
|
|
236
|
-
const propsConfig = (0,
|
|
241
|
+
const propsConfig = (0, omit_1.default)(config, ['_ignoreResources']);
|
|
237
242
|
Object.assign(pageItem, propsConfig);
|
|
238
|
-
pageItem.resources = (0,
|
|
243
|
+
pageItem.resources = (0, concat_1.default)(pageItem.resources, config._ignoreResources);
|
|
239
244
|
}
|
|
240
245
|
else if (versionConfig.pageJSONRegExp.test(codeItem.path)) {
|
|
241
246
|
/**
|
|
@@ -254,11 +259,12 @@ function codeToCals(codeList, version = 'v1') {
|
|
|
254
259
|
/**
|
|
255
260
|
* global normal codes
|
|
256
261
|
*/
|
|
257
|
-
handleNormalCodes(codeItem, '', calsJSON.resources);
|
|
262
|
+
handleNormalCodes(codeItem, '', calsJSON.resources || []);
|
|
258
263
|
}
|
|
259
264
|
});
|
|
260
265
|
return calsJSON;
|
|
261
266
|
function handleNormalCodes(codeItem, pageId, resources) {
|
|
267
|
+
var _a, _b;
|
|
262
268
|
const relativePath = !pageId
|
|
263
269
|
? codeItem.path.replace('src/', '')
|
|
264
270
|
: codeItem.path.replace(`${versionConfig.pageDir}/${pageId}/`, '');
|
|
@@ -274,7 +280,7 @@ function codeToCals(codeList, version = 'v1') {
|
|
|
274
280
|
*/
|
|
275
281
|
switch (relativePath) {
|
|
276
282
|
case 'theme.less':
|
|
277
|
-
calsJSON.resources.push(Object.assign({ name: types_1.ECodeType.THEME, path: `${_pageId}/${types_1.ECodeType.THEME}`, codeType: types_1.ECodeType.THEME }, commonVal));
|
|
283
|
+
(_a = calsJSON.resources) === null || _a === void 0 ? void 0 : _a.push(Object.assign({ name: types_1.ECodeType.THEME, path: `${_pageId}/${types_1.ECodeType.THEME}`, codeType: types_1.ECodeType.THEME }, commonVal));
|
|
278
284
|
break;
|
|
279
285
|
case 'style.less':
|
|
280
286
|
resources.push(Object.assign({ name: types_1.ECodeType.STYLE, path: `${_pageId}/${types_1.ECodeType.STYLE}`, codeType: types_1.ECodeType.STYLE }, commonVal));
|
|
@@ -293,7 +299,7 @@ function codeToCals(codeList, version = 'v1') {
|
|
|
293
299
|
const commonMatches = relativePath.match(/^common\/([^/]*?).js$/);
|
|
294
300
|
if (commonMatches) {
|
|
295
301
|
const [, name] = commonMatches;
|
|
296
|
-
calsJSON.resources.push(Object.assign({ name, path: `${_pageId}/common/${name}`, codeType: types_1.ECodeType.NORMAL_MODULE }, commonVal));
|
|
302
|
+
(_b = calsJSON.resources) === null || _b === void 0 ? void 0 : _b.push(Object.assign({ name, path: `${_pageId}/common/${name}`, codeType: types_1.ECodeType.NORMAL_MODULE }, commonVal));
|
|
297
303
|
}
|
|
298
304
|
break;
|
|
299
305
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../src/parser/cals/utils/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../src/parser/cals/utils/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAgB,MAAM,kBAAkB,CAAC;AAI/D,wBAAgB,cAAc,CAC5B,UAAU,GAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAoB,EACpD,WAAW,GAAE,MAAM,EAAO,GACzB,MAAM,CAqDR;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,GAAG,OAiDtC;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,GAAG,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAAA;CAAE,CA4B1E;AAED,wBAAgB,aAAa,CAAC,iBAAiB,GAAE,GAAG,EAAO,OAiB1D;AAED,wBAAgB,cAAc,CAAC,SAAS,GAAE,GAAG,EAAO,SAenD;AAGD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,GAAQ,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,10 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.getValidValue = exports.setValidValue = exports.writeDynamicData = exports.writeListeners = exports.readListeners = exports.readDynamicData = exports.readDirectives = exports.readComponents = void 0;
|
|
4
7
|
const expression_1 = require("../../expression");
|
|
5
8
|
const style_1 = require("./style");
|
|
6
9
|
const common_1 = require("./common");
|
|
7
|
-
const
|
|
10
|
+
const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
|
|
8
11
|
function readComponents(properties = {}, excludeKeys = []) {
|
|
9
12
|
var _a;
|
|
10
13
|
const cmps /* IWeAppPage['componentInstances'] */ = {};
|
|
@@ -173,7 +176,7 @@ function writeListeners(listeners = []) {
|
|
|
173
176
|
exports.writeListeners = writeListeners;
|
|
174
177
|
// 处理Listeners动态数据
|
|
175
178
|
function writeDynamicData(from = {}, to, properties) {
|
|
176
|
-
const act = (0,
|
|
179
|
+
const act = (0, cloneDeep_1.default)(to);
|
|
177
180
|
act.dataTypes = to.dataTypes || [];
|
|
178
181
|
for (const prop in from) {
|
|
179
182
|
const dv = from[prop];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../../src/parser/cals/utils/style.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../../src/parser/cals/utils/style.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAKrC,wBAAgB,2BAA2B,CAAC,SAAS,GAAE,GAA2B,GAAG,GAAG,CAUvF;AA4JD;;;;GAIG;AACH,wBAAgB,gCAAgC,CAC9C,WAAW,GAAE,GAAQ,EACrB,OAAO,GAAE;IACP;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;OAIG;IACH,WAAW,CAAC,EAAE,KAAK,GAAG,IAAI,GAAG,KAAK,CAAC;IACnC;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;CACwE,GAC7F,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC,CAkS7B;AACD,UAAU,sBAAsB;IAC9B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AACD;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,GAAE,UAAU,CAAC,MAAM,GAAG,MAAM,CAAM,EACvC,OAAO,CAAC,EAAE,sBAAsB,GAC/B,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC,CAE7B;AACD,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,UAAU,CAAC,MAAM,GAAG,MAAM,CAAM,EACvC,IAAI,EAAE,IAAI,GAAG,KAAK,GAAG,KAAK,EAC1B,OAAO,CAAC,EAAE,sBAAsB,MAajC"}
|
|
@@ -10,10 +10,14 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
}
|
|
11
11
|
return t;
|
|
12
12
|
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
13
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
17
|
exports.processCSSPropertiesUnit = exports.processCSSProperties2Rem = exports.processCommonStyle2CSSProperties = exports.removeInvalidStyleFormValue = void 0;
|
|
15
18
|
const common_1 = require("./common");
|
|
16
|
-
const
|
|
19
|
+
const map_1 = __importDefault(require("lodash/map"));
|
|
20
|
+
const uniq_1 = __importDefault(require("lodash/uniq"));
|
|
17
21
|
const utils_1 = require("../../../utils");
|
|
18
22
|
const DISTANCE_KEY_LIST = ['top', 'right', 'bottom', 'left'];
|
|
19
23
|
function removeInvalidStyleFormValue(styleForm = {}) {
|
|
@@ -64,7 +68,7 @@ function _handleStyleNumValue(styleVal, addPXUnit) {
|
|
|
64
68
|
function setDistanceStyle(style, distance, attr, addPXUnit) {
|
|
65
69
|
const attributeKey = (0, common_1.camelcase)(`${attr}`);
|
|
66
70
|
if (Object.keys(distance).length === 4) {
|
|
67
|
-
if ((0,
|
|
71
|
+
if ((0, uniq_1.default)((0, map_1.default)(distance, (val) => val)).length === 1) {
|
|
68
72
|
// 4个值全相等的情况
|
|
69
73
|
setStyleValue(style, attributeKey, _handleStyleNumValue(distance.top, addPXUnit));
|
|
70
74
|
}
|
|
@@ -280,7 +284,7 @@ function processCommonStyle2CSSProperties(commonStyle = {}, options = { toRem: t
|
|
|
280
284
|
bottomLeft = '0';
|
|
281
285
|
}
|
|
282
286
|
}
|
|
283
|
-
if ((0,
|
|
287
|
+
if ((0, uniq_1.default)((0, map_1.default)(radiusInfo, (val) => val)).length === 1) {
|
|
284
288
|
// 4个值全相等的情况
|
|
285
289
|
setStyleValue(style, 'borderRadius', _handleStyleNumValue(topLeft, !!options.addPXUnit));
|
|
286
290
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../../src/parser/cals/utils/version/common.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../../src/parser/cals/utils/version/common.ts"],"names":[],"mappings":"AAiBA,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,GAAG,QAE1C;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,GAAG,QAYzC;AA2LD,wBAAgB,WAAW,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,UAAQ,QAiJ/E;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,GAAG,QAsCvC"}
|
|
@@ -1,31 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
4
|
};
|
|
25
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
6
|
exports.renameRepeatId = exports.addFormItem = exports.afterCommonParse = exports.beforeCommonParse = void 0;
|
|
27
7
|
const utils_1 = require("./utils");
|
|
28
|
-
const
|
|
8
|
+
const get_1 = __importDefault(require("lodash/get"));
|
|
9
|
+
const set_1 = __importDefault(require("lodash/set"));
|
|
10
|
+
const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
|
|
11
|
+
const merge_1 = __importDefault(require("lodash/merge"));
|
|
29
12
|
const index_1 = require("./index");
|
|
30
13
|
const common_1 = require("../common");
|
|
31
14
|
const utils_2 = require("../../../../utils");
|
|
@@ -196,7 +179,7 @@ function translateStyleToCommonStyle(comp) {
|
|
|
196
179
|
if (xProps === null || xProps === void 0 ? void 0 : xProps.style) {
|
|
197
180
|
xProps.commonStyle = xProps.commonStyle || {};
|
|
198
181
|
xProps.commonStyle.self = xProps.commonStyle.self || {};
|
|
199
|
-
xProps.commonStyle.self = (0,
|
|
182
|
+
xProps.commonStyle.self = (0, merge_1.default)(xProps.style, xProps.commonStyle.self);
|
|
200
183
|
delete xProps.style;
|
|
201
184
|
}
|
|
202
185
|
}
|
|
@@ -218,12 +201,12 @@ function addDefaultXIndex(comp) {
|
|
|
218
201
|
}
|
|
219
202
|
function addFormItem(comp, key, parent, isOnlySlot = false) {
|
|
220
203
|
const { properties, xIndex, xProps } = comp;
|
|
221
|
-
const defaultValue =
|
|
204
|
+
const defaultValue = (0, get_1.default)(xProps, 'data.defaultValue');
|
|
222
205
|
if (defaultValue) {
|
|
223
|
-
|
|
206
|
+
(0, set_1.default)(xProps, 'data.value', defaultValue);
|
|
224
207
|
delete xProps.data.defaultValue;
|
|
225
208
|
}
|
|
226
|
-
const rulesValue =
|
|
209
|
+
const rulesValue = (0, get_1.default)(xProps, 'data.rules') || {
|
|
227
210
|
value: [],
|
|
228
211
|
};
|
|
229
212
|
if (!rulesValue.type || rulesValue.type === 'static') {
|
|
@@ -239,19 +222,19 @@ function addFormItem(comp, key, parent, isOnlySlot = false) {
|
|
|
239
222
|
rulesValue.value = [rulesValue.value];
|
|
240
223
|
}
|
|
241
224
|
}
|
|
242
|
-
const layoutValue =
|
|
225
|
+
const layoutValue = (0, get_1.default)(xProps, 'data.layout') || {
|
|
243
226
|
value: 'vertical',
|
|
244
227
|
};
|
|
245
|
-
const requireValue =
|
|
228
|
+
const requireValue = (0, get_1.default)(xProps, 'data.required') || {
|
|
246
229
|
value: false,
|
|
247
230
|
};
|
|
248
231
|
const requiredTextValue = {
|
|
249
232
|
value: (requireValue === null || requireValue === void 0 ? void 0 : requireValue.value) ? '该项为必填项' : false,
|
|
250
233
|
};
|
|
251
|
-
const nameValue =
|
|
234
|
+
const nameValue = (0, get_1.default)(xProps, 'data.name') || {
|
|
252
235
|
value: 'uniqueFormKey',
|
|
253
236
|
};
|
|
254
|
-
let labelText =
|
|
237
|
+
let labelText = (0, get_1.default)(xProps, 'data.label.value') || '';
|
|
255
238
|
let isShowTitleSlot = false;
|
|
256
239
|
if (properties) {
|
|
257
240
|
Object.keys(properties).map((subKey) => {
|
|
@@ -261,8 +244,8 @@ function addFormItem(comp, key, parent, isOnlySlot = false) {
|
|
|
261
244
|
if (subKey === 'label') {
|
|
262
245
|
const targetLabelSlot = properties[subKey];
|
|
263
246
|
(0, utils_1.getComponentChildren)(targetLabelSlot).map(([key, item]) => {
|
|
264
|
-
labelText =
|
|
265
|
-
const cloneItem =
|
|
247
|
+
labelText = (0, get_1.default)(item, 'xProps.data.text.value');
|
|
248
|
+
const cloneItem = (0, cloneDeep_1.default)(item);
|
|
266
249
|
(0, index_1.deepParse)(cloneItem, key, comp);
|
|
267
250
|
isShowTitleSlot = true;
|
|
268
251
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parses.d.ts","sourceRoot":"","sources":["../../../../../src/parser/cals/utils/version/parses.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"parses.d.ts","sourceRoot":"","sources":["../../../../../src/parser/cals/utils/version/parses.ts"],"names":[],"mappings":"AAcA,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,GAAG,QAmC5C;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,GAAG,QA4G5C;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,GAAG,QA4B9C;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,QAuBlE;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,GAAG,QAoF5C;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,GAAG,QAM9C;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,GAAG,QAc1C;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,QAmDlE;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,QAanE;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,QAGnE;AAED,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,QAQ3E;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,QA6CnE;AAED,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,GAAG,QAgDnD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,GAAG,QAwD1C;AAGD,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE,GAAG,QAuB1D"}
|
|
@@ -1,31 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
4
|
};
|
|
25
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
6
|
exports.parseComplexComponentInstance = exports.parseGsdKboneTabs = exports.addFormWrapperComp = exports.parseGsdKboneUpload = exports.parseGsdKboneDateTimePicker = exports.parseGsdKbonePicker = exports.parseGsdKboneSwitch = exports.parseGsdKboneInput = exports.parseGsdKboneText = exports.parseGsdKboneRichText = exports.parseGsdKboneSwiper = exports.parseGsdKboneAgree = exports.parseGsdKbonePopLayer = exports.parseGsdKboneButton = exports.parseGsdKboneFooter = void 0;
|
|
27
7
|
const utils_1 = require("./utils");
|
|
28
|
-
const
|
|
8
|
+
const get_1 = __importDefault(require("lodash/get"));
|
|
9
|
+
const set_1 = __importDefault(require("lodash/set"));
|
|
10
|
+
const merge_1 = __importDefault(require("lodash/merge"));
|
|
29
11
|
const common_1 = require("./common");
|
|
30
12
|
const utils_2 = require("../../../../utils");
|
|
31
13
|
function parseGsdKboneFooter(comp) {
|
|
@@ -283,7 +265,7 @@ function parseGsdKboneSwiper(comp) {
|
|
|
283
265
|
else {
|
|
284
266
|
const newSwiperItemId = (0, utils_1.getId)();
|
|
285
267
|
const newSubComp = JSON.parse(JSON.stringify(subComp).replace(new RegExp(`forItems\\.${subKey}`, 'g'), `forItems.${newSwiperItemId}`));
|
|
286
|
-
const waFor =
|
|
268
|
+
const waFor = (0, get_1.default)(newSubComp, 'xProps.directives.waFor');
|
|
287
269
|
try {
|
|
288
270
|
delete newSubComp.xProps.directives.waFor;
|
|
289
271
|
delete comp.properties[subKey];
|
|
@@ -330,7 +312,7 @@ function parseGsdKboneText(comp) {
|
|
|
330
312
|
comp.xProps = comp.xProps || {};
|
|
331
313
|
comp.xProps.commonStyle = comp.xProps.commonStyle || {};
|
|
332
314
|
// v1 版本 text 为 block
|
|
333
|
-
comp.xProps.commonStyle = (0,
|
|
315
|
+
comp.xProps.commonStyle = (0, merge_1.default)({
|
|
334
316
|
display: 'block',
|
|
335
317
|
self: {
|
|
336
318
|
display: 'block',
|
|
@@ -383,20 +365,20 @@ function parseGsdKboneInput(comp, key, parent) {
|
|
|
383
365
|
},
|
|
384
366
|
};
|
|
385
367
|
(0, utils_1.addDefaultData)(defaultData, comp);
|
|
386
|
-
const append =
|
|
368
|
+
const append = (0, get_1.default)(comp, 'properties.append');
|
|
387
369
|
if (append) {
|
|
388
|
-
|
|
389
|
-
|
|
370
|
+
(0, set_1.default)(comp, 'properties.suffix', append);
|
|
371
|
+
(0, set_1.default)(comp, 'xProps.data.isSuffix.value', true);
|
|
390
372
|
delete comp.properties.append;
|
|
391
373
|
}
|
|
392
374
|
}
|
|
393
375
|
exports.parseGsdKboneInput = parseGsdKboneInput;
|
|
394
376
|
function parseGsdKboneSwitch(comp, key, parent) {
|
|
395
377
|
(0, common_1.addFormItem)(comp, key, parent, true);
|
|
396
|
-
const defaultValue =
|
|
397
|
-
defaultValue &&
|
|
398
|
-
const originStyle =
|
|
399
|
-
|
|
378
|
+
const defaultValue = (0, get_1.default)(comp, 'xProps.data.defaultValue');
|
|
379
|
+
defaultValue && (0, set_1.default)(comp, 'xProps.data.value', defaultValue);
|
|
380
|
+
const originStyle = (0, get_1.default)(comp, 'xProps.commonStyle.margin');
|
|
381
|
+
(0, set_1.default)(comp, 'xProps.commonStyle.margin', Object.assign(Object.assign({}, originStyle), { top: '30', right: '40', bottom: '30', left: '40' }));
|
|
400
382
|
}
|
|
401
383
|
exports.parseGsdKboneSwitch = parseGsdKboneSwitch;
|
|
402
384
|
function parseGsdKbonePicker(comp, key, parent) {
|
|
@@ -406,7 +388,7 @@ function parseGsdKbonePicker(comp, key, parent) {
|
|
|
406
388
|
exports.parseGsdKbonePicker = parseGsdKbonePicker;
|
|
407
389
|
function parseGsdKboneDateTimePicker(comp, key, parent) {
|
|
408
390
|
(0, common_1.addFormItem)(comp, key, parent);
|
|
409
|
-
const modeValue =
|
|
391
|
+
const modeValue = (0, get_1.default)(comp, 'xProps.data.mode.value');
|
|
410
392
|
if (modeValue === 'date') {
|
|
411
393
|
comp.xComponent.name = 'Date';
|
|
412
394
|
}
|
|
@@ -474,10 +456,10 @@ function addFormWrapperComp(pageInstance) {
|
|
|
474
456
|
let comp = _comp;
|
|
475
457
|
const { xComponent, xProps } = comp;
|
|
476
458
|
if (xComponent && xComponent.name === 'Button') {
|
|
477
|
-
const target =
|
|
459
|
+
const target = (0, get_1.default)(xProps, 'listeners[0]');
|
|
478
460
|
if (target && target.trigger && target.trigger === 'click') {
|
|
479
461
|
listeners = xProps.listeners;
|
|
480
|
-
|
|
462
|
+
(0, set_1.default)(xProps, 'data.formType', {
|
|
481
463
|
value: 'submit',
|
|
482
464
|
});
|
|
483
465
|
target.trigger = 'submit';
|
|
@@ -529,7 +511,7 @@ function parseGsdKboneTabs(comp) {
|
|
|
529
511
|
}
|
|
530
512
|
let tabItems; // [{key, title, content}]
|
|
531
513
|
if (xProps.data) {
|
|
532
|
-
tabItems =
|
|
514
|
+
tabItems = (0, get_1.default)(xProps.data, 'TabItems.value', []);
|
|
533
515
|
// 只保留 activeKey
|
|
534
516
|
Object.keys(xProps.data).forEach((key) => {
|
|
535
517
|
if (key !== 'activeKey')
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.findComponentInTree = exports.checkIsNeedAddFormWrapper = exports.isPlainObject = exports.isEmptyObject = exports.isWeAppId = exports.getComponentChildren = exports.isComplexJSON = exports.addDefaultData = exports.addDefaultSlot = exports.isGsdH5ReactComponent = exports.isComplexComponent = exports.getId = exports.init = void 0;
|
|
4
7
|
const config_1 = require("./config");
|
|
5
|
-
const
|
|
8
|
+
const merge_1 = __importDefault(require("lodash/merge"));
|
|
6
9
|
const ids = [];
|
|
7
10
|
let maxId = 10000;
|
|
8
11
|
function init(json) {
|
|
@@ -71,7 +74,7 @@ function addDefaultData(defaultData, comp) {
|
|
|
71
74
|
// @ts-ignore
|
|
72
75
|
comp.xProps = comp.xProps || {};
|
|
73
76
|
comp.xProps.data = comp.xProps.data || {};
|
|
74
|
-
comp.xProps.data = (0,
|
|
77
|
+
comp.xProps.data = (0, merge_1.default)(defaultData, comp.xProps.data);
|
|
75
78
|
}
|
|
76
79
|
exports.addDefaultData = addDefaultData;
|
|
77
80
|
function isComplexJSON(json) {
|
|
@@ -50,11 +50,11 @@ function Plugin(opt) {
|
|
|
50
50
|
return str;
|
|
51
51
|
if (num1 == '0')
|
|
52
52
|
return '0';
|
|
53
|
-
const v = +num1 / zoom;
|
|
53
|
+
const v = +num1 / (zoom || 1);
|
|
54
54
|
if (isNaN(v)) {
|
|
55
55
|
return str;
|
|
56
56
|
}
|
|
57
|
-
const value = Number.isInteger(v) ? v.toString() : toFixed(v, precision);
|
|
57
|
+
const value = Number.isInteger(v) ? v.toString() : toFixed(v, precision || 0);
|
|
58
58
|
return `calc(${value}${outUnit}/${rootValue})`;
|
|
59
59
|
});
|
|
60
60
|
}
|
package/lib/utils/build.js
CHANGED
|
@@ -29,7 +29,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
const path_1 = require("path");
|
|
30
30
|
const fs_1 = require("fs");
|
|
31
31
|
const TJS = __importStar(require("typescript-json-schema"));
|
|
32
|
-
const
|
|
32
|
+
const merge_1 = __importDefault(require("lodash/merge"));
|
|
33
33
|
// optionally pass argument to schema generator
|
|
34
34
|
const settings = {
|
|
35
35
|
required: true,
|
|
@@ -53,7 +53,7 @@ const platformApp = platformCalsGenerator === null || platformCalsGenerator ===
|
|
|
53
53
|
const lcdsComponent = lcdsGenerator === null || lcdsGenerator === void 0 ? void 0 : lcdsGenerator.getSchemaForSymbol('LCDS.IComponent');
|
|
54
54
|
const lcdsAction = lcdsGenerator === null || lcdsGenerator === void 0 ? void 0 : lcdsGenerator.getSchemaForSymbol('LCDS.IAction');
|
|
55
55
|
// rewrite lcds
|
|
56
|
-
const resolveLcdsComponent =
|
|
56
|
+
const resolveLcdsComponent = (0, merge_1.default)({}, lcdsComponent, {
|
|
57
57
|
properties: {
|
|
58
58
|
data: {
|
|
59
59
|
$schema: 'https://comp-public-1303824488.cos.ap-shanghai.myqcloud.com/schema/schema#',
|
|
@@ -61,7 +61,7 @@ const resolveLcdsComponent = lodash_1.default.merge({}, lcdsComponent, {
|
|
|
61
61
|
},
|
|
62
62
|
},
|
|
63
63
|
});
|
|
64
|
-
const resolveLcdsAction =
|
|
64
|
+
const resolveLcdsAction = (0, merge_1.default)({}, lcdsAction, {
|
|
65
65
|
properties: {
|
|
66
66
|
data: {
|
|
67
67
|
$schema: 'http://json-schema.org/draft-07/schema#',
|
package/lib/utils/dts/index.d.ts
CHANGED
|
@@ -105,14 +105,14 @@ export declare class WeDaDTS {
|
|
|
105
105
|
/**
|
|
106
106
|
* 全部更新
|
|
107
107
|
*/
|
|
108
|
-
static updateDTS(inputData?: IInputData, options?: Pick<IOptions,
|
|
108
|
+
static updateDTS(inputData?: IInputData, options?: Pick<IOptions, 'isCompMode'>): Promise<void>;
|
|
109
109
|
/**
|
|
110
110
|
* 部分更新 - 只更新一种类型
|
|
111
111
|
*/
|
|
112
112
|
static updateDTSPartial(inputData: IJsonSchemaObject | IDTSCodeItem[] | string[] | IInputDataUsedComponents[] | IInputDataWidgetItem[] | IInputDataRepeaterItem[] | IInputDataRedefineAnyType[], itemType: IInputDataType, options?: {
|
|
113
113
|
setEmptyIfError: boolean;
|
|
114
114
|
}): Promise<void>;
|
|
115
|
-
static getDTS(options?: Omit<IOptions,
|
|
115
|
+
static getDTS(options?: Omit<IOptions, 'isCompMode'>): string;
|
|
116
116
|
}
|
|
117
117
|
/**
|
|
118
118
|
* 生成 WeDa 应用的低码代码提示的 dts 类型声明内容
|
|
@@ -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;AAC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AAsB,EAAE,GACxB,yBAAyB,EAAE,EAC/B,QAAQ,EAAE,cAAc,EACxB,OAAO,GAAE;QAAE,eAAe,EAAE,OAAO,CAAA;KAA+B;IA2BpE,MAAM,CAAC,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;AAygBD,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,12 +357,30 @@ 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* () {
|
|
368
|
+
// 组件系统属性(在 framework/weda-framework.d.ts 的 UserWidget 中筛选一部分)
|
|
369
|
+
const commonProperties = {
|
|
370
|
+
id: {
|
|
371
|
+
type: 'string',
|
|
372
|
+
title: '组件 ID',
|
|
373
|
+
describe: '组件 ID,微搭中一般由编辑器生成'
|
|
374
|
+
},
|
|
375
|
+
module: {
|
|
376
|
+
type: 'string',
|
|
377
|
+
title: '组件库名',
|
|
378
|
+
},
|
|
379
|
+
component: {
|
|
380
|
+
type: 'string',
|
|
381
|
+
title: '组件名',
|
|
382
|
+
}
|
|
383
|
+
};
|
|
350
384
|
const results = yield Promise.all(inputData.map((item) => __awaiter(this, void 0, void 0, function* () {
|
|
351
385
|
// 属性
|
|
352
386
|
let exportPropertiesDTS = '';
|
|
@@ -386,12 +420,22 @@ function _generateOneItemDTS(inputData, itemType) {
|
|
|
386
420
|
// }
|
|
387
421
|
// `
|
|
388
422
|
const interfaceName = _genCompInterfaceName(item.module, item.component);
|
|
423
|
+
if (!item.exportProperties) {
|
|
424
|
+
item.exportProperties = {
|
|
425
|
+
type: 'object',
|
|
426
|
+
properties: {}
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
item.exportProperties.properties = Object.assign({}, commonProperties, item.exportProperties.properties);
|
|
389
430
|
return `
|
|
390
431
|
/**
|
|
391
432
|
${genWeDaCodeComment({
|
|
392
433
|
fieldName: interfaceName,
|
|
393
434
|
schema: item.exportProperties,
|
|
394
|
-
})
|
|
435
|
+
})
|
|
436
|
+
.split('\n')
|
|
437
|
+
.map((item) => `* ${item}`)
|
|
438
|
+
.join('\n')}
|
|
395
439
|
*/
|
|
396
440
|
declare class ${interfaceName} extends UserWidget {
|
|
397
441
|
|
|
@@ -405,10 +449,12 @@ function _generateOneItemDTS(inputData, itemType) {
|
|
|
405
449
|
});
|
|
406
450
|
},
|
|
407
451
|
[IInputDataType.usedWidgets]: function (inputData) {
|
|
408
|
-
return inputData
|
|
452
|
+
return inputData
|
|
453
|
+
.map((item) => {
|
|
409
454
|
if (item.idList && item.idList.length > 0) {
|
|
410
455
|
const interfaceName = _genCompInterfaceName(item.module, item.component);
|
|
411
|
-
return item.idList
|
|
456
|
+
return item.idList
|
|
457
|
+
.map((id) => `
|
|
412
458
|
/**
|
|
413
459
|
${genWeDaCodeComment({
|
|
414
460
|
fieldName: id,
|
|
@@ -417,13 +463,18 @@ function _generateOneItemDTS(inputData, itemType) {
|
|
|
417
463
|
group: GroupEnum.COMPONENT,
|
|
418
464
|
type: 'component',
|
|
419
465
|
baseClass: interfaceName,
|
|
420
|
-
datasource: `$${id}_start$ $${id}_end
|
|
421
|
-
})
|
|
466
|
+
datasource: `$${id}_start$ $${id}_end$`,
|
|
467
|
+
})
|
|
468
|
+
.split('\n')
|
|
469
|
+
.map((item) => `* ${item}`)
|
|
470
|
+
.join('\n')}
|
|
422
471
|
*/
|
|
423
|
-
const ${id}: ${interfaceName}`)
|
|
472
|
+
const ${id}: ${interfaceName}`)
|
|
473
|
+
.join('\n');
|
|
424
474
|
}
|
|
425
475
|
return '';
|
|
426
|
-
})
|
|
476
|
+
})
|
|
477
|
+
.join('\n');
|
|
427
478
|
},
|
|
428
479
|
[IInputDataType.repeaterScope]: function (inputData) {
|
|
429
480
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -447,8 +498,11 @@ function _generateOneItemDTS(inputData, itemType) {
|
|
|
447
498
|
group: GroupEnum.REPEATER,
|
|
448
499
|
type: getDisplayReturnType(itemDataDTS),
|
|
449
500
|
schema: item.itemData,
|
|
450
|
-
subGroup: item.widgetId
|
|
451
|
-
})
|
|
501
|
+
subGroup: item.widgetId,
|
|
502
|
+
})
|
|
503
|
+
.split('\n')
|
|
504
|
+
.map((item) => `* ${item}`)
|
|
505
|
+
.join('\n')}
|
|
452
506
|
*/
|
|
453
507
|
const ${item.currentItemAlias}: ${itemDataDTS}
|
|
454
508
|
/**
|
|
@@ -458,8 +512,11 @@ function _generateOneItemDTS(inputData, itemType) {
|
|
|
458
512
|
description: '',
|
|
459
513
|
group: GroupEnum.REPEATER,
|
|
460
514
|
type: 'number',
|
|
461
|
-
subGroup: item.widgetId
|
|
462
|
-
})
|
|
515
|
+
subGroup: item.widgetId,
|
|
516
|
+
})
|
|
517
|
+
.split('\n')
|
|
518
|
+
.map((item) => `* ${item}`)
|
|
519
|
+
.join('\n')}
|
|
463
520
|
*/
|
|
464
521
|
const ${item.currentIndexAlias}: number
|
|
465
522
|
`;
|
|
@@ -477,7 +534,7 @@ function _generateOneItemDTS(inputData, itemType) {
|
|
|
477
534
|
*/
|
|
478
535
|
replaceRules.push({
|
|
479
536
|
from: new RegExp(`(const ${item.widgetId}): .*`),
|
|
480
|
-
to: `$1: ${widgetInterfaceName}
|
|
537
|
+
to: `$1: ${widgetInterfaceName}`,
|
|
481
538
|
});
|
|
482
539
|
/**
|
|
483
540
|
* 增加类
|
|
@@ -492,7 +549,10 @@ function _generateOneItemDTS(inputData, itemType) {
|
|
|
492
549
|
datasources[id] = {
|
|
493
550
|
fields: [{ name: prop.widgetPropName, title: prop.widgetPropTitle }],
|
|
494
551
|
schema: prop.widgetPropTypeSchema,
|
|
495
|
-
name: prop.datasource.name,
|
|
552
|
+
name: prop.datasource.name,
|
|
553
|
+
title: prop.datasource.title,
|
|
554
|
+
id: prop.datasource.id,
|
|
555
|
+
type: prop.datasource.type,
|
|
496
556
|
};
|
|
497
557
|
}
|
|
498
558
|
else {
|
|
@@ -507,7 +567,7 @@ function _generateOneItemDTS(inputData, itemType) {
|
|
|
507
567
|
let othersFields = [];
|
|
508
568
|
if (multiLevelField) {
|
|
509
569
|
multiLevelFields = prop.widgetPropName.split('.');
|
|
510
|
-
(0,
|
|
570
|
+
(0, set_1.default)(multiLevelFieldObj, prop.widgetPropName, '$$schema$$');
|
|
511
571
|
const [_firstField, ..._othersFields] = multiLevelFields;
|
|
512
572
|
firstField = _firstField;
|
|
513
573
|
othersFields = _othersFields;
|
|
@@ -519,10 +579,15 @@ function _generateOneItemDTS(inputData, itemType) {
|
|
|
519
579
|
title: prop.widgetPropTypeSchema.title,
|
|
520
580
|
description: prop.widgetPropTypeSchema.description,
|
|
521
581
|
group: undefined,
|
|
522
|
-
type: getDisplayReturnType(widgetPropTypeDTS)
|
|
523
|
-
})
|
|
582
|
+
type: getDisplayReturnType(widgetPropTypeDTS),
|
|
583
|
+
})
|
|
584
|
+
.split('\n')
|
|
585
|
+
.map((item) => `* ${item}`)
|
|
586
|
+
.join('\n')}
|
|
524
587
|
*/
|
|
525
|
-
${multiLevelField
|
|
588
|
+
${multiLevelField
|
|
589
|
+
? `${firstField}: Omit<${compInterfaceName}['${firstField}'], '${othersFields.join('.')}'> & ${JSON.stringify(multiLevelFieldObj[firstField]).replace('"$$schema$$"', widgetPropTypeDTS)}`
|
|
590
|
+
: `${prop.widgetPropName}: ${widgetPropTypeDTS}`}
|
|
526
591
|
`;
|
|
527
592
|
})));
|
|
528
593
|
/**
|
|
@@ -533,7 +598,7 @@ function _generateOneItemDTS(inputData, itemType) {
|
|
|
533
598
|
replaceRules.push({
|
|
534
599
|
from: new RegExp(`(\\$${item.widgetId}_start\\$).*(\\$${item.widgetId}_end\\$)`),
|
|
535
600
|
// encodeURIComponent 是为了能正常 parse 成 JSON
|
|
536
|
-
to: `$1${encodeURIComponent(JSON.stringify(datasourceInfoList))}$2
|
|
601
|
+
to: `$1${encodeURIComponent(JSON.stringify(datasourceInfoList))}$2`,
|
|
537
602
|
});
|
|
538
603
|
}
|
|
539
604
|
return `
|
|
@@ -544,7 +609,7 @@ function _generateOneItemDTS(inputData, itemType) {
|
|
|
544
609
|
})));
|
|
545
610
|
return results.join('\n');
|
|
546
611
|
});
|
|
547
|
-
}
|
|
612
|
+
},
|
|
548
613
|
};
|
|
549
614
|
let dts = '';
|
|
550
615
|
if (!inputData)
|
|
@@ -635,20 +700,18 @@ function TypescriptWorker(workerId, workerCode) {
|
|
|
635
700
|
typescriptWorker.onmessage = function (event) {
|
|
636
701
|
const { action } = event.data;
|
|
637
702
|
if (action === 'dts_back') {
|
|
638
|
-
const { data: { id, dts } } = event.data;
|
|
703
|
+
const { data: { id, dts }, } = event.data;
|
|
639
704
|
sendMessageCallbackFn[id] && sendMessageCallbackFn[id](dts);
|
|
640
705
|
}
|
|
641
706
|
};
|
|
642
707
|
typescriptWorkerMap[workerId] = {
|
|
643
708
|
typescriptWorker,
|
|
644
|
-
sendMessageCallbackFn
|
|
709
|
+
sendMessageCallbackFn,
|
|
645
710
|
};
|
|
646
711
|
}
|
|
647
712
|
function sendMessage(msgData, callbackFn) {
|
|
648
713
|
const { typescriptWorker, sendMessageCallbackFn } = typescriptWorkerMap[workerId];
|
|
649
|
-
const id = Math.random()
|
|
650
|
-
.toString(36)
|
|
651
|
-
.substring(2, 5);
|
|
714
|
+
const id = Math.random().toString(36).substring(2, 5);
|
|
652
715
|
msgData.data.id = id;
|
|
653
716
|
sendMessageCallbackFn[id] = callbackFn;
|
|
654
717
|
typescriptWorker.postMessage(msgData);
|
|
@@ -657,22 +720,22 @@ function TypescriptWorker(workerId, workerCode) {
|
|
|
657
720
|
};
|
|
658
721
|
}
|
|
659
722
|
/**
|
|
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
|
-
*/
|
|
723
|
+
* 使用:
|
|
724
|
+
* const typescriptWorker = getTypescriptWorker();
|
|
725
|
+
* typescriptWorker.sendMessage({ action: 'dts', data: { code } }, dts => {
|
|
726
|
+
*
|
|
727
|
+
* })
|
|
728
|
+
* // 以下暂未实现
|
|
729
|
+
* typescriptWorker.sendMessage({ action: 'ts', data: { code } }, ts => {
|
|
730
|
+
*
|
|
731
|
+
* })
|
|
732
|
+
*/
|
|
670
733
|
const getTypescriptWorker = TypescriptWorker('transpileToDTS', exports.workerCode);
|
|
671
734
|
/**
|
|
672
735
|
* 通过 js/ts 代码生成 dts
|
|
673
736
|
*/
|
|
674
737
|
function transpileToDTS(code) {
|
|
675
|
-
return new Promise(resolve => {
|
|
738
|
+
return new Promise((resolve) => {
|
|
676
739
|
const typescriptWorker = getTypescriptWorker();
|
|
677
740
|
typescriptWorker.sendMessage({ action: 'dts', data: { code } }, (dts) => {
|
|
678
741
|
resolve(dts);
|
|
@@ -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) {
|