Compare commits

...

6 Commits

Author SHA1 Message Date
LeoYuan 袁力皓
c31ca674d3 chore(release): code-generator - 1.1.2 2023-05-06 17:11:26 +08:00
LeoYuan 袁力皓
e362ead061 Merge branch 'develop' into chore/code-gen-comp 2023-05-06 17:11:05 +08:00
LeoYuan 袁力皓
8fc0a75e44 chore(release): code-generator - 1.1.1 2023-05-06 17:08:58 +08:00
LeoYuan 袁力皓
a177c8a1ab refactor: moduleName of Component should not be converted 2023-05-06 17:07:58 +08:00
LeoYuan 袁力皓
066fcf022d fix: attr name in IPublicTypePanelDockConfig should not be optional 2023-05-04 17:02:17 +08:00
LeoYuan 袁力皓
bb8e2d7b72 fix: use noop function instead 2023-05-04 17:01:02 +08:00
6 changed files with 14 additions and 7 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@alilc/lowcode-code-generator", "name": "@alilc/lowcode-code-generator",
"version": "1.1.0", "version": "1.1.2",
"description": "出码引擎 for LowCode Engine", "description": "出码引擎 for LowCode Engine",
"license": "MIT", "license": "MIT",
"main": "lib/index.js", "main": "lib/index.js",

View File

@ -32,7 +32,7 @@ import {
import { SUPPORT_SCHEMA_VERSION_LIST } from '../const'; import { SUPPORT_SCHEMA_VERSION_LIST } from '../const';
import { getErrorMessage } from '../utils/errors'; import { getErrorMessage } from '../utils/errors';
import { handleSubNodes, isValidContainerType } from '../utils/schema'; import { handleSubNodes, isValidContainerType, ContainerType } from '../utils/schema';
import { uniqueArray } from '../utils/common'; import { uniqueArray } from '../utils/common';
import { componentAnalyzer } from '../analyzer/componentAnalyzer'; import { componentAnalyzer } from '../analyzer/componentAnalyzer';
import { ensureValidClassName } from '../utils/validate'; import { ensureValidClassName } from '../utils/validate';
@ -161,7 +161,8 @@ export class SchemaParser implements ISchemaParser {
...subRoot, ...subRoot,
componentName: getRootComponentName(subRoot.componentName, compDeps), componentName: getRootComponentName(subRoot.componentName, compDeps),
containerType: subRoot.componentName, containerType: subRoot.componentName,
moduleName: ensureValidClassName(changeCase.pascalCase(subRoot.fileName)), moduleName: ensureValidClassName(subRoot.componentName === ContainerType.Component ?
subRoot.fileName : changeCase.pascalCase(subRoot.fileName)),
}; };
return container; return container;
}); });

View File

@ -48,7 +48,7 @@ const pluginFactory: BuilderComponentPluginFactory<unknown> = () => {
type: ChunkType.STRING, type: ChunkType.STRING,
fileType: FileType.JSX, fileType: FileType.JSX,
name: CLASS_DEFINE_CHUNK_NAME.InsVar, name: CLASS_DEFINE_CHUNK_NAME.InsVar,
content: `static displayName = '${changeCase.pascalCase(ir.moduleName)}';`, content: `static displayName = '${ir.moduleName}';`,
linkAfter: [ linkAfter: [
CLASS_DEFINE_CHUNK_NAME.Start, CLASS_DEFINE_CHUNK_NAME.Start,
], ],

View File

@ -58,7 +58,7 @@ const pluginFactory: BuilderComponentPluginFactory<PluginConfig> = (config?) =>
generateCompositeType( generateCompositeType(
{ {
type: 'JSFunction', type: 'JSFunction',
value: input.value || 'null', value: input.value || 'function () {}',
}, },
Scope.createRootScope(), Scope.createRootScope(),
), ),

View File

@ -148,3 +148,9 @@ export function isValidContainerType(schema: IPublicTypeNodeSchema) {
'Block', 'Block',
].includes(schema.componentName); ].includes(schema.componentName);
} }
export const enum ContainerType {
Page = 'Page',
Component = 'Component',
Block = 'Block',
}

View File

@ -25,7 +25,7 @@ export interface IPublicTypePanelDockConfig extends IPublicTypeWidgetBaseConfig
props?: IPublicTypePanelDockProps; props?: IPublicTypePanelDockProps;
/** 面板 name, 当没有 props.title 时, 会使用 name 作为标题 */ /** 面板 name, 当没有 props.title 时, 会使用 name 作为标题 */
name?: string; name: string;
} }
export interface IPublicTypePanelDockProps { export interface IPublicTypePanelDockProps {