@cloudbase/cals 0.5.5-alpha.1 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/parser/cals/index.d.ts +9 -0
- package/lib/parser/cals/index.d.ts.map +1 -1
- package/lib/parser/cals/index.js +24 -2
- package/lib/parser/cals/utils/code/index.d.ts.map +1 -1
- package/lib/parser/cals/utils/code/index.js +1 -0
- package/lib/parser/cals/utils/style.d.ts +36 -5
- package/lib/parser/cals/utils/style.d.ts.map +1 -1
- package/lib/parser/cals/utils/style.js +104 -73
- package/lib/parser/cals/utils/template.d.ts +1 -0
- package/lib/parser/cals/utils/template.d.ts.map +1 -1
- package/lib/parser/cals/utils/template.js +3 -2
- package/lib/parser/index.d.ts +2 -1
- package/lib/parser/index.d.ts.map +1 -1
- package/lib/parser/index.js +7 -1
- package/lib/parser/plugins/postcss-rpx2clac.d.ts +18 -0
- package/lib/parser/plugins/postcss-rpx2clac.d.ts.map +1 -0
- package/lib/parser/plugins/postcss-rpx2clac.js +68 -0
- package/lib/types/basic/app.d.ts +5 -0
- package/lib/types/basic/app.d.ts.map +1 -1
- package/lib/types/platform/app.d.ts +16 -0
- package/lib/types/platform/app.d.ts.map +1 -1
- package/lib/types/platform/app.js +9 -0
- package/lib/utils/dts/auto-generated.d.ts +1 -1
- package/lib/utils/dts/auto-generated.d.ts.map +1 -1
- package/lib/utils/dts/auto-generated.js +1 -92
- package/lib/utils/dts/build.js +0 -2
- package/lib/utils/dts/index.d.ts +4 -31
- package/lib/utils/dts/index.d.ts.map +1 -1
- package/lib/utils/dts/index.js +18 -150
- package/package.json +4 -1
|
@@ -289,6 +289,7 @@ export declare function deserializePlatformApp(data: IPlatformApp, optsions: {
|
|
|
289
289
|
isMiniProgramPlugins?: boolean;
|
|
290
290
|
})[];
|
|
291
291
|
}[];
|
|
292
|
+
externalResources: import("../../types").IExternalResource[];
|
|
292
293
|
extra: {
|
|
293
294
|
name: string;
|
|
294
295
|
author: string;
|
|
@@ -300,6 +301,7 @@ export declare function deserializePlatformApp(data: IPlatformApp, optsions: {
|
|
|
300
301
|
originHistoryId?: string;
|
|
301
302
|
};
|
|
302
303
|
dependencies: IDependencies;
|
|
304
|
+
schemaVersion: string;
|
|
303
305
|
};
|
|
304
306
|
/**
|
|
305
307
|
* page
|
|
@@ -356,5 +358,12 @@ export declare function deserializeComponentLibraryMeta(meta: {
|
|
|
356
358
|
};
|
|
357
359
|
export declare function processRuntimeCodeResources(ctx: {
|
|
358
360
|
id: string;
|
|
361
|
+
version?: string;
|
|
359
362
|
}, resources: any[], scope: string): any[];
|
|
363
|
+
/**
|
|
364
|
+
* 解析 cals version 来生成 feature map
|
|
365
|
+
*/
|
|
366
|
+
export declare function parseVersion(version?: string): {
|
|
367
|
+
defaultDynamicCssUnit: boolean;
|
|
368
|
+
};
|
|
360
369
|
//# 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,eAAe,CAAC,EAAE,GAAG,CAAC;IACtB,IAAI,CAAC,EAAE,cAAc,CAAC;CACvB;AAED,UAAU,iBAAiB;IACzB,GAAG,CAAC,EAA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,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,CACzC,GAAG,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,EACrC,SAAS,OAAyB,EAClC,KAAK,EAAE,MAAM,SAkCd;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,SAAK,GAAG;IAC1C,qBAAqB,EAAE,OAAO,CAAC;CAChC,CAcA"}
|
package/lib/parser/cals/index.js
CHANGED
|
@@ -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.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.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;
|
|
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 } = data, restData = __rest(data, ["version", "author", "name", "label", "description", "selectedPageId", "pageInstanceList", "lowCodes", "datasources", "vars", "dataset", "extra", "dependencies", "miniprogramPlugins", "lastDependencies"]);
|
|
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"]);
|
|
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,7 +795,9 @@ function serializePlatformApp(data, optsions) {
|
|
|
795
795
|
name: name || extraName,
|
|
796
796
|
author: author || extraAuthor,
|
|
797
797
|
version,
|
|
798
|
+
schemaVersion,
|
|
798
799
|
description: description || extraDescription,
|
|
800
|
+
externalResources,
|
|
799
801
|
main: homePage ? homePage.id : ((_a = pageInstanceList === null || pageInstanceList === void 0 ? void 0 : pageInstanceList[0]) === null || _a === void 0 ? void 0 : _a.id) || selectedPageId,
|
|
800
802
|
items: pageInstanceList === null || pageInstanceList === void 0 ? void 0 : pageInstanceList.map((page) => serializePage(ctx, page)),
|
|
801
803
|
resources: lowCodes === null || lowCodes === void 0 ? void 0 : lowCodes.map((item) => serializeCodeSource(ctx, item)),
|
|
@@ -854,10 +856,12 @@ function deserializePlatformApp(data, optsions) {
|
|
|
854
856
|
presetColors: presetColors || [],
|
|
855
857
|
appConfig,
|
|
856
858
|
miniprogramPlugins,
|
|
859
|
+
externalResources: data.externalResources,
|
|
857
860
|
extra: Object.assign(Object.assign({}, restExtra), { name: data.name, author: data.author, description: data.description, lastDependencies }),
|
|
858
861
|
dependencies: data.dependencies,
|
|
859
862
|
// TODO
|
|
860
863
|
// emitEvents: [], { "name": "自定义校验规则", "eventName": "validator" }
|
|
864
|
+
schemaVersion: data.schemaVersion,
|
|
861
865
|
};
|
|
862
866
|
return processed;
|
|
863
867
|
}
|
|
@@ -1073,3 +1077,21 @@ function processRuntimeCodeResources(ctx, resources /* : IWeappCode[]*/ = [], sc
|
|
|
1073
1077
|
return resources.filter((m) => m.name !== common_1.ECodeName.PLACEHOLDER);
|
|
1074
1078
|
}
|
|
1075
1079
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/parser/cals/utils/code/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAsE,MAAM,mBAAmB,CAAC;AAGrH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,YAAY,EAAE,OAAO,GAAE,IAAI,GAAG,IAAW,GAAG,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/parser/cals/utils/code/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAsE,MAAM,mBAAmB,CAAC;AAGrH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,YAAY,EAAE,OAAO,GAAE,IAAI,GAAG,IAAW,GAAG,SAAS,EAAE,CAuL3F;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,SAAS,EAAE,EAAE,OAAO,GAAE,IAAI,GAAG,IAAW,GAAG,YAAY,CA+J3F;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,MAAM,CA6BlF"}
|
|
@@ -1,12 +1,43 @@
|
|
|
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
|
+
*/
|
|
3
8
|
export declare function processCommonStyle2CSSProperties(commonStyle?: any, options?: {
|
|
4
|
-
|
|
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;
|
|
5
30
|
ignoreSelf?: boolean;
|
|
6
31
|
addPXUnit?: boolean;
|
|
7
|
-
toRpx?: boolean;
|
|
8
|
-
}): Properties<string | number>;
|
|
9
|
-
export declare function processCSSProperties2Rem(style?: Properties<string | number>, options?: {
|
|
10
|
-
looseError: boolean;
|
|
11
32
|
}): 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 {};
|
|
12
43
|
//# 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;
|
|
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,GAAQ,EACrB,OAAO,GAAE;IACP;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;OAIG;IACH,WAAW,CAAC,EAAE,KAAK,GAAG,IAAI,GAAG,KAAK,CAAC;IACnC;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;CACwE,GAC7F,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC,CAkS7B;AACD,UAAU,sBAAsB;IAC9B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AACD;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,GAAE,UAAU,CAAC,MAAM,GAAG,MAAM,CAAM,EACvC,OAAO,CAAC,EAAE,sBAAsB,GAC/B,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC,CAE7B;AACD,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,UAAU,CAAC,MAAM,GAAG,MAAM,CAAM,EACvC,IAAI,EAAE,IAAI,GAAG,KAAK,GAAG,KAAK,EAC1B,OAAO,CAAC,EAAE,sBAAsB,MAajC"}
|
|
@@ -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.processCSSProperties2Rem = exports.processCommonStyle2CSSProperties = exports.removeInvalidStyleFormValue = void 0;
|
|
14
|
+
exports.processCSSPropertiesUnit = 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,10 +50,12 @@ function setStyleValue(object, key, value) {
|
|
|
50
50
|
}
|
|
51
51
|
function _handleStyleNumValue(styleVal, addPXUnit) {
|
|
52
52
|
if (addPXUnit) {
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
/**
|
|
54
|
+
* 2022.12.13
|
|
55
|
+
* 改分支未启用
|
|
56
|
+
*/
|
|
55
57
|
const value = `${styleVal}`;
|
|
56
|
-
if (
|
|
58
|
+
if (/^\d*.?\d+$/.test(value)) {
|
|
57
59
|
return `${value}px`;
|
|
58
60
|
}
|
|
59
61
|
}
|
|
@@ -84,7 +86,8 @@ function setDistanceStyle(style, distance, attr, addPXUnit) {
|
|
|
84
86
|
});
|
|
85
87
|
}
|
|
86
88
|
}
|
|
87
|
-
function translateStyleByHandler(style = {}, handler, options
|
|
89
|
+
function translateStyleByHandler(style = {}, handler, options) {
|
|
90
|
+
const { looseError = false, rpxCalcRoot } = options || {};
|
|
88
91
|
return Object.keys(style).reduce((result, key) => {
|
|
89
92
|
const value = style[key];
|
|
90
93
|
if (utils_1.isUnitlessNumber[key]) {
|
|
@@ -92,10 +95,10 @@ function translateStyleByHandler(style = {}, handler, options = { looseError: fa
|
|
|
92
95
|
}
|
|
93
96
|
else if (value !== undefined && value !== null) {
|
|
94
97
|
try {
|
|
95
|
-
setStyleValue(result, key, handler(value));
|
|
98
|
+
setStyleValue(result, key, handler(value, rpxCalcRoot));
|
|
96
99
|
}
|
|
97
100
|
catch (e) {
|
|
98
|
-
if (
|
|
101
|
+
if (looseError) {
|
|
99
102
|
console.warn('translate style error, key:value', key, value);
|
|
100
103
|
}
|
|
101
104
|
else {
|
|
@@ -106,51 +109,77 @@ function translateStyleByHandler(style = {}, handler, options = { looseError: fa
|
|
|
106
109
|
return result;
|
|
107
110
|
}, {});
|
|
108
111
|
}
|
|
109
|
-
function
|
|
110
|
-
if (
|
|
111
|
-
|
|
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(' ');
|
|
112
|
+
function toREM(cssLen, rpxCalcRoot = undefined) {
|
|
113
|
+
if (typeof cssLen === 'string' || typeof cssLen === 'number') {
|
|
114
|
+
const cssLenArr = `${cssLen}`.split(' ');
|
|
120
115
|
return cssLenArr
|
|
121
116
|
.map((attr) => {
|
|
122
|
-
const matchResult = attr.match(/^(-?\d+)(px)?$/);
|
|
117
|
+
const matchResult = attr.match(/^(-?\d+)(r?px)?$/);
|
|
123
118
|
if (matchResult === null || matchResult === void 0 ? void 0 : matchResult[1]) {
|
|
124
|
-
|
|
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`;
|
|
125
129
|
}
|
|
126
130
|
return attr;
|
|
127
131
|
})
|
|
128
132
|
.join(' ');
|
|
129
133
|
}
|
|
130
|
-
else if (typeof cssLen === 'number') {
|
|
131
|
-
return calPxToREM(cssLen);
|
|
132
|
-
}
|
|
133
134
|
else {
|
|
134
|
-
throw new Error(
|
|
135
|
+
throw new Error(`cssLen type error ${cssLen}`);
|
|
135
136
|
}
|
|
136
137
|
}
|
|
137
|
-
function toRPX(cssLen) {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
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';
|
|
145
149
|
}
|
|
146
|
-
return
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
}
|
|
150
|
-
|
|
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;
|
|
170
|
+
}
|
|
171
|
+
return `${+matchResult[1]}px`;
|
|
172
|
+
}
|
|
173
|
+
return attr;
|
|
174
|
+
})
|
|
175
|
+
.join(' ');
|
|
151
176
|
}
|
|
152
|
-
|
|
153
|
-
|
|
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 }) {
|
|
154
183
|
const { size,
|
|
155
184
|
// transform,
|
|
156
185
|
text, border, background, margin, padding, zIndex, position, display, flexConfig, custom, self, boxShadow, } = commonStyle;
|
|
@@ -351,45 +380,24 @@ function processCommonStyle2CSSProperties(commonStyle = {}, options = { toRem: t
|
|
|
351
380
|
currentBoxShadowStyleString = 'inset ';
|
|
352
381
|
}
|
|
353
382
|
// offsetX
|
|
354
|
-
|
|
355
|
-
currentBoxShadowStyleString += _handleStyleNumValue(offsetX, !!options.addPXUnit);
|
|
356
|
-
}
|
|
357
|
-
else {
|
|
358
|
-
currentBoxShadowStyleString += '0';
|
|
359
|
-
}
|
|
383
|
+
currentBoxShadowStyleString += _handleStyleNumValue(!!offsetX ? offsetX : 0, !!options.addPXUnit);
|
|
360
384
|
// offsetY
|
|
361
|
-
|
|
362
|
-
currentBoxShadowStyleString += ' ' + _handleStyleNumValue(offsetY, !!options.addPXUnit);
|
|
363
|
-
}
|
|
364
|
-
else {
|
|
365
|
-
currentBoxShadowStyleString += ' 0';
|
|
366
|
-
}
|
|
385
|
+
currentBoxShadowStyleString += ` ${_handleStyleNumValue(!!offsetY ? offsetY : 0, !!options.addPXUnit)}`;
|
|
367
386
|
// blur-radius 当 spread-radius 存在时,即使不存在 blur-radius,blur-radius 也要为 0
|
|
368
387
|
if (!!blurRadius || !!spreadRadius) {
|
|
369
|
-
|
|
370
|
-
currentBoxShadowStyleString += ' ' + _handleStyleNumValue(blurRadius, !!options.addPXUnit);
|
|
371
|
-
}
|
|
372
|
-
else {
|
|
373
|
-
currentBoxShadowStyleString += ' 0';
|
|
374
|
-
}
|
|
388
|
+
currentBoxShadowStyleString += ` ${_handleStyleNumValue(!!blurRadius ? blurRadius : 0, !!options.addPXUnit)}`;
|
|
375
389
|
}
|
|
376
390
|
// spread-radius
|
|
377
391
|
if (!!spreadRadius) {
|
|
378
|
-
currentBoxShadowStyleString +=
|
|
392
|
+
currentBoxShadowStyleString += ` ${_handleStyleNumValue(spreadRadius, !!options.addPXUnit)}`;
|
|
379
393
|
}
|
|
380
394
|
// color
|
|
381
395
|
if (!!color) {
|
|
382
|
-
currentBoxShadowStyleString +=
|
|
396
|
+
currentBoxShadowStyleString += ` ${color}`;
|
|
383
397
|
}
|
|
384
398
|
}
|
|
385
399
|
if (!!currentBoxShadowStyleString) {
|
|
386
|
-
|
|
387
|
-
if (!!boxShadowStyleString) {
|
|
388
|
-
splitLabel = ' , ';
|
|
389
|
-
}
|
|
390
|
-
else {
|
|
391
|
-
splitLabel = '';
|
|
392
|
-
}
|
|
400
|
+
const splitLabel = !!boxShadowStyleString ? ' , ' : '';
|
|
393
401
|
boxShadowStyleString += splitLabel + currentBoxShadowStyleString;
|
|
394
402
|
}
|
|
395
403
|
});
|
|
@@ -413,16 +421,39 @@ function processCommonStyle2CSSProperties(commonStyle = {}, options = { toRem: t
|
|
|
413
421
|
style[key] = value[value.length - 1];
|
|
414
422
|
}
|
|
415
423
|
}
|
|
416
|
-
|
|
417
|
-
|
|
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
|
+
}
|
|
418
433
|
}
|
|
419
|
-
|
|
434
|
+
if (defaultUnit) {
|
|
435
|
+
return processCSSPropertiesUnit(style, defaultUnit, translateStyleOptions);
|
|
436
|
+
}
|
|
437
|
+
return style;
|
|
420
438
|
}
|
|
421
439
|
exports.processCommonStyle2CSSProperties = processCommonStyle2CSSProperties;
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
function processCSSProperties2Rem(style = {}, options
|
|
440
|
+
/**
|
|
441
|
+
* @deprecated
|
|
442
|
+
*/
|
|
443
|
+
function processCSSProperties2Rem(style = {}, options) {
|
|
426
444
|
return translateStyleByHandler(style, toREM, options);
|
|
427
445
|
}
|
|
428
446
|
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 +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,
|
|
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"}
|
|
@@ -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
|
-
// 默认 px 会转换成 rem,含大写字母 PX 和 Px 则不会转换
|
|
162
|
+
// <%= version[0] === '4' ? '默认 rpx 会转换成 动态cals实现,px/PX/Px 均代表传统一样上的px':'默认 px 会转换成 rem,含大写字母 PX 和 Px 则不会转换' %>
|
|
163
163
|
// margin-top: 20px;
|
|
164
164
|
// 使用theme中的混合(mixins)
|
|
165
165
|
// <%= type === 'component' ? '':'.mixins();' %>
|
|
@@ -198,10 +198,11 @@ export default function(props) {
|
|
|
198
198
|
}`,
|
|
199
199
|
};
|
|
200
200
|
function generateDefaultCode(ctx, type, scope) {
|
|
201
|
-
const { id } = ctx;
|
|
201
|
+
const { id, version = '' } = ctx;
|
|
202
202
|
const data = {
|
|
203
203
|
type: scope,
|
|
204
204
|
id,
|
|
205
|
+
version,
|
|
205
206
|
};
|
|
206
207
|
switch (type) {
|
|
207
208
|
case types_1.ECodeType.LIFECYCLE: {
|
package/lib/parser/index.d.ts
CHANGED
|
@@ -4,5 +4,6 @@ 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 } from './cals/utils/style';
|
|
7
|
+
export { processCommonStyle2CSSProperties, processCSSProperties2Rem, processCSSPropertiesUnit, } from './cals/utils/style';
|
|
8
|
+
export { default as PostcssRpx2Calc } from './plugins/postcss-rpx2clac';
|
|
8
9
|
//# 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,
|
|
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"}
|
package/lib/parser/index.js
CHANGED
|
@@ -13,8 +13,11 @@ 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
|
+
};
|
|
16
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
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;
|
|
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;
|
|
18
21
|
__exportStar(require("./cals/index"), exports);
|
|
19
22
|
var version_1 = require("./cals/utils/version");
|
|
20
23
|
Object.defineProperty(exports, "upgrageToVersion2", { enumerable: true, get: function () { return version_1.upgrageToVersion2; } });
|
|
@@ -33,3 +36,6 @@ Object.defineProperty(exports, "PropBindType", { enumerable: true, get: function
|
|
|
33
36
|
var style_1 = require("./cals/utils/style");
|
|
34
37
|
Object.defineProperty(exports, "processCommonStyle2CSSProperties", { enumerable: true, get: function () { return style_1.processCommonStyle2CSSProperties; } });
|
|
35
38
|
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; } });
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,68 @@
|
|
|
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;
|
package/lib/types/basic/app.d.ts
CHANGED
|
@@ -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;;OAEG;IACH,W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EG;IACH,MAAM,CAAC,EAAE,GAAG,CAAC;IAEb;;OAEG;IACH,KAAK,EAAE,UAAU,EAAE,CAAC;IAEpB;;OAEG;IACH,WAAW,CAAC,EAAE,WAAW,EAAE,CAAC;IAE5B;;;;OAIG;IACH,SAAS,CAAC,EAAE,SAAS,EAAE,CAAC;IAExB;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,EAAE,CAAC;IAExB;;OAEG;IACH,KAAK,CAAC,EAAE,GAAG,CAAC;CACb"}
|
|
@@ -3,6 +3,13 @@ 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
|
+
}
|
|
6
13
|
/**
|
|
7
14
|
* 云开发低码平台应用
|
|
8
15
|
*/
|
|
@@ -40,6 +47,10 @@ export interface IPlatformApp extends Omit<Basic.IApp, 'attributes' | 'events' |
|
|
|
40
47
|
* IDependencies
|
|
41
48
|
*/
|
|
42
49
|
dependencies?: IDependencies;
|
|
50
|
+
/**
|
|
51
|
+
*
|
|
52
|
+
*/
|
|
53
|
+
externalResources?: IExternalResource[];
|
|
43
54
|
/** 应用所在环境ID */
|
|
44
55
|
envId?: string;
|
|
45
56
|
/** 应用 id */
|
|
@@ -158,4 +169,9 @@ export interface IPlatformAppLifeCycle extends IEvents {
|
|
|
158
169
|
*/
|
|
159
170
|
lifecycleOnLaunchEventName?: string;
|
|
160
171
|
}
|
|
172
|
+
export interface IExternalResource {
|
|
173
|
+
type: EExternalResourceType;
|
|
174
|
+
url?: string;
|
|
175
|
+
code?: string;
|
|
176
|
+
}
|
|
161
177
|
//# 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;
|
|
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,GAAG,QAAQ,GAAG,WAAW,GAAG,OAAO,GAAG,WAAW,CAAC;IACnH;;OAEG;IACH,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB;;OAEG;IACH,WAAW,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACpC;;OAEG;IACH,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B;;;;OAIG;IACH,aAAa,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACtC;;OAEG;IAC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WAAW,EAAE,MAAM,CAAC;QACpB,gBAAgB,EAAE,CAAC,MAAM,GAAG;YAC1B,oBAAoB,CAAC,EAAE,OAAO,CAAC;SAChC,CAAC,EAAE,CAAC;KACN,EAAE,CAAC;IACJ;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,gBAAgB,CAAC,EAAE;QAAE,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;KAAE,CAAC;IAClD;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,gBAAgB,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CAC9C;AACD,MAAM,WAAW,qBAAsB,SAAQ,OAAO;IACpD;;OAEG;IACH,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC;;OAEG;IACH,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC;;OAEG;IACH,0BAA0B,CAAC,EAAE,MAAM,CAAC;CACrC;AACD,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,qBAAqB,CAAC;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -1,2 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EExternalResourceType = 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 = "\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";
|
|
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";
|
|
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
|
|
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,38 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.wedaDTS = void 0;
|
|
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 {
|
|
4
|
+
exports.wedaDTS = `declare namespace $app {
|
|
36
5
|
namespace dataset {
|
|
37
6
|
|
|
38
7
|
const state: {
|
|
@@ -184,66 +153,6 @@ function scanCode(options: {
|
|
|
184
153
|
|
|
185
154
|
declare const app = $app
|
|
186
155
|
|
|
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
|
-
|
|
247
156
|
// Global For Begin
|
|
248
157
|
declare const $for: {
|
|
249
158
|
// Global For Inner Begin
|
package/lib/utils/dts/build.js
CHANGED
|
@@ -79,8 +79,6 @@ 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, ''));
|
|
84
82
|
// 增加 API
|
|
85
83
|
const appAPIDTS = wedaAPIDTS.replace(/[\s\S]*\/\/ ============ App API Begin ============ \/\/([\s\S]*?)\/\/ ============ App API End ============ \/\/[\s\S]*/, '$1');
|
|
86
84
|
resultDts = resultDts.replace("// App API - Don't touch me", appAPIDTS);
|
package/lib/utils/dts/index.d.ts
CHANGED
|
@@ -1,33 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { 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
|
-
}
|
|
26
6
|
export interface IOptions {
|
|
27
7
|
isCompMode?: boolean;
|
|
28
8
|
needGlobalFormula?: boolean;
|
|
29
9
|
needGlobalFor?: boolean;
|
|
30
|
-
needRepeaterScope?: boolean;
|
|
31
10
|
}
|
|
32
11
|
export declare enum IInputDataType {
|
|
33
12
|
globalState = "globalState",
|
|
@@ -39,10 +18,7 @@ export declare enum IInputDataType {
|
|
|
39
18
|
pageHandlerCodes = "pageHandlerCodes",
|
|
40
19
|
compHandlerCodes = "compHandlerCodes",
|
|
41
20
|
compPropData = "compPropData",
|
|
42
|
-
compPropEvents = "compPropEvents"
|
|
43
|
-
usedComponents = "usedComponents",
|
|
44
|
-
usedWidgets = "usedWidgets",
|
|
45
|
-
repeaterScope = "repeaterScope"
|
|
21
|
+
compPropEvents = "compPropEvents"
|
|
46
22
|
}
|
|
47
23
|
export interface IInputData {
|
|
48
24
|
[IInputDataType.globalState]?: IJsonSchemaObject;
|
|
@@ -55,9 +31,6 @@ export interface IInputData {
|
|
|
55
31
|
[IInputDataType.compHandlerCodes]?: IDTSCodeItem[];
|
|
56
32
|
[IInputDataType.compPropData]?: IJsonSchemaObject;
|
|
57
33
|
[IInputDataType.compPropEvents]?: string[];
|
|
58
|
-
[IInputDataType.usedComponents]?: IInputDataUsedComponents[];
|
|
59
|
-
[IInputDataType.usedWidgets]?: IInputDataWidgetItem[];
|
|
60
|
-
[IInputDataType.repeaterScope]?: IInputDataRepeaterItem[];
|
|
61
34
|
}
|
|
62
35
|
/**
|
|
63
36
|
* 通过该类可以共享同个dts。
|
|
@@ -72,7 +45,7 @@ export declare class WeDaDTS {
|
|
|
72
45
|
/**
|
|
73
46
|
* 部分更新 - 只更新一种类型
|
|
74
47
|
*/
|
|
75
|
-
static updateDTSPartial(inputData: IJsonSchemaObject | IDTSCodeItem[] | string[]
|
|
48
|
+
static updateDTSPartial(inputData: IJsonSchemaObject | IDTSCodeItem[] | string[], itemType: IInputDataType, options?: {
|
|
76
49
|
setEmptyIfError: boolean;
|
|
77
50
|
}): Promise<void>;
|
|
78
51
|
static getDTS(options?: Omit<IOptions, "isCompMode">): string;
|
|
@@ -81,7 +54,7 @@ export declare class WeDaDTS {
|
|
|
81
54
|
* 生成 WeDa 应用的低码代码提示的 dts 类型声明内容
|
|
82
55
|
*/
|
|
83
56
|
export declare function generateWeDaAppDTS(inputData?: IInputData, options?: IOptions): Promise<string>;
|
|
84
|
-
export declare const workerCode = "\nimportScripts('https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/release/_url/devtools/typescriptServices.min.js');\
|
|
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";
|
|
85
58
|
/**
|
|
86
59
|
* 通过 js/ts 代码生成 dts
|
|
87
60
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/dts/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,
|
|
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,C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|
IInputDataType["compPropData"] = "compPropData";
|
|
50
50
|
IInputDataType["compPropEvents"] = "compPropEvents";
|
|
51
|
-
IInputDataType["usedComponents"] = "usedComponents";
|
|
52
|
-
IInputDataType["usedWidgets"] = "usedWidgets";
|
|
53
|
-
IInputDataType["repeaterScope"] = "repeaterScope";
|
|
54
51
|
})(IInputDataType = exports.IInputDataType || (exports.IInputDataType = {}));
|
|
55
52
|
const DtsPlaceholder = {
|
|
56
53
|
[IInputDataType.globalState]: "// Global State 全局变量 - Don't touch me",
|
|
@@ -63,9 +60,6 @@ const DtsPlaceholder = {
|
|
|
63
60
|
[IInputDataType.compHandlerCodes]: "// Comp Handler 组件方法 - Don't touch me",
|
|
64
61
|
[IInputDataType.compPropData]: "// Comp Prop Data 组件属性 - Don't touch me",
|
|
65
62
|
[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"
|
|
69
63
|
};
|
|
70
64
|
const DtsInnerSign = {
|
|
71
65
|
[IInputDataType.globalState]: "Global State Inner",
|
|
@@ -78,9 +72,6 @@ const DtsInnerSign = {
|
|
|
78
72
|
[IInputDataType.compHandlerCodes]: "Comp Handler Inner",
|
|
79
73
|
[IInputDataType.compPropData]: "Comp Prop Data Inner",
|
|
80
74
|
[IInputDataType.compPropEvents]: "Comp Prop Events Inner",
|
|
81
|
-
[IInputDataType.usedComponents]: "Used Components Inner",
|
|
82
|
-
[IInputDataType.usedWidgets]: "used widgets Inner",
|
|
83
|
-
[IInputDataType.repeaterScope]: "repeater scope Inner"
|
|
84
75
|
};
|
|
85
76
|
/**
|
|
86
77
|
* 通过该类可以共享同个dts。
|
|
@@ -92,7 +83,7 @@ class WeDaDTS {
|
|
|
92
83
|
*/
|
|
93
84
|
static updateDTS(inputData = {}, options = { isCompMode: false }) {
|
|
94
85
|
return __awaiter(this, void 0, void 0, function* () {
|
|
95
|
-
WeDaDTS._dts = yield generateWeDaAppDTS(inputData, Object.assign(Object.assign({}, options), { needGlobalFormula: true, needGlobalFor: true
|
|
86
|
+
WeDaDTS._dts = yield generateWeDaAppDTS(inputData, Object.assign(Object.assign({}, options), { needGlobalFormula: true, needGlobalFor: true }));
|
|
96
87
|
});
|
|
97
88
|
}
|
|
98
89
|
/**
|
|
@@ -112,7 +103,7 @@ class WeDaDTS {
|
|
|
112
103
|
}
|
|
113
104
|
});
|
|
114
105
|
}
|
|
115
|
-
static getDTS(options = { needGlobalFormula: false, needGlobalFor: false
|
|
106
|
+
static getDTS(options = { needGlobalFormula: false, needGlobalFor: false }) {
|
|
116
107
|
let resultDts = WeDaDTS._dts;
|
|
117
108
|
if (!options.needGlobalFormula) {
|
|
118
109
|
resultDts = resultDts.replace(/^\/\/ Global Formula Begin[\s\S]*^\/\/ Global Formula End$/m, '');
|
|
@@ -120,9 +111,6 @@ class WeDaDTS {
|
|
|
120
111
|
if (!options.needGlobalFor) {
|
|
121
112
|
resultDts = resultDts.replace(/^\/\/ Global For Begin[\s\S]*^\/\/ Global For End$/m, '');
|
|
122
113
|
}
|
|
123
|
-
if (!options.needRepeaterScope) {
|
|
124
|
-
resultDts = resultDts.replace(/\/\/ repeater scope Inner Begin[\s\S]*\/\/ repeater scope Inner End$/m, '');
|
|
125
|
-
}
|
|
126
114
|
return resultDts;
|
|
127
115
|
}
|
|
128
116
|
}
|
|
@@ -131,7 +119,7 @@ WeDaDTS._dts = '';
|
|
|
131
119
|
/**
|
|
132
120
|
* 生成 WeDa 应用的低码代码提示的 dts 类型声明内容
|
|
133
121
|
*/
|
|
134
|
-
function generateWeDaAppDTS(inputData = {}, options = { isCompMode: false, needGlobalFormula: false, needGlobalFor: false
|
|
122
|
+
function generateWeDaAppDTS(inputData = {}, options = { isCompMode: false, needGlobalFormula: false, needGlobalFor: false }) {
|
|
135
123
|
return __awaiter(this, void 0, void 0, function* () {
|
|
136
124
|
let resultDts = auto_generated_1.wedaDTS;
|
|
137
125
|
yield Promise.all(Object.keys(inputData).map((key) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -162,10 +150,6 @@ function generateWeDaAppDTS(inputData = {}, options = { isCompMode: false, needG
|
|
|
162
150
|
if (!(options === null || options === void 0 ? void 0 : options.needGlobalFor)) {
|
|
163
151
|
resultDts = resultDts.replace(/^\/\/ Global For Begin[\s\S]*^\/\/ Global For End$/m, '');
|
|
164
152
|
}
|
|
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
|
-
}
|
|
169
153
|
// console.log(resultDts)
|
|
170
154
|
return resultDts;
|
|
171
155
|
});
|
|
@@ -223,70 +207,16 @@ function _generateOneItemDTS(inputData, itemType) {
|
|
|
223
207
|
return inputData.map(eventName => {
|
|
224
208
|
return `function ${eventName}(data?: ${IData}): void`;
|
|
225
209
|
}).join('\n');
|
|
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}
|
|
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
|
-
},
|
|
210
|
+
}
|
|
289
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
|
+
});
|
|
219
|
+
}
|
|
290
220
|
let dts = '';
|
|
291
221
|
if (!inputData)
|
|
292
222
|
return dts;
|
|
@@ -297,84 +227,22 @@ function _generateOneItemDTS(inputData, itemType) {
|
|
|
297
227
|
}
|
|
298
228
|
dts = dts || (yield _compile(inputData));
|
|
299
229
|
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
|
-
}
|
|
319
230
|
});
|
|
320
231
|
}
|
|
321
232
|
// 仅仅为了与 unittest 共享,外部请不要使用
|
|
322
233
|
exports.workerCode = `
|
|
323
234
|
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
|
-
}
|
|
372
235
|
|
|
236
|
+
ts.transpileOptionValueCompilerOptions.forEach(item => {
|
|
237
|
+
if (['emitDeclarationOnly', 'declaration'].includes(item.name)) {
|
|
238
|
+
item.transpileOptionValue = true
|
|
239
|
+
}
|
|
240
|
+
})
|
|
373
241
|
addEventListener('message', (message) => {
|
|
374
242
|
const {action, data: {id, code}} = message.data
|
|
375
243
|
switch(action) {
|
|
376
244
|
case 'dts':
|
|
377
|
-
const dts = transpile(code)
|
|
245
|
+
const dts = ts.transpile(code, {})
|
|
378
246
|
postMessage({action: 'dts_back', data: {id, dts}})
|
|
379
247
|
break
|
|
380
248
|
default:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/cals",
|
|
3
|
-
"version": "0.5.5
|
|
3
|
+
"version": "0.5.5",
|
|
4
4
|
"description": "Common application specifications",
|
|
5
5
|
"main": "lib/utils/index.js",
|
|
6
6
|
"source": "src/utils/index.ts",
|
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
"files": [
|
|
9
9
|
"lib"
|
|
10
10
|
],
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public"
|
|
13
|
+
},
|
|
11
14
|
"scripts": {
|
|
12
15
|
"build": "tsc",
|
|
13
16
|
"build:schema": "ts-node src/utils/build.ts",
|