comand-component-library 4.2.79 → 4.2.81
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/comand-component-library.css +1 -1
- package/dist/comand-component-library.js +3144 -3036
- package/package.json +1 -1
- package/src/ComponentLibrary.vue +124 -36
- package/src/assets/data/listOfComponents.json +1 -1
- package/src/components/CmdForm.vue +35 -32
- package/src/components/CmdFormElement.vue +3 -1
- package/src/components/CmdLink.vue +1 -1
- package/src/components/CmdMultistepFormProgressBar.vue +32 -4
- package/src/components/CmdMultistepFormWrapper.vue +35 -9
package/package.json
CHANGED
package/src/ComponentLibrary.vue
CHANGED
|
@@ -1258,6 +1258,26 @@
|
|
|
1258
1258
|
</CmdWidthLimitationWrapper>
|
|
1259
1259
|
<!-- end main-navigation --------------------------------------------------------------------------------------------------->
|
|
1260
1260
|
|
|
1261
|
+
<!-- begin multistep-form-progress-bar --------------------------------------------------------------------------------------------------->
|
|
1262
|
+
<CmdWidthLimitationWrapper>
|
|
1263
|
+
<h2 class="headline-demopage" id="section-multistep-form-progress-bar">
|
|
1264
|
+
<span>Multistepform-Progressbar</span>
|
|
1265
|
+
<a href="#" class="button small icon-cog" title="Open Component Settings"
|
|
1266
|
+
@click.prevent="openSettingsSidebar('CmdMultistepFormProgressBar')"></a>
|
|
1267
|
+
</h2>
|
|
1268
|
+
<h3>Steps with icons</h3>
|
|
1269
|
+
<CmdMultistepFormProgressBar ref="CmdMultistepFormProgressBar" :multisteps="multistepsData.withIcon"
|
|
1270
|
+
v-bind="cmdMultistepFormProgressBarSettingsData" @click="showPageMultistep = $event.index + 1" />
|
|
1271
|
+
<h3>Router</h3>
|
|
1272
|
+
<CmdMultistepFormProgressBar ref="CmdMultistepFormProgressBar" :multisteps="multistepsData.router"
|
|
1273
|
+
v-bind="cmdMultistepFormProgressBarSettingsData" @click="showPageMultistep = $event.index + 1" />
|
|
1274
|
+
<div>
|
|
1275
|
+
<p>Page {{ showPageMultistep }}</p>
|
|
1276
|
+
</div>
|
|
1277
|
+
</CmdWidthLimitationWrapper>
|
|
1278
|
+
<!-- end multistep-form-progress-bar --------------------------------------------------------------------------------------------------->
|
|
1279
|
+
|
|
1280
|
+
|
|
1261
1281
|
<!-- begin multistep-form-wrapper --------------------------------------------------------------------------------------------------->
|
|
1262
1282
|
<CmdWidthLimitationWrapper>
|
|
1263
1283
|
<h2 class="headline-demopage" id="section-multistep-form-wrapper">
|
|
@@ -1269,37 +1289,108 @@
|
|
|
1269
1289
|
<h3>Data provided by property</h3>
|
|
1270
1290
|
<CmdMultistepFormWrapper>
|
|
1271
1291
|
<template v-slot:page-1="props">
|
|
1292
|
+
<h3>Page 1 - all fields required</h3>
|
|
1272
1293
|
<CmdForm
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1294
|
+
:formElements="multistepFormWrapperPage1Data"
|
|
1295
|
+
:useSlot="false"
|
|
1296
|
+
@validation-status-change="toggleSystemMessage($event, props)"
|
|
1297
|
+
:submitButton="{show: false}"
|
|
1298
|
+
:modelValue="props.formDataForPage"
|
|
1299
|
+
@update:modelValue="props.updateFormDataForPage"
|
|
1300
|
+
/>
|
|
1279
1301
|
<a href="#" @click.prevent="props.setErrorOnPage('This is an error!')">Set Error</a><br />
|
|
1280
1302
|
<a href="#" @click.prevent="props.removeErrorOnPage">Remove Error</a>
|
|
1281
1303
|
</template>
|
|
1282
1304
|
<template v-slot:page-2="props">
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1305
|
+
<h3>Page 2 - 2/2 fields required (in slot)</h3>
|
|
1306
|
+
<CmdForm
|
|
1307
|
+
:submitButton="{show: false}"
|
|
1308
|
+
:cmdHeadline=" { headlineText: 'Form-Elements in Slot', headlineLevel: 3 }"
|
|
1309
|
+
>
|
|
1310
|
+
<CmdFormElement
|
|
1311
|
+
element="input"
|
|
1312
|
+
type="text"
|
|
1313
|
+
labelText="Telephone:"
|
|
1314
|
+
name="page-2-telephone"
|
|
1315
|
+
id="page-2-telephone"
|
|
1316
|
+
placeholder="Enter phone number"
|
|
1317
|
+
:required="true"
|
|
1318
|
+
:modelValue="props.formDataForPage['page-2-telephone']"
|
|
1319
|
+
@update:modelValue="setValue($event, 'page-2-telephone', props)"
|
|
1320
|
+
@validation-status-change="setValidationStatus($event, 'page-2-telephone', props)"
|
|
1321
|
+
/>
|
|
1322
|
+
<CmdFormElement
|
|
1323
|
+
element="input"
|
|
1324
|
+
type="email"
|
|
1325
|
+
labelText="E-Mail:"
|
|
1326
|
+
name="page-2-email"
|
|
1327
|
+
id="page-2-email"
|
|
1328
|
+
:required="true"
|
|
1329
|
+
placeholder="Enter email address"
|
|
1330
|
+
:modelValue="props.formDataForPage['page-2-email']"
|
|
1331
|
+
@update:modelValue="setValue($event, 'page-2-email', props)"
|
|
1332
|
+
@validation-status-change="setValidationStatus($event, 'page-2-email', props)"
|
|
1333
|
+
/>
|
|
1334
|
+
</CmdForm>
|
|
1287
1335
|
<a href="#" @click.prevent="props.setErrorOnPage('This is an error!')">Set Error</a>
|
|
1288
1336
|
</template>
|
|
1289
|
-
<template v-slot:page-3>
|
|
1290
|
-
|
|
1337
|
+
<template v-slot:page-3="props">
|
|
1338
|
+
<h3>Page 3 - no fields required</h3>
|
|
1339
|
+
<CmdForm
|
|
1340
|
+
@validation-status-change="toggleSystemMessage($event, props)"
|
|
1341
|
+
:submitButton="{show: false}"
|
|
1342
|
+
:modelValue="props.formDataForPage"
|
|
1343
|
+
@update:modelValue="props.updateFormDataForPage"
|
|
1344
|
+
:cmdHeadline=" { headlineText: 'Form-Elements in Slot', headlineLevel: 3 }"
|
|
1345
|
+
>
|
|
1346
|
+
<CmdFormElement
|
|
1347
|
+
element="input"
|
|
1348
|
+
type="text"
|
|
1349
|
+
labelText="Street/No:"
|
|
1350
|
+
name="street-no"
|
|
1351
|
+
id="street-no"
|
|
1352
|
+
placeholder="Enter street and number"
|
|
1353
|
+
v-model="props.formDataForPage.streetNo"
|
|
1354
|
+
/>
|
|
1355
|
+
<div class="input-wrapper">
|
|
1356
|
+
<CmdFormElement
|
|
1357
|
+
element="input"
|
|
1358
|
+
type="number"
|
|
1359
|
+
labelText="Zip:"
|
|
1360
|
+
name="zip"
|
|
1361
|
+
id="zip"
|
|
1362
|
+
v-model="props.formDataForPage.zip"
|
|
1363
|
+
/>
|
|
1364
|
+
<CmdFormElement
|
|
1365
|
+
element="input"
|
|
1366
|
+
type="text"
|
|
1367
|
+
labelText="City:"
|
|
1368
|
+
name="city"
|
|
1369
|
+
id="city"
|
|
1370
|
+
v-model="props.formDataForPage.city"
|
|
1371
|
+
/>
|
|
1372
|
+
</div>
|
|
1373
|
+
</CmdForm>
|
|
1291
1374
|
</template>
|
|
1292
1375
|
<template v-slot:page-4>
|
|
1376
|
+
<h3>Page 4</h3>
|
|
1293
1377
|
Content Page 4
|
|
1294
1378
|
</template>
|
|
1295
1379
|
<template v-slot:page-5="props">
|
|
1380
|
+
<h3>Page 5</h3>
|
|
1296
1381
|
<CmdForm
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1382
|
+
:formElements="multistepFormWrapperPage1Data"
|
|
1383
|
+
:useSlot="false"
|
|
1384
|
+
@validation-status-change="toggleSystemMessage($event, props)"
|
|
1385
|
+
:submitButton="{disabled: props.atleastOnePageWithError}"
|
|
1386
|
+
:cancelButton="{ show: false}"
|
|
1387
|
+
/>
|
|
1301
1388
|
props.atleastOnPageWithError: {{ props.atleastOnePageWithError }}
|
|
1302
1389
|
</template>
|
|
1390
|
+
<twmplate>
|
|
1391
|
+
<h3>Page 6 - Confirmation</h3>
|
|
1392
|
+
<p>Thank you for seding your request!</p>
|
|
1393
|
+
</twmplate>
|
|
1303
1394
|
</CmdMultistepFormWrapper>
|
|
1304
1395
|
<h3>Data provided by slot</h3>
|
|
1305
1396
|
<CmdMultistepFormWrapper>
|
|
@@ -1373,25 +1464,6 @@
|
|
|
1373
1464
|
</CmdWidthLimitationWrapper>
|
|
1374
1465
|
<!-- end multistep-form-wrapper --------------------------------------------------------------------------------------------------->
|
|
1375
1466
|
|
|
1376
|
-
<!-- begin multistep-form-progress-bar --------------------------------------------------------------------------------------------------->
|
|
1377
|
-
<CmdWidthLimitationWrapper>
|
|
1378
|
-
<h2 class="headline-demopage" id="section-multistep-form-progress-bar">
|
|
1379
|
-
<span>Multistepform-Progressbar</span>
|
|
1380
|
-
<a href="#" class="button small icon-cog" title="Open Component Settings"
|
|
1381
|
-
@click.prevent="openSettingsSidebar('CmdMultistepFormProgressBar')"></a>
|
|
1382
|
-
</h2>
|
|
1383
|
-
<h3>Steps with icons</h3>
|
|
1384
|
-
<CmdMultistepFormProgressBar ref="CmdMultistepFormProgressBar" :multisteps="multistepsData.withIcon"
|
|
1385
|
-
v-bind="cmdMultistepFormProgressBarSettingsData" @click="showPageMultistep = $event.index + 1" />
|
|
1386
|
-
<h3>Router</h3>
|
|
1387
|
-
<CmdMultistepFormProgressBar ref="CmdMultistepFormProgressBar" :multisteps="multistepsData.router"
|
|
1388
|
-
v-bind="cmdMultistepFormProgressBarSettingsData" @click="showPageMultistep = $event.index + 1" />
|
|
1389
|
-
<div>
|
|
1390
|
-
<p>Page {{ showPageMultistep }}</p>
|
|
1391
|
-
</div>
|
|
1392
|
-
</CmdWidthLimitationWrapper>
|
|
1393
|
-
<!-- end multistep-form-progress-bar --------------------------------------------------------------------------------------------------->
|
|
1394
|
-
|
|
1395
1467
|
<!-- begin newsletter-subscription --------------------------------------------------------------------------------------------------->
|
|
1396
1468
|
<CmdWidthLimitationWrapper>
|
|
1397
1469
|
<h2 class="headline-demopage" id="section-newsletter-subscription">
|
|
@@ -2006,6 +2078,7 @@ export default {
|
|
|
2006
2078
|
inputPassword: "",
|
|
2007
2079
|
inputField1: "",
|
|
2008
2080
|
inputFieldRequired: "",
|
|
2081
|
+
formElementsWithError: ["page-2-telephone", "page-2-email"],
|
|
2009
2082
|
componentName: "",
|
|
2010
2083
|
componentProps: {},
|
|
2011
2084
|
componentSettings: {},
|
|
@@ -2118,6 +2191,22 @@ export default {
|
|
|
2118
2191
|
}
|
|
2119
2192
|
},
|
|
2120
2193
|
methods: {
|
|
2194
|
+
setValue(event, itemName, props) {
|
|
2195
|
+
const data = {
|
|
2196
|
+
...props.formDataForPage,
|
|
2197
|
+
[itemName]: event
|
|
2198
|
+
}
|
|
2199
|
+
props.updateFormDataForPage(data)
|
|
2200
|
+
},
|
|
2201
|
+
setValidationStatus(event, itemName, props) {
|
|
2202
|
+
if (event === "error" && !this.formElementsWithError.some(entry => entry.name === itemName)) {
|
|
2203
|
+
this.formElementsWithError.push(itemName)
|
|
2204
|
+
} else if (event === "success" && this.formElementsWithError.includes(itemName)) {
|
|
2205
|
+
this.formElementsWithError = this.formElementsWithError.filter((element) => element !== itemName)
|
|
2206
|
+
}
|
|
2207
|
+
const status = this.formElementsWithError.length > 0 ? "error" : "success"
|
|
2208
|
+
this.toggleSystemMessage(status, props)
|
|
2209
|
+
},
|
|
2121
2210
|
outputFormData(event) {
|
|
2122
2211
|
console.log("outputFormData", event)
|
|
2123
2212
|
},
|
|
@@ -2125,7 +2214,6 @@ export default {
|
|
|
2125
2214
|
alert(text)
|
|
2126
2215
|
},
|
|
2127
2216
|
toggleSystemMessage(event, props) {
|
|
2128
|
-
console.log("event", event)
|
|
2129
2217
|
if(event === "error") {
|
|
2130
2218
|
props.setErrorOnPage("Please fill all required fields!")
|
|
2131
2219
|
} else {
|
|
@@ -8,7 +8,18 @@
|
|
|
8
8
|
legendOptions.text
|
|
9
9
|
}}
|
|
10
10
|
</legend>
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
<CmdHeadline
|
|
13
|
+
v-if="cmdHeadline?.headlineText"
|
|
14
|
+
v-bind="cmdHeadline"
|
|
15
|
+
/>
|
|
16
|
+
|
|
17
|
+
<CmdSystemMessage
|
|
18
|
+
v-if="systemMessage.show && systemMessage.message"
|
|
19
|
+
:validationStatus="systemMessage.validationStatus"
|
|
20
|
+
:systemMessage="systemMessage.message"
|
|
21
|
+
/>
|
|
22
|
+
|
|
12
23
|
<!-- begin default-slot-content -->
|
|
13
24
|
<slot v-if="useSlot"></slot>
|
|
14
25
|
<!-- end default-slot-content -->
|
|
@@ -37,7 +48,7 @@
|
|
|
37
48
|
:maxlength="item.maxlength"
|
|
38
49
|
:nativeButton="item.nativeButton"
|
|
39
50
|
:colored="item.colored"
|
|
40
|
-
@validation-status-change="
|
|
51
|
+
@validation-status-change="formElementHasError($event, item.name)"
|
|
41
52
|
/>
|
|
42
53
|
<CmdInputGroup
|
|
43
54
|
v-else-if="item.component === 'CmdInputGroup'"
|
|
@@ -73,7 +84,7 @@
|
|
|
73
84
|
:minlength="item.minlength"
|
|
74
85
|
:maxlength="item.maxlength"
|
|
75
86
|
:nativeButton="item.nativeButton"
|
|
76
|
-
@validation-status-change="
|
|
87
|
+
@validation-status-change="formElementHasError($event, item.name)"
|
|
77
88
|
/>
|
|
78
89
|
<CmdInputGroup
|
|
79
90
|
v-else-if="item.component === 'CmdInputGroup'"
|
|
@@ -92,7 +103,7 @@
|
|
|
92
103
|
<small v-if="mandatoryText" class="mandatory-text"><sup>*</sup>{{ mandatoryText }}</small>
|
|
93
104
|
<!-- begin cancel-button (below fieldset) -->
|
|
94
105
|
<button
|
|
95
|
-
v-if="cancelButtonOptions
|
|
106
|
+
v-if="cancelButtonOptions.show"
|
|
96
107
|
:class="['button', {'stretch-on-small-devices': cancelButtonOptions.stretchOnSmallDevices, disabled: cancelButtonOptions.disabled, cancel: cancelButtonOptions.useDefaultStyling}]"
|
|
97
108
|
type="button"
|
|
98
109
|
@click="cancelFormSubmit"
|
|
@@ -168,7 +179,7 @@ export default {
|
|
|
168
179
|
validationStatus: "",
|
|
169
180
|
message: ""
|
|
170
181
|
},
|
|
171
|
-
|
|
182
|
+
formElementsWithError: []
|
|
172
183
|
}
|
|
173
184
|
},
|
|
174
185
|
props: {
|
|
@@ -256,22 +267,28 @@ export default {
|
|
|
256
267
|
type: Object,
|
|
257
268
|
required: false
|
|
258
269
|
},
|
|
259
|
-
|
|
270
|
+
/**
|
|
260
271
|
* submit-button to submit all form-data
|
|
261
272
|
*/
|
|
262
273
|
submitButton: {
|
|
263
274
|
type: Object,
|
|
264
275
|
required: false
|
|
276
|
+
},
|
|
277
|
+
/**
|
|
278
|
+
* properties for CmdHeadline-component
|
|
279
|
+
*/
|
|
280
|
+
cmdHeadline: {
|
|
281
|
+
type: Object,
|
|
282
|
+
required: false
|
|
265
283
|
}
|
|
266
284
|
},
|
|
267
285
|
mounted() {
|
|
268
|
-
// get the names of all elements that match the phrase and push to data-property
|
|
286
|
+
// get the names of all elements that match the phrase and push to data-property to initially collect all required field to set correct validationStatus for form
|
|
269
287
|
const requiredElementNames = this.formElements?.filter(element => element.required === true).map(element => element.name)
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
})*/
|
|
288
|
+
|
|
289
|
+
requiredElementNames?.forEach((name) => {
|
|
290
|
+
this.formElementsWithError.push(name)
|
|
291
|
+
})
|
|
275
292
|
},
|
|
276
293
|
computed: {
|
|
277
294
|
legendOptions() {
|
|
@@ -307,29 +324,15 @@ export default {
|
|
|
307
324
|
}
|
|
308
325
|
},
|
|
309
326
|
methods: {
|
|
310
|
-
formElementsWithStatus(event, itemName) {
|
|
311
|
-
if (!this.formElementsValidationStatus.some(entry => entry.name === itemName)) {
|
|
312
|
-
this.formElementsValidationStatus.push({name: itemName, status: event})
|
|
313
|
-
}
|
|
314
|
-
//const formElement = this.formElementsValidationStatus.find(element => element.name === itemName)
|
|
315
|
-
console.log("this.formElementsValidationStatus", this.formElementsValidationStatus)
|
|
316
|
-
// formElement.status = event
|
|
317
|
-
|
|
318
|
-
// this.$emit("validation-status-change", formElement)
|
|
319
|
-
},
|
|
320
|
-
|
|
321
|
-
/*
|
|
322
327
|
formElementHasError(event, itemName) {
|
|
323
|
-
if (event === "error" && !this.
|
|
324
|
-
this.
|
|
325
|
-
} else if (event === "success" && this.
|
|
326
|
-
this.
|
|
328
|
+
if (event === "error" && !this.formElementsWithError.some(entry => entry.name === itemName)) {
|
|
329
|
+
this.formElementsWithError.push(itemName)
|
|
330
|
+
} else if (event === "success" && this.formElementsWithError.includes(itemName)) {
|
|
331
|
+
this.formElementsWithError = this.formElementsWithError.filter((element) => element !== itemName)
|
|
327
332
|
}
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
this.$emit("validation-status-change", this.formElementsValidationStatus.length ? "error" : "success")
|
|
333
|
+
|
|
334
|
+
this.$emit("validation-status-change", this.formElementsWithError.length ? "error" : "success")
|
|
331
335
|
},
|
|
332
|
-
*/
|
|
333
336
|
createHtmlId,
|
|
334
337
|
showMessage(validationStatus, message) {
|
|
335
338
|
this.systemMessage.show = true
|
|
@@ -190,7 +190,7 @@
|
|
|
190
190
|
v-bind="elementAttributes"
|
|
191
191
|
:id="htmlId"
|
|
192
192
|
@blur="onBlur"
|
|
193
|
-
@change="
|
|
193
|
+
@change="onChange">
|
|
194
194
|
|
|
195
195
|
<option v-if="!groupSelectOptionsByInitialLetters"
|
|
196
196
|
v-for="(option, index) in selectOptions"
|
|
@@ -885,6 +885,8 @@ export default {
|
|
|
885
885
|
this.$emit('update:modelValue', event.target.value)
|
|
886
886
|
},
|
|
887
887
|
onChange(event) {
|
|
888
|
+
this.validateInput(event)
|
|
889
|
+
|
|
888
890
|
if (typeof this.modelValue === "boolean") {
|
|
889
891
|
this.$emit("update:modelValue", event.target.checked)
|
|
890
892
|
} else if (typeof this.modelValue === "string") {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<!-- begin CmdMultistepFormProgressBar ---------------------------------------------------------------------------------------- -->
|
|
3
3
|
<ol :class="['cmd-multistep-form-progress-bar', {'use-gap': useGap, 'full-width': fullWidth}]">
|
|
4
|
-
<li v-for="(step, index) in multisteps" :key="index" :class="errorLinkClass(index)">
|
|
4
|
+
<li v-for="(step, index) in multisteps" :key="index" :class="[errorLinkClass(index), successLinkClass(index)]">
|
|
5
5
|
<!-- begin CmdLink -->
|
|
6
6
|
<CmdLink
|
|
7
7
|
:linkType="step.linkType"
|
|
8
|
-
:class="['stretch-on-small-devices', activeLinkClass(index), errorLinkClass(index)]"
|
|
8
|
+
:class="['stretch-on-small-devices', activeLinkClass(index), errorLinkClass(index), successLinkClass(index)]"
|
|
9
9
|
:styleAsButton="styleAsButtons"
|
|
10
10
|
:highlightLevel="highlightLevel"
|
|
11
11
|
:path="step.path"
|
|
@@ -103,6 +103,15 @@ export default {
|
|
|
103
103
|
type: Array,
|
|
104
104
|
required: false
|
|
105
105
|
},
|
|
106
|
+
/**
|
|
107
|
+
* provide a list of steps, that should be highlighted as "success"
|
|
108
|
+
*
|
|
109
|
+
* @affectStyling: true
|
|
110
|
+
*/
|
|
111
|
+
successSteps: {
|
|
112
|
+
type: Array,
|
|
113
|
+
required: false
|
|
114
|
+
},
|
|
106
115
|
/**
|
|
107
116
|
* icon-class for separator shown between multisteps
|
|
108
117
|
*/
|
|
@@ -125,13 +134,19 @@ export default {
|
|
|
125
134
|
methods: {
|
|
126
135
|
activeLinkClass(index) {
|
|
127
136
|
if(this.activeLink === index) {
|
|
128
|
-
|
|
137
|
+
return "active"
|
|
129
138
|
}
|
|
130
139
|
return null
|
|
131
140
|
},
|
|
132
141
|
errorLinkClass(index) {
|
|
133
142
|
if(this.errorSteps?.includes(index + 1)) {
|
|
134
|
-
|
|
143
|
+
return "error"
|
|
144
|
+
}
|
|
145
|
+
return null
|
|
146
|
+
},
|
|
147
|
+
successLinkClass(index) {
|
|
148
|
+
if(this.successSteps?.includes(index + 1)) {
|
|
149
|
+
return "success"
|
|
135
150
|
}
|
|
136
151
|
return null
|
|
137
152
|
},
|
|
@@ -326,6 +341,19 @@ export default {
|
|
|
326
341
|
}
|
|
327
342
|
}
|
|
328
343
|
|
|
344
|
+
&.success {
|
|
345
|
+
.number {
|
|
346
|
+
border-color: var(--success-color);
|
|
347
|
+
color: var(--success-color);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
.active {
|
|
351
|
+
.number {
|
|
352
|
+
background: var(--success-color) !important;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
329
357
|
:is(.active, .router-link-exact-active):not(.disabled) {
|
|
330
358
|
a {
|
|
331
359
|
background: var(--button-primary-background-highlighted);
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
:multisteps="multisteps"
|
|
10
10
|
:activeStep="currentPage - 1"
|
|
11
11
|
:errorSteps="errorSteps"
|
|
12
|
+
:successSteps="successSteps"
|
|
12
13
|
@click="setCurrentPage($event.index + 1)"
|
|
13
14
|
/>
|
|
14
15
|
</slot>
|
|
@@ -56,7 +57,7 @@ export default {
|
|
|
56
57
|
return {
|
|
57
58
|
currentPage: 1,
|
|
58
59
|
statusForPages: [],
|
|
59
|
-
inputMade:
|
|
60
|
+
inputMade: [],
|
|
60
61
|
formData: {}
|
|
61
62
|
}
|
|
62
63
|
},
|
|
@@ -121,8 +122,10 @@ export default {
|
|
|
121
122
|
},
|
|
122
123
|
setErrorOnPage(page, message) {
|
|
123
124
|
const exists = this.statusForPages.some(item => item.page === page);
|
|
124
|
-
|
|
125
|
-
this.inputMade
|
|
125
|
+
|
|
126
|
+
if(!this.inputMade.includes(page)) {
|
|
127
|
+
this.inputMade.push(page)
|
|
128
|
+
}
|
|
126
129
|
|
|
127
130
|
if (!exists) {
|
|
128
131
|
this.statusForPages.push({ page: page, message: message });
|
|
@@ -130,8 +133,10 @@ export default {
|
|
|
130
133
|
},
|
|
131
134
|
removeErrorOnPage(page) {
|
|
132
135
|
const index = this.statusForPages.findIndex(item => item.page === page);
|
|
133
|
-
|
|
134
|
-
this.inputMade
|
|
136
|
+
|
|
137
|
+
if(!this.inputMade.includes(page)) {
|
|
138
|
+
this.inputMade.push(page)
|
|
139
|
+
}
|
|
135
140
|
|
|
136
141
|
if (index !== -1) {
|
|
137
142
|
this.statusForPages.splice(index, 1);
|
|
@@ -153,19 +158,36 @@ export default {
|
|
|
153
158
|
},
|
|
154
159
|
computed: {
|
|
155
160
|
atleastOnePageWithError() {
|
|
156
|
-
return this.statusForPages.length > 0 ||
|
|
161
|
+
return this.statusForPages.length > 0 || this.inputMade.length === 0
|
|
157
162
|
},
|
|
158
163
|
pageHasError() {
|
|
159
164
|
return this.statusForPages.some((item) => {
|
|
160
165
|
return item.page === this.currentPage
|
|
161
166
|
})
|
|
162
167
|
},
|
|
168
|
+
successSteps() {
|
|
169
|
+
const steps = []
|
|
170
|
+
|
|
171
|
+
if(this.inputMade.length) {
|
|
172
|
+
for(let i = 0; i < this.numberOfPages; i++) {
|
|
173
|
+
const success = !this.statusForPages.find((item) => {
|
|
174
|
+
return item.page === i + 1
|
|
175
|
+
})
|
|
176
|
+
|
|
177
|
+
// if no statusForPages is found (all pages are 'success' ant at least one input was made)
|
|
178
|
+
if(success && this.inputMade.includes(i + 1)) {
|
|
179
|
+
steps.push(i + 1)
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return steps
|
|
185
|
+
},
|
|
163
186
|
errorSteps() {
|
|
164
187
|
const steps = []
|
|
165
|
-
this.statusForPages.
|
|
188
|
+
this.statusForPages.forEach((item) => {
|
|
166
189
|
steps.push(item.page)
|
|
167
190
|
})
|
|
168
|
-
console.log("steps", steps)
|
|
169
191
|
|
|
170
192
|
return steps
|
|
171
193
|
},
|
|
@@ -211,5 +233,9 @@ export default {
|
|
|
211
233
|
</script>
|
|
212
234
|
|
|
213
235
|
<style>
|
|
214
|
-
|
|
236
|
+
.cmd-multistepform-wrapper {
|
|
237
|
+
display: flex;
|
|
238
|
+
flex-direction: column;
|
|
239
|
+
gap: var(--default-gap);
|
|
240
|
+
}
|
|
215
241
|
</style>
|