lkt-step-process 2.0.11 → 2.0.12
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/dist/build.d.ts +3 -3
- package/dist/build.js +181 -153
- package/dist/lib-components/LktStepProcess.vue.d.ts +11556 -164
- package/package.json +1 -1
- package/src/lib-components/LktStepProcess.vue +26 -2
package/package.json
CHANGED
|
@@ -162,7 +162,19 @@
|
|
|
162
162
|
});
|
|
163
163
|
|
|
164
164
|
const onNext = (data: any) => {
|
|
165
|
-
|
|
165
|
+
let nextKey = stepsHaystack.value[currentStepIndex.value]?.nextKey;
|
|
166
|
+
let nextIndex = currentStepIndex.value + 1;
|
|
167
|
+
|
|
168
|
+
if (typeof nextKey === 'function') nextKey = nextKey();
|
|
169
|
+
if (typeof nextKey === 'string') {
|
|
170
|
+
let needle = stepsHaystack.value.findIndex((z) => {
|
|
171
|
+
return z.key === nextKey;
|
|
172
|
+
})
|
|
173
|
+
|
|
174
|
+
if (needle > -1) nextIndex = needle;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
currentStep.value = stepsHaystack.value[nextIndex].key;
|
|
166
178
|
if (currentStepIndex.value === (stepsHaystack.value.length - 1)) {
|
|
167
179
|
emit('finish', data);
|
|
168
180
|
|
|
@@ -171,7 +183,19 @@
|
|
|
171
183
|
}
|
|
172
184
|
},
|
|
173
185
|
onPrev = (data: any) => {
|
|
174
|
-
|
|
186
|
+
let prevKey = stepsHaystack.value[currentStepIndex.value]?.prevKey;
|
|
187
|
+
let nextIndex = currentStepIndex.value - 1;
|
|
188
|
+
|
|
189
|
+
if (typeof prevKey === 'function') prevKey = prevKey();
|
|
190
|
+
if (typeof prevKey === 'string') {
|
|
191
|
+
let needle = stepsHaystack.value.findIndex((z) => {
|
|
192
|
+
return z.key === prevKey;
|
|
193
|
+
})
|
|
194
|
+
|
|
195
|
+
if (needle > -1) nextIndex = needle;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
currentStep.value = stepsHaystack.value[nextIndex].key;
|
|
175
199
|
emit('prev', data);
|
|
176
200
|
};
|
|
177
201
|
|