@cloudbase/cals 1.0.3-alpha.1 → 1.0.3-alpha.10
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/cloudbase.cals.umd.min.js +5 -0
- package/lib/parser/cals/index.d.ts +366 -371
- package/lib/parser/cals/index.d.ts.map +1 -1
- package/lib/parser/cals/index.js +20 -12
- package/lib/parser/cals/utils/block/index.d.ts +14 -14
- package/lib/parser/cals/utils/block/index.d.ts.map +1 -1
- package/lib/parser/cals/utils/block/index.js +7 -3
- package/lib/parser/cals/utils/code/index.d.ts +30 -30
- package/lib/parser/cals/utils/code/index.d.ts.map +1 -1
- package/lib/parser/cals/utils/code/index.js +18 -12
- package/lib/parser/cals/utils/common.d.ts +11 -11
- package/lib/parser/cals/utils/runtime.d.ts +13 -13
- package/lib/parser/cals/utils/runtime.d.ts.map +1 -1
- package/lib/parser/cals/utils/runtime.js +5 -2
- package/lib/parser/cals/utils/spinoff/index.d.ts +9 -9
- package/lib/parser/cals/utils/style.d.ts +42 -42
- package/lib/parser/cals/utils/style.d.ts.map +1 -1
- package/lib/parser/cals/utils/style.js +7 -3
- package/lib/parser/cals/utils/template.d.ts +5 -5
- package/lib/parser/cals/utils/version/common.d.ts +4 -4
- package/lib/parser/cals/utils/version/common.d.ts.map +1 -1
- package/lib/parser/cals/utils/version/common.js +16 -33
- package/lib/parser/cals/utils/version/config.d.ts +13 -13
- package/lib/parser/cals/utils/version/index.d.ts +2 -2
- package/lib/parser/cals/utils/version/parses.d.ts +15 -15
- package/lib/parser/cals/utils/version/parses.d.ts.map +1 -1
- package/lib/parser/cals/utils/version/parses.js +18 -36
- package/lib/parser/cals/utils/version/utils.d.ts +13 -13
- package/lib/parser/cals/utils/version/utils.d.ts.map +1 -1
- package/lib/parser/cals/utils/version/utils.js +5 -2
- package/lib/parser/expression/index.d.ts +122 -122
- package/lib/parser/index.d.ts +8 -8
- package/lib/parser/plugins/postcss-rpx2clac.d.ts +17 -17
- package/lib/parser/plugins/postcss-rpx2clac.js +2 -2
- package/lib/types/basic/app.d.ts +72 -72
- package/lib/types/basic/common.d.ts +88 -88
- package/lib/types/basic/component.d.ts +208 -208
- package/lib/types/basic/datasource.d.ts +49 -49
- package/lib/types/index.d.ts +9 -9
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/index.js +14 -1
- package/lib/types/lcds.d.ts +447 -197
- package/lib/types/lcds.d.ts.map +1 -1
- package/lib/types/platform/app.d.ts +176 -176
- package/lib/types/platform/common.d.ts +137 -137
- package/lib/types/platform/component.d.ts +140 -140
- package/lib/types/platform/datasource.d.ts +466 -466
- package/lib/types/platform/widget/form.d.ts +89 -89
- package/lib/types/platform/widget/meta.d.ts +59 -59
- package/lib/utils/CSSProperty.d.ts +63 -63
- package/lib/utils/build.d.ts +1 -1
- package/lib/utils/build.js +3 -3
- package/lib/utils/constant.d.ts +40 -40
- 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 +141 -30
- package/lib/utils/dts/build.d.ts +1 -1
- package/lib/utils/dts/index.d.ts +130 -130
- package/lib/utils/dts/index.d.ts.map +1 -1
- package/lib/utils/dts/index.js +118 -78
- package/lib/utils/index.d.ts +7 -7
- package/lib/utils/version/common.d.ts +2 -2
- package/lib/utils/version/featureChecker.d.ts +2 -2
- package/lib/utils/version/featureChecker.d.ts.map +1 -1
- package/lib/utils/version/migrations/version4.d.ts +2 -2
- package/lib/utils/version/migrations/version4.js +2 -2
- package/package.json +10 -1
- package/lib/utils/version-migrations/common.d.ts +0 -5
- package/lib/utils/version-migrations/common.d.ts.map +0 -1
- package/lib/utils/version-migrations/common.js +0 -29
- package/lib/utils/version-migrations/version4.d.ts +0 -3
- package/lib/utils/version-migrations/version4.d.ts.map +0 -1
- package/lib/utils/version-migrations/version4.js +0 -199
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/parser/cals/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/parser/cals/index.ts"],"names":[],"mappings":"AASA,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;AAiB5F,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,EAAE,GAAG,CAAC;IACV,IAAI,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IACtB,SAAS,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAChE;;;OAGG;IACH,YAAY,CAAC,EAAE,GAAG,EAAE,CAAC;IACrB,eAAe,CAAC,EAAE,GAAG,CAAC;IACtB,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,wBAAgB,cAAc,CAAC,EAC7B,GAAG,EACH,GAAG,EACH,YAAY,EACZ,KAAc,EACd,sBAAsB,GACvB,EAAE;IACD,GAAG,EAAE,iBAAiB,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC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GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,GAC9B,eAAe,GAAG,iBAAiB,CAsHrC;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,GAAG,GAAG,CAwBzE;AAaD,wBAAgB,+BAA+B,CAAC,IAAI,EAAE;IACpD,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,YAAY,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IACzC,UAAU,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC,UAAU,CAAA;KAAE,CAAC;IAC/C,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC,OAAO,CAAA;KAAE,CAAC;CAC1C;;;;;;;mBAIY,MAAM;;sBAEH,MAAM;;;6BACwB,OAAO;;;;;;;;;EAkCpD;AAED,wBAAgB,2BAA2B,CACzC,GAAG,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,EACrC,SAAS,KAA8B,EACvC,KAAK,EAAE,MAAM,OAkCd;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,OAAO,SAAK,EACZ,YAAY,UAAK,GAChB;IACD,qBAAqB,EAAE,OAAO,CAAC;IAC/B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,cAAc,EAAE,OAAO,CAAC;CACzB,CA0BA"}
|
package/lib/parser/cals/index.js
CHANGED
|
@@ -10,9 +10,17 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
}
|
|
11
11
|
return t;
|
|
12
12
|
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
13
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
17
|
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
|
-
const
|
|
18
|
+
const get_1 = __importDefault(require("lodash/get"));
|
|
19
|
+
const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
|
|
20
|
+
const unset_1 = __importDefault(require("lodash/unset"));
|
|
21
|
+
const set_1 = __importDefault(require("lodash/set"));
|
|
22
|
+
const isArray_1 = __importDefault(require("lodash/isArray"));
|
|
23
|
+
const isObject_1 = __importDefault(require("lodash/isObject"));
|
|
16
24
|
const common_1 = require("../../types/platform/common");
|
|
17
25
|
const expression_1 = require("../expression");
|
|
18
26
|
const common_2 = require("./utils/common");
|
|
@@ -175,13 +183,13 @@ function serializeDynamicMapWithExtra({ ctx, map = {}, scope = 'page', streamlin
|
|
|
175
183
|
let originKey = processedKey;
|
|
176
184
|
if (matched) {
|
|
177
185
|
originKey = matched[1];
|
|
178
|
-
(0,
|
|
186
|
+
(0, unset_1.default)(data, originKey);
|
|
179
187
|
}
|
|
180
188
|
const originKeyArr = originKey.split('.');
|
|
181
|
-
if ((0,
|
|
189
|
+
if ((0, get_1.default)(data, processedKey) == undefined) {
|
|
182
190
|
/* 选区结构处理 [formily] to [CALS] */
|
|
183
191
|
if (Array.isArray(processedValue) && (processedValue === null || processedValue === void 0 ? void 0 : processedValue.some((item) => !!(item === null || item === void 0 ? void 0 : item.selectableBlock)))) {
|
|
184
|
-
let valueTmp = (0,
|
|
192
|
+
let valueTmp = (0, cloneDeep_1.default)(processedValue);
|
|
185
193
|
processedValue = valueTmp === null || valueTmp === void 0 ? void 0 : valueTmp.map((_value) => {
|
|
186
194
|
var _a, _b, _c;
|
|
187
195
|
const xProp = (_a = _value === null || _value === void 0 ? void 0 : _value.selectableBlock) === null || _a === void 0 ? void 0 : _a['x-props'];
|
|
@@ -198,10 +206,10 @@ function serializeDynamicMapWithExtra({ ctx, map = {}, scope = 'page', streamlin
|
|
|
198
206
|
}
|
|
199
207
|
// 为动态数据且有多级,将{":range.0.label": "$page.dataset.state.test1"}转为{ range: [{ label: "$page.dataset.state.test1"}] }
|
|
200
208
|
if (matched && originKeyArr.length >= 2) {
|
|
201
|
-
(0,
|
|
209
|
+
(0, set_1.default)(data, replaceWithColon(originKey), (0, cloneDeep_1.default)(processedValue));
|
|
202
210
|
}
|
|
203
211
|
else {
|
|
204
|
-
data[processedKey] = (0,
|
|
212
|
+
data[processedKey] = (0, cloneDeep_1.default)(processedValue);
|
|
205
213
|
}
|
|
206
214
|
}
|
|
207
215
|
extra[originKey] = processedExtra;
|
|
@@ -231,19 +239,19 @@ function replaceWithColon(key) {
|
|
|
231
239
|
function recoverSynamicMap(parent, current, path = '') {
|
|
232
240
|
Object.keys(current).forEach((key) => {
|
|
233
241
|
let value = current[key];
|
|
234
|
-
if ((0,
|
|
242
|
+
if ((0, isArray_1.default)(value)) {
|
|
235
243
|
// 注意如果是 selectableBlock 独立处理
|
|
236
244
|
if (value === null || value === void 0 ? void 0 : value.some((item) => !!(item === null || item === void 0 ? void 0 : item.selectableBlock))) {
|
|
237
245
|
return;
|
|
238
246
|
}
|
|
239
247
|
// 数组必须在前面
|
|
240
248
|
value.forEach((valueItem, valueIndex) => {
|
|
241
|
-
if ((0,
|
|
249
|
+
if ((0, isObject_1.default)(valueItem)) {
|
|
242
250
|
valueItem = recoverSynamicMap(parent, valueItem, `${path === '' ? '' : `${path}.`}${key}.${valueIndex}`);
|
|
243
251
|
}
|
|
244
252
|
});
|
|
245
253
|
}
|
|
246
|
-
else if ((0,
|
|
254
|
+
else if ((0, isObject_1.default)(value)) {
|
|
247
255
|
value = recoverSynamicMap(parent, value, `${path === '' ? '' : `${path}.`}${key}`);
|
|
248
256
|
}
|
|
249
257
|
else {
|
|
@@ -252,7 +260,7 @@ function recoverSynamicMap(parent, current, path = '') {
|
|
|
252
260
|
parent[`:${path === '' ? '' : `${path}.`}${matched[1]}`] = current[key];
|
|
253
261
|
if (current !== parent) {
|
|
254
262
|
// 如果是第一层级,说明current和parent相等,不unset
|
|
255
|
-
(0,
|
|
263
|
+
(0, unset_1.default)(current, key);
|
|
256
264
|
}
|
|
257
265
|
}
|
|
258
266
|
}
|
|
@@ -262,7 +270,7 @@ function recoverSynamicMap(parent, current, path = '') {
|
|
|
262
270
|
function deserializeDynamicMap(ctx, map, extraMap) {
|
|
263
271
|
var _a, _b;
|
|
264
272
|
let data = {};
|
|
265
|
-
const clonedMap = (0,
|
|
273
|
+
const clonedMap = (0, cloneDeep_1.default)(map);
|
|
266
274
|
// 还原flatten path
|
|
267
275
|
map = recoverSynamicMap(clonedMap, clonedMap, '');
|
|
268
276
|
for (let key in map || {}) {
|
|
@@ -1057,7 +1065,7 @@ function deserializeComponentLibraryMeta(meta) {
|
|
|
1057
1065
|
dependencies, components: processedComponents, actions });
|
|
1058
1066
|
}
|
|
1059
1067
|
exports.deserializeComponentLibraryMeta = deserializeComponentLibraryMeta;
|
|
1060
|
-
function processRuntimeCodeResources(ctx, resources
|
|
1068
|
+
function processRuntimeCodeResources(ctx, resources = [], scope) {
|
|
1061
1069
|
const { id } = ctx;
|
|
1062
1070
|
const fileTypes = [common_1.ECodeType.STYLE, common_1.ECodeType.STATE, common_1.ECodeType.LIFECYCLE, common_1.ECodeType.COMPUTEDN];
|
|
1063
1071
|
const CODE_TYPE_NAME_MAP = {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { IComplexComponent, IBasicComponent } from '../../../../types';
|
|
2
|
-
interface IParseContext {
|
|
3
|
-
component?: {
|
|
4
|
-
id: string;
|
|
5
|
-
};
|
|
6
|
-
forContext: Record<string, boolean>;
|
|
7
|
-
datasetMap: Record<string, any>;
|
|
8
|
-
dataSourceMap: Record<string, any>;
|
|
9
|
-
componentMap: Record<string, any>;
|
|
10
|
-
lowcodeMap: Record<string, any>;
|
|
11
|
-
componentLibMap: Record<string, any>;
|
|
12
|
-
}
|
|
13
|
-
export declare function parseComponentCals(ctx: IParseContext, cals: IBasicComponent | IComplexComponent): IParseContext;
|
|
14
|
-
export {};
|
|
1
|
+
import { IComplexComponent, IBasicComponent } from '../../../../types';
|
|
2
|
+
interface IParseContext {
|
|
3
|
+
component?: {
|
|
4
|
+
id: string;
|
|
5
|
+
};
|
|
6
|
+
forContext: Record<string, boolean>;
|
|
7
|
+
datasetMap: Record<string, any>;
|
|
8
|
+
dataSourceMap: Record<string, any>;
|
|
9
|
+
componentMap: Record<string, any>;
|
|
10
|
+
lowcodeMap: Record<string, any>;
|
|
11
|
+
componentLibMap: Record<string, any>;
|
|
12
|
+
}
|
|
13
|
+
export declare function parseComponentCals(ctx: IParseContext, cals: IBasicComponent | IComplexComponent): IParseContext;
|
|
14
|
+
export {};
|
|
15
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/parser/cals/utils/block/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAqB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/parser/cals/utils/block/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAqB,MAAM,mBAAmB,CAAC;AAK1F,UAAU,aAAa;IACrB,SAAS,CAAC,EAAE;QACV,EAAE,EAAE,MAAM,CAAC;KACZ,CAAC;IACF,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAChC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACnC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAClC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAChC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACtC;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,eAAe,GAAG,iBAAiB,GAAG,aAAa,CAyD/G"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.parseComponentCals = void 0;
|
|
4
|
-
const
|
|
7
|
+
const get_1 = __importDefault(require("lodash/get"));
|
|
8
|
+
const set_1 = __importDefault(require("lodash/set"));
|
|
5
9
|
const expression_1 = require("../../../expression");
|
|
6
10
|
function parseComponentCals(ctx, cals) {
|
|
7
11
|
if (!ctx.datasetMap) {
|
|
@@ -23,8 +27,8 @@ function parseComponentCals(ctx, cals) {
|
|
|
23
27
|
id: cals.id || '',
|
|
24
28
|
};
|
|
25
29
|
const { component, module, attributes = {}, items = [], listeners = [], directives = {}, [':class']: dynamicClassList, [':style']: dynamicStyle, } = cals;
|
|
26
|
-
if (module && component && !(0,
|
|
27
|
-
(0,
|
|
30
|
+
if (module && component && !(0, get_1.default)(ctx.componentMap, `${module}.${component}`)) {
|
|
31
|
+
(0, set_1.default)(ctx.componentMap, `${module}.${component}`, true);
|
|
28
32
|
ctx.componentLibMap[module] = true;
|
|
29
33
|
}
|
|
30
34
|
// 优先处理 directives 因为其他绑定会用到for
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* cals 与 code 互转
|
|
3
|
-
* 这里的 code 是中间状态的 code,即非最终生成的可运行的项目代码
|
|
4
|
-
*/
|
|
5
|
-
import { IPlatformApp } from '../../../../types';
|
|
6
|
-
export interface ICodeItem {
|
|
7
|
-
path: string;
|
|
8
|
-
code: string;
|
|
9
|
-
conflict?: boolean;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* CALS 转成 中间状态的代码
|
|
13
|
-
*
|
|
14
|
-
* @params version: v0 - 没有 pages 目录; v1 - 有 pages 目录
|
|
15
|
-
*/
|
|
16
|
-
export declare function calsToCode(calsJSON: IPlatformApp, version?: 'v0' | 'v1'): ICodeItem[];
|
|
17
|
-
/**
|
|
18
|
-
* 中间状态的代码 转成 CALS
|
|
19
|
-
*
|
|
20
|
-
* @params version: v0 - 没有 pages 目录; v1 - 有 pages 目录
|
|
21
|
-
*/
|
|
22
|
-
export declare function codeToCals(codeList: ICodeItem[], version?: 'v0' | 'v1'): IPlatformApp;
|
|
23
|
-
/**
|
|
24
|
-
* 指定代码内容是否存在冲突未解决
|
|
25
|
-
*/
|
|
26
|
-
export declare function checkForConflicts(code: string): boolean;
|
|
27
|
-
/**
|
|
28
|
-
* 以 from 为准自动解决冲突
|
|
29
|
-
*/
|
|
30
|
-
export declare function autoResolveConflicts(code: string, from: 'theirs' | 'ours'): string;
|
|
1
|
+
/**
|
|
2
|
+
* cals 与 code 互转
|
|
3
|
+
* 这里的 code 是中间状态的 code,即非最终生成的可运行的项目代码
|
|
4
|
+
*/
|
|
5
|
+
import { IPlatformApp } from '../../../../types';
|
|
6
|
+
export interface ICodeItem {
|
|
7
|
+
path: string;
|
|
8
|
+
code: string;
|
|
9
|
+
conflict?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* CALS 转成 中间状态的代码
|
|
13
|
+
*
|
|
14
|
+
* @params version: v0 - 没有 pages 目录; v1 - 有 pages 目录
|
|
15
|
+
*/
|
|
16
|
+
export declare function calsToCode(calsJSON: IPlatformApp, version?: 'v0' | 'v1'): ICodeItem[];
|
|
17
|
+
/**
|
|
18
|
+
* 中间状态的代码 转成 CALS
|
|
19
|
+
*
|
|
20
|
+
* @params version: v0 - 没有 pages 目录; v1 - 有 pages 目录
|
|
21
|
+
*/
|
|
22
|
+
export declare function codeToCals(codeList: ICodeItem[], version?: 'v0' | 'v1'): IPlatformApp;
|
|
23
|
+
/**
|
|
24
|
+
* 指定代码内容是否存在冲突未解决
|
|
25
|
+
*/
|
|
26
|
+
export declare function checkForConflicts(code: string): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* 以 from 为准自动解决冲突
|
|
29
|
+
*/
|
|
30
|
+
export declare function autoResolveConflicts(code: string, from: 'theirs' | 'ours'): string;
|
|
31
31
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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;
|
|
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,CAwL3F;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"}
|
|
@@ -3,10 +3,15 @@
|
|
|
3
3
|
* cals 与 code 互转
|
|
4
4
|
* 这里的 code 是中间状态的 code,即非最终生成的可运行的项目代码
|
|
5
5
|
*/
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
6
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
10
|
exports.autoResolveConflicts = exports.checkForConflicts = exports.codeToCals = exports.calsToCode = void 0;
|
|
8
11
|
const types_1 = require("../../../../types");
|
|
9
|
-
const
|
|
12
|
+
const pick_1 = __importDefault(require("lodash/pick"));
|
|
13
|
+
const omit_1 = __importDefault(require("lodash/omit"));
|
|
14
|
+
const concat_1 = __importDefault(require("lodash/concat"));
|
|
10
15
|
/**
|
|
11
16
|
* CALS 转成 中间状态的代码
|
|
12
17
|
*
|
|
@@ -115,10 +120,10 @@ function calsToCode(calsJSON, version = 'v1') {
|
|
|
115
120
|
}
|
|
116
121
|
function genConfig(itemJSON, configFields, configPath, otherConfigFields) {
|
|
117
122
|
var _a;
|
|
118
|
-
const config = (0,
|
|
123
|
+
const config = (0, pick_1.default)(itemJSON, configFields);
|
|
119
124
|
if (otherConfigFields) {
|
|
120
125
|
Object.keys(otherConfigFields).forEach((key) => {
|
|
121
|
-
config[key] = (0,
|
|
126
|
+
config[key] = (0, pick_1.default)(config[key], otherConfigFields[key]);
|
|
122
127
|
});
|
|
123
128
|
}
|
|
124
129
|
// state, computed 类型以及名称为 ____index____ 的都不生成代码
|
|
@@ -200,7 +205,7 @@ function codeToCals(codeList, version = 'v1') {
|
|
|
200
205
|
resources: [],
|
|
201
206
|
};
|
|
202
207
|
const appConfigCodeItem = codeList.find((item) => item.path === 'src/app-config.json');
|
|
203
|
-
const appConfig = JSON.parse(appConfigCodeItem.code);
|
|
208
|
+
const appConfig = JSON.parse((appConfigCodeItem === null || appConfigCodeItem === void 0 ? void 0 : appConfigCodeItem.code) || '{}');
|
|
204
209
|
let pagePaths = appConfig.extra.pages;
|
|
205
210
|
codeList.forEach((codeItem) => {
|
|
206
211
|
if (codeItem.path === 'src/app-config.json') {
|
|
@@ -208,14 +213,14 @@ function codeToCals(codeList, version = 'v1') {
|
|
|
208
213
|
* app-config.json
|
|
209
214
|
*/
|
|
210
215
|
const config = appConfig;
|
|
211
|
-
Object.assign(calsJSON, (0,
|
|
212
|
-
calsJSON.resources = (0,
|
|
216
|
+
Object.assign(calsJSON, (0, omit_1.default)(config, ['_ignoreResources', 'extra.pages']));
|
|
217
|
+
calsJSON.resources = (0, concat_1.default)(calsJSON.resources, config._ignoreResources);
|
|
213
218
|
}
|
|
214
219
|
else if (isPageFile(codeItem.path)) {
|
|
215
220
|
/**
|
|
216
221
|
* page
|
|
217
222
|
*/
|
|
218
|
-
const [, pageId] = codeItem.path.match(versionConfig.pageIdRegExp);
|
|
223
|
+
const [, pageId] = codeItem.path.match(versionConfig.pageIdRegExp) || [];
|
|
219
224
|
let pageItem = calsJSON.items.find((item) => item.id === pageId);
|
|
220
225
|
if (!pageItem) {
|
|
221
226
|
pageItem = {
|
|
@@ -233,9 +238,9 @@ function codeToCals(codeList, version = 'v1') {
|
|
|
233
238
|
* page-config.json
|
|
234
239
|
*/
|
|
235
240
|
const config = JSON.parse(codeItem.code);
|
|
236
|
-
const propsConfig = (0,
|
|
241
|
+
const propsConfig = (0, omit_1.default)(config, ['_ignoreResources']);
|
|
237
242
|
Object.assign(pageItem, propsConfig);
|
|
238
|
-
pageItem.resources = (0,
|
|
243
|
+
pageItem.resources = (0, concat_1.default)(pageItem.resources, config._ignoreResources);
|
|
239
244
|
}
|
|
240
245
|
else if (versionConfig.pageJSONRegExp.test(codeItem.path)) {
|
|
241
246
|
/**
|
|
@@ -254,11 +259,12 @@ function codeToCals(codeList, version = 'v1') {
|
|
|
254
259
|
/**
|
|
255
260
|
* global normal codes
|
|
256
261
|
*/
|
|
257
|
-
handleNormalCodes(codeItem, '', calsJSON.resources);
|
|
262
|
+
handleNormalCodes(codeItem, '', calsJSON.resources || []);
|
|
258
263
|
}
|
|
259
264
|
});
|
|
260
265
|
return calsJSON;
|
|
261
266
|
function handleNormalCodes(codeItem, pageId, resources) {
|
|
267
|
+
var _a, _b;
|
|
262
268
|
const relativePath = !pageId
|
|
263
269
|
? codeItem.path.replace('src/', '')
|
|
264
270
|
: codeItem.path.replace(`${versionConfig.pageDir}/${pageId}/`, '');
|
|
@@ -274,7 +280,7 @@ function codeToCals(codeList, version = 'v1') {
|
|
|
274
280
|
*/
|
|
275
281
|
switch (relativePath) {
|
|
276
282
|
case 'theme.less':
|
|
277
|
-
calsJSON.resources.push(Object.assign({ name: types_1.ECodeType.THEME, path: `${_pageId}/${types_1.ECodeType.THEME}`, codeType: types_1.ECodeType.THEME }, commonVal));
|
|
283
|
+
(_a = calsJSON.resources) === null || _a === void 0 ? void 0 : _a.push(Object.assign({ name: types_1.ECodeType.THEME, path: `${_pageId}/${types_1.ECodeType.THEME}`, codeType: types_1.ECodeType.THEME }, commonVal));
|
|
278
284
|
break;
|
|
279
285
|
case 'style.less':
|
|
280
286
|
resources.push(Object.assign({ name: types_1.ECodeType.STYLE, path: `${_pageId}/${types_1.ECodeType.STYLE}`, codeType: types_1.ECodeType.STYLE }, commonVal));
|
|
@@ -293,7 +299,7 @@ function codeToCals(codeList, version = 'v1') {
|
|
|
293
299
|
const commonMatches = relativePath.match(/^common\/([^/]*?).js$/);
|
|
294
300
|
if (commonMatches) {
|
|
295
301
|
const [, name] = commonMatches;
|
|
296
|
-
calsJSON.resources.push(Object.assign({ name, path: `${_pageId}/common/${name}`, codeType: types_1.ECodeType.NORMAL_MODULE }, commonVal));
|
|
302
|
+
(_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));
|
|
297
303
|
}
|
|
298
304
|
break;
|
|
299
305
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { IDataBind } from '../../expression/index';
|
|
2
|
-
declare type IUsedComps = {
|
|
3
|
-
[libName: string]: Set<string>;
|
|
4
|
-
};
|
|
5
|
-
export declare function camelcase(str: string, firstUpperCase?: boolean): string;
|
|
6
|
-
export declare function isPlainObject(src: any): boolean;
|
|
7
|
-
export declare const isEmptyObj: (obj: object) => boolean;
|
|
8
|
-
export declare function isValidStyleBind(styleBind: IDataBind): boolean;
|
|
9
|
-
export declare function isValidClassNameListBind(classNameListBind: IDataBind): boolean;
|
|
10
|
-
export declare function getUsedComps(apps: any[], comps: any[]): IUsedComps;
|
|
11
|
-
export {};
|
|
1
|
+
import { IDataBind } from '../../expression/index';
|
|
2
|
+
declare type IUsedComps = {
|
|
3
|
+
[libName: string]: Set<string>;
|
|
4
|
+
};
|
|
5
|
+
export declare function camelcase(str: string, firstUpperCase?: boolean): string;
|
|
6
|
+
export declare function isPlainObject(src: any): boolean;
|
|
7
|
+
export declare const isEmptyObj: (obj: object) => boolean;
|
|
8
|
+
export declare function isValidStyleBind(styleBind: IDataBind): boolean;
|
|
9
|
+
export declare function isValidClassNameListBind(classNameListBind: IDataBind): boolean;
|
|
10
|
+
export declare function getUsedComps(apps: any[], comps: any[]): IUsedComps;
|
|
11
|
+
export {};
|
|
12
12
|
//# sourceMappingURL=common.d.ts.map
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { IDynamicValue } from '../../expression';
|
|
2
|
-
export declare function readComponents(properties?: {
|
|
3
|
-
[key: string]: any;
|
|
4
|
-
}, excludeKeys?: string[]): Object;
|
|
5
|
-
export declare function readDirectives(cmp: any): any;
|
|
6
|
-
export declare function readDynamicData(cmp: any): {
|
|
7
|
-
[key: string]: IDynamicValue;
|
|
8
|
-
};
|
|
9
|
-
export declare function readListeners(listenerInstances?: any[]): any;
|
|
10
|
-
export declare function writeListeners(listeners?: any[]): any[];
|
|
11
|
-
export declare function writeDynamicData(from: any, to: any, properties: any): any;
|
|
12
|
-
export declare function setValidValue(target: any, key: string, value: any): void;
|
|
13
|
-
export declare function getValidValue(value: any): any;
|
|
1
|
+
import { IDynamicValue } from '../../expression';
|
|
2
|
+
export declare function readComponents(properties?: {
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
}, excludeKeys?: string[]): Object;
|
|
5
|
+
export declare function readDirectives(cmp: any): any;
|
|
6
|
+
export declare function readDynamicData(cmp: any): {
|
|
7
|
+
[key: string]: IDynamicValue;
|
|
8
|
+
};
|
|
9
|
+
export declare function readListeners(listenerInstances?: any[]): any;
|
|
10
|
+
export declare function writeListeners(listeners?: any[]): any[];
|
|
11
|
+
export declare function writeDynamicData(from: any, to: any, properties: any): any;
|
|
12
|
+
export declare function setValidValue(target: any, key: string, value: any): void;
|
|
13
|
+
export declare function getValidValue(value: any): any;
|
|
14
14
|
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../src/parser/cals/utils/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../src/parser/cals/utils/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAgB,MAAM,kBAAkB,CAAC;AAI/D,wBAAgB,cAAc,CAC5B,UAAU,GAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAoB,EACpD,WAAW,GAAE,MAAM,EAAO,GACzB,MAAM,CAqDR;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,GAAG,OAiDtC;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,GAAG,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAAA;CAAE,CA4B1E;AAED,wBAAgB,aAAa,CAAC,iBAAiB,GAAE,GAAG,EAAO,OAiB1D;AAED,wBAAgB,cAAc,CAAC,SAAS,GAAE,GAAG,EAAO,SAenD;AAGD,wBAAgB,gBAAgB,CAAC,IAAI,KAAU,EAAE,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,OAgExE;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,QAKjE;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,OAWvC"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.getValidValue = exports.setValidValue = exports.writeDynamicData = exports.writeListeners = exports.readListeners = exports.readDynamicData = exports.readDirectives = exports.readComponents = void 0;
|
|
4
7
|
const expression_1 = require("../../expression");
|
|
5
8
|
const style_1 = require("./style");
|
|
6
9
|
const common_1 = require("./common");
|
|
7
|
-
const
|
|
10
|
+
const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
|
|
8
11
|
function readComponents(properties = {}, excludeKeys = []) {
|
|
9
12
|
var _a;
|
|
10
13
|
const cmps /* IWeAppPage['componentInstances'] */ = {};
|
|
@@ -173,7 +176,7 @@ function writeListeners(listeners = []) {
|
|
|
173
176
|
exports.writeListeners = writeListeners;
|
|
174
177
|
// 处理Listeners动态数据
|
|
175
178
|
function writeDynamicData(from = {}, to, properties) {
|
|
176
|
-
const act = (0,
|
|
179
|
+
const act = (0, cloneDeep_1.default)(to);
|
|
177
180
|
act.dataTypes = to.dataTypes || [];
|
|
178
181
|
for (const prop in from) {
|
|
179
182
|
const dv = from[prop];
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { IPlatformApp } from '../../../../types';
|
|
2
|
-
/**
|
|
3
|
-
* [WeApps协议] to [CALS协议]
|
|
4
|
-
*
|
|
5
|
-
* @param data
|
|
6
|
-
*/
|
|
7
|
-
export declare function processComponentModule(data: any, optsions: {
|
|
8
|
-
dependencies: object[];
|
|
9
|
-
}): IPlatformApp;
|
|
1
|
+
import { IPlatformApp } from '../../../../types';
|
|
2
|
+
/**
|
|
3
|
+
* [WeApps协议] to [CALS协议]
|
|
4
|
+
*
|
|
5
|
+
* @param data
|
|
6
|
+
*/
|
|
7
|
+
export declare function processComponentModule(data: any, optsions: {
|
|
8
|
+
dependencies: object[];
|
|
9
|
+
}): IPlatformApp;
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import { Properties } from 'csstype';
|
|
2
|
-
export declare function removeInvalidStyleFormValue(styleForm?: any): any;
|
|
3
|
-
/**
|
|
4
|
-
* Convert WeApps common style to css styles(React.CSSProperties)
|
|
5
|
-
* toRem/toRpx/toRpx 三者互斥 @deprecated
|
|
6
|
-
* 应使用 defaultUnit 来声明
|
|
7
|
-
*/
|
|
8
|
-
export declare function processCommonStyle2CSSProperties(commonStyle?: any, options?: {
|
|
9
|
-
/**
|
|
10
|
-
* 默认 px/无单位 转 rem
|
|
11
|
-
* @deprecated
|
|
12
|
-
*/
|
|
13
|
-
toRem?: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* 默认 px/无单位 转为rpx
|
|
16
|
-
* @deprecated
|
|
17
|
-
*/
|
|
18
|
-
toRpx?: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* px/无单位情况下 处理为何单位
|
|
21
|
-
* rem | rpx | px
|
|
22
|
-
* 优先级高于以上
|
|
23
|
-
*/
|
|
24
|
-
defaultUnit?: 'rem' | 'px' | 'rpx';
|
|
25
|
-
/**
|
|
26
|
-
* 是否使用 calc(xx px / `${rpxCalcRoot}`) 来模拟rpx
|
|
27
|
-
* 小程序不需要转
|
|
28
|
-
*/
|
|
29
|
-
rpxCalcRoot?: string;
|
|
30
|
-
ignoreSelf?: boolean;
|
|
31
|
-
addPXUnit?: boolean;
|
|
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
|
|
42
|
-
export {};
|
|
1
|
+
import { Properties } from 'csstype';
|
|
2
|
+
export declare function removeInvalidStyleFormValue(styleForm?: any): any;
|
|
3
|
+
/**
|
|
4
|
+
* Convert WeApps common style to css styles(React.CSSProperties)
|
|
5
|
+
* toRem/toRpx/toRpx 三者互斥 @deprecated
|
|
6
|
+
* 应使用 defaultUnit 来声明
|
|
7
|
+
*/
|
|
8
|
+
export declare function processCommonStyle2CSSProperties(commonStyle?: any, options?: {
|
|
9
|
+
/**
|
|
10
|
+
* 默认 px/无单位 转 rem
|
|
11
|
+
* @deprecated
|
|
12
|
+
*/
|
|
13
|
+
toRem?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* 默认 px/无单位 转为rpx
|
|
16
|
+
* @deprecated
|
|
17
|
+
*/
|
|
18
|
+
toRpx?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* px/无单位情况下 处理为何单位
|
|
21
|
+
* rem | rpx | px
|
|
22
|
+
* 优先级高于以上
|
|
23
|
+
*/
|
|
24
|
+
defaultUnit?: 'rem' | 'px' | 'rpx';
|
|
25
|
+
/**
|
|
26
|
+
* 是否使用 calc(xx px / `${rpxCalcRoot}`) 来模拟rpx
|
|
27
|
+
* 小程序不需要转
|
|
28
|
+
*/
|
|
29
|
+
rpxCalcRoot?: string;
|
|
30
|
+
ignoreSelf?: boolean;
|
|
31
|
+
addPXUnit?: boolean;
|
|
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, string & {}> | undefined, type: 'px' | 'rem' | 'rpx', options?: ITranslateStyleOptions): {};
|
|
42
|
+
export {};
|
|
43
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;AAKrC,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,sDAAkC,EACvC,IAAI,EAAE,IAAI,GAAG,KAAK,GAAG,KAAK,EAC1B,OAAO,CAAC,EAAE,sBAAsB,MAajC"}
|
|
@@ -10,10 +10,14 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
}
|
|
11
11
|
return t;
|
|
12
12
|
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
13
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
17
|
exports.processCSSPropertiesUnit = exports.processCSSProperties2Rem = exports.processCommonStyle2CSSProperties = exports.removeInvalidStyleFormValue = void 0;
|
|
15
18
|
const common_1 = require("./common");
|
|
16
|
-
const
|
|
19
|
+
const map_1 = __importDefault(require("lodash/map"));
|
|
20
|
+
const uniq_1 = __importDefault(require("lodash/uniq"));
|
|
17
21
|
const utils_1 = require("../../../utils");
|
|
18
22
|
const DISTANCE_KEY_LIST = ['top', 'right', 'bottom', 'left'];
|
|
19
23
|
function removeInvalidStyleFormValue(styleForm = {}) {
|
|
@@ -64,7 +68,7 @@ function _handleStyleNumValue(styleVal, addPXUnit) {
|
|
|
64
68
|
function setDistanceStyle(style, distance, attr, addPXUnit) {
|
|
65
69
|
const attributeKey = (0, common_1.camelcase)(`${attr}`);
|
|
66
70
|
if (Object.keys(distance).length === 4) {
|
|
67
|
-
if ((0,
|
|
71
|
+
if ((0, uniq_1.default)((0, map_1.default)(distance, (val) => val)).length === 1) {
|
|
68
72
|
// 4个值全相等的情况
|
|
69
73
|
setStyleValue(style, attributeKey, _handleStyleNumValue(distance.top, addPXUnit));
|
|
70
74
|
}
|
|
@@ -280,7 +284,7 @@ function processCommonStyle2CSSProperties(commonStyle = {}, options = { toRem: t
|
|
|
280
284
|
bottomLeft = '0';
|
|
281
285
|
}
|
|
282
286
|
}
|
|
283
|
-
if ((0,
|
|
287
|
+
if ((0, uniq_1.default)((0, map_1.default)(radiusInfo, (val) => val)).length === 1) {
|
|
284
288
|
// 4个值全相等的情况
|
|
285
289
|
setStyleValue(style, 'borderRadius', _handleStyleNumValue(topLeft, !!options.addPXUnit));
|
|
286
290
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ECodeType } from '../../../types';
|
|
2
|
-
export declare function generateDefaultCode(ctx: {
|
|
3
|
-
id: string;
|
|
4
|
-
version?: string;
|
|
5
|
-
}, type: ECodeType, scope: 'component' | 'page' | 'app'): string;
|
|
1
|
+
import { ECodeType } from '../../../types';
|
|
2
|
+
export declare function generateDefaultCode(ctx: {
|
|
3
|
+
id: string;
|
|
4
|
+
version?: string;
|
|
5
|
+
}, type: ECodeType, scope: 'component' | 'page' | 'app'): string;
|
|
6
6
|
//# sourceMappingURL=template.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare function beforeCommonParse(comp: any): void;
|
|
2
|
-
export declare function afterCommonParse(comp: any): void;
|
|
3
|
-
export declare function addFormItem(comp: any, key: any, parent: any, isOnlySlot?: boolean): void;
|
|
4
|
-
export declare function renameRepeatId(json: any): void;
|
|
1
|
+
export declare function beforeCommonParse(comp: any): void;
|
|
2
|
+
export declare function afterCommonParse(comp: any): void;
|
|
3
|
+
export declare function addFormItem(comp: any, key: any, parent: any, isOnlySlot?: boolean): void;
|
|
4
|
+
export declare function renameRepeatId(json: any): void;
|
|
5
5
|
//# sourceMappingURL=common.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../../src/parser/cals/utils/version/common.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../../src/parser/cals/utils/version/common.ts"],"names":[],"mappings":"AAiBA,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,GAAG,QAE1C;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,GAAG,QAYzC;AA2LD,wBAAgB,WAAW,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,UAAQ,QAiJ/E;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,GAAG,QAsCvC"}
|