@cloudbase/cals 1.0.3-alpha.0 → 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 +204 -42
- 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,31 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
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;
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
4
|
};
|
|
25
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
6
|
exports.renameRepeatId = exports.addFormItem = exports.afterCommonParse = exports.beforeCommonParse = void 0;
|
|
27
7
|
const utils_1 = require("./utils");
|
|
28
|
-
const
|
|
8
|
+
const get_1 = __importDefault(require("lodash/get"));
|
|
9
|
+
const set_1 = __importDefault(require("lodash/set"));
|
|
10
|
+
const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
|
|
11
|
+
const merge_1 = __importDefault(require("lodash/merge"));
|
|
29
12
|
const index_1 = require("./index");
|
|
30
13
|
const common_1 = require("../common");
|
|
31
14
|
const utils_2 = require("../../../../utils");
|
|
@@ -196,7 +179,7 @@ function translateStyleToCommonStyle(comp) {
|
|
|
196
179
|
if (xProps === null || xProps === void 0 ? void 0 : xProps.style) {
|
|
197
180
|
xProps.commonStyle = xProps.commonStyle || {};
|
|
198
181
|
xProps.commonStyle.self = xProps.commonStyle.self || {};
|
|
199
|
-
xProps.commonStyle.self = (0,
|
|
182
|
+
xProps.commonStyle.self = (0, merge_1.default)(xProps.style, xProps.commonStyle.self);
|
|
200
183
|
delete xProps.style;
|
|
201
184
|
}
|
|
202
185
|
}
|
|
@@ -218,12 +201,12 @@ function addDefaultXIndex(comp) {
|
|
|
218
201
|
}
|
|
219
202
|
function addFormItem(comp, key, parent, isOnlySlot = false) {
|
|
220
203
|
const { properties, xIndex, xProps } = comp;
|
|
221
|
-
const defaultValue =
|
|
204
|
+
const defaultValue = (0, get_1.default)(xProps, 'data.defaultValue');
|
|
222
205
|
if (defaultValue) {
|
|
223
|
-
|
|
206
|
+
(0, set_1.default)(xProps, 'data.value', defaultValue);
|
|
224
207
|
delete xProps.data.defaultValue;
|
|
225
208
|
}
|
|
226
|
-
const rulesValue =
|
|
209
|
+
const rulesValue = (0, get_1.default)(xProps, 'data.rules') || {
|
|
227
210
|
value: [],
|
|
228
211
|
};
|
|
229
212
|
if (!rulesValue.type || rulesValue.type === 'static') {
|
|
@@ -239,19 +222,19 @@ function addFormItem(comp, key, parent, isOnlySlot = false) {
|
|
|
239
222
|
rulesValue.value = [rulesValue.value];
|
|
240
223
|
}
|
|
241
224
|
}
|
|
242
|
-
const layoutValue =
|
|
225
|
+
const layoutValue = (0, get_1.default)(xProps, 'data.layout') || {
|
|
243
226
|
value: 'vertical',
|
|
244
227
|
};
|
|
245
|
-
const requireValue =
|
|
228
|
+
const requireValue = (0, get_1.default)(xProps, 'data.required') || {
|
|
246
229
|
value: false,
|
|
247
230
|
};
|
|
248
231
|
const requiredTextValue = {
|
|
249
232
|
value: (requireValue === null || requireValue === void 0 ? void 0 : requireValue.value) ? '该项为必填项' : false,
|
|
250
233
|
};
|
|
251
|
-
const nameValue =
|
|
234
|
+
const nameValue = (0, get_1.default)(xProps, 'data.name') || {
|
|
252
235
|
value: 'uniqueFormKey',
|
|
253
236
|
};
|
|
254
|
-
let labelText =
|
|
237
|
+
let labelText = (0, get_1.default)(xProps, 'data.label.value') || '';
|
|
255
238
|
let isShowTitleSlot = false;
|
|
256
239
|
if (properties) {
|
|
257
240
|
Object.keys(properties).map((subKey) => {
|
|
@@ -261,8 +244,8 @@ function addFormItem(comp, key, parent, isOnlySlot = false) {
|
|
|
261
244
|
if (subKey === 'label') {
|
|
262
245
|
const targetLabelSlot = properties[subKey];
|
|
263
246
|
(0, utils_1.getComponentChildren)(targetLabelSlot).map(([key, item]) => {
|
|
264
|
-
labelText =
|
|
265
|
-
const cloneItem =
|
|
247
|
+
labelText = (0, get_1.default)(item, 'xProps.data.text.value');
|
|
248
|
+
const cloneItem = (0, cloneDeep_1.default)(item);
|
|
266
249
|
(0, index_1.deepParse)(cloneItem, key, comp);
|
|
267
250
|
isShowTitleSlot = true;
|
|
268
251
|
});
|
|
@@ -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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parses.d.ts","sourceRoot":"","sources":["../../../../../src/parser/cals/utils/version/parses.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"parses.d.ts","sourceRoot":"","sources":["../../../../../src/parser/cals/utils/version/parses.ts"],"names":[],"mappings":"AAcA,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,GAAG,QAmC5C;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,GAAG,QA4G5C;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,GAAG,QA4B9C;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,QAuBlE;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,GAAG,QAoF5C;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,GAAG,QAM9C;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,GAAG,QAc1C;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,QAmDlE;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,QAanE;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,QAGnE;AAED,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,QAQ3E;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,QA6CnE;AAED,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,GAAG,QAgDnD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,GAAG,QAwD1C;AAGD,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE,GAAG,QAuB1D"}
|
|
@@ -1,31 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
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;
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
4
|
};
|
|
25
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
6
|
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
7
|
const utils_1 = require("./utils");
|
|
28
|
-
const
|
|
8
|
+
const get_1 = __importDefault(require("lodash/get"));
|
|
9
|
+
const set_1 = __importDefault(require("lodash/set"));
|
|
10
|
+
const merge_1 = __importDefault(require("lodash/merge"));
|
|
29
11
|
const common_1 = require("./common");
|
|
30
12
|
const utils_2 = require("../../../../utils");
|
|
31
13
|
function parseGsdKboneFooter(comp) {
|
|
@@ -283,7 +265,7 @@ function parseGsdKboneSwiper(comp) {
|
|
|
283
265
|
else {
|
|
284
266
|
const newSwiperItemId = (0, utils_1.getId)();
|
|
285
267
|
const newSubComp = JSON.parse(JSON.stringify(subComp).replace(new RegExp(`forItems\\.${subKey}`, 'g'), `forItems.${newSwiperItemId}`));
|
|
286
|
-
const waFor =
|
|
268
|
+
const waFor = (0, get_1.default)(newSubComp, 'xProps.directives.waFor');
|
|
287
269
|
try {
|
|
288
270
|
delete newSubComp.xProps.directives.waFor;
|
|
289
271
|
delete comp.properties[subKey];
|
|
@@ -330,7 +312,7 @@ function parseGsdKboneText(comp) {
|
|
|
330
312
|
comp.xProps = comp.xProps || {};
|
|
331
313
|
comp.xProps.commonStyle = comp.xProps.commonStyle || {};
|
|
332
314
|
// v1 版本 text 为 block
|
|
333
|
-
comp.xProps.commonStyle = (0,
|
|
315
|
+
comp.xProps.commonStyle = (0, merge_1.default)({
|
|
334
316
|
display: 'block',
|
|
335
317
|
self: {
|
|
336
318
|
display: 'block',
|
|
@@ -383,20 +365,20 @@ function parseGsdKboneInput(comp, key, parent) {
|
|
|
383
365
|
},
|
|
384
366
|
};
|
|
385
367
|
(0, utils_1.addDefaultData)(defaultData, comp);
|
|
386
|
-
const append =
|
|
368
|
+
const append = (0, get_1.default)(comp, 'properties.append');
|
|
387
369
|
if (append) {
|
|
388
|
-
|
|
389
|
-
|
|
370
|
+
(0, set_1.default)(comp, 'properties.suffix', append);
|
|
371
|
+
(0, set_1.default)(comp, 'xProps.data.isSuffix.value', true);
|
|
390
372
|
delete comp.properties.append;
|
|
391
373
|
}
|
|
392
374
|
}
|
|
393
375
|
exports.parseGsdKboneInput = parseGsdKboneInput;
|
|
394
376
|
function parseGsdKboneSwitch(comp, key, parent) {
|
|
395
377
|
(0, common_1.addFormItem)(comp, key, parent, true);
|
|
396
|
-
const defaultValue =
|
|
397
|
-
defaultValue &&
|
|
398
|
-
const originStyle =
|
|
399
|
-
|
|
378
|
+
const defaultValue = (0, get_1.default)(comp, 'xProps.data.defaultValue');
|
|
379
|
+
defaultValue && (0, set_1.default)(comp, 'xProps.data.value', defaultValue);
|
|
380
|
+
const originStyle = (0, get_1.default)(comp, 'xProps.commonStyle.margin');
|
|
381
|
+
(0, set_1.default)(comp, 'xProps.commonStyle.margin', Object.assign(Object.assign({}, originStyle), { top: '30', right: '40', bottom: '30', left: '40' }));
|
|
400
382
|
}
|
|
401
383
|
exports.parseGsdKboneSwitch = parseGsdKboneSwitch;
|
|
402
384
|
function parseGsdKbonePicker(comp, key, parent) {
|
|
@@ -406,7 +388,7 @@ function parseGsdKbonePicker(comp, key, parent) {
|
|
|
406
388
|
exports.parseGsdKbonePicker = parseGsdKbonePicker;
|
|
407
389
|
function parseGsdKboneDateTimePicker(comp, key, parent) {
|
|
408
390
|
(0, common_1.addFormItem)(comp, key, parent);
|
|
409
|
-
const modeValue =
|
|
391
|
+
const modeValue = (0, get_1.default)(comp, 'xProps.data.mode.value');
|
|
410
392
|
if (modeValue === 'date') {
|
|
411
393
|
comp.xComponent.name = 'Date';
|
|
412
394
|
}
|
|
@@ -474,10 +456,10 @@ function addFormWrapperComp(pageInstance) {
|
|
|
474
456
|
let comp = _comp;
|
|
475
457
|
const { xComponent, xProps } = comp;
|
|
476
458
|
if (xComponent && xComponent.name === 'Button') {
|
|
477
|
-
const target =
|
|
459
|
+
const target = (0, get_1.default)(xProps, 'listeners[0]');
|
|
478
460
|
if (target && target.trigger && target.trigger === 'click') {
|
|
479
461
|
listeners = xProps.listeners;
|
|
480
|
-
|
|
462
|
+
(0, set_1.default)(xProps, 'data.formType', {
|
|
481
463
|
value: 'submit',
|
|
482
464
|
});
|
|
483
465
|
target.trigger = 'submit';
|
|
@@ -529,7 +511,7 @@ function parseGsdKboneTabs(comp) {
|
|
|
529
511
|
}
|
|
530
512
|
let tabItems; // [{key, title, content}]
|
|
531
513
|
if (xProps.data) {
|
|
532
|
-
tabItems =
|
|
514
|
+
tabItems = (0, get_1.default)(xProps.data, 'TabItems.value', []);
|
|
533
515
|
// 只保留 activeKey
|
|
534
516
|
Object.keys(xProps.data).forEach((key) => {
|
|
535
517
|
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"}
|
|
@@ -1,8 +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.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
7
|
const config_1 = require("./config");
|
|
5
|
-
const
|
|
8
|
+
const merge_1 = __importDefault(require("lodash/merge"));
|
|
6
9
|
const ids = [];
|
|
7
10
|
let maxId = 10000;
|
|
8
11
|
function init(json) {
|
|
@@ -71,7 +74,7 @@ function addDefaultData(defaultData, comp) {
|
|
|
71
74
|
// @ts-ignore
|
|
72
75
|
comp.xProps = comp.xProps || {};
|
|
73
76
|
comp.xProps.data = comp.xProps.data || {};
|
|
74
|
-
comp.xProps.data = (0,
|
|
77
|
+
comp.xProps.data = (0, merge_1.default)(defaultData, comp.xProps.data);
|
|
75
78
|
}
|
|
76
79
|
exports.addDefaultData = addDefaultData;
|
|
77
80
|
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
|