lkt-step-process 2.0.10 → 2.0.11

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.10",
3
+ "version": "2.0.11",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "module": "./dist/build.js",
@@ -13,7 +13,10 @@
13
13
  "./theme/default": "./theme/default.css"
14
14
  },
15
15
  "types": "./dist/index.d.ts",
16
- "files": ["dist/*", "src/**/*.vue"],
16
+ "files": [
17
+ "dist/*",
18
+ "src/**/*.vue"
19
+ ],
17
20
  "license": "MIT",
18
21
  "sideEffects": false,
19
22
  "scripts": {
@@ -32,10 +32,9 @@
32
32
  v-show="!isLoading"
33
33
  v-bind="prevButton"
34
34
  class="is-prev-button"
35
- @click="emit('prev')"
36
35
  />
37
36
 
38
- <div class="lkt-step-process--nav-info">
37
+ <div class="lkt-step-process--nav-info" v-if="slots['nav-info'] || dots && amountOfSteps > 0">
39
38
  <template v-if="slots['nav-info']">
40
39
  <slot
41
40
  name="nav-info"
@@ -65,7 +64,6 @@
65
64
  v-show="!isLoading"
66
65
  v-bind="nextButton"
67
66
  class="is-next-button"
68
- @click="emit('next')"
69
67
  />
70
68
  </div>
71
69
  </template>
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, onMounted, ref, useSlots, watch } from 'vue';
3
3
  import {
4
- ButtonConfig,
4
+ ButtonConfig, ClickEventArgs,
5
5
  getDefaultValues,
6
6
  ItemCrudButtonNavPosition,
7
7
  ItemCrudButtonNavVisibility,
@@ -70,7 +70,24 @@
70
70
  if (typeof r.disabled === 'undefined') {
71
71
  r.disabled = prevDisabled.value;
72
72
  }
73
- return r;
73
+
74
+ const clientClickEvent = r.events?.click;
75
+
76
+ return {
77
+ ...r,
78
+ events: {
79
+ ...r.events,
80
+ click: (data: ClickEventArgs) => {
81
+
82
+ if (typeof clientClickEvent === 'function') clientClickEvent(data);
83
+
84
+ if (data.httpResponse?.success === false) {
85
+ return;
86
+ }
87
+ onPrev(data);
88
+ }
89
+ }
90
+ };
74
91
  }),
75
92
  computedNextButton = computed(() => {
76
93
  if (currentStepConfig.value?.nextButton === false) {
@@ -90,7 +107,24 @@
90
107
  if (typeof currentStepConfig.value?.nextButton === 'object') {
91
108
  r = { ...r, ...currentStepConfig.value?.nextButton };
92
109
  }
93
- return r;
110
+
111
+ const clientClickEvent = r.events?.click;
112
+
113
+ return {
114
+ ...r,
115
+ events: {
116
+ ...r.events,
117
+ click: (data: ClickEventArgs) => {
118
+
119
+ if (typeof clientClickEvent === 'function') clientClickEvent(data);
120
+
121
+ if (data.httpResponse?.success === false) {
122
+ return;
123
+ }
124
+ onNext(data);
125
+ }
126
+ }
127
+ };
94
128
  }),
95
129
  classes = computed(() => {
96
130
  const r = [];
@@ -119,6 +153,12 @@
119
153
  dots: props.dots,
120
154
  dotsNumbers: props.dotsNumbers,
121
155
  };
156
+ }),
157
+ computedHasButtonNavContent = computed(() => {
158
+ return typeof computedPrevButton.value === 'object'
159
+ || typeof computedNextButton.value === 'object'
160
+ || props.dots
161
+ || typeof slots['nav-info'] !== 'undefined';
122
162
  });
123
163
 
124
164
  const onNext = (data: any) => {
@@ -159,11 +199,9 @@
159
199
  <lkt-header v-if="header && Object.keys(header).length > 0" v-bind="header" />
160
200
 
161
201
  <button-nav
162
- v-if="computedRenderTopButtonNav"
202
+ v-if="computedRenderTopButtonNav && computedHasButtonNavContent"
163
203
  ref="navRef"
164
204
  v-bind="computedButtonNavProps"
165
- @prev="onPrev"
166
- @next="onNext"
167
205
  >
168
206
  <template #nav-info="{currentStep, currentStepIndex, amountOfSteps}" v-if="slots['nav-info']">
169
207
  <slot
@@ -189,11 +227,9 @@
189
227
  <lkt-loader v-if="isLoading" />
190
228
 
191
229
  <button-nav
192
- v-if="computedRenderBottomButtonNav"
230
+ v-if="computedRenderBottomButtonNav && computedHasButtonNavContent"
193
231
  ref="navRef"
194
232
  v-bind="computedButtonNavProps"
195
- @prev="onPrev"
196
- @next="onNext"
197
233
  >
198
234
  <template #nav-info="{currentStep, currentStepIndex, amountOfSteps}" v-if="slots['nav-info']">
199
235
  <slot