lkt-step-process 2.0.13 → 2.0.15
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 +2 -2
- package/dist/build.js +191 -160
- package/dist/components/ButtonNav.vue.d.ts +1 -0
- package/dist/config/ButtonNavProps.d.ts +3 -1
- package/dist/lib-components/LktStepProcess.vue.d.ts +1567 -1040
- package/package.json +1 -1
- package/src/components/ButtonNav.vue +12 -5
- package/src/lib-components/LktStepProcess.vue +33 -3
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
|
|
3
3
|
import { ButtonNavProps } from '../config/ButtonNavProps';
|
|
4
|
-
import { ref, SetupContext, useSlots } from 'vue';
|
|
4
|
+
import { computed, ref, SetupContext, useSlots } from 'vue';
|
|
5
5
|
import { DotConfig } from 'lkt-vue-kernel';
|
|
6
6
|
|
|
7
7
|
const props = withDefaults(defineProps<ButtonNavProps>(), {});
|
|
@@ -22,10 +22,16 @@
|
|
|
22
22
|
prevButtonRef.value.click();
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
|
+
|
|
26
|
+
const stepHasDotsInfo = computed(() => {
|
|
27
|
+
if (typeof props.currentStepConfig?.excludedFromTotalCount === 'function') return !props.currentStepConfig.excludedFromTotalCount();
|
|
28
|
+
if (typeof props.currentStepConfig?.excludedFromTotalCount === 'boolean') return !props.currentStepConfig.excludedFromTotalCount;
|
|
29
|
+
return true;
|
|
30
|
+
})
|
|
25
31
|
</script>
|
|
26
32
|
|
|
27
33
|
<template>
|
|
28
|
-
<div class="lkt-step-process--nav">
|
|
34
|
+
<div class="lkt-step-process--nav" v-if="prevButton || nextButton || (stepHasDotsInfo && (slots['nav-info'] || dots && amountOfSteps > 0))">
|
|
29
35
|
<lkt-button
|
|
30
36
|
ref="prevButtonRef"
|
|
31
37
|
v-if="prevButton"
|
|
@@ -34,11 +40,12 @@
|
|
|
34
40
|
class="is-prev-button"
|
|
35
41
|
/>
|
|
36
42
|
|
|
37
|
-
<div class="lkt-step-process--nav-info" v-if="slots['nav-info'] || dots && amountOfSteps > 0">
|
|
43
|
+
<div class="lkt-step-process--nav-info" v-if="stepHasDotsInfo && (slots['nav-info'] || dots && amountOfSteps > 0)">
|
|
38
44
|
<template v-if="slots['nav-info']">
|
|
39
45
|
<slot
|
|
40
46
|
name="nav-info"
|
|
41
47
|
v-bind="{
|
|
48
|
+
visibleStep: visibleStepIndex,
|
|
42
49
|
currentStep,
|
|
43
50
|
currentStepIndex,
|
|
44
51
|
amountOfSteps,
|
|
@@ -46,12 +53,12 @@
|
|
|
46
53
|
/>
|
|
47
54
|
</template>
|
|
48
55
|
|
|
49
|
-
<div class="lkt-step-process--dots" v-if="dots && amountOfSteps > 0">
|
|
56
|
+
<div class="lkt-step-process--dots" v-if="dots && amountOfSteps > 0 && stepHasDotsInfo">
|
|
50
57
|
<lkt-dot
|
|
51
58
|
v-for="n in amountOfSteps"
|
|
52
59
|
v-bind="<DotConfig>{
|
|
53
60
|
text: dotsNumbers ? n : '',
|
|
54
|
-
class: n ===
|
|
61
|
+
class: n === visibleStepIndex ? 'is-active' : '',
|
|
55
62
|
}"
|
|
56
63
|
/>
|
|
57
64
|
</div>
|
|
@@ -49,6 +49,20 @@
|
|
|
49
49
|
const currentStepIndex = computed(() => {
|
|
50
50
|
return stepsHaystack.value.findIndex((step: StepProcessStepConfig) => step.key === currentStep.value);
|
|
51
51
|
}),
|
|
52
|
+
visibleStepIndex = computed(() => {
|
|
53
|
+
let baseIndex = stepsHaystack.value.findIndex((step: StepProcessStepConfig) => step.key === currentStep.value);
|
|
54
|
+
let r = baseIndex;
|
|
55
|
+
for (let i = 0; i < baseIndex; ++i) {
|
|
56
|
+
let excluded = false,
|
|
57
|
+
excludedValue = stepsHaystack.value[i].excludedFromTotalCount;
|
|
58
|
+
|
|
59
|
+
if (typeof excludedValue === 'function') excluded = excludedValue() === true;
|
|
60
|
+
else if (typeof excludedValue === 'boolean') excluded = excludedValue === true;
|
|
61
|
+
|
|
62
|
+
if (excluded) --r;
|
|
63
|
+
}
|
|
64
|
+
return r + 1;
|
|
65
|
+
}),
|
|
52
66
|
currentStepConfig = computed(() => {
|
|
53
67
|
return stepsHaystack.value[currentStepIndex.value];
|
|
54
68
|
}),
|
|
@@ -146,7 +160,15 @@
|
|
|
146
160
|
return props.buttonNavPosition === ItemCrudButtonNavPosition.Bottom;
|
|
147
161
|
}),
|
|
148
162
|
computedAmountOfSteps = computed(() => {
|
|
149
|
-
|
|
163
|
+
let r = 0;
|
|
164
|
+
stepsHaystack.value.forEach(step => {
|
|
165
|
+
let excluded = false;
|
|
166
|
+
if (typeof step.excludedFromTotalCount === 'function') excluded = step.excludedFromTotalCount() === true;
|
|
167
|
+
else if (typeof step.excludedFromTotalCount === 'boolean') excluded = step.excludedFromTotalCount === true;
|
|
168
|
+
|
|
169
|
+
if (!excluded) ++r;
|
|
170
|
+
})
|
|
171
|
+
return r;
|
|
150
172
|
}),
|
|
151
173
|
computedButtonNavProps = computed(() => {
|
|
152
174
|
return <ButtonNavProps>{
|
|
@@ -154,7 +176,9 @@
|
|
|
154
176
|
prevButton: computedPrevButton.value,
|
|
155
177
|
nextButton: computedNextButton.value,
|
|
156
178
|
currentStep: currentStep.value,
|
|
179
|
+
currentStepConfig: currentStepConfig.value,
|
|
157
180
|
currentStepIndex: currentStepIndex.value,
|
|
181
|
+
visibleStepIndex: visibleStepIndex.value,
|
|
158
182
|
amountOfSteps: computedAmountOfSteps.value,
|
|
159
183
|
dots: props.dots,
|
|
160
184
|
dotsNumbers: props.dotsNumbers,
|
|
@@ -216,6 +240,9 @@
|
|
|
216
240
|
|
|
217
241
|
case StepRenderType.RendersAndVisibleIfActive:
|
|
218
242
|
return stepKey === currentStep.value;
|
|
243
|
+
|
|
244
|
+
case StepRenderType.RendersAfterFirstActiveVisibleIfActive:
|
|
245
|
+
return firstRenderReached.value[stepKey] === true;
|
|
219
246
|
}
|
|
220
247
|
}
|
|
221
248
|
return stepKey === currentStep.value;
|
|
@@ -234,6 +261,7 @@
|
|
|
234
261
|
|
|
235
262
|
case StepRenderType.AlwaysRendersVisibleIfActive:
|
|
236
263
|
case StepRenderType.RendersAndVisibleIfActive:
|
|
264
|
+
case StepRenderType.RendersAfterFirstActiveVisibleIfActive:
|
|
237
265
|
return stepKey === currentStep.value;
|
|
238
266
|
}
|
|
239
267
|
}
|
|
@@ -269,10 +297,11 @@
|
|
|
269
297
|
ref="navRef"
|
|
270
298
|
v-bind="computedButtonNavProps"
|
|
271
299
|
>
|
|
272
|
-
<template #nav-info="{currentStep, currentStepIndex, amountOfSteps}" v-if="slots['nav-info']">
|
|
300
|
+
<template #nav-info="{currentStep, currentStepIndex, amountOfSteps, visibleStep}" v-if="slots['nav-info']">
|
|
273
301
|
<slot
|
|
274
302
|
name="nav-info"
|
|
275
303
|
v-bind="{
|
|
304
|
+
visibleStep,
|
|
276
305
|
currentStep,
|
|
277
306
|
currentStepIndex,
|
|
278
307
|
amountOfSteps: computedAmountOfSteps,
|
|
@@ -297,10 +326,11 @@
|
|
|
297
326
|
ref="navRef"
|
|
298
327
|
v-bind="computedButtonNavProps"
|
|
299
328
|
>
|
|
300
|
-
<template #nav-info="{currentStep, currentStepIndex, amountOfSteps}" v-if="slots['nav-info']">
|
|
329
|
+
<template #nav-info="{currentStep, currentStepIndex, amountOfSteps, visibleStep}" v-if="slots['nav-info']">
|
|
301
330
|
<slot
|
|
302
331
|
name="nav-info"
|
|
303
332
|
v-bind="{
|
|
333
|
+
visibleStep,
|
|
304
334
|
currentStep,
|
|
305
335
|
currentStepIndex,
|
|
306
336
|
amountOfSteps: computedAmountOfSteps,
|