@cqa-lib/cqa-ui 1.1.257 → 1.1.258

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22104,7 +22104,7 @@ class TestCaseLoopStepComponent {
22104
22104
  this.cdr.detectChanges();
22105
22105
  }
22106
22106
  onEdit() {
22107
- var _a, _b, _c, _d, _e, _f, _g;
22107
+ var _a, _b, _c, _d, _e, _f, _g, _h;
22108
22108
  this.editSnapshot = {
22109
22109
  testDataProfile: this.testDataProfile,
22110
22110
  startStep: this.startStep,
@@ -22134,24 +22134,28 @@ class TestCaseLoopStepComponent {
22134
22134
  });
22135
22135
  }
22136
22136
  if (this.loopType === 'while') {
22137
- this.editForm.patchValue({
22138
- condition: (_f = this.condition) !== null && _f !== void 0 ? _f : '',
22139
- maxIterations: (_g = this.maxIterations) !== null && _g !== void 0 ? _g : 5,
22140
- });
22141
- }
22142
- // While loop: restore selected template and template variables from config when opening edit
22143
- if (this.loopType === 'while' && (this.condition || this.config.templateVariablesData)) {
22144
- const configWithData = this.config;
22145
- const conditionStr = this.condition || configWithData.condition || '';
22146
- if (conditionStr && (this.naturalTextActionsOptions || []).length > 0) {
22147
- const matchingOption = this.naturalTextActionsOptions.find((opt) => (opt.naturalText || opt.name || opt.value) === conditionStr);
22148
- const fullTemplate = (matchingOption === null || matchingOption === void 0 ? void 0 : matchingOption.template) || matchingOption;
22149
- if (fullTemplate && fullTemplate.variables) {
22150
- this.selectedTemplate = fullTemplate;
22151
- this.templateVariables = this.setConditionTemplateVariables(fullTemplate) || [];
22152
- this.buildTemplateVariablesForm();
22137
+ // When naturalTextActionId exists, populate condition and selected template from options so autocomplete shows selected template
22138
+ const configWithId = this.config;
22139
+ if ((configWithId === null || configWithId === void 0 ? void 0 : configWithId.naturalTextActionId) != null && ((_f = this.naturalTextActionsOptions) === null || _f === void 0 ? void 0 : _f.length)) {
22140
+ this.rebuildWhileConditionFromNaturalTextAction();
22141
+ }
22142
+ else if (this.condition || (configWithId === null || configWithId === void 0 ? void 0 : configWithId.templateVariablesData)) {
22143
+ // Fallback: match by condition text when naturalTextActionId not set
22144
+ const conditionStr = this.condition || (configWithId === null || configWithId === void 0 ? void 0 : configWithId.condition) || '';
22145
+ if (conditionStr && (this.naturalTextActionsOptions || []).length > 0) {
22146
+ const matchingOption = this.naturalTextActionsOptions.find((opt) => (opt.naturalText || opt.name || opt.value) === conditionStr);
22147
+ const fullTemplate = (matchingOption === null || matchingOption === void 0 ? void 0 : matchingOption.template) || matchingOption;
22148
+ if (fullTemplate && fullTemplate.variables) {
22149
+ this.selectedTemplate = fullTemplate;
22150
+ this.templateVariables = this.setConditionTemplateVariables(fullTemplate) || [];
22151
+ this.buildTemplateVariablesForm();
22152
+ }
22153
22153
  }
22154
22154
  }
22155
+ this.editForm.patchValue({
22156
+ condition: (_g = this.condition) !== null && _g !== void 0 ? _g : '',
22157
+ maxIterations: (_h = this.maxIterations) !== null && _h !== void 0 ? _h : 5,
22158
+ });
22155
22159
  }
22156
22160
  this.isEditing = true;
22157
22161
  this.edit.emit();