@redseed/redseed-ui-vue3 7.6.1 → 7.6.2
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
|
@@ -15,6 +15,10 @@ const props = defineProps({
|
|
|
15
15
|
type: Boolean,
|
|
16
16
|
default: false,
|
|
17
17
|
},
|
|
18
|
+
showLabel: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: true,
|
|
21
|
+
},
|
|
18
22
|
sm: {
|
|
19
23
|
type: Boolean,
|
|
20
24
|
default: false,
|
|
@@ -27,10 +31,18 @@ const props = defineProps({
|
|
|
27
31
|
type: Boolean,
|
|
28
32
|
default: false,
|
|
29
33
|
},
|
|
34
|
+
// when the number of steps reaches threshold, use small indicator
|
|
35
|
+
threshold: {
|
|
36
|
+
type: Number,
|
|
37
|
+
default: 10,
|
|
38
|
+
validator: value => value >= 10,
|
|
39
|
+
}
|
|
30
40
|
})
|
|
31
41
|
|
|
32
42
|
const internalSteps = ref(props.steps)
|
|
33
43
|
|
|
44
|
+
const thresholdReached = computed(() => internalSteps.value.length >= props.threshold)
|
|
45
|
+
|
|
34
46
|
const activeStep = ref(props.steps.find(step => !!step.active) || props.steps[0])
|
|
35
47
|
|
|
36
48
|
const activeStepIndex = computed(() => internalSteps.value.findIndex(step => step === activeStep.value))
|
|
@@ -58,12 +70,18 @@ function handleStepClick(clickedStep) {
|
|
|
58
70
|
|
|
59
71
|
const defaultSize = computed(() => !props.sm && !props.md && !props.lg)
|
|
60
72
|
|
|
73
|
+
const isSmall = computed(() => props.sm || thresholdReached.value)
|
|
74
|
+
|
|
75
|
+
const isMedium = computed(() => props.md && !thresholdReached.value)
|
|
76
|
+
|
|
77
|
+
const isLarge = computed(() => (props.lg || defaultSize.value) && !thresholdReached.value)
|
|
78
|
+
|
|
61
79
|
const componentClass = computed(() => [
|
|
62
80
|
'rsui-progress-tracker',
|
|
63
81
|
{
|
|
64
|
-
'rsui-progress-tracker--sm':
|
|
65
|
-
'rsui-progress-tracker--md':
|
|
66
|
-
'rsui-progress-tracker--lg':
|
|
82
|
+
'rsui-progress-tracker--sm': isSmall.value,
|
|
83
|
+
'rsui-progress-tracker--md': isMedium.value,
|
|
84
|
+
'rsui-progress-tracker--lg': isLarge.value,
|
|
67
85
|
}
|
|
68
86
|
])
|
|
69
87
|
</script>
|
|
@@ -77,16 +95,18 @@ const componentClass = computed(() => [
|
|
|
77
95
|
:active="index === activeStepIndex"
|
|
78
96
|
:clickable="clickable"
|
|
79
97
|
:skippable="skippable || index === activeStepIndex + 1"
|
|
80
|
-
:sm="
|
|
81
|
-
:md="
|
|
82
|
-
:lg="
|
|
98
|
+
:sm="isSmall"
|
|
99
|
+
:md="isMedium"
|
|
100
|
+
:lg="isLarge"
|
|
83
101
|
@click="handleStepClick(step)"
|
|
84
102
|
>
|
|
85
103
|
<template #indicator>
|
|
86
104
|
{{ index + 1 }}
|
|
87
105
|
</template>
|
|
88
106
|
|
|
89
|
-
|
|
107
|
+
<div v-if="showLabel">
|
|
108
|
+
{{ step.label }}
|
|
109
|
+
</div>
|
|
90
110
|
</ProgressTrackerStep>
|
|
91
111
|
</slot>
|
|
92
112
|
</div>
|