@cloudbase/cals 0.5.4 → 0.5.5-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.
@@ -289,7 +289,6 @@ export declare function deserializePlatformApp(data: IPlatformApp, optsions: {
289
289
  isMiniProgramPlugins?: boolean;
290
290
  })[];
291
291
  }[];
292
- externalResources: import("../../types").IExternalResource[];
293
292
  extra: {
294
293
  name: string;
295
294
  author: string;
@@ -301,7 +300,6 @@ export declare function deserializePlatformApp(data: IPlatformApp, optsions: {
301
300
  originHistoryId?: string;
302
301
  };
303
302
  dependencies: IDependencies;
304
- schemaVersion: string;
305
303
  };
306
304
  /**
307
305
  * page
@@ -358,12 +356,5 @@ export declare function deserializeComponentLibraryMeta(meta: {
358
356
  };
359
357
  export declare function processRuntimeCodeResources(ctx: {
360
358
  id: string;
361
- version?: string;
362
359
  }, resources: any[], scope: string): any[];
363
- /**
364
- * 解析 cals version 来生成 feature map
365
- */
366
- export declare function parseVersion(version?: string): {
367
- defaultDynamicCssUnit: boolean;
368
- };
369
360
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/parser/cals/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,cAAc,EAGd,mBAAmB,EACnB,cAAc,EAAE,cAAc;AAC9B,mBAAmB,EACnB,aAAa,EACb,IAAI,EACL,MAAM,aAAa,CAAC;AAErB,OAAO,EAAkC,aAAa,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAgB5F,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,UAAU,mBAAmB;IAC3B,GAAG,CAAC,EAAE,YAAY,CAAC;IACnB,YAAY,CAAC,EAAE,GAAG,EAAE,CAAC;IACrB,eA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,IAAI,EAAE,GAAG,GACR,cAAc,CAmDhB;AAWD;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,iBAAiB,GAAG;IACvB,IAAI,EAAE,QAAQ,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;CAC3C,EACD,SAAS,EAAE,GAAG,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,GAC9B,eAAe,GAAG,iBAAiB,CAqHrC;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,GAAG,GAAG,CAwBzE;AAaD,wBAAgB,+BAA+B,CAAC,IAAI,EAAE;IACpD,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,YAAY,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IACzC,UAAU,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC,UAAU,CAAA;KAAE,CAAC;IAC/C,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC,OAAO,CAAA;KAAE,CAAC;CAC1C;;;;;;;mBAIY,MAAM;mBACN,MAAM;sBACH,MAAM;;;6BACwB,OAAO;;;wBACnC,MAAM;;;;;;EAiCvB;AAED,wBAAgB,2BAA2B,CAAC,GAAG,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EAAE,SAAS,OAAyB,EAAE,KAAK,EAAE,MAAM,SAiCjH"}
@@ -11,7 +11,7 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  return t;
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.parseVersion = exports.processRuntimeCodeResources = exports.deserializeComponentLibraryMeta = exports.deserializeRuntimeComponent = exports.serializeRuntimeComponent = exports.serializeRuntimePage = exports.deserializePlatformApp = exports.serializePlatformApp = exports.deserializePage = exports.serializePage = exports.deserializeComponent = exports.serializeComponent = exports.deserializeDataVariables = exports.deserializeAttributes = exports.serializeAttributes = exports.deserializeDynamicMap = exports.serializeDynamicMap = exports.deserializeValue = exports.serializeValue = exports.generateDefaultCode = exports.getUsedComps = void 0;
14
+ exports.processRuntimeCodeResources = exports.deserializeComponentLibraryMeta = exports.deserializeRuntimeComponent = exports.serializeRuntimeComponent = exports.serializeRuntimePage = exports.deserializePlatformApp = exports.serializePlatformApp = exports.deserializePage = exports.serializePage = exports.deserializeComponent = exports.serializeComponent = exports.deserializeDataVariables = exports.deserializeAttributes = exports.serializeAttributes = exports.deserializeDynamicMap = exports.serializeDynamicMap = exports.deserializeValue = exports.serializeValue = exports.generateDefaultCode = exports.getUsedComps = void 0;
15
15
  const lodash_1 = require("lodash");
16
16
  const common_1 = require("../../types/platform/common");
17
17
  const expression_1 = require("../expression");
@@ -781,7 +781,7 @@ exports.deserializePage = deserializePage;
781
781
  */
782
782
  function serializePlatformApp(data, optsions) {
783
783
  var _a;
784
- let { version, author, name, label, description, selectedPageId, pageInstanceList, lowCodes = [], datasources, vars, dataset, extra, dependencies: calsDependencies, miniprogramPlugins, lastDependencies, externalResources, schemaVersion } = data, restData = __rest(data, ["version", "author", "name", "label", "description", "selectedPageId", "pageInstanceList", "lowCodes", "datasources", "vars", "dataset", "extra", "dependencies", "miniprogramPlugins", "lastDependencies", "externalResources", "schemaVersion"]);
784
+ let { version, author, name, label, description, selectedPageId, pageInstanceList, lowCodes = [], datasources, vars, dataset, extra, dependencies: calsDependencies, miniprogramPlugins, lastDependencies } = data, restData = __rest(data, ["version", "author", "name", "label", "description", "selectedPageId", "pageInstanceList", "lowCodes", "datasources", "vars", "dataset", "extra", "dependencies", "miniprogramPlugins", "lastDependencies"]);
785
785
  let { dependencies = [] } = optsions || {};
786
786
  const _b = extra || {}, { name: extraName, label: extraLabel, author: extraAuthor, description: extraDescription } = _b, restExtra = __rest(_b, ["name", "label", "author", "description"]);
787
787
  const ctx = {
@@ -795,9 +795,7 @@ function serializePlatformApp(data, optsions) {
795
795
  name: name || extraName,
796
796
  author: author || extraAuthor,
797
797
  version,
798
- schemaVersion,
799
798
  description: description || extraDescription,
800
- externalResources,
801
799
  main: homePage ? homePage.id : ((_a = pageInstanceList === null || pageInstanceList === void 0 ? void 0 : pageInstanceList[0]) === null || _a === void 0 ? void 0 : _a.id) || selectedPageId,
802
800
  items: pageInstanceList === null || pageInstanceList === void 0 ? void 0 : pageInstanceList.map((page) => serializePage(ctx, page)),
803
801
  resources: lowCodes === null || lowCodes === void 0 ? void 0 : lowCodes.map((item) => serializeCodeSource(ctx, item)),
@@ -856,12 +854,10 @@ function deserializePlatformApp(data, optsions) {
856
854
  presetColors: presetColors || [],
857
855
  appConfig,
858
856
  miniprogramPlugins,
859
- externalResources: data.externalResources,
860
857
  extra: Object.assign(Object.assign({}, restExtra), { name: data.name, author: data.author, description: data.description, lastDependencies }),
861
858
  dependencies: data.dependencies,
862
859
  // TODO
863
860
  // emitEvents: [], { "name": "自定义校验规则", "eventName": "validator" }
864
- schemaVersion: data.schemaVersion,
865
861
  };
866
862
  return processed;
867
863
  }
@@ -1077,21 +1073,3 @@ function processRuntimeCodeResources(ctx, resources /* : IWeappCode[]*/ = [], sc
1077
1073
  return resources.filter((m) => m.name !== common_1.ECodeName.PLACEHOLDER);
1078
1074
  }
1079
1075
  exports.processRuntimeCodeResources = processRuntimeCodeResources;
1080
- /**
1081
- * 解析 cals version 来生成 feature map
1082
- */
1083
- function parseVersion(version = '') {
1084
- const list = version.split('.');
1085
- const FEATURE_MAP = {
1086
- /**
1087
- * 默认单位为 px,
1088
- * 然后进行动态转换 为 rem及rpx
1089
- */
1090
- defaultDynamicCssUnit: true,
1091
- };
1092
- if (list[0] === '4' || version === 'latest') {
1093
- FEATURE_MAP.defaultDynamicCssUnit = false;
1094
- }
1095
- return FEATURE_MAP;
1096
- }
1097
- exports.parseVersion = parseVersion;
@@ -1,43 +1,12 @@
1
1
  import { Properties } from 'csstype';
2
2
  export declare function removeInvalidStyleFormValue(styleForm?: any): any;
3
- /**
4
- * Convert WeApps common style to css styles(React.CSSProperties)
5
- * toRem/toRpx/toRpx 三者互斥 @deprecated
6
- * 应使用 defaultUnit 来声明
7
- */
8
3
  export declare function processCommonStyle2CSSProperties(commonStyle?: any, options?: {
9
- /**
10
- * 默认 px/无单位 转 rem
11
- * @deprecated
12
- */
13
- toRem?: boolean;
14
- /**
15
- * 默认 px/无单位 转为rpx
16
- * @deprecated
17
- */
18
- toRpx?: boolean;
19
- /**
20
- * px/无单位情况下 处理为何单位
21
- * rem | rpx | px
22
- * 优先级高于以上
23
- */
24
- defaultUnit?: 'rem' | 'px' | 'rpx';
25
- /**
26
- * 是否使用 calc(xx px / `${rpxCalcRoot}`) 来模拟rpx
27
- * 小程序不需要转
28
- */
29
- rpxCalcRoot?: string;
4
+ toRem: boolean;
30
5
  ignoreSelf?: boolean;
31
6
  addPXUnit?: boolean;
7
+ toRpx?: boolean;
8
+ }): Properties<string | number>;
9
+ export declare function processCSSProperties2Rem(style?: Properties<string | number>, options?: {
10
+ looseError: boolean;
32
11
  }): Properties<string | number>;
33
- interface ITranslateStyleOptions {
34
- looseError?: boolean;
35
- rpxCalcRoot?: string;
36
- }
37
- /**
38
- * @deprecated
39
- */
40
- export declare function processCSSProperties2Rem(style?: Properties<string | number>, options?: ITranslateStyleOptions): Properties<string | number>;
41
- export declare function processCSSPropertiesUnit(style: Properties<string | number>, type: 'px' | 'rem' | 'rpx', options?: ITranslateStyleOptions): {};
42
- export {};
43
12
  //# sourceMappingURL=style.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../../src/parser/cals/utils/style.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAIrC,wBAAgB,2BAA2B,CAAC,SAAS,GAAE,GAA2B,GAAG,GAAG,CAUvF;AA4JD;;;;GAIG;AACH,wBAAgB,gCAAgC,CAC9C,WAAW,GAAE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AAC,MAAM,GAAG,MAAM,CAAC,CAgU7B;AASD,wBAAgB,wBAAwB,CACtC,KAAK,GAAE,UAAU,CAAC,MAAM,GAAG,MAAM,CAAM,EACvC,OAAO;;CAAwB,GAC9B,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC,CAE7B"}
@@ -11,7 +11,7 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  return t;
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.processCSSPropertiesUnit = exports.processCSSProperties2Rem = exports.processCommonStyle2CSSProperties = exports.removeInvalidStyleFormValue = void 0;
14
+ exports.processCSSProperties2Rem = exports.processCommonStyle2CSSProperties = exports.removeInvalidStyleFormValue = void 0;
15
15
  const common_1 = require("./common");
16
16
  const lodash_1 = require("lodash");
17
17
  const utils_1 = require("../../../utils");
@@ -50,12 +50,10 @@ function setStyleValue(object, key, value) {
50
50
  }
51
51
  function _handleStyleNumValue(styleVal, addPXUnit) {
52
52
  if (addPXUnit) {
53
- /**
54
- * 2022.12.13
55
- * 改分支未启用
56
- */
53
+ // 该分支实际没有使用?
54
+ // styleValue = '0.2' 时处理有问题
57
55
  const value = `${styleVal}`;
58
- if (/^\d*.?\d+$/.test(value)) {
56
+ if (value.search(/^\d+$/) >= 0) {
59
57
  return `${value}px`;
60
58
  }
61
59
  }
@@ -86,8 +84,7 @@ function setDistanceStyle(style, distance, attr, addPXUnit) {
86
84
  });
87
85
  }
88
86
  }
89
- function translateStyleByHandler(style = {}, handler, options) {
90
- const { looseError = false, rpxCalcRoot } = options || {};
87
+ function translateStyleByHandler(style = {}, handler, options = { looseError: false }) {
91
88
  return Object.keys(style).reduce((result, key) => {
92
89
  const value = style[key];
93
90
  if (utils_1.isUnitlessNumber[key]) {
@@ -95,10 +92,10 @@ function translateStyleByHandler(style = {}, handler, options) {
95
92
  }
96
93
  else if (value !== undefined && value !== null) {
97
94
  try {
98
- setStyleValue(result, key, handler(value, rpxCalcRoot));
95
+ setStyleValue(result, key, handler(value));
99
96
  }
100
97
  catch (e) {
101
- if (looseError) {
98
+ if (options.looseError) {
102
99
  console.warn('translate style error, key:value', key, value);
103
100
  }
104
101
  else {
@@ -109,77 +106,51 @@ function translateStyleByHandler(style = {}, handler, options) {
109
106
  return result;
110
107
  }, {});
111
108
  }
112
- function toREM(cssLen, rpxCalcRoot = undefined) {
113
- if (typeof cssLen === 'string' || typeof cssLen === 'number') {
114
- const cssLenArr = `${cssLen}`.split(' ');
109
+ function calPxToREM(px) {
110
+ if (Number.isNaN(px / 28))
111
+ return px.toString();
112
+ if (+px === 0) {
113
+ return '0';
114
+ }
115
+ return `${(px / 28).toFixed(4)}rem`;
116
+ }
117
+ function toREM(cssLen) {
118
+ if (typeof cssLen === 'string') {
119
+ const cssLenArr = cssLen.split(' ');
115
120
  return cssLenArr
116
121
  .map((attr) => {
117
- const matchResult = attr.match(/^(-?\d+)(r?px)?$/);
122
+ const matchResult = attr.match(/^(-?\d+)(px)?$/);
118
123
  if (matchResult === null || matchResult === void 0 ? void 0 : matchResult[1]) {
119
- const px = +matchResult[1];
120
- if (Number.isNaN(px / 1))
121
- return px.toString();
122
- if (+px === 0) {
123
- return '0';
124
- }
125
- if ((matchResult === null || matchResult === void 0 ? void 0 : matchResult[2]) === 'rpx') {
126
- return rpxCalcRoot ? `calc(${px}px / ${rpxCalcRoot})` : attr;
127
- }
128
- return `${(px / 28).toFixed(4)}rem`;
124
+ return calPxToREM(+matchResult[1]);
129
125
  }
130
126
  return attr;
131
127
  })
132
128
  .join(' ');
133
129
  }
130
+ else if (typeof cssLen === 'number') {
131
+ return calPxToREM(cssLen);
132
+ }
134
133
  else {
135
- throw new Error(`cssLen type error ${cssLen}`);
134
+ throw new Error('cssLen type error ' + cssLen);
136
135
  }
137
136
  }
138
- function toRPX(cssLen, rpxCalcRoot = undefined) {
139
- const cssLenArr = `${cssLen}`.split(' ');
140
- return cssLenArr
141
- .map((attr) => {
142
- const matchResult = attr.match(/^(-?\d+)(px)?$/);
143
- if (matchResult === null || matchResult === void 0 ? void 0 : matchResult[1]) {
144
- const px = +matchResult[1];
145
- if (Number.isNaN(px / 1))
146
- return px.toString();
147
- if (+px === 0) {
148
- return '0';
149
- }
150
- return rpxCalcRoot ? `calc(${px}px / ${rpxCalcRoot})` : `${px}rpx`;
151
- }
152
- return attr;
153
- })
154
- .join(' ');
155
- }
156
- function toPX(cssLen, rpxCalcRoot = undefined) {
157
- const cssLenArr = `${cssLen}`.split(' ');
158
- return cssLenArr
159
- .map((attr) => {
160
- const matchResult = attr.match(/^(-?\d+)(rpx)?$/);
161
- if (matchResult === null || matchResult === void 0 ? void 0 : matchResult[1]) {
162
- const px = +matchResult[1];
163
- if (Number.isNaN(px / 1))
164
- return px.toString();
165
- if (+px === 0) {
166
- return '0';
167
- }
168
- if ((matchResult === null || matchResult === void 0 ? void 0 : matchResult[2]) === 'rpx') {
169
- return rpxCalcRoot ? `calc(${px}px / ${rpxCalcRoot})` : attr;
137
+ function toRPX(cssLen) {
138
+ if (typeof cssLen === 'string') {
139
+ const cssLenArr = cssLen.split(' ');
140
+ return cssLenArr
141
+ .map((attr) => {
142
+ const matchResult = attr.match(/^(-?\d+)(px)?$/);
143
+ if (matchResult === null || matchResult === void 0 ? void 0 : matchResult[1]) {
144
+ return `${+matchResult[1]}rpx`;
170
145
  }
171
- return `${+matchResult[1]}px`;
172
- }
173
- return attr;
174
- })
175
- .join(' ');
146
+ return attr;
147
+ })
148
+ .join(' ');
149
+ }
150
+ return `${cssLen}rpx`;
176
151
  }
177
- /**
178
- * Convert WeApps common style to css styles(React.CSSProperties)
179
- * toRem/toRpx/toRpx 三者互斥 @deprecated
180
- * 应使用 defaultUnit 来声明
181
- */
182
- function processCommonStyle2CSSProperties(commonStyle = {}, options = { toRem: true, ignoreSelf: false, addPXUnit: false, toRpx: false, rpxCalcRoot: undefined }) {
152
+ // Convert WeApps common style to css styles(React.CSSProperties)
153
+ function processCommonStyle2CSSProperties(commonStyle = {}, options = { toRem: true, ignoreSelf: false, addPXUnit: false, toRpx: false }) {
183
154
  const { size,
184
155
  // transform,
185
156
  text, border, background, margin, padding, zIndex, position, display, flexConfig, custom, self, boxShadow, } = commonStyle;
@@ -380,24 +351,45 @@ function processCommonStyle2CSSProperties(commonStyle = {}, options = { toRem: t
380
351
  currentBoxShadowStyleString = 'inset ';
381
352
  }
382
353
  // offsetX
383
- currentBoxShadowStyleString += _handleStyleNumValue(!!offsetX ? offsetX : 0, !!options.addPXUnit);
354
+ if (!!offsetX) {
355
+ currentBoxShadowStyleString += _handleStyleNumValue(offsetX, !!options.addPXUnit);
356
+ }
357
+ else {
358
+ currentBoxShadowStyleString += '0';
359
+ }
384
360
  // offsetY
385
- currentBoxShadowStyleString += ` ${_handleStyleNumValue(!!offsetY ? offsetY : 0, !!options.addPXUnit)}`;
361
+ if (!!offsetY) {
362
+ currentBoxShadowStyleString += ' ' + _handleStyleNumValue(offsetY, !!options.addPXUnit);
363
+ }
364
+ else {
365
+ currentBoxShadowStyleString += ' 0';
366
+ }
386
367
  // blur-radius 当 spread-radius 存在时,即使不存在 blur-radius,blur-radius 也要为 0
387
368
  if (!!blurRadius || !!spreadRadius) {
388
- currentBoxShadowStyleString += ` ${_handleStyleNumValue(!!blurRadius ? blurRadius : 0, !!options.addPXUnit)}`;
369
+ if (!!blurRadius) {
370
+ currentBoxShadowStyleString += ' ' + _handleStyleNumValue(blurRadius, !!options.addPXUnit);
371
+ }
372
+ else {
373
+ currentBoxShadowStyleString += ' 0';
374
+ }
389
375
  }
390
376
  // spread-radius
391
377
  if (!!spreadRadius) {
392
- currentBoxShadowStyleString += ` ${_handleStyleNumValue(spreadRadius, !!options.addPXUnit)}`;
378
+ currentBoxShadowStyleString += ' ' + _handleStyleNumValue(spreadRadius, !!options.addPXUnit);
393
379
  }
394
380
  // color
395
381
  if (!!color) {
396
- currentBoxShadowStyleString += ` ${color}`;
382
+ currentBoxShadowStyleString += ' ' + color;
397
383
  }
398
384
  }
399
385
  if (!!currentBoxShadowStyleString) {
400
- const splitLabel = !!boxShadowStyleString ? ' , ' : '';
386
+ let splitLabel;
387
+ if (!!boxShadowStyleString) {
388
+ splitLabel = ' , ';
389
+ }
390
+ else {
391
+ splitLabel = '';
392
+ }
401
393
  boxShadowStyleString += splitLabel + currentBoxShadowStyleString;
402
394
  }
403
395
  });
@@ -421,39 +413,16 @@ function processCommonStyle2CSSProperties(commonStyle = {}, options = { toRem: t
421
413
  style[key] = value[value.length - 1];
422
414
  }
423
415
  }
424
- let { defaultUnit } = options;
425
- const translateStyleOptions = { rpxCalcRoot: options.rpxCalcRoot };
426
- if (!defaultUnit) {
427
- if (options.toRpx) {
428
- defaultUnit = 'rpx';
429
- }
430
- if (options.toRem) {
431
- defaultUnit = 'rem';
432
- }
416
+ if (options.toRpx) {
417
+ return translateStyleToRpx(style);
433
418
  }
434
- if (defaultUnit) {
435
- return processCSSPropertiesUnit(style, defaultUnit, translateStyleOptions);
436
- }
437
- return style;
419
+ return options.toRem ? processCSSProperties2Rem(style) : style;
438
420
  }
439
421
  exports.processCommonStyle2CSSProperties = processCommonStyle2CSSProperties;
440
- /**
441
- * @deprecated
442
- */
443
- function processCSSProperties2Rem(style = {}, options) {
422
+ function translateStyleToRpx(style = {}, options = { looseError: false }) {
423
+ return translateStyleByHandler(style, toRPX, options);
424
+ }
425
+ function processCSSProperties2Rem(style = {}, options = { looseError: false }) {
444
426
  return translateStyleByHandler(style, toREM, options);
445
427
  }
446
428
  exports.processCSSProperties2Rem = processCSSProperties2Rem;
447
- function processCSSPropertiesUnit(style = {}, type, options) {
448
- const handerMap = {
449
- px: toPX,
450
- rem: toREM,
451
- rpx: toRPX,
452
- };
453
- const handler = handerMap[type] ||
454
- function (cssLen, _) {
455
- return cssLen;
456
- };
457
- return translateStyleByHandler(style, handler, options);
458
- }
459
- exports.processCSSPropertiesUnit = processCSSPropertiesUnit;
@@ -1,6 +1,5 @@
1
1
  import { ECodeType } from '../../../types';
2
2
  export declare function generateDefaultCode(ctx: {
3
3
  id: string;
4
- version?: string;
5
4
  }, type: ECodeType, scope: 'component' | 'page' | 'app'): string;
6
5
  //# sourceMappingURL=template.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../../../src/parser/cals/utils/template.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAqM3C,wBAAgB,mBAAmB,CACjC,GAAG,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,EACrC,IAAI,EAAE,SAAS,EACf,KAAK,EAAE,WAAW,GAAG,MAAM,GAAG,KAAK,UA6BpC"}
1
+ {"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../../../src/parser/cals/utils/template.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAqM3C,wBAAgB,mBAAmB,CAAC,GAAG,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,GAAG,MAAM,GAAG,KAAK,UA2B5G"}
@@ -159,7 +159,7 @@ export function sayHi() {
159
159
  // 使用theme中的变量
160
160
  // color: <% if (type === 'app' || type === 'page') { %>@example-primary-color<% } %><% if (type === 'component') { %>blue<% } %>;
161
161
 
162
- // <%= version[0] === '4' ? '默认 rpx 会转换成 动态cals实现,px/PX/Px 均代表传统一样上的px':'默认 px 会转换成 rem,含大写字母 PX 和 Px 则不会转换' %>
162
+ // 默认 px 会转换成 rem,含大写字母 PX 和 Px 则不会转换
163
163
  // margin-top: 20px;
164
164
  // 使用theme中的混合(mixins)
165
165
  // <%= type === 'component' ? '':'.mixins();' %>
@@ -198,11 +198,10 @@ export default function(props) {
198
198
  }`,
199
199
  };
200
200
  function generateDefaultCode(ctx, type, scope) {
201
- const { id, version = '' } = ctx;
201
+ const { id } = ctx;
202
202
  const data = {
203
203
  type: scope,
204
204
  id,
205
- version,
206
205
  };
207
206
  switch (type) {
208
207
  case types_1.ECodeType.LIFECYCLE: {
@@ -4,6 +4,5 @@ export { processComponentModule } from './cals/utils/spinoff';
4
4
  export { calsToCode, codeToCals, ICodeItem, checkForConflicts, autoResolveConflicts } from './cals/utils/code';
5
5
  export { parseComponentCals } from './cals/utils/block';
6
6
  export { ActionType, IDataBind, PropBindType } from './expression/index';
7
- export { processCommonStyle2CSSProperties, processCSSProperties2Rem, processCSSPropertiesUnit, } from './cals/utils/style';
8
- export { default as PostcssRpx2Calc } from './plugins/postcss-rpx2clac';
7
+ export { processCommonStyle2CSSProperties, processCSSProperties2Rem } from './cals/utils/style';
9
8
  //# 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,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC/G,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EACL,gCAAgC,EAChC,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,4BAA4B,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,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC/G,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,gCAAgC,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC"}
@@ -13,11 +13,8 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
13
13
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
- var __importDefault = (this && this.__importDefault) || function (mod) {
17
- return (mod && mod.__esModule) ? mod : { "default": mod };
18
- };
19
16
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.PostcssRpx2Calc = exports.processCSSPropertiesUnit = exports.processCSSProperties2Rem = exports.processCommonStyle2CSSProperties = exports.PropBindType = exports.ActionType = exports.parseComponentCals = exports.autoResolveConflicts = exports.checkForConflicts = exports.codeToCals = exports.calsToCode = exports.processComponentModule = exports.upgrageToVersion2 = void 0;
17
+ exports.processCSSProperties2Rem = exports.processCommonStyle2CSSProperties = exports.PropBindType = exports.ActionType = exports.parseComponentCals = exports.autoResolveConflicts = exports.checkForConflicts = exports.codeToCals = exports.calsToCode = exports.processComponentModule = exports.upgrageToVersion2 = void 0;
21
18
  __exportStar(require("./cals/index"), exports);
22
19
  var version_1 = require("./cals/utils/version");
23
20
  Object.defineProperty(exports, "upgrageToVersion2", { enumerable: true, get: function () { return version_1.upgrageToVersion2; } });
@@ -36,6 +33,3 @@ Object.defineProperty(exports, "PropBindType", { enumerable: true, get: function
36
33
  var style_1 = require("./cals/utils/style");
37
34
  Object.defineProperty(exports, "processCommonStyle2CSSProperties", { enumerable: true, get: function () { return style_1.processCommonStyle2CSSProperties; } });
38
35
  Object.defineProperty(exports, "processCSSProperties2Rem", { enumerable: true, get: function () { return style_1.processCSSProperties2Rem; } });
39
- Object.defineProperty(exports, "processCSSPropertiesUnit", { enumerable: true, get: function () { return style_1.processCSSPropertiesUnit; } });
40
- var postcss_rpx2clac_1 = require("./plugins/postcss-rpx2clac");
41
- Object.defineProperty(exports, "PostcssRpx2Calc", { enumerable: true, get: function () { return __importDefault(postcss_rpx2clac_1).default; } });
@@ -20,11 +20,6 @@ export interface IApp {
20
20
  * @default 0.1.0
21
21
  */
22
22
  version?: string;
23
- /**
24
- * 协议版本 semer version
25
- * x.x.x | latest
26
- */
27
- schemaVersion?: string;
28
23
  /**
29
24
  * 选填, 应用简介
30
25
  */
@@ -1 +1 @@
1
- {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../src/types/basic/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,WAAW,IAAI;IACnB;;;;;OAKG;IAEH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAEjC;;OAEG;IACH,MAAM,CAAC,EAAE,GAAG,CAAC;IAEb;;O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6 @@ import { ICodeResource, IPlatformDataset } from './common';
3
3
  import { IPageComponent } from './component';
4
4
  import { IDataSourceVariable, IPlatformDataSource } from './datasource';
5
5
  import { IEvents } from '../basic/component';
6
- export declare enum EExternalResourceType {
7
- JSUrl = "jsUrl",
8
- CSSUrl = "cssUrl",
9
- CSSText = "cssText",
10
- JSText = "jsText",
11
- Bundle = "bundle"
12
- }
13
6
  /**
14
7
  * 云开发低码平台应用
15
8
  */
@@ -47,10 +40,6 @@ export interface IPlatformApp extends Omit<Basic.IApp, 'attributes' | 'events' |
47
40
  * IDependencies
48
41
  */
49
42
  dependencies?: IDependencies;
50
- /**
51
- *
52
- */
53
- externalResources?: IExternalResource[];
54
43
  /** 应用所在环境ID */
55
44
  envId?: string;
56
45
  /** 应用 id */
@@ -169,9 +158,4 @@ export interface IPlatformAppLifeCycle extends IEvents {
169
158
  */
170
159
  lifecycleOnLaunchEventName?: string;
171
160
  }
172
- export interface IExternalResource {
173
- type: EExternalResourceType;
174
- url?: string;
175
- code?: string;
176
- }
177
161
  //# sourceMappingURL=app.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../src/types/platform/app.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAuC,MAAM,UAAU,CAAC;AAChG,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,oBAAY,qBAAqB;IAC/B,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB;AACD;;GAEG;AACH,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,YAAY,GA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ceType = void 0;
4
- var EExternalResourceType;
5
- (function (EExternalResourceType) {
6
- EExternalResourceType["JSUrl"] = "jsUrl";
7
- EExternalResourceType["CSSUrl"] = "cssUrl";
8
- EExternalResourceType["CSSText"] = "cssText";
9
- EExternalResourceType["JSText"] = "jsText";
10
- EExternalResourceType["Bundle"] = "bundle";
11
- })(EExternalResourceType = exports.EExternalResourceType || (exports.EExternalResourceType = {}));
@@ -1,2 +1,2 @@
1
- export declare const wedaDTS = "declare namespace $app {\n namespace dataset {\n\n const state: {\n // Global State Inner Begin\n // Global State \u5168\u5C40\u53D8\u91CF - Don't touch me\n // Global State Inner End\n }\n\n }\n\n namespace utils {\n function ABS(num: number): number;\n function Min(...args: number[]): number;\n function Max(...args: number[]): number;\n function Average(...args: number[]): number;\n function Floor(num: number): number;\n function Ceiling(num: number): number;\n function Round(num: number): number;\n function Sum(...args: number[]): number;\n function Rand(num: number): number;\n\n function If(condition: boolean, val1: any, val2: any): any;\n function IsEmpty(text: string | string[]): boolean;\n function NotNull(val: any): boolean;\n function And(...args: boolean[]): boolean;\n function Or(...args: boolean[]): boolean;\n\n function Len(text: string): number;\n function Contains(text1: string, text2: string): boolean;\n function Split(text1: string, text2: string): string[];\n function Trim(text: string): string;\n function Upper(text: string): string;\n function Lower(text: string): string;\n function Concat(...text: string[]): string;\n\n function Now(): number;\n function Timestamp(arg: number | string | Date): number;\n function Second(arg: number | string | Date): number;\n function Minute(arg: number | string | Date): number;\n function Hour(arg: number | string | Date): number;\n function Day(arg: number | string | Date): number;\n function DayOfWeek(arg: number | string | Date): number;\n function Month(arg: number | string | Date): number;\n function Year(arg: number | string | Date): number;\n function GetDate(year: number, month: number, day: number): number;\n function DateTimeValue(arg: string, val: string): number;\n function Age(arg: number | string | Date, val: number | string | Date): number;\n function AgeOfNow(arg: number | string | Date): number;\n function DateAdd(arg: number | string | Date, day: number): number;\n function MonthAdd(arg: number | string | Date, month: number): number;\n function YearAdd(arg: number | string | Date, year: number): number;\n function DateDiff(startDay: number | string | Date, endDay: number | string | Date): number;\n function HourDiff(startDay: number | string | Date, endDay: number | string | Date): number;\n function MinuteDiff(startDay: number | string | Date, endDay: number | string | Date): number;\n function SecondDiff(startDay: number | string | Date, endDay: number | string | Date): number;\n function MonthDiff(startDay: number | string | Date, endDay: number | string | Date): number;\n function YearDiff(startDay: number | string | Date, endDay: number | string | Date): number;\n function DateText(createdTime: number | string | Date, text: string): string;\n function IsToday(date: number | string | Date): boolean;\n\n }\n\n namespace common {\n // Global Common Inner Begin\n // Global Common \u5168\u5C40\u65B9\u6CD5 - Don't touch me\n // Global Common Inner End\n }\n\n namespace auth {\n const currentUser: {\n userId?: string\n phone?: string\n type?: number\n relatedRoles?: {\n id?: string\n envId?: string\n name?: string\n roleIdentity?: string\n }[]\n openId?: string\n name?: string\n nickName?: string\n email?: string\n mainOrg?: {\n id?: string\n name?: string\n }\n orgs?: {\n id?: string\n name?: string\n }[]\n}\n\n }\n\n \n\ninterface navigatorOptions {\n packageName: string;\n pageId: string;\n data?: Record<string, any>;\n params?: Record<string, any>;\n events?: Record<string, (data: any) => void>;\n success(res: any);\n fail(res: any);\n complete(res: any);\n}\n\ninterface navigateBackOptions {\n delta: number;\n}\n\n// \u8BBE\u7F6E\u72B6\u6001\nfunction setState(userSetState: Record<string, any>): void\n\n// \u7279\u5236\u8DEF\u7531\nfunction navigateTo(options: navigatorOptions)\nfunction redirectTo(options: navigatorOptions)\nfunction reLaunch(options: navigatorOptions)\nfunction navigateBack(options: navigateBackOptions)\n\n// \u663E\u793A\u63D0\u793A\nfunction showToast(options);\n\n// \u663E\u793A\u6A21\u6001\u63D0\u793A\nfunction showModal(options);\n\n// \u663E\u793A loading \u63D0\u793A\nfunction showLoading(options);\n\n// \u9690\u85CF loading \u63D0\u793A\nfunction hideLoading(options);\n\n// \u9690\u85CF\u63D0\u793A\nfunction hideToast(options);\n\n// sacnCode\nfunction scanCode(options: {\n onlyFromCamera?: boolean;\n enableDefaultBehavior?: boolean;\n scanType?: ('barCode' | 'qrCode')[];\n success?: (res: { result: string; scanType: string }) => void;\n fail?: (err: Error) => void;\n complete?: () => void;\n}): Promise<ScanCodeResult> | ScanCodeResult;\n\n\n}\n\ndeclare const app = $app\n\n// Global For Begin\ndeclare const $for: {\n // Global For Inner Begin\n // For \u5FAA\u73AF\u53D8\u91CF - Don't touch me\n // Global For Inner End\n}\ndeclare const forItems = $for\n// Global For End\n\n// $page Begin\ndeclare namespace $page {\n namespace dataset {\n\n const state: {\n // Page State Inner Begin\n // Page State \u9875\u9762\u53D8\u91CF - Don't touch me\n // Page State Inner End\n }\n\n const params: {\n // Page Param Inner Begin\n // Page Param \u9875\u9762\u53C2\u6570 - Don't touch me\n // Page Param Inner End\n }\n\n }\n\n namespace handler {\n // Page Handler Inner Begin\n // Page Handler \u9875\u9762\u65B9\u6CD5 - Don't touch me\n // Page Handler Inner End\n }\n\n \n\n// \u8BBE\u7F6E\u72B6\u6001\nfunction setState(userSetState: Record<string, any>): void\n\n\n}\n// $page End\n\n// $comp Begin\ndeclare namespace $comp {\n\n namespace props {\n\n const data: {\n // Comp Prop Data Inner Begin\n // Comp Prop Data \u7EC4\u4EF6\u5C5E\u6027 - Don't touch me\n // Comp Prop Data Inner End\n }\n\n namespace events {\n // Comp Prop Events Inner Begin\n // Comp Prop Events \u7EC4\u4EF6\u4E8B\u4EF6 - Don't touch me\n // Comp Prop Events Inner End\n }\n\n }\n\n namespace dataset {\n\n const state: {\n // Comp State Inner Begin\n // Comp State \u7EC4\u4EF6\u53D8\u91CF - Don't touch me\n // Comp State Inner End\n }\n\n }\n\n namespace handler {\n // Comp Handler Inner Begin\n // Comp Handler \u7EC4\u4EF6\u65B9\u6CD5 - Don't touch me\n // Comp Handler Inner End\n }\n\n}\n// $comp End\n\n// Global Formula Begin\n\ndeclare function ABS(num: number): number;\ndeclare function Min(...args: number[]): number;\ndeclare function Max(...args: number[]): number;\ndeclare function Average(...args: number[]): number;\ndeclare function Floor(num: number): number;\ndeclare function Ceiling(num: number): number;\ndeclare function Round(num: number): number;\ndeclare function Sum(...args: number[]): number;\ndeclare function Rand(num: number): number;\n\ndeclare function If(condition: boolean, val1: any, val2: any): any;\ndeclare function IsEmpty(text: string | string[]): boolean;\ndeclare function NotNull(val: any): boolean;\ndeclare function And(...args: boolean[]): boolean;\ndeclare function Or(...args: boolean[]): boolean;\n\ndeclare function Len(text: string): number;\ndeclare function Contains(text1: string, text2: string): boolean;\ndeclare function Split(text1: string, text2: string): string[];\ndeclare function Trim(text: string): string;\ndeclare function Upper(text: string): string;\ndeclare function Lower(text: string): string;\ndeclare function Concat(...text: string[]): string;\n\ndeclare function Now(): number;\ndeclare function Timestamp(arg: number | string | Date): number;\ndeclare function Second(arg: number | string | Date): number;\ndeclare function Minute(arg: number | string | Date): number;\ndeclare function Hour(arg: number | string | Date): number;\ndeclare function Day(arg: number | string | Date): number;\ndeclare function DayOfWeek(arg: number | string | Date): number;\ndeclare function Month(arg: number | string | Date): number;\ndeclare function Year(arg: number | string | Date): number;\ndeclare function GetDate(year: number, month: number, day: number): number;\ndeclare function DateTimeValue(arg: string, val: string): number;\ndeclare function Age(arg: number | string | Date, val: number | string | Date): number;\ndeclare function AgeOfNow(arg: number | string | Date): number;\ndeclare function DateAdd(arg: number | string | Date, day: number): number;\ndeclare function MonthAdd(arg: number | string | Date, month: number): number;\ndeclare function YearAdd(arg: number | string | Date, year: number): number;\ndeclare function DateDiff(startDay: number | string | Date, endDay: number | string | Date): number;\ndeclare function HourDiff(startDay: number | string | Date, endDay: number | string | Date): number;\ndeclare function MinuteDiff(startDay: number | string | Date, endDay: number | string | Date): number;\ndeclare function SecondDiff(startDay: number | string | Date, endDay: number | string | Date): number;\ndeclare function MonthDiff(startDay: number | string | Date, endDay: number | string | Date): number;\ndeclare function YearDiff(startDay: number | string | Date, endDay: number | string | Date): number;\ndeclare function DateText(createdTime: number | string | Date, text: string): string;\ndeclare function IsToday(date: number | string | Date): boolean;\n\n\n// Global Formula End\n";
1
+ export declare const wedaDTS = "\ndeclare class UserWidget {\n // \u5185\u7F6E\u547D\u540D\u7A7A\u95F4\n get sys(): {\n readonly id: string;\n readonly module: string;\n readonly component: string;\n readonly parent: UserWidget;\n readonly children: UserWidget[];\n\n closest(filter?: (parentWidget: UserWidget) => boolean): UserWidget | null;\n };\n\n // \u81EA\u5B9A\u4E49\u547D\u540D\u7A7A\u95F4\n get custom(): { [key: string]: any };\n\n // ========== \u5FEB\u6377\u8BBF\u95EE\u65B9\u5F0F ========== //\n\n readonly id: string;\n readonly module: string;\n readonly component: string;\n readonly parent: UserWidget;\n readonly children: UserWidget[];\n\n closest(filter?: (parentWidget: UserWidget) => boolean): UserWidget | null;\n}\n\n// Used Components Inner Begin\n// Used Components - Don't touch me\n// Used Components Inner End\n\ndeclare namespace $app {\n namespace dataset {\n\n const state: {\n // Global State Inner Begin\n // Global State \u5168\u5C40\u53D8\u91CF - Don't touch me\n // Global State Inner End\n }\n\n }\n\n namespace utils {\n function ABS(num: number): number;\n function Min(...args: number[]): number;\n function Max(...args: number[]): number;\n function Average(...args: number[]): number;\n function Floor(num: number): number;\n function Ceiling(num: number): number;\n function Round(num: number): number;\n function Sum(...args: number[]): number;\n function Rand(num: number): number;\n\n function If(condition: boolean, val1: any, val2: any): any;\n function IsEmpty(text: string | string[]): boolean;\n function NotNull(val: any): boolean;\n function And(...args: boolean[]): boolean;\n function Or(...args: boolean[]): boolean;\n\n function Len(text: string): number;\n function Contains(text1: string, text2: string): boolean;\n function Split(text1: string, text2: string): string[];\n function Trim(text: string): string;\n function Upper(text: string): string;\n function Lower(text: string): string;\n function Concat(...text: string[]): string;\n\n function Now(): number;\n function Timestamp(arg: number | string | Date): number;\n function Second(arg: number | string | Date): number;\n function Minute(arg: number | string | Date): number;\n function Hour(arg: number | string | Date): number;\n function Day(arg: number | string | Date): number;\n function DayOfWeek(arg: number | string | Date): number;\n function Month(arg: number | string | Date): number;\n function Year(arg: number | string | Date): number;\n function GetDate(year: number, month: number, day: number): number;\n function DateTimeValue(arg: string, val: string): number;\n function Age(arg: number | string | Date, val: number | string | Date): number;\n function AgeOfNow(arg: number | string | Date): number;\n function DateAdd(arg: number | string | Date, day: number): number;\n function MonthAdd(arg: number | string | Date, month: number): number;\n function YearAdd(arg: number | string | Date, year: number): number;\n function DateDiff(startDay: number | string | Date, endDay: number | string | Date): number;\n function HourDiff(startDay: number | string | Date, endDay: number | string | Date): number;\n function MinuteDiff(startDay: number | string | Date, endDay: number | string | Date): number;\n function SecondDiff(startDay: number | string | Date, endDay: number | string | Date): number;\n function MonthDiff(startDay: number | string | Date, endDay: number | string | Date): number;\n function YearDiff(startDay: number | string | Date, endDay: number | string | Date): number;\n function DateText(createdTime: number | string | Date, text: string): string;\n function IsToday(date: number | string | Date): boolean;\n\n }\n\n namespace common {\n // Global Common Inner Begin\n // Global Common \u5168\u5C40\u65B9\u6CD5 - Don't touch me\n // Global Common Inner End\n }\n\n namespace auth {\n const currentUser: {\n userId?: string\n phone?: string\n type?: number\n relatedRoles?: {\n id?: string\n envId?: string\n name?: string\n roleIdentity?: string\n }[]\n openId?: string\n name?: string\n nickName?: string\n email?: string\n mainOrg?: {\n id?: string\n name?: string\n }\n orgs?: {\n id?: string\n name?: string\n }[]\n}\n\n }\n\n \n\ninterface navigatorOptions {\n packageName: string;\n pageId: string;\n data?: Record<string, any>;\n params?: Record<string, any>;\n events?: Record<string, (data: any) => void>;\n success(res: any);\n fail(res: any);\n complete(res: any);\n}\n\ninterface navigateBackOptions {\n delta: number;\n}\n\n// \u8BBE\u7F6E\u72B6\u6001\nfunction setState(userSetState: Record<string, any>): void\n\n// \u7279\u5236\u8DEF\u7531\nfunction navigateTo(options: navigatorOptions)\nfunction redirectTo(options: navigatorOptions)\nfunction reLaunch(options: navigatorOptions)\nfunction navigateBack(options: navigateBackOptions)\n\n// \u663E\u793A\u63D0\u793A\nfunction showToast(options);\n\n// \u663E\u793A\u6A21\u6001\u63D0\u793A\nfunction showModal(options);\n\n// \u663E\u793A loading \u63D0\u793A\nfunction showLoading(options);\n\n// \u9690\u85CF loading \u63D0\u793A\nfunction hideLoading(options);\n\n// \u9690\u85CF\u63D0\u793A\nfunction hideToast(options);\n\n// sacnCode\nfunction scanCode(options: {\n onlyFromCamera?: boolean;\n enableDefaultBehavior?: boolean;\n scanType?: ('barCode' | 'qrCode')[];\n success?: (res: { result: string; scanType: string }) => void;\n fail?: (err: Error) => void;\n complete?: () => void;\n}): Promise<ScanCodeResult> | ScanCodeResult;\n\n\n}\n\ndeclare const app = $app\n\ndeclare namespace $w {\n function ABS(num: number): number;\n function Min(...args: number[]): number;\n function Max(...args: number[]): number;\n function Average(...args: number[]): number;\n function Floor(num: number): number;\n function Ceiling(num: number): number;\n function Round(num: number): number;\n function Sum(...args: number[]): number;\n function Rand(num: number): number;\n\n function If(condition: boolean, val1: any, val2: any): any;\n function IsEmpty(text: string | string[]): boolean;\n function NotNull(val: any): boolean;\n function And(...args: boolean[]): boolean;\n function Or(...args: boolean[]): boolean;\n\n function Len(text: string): number;\n function Contains(text1: string, text2: string): boolean;\n function Split(text1: string, text2: string): string[];\n function Trim(text: string): string;\n function Upper(text: string): string;\n function Lower(text: string): string;\n function Concat(...text: string[]): string;\n\n function Now(): number;\n function Timestamp(arg: number | string | Date): number;\n function Second(arg: number | string | Date): number;\n function Minute(arg: number | string | Date): number;\n function Hour(arg: number | string | Date): number;\n function Day(arg: number | string | Date): number;\n function DayOfWeek(arg: number | string | Date): number;\n function Month(arg: number | string | Date): number;\n function Year(arg: number | string | Date): number;\n function GetDate(year: number, month: number, day: number): number;\n function DateTimeValue(arg: string, val: string): number;\n function Age(arg: number | string | Date, val: number | string | Date): number;\n function AgeOfNow(arg: number | string | Date): number;\n function DateAdd(arg: number | string | Date, day: number): number;\n function MonthAdd(arg: number | string | Date, month: number): number;\n function YearAdd(arg: number | string | Date, year: number): number;\n function DateDiff(startDay: number | string | Date, endDay: number | string | Date): number;\n function HourDiff(startDay: number | string | Date, endDay: number | string | Date): number;\n function MinuteDiff(startDay: number | string | Date, endDay: number | string | Date): number;\n function SecondDiff(startDay: number | string | Date, endDay: number | string | Date): number;\n function MonthDiff(startDay: number | string | Date, endDay: number | string | Date): number;\n function YearDiff(startDay: number | string | Date, endDay: number | string | Date): number;\n function DateText(createdTime: number | string | Date, text: string): string;\n function IsToday(date: number | string | Date): boolean;\n\n\n // used widgets Inner Begin\n // used widgets - Don't touch me\n // used widgets Inner End\n\n // repeater scope Inner Begin\n // repeater scope - Don't touch me\n // repeater scope Inner End\n}\n\n// Global For Begin\ndeclare const $for: {\n // Global For Inner Begin\n // For \u5FAA\u73AF\u53D8\u91CF - Don't touch me\n // Global For Inner End\n}\ndeclare const forItems = $for\n// Global For End\n\n// $page Begin\ndeclare namespace $page {\n namespace dataset {\n\n const state: {\n // Page State Inner Begin\n // Page State \u9875\u9762\u53D8\u91CF - Don't touch me\n // Page State Inner End\n }\n\n const params: {\n // Page Param Inner Begin\n // Page Param \u9875\u9762\u53C2\u6570 - Don't touch me\n // Page Param Inner End\n }\n\n }\n\n namespace handler {\n // Page Handler Inner Begin\n // Page Handler \u9875\u9762\u65B9\u6CD5 - Don't touch me\n // Page Handler Inner End\n }\n\n \n\n// \u8BBE\u7F6E\u72B6\u6001\nfunction setState(userSetState: Record<string, any>): void\n\n\n}\n// $page End\n\n// $comp Begin\ndeclare namespace $comp {\n\n namespace props {\n\n const data: {\n // Comp Prop Data Inner Begin\n // Comp Prop Data \u7EC4\u4EF6\u5C5E\u6027 - Don't touch me\n // Comp Prop Data Inner End\n }\n\n namespace events {\n // Comp Prop Events Inner Begin\n // Comp Prop Events \u7EC4\u4EF6\u4E8B\u4EF6 - Don't touch me\n // Comp Prop Events Inner End\n }\n\n }\n\n namespace dataset {\n\n const state: {\n // Comp State Inner Begin\n // Comp State \u7EC4\u4EF6\u53D8\u91CF - Don't touch me\n // Comp State Inner End\n }\n\n }\n\n namespace handler {\n // Comp Handler Inner Begin\n // Comp Handler \u7EC4\u4EF6\u65B9\u6CD5 - Don't touch me\n // Comp Handler Inner End\n }\n\n}\n// $comp End\n\n// Global Formula Begin\n\ndeclare function ABS(num: number): number;\ndeclare function Min(...args: number[]): number;\ndeclare function Max(...args: number[]): number;\ndeclare function Average(...args: number[]): number;\ndeclare function Floor(num: number): number;\ndeclare function Ceiling(num: number): number;\ndeclare function Round(num: number): number;\ndeclare function Sum(...args: number[]): number;\ndeclare function Rand(num: number): number;\n\ndeclare function If(condition: boolean, val1: any, val2: any): any;\ndeclare function IsEmpty(text: string | string[]): boolean;\ndeclare function NotNull(val: any): boolean;\ndeclare function And(...args: boolean[]): boolean;\ndeclare function Or(...args: boolean[]): boolean;\n\ndeclare function Len(text: string): number;\ndeclare function Contains(text1: string, text2: string): boolean;\ndeclare function Split(text1: string, text2: string): string[];\ndeclare function Trim(text: string): string;\ndeclare function Upper(text: string): string;\ndeclare function Lower(text: string): string;\ndeclare function Concat(...text: string[]): string;\n\ndeclare function Now(): number;\ndeclare function Timestamp(arg: number | string | Date): number;\ndeclare function Second(arg: number | string | Date): number;\ndeclare function Minute(arg: number | string | Date): number;\ndeclare function Hour(arg: number | string | Date): number;\ndeclare function Day(arg: number | string | Date): number;\ndeclare function DayOfWeek(arg: number | string | Date): number;\ndeclare function Month(arg: number | string | Date): number;\ndeclare function Year(arg: number | string | Date): number;\ndeclare function GetDate(year: number, month: number, day: number): number;\ndeclare function DateTimeValue(arg: string, val: string): number;\ndeclare function Age(arg: number | string | Date, val: number | string | Date): number;\ndeclare function AgeOfNow(arg: number | string | Date): number;\ndeclare function DateAdd(arg: number | string | Date, day: number): number;\ndeclare function MonthAdd(arg: number | string | Date, month: number): number;\ndeclare function YearAdd(arg: number | string | Date, year: number): number;\ndeclare function DateDiff(startDay: number | string | Date, endDay: number | string | Date): number;\ndeclare function HourDiff(startDay: number | string | Date, endDay: number | string | Date): number;\ndeclare function MinuteDiff(startDay: number | string | Date, endDay: number | string | Date): number;\ndeclare function SecondDiff(startDay: number | string | Date, endDay: number | string | Date): number;\ndeclare function MonthDiff(startDay: number | string | Date, endDay: number | string | Date): number;\ndeclare function YearDiff(startDay: number | string | Date, endDay: number | string | Date): number;\ndeclare function DateText(createdTime: number | string | Date, text: string): string;\ndeclare function IsToday(date: number | string | Date): boolean;\n\n\n// Global Formula End\n";
2
2
  //# sourceMappingURL=auto-generated.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"auto-generated.d.ts","sourceRoot":"","sources":["../../../src/utils/dts/auto-generated.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,wrSA6RnB,CAAA"}
1
+ {"version":3,"file":"auto-generated.d.ts","sourceRoot":"","sources":["../../../src/utils/dts/auto-generated.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,+xZAwXnB,CAAA"}
@@ -1,7 +1,38 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.wedaDTS = void 0;
4
- exports.wedaDTS = `declare namespace $app {
4
+ exports.wedaDTS = `
5
+ declare class UserWidget {
6
+ // 内置命名空间
7
+ get sys(): {
8
+ readonly id: string;
9
+ readonly module: string;
10
+ readonly component: string;
11
+ readonly parent: UserWidget;
12
+ readonly children: UserWidget[];
13
+
14
+ closest(filter?: (parentWidget: UserWidget) => boolean): UserWidget | null;
15
+ };
16
+
17
+ // 自定义命名空间
18
+ get custom(): { [key: string]: any };
19
+
20
+ // ========== 快捷访问方式 ========== //
21
+
22
+ readonly id: string;
23
+ readonly module: string;
24
+ readonly component: string;
25
+ readonly parent: UserWidget;
26
+ readonly children: UserWidget[];
27
+
28
+ closest(filter?: (parentWidget: UserWidget) => boolean): UserWidget | null;
29
+ }
30
+
31
+ // Used Components Inner Begin
32
+ // Used Components - Don't touch me
33
+ // Used Components Inner End
34
+
35
+ declare namespace $app {
5
36
  namespace dataset {
6
37
 
7
38
  const state: {
@@ -153,6 +184,66 @@ function scanCode(options: {
153
184
 
154
185
  declare const app = $app
155
186
 
187
+ declare namespace $w {
188
+ function ABS(num: number): number;
189
+ function Min(...args: number[]): number;
190
+ function Max(...args: number[]): number;
191
+ function Average(...args: number[]): number;
192
+ function Floor(num: number): number;
193
+ function Ceiling(num: number): number;
194
+ function Round(num: number): number;
195
+ function Sum(...args: number[]): number;
196
+ function Rand(num: number): number;
197
+
198
+ function If(condition: boolean, val1: any, val2: any): any;
199
+ function IsEmpty(text: string | string[]): boolean;
200
+ function NotNull(val: any): boolean;
201
+ function And(...args: boolean[]): boolean;
202
+ function Or(...args: boolean[]): boolean;
203
+
204
+ function Len(text: string): number;
205
+ function Contains(text1: string, text2: string): boolean;
206
+ function Split(text1: string, text2: string): string[];
207
+ function Trim(text: string): string;
208
+ function Upper(text: string): string;
209
+ function Lower(text: string): string;
210
+ function Concat(...text: string[]): string;
211
+
212
+ function Now(): number;
213
+ function Timestamp(arg: number | string | Date): number;
214
+ function Second(arg: number | string | Date): number;
215
+ function Minute(arg: number | string | Date): number;
216
+ function Hour(arg: number | string | Date): number;
217
+ function Day(arg: number | string | Date): number;
218
+ function DayOfWeek(arg: number | string | Date): number;
219
+ function Month(arg: number | string | Date): number;
220
+ function Year(arg: number | string | Date): number;
221
+ function GetDate(year: number, month: number, day: number): number;
222
+ function DateTimeValue(arg: string, val: string): number;
223
+ function Age(arg: number | string | Date, val: number | string | Date): number;
224
+ function AgeOfNow(arg: number | string | Date): number;
225
+ function DateAdd(arg: number | string | Date, day: number): number;
226
+ function MonthAdd(arg: number | string | Date, month: number): number;
227
+ function YearAdd(arg: number | string | Date, year: number): number;
228
+ function DateDiff(startDay: number | string | Date, endDay: number | string | Date): number;
229
+ function HourDiff(startDay: number | string | Date, endDay: number | string | Date): number;
230
+ function MinuteDiff(startDay: number | string | Date, endDay: number | string | Date): number;
231
+ function SecondDiff(startDay: number | string | Date, endDay: number | string | Date): number;
232
+ function MonthDiff(startDay: number | string | Date, endDay: number | string | Date): number;
233
+ function YearDiff(startDay: number | string | Date, endDay: number | string | Date): number;
234
+ function DateText(createdTime: number | string | Date, text: string): string;
235
+ function IsToday(date: number | string | Date): boolean;
236
+
237
+
238
+ // used widgets Inner Begin
239
+ // used widgets - Don't touch me
240
+ // used widgets Inner End
241
+
242
+ // repeater scope Inner Begin
243
+ // repeater scope - Don't touch me
244
+ // repeater scope Inner End
245
+ }
246
+
156
247
  // Global For Begin
157
248
  declare const $for: {
158
249
  // Global For Inner Begin
@@ -79,6 +79,8 @@ function groupDTSs({ wedaFrameworkDTS = '', wedaAPIDTS = '', wedaAuthDTS = '', f
79
79
  resultDts = resultDts.replace("// Formula 函数公式 - Don't touch me", formulaDTS.replace(/export/g, ''));
80
80
  // 函数公式:全局变量提示
81
81
  resultDts = resultDts.replace("// Global Formula 全局函数公式- Don't touch me", formulaDTS.replace(/export/g, 'declare'));
82
+ // 函数公式:$w.xxx
83
+ resultDts = resultDts.replace("// $w global APIs - Don't touch me", formulaDTS.replace(/export/g, ''));
82
84
  // 增加 API
83
85
  const appAPIDTS = wedaAPIDTS.replace(/[\s\S]*\/\/ ============ App API Begin ============ \/\/([\s\S]*?)\/\/ ============ App API End ============ \/\/[\s\S]*/, '$1');
84
86
  resultDts = resultDts.replace("// App API - Don't touch me", appAPIDTS);
@@ -1,12 +1,33 @@
1
- import { IJsonSchemaObject } from '../../types';
1
+ import { IJsonSchemaAny, IJsonSchemaObject } from '../../types';
2
2
  export interface IDTSCodeItem {
3
3
  name: string;
4
4
  code: string;
5
5
  }
6
+ export interface IInputDataUsedComponents {
7
+ module: string;
8
+ component: string;
9
+ exportProperties?: IJsonSchemaObject;
10
+ exportMethods?: {
11
+ name: string;
12
+ input?: IJsonSchemaObject;
13
+ output?: IJsonSchemaAny;
14
+ }[];
15
+ }
16
+ export interface IInputDataWidgetItem {
17
+ module: string;
18
+ component: string;
19
+ idList: string[];
20
+ }
21
+ export interface IInputDataRepeaterItem {
22
+ currentItemAlias: string;
23
+ currentIndexAlias: string;
24
+ itemData: IJsonSchemaAny;
25
+ }
6
26
  export interface IOptions {
7
27
  isCompMode?: boolean;
8
28
  needGlobalFormula?: boolean;
9
29
  needGlobalFor?: boolean;
30
+ needRepeaterScope?: boolean;
10
31
  }
11
32
  export declare enum IInputDataType {
12
33
  globalState = "globalState",
@@ -18,7 +39,10 @@ export declare enum IInputDataType {
18
39
  pageHandlerCodes = "pageHandlerCodes",
19
40
  compHandlerCodes = "compHandlerCodes",
20
41
  compPropData = "compPropData",
21
- compPropEvents = "compPropEvents"
42
+ compPropEvents = "compPropEvents",
43
+ usedComponents = "usedComponents",
44
+ usedWidgets = "usedWidgets",
45
+ repeaterScope = "repeaterScope"
22
46
  }
23
47
  export interface IInputData {
24
48
  [IInputDataType.globalState]?: IJsonSchemaObject;
@@ -31,6 +55,9 @@ export interface IInputData {
31
55
  [IInputDataType.compHandlerCodes]?: IDTSCodeItem[];
32
56
  [IInputDataType.compPropData]?: IJsonSchemaObject;
33
57
  [IInputDataType.compPropEvents]?: string[];
58
+ [IInputDataType.usedComponents]?: IInputDataUsedComponents[];
59
+ [IInputDataType.usedWidgets]?: IInputDataWidgetItem[];
60
+ [IInputDataType.repeaterScope]?: IInputDataRepeaterItem[];
34
61
  }
35
62
  /**
36
63
  * 通过该类可以共享同个dts。
@@ -45,7 +72,7 @@ export declare class WeDaDTS {
45
72
  /**
46
73
  * 部分更新 - 只更新一种类型
47
74
  */
48
- static updateDTSPartial(inputData: IJsonSchemaObject | IDTSCodeItem[] | string[], itemType: IInputDataType, options?: {
75
+ static updateDTSPartial(inputData: IJsonSchemaObject | IDTSCodeItem[] | string[] | IInputDataUsedComponents[] | IInputDataWidgetItem[] | IInputDataRepeaterItem[], itemType: IInputDataType, options?: {
49
76
  setEmptyIfError: boolean;
50
77
  }): Promise<void>;
51
78
  static getDTS(options?: Omit<IOptions, "isCompMode">): string;
@@ -54,7 +81,7 @@ export declare class WeDaDTS {
54
81
  * 生成 WeDa 应用的低码代码提示的 dts 类型声明内容
55
82
  */
56
83
  export declare function generateWeDaAppDTS(inputData?: IInputData, options?: IOptions): Promise<string>;
57
- export declare const workerCode = "\nimportScripts('https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/release/_url/devtools/typescriptServices.min.js');\n\nts.transpileOptionValueCompilerOptions.forEach(item => {\n if (['emitDeclarationOnly', 'declaration'].includes(item.name)) {\n item.transpileOptionValue = true\n }\n})\naddEventListener('message', (message) => {\n const {action, data: {id, code}} = message.data\n switch(action) {\n case 'dts':\n const dts = ts.transpile(code, {})\n postMessage({action: 'dts_back', data: {id, dts}})\n break\n default:\n break\n }\n})\n";
84
+ export declare const workerCode = "\nimportScripts('https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/release/_url/devtools/typescriptServices.min.js');\nimportScripts('https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/release/_url/devtools/ts-lib.min.js');\n\nconst files = {\n \"foo.ts\": '',\n \"lib.d.ts\": libFileMap['lib.es5.d.ts']\n};\n\nfunction createLanguageService() {\n return ts.createLanguageService({\n getCompilationSettings() {\n return {};\n },\n getScriptFileNames() {\n return [\"foo.ts\", \"lib.d.ts\"];\n },\n getScriptVersion(_fileName) {\n // \u8FD9\u6837\u53EF\u907F\u514D\u4F7F\u7528\u7F13\u5B58\n if (_fileName === 'foo.ts')\n return 'v_' + Math.random();\n return ''\n },\n getScriptSnapshot(fileName) {\n if (fileName === \".ts\") {\n return ts.ScriptSnapshot.fromString(\"\");\n }\n return ts.ScriptSnapshot.fromString(files[fileName] || \"\");\n },\n getCurrentDirectory: () => \".\",\n getDefaultLibFileName(options) {\n return 'lib.d.ts'\n },\n fileExists: name => !!files[name],\n readFile: name => {\n return files[name]\n }\n });\n}\nconst languageService = createLanguageService();\n\nfunction transpile(code) {\n files[\"foo.ts\"] = code\n const result = languageService.getEmitOutput(\n \"foo.ts\",\n /*emitOnlyDtsFiles*/ true,\n /*forceDtsEmit*/ true\n )\n return result.outputFiles[0].text.trim()\n}\n\naddEventListener('message', (message) => {\n const {action, data: {id, code}} = message.data\n switch(action) {\n case 'dts':\n const dts = transpile(code)\n postMessage({action: 'dts_back', data: {id, dts}})\n break\n default:\n break\n }\n})\n";
58
85
  /**
59
86
  * 通过 js/ts 代码生成 dts
60
87
  */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/dts/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAK/C,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,QAAQ;IAEvB,UAAU,CAAC,EAAE,OAAO,CAAA;IAEpB,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAE3B,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAED,oBAAY,cAAc;IACxB,WAAW,gBAAgB;IAC3B,SAAS,cAAc;IACvB,SAAS,cAAc;IACvB,UAAU,eAAe;IACzB,QAAQ,aAAa;IACrB,iBAAiB,sBAAsB;IACvC,gBAAgB,qBAAqB;IACrC,gBAAgB,qBAAqB;IACrC,YAAY,iBAAiB;IAC7B,cAAc,mBAAmB;CAClC;AAED,MAAM,WAAW,UAAU;IACzB,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,EAAE,iBAAiB,CAAA;IAChD,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,EAAE,iBAAiB,CAAA;IAC9C,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,EAAE,iBAAiB,CAAA;IAC9C,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,EAAE,iBAAiB,CAAA;IAC/C,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,EAAE,iBAAiB,CAAA;IAC7C,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC,EAAE,YAAY,EAAE,CAAA;IACnD,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC,EAAE,YAAY,EAAE,CAAA;IAClD,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC,EAAE,YAAY,EAAE,CAAA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,OAAO,CAAC,MAAM,CAAC,CAO5D"}
@@ -48,6 +48,9 @@ var IInputDataType;
48
48
  IInputDataType["compHandlerCodes"] = "compHandlerCodes";
49
49
  IInputDataType["compPropData"] = "compPropData";
50
50
  IInputDataType["compPropEvents"] = "compPropEvents";
51
+ IInputDataType["usedComponents"] = "usedComponents";
52
+ IInputDataType["usedWidgets"] = "usedWidgets";
53
+ IInputDataType["repeaterScope"] = "repeaterScope";
51
54
  })(IInputDataType = exports.IInputDataType || (exports.IInputDataType = {}));
52
55
  const DtsPlaceholder = {
53
56
  [IInputDataType.globalState]: "// Global State 全局变量 - Don't touch me",
@@ -60,6 +63,9 @@ const DtsPlaceholder = {
60
63
  [IInputDataType.compHandlerCodes]: "// Comp Handler 组件方法 - Don't touch me",
61
64
  [IInputDataType.compPropData]: "// Comp Prop Data 组件属性 - Don't touch me",
62
65
  [IInputDataType.compPropEvents]: "// Comp Prop Events 组件事件 - Don't touch me",
66
+ [IInputDataType.usedComponents]: "// Used Components - Don't touch me",
67
+ [IInputDataType.usedWidgets]: "// used widgets - Don't touch me",
68
+ [IInputDataType.repeaterScope]: "// repeater scope - Don't touch me"
63
69
  };
64
70
  const DtsInnerSign = {
65
71
  [IInputDataType.globalState]: "Global State Inner",
@@ -72,6 +78,9 @@ const DtsInnerSign = {
72
78
  [IInputDataType.compHandlerCodes]: "Comp Handler Inner",
73
79
  [IInputDataType.compPropData]: "Comp Prop Data Inner",
74
80
  [IInputDataType.compPropEvents]: "Comp Prop Events Inner",
81
+ [IInputDataType.usedComponents]: "Used Components Inner",
82
+ [IInputDataType.usedWidgets]: "used widgets Inner",
83
+ [IInputDataType.repeaterScope]: "repeater scope Inner"
75
84
  };
76
85
  /**
77
86
  * 通过该类可以共享同个dts。
@@ -83,7 +92,7 @@ class WeDaDTS {
83
92
  */
84
93
  static updateDTS(inputData = {}, options = { isCompMode: false }) {
85
94
  return __awaiter(this, void 0, void 0, function* () {
86
- WeDaDTS._dts = yield generateWeDaAppDTS(inputData, Object.assign(Object.assign({}, options), { needGlobalFormula: true, needGlobalFor: true }));
95
+ WeDaDTS._dts = yield generateWeDaAppDTS(inputData, Object.assign(Object.assign({}, options), { needGlobalFormula: true, needGlobalFor: true, needRepeaterScope: true }));
87
96
  });
88
97
  }
89
98
  /**
@@ -103,7 +112,7 @@ class WeDaDTS {
103
112
  }
104
113
  });
105
114
  }
106
- static getDTS(options = { needGlobalFormula: false, needGlobalFor: false }) {
115
+ static getDTS(options = { needGlobalFormula: false, needGlobalFor: false, needRepeaterScope: false }) {
107
116
  let resultDts = WeDaDTS._dts;
108
117
  if (!options.needGlobalFormula) {
109
118
  resultDts = resultDts.replace(/^\/\/ Global Formula Begin[\s\S]*^\/\/ Global Formula End$/m, '');
@@ -111,6 +120,9 @@ class WeDaDTS {
111
120
  if (!options.needGlobalFor) {
112
121
  resultDts = resultDts.replace(/^\/\/ Global For Begin[\s\S]*^\/\/ Global For End$/m, '');
113
122
  }
123
+ if (!options.needRepeaterScope) {
124
+ resultDts = resultDts.replace(/\/\/ repeater scope Inner Begin[\s\S]*\/\/ repeater scope Inner End$/m, '');
125
+ }
114
126
  return resultDts;
115
127
  }
116
128
  }
@@ -119,7 +131,7 @@ WeDaDTS._dts = '';
119
131
  /**
120
132
  * 生成 WeDa 应用的低码代码提示的 dts 类型声明内容
121
133
  */
122
- function generateWeDaAppDTS(inputData = {}, options = { isCompMode: false, needGlobalFormula: false, needGlobalFor: false }) {
134
+ function generateWeDaAppDTS(inputData = {}, options = { isCompMode: false, needGlobalFormula: false, needGlobalFor: false, needRepeaterScope: false }) {
123
135
  return __awaiter(this, void 0, void 0, function* () {
124
136
  let resultDts = auto_generated_1.wedaDTS;
125
137
  yield Promise.all(Object.keys(inputData).map((key) => __awaiter(this, void 0, void 0, function* () {
@@ -150,6 +162,10 @@ function generateWeDaAppDTS(inputData = {}, options = { isCompMode: false, needG
150
162
  if (!(options === null || options === void 0 ? void 0 : options.needGlobalFor)) {
151
163
  resultDts = resultDts.replace(/^\/\/ Global For Begin[\s\S]*^\/\/ Global For End$/m, '');
152
164
  }
165
+ // 根据是否需要 Repeater 作用域来删除一些类型定义
166
+ if (!(options === null || options === void 0 ? void 0 : options.needRepeaterScope)) {
167
+ resultDts = resultDts.replace(/\/\/ repeater scope Inner Begin[\s\S]*\/\/ repeater scope Inner End$/m, '');
168
+ }
153
169
  // console.log(resultDts)
154
170
  return resultDts;
155
171
  });
@@ -207,16 +223,70 @@ function _generateOneItemDTS(inputData, itemType) {
207
223
  return inputData.map(eventName => {
208
224
  return `function ${eventName}(data?: ${IData}): void`;
209
225
  }).join('\n');
210
- }
211
- };
212
- function _compile(jsonschema) {
213
- return __awaiter(this, void 0, void 0, function* () {
214
- let dts = yield compile(jsonschema, 'IWeDa', { additionalProperties: false, bannerComment: '', format: false });
215
- dts = dts.replace(/^export interface.*$/m, '');
216
- dts = dts.substring(0, dts.length - 2);
217
- return dts;
218
- });
226
+ },
227
+ [IInputDataType.usedComponents]: function (inputData) {
228
+ return __awaiter(this, void 0, void 0, function* () {
229
+ const results = yield Promise.all(inputData.map((item) => __awaiter(this, void 0, void 0, function* () {
230
+ // 属性
231
+ let exportPropertiesDTS = '';
232
+ if (item.exportProperties) {
233
+ exportPropertiesDTS = yield _compile(item.exportProperties);
234
+ }
235
+ // 方法
236
+ let exportMethodsDTS = '';
237
+ if (item.exportMethods) {
238
+ const results = yield Promise.all(item.exportMethods.map((item) => __awaiter(this, void 0, void 0, function* () {
239
+ let inputDTS = '';
240
+ if (item.input) {
241
+ inputDTS = yield _compile(item.input);
242
+ }
243
+ let outputDTS = 'void';
244
+ if (item.output) {
245
+ outputDTS = yield _compile(item.output, true);
246
+ }
247
+ return `${item.name}: (${inputDTS.trim().replace(/\n/g, ',')}) => ${outputDTS}`;
248
+ })));
249
+ exportMethodsDTS = results.join('\n');
250
+ }
251
+ return `
252
+ declare class ${_genCompInterfaceName(item.module, item.component)} extends UserWidget {
253
+ get custom(): {
254
+ ${exportPropertiesDTS}
255
+
256
+ ${exportMethodsDTS}
257
+ };
258
+
259
+ ${exportPropertiesDTS}
260
+
261
+ ${exportMethodsDTS}
219
262
  }
263
+ `;
264
+ })));
265
+ return results.join('\n');
266
+ });
267
+ },
268
+ [IInputDataType.usedWidgets]: function (inputData) {
269
+ return inputData.map(item => {
270
+ if (item.idList && item.idList.length > 0) {
271
+ const interfaceName = _genCompInterfaceName(item.module, item.component);
272
+ return item.idList.map(id => `const ${id}: ${interfaceName}`).join('\n');
273
+ }
274
+ return '';
275
+ }).join('\n');
276
+ },
277
+ [IInputDataType.repeaterScope]: function (inputData) {
278
+ return __awaiter(this, void 0, void 0, function* () {
279
+ const results = yield Promise.all(inputData.map((item) => __awaiter(this, void 0, void 0, function* () {
280
+ let itemDataDTS = yield _compile(item.itemData, true);
281
+ return `
282
+ const ${item.currentItemAlias}: ${itemDataDTS}
283
+ const ${item.currentIndexAlias}: number
284
+ `;
285
+ })));
286
+ return results.join('\n');
287
+ });
288
+ },
289
+ };
220
290
  let dts = '';
221
291
  if (!inputData)
222
292
  return dts;
@@ -227,22 +297,84 @@ function _generateOneItemDTS(inputData, itemType) {
227
297
  }
228
298
  dts = dts || (yield _compile(inputData));
229
299
  return dts;
300
+ function _genCompInterfaceName(module, component) {
301
+ return `${module.replace(/-/g, '_')}_${component}`;
302
+ }
303
+ function _compile(jsonschema, isObjNeedWrapper = false) {
304
+ return __awaiter(this, void 0, void 0, function* () {
305
+ let dts = yield compile(jsonschema, 'IWeDa', { additionalProperties: false, bannerComment: '', format: false });
306
+ if (dts.search(/^export interface IWeDa/) >= 0) {
307
+ dts = dts.replace(/^export interface.*$/m, '');
308
+ dts = dts.substring(0, dts.length - 2);
309
+ if (isObjNeedWrapper) {
310
+ dts = `{${dts}}`;
311
+ }
312
+ }
313
+ else {
314
+ dts = dts.replace(/^export type IWeDa =/m, '');
315
+ }
316
+ return dts;
317
+ });
318
+ }
230
319
  });
231
320
  }
232
321
  // 仅仅为了与 unittest 共享,外部请不要使用
233
322
  exports.workerCode = `
234
323
  importScripts('https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/release/_url/devtools/typescriptServices.min.js');
324
+ importScripts('https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/release/_url/devtools/ts-lib.min.js');
325
+
326
+ const files = {
327
+ "foo.ts": '',
328
+ "lib.d.ts": libFileMap['lib.es5.d.ts']
329
+ };
330
+
331
+ function createLanguageService() {
332
+ return ts.createLanguageService({
333
+ getCompilationSettings() {
334
+ return {};
335
+ },
336
+ getScriptFileNames() {
337
+ return ["foo.ts", "lib.d.ts"];
338
+ },
339
+ getScriptVersion(_fileName) {
340
+ // 这样可避免使用缓存
341
+ if (_fileName === 'foo.ts')
342
+ return 'v_' + Math.random();
343
+ return ''
344
+ },
345
+ getScriptSnapshot(fileName) {
346
+ if (fileName === ".ts") {
347
+ return ts.ScriptSnapshot.fromString("");
348
+ }
349
+ return ts.ScriptSnapshot.fromString(files[fileName] || "");
350
+ },
351
+ getCurrentDirectory: () => ".",
352
+ getDefaultLibFileName(options) {
353
+ return 'lib.d.ts'
354
+ },
355
+ fileExists: name => !!files[name],
356
+ readFile: name => {
357
+ return files[name]
358
+ }
359
+ });
360
+ }
361
+ const languageService = createLanguageService();
362
+
363
+ function transpile(code) {
364
+ files["foo.ts"] = code
365
+ const result = languageService.getEmitOutput(
366
+ "foo.ts",
367
+ /*emitOnlyDtsFiles*/ true,
368
+ /*forceDtsEmit*/ true
369
+ )
370
+ return result.outputFiles[0].text.trim()
371
+ }
235
372
 
236
- ts.transpileOptionValueCompilerOptions.forEach(item => {
237
- if (['emitDeclarationOnly', 'declaration'].includes(item.name)) {
238
- item.transpileOptionValue = true
239
- }
240
- })
241
373
  addEventListener('message', (message) => {
242
374
  const {action, data: {id, code}} = message.data
243
375
  switch(action) {
244
376
  case 'dts':
245
- const dts = ts.transpile(code, {})
377
+ const dts = transpile(code)
246
378
  postMessage({action: 'dts_back', data: {id, dts}})
247
379
  break
248
380
  default:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/cals",
3
- "version": "0.5.4",
3
+ "version": "0.5.5-alpha.1",
4
4
  "description": "Common application specifications",
5
5
  "main": "lib/utils/index.js",
6
6
  "source": "src/utils/index.ts",
@@ -8,9 +8,6 @@
8
8
  "files": [
9
9
  "lib"
10
10
  ],
11
- "publishConfig": {
12
- "access": "public"
13
- },
14
11
  "scripts": {
15
12
  "build": "tsc",
16
13
  "build:schema": "ts-node src/utils/build.ts",
@@ -51,4 +48,4 @@
51
48
  "typescript": "^4.7.4",
52
49
  "typescript-json-schema": "^0.53.0"
53
50
  }
54
- }
51
+ }
@@ -1,18 +0,0 @@
1
- declare function Plugin(opt?: {
2
- root?: string;
3
- zoom?: number;
4
- precision?: number;
5
- outUnit?: string;
6
- exclude?: string;
7
- }): {
8
- postcssPlugin: string;
9
- Once(root: any, { result }: {
10
- result: any;
11
- }): void;
12
- };
13
- declare namespace Plugin {
14
- var postcss: boolean;
15
- var CALC_RPX_ROOT_VAL_NAME: string;
16
- }
17
- export default Plugin;
18
- //# sourceMappingURL=postcss-rpx2clac.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"postcss-rpx2clac.d.ts","sourceRoot":"","sources":["../../../src/parser/plugins/postcss-rpx2clac.ts"],"names":[],"mappings":"AA+BA,iBAAS,MAAM,CAAC,GAAG,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE;;;;;EAqC7G;kBArCQ,MAAM;;;;AA0Cf,eAAe,MAAM,CAAC"}
@@ -1,68 +0,0 @@
1
- 'use strict';
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const DEFAULT_CONFIG = {
4
- root: '2',
5
- /**
6
- * 缩放比例
7
- */
8
- zoom: 1,
9
- /**
10
- * 配置精度
11
- */
12
- precision: 5,
13
- /**
14
- * 输出单位
15
- */
16
- outUnit: 'px',
17
- /**
18
- * 配置忽略文件,正则匹配
19
- */
20
- exclude: '',
21
- };
22
- /**
23
- * https://github.com/cuth/postcss-pxtorem/blob/122649015322214f8e9d1ac852eb11c0791b634b/index.js#L56
24
- */
25
- function toFixed(number, precision) {
26
- const multiplier = Math.pow(10, precision + 1), wholeNumber = Math.floor(number * multiplier);
27
- return (Math.round(wholeNumber / 10) * 10) / multiplier;
28
- }
29
- function Plugin(opt) {
30
- opt = Object.assign(Object.assign({}, DEFAULT_CONFIG), (opt || {}));
31
- const { root: rootValue, zoom, precision, outUnit, exclude } = opt;
32
- return {
33
- postcssPlugin: 'postcss-rpx2calc',
34
- Once(root, { result }) {
35
- if (exclude && root.source.input.file.match(exclude) !== null) {
36
- result.root = root;
37
- return;
38
- }
39
- root.walkRules(function (rule) {
40
- rule.walkDecls(function (decl) {
41
- if (decl.value.includes('rpx')) {
42
- /**
43
- * copy form
44
- * https://github.com/cuth/postcss-pxtorem/blob/122649015322214f8e9d1ac852eb11c0791b634b/lib/pixel-unit-regex.js#L9
45
- * 不处理 var()rpx 的情况
46
- */
47
- const r2 = /"[^"]+"|'[^']+'|url\([^)]+\)|var\([^)]+\)|(\d*\.?\d+)rpx/g;
48
- decl.value = decl.value.replace(r2, (str, num1) => {
49
- if (num1 == undefined)
50
- return str;
51
- if (num1 == '0')
52
- return '0';
53
- const v = +num1 / zoom;
54
- if (isNaN(v)) {
55
- return str;
56
- }
57
- const value = Number.isInteger(v) ? v.toString() : toFixed(v, precision);
58
- return `calc(${value}${outUnit}/${rootValue})`;
59
- });
60
- }
61
- });
62
- });
63
- },
64
- };
65
- }
66
- Plugin.postcss = true;
67
- Plugin.CALC_RPX_ROOT_VAL_NAME = '--wd-rpx-radio';
68
- exports.default = Plugin;