@cloudbase/cals 0.3.19 → 0.3.22-alpha.1

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 (31) hide show
  1. package/README.md +17 -10
  2. package/lib/parser/cals/index.d.ts +22 -68
  3. package/lib/parser/cals/index.d.ts.map +1 -1
  4. package/lib/parser/cals/index.js +134 -96
  5. package/lib/parser/cals/utils/block/index.js +2 -2
  6. package/lib/parser/cals/utils/common.d.ts +5 -0
  7. package/lib/parser/cals/utils/common.d.ts.map +1 -1
  8. package/lib/parser/cals/utils/common.js +125 -1
  9. package/lib/parser/cals/utils/runtime.d.ts +4 -1
  10. package/lib/parser/cals/utils/runtime.d.ts.map +1 -1
  11. package/lib/parser/cals/utils/runtime.js +7 -0
  12. package/lib/parser/cals/utils/spinoff/index.d.ts.map +1 -1
  13. package/lib/parser/expression/index.d.ts +8 -1
  14. package/lib/parser/expression/index.d.ts.map +1 -1
  15. package/lib/parser/expression/index.js +6 -1
  16. package/lib/tsconfig.tsbuildinfo +1 -1
  17. package/lib/types/platform/app.d.ts +15 -1
  18. package/lib/types/platform/app.d.ts.map +1 -1
  19. package/lib/types/platform/common.d.ts +7 -7
  20. package/lib/types/platform/common.d.ts.map +1 -1
  21. package/lib/types/platform/common.js +4 -5
  22. package/lib/types/platform/component.d.ts +17 -30
  23. package/lib/types/platform/component.d.ts.map +1 -1
  24. package/lib/types/platform/component.js +5 -6
  25. package/lib/types/platform/datasource.d.ts +9 -5
  26. package/lib/types/platform/datasource.d.ts.map +1 -1
  27. package/package.json +6 -2
  28. package/lib/schema/platform_application.json +0 -2177
  29. package/lib/tests/common-application-specs.test.d.ts +0 -2
  30. package/lib/tests/common-application-specs.test.d.ts.map +0 -1
  31. package/lib/tests/common-application-specs.test.js +0 -45
@@ -11,12 +11,13 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  return t;
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
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 = void 0;
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
- const types_1 = require("../../types");
17
+ var common_2 = require("./utils/common");
18
+ Object.defineProperty(exports, "getUsedComps", { enumerable: true, get: function () { return common_2.getUsedComps; } });
18
19
  const expression_1 = require("../expression");
19
- const common_2 = require("./utils/common");
20
+ const common_3 = require("./utils/common");
20
21
  const style_1 = require("./utils/style");
21
22
  const runtime_1 = require("./utils/runtime");
22
23
  const config_1 = require("./utils/version/config");
@@ -32,14 +33,14 @@ function serializeValue({ ctx, key, dynamicValue, scope = 'page', streamlineDefa
32
33
  case expression_1.PropBindType.computed:
33
34
  case expression_1.PropBindType.dataVar:
34
35
  case expression_1.PropBindType.stateData:
35
- case expression_1.PropBindType.paramData: {
36
+ case expression_1.PropBindType.params: {
36
37
  const TYPE_MAP = {
37
38
  [expression_1.PropBindType.prop]: 'props',
38
39
  [expression_1.PropBindType.state]: 'state',
39
40
  [expression_1.PropBindType.computed]: 'computed',
40
41
  [expression_1.PropBindType.dataVar]: 'dataVar',
41
42
  [expression_1.PropBindType.stateData]: 'dataset.state',
42
- [expression_1.PropBindType.paramData]: 'dataset.params',
43
+ [expression_1.PropBindType.params]: 'dataset.params',
43
44
  };
44
45
  let exp = dynamicValue.value;
45
46
  let reg = /^(.*?)\./;
@@ -84,12 +85,13 @@ function serializeValue({ ctx, key, dynamicValue, scope = 'page', streamlineDefa
84
85
  value = undefined;
85
86
  }
86
87
  }
87
- return { key, value };
88
+ return { key, value, extra: dynamicValue.extra };
88
89
  }
89
90
  exports.serializeValue = serializeValue;
90
- function deserializeValue(ctx, key, value) {
91
+ const DYNAMIC_KEY_REG = /^:(.*)$/;
92
+ function deserializeValue(ctx, key, value, extra) {
91
93
  var _a;
92
- let matched = key.match(/^:(.*)$/);
94
+ let matched = key.match(DYNAMIC_KEY_REG);
93
95
  if (matched) {
94
96
  let key = matched[1];
95
97
  let type = expression_1.PropBindType.expression;
@@ -117,7 +119,7 @@ function deserializeValue(ctx, key, value) {
117
119
  }
118
120
  return {
119
121
  key,
120
- value: { type, value },
122
+ value: { type, value, extra },
121
123
  };
122
124
  }
123
125
  else {
@@ -128,13 +130,19 @@ function deserializeValue(ctx, key, value) {
128
130
  : {
129
131
  type: undefined /*'static'*/,
130
132
  value,
133
+ extra,
131
134
  },
132
135
  };
133
136
  }
134
137
  }
135
138
  exports.deserializeValue = deserializeValue;
136
- function serializeDynamicMap({ ctx, map = {}, scope = 'page', streamlineDefaultValue, }) {
139
+ function serializeDynamicMap(props) {
140
+ return serializeDynamicMapWithExtra(props).data;
141
+ }
142
+ exports.serializeDynamicMap = serializeDynamicMap;
143
+ function serializeDynamicMapWithExtra({ ctx, map = {}, scope = 'page', streamlineDefaultValue, }) {
137
144
  let data = {};
145
+ let extra = {};
138
146
  Object.keys(map)
139
147
  .sort((a, b) => {
140
148
  const aPath = a.split('.');
@@ -149,7 +157,7 @@ function serializeDynamicMap({ ctx, map = {}, scope = 'page', streamlineDefaultV
149
157
  }
150
158
  })
151
159
  .forEach((key) => {
152
- let { key: processedKey, value: processedValue } = serializeValue({
160
+ let { key: processedKey, value: processedValue, extra: processedExtra, } = serializeValue({
153
161
  ctx,
154
162
  key,
155
163
  dynamicValue: map[key],
@@ -157,17 +165,17 @@ function serializeDynamicMap({ ctx, map = {}, scope = 'page', streamlineDefaultV
157
165
  streamlineDefaultValue,
158
166
  });
159
167
  let matched = processedKey.match(/^:(.*)$/);
168
+ let originKey = processedKey;
160
169
  if (matched) {
161
- const originValue = matched[1];
162
- (0, lodash_1.unset)(data, originValue);
170
+ originKey = matched[1];
171
+ (0, lodash_1.unset)(data, originKey);
163
172
  }
164
173
  if ((0, lodash_1.get)(data, processedKey) == undefined) {
165
- let ValueTmp = processedValue;
166
174
  /* 选区结构处理 [formily] to [CALS] */
167
- if (Array.isArray(ValueTmp) &&
168
- (ValueTmp === null || ValueTmp === void 0 ? void 0 : ValueTmp.some((item) => item && item.selectableBlock))) {
169
- ValueTmp = (0, lodash_1.cloneDeep)(processedValue);
170
- ValueTmp === null || ValueTmp === void 0 ? void 0 : ValueTmp.map((_value) => {
175
+ if (Array.isArray(processedValue) &&
176
+ (processedValue === null || processedValue === void 0 ? void 0 : processedValue.some((item) => item && item.selectableBlock))) {
177
+ let valueTmp = (0, lodash_1.cloneDeep)(processedValue);
178
+ valueTmp === null || valueTmp === void 0 ? void 0 : valueTmp.map((_value) => {
171
179
  var _a, _b, _c;
172
180
  const xProp = (_a = _value === null || _value === void 0 ? void 0 : _value.selectableBlock) === null || _a === void 0 ? void 0 : _a['x-props'];
173
181
  const xComponent = (_c = (_b = _value === null || _value === void 0 ? void 0 : _value.selectableBlock) === null || _b === void 0 ? void 0 : _b['x-component']) === null || _c === void 0 ? void 0 : _c.toLowerCase();
@@ -181,24 +189,24 @@ function serializeDynamicMap({ ctx, map = {}, scope = 'page', streamlineDefaultV
181
189
  return _value;
182
190
  });
183
191
  }
184
- data[processedKey] = ValueTmp;
192
+ data[processedKey] = processedValue;
185
193
  }
194
+ extra[originKey] = processedExtra;
186
195
  });
187
- return data;
196
+ return { data, extra };
188
197
  }
189
- exports.serializeDynamicMap = serializeDynamicMap;
190
- function deserializeDynamicMap(ctx, map) {
198
+ function deserializeDynamicMap(ctx, map, extraMap) {
191
199
  var _a, _b, _c;
192
200
  let data = {};
193
201
  for (let key in map || {}) {
194
202
  let value = (_a = map) === null || _a === void 0 ? void 0 : _a[key];
195
- let { key: processedKey, value: processedValue } = deserializeValue(ctx, key, value);
196
- let ValueTmp = processedValue;
203
+ let matched = key.match(DYNAMIC_KEY_REG);
204
+ let { key: processedKey, value: processedValue } = deserializeValue(ctx, key, value, extraMap === null || extraMap === void 0 ? void 0 : extraMap[matched ? matched[1] : key]);
197
205
  /* 选区结构处理 [CALS] to [formily] */
198
206
  if (Array.isArray(processedValue === null || processedValue === void 0 ? void 0 : processedValue.value) &&
199
207
  ((_b = processedValue === null || processedValue === void 0 ? void 0 : processedValue.value) === null || _b === void 0 ? void 0 : _b.some((item) => item && item.selectableBlock))) {
200
- ValueTmp = (0, lodash_1.cloneDeep)(processedValue);
201
- (_c = ValueTmp === null || ValueTmp === void 0 ? void 0 : ValueTmp.value) === null || _c === void 0 ? void 0 : _c.map((_value) => {
208
+ let valueTmp = (0, lodash_1.cloneDeep)(processedValue);
209
+ (_c = valueTmp === null || valueTmp === void 0 ? void 0 : valueTmp.value) === null || _c === void 0 ? void 0 : _c.forEach((_value) => {
202
210
  var _a, _b, _c, _d;
203
211
  const module = (_b = (_a = _value === null || _value === void 0 ? void 0 : _value.selectableBlock) === null || _a === void 0 ? void 0 : _a.module) === null || _b === void 0 ? void 0 : _b.toLowerCase();
204
212
  const component = (_d = (_c = _value === null || _value === void 0 ? void 0 : _value.selectableBlock) === null || _c === void 0 ? void 0 : _c.component) === null || _d === void 0 ? void 0 : _d.toLowerCase();
@@ -210,21 +218,24 @@ function deserializeDynamicMap(ctx, map) {
210
218
  return _value;
211
219
  });
212
220
  }
213
- data[processedKey] = ValueTmp;
221
+ data[processedKey] = processedValue;
214
222
  }
215
223
  return data;
216
224
  }
217
225
  exports.deserializeDynamicMap = deserializeDynamicMap;
218
226
  function serializeAttributes(ctx, scope, attributes = {}) {
219
- return serializeDynamicMap({
227
+ return serializeAttributesWithExtra(ctx, scope, attributes).data;
228
+ }
229
+ exports.serializeAttributes = serializeAttributes;
230
+ function serializeAttributesWithExtra(ctx, scope, attributes = {}) {
231
+ return serializeDynamicMapWithExtra({
220
232
  ctx,
221
233
  scope,
222
234
  map: attributes,
223
235
  streamlineDefaultValue: ctx.streamlineDefaultValue,
224
236
  });
225
237
  }
226
- exports.serializeAttributes = serializeAttributes;
227
- function deserializeAttributes(ctx, attributes = {}) {
238
+ function deserializeAttributes(ctx, attributes = {}, attributesExtraData = {}) {
228
239
  const reservedAttributes = ['style', 'commonStyle', 'class'];
229
240
  const reservedAttributesMap = reservedAttributes.reduce((map, key) => {
230
241
  map[key] = true;
@@ -240,7 +251,7 @@ function deserializeAttributes(ctx, attributes = {}) {
240
251
  restAttributes[key] = attributes[key];
241
252
  }
242
253
  }
243
- return deserializeDynamicMap(ctx, restAttributes);
254
+ return deserializeDynamicMap(ctx, restAttributes, attributesExtraData);
244
255
  }
245
256
  exports.deserializeAttributes = deserializeAttributes;
246
257
  /**
@@ -252,20 +263,20 @@ function serializeDataset(ctx, dataset) {
252
263
  return dataset;
253
264
  const result = JSON.parse(JSON.stringify(dataset));
254
265
  Object.values(result.state).forEach((state) => {
255
- var _a, _b;
266
+ var _a, _b, _c, _d;
256
267
  if (state.varType !== 'datasource')
257
268
  return;
258
269
  if ((_a = state.initMethod) === null || _a === void 0 ? void 0 : _a.params) {
259
- state.initMethod.params = serializeDynamicMap({
270
+ state.initMethod.params = (_b = serializeDynamicMapWithExtra({
260
271
  ctx,
261
272
  map: state.initMethod.params,
262
- });
273
+ })) === null || _b === void 0 ? void 0 : _b.data;
263
274
  }
264
- if ((_b = state.updateMethod) === null || _b === void 0 ? void 0 : _b.params) {
265
- state.updateMethod.params = serializeDynamicMap({
275
+ if ((_c = state.updateMethod) === null || _c === void 0 ? void 0 : _c.params) {
276
+ state.updateMethod.params = (_d = serializeDynamicMapWithExtra({
266
277
  ctx,
267
278
  map: state.updateMethod.params,
268
- });
279
+ })) === null || _d === void 0 ? void 0 : _d.data;
269
280
  }
270
281
  });
271
282
  return result;
@@ -375,10 +386,10 @@ function serializeListener(ctx, listener) {
375
386
  module: /^comp\-\w+$/.test(listener.handler.moduleName)
376
387
  ? '$comp'
377
388
  : listener.handler.moduleName,
378
- params: serializeDynamicMap({
389
+ params: serializeDynamicMapWithExtra({
379
390
  ctx,
380
391
  map: listener.data,
381
- }),
392
+ }).data,
382
393
  },
383
394
  isCapturePhase: listener.isCapturePhase,
384
395
  };
@@ -490,45 +501,59 @@ function serializeComponent(ctx, component, scope = 'page') {
490
501
  if (componentCtx.dependencies && !componentCtx.dependenciesMap) {
491
502
  componentCtx.dependenciesMap = processDependenciesMap(componentCtx.dependencies || []);
492
503
  }
504
+ const { data: attributes = {}, extra: attributeExtraData = {}, } = serializeAttributesWithExtra(componentCtx, scope, (component.xProps.data || {}));
505
+ let classListBindData = null;
506
+ let styleBindData = null;
507
+ if ((_d = component === null || component === void 0 ? void 0 : component.xProps) === null || _d === void 0 ? void 0 : _d.classListBind) {
508
+ classListBindData = serializeValue({
509
+ ctx: componentCtx,
510
+ key: 'classListBind',
511
+ dynamicValue: (_e = component === null || component === void 0 ? void 0 : component.xProps) === null || _e === void 0 ? void 0 : _e.classListBind,
512
+ scope,
513
+ });
514
+ if (classListBindData.extra) {
515
+ attributeExtraData['class'] = classListBindData.extra;
516
+ }
517
+ }
518
+ if ((_f = component === null || component === void 0 ? void 0 : component.xProps) === null || _f === void 0 ? void 0 : _f.styleBind) {
519
+ styleBindData = serializeValue({
520
+ ctx: componentCtx,
521
+ key: 'styleBind',
522
+ dynamicValue: (_g = component === null || component === void 0 ? void 0 : component.xProps) === null || _g === void 0 ? void 0 : _g.styleBind,
523
+ });
524
+ if (styleBindData.extra) {
525
+ attributeExtraData['style'] = styleBindData.extra;
526
+ }
527
+ }
493
528
  return {
494
529
  id: component.id,
495
530
  type: undefined,
496
531
  module: serializeModuleName(componentCtx, moduleName, componentName),
497
532
  component: componentName,
498
533
  attributes: (0, runtime_1.getValidValue)(component.xProps
499
- ? Object.assign(Object.assign({}, serializeAttributes(componentCtx, scope, (component.xProps.data || {}))), { style: (_d = component.xProps) === null || _d === void 0 ? void 0 : _d.style, class: (_f = (_e = component.xProps) === null || _e === void 0 ? void 0 : _e.classList) === null || _f === void 0 ? void 0 : _f.join(' ') }) : undefined),
534
+ ? Object.assign(Object.assign({}, attributes), { style: (_h = component.xProps) === null || _h === void 0 ? void 0 : _h.style, class: (_k = (_j = component.xProps) === null || _j === void 0 ? void 0 : _j.classList) === null || _k === void 0 ? void 0 : _k.join(' ') }) : undefined),
500
535
  items: component.properties
501
536
  ? Object.keys(component.properties).map((key) => {
502
537
  var _a;
503
538
  return serializeComponent(componentCtx, Object.assign({ id: key }, (_a = component.properties) === null || _a === void 0 ? void 0 : _a[key]), scope);
504
539
  })
505
540
  : undefined,
506
- listeners: (0, runtime_1.getValidValue)((_h = (_g = component.xProps) === null || _g === void 0 ? void 0 : _g.listeners) === null || _h === void 0 ? void 0 : _h.map((listener) => {
541
+ listeners: (0, runtime_1.getValidValue)((_m = (_l = component.xProps) === null || _l === void 0 ? void 0 : _l.listeners) === null || _m === void 0 ? void 0 : _m.map((listener) => {
507
542
  return serializeListener(componentCtx, listener);
508
543
  })),
509
- directives: serializeDirecties(componentCtx, (((_j = component.xProps) === null || _j === void 0 ? void 0 : _j.directives) || {}), scope) || {
544
+ directives: serializeDirecties(componentCtx, (((_o = component.xProps) === null || _o === void 0 ? void 0 : _o.directives) || {}), scope) || {
510
545
  ':if': true,
511
546
  },
512
- ':class': ((_k = component === null || component === void 0 ? void 0 : component.xProps) === null || _k === void 0 ? void 0 : _k.classListBind)
513
- ? serializeValue({
514
- ctx: componentCtx,
515
- key: 'classListBind',
516
- dynamicValue: (_l = component === null || component === void 0 ? void 0 : component.xProps) === null || _l === void 0 ? void 0 : _l.classListBind,
517
- scope,
518
- }).value
519
- : undefined,
520
- ':style': ((_m = component === null || component === void 0 ? void 0 : component.xProps) === null || _m === void 0 ? void 0 : _m.styleBind)
521
- ? serializeValue({
522
- ctx: componentCtx,
523
- key: 'styleBind',
524
- dynamicValue: (_o = component === null || component === void 0 ? void 0 : component.xProps) === null || _o === void 0 ? void 0 : _o.styleBind,
525
- }).value
526
- : undefined,
547
+ ':class': classListBindData ? classListBindData.value : undefined,
548
+ ':style': styleBindData ? styleBindData.value : undefined,
527
549
  extra: {
528
550
  commonStyle: (_p = component.xProps) === null || _p === void 0 ? void 0 : _p.commonStyle,
529
551
  xIndex: component.xIndex,
530
552
  styleBindPath: (_q = component === null || component === void 0 ? void 0 : component.xProps) === null || _q === void 0 ? void 0 : _q.styleBindPath,
531
553
  staticResourceAttribute: (_r = component === null || component === void 0 ? void 0 : component.xProps) === null || _r === void 0 ? void 0 : _r.staticResourceAttribute,
554
+ attributeExtraData: (0, common_3.isEmptyObj)(attributeExtraData)
555
+ ? undefined
556
+ : attributeExtraData,
532
557
  },
533
558
  };
534
559
  }
@@ -536,11 +561,14 @@ exports.serializeComponent = serializeComponent;
536
561
  function deserializeComponent(ctx, components) {
537
562
  let componentMap = components.reduce((map, item) => {
538
563
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
564
+ const { attributeExtraData = {} } = item.extra || {};
539
565
  let dynamicStyle = item[':style']
540
- ? deserializeValue(ctx, ':style', item[':style']).value
566
+ ? deserializeValue(ctx, ':style', item[':style'], attributeExtraData['style'] // 此处就是 style,取的是原始的属性
567
+ ).value
541
568
  : undefined;
542
569
  let dynamicClassList = item[':class']
543
- ? deserializeValue(ctx, ':class', item[':class']).value
570
+ ? deserializeValue(ctx, ':class', item[':class'], attributeExtraData['class'] // 此处就是 class,取的是原始的属性
571
+ ).value
544
572
  : undefined;
545
573
  const xComponent = {
546
574
  moduleName: item.module,
@@ -552,7 +580,7 @@ function deserializeComponent(ctx, components) {
552
580
  xComponent.moduleName;
553
581
  }
554
582
  const xProps = {
555
- data: deserializeAttributes(ctx, item.attributes),
583
+ data: deserializeAttributes(ctx, item.attributes, attributeExtraData),
556
584
  directives: deserializeDirecties(ctx, item.directives || {}),
557
585
  style: (_a = item.attributes) === null || _a === void 0 ? void 0 : _a.style,
558
586
  styleBind: dynamicStyle
@@ -561,9 +589,6 @@ function deserializeComponent(ctx, components) {
561
589
  value: dynamicStyle.value,
562
590
  }
563
591
  : undefined,
564
- // styleBindPath: item.styleBindPath
565
- // ? deserializeValue('styleBindPath', item.styleBindPath).value
566
- // : undefined, // 含义未知
567
592
  commonStyle: (_b = item === null || item === void 0 ? void 0 : item.extra) === null || _b === void 0 ? void 0 : _b.commonStyle,
568
593
  staticResourceAttribute: (_c = item === null || item === void 0 ? void 0 : item.extra) === null || _c === void 0 ? void 0 : _c.staticResourceAttribute,
569
594
  classList: (_f = (_e = (_d = item.attributes) === null || _d === void 0 ? void 0 : _d.class) === null || _e === void 0 ? void 0 : _e.split(/\s/g)) === null || _f === void 0 ? void 0 : _f.filter((className) => !!className),
@@ -585,7 +610,7 @@ function deserializeComponent(ctx, components) {
585
610
  if (Array.isArray(item)) {
586
611
  return !!item.length;
587
612
  }
588
- return item != undefined && !(0, common_2.isEmptyObj)(item);
613
+ return item != undefined && !(0, common_3.isEmptyObj)(item);
589
614
  })
590
615
  ? xProps
591
616
  : undefined,
@@ -613,9 +638,9 @@ function serializePage(ctx, page) {
613
638
  }
614
639
  let processedPage = {
615
640
  id: page.id,
616
- type: types_1.EComponentType.PAGE,
641
+ type: 'PAGE',
617
642
  component: 'Page',
618
- attributes: (0, runtime_1.getValidValue)(serializeAttributes(pageCtx, 'page', page.data)),
643
+ attributes: (0, runtime_1.getValidValue)(serializeAttributesWithExtra(pageCtx, 'page', page.data).data),
619
644
  items: Object.keys(page.componentInstances || {}).map((id) => {
620
645
  return serializeComponent(pageCtx, Object.assign({ id }, page.componentInstances[id]));
621
646
  }),
@@ -629,7 +654,6 @@ function serializePage(ctx, page) {
629
654
  return serializeListener(pageCtx, item);
630
655
  })),
631
656
  extra: {
632
- pluginInstances: page === null || page === void 0 ? void 0 : page.pluginInstances,
633
657
  commonStyle: page === null || page === void 0 ? void 0 : page.commonStyle,
634
658
  xIndex: page.xIndex,
635
659
  staticResourceAttribute: page === null || page === void 0 ? void 0 : page.staticResourceAttribute,
@@ -665,9 +689,8 @@ function deserializePage(ctx, page) {
665
689
  return deserializeDataVariables(pageCtx, item);
666
690
  })) || [],
667
691
  },
668
- data: deserializeAttributes(pageCtx, page.attributes),
692
+ data: deserializeAttributes(pageCtx, page.attributes, (_b = page === null || page === void 0 ? void 0 : page.extra) === null || _b === void 0 ? void 0 : _b.attributeExtraData),
669
693
  componentInstances: deserializeComponent(pageCtx, page.items || []),
670
- pluginInstances: (_b = page.extra) === null || _b === void 0 ? void 0 : _b.pluginInstances,
671
694
  commonStyle: (_c = page === null || page === void 0 ? void 0 : page.extra) === null || _c === void 0 ? void 0 : _c.commonStyle,
672
695
  staticResourceAttribute: (_d = page === null || page === void 0 ? void 0 : page.extra) === null || _d === void 0 ? void 0 : _d.staticResourceAttribute,
673
696
  hideAdminPortalMenu: (_e = page === null || page === void 0 ? void 0 : page.extra) === null || _e === void 0 ? void 0 : _e.hideAdminPortalMenu,
@@ -724,7 +747,7 @@ function deserializePlatformApp(data, optsions) {
724
747
  var _a, _b;
725
748
  let homePageId = data.main || ((_a = data.items[0]) === null || _a === void 0 ? void 0 : _a.id) || '';
726
749
  let extra = data.extra || {};
727
- const { historyType, npmDependencies, plugins, maxID, rootPath, themeVars, presetColors, appConfig, miniprogramPlugins } = extra, restExtra = __rest(extra, ["historyType", "npmDependencies", "plugins", "maxID", "rootPath", "themeVars", "presetColors", "appConfig", "miniprogramPlugins"]);
750
+ const { historyType, npmDependencies, plugins, maxID, rootPath, themeVars, presetColors, appConfig, miniprogramPlugins, compHiddenConfig } = extra, restExtra = __rest(extra, ["historyType", "npmDependencies", "plugins", "maxID", "rootPath", "themeVars", "presetColors", "appConfig", "miniprogramPlugins", "compHiddenConfig"]);
728
751
  const ctx = {
729
752
  app: data,
730
753
  dependencies: (optsions === null || optsions === void 0 ? void 0 : optsions.dependencies) || [],
@@ -752,6 +775,7 @@ function deserializePlatformApp(data, optsions) {
752
775
  return deserializeDataVariables(ctx, item);
753
776
  })) || [],
754
777
  },
778
+ compHiddenConfig: compHiddenConfig || {},
755
779
  npmDependencies: npmDependencies || {},
756
780
  plugins: plugins || [],
757
781
  maxID: maxID,
@@ -778,9 +802,9 @@ function serializeRuntimePage(ctx, page //IPageInstance
778
802
  const pageCtx = Object.assign(Object.assign({}, ctx), { dependenciesMap: processDependenciesMap(ctx.dependencies || []), page: { id: page.id } });
779
803
  let processedPage = {
780
804
  id: page.id,
781
- type: types_1.EComponentType.PAGE,
805
+ type: 'PAGE',
782
806
  component: 'Page',
783
- attributes: serializeAttributes(pageCtx, 'page', (0, runtime_1.readDynamicData)(page)),
807
+ attributes: serializeAttributesWithExtra(pageCtx, 'page', (0, runtime_1.readDynamicData)(page)).data,
784
808
  items: (0, runtime_1.getValidValue)(Object.keys(((_a = page.componentSchemaJson) === null || _a === void 0 ? void 0 : _a.properties) || {}).map((id) => {
785
809
  var _a;
786
810
  return serializeRuntimeComponent(pageCtx, Object.assign({ id }, (_a = page.componentSchemaJson) === null || _a === void 0 ? void 0 : _a.properties[id]));
@@ -792,21 +816,20 @@ function serializeRuntimePage(ctx, page //IPageInstance
792
816
  return serializeListener(pageCtx, item);
793
817
  })),
794
818
  extra: {
795
- pluginInstances: (0, runtime_1.getValidValue)(page === null || page === void 0 ? void 0 : page.pluginInstances),
796
819
  commonStyle: (0, runtime_1.getValidValue)((0, style_1.removeInvalidStyleFormValue)(page.style)),
797
820
  styleBindPath: (0, runtime_1.getValidValue)(page.styleBindPath),
798
821
  xIndex: page.xIndex,
799
822
  children: (0, runtime_1.getValidValue)((_e = page.children) === null || _e === void 0 ? void 0 : _e.map((child) => serializeRuntimePage(ctx, child))),
800
823
  },
801
824
  };
802
- if ((0, common_2.isValidStyleBind)(page.styleBind) && (0, runtime_1.getValidValue)(page.styleBind)) {
825
+ if ((0, common_3.isValidStyleBind)(page.styleBind) && (0, runtime_1.getValidValue)(page.styleBind)) {
803
826
  page[':style'] = serializeValue({
804
827
  ctx: pageCtx,
805
828
  key: 'styleBind',
806
829
  dynamicValue: page.styleBind,
807
830
  }).value;
808
831
  }
809
- if ((0, common_2.isValidClassNameListBind)(page.classListBind) &&
832
+ if ((0, common_3.isValidClassNameListBind)(page.classListBind) &&
810
833
  (0, runtime_1.getValidValue)(page.classListBind)) {
811
834
  page[':class'] = serializeValue({
812
835
  ctx: pageCtx,
@@ -852,33 +875,48 @@ function serializeRuntimeComponent(ctx, component //IComponentSchemaJson
852
875
  .filter((dataType) => dataType.type !== 'slot')
853
876
  .map((dataType) => dataType.propertyPath);
854
877
  let properties = component.properties || {};
855
- processed = Object.assign(Object.assign({}, processed), { module: serializeModuleName(componentCtx, moduleName, name), component: name, attributes: Object.assign(Object.assign({}, serializeAttributes(componentCtx, 'page', ((0, runtime_1.getValidValue)((0, runtime_1.readDynamicData)(props)) || {}))), { style: (0, runtime_1.getValidValue)(props.style), class: (_a = (0, runtime_1.getValidValue)(props.classNameList)) === null || _a === void 0 ? void 0 : _a.join(' ') }), items: (0, runtime_1.getValidValue)(Object.keys(properties)
878
+ const { data: attributes = {}, extra: attributeExtraData = {}, } = serializeAttributesWithExtra(componentCtx, 'page', (0, runtime_1.getValidValue)((0, runtime_1.readDynamicData)(props)) || {});
879
+ let styleBindData = null;
880
+ let classListBindData = null;
881
+ if ((_a = props === null || props === void 0 ? void 0 : props.styleBind) === null || _a === void 0 ? void 0 : _a.bindDataPath) {
882
+ styleBindData = serializeValue({
883
+ ctx: componentCtx,
884
+ key: 'styleBind',
885
+ dynamicValue: {
886
+ type: props.styleBind.type,
887
+ value: props.styleBind.bindDataPath,
888
+ extra: props.styleBind.extra,
889
+ },
890
+ });
891
+ if (styleBindData === null || styleBindData === void 0 ? void 0 : styleBindData.extra) {
892
+ attributeExtraData.style = styleBindData === null || styleBindData === void 0 ? void 0 : styleBindData.extra;
893
+ }
894
+ }
895
+ if ((0, common_3.isValidClassNameListBind)(props.classNameListBind)) {
896
+ classListBindData = serializeValue({
897
+ ctx: componentCtx,
898
+ key: 'classListBind',
899
+ dynamicValue: (0, runtime_1.getValidValue)({
900
+ type: props.classNameListBind.type,
901
+ value: props.classNameListBind.bindDataPath,
902
+ }),
903
+ });
904
+ if (classListBindData === null || classListBindData === void 0 ? void 0 : classListBindData.extra) {
905
+ attributeExtraData.class = classListBindData === null || classListBindData === void 0 ? void 0 : classListBindData.extra;
906
+ }
907
+ }
908
+ 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)
856
909
  .filter((key) => !excludeKeys.includes(key))
857
- .map((key) => serializeRuntimeComponent(ctx, Object.assign({ id: key }, properties[key])))), listeners: (_b = (0, runtime_1.getValidValue)((0, runtime_1.readListeners)(props.listenerInstances))) === null || _b === void 0 ? void 0 : _b.map((listener /* IEventListener */) => {
910
+ .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 */) => {
858
911
  return serializeListener(componentCtx, listener);
859
- }), directives: serializeDirecties(componentCtx, ((0, runtime_1.getValidValue)((0, runtime_1.readDirectives)(props)) || {})) || undefined, ':class': (0, common_2.isValidClassNameListBind)(props.classNameListBind)
860
- ? serializeValue({
861
- ctx: componentCtx,
862
- key: 'classListBind',
863
- dynamicValue: (0, runtime_1.getValidValue)({
864
- type: props.classNameListBind.type,
865
- value: props.classNameListBind.bindDataPath,
866
- }),
867
- }).value
868
- : undefined, ':style': ((_c = props === null || props === void 0 ? void 0 : props.styleBind) === null || _c === void 0 ? void 0 : _c.bindDataPath)
869
- ? serializeValue({
870
- ctx: componentCtx,
871
- key: 'styleBind',
872
- dynamicValue: {
873
- type: props.styleBind.type,
874
- value: props.styleBind.bindDataPath,
875
- },
876
- }).value
877
- : undefined, extra: {
912
+ }), 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: {
878
913
  commonStyle: (0, runtime_1.getValidValue)((0, style_1.removeInvalidStyleFormValue)(props.commonStyle)),
879
914
  xIndex: (0, runtime_1.getValidValue)(component['x-index']),
880
915
  styleBindPath: (0, runtime_1.getValidValue)(props.styleBindPath),
881
916
  staticResourceAttribute: (0, runtime_1.getValidValue)(props.staticResourceAttribute),
917
+ attributeExtraData: (0, common_3.isEmptyObj)(attributeExtraData)
918
+ ? undefined
919
+ : attributeExtraData,
882
920
  } });
883
921
  }
884
922
  else {
@@ -108,10 +108,10 @@ function parseValueCals(ctx, value) {
108
108
  let parser = new expression_1.DynamicValueParser(value, { pageId: '$page' });
109
109
  let res = parser.parse();
110
110
  switch (res.type) {
111
- case expression_1.PropBindType.paramData:
111
+ case expression_1.PropBindType.params:
112
112
  case expression_1.PropBindType.stateData: {
113
113
  const TYPE_MAP = {
114
- [expression_1.PropBindType.paramData]: 'params',
114
+ [expression_1.PropBindType.params]: 'params',
115
115
  [expression_1.PropBindType.stateData]: 'state',
116
116
  };
117
117
  const type = TYPE_MAP[res.type];
@@ -1,7 +1,12 @@
1
1
  import { IDataBind } from '../../expression/index';
2
+ declare type IUsedComps = {
3
+ [libName: string]: Set<string>;
4
+ };
2
5
  export declare function camelcase(str: string, firstUpperCase?: boolean): string;
3
6
  export declare function isPlainObject(src: any): boolean;
4
7
  export declare const isEmptyObj: (obj: object) => boolean;
5
8
  export declare function isValidStyleBind(styleBind: IDataBind): boolean;
6
9
  export declare function isValidClassNameListBind(classNameListBind: IDataBind): boolean;
10
+ export declare function getUsedComps(apps: any[], comps: any[]): IUsedComps;
11
+ export {};
7
12
  //# sourceMappingURL=common.d.ts.map
@@ -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,CAAA;AAElD,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,CAAA;AAED,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,SAAS,WAQpD;AAED,wBAAgB,wBAAwB,CAAC,iBAAiB,EAAE,SAAS,WAQpE"}
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../parser/cals/utils/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAYlD,aAAK,UAAU,GAAG;IAAE,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAAA;CAAE,CAAA;AAGpD,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,CAAA;AAED,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,SAAS,WAQpD;AAED,wBAAgB,wBAAwB,CAAC,iBAAiB,EAAE,SAAS,WAQpE;AAmFD,wBAAgB,YAAY,CAExB,IAAI,EAAE,GAAG,EAAE,EAEX,KAAK,EAAE,GAAG,EAAE,GACb,UAAU,CAwDZ"}