@cloudbase/cals 0.3.27 → 0.3.30-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 +3 -1
- package/lib/parser/cals/index.d.ts.map +1 -1
- package/lib/parser/cals/index.js +43 -66
- package/lib/parser/cals/utils/common.d.ts.map +1 -1
- package/lib/parser/cals/utils/common.js +6 -12
- package/lib/parser/cals/utils/runtime.d.ts.map +1 -1
- package/lib/parser/cals/utils/runtime.js +21 -17
- package/lib/parser/cals/utils/transform/index.d.ts +4 -0
- package/lib/parser/cals/utils/transform/index.d.ts.map +1 -0
- package/lib/parser/cals/utils/transform/index.js +247 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/lcds.d.ts +30 -0
- package/lib/types/lcds.d.ts.map +1 -1
- package/lib/types/platform/common.d.ts +13 -1
- package/lib/types/platform/common.d.ts.map +1 -1
- package/lib/types/platform/common.js +4 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { getUsedComps } from './utils/common';
|
|
2
1
|
import { IAttributes, IPlatformApp, IComplexComponent, IBasicComponent, IPageComponent, IDataSourceVariable, IDataVarMethod, // 勿删,为了生成d.ts
|
|
3
2
|
IPlatformDataSource, IDependencies, LCDS } from '../../types';
|
|
4
3
|
import { IDynamicValue, PropBindType } from '../expression';
|
|
4
|
+
export { getUsedComps } from './utils/common';
|
|
5
5
|
interface IDeserializeContext {
|
|
6
6
|
app?: IPlatformApp;
|
|
7
7
|
dependencies?: any[];
|
|
@@ -166,6 +166,7 @@ export declare function deserializePage(ctx: {
|
|
|
166
166
|
};
|
|
167
167
|
isCapturePhase: boolean;
|
|
168
168
|
noPropagation: boolean;
|
|
169
|
+
extra: object;
|
|
169
170
|
}[];
|
|
170
171
|
};
|
|
171
172
|
/**
|
|
@@ -236,6 +237,7 @@ export declare function deserializePlatformApp(data: IPlatformApp, optsions: {
|
|
|
236
237
|
};
|
|
237
238
|
isCapturePhase: boolean;
|
|
238
239
|
noPropagation: boolean;
|
|
240
|
+
extra: object;
|
|
239
241
|
}[];
|
|
240
242
|
}[];
|
|
241
243
|
lowCodes: {
|
|
@@ -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":"AAIA,OAAO,EACL,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,cAAc,EAGd,mBAAmB,EACnB,cAAc,EAAE,cAAc;AAC9B,mBAAmB,EACnB,aAAa,EACb,IAAI,EACL,MAAM,aAAa,CAAC;AAErB,OAAO,EAAkC,aAAa,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAc5F,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,UAAU,mBAAmB;IAC3B,GAAG,CAAC,EAAE,YAAY,CAAC;IACnB,YAAY,CAAC,EAAE,GAAG,EAAE,CAAC;IACrB,eAAe,CAAC,EAAE,GAAG,CAAC;IACtB,IAAI,CAAC,EAAE,cAAc,CAAC;CACvB;AAED,UAAU,iBAAiB;IACzB,GAAG,CAAC,EAAE,GAAG,CAAC;IACV,IAAI,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IACtB,SAAS,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAChE;;;OAGG;IACH,YAAY,CAAC,EAAE,GAAG,EAAE,CAAC;IACrB,eAAe,CAAC,EAAE,GAAG,CAAC;IACtB,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,wBAAgB,cAAc,CAAC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ACD,SAAS,EAAE,GAAG,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,GAC9B,eAAe,GAAG,iBAAiB,CAmHrC;AAED;;;;GAIG;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;;;EA8BvB"}
|
package/lib/parser/cals/index.js
CHANGED
|
@@ -14,16 +14,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
14
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 = exports.getUsedComps = void 0;
|
|
15
15
|
const lodash_1 = require("lodash");
|
|
16
16
|
const common_1 = require("../../types/platform/common");
|
|
17
|
-
var common_2 = require("./utils/common");
|
|
18
|
-
Object.defineProperty(exports, "getUsedComps", { enumerable: true, get: function () { return common_2.getUsedComps; } });
|
|
19
17
|
const expression_1 = require("../expression");
|
|
20
|
-
const
|
|
18
|
+
const common_2 = require("./utils/common");
|
|
21
19
|
const style_1 = require("./utils/style");
|
|
22
20
|
const runtime_1 = require("./utils/runtime");
|
|
23
21
|
const config_1 = require("./utils/version/config");
|
|
22
|
+
var common_3 = require("./utils/common");
|
|
23
|
+
Object.defineProperty(exports, "getUsedComps", { enumerable: true, get: function () { return common_3.getUsedComps; } });
|
|
24
24
|
function serializeValue({ ctx, key, dynamicValue, scope = 'page', streamlineDefaultValue, }) {
|
|
25
25
|
var _a, _b;
|
|
26
|
-
let value = dynamicValue
|
|
26
|
+
let { value } = dynamicValue;
|
|
27
27
|
let { dependenciesMap = {} } = ctx;
|
|
28
28
|
if (dynamicValue.type && dynamicValue.type !== 'static') {
|
|
29
29
|
key = `:${key}`;
|
|
@@ -80,8 +80,7 @@ function serializeValue({ ctx, key, dynamicValue, scope = 'page', streamlineDefa
|
|
|
80
80
|
let { module = '', component = '' } = ctx.component || {};
|
|
81
81
|
let sourceKey = `${module}:${component}`;
|
|
82
82
|
let config = (_b = (_a = dependenciesMap === null || dependenciesMap === void 0 ? void 0 : dependenciesMap[sourceKey]) === null || _a === void 0 ? void 0 : _a.dataForm) === null || _b === void 0 ? void 0 : _b[key];
|
|
83
|
-
if ((config === null || config === void 0 ? void 0 : config.default) === value ||
|
|
84
|
-
(config && config.default === undefined && value === '')) {
|
|
83
|
+
if ((config === null || config === void 0 ? void 0 : config.default) === value || (config && config.default === undefined && value === '')) {
|
|
85
84
|
value = undefined;
|
|
86
85
|
}
|
|
87
86
|
}
|
|
@@ -110,9 +109,7 @@ function deserializeValue(ctx, key, value, extra) {
|
|
|
110
109
|
else {
|
|
111
110
|
type = expression_1.PropBindType.expression;
|
|
112
111
|
try {
|
|
113
|
-
value = value
|
|
114
|
-
.replace(/\$app\./g, 'app.')
|
|
115
|
-
.replace(/\$for./g, 'forItems.');
|
|
112
|
+
value = value.replace(/\$app\./g, 'app.').replace(/\$for./g, 'forItems.');
|
|
116
113
|
}
|
|
117
114
|
catch (e) { }
|
|
118
115
|
}
|
|
@@ -128,7 +125,7 @@ function deserializeValue(ctx, key, value, extra) {
|
|
|
128
125
|
value: value === undefined
|
|
129
126
|
? undefined
|
|
130
127
|
: {
|
|
131
|
-
type: undefined /*'static'*/,
|
|
128
|
+
type: undefined /* 'static'*/,
|
|
132
129
|
value,
|
|
133
130
|
extra,
|
|
134
131
|
},
|
|
@@ -172,8 +169,7 @@ function serializeDynamicMapWithExtra({ ctx, map = {}, scope = 'page', streamlin
|
|
|
172
169
|
}
|
|
173
170
|
if ((0, lodash_1.get)(data, processedKey) == undefined) {
|
|
174
171
|
/* 选区结构处理 [formily] to [CALS] */
|
|
175
|
-
if (Array.isArray(processedValue) &&
|
|
176
|
-
(processedValue === null || processedValue === void 0 ? void 0 : processedValue.some((item) => item && item.selectableBlock))) {
|
|
172
|
+
if (Array.isArray(processedValue) && (processedValue === null || processedValue === void 0 ? void 0 : processedValue.some((item) => !!(item === null || item === void 0 ? void 0 : item.selectableBlock)))) {
|
|
177
173
|
let valueTmp = (0, lodash_1.cloneDeep)(processedValue);
|
|
178
174
|
processedValue = valueTmp === null || valueTmp === void 0 ? void 0 : valueTmp.map((_value) => {
|
|
179
175
|
var _a, _b, _c;
|
|
@@ -203,8 +199,7 @@ function deserializeDynamicMap(ctx, map, extraMap) {
|
|
|
203
199
|
let matched = key.match(DYNAMIC_KEY_REG);
|
|
204
200
|
let { key: processedKey, value: processedValue } = deserializeValue(ctx, key, value, extraMap === null || extraMap === void 0 ? void 0 : extraMap[matched ? matched[1] : key]);
|
|
205
201
|
/* 选区结构处理 [CALS] to [formily] */
|
|
206
|
-
if (Array.isArray(processedValue === null || processedValue === void 0 ? void 0 : processedValue.value) &&
|
|
207
|
-
((_b = processedValue === null || processedValue === void 0 ? void 0 : processedValue.value) === null || _b === void 0 ? void 0 : _b.some((item) => item && item.selectableBlock))) {
|
|
202
|
+
if (Array.isArray(processedValue === null || processedValue === void 0 ? void 0 : processedValue.value) && ((_b = processedValue === null || processedValue === void 0 ? void 0 : processedValue.value) === null || _b === void 0 ? void 0 : _b.some((item) => !!(item === null || item === void 0 ? void 0 : item.selectableBlock)))) {
|
|
208
203
|
let valueTmp = (0, lodash_1.cloneDeep)(processedValue);
|
|
209
204
|
(_c = valueTmp === null || valueTmp === void 0 ? void 0 : valueTmp.value) === null || _c === void 0 ? void 0 : _c.forEach((_value) => {
|
|
210
205
|
var _a, _b, _c, _d;
|
|
@@ -316,8 +311,7 @@ function isDatasetNeedToProcess(dataset) {
|
|
|
316
311
|
return false;
|
|
317
312
|
const hasNoParams = Object.values(dataset.state).every((item) => {
|
|
318
313
|
var _a, _b;
|
|
319
|
-
return
|
|
320
|
-
!(((_a = item.initMethod) === null || _a === void 0 ? void 0 : _a.params) || ((_b = item.updateMethod) === null || _b === void 0 ? void 0 : _b.params)));
|
|
314
|
+
return item.varType !== 'datasource' || !(((_a = item.initMethod) === null || _a === void 0 ? void 0 : _a.params) || ((_b = item.updateMethod) === null || _b === void 0 ? void 0 : _b.params));
|
|
321
315
|
});
|
|
322
316
|
if (hasNoParams)
|
|
323
317
|
return false;
|
|
@@ -352,12 +346,8 @@ function serializeDirecties(ctx, directives, scope = 'page') {
|
|
|
352
346
|
return undefined;
|
|
353
347
|
}
|
|
354
348
|
function deserializeDirecties(ctx, directives) {
|
|
355
|
-
let waIf = (directives === null || directives === void 0 ? void 0 : directives[':if']) != undefined
|
|
356
|
-
|
|
357
|
-
: { value: true };
|
|
358
|
-
let waFor = (directives === null || directives === void 0 ? void 0 : directives[':for'])
|
|
359
|
-
? deserializeValue(ctx, ':for', directives[':for']).value
|
|
360
|
-
: undefined;
|
|
349
|
+
let waIf = (directives === null || directives === void 0 ? void 0 : directives[':if']) != undefined ? deserializeValue(ctx, ':if', directives[':if']).value : { value: true };
|
|
350
|
+
let waFor = (directives === null || directives === void 0 ? void 0 : directives[':for']) ? deserializeValue(ctx, ':for', directives[':for']).value : undefined;
|
|
361
351
|
if (waFor) {
|
|
362
352
|
let { type, value } = waFor;
|
|
363
353
|
if (type === expression_1.PropBindType.expression) {
|
|
@@ -366,7 +356,7 @@ function deserializeDirecties(ctx, directives) {
|
|
|
366
356
|
}
|
|
367
357
|
let processed = {
|
|
368
358
|
waIf: (waIf === null || waIf === void 0 ? void 0 : waIf.value) === true ? undefined : waIf,
|
|
369
|
-
waFor
|
|
359
|
+
waFor,
|
|
370
360
|
};
|
|
371
361
|
for (let key in processed) {
|
|
372
362
|
let map = processed;
|
|
@@ -388,19 +378,18 @@ function serializeListener(ctx, listener) {
|
|
|
388
378
|
type: listener.type,
|
|
389
379
|
handler: {
|
|
390
380
|
name: listener.handler.name,
|
|
391
|
-
module: /^comp
|
|
392
|
-
? '$comp'
|
|
393
|
-
: listener.handler.moduleName,
|
|
381
|
+
module: /^comp-\w+$/.test(listener.handler.moduleName) ? '$comp' : listener.handler.moduleName,
|
|
394
382
|
params: (_a = serializeDynamicMapWithExtra({
|
|
395
383
|
ctx,
|
|
396
384
|
map: listener.data,
|
|
397
385
|
})) === null || _a === void 0 ? void 0 : _a.data,
|
|
386
|
+
extra: listener === null || listener === void 0 ? void 0 : listener.extra,
|
|
398
387
|
},
|
|
399
388
|
isCapturePhase: listener.isCapturePhase,
|
|
400
389
|
};
|
|
401
390
|
}
|
|
402
391
|
function deserializeListener(ctx, listener) {
|
|
403
|
-
var _a, _b, _c;
|
|
392
|
+
var _a, _b, _c, _d;
|
|
404
393
|
let processed = {
|
|
405
394
|
key: listener.id,
|
|
406
395
|
trigger: listener.eventName,
|
|
@@ -413,6 +402,7 @@ function deserializeListener(ctx, listener) {
|
|
|
413
402
|
isCapturePhase: !!listener.isCapturePhase,
|
|
414
403
|
// TODO
|
|
415
404
|
noPropagation: !!listener.noPropagation,
|
|
405
|
+
extra: (_d = listener.handler) === null || _d === void 0 ? void 0 : _d.extra,
|
|
416
406
|
};
|
|
417
407
|
return processed;
|
|
418
408
|
}
|
|
@@ -518,7 +508,7 @@ function serializeComponent(ctx, component, scope = 'page') {
|
|
|
518
508
|
scope,
|
|
519
509
|
});
|
|
520
510
|
if (classListBindData.extra) {
|
|
521
|
-
attributeExtraData
|
|
511
|
+
attributeExtraData.class = classListBindData.extra;
|
|
522
512
|
}
|
|
523
513
|
}
|
|
524
514
|
if ((_g = component === null || component === void 0 ? void 0 : component.xProps) === null || _g === void 0 ? void 0 : _g.styleBind) {
|
|
@@ -528,7 +518,7 @@ function serializeComponent(ctx, component, scope = 'page') {
|
|
|
528
518
|
dynamicValue: (_h = component === null || component === void 0 ? void 0 : component.xProps) === null || _h === void 0 ? void 0 : _h.styleBind,
|
|
529
519
|
});
|
|
530
520
|
if (styleBindData.extra) {
|
|
531
|
-
attributeExtraData
|
|
521
|
+
attributeExtraData.style = styleBindData.extra;
|
|
532
522
|
}
|
|
533
523
|
}
|
|
534
524
|
return {
|
|
@@ -557,9 +547,7 @@ function serializeComponent(ctx, component, scope = 'page') {
|
|
|
557
547
|
xIndex: component.xIndex,
|
|
558
548
|
styleBindPath: (_r = component === null || component === void 0 ? void 0 : component.xProps) === null || _r === void 0 ? void 0 : _r.styleBindPath,
|
|
559
549
|
staticResourceAttribute: (_s = component === null || component === void 0 ? void 0 : component.xProps) === null || _s === void 0 ? void 0 : _s.staticResourceAttribute,
|
|
560
|
-
attributeExtraData: (0,
|
|
561
|
-
? undefined
|
|
562
|
-
: attributeExtraData,
|
|
550
|
+
attributeExtraData: (0, common_2.isEmptyObj)(attributeExtraData) ? undefined : attributeExtraData,
|
|
563
551
|
},
|
|
564
552
|
};
|
|
565
553
|
}
|
|
@@ -569,12 +557,10 @@ function deserializeComponent(ctx, components) {
|
|
|
569
557
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
570
558
|
const { attributeExtraData = {} } = item.extra || {};
|
|
571
559
|
let dynamicStyle = item[':style']
|
|
572
|
-
? deserializeValue(ctx, ':style', item[':style'], attributeExtraData
|
|
573
|
-
).value
|
|
560
|
+
? deserializeValue(ctx, ':style', item[':style'], attributeExtraData.style).value
|
|
574
561
|
: undefined;
|
|
575
562
|
let dynamicClassList = item[':class']
|
|
576
|
-
? deserializeValue(ctx, ':class', item[':class'], attributeExtraData
|
|
577
|
-
).value
|
|
563
|
+
? deserializeValue(ctx, ':class', item[':class'], attributeExtraData.class).value
|
|
578
564
|
: undefined;
|
|
579
565
|
const xComponent = {
|
|
580
566
|
moduleName: item.module,
|
|
@@ -582,8 +568,7 @@ function deserializeComponent(ctx, components) {
|
|
|
582
568
|
};
|
|
583
569
|
if (xComponent.name) {
|
|
584
570
|
xComponent.moduleName =
|
|
585
|
-
deserializeModuleName(ctx, xComponent.name, xComponent.moduleName) ||
|
|
586
|
-
xComponent.moduleName;
|
|
571
|
+
deserializeModuleName(ctx, xComponent.name, xComponent.moduleName) || xComponent.moduleName;
|
|
587
572
|
}
|
|
588
573
|
const xProps = {
|
|
589
574
|
data: deserializeAttributes(ctx, item.attributes, attributeExtraData),
|
|
@@ -609,26 +594,20 @@ function deserializeComponent(ctx, components) {
|
|
|
609
594
|
})) || [],
|
|
610
595
|
};
|
|
611
596
|
let processed = {
|
|
612
|
-
xComponent: Object.values(xComponent).find((item) => item != undefined)
|
|
613
|
-
? xComponent
|
|
614
|
-
: undefined,
|
|
597
|
+
xComponent: Object.values(xComponent).find((item) => item != undefined) ? xComponent : undefined,
|
|
615
598
|
xProps: Object.values(xProps).find((item) => {
|
|
616
599
|
if (Array.isArray(item)) {
|
|
617
600
|
return !!item.length;
|
|
618
601
|
}
|
|
619
|
-
return item != undefined && !(0,
|
|
602
|
+
return item != undefined && !(0, common_2.isEmptyObj)(item);
|
|
620
603
|
})
|
|
621
604
|
? xProps
|
|
622
605
|
: undefined,
|
|
623
606
|
/**
|
|
624
607
|
* TODO
|
|
625
608
|
*/
|
|
626
|
-
xIndex: ((_h = item.extra) === null || _h === void 0 ? void 0 : _h.xIndex) !== undefined
|
|
627
|
-
|
|
628
|
-
: undefined /*0*/,
|
|
629
|
-
properties: item.items
|
|
630
|
-
? deserializeComponent(ctx, item.items)
|
|
631
|
-
: undefined,
|
|
609
|
+
xIndex: ((_h = item.extra) === null || _h === void 0 ? void 0 : _h.xIndex) !== undefined ? (_j = item.extra) === null || _j === void 0 ? void 0 : _j.xIndex : undefined /* 0*/,
|
|
610
|
+
properties: item.items ? deserializeComponent(ctx, item.items) : undefined,
|
|
632
611
|
};
|
|
633
612
|
map[item.id] = processed;
|
|
634
613
|
return map;
|
|
@@ -685,7 +664,7 @@ function serializePage(ctx, page) {
|
|
|
685
664
|
exports.serializePage = serializePage;
|
|
686
665
|
function deserializePage(ctx, page) {
|
|
687
666
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
688
|
-
let pageCtx = Object.assign(Object.assign({}, ctx), { page
|
|
667
|
+
let pageCtx = Object.assign(Object.assign({}, ctx), { page });
|
|
689
668
|
return {
|
|
690
669
|
id: page.id,
|
|
691
670
|
isHome: page.id === ctx.homePageId,
|
|
@@ -730,7 +709,7 @@ function serializePlatformApp(data, optsions) {
|
|
|
730
709
|
label: label || extraLabel,
|
|
731
710
|
name: name || extraName,
|
|
732
711
|
author: author || extraAuthor,
|
|
733
|
-
version
|
|
712
|
+
version,
|
|
734
713
|
description: description || extraDescription,
|
|
735
714
|
main: homePage ? homePage.id : ((_a = pageInstanceList === null || pageInstanceList === void 0 ? void 0 : pageInstanceList[0]) === null || _a === void 0 ? void 0 : _a.id) || selectedPageId,
|
|
736
715
|
items: pageInstanceList === null || pageInstanceList === void 0 ? void 0 : pageInstanceList.map((page) => serializePage(ctx, page)),
|
|
@@ -784,11 +763,11 @@ function deserializePlatformApp(data, optsions) {
|
|
|
784
763
|
compHiddenConfig: compHiddenConfig || {},
|
|
785
764
|
npmDependencies: npmDependencies || {},
|
|
786
765
|
plugins: plugins || [],
|
|
787
|
-
maxID
|
|
788
|
-
rootPath
|
|
789
|
-
themeVars
|
|
766
|
+
maxID,
|
|
767
|
+
rootPath,
|
|
768
|
+
themeVars,
|
|
790
769
|
presetColors: presetColors || [],
|
|
791
|
-
appConfig
|
|
770
|
+
appConfig,
|
|
792
771
|
miniprogramPlugins,
|
|
793
772
|
extra: Object.assign(Object.assign({}, restExtra), { name: data.name, author: data.author, description: data.description }),
|
|
794
773
|
dependencies: data.dependencies,
|
|
@@ -802,8 +781,7 @@ exports.deserializePlatformApp = deserializePlatformApp;
|
|
|
802
781
|
* page
|
|
803
782
|
* [formily] to [CALS]
|
|
804
783
|
*/
|
|
805
|
-
function serializeRuntimePage(ctx, page
|
|
806
|
-
) {
|
|
784
|
+
function serializeRuntimePage(ctx, page) {
|
|
807
785
|
var _a, _b, _c, _d, _e, _f;
|
|
808
786
|
const pageCtx = Object.assign(Object.assign({}, ctx), { dependenciesMap: processDependenciesMap(ctx.dependencies || []), page: { id: page.id } });
|
|
809
787
|
let processedPage = {
|
|
@@ -828,15 +806,14 @@ function serializeRuntimePage(ctx, page //IPageInstance
|
|
|
828
806
|
children: (0, runtime_1.getValidValue)((_f = page.children) === null || _f === void 0 ? void 0 : _f.map((child) => serializeRuntimePage(ctx, child))),
|
|
829
807
|
},
|
|
830
808
|
};
|
|
831
|
-
if ((0,
|
|
809
|
+
if ((0, common_2.isValidStyleBind)(page.styleBind) && (0, runtime_1.getValidValue)(page.styleBind)) {
|
|
832
810
|
page[':style'] = serializeValue({
|
|
833
811
|
ctx: pageCtx,
|
|
834
812
|
key: 'styleBind',
|
|
835
813
|
dynamicValue: page.styleBind,
|
|
836
814
|
}).value;
|
|
837
815
|
}
|
|
838
|
-
if ((0,
|
|
839
|
-
(0, runtime_1.getValidValue)(page.classListBind)) {
|
|
816
|
+
if ((0, common_2.isValidClassNameListBind)(page.classListBind) && (0, runtime_1.getValidValue)(page.classListBind)) {
|
|
840
817
|
page[':class'] = serializeValue({
|
|
841
818
|
ctx: pageCtx,
|
|
842
819
|
key: 'classListBind',
|
|
@@ -858,8 +835,7 @@ exports.serializeRuntimePage = serializeRuntimePage;
|
|
|
858
835
|
* component
|
|
859
836
|
* [formily] to [CALS]
|
|
860
837
|
*/
|
|
861
|
-
function serializeRuntimeComponent(ctx, component
|
|
862
|
-
) {
|
|
838
|
+
function serializeRuntimeComponent(ctx, component) {
|
|
863
839
|
var _a, _b, _c;
|
|
864
840
|
if (!component.id) {
|
|
865
841
|
component.id = component.key;
|
|
@@ -898,7 +874,7 @@ function serializeRuntimeComponent(ctx, component //IComponentSchemaJson
|
|
|
898
874
|
attributeExtraData.style = styleBindData === null || styleBindData === void 0 ? void 0 : styleBindData.extra;
|
|
899
875
|
}
|
|
900
876
|
}
|
|
901
|
-
if ((0,
|
|
877
|
+
if ((0, common_2.isValidClassNameListBind)(props.classNameListBind)) {
|
|
902
878
|
classListBindData = serializeValue({
|
|
903
879
|
ctx: componentCtx,
|
|
904
880
|
key: 'classListBind',
|
|
@@ -913,6 +889,7 @@ function serializeRuntimeComponent(ctx, component //IComponentSchemaJson
|
|
|
913
889
|
}
|
|
914
890
|
processed = Object.assign(Object.assign({}, processed), { module: serializeModuleName(componentCtx, moduleName, name), component: name, attributes: Object.assign(Object.assign({}, attributes), { style: (0, runtime_1.getValidValue)(props.style), class: (_b = (0, runtime_1.getValidValue)(props.classNameList)) === null || _b === void 0 ? void 0 : _b.join(' ') }), items: (0, runtime_1.getValidValue)(Object.keys(properties)
|
|
915
891
|
.filter((key) => !excludeKeys.includes(key))
|
|
892
|
+
.sort((a, b) => properties[a]['x-index'] - properties[b]['x-index'])
|
|
916
893
|
.map((key) => serializeRuntimeComponent(ctx, Object.assign({ id: key }, properties[key])))), listeners: (_c = (0, runtime_1.getValidValue)((0, runtime_1.readListeners)(props.listenerInstances))) === null || _c === void 0 ? void 0 : _c.map((listener /* IEventListener */) => {
|
|
917
894
|
return serializeListener(componentCtx, listener);
|
|
918
895
|
}), directives: serializeDirecties(componentCtx, ((0, runtime_1.getValidValue)((0, runtime_1.readDirectives)(props)) || {})) || undefined, ':class': (classListBindData === null || classListBindData === void 0 ? void 0 : classListBindData.value) || undefined, ':style': (styleBindData === null || styleBindData === void 0 ? void 0 : styleBindData.value) || undefined, extra: {
|
|
@@ -920,13 +897,13 @@ function serializeRuntimeComponent(ctx, component //IComponentSchemaJson
|
|
|
920
897
|
xIndex: (0, runtime_1.getValidValue)(component['x-index']),
|
|
921
898
|
styleBindPath: (0, runtime_1.getValidValue)(props.styleBindPath),
|
|
922
899
|
staticResourceAttribute: (0, runtime_1.getValidValue)(props.staticResourceAttribute),
|
|
923
|
-
attributeExtraData: (0,
|
|
924
|
-
? undefined
|
|
925
|
-
: attributeExtraData,
|
|
900
|
+
attributeExtraData: (0, common_2.isEmptyObj)(attributeExtraData) ? undefined : attributeExtraData,
|
|
926
901
|
} });
|
|
927
902
|
}
|
|
928
903
|
else {
|
|
929
|
-
let items = Object.keys(component.properties || {})
|
|
904
|
+
let items = Object.keys(component.properties || {})
|
|
905
|
+
.sort((a, b) => component.properties[a]['x-index'] - component.properties[b]['x-index'])
|
|
906
|
+
.map((key) => serializeRuntimeComponent(ctx, Object.assign({ id: key }, component.properties[key])));
|
|
930
907
|
processed = Object.assign(Object.assign({}, processed), { items: (0, runtime_1.getValidValue)(items) });
|
|
931
908
|
}
|
|
932
909
|
return processed;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../parser/cals/utils/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../parser/cals/utils/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAYnD,aAAK,UAAU,GAAG;IAAE,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAAA;CAAE,CAAC;AAGrD,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,cAAc,UAAQ,UAQ5D;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,WAErC;AAED,eAAO,MAAM,UAAU,QAAS,MAAM,YAUrC,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,SAAS,WAQpD;AAED,wBAAgB,wBAAwB,CAAC,iBAAiB,EAAE,SAAS,WAQpE;AAyED,wBAAgB,YAAY,CAE1B,IAAI,EAAE,GAAG,EAAE,EAEX,KAAK,EAAE,GAAG,EAAE,GACX,UAAU,CA6CZ"}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getUsedComps = exports.isValidClassNameListBind = exports.isValidStyleBind = exports.isEmptyObj = exports.isPlainObject = exports.camelcase = void 0;
|
|
4
4
|
const index_1 = require("../index");
|
|
5
5
|
function camelcase(str, firstUpperCase = false) {
|
|
6
|
-
str = str.replace(/[_-]([a-z])/g,
|
|
6
|
+
str = str.replace(/[_-]([a-z])/g, (l) => {
|
|
7
7
|
return l[1].toUpperCase();
|
|
8
8
|
});
|
|
9
9
|
if (firstUpperCase)
|
|
@@ -89,7 +89,7 @@ addedUsedComps) {
|
|
|
89
89
|
const cmp = lib.components.find((c) => c.name === cmpName);
|
|
90
90
|
if (!cmp) {
|
|
91
91
|
// 找不到复合组件内容, 应该抛异常
|
|
92
|
-
console.warn('Component not found', libName
|
|
92
|
+
console.warn('Component not found', `${libName}:${cmpName}`);
|
|
93
93
|
return;
|
|
94
94
|
}
|
|
95
95
|
if (checkedComps.indexOf(cmp) > -1) {
|
|
@@ -122,12 +122,12 @@ apps,
|
|
|
122
122
|
// 分库后的组件库 denpendienicy
|
|
123
123
|
comps) {
|
|
124
124
|
// 0. 应用内容转换(cals to weapps)
|
|
125
|
-
const transferApps = apps.map(app => {
|
|
125
|
+
const transferApps = apps.map((app) => {
|
|
126
126
|
return (0, index_1.deserializePlatformApp)(app, { dependencies: comps });
|
|
127
127
|
});
|
|
128
128
|
// 1. 寻找应用内容里用到的所有组件
|
|
129
129
|
// 1.1 寻找主子应用各自的内容里所用到的组件
|
|
130
|
-
const appUsedComps = transferApps.map(app => {
|
|
130
|
+
const appUsedComps = transferApps.map((app) => {
|
|
131
131
|
var _a;
|
|
132
132
|
const usedComps = {};
|
|
133
133
|
// 主子包模式下, 可能没有应用内容
|
|
@@ -139,10 +139,7 @@ comps) {
|
|
|
139
139
|
// 1.2 合并主子包所有用到的组件
|
|
140
140
|
const mergeAppUsedComps = appUsedComps.reduce((comps, item) => {
|
|
141
141
|
for (const libName in item) {
|
|
142
|
-
comps[libName] = new Set([
|
|
143
|
-
...Array.from(item[libName]),
|
|
144
|
-
...Array.from(comps[libName] || [])
|
|
145
|
-
]);
|
|
142
|
+
comps[libName] = new Set([...Array.from(item[libName]), ...Array.from(comps[libName] || [])]);
|
|
146
143
|
}
|
|
147
144
|
return comps;
|
|
148
145
|
}, {});
|
|
@@ -160,10 +157,7 @@ comps) {
|
|
|
160
157
|
// 3. 合并[应用内容用到的组件]和[复合组件库用到的组件]
|
|
161
158
|
const allUsedComps = [mergeAppUsedComps, libUsedComps].reduce((comps, item) => {
|
|
162
159
|
for (const libName in item) {
|
|
163
|
-
comps[libName] = new Set([
|
|
164
|
-
...Array.from(item[libName]),
|
|
165
|
-
...Array.from(comps[libName] || [])
|
|
166
|
-
]);
|
|
160
|
+
comps[libName] = new Set([...Array.from(item[libName]), ...Array.from(comps[libName] || [])]);
|
|
167
161
|
}
|
|
168
162
|
return comps;
|
|
169
163
|
}, {});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../parser/cals/utils/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAA2B,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../parser/cals/utils/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAA2B,MAAM,kBAAkB,CAAC;AAK1E,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,OAkCtC;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,OAkB1D;AAED,wBAAgB,cAAc,CAAC,SAAS,GAAE,GAAG,EAAO,SAgBnD;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"}
|
|
@@ -6,6 +6,7 @@ const style_1 = require("./style");
|
|
|
6
6
|
const common_1 = require("./common");
|
|
7
7
|
const lodash_1 = require("lodash");
|
|
8
8
|
function readComponents(properties = {}, excludeKeys = []) {
|
|
9
|
+
var _a;
|
|
9
10
|
const cmps = {};
|
|
10
11
|
for (const key in properties) {
|
|
11
12
|
if (excludeKeys.indexOf(key) > -1) {
|
|
@@ -27,7 +28,7 @@ function readComponents(properties = {}, excludeKeys = []) {
|
|
|
27
28
|
setValidValue(componentXProps, 'style', srcProps.style);
|
|
28
29
|
setValidValue(componentXProps, 'commonStyle', (0, style_1.removeInvalidStyleFormValue)(srcProps.commonStyle));
|
|
29
30
|
setValidValue(componentXProps, 'styleBindPath', srcProps.styleBindPath);
|
|
30
|
-
if (srcProps.styleBind
|
|
31
|
+
if ((_a = srcProps.styleBind) === null || _a === void 0 ? void 0 : _a.bindDataPath) {
|
|
31
32
|
componentXProps.styleBind = {
|
|
32
33
|
type: srcProps.styleBind.type,
|
|
33
34
|
value: srcProps.styleBind.bindDataPath,
|
|
@@ -60,6 +61,7 @@ function readComponents(properties = {}, excludeKeys = []) {
|
|
|
60
61
|
}
|
|
61
62
|
exports.readComponents = readComponents;
|
|
62
63
|
function readDirectives(cmp) {
|
|
64
|
+
var _a;
|
|
63
65
|
const directives = {};
|
|
64
66
|
// 默认为 true,节省体积不记录
|
|
65
67
|
if (cmp.data && cmp.data._visible !== true) {
|
|
@@ -67,7 +69,7 @@ function readDirectives(cmp) {
|
|
|
67
69
|
value: cmp.data._visible,
|
|
68
70
|
};
|
|
69
71
|
}
|
|
70
|
-
if (cmp.dataBinds
|
|
72
|
+
if ((_a = cmp.dataBinds) === null || _a === void 0 ? void 0 : _a.length) {
|
|
71
73
|
const bind = cmp.dataBinds.find((bind) => bind.propertyPath === '_visible');
|
|
72
74
|
if (bind) {
|
|
73
75
|
const foundDataType = (cmp.dataTypes || []).find((dataType) => dataType.propertyPath === bind.propertyPath);
|
|
@@ -92,6 +94,7 @@ function readDirectives(cmp) {
|
|
|
92
94
|
}
|
|
93
95
|
exports.readDirectives = readDirectives;
|
|
94
96
|
function readDynamicData(cmp) {
|
|
97
|
+
var _a, _b;
|
|
95
98
|
const data = {};
|
|
96
99
|
const ignoredProps = ['_visible', '_waFor'];
|
|
97
100
|
// Read data
|
|
@@ -103,20 +106,19 @@ function readDynamicData(cmp) {
|
|
|
103
106
|
data[prop] = { value: cmp.data[prop] };
|
|
104
107
|
}
|
|
105
108
|
// Read data binds
|
|
106
|
-
cmp.dataBinds
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
});
|
|
109
|
+
(_b = (_a = cmp.dataBinds) === null || _a === void 0 ? void 0 : _a.forEach) === null || _b === void 0 ? void 0 : _b.call(_a, (bind) => {
|
|
110
|
+
if (ignoredProps.indexOf(bind.propertyPath) > -1) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
const foundDataType = (cmp.dataTypes || []).find((dataType) => dataType.propertyPath === bind.propertyPath);
|
|
114
|
+
if (foundDataType && foundDataType.type === 'bind') {
|
|
115
|
+
data[bind.propertyPath] = {
|
|
116
|
+
type: bind.type || expression_1.PropBindType.state,
|
|
117
|
+
value: bind.bindDataPath,
|
|
118
|
+
extra: bind.extra,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
});
|
|
120
122
|
return data;
|
|
121
123
|
}
|
|
122
124
|
exports.readDynamicData = readDynamicData;
|
|
@@ -132,6 +134,7 @@ function readListeners(listenerInstances = []) {
|
|
|
132
134
|
name: fromParts[1],
|
|
133
135
|
},
|
|
134
136
|
data: readDynamicData(act),
|
|
137
|
+
extra: act === null || act === void 0 ? void 0 : act.extra,
|
|
135
138
|
isCapturePhase: act.isCapturePhase,
|
|
136
139
|
noPropagation: act.noPropagation,
|
|
137
140
|
};
|
|
@@ -143,11 +146,12 @@ function writeListeners(listeners = []) {
|
|
|
143
146
|
return listeners.map((l) => {
|
|
144
147
|
const act = {
|
|
145
148
|
key: l.key || '',
|
|
146
|
-
sourceKey: l.handler.moduleName
|
|
149
|
+
sourceKey: `${l.handler.moduleName}:${l.handler.name}`,
|
|
147
150
|
trigger: l.trigger,
|
|
148
151
|
type: l.type,
|
|
149
152
|
data: {},
|
|
150
153
|
dataBinds: [],
|
|
154
|
+
extra: l.extra,
|
|
151
155
|
handler: l.handler,
|
|
152
156
|
isCapturePhase: l.isCapturePhase,
|
|
153
157
|
noPropagation: l.noPropagation,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../parser/cals/utils/transform/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAA4B,MAAM,yBAAyB,CAAC;AAEjF,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,YAAY,EAAE,OAAO,CAAC,KAAA,iBAkDvE;AAED,wBAAsB,qBAAqB,CAAC,GAAG,KAAA,gBAmD9C"}
|