comand-component-library 4.2.83 → 4.2.84
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
package/src/ComponentLibrary.vue
CHANGED
|
@@ -1283,7 +1283,7 @@
|
|
|
1283
1283
|
<h2 class="headline-demopage" id="section-multistep-form-wrapper">
|
|
1284
1284
|
<span>Multistepform-Wrapper</span>
|
|
1285
1285
|
<a href="#" class="button small icon-cog" title="Open Component Settings"
|
|
1286
|
-
@click.prevent="openSettingsSidebar('
|
|
1286
|
+
@click.prevent="openSettingsSidebar('CmdMultistepFormWrapper')">
|
|
1287
1287
|
</a>
|
|
1288
1288
|
</h2>
|
|
1289
1289
|
<h3>Data provided by property</h3>
|
|
@@ -1372,15 +1372,14 @@
|
|
|
1372
1372
|
</div>
|
|
1373
1373
|
</CmdForm>
|
|
1374
1374
|
</template>
|
|
1375
|
-
<template v-slot:page-4>
|
|
1375
|
+
<template v-slot:page-4="props">
|
|
1376
1376
|
<h3>Page 4</h3>
|
|
1377
|
-
Content Page 4
|
|
1378
|
-
</template>
|
|
1379
|
-
<template v-slot:page-5="props">
|
|
1380
|
-
<h3>Page 5</h3>
|
|
1381
1377
|
<CmdForm
|
|
1382
|
-
|
|
1378
|
+
:cmdHeadline=" { headlineText: 'Confirmation', headlineLevel: 3 }"
|
|
1379
|
+
:submitButton="{ disabled : props.atleastOneStepWithError }"
|
|
1380
|
+
:cancelButton="{ show: false }"
|
|
1383
1381
|
>
|
|
1382
|
+
<p>Please confirm that all data ou provided is legit.</p>
|
|
1384
1383
|
<CmdFormElement
|
|
1385
1384
|
element="input"
|
|
1386
1385
|
type="checkbox"
|
|
@@ -1393,12 +1392,12 @@
|
|
|
1393
1392
|
@validation-status-change="setValidationStatusCheckbox($event, 'confirm-data-privacy', props)"
|
|
1394
1393
|
/>
|
|
1395
1394
|
</CmdForm>
|
|
1396
|
-
props.
|
|
1395
|
+
props.atleastOneStepWithError: {{ props.atleastOneStepWithError }}
|
|
1396
|
+
</template>
|
|
1397
|
+
<template>
|
|
1398
|
+
<h3>Page 5 - Confirmation</h3>
|
|
1399
|
+
<p>Thank you for sending your request!</p>
|
|
1397
1400
|
</template>
|
|
1398
|
-
<twmplate>
|
|
1399
|
-
<h3>Page 6 - Confirmation</h3>
|
|
1400
|
-
<p>Thank you for seding your request!</p>
|
|
1401
|
-
</twmplate>
|
|
1402
1401
|
</CmdMultistepFormWrapper>
|
|
1403
1402
|
<h3>Data provided by slot</h3>
|
|
1404
1403
|
<CmdMultistepFormWrapper>
|
|
@@ -15,19 +15,22 @@
|
|
|
15
15
|
</slot>
|
|
16
16
|
<!-- begin slot for progress-bar -->
|
|
17
17
|
|
|
18
|
+
<!-- begin main cntent for page -->
|
|
18
19
|
<div v-show="page === currentPage" :class="'multistep-page-' + page" v-for="(page, index) in numberOfPages" :key="index">
|
|
19
|
-
<CmdSystemMessage v-if="
|
|
20
|
+
<CmdSystemMessage v-if="validationStatusForSteps.some(item => item.page === page)" :systemMessage="getSystemMessage(page)" validationStatus="error" />
|
|
21
|
+
|
|
20
22
|
<!-- begin slot for page content -->
|
|
21
23
|
<slot
|
|
22
24
|
:name="'page-' + page"
|
|
23
25
|
:setErrorOnPage="(message) => setErrorOnPage(page, message)"
|
|
24
26
|
:removeErrorOnPage="() => removeErrorOnPage(page)"
|
|
25
|
-
:
|
|
27
|
+
:atleastOneStepWithError="atleastOneStepWithError"
|
|
26
28
|
:formDataForPage="formDataForPage(page)"
|
|
27
29
|
:updateFormDataForPage="(event) => updateFormDataForPage(page, event)"
|
|
28
30
|
/>
|
|
29
31
|
<!-- end slot for page content -->
|
|
30
32
|
</div>
|
|
33
|
+
<!-- end main cntent for page -->
|
|
31
34
|
|
|
32
35
|
<!-- begin slot for pagination -->
|
|
33
36
|
<slot name="pagination"
|
|
@@ -56,7 +59,7 @@ export default {
|
|
|
56
59
|
data () {
|
|
57
60
|
return {
|
|
58
61
|
currentPage: 1,
|
|
59
|
-
|
|
62
|
+
validationStatusForSteps: [],
|
|
60
63
|
inputMade: [],
|
|
61
64
|
formData: {}
|
|
62
65
|
}
|
|
@@ -72,13 +75,6 @@ export default {
|
|
|
72
75
|
show: true
|
|
73
76
|
}
|
|
74
77
|
}
|
|
75
|
-
},
|
|
76
|
-
/**
|
|
77
|
-
* properties for CmdMultistepFormProgressBar-component
|
|
78
|
-
*/
|
|
79
|
-
showButtonWrapper: {
|
|
80
|
-
type: Boolean,
|
|
81
|
-
default: true
|
|
82
78
|
},
|
|
83
79
|
/**
|
|
84
80
|
* properties for CmdLink-component
|
|
@@ -117,29 +113,29 @@ export default {
|
|
|
117
113
|
this.formData[page] = event
|
|
118
114
|
},
|
|
119
115
|
getSystemMessage(page) {
|
|
120
|
-
const pageEntry = this.
|
|
116
|
+
const pageEntry = this.validationStatusForSteps.find(item => item.page === page);
|
|
121
117
|
return pageEntry.message
|
|
122
118
|
},
|
|
123
119
|
setErrorOnPage(page, message) {
|
|
124
|
-
const exists = this.
|
|
120
|
+
const exists = this.validationStatusForSteps.some(item => item.page === page);
|
|
125
121
|
|
|
126
122
|
if(!this.inputMade.includes(page)) {
|
|
127
123
|
this.inputMade.push(page)
|
|
128
124
|
}
|
|
129
125
|
|
|
130
126
|
if (!exists) {
|
|
131
|
-
this.
|
|
127
|
+
this.validationStatusForSteps.push({ page: page, message: message });
|
|
132
128
|
}
|
|
133
129
|
},
|
|
134
130
|
removeErrorOnPage(page) {
|
|
135
|
-
const index = this.
|
|
131
|
+
const index = this.validationStatusForSteps.findIndex(item => item.page === page);
|
|
136
132
|
|
|
137
133
|
if(!this.inputMade.includes(page)) {
|
|
138
134
|
this.inputMade.push(page)
|
|
139
135
|
}
|
|
140
136
|
|
|
141
137
|
if (index !== -1) {
|
|
142
|
-
this.
|
|
138
|
+
this.validationStatusForSteps.splice(index, 1);
|
|
143
139
|
}
|
|
144
140
|
},
|
|
145
141
|
setCurrentPage(page) {
|
|
@@ -157,24 +153,27 @@ export default {
|
|
|
157
153
|
}
|
|
158
154
|
},
|
|
159
155
|
computed: {
|
|
160
|
-
|
|
161
|
-
|
|
156
|
+
// check if at leat one step has status 'error'
|
|
157
|
+
atleastOneStepWithError() {
|
|
158
|
+
return this.validationStatusForSteps.length > 0 || this.inputMade.length === 0
|
|
162
159
|
},
|
|
160
|
+
// check if a page ha
|
|
163
161
|
pageHasError() {
|
|
164
|
-
return this.
|
|
162
|
+
return this.validationStatusForSteps.some((item) => {
|
|
165
163
|
return item.page === this.currentPage
|
|
166
164
|
})
|
|
167
165
|
},
|
|
166
|
+
// get steps filled correctly (status 'success')
|
|
168
167
|
successSteps() {
|
|
169
168
|
const steps = []
|
|
170
169
|
|
|
171
170
|
if(this.inputMade.length) {
|
|
172
171
|
for(let i = 0; i < this.numberOfPages; i++) {
|
|
173
|
-
const success = !this.
|
|
172
|
+
const success = !this.validationStatusForSteps.find((item) => {
|
|
174
173
|
return item.page === i + 1
|
|
175
174
|
})
|
|
176
175
|
|
|
177
|
-
// if no
|
|
176
|
+
// if no validationStatusForSteps is found (all steps are 'success' ant at least one input was made)
|
|
178
177
|
if(success && this.inputMade.includes(i + 1)) {
|
|
179
178
|
steps.push(i + 1)
|
|
180
179
|
}
|
|
@@ -183,9 +182,10 @@ export default {
|
|
|
183
182
|
|
|
184
183
|
return steps
|
|
185
184
|
},
|
|
185
|
+
// get steps filled incorrectly (status 'error')
|
|
186
186
|
errorSteps() {
|
|
187
187
|
const steps = []
|
|
188
|
-
this.
|
|
188
|
+
this.validationStatusForSteps.forEach((item) => {
|
|
189
189
|
steps.push(item.page)
|
|
190
190
|
})
|
|
191
191
|
|
|
@@ -200,9 +200,11 @@ export default {
|
|
|
200
200
|
|
|
201
201
|
return steps
|
|
202
202
|
},
|
|
203
|
+
// get number of pages
|
|
203
204
|
numberOfPages() {
|
|
204
205
|
return Object.keys(this.$slots).filter(key => key.startsWith("page-")).length
|
|
205
206
|
},
|
|
207
|
+
// set properties for inner CmdMultistepFormProgressBar
|
|
206
208
|
cmdMultistepFormProgressBarProperties() {
|
|
207
209
|
return {
|
|
208
210
|
show: true,
|
|
@@ -210,6 +212,7 @@ export default {
|
|
|
210
212
|
...this.cmdMultistepFormProgressBar
|
|
211
213
|
}
|
|
212
214
|
},
|
|
215
|
+
// set properties for inner CmdPagination
|
|
213
216
|
cmdPaginationProperties() {
|
|
214
217
|
return {
|
|
215
218
|
pages: null,
|
|
@@ -233,9 +236,11 @@ export default {
|
|
|
233
236
|
</script>
|
|
234
237
|
|
|
235
238
|
<style>
|
|
239
|
+
/* begin cmd-multistepform-wrapper ------------------------------------------------------------------------------------------ */
|
|
236
240
|
.cmd-multistepform-wrapper {
|
|
237
241
|
display: flex;
|
|
238
242
|
flex-direction: column;
|
|
239
243
|
gap: var(--default-gap);
|
|
240
244
|
}
|
|
245
|
+
/* end cmd-multistepform-wrapper ------------------------------------------------------------------------------------------ */
|
|
241
246
|
</style>
|