mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-12 11:20:11 +00:00
Merge pull request #228 from alibaba/feat/lowcode-slot-props
fix: Fix the conversion failure of some props expressions under Slot …
This commit is contained in:
commit
6b24f9d2ff
@ -1,5 +1,3 @@
|
|||||||
const esModules = ['@recore/obx-react'].join('|');
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
// transform: {
|
// transform: {
|
||||||
// '^.+\\.[jt]sx?$': 'babel-jest',
|
// '^.+\\.[jt]sx?$': 'babel-jest',
|
||||||
@ -7,9 +5,6 @@ module.exports = {
|
|||||||
// // '^.+\\.(js|jsx)$': 'babel-jest',
|
// // '^.+\\.(js|jsx)$': 'babel-jest',
|
||||||
// },
|
// },
|
||||||
// testMatch: ['(/tests?/.*(test))\\.[jt]s$'],
|
// testMatch: ['(/tests?/.*(test))\\.[jt]s$'],
|
||||||
transformIgnorePatterns: [
|
|
||||||
`/node_modules/(?!${esModules})/`,
|
|
||||||
],
|
|
||||||
moduleFileExtensions: ['ts', 'tsx', 'js', 'json'],
|
moduleFileExtensions: ['ts', 'tsx', 'js', 'json'],
|
||||||
collectCoverage: true,
|
collectCoverage: true,
|
||||||
collectCoverageFrom: [
|
collectCoverageFrom: [
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
const esModules = [
|
const esModules = [
|
||||||
'@recore/obx-react',
|
|
||||||
'@alilc/lowcode-datasource-engine',
|
'@alilc/lowcode-datasource-engine',
|
||||||
].join('|');
|
].join('|');
|
||||||
|
|
||||||
|
|||||||
6
packages/utils/build.test.json
Normal file
6
packages/utils/build.test.json
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"plugins": [
|
||||||
|
"build-plugin-component",
|
||||||
|
"@alilc/lowcode-test-mate/plugin/index.ts"
|
||||||
|
]
|
||||||
|
}
|
||||||
9
packages/utils/jest.config.js
Normal file
9
packages/utils/jest.config.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
module.exports = {
|
||||||
|
moduleFileExtensions: ['ts', 'tsx', 'js', 'json'],
|
||||||
|
collectCoverage: true,
|
||||||
|
collectCoverageFrom: [
|
||||||
|
'src/**/*.{ts,tsx}',
|
||||||
|
'!**/node_modules/**',
|
||||||
|
'!**/vendor/**',
|
||||||
|
],
|
||||||
|
};
|
||||||
@ -9,6 +9,7 @@
|
|||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"module": "es/index.js",
|
"module": "es/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"test": "build-scripts test --config build.test.json",
|
||||||
"build": "build-scripts build --skip-demo"
|
"build": "build-scripts build --skip-demo"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@ -26,7 +26,7 @@ export function compatibleLegaoSchema(props: any): any {
|
|||||||
type: 'JSSlot',
|
type: 'JSSlot',
|
||||||
title: (props.value.props as any)?.slotTitle,
|
title: (props.value.props as any)?.slotTitle,
|
||||||
name: (props.value.props as any)?.slotName,
|
name: (props.value.props as any)?.slotName,
|
||||||
value: props.value.children,
|
value: compatibleLegaoSchema(props.value.children),
|
||||||
params: (props.value.props as any)?.slotParams,
|
params: (props.value.props as any)?.slotParams,
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
23
packages/utils/test/src/__snapshots__/schema.test.ts.snap
Normal file
23
packages/utils/test/src/__snapshots__/schema.test.ts.snap
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`Schema Ut props 1`] = `
|
||||||
|
Object {
|
||||||
|
"props": Object {
|
||||||
|
"mobileSlot": Object {
|
||||||
|
"name": undefined,
|
||||||
|
"params": undefined,
|
||||||
|
"title": undefined,
|
||||||
|
"type": "JSSlot",
|
||||||
|
"value": Array [
|
||||||
|
Object {
|
||||||
|
"loop": Object {
|
||||||
|
"mock": undefined,
|
||||||
|
"type": "JSExpression",
|
||||||
|
"value": "props.content",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
`;
|
||||||
27
packages/utils/test/src/schema.test.ts
Normal file
27
packages/utils/test/src/schema.test.ts
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import { compatibleLegaoSchema } from '../../src/schema';
|
||||||
|
describe('Schema Ut', () => {
|
||||||
|
it('props', () => {
|
||||||
|
const schema = {
|
||||||
|
props: {
|
||||||
|
mobileSlot: {
|
||||||
|
type: "JSBlock",
|
||||||
|
value: {
|
||||||
|
componentName: "Slot",
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
loop: {
|
||||||
|
variable: "props.content",
|
||||||
|
type: "variable"
|
||||||
|
},
|
||||||
|
}
|
||||||
|
],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const result = compatibleLegaoSchema(schema);
|
||||||
|
expect(result).toMatchSnapshot();
|
||||||
|
expect(result.props.mobileSlot.value[0].loop.type).toBe('JSExpression');
|
||||||
|
});
|
||||||
|
})
|
||||||
Loading…
x
Reference in New Issue
Block a user