2024-02-13 06:22:45 +00:00
|
|
|
<template>
|
|
|
|
<div :class="cx('root')" role="tablist" v-bind="ptmi('root')">
|
|
|
|
<slot v-if="$slots.start" name="start" />
|
2024-06-04 06:23:00 +00:00
|
|
|
<slot />
|
2024-02-13 06:22:45 +00:00
|
|
|
<slot v-if="$slots.end" name="end" />
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { UniqueComponentId } from 'primevue/utils';
|
|
|
|
import BaseStepper from './BaseStepper.vue';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'Stepper',
|
|
|
|
extends: BaseStepper,
|
2024-02-21 09:05:55 +00:00
|
|
|
inheritAttrs: false,
|
2024-06-04 06:23:00 +00:00
|
|
|
emits: ['update:value'],
|
2024-02-13 06:22:45 +00:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
id: this.$attrs.id,
|
2024-06-04 06:23:00 +00:00
|
|
|
d_value: this.value
|
2024-02-13 06:22:45 +00:00
|
|
|
};
|
|
|
|
},
|
|
|
|
watch: {
|
2024-06-04 06:23:00 +00:00
|
|
|
'$attrs.id'(newValue) {
|
2024-04-16 09:35:02 +00:00
|
|
|
this.id = newValue || UniqueComponentId();
|
2024-02-13 06:22:45 +00:00
|
|
|
},
|
2024-06-04 06:23:00 +00:00
|
|
|
value(newValue) {
|
|
|
|
this.d_value = newValue;
|
2024-02-13 06:22:45 +00:00
|
|
|
}
|
|
|
|
},
|
2024-04-16 09:35:02 +00:00
|
|
|
mounted() {
|
|
|
|
this.id = this.id || UniqueComponentId();
|
|
|
|
},
|
2024-02-13 06:22:45 +00:00
|
|
|
methods: {
|
2024-06-04 06:23:00 +00:00
|
|
|
updateValue(newValue) {
|
|
|
|
if (this.d_value !== newValue) {
|
|
|
|
this.d_value = newValue;
|
|
|
|
this.$emit('update:value', newValue);
|
2024-02-13 06:22:45 +00:00
|
|
|
}
|
|
|
|
},
|
2024-06-04 06:23:00 +00:00
|
|
|
isStepActive(value) {
|
|
|
|
return this.d_value === value;
|
2024-02-13 06:22:45 +00:00
|
|
|
},
|
2024-06-04 06:23:00 +00:00
|
|
|
isStepDisabled() {
|
|
|
|
return this.linear;
|
2024-02-13 06:22:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|