@cloudbase/cals 1.0.63-alpha.0 → 1.0.63
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 +1 -6
- package/lib/parser/cals/index.d.ts.map +1 -1
- package/lib/parser/cals/index.js +2 -30
- package/lib/parser/cals/utils/code/index.d.ts +2 -2
- package/lib/parser/cals/utils/code/index.d.ts.map +1 -1
- package/lib/parser/cals/utils/code/index.js +11 -10
- package/lib/parser/cals/utils/common.d.ts +2 -2
- package/lib/parser/cals/utils/common.d.ts.map +1 -1
- package/lib/parser/cals/utils/common.js +1 -1
- package/lib/types/platform/app.d.ts +34 -97
- package/lib/types/platform/app.d.ts.map +1 -1
- package/lib/utils/dts/index.js +2 -3
- package/lib/utils/version-migrations/common.d.ts +5 -0
- package/lib/utils/version-migrations/common.d.ts.map +1 -0
- package/lib/utils/version-migrations/common.js +29 -0
- package/lib/utils/version-migrations/version4.d.ts +3 -0
- package/lib/utils/version-migrations/version4.d.ts.map +1 -0
- package/lib/utils/version-migrations/version4.js +199 -0
- package/package.json +3 -3
|
@@ -3,7 +3,7 @@ import { IAttributes, IPlatformApp, IPageComponent, IPlatformComponent, IDataSou
|
|
|
3
3
|
IPlatformDataSource, IDependencies, LCDS } from '../../types';
|
|
4
4
|
import { IDynamicValue, PropBindType } from '../expression';
|
|
5
5
|
import { IEventFlow } from '../../types/platform/eventFlow';
|
|
6
|
-
import { IHandler
|
|
6
|
+
import { IHandler } from '../../utils';
|
|
7
7
|
export { getUsedComps } from './utils/common';
|
|
8
8
|
export { generateDefaultCode } from './utils/template';
|
|
9
9
|
interface IDeserializeContext {
|
|
@@ -498,9 +498,4 @@ export declare function processTemplatesToDependiencies(templates?: any[]): {
|
|
|
498
498
|
schemaVersion: string;
|
|
499
499
|
};
|
|
500
500
|
export declare function generateHandlerParamsDynamicMap(handler: IHandler): any;
|
|
501
|
-
/**
|
|
502
|
-
* 精简过滤子包数据
|
|
503
|
-
* 仅保留子包自身数据
|
|
504
|
-
*/
|
|
505
|
-
export declare function streamlineSubApp(cals: any): IPlatformSubApp;
|
|
506
501
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/parser/cals/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAuC,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEvH,OAAO,EACL,WAAW,EACX,YAAY,EAGZ,cAAc,EACd,kBAAkB,EAElB,mBAAmB,EACnB,cAAc,EAAE,cAAc;AAC9B,mBAAmB,EACnB,aAAa,EACb,IAAI,EAEL,MAAM,aAAa,CAAC;AAErB,OAAO,EAAkC,aAAa,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAS5F,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/parser/cals/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAuC,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAEvH,OAAO,EACL,WAAW,EACX,YAAY,EAGZ,cAAc,EACd,kBAAkB,EAElB,mBAAmB,EACnB,cAAc,EAAE,cAAc;AAC9B,mBAAmB,EACnB,aAAa,EACb,IAAI,EAEL,MAAM,aAAa,CAAC;AAErB,OAAO,EAAkC,aAAa,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAS5F,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAoC,MAAM,aAAa,CAAC;AAEzE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,UAAU,mBAAmB;IAC3B,GAAG,CAAC,EAAE,YAA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,CAC1B,OAAO,SAAK,EACZ,YAAY,QAAK,GAChB;IACD,qBAAqB,EAAE,OAAO,CAAC;IAC/B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,cAAc,EAAE,OAAO,CAAC;IACxB,uBAAuB,EAAE,OAAO,CAAC;IACjC,oBAAoB,EAAE,OAAO,CAAC;CAC/B,CAoCA;AAED,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,iBAAiB,EAAE,EAC9B,OAAO,CAAC,EAAE;IAAE,MAAM,EAAE,OAAO,CAAA;CAAE,GAC5B;IACD,SAAS,EAAE,iBAAiB,EAAE,CAAC;IAC/B,UAAU,EAAE,UAAU,EAAE,CAAC;CAC1B,CA4DA;AAED,wBAAgB,6BAA6B,CAAC,YAAY,GAAE,aAAkB,MAQ7E;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,UAWvD;AAED,wBAAgB,+BAA+B,CAAC,SAAS,QAAK;;;;;;;;;;;;;;;;;QA4BtD;;;WAGG;;;;;;;EAcV;AAED,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,QAAQ,OAchE"}
|
package/lib/parser/cals/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
17
|
+
exports.generateHandlerParamsDynamicMap = exports.processTemplatesToDependiencies = exports.parseDependenciesVersion = exports.processDependenciesVersionMap = exports.processListeners = exports.parseVersion = exports.processRuntimeCodeResources = exports.deserializeComponentLibraryMeta = exports.deserializeRuntimeComponent = exports.serializeRuntimeComponent = exports.serializeRuntimeDataset = exports.serializeRuntimePage = exports.deserializeCompositeComponent = exports.deserializePlatformApp = exports.serializePlatformApp = exports.deserializePage = exports.serializeLayouts = exports.serializePage = exports.deserializeComponent = exports.serializeComponent = exports.deserializeDataVariables = exports.normalizeQuery = exports.deserializeDataset = exports.deserializeTemplates = exports.serializeDataset = exports.deserializeAttributes = exports.serializeAttributes = exports.deserializeDynamicMap = exports.serializeDynamicMap = exports.deserializeValue = exports.serializeValue = exports.generateDefaultCode = exports.getUsedComps = void 0;
|
|
18
18
|
const get_1 = __importDefault(require("lodash/get"));
|
|
19
19
|
const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
|
|
20
20
|
const unset_1 = __importDefault(require("lodash/unset"));
|
|
@@ -366,7 +366,6 @@ function serializeDataset(ctx, dataset) {
|
|
|
366
366
|
Object.entries(result.query || {}).forEach(([key, query]) => {
|
|
367
367
|
var _a, _b, _c, _d;
|
|
368
368
|
let { dataSourceName, method, listeners, handler, data, args } = query, restQuery = __rest(query, ["dataSourceName", "method", "listeners", "handler", "data", "args"]);
|
|
369
|
-
let isDeprecatedVersion = false;
|
|
370
369
|
let mergedData = (_a = serializeDynamicMapWithExtra({
|
|
371
370
|
ctx,
|
|
372
371
|
map: data || {},
|
|
@@ -376,7 +375,6 @@ function serializeDataset(ctx, dataset) {
|
|
|
376
375
|
moduleName: 'platform',
|
|
377
376
|
name: 'cloud.callDataSource',
|
|
378
377
|
};
|
|
379
|
-
isDeprecatedVersion = true;
|
|
380
378
|
mergedData = {
|
|
381
379
|
dataSourceName,
|
|
382
380
|
methodName: method === null || method === void 0 ? void 0 : method.name,
|
|
@@ -395,10 +393,7 @@ function serializeDataset(ctx, dataset) {
|
|
|
395
393
|
name: handler === null || handler === void 0 ? void 0 : handler.name,
|
|
396
394
|
':code': handler === null || handler === void 0 ? void 0 : handler.code,
|
|
397
395
|
};
|
|
398
|
-
if (
|
|
399
|
-
processedHandler.params = mergedData;
|
|
400
|
-
}
|
|
401
|
-
else if (mergedData && data) {
|
|
396
|
+
if (mergedData && data) {
|
|
402
397
|
processedHandler.params = mergedData;
|
|
403
398
|
}
|
|
404
399
|
else {
|
|
@@ -1476,26 +1471,3 @@ function generateHandlerParamsDynamicMap(handler) {
|
|
|
1476
1471
|
return handerParam;
|
|
1477
1472
|
}
|
|
1478
1473
|
exports.generateHandlerParamsDynamicMap = generateHandlerParamsDynamicMap;
|
|
1479
|
-
/**
|
|
1480
|
-
* 精简过滤子包数据
|
|
1481
|
-
* 仅保留子包自身数据
|
|
1482
|
-
*/
|
|
1483
|
-
function streamlineSubApp(cals) {
|
|
1484
|
-
const { schemaVersion, id, name, description, label, main, items = [], extra } = cals;
|
|
1485
|
-
const { originHistoryId, pageTree, rootPath } = extra;
|
|
1486
|
-
return {
|
|
1487
|
-
schemaVersion,
|
|
1488
|
-
id,
|
|
1489
|
-
name,
|
|
1490
|
-
label,
|
|
1491
|
-
description,
|
|
1492
|
-
main,
|
|
1493
|
-
items,
|
|
1494
|
-
extra: {
|
|
1495
|
-
pageTree,
|
|
1496
|
-
originHistoryId,
|
|
1497
|
-
rootPath,
|
|
1498
|
-
},
|
|
1499
|
-
};
|
|
1500
|
-
}
|
|
1501
|
-
exports.streamlineSubApp = streamlineSubApp;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* cals 与 code 互转
|
|
3
3
|
* 这里的 code 是中间状态的 code,即非最终生成的可运行的项目代码
|
|
4
4
|
*/
|
|
5
|
-
import { IPlatformApp
|
|
5
|
+
import { IPlatformApp } from '../../../../types';
|
|
6
6
|
export interface ICodeItem {
|
|
7
7
|
path: string;
|
|
8
8
|
code: string;
|
|
@@ -13,7 +13,7 @@ export interface ICodeItem {
|
|
|
13
13
|
*
|
|
14
14
|
* @params version: v0 - 没有 pages 目录; v1 - 有 pages 目录
|
|
15
15
|
*/
|
|
16
|
-
export declare function calsToCode(calsJSON: IPlatformApp
|
|
16
|
+
export declare function calsToCode(calsJSON: IPlatformApp, version?: 'v0' | 'v1'): ICodeItem[];
|
|
17
17
|
/**
|
|
18
18
|
* 中间状态的代码 转成 CALS
|
|
19
19
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/parser/cals/utils/code/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,
|
|
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;AAKrH,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,CAoM3F;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;AAED,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,gBAAgB,GAAE,OAAe,GAChC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,EAAE,CAoClD"}
|
|
@@ -94,16 +94,14 @@ function calsToCode(calsJSON, version = 'v1') {
|
|
|
94
94
|
'rootPath',
|
|
95
95
|
'themeVars',
|
|
96
96
|
'originHistoryId',
|
|
97
|
-
'enableLoading',
|
|
98
|
-
'statusPageId',
|
|
99
|
-
'disabled',
|
|
100
|
-
'enableAsyncMaterials',
|
|
101
|
-
'clientId',
|
|
102
|
-
'loginConfigVersion',
|
|
103
|
-
'enableLoginStatusShare',
|
|
104
97
|
// 额外添加,非标准
|
|
105
98
|
'pages',
|
|
106
99
|
'processPages',
|
|
100
|
+
'mpAppId',
|
|
101
|
+
'endpointType',
|
|
102
|
+
'resourceAppId',
|
|
103
|
+
'envId',
|
|
104
|
+
'uin',
|
|
107
105
|
],
|
|
108
106
|
};
|
|
109
107
|
// @ts-ignore
|
|
@@ -120,6 +118,10 @@ function calsToCode(calsJSON, version = 'v1') {
|
|
|
120
118
|
name: calsJSON.name,
|
|
121
119
|
description: calsJSON.description,
|
|
122
120
|
version: calsJSON.version,
|
|
121
|
+
scripts: {
|
|
122
|
+
'preview:web': 'tcb lowcode preview:app',
|
|
123
|
+
'preview:mp': 'tcb lowcode preview:app --platform=mp',
|
|
124
|
+
},
|
|
123
125
|
}, null, 2), '');
|
|
124
126
|
return codeList;
|
|
125
127
|
function addCodeItem(path, code, parentDir = 'src') {
|
|
@@ -147,7 +149,7 @@ function calsToCode(calsJSON, version = 'v1') {
|
|
|
147
149
|
.forEach((key) => (newConfig[key] = config[key]));
|
|
148
150
|
addCodeItem(configPath, JSON.stringify(config, null, 2));
|
|
149
151
|
}
|
|
150
|
-
function genCode(resources
|
|
152
|
+
function genCode(resources, basePath = '') {
|
|
151
153
|
const codeResources = (resources || []).filter((item) => item.type === types_1.EResourceType.CODE && item.name !== types_1.ECodeName.PLACEHOLDER);
|
|
152
154
|
codeResources.forEach((codeItem) => {
|
|
153
155
|
let codePath = '';
|
|
@@ -298,7 +300,7 @@ function codeToCals(codeList, version = 'v1') {
|
|
|
298
300
|
case 'lifecycle.js':
|
|
299
301
|
resources.push(Object.assign({ name: types_1.ECodeType.LIFECYCLE, path: `${_pageId}/${types_1.ECodeType.LIFECYCLE}`, codeType: types_1.ECodeType.LIFECYCLE }, commonVal));
|
|
300
302
|
break;
|
|
301
|
-
default:
|
|
303
|
+
default:
|
|
302
304
|
// page handler
|
|
303
305
|
const handlerMatches = relativePath.match(/^handler\/([^/]*?).js$/);
|
|
304
306
|
if (handlerMatches) {
|
|
@@ -312,7 +314,6 @@ function codeToCals(codeList, version = 'v1') {
|
|
|
312
314
|
(_b = calsJSON.resources) === null || _b === void 0 ? void 0 : _b.push(Object.assign({ name, path: `${_pageId}/common/${name}`, codeType: types_1.ECodeType.NORMAL_MODULE }, commonVal));
|
|
313
315
|
}
|
|
314
316
|
break;
|
|
315
|
-
}
|
|
316
317
|
}
|
|
317
318
|
}
|
|
318
319
|
function isPageFile(filePath) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IPlatformApp
|
|
1
|
+
import { IPlatformApp } from '../../../types';
|
|
2
2
|
import { IDataBind } from '../../expression/index';
|
|
3
3
|
declare type IUsedComponentResources = {
|
|
4
4
|
[libName: string]: Set<string>;
|
|
@@ -8,7 +8,7 @@ export declare function isPlainObject(src: any): boolean;
|
|
|
8
8
|
export declare const isEmptyObj: (obj: object) => boolean;
|
|
9
9
|
export declare function isValidStyleBind(styleBind: IDataBind): boolean;
|
|
10
10
|
export declare function isValidClassNameListBind(classNameListBind: IDataBind): boolean;
|
|
11
|
-
export declare function getUsedComps(apps:
|
|
11
|
+
export declare function getUsedComps(apps: IPlatformApp[], dependencies: any[], options?: {
|
|
12
12
|
withAction?: boolean;
|
|
13
13
|
/**
|
|
14
14
|
* templates 按需引入
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/parser/cals/utils/common.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,YAAY,
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/parser/cals/utils/common.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,YAAY,EAAsB,MAAM,gBAAgB,CAAC;AAElF,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAsBnD,aAAK,uBAAuB,GAAG;IAAE,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAAA;CAAE,CAAC;AAOlE,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,cAAc,UAAQ,UAQ5D;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,WAErC;AAED,eAAO,MAAM,UAAU,QAAS,MAAM,YAUrC,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,SAAS,WAQpD;AAED,wBAAgB,wBAAwB,CAAC,iBAAiB,EAAE,SAAS,WAQpE;AAyJD,wBAAgB,YAAY,CAE1B,IAAI,EAAE,YAAY,EAAE,EAEpB,YAAY,EAAE,GAAG,EAAE,EACnB,OAAO,CAAC,EAAE;IACR,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,UAAU,EAAE,OAAO,CAAC;CACrB,GACA,uBAAuB,GAAG;IAAE,SAAS,EAAE,uBAAuB,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAA;CAAE,CA+EvG"}
|
|
@@ -197,7 +197,7 @@ apps,
|
|
|
197
197
|
// 分库后的组件库 denpendienicy
|
|
198
198
|
dependencies, options) {
|
|
199
199
|
const { streamline = false, withAction = false } = options || {};
|
|
200
|
-
const { templates = [] } = (
|
|
200
|
+
const { templates = [] } = (apps === null || apps === void 0 ? void 0 : apps[0]) || {};
|
|
201
201
|
const comps = streamline && templates.length ? [...dependencies, (0, index_1.processTemplatesToDependiencies)(templates)] : dependencies;
|
|
202
202
|
// 1. 寻找应用内容里用到的所有组件
|
|
203
203
|
// 1.1 寻找主子应用各自的内容里所用到的组件
|
|
@@ -3,6 +3,7 @@ import { ICodeResource, IPlatformDataset } from './common';
|
|
|
3
3
|
import { IComplexComponent, IPageComponent } from './component';
|
|
4
4
|
import { IDataSourceVariable, IPlatformDataSource } from './datasource';
|
|
5
5
|
import { type ITheme } from './theme';
|
|
6
|
+
import { IEvents } from '../basic/component';
|
|
6
7
|
import { LCDS } from '../index';
|
|
7
8
|
export declare enum EExternalResourceType {
|
|
8
9
|
JSUrl = "jsUrl",
|
|
@@ -60,13 +61,6 @@ export interface IPlatformApp extends Omit<Basic.IApp, 'attributes' | 'events' |
|
|
|
60
61
|
/** 应用主题 */
|
|
61
62
|
theme?: ITheme;
|
|
62
63
|
}
|
|
63
|
-
/**
|
|
64
|
-
* 类型修改同步修改 parse 方法
|
|
65
|
-
* /src/parser/cals/index.ts
|
|
66
|
-
*/
|
|
67
|
-
export interface IPlatformSubApp extends Pick<IPlatformApp, 'schemaVersion' | 'id' | 'name' | 'description' | 'label' | 'main' | 'items'> {
|
|
68
|
-
extra?: IBasePlatformAppExtra & IBaseEditorPlatformAppExtra;
|
|
69
|
-
}
|
|
70
64
|
/**
|
|
71
65
|
* 格式和npm一样
|
|
72
66
|
* 格式:{ '@命名空间/组件库名称': <protocal>:<path>?v=<版本号> } 遵循URL规范
|
|
@@ -90,11 +84,7 @@ export interface IPlatformSubApp extends Pick<IPlatformApp, 'schemaVersion' | 'i
|
|
|
90
84
|
export declare type IDependencies = {
|
|
91
85
|
[key: string]: string;
|
|
92
86
|
};
|
|
93
|
-
|
|
94
|
-
* 新增持久化数据必须同步修改
|
|
95
|
-
* src/parser/cals/utils/code/index.ts
|
|
96
|
-
*/
|
|
97
|
-
export interface IPlatformAppExtra extends IEditorPlatformAppExtra, IBasePlatformAppExtra {
|
|
87
|
+
export interface IPlatformAppExtra {
|
|
98
88
|
/**
|
|
99
89
|
* 应用统一路由模式
|
|
100
90
|
*/
|
|
@@ -106,12 +96,14 @@ export interface IPlatformAppExtra extends IEditorPlatformAppExtra, IBasePlatfor
|
|
|
106
96
|
[key: string]: string;
|
|
107
97
|
};
|
|
108
98
|
/**
|
|
109
|
-
* @deprecated
|
|
110
99
|
* 预设色彩值
|
|
111
100
|
*/
|
|
112
101
|
presetColors?: string[];
|
|
113
102
|
/**
|
|
114
|
-
*
|
|
103
|
+
* 生成自增ID极限范围
|
|
104
|
+
*/
|
|
105
|
+
maxID?: number;
|
|
106
|
+
/**
|
|
115
107
|
* 小程序插件
|
|
116
108
|
*/
|
|
117
109
|
plugins?: {
|
|
@@ -122,7 +114,10 @@ export interface IPlatformAppExtra extends IEditorPlatformAppExtra, IBasePlatfor
|
|
|
122
114
|
version: string;
|
|
123
115
|
}[];
|
|
124
116
|
/**
|
|
125
|
-
*
|
|
117
|
+
* 小程序子包名 或 web 子页面路径
|
|
118
|
+
*/
|
|
119
|
+
rootPath?: string | null;
|
|
120
|
+
/**
|
|
126
121
|
* 主题定义
|
|
127
122
|
*/
|
|
128
123
|
themeVars?: {
|
|
@@ -147,6 +142,23 @@ export interface IPlatformAppExtra extends IEditorPlatformAppExtra, IBasePlatfor
|
|
|
147
142
|
* 当前页面静态资源域名(html、图片等静态资源)
|
|
148
143
|
*/
|
|
149
144
|
domain?: string;
|
|
145
|
+
/**
|
|
146
|
+
* 隐藏插槽配置
|
|
147
|
+
*/
|
|
148
|
+
compHiddenConfig?: {
|
|
149
|
+
[pageId: string]: string[];
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* 基准历史ID
|
|
153
|
+
*/
|
|
154
|
+
originHistoryId?: string;
|
|
155
|
+
/**
|
|
156
|
+
* 组件库上个版本信息。格式为:
|
|
157
|
+
* { @tcwd/CLOUDBASE_BUSSINESS: "weda:components?v=1.22.3&updateTime=1662369434696", @tcwd/CLOUDBASE_STANDARD: "weda:components?v=1.4.2&updateTime=1662369434696"}
|
|
158
|
+
*/
|
|
159
|
+
lastDependencies?: {
|
|
160
|
+
[key: string]: string;
|
|
161
|
+
};
|
|
150
162
|
/**
|
|
151
163
|
* 是否开启默认loading
|
|
152
164
|
*/
|
|
@@ -163,99 +175,24 @@ export interface IPlatformAppExtra extends IEditorPlatformAppExtra, IBasePlatfor
|
|
|
163
175
|
* 组件库目录独立子包
|
|
164
176
|
*/
|
|
165
177
|
enableAsyncMaterials?: boolean;
|
|
166
|
-
/**
|
|
167
|
-
* idaas 登录态区分标识
|
|
168
|
-
*/
|
|
169
|
-
clientId?: string;
|
|
170
|
-
/**
|
|
171
|
-
* 登录设置
|
|
172
|
-
*/
|
|
173
|
-
loginConfigVersion?: string;
|
|
174
|
-
/**
|
|
175
|
-
* 登录态共享
|
|
176
|
-
*/
|
|
177
|
-
enableLoginStatusShare?: boolean;
|
|
178
|
-
}
|
|
179
|
-
interface IBasePlatformAppExtra {
|
|
180
|
-
/**
|
|
181
|
-
* 小程序子包名 或 web 子页面路径
|
|
182
|
-
*/
|
|
183
|
-
rootPath?: string | null;
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* 新增持久化数据必须同步修改
|
|
187
|
-
* src/parser/cals/utils/code/index.ts
|
|
188
|
-
*/
|
|
189
|
-
interface IEditorPlatformAppExtra extends IBaseEditorPlatformAppExtra {
|
|
190
|
-
/**
|
|
191
|
-
* 是否显示条件渲染
|
|
192
|
-
*/
|
|
193
|
-
conditionalRendering?: Boolean;
|
|
194
|
-
/**
|
|
195
|
-
* 组件库上个版本信息。格式为:
|
|
196
|
-
* { @tcwd/CLOUDBASE_BUSSINESS: "weda:components?v=1.22.3&updateTime=1662369434696", @tcwd/CLOUDBASE_STANDARD: "weda:components?v=1.4.2&updateTime=1662369434696"}
|
|
197
|
-
*/
|
|
198
|
-
lastDependencies?: {
|
|
199
|
-
[key: string]: string;
|
|
200
|
-
};
|
|
201
|
-
/**
|
|
202
|
-
* 流程页面
|
|
203
|
-
*/
|
|
204
|
-
processPages?: {
|
|
205
|
-
/**
|
|
206
|
-
* 页面id
|
|
207
|
-
*/
|
|
208
|
-
id: string;
|
|
209
|
-
label: string;
|
|
210
|
-
/**
|
|
211
|
-
* 审批结点id
|
|
212
|
-
*/
|
|
213
|
-
nodeId: string;
|
|
214
|
-
nodeName: string;
|
|
215
|
-
inputNode: string[];
|
|
216
|
-
outputNode: string[];
|
|
217
|
-
/**
|
|
218
|
-
* 流程id
|
|
219
|
-
*/
|
|
220
|
-
processKey: string;
|
|
221
|
-
processName: string;
|
|
222
|
-
}[];
|
|
223
178
|
}
|
|
224
|
-
|
|
225
|
-
* 新增持久化数据必须同步修改
|
|
226
|
-
* src/parser/cals/utils/code/index.ts
|
|
227
|
-
*/
|
|
228
|
-
interface IBaseEditorPlatformAppExtra {
|
|
179
|
+
export interface IPlatformAppLifeCycle extends IEvents {
|
|
229
180
|
/**
|
|
230
|
-
*
|
|
181
|
+
* 可选,onShow钩子函数名称
|
|
231
182
|
*/
|
|
232
|
-
|
|
183
|
+
lifecycleOnShowEventName?: string;
|
|
233
184
|
/**
|
|
234
|
-
*
|
|
185
|
+
* 可选,onHide钩子函数名称
|
|
235
186
|
*/
|
|
236
|
-
|
|
237
|
-
id: string;
|
|
238
|
-
label: string;
|
|
239
|
-
type: 'page' | 'folder';
|
|
240
|
-
items?: any[];
|
|
241
|
-
}[];
|
|
242
|
-
/**
|
|
243
|
-
* @deprecated
|
|
244
|
-
* 大纲树alias数据补充
|
|
245
|
-
*/
|
|
246
|
-
componentPropsDatas?: any[];
|
|
187
|
+
lifecycleOnHideEventName?: string;
|
|
247
188
|
/**
|
|
248
|
-
*
|
|
249
|
-
* @deprecated
|
|
189
|
+
* 可选,onLaunch钩子函数名称
|
|
250
190
|
*/
|
|
251
|
-
|
|
252
|
-
[pageId: string]: string[];
|
|
253
|
-
};
|
|
191
|
+
lifecycleOnLaunchEventName?: string;
|
|
254
192
|
}
|
|
255
193
|
export interface IExternalResource {
|
|
256
194
|
type: EExternalResourceType;
|
|
257
195
|
url?: string;
|
|
258
196
|
code?: string;
|
|
259
197
|
}
|
|
260
|
-
export {};
|
|
261
198
|
//# 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,iBAAiB,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,CAAC,EAAE;QACnB,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,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;IAC7C;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;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"}
|
package/lib/utils/dts/index.js
CHANGED
|
@@ -302,12 +302,11 @@ function _generateOneItemDTS(inputData, itemType) {
|
|
|
302
302
|
* 获取用于显示的数据类型(仅有 number, string , boolean, array, object 等内置基础类型)
|
|
303
303
|
*/
|
|
304
304
|
function getDisplayReturnType(typeStr) {
|
|
305
|
-
var _a, _b;
|
|
306
305
|
let displayType = typeStr.trim();
|
|
307
|
-
if (
|
|
306
|
+
if (displayType.endsWith('[]')) {
|
|
308
307
|
displayType = 'array';
|
|
309
308
|
}
|
|
310
|
-
else if (
|
|
309
|
+
else if (displayType.endsWith('}')) {
|
|
311
310
|
displayType = 'object';
|
|
312
311
|
}
|
|
313
312
|
return displayType;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function semverComp(a: string, b: string): number;
|
|
2
|
+
export declare function toFixed(num: number, precision: number): number;
|
|
3
|
+
export declare const OFFICIAL_COMPONENT_LIB_NAME = "CLOUDBASE_STANDARD";
|
|
4
|
+
export declare const OFFICIAL_MATERIAL_LIB_NAME = "gsd-h5-react";
|
|
5
|
+
//# sourceMappingURL=common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/utils/version-migrations/common.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAYvD;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAI9D;AAED,eAAO,MAAM,2BAA2B,uBAAuB,CAAC;AAChE,eAAO,MAAM,0BAA0B,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OFFICIAL_MATERIAL_LIB_NAME = exports.OFFICIAL_COMPONENT_LIB_NAME = exports.toFixed = exports.semverComp = void 0;
|
|
4
|
+
function semverComp(a, b) {
|
|
5
|
+
const pa = a.split('.');
|
|
6
|
+
const pb = b.split('.');
|
|
7
|
+
for (let i = 0; i < 3; i++) {
|
|
8
|
+
const na = Number(pa[i]);
|
|
9
|
+
const nb = Number(pb[i]);
|
|
10
|
+
if (na > nb)
|
|
11
|
+
return 1;
|
|
12
|
+
if (nb > na)
|
|
13
|
+
return -1;
|
|
14
|
+
if (!isNaN(na) && isNaN(nb))
|
|
15
|
+
return 1;
|
|
16
|
+
if (isNaN(na) && !isNaN(nb))
|
|
17
|
+
return -1;
|
|
18
|
+
}
|
|
19
|
+
return 0;
|
|
20
|
+
}
|
|
21
|
+
exports.semverComp = semverComp;
|
|
22
|
+
function toFixed(num, precision) {
|
|
23
|
+
const multiplier = Math.pow(10, (precision + 1));
|
|
24
|
+
const wholeNumber = Math.floor(num * multiplier);
|
|
25
|
+
return (Math.round(wholeNumber / 10) * 10) / multiplier;
|
|
26
|
+
}
|
|
27
|
+
exports.toFixed = toFixed;
|
|
28
|
+
exports.OFFICIAL_COMPONENT_LIB_NAME = 'CLOUDBASE_STANDARD';
|
|
29
|
+
exports.OFFICIAL_MATERIAL_LIB_NAME = 'gsd-h5-react';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version4.d.ts","sourceRoot":"","sources":["../../../src/utils/version-migrations/version4.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAkB,MAAM,aAAa,CAAC;AAGhE,wBAAgB,QAAQ,CACtB,IAAI,EAAE,YAAY,EAClB,SAAS,EAAE,OAAO,EAClB,wBAAwB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,GAC/D,YAAY,CAEd"}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.version4 = void 0;
|
|
7
|
+
const postcss_1 = __importDefault(require("postcss"));
|
|
8
|
+
const postcss_less_1 = __importDefault(require("postcss-less"));
|
|
9
|
+
const __1 = require("..");
|
|
10
|
+
const common_1 = require("./common");
|
|
11
|
+
function version4(cals, isUpgrade, setSchemaVersionCallback) {
|
|
12
|
+
return transformPxLowcodeCompAndSourceComp(cals, isUpgrade, setSchemaVersionCallback);
|
|
13
|
+
}
|
|
14
|
+
exports.version4 = version4;
|
|
15
|
+
const transformPxLowcodeCompAndSourceComp = (cals, isUpgrade, setSchemaVersionCallback) => {
|
|
16
|
+
var _a, _b, _c, _d;
|
|
17
|
+
{
|
|
18
|
+
function transformCals(items, isUpgradeToPx) {
|
|
19
|
+
return items.map((item) => {
|
|
20
|
+
var _a;
|
|
21
|
+
// 对于表单操作区的按钮组件的父容器添加.wd-form__action, 兼容组件规范化按钮升级样式
|
|
22
|
+
if ((item === null || item === void 0 ? void 0 : item.module) === common_1.OFFICIAL_COMPONENT_LIB_NAME && (item === null || item === void 0 ? void 0 : item.component) === 'Form') {
|
|
23
|
+
item = addClassToButtonContainer(item);
|
|
24
|
+
}
|
|
25
|
+
if ((_a = item === null || item === void 0 ? void 0 : item.extra) === null || _a === void 0 ? void 0 : _a.commonStyle) {
|
|
26
|
+
item.extra.commonStyle = convertCommonStyle(item.extra.commonStyle, isUpgradeToPx);
|
|
27
|
+
if (item.extra.commonStyle.self) {
|
|
28
|
+
// 处理 margin padding shorthand 同步
|
|
29
|
+
const newSelf = (0, __1.processCommonStyle2CSSProperties)(item.extra.commonStyle, {
|
|
30
|
+
toRem: false,
|
|
31
|
+
ignoreSelf: true,
|
|
32
|
+
addPXUnit: true,
|
|
33
|
+
});
|
|
34
|
+
['margin', 'padding', 'border'].forEach((k) => {
|
|
35
|
+
if (item.extra.commonStyle.self[k]) {
|
|
36
|
+
item.extra.commonStyle.self[k] = newSelf[k];
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (item === null || item === void 0 ? void 0 : item.resources) {
|
|
42
|
+
item.resources = item.resources.map((n) => {
|
|
43
|
+
if (n.codeType === 'style') {
|
|
44
|
+
n = convertLowCodesStyle(n, isUpgradeToPx);
|
|
45
|
+
return n;
|
|
46
|
+
}
|
|
47
|
+
return n;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
if (item.items) {
|
|
51
|
+
item.items = transformCals(item.items, isUpgradeToPx);
|
|
52
|
+
}
|
|
53
|
+
return item;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
let pages = cals['items'];
|
|
57
|
+
let isDivision;
|
|
58
|
+
if (isUpgrade && (0, common_1.semverComp)((_a = cals['schemaVersion']) !== null && _a !== void 0 ? _a : '3.0.0', '4.0.0') < 0) {
|
|
59
|
+
// 组件库版本高于目标版本,且schemaVersion小于4, 将应用 CALS 数据中的 CSS 和 style 中的无单位和有单位的小写 px统一改写为 1/2 px
|
|
60
|
+
isDivision = true;
|
|
61
|
+
pages = transformCals(pages, isDivision);
|
|
62
|
+
cals.resources = (_b = cals.resources) === null || _b === void 0 ? void 0 : _b.map((n) => {
|
|
63
|
+
if (n.codeType === 'style') {
|
|
64
|
+
n = convertLowCodesStyle(n, isDivision);
|
|
65
|
+
return n;
|
|
66
|
+
}
|
|
67
|
+
return n;
|
|
68
|
+
});
|
|
69
|
+
cals['schemaVersion'] = '4.0.0';
|
|
70
|
+
setSchemaVersionCallback === null || setSchemaVersionCallback === void 0 ? void 0 : setSchemaVersionCallback('4.0.0');
|
|
71
|
+
}
|
|
72
|
+
else if (!isUpgrade && (0, common_1.semverComp)((_c = cals['schemaVersion']) !== null && _c !== void 0 ? _c : '3.0.0', '4.0.0') >= 0) {
|
|
73
|
+
// 组件库低于目标版本,并且schemaVersion大于4 将应用 CALS 数据中的 CSS 和 style 中的无单位和有单位的小写 px统一改写为 2倍 px
|
|
74
|
+
isDivision = false;
|
|
75
|
+
pages = transformCals(pages, isDivision);
|
|
76
|
+
cals.resources = (_d = cals.resources) === null || _d === void 0 ? void 0 : _d.map((n) => {
|
|
77
|
+
if (n.codeType === 'style') {
|
|
78
|
+
n = convertLowCodesStyle(n, isDivision);
|
|
79
|
+
return n;
|
|
80
|
+
}
|
|
81
|
+
return n;
|
|
82
|
+
});
|
|
83
|
+
delete cals['schemaVersion'];
|
|
84
|
+
setSchemaVersionCallback === null || setSchemaVersionCallback === void 0 ? void 0 : setSchemaVersionCallback(undefined);
|
|
85
|
+
}
|
|
86
|
+
cals['items'] = pages;
|
|
87
|
+
return cals;
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
function hasSubmitButton(item) {
|
|
91
|
+
var _a;
|
|
92
|
+
if ((_a = item === null || item === void 0 ? void 0 : item.items) === null || _a === void 0 ? void 0 : _a.length) {
|
|
93
|
+
const children = item.items;
|
|
94
|
+
return children.some((i) => { var _a; return (i === null || i === void 0 ? void 0 : i.module) === common_1.OFFICIAL_COMPONENT_LIB_NAME && i.component === 'Button' && ((_a = i === null || i === void 0 ? void 0 : i.attributes) === null || _a === void 0 ? void 0 : _a.formType) === 'submit'; });
|
|
95
|
+
}
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
function addClassToButtonContainer(item) {
|
|
99
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
100
|
+
if ((item === null || item === void 0 ? void 0 : item.module) === common_1.OFFICIAL_MATERIAL_LIB_NAME && item.component === 'Container') {
|
|
101
|
+
if (hasSubmitButton(item)) {
|
|
102
|
+
if (((_a = item.attributes) === null || _a === void 0 ? void 0 : _a.class) && !((_b = item.attributes) === null || _b === void 0 ? void 0 : _b.class.includes('wd-form__action'))) {
|
|
103
|
+
if (typeof ((_c = item.attributes) === null || _c === void 0 ? void 0 : _c.class) === 'string') {
|
|
104
|
+
item.attributes = Object.assign(Object.assign({}, item.attributes), { class: `${(_d = item.attributes) === null || _d === void 0 ? void 0 : _d.class} wd-form__action` });
|
|
105
|
+
}
|
|
106
|
+
else if (Array.isArray((_e = item.attributes) === null || _e === void 0 ? void 0 : _e.class)) {
|
|
107
|
+
item.attributes = Object.assign(Object.assign({}, item.attributes), { class: [...(_f = item.attributes) === null || _f === void 0 ? void 0 : _f.class, 'wd-form__action'] });
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
else if (!((_g = item.attributes) === null || _g === void 0 ? void 0 : _g.class)) {
|
|
111
|
+
item.attributes = Object.assign(Object.assign({}, item.attributes), { class: 'wd-form__action' });
|
|
112
|
+
}
|
|
113
|
+
// 移除旧的padding配置
|
|
114
|
+
if ((_j = (_h = item === null || item === void 0 ? void 0 : item.extra) === null || _h === void 0 ? void 0 : _h.commonStyle) === null || _j === void 0 ? void 0 : _j.padding) {
|
|
115
|
+
delete item.extra.commonStyle.padding;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
if ((_k = item === null || item === void 0 ? void 0 : item.items) === null || _k === void 0 ? void 0 : _k.length) {
|
|
120
|
+
item.items = item.items.map((i) => addClassToButtonContainer(i));
|
|
121
|
+
}
|
|
122
|
+
return item;
|
|
123
|
+
}
|
|
124
|
+
function jsonTranverse(json, reviver) {
|
|
125
|
+
return JSON.parse(JSON.stringify(json, reviver, 2));
|
|
126
|
+
}
|
|
127
|
+
function convertCommonStyle(value, isUpgrade) {
|
|
128
|
+
return jsonTranverse(value, (key, value) => {
|
|
129
|
+
if (__1.isUnitlessNumber[key]) {
|
|
130
|
+
return value;
|
|
131
|
+
}
|
|
132
|
+
if (typeof value === 'number') {
|
|
133
|
+
if (isUpgrade) {
|
|
134
|
+
value = value / 2;
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
value = value * 2;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
else if (/^((\d+\.)?\d+)(px)?$/.test(value)) {
|
|
141
|
+
value = !value ? value : value === null || value === void 0 ? void 0 : value.replace('px', '');
|
|
142
|
+
if (isUpgrade) {
|
|
143
|
+
// console.log(key, value, Number(value) / 2);
|
|
144
|
+
value = !value ? value : `${(0, common_1.toFixed)(Number(value) / 2, 3)}px`;
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
value = !value ? value : `${Number(value) * 2}px`;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return value;
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
const rem2PxPlugin = (opts) => {
|
|
154
|
+
const rem2pxSym = Symbol('rem2pxSym');
|
|
155
|
+
const { isUpgrade } = opts;
|
|
156
|
+
return {
|
|
157
|
+
postcssPlugin: 'postcss-rem2px',
|
|
158
|
+
Declaration(decl, rule) {
|
|
159
|
+
// Modified From https://github.com/cuth/postcss-pxtorem/blob/122649015322214f8e9d1ac852eb11c0791b634b/lib/pixel-unit-regex.js#L9
|
|
160
|
+
// eslint-disable-next-line no-useless-escape
|
|
161
|
+
const pxRegex = /"[^"]+"|'[^']+'|(\d*\.?\d+)px/gm;
|
|
162
|
+
if (decl.value.indexOf('px') < 0) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
if (decl[rem2pxSym]) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
if (isUpgrade) {
|
|
169
|
+
const value = decl.value.replace(pxRegex, (match, p1) => {
|
|
170
|
+
if (p1 !== null && p1 !== undefined) {
|
|
171
|
+
const r = (0, common_1.toFixed)(Number(p1) / 2, 3);
|
|
172
|
+
const rs = r.toString();
|
|
173
|
+
return `${rs}px`;
|
|
174
|
+
}
|
|
175
|
+
return match;
|
|
176
|
+
});
|
|
177
|
+
decl.value = value;
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
const value = decl.value.replace(pxRegex, (match, p1) => {
|
|
181
|
+
if (p1 !== null && p1 !== undefined) {
|
|
182
|
+
return `${Number(p1) * 2}px`;
|
|
183
|
+
}
|
|
184
|
+
return match;
|
|
185
|
+
});
|
|
186
|
+
decl.value = value;
|
|
187
|
+
}
|
|
188
|
+
decl[rem2pxSym] = true;
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
rem2PxPlugin.postcss = true;
|
|
193
|
+
function convertLowCodesStyle(value, isUpgrade) {
|
|
194
|
+
const result = (0, postcss_1.default)([rem2PxPlugin({ isUpgrade })]).process(value.code, {
|
|
195
|
+
syntax: postcss_less_1.default,
|
|
196
|
+
});
|
|
197
|
+
value.code = result.css;
|
|
198
|
+
return value;
|
|
199
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/cals",
|
|
3
|
-
"version": "1.0.63
|
|
3
|
+
"version": "1.0.63",
|
|
4
4
|
"description": "Common application specifications",
|
|
5
5
|
"main": "lib/utils/index.js",
|
|
6
6
|
"source": "src/utils/index.ts",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"tinycolor2": "^1.6.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@tcwd/dev-tools": "
|
|
48
|
+
"@tcwd/dev-tools": "workspace:^",
|
|
49
49
|
"@types/acorn": "^4.0.5",
|
|
50
50
|
"@types/jest": "^27.4.0",
|
|
51
51
|
"@types/lodash": "^4.14.168",
|
|
@@ -62,4 +62,4 @@
|
|
|
62
62
|
"typescript": "^4.7.4",
|
|
63
63
|
"typescript-json-schema": "^0.53.0"
|
|
64
64
|
}
|
|
65
|
-
}
|
|
65
|
+
}
|