Merge pull request #19614 from Marklb/marklb/undo-over-removal-of-deprecation

Undo template gen removal during deprecation property removal
This commit is contained in:
Norbert de Langen 2022-11-04 14:22:54 +01:00 committed by GitHub
commit d99735bfe1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,6 +7,7 @@ import { storyPropsProvider } from './StorybookProvider';
import { isComponentAlreadyDeclaredInModules } from './utils/NgModulesAnalyzer';
import { isDeclarable, isStandaloneComponent } from './utils/NgComponentAnalyzer';
import { createStorybookWrapperComponent } from './StorybookWrapperComponent';
import { computesTemplateFromComponent } from './ComputesTemplateFromComponent';
export const getStorybookModuleMetadata = (
{
@ -21,7 +22,12 @@ export const getStorybookModuleMetadata = (
storyProps$: Subject<ICollection>
): NgModule => {
const { props, styles, moduleMetadata = {} } = storyFnAngular;
const { template } = storyFnAngular;
let { template } = storyFnAngular;
const hasTemplate = !hasNoTemplate(template);
if (!hasTemplate && component) {
template = computesTemplateFromComponent(component, props, '');
}
/**
* Create a component that wraps generated template and gives it props
@ -68,3 +74,7 @@ export const createStorybookModule = (ngModule: NgModule): Type<unknown> => {
class StorybookModule {}
return StorybookModule;
};
function hasNoTemplate(template: string | null | undefined): template is undefined {
return template === null || template === undefined;
}