import { EventEmitter, OnChanges, SimpleChanges, ChangeDetectorRef } from '@angular/core'; import { FormGroup, FormArray } from '@angular/forms'; import { DynamicSelectFieldConfig, SelectOption } from '../../dynamic-select/dynamic-select-field.component'; import { ElementCreatePayload, ScreenNameOption } from '../../test-case-details/element-popup/element-popup-form-data'; import * as i0 from "@angular/core"; interface Element { id?: number; name: string; locatorValue?: string; otherLocator?: string[]; [key: string]: any; screenNameId?: number; screenNameObj?: any; } export interface TemplateVariable { name: string; dataKey: string; label: string; value: any; type?: string; options?: { value: string; label: string; }[]; dataType?: 'plain-text' | 'parameter' | 'runtime' | 'environment'; rawValue?: string; selectedEnvironment?: string; selectedEnvironmentId?: number; selectedTestDataProfile?: string; selectedTestDataProfileId?: number; selectedDataSet?: string; selectedDataSetStart?: string; selectedDataSetEnd?: string; selectedScreenName?: string; screenNameId?: number; elementId?: number; elementLocator?: string; elementName?: string; } export declare class TemplateVariablesFormComponent implements OnChanges { private cdr; templateVariables: TemplateVariable[]; variablesForm: FormArray; metadata: string; description: string; elementOptions: Element[]; hasMoreElements: boolean; isLoadingElements: boolean; /** Screen name options for element form autocomplete (from API) */ screenNameOptions: ScreenNameOption[]; /** Whether more screen names are available for infinite scroll */ hasMoreScreenNames: boolean; /** True while parent is loading screen names (search or load more) */ isLoadingScreenNames: boolean; /** Test data profiles for parameter dropdown (from API) - raw TestData objects */ parameterOptions: any[]; /** Whether more parameters are available for infinite scroll */ hasMoreParameters: boolean; /** True while parent is loading parameters (search or load more) */ isLoadingParameters: boolean; /** Upload options for upload dropdown (from API) */ uploadOptions: any[]; /** Whether more uploads are available for infinite scroll */ hasMoreUploads: boolean; /** True while parent is loading uploads (search or load more) */ isLoadingUploads: boolean; /** Environment options for environment parameter dropdown (from API) */ environmentOptions: { id: string; name: string; value: string; environment: string; }[]; /** Whether more environments are available for infinite scroll */ hasMoreEnvironments: boolean; /** True while parent is loading environments (search or load more) */ isLoadingEnvironments: boolean; /** Default test data profile ID from test case (if available, profile and data set dropdowns will be disabled) */ defaultTestDataProfileId?: number; /** Default test data start index from test case (data set index in the profile) */ defaultTestDataStartIndex?: number; /** Default test data end index from FOR loop context */ defaultTestDataEndIndex?: number; /** True when the edited step is inside a FOR loop. */ isInsideForLoopStep: boolean; /** True when the parent test case has a test data profile configured (testCase.testDataId is set). */ hasTestDataProfile: boolean; isEditInDepth: boolean; isDebug: boolean; variableValueChange: EventEmitter<{ name: string; value: any; }>; variableBooleanChange: EventEmitter<{ name: string; value: boolean; }>; metadataChange: EventEmitter; descriptionChange: EventEmitter; loadMoreElements: EventEmitter; searchElements: EventEmitter; searchElementsByScreenName: EventEmitter<{ screenNameId: number; searchTerm?: string; }>; createElement: EventEmitter; searchScreenName: EventEmitter; loadMoreScreenNames: EventEmitter; createScreenNameRequest: EventEmitter; searchParameters: EventEmitter; loadMoreParameters: EventEmitter; searchUploads: EventEmitter; loadMoreUploads: EventEmitter; searchEnvironments: EventEmitter; loadMoreEnvironments: EventEmitter; cancelElementForm: EventEmitter; elementFormVisibilityChange: EventEmitter; private selectConfigCache; private dataTypeSelectConfigCache; private parameterSelectConfigCache; private environmentSelectConfigCache; private environmentNameSelectConfigCache; private environmentParameterSelectConfigCache; private screenNameSelectConfigCache; private elementSelectConfigCache; private testDataProfileSelectConfigCache; private dataSetSelectConfigCache; private activeEnvironmentSearchVariable; private activeParameterSearchVariable; private selectedParameterProfileSnapshot; private selectedEnvironmentOptionsSnapshot; private dataSetRangeSelectConfigCache; private parameterForDataSetSelectConfigCache; private needsDataTypeDropdownCache; private shouldShowDropdownCache; private readonly dataTypeOptions; createElementVisible: boolean; constructor(cdr: ChangeDetectorRef); onCreateElement(payload: ElementCreatePayload): void; onCancelElementForm(): void; ngOnChanges(changes: SimpleChanges): void; private initializeTestDataVariables; /** Get form group for a variable by name from FormArray */ getVariableFormGroup(variableName: string): FormGroup | null; /** Get form group at a specific index from FormArray (for template use) */ getFormGroupAt(index: number): FormGroup | null; private precomputeConfigs; private parseTestDataValue; private formatTestDataValue; trackByVariable(index: number, variable: TemplateVariable): any; getSelectConfig(variable: TemplateVariable, index: number): DynamicSelectFieldConfig; onVariableValueChange(variableName: string, value: any): void; onVariableBooleanChange(variableName: string, value: boolean): void; shouldShowDropdown(variable: TemplateVariable): boolean; needsDataTypeDropdown(variable: TemplateVariable): boolean; /** True when the variable is the synthetic AI Ask / AI Verify environment dropdown. */ isEnvironmentNameType(variable: TemplateVariable): boolean; /** * Builds the dynamic-select config for the synthetic AI Ask / AI Verify * environment dropdown. Prepends a sentinel "None" entry (empty value) so * the user can explicitly clear the choice — the empty value round-trips * through onVariableValueChange → setValue('') → backend reads * `event.environment` as '' and treats it as no environment context. * * Deduplicates by environment name to mirror getUniqueEnvironments() used * by the existing test-data environment selector. */ getEnvironmentNameSelectConfig(variable: TemplateVariable): DynamicSelectFieldConfig; /** Look up an environment's display name from the numeric id stored on the variable. */ private resolveEnvironmentNameById; getDataTypeOptions(): SelectOption[]; getDataTypeSelectConfig(variable: TemplateVariable, index: number): DynamicSelectFieldConfig; getCurrentDataType(variable: TemplateVariable): 'plain-text' | 'parameter' | 'runtime' | 'environment'; getRawValue(variable: TemplateVariable): string; /** * Check if selector variable is available in templateVariables */ get selectorVariableAvailable(): boolean; /** * Check if parameter variable is available (testData with parameter type) */ get parameterVariableAvailable(): boolean; /** * Check if environment variable is available (testData with environment type) */ get environmentVariableAvailable(): boolean; onDataTypeChange(variableName: string, dataType: 'plain-text' | 'parameter' | 'runtime' | 'environment'): void; onElementSearch(event: { key: string; query: string; }): void; private readonly variableSyntaxErrors; private readonly controlsWithSyntaxValidator; private makeSyntaxValidator; onTestDataValidityChange(variableName: string, event: { valid: boolean; error: string | null; }): void; onTestDataValueChange(variableName: string, rawValue: string): void; /** * Get unique test data profiles from parameter options (raw TestData objects) */ getUniqueTestDataProfiles(): { id: string; name: string; }[]; /** * Get data sets for a specific test data profile * Returns all data sets from the profile's data array */ getDataSetsForTestDataProfile(profileId: string): { id: string; name: string; }[]; /** * Get parameters for a specific data set in a test data profile * Extracts parameter names from the selected data set's data object */ getParametersForDataSet(profileIdOrName: string, dataSetName: string): { id: string; name: string; }[]; /** * Find a profile in the snapshot by numeric ID. * Used as fallback when parameterOptions is temporarily filtered by another variable's search. */ private findProfileInSnapshot; /** * Get select config for test data profile dropdown (first dropdown for parameters) */ getTestDataProfileSelectConfig(variable: TemplateVariable, index: number): DynamicSelectFieldConfig; /** * Get select config for data set dropdown (second dropdown for parameters - shows data sets from selected profile) */ getDataSetSelectConfig(variable: TemplateVariable, index: number): DynamicSelectFieldConfig; /** Data Set Start/End select config for FOR-loop context. */ getDataSetRangeSelectConfig(variable: TemplateVariable, index: number, range: 'start' | 'end'): DynamicSelectFieldConfig; /** * Get select config for parameter dropdown (third dropdown for parameters - shows parameters from selected data set) */ getParameterSelectConfig(variable: TemplateVariable, index: number): DynamicSelectFieldConfig; /** * Get unique environments from environment options */ getUniqueEnvironments(): { id: string; name: string; }[]; /** * Get parameters for a specific environment */ getParametersForEnvironment(environmentName: string): { id: string; name: string; }[]; /** * Get select config for environment dropdown (first dropdown - select environment) */ getEnvironmentSelectConfig(variable: TemplateVariable, index: number): DynamicSelectFieldConfig; /** * Get select config for environment parameter dropdown (second dropdown - select parameter from environment) */ getEnvironmentParameterSelectConfig(variable: TemplateVariable, index: number): DynamicSelectFieldConfig; /** * Get selected environment for a variable */ getSelectedEnvironment(variable: TemplateVariable): string; /** * Check if environment is selected for a variable */ hasSelectedEnvironment(variable: TemplateVariable): boolean; /** * Get selected environment ID for a variable */ getSelectedEnvironmentId(variable: TemplateVariable): number | null; /** * Get all environment IDs for variables that use environment type * Returns a map of variable name to environment ID */ getEnvironmentIdsForVariables(): Map; /** * Check if current data type is plain-text */ isPlainTextType(variable: TemplateVariable): boolean; /** * Check if current data type is parameter */ isParameterType(variable: TemplateVariable): boolean; /** * Check if test data profile is selected for a variable */ hasSelectedTestDataProfile(variable: TemplateVariable): boolean; /** * Check if data set is selected for a variable */ hasSelectedDataSet(variable: TemplateVariable): boolean; /** * Check if default test data profile and data set are set (from test case) * If true, profile and data set dropdowns should be disabled */ hasDefaultTestDataSelection(): boolean; /** * Check if current data type is environment */ isEnvironmentType(variable: TemplateVariable): boolean; /** * Check if variable is element type (dataKey === 'element') */ isElementType(variable: TemplateVariable): boolean; /** * Check if screen name is selected for an element variable * Returns true if either selectedScreenName or screenNameId is set (and not "None") */ hasSelectedScreenName(variable: TemplateVariable): boolean; /** * Get select config for screen name dropdown (first dropdown for element variables) */ getScreenNameSelectConfig(variable: TemplateVariable, index: number): DynamicSelectFieldConfig; /** * Get select config for element dropdown (second dropdown - filtered by screen name) * Optimized to return immediately from cache to avoid repeated calls during change detection */ getElementSelectConfig(variable: TemplateVariable, index: number): DynamicSelectFieldConfig; /** * Check if current data type is runtime */ isRuntimeType(variable: TemplateVariable): boolean; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } export {};