@cloudbase/cals 0.3.6 → 0.3.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/parser/cals/index.d.ts +57 -2
- package/lib/parser/cals/index.d.ts.map +1 -1
- package/lib/parser/cals/index.js +68 -52
- package/lib/parser/cals/utils/block/index.d.ts +15 -0
- package/lib/parser/cals/utils/block/index.d.ts.map +1 -0
- package/lib/parser/cals/utils/block/index.js +148 -0
- package/lib/parser/cals/utils/runtime.js +3 -3
- package/lib/parser/cals/utils/style.js +3 -3
- package/lib/parser/cals/utils/version/common.js +14 -14
- package/lib/parser/cals/utils/version/index.js +6 -6
- package/lib/parser/cals/utils/version/parses.js +24 -24
- package/lib/parser/cals/utils/version/utils.js +1 -1
- package/lib/parser/expression/index.d.ts +3 -1
- package/lib/parser/expression/index.d.ts.map +1 -1
- package/lib/parser/expression/index.js +14 -5
- package/lib/parser/index.d.ts +3 -2
- package/lib/parser/index.d.ts.map +1 -1
- package/lib/parser/index.js +17 -12
- package/lib/tsconfig.tsbuildinfo +1 -1636
- package/lib/types/platform/common.d.ts +40 -0
- package/lib/types/platform/common.d.ts.map +1 -1
- package/lib/types/platform/common.js +42 -1
- package/lib/types/platform/datasource.d.ts +1 -1
- package/lib/types/platform/datasource.d.ts.map +1 -1
- package/lib/utils/build.js +7 -7
- package/package.json +4 -4
|
@@ -70,8 +70,8 @@ function translateComponentModuleName(comp) {
|
|
|
70
70
|
const { xComponent } = comp;
|
|
71
71
|
if (xComponent) {
|
|
72
72
|
const { name } = xComponent;
|
|
73
|
-
const complexName = utils_1.isComplexComponent(name);
|
|
74
|
-
const gsdH5ReactName = utils_1.isGsdH5ReactComponent(name);
|
|
73
|
+
const complexName = (0, utils_1.isComplexComponent)(name);
|
|
74
|
+
const gsdH5ReactName = (0, utils_1.isGsdH5ReactComponent)(name);
|
|
75
75
|
if (complexName) {
|
|
76
76
|
xComponent.moduleName = 'CLOUDBASE_STANDARD';
|
|
77
77
|
xComponent.name = complexName;
|
|
@@ -167,7 +167,7 @@ function translateComponent(comp) {
|
|
|
167
167
|
comp.properties = {
|
|
168
168
|
contentSlot: {
|
|
169
169
|
properties: {
|
|
170
|
-
[utils_1.getId()]: {
|
|
170
|
+
[(0, utils_1.getId)()]: {
|
|
171
171
|
xComponent: {
|
|
172
172
|
moduleName: 'gsd-h5-react',
|
|
173
173
|
name: 'Text',
|
|
@@ -246,7 +246,7 @@ function translateStyleToCommonStyle(comp) {
|
|
|
246
246
|
if (xProps && xProps.style) {
|
|
247
247
|
xProps.commonStyle = xProps.commonStyle || {};
|
|
248
248
|
xProps.commonStyle.self = xProps.commonStyle.self || {};
|
|
249
|
-
xProps.commonStyle.self = lodash_1.merge(xProps.style, xProps.commonStyle.self);
|
|
249
|
+
xProps.commonStyle.self = (0, lodash_1.merge)(xProps.style, xProps.commonStyle.self);
|
|
250
250
|
delete xProps.style;
|
|
251
251
|
}
|
|
252
252
|
}
|
|
@@ -280,11 +280,11 @@ function addFormItem(comp, key, parent, isOnlySlot = false) {
|
|
|
280
280
|
};
|
|
281
281
|
if (!rulesValue.type || rulesValue.type === 'static') {
|
|
282
282
|
rulesValue.value = (rulesValue.value || []).filter((meta) => {
|
|
283
|
-
return meta && !common_1.isEmptyObj(meta);
|
|
283
|
+
return meta && !(0, common_1.isEmptyObj)(meta);
|
|
284
284
|
});
|
|
285
285
|
}
|
|
286
|
-
if (utils_1.isPlainObject(rulesValue.value)) {
|
|
287
|
-
if (utils_1.isEmptyObject(rulesValue.value)) {
|
|
286
|
+
if ((0, utils_1.isPlainObject)(rulesValue.value)) {
|
|
287
|
+
if ((0, utils_1.isEmptyObject)(rulesValue.value)) {
|
|
288
288
|
rulesValue.value = [];
|
|
289
289
|
}
|
|
290
290
|
else {
|
|
@@ -307,15 +307,15 @@ function addFormItem(comp, key, parent, isOnlySlot = false) {
|
|
|
307
307
|
let isShowTitleSlot = false;
|
|
308
308
|
if (properties) {
|
|
309
309
|
Object.keys(properties).map((subKey) => {
|
|
310
|
-
if (utils_1.isWeAppId(subKey)) {
|
|
310
|
+
if ((0, utils_1.isWeAppId)(subKey)) {
|
|
311
311
|
delete properties[subKey];
|
|
312
312
|
}
|
|
313
313
|
if (subKey === 'label') {
|
|
314
314
|
const targetLabelSlot = properties[subKey];
|
|
315
|
-
utils_1.getComponentChildren(targetLabelSlot).map(([key, item]) => {
|
|
315
|
+
(0, utils_1.getComponentChildren)(targetLabelSlot).map(([key, item]) => {
|
|
316
316
|
labelText = lodash_1.default.get(item, 'xProps.data.text.value');
|
|
317
317
|
const cloneItem = lodash_1.default.cloneDeep(item);
|
|
318
|
-
index_1.deepParse(cloneItem, key, comp);
|
|
318
|
+
(0, index_1.deepParse)(cloneItem, key, comp);
|
|
319
319
|
isShowTitleSlot = true;
|
|
320
320
|
});
|
|
321
321
|
delete comp.properties.label;
|
|
@@ -323,7 +323,7 @@ function addFormItem(comp, key, parent, isOnlySlot = false) {
|
|
|
323
323
|
});
|
|
324
324
|
}
|
|
325
325
|
const titleSlot = {
|
|
326
|
-
[utils_1.getId()]: {
|
|
326
|
+
[(0, utils_1.getId)()]: {
|
|
327
327
|
xComponent: {
|
|
328
328
|
moduleName: 'gsd-h5-react',
|
|
329
329
|
name: 'Text',
|
|
@@ -358,7 +358,7 @@ function addFormItem(comp, key, parent, isOnlySlot = false) {
|
|
|
358
358
|
if (!parent.xComponent ||
|
|
359
359
|
(parent.xComponent && parent.xComponent.name !== 'FormItem')) {
|
|
360
360
|
// add FormItem
|
|
361
|
-
const newFormItemId = utils_1.getId();
|
|
361
|
+
const newFormItemId = (0, utils_1.getId)();
|
|
362
362
|
// @ts-ignore
|
|
363
363
|
parent.properties[newFormItemId] = {
|
|
364
364
|
xComponent: {
|
|
@@ -420,7 +420,7 @@ function renameRepeatId(json) {
|
|
|
420
420
|
for (const i in componentInstances) {
|
|
421
421
|
const comp = componentInstances[i];
|
|
422
422
|
if (_compIds[i] && i.startsWith('id')) {
|
|
423
|
-
const newId = utils_1.getId();
|
|
423
|
+
const newId = (0, utils_1.getId)();
|
|
424
424
|
componentInstances[newId] = comp;
|
|
425
425
|
delete componentInstances[i];
|
|
426
426
|
}
|
|
@@ -439,7 +439,7 @@ function renameRepeatId(json) {
|
|
|
439
439
|
keys.forEach((key) => {
|
|
440
440
|
const _comp = topComp['properties'][key];
|
|
441
441
|
if (_compIds[key] && key.startsWith('id')) {
|
|
442
|
-
const newId = utils_1.getId();
|
|
442
|
+
const newId = (0, utils_1.getId)();
|
|
443
443
|
topComp['properties'][newId] = _comp;
|
|
444
444
|
delete topComp['properties'][key];
|
|
445
445
|
}
|
|
@@ -26,12 +26,12 @@ const CompParse = __importStar(require("./parses"));
|
|
|
26
26
|
const index_1 = require("../../index");
|
|
27
27
|
function upgrageToVersion2(app) {
|
|
28
28
|
if (app.selectedPageId) {
|
|
29
|
-
utils_1.init(app);
|
|
30
|
-
common_1.renameRepeatId(app);
|
|
29
|
+
(0, utils_1.init)(app);
|
|
30
|
+
(0, common_1.renameRepeatId)(app);
|
|
31
31
|
parse2V2(app);
|
|
32
32
|
let str = JSON.stringify(app);
|
|
33
33
|
let obj = JSON.parse(str.replace(/app\.getPageOptions/g, '(()=>{})').replace(/\\\\n/g, '\\n'));
|
|
34
|
-
return index_1.serializePlatformApp(obj, { dependencies: [] });
|
|
34
|
+
return (0, index_1.serializePlatformApp)(obj, { dependencies: [] });
|
|
35
35
|
}
|
|
36
36
|
else {
|
|
37
37
|
return app;
|
|
@@ -46,7 +46,7 @@ function parse2V2(json) {
|
|
|
46
46
|
findSelectedPage = true;
|
|
47
47
|
}
|
|
48
48
|
CompParse.addFormWrapperComp(pageInstance);
|
|
49
|
-
if (utils_1.isComplexJSON(json)) {
|
|
49
|
+
if ((0, utils_1.isComplexJSON)(json)) {
|
|
50
50
|
CompParse.parseComplexComponentInstance(pageInstance);
|
|
51
51
|
}
|
|
52
52
|
const { componentInstances } = pageInstance;
|
|
@@ -71,10 +71,10 @@ function deepParse(comp, key, parent) {
|
|
|
71
71
|
const { xComponent } = comp;
|
|
72
72
|
if (xComponent) {
|
|
73
73
|
const { name } = xComponent;
|
|
74
|
-
common_1.beforeCommonParse(comp);
|
|
74
|
+
(0, common_1.beforeCommonParse)(comp);
|
|
75
75
|
const parseFunction = CompParse[`parseGsdKbone${name}`];
|
|
76
76
|
parseFunction && parseFunction(comp, key, parent);
|
|
77
|
-
common_1.afterCommonParse(comp);
|
|
77
|
+
(0, common_1.afterCommonParse)(comp);
|
|
78
78
|
}
|
|
79
79
|
else {
|
|
80
80
|
// 当前为 slot
|
|
@@ -33,7 +33,7 @@ function parseGsdKboneFooter(comp) {
|
|
|
33
33
|
comp.properties = {
|
|
34
34
|
text: {
|
|
35
35
|
properties: {
|
|
36
|
-
[utils_1.getId()]: {
|
|
36
|
+
[(0, utils_1.getId)()]: {
|
|
37
37
|
xComponent: {
|
|
38
38
|
moduleName: 'gsd-h5-react',
|
|
39
39
|
name: 'Text',
|
|
@@ -146,7 +146,7 @@ function parseGsdKboneButton(comp) {
|
|
|
146
146
|
comp.properties = {
|
|
147
147
|
contentSlot: {
|
|
148
148
|
properties: {
|
|
149
|
-
[utils_1.getId()]: {
|
|
149
|
+
[(0, utils_1.getId)()]: {
|
|
150
150
|
xComponent: {
|
|
151
151
|
moduleName: 'gsd-h5-react',
|
|
152
152
|
name: 'Text',
|
|
@@ -175,7 +175,7 @@ function parseGsdKbonePopLayer(comp) {
|
|
|
175
175
|
// 特殊处理,因为组件名字大小写改了
|
|
176
176
|
comp.xComponent.name = 'Poplayer';
|
|
177
177
|
const slotKeys = ['content', 'footer'];
|
|
178
|
-
utils_1.addDefaultSlot(slotKeys, comp);
|
|
178
|
+
(0, utils_1.addDefaultSlot)(slotKeys, comp);
|
|
179
179
|
const defaultData = {
|
|
180
180
|
visible: {
|
|
181
181
|
value: true,
|
|
@@ -198,13 +198,13 @@ function parseGsdKbonePopLayer(comp) {
|
|
|
198
198
|
value: '120',
|
|
199
199
|
},
|
|
200
200
|
};
|
|
201
|
-
utils_1.addDefaultData(defaultData, comp);
|
|
201
|
+
(0, utils_1.addDefaultData)(defaultData, comp);
|
|
202
202
|
}
|
|
203
203
|
exports.parseGsdKbonePopLayer = parseGsdKbonePopLayer;
|
|
204
204
|
function parseGsdKboneAgree(comp, key, parent) {
|
|
205
|
-
common_1.addFormItem(comp, key, parent, true);
|
|
205
|
+
(0, common_1.addFormItem)(comp, key, parent, true);
|
|
206
206
|
const slotKeys = ['content'];
|
|
207
|
-
utils_1.addDefaultSlot(slotKeys, comp);
|
|
207
|
+
(0, utils_1.addDefaultSlot)(slotKeys, comp);
|
|
208
208
|
const defaultData = {
|
|
209
209
|
name: {
|
|
210
210
|
value: 'thisIsAgreeKey',
|
|
@@ -219,7 +219,7 @@ function parseGsdKboneAgree(comp, key, parent) {
|
|
|
219
219
|
value: 'https://weapps-prod-1301730524.cos.ap-guangzhou.myqcloud.com/res/2/square_un.svg',
|
|
220
220
|
},
|
|
221
221
|
};
|
|
222
|
-
utils_1.addDefaultData(defaultData, comp);
|
|
222
|
+
(0, utils_1.addDefaultData)(defaultData, comp);
|
|
223
223
|
if (comp.properties && comp.properties.custom) {
|
|
224
224
|
comp.properties.content = comp.properties.custom;
|
|
225
225
|
delete comp.properties.custom;
|
|
@@ -268,15 +268,15 @@ function parseGsdKboneSwiper(comp) {
|
|
|
268
268
|
value: '',
|
|
269
269
|
},
|
|
270
270
|
};
|
|
271
|
-
utils_1.addDefaultData(defaultData, comp);
|
|
272
|
-
utils_1.getComponentChildren(comp).map(([subKey, subComp]) => {
|
|
271
|
+
(0, utils_1.addDefaultData)(defaultData, comp);
|
|
272
|
+
(0, utils_1.getComponentChildren)(comp).map(([subKey, subComp]) => {
|
|
273
273
|
const { xComponent } = subComp;
|
|
274
274
|
if (xComponent.name === 'Container') {
|
|
275
275
|
xComponent.moduleName = 'gsd-h5-react';
|
|
276
276
|
xComponent.name = 'SwiperItem';
|
|
277
277
|
}
|
|
278
278
|
else {
|
|
279
|
-
const newSwiperItemId = utils_1.getId();
|
|
279
|
+
const newSwiperItemId = (0, utils_1.getId)();
|
|
280
280
|
const newSubComp = JSON.parse(JSON.stringify(subComp).replace(new RegExp(`forItems\\.${subKey}`, 'g'), `forItems.${newSwiperItemId}`));
|
|
281
281
|
const waFor = lodash_1.default.get(newSubComp, 'xProps.directives.waFor');
|
|
282
282
|
try {
|
|
@@ -325,7 +325,7 @@ function parseGsdKboneText(comp) {
|
|
|
325
325
|
comp.xProps = comp.xProps || {};
|
|
326
326
|
comp.xProps.commonStyle = comp.xProps.commonStyle || {};
|
|
327
327
|
// v1 版本 text 为 block
|
|
328
|
-
comp.xProps.commonStyle = lodash_1.merge({
|
|
328
|
+
comp.xProps.commonStyle = (0, lodash_1.merge)({
|
|
329
329
|
display: 'block',
|
|
330
330
|
self: {
|
|
331
331
|
display: 'block',
|
|
@@ -334,9 +334,9 @@ function parseGsdKboneText(comp) {
|
|
|
334
334
|
}
|
|
335
335
|
exports.parseGsdKboneText = parseGsdKboneText;
|
|
336
336
|
function parseGsdKboneInput(comp, key, parent) {
|
|
337
|
-
common_1.addFormItem(comp, key, parent);
|
|
337
|
+
(0, common_1.addFormItem)(comp, key, parent);
|
|
338
338
|
const slotKeys = ['prefix', 'suffix'];
|
|
339
|
-
utils_1.addDefaultSlot(slotKeys, comp);
|
|
339
|
+
(0, utils_1.addDefaultSlot)(slotKeys, comp);
|
|
340
340
|
const defaultData = {
|
|
341
341
|
name: {
|
|
342
342
|
value: 'uniqueFormKey',
|
|
@@ -377,7 +377,7 @@ function parseGsdKboneInput(comp, key, parent) {
|
|
|
377
377
|
type: 'slot',
|
|
378
378
|
},
|
|
379
379
|
};
|
|
380
|
-
utils_1.addDefaultData(defaultData, comp);
|
|
380
|
+
(0, utils_1.addDefaultData)(defaultData, comp);
|
|
381
381
|
const append = lodash_1.default.get(comp, 'properties.append');
|
|
382
382
|
if (append) {
|
|
383
383
|
lodash_1.default.set(comp, 'properties.suffix', append);
|
|
@@ -387,7 +387,7 @@ function parseGsdKboneInput(comp, key, parent) {
|
|
|
387
387
|
}
|
|
388
388
|
exports.parseGsdKboneInput = parseGsdKboneInput;
|
|
389
389
|
function parseGsdKboneSwitch(comp, key, parent) {
|
|
390
|
-
common_1.addFormItem(comp, key, parent, true);
|
|
390
|
+
(0, common_1.addFormItem)(comp, key, parent, true);
|
|
391
391
|
const defaultValue = lodash_1.default.get(comp, 'xProps.data.defaultValue');
|
|
392
392
|
defaultValue && lodash_1.default.set(comp, 'xProps.data.value', defaultValue);
|
|
393
393
|
const originStyle = lodash_1.default.get(comp, 'xProps.commonStyle.margin');
|
|
@@ -395,12 +395,12 @@ function parseGsdKboneSwitch(comp, key, parent) {
|
|
|
395
395
|
}
|
|
396
396
|
exports.parseGsdKboneSwitch = parseGsdKboneSwitch;
|
|
397
397
|
function parseGsdKbonePicker(comp, key, parent) {
|
|
398
|
-
common_1.addFormItem(comp, key, parent);
|
|
398
|
+
(0, common_1.addFormItem)(comp, key, parent);
|
|
399
399
|
comp.xComponent.name = 'Selector';
|
|
400
400
|
}
|
|
401
401
|
exports.parseGsdKbonePicker = parseGsdKbonePicker;
|
|
402
402
|
function parseGsdKboneDateTimePicker(comp, key, parent) {
|
|
403
|
-
common_1.addFormItem(comp, key, parent);
|
|
403
|
+
(0, common_1.addFormItem)(comp, key, parent);
|
|
404
404
|
const modeValue = lodash_1.default.get(comp, 'xProps.data.mode.value');
|
|
405
405
|
if (modeValue === 'date') {
|
|
406
406
|
comp.xComponent.name = 'Date';
|
|
@@ -411,7 +411,7 @@ function parseGsdKboneDateTimePicker(comp, key, parent) {
|
|
|
411
411
|
}
|
|
412
412
|
exports.parseGsdKboneDateTimePicker = parseGsdKboneDateTimePicker;
|
|
413
413
|
function parseGsdKboneUpload(comp, key, parent) {
|
|
414
|
-
common_1.addFormItem(comp, key, parent);
|
|
414
|
+
(0, common_1.addFormItem)(comp, key, parent);
|
|
415
415
|
comp.xComponent.name = 'Uploader';
|
|
416
416
|
const defaultData = {
|
|
417
417
|
name: {
|
|
@@ -454,7 +454,7 @@ function parseGsdKboneUpload(comp, key, parent) {
|
|
|
454
454
|
value: '',
|
|
455
455
|
},
|
|
456
456
|
};
|
|
457
|
-
utils_1.addDefaultData(defaultData, comp);
|
|
457
|
+
(0, utils_1.addDefaultData)(defaultData, comp);
|
|
458
458
|
}
|
|
459
459
|
exports.parseGsdKboneUpload = parseGsdKboneUpload;
|
|
460
460
|
function addFormWrapperComp(pageInstance) {
|
|
@@ -462,10 +462,10 @@ function addFormWrapperComp(pageInstance) {
|
|
|
462
462
|
const cloneTree = {
|
|
463
463
|
properties: componentInstances,
|
|
464
464
|
};
|
|
465
|
-
if (utils_1.checkIsNeedAddFormWrapper(cloneTree)) {
|
|
465
|
+
if ((0, utils_1.checkIsNeedAddFormWrapper)(cloneTree)) {
|
|
466
466
|
let listeners = [];
|
|
467
467
|
// 获取 Button 按钮事件,赋值到 Form 并删除按钮事件监听
|
|
468
|
-
utils_1.findComponentInTree(cloneTree, (_comp) => {
|
|
468
|
+
(0, utils_1.findComponentInTree)(cloneTree, (_comp) => {
|
|
469
469
|
let comp = _comp;
|
|
470
470
|
const { xComponent, xProps } = comp;
|
|
471
471
|
if (xComponent && xComponent.name === 'Button') {
|
|
@@ -483,7 +483,7 @@ function addFormWrapperComp(pageInstance) {
|
|
|
483
483
|
});
|
|
484
484
|
// @ts-ignore
|
|
485
485
|
pageInstance.componentInstances = {
|
|
486
|
-
[utils_1.getId()]: {
|
|
486
|
+
[(0, utils_1.getId)()]: {
|
|
487
487
|
xComponent: {
|
|
488
488
|
moduleName: 'gsd-h5-react',
|
|
489
489
|
name: 'Form',
|
|
@@ -536,7 +536,7 @@ function parseGsdKboneTabs(comp) {
|
|
|
536
536
|
Object.values(properties).forEach((pItem, idx) => {
|
|
537
537
|
const tabItem = tabItems[idx];
|
|
538
538
|
if (tabItem) {
|
|
539
|
-
newProperties[utils_1.getId()] = {
|
|
539
|
+
newProperties[(0, utils_1.getId)()] = {
|
|
540
540
|
xComponent: {
|
|
541
541
|
moduleName: 'CLOUDBASE_STANDARD',
|
|
542
542
|
name: 'TabPane',
|
|
@@ -580,7 +580,7 @@ function parseComplexComponentInstance(instance) {
|
|
|
580
580
|
const keys = Object.keys(componentInstances);
|
|
581
581
|
if (keys.length > 1) {
|
|
582
582
|
instance.componentInstances = {
|
|
583
|
-
[utils_1.getId()]: {
|
|
583
|
+
[(0, utils_1.getId)()]: {
|
|
584
584
|
xComponent: {
|
|
585
585
|
moduleName: 'gsd-h5-react',
|
|
586
586
|
name: 'Container',
|
|
@@ -73,7 +73,7 @@ function addDefaultData(defaultData, comp) {
|
|
|
73
73
|
// @ts-ignore
|
|
74
74
|
comp.xProps = comp.xProps || {};
|
|
75
75
|
comp.xProps.data = comp.xProps.data || {};
|
|
76
|
-
comp.xProps.data = lodash_1.merge(defaultData, comp.xProps.data);
|
|
76
|
+
comp.xProps.data = (0, lodash_1.merge)(defaultData, comp.xProps.data);
|
|
77
77
|
}
|
|
78
78
|
exports.addDefaultData = addDefaultData;
|
|
79
79
|
function isComplexJSON(json) {
|
|
@@ -34,7 +34,9 @@ export declare enum ActionType {
|
|
|
34
34
|
LifeCycle = "lifecycle",
|
|
35
35
|
PropEvent = "prop-event",
|
|
36
36
|
HandlerFn = "handler-fn",
|
|
37
|
-
Inline = "inline"
|
|
37
|
+
Inline = "inline",
|
|
38
|
+
Platform = "platform",
|
|
39
|
+
DataSource = "dataSource"
|
|
38
40
|
}
|
|
39
41
|
export interface IDynamicValue {
|
|
40
42
|
type: PropBindType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../parser/expression/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,IAAI,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../parser/expression/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,IAAI,EAA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AAM,GAAG,MAAM,CAAC,EAAE,CAAA;QACnC,KAAK,EAAE,MAAM,CAAA;QACb,QAAQ,EAAE,MAAM,CAAA;KACjB,EACD,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC;CAuB3B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DynamicValueParser = exports.parseMemberProperty = exports.PropBindType = exports.AST_TYPE = exports.PARSE_CONFIG = void 0;
|
|
3
|
+
exports.DynamicValueParser = exports.parseMemberProperty = exports.ActionType = exports.PropBindType = exports.AST_TYPE = exports.PARSE_CONFIG = void 0;
|
|
4
4
|
const acorn_1 = require("acorn");
|
|
5
5
|
exports.PARSE_CONFIG = {
|
|
6
6
|
ecmaVersion: 6,
|
|
@@ -38,6 +38,18 @@ var PropBindType;
|
|
|
38
38
|
PropBindType["stateData"] = "state";
|
|
39
39
|
PropBindType["paramData"] = "params";
|
|
40
40
|
})(PropBindType = exports.PropBindType || (exports.PropBindType = {}));
|
|
41
|
+
var ActionType;
|
|
42
|
+
(function (ActionType) {
|
|
43
|
+
ActionType["Rematch"] = "rematch";
|
|
44
|
+
ActionType["Material"] = "material";
|
|
45
|
+
ActionType["GeneralFunc"] = "general-func";
|
|
46
|
+
ActionType["LifeCycle"] = "lifecycle";
|
|
47
|
+
ActionType["PropEvent"] = "prop-event";
|
|
48
|
+
ActionType["HandlerFn"] = "handler-fn";
|
|
49
|
+
ActionType["Inline"] = "inline";
|
|
50
|
+
ActionType["Platform"] = "platform";
|
|
51
|
+
ActionType["DataSource"] = "dataSource";
|
|
52
|
+
})(ActionType = exports.ActionType || (exports.ActionType = {}));
|
|
41
53
|
class ParseError extends Error {
|
|
42
54
|
constructor(error) {
|
|
43
55
|
super(error.message);
|
|
@@ -101,7 +113,7 @@ class DynamicValueParser {
|
|
|
101
113
|
constructor(expressionString, options) {
|
|
102
114
|
this.expressionString = expressionString;
|
|
103
115
|
this.options = Object.assign(Object.assign({}, options), { type: PropBindType.expression, value: this.expressionString });
|
|
104
|
-
let ast = acorn_1.parse(this.expressionString, exports.PARSE_CONFIG);
|
|
116
|
+
let ast = (0, acorn_1.parse)(this.expressionString, exports.PARSE_CONFIG);
|
|
105
117
|
let { expression } = ast.body[0];
|
|
106
118
|
this.expression = expression;
|
|
107
119
|
}
|
|
@@ -168,7 +180,6 @@ class DynamicValueParser {
|
|
|
168
180
|
switch (memberProperty[1]) {
|
|
169
181
|
case 'dataset': {
|
|
170
182
|
return this.parseDataset(expression, meta, options);
|
|
171
|
-
break;
|
|
172
183
|
}
|
|
173
184
|
case 'state':
|
|
174
185
|
case 'computed':
|
|
@@ -189,7 +200,6 @@ class DynamicValueParser {
|
|
|
189
200
|
throw new ParseError({ expression });
|
|
190
201
|
}
|
|
191
202
|
}
|
|
192
|
-
break;
|
|
193
203
|
}
|
|
194
204
|
case '$app': {
|
|
195
205
|
meta.index = 1;
|
|
@@ -197,7 +207,6 @@ class DynamicValueParser {
|
|
|
197
207
|
switch (memberProperty[1]) {
|
|
198
208
|
case 'dataset': {
|
|
199
209
|
return this.parseDataset(expression, meta, options);
|
|
200
|
-
break;
|
|
201
210
|
}
|
|
202
211
|
case 'state':
|
|
203
212
|
case 'computed':
|
package/lib/parser/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export
|
|
2
|
-
deserializeComponentLibraryMeta, } from './cals/index';
|
|
1
|
+
export * from './cals/index';
|
|
3
2
|
export { upgrageToVersion2 } from './cals/utils/version';
|
|
4
3
|
export { processComponentModule } from './cals/utils/spinoff';
|
|
4
|
+
export { parseComponentCals } from './cals/utils/block';
|
|
5
|
+
export { ActionType, IDataBind, PropBindType } from './expression/index';
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../parser/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../parser/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA"}
|
package/lib/parser/index.js
CHANGED
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
2
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "serializePlatformApp", { enumerable: true, get: function () { return index_1.serializePlatformApp; } });
|
|
6
|
-
Object.defineProperty(exports, "deserializePlatformApp", { enumerable: true, get: function () { return index_1.deserializePlatformApp; } });
|
|
7
|
-
Object.defineProperty(exports, "serializeComponent", { enumerable: true, get: function () { return index_1.serializeComponent; } });
|
|
8
|
-
Object.defineProperty(exports, "deserializeComponent", { enumerable: true, get: function () { return index_1.deserializeComponent; } });
|
|
9
|
-
Object.defineProperty(exports, "serializePage", { enumerable: true, get: function () { return index_1.serializePage; } });
|
|
10
|
-
Object.defineProperty(exports, "deserializePage", { enumerable: true, get: function () { return index_1.deserializePage; } });
|
|
11
|
-
Object.defineProperty(exports, "serializeRuntimePage", { enumerable: true, get: function () { return index_1.serializeRuntimePage; } });
|
|
12
|
-
// deserializeRuntimePage,
|
|
13
|
-
Object.defineProperty(exports, "serializeRuntimeComponent", { enumerable: true, get: function () { return index_1.serializeRuntimeComponent; } });
|
|
14
|
-
Object.defineProperty(exports, "deserializeComponentLibraryMeta", { enumerable: true, get: function () { return index_1.deserializeComponentLibraryMeta; } });
|
|
13
|
+
exports.PropBindType = exports.ActionType = exports.parseComponentCals = exports.processComponentModule = exports.upgrageToVersion2 = void 0;
|
|
14
|
+
__exportStar(require("./cals/index"), exports);
|
|
15
15
|
var version_1 = require("./cals/utils/version");
|
|
16
16
|
Object.defineProperty(exports, "upgrageToVersion2", { enumerable: true, get: function () { return version_1.upgrageToVersion2; } });
|
|
17
17
|
var spinoff_1 = require("./cals/utils/spinoff");
|
|
18
18
|
Object.defineProperty(exports, "processComponentModule", { enumerable: true, get: function () { return spinoff_1.processComponentModule; } });
|
|
19
|
+
var block_1 = require("./cals/utils/block");
|
|
20
|
+
Object.defineProperty(exports, "parseComponentCals", { enumerable: true, get: function () { return block_1.parseComponentCals; } });
|
|
21
|
+
var index_1 = require("./expression/index");
|
|
22
|
+
Object.defineProperty(exports, "ActionType", { enumerable: true, get: function () { return index_1.ActionType; } });
|
|
23
|
+
Object.defineProperty(exports, "PropBindType", { enumerable: true, get: function () { return index_1.PropBindType; } });
|