@cloudbase/cals 1.0.70 → 1.0.72-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.
Files changed (36) hide show
  1. package/lib/parser/cals/index.d.ts +24 -1
  2. package/lib/parser/cals/index.d.ts.map +1 -1
  3. package/lib/parser/cals/index.js +162 -30
  4. package/lib/parser/cals/utils/block/helpers/get-component-namespace.d.ts +2 -0
  5. package/lib/parser/cals/utils/block/helpers/get-component-namespace.d.ts.map +1 -0
  6. package/lib/parser/cals/utils/block/helpers/get-component-namespace.js +9 -0
  7. package/lib/parser/cals/utils/block/helpers/remap-component-ids.d.ts +30 -0
  8. package/lib/parser/cals/utils/block/helpers/remap-component-ids.d.ts.map +1 -0
  9. package/lib/parser/cals/utils/block/helpers/remap-component-ids.js +128 -0
  10. package/lib/parser/cals/utils/block/helpers/renew-id-in-code.d.ts +7 -0
  11. package/lib/parser/cals/utils/block/helpers/renew-id-in-code.d.ts.map +1 -0
  12. package/lib/parser/cals/utils/block/helpers/renew-id-in-code.js +19 -0
  13. package/lib/parser/cals/utils/block/helpers/renew-id-in-expr.d.ts +7 -0
  14. package/lib/parser/cals/utils/block/helpers/renew-id-in-expr.d.ts.map +1 -0
  15. package/lib/parser/cals/utils/block/helpers/renew-id-in-expr.js +69 -0
  16. package/lib/parser/cals/utils/block/helpers/renew-id-in-resource.d.ts +8 -0
  17. package/lib/parser/cals/utils/block/helpers/renew-id-in-resource.d.ts.map +1 -0
  18. package/lib/parser/cals/utils/block/helpers/renew-id-in-resource.js +17 -0
  19. package/lib/parser/cals/utils/block/helpers/resolve-new-id.d.ts +7 -0
  20. package/lib/parser/cals/utils/block/helpers/resolve-new-id.d.ts.map +1 -0
  21. package/lib/parser/cals/utils/block/helpers/resolve-new-id.js +21 -0
  22. package/lib/parser/cals/utils/block/index.d.ts +6 -1
  23. package/lib/parser/cals/utils/block/index.d.ts.map +1 -1
  24. package/lib/parser/cals/utils/block/index.js +13 -1
  25. package/lib/parser/cals/utils/common.d.ts +3 -1
  26. package/lib/parser/cals/utils/common.d.ts.map +1 -1
  27. package/lib/parser/cals/utils/common.js +14 -1
  28. package/lib/parser/cals/utils/getUsedReference.d.ts +7 -0
  29. package/lib/parser/cals/utils/getUsedReference.d.ts.map +1 -0
  30. package/lib/parser/cals/utils/getUsedReference.js +56 -0
  31. package/lib/parser/index.d.ts +3 -1
  32. package/lib/parser/index.d.ts.map +1 -1
  33. package/lib/parser/index.js +9 -1
  34. package/lib/types/platform/component.d.ts +13 -4
  35. package/lib/types/platform/component.d.ts.map +1 -1
  36. package/package.json +2 -2
@@ -11,6 +11,7 @@ interface IDeserializeContext {
11
11
  dependencies?: any[];
12
12
  dependenciesMap?: any;
13
13
  page?: IPageComponent;
14
+ dereference?: boolean;
14
15
  }
15
16
  interface ISerializeContext {
16
17
  app?: any;
@@ -30,6 +31,7 @@ interface ISerializeContext {
30
31
  dependenciesMap?: any;
31
32
  streamlineDefaultValue?: boolean;
32
33
  streamlineModuleName?: boolean;
34
+ dereference?: boolean;
33
35
  }
34
36
  export declare function serializeValue({ ctx, key, dynamicValue, scope, streamlineDefaultValue, }: {
35
37
  ctx: ISerializeContext;
@@ -140,7 +142,7 @@ export declare function serializeComponent(ctx: ISerializeContext & ({
140
142
  } & {
141
143
  id: string;
142
144
  label?: string;
143
- } & Pick<IPlatformComponentExtra, 'anchored' | 'dataForm'>, scope?: 'page' | 'component'): IPlatformComponent;
145
+ } & Pick<IPlatformComponentExtra, 'anchored' | 'dataForm' | 'include' | 'ref' | 'refAttributes'>, scope?: 'page' | 'component'): IPlatformComponent;
144
146
  export declare function deserializeComponent(ctx: IDeserializeContext, components: IPlatformComponent[]): {
145
147
  [key: string]: object;
146
148
  };
@@ -185,6 +187,7 @@ export declare function deserializePage(ctx: {
185
187
  data: {
186
188
  [key: string]: IDynamicValue;
187
189
  };
190
+ style: object;
188
191
  commonStyle: object;
189
192
  staticResourceAttribute: string[];
190
193
  hideAdminPortalMenu: boolean;
@@ -285,6 +288,7 @@ export declare function deserializePlatformApp(data: IPlatformApp, optsions: {
285
288
  data: {
286
289
  [key: string]: IDynamicValue;
287
290
  };
291
+ style: object;
288
292
  commonStyle: object;
289
293
  staticResourceAttribute: string[];
290
294
  hideAdminPortalMenu: boolean;
@@ -504,4 +508,23 @@ export declare function generateHandlerParamsDynamicMap(handler: IHandler): any;
504
508
  * 仅保留子包自身数据
505
509
  */
506
510
  export declare function streamlineSubApp(cals: any): IPlatformSubApp;
511
+ /**
512
+ * 还原引用
513
+ */
514
+ export declare function collapseCalsReference(cals: IPlatformApp | IPlatformSubApp, options: {
515
+ blockTemplates: {
516
+ name?: string;
517
+ path?: string;
518
+ }[];
519
+ }): IPlatformApp | IPlatformSubApp;
520
+ /**
521
+ * 展开引用
522
+ */
523
+ export declare function expandCalsReference(cals: IPlatformApp | IPlatformSubApp, options: {
524
+ blockTemplates: {
525
+ name?: string;
526
+ path?: string;
527
+ }[];
528
+ strict?: boolean;
529
+ }): IPlatformApp | IPlatformSubApp;
507
530
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/parser/cals/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAuC,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEvH,OAAO,EACL,WAAW,EACX,YAAY,EAGZ,cAAc,EACd,kBAAkB,EAElB,mBAAmB,EACnB,cAAc,EAAE,cAAc;AAC9B,mBAAmB,EACnB,aAAa,EACb,IAAI,EAEL,MAAM,aAAa,CAAC;AAErB,OAAO,EAAkC,aAAa,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAS5F,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,uBAAuB,EAAoC,MAAM,aAAa,CAAC;AAEnH,OAAO,EAAE,YAAY,EAAE,iCAAiC,EAAE,M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;AACH,wBAAgB,gBAAgB,CAAC,IAAI,KAAA,GAAG,eAAe,CAiBtD;AASD;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,YAAY,GAAG,eAAe,EACpC,OAAO,EAAE;IAAE,cAAc,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAAE,GAC9D,YAAY,GAAG,eAAe,CAehC;AA0CD;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,YAAY,GAAG,eAAe,EACpC,OAAO,EAAE;IAAE,cAAc,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,GAChF,YAAY,GAAG,eAAe,CA8ChC"}
@@ -14,13 +14,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.streamlineSubApp = exports.generateHandlerParamsDynamicMap = exports.processTemplatesToDependiencies = exports.parseDependenciesVersion = exports.processDependenciesVersionMap = exports.processListeners = exports.parseVersion = exports.processRuntimeCodeResources = exports.deserializeComponentLibraryMeta = exports.deserializeRuntimeComponent = exports.serializeRuntimeComponent = exports.serializeRuntimeDataset = exports.serializeRuntimePage = exports.deserializeCompositeComponent = exports.deserializePlatformApp = exports.serializePlatformApp = exports.deserializePage = exports.serializeLayouts = exports.serializePage = exports.deserializeComponent = exports.serializeComponent = exports.deserializeDataVariables = exports.normalizeQuery = exports.deserializeDataset = exports.deserializeTemplates = exports.serializeDataset = exports.deserializeAttributes = exports.serializeAttributes = exports.deserializeDynamicMap = exports.serializeDynamicMap = exports.deserializeValue = exports.serializeValue = exports.generateDefaultCode = exports.generateCustomLoginConfigPathname = exports.getUsedComps = void 0;
17
+ exports.expandCalsReference = exports.collapseCalsReference = exports.streamlineSubApp = exports.generateHandlerParamsDynamicMap = exports.processTemplatesToDependiencies = exports.parseDependenciesVersion = exports.processDependenciesVersionMap = exports.processListeners = exports.parseVersion = exports.processRuntimeCodeResources = exports.deserializeComponentLibraryMeta = exports.deserializeRuntimeComponent = exports.serializeRuntimeComponent = exports.serializeRuntimeDataset = exports.serializeRuntimePage = exports.deserializeCompositeComponent = exports.deserializePlatformApp = exports.serializePlatformApp = exports.deserializePage = exports.serializeLayouts = exports.serializePage = exports.deserializeComponent = exports.serializeComponent = exports.deserializeDataVariables = exports.normalizeQuery = exports.deserializeDataset = exports.deserializeTemplates = exports.serializeDataset = exports.deserializeAttributes = exports.serializeAttributes = exports.deserializeDynamicMap = exports.serializeDynamicMap = exports.deserializeValue = exports.serializeValue = exports.generateDefaultCode = exports.generateCustomLoginConfigPathname = exports.getUsedComps = void 0;
18
18
  const get_1 = __importDefault(require("lodash/get"));
19
19
  const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
20
20
  const unset_1 = __importDefault(require("lodash/unset"));
21
21
  const set_1 = __importDefault(require("lodash/set"));
22
22
  const isArray_1 = __importDefault(require("lodash/isArray"));
23
23
  const isObject_1 = __importDefault(require("lodash/isObject"));
24
+ const isEqual_1 = __importDefault(require("lodash/isEqual"));
24
25
  const common_1 = require("../../types/platform/common");
25
26
  const expression_1 = require("../expression");
26
27
  const common_2 = require("./utils/common");
@@ -30,6 +31,10 @@ const config_1 = require("./utils/version/config");
30
31
  const template_1 = require("./utils/template");
31
32
  const featureChecker_1 = require("../../utils/version/featureChecker");
32
33
  const utils_1 = require("../../utils");
34
+ const getUsedReference_1 = require("./utils/getUsedReference");
35
+ const remap_component_ids_1 = require("./utils/block/helpers/remap-component-ids");
36
+ const get_component_namespace_1 = require("./utils/block/helpers/get-component-namespace");
37
+ const index_1 = require("./utils/block/index");
33
38
  var common_3 = require("./utils/common");
34
39
  Object.defineProperty(exports, "getUsedComps", { enumerable: true, get: function () { return common_3.getUsedComps; } });
35
40
  Object.defineProperty(exports, "generateCustomLoginConfigPathname", { enumerable: true, get: function () { return common_3.generateCustomLoginConfigPathname; } });
@@ -107,10 +112,9 @@ function serializeValue({ ctx, key, dynamicValue, scope = 'page', streamlineDefa
107
112
  return { key, value, extra: dynamicValue.extra };
108
113
  }
109
114
  exports.serializeValue = serializeValue;
110
- const DYNAMIC_KEY_REG = /^:(.*)$/;
111
115
  function deserializeValue(ctx, key, value, extra) {
112
116
  var _a;
113
- let matched = key.match(DYNAMIC_KEY_REG);
117
+ let matched = key.match(common_2.DYNAMIC_KEY_REG);
114
118
  if (matched) {
115
119
  let key = matched[1];
116
120
  let type = expression_1.PropBindType.expression;
@@ -181,7 +185,7 @@ function serializeDynamicMapWithExtra({ ctx, map = {}, scope = 'page', streamlin
181
185
  scope,
182
186
  streamlineDefaultValue,
183
187
  });
184
- let matched = processedKey.match(DYNAMIC_KEY_REG);
188
+ let matched = processedKey.match(common_2.DYNAMIC_KEY_REG);
185
189
  let originKey = processedKey;
186
190
  if (matched) {
187
191
  originKey = matched[1];
@@ -260,7 +264,7 @@ function recoverSynamicMap(parent, current, path = '') {
260
264
  value = recoverSynamicMap(parent, value, `${path === '' ? '' : `${path}.`}${key}`);
261
265
  }
262
266
  else {
263
- const matched = key.match(DYNAMIC_KEY_REG);
267
+ const matched = key.match(common_2.DYNAMIC_KEY_REG);
264
268
  if (matched) {
265
269
  parent[`:${path === '' ? '' : `${path}.`}${matched[1]}`] = current[key];
266
270
  if (current !== parent) {
@@ -280,7 +284,7 @@ function deserializeDynamicMap(ctx, map, extraMap) {
280
284
  map = recoverSynamicMap(clonedMap, clonedMap, '');
281
285
  for (let key in map || {}) {
282
286
  let value = map === null || map === void 0 ? void 0 : map[key];
283
- let matched = key.match(DYNAMIC_KEY_REG);
287
+ let matched = key.match(common_2.DYNAMIC_KEY_REG);
284
288
  if (matched && !matched[1]) {
285
289
  continue;
286
290
  }
@@ -755,21 +759,19 @@ function serializeComponent(ctx, component, scope = 'page') {
755
759
  ':class': classListBindData ? classListBindData.value : undefined,
756
760
  ':style': styleBindData ? styleBindData.value : undefined,
757
761
  scopedStyle: (0, runtime_1.getValidValue)((_q = component.xProps) === null || _q === void 0 ? void 0 : _q.scopedStyle),
758
- extra: {
759
- commonStyle: (_r = component.xProps) === null || _r === void 0 ? void 0 : _r.commonStyle,
760
- xIndex: component.xIndex,
761
- styleBindPath: (_s = component === null || component === void 0 ? void 0 : component.xProps) === null || _s === void 0 ? void 0 : _s.styleBindPath,
762
- staticResourceAttribute: (_t = component === null || component === void 0 ? void 0 : component.xProps) === null || _t === void 0 ? void 0 : _t.staticResourceAttribute,
763
- attributeExtraData: (0, common_2.isEmptyObj)(attributeExtraData) ? undefined : attributeExtraData,
764
- anchored: (0, runtime_1.getValidValue)(component.anchored),
765
- dataForm: (0, runtime_1.getValidValue)(component.dataForm),
766
- },
762
+ extra: Object.assign({ commonStyle: (_r = component.xProps) === null || _r === void 0 ? void 0 : _r.commonStyle, xIndex: component.xIndex, styleBindPath: (_s = component === null || component === void 0 ? void 0 : component.xProps) === null || _s === void 0 ? void 0 : _s.styleBindPath, staticResourceAttribute: (_t = component === null || component === void 0 ? void 0 : component.xProps) === null || _t === void 0 ? void 0 : _t.staticResourceAttribute, attributeExtraData: (0, common_2.isEmptyObj)(attributeExtraData) ? undefined : attributeExtraData, anchored: (0, runtime_1.getValidValue)(component.anchored), dataForm: (0, runtime_1.getValidValue)(component.dataForm) }, (ctx.dereference
763
+ ? {}
764
+ : {
765
+ ref: (0, runtime_1.getValidValue)(component.ref),
766
+ include: (0, runtime_1.getValidValue)(component.include),
767
+ refAttributes: (0, runtime_1.getValidValue)(component.refAttributes),
768
+ })),
767
769
  };
768
770
  }
769
771
  exports.serializeComponent = serializeComponent;
770
772
  function deserializeComponent(ctx, components) {
771
773
  let componentMap = components.reduce((map, item, index) => {
772
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
774
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
773
775
  const { attributeExtraData = {} } = item.extra || {};
774
776
  let dynamicStyle = item[':style']
775
777
  ? deserializeValue(ctx, ':style', item[':style'], attributeExtraData.style).value
@@ -810,22 +812,20 @@ function deserializeComponent(ctx, components) {
810
812
  return deserializeListener(ctx, item);
811
813
  })) || [],
812
814
  };
813
- let processed = {
814
- xComponent: Object.values(xComponent).find((item) => item != undefined) ? xComponent : undefined,
815
- xProps: Object.values(xProps).find((item) => {
815
+ let processed = Object.assign({ xComponent: Object.values(xComponent).find((item) => item != undefined) ? xComponent : undefined, xProps: Object.values(xProps).find((item) => {
816
816
  if (Array.isArray(item)) {
817
817
  return !!item.length;
818
818
  }
819
819
  return item !== undefined && !(0, common_2.isEmptyObj)(item);
820
820
  })
821
821
  ? xProps
822
- : undefined,
823
- xIndex: ((_h = item.extra) === null || _h === void 0 ? void 0 : _h.xIndex) !== undefined ? (_j = item.extra) === null || _j === void 0 ? void 0 : _j.xIndex : index,
824
- label: (item === null || item === void 0 ? void 0 : item.label) !== undefined ? item === null || item === void 0 ? void 0 : item.label : undefined,
825
- properties: item.items ? deserializeComponent(ctx, item.items) : undefined,
826
- anchored: (_k = item === null || item === void 0 ? void 0 : item.extra) === null || _k === void 0 ? void 0 : _k.anchored,
827
- dataForm: (_l = item === null || item === void 0 ? void 0 : item.extra) === null || _l === void 0 ? void 0 : _l.dataForm,
828
- };
822
+ : undefined, xIndex: ((_h = item.extra) === null || _h === void 0 ? void 0 : _h.xIndex) !== undefined ? (_j = item.extra) === null || _j === void 0 ? void 0 : _j.xIndex : index, label: (item === null || item === void 0 ? void 0 : item.label) !== undefined ? item === null || item === void 0 ? void 0 : item.label : undefined, properties: item.items ? deserializeComponent(ctx, item.items) : undefined, anchored: (_k = item === null || item === void 0 ? void 0 : item.extra) === null || _k === void 0 ? void 0 : _k.anchored, dataForm: (_l = item === null || item === void 0 ? void 0 : item.extra) === null || _l === void 0 ? void 0 : _l.dataForm }, (ctx.dereference
823
+ ? {}
824
+ : {
825
+ include: (0, runtime_1.getValidValue)((_m = item === null || item === void 0 ? void 0 : item.extra) === null || _m === void 0 ? void 0 : _m.include),
826
+ ref: (0, runtime_1.getValidValue)((_o = item === null || item === void 0 ? void 0 : item.extra) === null || _o === void 0 ? void 0 : _o.ref),
827
+ refAttributes: (0, runtime_1.getValidValue)((_p = item === null || item === void 0 ? void 0 : item.extra) === null || _p === void 0 ? void 0 : _p.refAttributes),
828
+ }));
829
829
  map[item.id] = processed;
830
830
  return map;
831
831
  }, {});
@@ -866,6 +866,9 @@ function serializePage(ctx, page) {
866
866
  hideAdminPortalMenu: page === null || page === void 0 ? void 0 : page.hideAdminPortalMenu,
867
867
  },
868
868
  };
869
+ if (page.style) {
870
+ (0, set_1.default)(processedPage, 'attributes.style', page.style);
871
+ }
869
872
  if (page.styleBind) {
870
873
  processedPage[':style'] = serializeValue({
871
874
  ctx: pageCtx,
@@ -900,7 +903,7 @@ function serializeLayouts(ctx, layouts = {}) {
900
903
  }
901
904
  exports.serializeLayouts = serializeLayouts;
902
905
  function deserializePage(ctx, page) {
903
- var _a, _b, _c, _d, _e, _f, _g;
906
+ var _a, _b, _c, _d, _e, _f, _g, _h;
904
907
  const { homePageId } = ctx, _pageCtx = __rest(ctx, ["homePageId"]);
905
908
  let pageCtx = Object.assign(Object.assign({}, _pageCtx), { page });
906
909
  let dynamicStyle = page[':style']
@@ -912,7 +915,7 @@ function deserializePage(ctx, page) {
912
915
  data: ((_c = page.dataVariables) === null || _c === void 0 ? void 0 : _c.map((item) => {
913
916
  return deserializeDataVariables(undefined, item);
914
917
  })) || [],
915
- }, data: deserializeAttributes(pageCtx, page.attributes, (_d = page === null || page === void 0 ? void 0 : page.extra) === null || _d === void 0 ? void 0 : _d.attributeExtraData), commonStyle: (_e = page === null || page === void 0 ? void 0 : page.extra) === null || _e === void 0 ? void 0 : _e.commonStyle, staticResourceAttribute: (_f = page === null || page === void 0 ? void 0 : page.extra) === null || _f === void 0 ? void 0 : _f.staticResourceAttribute, hideAdminPortalMenu: (_g = page === null || page === void 0 ? void 0 : page.extra) === null || _g === void 0 ? void 0 : _g.hideAdminPortalMenu, listeners: (listeners === null || listeners === void 0 ? void 0 : listeners.map((item) => {
918
+ }, data: deserializeAttributes(pageCtx, page.attributes, (_d = page === null || page === void 0 ? void 0 : page.extra) === null || _d === void 0 ? void 0 : _d.attributeExtraData), style: (_e = page.attributes) === null || _e === void 0 ? void 0 : _e.style, commonStyle: (_f = page === null || page === void 0 ? void 0 : page.extra) === null || _f === void 0 ? void 0 : _f.commonStyle, staticResourceAttribute: (_g = page === null || page === void 0 ? void 0 : page.extra) === null || _g === void 0 ? void 0 : _g.staticResourceAttribute, hideAdminPortalMenu: (_h = page === null || page === void 0 ? void 0 : page.extra) === null || _h === void 0 ? void 0 : _h.hideAdminPortalMenu, listeners: (listeners === null || listeners === void 0 ? void 0 : listeners.map((item) => {
916
919
  return deserializeListener(pageCtx, item);
917
920
  })) || [], eventFlows: (eventFlows === null || eventFlows === void 0 ? void 0 : eventFlows.map((eventFlow) => {
918
921
  var _a, _b;
@@ -1046,7 +1049,7 @@ exports.deserializeCompositeComponent = deserializeCompositeComponent;
1046
1049
  * @deprecated 已过时,使用会产生意外错误,如不包含事件流
1047
1050
  */
1048
1051
  function serializeRuntimePage(ctx, page) {
1049
- var _a, _b, _c, _d, _e, _f;
1052
+ var _a, _b, _c, _d, _e;
1050
1053
  const pageCtx = Object.assign(Object.assign({}, ctx), { dependenciesMap: processDependenceList2Map(ctx.dependencies || []), page: { id: page.id } });
1051
1054
  let processedPage = {
1052
1055
  id: page.id,
@@ -1070,7 +1073,6 @@ function serializeRuntimePage(ctx, page) {
1070
1073
  commonStyle: (0, runtime_1.getValidValue)((0, style_1.removeInvalidStyleFormValue)(page.style)),
1071
1074
  styleBindPath: (0, runtime_1.getValidValue)(page.styleBindPath),
1072
1075
  xIndex: page.xIndex,
1073
- children: (0, runtime_1.getValidValue)((_f = page.children) === null || _f === void 0 ? void 0 : _f.map((child) => serializeRuntimePage(ctx, child))),
1074
1076
  },
1075
1077
  };
1076
1078
  if ((0, common_2.isValidStyleBind)(page.styleBind) && (0, runtime_1.getValidValue)(page.styleBind)) {
@@ -1507,3 +1509,133 @@ function streamlineSubApp(cals) {
1507
1509
  };
1508
1510
  }
1509
1511
  exports.streamlineSubApp = streamlineSubApp;
1512
+ /**
1513
+ * 还原引用
1514
+ */
1515
+ function collapseCalsReference(cals, options) {
1516
+ var _a;
1517
+ const { blockTemplates = [] } = options;
1518
+ const ctx = {
1519
+ blockTemplateMap: (0, getUsedReference_1.generateBlockTemplateMap)(blockTemplates),
1520
+ };
1521
+ const res = Object.assign(Object.assign({}, cals), { items: (_a = cals.items) === null || _a === void 0 ? void 0 : _a.map((page) => {
1522
+ var _a;
1523
+ return Object.assign(Object.assign({}, page), { items: (_a = page.items) === null || _a === void 0 ? void 0 : _a.map((component) => collapseComponentReference(ctx, component)) });
1524
+ }) });
1525
+ return res;
1526
+ }
1527
+ exports.collapseCalsReference = collapseCalsReference;
1528
+ function collapseComponentReference(ctx, component) {
1529
+ var _a, _b, _c;
1530
+ const { extra, attributes = {}, ':style': styleBind, ':class': classBind } = component;
1531
+ const { blockTemplateMap } = ctx;
1532
+ const _d = extra || {}, { ref, anchored, refAttributes } = _d, restExtra = __rest(_d, ["ref", "anchored", "refAttributes"]);
1533
+ if (ref && blockTemplateMap[ref]) {
1534
+ const processed = {};
1535
+ const blockContent = (_c = (_b = (_a = blockTemplateMap[ref].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];
1536
+ restExtra.ref = ref;
1537
+ processed.attributes = filterMap(attributes, refAttributes);
1538
+ if (styleBind !== blockContent[':style']) {
1539
+ processed[':style'] = styleBind;
1540
+ }
1541
+ if (classBind !== blockContent[':class']) {
1542
+ processed[':class'] = classBind;
1543
+ }
1544
+ processed.extra = filterMap(restExtra, blockContent === null || blockContent === void 0 ? void 0 : blockContent.extra);
1545
+ return processed;
1546
+ }
1547
+ else {
1548
+ const _e = (component === null || component === void 0 ? void 0 : component.extra) || {}, { ref, refAttributes } = _e, rest = __rest(_e, ["ref", "refAttributes"]);
1549
+ 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 });
1550
+ }
1551
+ }
1552
+ function filterMap(current = {}, base = {}) {
1553
+ const filtered = {};
1554
+ Object.entries(current).forEach(([key, value]) => {
1555
+ // todo: 变量绑定key与非绑定key应为相同key
1556
+ if (!(0, isEqual_1.default)(base[key], value)) {
1557
+ filtered[key] = value;
1558
+ }
1559
+ });
1560
+ return filtered;
1561
+ }
1562
+ /**
1563
+ * 展开引用
1564
+ */
1565
+ function expandCalsReference(cals, options) {
1566
+ var _a;
1567
+ const { blockTemplates = [] } = options;
1568
+ const blockTemplateMap = (0, getUsedReference_1.generateBlockTemplateMap)(blockTemplates);
1569
+ const ctx = {
1570
+ blockTemplateMap,
1571
+ strict: options.strict,
1572
+ visiting: {
1573
+ existing: new remap_component_ids_1.VisitedMap(),
1574
+ untilNow: new remap_component_ids_1.VisitedMap(),
1575
+ },
1576
+ };
1577
+ const { refs } = (0, utils_1.getUsedReference)([cals], blockTemplates);
1578
+ [cals]
1579
+ .concat(Array.from(refs)
1580
+ .map((key) => blockTemplateMap[key])
1581
+ .filter((item) => !!item))
1582
+ .forEach((cals, index) => {
1583
+ var _a, _b;
1584
+ (_b = (_a = cals.items) === null || _a === void 0 ? void 0 : _a.forEach) === null || _b === void 0 ? void 0 : _b.call(_a, (page) => {
1585
+ (0, common_2.walkThroughComponents)(page.items || [], (component) => {
1586
+ const { component: componentName } = component;
1587
+ if (typeof componentName === 'string' && componentName) {
1588
+ const { untilNow, existing } = ctx.visiting;
1589
+ const namespace = (0, get_component_namespace_1.getComponentNamespace)(componentName);
1590
+ if (index === 0) {
1591
+ untilNow.add(namespace, id);
1592
+ }
1593
+ existing.add(namespace, component.id);
1594
+ }
1595
+ return component;
1596
+ });
1597
+ });
1598
+ });
1599
+ return Object.assign(Object.assign({}, cals), { items: (_a = cals.items) === null || _a === void 0 ? void 0 : _a.map((page) => {
1600
+ var _a, _b;
1601
+ return Object.assign(Object.assign({}, page), { items: (_b = (_a = page.items) === null || _a === void 0 ? void 0 : _a.map) === null || _b === void 0 ? void 0 : _b.call(_a, (component) => expandComponentReference(ctx, component)) });
1602
+ }) });
1603
+ }
1604
+ exports.expandCalsReference = expandCalsReference;
1605
+ function expandComponentReference(ctx, component) {
1606
+ var _a, _b, _c, _d, _e, _f;
1607
+ const { blockTemplateMap, strict } = ctx;
1608
+ const { extra = {}, id, component: componentName } = component;
1609
+ const { ref } = extra;
1610
+ if (ref) {
1611
+ if (blockTemplateMap[ref]) {
1612
+ if ((_a = ctx === null || ctx === void 0 ? void 0 : ctx.referenceMap) === null || _a === void 0 ? void 0 : _a[ref]) {
1613
+ if (strict) {
1614
+ throw new Error(`存在循环引用:${ref}`);
1615
+ }
1616
+ else {
1617
+ return undefined;
1618
+ }
1619
+ }
1620
+ const blockContent = expandComponentReference(Object.assign(Object.assign({}, ctx), { referenceMap: Object.assign(Object.assign({}, ctx.referenceMap), { [ref]: true }) }),
1621
+ /**
1622
+ * 先根遍历
1623
+ * 先安装当前的区块,不展开,接着展开安装子级别区块
1624
+ */
1625
+ (0, index_1.regenBlockTemplateComponent)(ctx, Object.assign({}, (_d = (_c = (_b = blockTemplateMap[ref].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])));
1626
+ const { attributes: blockAttributes = {} } = blockContent;
1627
+ return Object.assign(Object.assign({}, blockContent), {
1628
+ // todo: 这里合并有问题,无法简单的合并
1629
+ attributes: Object.assign(Object.assign({}, blockAttributes), component.attributes), ':style': component[':style'] || blockContent[':style'], ':class': component[':class'] || blockContent[':class'], extra: Object.assign(Object.assign({}, blockContent.extra), { refAttributes: Object.keys(blockAttributes) ? blockAttributes : undefined, ref }) });
1630
+ }
1631
+ else {
1632
+ if (strict) {
1633
+ throw new Error(`未找到引用:${ref}`);
1634
+ }
1635
+ else {
1636
+ return undefined;
1637
+ }
1638
+ }
1639
+ }
1640
+ return Object.assign(Object.assign({}, component), { items: (_f = (_e = component.items) === null || _e === void 0 ? void 0 : _e.map) === null || _f === void 0 ? void 0 : _f.call(_e, (item) => expandComponentReference(ctx, item)) });
1641
+ }
@@ -0,0 +1,2 @@
1
+ export declare function getComponentNamespace(componentName: string): string;
2
+ //# sourceMappingURL=get-component-namespace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-component-namespace.d.ts","sourceRoot":"","sources":["../../../../../../src/parser/cals/utils/block/helpers/get-component-namespace.ts"],"names":[],"mappings":"AAAA,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,MAAM,UAI1D"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getComponentNamespace = void 0;
4
+ function getComponentNamespace(componentName) {
5
+ // `Text / WdText` 是同一类组件
6
+ // 因此它们生成的组件 ID 前缀应该都是 `text`
7
+ return componentName.toLowerCase().replace(/^wd/, '');
8
+ }
9
+ exports.getComponentNamespace = getComponentNamespace;
@@ -0,0 +1,30 @@
1
+ import { IPlatformComponent } from '../../../../../types';
2
+ declare type ComponentNamespace = string;
3
+ declare type ComponentId = string;
4
+ export interface IVisitedContext {
5
+ /** 在多份 cals 数据中,各个组件已事先收集的所有 ID 列表 */
6
+ existing: VisitedMap;
7
+ /** 遍历到当前 cals 组件列表时,各个组件已标记存在的 ID 列表 */
8
+ untilNow: VisitedMap;
9
+ }
10
+ export declare class VisitedMap {
11
+ #private;
12
+ constructor();
13
+ has(...args: any[]): boolean;
14
+ get(component: ComponentNamespace): any;
15
+ add(component: ComponentNamespace, id: ComponentId): void;
16
+ get size(): number;
17
+ }
18
+ /**
19
+ * 在特定的上下文,给 CALS 组件按需生成新的 ID
20
+ * @param components CALS 组件列表
21
+ * @param visitedContext 访问上下文
22
+ */
23
+ export declare function remapComponentIds(components: IPlatformComponent[], visitedContext: IVisitedContext): {
24
+ componentIdMap: Map<string, string>;
25
+ };
26
+ export declare function refreshComponentIds(ctx: {
27
+ componentIdMap: Map<string, string>;
28
+ }, component: IPlatformComponent): any;
29
+ export {};
30
+ //# sourceMappingURL=remap-component-ids.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remap-component-ids.d.ts","sourceRoot":"","sources":["../../../../../../src/parser/cals/utils/block/helpers/remap-component-ids.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAK1D,aAAK,kBAAkB,GAAG,MAAM,CAAC;AACjC,aAAK,WAAW,GAAG,MAAM,CAAC;AAE1B,MAAM,WAAW,eAAe;IAC9B,sCAAsC;IACtC,QAAQ,EAAE,UAAU,CAAC;IAErB,wCAAwC;IACxC,QAAQ,EAAE,UAAU,CAAC;CACtB;AAED,qBAAa,UAAU;;;IAMrB,GAAG,CAAC,GAAG,IAAI,OAAA;IAIX,GAAG,CAAC,SAAS,EAAE,kBAAkB;IAGjC,GAAG,CAAC,SAAS,EAAE,kBAAkB,EAAE,EAAE,EAAE,WAAW;IAOlD,IAAI,IAAI,WAEP;CACF;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,kBAAkB,EAAE,EAAE,cAAc,EAAE,eAAe;;EAmClG;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE;IAAE,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,EAAE,SAAS,EAAE,kBAAkB,OAoD9G"}
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
+ };
7
+ var _VisitedMap_flatten, _VisitedMap_group;
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.refreshComponentIds = exports.remapComponentIds = exports.VisitedMap = void 0;
10
+ // import { getCodeIdSegments } from 'pages/editor/utils/name/getCodeIdSegments';
11
+ // import { getNextAvailableCodeId } from 'pages/editor/utils/name/getNextAvailableCodeId';
12
+ const get_component_namespace_1 = require("./get-component-namespace");
13
+ const common_1 = require("../../common");
14
+ const renew_id_in_expr_1 = require("./renew-id-in-expr");
15
+ const renew_id_in_code_1 = require("./renew-id-in-code");
16
+ const renew_id_in_resource_1 = require("./renew-id-in-resource");
17
+ class VisitedMap {
18
+ constructor() {
19
+ _VisitedMap_flatten.set(this, new Set());
20
+ _VisitedMap_group.set(this, new Map());
21
+ return this;
22
+ }
23
+ has(...args) {
24
+ const key = args.length === 1 ? args[0] : args[1];
25
+ return __classPrivateFieldGet(this, _VisitedMap_flatten, "f").has(key);
26
+ }
27
+ get(component) {
28
+ return __classPrivateFieldGet(this, _VisitedMap_group, "f").get(component);
29
+ }
30
+ add(component, id) {
31
+ if (!__classPrivateFieldGet(this, _VisitedMap_group, "f").get(component)) {
32
+ __classPrivateFieldGet(this, _VisitedMap_group, "f").set(component, new Set([]));
33
+ }
34
+ __classPrivateFieldGet(this, _VisitedMap_group, "f").get(component).add(id);
35
+ __classPrivateFieldGet(this, _VisitedMap_flatten, "f").add(id);
36
+ }
37
+ get size() {
38
+ return __classPrivateFieldGet(this, _VisitedMap_flatten, "f").size;
39
+ }
40
+ }
41
+ exports.VisitedMap = VisitedMap;
42
+ _VisitedMap_flatten = new WeakMap(), _VisitedMap_group = new WeakMap();
43
+ /**
44
+ * 在特定的上下文,给 CALS 组件按需生成新的 ID
45
+ * @param components CALS 组件列表
46
+ * @param visitedContext 访问上下文
47
+ */
48
+ function remapComponentIds(components, visitedContext) {
49
+ const { existing, untilNow } = visitedContext;
50
+ /**
51
+ * 映射: 组件原始 ID => 新生成 ID
52
+ */
53
+ const componentIdMap = new Map();
54
+ (0, common_1.walkThroughComponents)(components, (item) => {
55
+ if (!item.component || typeof item.component !== 'string') {
56
+ return item;
57
+ }
58
+ const namespace = (0, get_component_namespace_1.getComponentNamespace)(item.component);
59
+ console.log('>>>>>untilNow', item.id);
60
+ if (untilNow.has(item.id)) {
61
+ let nextCodeId = `${namespace}1`;
62
+ let seq = 0;
63
+ do {
64
+ seq += 1;
65
+ nextCodeId = `${namespace}${seq}`;
66
+ } while (existing.has(nextCodeId));
67
+ componentIdMap.set(item.id, nextCodeId);
68
+ item.id = nextCodeId;
69
+ }
70
+ // 更新 `existing / untilNow` 中存储的组件 ID 数据
71
+ for (const target of [existing, untilNow]) {
72
+ target.add(namespace, item.id);
73
+ }
74
+ return item;
75
+ });
76
+ return { componentIdMap };
77
+ }
78
+ exports.remapComponentIds = remapComponentIds;
79
+ function refreshComponentIds(ctx, component) {
80
+ var _a, _b, _c, _d, _e, _f, _g;
81
+ const { componentIdMap } = ctx;
82
+ const processed = JSON.parse(JSON.stringify(component, (key, value) => {
83
+ if (common_1.DYNAMIC_KEY_REG.test(key)) {
84
+ return (0, renew_id_in_expr_1.renewIdInExpr)(value, componentIdMap);
85
+ }
86
+ else {
87
+ return value;
88
+ }
89
+ }));
90
+ switch (processed.component) {
91
+ case 'JSX': {
92
+ if ((_a = processed.attributes) === null || _a === void 0 ? void 0 : _a.jsCode) {
93
+ processed.attributes.jsCode = (0, renew_id_in_code_1.renewIdInCode)(processed.attributes.jsCode, componentIdMap);
94
+ }
95
+ if ((_b = processed.attributes) === null || _b === void 0 ? void 0 : _b.jsxCode) {
96
+ processed.attributes.jsxCode = (0, renew_id_in_code_1.renewIdInCode)(processed.attributes.jsxCode, componentIdMap);
97
+ }
98
+ break;
99
+ }
100
+ case 'Repeater': {
101
+ const oldId = (_c = processed.attributes) === null || _c === void 0 ? void 0 : _c.suffix;
102
+ if (oldId && componentIdMap.has(oldId)) {
103
+ for (const key of ['forIndex', 'forItem', 'suffix']) {
104
+ const value = processed.attributes[key];
105
+ if (typeof value === 'string') {
106
+ processed.attributes[key] = value.replace(oldId, componentIdMap.get(oldId));
107
+ }
108
+ }
109
+ }
110
+ break;
111
+ }
112
+ }
113
+ (_e = (_d = processed === null || processed === void 0 ? void 0 : processed.listeners) === null || _d === void 0 ? void 0 : _d.forEach) === null || _e === void 0 ? void 0 : _e.call(_d, (listener) => {
114
+ var _a, _b, _c;
115
+ if (((_a = listener === null || listener === void 0 ? void 0 : listener.handler) === null || _a === void 0 ? void 0 : _a.module) === 'platform' && ((_b = listener === null || listener === void 0 ? void 0 : listener.handler) === null || _b === void 0 ? void 0 : _b.name) === 'invoke') {
116
+ const oldId = (_c = listener.handler.params) === null || _c === void 0 ? void 0 : _c.component;
117
+ if (oldId && componentIdMap.has(oldId)) {
118
+ listener.handler.params.component = componentIdMap.get(oldId);
119
+ }
120
+ }
121
+ });
122
+ if (processed === null || processed === void 0 ? void 0 : processed.resources) {
123
+ processed.resources = processed.resources.map((item) => (0, renew_id_in_resource_1.renewIdInResource)(item, componentIdMap));
124
+ }
125
+ (_g = (_f = processed.items) === null || _f === void 0 ? void 0 : _f.forEach) === null || _g === void 0 ? void 0 : _g.call(_f, (i) => refreshComponentIds(ctx, i));
126
+ return processed;
127
+ }
128
+ exports.refreshComponentIds = refreshComponentIds;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * 按需将代码中引用的组件旧 ID 更新为新 ID
3
+ * @param expr 表达式
4
+ * @param componentIdMap 映射: 组件原始 ID => 新生成 ID
5
+ */
6
+ export declare function renewIdInCode(code: string, componentIdMap: Map<string, string>): string;
7
+ //# sourceMappingURL=renew-id-in-code.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renew-id-in-code.d.ts","sourceRoot":"","sources":["../../../../../../src/parser/cals/utils/block/helpers/renew-id-in-code.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,UAS9E"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.renewIdInCode = void 0;
4
+ const resolve_new_id_1 = require("./resolve-new-id");
5
+ /**
6
+ * 按需将代码中引用的组件旧 ID 更新为新 ID
7
+ * @param expr 表达式
8
+ * @param componentIdMap 映射: 组件原始 ID => 新生成 ID
9
+ */
10
+ function renewIdInCode(code, componentIdMap) {
11
+ return code.replace(/(\$w\.)(\w+)/g, (match, p1, p2) => {
12
+ const newId = (0, resolve_new_id_1.resolveNewId)(p2, componentIdMap);
13
+ if (newId) {
14
+ return `${p1}${newId}`;
15
+ }
16
+ return match;
17
+ });
18
+ }
19
+ exports.renewIdInCode = renewIdInCode;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * 按需将表达式中引用的组件旧 ID 更新为新 ID
3
+ * @param expr 表达式
4
+ * @param componentIdMap 映射: 组件原始 ID => 新生成 ID
5
+ */
6
+ export declare function renewIdInExpr(expr: string, componentIdMap: Map<string, string>): any;
7
+ //# sourceMappingURL=renew-id-in-expr.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renew-id-in-expr.d.ts","sourceRoot":"","sources":["../../../../../../src/parser/cals/utils/block/helpers/renew-id-in-expr.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,OAwC9E"}
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
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;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.renewIdInExpr = void 0;
27
+ const Babel = __importStar(require("@babel/standalone"));
28
+ const resolve_new_id_1 = require("./resolve-new-id");
29
+ /**
30
+ * 按需将表达式中引用的组件旧 ID 更新为新 ID
31
+ * @param expr 表达式
32
+ * @param componentIdMap 映射: 组件原始 ID => 新生成 ID
33
+ */
34
+ function renewIdInExpr(expr, componentIdMap) {
35
+ if (typeof expr !== 'string' || expr.length === 0 || !expr.includes('$w')) {
36
+ return expr;
37
+ }
38
+ const output = Babel.transform(expr, {
39
+ plugins: [
40
+ ({ types: t }) => {
41
+ return {
42
+ visitor: {
43
+ MemberExpression({ node }) {
44
+ const { object, property } = node;
45
+ if (object.name === '$w') {
46
+ const newId = (0, resolve_new_id_1.resolveNewId)(property.name || '', componentIdMap);
47
+ if (newId) {
48
+ node.property = t.identifier(newId);
49
+ }
50
+ }
51
+ },
52
+ },
53
+ };
54
+ },
55
+ ],
56
+ });
57
+ let code = output.code.replace(/;\s$/, '');
58
+ // code wrapped in `()`
59
+ // TODO: 是否有必要?
60
+ {
61
+ const match = code.match(/^\((.*?)\)$/);
62
+ if (match === null || match === void 0 ? void 0 : match[1]) {
63
+ // eslint-disable-next-line prefer-destructuring
64
+ code = match[1];
65
+ }
66
+ }
67
+ return code;
68
+ }
69
+ exports.renewIdInExpr = renewIdInExpr;
@@ -0,0 +1,8 @@
1
+ import { ICodeResource } from '../../../../../types';
2
+ /**
3
+ * 按需将代码资源中引用的组件旧 ID 更新为新 ID
4
+ * @param resource 代码资源
5
+ * @param componentIdMap 映射: 组件原始 ID => 新生成 ID
6
+ */
7
+ export declare function renewIdInResource(resource: ICodeResource, componentIdMap: Map<string, string>): ICodeResource;
8
+ //# sourceMappingURL=renew-id-in-resource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renew-id-in-resource.d.ts","sourceRoot":"","sources":["../../../../../../src/parser/cals/utils/block/helpers/renew-id-in-resource.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAEhE;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,aAAa,EAAE,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,iBAK7F"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.renewIdInResource = void 0;
4
+ const renew_id_in_code_1 = require("./renew-id-in-code");
5
+ const types_1 = require("../../../../../types");
6
+ /**
7
+ * 按需将代码资源中引用的组件旧 ID 更新为新 ID
8
+ * @param resource 代码资源
9
+ * @param componentIdMap 映射: 组件原始 ID => 新生成 ID
10
+ */
11
+ function renewIdInResource(resource, componentIdMap) {
12
+ if (resource.codeType === types_1.ECodeType.STYLE || resource.codeType === types_1.ECodeType.THEME) {
13
+ return resource;
14
+ }
15
+ return Object.assign(Object.assign({}, resource), { code: (0, renew_id_in_code_1.renewIdInCode)(resource.code, componentIdMap) });
16
+ }
17
+ exports.renewIdInResource = renewIdInResource;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * 根据组件原始 ID,返回对应的新 ID(如没有,返回 null)
3
+ * @param originId 组件原始 ID
4
+ * @param componentIdMap 映射: 组件原始 ID => 新生成 ID
5
+ */
6
+ export declare function resolveNewId(originId: string, componentIdMap: Map<string, string>): string;
7
+ //# sourceMappingURL=resolve-new-id.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-new-id.d.ts","sourceRoot":"","sources":["../../../../../../src/parser/cals/utils/block/helpers/resolve-new-id.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,UAajF"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolveNewId = void 0;
4
+ /**
5
+ * 根据组件原始 ID,返回对应的新 ID(如没有,返回 null)
6
+ * @param originId 组件原始 ID
7
+ * @param componentIdMap 映射: 组件原始 ID => 新生成 ID
8
+ */
9
+ function resolveNewId(originId, componentIdMap) {
10
+ var _a;
11
+ if (/^(?:index|item)_/.test(originId)) {
12
+ // Repeater 表达式处理逻辑
13
+ // 'index_repeater1' => ['index_repeater1', 'index', 'repeater1']
14
+ const [, prefix, oldId] = originId.match(/^(index|item)_(.*)$/);
15
+ if (componentIdMap.has(oldId)) {
16
+ return `${prefix}_${componentIdMap.get(oldId)}`;
17
+ }
18
+ }
19
+ return (_a = componentIdMap.get(originId)) !== null && _a !== void 0 ? _a : null;
20
+ }
21
+ exports.resolveNewId = resolveNewId;
@@ -1,4 +1,7 @@
1
1
  import { IPlatformComponent } from '../../../../types';
2
+ import { IVisitedContext } from './helpers/remap-component-ids';
3
+ export { renewIdInResource } from './helpers/renew-id-in-resource';
4
+ export { VisitedMap } from './helpers/remap-component-ids';
2
5
  interface IParseContext {
3
6
  component?: {
4
7
  id: string;
@@ -11,5 +14,7 @@ interface IParseContext {
11
14
  componentLibMap: Record<string, any>;
12
15
  }
13
16
  export declare function parseComponentCals(ctx: IParseContext, cals: IPlatformComponent): IParseContext;
14
- export {};
17
+ export declare function regenBlockTemplateComponent(ctx: {
18
+ visiting: IVisitedContext;
19
+ }, component: IPlatformComponent): IPlatformComponent;
15
20
  //# 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,kBAAkB,EAAqB,MAAM,mBAAmB,CAAC;AAK1E,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,kBAAkB,GAAG,aAAa,CAyD9F"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/parser/cals/utils/block/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAqB,MAAM,mBAAmB,CAAC;AAI1E,OAAO,EAAE,eAAe,EAA0C,MAAM,+BAA+B,CAAC;AAExG,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,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,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,kBAAkB,GAAG,aAAa,CAyD9F;AA+GD,wBAAgB,2BAA2B,CACzC,GAAG,EAAE;IAAE,QAAQ,EAAE,eAAe,CAAA;CAAE,EAClC,SAAS,EAAE,kBAAkB,GAC5B,kBAAkB,CAepB"}
@@ -3,10 +3,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.parseComponentCals = void 0;
6
+ exports.regenBlockTemplateComponent = exports.parseComponentCals = exports.VisitedMap = exports.renewIdInResource = void 0;
7
7
  const get_1 = __importDefault(require("lodash/get"));
8
8
  const set_1 = __importDefault(require("lodash/set"));
9
9
  const expression_1 = require("../../../expression");
10
+ const remap_component_ids_1 = require("./helpers/remap-component-ids");
11
+ var renew_id_in_resource_1 = require("./helpers/renew-id-in-resource");
12
+ Object.defineProperty(exports, "renewIdInResource", { enumerable: true, get: function () { return renew_id_in_resource_1.renewIdInResource; } });
13
+ var remap_component_ids_2 = require("./helpers/remap-component-ids");
14
+ Object.defineProperty(exports, "VisitedMap", { enumerable: true, get: function () { return remap_component_ids_2.VisitedMap; } });
10
15
  function parseComponentCals(ctx, cals) {
11
16
  if (!ctx.datasetMap) {
12
17
  ctx.datasetMap = {};
@@ -149,3 +154,10 @@ function parseValueCals(ctx, value) {
149
154
  }
150
155
  }
151
156
  }
157
+ function regenBlockTemplateComponent(ctx, component) {
158
+ const { componentIdMap } = (0, remap_component_ids_1.remapComponentIds)([component], ctx.visiting);
159
+ const processed = (0, remap_component_ids_1.refreshComponentIds)({ componentIdMap }, component);
160
+ // todo: 需要处理extra.dataForm
161
+ return Object.assign(Object.assign({}, processed), { extra: Object.assign(Object.assign({}, processed.extra), { xIndex: undefined, anchored: true }) });
162
+ }
163
+ exports.regenBlockTemplateComponent = regenBlockTemplateComponent;
@@ -1,4 +1,4 @@
1
- import { IPlatformApp, IPlatformSubApp } from '../../../types';
1
+ import { IPlatformApp, IPlatformSubApp, IPlatformComponent } from '../../../types';
2
2
  import { IDataBind } from '../../expression/index';
3
3
  declare type IUsedComponentResources = {
4
4
  [libName: string]: Set<string>;
@@ -22,5 +22,7 @@ export declare function generateCustomLoginConfigPathname({ appId, version }: {
22
22
  appId: string;
23
23
  version: string;
24
24
  }): string;
25
+ export declare function walkThroughComponents(components: IPlatformComponent[], visit: any): any[];
26
+ export declare const DYNAMIC_KEY_REG: RegExp;
25
27
  export {};
26
28
  //# sourceMappingURL=common.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/parser/cals/utils/common.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,YAAY,EAAE,eAAe,EAAsB,MAAM,gBAAgB,CAAC;AAEnG,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAsBnD,aAAK,uBAAuB,GAAG;IAAE,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAAA;CAAE,CAAC;AAOlE,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,cAAc,UAAQ,UAQ5D;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,WAErC;AAED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,SAAS,WAQpE;AAyJD,wBAAgB,YAAY,CAE1B,IAAI,EAAE,CAAC,YAAY,GAAG,eAAe,CAAC,EAAE,EAExC,YAAY,EAAE,GAAG,EAAE,EACnB,OAAO,CAAC,EAAE;IACR,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,UAAU,EAAE,OAAO,CAAC;CACrB,GACA,uBAAuB,GAAG;IAAE,SAAS,EAAE,uBAAuB,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAA;CAAE,CA+EvG;AAED,wBAAgB,iCAAiC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,UASvG;AAED,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,kBAAkB,EAAO,EAAE,KAAK,KAAA,SAUjF;AAED,eAAO,MAAM,eAAe,QAAY,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateCustomLoginConfigPathname = exports.getUsedComps = exports.isValidClassNameListBind = exports.isValidStyleBind = exports.isEmptyObj = exports.isPlainObject = exports.camelcase = void 0;
3
+ exports.DYNAMIC_KEY_REG = exports.walkThroughComponents = exports.generateCustomLoginConfigPathname = exports.getUsedComps = exports.isValidClassNameListBind = exports.isValidStyleBind = exports.isEmptyObj = exports.isPlainObject = exports.camelcase = void 0;
4
4
  const utils_1 = require("../../../utils");
5
5
  const index_1 = require("../index");
6
6
  function camelcase(str, firstUpperCase = false) {
@@ -275,3 +275,16 @@ function generateCustomLoginConfigPathname({ appId, version }) {
275
275
  return pathname;
276
276
  }
277
277
  exports.generateCustomLoginConfigPathname = generateCustomLoginConfigPathname;
278
+ function walkThroughComponents(components = [], visit) {
279
+ return components
280
+ .map((component) => {
281
+ const visiteComponent = visit(component);
282
+ if (visiteComponent.items) {
283
+ visiteComponent.items = walkThroughComponents(visiteComponent.items || [], visit);
284
+ }
285
+ return visiteComponent;
286
+ })
287
+ .filter((item) => !!item);
288
+ }
289
+ exports.walkThroughComponents = walkThroughComponents;
290
+ exports.DYNAMIC_KEY_REG = /^:(.*)$/;
@@ -0,0 +1,7 @@
1
+ import { IPlatformApp } from '../../../utils';
2
+ export declare function generateBlockTemplateMap(blockTemplates?: any[]): any;
3
+ export declare function getUsedReference(apps?: IPlatformApp[], templates?: any[]): {
4
+ includes: Set<any>;
5
+ refs: Set<any>;
6
+ };
7
+ //# sourceMappingURL=getUsedReference.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getUsedReference.d.ts","sourceRoot":"","sources":["../../../../src/parser/cals/utils/getUsedReference.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,wBAAgB,wBAAwB,CAAC,cAAc,QAAK,OAU3D;AAQD,wBAAgB,gBAAgB,CAAC,IAAI,GAAE,YAAY,EAAO,EAAE,SAAS,GAAE,GAAG,EAAO;;;EAqBhF"}
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getUsedReference = exports.generateBlockTemplateMap = void 0;
4
+ function generateBlockTemplateMap(blockTemplates = []) {
5
+ return blockTemplates.reduce((map, block) => {
6
+ if (block.name) {
7
+ map[block.name] = block;
8
+ }
9
+ if (block.path) {
10
+ map[block.path] = block;
11
+ }
12
+ return map;
13
+ }, {});
14
+ }
15
+ exports.generateBlockTemplateMap = generateBlockTemplateMap;
16
+ function getUsedReference(apps = [], templates = []) {
17
+ const templateMap = generateBlockTemplateMap(templates);
18
+ const includes = new Set([]);
19
+ const refs = new Set([]);
20
+ apps.forEach((cals) => {
21
+ const { include = [] } = (cals === null || cals === void 0 ? void 0 : cals.extra) || {};
22
+ include.forEach((path) => {
23
+ includes.add(path);
24
+ });
25
+ cals.items.forEach((page) => {
26
+ const { include = [] } = (page === null || page === void 0 ? void 0 : page.extra) || {};
27
+ include.forEach((path) => {
28
+ includes.add(path);
29
+ });
30
+ page === null || page === void 0 ? void 0 : page.items.forEach((component) => getComponentUsedReference({ includes, refs, blockTemplateMap: templateMap }, component));
31
+ });
32
+ });
33
+ return { includes, refs };
34
+ }
35
+ exports.getUsedReference = getUsedReference;
36
+ function getComponentUsedReference(ctx, component) {
37
+ var _a;
38
+ const { blockTemplateMap } = ctx;
39
+ if (!component) {
40
+ return;
41
+ }
42
+ const { extra } = component;
43
+ const { ref, include = [] } = extra || {};
44
+ include.forEach((path) => {
45
+ ctx.includes.add(path);
46
+ });
47
+ if (ref) {
48
+ if (!ctx.refs.has(ref) && blockTemplateMap[ref]) {
49
+ ctx.refs.add(ref);
50
+ getComponentUsedReference(ctx, blockTemplateMap[ref]);
51
+ }
52
+ }
53
+ else {
54
+ (_a = component.items) === null || _a === void 0 ? void 0 : _a.forEach((component) => getComponentUsedReference(ctx, component));
55
+ }
56
+ }
@@ -2,10 +2,12 @@ export * from './cals/index';
2
2
  export { upgrageToVersion2 } from './cals/utils/version';
3
3
  export { processComponentModule } from './cals/utils/spinoff';
4
4
  export { calsToCode, codeToCals, type ICodeItem, checkForConflicts, autoResolveConflicts, findAllConflicts, } from './cals/utils/code';
5
- export { parseComponentCals } from './cals/utils/block';
5
+ export { parseComponentCals, regenBlockTemplateComponent, renewIdInResource, VisitedMap } from './cals/utils/block';
6
6
  export { ActionType, type IDataBind, PropBindType } from './expression/index';
7
7
  export { processCommonStyle2CSSProperties, processCSSProperties2Rem, processCSSPropertiesUnit, } from './cals/utils/style';
8
8
  export { getUsedResources, getNavUsedStaticResource, _simpleGetUsedResourceOfComponent, } from './cals/utils/getUsedResources';
9
+ export { getUsedReference } from './cals/utils/getUsedReference';
9
10
  export { default as PostcssRpx2Calc } from './plugins/postcss-rpx2clac';
10
11
  export { Dependencies } from './dependiencies';
12
+ export { walkThroughComponents, DYNAMIC_KEY_REG } from './cals/utils/common';
11
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/parser/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EACL,UAAU,EACV,UAAU,EACV,KAAK,SAAS,EACd,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,KAAK,SAAS,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EACL,gCAAgC,EAChC,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EACxB,iCAAiC,GAClC,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/parser/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EACL,UAAU,EACV,UAAU,EACV,KAAK,SAAS,EACd,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,2BAA2B,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACpH,OAAO,EAAE,UAAU,EAAE,KAAK,SAAS,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EACL,gCAAgC,EAChC,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EACxB,iCAAiC,GAClC,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC"}
@@ -17,7 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.Dependencies = exports.PostcssRpx2Calc = exports._simpleGetUsedResourceOfComponent = exports.getNavUsedStaticResource = exports.getUsedResources = exports.processCSSPropertiesUnit = exports.processCSSProperties2Rem = exports.processCommonStyle2CSSProperties = exports.PropBindType = exports.ActionType = exports.parseComponentCals = exports.findAllConflicts = exports.autoResolveConflicts = exports.checkForConflicts = exports.codeToCals = exports.calsToCode = exports.processComponentModule = exports.upgrageToVersion2 = void 0;
20
+ exports.DYNAMIC_KEY_REG = exports.walkThroughComponents = exports.Dependencies = exports.PostcssRpx2Calc = exports.getUsedReference = exports._simpleGetUsedResourceOfComponent = exports.getNavUsedStaticResource = exports.getUsedResources = exports.processCSSPropertiesUnit = exports.processCSSProperties2Rem = exports.processCommonStyle2CSSProperties = exports.PropBindType = exports.ActionType = exports.VisitedMap = exports.renewIdInResource = exports.regenBlockTemplateComponent = exports.parseComponentCals = exports.findAllConflicts = exports.autoResolveConflicts = exports.checkForConflicts = exports.codeToCals = exports.calsToCode = exports.processComponentModule = exports.upgrageToVersion2 = void 0;
21
21
  __exportStar(require("./cals/index"), exports);
22
22
  var version_1 = require("./cals/utils/version");
23
23
  Object.defineProperty(exports, "upgrageToVersion2", { enumerable: true, get: function () { return version_1.upgrageToVersion2; } });
@@ -31,6 +31,9 @@ Object.defineProperty(exports, "autoResolveConflicts", { enumerable: true, get:
31
31
  Object.defineProperty(exports, "findAllConflicts", { enumerable: true, get: function () { return code_1.findAllConflicts; } });
32
32
  var block_1 = require("./cals/utils/block");
33
33
  Object.defineProperty(exports, "parseComponentCals", { enumerable: true, get: function () { return block_1.parseComponentCals; } });
34
+ Object.defineProperty(exports, "regenBlockTemplateComponent", { enumerable: true, get: function () { return block_1.regenBlockTemplateComponent; } });
35
+ Object.defineProperty(exports, "renewIdInResource", { enumerable: true, get: function () { return block_1.renewIdInResource; } });
36
+ Object.defineProperty(exports, "VisitedMap", { enumerable: true, get: function () { return block_1.VisitedMap; } });
34
37
  var index_1 = require("./expression/index");
35
38
  Object.defineProperty(exports, "ActionType", { enumerable: true, get: function () { return index_1.ActionType; } });
36
39
  Object.defineProperty(exports, "PropBindType", { enumerable: true, get: function () { return index_1.PropBindType; } });
@@ -42,7 +45,12 @@ var getUsedResources_1 = require("./cals/utils/getUsedResources");
42
45
  Object.defineProperty(exports, "getUsedResources", { enumerable: true, get: function () { return getUsedResources_1.getUsedResources; } });
43
46
  Object.defineProperty(exports, "getNavUsedStaticResource", { enumerable: true, get: function () { return getUsedResources_1.getNavUsedStaticResource; } });
44
47
  Object.defineProperty(exports, "_simpleGetUsedResourceOfComponent", { enumerable: true, get: function () { return getUsedResources_1._simpleGetUsedResourceOfComponent; } });
48
+ var getUsedReference_1 = require("./cals/utils/getUsedReference");
49
+ Object.defineProperty(exports, "getUsedReference", { enumerable: true, get: function () { return getUsedReference_1.getUsedReference; } });
45
50
  var postcss_rpx2clac_1 = require("./plugins/postcss-rpx2clac");
46
51
  Object.defineProperty(exports, "PostcssRpx2Calc", { enumerable: true, get: function () { return __importDefault(postcss_rpx2clac_1).default; } });
47
52
  var dependiencies_1 = require("./dependiencies");
48
53
  Object.defineProperty(exports, "Dependencies", { enumerable: true, get: function () { return dependiencies_1.Dependencies; } });
54
+ var common_1 = require("./cals/utils/common");
55
+ Object.defineProperty(exports, "walkThroughComponents", { enumerable: true, get: function () { return common_1.walkThroughComponents; } });
56
+ Object.defineProperty(exports, "DYNAMIC_KEY_REG", { enumerable: true, get: function () { return common_1.DYNAMIC_KEY_REG; } });
@@ -55,10 +55,6 @@ export interface IPlatformComponentExtra {
55
55
  * style bind path
56
56
  */
57
57
  styleBindPath?: string;
58
- /**
59
- * 未知用处 children
60
- */
61
- children?: IPlatformComponent[];
62
58
  /**
63
59
  * @deprecated
64
60
  * 是否再门户网站中的菜单中隐藏页面对应的菜单项
@@ -87,6 +83,19 @@ export interface IPlatformComponentExtra {
87
83
  title: string;
88
84
  [key: string]: any;
89
85
  }>;
86
+ /**
87
+ * 表示当前节点源于开发态引用关系
88
+ */
89
+ ref?: string;
90
+ /**
91
+ * 引用节点的初始属性
92
+ * 冗余记录为了diff
93
+ */
94
+ refAttributes?: IPlatformAttributes;
95
+ /**
96
+ * 表示需要引用外部/本地资源
97
+ */
98
+ include?: string[];
90
99
  }
91
100
  /**
92
101
  * 默认组件, 由平台提供的组件
@@ -1 +1 @@
1
- {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/types/platform/component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGnD,aAAK,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAE5B;;GAEG;AACH,eAAO,MAAM,cAAc;;;;CAIjB,CAAC;AAEX,MAAM,WAAW,mBAAoB,SAAQ,KAAK,CAAC,WAAW;IAC5D;;OAEG;I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C;IACpC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,eAAgB,SAAQ,kBAAkB;IACzD,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB;IAC3D,IAAI,CAAC,EAAE,SAAS,CAAC;IAEjB,EAAE,EAAE,MAAM,CAAC;CACZ;AAED;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,kBAAkB,EAAE,QAAQ,CAAC;IACxE,IAAI,EAAE,MAAM,CAAC;IACb,sBAAsB;IACtB,EAAE,EAAE,MAAM,CAAC;IAEX,KAAK,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAE7B;;OAEG;IACH,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAE3B;;OAEG;IAGH;;;;OAIG;IACH,aAAa,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAEtC;;;;OAIG;IACH,SAAS,CAAC,EAAE,aAAa,EAAE,CAAC;CAQ7B;AAED,MAAM,WAAW,uBAAwB,SAAQ,KAAK,CAAC,OAAO;IAC5D;;OAEG;IACH,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC;;OAEG;IACH,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC;;OAEG;IACH,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC;;OAEG;IACH,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC;;OAEG;IACH,0BAA0B,CAAC,EAAE,MAAM,CAAC;CACrC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/cals",
3
- "version": "1.0.70",
3
+ "version": "1.0.72-alpha.0",
4
4
  "description": "Common application specifications",
5
5
  "main": "lib/utils/index.js",
6
6
  "source": "src/utils/index.ts",
@@ -38,7 +38,6 @@
38
38
  "acorn": "^8.0.4",
39
39
  "csstype": "^3.1.2",
40
40
  "json-easy-filter": "^0.3.1",
41
- "json-schema-to-typescript-for-browser": "^11.0.3",
42
41
  "lodash": "^4.17.20",
43
42
  "postcss": "^8.4.20",
44
43
  "postcss-less": "^6.0.0",
@@ -55,6 +54,7 @@
55
54
  "ajv": "^8.8.2",
56
55
  "jest-fetch-mock": "^3.0.3",
57
56
  "jsdom-worker": "^0.3.0",
57
+ "json-schema-to-typescript-for-browser": "^11.0.3",
58
58
  "minimist": "^1.2.8",
59
59
  "node-watch": "^0.7.3",
60
60
  "ts-node": "^10.4.0",