@cloudbase/cals 1.0.72-alpha.6 → 1.0.72-alpha.7
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.
|
@@ -26,6 +26,9 @@ interface IMergeCalsMeta {
|
|
|
26
26
|
mode: 'before' | 'after' | 'head' | 'tail';
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* todo: dataForm 追加
|
|
31
|
+
*/
|
|
29
32
|
export declare function mergeCals(ctx: {
|
|
30
33
|
blockTemplateMap: Record<string, IBlockTemplate>;
|
|
31
34
|
}, list: IMergeCalsMeta[]): IPlatformApp;
|
|
@@ -36,7 +39,7 @@ export declare function collapseComponentReference(ctx: ICalsReferenceContext, c
|
|
|
36
39
|
export interface IBlockTemplate {
|
|
37
40
|
name: string;
|
|
38
41
|
path?: string;
|
|
39
|
-
dynamicConfig?:
|
|
42
|
+
dynamicConfig?: any;
|
|
40
43
|
content: IPlatformApp;
|
|
41
44
|
}
|
|
42
45
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/parser/cals/utils/block/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAqC,MAAM,mBAAmB,CAAC;AAKxG,OAAO,EAAE,eAAe,EAAsD,MAAM,+BAA+B,CAAC;AAOpH,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAG1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACvF,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D,UAAU,aAAa;IACrB,SAAS,CAAC,EAAE;QACV,EAAE,EAAE,MAAM,CAAC;KACZ,CAAC;IACF,UAAU,EAAE,MAAM,CA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IAAI,CAAC,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,GAAG,CAAC;IACpB,OAAO,EAAE,YAAY,CAAC;CACvB"}
|
|
@@ -182,12 +182,14 @@ function regenBlockTemplateComponents(ctx, components) {
|
|
|
182
182
|
componentIdMap = (0, remap_component_ids_1.remapComponentIds)(components, ctx.visiting).componentIdMap;
|
|
183
183
|
}
|
|
184
184
|
return components.map((component) => {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
return expandComponentReference(restContext, Object.assign(Object.assign({}, processed), { extra: Object.assign(Object.assign({}, processed.extra), { xIndex: undefined, anchored: true }) }));
|
|
185
|
+
let processed = (0, remap_component_ids_1.refreshComponentIds)({ componentIdMap }, component);
|
|
186
|
+
return expandComponentReference(restContext, Object.assign(Object.assign({}, processed), { xIndex: undefined, anchored: true }));
|
|
188
187
|
});
|
|
189
188
|
}
|
|
190
189
|
exports.regenBlockTemplateComponents = regenBlockTemplateComponents;
|
|
190
|
+
/**
|
|
191
|
+
* todo: dataForm 追加
|
|
192
|
+
*/
|
|
191
193
|
function mergeCals(ctx, list) {
|
|
192
194
|
var _a, _b;
|
|
193
195
|
const visitedContext = {
|
|
@@ -241,7 +243,7 @@ function mergeCals(ctx, list) {
|
|
|
241
243
|
}
|
|
242
244
|
exports.mergeCals = mergeCals;
|
|
243
245
|
function expandComponentReference(ctx, component) {
|
|
244
|
-
var _a, _b, _c, _d, _e, _f;
|
|
246
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
245
247
|
const { blockTemplateMap, strict } = ctx;
|
|
246
248
|
const { extra = {}, id, component: componentName } = component;
|
|
247
249
|
const { ref } = extra;
|
|
@@ -255,7 +257,19 @@ function expandComponentReference(ctx, component) {
|
|
|
255
257
|
return undefined;
|
|
256
258
|
}
|
|
257
259
|
}
|
|
258
|
-
const
|
|
260
|
+
const block = blockTemplateMap[ref];
|
|
261
|
+
const blockContent = (_d = regenBlockTemplateComponents(Object.assign(Object.assign({}, ctx), { referenceMap: Object.assign(Object.assign({}, ctx.referenceMap), { [ref]: true }) }), (0, lodash_1.cloneDeep)(((_c = (_b = block.content.items) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.items) || []))) === null || _d === void 0 ? void 0 : _d[0];
|
|
262
|
+
/**
|
|
263
|
+
* 动态配置协议有修改未定
|
|
264
|
+
* 因此先写死限制
|
|
265
|
+
*/
|
|
266
|
+
if (!((_e = blockContent === null || blockContent === void 0 ? void 0 : blockContent.extra) === null || _e === void 0 ? void 0 : _e.dataForm) &&
|
|
267
|
+
blockContent.component === 'Container' &&
|
|
268
|
+
(((_f = blockContent.attributes) === null || _f === void 0 ? void 0 : _f.data) || ((_g = blockContent.attributes) === null || _g === void 0 ? void 0 : _g[':data'])) &&
|
|
269
|
+
((_h = block.dynamicConfig) === null || _h === void 0 ? void 0 : _h.type) === 'object' &&
|
|
270
|
+
((_j = block.dynamicConfig) === null || _j === void 0 ? void 0 : _j.properties.configs)) {
|
|
271
|
+
blockContent.extra = Object.assign(Object.assign({}, blockContent.extra), { dataForm: { data: (_k = block.dynamicConfig) === null || _k === void 0 ? void 0 : _k.properties.configs } });
|
|
272
|
+
}
|
|
259
273
|
const { attributes: blockAttributes = {} } = blockContent;
|
|
260
274
|
return Object.assign(Object.assign({}, blockContent), {
|
|
261
275
|
// todo: 这里合并有问题,无法简单的合并
|
|
@@ -270,14 +284,14 @@ function expandComponentReference(ctx, component) {
|
|
|
270
284
|
}
|
|
271
285
|
}
|
|
272
286
|
}
|
|
273
|
-
return Object.assign(Object.assign({}, component), { items: (
|
|
287
|
+
return Object.assign(Object.assign({}, component), { items: (_m = (_l = component.items) === null || _l === void 0 ? void 0 : _l.map) === null || _m === void 0 ? void 0 : _m.call(_l, (item) => expandComponentReference(ctx, item)) });
|
|
274
288
|
}
|
|
275
289
|
exports.expandComponentReference = expandComponentReference;
|
|
276
290
|
function collapseComponentReference(ctx, component) {
|
|
277
291
|
var _a, _b, _c;
|
|
278
292
|
const { extra, attributes = {}, ':style': styleBind, ':class': classBind } = component;
|
|
279
293
|
const { blockTemplateMap } = ctx;
|
|
280
|
-
const _d = extra || {}, { ref, anchored, refAttributes } = _d, restExtra = __rest(_d, ["ref", "anchored", "refAttributes"]);
|
|
294
|
+
const _d = extra || {}, { ref, anchored, dataForm, refAttributes } = _d, restExtra = __rest(_d, ["ref", "anchored", "dataForm", "refAttributes"]);
|
|
281
295
|
if (ref && blockTemplateMap[ref]) {
|
|
282
296
|
const processed = {};
|
|
283
297
|
const blockContent = (_c = (_b = (_a = blockTemplateMap[ref].content.items) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.items) === null || _c === void 0 ? void 0 : _c[0];
|
|
@@ -293,7 +307,7 @@ function collapseComponentReference(ctx, component) {
|
|
|
293
307
|
return processed;
|
|
294
308
|
}
|
|
295
309
|
else {
|
|
296
|
-
const _e = (component === null || component === void 0 ? void 0 : component.extra) || {}, { ref, refAttributes } = _e, rest = __rest(_e, ["ref", "refAttributes"]);
|
|
310
|
+
const _e = (component === null || component === void 0 ? void 0 : component.extra) || {}, { ref, refAttributes, dataForm } = _e, rest = __rest(_e, ["ref", "refAttributes", "dataForm"]);
|
|
297
311
|
return Object.assign(Object.assign({}, component), { extra: (component === null || component === void 0 ? void 0 : component.extra) ? rest : component === null || component === void 0 ? void 0 : component.extra });
|
|
298
312
|
}
|
|
299
313
|
}
|