mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-12 17:08:14 +00:00
add assets
This commit is contained in:
parent
6fc9485c7c
commit
944da40213
File diff suppressed because it is too large
Load Diff
@ -2,8 +2,7 @@
|
||||
"componentName": "Page",
|
||||
"fileName": "test",
|
||||
"dataSource": {
|
||||
"list": [],
|
||||
"online": []
|
||||
"list": []
|
||||
},
|
||||
"state": {
|
||||
"text": "outter"
|
||||
@ -15,5 +14,97 @@
|
||||
"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') {
|
||||
setter = setter.props.setters[0];
|
||||
} 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)) {
|
||||
|
||||
@ -32,9 +32,11 @@ function propTypeToSetter(propType: PropType): SetterType {
|
||||
let isRequired: boolean | undefined = false;
|
||||
if (typeof propType === 'string') {
|
||||
typeName = propType;
|
||||
} else {
|
||||
} else if (typeof propType === 'object'){
|
||||
typeName = propType.type;
|
||||
isRequired = propType.isRequired;
|
||||
} else {
|
||||
typeName = 'string';
|
||||
}
|
||||
// TODO: use mixinSetter wrapper
|
||||
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 fs from 'fs';
|
||||
import { IMaterializeOptions } from '../src/types';
|
||||
import { getFromFixtures } from './helpers';
|
||||
|
||||
const multiExportedComptPath = getFromFixtures('multiple-exported-component');
|
||||
const singleExportedComptPath = getFromFixtures('single-exported-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 => {
|
||||
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 => {
|
||||
async function generate() {
|
||||
const options: IMaterializeOptions = {
|
||||
entry: fusionComptPath,
|
||||
accesser: 'local',
|
||||
};
|
||||
|
||||
const actual = await parse(options);
|
||||
fs.writeFileSync('configure.json', JSON.stringify(actual, null, 2));
|
||||
console.log(actual);
|
||||
}
|
||||
|
||||
t.snapshot(actual);
|
||||
});
|
||||
|
||||
test('antd component by local', async t => {
|
||||
const options: IMaterializeOptions = {
|
||||
entry: antdComptPath,
|
||||
accesser: 'local',
|
||||
};
|
||||
|
||||
const actual = await parse(options);
|
||||
|
||||
t.snapshot(actual);
|
||||
});
|
||||
generate();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user