lkt-step-process 2.0.1 → 2.0.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/dist/build.d.ts +3 -3
- package/dist/build.js +136 -85
- package/dist/components/ButtonNav.vue.d.ts +9 -0
- package/dist/config/ButtonNavProps.d.ts +8 -0
- package/dist/lib-components/LktStepProcess.vue.d.ts +1751 -367
- package/package.json +1 -1
- package/src/components/ButtonNav.vue +29 -0
- package/src/lib-components/LktStepProcess.vue +73 -28
package/package.json
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
|
|
3
|
+
import { ButtonNavProps } from '../config/ButtonNavProps';
|
|
4
|
+
|
|
5
|
+
const props = withDefaults(defineProps<ButtonNavProps>(), {
|
|
6
|
+
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const emit = defineEmits(['prev', 'next']);
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<div class="lkt-step-process-buttons">
|
|
14
|
+
<lkt-button
|
|
15
|
+
ref="prevButtonRef"
|
|
16
|
+
v-if="prevButton"
|
|
17
|
+
v-show="!isLoading && !prevHidden"
|
|
18
|
+
v-bind="prevButton"
|
|
19
|
+
@click="emit('prev')"
|
|
20
|
+
/>
|
|
21
|
+
<lkt-button
|
|
22
|
+
ref="nextButtonRef"
|
|
23
|
+
v-if="nextButton"
|
|
24
|
+
v-show="!isLoading && !nextHidden"
|
|
25
|
+
v-bind="nextButton"
|
|
26
|
+
@click="emit('next')"
|
|
27
|
+
/>
|
|
28
|
+
</div>
|
|
29
|
+
</template>
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { computed, ref, useSlots, watch } from 'vue';
|
|
2
|
+
import { computed, onMounted, ref, useSlots, watch } from 'vue';
|
|
3
3
|
import {
|
|
4
4
|
ButtonConfig,
|
|
5
5
|
getDefaultValues,
|
|
6
|
+
ItemCrudButtonNavPosition,
|
|
7
|
+
ItemCrudButtonNavVisibility,
|
|
6
8
|
StepProcess,
|
|
7
9
|
StepProcessConfig,
|
|
8
10
|
StepProcessStepConfig,
|
|
9
11
|
} from 'lkt-vue-kernel';
|
|
12
|
+
import ButtonNav from '@/components/ButtonNav.vue';
|
|
13
|
+
import { ButtonNavProps } from '@/config/ButtonNavProps';
|
|
10
14
|
|
|
11
15
|
const props = withDefaults(defineProps<StepProcessConfig>(), getDefaultValues(StepProcess));
|
|
12
16
|
|
|
@@ -47,8 +51,16 @@
|
|
|
47
51
|
return currentStepIndex.value === 0;
|
|
48
52
|
}),
|
|
49
53
|
computedPrevButton = computed(() => {
|
|
54
|
+
if (currentStepConfig.value?.prevButton === false) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (props.prevButton === false && !currentStepConfig.value?.prevButton) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
|
|
50
62
|
let r: ButtonConfig = { ...props.prevButton };
|
|
51
|
-
if (currentStepConfig.value?.prevButton) {
|
|
63
|
+
if (typeof currentStepConfig.value?.prevButton === 'object') {
|
|
52
64
|
r = { ...r, ...currentStepConfig.value?.prevButton };
|
|
53
65
|
}
|
|
54
66
|
if (typeof r.disabled === 'undefined') {
|
|
@@ -57,34 +69,64 @@
|
|
|
57
69
|
return r;
|
|
58
70
|
}),
|
|
59
71
|
computedNextButton = computed(() => {
|
|
72
|
+
if (currentStepConfig.value?.nextButton === false) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (props.nextButton === false && !currentStepConfig.value?.nextButton) {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
|
|
60
80
|
let r: ButtonConfig = { ...props.nextButton };
|
|
61
|
-
if (currentStepConfig.value?.nextButton) {
|
|
81
|
+
if (typeof currentStepConfig.value?.nextButton === 'object') {
|
|
62
82
|
r = { ...r, ...currentStepConfig.value?.nextButton };
|
|
63
83
|
}
|
|
64
84
|
return r;
|
|
65
85
|
}),
|
|
66
86
|
prevHidden = computed(() => {
|
|
67
|
-
if (typeof currentStepConfig.value
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
87
|
+
if (typeof currentStepConfig.value === 'object'){
|
|
88
|
+
if (typeof currentStepConfig.value?.prevHidden === 'function') {
|
|
89
|
+
return currentStepConfig.value.prevHidden(currentStepConfig.value, stepsHaystack.value);
|
|
90
|
+
}
|
|
91
|
+
if (typeof currentStepConfig.value?.prevHidden === 'boolean') {
|
|
92
|
+
return currentStepConfig.value.prevHidden;
|
|
93
|
+
}
|
|
72
94
|
}
|
|
73
95
|
return currentStepIndex.value === 0;
|
|
74
96
|
}),
|
|
75
97
|
nextHidden = computed(() => {
|
|
76
|
-
if (typeof currentStepConfig.value
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
98
|
+
if (typeof currentStepConfig.value === 'object') {
|
|
99
|
+
if (typeof currentStepConfig.value?.nextHidden === 'function') {
|
|
100
|
+
return currentStepConfig.value.nextHidden(currentStepConfig.value, stepsHaystack.value);
|
|
101
|
+
}
|
|
102
|
+
if (typeof currentStepConfig.value?.nextHidden === 'boolean') {
|
|
103
|
+
return currentStepConfig.value.nextHidden;
|
|
104
|
+
}
|
|
105
|
+
return currentStepConfig.value?.nextButton === false;
|
|
81
106
|
}
|
|
82
|
-
return
|
|
107
|
+
return true;
|
|
83
108
|
}),
|
|
84
109
|
classes = computed(() => {
|
|
85
110
|
const r = [];
|
|
86
111
|
if (currentStep.value) r.push(`step-${currentStep.value}`);
|
|
87
112
|
return r.join(' ');
|
|
113
|
+
}),
|
|
114
|
+
computedRenderTopButtonNav = computed(() => {
|
|
115
|
+
if (props.buttonNavVisibility === ItemCrudButtonNavVisibility.Never) return false;
|
|
116
|
+
return !props.buttonNavPosition || props.buttonNavPosition === ItemCrudButtonNavPosition.Top;
|
|
117
|
+
}),
|
|
118
|
+
computedRenderBottomButtonNav = computed(() => {
|
|
119
|
+
if (props.buttonNavVisibility === ItemCrudButtonNavVisibility.Never) return false;
|
|
120
|
+
return props.buttonNavPosition === ItemCrudButtonNavPosition.Bottom;
|
|
121
|
+
}),
|
|
122
|
+
computedButtonNavProps = computed(() => {
|
|
123
|
+
return <ButtonNavProps>{
|
|
124
|
+
isLoading: isLoading.value,
|
|
125
|
+
prevHidden: prevHidden.value,
|
|
126
|
+
nextHidden: nextHidden.value,
|
|
127
|
+
prevButton: computedPrevButton.value,
|
|
128
|
+
nextButton: computedNextButton.value,
|
|
129
|
+
};
|
|
88
130
|
});
|
|
89
131
|
|
|
90
132
|
const onNext = (data: any) => {
|
|
@@ -114,26 +156,22 @@
|
|
|
114
156
|
startLoader: () => isLoading.value = true,
|
|
115
157
|
stopLoader: () => isLoading.value = false,
|
|
116
158
|
});
|
|
159
|
+
|
|
160
|
+
onMounted(() => {
|
|
161
|
+
if (!currentStep.value && stepsHaystack.value.length > 0) currentStep.value = stepsHaystack.value[0].key
|
|
162
|
+
})
|
|
117
163
|
</script>
|
|
118
164
|
|
|
119
165
|
<template>
|
|
120
166
|
<article class="lkt-step-process" :class="classes">
|
|
121
167
|
<lkt-header v-if="header && Object.keys(header).length > 0" v-bind="header" />
|
|
122
168
|
|
|
123
|
-
<
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
/>
|
|
130
|
-
<lkt-button
|
|
131
|
-
ref="nextButtonRef"
|
|
132
|
-
v-show="!isLoading && !nextHidden"
|
|
133
|
-
v-bind="computedNextButton"
|
|
134
|
-
v-on:click="onNext"
|
|
135
|
-
/>
|
|
136
|
-
</div>
|
|
169
|
+
<button-nav
|
|
170
|
+
v-if="computedRenderTopButtonNav"
|
|
171
|
+
v-bind="computedButtonNavProps"
|
|
172
|
+
@prev="onPrev"
|
|
173
|
+
@next="onNext"
|
|
174
|
+
/>
|
|
137
175
|
|
|
138
176
|
<div class="lkt-step-process_content" v-if="!isLoading">
|
|
139
177
|
<div class="lkt-grid-1">
|
|
@@ -143,5 +181,12 @@
|
|
|
143
181
|
</div>
|
|
144
182
|
</div>
|
|
145
183
|
<lkt-loader v-if="isLoading" />
|
|
184
|
+
|
|
185
|
+
<button-nav
|
|
186
|
+
v-if="computedRenderBottomButtonNav"
|
|
187
|
+
v-bind="computedButtonNavProps"
|
|
188
|
+
@prev="onPrev"
|
|
189
|
+
@next="onNext"
|
|
190
|
+
/>
|
|
146
191
|
</article>
|
|
147
192
|
</template>
|