import { BaseComponentProps } from '@aws-amplify/ui-react'; import { ComponentMetadata, StudioComponent, StudioComponentChild, StudioNode } from '@aws-amplify/codegen-ui'; import { JsxChild, JsxElement } from 'typescript'; import { ReactComponentRenderer } from '../react-component-renderer'; import { ImportCollection } from '../imports'; import { ReactRenderConfig } from '../react-render-config'; import { defaultRenderConfig } from '../react-studio-template-renderer-helper'; export default class CollectionRenderer extends ReactComponentRenderer { protected componentMetadata: ComponentMetadata; protected importCollection: ImportCollection; protected renderConfig: ReactRenderConfig & typeof defaultRenderConfig; protected parent?: StudioNode | undefined; constructor(component: StudioComponent | StudioComponentChild, componentMetadata: ComponentMetadata, importCollection: ImportCollection, renderConfig: ReactRenderConfig & typeof defaultRenderConfig, parent?: StudioNode | undefined); renderElement(renderChildren: (children: StudioComponentChild[]) => JsxChild[]): JsxElement; private renderCollectionOpeningElement; private addKeyPropertyToChildren; /** * SECURITY: the returned name is emitted as a bare identifier via * factory.createIdentifier() (the collection's `items={ || []}` * attribute), so it must be a valid JS identifier. collectionProperties keys * come straight from the schema and are not constrained by schema validation, * so invalid keys are skipped and the caller falls back to `items` */ private findItemsVariableName; private renderItemArrowFunctionExpr; private getCollectionElement; }