@cqa-lib/cqa-ui 1.1.57 → 1.1.58

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.
@@ -6222,6 +6222,7 @@ class LoopStepComponent extends BaseStepComponent {
6222
6222
  // Output event for when iteration selection changes
6223
6223
  this.onIterationChange = new EventEmitter();
6224
6224
  this.selectedIteration = null;
6225
+ this.userSelectedIterationId = null; // Track user's manual selection
6225
6226
  }
6226
6227
  ngOnInit() {
6227
6228
  // Build config from individual inputs
@@ -6252,26 +6253,49 @@ class LoopStepComponent extends BaseStepComponent {
6252
6253
  const currentValue = changes['selectedIterationId'].currentValue;
6253
6254
  const previousValue = changes['selectedIterationId'].previousValue;
6254
6255
  if (currentValue !== previousValue) {
6255
- // If selectedIterationId is provided and different, use it
6256
- if (currentValue) {
6256
+ // If user has manually selected an iteration, don't override it unless the input matches
6257
+ if (this.userSelectedIterationId && this.userSelectedIterationId === currentValue) {
6258
+ // Input matches user's selection, keep it
6257
6259
  const found = this.iterations.find(iter => iter.id === currentValue);
6258
6260
  if (found) {
6259
6261
  this.selectedIteration = found;
6260
6262
  }
6263
+ }
6264
+ else if (!this.userSelectedIterationId) {
6265
+ // No user selection, use the input value
6266
+ if (currentValue) {
6267
+ const found = this.iterations.find(iter => iter.id === currentValue);
6268
+ if (found) {
6269
+ this.selectedIteration = found;
6270
+ }
6271
+ else {
6272
+ this.selectDefaultIteration();
6273
+ }
6274
+ }
6261
6275
  else {
6262
6276
  this.selectDefaultIteration();
6263
6277
  }
6264
6278
  }
6265
- else {
6266
- this.selectDefaultIteration();
6267
- }
6279
+ // If input doesn't match user selection, don't override user's choice
6268
6280
  }
6269
6281
  }
6270
6282
  // Update selection when iterations array changes
6271
6283
  if (changes['iterations'] && this.iterations && this.iterations.length > 0) {
6272
6284
  // Only reselect if we don't have a valid selection or if selectedIterationId changed
6273
6285
  if (!this.selectedIteration || !this.iterations.some(iter => iter.id === this.selectedIteration?.id)) {
6274
- this.selectDefaultIteration();
6286
+ // If user has selected something, try to preserve it
6287
+ if (this.userSelectedIterationId) {
6288
+ const found = this.iterations.find(iter => iter.id === this.userSelectedIterationId);
6289
+ if (found) {
6290
+ this.selectedIteration = found;
6291
+ }
6292
+ else {
6293
+ this.selectDefaultIteration();
6294
+ }
6295
+ }
6296
+ else {
6297
+ this.selectDefaultIteration();
6298
+ }
6275
6299
  }
6276
6300
  }
6277
6301
  // Update config when inputs change
@@ -6314,12 +6338,9 @@ class LoopStepComponent extends BaseStepComponent {
6314
6338
  }
6315
6339
  }
6316
6340
  handleIterationChange(iterationId) {
6341
+ // Store the user's manual selection
6342
+ this.userSelectedIterationId = iterationId;
6317
6343
  this.selectedIteration = this.iterations.find(iter => iter.id === iterationId) || null;
6318
- // Update the selectedIterationId to match the user's selection
6319
- // This ensures consistency
6320
- if (this.selectedIteration) {
6321
- // Keep the internal state in sync
6322
- }
6323
6344
  // Emit the event with the iteration ID
6324
6345
  this.onIterationChange.emit(iterationId);
6325
6346
  }