lkt-step-process 2.0.2 → 2.0.4

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lkt-step-process",
3
- "version": "2.0.2",
3
+ "version": "2.0.4",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "module": "./dist/build.js",
@@ -0,0 +1,37 @@
1
+ <script setup lang="ts">
2
+
3
+ import { ButtonNavProps } from '../config/ButtonNavProps';
4
+ import { SetupContext, useSlots } from 'vue';
5
+
6
+ const props = withDefaults(defineProps<ButtonNavProps>(), {
7
+
8
+ });
9
+
10
+ const emit = defineEmits(['prev', 'next']);
11
+ const slots: SetupContext['slots'] = useSlots();
12
+ </script>
13
+
14
+ <template>
15
+ <div class="lkt-step-process-buttons">
16
+ <lkt-button
17
+ ref="prevButtonRef"
18
+ v-if="prevButton"
19
+ v-show="!isLoading && !prevHidden"
20
+ v-bind="prevButton"
21
+ @click="emit('prev')"
22
+ />
23
+
24
+ <template v-if="slots['between-buttons-ever']" v-show="!isLoading">
25
+ <slot name="between-buttons-ever"/>
26
+ </template>
27
+
28
+
29
+ <lkt-button
30
+ ref="nextButtonRef"
31
+ v-if="nextButton"
32
+ v-show="!isLoading && !nextHidden"
33
+ v-bind="nextButton"
34
+ @click="emit('next')"
35
+ />
36
+ </div>
37
+ </template>
@@ -3,10 +3,14 @@
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
 
@@ -106,6 +110,23 @@
106
110
  const r = [];
107
111
  if (currentStep.value) r.push(`step-${currentStep.value}`);
108
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
+ };
109
130
  });
110
131
 
111
132
  const onNext = (data: any) => {
@@ -145,22 +166,16 @@
145
166
  <article class="lkt-step-process" :class="classes">
146
167
  <lkt-header v-if="header && Object.keys(header).length > 0" v-bind="header" />
147
168
 
148
- <div class="lkt-step-process-buttons">
149
- <lkt-button
150
- ref="prevButtonRef"
151
- v-if="computedPrevButton"
152
- v-show="!isLoading && !prevHidden"
153
- v-bind="computedPrevButton"
154
- v-on:click="onPrev"
155
- />
156
- <lkt-button
157
- ref="nextButtonRef"
158
- v-if="computedNextButton"
159
- v-show="!isLoading && !nextHidden"
160
- v-bind="computedNextButton"
161
- v-on:click="onNext"
162
- />
163
- </div>
169
+ <button-nav
170
+ v-if="computedRenderTopButtonNav"
171
+ v-bind="computedButtonNavProps"
172
+ @prev="onPrev"
173
+ @next="onNext"
174
+ >
175
+ <template #between-buttons-ever="{}" v-if="slots['between-buttons-ever']">
176
+ <slot name="between-buttons-ever"/>
177
+ </template>
178
+ </button-nav>
164
179
 
165
180
  <div class="lkt-step-process_content" v-if="!isLoading">
166
181
  <div class="lkt-grid-1">
@@ -170,5 +185,16 @@
170
185
  </div>
171
186
  </div>
172
187
  <lkt-loader v-if="isLoading" />
188
+
189
+ <button-nav
190
+ v-if="computedRenderBottomButtonNav"
191
+ v-bind="computedButtonNavProps"
192
+ @prev="onPrev"
193
+ @next="onNext"
194
+ >
195
+ <template #between-buttons-ever="{}" v-if="slots['between-buttons-ever']">
196
+ <slot name="between-buttons-ever"/>
197
+ </template>
198
+ </button-nav>
173
199
  </article>
174
200
  </template>