mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-16 11:54:27 +00:00
add assets
This commit is contained in:
parent
d3fa0ea9a4
commit
a212480d62
File diff suppressed because it is too large
Load Diff
@ -2,8 +2,7 @@
|
|||||||
"componentName": "Page",
|
"componentName": "Page",
|
||||||
"fileName": "test",
|
"fileName": "test",
|
||||||
"dataSource": {
|
"dataSource": {
|
||||||
"list": [],
|
"list": []
|
||||||
"online": []
|
|
||||||
},
|
},
|
||||||
"state": {
|
"state": {
|
||||||
"text": "outter"
|
"text": "outter"
|
||||||
@ -15,5 +14,97 @@
|
|||||||
"padding": 20
|
"padding": 20
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"children": []
|
"children": [{
|
||||||
|
"componentName": "Form",
|
||||||
|
"props": {
|
||||||
|
"labelCol": 3,
|
||||||
|
"style": {},
|
||||||
|
"ref": "testForm"
|
||||||
|
},
|
||||||
|
"children": [{
|
||||||
|
"componentName": "Form.Item",
|
||||||
|
"props": {
|
||||||
|
"label": "姓名:",
|
||||||
|
"name": "name",
|
||||||
|
"initValue": "李雷"
|
||||||
|
},
|
||||||
|
"children": [{
|
||||||
|
"componentName": "Input",
|
||||||
|
"props": {
|
||||||
|
"placeholder": "请输入",
|
||||||
|
"size": "medium",
|
||||||
|
"style": {
|
||||||
|
"width": 320
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}, {
|
||||||
|
"componentName": "Form.Item",
|
||||||
|
"props": {
|
||||||
|
"label": "年龄:",
|
||||||
|
"name": "age",
|
||||||
|
"initValue": "22"
|
||||||
|
},
|
||||||
|
"children": [{
|
||||||
|
"componentName": "NumberPicker",
|
||||||
|
"props": {
|
||||||
|
"size": "medium",
|
||||||
|
"type": "normal"
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}, {
|
||||||
|
"componentName": "Form.Item",
|
||||||
|
"props": {
|
||||||
|
"label": "职业:",
|
||||||
|
"name": "profession"
|
||||||
|
},
|
||||||
|
"children": [{
|
||||||
|
"componentName": "Select",
|
||||||
|
"props": {
|
||||||
|
"dataSource": [{
|
||||||
|
"label": "教师",
|
||||||
|
"value": "t"
|
||||||
|
}, {
|
||||||
|
"label": "医生",
|
||||||
|
"value": "d"
|
||||||
|
}, {
|
||||||
|
"label": "歌手",
|
||||||
|
"value": "s"
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}, {
|
||||||
|
"componentName": "Div",
|
||||||
|
"props": {
|
||||||
|
"style": {
|
||||||
|
"textAlign": "center"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"children": [{
|
||||||
|
"componentName": "Button.Group",
|
||||||
|
"props": {},
|
||||||
|
"children": [{
|
||||||
|
"componentName": "Button",
|
||||||
|
"props": {
|
||||||
|
"type": "primary",
|
||||||
|
"style": {
|
||||||
|
"margin": "0 5px 0 5px"
|
||||||
|
},
|
||||||
|
"htmlType": "submit"
|
||||||
|
},
|
||||||
|
"children": "提交"
|
||||||
|
}, {
|
||||||
|
"componentName": "Button",
|
||||||
|
"props": {
|
||||||
|
"type": "normal",
|
||||||
|
"style": {
|
||||||
|
"margin": "0 5px 0 5px"
|
||||||
|
},
|
||||||
|
"htmlType": "reset"
|
||||||
|
},
|
||||||
|
"children": "重置"
|
||||||
|
}]
|
||||||
|
}]
|
||||||
|
}]
|
||||||
|
}]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,7 +39,7 @@ export class Transducer {
|
|||||||
} else if (isValidElement(setter) && setter.type.displayName === 'MixedSetter') {
|
} else if (isValidElement(setter) && setter.type.displayName === 'MixedSetter') {
|
||||||
setter = setter.props.setters[0];
|
setter = setter.props.setters[0];
|
||||||
} else if (typeof setter === 'object' && setter.componentName === 'MixedSetter') {
|
} else if (typeof setter === 'object' && setter.componentName === 'MixedSetter') {
|
||||||
setter = setter.props.setters[0];
|
setter = setter && setter.props && setter.props.setters && Array.isArray(setter.props.setters) && setter.props.setters[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isSetterConfig(setter)) {
|
if (isSetterConfig(setter)) {
|
||||||
|
|||||||
@ -32,9 +32,11 @@ function propTypeToSetter(propType: PropType): SetterType {
|
|||||||
let isRequired: boolean | undefined = false;
|
let isRequired: boolean | undefined = false;
|
||||||
if (typeof propType === 'string') {
|
if (typeof propType === 'string') {
|
||||||
typeName = propType;
|
typeName = propType;
|
||||||
} else {
|
} else if (typeof propType === 'object'){
|
||||||
typeName = propType.type;
|
typeName = propType.type;
|
||||||
isRequired = propType.isRequired;
|
isRequired = propType.isRequired;
|
||||||
|
} else {
|
||||||
|
typeName = 'string';
|
||||||
}
|
}
|
||||||
// TODO: use mixinSetter wrapper
|
// TODO: use mixinSetter wrapper
|
||||||
switch (typeName) {
|
switch (typeName) {
|
||||||
|
|||||||
13089
packages/material-parser/test/configure.json
Normal file
13089
packages/material-parser/test/configure.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,89 +1,19 @@
|
|||||||
import test from 'ava';
|
|
||||||
import parse from '../src';
|
import parse from '../src';
|
||||||
|
import fs from 'fs';
|
||||||
import { IMaterializeOptions } from '../src/types';
|
import { IMaterializeOptions } from '../src/types';
|
||||||
import { getFromFixtures } from './helpers';
|
import { getFromFixtures } from './helpers';
|
||||||
|
|
||||||
const multiExportedComptPath = getFromFixtures('multiple-exported-component');
|
|
||||||
const singleExportedComptPath = getFromFixtures('single-exported-component');
|
|
||||||
const fusionComptPath = getFromFixtures('fusion-next-component');
|
const fusionComptPath = getFromFixtures('fusion-next-component');
|
||||||
const antdComptPath = getFromFixtures('antd-component');
|
|
||||||
const singleExportedComponent = '@ali/demo-biz-test090702@0.0.2';
|
|
||||||
const multipleExportedComponent = '@ali/aimake-basic@0.1.0';
|
|
||||||
const tsComponent = getFromFixtures('ts-component');
|
|
||||||
|
|
||||||
test('materialize single exported component by local', async t => {
|
async function generate() {
|
||||||
const options: IMaterializeOptions = {
|
|
||||||
entry: singleExportedComptPath,
|
|
||||||
accesser: 'local',
|
|
||||||
};
|
|
||||||
|
|
||||||
const actual = await parse(options);
|
|
||||||
|
|
||||||
t.snapshot(actual);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('materialize multiple exported component by local', async t => {
|
|
||||||
const options: IMaterializeOptions = {
|
|
||||||
entry: multiExportedComptPath,
|
|
||||||
accesser: 'local',
|
|
||||||
};
|
|
||||||
|
|
||||||
const actual = await parse(options);
|
|
||||||
|
|
||||||
t.snapshot(actual);
|
|
||||||
});
|
|
||||||
|
|
||||||
test.skip('materialize single exported component by online', async t => {
|
|
||||||
const options: IMaterializeOptions = {
|
|
||||||
entry: singleExportedComponent,
|
|
||||||
accesser: 'online',
|
|
||||||
};
|
|
||||||
|
|
||||||
const actual = await parse(options);
|
|
||||||
|
|
||||||
t.snapshot(actual);
|
|
||||||
});
|
|
||||||
|
|
||||||
test.skip('materialize multiple exported component by online', async t => {
|
|
||||||
const options: IMaterializeOptions = {
|
|
||||||
entry: multipleExportedComponent,
|
|
||||||
accesser: 'online',
|
|
||||||
};
|
|
||||||
|
|
||||||
const actual = await parse(options);
|
|
||||||
|
|
||||||
t.snapshot(actual);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('ts component by local', async t => {
|
|
||||||
const options: IMaterializeOptions = {
|
|
||||||
entry: tsComponent,
|
|
||||||
accesser: 'local',
|
|
||||||
};
|
|
||||||
|
|
||||||
const actual = await parse(options);
|
|
||||||
|
|
||||||
t.snapshot(actual);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('fusion next component by local', async t => {
|
|
||||||
const options: IMaterializeOptions = {
|
const options: IMaterializeOptions = {
|
||||||
entry: fusionComptPath,
|
entry: fusionComptPath,
|
||||||
accesser: 'local',
|
accesser: 'local',
|
||||||
};
|
};
|
||||||
|
|
||||||
const actual = await parse(options);
|
const actual = await parse(options);
|
||||||
|
fs.writeFileSync('configure.json', JSON.stringify(actual, null, 2));
|
||||||
|
console.log(actual);
|
||||||
|
}
|
||||||
|
|
||||||
t.snapshot(actual);
|
generate();
|
||||||
});
|
|
||||||
|
|
||||||
test('antd component by local', async t => {
|
|
||||||
const options: IMaterializeOptions = {
|
|
||||||
entry: antdComptPath,
|
|
||||||
accesser: 'local',
|
|
||||||
};
|
|
||||||
|
|
||||||
const actual = await parse(options);
|
|
||||||
|
|
||||||
t.snapshot(actual);
|
|
||||||
});
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user