@cqa-lib/cqa-ui 1.1.315 → 1.1.316

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.
@@ -22264,7 +22264,7 @@ class TestCaseLoopStepComponent {
22264
22264
  this.stepNumber = this.config.stepNumber;
22265
22265
  this.condition = this.config.condition;
22266
22266
  this.maxIterations = this.config.maxIterations;
22267
- this.testDataProfile = this.config.testDataProfile;
22267
+ this.testDataProfile = this.getStoredTestDataProfileLabel();
22268
22268
  this.startStep = this.config.startStep;
22269
22269
  this.endStep = this.config.endStep;
22270
22270
  this.nestedSteps = this.config.nestedSteps || [];
@@ -22278,6 +22278,7 @@ class TestCaseLoopStepComponent {
22278
22278
  var _a, _b;
22279
22279
  if (changes['config'] && this.config) {
22280
22280
  this.selected = this.config.selected || false;
22281
+ this.testDataProfile = this.getStoredTestDataProfileLabel();
22281
22282
  if (this.loopType === 'while') {
22282
22283
  this.rebuildWhileConditionFromNaturalTextAction();
22283
22284
  }
@@ -22325,18 +22326,22 @@ class TestCaseLoopStepComponent {
22325
22326
  }
22326
22327
  /** Test Data Profile dropdown value: prefer forLoopTestDataId from config (or dataMapJson/dataMapBean). Use option.id when options loaded so type matches select. */
22327
22328
  getTestDataProfileFormValue() {
22328
- var _a, _b, _c, _d, _e, _f, _g, _h;
22329
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
22330
+ const currentFormValue = (_b = (_a = this.editForm) === null || _a === void 0 ? void 0 : _a.get('testDataProfile')) === null || _b === void 0 ? void 0 : _b.value;
22331
+ if (currentFormValue !== null && currentFormValue !== undefined && currentFormValue !== '') {
22332
+ return currentFormValue;
22333
+ }
22329
22334
  const cfg = this.config;
22330
- const idFromConfig = (_c = (_a = cfg === null || cfg === void 0 ? void 0 : cfg.forLoopTestDataId) !== null && _a !== void 0 ? _a : (_b = cfg === null || cfg === void 0 ? void 0 : cfg.dataMapJson) === null || _b === void 0 ? void 0 : _b.forLoopTestDataId) !== null && _c !== void 0 ? _c : (_e = (_d = cfg === null || cfg === void 0 ? void 0 : cfg.dataMapBean) === null || _d === void 0 ? void 0 : _d.for_loop) === null || _e === void 0 ? void 0 : _e.testDataId;
22335
+ const idFromConfig = (_e = (_c = cfg === null || cfg === void 0 ? void 0 : cfg.forLoopTestDataId) !== null && _c !== void 0 ? _c : (_d = cfg === null || cfg === void 0 ? void 0 : cfg.dataMapJson) === null || _d === void 0 ? void 0 : _d.forLoopTestDataId) !== null && _e !== void 0 ? _e : (_g = (_f = cfg === null || cfg === void 0 ? void 0 : cfg.dataMapBean) === null || _f === void 0 ? void 0 : _f.for_loop) === null || _g === void 0 ? void 0 : _g.testDataId;
22331
22336
  // When we have options, resolve by id so form value matches option.id (strict equality in dynamic-select)
22332
- if (this.loopType === 'for' && ((_f = this.dataProfileOptions) === null || _f === void 0 ? void 0 : _f.length)) {
22337
+ if (this.loopType === 'for' && ((_h = this.dataProfileOptions) === null || _h === void 0 ? void 0 : _h.length)) {
22333
22338
  if (idFromConfig != null) {
22334
22339
  const match = this.dataProfileOptions.find(o => o.id === idFromConfig || String(o.id) === String(idFromConfig));
22335
22340
  if (match)
22336
22341
  return match.id;
22337
22342
  return idFromConfig;
22338
22343
  }
22339
- const value = (_g = this.testDataProfile) !== null && _g !== void 0 ? _g : '';
22344
+ const value = (_j = this.testDataProfile) !== null && _j !== void 0 ? _j : '';
22340
22345
  if (value !== '') {
22341
22346
  const match = this.dataProfileOptions.find(o => o.name === value || String(o.id) === String(value));
22342
22347
  if (match)
@@ -22346,25 +22351,31 @@ class TestCaseLoopStepComponent {
22346
22351
  }
22347
22352
  if (idFromConfig != null)
22348
22353
  return idFromConfig;
22349
- return ((_h = this.testDataProfile) !== null && _h !== void 0 ? _h : '');
22354
+ return ((_k = this.testDataProfile) !== null && _k !== void 0 ? _k : '');
22350
22355
  }
22351
22356
  /** Loop Start dropdown value: prefer forLoopStartIndex from config (or dataMapJson/dataMapBean), else startStep */
22352
22357
  getLoopStartFormValue() {
22353
- var _a, _b, _c, _d, _e, _f;
22358
+ var _a, _b, _c, _d, _e, _f, _g, _h;
22359
+ const currentFormValue = (_b = (_a = this.editForm) === null || _a === void 0 ? void 0 : _a.get('startStep')) === null || _b === void 0 ? void 0 : _b.value;
22360
+ if (currentFormValue !== null && currentFormValue !== undefined)
22361
+ return Number(currentFormValue);
22354
22362
  const cfg = this.config;
22355
- const v = (_c = (_a = cfg === null || cfg === void 0 ? void 0 : cfg.forLoopStartIndex) !== null && _a !== void 0 ? _a : (_b = cfg === null || cfg === void 0 ? void 0 : cfg.dataMapJson) === null || _b === void 0 ? void 0 : _b.forLoopStartIndex) !== null && _c !== void 0 ? _c : (_e = (_d = cfg === null || cfg === void 0 ? void 0 : cfg.dataMapBean) === null || _d === void 0 ? void 0 : _d.for_loop) === null || _e === void 0 ? void 0 : _e.startIndex;
22363
+ const v = (_e = (_c = cfg === null || cfg === void 0 ? void 0 : cfg.forLoopStartIndex) !== null && _c !== void 0 ? _c : (_d = cfg === null || cfg === void 0 ? void 0 : cfg.dataMapJson) === null || _d === void 0 ? void 0 : _d.forLoopStartIndex) !== null && _e !== void 0 ? _e : (_g = (_f = cfg === null || cfg === void 0 ? void 0 : cfg.dataMapBean) === null || _f === void 0 ? void 0 : _f.for_loop) === null || _g === void 0 ? void 0 : _g.startIndex;
22356
22364
  if (v != null)
22357
22365
  return Number(v);
22358
- return (_f = this.startStep) !== null && _f !== void 0 ? _f : null;
22366
+ return (_h = this.startStep) !== null && _h !== void 0 ? _h : null;
22359
22367
  }
22360
22368
  /** Loop End dropdown value: prefer forLoopEndIndex from config (or dataMapJson/dataMapBean), else endStep */
22361
22369
  getLoopEndFormValue() {
22362
- var _a, _b, _c, _d, _e, _f;
22370
+ var _a, _b, _c, _d, _e, _f, _g, _h;
22371
+ const currentFormValue = (_b = (_a = this.editForm) === null || _a === void 0 ? void 0 : _a.get('endStep')) === null || _b === void 0 ? void 0 : _b.value;
22372
+ if (currentFormValue !== null && currentFormValue !== undefined)
22373
+ return Number(currentFormValue);
22363
22374
  const cfg = this.config;
22364
- const v = (_c = (_a = cfg === null || cfg === void 0 ? void 0 : cfg.forLoopEndIndex) !== null && _a !== void 0 ? _a : (_b = cfg === null || cfg === void 0 ? void 0 : cfg.dataMapJson) === null || _b === void 0 ? void 0 : _b.forLoopEndIndex) !== null && _c !== void 0 ? _c : (_e = (_d = cfg === null || cfg === void 0 ? void 0 : cfg.dataMapBean) === null || _d === void 0 ? void 0 : _d.for_loop) === null || _e === void 0 ? void 0 : _e.endIndex;
22375
+ const v = (_e = (_c = cfg === null || cfg === void 0 ? void 0 : cfg.forLoopEndIndex) !== null && _c !== void 0 ? _c : (_d = cfg === null || cfg === void 0 ? void 0 : cfg.dataMapJson) === null || _d === void 0 ? void 0 : _d.forLoopEndIndex) !== null && _e !== void 0 ? _e : (_g = (_f = cfg === null || cfg === void 0 ? void 0 : cfg.dataMapBean) === null || _f === void 0 ? void 0 : _f.for_loop) === null || _g === void 0 ? void 0 : _g.endIndex;
22365
22376
  if (v != null)
22366
22377
  return Number(v);
22367
- return (_f = this.endStep) !== null && _f !== void 0 ? _f : null;
22378
+ return (_h = this.endStep) !== null && _h !== void 0 ? _h : null;
22368
22379
  }
22369
22380
  buildEditForm() {
22370
22381
  var _a, _b, _c, _d, _e;
@@ -22614,13 +22625,14 @@ class TestCaseLoopStepComponent {
22614
22625
  const cfg = this.config;
22615
22626
  const forLoopTestDataId = (_c = (_a = cfg === null || cfg === void 0 ? void 0 : cfg.forLoopTestDataId) !== null && _a !== void 0 ? _a : (_b = cfg === null || cfg === void 0 ? void 0 : cfg.dataMapJson) === null || _b === void 0 ? void 0 : _b.forLoopTestDataId) !== null && _c !== void 0 ? _c : (_e = (_d = cfg === null || cfg === void 0 ? void 0 : cfg.dataMapBean) === null || _d === void 0 ? void 0 : _d.for_loop) === null || _e === void 0 ? void 0 : _e.testDataId;
22616
22627
  const selectedVal = this.loopType === 'for' ? this.getTestDataProfileFormValue() : undefined;
22617
- // If we have a preselected id but it's not in the current options list (e.g. options not loaded yet), add a placeholder option so the dropdown can show the selection
22618
- if (this.loopType === 'for' && forLoopTestDataId != null) {
22619
- const idStr = String(forLoopTestDataId);
22628
+ // Keep the selected profile visible by label even when server-search replaces the option list.
22629
+ const selectedProfileId = selectedVal !== null && selectedVal !== void 0 ? selectedVal : forLoopTestDataId;
22630
+ if (this.loopType === 'for' && selectedProfileId != null && selectedProfileId !== '') {
22631
+ const idStr = String(selectedProfileId);
22620
22632
  const alreadyInList = options.some((o) => { var _a; return String((_a = o.id) !== null && _a !== void 0 ? _a : o.value) === idStr; });
22621
22633
  if (!alreadyInList) {
22622
- const displayName = this.resolveTestDataProfileName(forLoopTestDataId) || this.resolveTestDataProfileName(this.testDataProfile) || 'Selected profile';
22623
- options = [{ id: forLoopTestDataId, value: forLoopTestDataId, name: displayName, label: displayName }, ...options];
22634
+ const displayName = this.resolveTestDataProfileName(selectedProfileId) || this.resolveTestDataProfileName(this.testDataProfile) || 'Selected profile';
22635
+ options = [{ id: selectedProfileId, value: selectedProfileId, name: displayName, label: displayName }, ...options];
22624
22636
  }
22625
22637
  }
22626
22638
  this.testDataProfileSelectConfig = Object.assign(Object.assign({ key: 'testDataProfile', placeholder: 'Testdataprofile', searchable: true, serverSearch: true, initialFetchOnOpen: true, hasMore: this.hasMoreDataProfiles, isLoading: this.isLoadingDataProfiles, options }, (selectedVal !== undefined && selectedVal !== '' && { selectedValue: selectedVal })), { onChange: (value) => {
@@ -22656,6 +22668,27 @@ class TestCaseLoopStepComponent {
22656
22668
  label: option.name
22657
22669
  }));
22658
22670
  }
22671
+ /** Best-known persisted label for the selected test data profile, even when current search results exclude it. */
22672
+ getStoredTestDataProfileLabel() {
22673
+ var _a, _b, _c, _d;
22674
+ const candidates = [
22675
+ this.testDataProfile,
22676
+ (_a = this.config) === null || _a === void 0 ? void 0 : _a.testDataProfile,
22677
+ (_c = (_b = this.config) === null || _b === void 0 ? void 0 : _b.testData) === null || _c === void 0 ? void 0 : _c.name,
22678
+ (_d = this.config) === null || _d === void 0 ? void 0 : _d.action,
22679
+ ];
22680
+ for (const candidate of candidates) {
22681
+ const value = candidate != null ? String(candidate).trim() : '';
22682
+ if (!value)
22683
+ continue;
22684
+ if (value === 'Test Data profile')
22685
+ continue;
22686
+ if (/^\d+$/.test(value))
22687
+ continue;
22688
+ return value;
22689
+ }
22690
+ return '';
22691
+ }
22659
22692
  /** Resolve a data profile id/value back to the display name used by the dropdown trigger. */
22660
22693
  resolveTestDataProfileName(value) {
22661
22694
  if (value == null || value === '')
@@ -22663,6 +22696,9 @@ class TestCaseLoopStepComponent {
22663
22696
  const match = this.dataProfileOptions.find(option => option.id === value || String(option.id) === String(value) || option.name === value);
22664
22697
  if (match === null || match === void 0 ? void 0 : match.name)
22665
22698
  return match.name;
22699
+ const storedLabel = this.getStoredTestDataProfileLabel();
22700
+ if (storedLabel)
22701
+ return storedLabel;
22666
22702
  return typeof value === 'string' ? value : String(value);
22667
22703
  }
22668
22704
  /** Data length (N) of the currently selected test data profile; 0 if none selected or not found. */
@@ -22712,33 +22748,20 @@ class TestCaseLoopStepComponent {
22712
22748
  };
22713
22749
  return [...this.getLoopStepSelectOptions(), endOption];
22714
22750
  }
22715
- /** Handle data profile selection: update display, clamp start/end to new profile range, refresh start/end dropdowns. */
22751
+ /** Handle data profile selection: update display and reset start/end like the old UI. */
22716
22752
  onDataProfileChange(profileId) {
22717
- var _a, _b, _c, _d, _e, _f, _g, _h;
22753
+ var _a, _b;
22718
22754
  this.onTestDataProfileChange(profileId);
22719
22755
  if (this.loopType !== 'for')
22720
22756
  return;
22721
- const N = this.getSelectedProfileDataLength();
22722
- if (N === 0)
22723
- return;
22724
- const options = this.getLoopStepOptions();
22725
- const maxVal = options.length > 0 ? options[options.length - 1] : 1;
22726
- let startVal = (_c = (_b = (_a = this.editForm) === null || _a === void 0 ? void 0 : _a.get('startStep')) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : this.startStep;
22727
- let endVal = (_f = (_e = (_d = this.editForm) === null || _d === void 0 ? void 0 : _d.get('endStep')) === null || _e === void 0 ? void 0 : _e.value) !== null && _f !== void 0 ? _f : this.endStep;
22728
- if (startVal != null && startVal > maxVal)
22729
- startVal = maxVal;
22730
- if (endVal != null && endVal > maxVal)
22731
- endVal = maxVal;
22732
- if (startVal != null && endVal != null && startVal > endVal)
22733
- endVal = startVal;
22757
+ const startVal = TestCaseLoopStepComponent.LOOP_INDEX_START;
22758
+ const endVal = TestCaseLoopStepComponent.LOOP_INDEX_END;
22734
22759
  if (this.editForm) {
22735
- if (startVal != null)
22736
- (_g = this.editForm.get('startStep')) === null || _g === void 0 ? void 0 : _g.setValue(startVal);
22737
- if (endVal != null)
22738
- (_h = this.editForm.get('endStep')) === null || _h === void 0 ? void 0 : _h.setValue(endVal);
22760
+ (_a = this.editForm.get('startStep')) === null || _a === void 0 ? void 0 : _a.setValue(startVal);
22761
+ (_b = this.editForm.get('endStep')) === null || _b === void 0 ? void 0 : _b.setValue(endVal);
22739
22762
  }
22740
- this.startStep = startVal !== null && startVal !== void 0 ? startVal : undefined;
22741
- this.endStep = endVal !== null && endVal !== void 0 ? endVal : undefined;
22763
+ this.startStep = startVal;
22764
+ this.endStep = endVal;
22742
22765
  this.updateStartEndStepSelectConfigsSelectedValues();
22743
22766
  this.cdr.detectChanges();
22744
22767
  }