mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-14 04:43:14 +00:00
fix: 🐛 fix bug of transforming type
This commit is contained in:
parent
6e661686e4
commit
ebbe58df70
@ -17,38 +17,47 @@ import BaseParser from './BaseParser';
|
||||
const log = debug.extend('mat');
|
||||
const parser = buildParser();
|
||||
|
||||
function transformType(item: any): any {
|
||||
switch (typeof item) {
|
||||
case 'string':
|
||||
return {
|
||||
propType: item,
|
||||
};
|
||||
case 'object':
|
||||
if (Array.isArray(item)) {
|
||||
return item.map(transformType);
|
||||
} else if (Object.keys(item).length === 1 && item.name) {
|
||||
return {
|
||||
propType: item.name,
|
||||
};
|
||||
} else if (item.name === 'shape' || item.name === 'exact') {
|
||||
return {
|
||||
propType: item.name,
|
||||
value: Object.keys(item.value).map(name => {
|
||||
return {
|
||||
name,
|
||||
...transformType(item.value[name]),
|
||||
};
|
||||
}),
|
||||
};
|
||||
} else if (item.name === 'enum') {
|
||||
return item.value.map((x: any) => x.value);
|
||||
} else {
|
||||
return {
|
||||
propType: item.name,
|
||||
isRequired: item.required,
|
||||
};
|
||||
}
|
||||
function transformType(type: any): any {
|
||||
const { name, value, computed, required } = type;
|
||||
if (!value && !required) {
|
||||
return name;
|
||||
}
|
||||
if (computed !== undefined && value) {
|
||||
// tslint:disable-next-line:no-eval
|
||||
return eval(value);
|
||||
}
|
||||
const result: any = {
|
||||
type: name,
|
||||
};
|
||||
if (required) {
|
||||
result.isRequired = required;
|
||||
}
|
||||
if (Array.isArray(value)) {
|
||||
if (name === 'enum') {
|
||||
result.type = 'oneOf';
|
||||
}
|
||||
result.value = value.map(transformType);
|
||||
} else if (typeof value === 'object') {
|
||||
if (name === 'objectOf' || name === 'arrayOf' || name === 'instanceOf') {
|
||||
result.value = transformType(value);
|
||||
} else {
|
||||
result.value = Object.keys(value).map((n: string) => {
|
||||
return transformItem(n, value[n]);
|
||||
});
|
||||
}
|
||||
} else if (value !== undefined) {
|
||||
result.value = value;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function transformItem(name: string, item: any): any {
|
||||
const result: any = {
|
||||
name,
|
||||
propType: transformType(item),
|
||||
};
|
||||
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* 解析 react 生态下的组件
|
||||
@ -120,10 +129,14 @@ class ReactParser extends BaseParser {
|
||||
}
|
||||
|
||||
public static parseProperties(objectPath: any): IPropTypes {
|
||||
const results: IPropTypes = objectPath.get('properties').map((p: any) => ({
|
||||
name: p.get('key').node.name,
|
||||
...transformType(ReactDocUtils.getPropType(p.get('value'))),
|
||||
}));
|
||||
const results: IPropTypes = objectPath
|
||||
.get('properties')
|
||||
.map((p: any) =>
|
||||
transformItem(
|
||||
p.get('key').node.name,
|
||||
ReactDocUtils.getPropType(p.get('value')),
|
||||
),
|
||||
);
|
||||
// console.log(JSON.stringify(results, null, 2));
|
||||
// objectPath.node.properties.forEach((prop: any) => {
|
||||
// if (t.isProperty(prop)) {
|
||||
@ -239,7 +252,7 @@ class ReactParser extends BaseParser {
|
||||
path.node.expression.left.object.name === defaultExportName &&
|
||||
['propTypes'].includes(path.node.expression.left.property.name)
|
||||
) {
|
||||
debugger;
|
||||
// debugger;
|
||||
// 处理 propTypes
|
||||
results.push(
|
||||
// @ts-ignore
|
||||
|
||||
@ -25,9 +25,17 @@ Generated by [AVA](https://avajs.dev).
|
||||
},
|
||||
props: [
|
||||
{
|
||||
isRequired: undefined,
|
||||
name: 'children',
|
||||
propType: 'union',
|
||||
propType: {
|
||||
type: 'union',
|
||||
value: [
|
||||
{
|
||||
type: 'arrayOf',
|
||||
value: 'node',
|
||||
},
|
||||
'node',
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'styleBoxModel',
|
||||
@ -82,9 +90,17 @@ Generated by [AVA](https://avajs.dev).
|
||||
propType: 'string',
|
||||
},
|
||||
{
|
||||
isRequired: undefined,
|
||||
name: 'children',
|
||||
propType: 'union',
|
||||
propType: {
|
||||
type: 'union',
|
||||
value: [
|
||||
{
|
||||
type: 'arrayOf',
|
||||
value: 'node',
|
||||
},
|
||||
'node',
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'styleBoxModel',
|
||||
@ -151,9 +167,17 @@ Generated by [AVA](https://avajs.dev).
|
||||
},
|
||||
props: [
|
||||
{
|
||||
isRequired: undefined,
|
||||
name: 'children',
|
||||
propType: 'union',
|
||||
propType: {
|
||||
type: 'union',
|
||||
value: [
|
||||
{
|
||||
type: 'arrayOf',
|
||||
value: 'node',
|
||||
},
|
||||
'node',
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'styleBoxModel',
|
||||
@ -196,9 +220,17 @@ Generated by [AVA](https://avajs.dev).
|
||||
},
|
||||
props: [
|
||||
{
|
||||
isRequired: undefined,
|
||||
name: 'children',
|
||||
propType: 'union',
|
||||
propType: {
|
||||
type: 'union',
|
||||
value: [
|
||||
{
|
||||
type: 'arrayOf',
|
||||
value: 'node',
|
||||
},
|
||||
'node',
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'styleBoxModel',
|
||||
@ -233,9 +265,18 @@ Generated by [AVA](https://avajs.dev).
|
||||
},
|
||||
props: [
|
||||
{
|
||||
isRequired: undefined,
|
||||
name: 'children',
|
||||
propType: 'union',
|
||||
propType: {
|
||||
type: 'union',
|
||||
value: [
|
||||
{
|
||||
type: 'arrayOf',
|
||||
value: 'node',
|
||||
},
|
||||
'node',
|
||||
'string',
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'type',
|
||||
@ -286,9 +327,17 @@ Generated by [AVA](https://avajs.dev).
|
||||
propType: 'object',
|
||||
},
|
||||
{
|
||||
isRequired: undefined,
|
||||
name: 'children',
|
||||
propType: 'union',
|
||||
propType: {
|
||||
type: 'union',
|
||||
value: [
|
||||
'element',
|
||||
{
|
||||
type: 'arrayOf',
|
||||
value: 'element',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
screenshot: '',
|
||||
@ -358,77 +407,106 @@ Generated by [AVA](https://avajs.dev).
|
||||
propType: 'elementType',
|
||||
},
|
||||
{
|
||||
isRequired: undefined,
|
||||
name: 'optionalMessage',
|
||||
propType: 'instanceOf',
|
||||
propType: {
|
||||
type: 'instanceOf',
|
||||
value: 'Demo',
|
||||
},
|
||||
},
|
||||
{
|
||||
0: '\'News\'',
|
||||
1: '\'Photos\'',
|
||||
name: 'optionalEnum',
|
||||
propType: {
|
||||
type: 'oneOf',
|
||||
value: [
|
||||
'News',
|
||||
'Photos',
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
isRequired: undefined,
|
||||
name: 'optionalUnion',
|
||||
propType: 'union',
|
||||
propType: {
|
||||
type: 'union',
|
||||
value: [
|
||||
'string',
|
||||
'number',
|
||||
{
|
||||
type: 'instanceOf',
|
||||
value: 'Demo',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
isRequired: undefined,
|
||||
name: 'optionalArrayOf',
|
||||
propType: 'arrayOf',
|
||||
propType: {
|
||||
type: 'arrayOf',
|
||||
value: 'number',
|
||||
},
|
||||
},
|
||||
{
|
||||
isRequired: undefined,
|
||||
name: 'optionalObjectOf',
|
||||
propType: 'objectOf',
|
||||
propType: {
|
||||
type: 'objectOf',
|
||||
value: 'number',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'optionalObjectWithShape',
|
||||
propType: 'shape',
|
||||
value: [
|
||||
{
|
||||
isRequired: false,
|
||||
name: 'optionalProperty',
|
||||
propType: 'string',
|
||||
},
|
||||
{
|
||||
isRequired: true,
|
||||
name: 'requiredProperty',
|
||||
propType: 'number',
|
||||
},
|
||||
],
|
||||
propType: {
|
||||
type: 'shape',
|
||||
value: [
|
||||
{
|
||||
name: 'optionalProperty',
|
||||
propType: 'string',
|
||||
},
|
||||
{
|
||||
name: 'requiredProperty',
|
||||
propType: {
|
||||
isRequired: true,
|
||||
type: 'number',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'optionalObjectWithShape2',
|
||||
propType: 'shape',
|
||||
value: [
|
||||
{
|
||||
isRequired: false,
|
||||
name: 'optionalProperty',
|
||||
propType: 'string',
|
||||
},
|
||||
{
|
||||
isRequired: true,
|
||||
name: 'requiredProperty',
|
||||
propType: 'number',
|
||||
},
|
||||
],
|
||||
propType: {
|
||||
type: 'shape',
|
||||
value: [
|
||||
{
|
||||
name: 'optionalProperty',
|
||||
propType: 'string',
|
||||
},
|
||||
{
|
||||
name: 'requiredProperty',
|
||||
propType: {
|
||||
isRequired: true,
|
||||
type: 'number',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'optionalObjectWithStrictShape',
|
||||
propType: 'exact',
|
||||
value: [
|
||||
{
|
||||
isRequired: false,
|
||||
name: 'optionalProperty',
|
||||
propType: 'string',
|
||||
},
|
||||
{
|
||||
isRequired: true,
|
||||
name: 'requiredProperty',
|
||||
propType: 'number',
|
||||
},
|
||||
],
|
||||
propType: {
|
||||
type: 'exact',
|
||||
value: [
|
||||
{
|
||||
name: 'optionalProperty',
|
||||
propType: 'string',
|
||||
},
|
||||
{
|
||||
name: 'requiredProperty',
|
||||
propType: {
|
||||
isRequired: true,
|
||||
type: 'number',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'requiredFunc',
|
||||
|
||||
Binary file not shown.
@ -25,9 +25,17 @@ Generated by [AVA](https://avajs.dev).
|
||||
},
|
||||
props: [
|
||||
{
|
||||
isRequired: undefined,
|
||||
name: 'children',
|
||||
propType: 'union',
|
||||
propType: {
|
||||
type: 'union',
|
||||
value: [
|
||||
{
|
||||
type: 'arrayOf',
|
||||
value: 'node',
|
||||
},
|
||||
'node',
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'styleBoxModel',
|
||||
@ -82,9 +90,17 @@ Generated by [AVA](https://avajs.dev).
|
||||
propType: 'string',
|
||||
},
|
||||
{
|
||||
isRequired: undefined,
|
||||
name: 'children',
|
||||
propType: 'union',
|
||||
propType: {
|
||||
type: 'union',
|
||||
value: [
|
||||
{
|
||||
type: 'arrayOf',
|
||||
value: 'node',
|
||||
},
|
||||
'node',
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'styleBoxModel',
|
||||
@ -151,9 +167,17 @@ Generated by [AVA](https://avajs.dev).
|
||||
},
|
||||
props: [
|
||||
{
|
||||
isRequired: undefined,
|
||||
name: 'children',
|
||||
propType: 'union',
|
||||
propType: {
|
||||
type: 'union',
|
||||
value: [
|
||||
{
|
||||
type: 'arrayOf',
|
||||
value: 'node',
|
||||
},
|
||||
'node',
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'styleBoxModel',
|
||||
@ -196,9 +220,17 @@ Generated by [AVA](https://avajs.dev).
|
||||
},
|
||||
props: [
|
||||
{
|
||||
isRequired: undefined,
|
||||
name: 'children',
|
||||
propType: 'union',
|
||||
propType: {
|
||||
type: 'union',
|
||||
value: [
|
||||
{
|
||||
type: 'arrayOf',
|
||||
value: 'node',
|
||||
},
|
||||
'node',
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'styleBoxModel',
|
||||
@ -233,9 +265,18 @@ Generated by [AVA](https://avajs.dev).
|
||||
},
|
||||
props: [
|
||||
{
|
||||
isRequired: undefined,
|
||||
name: 'children',
|
||||
propType: 'union',
|
||||
propType: {
|
||||
type: 'union',
|
||||
value: [
|
||||
{
|
||||
type: 'arrayOf',
|
||||
value: 'node',
|
||||
},
|
||||
'node',
|
||||
'string',
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'type',
|
||||
@ -286,9 +327,17 @@ Generated by [AVA](https://avajs.dev).
|
||||
propType: 'object',
|
||||
},
|
||||
{
|
||||
isRequired: undefined,
|
||||
name: 'children',
|
||||
propType: 'union',
|
||||
propType: {
|
||||
type: 'union',
|
||||
value: [
|
||||
'element',
|
||||
{
|
||||
type: 'arrayOf',
|
||||
value: 'element',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
screenshot: '',
|
||||
@ -358,77 +407,106 @@ Generated by [AVA](https://avajs.dev).
|
||||
propType: 'elementType',
|
||||
},
|
||||
{
|
||||
isRequired: undefined,
|
||||
name: 'optionalMessage',
|
||||
propType: 'instanceOf',
|
||||
propType: {
|
||||
type: 'instanceOf',
|
||||
value: 'Demo',
|
||||
},
|
||||
},
|
||||
{
|
||||
0: '\'News\'',
|
||||
1: '\'Photos\'',
|
||||
name: 'optionalEnum',
|
||||
propType: {
|
||||
type: 'oneOf',
|
||||
value: [
|
||||
'News',
|
||||
'Photos',
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
isRequired: undefined,
|
||||
name: 'optionalUnion',
|
||||
propType: 'union',
|
||||
propType: {
|
||||
type: 'union',
|
||||
value: [
|
||||
'string',
|
||||
'number',
|
||||
{
|
||||
type: 'instanceOf',
|
||||
value: 'Demo',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
isRequired: undefined,
|
||||
name: 'optionalArrayOf',
|
||||
propType: 'arrayOf',
|
||||
propType: {
|
||||
type: 'arrayOf',
|
||||
value: 'number',
|
||||
},
|
||||
},
|
||||
{
|
||||
isRequired: undefined,
|
||||
name: 'optionalObjectOf',
|
||||
propType: 'objectOf',
|
||||
propType: {
|
||||
type: 'objectOf',
|
||||
value: 'number',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'optionalObjectWithShape',
|
||||
propType: 'shape',
|
||||
value: [
|
||||
{
|
||||
isRequired: false,
|
||||
name: 'optionalProperty',
|
||||
propType: 'string',
|
||||
},
|
||||
{
|
||||
isRequired: true,
|
||||
name: 'requiredProperty',
|
||||
propType: 'number',
|
||||
},
|
||||
],
|
||||
propType: {
|
||||
type: 'shape',
|
||||
value: [
|
||||
{
|
||||
name: 'optionalProperty',
|
||||
propType: 'string',
|
||||
},
|
||||
{
|
||||
name: 'requiredProperty',
|
||||
propType: {
|
||||
isRequired: true,
|
||||
type: 'number',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'optionalObjectWithShape2',
|
||||
propType: 'shape',
|
||||
value: [
|
||||
{
|
||||
isRequired: false,
|
||||
name: 'optionalProperty',
|
||||
propType: 'string',
|
||||
},
|
||||
{
|
||||
isRequired: true,
|
||||
name: 'requiredProperty',
|
||||
propType: 'number',
|
||||
},
|
||||
],
|
||||
propType: {
|
||||
type: 'shape',
|
||||
value: [
|
||||
{
|
||||
name: 'optionalProperty',
|
||||
propType: 'string',
|
||||
},
|
||||
{
|
||||
name: 'requiredProperty',
|
||||
propType: {
|
||||
isRequired: true,
|
||||
type: 'number',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'optionalObjectWithStrictShape',
|
||||
propType: 'exact',
|
||||
value: [
|
||||
{
|
||||
isRequired: false,
|
||||
name: 'optionalProperty',
|
||||
propType: 'string',
|
||||
},
|
||||
{
|
||||
isRequired: true,
|
||||
name: 'requiredProperty',
|
||||
propType: 'number',
|
||||
},
|
||||
],
|
||||
propType: {
|
||||
type: 'exact',
|
||||
value: [
|
||||
{
|
||||
name: 'optionalProperty',
|
||||
propType: 'string',
|
||||
},
|
||||
{
|
||||
name: 'requiredProperty',
|
||||
propType: {
|
||||
isRequired: true,
|
||||
type: 'number',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'requiredFunc',
|
||||
|
||||
Binary file not shown.
@ -65,77 +65,106 @@ Generated by [AVA](https://avajs.dev).
|
||||
propType: 'elementType',
|
||||
},
|
||||
{
|
||||
isRequired: undefined,
|
||||
name: 'optionalMessage',
|
||||
propType: 'instanceOf',
|
||||
propType: {
|
||||
type: 'instanceOf',
|
||||
value: 'Demo',
|
||||
},
|
||||
},
|
||||
{
|
||||
0: '\'News\'',
|
||||
1: '\'Photos\'',
|
||||
name: 'optionalEnum',
|
||||
propType: {
|
||||
type: 'oneOf',
|
||||
value: [
|
||||
'News',
|
||||
'Photos',
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
isRequired: undefined,
|
||||
name: 'optionalUnion',
|
||||
propType: 'union',
|
||||
propType: {
|
||||
type: 'union',
|
||||
value: [
|
||||
'string',
|
||||
'number',
|
||||
{
|
||||
type: 'instanceOf',
|
||||
value: 'Demo',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
isRequired: undefined,
|
||||
name: 'optionalArrayOf',
|
||||
propType: 'arrayOf',
|
||||
propType: {
|
||||
type: 'arrayOf',
|
||||
value: 'number',
|
||||
},
|
||||
},
|
||||
{
|
||||
isRequired: undefined,
|
||||
name: 'optionalObjectOf',
|
||||
propType: 'objectOf',
|
||||
propType: {
|
||||
type: 'objectOf',
|
||||
value: 'number',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'optionalObjectWithShape',
|
||||
propType: 'shape',
|
||||
value: [
|
||||
{
|
||||
isRequired: false,
|
||||
name: 'optionalProperty',
|
||||
propType: 'string',
|
||||
},
|
||||
{
|
||||
isRequired: true,
|
||||
name: 'requiredProperty',
|
||||
propType: 'number',
|
||||
},
|
||||
],
|
||||
propType: {
|
||||
type: 'shape',
|
||||
value: [
|
||||
{
|
||||
name: 'optionalProperty',
|
||||
propType: 'string',
|
||||
},
|
||||
{
|
||||
name: 'requiredProperty',
|
||||
propType: {
|
||||
isRequired: true,
|
||||
type: 'number',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'optionalObjectWithShape2',
|
||||
propType: 'shape',
|
||||
value: [
|
||||
{
|
||||
isRequired: false,
|
||||
name: 'optionalProperty',
|
||||
propType: 'string',
|
||||
},
|
||||
{
|
||||
isRequired: true,
|
||||
name: 'requiredProperty',
|
||||
propType: 'number',
|
||||
},
|
||||
],
|
||||
propType: {
|
||||
type: 'shape',
|
||||
value: [
|
||||
{
|
||||
name: 'optionalProperty',
|
||||
propType: 'string',
|
||||
},
|
||||
{
|
||||
name: 'requiredProperty',
|
||||
propType: {
|
||||
isRequired: true,
|
||||
type: 'number',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'optionalObjectWithStrictShape',
|
||||
propType: 'exact',
|
||||
value: [
|
||||
{
|
||||
isRequired: false,
|
||||
name: 'optionalProperty',
|
||||
propType: 'string',
|
||||
},
|
||||
{
|
||||
isRequired: true,
|
||||
name: 'requiredProperty',
|
||||
propType: 'number',
|
||||
},
|
||||
],
|
||||
propType: {
|
||||
type: 'exact',
|
||||
value: [
|
||||
{
|
||||
name: 'optionalProperty',
|
||||
propType: 'string',
|
||||
},
|
||||
{
|
||||
name: 'requiredProperty',
|
||||
propType: {
|
||||
isRequired: true,
|
||||
type: 'number',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'requiredFunc',
|
||||
|
||||
Binary file not shown.
@ -176,9 +176,17 @@ Generated by [AVA](https://avajs.dev).
|
||||
propsDefaults: [],
|
||||
propsTypes: [
|
||||
{
|
||||
isRequired: undefined,
|
||||
name: 'children',
|
||||
propType: 'union',
|
||||
propType: {
|
||||
type: 'union',
|
||||
value: [
|
||||
{
|
||||
type: 'arrayOf',
|
||||
value: 'node',
|
||||
},
|
||||
'node',
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'styleBoxModel',
|
||||
@ -295,9 +303,17 @@ Generated by [AVA](https://avajs.dev).
|
||||
propType: 'string',
|
||||
},
|
||||
{
|
||||
isRequired: undefined,
|
||||
name: 'children',
|
||||
propType: 'union',
|
||||
propType: {
|
||||
type: 'union',
|
||||
value: [
|
||||
{
|
||||
type: 'arrayOf',
|
||||
value: 'node',
|
||||
},
|
||||
'node',
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'styleBoxModel',
|
||||
@ -502,9 +518,17 @@ Generated by [AVA](https://avajs.dev).
|
||||
propsDefaults: [],
|
||||
propsTypes: [
|
||||
{
|
||||
isRequired: undefined,
|
||||
name: 'children',
|
||||
propType: 'union',
|
||||
propType: {
|
||||
type: 'union',
|
||||
value: [
|
||||
{
|
||||
type: 'arrayOf',
|
||||
value: 'node',
|
||||
},
|
||||
'node',
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'styleBoxModel',
|
||||
@ -599,9 +623,17 @@ Generated by [AVA](https://avajs.dev).
|
||||
propsDefaults: [],
|
||||
propsTypes: [
|
||||
{
|
||||
isRequired: undefined,
|
||||
name: 'children',
|
||||
propType: 'union',
|
||||
propType: {
|
||||
type: 'union',
|
||||
value: [
|
||||
{
|
||||
type: 'arrayOf',
|
||||
value: 'node',
|
||||
},
|
||||
'node',
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'styleBoxModel',
|
||||
@ -703,9 +735,18 @@ Generated by [AVA](https://avajs.dev).
|
||||
propsDefaults: [],
|
||||
propsTypes: [
|
||||
{
|
||||
isRequired: undefined,
|
||||
name: 'children',
|
||||
propType: 'union',
|
||||
propType: {
|
||||
type: 'union',
|
||||
value: [
|
||||
{
|
||||
type: 'arrayOf',
|
||||
value: 'node',
|
||||
},
|
||||
'node',
|
||||
'string',
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'type',
|
||||
@ -793,9 +834,17 @@ Generated by [AVA](https://avajs.dev).
|
||||
propType: 'object',
|
||||
},
|
||||
{
|
||||
isRequired: undefined,
|
||||
name: 'children',
|
||||
propType: 'union',
|
||||
propType: {
|
||||
type: 'union',
|
||||
value: [
|
||||
'element',
|
||||
{
|
||||
type: 'arrayOf',
|
||||
value: 'element',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
subModules: [],
|
||||
@ -897,77 +946,106 @@ Generated by [AVA](https://avajs.dev).
|
||||
propType: 'elementType',
|
||||
},
|
||||
{
|
||||
isRequired: undefined,
|
||||
name: 'optionalMessage',
|
||||
propType: 'instanceOf',
|
||||
propType: {
|
||||
type: 'instanceOf',
|
||||
value: 'Demo',
|
||||
},
|
||||
},
|
||||
{
|
||||
0: '\'News\'',
|
||||
1: '\'Photos\'',
|
||||
name: 'optionalEnum',
|
||||
propType: {
|
||||
type: 'oneOf',
|
||||
value: [
|
||||
'News',
|
||||
'Photos',
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
isRequired: undefined,
|
||||
name: 'optionalUnion',
|
||||
propType: 'union',
|
||||
propType: {
|
||||
type: 'union',
|
||||
value: [
|
||||
'string',
|
||||
'number',
|
||||
{
|
||||
type: 'instanceOf',
|
||||
value: 'Demo',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
isRequired: undefined,
|
||||
name: 'optionalArrayOf',
|
||||
propType: 'arrayOf',
|
||||
propType: {
|
||||
type: 'arrayOf',
|
||||
value: 'number',
|
||||
},
|
||||
},
|
||||
{
|
||||
isRequired: undefined,
|
||||
name: 'optionalObjectOf',
|
||||
propType: 'objectOf',
|
||||
propType: {
|
||||
type: 'objectOf',
|
||||
value: 'number',
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'optionalObjectWithShape',
|
||||
propType: 'shape',
|
||||
value: [
|
||||
{
|
||||
isRequired: false,
|
||||
name: 'optionalProperty',
|
||||
propType: 'string',
|
||||
},
|
||||
{
|
||||
isRequired: true,
|
||||
name: 'requiredProperty',
|
||||
propType: 'number',
|
||||
},
|
||||
],
|
||||
propType: {
|
||||
type: 'shape',
|
||||
value: [
|
||||
{
|
||||
name: 'optionalProperty',
|
||||
propType: 'string',
|
||||
},
|
||||
{
|
||||
name: 'requiredProperty',
|
||||
propType: {
|
||||
isRequired: true,
|
||||
type: 'number',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'optionalObjectWithShape2',
|
||||
propType: 'shape',
|
||||
value: [
|
||||
{
|
||||
isRequired: false,
|
||||
name: 'optionalProperty',
|
||||
propType: 'string',
|
||||
},
|
||||
{
|
||||
isRequired: true,
|
||||
name: 'requiredProperty',
|
||||
propType: 'number',
|
||||
},
|
||||
],
|
||||
propType: {
|
||||
type: 'shape',
|
||||
value: [
|
||||
{
|
||||
name: 'optionalProperty',
|
||||
propType: 'string',
|
||||
},
|
||||
{
|
||||
name: 'requiredProperty',
|
||||
propType: {
|
||||
isRequired: true,
|
||||
type: 'number',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'optionalObjectWithStrictShape',
|
||||
propType: 'exact',
|
||||
value: [
|
||||
{
|
||||
isRequired: false,
|
||||
name: 'optionalProperty',
|
||||
propType: 'string',
|
||||
},
|
||||
{
|
||||
isRequired: true,
|
||||
name: 'requiredProperty',
|
||||
propType: 'number',
|
||||
},
|
||||
],
|
||||
propType: {
|
||||
type: 'exact',
|
||||
value: [
|
||||
{
|
||||
name: 'optionalProperty',
|
||||
propType: 'string',
|
||||
},
|
||||
{
|
||||
name: 'requiredProperty',
|
||||
propType: {
|
||||
isRequired: true,
|
||||
type: 'number',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'requiredFunc',
|
||||
|
||||
Binary file not shown.
@ -1 +1 @@
|
||||
{"componentName":"AIMakeBlank","title":"","docUrl":"","screenshot":"","npm":{"package":"@ali/lowcode-engine-material-parser","version":"0.1.0","exportName":"AIMakeBlank","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js","destructuring":false,"subName":""},"props":[{"name":"children","propType":"union"},{"name":"styleBoxModel","propType":"object"},{"name":"styleLayout","propType":"object"},{"name":"styleBackground","propType":"object"},{"name":"styleFlexLayout","propType":"object"},{"name":"style","propType":"object"},{"name":"id","propType":"string"}]}
|
||||
{"componentName":"AIMakeBlank","title":"","docUrl":"","screenshot":"","npm":{"package":"multiple-exported-component","version":"1.0.0","exportName":"AIMakeBlank","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js","destructuring":false,"subName":""},"props":[{"name":"children","propType":{"type":"union","value":[{"type":"arrayOf","value":"node"},"node"]}},{"name":"styleBoxModel","propType":"object"},{"name":"styleLayout","propType":"object"},{"name":"styleBackground","propType":"object"},{"name":"styleFlexLayout","propType":"object"},{"name":"style","propType":"object"},{"name":"id","propType":"string"}]}
|
||||
@ -1 +1 @@
|
||||
{"componentName":"AIMakeIcon","title":"","docUrl":"","screenshot":"","npm":{"package":"@ali/lowcode-engine-material-parser","version":"0.1.0","exportName":"AIMakeIcon","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js","destructuring":false,"subName":""},"props":[{"name":"className","propType":"string"},{"name":"iconClassName","propType":"string"},{"name":"children","propType":"union"},{"name":"styleBoxModel","propType":"object"},{"name":"styleText","propType":"object"},{"name":"styleBackground","propType":"object"},{"name":"style","propType":"object"}]}
|
||||
{"componentName":"AIMakeIcon","title":"","docUrl":"","screenshot":"","npm":{"package":"multiple-exported-component","version":"1.0.0","exportName":"AIMakeIcon","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js","destructuring":false,"subName":""},"props":[{"name":"className","propType":"string"},{"name":"iconClassName","propType":"string"},{"name":"children","propType":{"type":"union","value":[{"type":"arrayOf","value":"node"},"node"]}},{"name":"styleBoxModel","propType":"object"},{"name":"styleText","propType":"object"},{"name":"styleBackground","propType":"object"},{"name":"style","propType":"object"}]}
|
||||
@ -1 +1 @@
|
||||
{"componentName":"AIMakeImage","title":"","docUrl":"","screenshot":"","npm":{"package":"@ali/lowcode-engine-material-parser","version":"0.1.0","exportName":"AIMakeImage","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js","destructuring":false,"subName":""},"props":[{"name":"styleBoxModel","propType":"object"},{"name":"style","propType":"object"}]}
|
||||
{"componentName":"AIMakeImage","title":"","docUrl":"","screenshot":"","npm":{"package":"multiple-exported-component","version":"1.0.0","exportName":"AIMakeImage","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js","destructuring":false,"subName":""},"props":[{"name":"styleBoxModel","propType":"object"},{"name":"style","propType":"object"}]}
|
||||
@ -1 +1 @@
|
||||
{"componentName":"AIMakeLink","title":"","docUrl":"","screenshot":"","npm":{"package":"@ali/lowcode-engine-material-parser","version":"0.1.0","exportName":"AIMakeLink","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js","destructuring":false,"subName":""},"props":[{"name":"children","propType":"union"},{"name":"styleBoxModel","propType":"object"},{"name":"styleText","propType":"object"},{"name":"styleLayout","propType":"object"},{"name":"styleBackground","propType":"object"},{"name":"style","propType":"object"}]}
|
||||
{"componentName":"AIMakeLink","title":"","docUrl":"","screenshot":"","npm":{"package":"multiple-exported-component","version":"1.0.0","exportName":"AIMakeLink","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js","destructuring":false,"subName":""},"props":[{"name":"children","propType":{"type":"union","value":[{"type":"arrayOf","value":"node"},"node"]}},{"name":"styleBoxModel","propType":"object"},{"name":"styleText","propType":"object"},{"name":"styleLayout","propType":"object"},{"name":"styleBackground","propType":"object"},{"name":"style","propType":"object"}]}
|
||||
@ -1 +1 @@
|
||||
{"componentName":"AIMakePlaceholder","title":"","docUrl":"","screenshot":"","npm":{"package":"@ali/lowcode-engine-material-parser","version":"0.1.0","exportName":"AIMakePlaceholder","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js","destructuring":false,"subName":""},"props":[{"name":"children","propType":"union"},{"name":"styleBoxModel","propType":"object"},{"name":"styleLayout","propType":"object"},{"name":"style","propType":"object"}]}
|
||||
{"componentName":"AIMakePlaceholder","title":"","docUrl":"","screenshot":"","npm":{"package":"multiple-exported-component","version":"1.0.0","exportName":"AIMakePlaceholder","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js","destructuring":false,"subName":""},"props":[{"name":"children","propType":{"type":"union","value":[{"type":"arrayOf","value":"node"},"node"]}},{"name":"styleBoxModel","propType":"object"},{"name":"styleLayout","propType":"object"},{"name":"style","propType":"object"}]}
|
||||
@ -1 +1 @@
|
||||
{"componentName":"AIMakeText","title":"","docUrl":"","screenshot":"","npm":{"package":"@ali/lowcode-engine-material-parser","version":"0.1.0","exportName":"AIMakeText","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js","destructuring":false,"subName":""},"props":[{"name":"children","propType":"union"},{"name":"type","propType":"string"},{"name":"styleBoxModel","propType":"object"},{"name":"styleText","propType":"object"},{"name":"styleLayout","propType":"object"},{"name":"styleBackground","propType":"object"},{"name":"style","propType":"object"}]}
|
||||
{"componentName":"AIMakeText","title":"","docUrl":"","screenshot":"","npm":{"package":"multiple-exported-component","version":"1.0.0","exportName":"AIMakeText","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js","destructuring":false,"subName":""},"props":[{"name":"children","propType":{"type":"union","value":[{"type":"arrayOf","value":"node"},"node","string"]}},{"name":"type","propType":"string"},{"name":"styleBoxModel","propType":"object"},{"name":"styleText","propType":"object"},{"name":"styleLayout","propType":"object"},{"name":"styleBackground","propType":"object"},{"name":"style","propType":"object"}]}
|
||||
@ -1 +1 @@
|
||||
{"componentName":"Root","title":"","docUrl":"","screenshot":"","npm":{"package":"@ali/lowcode-engine-material-parser","version":"0.1.0","exportName":"Root","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js","destructuring":false,"subName":""},"props":[{"name":"style","propType":"object"},{"name":"children","propType":"union"}]}
|
||||
{"componentName":"Root","title":"","docUrl":"","screenshot":"","npm":{"package":"multiple-exported-component","version":"1.0.0","exportName":"Root","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/multiple-exported-component/es/index.js","destructuring":false,"subName":""},"props":[{"name":"style","propType":"object"},{"name":"children","propType":{"type":"union","value":["element",{"type":"arrayOf","value":"element"}]}}]}
|
||||
@ -1 +1 @@
|
||||
{"componentName":"Demo","title":"","docUrl":"","screenshot":"","npm":{"package":"single-exported-component","version":"1.0.0","exportName":"Demo","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/single-exported-component/es/index.js","destructuring":false,"subName":""},"props":[{"name":"optionalArray","propType":"array"},{"name":"optionalBool","propType":"bool"},{"name":"optionalFunc","propType":"func"},{"name":"optionalNumber","propType":"number"},{"name":"optionalObject","propType":"object"},{"name":"optionalString","propType":"string"},{"name":"optionalSymbol","propType":"symbol"},{"name":"optionalNode","propType":"node"},{"name":"optionalElement","propType":"element"},{"name":"optionalElementType","propType":"elementType"},{"name":"optionalMessage","propType":"instanceOf"},{"0":"'News'","1":"'Photos'","name":"optionalEnum"},{"name":"optionalUnion","propType":"union"},{"name":"optionalArrayOf","propType":"arrayOf"},{"name":"optionalObjectOf","propType":"objectOf"},{"name":"optionalObjectWithShape","propType":"shape","value":[{"name":"optionalProperty","propType":"string","isRequired":false},{"name":"requiredProperty","propType":"number","isRequired":true}]},{"name":"optionalObjectWithShape2","propType":"shape","value":[{"name":"optionalProperty","propType":"string","isRequired":false},{"name":"requiredProperty","propType":"number","isRequired":true}]},{"name":"optionalObjectWithStrictShape","propType":"exact","value":[{"name":"optionalProperty","propType":"string","isRequired":false},{"name":"requiredProperty","propType":"number","isRequired":true}]},{"name":"requiredFunc","propType":"func"},{"name":"requiredAny","propType":"any"}]}
|
||||
{"componentName":"Demo","title":"","docUrl":"","screenshot":"","npm":{"package":"single-exported-component","version":"1.0.0","exportName":"Demo","main":"/Users/gengyang/code/frontend/low-code/ali-lowcode-engine/packages/material-parser/test/fixtures/single-exported-component/es/index.js","destructuring":false,"subName":""},"props":[{"name":"optionalArray","propType":"array"},{"name":"optionalBool","propType":"bool"},{"name":"optionalFunc","propType":"func"},{"name":"optionalNumber","propType":"number"},{"name":"optionalObject","propType":"object"},{"name":"optionalString","propType":"string"},{"name":"optionalSymbol","propType":"symbol"},{"name":"optionalNode","propType":"node"},{"name":"optionalElement","propType":"element"},{"name":"optionalElementType","propType":"elementType"},{"name":"optionalMessage","propType":{"type":"instanceOf","value":"Demo"}},{"name":"optionalEnum","propType":{"type":"oneOf","value":["News","Photos"]}},{"name":"optionalUnion","propType":{"type":"union","value":["string","number",{"type":"instanceOf","value":"Demo"}]}},{"name":"optionalArrayOf","propType":{"type":"arrayOf","value":"number"}},{"name":"optionalObjectOf","propType":{"type":"objectOf","value":"number"}},{"name":"optionalObjectWithShape","propType":{"type":"shape","value":[{"name":"optionalProperty","propType":"string"},{"name":"requiredProperty","propType":{"type":"number","isRequired":true}}]}},{"name":"optionalObjectWithShape2","propType":{"type":"shape","value":[{"name":"optionalProperty","propType":"string"},{"name":"requiredProperty","propType":{"type":"number","isRequired":true}}]}},{"name":"optionalObjectWithStrictShape","propType":{"type":"exact","value":[{"name":"optionalProperty","propType":"string"},{"name":"requiredProperty","propType":{"type":"number","isRequired":true}}]}},{"name":"requiredFunc","propType":"func"},{"name":"requiredAny","propType":"any"}]}
|
||||
Loading…
x
Reference in New Issue
Block a user