@cloudbase/cals 1.0.3-alpha.7 → 1.0.3-alpha.8
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 +12 -12
- package/lib/parser/cals/utils/block/index.d.ts +14 -14
- package/lib/parser/cals/utils/block/index.js +3 -3
- package/lib/parser/cals/utils/code/index.d.ts +30 -30
- package/lib/parser/cals/utils/code/index.js +13 -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 +2 -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 +3 -3
- package/lib/parser/cals/utils/template.d.ts +5 -5
- package/lib/parser/cals/utils/template.js +3 -6
- package/lib/parser/cals/utils/version/common.d.ts +4 -4
- package/lib/parser/cals/utils/version/common.js +11 -34
- 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.js +14 -37
- 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 +2 -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 -6
- package/lib/utils/constant.d.ts +40 -40
- package/lib/utils/dts/auto-generated.d.ts +1 -1
- 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 +116 -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 +12 -3
- 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,31 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
exports.renameRepeatId = exports.addFormItem = exports.afterCommonParse = exports.beforeCommonParse = void 0;
|
|
27
4
|
const utils_1 = require("./utils");
|
|
28
|
-
const
|
|
5
|
+
const lodash_es_1 = require("lodash-es");
|
|
29
6
|
const index_1 = require("./index");
|
|
30
7
|
const common_1 = require("../common");
|
|
31
8
|
const utils_2 = require("../../../../utils");
|
|
@@ -196,7 +173,7 @@ function translateStyleToCommonStyle(comp) {
|
|
|
196
173
|
if (xProps === null || xProps === void 0 ? void 0 : xProps.style) {
|
|
197
174
|
xProps.commonStyle = xProps.commonStyle || {};
|
|
198
175
|
xProps.commonStyle.self = xProps.commonStyle.self || {};
|
|
199
|
-
xProps.commonStyle.self = (0,
|
|
176
|
+
xProps.commonStyle.self = (0, lodash_es_1.merge)(xProps.style, xProps.commonStyle.self);
|
|
200
177
|
delete xProps.style;
|
|
201
178
|
}
|
|
202
179
|
}
|
|
@@ -218,12 +195,12 @@ function addDefaultXIndex(comp) {
|
|
|
218
195
|
}
|
|
219
196
|
function addFormItem(comp, key, parent, isOnlySlot = false) {
|
|
220
197
|
const { properties, xIndex, xProps } = comp;
|
|
221
|
-
const defaultValue =
|
|
198
|
+
const defaultValue = (0, lodash_es_1.get)(xProps, 'data.defaultValue');
|
|
222
199
|
if (defaultValue) {
|
|
223
|
-
|
|
200
|
+
(0, lodash_es_1.set)(xProps, 'data.value', defaultValue);
|
|
224
201
|
delete xProps.data.defaultValue;
|
|
225
202
|
}
|
|
226
|
-
const rulesValue =
|
|
203
|
+
const rulesValue = (0, lodash_es_1.get)(xProps, 'data.rules') || {
|
|
227
204
|
value: [],
|
|
228
205
|
};
|
|
229
206
|
if (!rulesValue.type || rulesValue.type === 'static') {
|
|
@@ -239,19 +216,19 @@ function addFormItem(comp, key, parent, isOnlySlot = false) {
|
|
|
239
216
|
rulesValue.value = [rulesValue.value];
|
|
240
217
|
}
|
|
241
218
|
}
|
|
242
|
-
const layoutValue =
|
|
219
|
+
const layoutValue = (0, lodash_es_1.get)(xProps, 'data.layout') || {
|
|
243
220
|
value: 'vertical',
|
|
244
221
|
};
|
|
245
|
-
const requireValue =
|
|
222
|
+
const requireValue = (0, lodash_es_1.get)(xProps, 'data.required') || {
|
|
246
223
|
value: false,
|
|
247
224
|
};
|
|
248
225
|
const requiredTextValue = {
|
|
249
226
|
value: (requireValue === null || requireValue === void 0 ? void 0 : requireValue.value) ? '该项为必填项' : false,
|
|
250
227
|
};
|
|
251
|
-
const nameValue =
|
|
228
|
+
const nameValue = (0, lodash_es_1.get)(xProps, 'data.name') || {
|
|
252
229
|
value: 'uniqueFormKey',
|
|
253
230
|
};
|
|
254
|
-
let labelText =
|
|
231
|
+
let labelText = (0, lodash_es_1.get)(xProps, 'data.label.value') || '';
|
|
255
232
|
let isShowTitleSlot = false;
|
|
256
233
|
if (properties) {
|
|
257
234
|
Object.keys(properties).map((subKey) => {
|
|
@@ -261,8 +238,8 @@ function addFormItem(comp, key, parent, isOnlySlot = false) {
|
|
|
261
238
|
if (subKey === 'label') {
|
|
262
239
|
const targetLabelSlot = properties[subKey];
|
|
263
240
|
(0, utils_1.getComponentChildren)(targetLabelSlot).map(([key, item]) => {
|
|
264
|
-
labelText =
|
|
265
|
-
const cloneItem =
|
|
241
|
+
labelText = (0, lodash_es_1.get)(item, 'xProps.data.text.value');
|
|
242
|
+
const cloneItem = (0, lodash_es_1.cloneDeep)(item);
|
|
266
243
|
(0, index_1.deepParse)(cloneItem, key, comp);
|
|
267
244
|
isShowTitleSlot = true;
|
|
268
245
|
});
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
/**
|
|
2
|
-
备注:登录 WeApps v2,在任一页面控制台输入以下代码(需要修改相应的分类名称),以获取指定分类的 COMPLEX_COMPONENT_KEYS
|
|
1
|
+
/**
|
|
2
|
+
备注:登录 WeApps v2,在任一页面控制台输入以下代码(需要修改相应的分类名称),以获取指定分类的 COMPLEX_COMPONENT_KEYS
|
|
3
3
|
|
|
4
|
-
fetch(`http://dev.weapps.woa.com/api/compositeComp/list?pageIndex=0&category=${encodeURI('审批系统')}&keyword=&pageSize=500`).then(function(response) {
|
|
5
|
-
return response.json();
|
|
6
|
-
}).then(function(json) {
|
|
7
|
-
console.log(JSON.stringify(json.data.rows.map(item => item.name), null, 2))
|
|
8
|
-
});
|
|
4
|
+
fetch(`http://dev.weapps.woa.com/api/compositeComp/list?pageIndex=0&category=${encodeURI('审批系统')}&keyword=&pageSize=500`).then(function(response) {
|
|
5
|
+
return response.json();
|
|
6
|
+
}).then(function(json) {
|
|
7
|
+
console.log(JSON.stringify(json.data.rows.map(item => item.name), null, 2))
|
|
8
|
+
});
|
|
9
9
|
|
|
10
|
-
*/
|
|
11
|
-
export declare const COMPLEX_COMPONENT_KEYS: string[];
|
|
12
|
-
export declare const FORM_COMPONENT_KEYS: string[];
|
|
13
|
-
export declare const GSD_H5_REACT_COMPONENT_KEYS: string[];
|
|
14
|
-
export declare const COMPONENT_SELECTABLEBLOCK_WHITELIST: string[];
|
|
15
|
-
export declare const MODULE_SELECTABLEBLOCK_REGEX: RegExp;
|
|
10
|
+
*/
|
|
11
|
+
export declare const COMPLEX_COMPONENT_KEYS: string[];
|
|
12
|
+
export declare const FORM_COMPONENT_KEYS: string[];
|
|
13
|
+
export declare const GSD_H5_REACT_COMPONENT_KEYS: string[];
|
|
14
|
+
export declare const COMPONENT_SELECTABLEBLOCK_WHITELIST: string[];
|
|
15
|
+
export declare const MODULE_SELECTABLEBLOCK_REGEX: RegExp;
|
|
16
16
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare function upgrageToVersion2(app: any): any;
|
|
2
|
-
export declare function deepParse(comp: any, key: any, parent: any): void;
|
|
1
|
+
export declare function upgrageToVersion2(app: any): any;
|
|
2
|
+
export declare function deepParse(comp: any, key: any, parent: any): void;
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
export declare function parseGsdKboneFooter(comp: any): void;
|
|
2
|
-
export declare function parseGsdKboneButton(comp: any): void;
|
|
3
|
-
export declare function parseGsdKbonePopLayer(comp: any): void;
|
|
4
|
-
export declare function parseGsdKboneAgree(comp: any, key: any, parent: any): void;
|
|
5
|
-
export declare function parseGsdKboneSwiper(comp: any): void;
|
|
6
|
-
export declare function parseGsdKboneRichText(comp: any): void;
|
|
7
|
-
export declare function parseGsdKboneText(comp: any): void;
|
|
8
|
-
export declare function parseGsdKboneInput(comp: any, key: any, parent: any): void;
|
|
9
|
-
export declare function parseGsdKboneSwitch(comp: any, key: any, parent: any): void;
|
|
10
|
-
export declare function parseGsdKbonePicker(comp: any, key: any, parent: any): void;
|
|
11
|
-
export declare function parseGsdKboneDateTimePicker(comp: any, key: any, parent: any): void;
|
|
12
|
-
export declare function parseGsdKboneUpload(comp: any, key: any, parent: any): void;
|
|
13
|
-
export declare function addFormWrapperComp(pageInstance: any): void;
|
|
14
|
-
export declare function parseGsdKboneTabs(comp: any): void;
|
|
15
|
-
export declare function parseComplexComponentInstance(instance: any): void;
|
|
1
|
+
export declare function parseGsdKboneFooter(comp: any): void;
|
|
2
|
+
export declare function parseGsdKboneButton(comp: any): void;
|
|
3
|
+
export declare function parseGsdKbonePopLayer(comp: any): void;
|
|
4
|
+
export declare function parseGsdKboneAgree(comp: any, key: any, parent: any): void;
|
|
5
|
+
export declare function parseGsdKboneSwiper(comp: any): void;
|
|
6
|
+
export declare function parseGsdKboneRichText(comp: any): void;
|
|
7
|
+
export declare function parseGsdKboneText(comp: any): void;
|
|
8
|
+
export declare function parseGsdKboneInput(comp: any, key: any, parent: any): void;
|
|
9
|
+
export declare function parseGsdKboneSwitch(comp: any, key: any, parent: any): void;
|
|
10
|
+
export declare function parseGsdKbonePicker(comp: any, key: any, parent: any): void;
|
|
11
|
+
export declare function parseGsdKboneDateTimePicker(comp: any, key: any, parent: any): void;
|
|
12
|
+
export declare function parseGsdKboneUpload(comp: any, key: any, parent: any): void;
|
|
13
|
+
export declare function addFormWrapperComp(pageInstance: any): void;
|
|
14
|
+
export declare function parseGsdKboneTabs(comp: any): void;
|
|
15
|
+
export declare function parseComplexComponentInstance(instance: any): void;
|
|
16
16
|
//# sourceMappingURL=parses.d.ts.map
|
|
@@ -1,31 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
exports.parseComplexComponentInstance = exports.parseGsdKboneTabs = exports.addFormWrapperComp = exports.parseGsdKboneUpload = exports.parseGsdKboneDateTimePicker = exports.parseGsdKbonePicker = exports.parseGsdKboneSwitch = exports.parseGsdKboneInput = exports.parseGsdKboneText = exports.parseGsdKboneRichText = exports.parseGsdKboneSwiper = exports.parseGsdKboneAgree = exports.parseGsdKbonePopLayer = exports.parseGsdKboneButton = exports.parseGsdKboneFooter = void 0;
|
|
27
4
|
const utils_1 = require("./utils");
|
|
28
|
-
const
|
|
5
|
+
const lodash_es_1 = require("lodash-es");
|
|
29
6
|
const common_1 = require("./common");
|
|
30
7
|
const utils_2 = require("../../../../utils");
|
|
31
8
|
function parseGsdKboneFooter(comp) {
|
|
@@ -283,7 +260,7 @@ function parseGsdKboneSwiper(comp) {
|
|
|
283
260
|
else {
|
|
284
261
|
const newSwiperItemId = (0, utils_1.getId)();
|
|
285
262
|
const newSubComp = JSON.parse(JSON.stringify(subComp).replace(new RegExp(`forItems\\.${subKey}`, 'g'), `forItems.${newSwiperItemId}`));
|
|
286
|
-
const waFor =
|
|
263
|
+
const waFor = (0, lodash_es_1.get)(newSubComp, 'xProps.directives.waFor');
|
|
287
264
|
try {
|
|
288
265
|
delete newSubComp.xProps.directives.waFor;
|
|
289
266
|
delete comp.properties[subKey];
|
|
@@ -330,7 +307,7 @@ function parseGsdKboneText(comp) {
|
|
|
330
307
|
comp.xProps = comp.xProps || {};
|
|
331
308
|
comp.xProps.commonStyle = comp.xProps.commonStyle || {};
|
|
332
309
|
// v1 版本 text 为 block
|
|
333
|
-
comp.xProps.commonStyle = (0,
|
|
310
|
+
comp.xProps.commonStyle = (0, lodash_es_1.merge)({
|
|
334
311
|
display: 'block',
|
|
335
312
|
self: {
|
|
336
313
|
display: 'block',
|
|
@@ -383,20 +360,20 @@ function parseGsdKboneInput(comp, key, parent) {
|
|
|
383
360
|
},
|
|
384
361
|
};
|
|
385
362
|
(0, utils_1.addDefaultData)(defaultData, comp);
|
|
386
|
-
const append =
|
|
363
|
+
const append = (0, lodash_es_1.get)(comp, 'properties.append');
|
|
387
364
|
if (append) {
|
|
388
|
-
|
|
389
|
-
|
|
365
|
+
(0, lodash_es_1.set)(comp, 'properties.suffix', append);
|
|
366
|
+
(0, lodash_es_1.set)(comp, 'xProps.data.isSuffix.value', true);
|
|
390
367
|
delete comp.properties.append;
|
|
391
368
|
}
|
|
392
369
|
}
|
|
393
370
|
exports.parseGsdKboneInput = parseGsdKboneInput;
|
|
394
371
|
function parseGsdKboneSwitch(comp, key, parent) {
|
|
395
372
|
(0, common_1.addFormItem)(comp, key, parent, true);
|
|
396
|
-
const defaultValue =
|
|
397
|
-
defaultValue &&
|
|
398
|
-
const originStyle =
|
|
399
|
-
|
|
373
|
+
const defaultValue = (0, lodash_es_1.get)(comp, 'xProps.data.defaultValue');
|
|
374
|
+
defaultValue && (0, lodash_es_1.set)(comp, 'xProps.data.value', defaultValue);
|
|
375
|
+
const originStyle = (0, lodash_es_1.get)(comp, 'xProps.commonStyle.margin');
|
|
376
|
+
(0, lodash_es_1.set)(comp, 'xProps.commonStyle.margin', Object.assign(Object.assign({}, originStyle), { top: '30', right: '40', bottom: '30', left: '40' }));
|
|
400
377
|
}
|
|
401
378
|
exports.parseGsdKboneSwitch = parseGsdKboneSwitch;
|
|
402
379
|
function parseGsdKbonePicker(comp, key, parent) {
|
|
@@ -406,7 +383,7 @@ function parseGsdKbonePicker(comp, key, parent) {
|
|
|
406
383
|
exports.parseGsdKbonePicker = parseGsdKbonePicker;
|
|
407
384
|
function parseGsdKboneDateTimePicker(comp, key, parent) {
|
|
408
385
|
(0, common_1.addFormItem)(comp, key, parent);
|
|
409
|
-
const modeValue =
|
|
386
|
+
const modeValue = (0, lodash_es_1.get)(comp, 'xProps.data.mode.value');
|
|
410
387
|
if (modeValue === 'date') {
|
|
411
388
|
comp.xComponent.name = 'Date';
|
|
412
389
|
}
|
|
@@ -474,10 +451,10 @@ function addFormWrapperComp(pageInstance) {
|
|
|
474
451
|
let comp = _comp;
|
|
475
452
|
const { xComponent, xProps } = comp;
|
|
476
453
|
if (xComponent && xComponent.name === 'Button') {
|
|
477
|
-
const target =
|
|
454
|
+
const target = (0, lodash_es_1.get)(xProps, 'listeners[0]');
|
|
478
455
|
if (target && target.trigger && target.trigger === 'click') {
|
|
479
456
|
listeners = xProps.listeners;
|
|
480
|
-
|
|
457
|
+
(0, lodash_es_1.set)(xProps, 'data.formType', {
|
|
481
458
|
value: 'submit',
|
|
482
459
|
});
|
|
483
460
|
target.trigger = 'submit';
|
|
@@ -529,7 +506,7 @@ function parseGsdKboneTabs(comp) {
|
|
|
529
506
|
}
|
|
530
507
|
let tabItems; // [{key, title, content}]
|
|
531
508
|
if (xProps.data) {
|
|
532
|
-
tabItems =
|
|
509
|
+
tabItems = (0, lodash_es_1.get)(xProps.data, 'TabItems.value', []);
|
|
533
510
|
// 只保留 activeKey
|
|
534
511
|
Object.keys(xProps.data).forEach((key) => {
|
|
535
512
|
if (key !== 'activeKey')
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export declare function init(json: any): void;
|
|
2
|
-
export declare function getId(): string;
|
|
3
|
-
export declare function isComplexComponent(name?: string): string;
|
|
4
|
-
export declare function isGsdH5ReactComponent(name?: string): string;
|
|
5
|
-
export declare function addDefaultSlot(slotKey: string[], comp: any): void;
|
|
6
|
-
export declare function addDefaultData(defaultData: any, comp: any): void;
|
|
7
|
-
export declare function isComplexJSON(json: any): any;
|
|
8
|
-
export declare function getComponentChildren(component: any): [string, unknown][];
|
|
9
|
-
export declare function isWeAppId(key?: string): RegExpMatchArray;
|
|
10
|
-
export declare function isEmptyObject(obj?: {}): boolean;
|
|
11
|
-
export declare function isPlainObject(src: any): boolean;
|
|
12
|
-
export declare function checkIsNeedAddFormWrapper(tree: any): boolean;
|
|
13
|
-
export declare function findComponentInTree(tree: any, cb: (cmp: any, path: string) => any, path?: string): any;
|
|
1
|
+
export declare function init(json: any): void;
|
|
2
|
+
export declare function getId(): string;
|
|
3
|
+
export declare function isComplexComponent(name?: string): string | undefined;
|
|
4
|
+
export declare function isGsdH5ReactComponent(name?: string): string | undefined;
|
|
5
|
+
export declare function addDefaultSlot(slotKey: string[] | undefined, comp: any): void;
|
|
6
|
+
export declare function addDefaultData(defaultData: any, comp: any): void;
|
|
7
|
+
export declare function isComplexJSON(json: any): any;
|
|
8
|
+
export declare function getComponentChildren(component: any): [string, unknown][];
|
|
9
|
+
export declare function isWeAppId(key?: string): RegExpMatchArray | null;
|
|
10
|
+
export declare function isEmptyObject(obj?: {}): boolean;
|
|
11
|
+
export declare function isPlainObject(src: any): boolean;
|
|
12
|
+
export declare function checkIsNeedAddFormWrapper(tree: any): boolean;
|
|
13
|
+
export declare function findComponentInTree(tree: any, cb: (cmp: any, path: string) => any, path?: string): any;
|
|
14
14
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/parser/cals/utils/version/utils.ts"],"names":[],"mappings":"AAKA,wBAAgB,IAAI,CAAC,IAAI,EAAE,GAAG,QA2B7B;AAED,wBAAgB,KAAK,WAEpB;AAED,wBAAgB,kBAAkB,CAAC,IAAI,SAAK,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/parser/cals/utils/version/utils.ts"],"names":[],"mappings":"AAKA,wBAAgB,IAAI,CAAC,IAAI,EAAE,GAAG,QA2B7B;AAED,wBAAgB,KAAK,WAEpB;AAED,wBAAgB,kBAAkB,CAAC,IAAI,SAAK,sBAQ3C;AAED,wBAAgB,qBAAqB,CAAC,IAAI,SAAK,sBAQ9C;AAED,wBAAgB,cAAc,CAAC,OAAO,sBAAe,EAAE,IAAI,EAAE,GAAG,QAO/D;AAED,wBAAgB,cAAc,CAAC,WAAW,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,QAKzD;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,GAAG,OAItC;AAED,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,GAAG,uBASlD;AAED,wBAAgB,SAAS,CAAC,GAAG,SAAK,2BAEjC;AAED,wBAAgB,aAAa,CAAC,GAAG,KAAK,WAErC;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,WAErC;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,GAAG,WAkBlD;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,GAAG,EAAE,IAAI,SAAK,GAAG,GAAG,CAmBlG"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.findComponentInTree = exports.checkIsNeedAddFormWrapper = exports.isPlainObject = exports.isEmptyObject = exports.isWeAppId = exports.getComponentChildren = exports.isComplexJSON = exports.addDefaultData = exports.addDefaultSlot = exports.isGsdH5ReactComponent = exports.isComplexComponent = exports.getId = exports.init = void 0;
|
|
4
4
|
const config_1 = require("./config");
|
|
5
|
-
const
|
|
5
|
+
const lodash_es_1 = require("lodash-es");
|
|
6
6
|
const ids = [];
|
|
7
7
|
let maxId = 10000;
|
|
8
8
|
function init(json) {
|
|
@@ -71,7 +71,7 @@ function addDefaultData(defaultData, comp) {
|
|
|
71
71
|
// @ts-ignore
|
|
72
72
|
comp.xProps = comp.xProps || {};
|
|
73
73
|
comp.xProps.data = comp.xProps.data || {};
|
|
74
|
-
comp.xProps.data = (0,
|
|
74
|
+
comp.xProps.data = (0, lodash_es_1.merge)(defaultData, comp.xProps.data);
|
|
75
75
|
}
|
|
76
76
|
exports.addDefaultData = addDefaultData;
|
|
77
77
|
function isComplexJSON(json) {
|
|
@@ -1,123 +1,123 @@
|
|
|
1
|
-
import { Node, Options } from 'acorn';
|
|
2
|
-
export declare const PARSE_CONFIG: Options;
|
|
3
|
-
export declare const AST_TYPE: {
|
|
4
|
-
Literal: string;
|
|
5
|
-
ExpressionStatement: string;
|
|
6
|
-
LogicalExpression: string;
|
|
7
|
-
BinaryExpression: string;
|
|
8
|
-
UnaryExpression: string;
|
|
9
|
-
MemberExpression: string;
|
|
10
|
-
Identifier: string;
|
|
11
|
-
ArrayExpression: string;
|
|
12
|
-
CallExpression: string;
|
|
13
|
-
TemplateLiteral: string;
|
|
14
|
-
TemplateElement: string;
|
|
15
|
-
ConditionalExpression: string;
|
|
16
|
-
SequenceExpression: string;
|
|
17
|
-
};
|
|
18
|
-
export declare enum PropBindType {
|
|
19
|
-
static = "static",
|
|
20
|
-
state = "rematch",
|
|
21
|
-
computed = "computed",
|
|
22
|
-
forItem = "for-item",
|
|
23
|
-
expression = "expression",
|
|
24
|
-
prop = "prop",
|
|
25
|
-
slot = "slot",
|
|
26
|
-
dataVar = "dataVar",
|
|
27
|
-
stateData = "state",
|
|
28
|
-
/**
|
|
29
|
-
* @deprecated
|
|
30
|
-
*/
|
|
31
|
-
paramData = "params",
|
|
32
|
-
params = "params",
|
|
33
|
-
scope = "scope"
|
|
34
|
-
}
|
|
35
|
-
export declare enum ActionType {
|
|
36
|
-
Rematch = "rematch",
|
|
37
|
-
Material = "material",
|
|
38
|
-
GeneralFunc = "general-func",
|
|
39
|
-
LifeCycle = "lifecycle",
|
|
40
|
-
PropEvent = "prop-event",
|
|
41
|
-
HandlerFn = "handler-fn",
|
|
42
|
-
Inline = "inline",
|
|
43
|
-
Platform = "platform",
|
|
44
|
-
DataSource = "dataSource"
|
|
45
|
-
}
|
|
46
|
-
export interface IDynamicValue {
|
|
47
|
-
type: PropBindType;
|
|
48
|
-
value: any;
|
|
49
|
-
extra?: any;
|
|
50
|
-
}
|
|
51
|
-
export interface IDataBind {
|
|
52
|
-
propertyPath: string;
|
|
53
|
-
bindDataPath: string;
|
|
54
|
-
type?: PropBindType;
|
|
55
|
-
extra?: any;
|
|
56
|
-
}
|
|
57
|
-
interface NodeEx extends Node {
|
|
58
|
-
$parent: NodeEx;
|
|
59
|
-
$path: any[];
|
|
60
|
-
expressions: NodeEx[];
|
|
61
|
-
/**
|
|
62
|
-
* LogicalExpression
|
|
63
|
-
*/
|
|
64
|
-
left: NodeEx;
|
|
65
|
-
right: NodeEx;
|
|
66
|
-
/**
|
|
67
|
-
* UnaryExpression
|
|
68
|
-
*/
|
|
69
|
-
operator: string;
|
|
70
|
-
prefix: boolean;
|
|
71
|
-
/**
|
|
72
|
-
* MemberExpression
|
|
73
|
-
*/
|
|
74
|
-
property: NodeEx;
|
|
75
|
-
object: NodeEx;
|
|
76
|
-
computed: boolean;
|
|
77
|
-
/**
|
|
78
|
-
* Literal
|
|
79
|
-
*/
|
|
80
|
-
name: string;
|
|
81
|
-
value: any;
|
|
82
|
-
regex: any;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* 检查全局变量静态访问是否符合要求
|
|
86
|
-
* @export
|
|
87
|
-
* @param {*} expression
|
|
88
|
-
*/
|
|
89
|
-
export declare function parseMemberProperty(expression: NodeEx, checkMemberProperty?: (path: any[]) => void): (string | number)[];
|
|
90
|
-
interface IDynamicValueParserOptions {
|
|
91
|
-
type: PropBindType;
|
|
92
|
-
value?: string;
|
|
93
|
-
expression?: any;
|
|
94
|
-
pageId?: string;
|
|
95
|
-
}
|
|
96
|
-
export declare class DynamicValueParser {
|
|
97
|
-
expression: NodeEx;
|
|
98
|
-
expressionString: string;
|
|
99
|
-
options: IDynamicValueParserOptions;
|
|
100
|
-
constructor(expressionString: string, options?: Partial<IDynamicValueParserOptions>);
|
|
101
|
-
/**
|
|
102
|
-
* parser
|
|
103
|
-
*/
|
|
104
|
-
parse(): IDynamicValueParserOptions;
|
|
105
|
-
linkBinaryExpression(expression: NodeEx): void;
|
|
106
|
-
parseBinaryExpression(expression: NodeEx, options: this['options']): IDynamicValueParserOptions;
|
|
107
|
-
parseSimpleExpression(expression: NodeEx, options: this['options']): IDynamicValueParserOptions;
|
|
108
|
-
parseItemAliseExpression(expression: NodeEx, options: this['options']): this["options"];
|
|
109
|
-
_generatePrefix(memberProperty: (number | string)[], index: number): string;
|
|
110
|
-
_replaceExpression(meta: {
|
|
111
|
-
memberProperty: (number | string)[];
|
|
112
|
-
index: number;
|
|
113
|
-
replacer: string;
|
|
114
|
-
expressionString?: string;
|
|
115
|
-
}): string;
|
|
116
|
-
parseDataset(expression: NodeEx, meta: {
|
|
117
|
-
memberProperty: (number | string)[];
|
|
118
|
-
index: number;
|
|
119
|
-
replacer: string;
|
|
120
|
-
}, options: this['options']): IDynamicValueParserOptions;
|
|
121
|
-
}
|
|
122
|
-
export {};
|
|
1
|
+
import { Node, Options } from 'acorn';
|
|
2
|
+
export declare const PARSE_CONFIG: Options;
|
|
3
|
+
export declare const AST_TYPE: {
|
|
4
|
+
Literal: string;
|
|
5
|
+
ExpressionStatement: string;
|
|
6
|
+
LogicalExpression: string;
|
|
7
|
+
BinaryExpression: string;
|
|
8
|
+
UnaryExpression: string;
|
|
9
|
+
MemberExpression: string;
|
|
10
|
+
Identifier: string;
|
|
11
|
+
ArrayExpression: string;
|
|
12
|
+
CallExpression: string;
|
|
13
|
+
TemplateLiteral: string;
|
|
14
|
+
TemplateElement: string;
|
|
15
|
+
ConditionalExpression: string;
|
|
16
|
+
SequenceExpression: string;
|
|
17
|
+
};
|
|
18
|
+
export declare enum PropBindType {
|
|
19
|
+
static = "static",
|
|
20
|
+
state = "rematch",
|
|
21
|
+
computed = "computed",
|
|
22
|
+
forItem = "for-item",
|
|
23
|
+
expression = "expression",
|
|
24
|
+
prop = "prop",
|
|
25
|
+
slot = "slot",
|
|
26
|
+
dataVar = "dataVar",
|
|
27
|
+
stateData = "state",
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated
|
|
30
|
+
*/
|
|
31
|
+
paramData = "params",
|
|
32
|
+
params = "params",
|
|
33
|
+
scope = "scope"
|
|
34
|
+
}
|
|
35
|
+
export declare enum ActionType {
|
|
36
|
+
Rematch = "rematch",
|
|
37
|
+
Material = "material",
|
|
38
|
+
GeneralFunc = "general-func",
|
|
39
|
+
LifeCycle = "lifecycle",
|
|
40
|
+
PropEvent = "prop-event",
|
|
41
|
+
HandlerFn = "handler-fn",
|
|
42
|
+
Inline = "inline",
|
|
43
|
+
Platform = "platform",
|
|
44
|
+
DataSource = "dataSource"
|
|
45
|
+
}
|
|
46
|
+
export interface IDynamicValue {
|
|
47
|
+
type: PropBindType;
|
|
48
|
+
value: any;
|
|
49
|
+
extra?: any;
|
|
50
|
+
}
|
|
51
|
+
export interface IDataBind {
|
|
52
|
+
propertyPath: string;
|
|
53
|
+
bindDataPath: string;
|
|
54
|
+
type?: PropBindType;
|
|
55
|
+
extra?: any;
|
|
56
|
+
}
|
|
57
|
+
interface NodeEx extends Node {
|
|
58
|
+
$parent: NodeEx;
|
|
59
|
+
$path: any[];
|
|
60
|
+
expressions: NodeEx[];
|
|
61
|
+
/**
|
|
62
|
+
* LogicalExpression
|
|
63
|
+
*/
|
|
64
|
+
left: NodeEx;
|
|
65
|
+
right: NodeEx;
|
|
66
|
+
/**
|
|
67
|
+
* UnaryExpression
|
|
68
|
+
*/
|
|
69
|
+
operator: string;
|
|
70
|
+
prefix: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* MemberExpression
|
|
73
|
+
*/
|
|
74
|
+
property: NodeEx;
|
|
75
|
+
object: NodeEx;
|
|
76
|
+
computed: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Literal
|
|
79
|
+
*/
|
|
80
|
+
name: string;
|
|
81
|
+
value: any;
|
|
82
|
+
regex: any;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* 检查全局变量静态访问是否符合要求
|
|
86
|
+
* @export
|
|
87
|
+
* @param {*} expression
|
|
88
|
+
*/
|
|
89
|
+
export declare function parseMemberProperty(expression: NodeEx, checkMemberProperty?: (path: any[]) => void): (string | number)[];
|
|
90
|
+
interface IDynamicValueParserOptions {
|
|
91
|
+
type: PropBindType;
|
|
92
|
+
value?: string;
|
|
93
|
+
expression?: any;
|
|
94
|
+
pageId?: string;
|
|
95
|
+
}
|
|
96
|
+
export declare class DynamicValueParser {
|
|
97
|
+
expression: NodeEx;
|
|
98
|
+
expressionString: string;
|
|
99
|
+
options: IDynamicValueParserOptions;
|
|
100
|
+
constructor(expressionString: string, options?: Partial<IDynamicValueParserOptions>);
|
|
101
|
+
/**
|
|
102
|
+
* parser
|
|
103
|
+
*/
|
|
104
|
+
parse(): IDynamicValueParserOptions;
|
|
105
|
+
linkBinaryExpression(expression: NodeEx): void;
|
|
106
|
+
parseBinaryExpression(expression: NodeEx, options: this['options']): IDynamicValueParserOptions;
|
|
107
|
+
parseSimpleExpression(expression: NodeEx, options: this['options']): IDynamicValueParserOptions;
|
|
108
|
+
parseItemAliseExpression(expression: NodeEx, options: this['options']): this["options"];
|
|
109
|
+
_generatePrefix(memberProperty: (number | string)[], index: number): string;
|
|
110
|
+
_replaceExpression(meta: {
|
|
111
|
+
memberProperty: (number | string)[];
|
|
112
|
+
index: number;
|
|
113
|
+
replacer: string;
|
|
114
|
+
expressionString?: string;
|
|
115
|
+
}): string;
|
|
116
|
+
parseDataset(expression: NodeEx, meta: {
|
|
117
|
+
memberProperty: (number | string)[];
|
|
118
|
+
index: number;
|
|
119
|
+
replacer: string;
|
|
120
|
+
}, options: this['options']): IDynamicValueParserOptions;
|
|
121
|
+
}
|
|
122
|
+
export {};
|
|
123
123
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/parser/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export * from './cals/index';
|
|
2
|
-
export { upgrageToVersion2 } from './cals/utils/version';
|
|
3
|
-
export { processComponentModule } from './cals/utils/spinoff';
|
|
4
|
-
export { calsToCode, codeToCals, ICodeItem, checkForConflicts, autoResolveConflicts } from './cals/utils/code';
|
|
5
|
-
export { parseComponentCals } from './cals/utils/block';
|
|
6
|
-
export { ActionType, IDataBind, PropBindType } from './expression/index';
|
|
7
|
-
export { processCommonStyle2CSSProperties, processCSSProperties2Rem, processCSSPropertiesUnit, } from './cals/utils/style';
|
|
8
|
-
export { default as PostcssRpx2Calc } from './plugins/postcss-rpx2clac';
|
|
1
|
+
export * from './cals/index';
|
|
2
|
+
export { upgrageToVersion2 } from './cals/utils/version';
|
|
3
|
+
export { processComponentModule } from './cals/utils/spinoff';
|
|
4
|
+
export { calsToCode, codeToCals, ICodeItem, checkForConflicts, autoResolveConflicts } from './cals/utils/code';
|
|
5
|
+
export { parseComponentCals } from './cals/utils/block';
|
|
6
|
+
export { ActionType, IDataBind, PropBindType } from './expression/index';
|
|
7
|
+
export { processCommonStyle2CSSProperties, processCSSProperties2Rem, processCSSPropertiesUnit, } from './cals/utils/style';
|
|
8
|
+
export { default as PostcssRpx2Calc } from './plugins/postcss-rpx2clac';
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,18 +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;
|
|
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
18
|
//# sourceMappingURL=postcss-rpx2clac.d.ts.map
|
|
@@ -50,11 +50,11 @@ function Plugin(opt) {
|
|
|
50
50
|
return str;
|
|
51
51
|
if (num1 == '0')
|
|
52
52
|
return '0';
|
|
53
|
-
const v = +num1 / zoom;
|
|
53
|
+
const v = +num1 / (zoom || 1);
|
|
54
54
|
if (isNaN(v)) {
|
|
55
55
|
return str;
|
|
56
56
|
}
|
|
57
|
-
const value = Number.isInteger(v) ? v.toString() : toFixed(v, precision);
|
|
57
|
+
const value = Number.isInteger(v) ? v.toString() : toFixed(v, precision || 0);
|
|
58
58
|
return `calc(${value}${outUnit}/${rootValue})`;
|
|
59
59
|
});
|
|
60
60
|
}
|