@cqa-lib/cqa-ui 1.1.472 → 1.1.473
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.
- package/esm2020/lib/step-builder/step-builder-group/step-builder-group.component.mjs +39 -2
- package/fesm2015/cqa-lib-cqa-ui.mjs +38 -1
- package/fesm2015/cqa-lib-cqa-ui.mjs.map +1 -1
- package/fesm2020/cqa-lib-cqa-ui.mjs +38 -1
- package/fesm2020/cqa-lib-cqa-ui.mjs.map +1 -1
- package/lib/step-builder/step-builder-group/step-builder-group.component.d.ts +8 -0
- package/package.json +1 -1
|
@@ -40737,6 +40737,10 @@ class StepBuilderGroupComponent {
|
|
|
40737
40737
|
this.searchStepGroups = new EventEmitter();
|
|
40738
40738
|
this.selectedStepGroup = null;
|
|
40739
40739
|
this.runtimeVariableValues = {};
|
|
40740
|
+
/** Tracks initial state for edit mode to detect changes */
|
|
40741
|
+
this.initialStepGroupIdSnapshot = null;
|
|
40742
|
+
this.initialRuntimeValuesSnapshot = '{}';
|
|
40743
|
+
this.snapshotReady = false;
|
|
40740
40744
|
this.stepGroupForm = this.fb.group({
|
|
40741
40745
|
stepGroupId: [null, Validators.required]
|
|
40742
40746
|
});
|
|
@@ -40796,6 +40800,10 @@ class StepBuilderGroupComponent {
|
|
|
40796
40800
|
if (foundGroup) {
|
|
40797
40801
|
this.stepGroupForm.patchValue({ stepGroupId: this.initialStepGroupId });
|
|
40798
40802
|
this.selectedStepGroup = foundGroup;
|
|
40803
|
+
// Capture snapshot for change detection (will be recaptured if runtime variables load later)
|
|
40804
|
+
if (this.editMode) {
|
|
40805
|
+
this.captureInitialSnapshot();
|
|
40806
|
+
}
|
|
40799
40807
|
}
|
|
40800
40808
|
}
|
|
40801
40809
|
}
|
|
@@ -40847,6 +40855,10 @@ class StepBuilderGroupComponent {
|
|
|
40847
40855
|
}
|
|
40848
40856
|
});
|
|
40849
40857
|
}
|
|
40858
|
+
// Capture snapshot after runtime values are initialized (for edit mode change detection)
|
|
40859
|
+
if (this.editMode) {
|
|
40860
|
+
this.captureInitialSnapshot();
|
|
40861
|
+
}
|
|
40850
40862
|
}
|
|
40851
40863
|
onRuntimeVariableChange(groupId, paramName, value) {
|
|
40852
40864
|
if (!this.runtimeVariableValues[groupId]) {
|
|
@@ -40875,8 +40887,33 @@ class StepBuilderGroupComponent {
|
|
|
40875
40887
|
onCancel() {
|
|
40876
40888
|
this.cancelled.emit();
|
|
40877
40889
|
}
|
|
40890
|
+
/** Returns true if the form has changed from its initial state (edit mode only) */
|
|
40891
|
+
hasChanges() {
|
|
40892
|
+
if (!this.editMode) {
|
|
40893
|
+
return true; // In create mode, always allow submission
|
|
40894
|
+
}
|
|
40895
|
+
// Until the snapshot is ready, treat as no changes (disable button)
|
|
40896
|
+
if (!this.snapshotReady) {
|
|
40897
|
+
return false;
|
|
40898
|
+
}
|
|
40899
|
+
const currentStepGroupId = this.stepGroupForm.value.stepGroupId;
|
|
40900
|
+
if (currentStepGroupId !== this.initialStepGroupIdSnapshot) {
|
|
40901
|
+
return true;
|
|
40902
|
+
}
|
|
40903
|
+
return JSON.stringify(this.runtimeVariableValues) !== this.initialRuntimeValuesSnapshot;
|
|
40904
|
+
}
|
|
40905
|
+
/** Captures the current state as the baseline for change detection */
|
|
40906
|
+
captureInitialSnapshot() {
|
|
40907
|
+
// Only capture when a valid step group is selected
|
|
40908
|
+
if (!this.selectedStepGroup) {
|
|
40909
|
+
return;
|
|
40910
|
+
}
|
|
40911
|
+
this.initialStepGroupIdSnapshot = this.stepGroupForm.value.stepGroupId || null;
|
|
40912
|
+
this.initialRuntimeValuesSnapshot = JSON.stringify(this.runtimeVariableValues);
|
|
40913
|
+
this.snapshotReady = true;
|
|
40914
|
+
}
|
|
40878
40915
|
isFormValid() {
|
|
40879
|
-
return this.stepGroupForm.valid && !!this.selectedStepGroup;
|
|
40916
|
+
return this.stepGroupForm.valid && !!this.selectedStepGroup && this.hasChanges();
|
|
40880
40917
|
}
|
|
40881
40918
|
}
|
|
40882
40919
|
StepBuilderGroupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: StepBuilderGroupComponent, deps: [{ token: i1$1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component });
|