@visns-studio/visns-components 5.14.2 → 5.14.3
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/package.json
CHANGED
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"react-dom": "^17.0.0 || ^18.0.0"
|
|
89
89
|
},
|
|
90
90
|
"name": "@visns-studio/visns-components",
|
|
91
|
-
"version": "5.14.
|
|
91
|
+
"version": "5.14.3",
|
|
92
92
|
"description": "Various packages to assist in the development of our Custom Applications.",
|
|
93
93
|
"main": "src/index.js",
|
|
94
94
|
"files": [
|
|
@@ -122,15 +122,17 @@ const OcrTemplateEnhanced = ({
|
|
|
122
122
|
});
|
|
123
123
|
setCompletedSteps(newCompletedSteps);
|
|
124
124
|
|
|
125
|
-
//
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
125
|
+
// Only auto-advance if we haven't manually navigated
|
|
126
|
+
if (!hasAutoJumped) {
|
|
127
|
+
const currentStepData = journeySteps.find(s => s.id === currentStep);
|
|
128
|
+
if (currentStepData?.isCompleted() && currentStep < journeySteps.length) {
|
|
129
|
+
const nextIncompleteStep = journeySteps.find(s => s.id > currentStep && !newCompletedSteps.has(s.id));
|
|
130
|
+
if (nextIncompleteStep) {
|
|
131
|
+
setCurrentStep(nextIncompleteStep.id);
|
|
132
|
+
}
|
|
131
133
|
}
|
|
132
134
|
}
|
|
133
|
-
}, [ocrTemplateBuilder, data, currentStep]);
|
|
135
|
+
}, [ocrTemplateBuilder, data, currentStep, hasAutoJumped]);
|
|
134
136
|
|
|
135
137
|
// Initial step detection - jump to latest completed step on load (only once)
|
|
136
138
|
React.useEffect(() => {
|
|
@@ -168,8 +170,31 @@ const OcrTemplateEnhanced = ({
|
|
|
168
170
|
|
|
169
171
|
// Manual navigation function to prevent auto-jump interference
|
|
170
172
|
const navigateToStep = (stepId) => {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
+
// Validate step ID
|
|
174
|
+
if (stepId < 1 || stepId > journeySteps.length) {
|
|
175
|
+
console.warn(`Invalid step ID: ${stepId}`);
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const targetStep = journeySteps.find(s => s.id === stepId);
|
|
180
|
+
if (!targetStep) {
|
|
181
|
+
console.warn(`Step not found: ${stepId}`);
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// Check if we can access this step
|
|
186
|
+
const stepIndex = journeySteps.findIndex(s => s.id === stepId);
|
|
187
|
+
const canAccess = stepIndex === 0 ||
|
|
188
|
+
completedSteps.has(stepId) ||
|
|
189
|
+
completedSteps.has(journeySteps[stepIndex - 1].id);
|
|
190
|
+
|
|
191
|
+
if (canAccess) {
|
|
192
|
+
console.log(`Navigating to step ${stepId}`);
|
|
193
|
+
setCurrentStep(stepId);
|
|
194
|
+
setHasAutoJumped(true); // Prevent future auto-jumping after manual navigation
|
|
195
|
+
} else {
|
|
196
|
+
console.warn(`Cannot access step ${stepId}. Step index: ${stepIndex}, Completed steps:`, Array.from(completedSteps));
|
|
197
|
+
}
|
|
173
198
|
};
|
|
174
199
|
|
|
175
200
|
// Enhanced smart categorization utility
|
|
@@ -1125,7 +1150,14 @@ const OcrTemplateEnhanced = ({
|
|
|
1125
1150
|
<div
|
|
1126
1151
|
key={step.id}
|
|
1127
1152
|
className={`${styles.progressStep} ${isActive ? styles.active : ''} ${isCompleted ? styles.completed : ''} ${!canAccess ? styles.disabled : ''}`}
|
|
1128
|
-
onClick={() =>
|
|
1153
|
+
onClick={() => {
|
|
1154
|
+
if (canAccess) {
|
|
1155
|
+
navigateToStep(step.id);
|
|
1156
|
+
} else {
|
|
1157
|
+
console.log(`Step ${step.id} not accessible. Completed steps:`, Array.from(completedSteps));
|
|
1158
|
+
}
|
|
1159
|
+
}}
|
|
1160
|
+
style={{ cursor: canAccess ? 'pointer' : 'not-allowed' }}
|
|
1129
1161
|
>
|
|
1130
1162
|
<div className={styles.stepIcon}>
|
|
1131
1163
|
{isCompleted ? (
|
|
@@ -1294,7 +1326,7 @@ const OcrTemplateEnhanced = ({
|
|
|
1294
1326
|
<div className={styles.journeyNavigation}>
|
|
1295
1327
|
<button
|
|
1296
1328
|
className={styles.navBtn}
|
|
1297
|
-
onClick={() => navigateToStep(
|
|
1329
|
+
onClick={() => navigateToStep(currentStep - 1)}
|
|
1298
1330
|
disabled={currentStep === 1}
|
|
1299
1331
|
>
|
|
1300
1332
|
<ArrowLeft size={16} />
|
|
@@ -1303,11 +1335,17 @@ const OcrTemplateEnhanced = ({
|
|
|
1303
1335
|
|
|
1304
1336
|
<div className={styles.stepIndicator}>
|
|
1305
1337
|
Step {currentStep} of {journeySteps.length}
|
|
1338
|
+
{completedSteps.has(currentStep) && (
|
|
1339
|
+
<span className={styles.completedBadge}>
|
|
1340
|
+
<CheckCircle2 size={14} />
|
|
1341
|
+
Completed
|
|
1342
|
+
</span>
|
|
1343
|
+
)}
|
|
1306
1344
|
</div>
|
|
1307
1345
|
|
|
1308
1346
|
<button
|
|
1309
1347
|
className={styles.navBtn}
|
|
1310
|
-
onClick={() => navigateToStep(
|
|
1348
|
+
onClick={() => navigateToStep(currentStep + 1)}
|
|
1311
1349
|
disabled={currentStep === journeySteps.length}
|
|
1312
1350
|
>
|
|
1313
1351
|
Next Step
|