Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angular: Filter non-inputs from controls #30550

Open
wants to merge 2 commits into
base: next
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion code/frameworks/angular/src/client/docs/compodoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { logger } from 'storybook/internal/client-logger';
import { ArgTypes, InputType, SBType } from 'storybook/internal/types';

import global from 'global';
import { global } from '@storybook/global';

import {
Expand All @@ -17,6 +18,8 @@ import {
Property,
} from './types';

const { FEATURES } = global;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Consider adding a type annotation for FEATURES to ensure type safety


export const isMethod = (methodOrProp: Method | Property): methodOrProp is Method => {
return (methodOrProp as Method).args !== undefined;
};
Expand Down Expand Up @@ -223,8 +226,11 @@ const resolveTypealias = (compodocType: string): string => {

export const extractArgTypesFromData = (componentData: Class | Directive | Injectable | Pipe) => {
const sectionToItems: Record<string, InputType[]> = {};
const componentClasses = FEATURES.angularFilterNonInputControls
? ['inputsClass']
: ['propertiesClass', 'methodsClass', 'inputsClass', 'outputsClass'];
const compodocClasses = ['component', 'directive'].includes(componentData.type)
? ['propertiesClass', 'methodsClass', 'inputsClass', 'outputsClass']
? componentClasses
: ['properties', 'methods'];
// eslint-disable-next-line @typescript-eslint/naming-convention
type COMPODOC_CLASS =
Expand Down